| 
					
				 | 
			
			
				@@ -14,6 +14,10 @@ class Session; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 #define MAX_BUFFER 256 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+#include <functional> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+typedef std::function<void(const std::string &)> StringFunc; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 /* 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 The Session: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -24,10 +28,16 @@ public: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   Session(boost::asio::ip::tcp::socket socket, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           boost::asio::io_service &io_service, std::string hostname, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           std::string port); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  void start(void); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   ~Session(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  void start(void); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  const std::string &get_prompt(void); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  void to_client(const std::string &message); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  void to_server(const std::string &message); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+private: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   void parse_auth(void); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   void on_connect(const boost::system::error_code error); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -37,16 +47,12 @@ public: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   void client_read(void); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   void client_input(const std::string &input); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  void to_client(const std::string &message); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  void to_server(const std::string &message); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   void on_shutdown(boost::system::error_code ec); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   void dispatch_line(std::string line); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   void process_lines(std::string &received); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  const std::string & get_prompt(void); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 private: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   void set_timer(void); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   void reset_timer(void); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -91,7 +97,7 @@ private: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   boost::asio::high_resolution_timer timer_; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    * Keep connection alive, don't timeout. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-   *  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+   * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    * This gets set by to_server config[keepalive], and sends a 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    * space ' ' if we haven't sent anything to the server in that 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    * many seconds. 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -140,7 +146,7 @@ private: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   std::string host; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   std::string port; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   char game = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-   
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    * Are we connected to the server? 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    * 
			 |