From bd8a04455d9c991c15df2287e091abe4ba054efb Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 25 Nov 2012 12:54:45 +0000 Subject: typed stub for MS_PROTO_GETCONTACTBASEPROTO git-svn-id: http://svn.miranda-ng.org/main/trunk@2480 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/MetaContacts/src/edit.cpp | 2 +- plugins/MetaContacts/src/meta_main.cpp | 2 +- plugins/MetaContacts/src/meta_menu.cpp | 6 +++--- plugins/MetaContacts/src/meta_services.cpp | 32 ++++++++++++++---------------- plugins/MetaContacts/src/meta_utils.cpp | 22 ++++++++++---------- 5 files changed, 31 insertions(+), 33 deletions(-) (limited to 'plugins/MetaContacts/src') diff --git a/plugins/MetaContacts/src/edit.cpp b/plugins/MetaContacts/src/edit.cpp index 5980f905a4..15e9455bda 100644 --- a/plugins/MetaContacts/src/edit.cpp +++ b/plugins/MetaContacts/src/edit.cpp @@ -103,7 +103,7 @@ void FillContactList(HWND hWndDlg, CHANGES *chg) { LvItem.iSubItem = 1; // id - proto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)chg->hContact[i], 0); + proto = GetContactProto(chg->hContact[i]); if (proto) { field = (char *)CallProtoService(proto,PS_GETCAPS,PFLAG_UNIQUEIDSETTING,0); diff --git a/plugins/MetaContacts/src/meta_main.cpp b/plugins/MetaContacts/src/meta_main.cpp index 8a05fe1f7b..f307d800b6 100644 --- a/plugins/MetaContacts/src/meta_main.cpp +++ b/plugins/MetaContacts/src/meta_main.cpp @@ -171,7 +171,7 @@ extern "C" __declspec(dllexport) int Load(void) HANDLE hContact = db_find_first(); char *proto; while(hContact != NULL) { - //proto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0); + //proto = GetContactProto(hContact); if (!DBGetContactSetting(hContact, "Protocol", "p", &dbv)) { proto = dbv.pszVal; if (proto && !lstrcmp( META_PROTO, proto)) { diff --git a/plugins/MetaContacts/src/meta_menu.cpp b/plugins/MetaContacts/src/meta_menu.cpp index fe718ba95b..524a46931c 100644 --- a/plugins/MetaContacts/src/meta_menu.cpp +++ b/plugins/MetaContacts/src/meta_menu.cpp @@ -42,7 +42,7 @@ INT_PTR Meta_Convert(WPARAM wParam,LPARAM lParam) char *group = 0;//, *proto; // Get some information about the selected contact. -// proto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO,wParam,0); +// proto = GetContactProto(wParam,0); if (!DBGetContactSettingStringUtf((HANDLE)wParam,"CList","Group",&dbv)) { group = _strdup(dbv.pszVal); DBFreeVariant(&dbv); @@ -437,7 +437,7 @@ int Meta_ModifyMenu(WPARAM wParam, LPARAM lParam) for (i = 0; i < MAX_CONTACTS; i++) { if (i < num_contacts) { hContact = Meta_GetContactHandle((HANDLE)wParam, i); - proto = _strdup((char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0)); + proto = _strdup(GetContactProto(hContact)); if (!proto) status = ID_STATUS_OFFLINE; @@ -506,7 +506,7 @@ int Meta_ModifyMenu(WPARAM wParam, LPARAM lParam) { char serviceFunc[256]; hContact = Meta_GetMostOnline((HANDLE)wParam); - mir_snprintf(serviceFunc, 256, "%s/SendNudge", (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0)); + mir_snprintf(serviceFunc, 256, "%s/SendNudge", GetContactProto(hContact)); CallService(MS_NUDGE_SHOWMENU, (WPARAM)META_PROTO, (LPARAM)ServiceExists(serviceFunc)); } } diff --git a/plugins/MetaContacts/src/meta_services.cpp b/plugins/MetaContacts/src/meta_services.cpp index 251f42a718..d2b5ca563c 100644 --- a/plugins/MetaContacts/src/meta_services.cpp +++ b/plugins/MetaContacts/src/meta_services.cpp @@ -299,7 +299,7 @@ INT_PTR Meta_SendNudge(WPARAM wParam,LPARAM lParam) hSubContact = Meta_GetMostOnline(hMeta); char servicefunction[ 100 ]; - char *protoName = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hSubContact, 0); + char *protoName = GetContactProto(hSubContact); sprintf(servicefunction, "%s/SendNudge", protoName); return CallService(servicefunction, (WPARAM)hSubContact, lParam); @@ -358,7 +358,7 @@ INT_PTR Meta_SendMessage(WPARAM wParam,LPARAM lParam) Meta_CopyContactNick(ccs->hContact, most_online); ccs->hContact = most_online; - proto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)most_online, 0); + proto = GetContactProto(most_online); Meta_SetNick(proto); // (no matter what was there before) // don't bypass filters etc @@ -374,7 +374,7 @@ INT_PTR Meta_SendMessage(WPARAM wParam,LPARAM lParam) if (options.subhistory && !(ccs->wParam & PREF_METANODB)) { // add sent event to subcontact DBEVENTINFO dbei = { sizeof(dbei) }; - dbei.szModule = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)ccs->hContact, 0); + dbei.szModule = GetContactProto(ccs->hContact); if (dbei.szModule) { dbei.flags = DBEF_SENT; dbei.timestamp = time(NULL); @@ -464,7 +464,7 @@ INT_PTR MetaFilter_RecvMessage(WPARAM wParam,LPARAM lParam) if (options.use_proto_recv) { // use the subcontact's protocol 'recv' service to add the meta's history (AIMOSCAR removes HTML here!) if possible - char *proto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)ccs->hContact, 0); + char *proto = GetContactProto(ccs->hContact); if (proto) { char service[256]; HANDLE hSub = ccs->hContact; @@ -509,7 +509,7 @@ INT_PTR MetaFilter_RecvMessage(WPARAM wParam,LPARAM lParam) if (options.subhistory) { ZeroMemory(&dbei, sizeof(dbei)); dbei.cbSize = sizeof(dbei); - dbei.szModule = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)ccs->hContact, 0); + dbei.szModule = GetContactProto(ccs->hContact, 0); dbei.timestamp = pre->timestamp; dbei.flags = (DBGetContactSettingByte(ccs->hContact, META_PROTO, "WindowOpen", 0) ? 0 : DBEF_READ); if (pre->flags & PREF_RTL) dbei.flags |= DBEF_RTL; @@ -551,9 +551,7 @@ INT_PTR Meta_RecvMessage(WPARAM wParam, LPARAM lParam) CCSDATA *ccs = (CCSDATA *) lParam; PROTORECVEVENT *pre = (PROTORECVEVENT *) ccs->lParam; - char *proto; - - proto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)ccs->hContact, 0); + char *proto = GetContactProto(ccs->hContact); // contact is not a meta proto contact - just leave it if (!proto || strcmp(proto, META_PROTO)) { @@ -564,7 +562,7 @@ INT_PTR Meta_RecvMessage(WPARAM wParam, LPARAM lParam) { // use the subcontact's protocol to add the db if possible (AIMOSCAR removes HTML here!) HANDLE most_online = Meta_GetMostOnline(ccs->hContact); - char *proto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)most_online, 0); + char *proto = GetContactProto(most_online); if (proto) { char service[256]; mir_snprintf(service, 256, "%s%s", proto, PSR_MESSAGE); @@ -817,7 +815,7 @@ int Meta_SettingChanged(WPARAM wParam, LPARAM lParam) if (dcws->value.type == DBVT_DELETED) { DBVARIANT dbv; - char *proto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, wParam, 0); + char *proto = GetContactProto((HANDLE)wParam); strcpy(buffer, "CListName"); strcat(buffer, _itoa(contact_number, buffer2, 10)); if (proto && !MyDBGetContactSetting((HANDLE)wParam, proto, "Nick", &dbv)) { @@ -969,7 +967,7 @@ INT_PTR Meta_UserIsTyping(WPARAM wParam, LPARAM lParam) if (!most_online) return 0; - proto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)most_online, 0); + proto = GetContactProto(most_online); if (proto) { strncpy(buff, proto, 512); strncpy(buff + strlen(proto), PSS_USERISTYPING, 512 - strlen(proto)); @@ -1100,7 +1098,7 @@ int Meta_ClistDoubleClicked(WPARAM wParam, LPARAM lParam) } return 1; } else { - proto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)most_online, 0); + proto = GetContactProto(most_online); if (proto) { strcpy(buffer, proto); @@ -1315,7 +1313,7 @@ INT_PTR Meta_ContactMenuFunc(WPARAM wParam, LPARAM lParam) { char *proto; char buffer[512]; - proto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0); + proto = GetContactProto(hContact); if (proto) { strcpy(buffer, proto); @@ -1376,7 +1374,7 @@ INT_PTR Meta_FileSend(WPARAM wParam, LPARAM lParam) return 0; } - proto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)most_online, 0); + proto = GetContactProto(most_online); //Meta_CopyContactNick(ccs->hContact, most_online, proto); if (proto) { @@ -1416,7 +1414,7 @@ INT_PTR Meta_GetAwayMsg(WPARAM wParam, LPARAM lParam) { if (!most_online) return 0; - proto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)most_online, 0); + proto = GetContactProto(most_online); if (!proto) return 0; //Meta_CopyContactNick(ccs->hContact, most_online, proto); @@ -1452,7 +1450,7 @@ INT_PTR Meta_GetAvatarInfo(WPARAM wParam, LPARAM lParam) { if (!hSub) return GAIR_NOAVATAR; - proto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hSub, 0); + proto = GetContactProto(hSub); if (!proto) return GAIR_NOAVATAR; AI->hContact = hSub; @@ -1487,7 +1485,7 @@ INT_PTR Meta_GetInfo(WPARAM wParam, LPARAM lParam) { if (!most_online) return 0; - proto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)most_online, 0); + proto = GetContactProto(most_online); if (!proto) return 0; AI.cbSize = sizeof(AI); diff --git a/plugins/MetaContacts/src/meta_utils.cpp b/plugins/MetaContacts/src/meta_utils.cpp index 3931044812..8df0479440 100644 --- a/plugins/MetaContacts/src/meta_utils.cpp +++ b/plugins/MetaContacts/src/meta_utils.cpp @@ -257,7 +257,7 @@ BOOL Meta_Assign(HANDLE src, HANDLE dest, BOOL set_as_default) MessageBox(0, Translate("Could not retreive MetaContact contact count"), Translate("Assignment Error"), MB_OK | MB_ICONWARNING); return FALSE; } - if (!(proto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)src,0))) { + if (!(proto = GetContactProto(src))) { MessageBox(0, Translate("Could not retreive contact protocol"), Translate("Assignment Error"), MB_OK | MB_ICONWARNING); return FALSE; } @@ -476,7 +476,7 @@ HANDLE Meta_GetMostOnlineSupporting(HANDLE hMeta, int pflagnum, unsigned long ca return NULL; most_online_contact = Meta_GetContactHandle(hMeta, default_contact_number); - proto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)most_online_contact, 0); + proto = GetContactProto(most_online_contact); caps = proto ? CallProtoService(proto, PS_GETCAPS, (WPARAM)pflagnum, 0) : 0; if (proto && strcmp(proto, "IRC") == 0) caps |= PF1_IM; // we are forced to do use default for sending - '-1' capability indicates no specific capability, but respect 'Force Default' @@ -492,7 +492,7 @@ HANDLE Meta_GetMostOnlineSupporting(HANDLE hMeta, int pflagnum, unsigned long ca } most_online_contact = Meta_GetContactHandle(hMeta, default_contact_number); - proto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)most_online_contact, 0); + proto = GetContactProto(most_online_contact); if (proto && CallProtoService(proto, PS_GETSTATUS, 0, 0) >= ID_STATUS_ONLINE) { caps = proto ? CallProtoService(proto, PS_GETCAPS, (WPARAM)pflagnum, 0) : 0; if (proto && strcmp(proto, "IRC") == 0) caps |= PF1_IM; @@ -516,7 +516,7 @@ HANDLE Meta_GetMostOnlineSupporting(HANDLE hMeta, int pflagnum, unsigned long ca continue; hContact = Meta_GetContactHandle(hMeta, i); - proto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0); + proto = GetContactProto(hContact); if (!proto || CallProtoService(proto, PS_GETSTATUS, 0, 0) < ID_STATUS_ONLINE) // proto offline or connecting continue; @@ -607,7 +607,7 @@ BOOL dbv_same(DBVARIANT *dbv1, DBVARIANT *dbv2) { if (hContact) { if (!module) { - used_mod = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0); + used_mod = GetContactProto(hContact); if (!used_mod) continue; // next contact } else used_mod = module; @@ -698,7 +698,7 @@ void CopyStatusData(HANDLE hMeta) { else hContact = Meta_GetContactHandle(hMeta, i); - proto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0); + proto = GetContactProto(hContact); if (proto && DBGetContactSettingWord(hContact, proto, "Status", ID_STATUS_OFFLINE) == status) { if (!bDoneStatus && !MyDBGetContactSetting(hContact, "CList", "StatusMsg", &dbv)) { @@ -974,7 +974,7 @@ int Meta_HideLinkedContacts(void) { contact_number = DBGetContactSettingDword(hContact, META_PROTO, "ContactNumber", (DWORD)-1); // prepare to update metacontact record of subcontat status - proto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0); + proto = GetContactProto(hContact); // save old group and move to invisible group (i.e. non-existent group) Meta_SetGroup(hContact); @@ -1184,7 +1184,7 @@ void Meta_SetGroup(HANDLE hContact) { // the existence of this service means that clist_meta_mw is active and will do the hiding for us if (ServiceExists(MS_CLUI_METASUPPORT)) return; - proto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0); + proto = GetContactProto(hContact); if (proto) uid = (char *)CallProtoService(proto, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0); @@ -1280,7 +1280,7 @@ int Meta_CopyContactNick(HANDLE hMeta, HANDLE hContact) { if (!hContact) return 1; - //proto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0); + //proto = GetContactProto(hContact); // read proto direct from db, since we do this on load and other proto plugins may not be loaded yet if (!DBGetContactSetting(hContact, "Protocol", "p", &dbv_proto)) { @@ -1636,7 +1636,7 @@ void Meta_RemoveHistory(HANDLE hContactRemoveFrom, HANDLE hContactSource) { } char *Meta_GetUniqueIdentifier(HANDLE hContact, DWORD *pused) { - char *proto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0); + char *proto = GetContactProto(hContact); char *field; char *id; char buff[256]; @@ -1687,7 +1687,7 @@ char *Meta_GetUniqueIdentifier(HANDLE hContact, DWORD *pused) { void Meta_FixStatus(HANDLE hMeta) { HANDLE most_online = Meta_GetMostOnlineSupporting(hMeta, PFLAGNUM_1, 0); if (most_online) { - char *proto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)most_online, 0); + char *proto = GetContactProto(most_online); if (proto) { WORD status = (WORD)DBGetContactSettingWord(most_online, proto, "Status", (WORD)ID_STATUS_OFFLINE); DBWriteContactSettingWord(hMeta, META_PROTO, "Status", status); -- cgit v1.2.3