summaryrefslogtreecommitdiff
path: root/protocols/MRA
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
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')
-rw-r--r--protocols/MRA/src/Mra_functions.cpp6
-rw-r--r--protocols/MRA/src/Mra_proto.cpp6
-rw-r--r--protocols/MRA/src/Mra_svcs.cpp30
-rw-r--r--protocols/MRA/src/version.h2
4 files changed, 30 insertions, 14 deletions
diff --git a/protocols/MRA/src/Mra_functions.cpp b/protocols/MRA/src/Mra_functions.cpp
index d745d942f7..6550e5b915 100644
--- a/protocols/MRA/src/Mra_functions.cpp
+++ b/protocols/MRA/src/Mra_functions.cpp
@@ -307,6 +307,7 @@ DWORD CMraProto::MraMoveContactToGroup(HANDLE hContact, DWORD dwGroupID, LPCTSTR
break;
}
+ DWORD dwContactFlags = CONTACT_FLAG_UNICODE_NAME | CONTACT_FLAG_GROUP;
if (p == NULL) {
if (m_groups.getCount() == 20)
return 0;
@@ -316,15 +317,16 @@ DWORD CMraProto::MraMoveContactToGroup(HANDLE hContact, DWORD dwGroupID, LPCTSTR
if (m_groups.find((MraGroupItem*)&id) == NULL)
break;
- DWORD dwContactFlags = (CONTACT_FLAG_UNICODE_NAME | CONTACT_FLAG_GROUP) + (id << 24);
+ dwContactFlags |= (id << 24);
p = new MraGroupItem(id, dwContactFlags, ptszName);
m_groups.insert(p);
MraAddContact(NULL, dwContactFlags, 0, ptszName, p->m_name);
}
+ else dwContactFlags |= (p->m_id << 24);
if (dwGroupID != p->m_id) {
setDword("GroupID", p->m_id);
- MraModifyContact(hContact, 0, 0, &p->m_id);
+ MraModifyContact(hContact, 0, &dwContactFlags, &p->m_id);
}
return p->m_id;
}
diff --git a/protocols/MRA/src/Mra_proto.cpp b/protocols/MRA/src/Mra_proto.cpp
index 3a1a93ccba..39a6f8ca4c 100644
--- a/protocols/MRA/src/Mra_proto.cpp
+++ b/protocols/MRA/src/Mra_proto.cpp
@@ -1140,8 +1140,10 @@ bool CMraProto::CmdClist2(BinBuffer &buf)
// add/modify group
if (dwControlParam > 1) { // все параметры правильно инициализированны!
- m_groups.insert( new MraGroupItem(dwID, dwGroupFlags, wszGroupName));
- Clist_CreateGroup(0, wszGroupName);
+ if ( !(dwGroupFlags & CONTACT_FLAG_REMOVED)) {
+ m_groups.insert( new MraGroupItem(dwID, dwGroupFlags, wszGroupName));
+ Clist_CreateGroup(0, wszGroupName);
+ }
#ifdef _DEBUG
DebugPrintW(wszGroupName);
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;
}
diff --git a/protocols/MRA/src/version.h b/protocols/MRA/src/version.h
index 30cb871352..5553461ecd 100644
--- a/protocols/MRA/src/version.h
+++ b/protocols/MRA/src/version.h
@@ -1,7 +1,7 @@
#define __MAJOR_VERSION 2
#define __MINOR_VERSION 1
#define __RELEASE_NUM 0
-#define __BUILD_NUM 4
+#define __BUILD_NUM 5
#define __FILEVERSION_STRING __MAJOR_VERSION,__MINOR_VERSION,__RELEASE_NUM,__BUILD_NUM