diff options
Diffstat (limited to 'protocols/MRA/src/Mra_svcs.cpp')
-rw-r--r-- | protocols/MRA/src/Mra_svcs.cpp | 30 |
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;
}
|