summaryrefslogtreecommitdiff
path: root/protocols/FacebookRM
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2017-08-15 13:49:37 +0300
committerGeorge Hazan <ghazan@miranda.im>2017-08-15 13:49:37 +0300
commitf52b5cc86d9eff2494902157c8fc0a4e019a3c95 (patch)
tree9f668bf7b89decd53757589d74e476aac81eb451 /protocols/FacebookRM
parentd05dd78157058eea348f0d7666c7c6b0570ef25b (diff)
fixes #799 (Crash on receiving msg in FB group chat)
Diffstat (limited to 'protocols/FacebookRM')
-rw-r--r--protocols/FacebookRM/src/communication.cpp2
-rw-r--r--protocols/FacebookRM/src/json.cpp11
-rw-r--r--protocols/FacebookRM/src/proto.cpp18
3 files changed, 11 insertions, 20 deletions
diff --git a/protocols/FacebookRM/src/communication.cpp b/protocols/FacebookRM/src/communication.cpp
index 712c5daaf6..514ab9ccef 100644
--- a/protocols/FacebookRM/src/communication.cpp
+++ b/protocols/FacebookRM/src/communication.cpp
@@ -388,7 +388,7 @@ void facebook_client::erase_reader(MCONTACT hContact)
parent->delSetting(hContact, FACEBOOK_KEY_MESSAGE_READ);
readers.erase(hContact);
- CallService(MS_MSG_SETSTATUSTEXT, (WPARAM)hContact);
+ Srmm_SetStatusText(hContact, nullptr);
}
void loginError(FacebookProto *proto, std::string error_str) {
diff --git a/protocols/FacebookRM/src/json.cpp b/protocols/FacebookRM/src/json.cpp
index 90ed0dd3cf..66254354b2 100644
--- a/protocols/FacebookRM/src/json.cpp
+++ b/protocols/FacebookRM/src/json.cpp
@@ -835,12 +835,10 @@ int facebook_json_parser::parse_messages(std::string *pData, std::vector<faceboo
MCONTACT hChatContact = proto->ChatIDToHContact(tid);
ptrW name(mir_utf8decodeW(participant->second.nick.c_str()));
- if (st_.as_int() == 1) {
- StatusTextData st = { 0 };
- mir_snwprintf(st.tszText, TranslateT("%s is typing a message..."), name);
- CallService(MS_MSG_SETSTATUSTEXT, (WPARAM)hChatContact, (LPARAM)&st);
- }
- else CallService(MS_MSG_SETSTATUSTEXT, (WPARAM)hChatContact);
+ if (st_.as_int() == 1)
+ Srmm_SetStatusText(hChatContact, CMStringW(FORMAT, TranslateT("%s is typing a message..."), name));
+ else
+ Srmm_SetStatusText(hChatContact, nullptr);
// TODO: support proper MS_PROTO_CONTACTISTYPING service for chatrooms (when it will be implemented)
}
@@ -1459,4 +1457,3 @@ int facebook_json_parser::parse_messages_count(std::string *data, int *messagesC
return EXIT_SUCCESS;
}
-
diff --git a/protocols/FacebookRM/src/proto.cpp b/protocols/FacebookRM/src/proto.cpp
index c43f9c8d4c..0490710df1 100644
--- a/protocols/FacebookRM/src/proto.cpp
+++ b/protocols/FacebookRM/src/proto.cpp
@@ -1145,19 +1145,13 @@ void FacebookProto::MessageRead(MCONTACT hContact)
wchar_t ttime[64];
wcsftime(ttime, _countof(ttime), L"%X", localtime(&time));
- StatusTextData st = { 0 };
- st.hIcon = IcoLib_GetIconByHandle(GetIconHandle("read"));
+ HICON hIcon = IcoLib_GetIconByHandle(GetIconHandle("read"));
if (isChatRoom(hContact)) {
- // FIXME: Remove this condition when #799 is fixed
- if (!getBool("NoChatMessageReadNotify")) {
- // Load readers names
- ptrW treaders(getWStringA(hContact, FACEBOOK_KEY_MESSAGE_READERS));
- mir_snwprintf(st.tszText, TranslateT("Message read: %s by %s"), ttime, treaders ? treaders : L"???");
- CallService(MS_MSG_SETSTATUSTEXT, (WPARAM)hContact, (LPARAM)&st);
- }
- } else if (!ServiceExists(MS_MESSAGESTATE_UPDATE)){
- mir_snwprintf(st.tszText, TranslateT("Message read: %s"), ttime);
- CallService(MS_MSG_SETSTATUSTEXT, (WPARAM)hContact, (LPARAM)&st);
+ // Load readers names
+ ptrW treaders(getWStringA(hContact, FACEBOOK_KEY_MESSAGE_READERS));
+ Srmm_SetStatusText(hContact, CMStringW(FORMAT, TranslateT("Message read: %s by %s"), ttime, treaders ? treaders : L"???"), hIcon);
}
+ else if (!ServiceExists(MS_MESSAGESTATE_UPDATE))
+ Srmm_SetStatusText(hContact, CMStringW(FORMAT, TranslateT("Message read: %s"), ttime), hIcon);
}