Jelajahi Sumber

MenuDispatch with server_line display code.

Steve Thielemann 3 tahun lalu
induk
melakukan
27238d8e98
1 mengubah file dengan 37 tambahan dan 0 penghapusan
  1. 37 0
      dispatchers.cpp

+ 37 - 0
dispatchers.cpp

@@ -406,6 +406,43 @@ void MenuDispatch::server_line(const std::string &line,
                                const std::string &raw_line) {
   // TODO:
   // Clear prompt, display raw server line, restore prompt.
+  if (line.empty())
+    return;
+
+  std::string temp = repr(raw_line);
+  BUGZ_LOG(fatal) << "Input:SL(" << temp << ")";
+
+  if (startswith(line, "Command [TL=")) {
+    return;
+  }
+
+  /*
+  temp = raw_line;
+  clean_string(temp);
+  BUGZ_LOG(fatal) << "InputDispatch::server_line(" << temp << ")";
+  */
+  temp = menu_prompt;
+  ansi_clean(temp);
+  size_t total = temp.length() + input.length();
+
+  to_client("\x1b[0m");  // reset colors
+  while (total > 0) {
+    to_client("\b \b");
+    --total;
+  }
+
+  // Lines line "\[[1A\[[1;36mphil \[[0;32mwarps into the sector.\[[0m"
+  temp = raw_line;
+  replace(temp, "\x1b[1A", "");
+  // replace(temp, "\x1[2J", "");
+  to_client(temp); 
+  to_client("\n\r");
+  // Doesn't matter if it is one or two calls.
+  temp = menu_prompt;
+  temp.append(input);
+  to_client(temp);
+  // to_client(prompt);
+  // to_client(input);  
 }
 
 void MenuDispatch::client_input(const std::string &cinput) {