Author: mir3x
Date: Sun Nov  1 18:56:01 2015
New Revision: 30357

URL: http://svn.gna.org/viewcvs/freeciv?rev=30357&view=rev
Log:
Changed all html tags <Yxx> in chat output (usually player nicknames were 
treated as html) 
to non-html tags [Yxx] if Y is uppercase letter in Qt-client.

See patch #6505


Modified:
    branches/S2_6/client/gui-qt/chatline.cpp

Modified: branches/S2_6/client/gui-qt/chatline.cpp
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/gui-qt/chatline.cpp?rev=30357&r1=30356&r2=30357&view=diff
==============================================================================
--- branches/S2_6/client/gui-qt/chatline.cpp    (original)
+++ branches/S2_6/client/gui-qt/chatline.cpp    Sun Nov  1 18:56:01 2015
@@ -390,6 +390,7 @@
 static QString replace_html(QString str)
 {
   QString s, s2;
+  int i, j;
   conn_list_iterate(game.all_connections, pconn){
     s = pconn->username;
     s = "<(" + s + ")>";
@@ -420,6 +421,24 @@
       str = str.replace(s, s2);
     }
   } players_iterate_end;
+  /* replace all <X...> where X is uppercase letter
+   * with [X ....], its definitely message from server
+   * not html tag */
+  j = 0;
+  while (1) {
+    QChar c;
+    i = str.indexOf('<', j);
+    j = str.indexOf('>', i);
+    if (i + 1 >= str.length() || i == -1 || j == -1) {
+      break;
+    }
+    c = str.at(i + 1);
+    if (c.isUpper()) {
+      str.replace(i, 1 , '[');
+      str.replace(j, 1 , ']');
+    }
+    j++;
+  }
   return str;
 }
 


_______________________________________________
Freeciv-commits mailing list
Freeciv-commits@gna.org
https://mail.gna.org/listinfo/freeciv-commits

Reply via email to