summaryrefslogtreecommitdiff
path: root/src/modules/clist
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules/clist')
-rw-r--r--src/modules/clist/clc.cpp10
-rw-r--r--src/modules/clist/clcfiledrop.cpp2
-rw-r--r--src/modules/clist/clcitems.cpp6
-rw-r--r--src/modules/clist/clistevents.cpp16
-rw-r--r--src/modules/clist/clistmenus.cpp2
-rw-r--r--src/modules/clist/clistmod.cpp8
-rw-r--r--src/modules/clist/clistsettings.cpp4
-rw-r--r--src/modules/clist/clui.cpp2
-rw-r--r--src/modules/clist/contact.cpp6
9 files changed, 28 insertions, 28 deletions
diff --git a/src/modules/clist/clc.cpp b/src/modules/clist/clc.cpp
index 81e0fe8ce3..d05ee95686 100644
--- a/src/modules/clist/clc.cpp
+++ b/src/modules/clist/clc.cpp
@@ -93,7 +93,7 @@ static int ClcSettingChanged(WPARAM wParam, LPARAM lParam)
cli.pfnClcBroadcast(INTM_NAMEORDERCHANGED, 0, 0);
}
else {
- char *szProto = (char *) CallService(MS_PROTO_GETCONTACTBASEPROTO, wParam, 0);
+ char *szProto = GetContactProto((HANDLE)wParam);
if (szProto != NULL) {
if ( !strcmp(cws->szModule, "Protocol") && !strcmp(cws->szSetting, "p"))
cli.pfnClcBroadcast(INTM_PROTOCHANGED, wParam, lParam);
@@ -511,7 +511,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam,
HANDLE hSelItem = NULL;
ClcContact *selcontact = NULL;
- char *szProto = (char *) CallService(MS_PROTO_GETCONTACTBASEPROTO, wParam, 0);
+ char *szProto = GetContactProto((HANDLE)wParam);
if (szProto == NULL)
status = ID_STATUS_OFFLINE;
else
@@ -580,7 +580,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam,
if ( !cli.pfnFindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL))
break;
- contact->proto = (char *) CallService(MS_PROTO_GETCONTACTBASEPROTO, wParam, 0);
+ contact->proto = GetContactProto((HANDLE)wParam);
cli.pfnInvalidateDisplayNameCacheEntry((HANDLE)wParam);
lstrcpyn(contact->szText, cli.pfnGetContactDisplayName((HANDLE)wParam, 0), SIZEOF(contact->szText));
SortClcByTimer(hwnd);
@@ -606,7 +606,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam,
case INTM_APPARENTMODECHANGED:
if ( cli.pfnFindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) {
- char *szProto = (char *) CallService(MS_PROTO_GETCONTACTBASEPROTO, wParam, 0);
+ char *szProto = GetContactProto((HANDLE)wParam);
if (szProto == NULL)
break;
@@ -628,7 +628,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam,
case INTM_IDLECHANGED:
if ( cli.pfnFindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) {
- char *szProto = (char *) CallService(MS_PROTO_GETCONTACTBASEPROTO, wParam, 0);
+ char *szProto = GetContactProto((HANDLE)wParam);
if (szProto == NULL)
break;
contact->flags &= ~CONTACTF_IDLE;
diff --git a/src/modules/clist/clcfiledrop.cpp b/src/modules/clist/clcfiledrop.cpp
index 1993936a01..c33bc23334 100644
--- a/src/modules/clist/clcfiledrop.cpp
+++ b/src/modules/clist/clcfiledrop.cpp
@@ -76,7 +76,7 @@ static HANDLE HContactFromPoint(HWND hwnd, struct ClcData *dat, int x, int y, in
if (hit == -1 || !(hitFlags & (CLCHT_ONITEMLABEL | CLCHT_ONITEMICON)) || contact->type != CLCIT_CONTACT)
return NULL;
- char *szProto = (char *) CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM) contact->hContact, 0);
+ char *szProto = GetContactProto(contact->hContact);
if (szProto == NULL)
return NULL;
diff --git a/src/modules/clist/clcitems.cpp b/src/modules/clist/clcitems.cpp
index e9d280b96f..4619ba6c4b 100644
--- a/src/modules/clist/clcitems.cpp
+++ b/src/modules/clist/clcitems.cpp
@@ -184,7 +184,7 @@ int fnAddContactToGroup(struct ClcData *dat, ClcGroup *group, HANDLE hContact)
}
i = cli.pfnAddItemToGroup(group, index + 1);
- char *szProto = (char *) CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM) hContact, 0);
+ char *szProto = GetContactProto(hContact);
group->cl.items[i]->type = CLCIT_CONTACT;
group->cl.items[i]->iImage = CallService(MS_CLIST_GETCONTACTICON, (WPARAM) hContact, 0);
group->cl.items[i]->hContact = hContact;
@@ -218,7 +218,7 @@ void fnAddContactToTree(HWND hwnd, struct ClcData *dat, HANDLE hContact, int upd
DBVARIANT dbv;
DWORD style = GetWindowLongPtr(hwnd, GWL_STYLE);
WORD status = ID_STATUS_OFFLINE;
- char *szProto = (char *) CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM) hContact, 0);
+ char *szProto = GetContactProto(hContact);
dat->needsResort = 1;
if (style & CLS_NOHIDEOFFLINE)
@@ -392,7 +392,7 @@ void fnRebuildEntireList(HWND hwnd, struct ClcData *dat)
if (_tcsstr(lowered_name, lowered_search))
cli.pfnAddContactToGroup(dat, group, hContact);
} else if ( !(style & CLS_NOHIDEOFFLINE) && (style & CLS_HIDEOFFLINE || group->hideOffline)) {
- szProto = (char *) CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM) hContact, 0);
+ szProto = GetContactProto(hContact);
if (szProto == NULL) {
if ( !cli.pfnIsHiddenMode(dat, ID_STATUS_OFFLINE))
cli.pfnAddContactToGroup(dat, group, hContact);
diff --git a/src/modules/clist/clistevents.cpp b/src/modules/clist/clistevents.cpp
index 71a520b2ff..253381b4a9 100644
--- a/src/modules/clist/clistevents.cpp
+++ b/src/modules/clist/clistevents.cpp
@@ -73,7 +73,7 @@ static char * GetEventProtocol(int idx)
szProto = NULL;
}
else
- szProto = (char *) CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM) cli.events.items[idx]->cle.hContact, 0);
+ szProto = GetContactProto(cli.events.items[idx]->cle.hContact);
return szProto;
}
return NULL;
@@ -185,8 +185,8 @@ struct CListEvent* fnAddEvent(CLISTEVENT *cle)
else
szProto = NULL;
}
- else
- szProto = (char *) CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)cle->hContact, 0);
+ else szProto = GetContactProto(cle->hContact);
+
iconsOn = 1;
flashTimerId = SetTimer(NULL, 0, db_get_w(NULL, "CList", "IconFlashTime", 550), IconFlashTimer);
cli.pfnTrayIconUpdateWithImageList(p->imlIconIndex, p->cle.ptszTooltip, szProto);
@@ -214,7 +214,7 @@ int fnRemoveEvent(HANDLE hContact, HANDLE dbEvent)
return 1;
// Update contact's icon
- szProto = (char *) CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0);
+ szProto = GetContactProto(hContact);
cli.pfnChangeContactIcon(cli.events.items[i]->cle.hContact,
CallService(MS_CLIST_GETCONTACTICON, (WPARAM)cli.events.items[i]->cle.hContact, 1),
0);
@@ -228,7 +228,7 @@ int fnRemoveEvent(HANDLE hContact, HANDLE dbEvent)
for (i=0; i < cli.events.count; i++)
{
if (cli.events.items[i]->cle.hContact)
- szEventProto = (char *) CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)(cli.events.items[i]->cle.hContact), 0);
+ szEventProto = GetContactProto((cli.events.items[i]->cle.hContact));
else if (cli.events.items[i]->cle.flags&CLEF_PROTOCOLGLOBAL)
szEventProto = (char *) cli.events.items[i]->cle.lpszProtocol;
else
@@ -248,7 +248,7 @@ int fnRemoveEvent(HANDLE hContact, HANDLE dbEvent)
if (cli.events.items[0]->cle.hContact == NULL)
szProto = NULL;
else
- szProto = (char *) CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM) cli.events.items[0]->cle.hContact, 0);
+ szProto = GetContactProto(cli.events.items[0]->cle.hContact);
cli.pfnTrayIconUpdateWithImageList(iconsOn ? cli.events.items[0]->imlIconIndex : 0, cli.events.items[0]->cle.ptszTooltip, szProto);
}
@@ -304,7 +304,7 @@ int fnEventsProcessTrayDoubleClick(int index)
for (i=0; i<cli.events.count; i++) {
char * eventProto = NULL;
if (cli.events.items[i]->cle.hContact)
- eventProto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)cli.events.items[i]->cle.hContact, 0);
+ eventProto = GetContactProto(cli.events.items[i]->cle.hContact);
if ( !eventProto)
eventProto = cli.events.items[i]->cle.lpszProtocol;
@@ -321,7 +321,7 @@ int fnEventsProcessTrayDoubleClick(int index)
for (i=0; i<cli.events.count; i++) {
char * eventProto = NULL;
if (cli.events.items[i]->cle.hContact)
- eventProto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)cli.events.items[i]->cle.hContact, 0);
+ eventProto = GetContactProto(cli.events.items[i]->cle.hContact);
if ( !eventProto)
eventProto = cli.events.items[i]->cle.lpszProtocol;
if (eventProto) {
diff --git a/src/modules/clist/clistmenus.cpp b/src/modules/clist/clistmenus.cpp
index ce37c3ad59..e88ca7aa46 100644
--- a/src/modules/clist/clistmenus.cpp
+++ b/src/modules/clist/clistmenus.cpp
@@ -331,7 +331,7 @@ static INT_PTR BuildContactMenu(WPARAM wParam, LPARAM)
HANDLE hContact = (HANDLE)wParam;
NotifyEventHooks(hPreBuildContactMenuEvent, (WPARAM)hContact, 0);
- char *szProto = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0);
+ char *szProto = GetContactProto(hContact);
BuildContactParam bcp;
bcp.szProto = szProto;
diff --git a/src/modules/clist/clistmod.cpp b/src/modules/clist/clistmod.cpp
index fdbc75fe82..3c7f6ddc49 100644
--- a/src/modules/clist/clistmod.cpp
+++ b/src/modules/clist/clistmod.cpp
@@ -148,7 +148,7 @@ static int ProtocolAck(WPARAM, LPARAM lParam)
if (caps & PF1_SERVERCLIST) {
HANDLE hContact = db_find_first();
while (hContact) {
- char *szProto = (char *) CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM) hContact, 0);
+ char *szProto = GetContactProto(hContact);
if (szProto != NULL && !strcmp(szProto, ack->szModule))
if (db_get_b(hContact, "CList", "Delete", 0))
CallService(MS_DB_CONTACT_DELETE, (WPARAM) hContact, 0);
@@ -187,7 +187,7 @@ int fnIconFromStatusMode(const char *szProto, int status, HANDLE)
static INT_PTR GetContactIcon(WPARAM wParam, LPARAM)
{
- char *szProto = (char *) CallService(MS_PROTO_GETCONTACTBASEPROTO, wParam, 0);
+ char *szProto = GetContactProto((HANDLE)wParam);
HANDLE hContact = (HANDLE)wParam;
return cli.pfnIconFromStatusMode(szProto,
@@ -444,8 +444,8 @@ static INT_PTR CompareContacts(WPARAM wParam, LPARAM lParam)
char *szProto1, *szProto2;
int rc;
- szProto1 = (char *) CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM) a, 0);
- szProto2 = (char *) CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM) b, 0);
+ szProto1 = GetContactProto(a);
+ szProto2 = GetContactProto(b);
statusa = db_get_w((HANDLE) a, SAFESTRING(szProto1), "Status", ID_STATUS_OFFLINE);
statusb = db_get_w((HANDLE) b, SAFESTRING(szProto2), "Status", ID_STATUS_OFFLINE);
diff --git a/src/modules/clist/clistsettings.cpp b/src/modules/clist/clistsettings.cpp
index 504511acd2..b3d1edb897 100644
--- a/src/modules/clist/clistsettings.cpp
+++ b/src/modules/clist/clistsettings.cpp
@@ -214,7 +214,7 @@ INT_PTR InvalidateDisplayName(WPARAM wParam, LPARAM)
int ContactAdded(WPARAM wParam, LPARAM)
{
- cli.pfnChangeContactIcon((HANDLE)wParam, cli.pfnIconFromStatusMode((char *) CallService(MS_PROTO_GETCONTACTBASEPROTO, wParam, 0), ID_STATUS_OFFLINE, NULL), 1);
+ cli.pfnChangeContactIcon((HANDLE)wParam, cli.pfnIconFromStatusMode(GetContactProto((HANDLE)wParam), ID_STATUS_OFFLINE, NULL), 1);
cli.pfnSortContacts();
return 0;
}
@@ -269,7 +269,7 @@ int ContactSettingChanged(WPARAM wParam, LPARAM lParam)
if ( !strcmp(cws->szModule, "CList")) {
if ( !strcmp(cws->szSetting, "Hidden")) {
if (cws->value.type == DBVT_DELETED || cws->value.bVal == 0) {
- char *szProto = (char *) CallService(MS_PROTO_GETCONTACTBASEPROTO, wParam, 0);
+ char *szProto = GetContactProto((HANDLE)wParam);
cli.pfnChangeContactIcon(hContact, cli.pfnIconFromStatusMode(szProto, szProto == NULL ? ID_STATUS_OFFLINE : db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE), hContact), 1);
}
else
diff --git a/src/modules/clist/clui.cpp b/src/modules/clist/clui.cpp
index 58f3978b84..612be5cd8e 100644
--- a/src/modules/clist/clui.cpp
+++ b/src/modules/clist/clui.cpp
@@ -192,7 +192,7 @@ static INT_PTR MenuItem_DeleteContact(WPARAM wParam, LPARAM lParam)
// Delete contact
case IDYES:
{
- char *szProto = (char *) CallService(MS_PROTO_GETCONTACTBASEPROTO, wParam, 0);
+ char *szProto = GetContactProto((HANDLE)wParam);
if (szProto != NULL) {
// Check if protocol uses server side lists
DWORD caps;
diff --git a/src/modules/clist/contact.cpp b/src/modules/clist/contact.cpp
index 76cb8960c7..9ecc273604 100644
--- a/src/modules/clist/contact.cpp
+++ b/src/modules/clist/contact.cpp
@@ -45,7 +45,7 @@ static const struct {
static int GetContactStatus(HANDLE hContact)
{
- char* szProto = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM) hContact, 0);
+ char* szProto = GetContactProto(hContact);
if (szProto == NULL)
return ID_STATUS_OFFLINE;
return db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE);
@@ -83,7 +83,7 @@ void fnLoadContactTree(void)
while (hContact != NULL) {
status = GetContactStatus(hContact);
if (( !hideOffline || status != ID_STATUS_OFFLINE) && !db_get_b(hContact, "CList", "Hidden", 0))
- cli.pfnChangeContactIcon(hContact, cli.pfnIconFromStatusMode((char *) CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM) hContact, 0), status, hContact), 1);
+ cli.pfnChangeContactIcon(hContact, cli.pfnIconFromStatusMode(GetContactProto(hContact), status, hContact), 1);
hContact = db_find_next(hContact);
}
sortByStatus = db_get_b(NULL, "CList", "SortByStatus", SETTING_SORTBYSTATUS_DEFAULT);
@@ -168,7 +168,7 @@ INT_PTR ContactChangeGroup(WPARAM wParam, LPARAM lParam)
db_set_ts((HANDLE)wParam, "CList", "Group", grpChg.pszNewName);
}
CallService(MS_CLUI_CONTACTADDED, wParam,
- cli.pfnIconFromStatusMode((char *) CallService(MS_PROTO_GETCONTACTBASEPROTO, wParam, 0), GetContactStatus((HANDLE)wParam), (HANDLE)wParam));
+ cli.pfnIconFromStatusMode(GetContactProto((HANDLE)wParam), GetContactStatus((HANDLE)wParam), (HANDLE)wParam));
NotifyEventHooks(hGroupChangeEvent, wParam, (LPARAM)&grpChg);
return 0;