diff options
author | George Hazan <george.hazan@gmail.com> | 2012-11-04 19:54:17 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2012-11-04 19:54:17 +0000 |
commit | 21bc5f8f834fd4cf2b961264c2f258f6f3dd09e3 (patch) | |
tree | 595833a1765327090d80a6276d7ad02ce934540c /protocols/IcqOscarJ/src/icq_servlist.cpp | |
parent | e32deeef116280a7646a5acca0eb2eb57dc0e776 (diff) |
replacement for the old clist interface code
git-svn-id: http://svn.miranda-ng.org/main/trunk@2192 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/IcqOscarJ/src/icq_servlist.cpp')
-rw-r--r-- | protocols/IcqOscarJ/src/icq_servlist.cpp | 52 |
1 files changed, 12 insertions, 40 deletions
diff --git a/protocols/IcqOscarJ/src/icq_servlist.cpp b/protocols/IcqOscarJ/src/icq_servlist.cpp index 4afdeae7e4..ee0355443a 100644 --- a/protocols/IcqOscarJ/src/icq_servlist.cpp +++ b/protocols/IcqOscarJ/src/icq_servlist.cpp @@ -1609,53 +1609,25 @@ int CIcqProto::getCListGroupHandle(const char *szGroup) //!! this function is not thread-safe due to the use of cli->pfnGetGroupName()
int CIcqProto::getCListGroupExists(const char *szGroup)
{
- int hGroup = 0;
- CLIST_INTERFACE *clint = NULL;
-
- if (!szGroup) return 0;
-
- if (ServiceExists(MS_CLIST_RETRIEVE_INTERFACE))
- clint = (CLIST_INTERFACE*)CallService(MS_CLIST_RETRIEVE_INTERFACE, 0, 0);
-
- if (clint && clint->version >= 1)
- { // we've got clist interface, use it
- int size = strlennull(szGroup) + 2;
- TCHAR *tszGroup = (TCHAR*)_alloca(size * sizeof(TCHAR));
-
- if (utf8_to_tchar_static(szGroup, tszGroup, size))
- for (int i = 1; TRUE; i++)
- {
- TCHAR *tszGroupName = (TCHAR*)clint->pfnGetGroupName(i, NULL);
-
- if (!tszGroupName) break;
-
- if (!_tcscmp(tszGroup, tszGroupName))
- { // we have found the group
- hGroup = i;
- break;
- }
- }
- }
- else
- { // old ansi version - no other way
- int size = strlennull(szGroup) + 2;
- char *aszGroup = (char*)_alloca(size);
-
- utf8_decode_static(szGroup, aszGroup, size);
+ if (!szGroup)
+ return 0;
- for (int i = 1; TRUE; i++)
- {
- char *paszGroup = (char*)CallService(MS_CLIST_GROUPGETNAME, i, 0);
+ int hGroup = 0;
+ int size = strlennull(szGroup) + 2;
+ TCHAR *tszGroup = (TCHAR*)_alloca(size * sizeof(TCHAR));
- if (!paszGroup) break;
+ if (utf8_to_tchar_static(szGroup, tszGroup, size))
+ for (int i = 1; TRUE; i++) {
+ TCHAR *tszGroupName = (TCHAR*)pcli->pfnGetGroupName(i, NULL);
+ if (!tszGroupName)
+ break;
- if (!strcmpnull(aszGroup, paszGroup))
- { // we found the group
+ if (!_tcscmp(tszGroup, tszGroupName)) {
+ // we have found the group
hGroup = i;
break;
}
}
- }
return hGroup;
}
|