qmlFrontend/hwengine.cpp
branchqmlfrontend
changeset 11428 e045dc60c37e
parent 11427 c6c6a4b32cea
child 11429 86c13e5662f1
--- a/qmlFrontend/hwengine.cpp	Sat Nov 21 12:40:33 2015 +0300
+++ b/qmlFrontend/hwengine.cpp	Sat Nov 21 17:07:06 2015 +0300
@@ -37,6 +37,7 @@
     connectOfficialServer_t * flibConnectOfficialServer;
     passNetData_t * flibPassNetData;
     sendChatLine_t * flibSendChatLine;
+    joinRoom_t * flibJoinRoom;
 }
 
 Q_DECLARE_METATYPE(MessageType);
@@ -84,6 +85,7 @@
     flibConnectOfficialServer = (connectOfficialServer_t*) hwlib.resolve("connectOfficialServer");
     flibPassNetData = (passNetData_t*) hwlib.resolve("passNetData");
     flibSendChatLine = (sendChatLine_t*) hwlib.resolve("sendChatLine");
+    flibJoinRoom = (joinRoom_t*) hwlib.resolve("joinRoom");
 
     flibInit("/usr/home/unC0Rr/Sources/Hedgewars/Hedgewars-GC/share/hedgewars/Data", "/usr/home/unC0Rr/.hedgewars");
     flibRegisterUIMessagesCallback(this, &guiMessagesCallback);
@@ -191,7 +193,8 @@
         break;
     }
     case MSG_REMOVELOBBYCLIENT: {
-        emit lobbyClientRemoved(QString::fromUtf8(msg));
+        QStringList l = QString::fromUtf8(msg).split('\n');
+        emit lobbyClientRemoved(l[0], l[1]);
         break;
     }
     case MSG_LOBBYCHATLINE: {
@@ -213,6 +216,14 @@
         emit roomRemoved(QString::fromUtf8(msg));
         break;
     }
+    case MSG_ERROR: {
+        emit errorMessage(QString::fromUtf8(msg));
+        break;
+    }
+    case MSG_WARNING: {
+        emit warningMessage(QString::fromUtf8(msg));
+        break;
+    }
     }
 }
 
@@ -294,6 +305,11 @@
     flibSendChatLine(msg.toUtf8().constData());
 }
 
+void HWEngine::joinRoom(const QString &roomName)
+{
+    flibJoinRoom(roomName.toUtf8().constData());
+}
+
 void HWEngine::setTheme(const QString &theme)
 {
     flibSetTheme(theme.toUtf8().constData());