From 0fa39189ae1eea51681d472db38a290bc4df1cfe Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 24 Jan 2024 13:38:10 +0300 Subject: PS_GETNAME: another old atavism removed --- plugins/AVS/src/userInfo.cpp | 9 ++------- plugins/Clist_blind/src/clc.cpp | 4 +--- plugins/NewAwaySysMod/src/AwaySys.cpp | 9 +++------ plugins/Variables/src/contact.cpp | 7 ------- plugins/Variables/src/contact.h | 8 +++----- plugins/helpers/gen_helpers.cpp | 6 +----- plugins/mRadio/i_service.inc | 19 +++++-------------- 7 files changed, 15 insertions(+), 47 deletions(-) (limited to 'plugins') diff --git a/plugins/AVS/src/userInfo.cpp b/plugins/AVS/src/userInfo.cpp index fd36371454..3b7a4bd129 100644 --- a/plugins/AVS/src/userInfo.cpp +++ b/plugins/AVS/src/userInfo.cpp @@ -406,14 +406,9 @@ public: SetMyAvatar(NULL, (LPARAM)L""); } else { - if (char *proto = GetSelectedProtocol()) { - char description[256]; - CallProtoService(proto, PS_GETNAME, _countof(description), (LPARAM)description); - wchar_t *descr = mir_a2u(description); - if (MessageBox(m_hwnd, TranslateT("Are you sure you want to remove your avatar?"), descr, MB_YESNO) == IDYES) + if (char *proto = GetSelectedProtocol()) + if (MessageBox(m_hwnd, TranslateT("Are you sure you want to remove your avatar?"), _A2T(proto), MB_YESNO) == IDYES) SetMyAvatar((WPARAM)proto, (LPARAM)L""); - mir_free(descr); - } } } diff --git a/plugins/Clist_blind/src/clc.cpp b/plugins/Clist_blind/src/clc.cpp index 5a57f0523a..d8e912baf8 100644 --- a/plugins/Clist_blind/src/clc.cpp +++ b/plugins/Clist_blind/src/clc.cpp @@ -71,9 +71,7 @@ static wchar_t* GetProtoName(ClcContact *item) PROTOACCOUNT *acc = Proto_GetAccount(item->pce->szProto); if (acc == nullptr) { - char description[128]; - CallProtoService(item->pce->szProto, PS_GETNAME, sizeof(description), (LPARAM)description); - mir_snwprintf(proto_name, L"%S", description); + mir_snwprintf(proto_name, L"%S", item->pce->szProto); return proto_name; } diff --git a/plugins/NewAwaySysMod/src/AwaySys.cpp b/plugins/NewAwaySysMod/src/AwaySys.cpp index eb50f63ee7..c3287605f5 100644 --- a/plugins/NewAwaySysMod/src/AwaySys.cpp +++ b/plugins/NewAwaySysMod/src/AwaySys.cpp @@ -462,12 +462,9 @@ INT_PTR srvVariablesHandler(WPARAM, LPARAM lParam) return NULL; // return it now, as later we change NULL to "" } else if (!mir_wstrcmp(ai->argv.w[0], VAR_PROTOCOL)) { - if (VarParseData.szProto) { - CString AnsiResult; - CallProtoService(VarParseData.szProto, PS_GETNAME, 256, (LPARAM)AnsiResult.GetBuffer(256)); - AnsiResult.ReleaseBuffer(); - Result = _A2T(AnsiResult); - } + if (VarParseData.szProto) + Result = _A2T(VarParseData.szProto); + if (Result == nullptr) // if we didn't find a message with specified title return NULL; // return it now, as later we change NULL to "" } diff --git a/plugins/Variables/src/contact.cpp b/plugins/Variables/src/contact.cpp index 2d5e1fca0d..399d2d6dcc 100644 --- a/plugins/Variables/src/contact.cpp +++ b/plugins/Variables/src/contact.cpp @@ -65,7 +65,6 @@ static builtinCnfs[] = { CNF_COHOMEPAGE, STR_COHOMEPAGE }, { CCNF_ACCOUNT, STR_ACCOUNT }, - { CCNF_PROTOCOL, STR_PROTOCOL }, { CCNF_STATUS, STR_STATUS }, { CCNF_INTERNALIP, STR_INTERNALIP }, { CCNF_EXTERNALIP, STR_EXTERNALIP }, @@ -128,12 +127,6 @@ wchar_t* getContactInfoT(uint8_t type, MCONTACT hContact) return pa ? mir_wstrdup(pa->tszAccountName) : nullptr; } - case CCNF_PROTOCOL: - char protoname[128]; - if (CallProtoService(szProto, PS_GETNAME, (WPARAM)sizeof(protoname), (LPARAM)protoname)) - return nullptr; - return mir_a2u(protoname); - case CCNF_STATUS: return mir_wstrdup(Clist_GetStatusModeDescription(db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE), 0)); diff --git a/plugins/Variables/src/contact.h b/plugins/Variables/src/contact.h index f8d04de21d..da81160e95 100644 --- a/plugins/Variables/src/contact.h +++ b/plugins/Variables/src/contact.h @@ -59,18 +59,16 @@ #define STR_COHOMEPAGE L"cohomepage" #define STR_ACCOUNT L"account" -#define STR_PROTOCOL L"protocol" #define STR_STATUS L"status" #define STR_INTERNALIP L"intip" #define STR_EXTERNALIP L"extip" #define STR_GROUP L"group" #define STR_PROTOID L"protoid" -#define CCNF_ACCOUNT 51 // CUSTOM, returns contact's account name (0.8.0+) -#define CCNF_PROTOCOL 50 // CUSTOM, returns the contact's protocol (human-readable) +#define CCNF_ACCOUNT 50 // CUSTOM, returns contact's account name (0.8.0+) #define CCNF_STATUS 49 // CUSTOM, returns status mode description -#define CCNF_INTERNALIP 48 // CUSTOM, returns the contact's internal IP -#define CCNF_EXTERNALIP 47 // CUSTOM, returns the contact's external IP +#define CCNF_INTERNALIP 48 // CUSTOM, returns the contact's internal IP +#define CCNF_EXTERNALIP 47 // CUSTOM, returns the contact's external IP #define CCNF_GROUP 46 // CUSTOM, returns group name #define CCNF_PROTOID 45 // CUSTOM, returns protocol ID instead of name diff --git a/plugins/helpers/gen_helpers.cpp b/plugins/helpers/gen_helpers.cpp index 3bf6e4976f..f1e5a1abde 100644 --- a/plugins/helpers/gen_helpers.cpp +++ b/plugins/helpers/gen_helpers.cpp @@ -22,11 +22,7 @@ wchar_t* Hlp_GetProtocolName(const char *proto) { - char protoname[256]; - if ((!ProtoServiceExists(proto, PS_GETNAME)) || (CallProtoService(proto, PS_GETNAME, (WPARAM)sizeof(protoname), (LPARAM)protoname))) - return nullptr; - - return mir_a2u(protoname); + return mir_a2u(proto); } wchar_t* Hlp_GetDlgItemText(HWND hwndDlg, int nIDDlgItem) diff --git a/plugins/mRadio/i_service.inc b/plugins/mRadio/i_service.inc index c129046170..f829d5fe82 100644 --- a/plugins/mRadio/i_service.inc +++ b/plugins/mRadio/i_service.inc @@ -18,13 +18,6 @@ begin end end; -function Service_GetName(wParam:WPARAM;lParam:LPARAM):int_ptr;cdecl; -begin - if lParam<>0 then - StrCopy(PAnsiChar(lParam),Translate(PluginName),wParam); - result:=0; -end; - procedure GetAwayMsgProc(hContact:TMCONTACT); cdecl; var buf,p:PWideChar; @@ -161,7 +154,7 @@ begin end; var - prh0,prh1,prh2,prh3,prh4,prh5,prh6,prh7,prh8,prh9:THANDLE; + prh0,prh1,prh2,prh3,prh4,prh5,prh6,prh7,prh8:THANDLE; procedure DestroyProtoServices; begin @@ -174,7 +167,6 @@ begin DestroyServiceFunction(prh6); DestroyServiceFunction(prh7); DestroyServiceFunction(prh8); - DestroyServiceFunction(prh9); end; procedure CreateProtoServices; @@ -184,9 +176,8 @@ begin prh2:=CreateProtoService(PS_CREATEADVSEARCHUI, @Service_ExtSearchUI); prh3:=CreateProtoService(PS_SEARCHBYADVANCED, @Service_SearchByAdvanced); prh4:=CreateProtoService(PS_BASICSEARCH, @Service_SearchBasic); - prh5:=CreateProtoService(PS_GETNAME, @Service_GetName); - prh6:=CreateProtoService(PS_LOADICON, @Service_LoadIcon); - prh7:=CreateProtoService(PS_GETSTATUS, @Service_GetStatus); - prh8:=CreateProtoService(PS_SETSTATUS, @Service_SetStatus); - prh9:=CreateProtoService(PSS_GETAWAYMSG, @Service_GetAwayMsg); + prh5:=CreateProtoService(PS_LOADICON, @Service_LoadIcon); + prh6:=CreateProtoService(PS_GETSTATUS, @Service_GetStatus); + prh7:=CreateProtoService(PS_SETSTATUS, @Service_SetStatus); + prh8:=CreateProtoService(PSS_GETAWAYMSG, @Service_GetAwayMsg); end; -- cgit v1.2.3