diff options
author | George Hazan <george.hazan@gmail.com> | 2013-09-07 12:09:27 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2013-09-07 12:09:27 +0000 |
commit | 03a0b643b94d5aa7f9c129fe73eea314d099cf56 (patch) | |
tree | 221081ffe0602905765815d302b02d1f761cf100 /protocols/IcqOscarJ | |
parent | 0ac4b544972fb011e7c7c69e60a1d5d180ada0ac (diff) |
shameful end of the group processing zoo, part 1
git-svn-id: http://svn.miranda-ng.org/main/trunk@5994 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/IcqOscarJ')
-rw-r--r-- | protocols/IcqOscarJ/src/icq_proto.h | 1 | ||||
-rw-r--r-- | protocols/IcqOscarJ/src/icq_servlist.cpp | 49 |
2 files changed, 6 insertions, 44 deletions
diff --git a/protocols/IcqOscarJ/src/icq_proto.h b/protocols/IcqOscarJ/src/icq_proto.h index af852a7b8f..98dfb90c1c 100644 --- a/protocols/IcqOscarJ/src/icq_proto.h +++ b/protocols/IcqOscarJ/src/icq_proto.h @@ -678,7 +678,6 @@ struct CIcqProto : public PROTO<CIcqProto> void resetServContactAuthState(HANDLE hContact, DWORD dwUin);
void FlushSrvGroupsCache();
- int getCListGroupHandle(const char *szGroup);
int getCListGroupExists(const char *szGroup);
int moveContactToCListGroup(HANDLE hContact, const char *szGroup); /// TODO: this should be DB function
diff --git a/protocols/IcqOscarJ/src/icq_servlist.cpp b/protocols/IcqOscarJ/src/icq_servlist.cpp index 7110e3ea2e..3d5c88e85d 100644 --- a/protocols/IcqOscarJ/src/icq_servlist.cpp +++ b/protocols/IcqOscarJ/src/icq_servlist.cpp @@ -1571,40 +1571,6 @@ void CIcqProto::setServListGroupLinkID(const char *szPath, WORD wGroupID) db_unset(NULL, szModule, szPath);
}
-
-// this function takes all backslashes in szGroup as group-level separators
-int CIcqProto::getCListGroupHandle(const char *szGroup)
-{
- char *pszGroup = (char*)szGroup;
- int hParentGroup = 0, hGroup = 0;
-
- if (!strlennull(szGroup)) return 0; // no group
-
- if (strrchr(szGroup, '\\'))
- { // create parent group
- char *szSeparator = (char*)strrchr(szGroup, '\\');
-
- *szSeparator = '\0';
- hParentGroup = getCListGroupHandle(szGroup);
- *szSeparator = '\\';
- // take only sub-group name
- pszGroup = ++szSeparator;
- }
-
- int size = strlennull(szGroup) + 2;
- TCHAR *tszGroup = (TCHAR*)_alloca(size * sizeof(TCHAR));
-
- if (utf8_to_tchar_static(pszGroup, tszGroup, size))
- hGroup = CallService(MS_CLIST_GROUPCREATE, hParentGroup, (LPARAM)tszGroup); // 0.7+
-
-#ifdef _DEBUG
- NetLog_Server("Obtained CList group \"%s\" handle %x", szGroup, hGroup);
-#endif
-
- return hGroup;
-}
-
-
// determine if the specified clist group path exists
//!! this function is not thread-safe due to the use of cli->pfnGetGroupName()
int CIcqProto::getCListGroupExists(const char *szGroup)
@@ -1612,7 +1578,6 @@ int CIcqProto::getCListGroupExists(const char *szGroup) if (!szGroup)
return 0;
- int hGroup = 0;
int size = strlennull(szGroup) + 2;
TCHAR *tszGroup = (TCHAR*)_alloca(size * sizeof(TCHAR));
@@ -1622,23 +1587,21 @@ int CIcqProto::getCListGroupExists(const char *szGroup) if (!tszGroupName)
break;
- if (!_tcscmp(tszGroup, tszGroupName)) {
- // we have found the group
- hGroup = i;
- break;
- }
+ // we have found the group
+ if (!_tcscmp(tszGroup, tszGroupName))
+ return i;
}
- return hGroup;
+ return 0;
}
int CIcqProto::moveContactToCListGroup(HANDLE hContact, const char *szGroup)
{
- int hGroup = getCListGroupHandle(szGroup);
+ HANDLE hGroup = Clist_CreateGroup(0, _A2T(szGroup));
if (ServiceExists(MS_CLIST_CONTACTCHANGEGROUP))
- return CallService(MS_CLIST_CONTACTCHANGEGROUP, (WPARAM)hContact, hGroup);
+ return CallService(MS_CLIST_CONTACTCHANGEGROUP, (WPARAM)hContact, (LPARAM)hGroup);
else /// TODO: is this neccessary ?
return db_set_utf(hContact, "CList", "Group", szGroup);
}
|