diff options
-rw-r--r-- | include/m_chat_int.h | 5 | ||||
-rw-r--r-- | libs/win32/mir_app.lib | bin | 220308 -> 220498 bytes | |||
-rw-r--r-- | libs/win64/mir_app.lib | bin | 216164 -> 216334 bytes | |||
-rw-r--r-- | protocols/WhatsAppWeb/src/proto.h | 16 | ||||
-rw-r--r-- | protocols/WhatsAppWeb/src/server.cpp | 20 | ||||
-rw-r--r-- | protocols/WhatsAppWeb/src/stdafx.h | 2 | ||||
-rw-r--r-- | src/mir_app/src/chat_svc.cpp | 5 | ||||
-rw-r--r-- | src/mir_app/src/mir_app.def | 1 | ||||
-rw-r--r-- | src/mir_app/src/mir_app64.def | 1 |
9 files changed, 34 insertions, 16 deletions
diff --git a/include/m_chat_int.h b/include/m_chat_int.h index 5a499afb18..434f93a5c3 100644 --- a/include/m_chat_int.h +++ b/include/m_chat_int.h @@ -389,8 +389,11 @@ EXTERN_C MIR_APP_DLL(UINT) Chat_CreateMenu(HWND hwnd, HMENU hMenu, POINT pt, SES // calculates width or height of a string
EXTERN_C MIR_APP_DLL(int) Chat_GetTextPixelSize(const wchar_t *pszText, HFONT hFont, bool bWidth);
-// creates a default description of a groupchat event
+// creates a default description of a group chat event
// returns true if lin->ptszText is already utilized, you need to add it manually then otherwise
EXTERN_C MIR_APP_DLL(bool) Chat_GetDefaultEventDescr(const SESSION_INFO *si, const LOGINFO *lin, CMStringW &res);
+// sets mute mode for a group chat
+EXTERN_C MIR_APP_DLL(void) Chat_Mute(SESSION_INFO *si, int mode);
+
#endif // M_CHAT_INT_H__
diff --git a/libs/win32/mir_app.lib b/libs/win32/mir_app.lib Binary files differindex a470d81fbd..05fbbdb7dd 100644 --- a/libs/win32/mir_app.lib +++ b/libs/win32/mir_app.lib diff --git a/libs/win64/mir_app.lib b/libs/win64/mir_app.lib Binary files differindex 8e219531ec..84938a21af 100644 --- a/libs/win64/mir_app.lib +++ b/libs/win64/mir_app.lib diff --git a/protocols/WhatsAppWeb/src/proto.h b/protocols/WhatsAppWeb/src/proto.h index 1f83c8683d..d165b43361 100644 --- a/protocols/WhatsAppWeb/src/proto.h +++ b/protocols/WhatsAppWeb/src/proto.h @@ -8,20 +8,6 @@ Copyright © 2019-21 George Hazan #if !defined(PROTO_H) #define PROTO_H -struct WAChatInfo -{ - WAChatInfo(wchar_t *_jid, wchar_t *_nick) : - tszJid(_jid), tszNick(_nick) - { - bActive = false; - } - - ptrW tszJid, tszNick, tszOwner; - bool bActive; - - MCONTACT hContact; -}; - class WhatsAppProto; typedef void (WhatsAppProto:: *WA_PKT_HANDLER)(const JSONNode &node); @@ -46,6 +32,7 @@ struct WAUser } MCONTACT hContact; + DWORD dwModifyTag; char *szId; SESSION_INFO *si = 0; }; @@ -109,6 +96,7 @@ class WhatsAppProto : public PROTO<WhatsAppProto> // binary packets void ProcessBinaryPacket(const MBinBuffer &buf); + void ProcessChats(const JSONNode &node); void ProcessContacts(const JSONNode &node); // text packets diff --git a/protocols/WhatsAppWeb/src/server.cpp b/protocols/WhatsAppWeb/src/server.cpp index 08285815c8..2668a9955a 100644 --- a/protocols/WhatsAppWeb/src/server.cpp +++ b/protocols/WhatsAppWeb/src/server.cpp @@ -435,6 +435,26 @@ void WhatsAppProto::ProcessBinaryPacket(const MBinBuffer &buf) CMStringA szType = root["type"].as_mstring(); if (szType == "contacts") ProcessContacts(root["$list$"]); + else if (szType == "chat") + ProcessChats(root["$list$"]); +} + +void WhatsAppProto::ProcessChats(const JSONNode &list) +{ + for (auto &it : list) { + CMStringW jid(it["jid"].as_mstring()); + auto *pUser = AddUser(T2Utf(jid), false); + + DWORD dwLastId = it["t"].as_int(); + setDword(pUser->hContact, "LastWriteTime", dwLastId); + + pUser->dwModifyTag = it["modify_tag"].as_int(); + + if (pUser->si) { + DWORD dwMute = _wtoi(it["mute"].as_mstring()); + Chat_Mute(pUser->si, dwMute ? CHATMODE_MUTE : CHATMODE_NORMAL); + } + } } void WhatsAppProto::ProcessContacts(const JSONNode &list) diff --git a/protocols/WhatsAppWeb/src/stdafx.h b/protocols/WhatsAppWeb/src/stdafx.h index a89e28976e..4aa4febb1a 100644 --- a/protocols/WhatsAppWeb/src/stdafx.h +++ b/protocols/WhatsAppWeb/src/stdafx.h @@ -14,7 +14,7 @@ Copyright © 2019-21 George Hazan #include <newpluginapi.h> #include <m_avatars.h> -#include <m_chat.h> +#include <m_chat_int.h> #include <m_clist.h> #include <m_contacts.h> #include <m_database.h> diff --git a/src/mir_app/src/chat_svc.cpp b/src/mir_app/src/chat_svc.cpp index c3a3f69005..c08fe1cc98 100644 --- a/src/mir_app/src/chat_svc.cpp +++ b/src/mir_app/src/chat_svc.cpp @@ -725,6 +725,11 @@ EXTERN_C MIR_APP_DLL(void) Chat_UpdateOptions() si->pDlg->UpdateOptions();
}
+EXTERN_C MIR_APP_DLL(void) Chat_Mute(SESSION_INFO *si, int mode)
+{
+ db_set_b(si->hContact, "SRMM", "MuteMode", mode);
+}
+
/////////////////////////////////////////////////////////////////////////////////////////
// module initialization
diff --git a/src/mir_app/src/mir_app.def b/src/mir_app/src/mir_app.def index c86156eb00..a73b840389 100644 --- a/src/mir_app/src/mir_app.def +++ b/src/mir_app/src/mir_app.def @@ -777,3 +777,4 @@ _Netlib_GetTlsUnique@8 @831 NONAME ?Upgrade@DB@@YGPAVMDatabaseCommon@@PB_W@Z @865 NONAME
?IsPluginOnWhiteList@@YG_NPBD@Z @866 NONAME
?SetPluginOnWhiteList@@YGXPBD_N@Z @867 NONAME
+Chat_Mute @868
diff --git a/src/mir_app/src/mir_app64.def b/src/mir_app/src/mir_app64.def index ab19f1360a..eac93a9a4c 100644 --- a/src/mir_app/src/mir_app64.def +++ b/src/mir_app/src/mir_app64.def @@ -777,3 +777,4 @@ Netlib_GetTlsUnique @831 NONAME ?Upgrade@DB@@YAPEAVMDatabaseCommon@@PEB_W@Z @865 NONAME
?IsPluginOnWhiteList@@YA_NPEBD@Z @866 NONAME
?SetPluginOnWhiteList@@YAXPEBD_N@Z @867 NONAME
+Chat_Mute @868
|