diff options
author | Robert Pösel <robyer@seznam.cz> | 2014-04-21 14:50:41 +0000 |
---|---|---|
committer | Robert Pösel <robyer@seznam.cz> | 2014-04-21 14:50:41 +0000 |
commit | cdde7a98ea50cfb2c7330cd2424afb071084d21c (patch) | |
tree | 158504c9bae593c5d987c9264b0108a18b7617e1 /protocols | |
parent | 591b56b22064c79e685b02ad8df809112e0142f4 (diff) |
Facebook: Experimental support for receiving typing notifications for multi chats for more users at once
I don't know if it will work from Facebook side though. And stopped typing isn't ideal in this case.
git-svn-id: http://svn.miranda-ng.org/main/trunk@9011 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols')
-rw-r--r-- | protocols/FacebookRM/src/entities.h | 1 | ||||
-rw-r--r-- | protocols/FacebookRM/src/json.cpp | 15 |
2 files changed, 12 insertions, 4 deletions
diff --git a/protocols/FacebookRM/src/entities.h b/protocols/FacebookRM/src/entities.h index f9a8283e36..a82b0843bb 100644 --- a/protocols/FacebookRM/src/entities.h +++ b/protocols/FacebookRM/src/entities.h @@ -91,6 +91,7 @@ struct facebook_chatroom std::map<std::string, std::string> participants;
std::string message_readers;
+ std::string message_typers;
DWORD last_active;
};
diff --git a/protocols/FacebookRM/src/json.cpp b/protocols/FacebookRM/src/json.cpp index 743d2380bd..df58d2d5f3 100644 --- a/protocols/FacebookRM/src/json.cpp +++ b/protocols/FacebookRM/src/json.cpp @@ -639,14 +639,21 @@ int facebook_json_parser::parse_messages(void* data, std::vector< facebook_messa participant = chatroom->second.participants.find(from_id);
if (participant != chatroom->second.participants.end()) {
MCONTACT hChatContact = proto->ChatIDToHContact(tid);
- ptrT name(mir_utf8decodeT(participant->second.c_str()));
+
+ if (!chatroom->second.message_typers.empty())
+ chatroom->second.message_typers += ", ";
+ chatroom->second.message_typers += participant->second.c_str();
+
+ ptrT typers(mir_utf8decodeT(chatroom->second.message_typers.c_str()));
TCHAR tstr[200];
- if (json_as_int(st_) == 1)
- mir_sntprintf(tstr, SIZEOF(tstr), TranslateT("%s is typing a message..."), name);
- else
+ if (json_as_int(st_) == 1) {
+ mir_sntprintf(tstr, SIZEOF(tstr), TranslateT("%s is typing a message..."), typers);
+ } else {
+ chatroom->second.message_typers = "";
mir_sntprintf(tstr, SIZEOF(tstr), _T(""));
+ }
// TODO: support proper MS_PROTO_CONTACTISTYPING service for chatrooms (when it will be implemented)
CallService(MS_MSG_SETSTATUSTEXT, (WPARAM)hChatContact, (LPARAM)tstr);
|