summaryrefslogtreecommitdiff
path: root/protocols
diff options
context:
space:
mode:
Diffstat (limited to 'protocols')
-rw-r--r--protocols/FacebookRM/src/communication.cpp2
-rw-r--r--protocols/FacebookRM/src/json.cpp11
-rw-r--r--protocols/FacebookRM/src/proto.cpp18
-rw-r--r--protocols/Omegle/src/communication.cpp26
-rw-r--r--protocols/Omegle/src/connection.cpp2
-rw-r--r--protocols/VKontakte/src/misc.cpp5
-rw-r--r--protocols/VKontakte/src/vk_chats.cpp12
-rw-r--r--protocols/WhatsApp/src/utils.cpp11
8 files changed, 29 insertions, 58 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);
}
diff --git a/protocols/Omegle/src/communication.cpp b/protocols/Omegle/src/communication.cpp
index 527a42705f..65baff0dee 100644
--- a/protocols/Omegle/src/communication.cpp
+++ b/protocols/Omegle/src/communication.cpp
@@ -552,28 +552,22 @@ bool Omegle_client::events()
// Stranger is typing, not supported by chat module yet
SkinPlaySound("StrangerTyp");
- StatusTextData st = { 0 };
- st.hIcon = IcoLib_GetIconByHandle(GetIconHandle("typing_on"));
-
ptrW who(name == "spyTyping" ? json_as_string(json_at(item, 1)) : mir_wstrdup(L"Stranger"));
- mir_snwprintf(st.tszText, TranslateT("%s is typing."), TranslateW(who));
-
- CallService(MS_MSG_SETSTATUSTEXT, (WPARAM)parent->GetChatHandle(), (LPARAM)&st);
+ Srmm_SetStatusText(parent->GetChatHandle(),
+ CMStringW(FORMAT, TranslateT("%s is typing."), TranslateW(who)),
+ IcoLib_GetIconByHandle(GetIconHandle("typing_on")));
}
else if (name == "stoppedTyping" || name == "spyStoppedTyping") {
// Stranger stopped typing, not supported by chat module yet
SkinPlaySound("StrangerTypStop");
- StatusTextData st = { 0 };
- st.hIcon = IcoLib_GetIconByHandle(GetIconHandle("typing_off"));
-
ptrW who(name == "spyTyping" ? json_as_string(json_at(item, 1)) : mir_wstrdup(L"Stranger"));
- mir_snwprintf(st.tszText, TranslateT("%s stopped typing."), TranslateW(who));
-
- CallService(MS_MSG_SETSTATUSTEXT, (WPARAM)parent->GetChatHandle(), (LPARAM)&st);
+ Srmm_SetStatusText(parent->GetChatHandle(),
+ CMStringW(FORMAT, TranslateT("%s stopped typing."), TranslateW(who)),
+ IcoLib_GetIconByHandle(GetIconHandle("typing_off")));
}
else if (name == "gotMessage") {
- CallService(MS_MSG_SETSTATUSTEXT, (WPARAM)parent->GetChatHandle(), NULL);
+ Srmm_SetStatusText(parent->GetChatHandle(), nullptr);
// Play sound as we received message
SkinPlaySound("StrangerMessage");
@@ -584,7 +578,7 @@ bool Omegle_client::events()
}
}
else if (name == "spyMessage") {
- CallService(MS_MSG_SETSTATUSTEXT, (WPARAM)parent->GetChatHandle(), NULL);
+ Srmm_SetStatusText(parent->GetChatHandle(), nullptr);
// Play sound as we received message
SkinPlaySound("StrangerMessage");
@@ -596,7 +590,7 @@ bool Omegle_client::events()
}
}
else if (name == "strangerDisconnected") {
- CallService(MS_MSG_SETSTATUSTEXT, (WPARAM)parent->GetChatHandle(), NULL);
+ Srmm_SetStatusText(parent->GetChatHandle(), nullptr);
// Stranger disconnected
if (db_get_b(NULL, parent->m_szModuleName, OMEGLE_KEY_DONT_STOP, 0))
@@ -608,7 +602,7 @@ bool Omegle_client::events()
parent->StopChat(false);
}
else if (name == "spyDisconnected") {
- CallService(MS_MSG_SETSTATUSTEXT, (WPARAM)parent->GetChatHandle(), NULL);
+ Srmm_SetStatusText(parent->GetChatHandle(), nullptr);
ptrW stranger(json_as_string(json_at(item, 1)));
diff --git a/protocols/Omegle/src/connection.cpp b/protocols/Omegle/src/connection.cpp
index 50aa33a759..361820f2b5 100644
--- a/protocols/Omegle/src/connection.cpp
+++ b/protocols/Omegle/src/connection.cpp
@@ -96,7 +96,7 @@ void OmegleProto::StopChat(bool disconnect)
SetTopic(); // reset topic content
- CallService(MS_MSG_SETSTATUSTEXT, (WPARAM)GetChatHandle(), NULL);
+ Srmm_SetStatusText(GetChatHandle(), nullptr);
}
else
{ // disconnecting or inactive
diff --git a/protocols/VKontakte/src/misc.cpp b/protocols/VKontakte/src/misc.cpp
index f91405128d..fc64fcaf8c 100644
--- a/protocols/VKontakte/src/misc.cpp
+++ b/protocols/VKontakte/src/misc.cpp
@@ -749,10 +749,7 @@ void CVkProto::SetSrmmReadStatus(MCONTACT hContact)
_wcsftime_l(ttime, _countof(ttime), L"%X - %x", localtime(&time), locale);
_free_locale(locale);
- StatusTextData st = { 0 };
- st.hIcon = IcoLib_GetIconByHandle(GetIconHandle(IDI_READMSG));
- mir_snwprintf(st.tszText, TranslateT("Message read: %s"), ttime);
- CallService(MS_MSG_SETSTATUSTEXT, (WPARAM)hContact, (LPARAM)&st);
+ Srmm_SetStatusText(hContact, CMStringW(FORMAT, TranslateT("Message read: %s"), ttime)), IcoLib_GetIconByHandle(GetIconHandle(IDI_READMSG));
}
void CVkProto::MarkDialogAsRead(MCONTACT hContact)
diff --git a/protocols/VKontakte/src/vk_chats.cpp b/protocols/VKontakte/src/vk_chats.cpp
index 46a09beb7a..19853e553d 100644
--- a/protocols/VKontakte/src/vk_chats.cpp
+++ b/protocols/VKontakte/src/vk_chats.cpp
@@ -840,9 +840,7 @@ void CVkProto::ChatContactTypingThread(void *p)
m_ChatsTyping.remove(cp);
m_ChatsTyping.insert(param);
- StatusTextData st = { 0 };
- mir_snwprintf(st.tszText, TranslateT("%s is typing a message..."), cu->m_wszNick);
- CallService(MS_MSG_SETSTATUSTEXT, (WPARAM)hChatContact, (LPARAM)&st);
+ Srmm_SetStatusText(hChatContact, CMStringW(FORMAT, TranslateT("%s is typing a message..."), cu->m_wszNick));
}
Sleep(9500);
@@ -869,13 +867,7 @@ void CVkProto::StopChatContactTyping(int iChatId, int iUserId)
if (cp != NULL && cp->m_UserId == iUserId) {
m_ChatsTyping.remove(cp);
-
- StatusTextData st = { 0 };
- mir_snwprintf(st.tszText, L" ");
- CallService(MS_MSG_SETSTATUSTEXT, (WPARAM)hChatContact, (LPARAM)&st);
-
- // After that I call standard cleaning procedure:
- CallService(MS_MSG_SETSTATUSTEXT, (WPARAM)hChatContact);
+ Srmm_SetStatusText(hChatContact, nullptr);
}
}
diff --git a/protocols/WhatsApp/src/utils.cpp b/protocols/WhatsApp/src/utils.cpp
index c0bfdfc558..7ae1c8fcfa 100644
--- a/protocols/WhatsApp/src/utils.cpp
+++ b/protocols/WhatsApp/src/utils.cpp
@@ -47,13 +47,10 @@ std::string getLastErrorMsg()
void utils::setStatusMessage(MCONTACT hContact, const wchar_t *ptszMessage)
{
- if (ptszMessage != NULL) {
- StatusTextData st = { 0 };
- st.hIcon = Skin_LoadIcon(SKINICON_EVENT_MESSAGE);
- wcsncpy_s(st.tszText, ptszMessage, _TRUNCATE);
- CallService(MS_MSG_SETSTATUSTEXT, hContact, (LPARAM)&st);
- }
- else CallService(MS_MSG_SETSTATUSTEXT, hContact, NULL);
+ if (ptszMessage != nullptr)
+ Srmm_SetStatusText(hContact, ptszMessage, Skin_LoadIcon(SKINICON_EVENT_MESSAGE));
+ else
+ Srmm_SetStatusText(hContact, nullptr);
}
BYTE* utils::md5string(const BYTE *data, int size, BYTE *digest)