diff options
author | George Hazan <george.hazan@gmail.com> | 2015-02-08 13:30:36 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2015-02-08 13:30:36 +0000 |
commit | 149298bd03dcfce00815d798c9f670e8ea24e7e0 (patch) | |
tree | f9fa1a9215fca876599e465e278afaa21b22d73e /protocols/WhatsApp/src/chat.cpp | |
parent | 8be3a7a616f0739959fb0d4f5266973510bd4142 (diff) |
support for private messages in chats
git-svn-id: http://svn.miranda-ng.org/main/trunk@12055 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/WhatsApp/src/chat.cpp')
-rw-r--r-- | protocols/WhatsApp/src/chat.cpp | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/protocols/WhatsApp/src/chat.cpp b/protocols/WhatsApp/src/chat.cpp index 28f0629f9b..c34f9e8e1b 100644 --- a/protocols/WhatsApp/src/chat.cpp +++ b/protocols/WhatsApp/src/chat.cpp @@ -49,10 +49,6 @@ int WhatsAppProto::onGroupChatEvent(WPARAM wParam, LPARAM lParam) return 0;
switch (gch->pDest->iType) {
- case GC_USER_LEAVE:
- case GC_SESSION_TERMINATE:
- break;
-
case GC_USER_LOGMENU:
ChatLogMenuHook(pInfo, gch);
break;
@@ -80,6 +76,20 @@ int WhatsAppProto::onGroupChatEvent(WPARAM wParam, LPARAM lParam) CODE_BLOCK_CATCH_ALL
}
break;
+
+ case GC_USER_PRIVMESS:
+ string jid = string(_T2A(gch->ptszUID)) + "@s.whatsapp.net";
+ MCONTACT hContact = ContactIDToHContact(jid);
+ if (hContact == 0) {
+ hContact = AddToContactList(jid, (char*)_T2A(gch->ptszUID));
+ setWord(hContact, "Status", ID_STATUS_ONLINE);
+
+ db_set_b(hContact, "CList", "Hidden", 1);
+ setTString(hContact, "Nick", gch->ptszUID);
+ db_set_dw(hContact, "Ignore", "Mask1", 0);
+ }
+ CallService(MS_MSG_SENDMESSAGE, hContact, 0);
+ break;
}
return 0;
@@ -160,7 +170,7 @@ void WhatsAppProto::InviteChatUser(WAChatInfo *pInfo) /////////////////////////////////////////////////////////////////////////////////////////
// nicklist menu event handler
-static gc_item sttListItems[] =
+static gc_item sttNickListItems[] =
{
{ LPGENT("&Add to roster"), IDM_ADD_RJID, MENU_POPUPITEM },
{ NULL, 0, MENU_SEPARATOR },
@@ -239,8 +249,8 @@ int WhatsAppProto::OnChatMenu(WPARAM wParam, LPARAM lParam) gcmi->Item = sttLogListItems;
}
else if (gcmi->Type == MENU_ON_NICKLIST) {
- gcmi->nItems = SIZEOF(sttListItems);
- gcmi->Item = sttListItems;
+ gcmi->nItems = SIZEOF(sttNickListItems);
+ gcmi->Item = sttNickListItems;
}
return 0;
|