summaryrefslogtreecommitdiff
path: root/protocols/IcqOscarJ
diff options
context:
space:
mode:
Diffstat (limited to 'protocols/IcqOscarJ')
-rw-r--r--protocols/IcqOscarJ/src/icq_servlist.cpp52
-rw-r--r--protocols/IcqOscarJ/src/init.cpp3
2 files changed, 15 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;
}
diff --git a/protocols/IcqOscarJ/src/init.cpp b/protocols/IcqOscarJ/src/init.cpp
index ab4bae973a..b2bf2bbc7e 100644
--- a/protocols/IcqOscarJ/src/init.cpp
+++ b/protocols/IcqOscarJ/src/init.cpp
@@ -32,6 +32,7 @@
HINSTANCE hInst;
int hLangpack;
+CLIST_INTERFACE *pcli;
IcqIconHandle hStaticIcons[4];
HANDLE hExtraXStatus;
@@ -85,6 +86,8 @@ extern "C" int __declspec(dllexport) Load(void)
srand(time(NULL));
_tzset();
+ pcli = (CLIST_INTERFACE*)CallService(MS_CLIST_RETRIEVE_INTERFACE, 0, (LPARAM)hInst);
+
// Register the module
PROTOCOLDESCRIPTOR pd = {0};
pd.cbSize = sizeof(pd);