summaryrefslogtreecommitdiff
path: root/protocols/JabberG/src/jabber_proto.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2016-06-28 11:04:48 +0000
committerGeorge Hazan <george.hazan@gmail.com>2016-06-28 11:04:48 +0000
commita743c7d531c07c1fc2a778d7e15189f124aa6e48 (patch)
tree1c0d4a35b23a6e7c52eafdbba5675f9202d59f41 /protocols/JabberG/src/jabber_proto.cpp
parent7256e8b5c3967e231627ce8056fa7c44aceb3dca (diff)
Jabber:
- newly added contacts could be doubled; - code cleaning git-svn-id: http://svn.miranda-ng.org/main/trunk@17041 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/JabberG/src/jabber_proto.cpp')
-rwxr-xr-xprotocols/JabberG/src/jabber_proto.cpp33
1 files changed, 4 insertions, 29 deletions
diff --git a/protocols/JabberG/src/jabber_proto.cpp b/protocols/JabberG/src/jabber_proto.cpp
index 327415dab4..b64ac73c55 100755
--- a/protocols/JabberG/src/jabber_proto.cpp
+++ b/protocols/JabberG/src/jabber_proto.cpp
@@ -42,7 +42,7 @@ static int compareListItems(const JABBER_LIST_ITEM *p1, const JABBER_LIST_ITEM *
// for bookmarks, temporary contacts & groupchat members
// resource must be used in the comparison
- if ((p1->list == LIST_ROSTER && (p1->bUseResource == TRUE || p2->bUseResource == TRUE))
+ if ((p1->list == LIST_ROSTER && (p1->bUseResource == true || p2->bUseResource == true))
|| (p1->list == LIST_BOOKMARK) || (p1->list == LIST_VCARD_TEMP))
return mir_tstrcmpi(p1->jid, p2->jid);
@@ -299,35 +299,10 @@ MCONTACT CJabberProto::AddToListByJID(const TCHAR *newJid, DWORD flags)
{
debugLog(_T("AddToListByJID jid = %s"), newJid);
- MCONTACT hContact = HContactFromJID(newJid);
- if (hContact == NULL) {
- // not already there: add
- debugLog(_T("Add new jid to contact jid = %s"), newJid);
- hContact = (MCONTACT)CallService(MS_DB_CONTACT_ADD, 0, 0);
- Proto_AddToContact(hContact, m_szModuleName);
- setTString(hContact, "jid", newJid);
-
- // Note that by removing or disable the "NotOnList" will trigger
- // the plugin to add a particular contact to the roster list.
- // See DBSettingChanged hook at the bottom part of this source file.
- // But the add module will delete "NotOnList". So we will not do it here.
- // Also because we need "MyHandle" and "Group" info, which are set after
- // PS_ADDTOLIST is called but before the add dialog issue deletion of
- // "NotOnList".
- // If temporary add, "NotOnList" won't be deleted, and that's expected.
- db_set_b(hContact, "CList", "NotOnList", 1);
- if (flags & PALF_TEMPORARY)
- db_set_b(hContact, "CList", "Hidden", 1);
- }
- else {
- // already exist
- // Set up a dummy "NotOnList" when adding permanently only
- if (!(flags & PALF_TEMPORARY))
- db_set_b(hContact, "CList", "NotOnList", 1);
- }
+ MCONTACT hContact = DBCreateContact(newJid, NULL, true, false);
+ if (flags & PALF_TEMPORARY)
+ db_set_b(hContact, "CList", "Hidden", 1);
- if (hContact && newJid)
- DBCheckIsTransportedContact(newJid, hContact);
return hContact;
}