From 7703c94a20e17edca4da21bc357db3116376ae6d Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 13 Feb 2015 19:15:58 +0000 Subject: fix for nick name cleaning after chat deletion git-svn-id: http://svn.miranda-ng.org/main/trunk@12101 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/WhatsApp/src/chat.cpp | 14 ++++++++++++++ protocols/WhatsApp/src/proto.cpp | 1 + protocols/WhatsApp/src/proto.h | 1 + protocols/WhatsApp/src/version.h | 2 +- 4 files changed, 17 insertions(+), 1 deletion(-) diff --git a/protocols/WhatsApp/src/chat.cpp b/protocols/WhatsApp/src/chat.cpp index 16a3da88e3..8c5d83c7bb 100644 --- a/protocols/WhatsApp/src/chat.cpp +++ b/protocols/WhatsApp/src/chat.cpp @@ -260,6 +260,20 @@ void WhatsAppProto::KickChatUser(WAChatInfo *pInfo, const TCHAR *ptszJid) m_pConnection->sendRemoveParticipants(gjid, jids); } +///////////////////////////////////////////////////////////////////////////////////////// +// Leave groupchat emulator for contact's deletion + +int WhatsAppProto::OnDeleteChat(WPARAM hContact, LPARAM lParam) +{ + if (isChatRoom(hContact) && isOnline()) { + ptrT tszID(getTStringA(hContact, WHATSAPP_KEY_ID)); + if (tszID) + m_pConnection->sendJoinLeaveGroup(_T2A(tszID), false); + } + + return 0; +} + ///////////////////////////////////////////////////////////////////////////////////////// // handler to customize chat menus diff --git a/protocols/WhatsApp/src/proto.cpp b/protocols/WhatsApp/src/proto.cpp index b09c81fc68..aa09bbac80 100644 --- a/protocols/WhatsApp/src/proto.cpp +++ b/protocols/WhatsApp/src/proto.cpp @@ -28,6 +28,7 @@ WhatsAppProto::WhatsAppProto(const char* proto_name, const TCHAR* username) : CreateProtoService(PS_GETMYAVATART, &WhatsAppProto::GetMyAvatar); CreateProtoService(PS_SETMYAVATART, &WhatsAppProto::SetMyAvatar); + HookProtoEvent(ME_DB_CONTACT_DELETED, &WhatsAppProto::OnDeleteChat); HookProtoEvent(ME_OPT_INITIALISE, &WhatsAppProto::OnOptionsInit); HookProtoEvent(ME_CLIST_PREBUILDSTATUSMENU, &WhatsAppProto::OnBuildStatusMenu); diff --git a/protocols/WhatsApp/src/proto.h b/protocols/WhatsApp/src/proto.h index 4c1b936840..224527e800 100644 --- a/protocols/WhatsApp/src/proto.h +++ b/protocols/WhatsApp/src/proto.h @@ -136,6 +136,7 @@ public: WAChatInfo* SafeGetChat(const std::string &jid); int __cdecl onGroupChatEvent(WPARAM, LPARAM); + int __cdecl OnDeleteChat(WPARAM, LPARAM); int __cdecl OnChatMenu(WPARAM, LPARAM); INT_PTR __cdecl OnCreateGroup(WPARAM, LPARAM); diff --git a/protocols/WhatsApp/src/version.h b/protocols/WhatsApp/src/version.h index 3475fe9955..0e30475e31 100644 --- a/protocols/WhatsApp/src/version.h +++ b/protocols/WhatsApp/src/version.h @@ -1,7 +1,7 @@ #define __MAJOR_VERSION 0 #define __MINOR_VERSION 1 #define __RELEASE_NUM 2 -#define __BUILD_NUM 8 +#define __BUILD_NUM 9 #include -- cgit v1.2.3