From c3a49bd95dce1276b4b02e0c236146f2184e31cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20P=C3=B6sel?= Date: Sat, 14 Jun 2014 17:31:19 +0000 Subject: Facebook, Omegle: adapt for new MS_MSG_SETSTATUSTEXT git-svn-id: http://svn.miranda-ng.org/main/trunk@9480 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/FacebookRM/src/json.cpp | 33 +++++++++++++++++++++------------ protocols/FacebookRM/src/resource.h | 3 ++- protocols/FacebookRM/src/theme.cpp | 1 + 3 files changed, 24 insertions(+), 13 deletions(-) (limited to 'protocols/FacebookRM/src') diff --git a/protocols/FacebookRM/src/json.cpp b/protocols/FacebookRM/src/json.cpp index fa021936d2..59c44a65c8 100644 --- a/protocols/FacebookRM/src/json.cpp +++ b/protocols/FacebookRM/src/json.cpp @@ -448,19 +448,24 @@ int facebook_json_parser::parse_messages(void* data, std::vector< facebook_messa ptrT readers(mir_utf8decodeT(chatroom->second.message_readers.c_str())); - TCHAR tstr[200]; - mir_sntprintf(tstr, SIZEOF(tstr), TranslateT("Message read: %s by %s"), ttime, readers); + StatusTextData st = { 0 }; + st.cbSize = sizeof(st); + st.hIcon = Skin_GetIconByHandle(GetIconHandle("read")); - CallService(MS_MSG_SETSTATUSTEXT, (WPARAM)hChatContact, (LPARAM)tstr); + mir_sntprintf(st.tszText, SIZEOF(st.tszText), TranslateT("Message read: %s by %s"), ttime, readers); + + CallService(MS_MSG_SETSTATUSTEXT, (WPARAM)hChatContact, (LPARAM)&st); } } } else { // classic contact MCONTACT hContact = proto->ContactIDToHContact(json_as_pstring(reader)); if (hContact) { - TCHAR tstr[100]; - mir_sntprintf(tstr, SIZEOF(tstr), TranslateT("Message read: %s"), ttime); + StatusTextData st = { 0 }; + st.cbSize = sizeof(st); + mir_sntprintf(st.tszText, SIZEOF(st.tszText), TranslateT("Message read: %s"), ttime); - CallService(MS_MSG_SETSTATUSTEXT, hContact, (LPARAM)tstr); + st.hIcon = Skin_GetIconByHandle(GetIconHandle("read")); + CallService(MS_MSG_SETSTATUSTEXT, (WPARAM)hContact, (LPARAM)&st); } } } else if (t == "deliver") { @@ -607,15 +612,19 @@ int facebook_json_parser::parse_messages(void* data, std::vector< facebook_messa MCONTACT hChatContact = proto->ChatIDToHContact(tid); ptrT name(mir_utf8decodeT(participant->second.c_str())); - TCHAR tstr[200]; + if (json_as_int(st_) == 1) { + StatusTextData st = { 0 }; + st.cbSize = sizeof(st); + + mir_sntprintf(st.tszText, SIZEOF(st.tszText), TranslateT("%s is typing a message..."), name); - if (json_as_int(st_) == 1) - mir_sntprintf(tstr, SIZEOF(tstr), TranslateT("%s is typing a message..."), name); - else - mir_sntprintf(tstr, SIZEOF(tstr), _T("")); + CallService(MS_MSG_SETSTATUSTEXT, (WPARAM)hChatContact, (LPARAM)&st); + } + else { + CallService(MS_MSG_SETSTATUSTEXT, (WPARAM)hChatContact, NULL); + } // TODO: support proper MS_PROTO_CONTACTISTYPING service for chatrooms (when it will be implemented) - CallService(MS_MSG_SETSTATUSTEXT, (WPARAM)hChatContact, (LPARAM)tstr); } } } else if (t == "privacy_changed") { diff --git a/protocols/FacebookRM/src/resource.h b/protocols/FacebookRM/src/resource.h index b85c308376..13646c3dfe 100644 --- a/protocols/FacebookRM/src/resource.h +++ b/protocols/FacebookRM/src/resource.h @@ -15,6 +15,7 @@ #define IDI_NEWSFEED 129 #define IDI_FRIENDS 130 #define IDI_CONVERSATION 131 +#define IDI_READ 132 #define IDC_UN 1001 #define IDC_PW 1002 #define IDC_NEWACCOUNTLINK 1003 @@ -57,7 +58,7 @@ // #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 132 +#define _APS_NEXT_RESOURCE_VALUE 133 #define _APS_NEXT_COMMAND_VALUE 40001 #define _APS_NEXT_CONTROL_VALUE 1211 #define _APS_NEXT_SYMED_VALUE 132 diff --git a/protocols/FacebookRM/src/theme.cpp b/protocols/FacebookRM/src/theme.cpp index e659319911..88b9256e81 100644 --- a/protocols/FacebookRM/src/theme.cpp +++ b/protocols/FacebookRM/src/theme.cpp @@ -33,6 +33,7 @@ static IconItem icons[] = { LPGEN("Newsfeed"), "newsfeed", IDI_NEWSFEED }, { LPGEN("Friendship details"), "friendship", IDI_FRIENDS }, { LPGEN("Conversation"), "conversation", IDI_CONVERSATION }, + { LPGEN("Message read"), "read", IDI_READ }, }; // TODO: uninit -- cgit v1.2.3