diff options
author | George Hazan <george.hazan@gmail.com> | 2016-07-29 15:09:25 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2016-07-29 15:09:25 +0000 |
commit | c70673812db722c68caef569e2c299f5462b9c13 (patch) | |
tree | 3791045429b8c4ff1c9a89137762a99ca79614ff /protocols/JabberG | |
parent | 0b83e36d6c95d982924bb856d5cc27f9f5090b61 (diff) |
fix for the broken removal of orphaned contacts in Jabber
git-svn-id: http://svn.miranda-ng.org/main/trunk@17145 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/JabberG')
-rw-r--r-- | protocols/JabberG/src/jabber_iq_handlers.cpp | 1 | ||||
-rw-r--r-- | protocols/JabberG/src/jabber_iqid.cpp | 18 | ||||
-rw-r--r-- | protocols/JabberG/src/jabber_list.h | 1 | ||||
-rw-r--r-- | protocols/JabberG/src/jabber_opt.cpp | 4 |
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()
{
|