diff --git a/libresapi/src/api/ChatHandler.cpp b/libresapi/src/api/ChatHandler.cpp index 3944032fb..4335389df 100644 --- a/libresapi/src/api/ChatHandler.cpp +++ b/libresapi/src/api/ChatHandler.cpp @@ -837,6 +837,7 @@ void ChatHandler::handleLobbies(Request &/*req*/, Response &resp) { tick(); + { RS_STACK_MUTEX(mMtx); /********** LOCKED **********/ resp.mDataStream.getStreamToMember(); for(std::vector::iterator vit = mLobbies.begin(); vit != mLobbies.end(); ++vit) @@ -854,6 +855,7 @@ void ChatHandler::handleLobbies(Request &/*req*/, Response &resp) resp.mDataStream.getStreamToMember() << *vit << makeKeyValueReference("unread_msg_count", unread_msgs); } resp.mStateToken = mLobbiesStateToken; + } resp.setOk(); } @@ -921,6 +923,12 @@ ResponseTask* ChatHandler::handleLobbyParticipants(Request &req, Response &resp) void ChatHandler::handleMessages(Request &req, Response &resp) { + /* G10h4ck: Whithout this the request processing won't happen, copied from + * ChatHandler::handleLobbies, is this a work around or is the right whay of + * doing it? */ + tick(); + + { RS_STACK_MUTEX(mMtx); /********** LOCKED **********/ ChatId id(req.mPath.top()); // make response a list @@ -941,6 +949,7 @@ void ChatHandler::handleMessages(Request &req, Response &resp) } resp.mStateToken = mMsgStateToken; handlePaginationRequest(req, resp, mit->second); + } } void ChatHandler::handleSendMessage(Request &req, Response &resp) diff --git a/retroshare-qml-app/src/qml/ChatView.qml b/retroshare-qml-app/src/qml/ChatView.qml index 5057c9683..3194d97a8 100644 --- a/retroshare-qml-app/src/qml/ChatView.qml +++ b/retroshare-qml-app/src/qml/ChatView.qml @@ -7,11 +7,7 @@ Item id: chatView property string chatId - function refreshData() - { - rsApi.request("/statetokenservice/*") - rsApi.request("/chat/messages/"+ chatId, "", function(par) { console.log("Callback called! -> " + par.response ); chatModel.json = par.response }) - } + function refreshData() { rsApi.request("/chat/messages/"+ chatId, "", function(par) { chatModel.json = par.response }) } onFocusChanged: focus && refreshData() @@ -84,7 +80,7 @@ Item Timer { id: refreshTimer - interval: 500 + interval: 800 repeat: true onTriggered: if(chatView.visible) chatView.refreshData() Component.onCompleted: start() diff --git a/retroshare-qml-app/src/qml/Contacts.qml b/retroshare-qml-app/src/qml/Contacts.qml index b0cf5c3da..4ecd267ef 100644 --- a/retroshare-qml-app/src/qml/Contacts.qml +++ b/retroshare-qml-app/src/qml/Contacts.qml @@ -33,15 +33,15 @@ Item function refreshOwn() { rsApi.request("/identity/own", "", function(par) - { - var json = JSON.parse(par.response) - if(json.data.length > 0) - { - contactsView.own_gxs_id = json.data[0].gxs_id - contactsView.own_nick = json.data[0].name - } - else createIdentityDialog.visible = true - }) + { + var json = JSON.parse(par.response) + if(json.data.length > 0) + { + contactsView.own_gxs_id = json.data[0].gxs_id + contactsView.own_nick = json.data[0].name + } + else createIdentityDialog.visible = true + }) } onFocusChanged: focus && refreshData()