summaryrefslogtreecommitdiff
path: root/protocols/WhatsApp/src
diff options
context:
space:
mode:
Diffstat (limited to 'protocols/WhatsApp/src')
-rw-r--r--protocols/WhatsApp/src/avatars.cpp4
-rw-r--r--protocols/WhatsApp/src/proto.cpp5
-rw-r--r--protocols/WhatsApp/src/utils.cpp9
3 files changed, 7 insertions, 11 deletions
diff --git a/protocols/WhatsApp/src/avatars.cpp b/protocols/WhatsApp/src/avatars.cpp
index fd4bbfde1f..7be5b1d412 100644
--- a/protocols/WhatsApp/src/avatars.cpp
+++ b/protocols/WhatsApp/src/avatars.cpp
@@ -46,7 +46,7 @@ INT_PTR WhatsAppProto::GetAvatarInfo(WPARAM wParam, LPARAM lParam)
{
PROTO_AVATAR_INFORMATION *pai = (PROTO_AVATAR_INFORMATION*)lParam;
- ptrA jid(getStringA(pai->hContact, isChatRoom(pai->hContact) ? "ChatRoomID" : DBKEY_ID));
+ ptrA jid(getStringA(pai->hContact, DBKEY_ID));
if (jid == NULL)
return GAIR_NOAVATAR;
@@ -94,7 +94,7 @@ CMStringW WhatsAppProto::GetAvatarFileName(MCONTACT hContact)
CMStringA jid;
if (hContact != NULL) {
- ptrA szId(getStringA(hContact, isChatRoom(hContact) ? "ChatRoomID" : DBKEY_ID));
+ ptrA szId(getStringA(hContact, DBKEY_ID));
if (szId == NULL)
return L"";
diff --git a/protocols/WhatsApp/src/proto.cpp b/protocols/WhatsApp/src/proto.cpp
index 40ab1336b8..1c2e0a7142 100644
--- a/protocols/WhatsApp/src/proto.cpp
+++ b/protocols/WhatsApp/src/proto.cpp
@@ -153,10 +153,9 @@ void WhatsAppProto::OnModulesLoaded()
m_arUsers.insert(new WAUser(0, m_szJid, false));
for (auto &cc : AccContacts()) {
- bool bIsChat = isChatRoom(cc);
- CMStringA szId(getMStringA(cc, bIsChat ? "ChatRoomID" : DBKEY_ID));
+ CMStringA szId(getMStringA(cc, DBKEY_ID));
if (!szId.IsEmpty())
- m_arUsers.insert(new WAUser(cc, szId, bIsChat));
+ m_arUsers.insert(new WAUser(cc, szId, isChatRoom(cc)));
}
}
diff --git a/protocols/WhatsApp/src/utils.cpp b/protocols/WhatsApp/src/utils.cpp
index 1e2d39f553..a1d234e405 100644
--- a/protocols/WhatsApp/src/utils.cpp
+++ b/protocols/WhatsApp/src/utils.cpp
@@ -113,19 +113,16 @@ WAUser* WhatsAppProto::AddUser(const char *szId, bool bTemporary)
MCONTACT hContact = db_add_contact();
Proto_AddToContact(hContact, m_szModuleName);
+ setString(hContact, DBKEY_ID, szId);
pUser = new WAUser(hContact, mir_strdup(szId));
pUser->bIsGroupChat = WAJid(szId).isGroup();
if (pUser->bIsGroupChat) {
setByte(hContact, "ChatRoom", 1);
- setString(hContact, "ChatRoomID", szId);
- }
- else {
- setString(hContact, DBKEY_ID, szId);
- if (m_wszDefaultGroup)
- Clist_SetGroup(hContact, m_wszDefaultGroup);
}
+ else if (m_wszDefaultGroup)
+ Clist_SetGroup(hContact, m_wszDefaultGroup);
if (bTemporary)
Contact::RemoveFromList(hContact);