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/facebook_10.vcxproj | 1 + protocols/FacebookRM/facebook_10.vcxproj.filters | 3 +++ protocols/FacebookRM/facebook_12.vcxproj | 1 + protocols/FacebookRM/facebook_12.vcxproj.filters | 3 +++ protocols/FacebookRM/res/facebook.rc | 1 + protocols/FacebookRM/res/read.ico | Bin 0 -> 1150 bytes protocols/FacebookRM/src/json.cpp | 33 ++++++++++++++--------- protocols/FacebookRM/src/resource.h | 3 ++- protocols/FacebookRM/src/theme.cpp | 1 + protocols/Omegle/src/communication.cpp | 19 +++++++++++-- 10 files changed, 50 insertions(+), 15 deletions(-) create mode 100644 protocols/FacebookRM/res/read.ico diff --git a/protocols/FacebookRM/facebook_10.vcxproj b/protocols/FacebookRM/facebook_10.vcxproj index a07c0e27be..3256202fad 100644 --- a/protocols/FacebookRM/facebook_10.vcxproj +++ b/protocols/FacebookRM/facebook_10.vcxproj @@ -222,6 +222,7 @@ + diff --git a/protocols/FacebookRM/facebook_10.vcxproj.filters b/protocols/FacebookRM/facebook_10.vcxproj.filters index f0c51221bd..aceb1bb5f1 100644 --- a/protocols/FacebookRM/facebook_10.vcxproj.filters +++ b/protocols/FacebookRM/facebook_10.vcxproj.filters @@ -144,5 +144,8 @@ Resource Files\Icons + + Resource Files\Icons + \ No newline at end of file diff --git a/protocols/FacebookRM/facebook_12.vcxproj b/protocols/FacebookRM/facebook_12.vcxproj index a5bfc87310..fab3f3f641 100644 --- a/protocols/FacebookRM/facebook_12.vcxproj +++ b/protocols/FacebookRM/facebook_12.vcxproj @@ -225,6 +225,7 @@ + diff --git a/protocols/FacebookRM/facebook_12.vcxproj.filters b/protocols/FacebookRM/facebook_12.vcxproj.filters index f0c51221bd..235840f852 100644 --- a/protocols/FacebookRM/facebook_12.vcxproj.filters +++ b/protocols/FacebookRM/facebook_12.vcxproj.filters @@ -143,6 +143,9 @@ Resource Files\Icons + + + Resource Files\Icons \ No newline at end of file diff --git a/protocols/FacebookRM/res/facebook.rc b/protocols/FacebookRM/res/facebook.rc index 8fa89e9f5d..7c0961e2d3 100644 --- a/protocols/FacebookRM/res/facebook.rc +++ b/protocols/FacebookRM/res/facebook.rc @@ -58,6 +58,7 @@ IDI_NOTIFICATION ICON "notification.ico" IDI_NEWSFEED ICON "feeds.ico" IDI_FRIENDS ICON "friends.ico" IDI_CONVERSATION ICON "conversation.ico" +IDI_READ ICON "read.ico" ///////////////////////////////////////////////////////////////////////////// // diff --git a/protocols/FacebookRM/res/read.ico b/protocols/FacebookRM/res/read.ico new file mode 100644 index 0000000000..91e9b72370 Binary files /dev/null and b/protocols/FacebookRM/res/read.ico differ 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 diff --git a/protocols/Omegle/src/communication.cpp b/protocols/Omegle/src/communication.cpp index d10f335b29..c82ae24cab 100644 --- a/protocols/Omegle/src/communication.cpp +++ b/protocols/Omegle/src/communication.cpp @@ -575,7 +575,15 @@ bool Omegle_client::events( ) { // Stranger is typing, not supported by chat module yet SkinPlaySound( "StrangerTyp" ); - CallService(MS_MSG_SETSTATUSTEXT, (WPARAM)parent->GetChatHandle(), (LPARAM)TranslateT("Stranger is typing.")); + + + StatusTextData st = { 0 }; + st.cbSize = sizeof(st); + // st.hIcon = Skin_GetIconByHandle(GetIconHandle("typing_on")); // TODO: typing icon + + mir_sntprintf(st.tszText, SIZEOF(st.tszText), TranslateT("%s is typing."), TranslateT("Stranger")); + + CallService(MS_MSG_SETSTATUSTEXT, (WPARAM)parent->GetChatHandle(), (LPARAM)&st); } if ( resp.data.find( "[\"stoppedTyping\"]" ) != std::string::npos @@ -583,7 +591,14 @@ bool Omegle_client::events( ) { // Stranger stopped typing, not supported by chat module yet SkinPlaySound( "StrangerTypStop" ); - CallService(MS_MSG_SETSTATUSTEXT, (WPARAM)parent->GetChatHandle(), (LPARAM)TranslateT("Stranger stopped typing.")); + + StatusTextData st = { 0 }; + st.cbSize = sizeof(st); + // st.hIcon = Skin_GetIconByHandle(GetIconHandle("typing_off")); // TODO: typing icon + + mir_sntprintf(st.tszText, SIZEOF(st.tszText), TranslateT("%s stopped typing."), TranslateT("Stranger")); + + CallService(MS_MSG_SETSTATUSTEXT, (WPARAM)parent->GetChatHandle(), (LPARAM)&st); } pos = 0; -- cgit v1.2.3