summaryrefslogtreecommitdiff
path: root/protocols/MRA/src/Mra_svcs.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2013-09-09 18:45:05 +0000
committerGeorge Hazan <george.hazan@gmail.com>2013-09-09 18:45:05 +0000
commitabb55ccf0e13f077d976777c6e16b9a7bc889821 (patch)
tree339c2e2a86269cea895a2fe8b47ff4c64bd7f387 /protocols/MRA/src/Mra_svcs.cpp
parent27ddbbb6b035d236996e52624333229e1f0b882a (diff)
- deleted groups aren't processed;
- group renaming added; - version bump git-svn-id: http://svn.miranda-ng.org/main/trunk@6036 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/MRA/src/Mra_svcs.cpp')
-rw-r--r--protocols/MRA/src/Mra_svcs.cpp30
1 files changed, 21 insertions, 9 deletions
diff --git a/protocols/MRA/src/Mra_svcs.cpp b/protocols/MRA/src/Mra_svcs.cpp
index 33c7084157..19c94f67bf 100644
--- a/protocols/MRA/src/Mra_svcs.cpp
+++ b/protocols/MRA/src/Mra_svcs.cpp
@@ -960,17 +960,29 @@ int CMraProto::OnGroupChanged(WPARAM wParam, LPARAM lParam)
HANDLE hContact = (HANDLE)wParam;
if (hContact == NULL) {
CLISTGROUPCHANGE *cgc = (CLISTGROUPCHANGE*)lParam;
- if (cgc->pszOldName != NULL && cgc->pszNewName == NULL) {
- for (int i=0; i < m_groups.getCount(); i++) {
- MraGroupItem &p = m_groups[i];
- if ( _tcscmp(p.m_name, cgc->pszOldName))
- continue;
-
- CMStringA szName = p.m_name;
- DWORD dwFlags = CONTACT_FLAG_GROUP | CONTACT_FLAG_REMOVED;
- MraModifyContact(NULL, &p.m_id, &dwFlags, 0, &szName, &p.m_name);
+ if (cgc->pszOldName == NULL)
+ return 0;
+
+ MraGroupItem *pGrp = NULL;
+ for (int i=0; i < m_groups.getCount(); i++) {
+ MraGroupItem &p = m_groups[i];
+ if ( !_tcscmp(p.m_name, cgc->pszOldName)) {
+ pGrp = &p;
+ break;
}
}
+ if (pGrp == NULL) // no MRA contacts in it
+ return 0;
+
+ DWORD dwFlags = CONTACT_FLAG_GROUP;
+ CMStringW wszGroup;
+ if (cgc->pszNewName != NULL) // renaming group
+ wszGroup = cgc->pszNewName;
+ else { // removing group
+ dwFlags |= CONTACT_FLAG_REMOVED;
+ wszGroup = cgc->pszOldName;
+ }
+ MraModifyContact(NULL, &pGrp->m_id, &dwFlags, 0, 0, &wszGroup);
}
return 0;
}