Update userlist backend methods

parent bd7ecd37
...@@ -62,6 +62,8 @@ class JSBridge : public QObject ...@@ -62,6 +62,8 @@ class JSBridge : public QObject
void notify(QString content); void notify(QString content);
void alertmsg(QString content); void alertmsg(QString content);
void public_received(QString user, QString content); void public_received(QString user, QString content);
void updateUserList(QString user, QString utype, QString direction);
void deleteUserList();
public slots: public slots:
void pushLogin(QString username, QString password); void pushLogin(QString username, QString password);
......
...@@ -272,6 +272,7 @@ SkylivexWin::SkylivexWin(QString &htmlfile) ...@@ -272,6 +272,7 @@ SkylivexWin::SkylivexWin(QString &htmlfile)
registerHandler((QString)"alert", (SKHandlerFunction)&SkylivexWin::handle_alert); registerHandler((QString)"alert", (SKHandlerFunction)&SkylivexWin::handle_alert);
registerHandler((QString)"notify", (SKHandlerFunction)&SkylivexWin::handle_notify); registerHandler((QString)"notify", (SKHandlerFunction)&SkylivexWin::handle_notify);
registerHandler((QString)"publicchatrcv", (SKHandlerFunction)&SkylivexWin::handle_chatreceived); registerHandler((QString)"publicchatrcv", (SKHandlerFunction)&SkylivexWin::handle_chatreceived);
registerHandler((QString)"userlist", (SKHandlerFunction)&SkylivexWin::handle_userlist);
} }
...@@ -288,6 +289,7 @@ SkylivexWin::SkylivexWin() ...@@ -288,6 +289,7 @@ SkylivexWin::SkylivexWin()
registerHandler((QString)"alert", (SKHandlerFunction)&SkylivexWin::handle_alert); registerHandler((QString)"alert", (SKHandlerFunction)&SkylivexWin::handle_alert);
registerHandler((QString)"notify", (SKHandlerFunction)&SkylivexWin::handle_notify); registerHandler((QString)"notify", (SKHandlerFunction)&SkylivexWin::handle_notify);
registerHandler((QString)"publicchatrcv", (SKHandlerFunction)&SkylivexWin::handle_chatreceived); registerHandler((QString)"publicchatrcv", (SKHandlerFunction)&SkylivexWin::handle_chatreceived);
registerHandler((QString)"userlist", (SKHandlerFunction)&SkylivexWin::handle_userlist);
} }
...@@ -371,3 +373,33 @@ void SkylivexWin::handle_chatreceived(SKMessage &msg) ...@@ -371,3 +373,33 @@ void SkylivexWin::handle_chatreceived(SKMessage &msg)
} }
} }
void SkylivexWin::handle_userlist(SKMessage &msg)
{
if(msg.handle=="userlist")
{
if(msg.parameters.contains("type"))
{
if(msg.parameters["type"]=="all")
{
jsbridge->deleteUserList();
for(int i=0;i<msg.listparams["admins"].size();i++)
{
jsbridge->updateUserList(msg.listparams["admins"][i], "admin", "in");
}
for(int i=0;i<msg.listparams["enableds"].size();i++)
{
jsbridge->updateUserList(msg.listparams["enableds"][i], "enabled", "in");
}
for(int i=0;i<msg.listparams["users"].size();i++)
{
jsbridge->updateUserList(msg.listparams["users"][i], "user", "in");
}
}
else if(msg.parameters["type"]=="in" || msg.parameters["type"]=="out")
{
jsbridge->updateUserList(msg.parameters["user"], msg.parameters["usertype"], msg.parameters["type"]);
}
}
}
}
...@@ -131,6 +131,7 @@ class SkylivexWin : public WebWin ...@@ -131,6 +131,7 @@ class SkylivexWin : public WebWin
void handle_alert(SKMessage &msg); void handle_alert(SKMessage &msg);
void handle_notify(SKMessage &msg); void handle_notify(SKMessage &msg);
void handle_chatreceived(SKMessage &msg); void handle_chatreceived(SKMessage &msg);
void handle_userlist(SKMessage &msg);
private slots: private slots:
void refreshJsObject(); void refreshJsObject();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment