| 
														
															@@ -76,7 +76,7 @@ std::string clean_string(const std::string &source) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 Session::Session(boost::asio::ip::tcp::socket socket, 
														 | 
														
														 | 
														
															 Session::Session(boost::asio::ip::tcp::socket socket, 
														 | 
													
												
											
												
													
														| 
														 | 
														
															                  boost::asio::io_service &io_service, std::string hostname, 
														 | 
														
														 | 
														
															                  boost::asio::io_service &io_service, std::string hostname, 
														 | 
													
												
											
												
													
														| 
														 | 
														
															                  std::string port) 
														 | 
														
														 | 
														
															                  std::string port) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-    : socket_(std::move(socket)), io_service_{io_service}, 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    : main(this), socket_(std::move(socket)), io_service_{io_service}, 
														 | 
													
												
											
												
													
														| 
														 | 
														
															       resolver_{io_service}, server_{io_service}, prompt_timer_{io_service}, 
														 | 
														
														 | 
														
															       resolver_{io_service}, server_{io_service}, prompt_timer_{io_service}, 
														 | 
													
												
											
												
													
														| 
														 | 
														
															       keep_alive_{io_service}, host{hostname}, port{port} { 
														 | 
														
														 | 
														
															       keep_alive_{io_service}, host{hostname}, port{port} { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															   // server_sent = 0; 
														 | 
														
														 | 
														
															   // server_sent = 0; 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -111,6 +111,16 @@ Session::~Session() { BUGZ_LOG(info) << "~Session"; } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  * @return const std::string& 
														 | 
														
														 | 
														
															  * @return const std::string& 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  */ 
														 | 
														
														 | 
														
															  */ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 const std::string &Session::get_prompt(void) { return server_prompt; } 
														 | 
														
														 | 
														
															 const std::string &Session::get_prompt(void) { return server_prompt; } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+void Session::set_prompt(const std::string &prompt) { server_prompt = prompt; } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+void Session::post(notifyFunc nf) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+  if (nf) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    BUGZ_LOG(info) << "Session::post()"; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    io_service_.post(nf); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+  } else { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    BUGZ_LOG(error) << "Session::post( nullptr )"; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+  } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+} 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															 void Session::parse_auth(void) { 
														 | 
														
														 | 
														
															 void Session::parse_auth(void) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															   // how many nulls should I be seeing? 
														 | 
														
														 | 
														
															   // how many nulls should I be seeing? 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -452,9 +462,6 @@ void Session::on_resolve( 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 void Session::client_input(const std::string &input) { 
														 | 
														
														 | 
														
															 void Session::client_input(const std::string &input) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															   BUGZ_LOG(info) << "CI: " << input; 
														 | 
														
														 | 
														
															   BUGZ_LOG(info) << "CI: " << input; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-  if (emit_client_input) { 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-    emit_client_input(input); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-  } 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															   // Is "proxy" active 
														 | 
														
														 | 
														
															   // Is "proxy" active 
														 | 
													
												
											
												
													
														| 
														 | 
														
															   if (active) { 
														 | 
														
														 | 
														
															   if (active) { 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -495,6 +502,8 @@ void Session::client_input(const std::string &input) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															       if (prompt.substr(0, 9) == "Command [") { 
														 | 
														
														 | 
														
															       if (prompt.substr(0, 9) == "Command [") { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         int len = prompt.length(); 
														 | 
														
														 | 
														
															         int len = prompt.length(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         if (prompt.substr(len - 14) == "] (?=Help)? : ") { 
														 | 
														
														 | 
														
															         if (prompt.substr(len - 14) == "] (?=Help)? : ") { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+          proxy_activate(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+          /* 
														 | 
													
												
											
												
													
														| 
														 | 
														
															           to_client("\n\r\x1b[1;34mWELCOME!  This is where the proxy would " 
														 | 
														
														 | 
														
															           to_client("\n\r\x1b[1;34mWELCOME!  This is where the proxy would " 
														 | 
													
												
											
												
													
														| 
														 | 
														
															                     "activate.\n\r"); 
														 | 
														
														 | 
														
															                     "activate.\n\r"); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															           // active = true; 
														 | 
														
														 | 
														
															           // active = true; 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -503,19 +512,40 @@ void Session::client_input(const std::string &input) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															           // but we aren't activating (NNY) 
														 | 
														
														 | 
														
															           // but we aren't activating (NNY) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															           to_client(get_prompt()); 
														 | 
														
														 | 
														
															           to_client(get_prompt()); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+          */ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															           return; 
														 | 
														
														 | 
														
															           return; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         } 
														 | 
														
														 | 
														
															         } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															       } 
														 | 
														
														 | 
														
															       } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															       // eat this input. 
														 | 
														
														 | 
														
															       // eat this input. 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+      BUGZ_LOG(warning) << "CI: unable to activate, prompt was: [" << prompt 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                        << "]"; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															       return; 
														 | 
														
														 | 
														
															       return; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     } 
														 | 
														
														 | 
														
															     } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															   } 
														 | 
														
														 | 
														
															   } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															   // as the above code matures, talk_direct might get changed. 
														 | 
														
														 | 
														
															   // as the above code matures, talk_direct might get changed. 
														 | 
													
												
											
												
													
														| 
														 | 
														
															   // keep this part here (and not above). 
														 | 
														
														 | 
														
															   // keep this part here (and not above). 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-  if (talk_direct) 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+  if (talk_direct) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     to_server(input); 
														 | 
														
														 | 
														
															     to_server(input); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+  } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+  if (emit_client_input) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    emit_client_input(input); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+  } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+} 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+void Session::proxy_activate(void) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+  active = true; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+  main.setNotify([this](void) { this->proxy_deactivate(); }); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+  main.activate(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+} 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+void Session::proxy_deactivate(void) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+  // Ok, how do we return? 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+  active = false; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+  to_client(get_prompt()); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+  // to_client(" \b"); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 } 
														 | 
														
														 | 
														
															 } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															 void Session::client_read(void) { 
														 | 
														
														 | 
														
															 void Session::client_read(void) { 
														 |