Przeglądaj źródła

Merge branch 'dev' into 'master'

Issue #2

Issue #2
Luiz 10 lat temu
rodzic
commit
30d61dfc54
2 zmienionych plików z 17 dodań i 2 usunięć
  1. 4 0
      Client.cpp
  2. 13 2
      SshClient.cpp

+ 4 - 0
Client.cpp

@@ -534,7 +534,11 @@ void Client::spDetection()
 QString Client::parseNameFun(const QString &string)
 {
   QByteArray b(string.toLatin1());
+
+  // Remove normal QW colored text
   QWClient::stripColor(b.data());
+
+  // Remove new QW colored text
   QString text = QString::fromLatin1(b);
   int pos = 0;
   int index_adj;

+ 13 - 2
SshClient.cpp

@@ -111,6 +111,13 @@ void SshClient::write(const QString &data)
 }
 
 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+static const char *umlauts[4][2] = {
+  {"ü", "u"},
+  {"ä", "a"},
+  {"ö", "o"},
+  {"ß", "ss"}
+};
+
 void SshClient::parse(const QDateTime &time, const QString &command, const QString &commandData)
 {
   /* JOINED - Another user has just joined central */
@@ -170,8 +177,12 @@ void SshClient::parse(const QDateTime &time, const QString &command, const QStri
       return;
 
     int serverCount, userCount;
-
-    myApp->broadcast(a.cap(3) + " " + a.cap(5) + " - " + a.cap(4) + " : " + a.cap(6), &serverCount, &userCount);
+    // Parse umlauts
+    QString msg = a.cap(6);
+    for (int i = 0; i < 4; ++i) {
+      msg.replace(umlauts[i][0], umlauts[i][1]);
+    }
+    myApp->broadcast(a.cap(3) + " " + a.cap(5) + " - " + a.cap(4) + " : " + msg, &serverCount, &userCount);
     if(userCount)
       write("BC_RE " + a.cap(1) + " Players=" + QString::number(userCount) + ",Servers=" + QString::number(serverCount) + "\n");