diff options
author | George Hazan <ghazan@miranda.im> | 2019-09-26 11:53:28 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2019-09-26 11:53:28 +0300 |
commit | 44e0a42d6130fbc42d826a7673d99480a06a87f6 (patch) | |
tree | 4d1eb5c2ef8ae351e871e3b43149b7b0220e34c5 | |
parent | 5df3cc2fd09d7afa8691658b52c08f456df381fe (diff) |
MS_UTILS_ENTERSTRING -> EnterString, useless service removed
-rw-r--r-- | include/delphi/m_utils.inc | 66 | ||||
-rw-r--r-- | include/m_utils.h | 34 | ||||
-rw-r--r-- | libs/win32/mir_app.lib | bin | 192818 -> 193018 bytes | |||
-rw-r--r-- | libs/win64/mir_app.lib | bin | 188584 -> 188764 bytes | |||
-rw-r--r-- | protocols/Discord/src/groupchat.cpp | 2 | ||||
-rw-r--r-- | protocols/Discord/src/menus.cpp | 4 | ||||
-rw-r--r-- | protocols/ICQ-WIM/src/proto.cpp | 4 | ||||
-rwxr-xr-x | protocols/JabberG/src/jabber_util.cpp | 2 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_chatrooms.cpp | 6 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_mslogin.cpp | 2 | ||||
-rw-r--r-- | protocols/VKontakte/src/misc.cpp | 7 | ||||
-rw-r--r-- | protocols/VKontakte/src/vk_chats.cpp | 2 | ||||
-rw-r--r-- | protocols/VKontakte/src/vk_status.cpp | 2 | ||||
-rw-r--r-- | src/mir_app/src/enterstring.cpp | 13 | ||||
-rw-r--r-- | src/mir_app/src/mir_app.def | 1 | ||||
-rw-r--r-- | src/mir_app/src/mir_app64.def | 1 | ||||
-rw-r--r-- | src/mir_app/src/utils.cpp | 4 |
17 files changed, 34 insertions, 116 deletions
diff --git a/include/delphi/m_utils.inc b/include/delphi/m_utils.inc index d308287544..58b7b3ed83 100644 --- a/include/delphi/m_utils.inc +++ b/include/delphi/m_utils.inc @@ -251,7 +251,7 @@ function PathIsAbsoluteW(const pSrc:PWideChar):int; stdcall; external CoreDLL name 'PathIsAbsoluteW';
{
- Generates Random number of any length
+ Generates Random number of any length
wParam=size - length of the random number to generate
lParam=(LPARAM)(char*)pszArray - pointer to array to fill with random number
Always returns 0
@@ -275,68 +275,4 @@ function Utils_ReplaceVars(const pSrc:PAnsiChar; hContact:TMCONTACT = 0; vars:PR function Utils_ReplaceVarsW(const pSrc:PWideChar; hContact:TMCONTACT = 0; vars:PREPLACEVARSARRAY = nil):PWideChar; stdcall;
external AppDLL name 'Utils_ReplaceVarsW';
-{
- variables known by the core:
- ----------------------------
- folders comes without trailing slash
-
- %miranda_profile% -> same as MS_DB_GETPROFILEPATH, base folder for all profiles
- %miranda_userdata% -> the active profile folder (home of the .dat file and all
- profile data)
- %miranda_path% -> home path of the miranda installation (installation path
- of miranda32/64.exe
- %miranda_profilename% -> Name of the profile in use. Essentially, the name of the
- .dat file without file name extension. Also: the folder name
- relative to %miranda_profile% where all profile data is stored.
- %miranda_logpath% -> base folder for log files. This is \Logs relative to the
- current profile folder.
- %miranda_avatarcache% -> base folder for all protocol avatars. internal use only.
-
- the following variables operate on contacts. REPLACEVARSDATA::hContact must be
- supplied by the caller.
-
- %nick% -> a contact nick name.
- %proto% -> internal protocol name for a given contact. NOT the user-
- defined account name.
- %accountname% -> user-defined account name for a given contact.
- %userid% -> Unique ID for a given contact (UIN, JID etc.)
-
- the following variables are system variables - unrelated to miranda profiles.
-
- %appdata% -> same as %APPDATA% environment variable.
- %destkop% -> location of the desktop folder in a user's profile.
- %mydocuments% -> location of the "My Documents" shell folder.
-}
-
-/////////////////////////////////////////////////////////////////////////////////////////
-// one field form
-
-const
- ESF_MULTILINE = 1;
- ESF_COMBO = 2;
- ESF_RICHEDIT = 3;
- ESF_PASSWORD = 4;
-
-type
- PENTER_STRING = ^TENTER_STRING;
- TENTER_STRING = record
- cbSize :int; // structure size
- _type :int; // one of ESF_* constants
- szModuleName:PAnsiChar; // module name to save window size and combobox strings
- szDataPrefix:PAnsiChar; // prefix for stored database variables
- caption :PAnsiChar; // window caption
- // next TChar fields is on same place
- // ptszInitVal:TChar; // initial value (note: the core DOES NOT free it)
- ptszResult :TChar; // result entered (must be freed via mir_free)
- recentCount :int; // number of combobox strings to store
- timeout :int; // timeout for the form auto-close
- end;
-
-const
-// enters one string
-// wParam = 0 (unused)
-// lParam = PENTER_STRING (form description)
-// returns TRUE on pressing OK or FALSE if Cancel was pressed
- MS_UTILS_ENTERSTRING:PAnsiChar = 'Utils/EnterString';
-
{$ENDIF}
diff --git a/include/m_utils.h b/include/m_utils.h index 9026e49a71..bda5c9a7a0 100644 --- a/include/m_utils.h +++ b/include/m_utils.h @@ -380,7 +380,8 @@ EXTERN_C MIR_APP_DLL(wchar_t*) Utils_ReplaceVarsW(const wchar_t *szData, MCONTAC #endif
/////////////////////////////////////////////////////////////////////////////////////////
-// one field form
+// enters one string
+// returns TRUE on pressing OK or FALSE if Cancel was pressed
#define ESF_MULTILINE 1
#define ESF_COMBO 2
@@ -389,30 +390,19 @@ EXTERN_C MIR_APP_DLL(wchar_t*) Utils_ReplaceVarsW(const wchar_t *szData, MCONTAC struct ENTER_STRING
{
- int cbSize; // structure size
- int type; // one of ESF_* constants
- LPCSTR szModuleName; // module name to save window size and combobox strings
- LPCSTR szDataPrefix; // prefix for stored database variables
- LPCTSTR caption; // window caption
+ LPCSTR szModuleName; // module name to save window size and combobox strings
+ LPCSTR szDataPrefix; // prefix for stored database variables
+ LPCWSTR caption; // window caption
union {
- LPCTSTR ptszInitVal; // initial value (note: the core DOES NOT free it)
- LPTSTR ptszResult; // result entered (must be freed via mir_free)
+ LPCWSTR ptszInitVal; // initial value (note: the core DOES NOT free it)
+ LPWSTR ptszResult; // result entered (must be freed via mir_free)
};
- int recentCount; // number of combobox strings to store
- int timeout; // timeout for the form auto-close
+
+ int type; // one of ESF_* constants
+ int recentCount; // number of combobox strings to store
+ int timeout; // timeout for the form auto-close
};
-/////////////////////////////////////////////////////////////////////////////////////////
-// enters one string
-// wParam = 0 (unused)
-// lParam = ENTER_STRING* (form description)
-// returns TRUE on pressing OK or FALSE if Cancel was pressed
-
-#define MS_UTILS_ENTERSTRING "Utils/EnterString"
-
-__forceinline INT_PTR EnterString(ENTER_STRING *pForm)
-{
- return CallService(MS_UTILS_ENTERSTRING, 0, (LPARAM)pForm);
-}
+EXTERN_C MIR_APP_DLL(bool) EnterString(ENTER_STRING *pForm);
#endif // M_UTILS_H__
diff --git a/libs/win32/mir_app.lib b/libs/win32/mir_app.lib Binary files differindex 36e749ece1..230c0a3dde 100644 --- a/libs/win32/mir_app.lib +++ b/libs/win32/mir_app.lib diff --git a/libs/win64/mir_app.lib b/libs/win64/mir_app.lib Binary files differindex e880f124d8..9583f8c37e 100644 --- a/libs/win64/mir_app.lib +++ b/libs/win64/mir_app.lib diff --git a/protocols/Discord/src/groupchat.cpp b/protocols/Discord/src/groupchat.cpp index babe48803a..95e3c47fb8 100644 --- a/protocols/Discord/src/groupchat.cpp +++ b/protocols/Discord/src/groupchat.cpp @@ -96,7 +96,7 @@ void CDiscordProto::Chat_ProcessLogMenu(GCHOOK *gch) if (pUser == nullptr) return; - ENTER_STRING es = { sizeof(es) }; + ENTER_STRING es = {}; es.szModuleName = m_szModuleName; switch (gch->dwData) { diff --git a/protocols/Discord/src/menus.cpp b/protocols/Discord/src/menus.cpp index e2c4a602f6..f4faa56c10 100644 --- a/protocols/Discord/src/menus.cpp +++ b/protocols/Discord/src/menus.cpp @@ -39,7 +39,7 @@ INT_PTR CDiscordProto::OnMenuCopyId(WPARAM hContact, LPARAM) INT_PTR CDiscordProto::OnMenuCreateChannel(WPARAM hContact, LPARAM) { - ENTER_STRING es = { sizeof(es), ESF_COMBO, m_szModuleName, "channel_name", TranslateT("Enter channel name"), nullptr, 5 }; + ENTER_STRING es = { m_szModuleName, "channel_name", TranslateT("Enter channel name"), nullptr, ESF_COMBO, 5 }; if (EnterString(&es)) { JSONNode roles(JSON_ARRAY); roles.set_name("permission_overwrites"); JSONNode root; root << INT_PARAM("type", 0) << WCHAR_PARAM("name", es.ptszResult) << roles; @@ -54,7 +54,7 @@ INT_PTR CDiscordProto::OnMenuCreateChannel(WPARAM hContact, LPARAM) INT_PTR CDiscordProto::OnMenuJoinGuild(WPARAM, LPARAM) { - ENTER_STRING es = { sizeof(es), ESF_COMBO, m_szModuleName, "guild_name", TranslateT("Enter invitation code you received"), nullptr, 5 }; + ENTER_STRING es = { m_szModuleName, "guild_name", TranslateT("Enter invitation code you received"), nullptr, ESF_COMBO, 5 }; if (EnterString(&es)) { CMStringA szUrl(FORMAT, "/invite/%S", es.ptszResult); Push(new AsyncHttpRequest(this, REQUEST_POST, szUrl, nullptr)); diff --git a/protocols/ICQ-WIM/src/proto.cpp b/protocols/ICQ-WIM/src/proto.cpp index 595a4c1689..39a58f7ef9 100644 --- a/protocols/ICQ-WIM/src/proto.cpp +++ b/protocols/ICQ-WIM/src/proto.cpp @@ -241,8 +241,8 @@ public: if (cmd == 1) { // rename ENTER_STRING es = {}; - es.cbSize = sizeof(es); - es.type = ESF_RICHEDIT; + es.type = ESF_COMBO; + es.szModuleName = m_proto->m_szModuleName; es.caption = TranslateT("Enter new group name"); if (!EnterString(&es)) return; diff --git a/protocols/JabberG/src/jabber_util.cpp b/protocols/JabberG/src/jabber_util.cpp index a0a281f0f9..4d5f4f8d3e 100755 --- a/protocols/JabberG/src/jabber_util.cpp +++ b/protocols/JabberG/src/jabber_util.cpp @@ -815,7 +815,7 @@ BOOL CJabberProto::EnterString(CMStringW &result, const wchar_t *caption, int ty result.Empty();
}
- ENTER_STRING param = { sizeof(param) };
+ ENTER_STRING param = {};
param.type = type;
param.caption = caption;
param.szModuleName = m_szModuleName;
diff --git a/protocols/SkypeWeb/src/skype_chatrooms.cpp b/protocols/SkypeWeb/src/skype_chatrooms.cpp index ab464fa852..4760ae7899 100644 --- a/protocols/SkypeWeb/src/skype_chatrooms.cpp +++ b/protocols/SkypeWeb/src/skype_chatrooms.cpp @@ -165,9 +165,8 @@ int CSkypeProto::OnGroupChatEventHook(WPARAM, LPARAM lParam) case 50:
ptrA tnick_old(GetChatContactNick(chat_id, user_id, T2Utf(gch->ptszText)));
- ENTER_STRING pForm = { sizeof(pForm) };
+ ENTER_STRING pForm = {};
pForm.type = ESF_COMBO;
- pForm.recentCount = 0;
pForm.caption = TranslateT("Enter new nickname");
pForm.szModuleName = m_szModuleName;
pForm.szDataPrefix = "renamenick_";
@@ -530,10 +529,9 @@ int CSkypeProto::OnGroupChatMenuHook(WPARAM, LPARAM lParam) CMStringW CSkypeProto::ChangeTopicForm()
{
CMStringW caption(FORMAT, L"[%s] %s", _A2T(m_szModuleName), TranslateT("Enter new chatroom topic"));
- ENTER_STRING pForm = { sizeof(pForm) };
+ ENTER_STRING pForm = {};
pForm.type = ESF_MULTILINE;
pForm.caption = caption;
- pForm.ptszInitVal = nullptr;
pForm.szModuleName = m_szModuleName;
return (!EnterString(&pForm)) ? CMStringW() : CMStringW(ptrW(pForm.ptszResult));
}
diff --git a/protocols/SkypeWeb/src/skype_mslogin.cpp b/protocols/SkypeWeb/src/skype_mslogin.cpp index 84755dad3a..28a8c25cef 100644 --- a/protocols/SkypeWeb/src/skype_mslogin.cpp +++ b/protocols/SkypeWeb/src/skype_mslogin.cpp @@ -162,7 +162,7 @@ void CSkypeProto::OnMSLoginEnd(const NETLIBHTTPREQUEST *response) CMStringW CSkypeProto::RunConfirmationCode()
{
CMStringW caption(FORMAT, L"[%s] %s", _A2T(m_szModuleName), TranslateT("Enter confirmation code"));
- ENTER_STRING pForm = { sizeof(pForm) };
+ ENTER_STRING pForm = {};
pForm.type = ESF_PASSWORD;
pForm.caption = caption;
pForm.ptszInitVal = nullptr;
diff --git a/protocols/VKontakte/src/misc.cpp b/protocols/VKontakte/src/misc.cpp index 8cb14eab53..9d54898e85 100644 --- a/protocols/VKontakte/src/misc.cpp +++ b/protocols/VKontakte/src/misc.cpp @@ -463,11 +463,9 @@ bool CVkProto::AutoFillForm(char *pBody, CMStringA &szAction, CMStringA& szResul CMStringW CVkProto::RunConfirmationCode(LPCWSTR pwszTitle)
{
- ENTER_STRING pForm = { sizeof(pForm) };
+ ENTER_STRING pForm = {};
pForm.type = ESF_COMBO;
- pForm.recentCount = 0;
pForm.caption = IsEmpty(pwszTitle) ? TranslateT("Enter confirmation code") : pwszTitle;
- pForm.ptszInitVal = nullptr;
pForm.szModuleName = m_szModuleName;
pForm.szDataPrefix = "confirmcode_";
return (!EnterString(&pForm)) ? CMStringW() : CMStringW(ptrW(pForm.ptszResult));
@@ -475,9 +473,8 @@ CMStringW CVkProto::RunConfirmationCode(LPCWSTR pwszTitle) CMStringW CVkProto::RunRenameNick(LPCWSTR pwszOldName)
{
- ENTER_STRING pForm = { sizeof(pForm) };
+ ENTER_STRING pForm = {};
pForm.type = ESF_COMBO;
- pForm.recentCount = 0;
pForm.caption = TranslateT("Enter new nickname");
pForm.ptszInitVal = pwszOldName;
pForm.szModuleName = m_szModuleName;
diff --git a/protocols/VKontakte/src/vk_chats.cpp b/protocols/VKontakte/src/vk_chats.cpp index 069bbc1142..35977921be 100644 --- a/protocols/VKontakte/src/vk_chats.cpp +++ b/protocols/VKontakte/src/vk_chats.cpp @@ -519,7 +519,7 @@ void CVkProto::OnSendChatMsg(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pReq) LPTSTR CVkProto::ChangeChatTopic(CVkChatInfo *cc)
{
- ENTER_STRING pForm = { sizeof(pForm) };
+ ENTER_STRING pForm = {};
pForm.type = ESF_MULTILINE;
pForm.caption = TranslateT("Enter new chat title");
pForm.ptszInitVal = cc->m_wszTopic;
diff --git a/protocols/VKontakte/src/vk_status.cpp b/protocols/VKontakte/src/vk_status.cpp index cd6df4fc71..4917bceead 100644 --- a/protocols/VKontakte/src/vk_status.cpp +++ b/protocols/VKontakte/src/vk_status.cpp @@ -135,7 +135,7 @@ void CVkProto::OnReceiveStatusMsg(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pR ptrW pwszOldStatusMsg(db_get_wsa(0, m_szModuleName, "OldStatusMsg"));
CMStringW wszOldStatusMsg(pwszOldStatusMsg);
- ENTER_STRING pForm = { sizeof(pForm) };
+ ENTER_STRING pForm = {};
pForm.type = ESF_MULTILINE;
pForm.caption = TranslateT("Enter new status message");
pForm.ptszInitVal = pwszOldStatusMsg;
diff --git a/src/mir_app/src/enterstring.cpp b/src/mir_app/src/enterstring.cpp index d3724d1903..fd3a9c9477 100644 --- a/src/mir_app/src/enterstring.cpp +++ b/src/mir_app/src/enterstring.cpp @@ -247,17 +247,16 @@ static INT_PTR CALLBACK sttEnterStringDlgProc(HWND hwndDlg, UINT msg, WPARAM wPa return FALSE;
}
-INT_PTR __cdecl svcEnterString(WPARAM, LPARAM lParam)
+MIR_APP_DLL(bool) EnterString(ENTER_STRING *pForm)
{
- ENTER_STRING *pForm = (ENTER_STRING*)lParam;
- if (pForm == nullptr || pForm->cbSize != sizeof(ENTER_STRING))
- return FALSE;
+ if (pForm == nullptr)
+ return false;
- EnterStringFormParam param;
+ EnterStringFormParam param = {};
memcpy(¶m, pForm, sizeof(ENTER_STRING));
if (!DialogBoxParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_ENTER_STRING), GetForegroundWindow(), sttEnterStringDlgProc, LPARAM(¶m)))
- return FALSE;
+ return false;
pForm->ptszResult = param.ptszResult;
- return TRUE;
+ return true;
}
diff --git a/src/mir_app/src/mir_app.def b/src/mir_app/src/mir_app.def index a59be4a7f1..e040deddea 100644 --- a/src/mir_app/src/mir_app.def +++ b/src/mir_app/src/mir_app.def @@ -104,6 +104,7 @@ Button_SetSkin_IcoLib @24 ?setWString@PROTO_INTERFACE@@QAEXPBDPB_W@Z @107 NONAME
?setWord@PROTO_INTERFACE@@QAEXIPBDG@Z @108 NONAME
?setWord@PROTO_INTERFACE@@QAEXPBDG@Z @109 NONAME
+EnterString @110 NONAME
ProtoBroadcastAck @111
ProtoCreateHookableEvent @113
ProtoCreateService @114
diff --git a/src/mir_app/src/mir_app64.def b/src/mir_app/src/mir_app64.def index cb548af9e7..050bc63a1c 100644 --- a/src/mir_app/src/mir_app64.def +++ b/src/mir_app/src/mir_app64.def @@ -104,6 +104,7 @@ Button_SetSkin_IcoLib @24 ?setWString@PROTO_INTERFACE@@QEAAXPEBDPEB_W@Z @107 NONAME
?setWord@PROTO_INTERFACE@@QEAAXIPEBDG@Z @108 NONAME
?setWord@PROTO_INTERFACE@@QEAAXPEBDG@Z @109 NONAME
+EnterString @110 NONAME
ProtoBroadcastAck @111
ProtoCreateHookableEvent @113
ProtoCreateService @114
diff --git a/src/mir_app/src/utils.cpp b/src/mir_app/src/utils.cpp index be9a8521b3..8cc2c70780 100644 --- a/src/mir_app/src/utils.cpp +++ b/src/mir_app/src/utils.cpp @@ -31,8 +31,6 @@ void UninitCrypt(void); void InitClistCore(void);
-INT_PTR __cdecl svcEnterString(WPARAM, LPARAM lParam);
-
static BOOL bModuleInitialized = FALSE;
static CountryListEntry countries[] = {
@@ -325,8 +323,6 @@ int LoadUtilsModule(void) CreateServiceFunction(MS_UTILS_GETCOUNTRYBYISOCODE, GetCountryByISOCode);
CreateServiceFunction(MS_UTILS_GETCOUNTRYLIST, GetCountryList);
- CreateServiceFunction(MS_UTILS_ENTERSTRING, svcEnterString);
-
InitCrypt();
InitClistCore();
return 0;
|