summaryrefslogtreecommitdiff
path: root/protocols/WhatsApp
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2015-02-09 20:32:09 +0000
committerGeorge Hazan <george.hazan@gmail.com>2015-02-09 20:32:09 +0000
commit822419030c568b40e8a7921232f74a1ecfd749ce (patch)
tree56034fa65d2dbd33386f410116ece062523ff2c0 /protocols/WhatsApp
parent047ec3257cc6e15d8e611a8c8c411894c5cced82 (diff)
small fix for the subject changing logic
git-svn-id: http://svn.miranda-ng.org/main/trunk@12074 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/WhatsApp')
-rw-r--r--protocols/WhatsApp/src/chat.cpp25
-rw-r--r--protocols/WhatsApp/src/contacts.cpp12
2 files changed, 16 insertions, 21 deletions
diff --git a/protocols/WhatsApp/src/chat.cpp b/protocols/WhatsApp/src/chat.cpp
index 7c78a1d5c4..28c20c80e8 100644
--- a/protocols/WhatsApp/src/chat.cpp
+++ b/protocols/WhatsApp/src/chat.cpp
@@ -400,20 +400,21 @@ void WhatsAppProto::onGroupNewSubject(const std::string &gjid, const std::string
return;
ptrT tszText(str2t(newSubject));
- ptrT tszTextDb(getTStringA(pInfo->hContact, "Nick"));
- ptrT tszUID(str2t(author));
- ptrT tszNick(GetChatUserNick(author));
+ ptrT tszTextDb(getTStringA(pInfo->hContact, "Topic"));
+ if (mir_tstrcmp(tszText, tszTextDb)) { // notify about subject change only if differs from the stored one
+ ptrT tszUID(str2t(author));
+ ptrT tszNick(GetChatUserNick(author));
- GCDEST gcd = { m_szModuleName, pInfo->tszJid, GC_EVENT_TOPIC };
+ GCDEST gcd = { m_szModuleName, pInfo->tszJid, GC_EVENT_TOPIC };
- GCEVENT gce = { sizeof(gce), &gcd };
- if (!mir_tstrcmp(tszText, tszTextDb)) // notify about subject change only if differs from the stored one
- gce.dwFlags = GCEF_NOTNOTIFY;
- gce.ptszUID = tszUID;
- gce.ptszNick = tszNick;
- gce.time = ts;
- gce.ptszText = tszText;
- CallServiceSync(MS_GC_EVENT, NULL, (LPARAM)&gce);
+ GCEVENT gce = { sizeof(gce), &gcd };
+ gce.dwFlags = 0;
+ gce.ptszUID = tszUID;
+ gce.ptszNick = tszNick;
+ gce.time = ts;
+ gce.ptszText = tszText;
+ CallServiceSync(MS_GC_EVENT, NULL, (LPARAM)&gce);
+ }
setTString(pInfo->hContact, "Nick", tszText);
}
diff --git a/protocols/WhatsApp/src/contacts.cpp b/protocols/WhatsApp/src/contacts.cpp
index 26e1050d9f..8ee4c0318c 100644
--- a/protocols/WhatsApp/src/contacts.cpp
+++ b/protocols/WhatsApp/src/contacts.cpp
@@ -81,16 +81,10 @@ MCONTACT WhatsAppProto::ContactIDToHContact(const std::string &phoneNumber)
void WhatsAppProto::SetAllContactStatuses(int status, bool reset_client)
{
for (MCONTACT hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) {
- if (isChatRoom(hContact))
- continue;
-
if (reset_client) {
- DBVARIANT dbv;
- if (!getTString(hContact, "MirVer", &dbv)) {
- if (_tcscmp(dbv.ptszVal, _T("WhatsApp")))
- setTString(hContact, "MirVer", _T("WhatsApp"));
- db_free(&dbv);
- }
+ ptrT tszMirVer(getTStringA(hContact, "MirVer"));
+ if (mir_tstrcmp(tszMirVer, _T("WhatsApp")))
+ setTString(hContact, "MirVer", _T("WhatsApp"));
db_set_ws(hContact, "CList", "StatusMsg", _T(""));
}