summaryrefslogtreecommitdiff
path: root/protocols/JabberG
diff options
context:
space:
mode:
Diffstat (limited to 'protocols/JabberG')
-rw-r--r--protocols/JabberG/src/jabber_iq_handlers.cpp1
-rw-r--r--protocols/JabberG/src/jabber_iqid.cpp18
-rw-r--r--protocols/JabberG/src/jabber_list.h1
-rw-r--r--protocols/JabberG/src/jabber_opt.cpp4
4 files changed, 13 insertions, 11 deletions
diff --git a/protocols/JabberG/src/jabber_iq_handlers.cpp b/protocols/JabberG/src/jabber_iq_handlers.cpp
index 301b24e15b..d9d2b471ce 100644
--- a/protocols/JabberG/src/jabber_iq_handlers.cpp
+++ b/protocols/JabberG/src/jabber_iq_handlers.cpp
@@ -260,6 +260,7 @@ BOOL CJabberProto::OnRosterPushRequest(HXML, CJabberIqInfo *pInfo)
JABBER_LIST_ITEM *item = ListAdd(LIST_ROSTER, jid, hContact);
replaceStrW(item->nick, nick);
+ item->bRealContact = true;
HXML groupNode = XmlGetChild(itemNode, "group");
replaceStrW(item->group, XmlGetText(groupNode));
diff --git a/protocols/JabberG/src/jabber_iqid.cpp b/protocols/JabberG/src/jabber_iqid.cpp
index 1f94d96dc7..186d2da1a9 100644
--- a/protocols/JabberG/src/jabber_iqid.cpp
+++ b/protocols/JabberG/src/jabber_iqid.cpp
@@ -406,13 +406,14 @@ void CJabberProto::OnIqResultGetRoster(HXML iqNode, CJabberIqInfo *pInfo)
JABBER_LIST_ITEM *item = ListAdd(LIST_ROSTER, jid, hContact);
item->subscription = sub;
+ item->bRealContact = true;
mir_free(item->nick); item->nick = nick;
HXML groupNode = XmlGetChild(itemNode, "group");
replaceStrW(item->group, XmlGetText(groupNode));
- // check group delimiters:
+ // check group delimiters
if (item->group && szGroupDelimeter) {
while (wchar_t *szPos = wcsstr(item->group, szGroupDelimeter)) {
*szPos = 0;
@@ -489,15 +490,14 @@ void CJabberProto::OnIqResultGetRoster(HXML iqNode, CJabberIqInfo *pInfo)
delete httpavatars;
// Delete orphaned contacts (if roster sync is enabled)
- if (m_options.RosterSync == TRUE) {
- for (MCONTACT hContact = db_find_first(m_szModuleName); hContact;) {
- MCONTACT hNext = db_find_next(hContact, m_szModuleName);
- ptrW jid(getWStringA(hContact, "jid"));
- if (jid != NULL && !ListGetItemPtr(LIST_ROSTER, jid)) {
- debugLogW(L"Syncing roster: preparing to delete %s (hContact=0x%x)", jid, hContact);
- CallService(MS_DB_CONTACT_DELETE, hContact, 0);
+ if (m_options.RosterSync) {
+ LISTFOREACH(i, this, LIST_ROSTER)
+ {
+ JABBER_LIST_ITEM *item = ListGetItemPtrFromIndex(i);
+ if (item && item->hContact && !item->bRealContact) {
+ debugLogW(L"Syncing roster: preparing to delete %s (hContact=0x%x)", item->jid, item->hContact);
+ CallService(MS_DB_CONTACT_DELETE, item->hContact, 0);
}
- hContact = hNext;
}
}
diff --git a/protocols/JabberG/src/jabber_list.h b/protocols/JabberG/src/jabber_list.h
index f3184582eb..d610a78cb3 100644
--- a/protocols/JabberG/src/jabber_list.h
+++ b/protocols/JabberG/src/jabber_list.h
@@ -211,6 +211,7 @@ struct JABBER_LIST_ITEM : public MZeroedObject
bool bUseResource;
bool bHistoryRead;
+ bool bRealContact;
};
/////////////////////////////////////////////////////////////////////////////////////////////
diff --git a/protocols/JabberG/src/jabber_opt.cpp b/protocols/JabberG/src/jabber_opt.cpp
index c1a9ab062b..3ad6032c0c 100644
--- a/protocols/JabberG/src/jabber_opt.cpp
+++ b/protocols/JabberG/src/jabber_opt.cpp
@@ -274,7 +274,7 @@ private:
CCtrlButton m_btnOk;
- void btnOk_OnClick(CCtrlButton *)
+ void btnOk_OnClick(CCtrlButton*)
{
if (m_bProcessStarted) {
Close();
@@ -301,7 +301,7 @@ class CCtrlEditJid : public CCtrlEdit
typedef CCtrlEdit CSuper;
public:
- CCtrlEditJid(CDlgBase* dlg, int ctrlId);
+ CCtrlEditJid(CDlgBase *dlg, int ctrlId);
void OnInit()
{