QTfrontend/newnetclient.cpp
changeset 4917 8ff92bdc9f98
parent 4908 99d6797b7ff4
child 4958 84afe376a3b3
--- a/QTfrontend/newnetclient.cpp	Fri Feb 04 20:41:46 2011 +0100
+++ b/QTfrontend/newnetclient.cpp	Sat Feb 05 11:05:16 2011 +0300
@@ -312,33 +312,36 @@
         return;
     }
 
-    if (lst[0] == "READY") {
-        if(lst.size() < 2)
+    if (lst[0] == "CLIENT_FLAGS")
+    {
+        if(lst.size() < 3 || lst[1].size() < 2)
         {
-            qWarning("Net: Malformed READY message");
+            qWarning("Net: Malformed CLIENT_FLAGS message");
             return;
         }
-        for(int i = 1; i < lst.size(); ++i)
+
+        QString flags = lst[1];
+        bool setFlag = flags[0] == '+';
+
+        while(flags.size() > 1)
         {
-            if (lst[i] == mynick)
-                emit setMyReadyStatus(true);
-            emit setReadyStatus(lst[i], true);
-        }
-        return;
-    }
+            flags.remove(0, 1);
+            char c = flags[0].toAscii();
 
-    if (lst[0] == "NOT_READY") {
-        if(lst.size() < 2)
-        {
-            qWarning("Net: Malformed NOT_READY message");
-            return;
+            switch(c)
+            {
+            case 'r':
+                {
+                    for(int i = 2; i < lst.size(); ++i)
+                    {
+                        if (lst[i] == mynick)
+                            emit setMyReadyStatus(setFlag);
+                        emit setReadyStatus(lst[i], setFlag);
+                    }
+                }
+            }
         }
-        for(int i = 1; i < lst.size(); ++i)
-        {
-            if (lst[i] == mynick)
-                emit setMyReadyStatus(false);
-            emit setReadyStatus(lst[i], false);
-        }
+
         return;
     }