From 0c41e6c4566fdb2d99b8a6ca1fb48859fd4a0e34 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 16 Sep 2016 19:43:24 +0000 Subject: - chats services replaces with functions; - chat calls switched from CallServiceSync to direct calls everywhere git-svn-id: http://svn.miranda-ng.org/main/trunk@17305 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Actman/iac_inout.pas | 4 +-- plugins/Dropbox/src/dropbox_utils.cpp | 2 +- plugins/MirLua/src/m_message.cpp | 2 +- plugins/MirandaG15/src/CAppletManager.cpp | 2 +- plugins/PasteIt/src/Options.cpp | 2 +- plugins/PasteIt/src/PasteIt.cpp | 8 +++--- plugins/PasteIt/src/stdafx.h | 2 +- plugins/Scriver/src/chat/main.cpp | 2 +- plugins/SendScreenshotPlus/src/CSend.cpp | 6 ++--- plugins/SendScreenshotPlus/src/Main.cpp | 2 ++ plugins/SendScreenshotPlus/src/stdafx.h | 2 +- plugins/TabSRMM/src/chat/main.cpp | 2 +- plugins/Utils.pas/mircontacts.pas | 45 ------------------------------- plugins/XSoundNotify/src/xsn_main.cpp | 3 +-- 14 files changed, 20 insertions(+), 64 deletions(-) (limited to 'plugins') diff --git a/plugins/Actman/iac_inout.pas b/plugins/Actman/iac_inout.pas index e83e62ad8f..b8effc62ae 100644 --- a/plugins/Actman/iac_inout.pas +++ b/plugins/Actman/iac_inout.pas @@ -289,9 +289,7 @@ begin dbei.flags :=DBEF_SENT or DBEF_UTF; db_event_add(hContact, @dbei); mFreeMem(blob); - end - else - SendToChat(hContact,last); + end; end else begin diff --git a/plugins/Dropbox/src/dropbox_utils.cpp b/plugins/Dropbox/src/dropbox_utils.cpp index c8ef7f06c8..d615b33ea0 100644 --- a/plugins/Dropbox/src/dropbox_utils.cpp +++ b/plugins/Dropbox/src/dropbox_utils.cpp @@ -112,7 +112,7 @@ void CDropbox::SendToContact(MCONTACT hContact, const wchar_t *data) gce.dwFlags = GCEF_ADDTOLOG; gce.ptszText = mir_wstrdup(data); gce.time = time(NULL); - CallServiceSync(MS_GC_EVENT, WINDOW_VISIBLE, (LPARAM)&gce); + Chat_Event(WINDOW_VISIBLE, &gce); mir_free((void*)gce.ptszText); return; } diff --git a/plugins/MirLua/src/m_message.cpp b/plugins/MirLua/src/m_message.cpp index eb99205312..cc0de69657 100644 --- a/plugins/MirLua/src/m_message.cpp +++ b/plugins/MirLua/src/m_message.cpp @@ -42,7 +42,7 @@ static int message_Send(lua_State *L) gce.ptszText = mir_utf8decodeW(message); gce.time = time(NULL); - res = CallServiceSync(MS_GC_EVENT, WINDOW_VISIBLE, (LPARAM)&gce); + res = Chat_Event(WINDOW_VISIBLE, &gce); lua_pushinteger(L, res); mir_free((void*)gce.ptszText); diff --git a/plugins/MirandaG15/src/CAppletManager.cpp b/plugins/MirandaG15/src/CAppletManager.cpp index 48d2c843c6..f7030c03a8 100644 --- a/plugins/MirandaG15/src/CAppletManager.cpp +++ b/plugins/MirandaG15/src/CAppletManager.cpp @@ -772,7 +772,7 @@ MEVENT CAppletManager::SendMessageToContact(MCONTACT hContact, tstring strMessag gce.ptszText = (LPTSTR)strAscii.c_str(); gce.time = time(NULL); gce.bIsMe = true; - CallService(MS_GC_EVENT, NULL, (LPARAM)&gce); + Chat_Event(NULL, &gce); db_free(&dbv); return 0; diff --git a/plugins/PasteIt/src/Options.cpp b/plugins/PasteIt/src/Options.cpp index 60cec76e47..8d80a15948 100644 --- a/plugins/PasteIt/src/Options.cpp +++ b/plugins/PasteIt/src/Options.cpp @@ -409,7 +409,7 @@ INT_PTR CALLBACK Options::DlgProcOptsPages(HWND hwndDlg, UINT msg, WPARAM wParam } case WM_CLOSE: { - OptsPagesData* optsPagesData = (OptsPagesData*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); + OptsPagesData *optsPagesData = (OptsPagesData*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); delete optsPagesData; SetWindowLongPtr(hwndDlg, GWLP_USERDATA, 0); break; diff --git a/plugins/PasteIt/src/PasteIt.cpp b/plugins/PasteIt/src/PasteIt.cpp index 6ebee5236d..6b6a8bd599 100644 --- a/plugins/PasteIt/src/PasteIt.cpp +++ b/plugins/PasteIt/src/PasteIt.cpp @@ -54,6 +54,7 @@ PLUGININFOEX pluginInfo = { static IconItem icon = { LPGEN("Paste It"), "PasteIt_main", IDI_MENU }; int hLangpack = 0; +CHAT_MANAGER *pci; BOOL APIENTRY DllMain(HMODULE hModule, DWORD, LPVOID) { @@ -146,13 +147,13 @@ void PasteIt(MCONTACT hContact, int mode) GC_INFO gci = { 0 }; GCDEST gcd = { szProto, NULL, GC_EVENT_SENDMESSAGE }; GCEVENT gce = { sizeof(gce), &gcd }; - int cnt = (int)CallService(MS_GC_GETSESSIONCOUNT, 0, (LPARAM)szProto); + int cnt = pci->SM_GetCount(szProto); for (int i = 0; i < cnt; i++) { gci.iItem = i; gci.pszModule = szProto; gci.Flags = GCF_BYINDEX | GCF_HCONTACT | GCF_ID; - CallService(MS_GC_GETINFO, 0, (LPARAM)&gci); + Chat_GetInfo(&gci); if (gci.hContact == hContact) { // In this place session was finded, gci.pszID contains @@ -163,7 +164,7 @@ void PasteIt(MCONTACT hContact, int mode) gce.dwFlags = GCEF_ADDTOLOG; gce.ptszText = mir_a2u_cp(pasteToWeb->szFileLink, CP_ACP); gce.time = time(NULL); - CallService(MS_GC_EVENT, 0, (LPARAM)&gce); + Chat_Event(0, &gce); mir_free((void*)gce.ptszText); break; } @@ -399,6 +400,7 @@ int ModulesLoaded(WPARAM, LPARAM) extern "C" int __declspec(dllexport) Load(void) { mir_getLP(&pluginInfo); + pci = Chat_GetInterface(); Icon_Register(hInst, LPGEN("Paste It"), &icon, 1); diff --git a/plugins/PasteIt/src/stdafx.h b/plugins/PasteIt/src/stdafx.h index 959524e03e..a637e884d0 100644 --- a/plugins/PasteIt/src/stdafx.h +++ b/plugins/PasteIt/src/stdafx.h @@ -27,7 +27,7 @@ #include #include #include -#include +#include #include diff --git a/plugins/Scriver/src/chat/main.cpp b/plugins/Scriver/src/chat/main.cpp index a223f9898d..cff8723cf0 100644 --- a/plugins/Scriver/src/chat/main.cpp +++ b/plugins/Scriver/src/chat/main.cpp @@ -155,7 +155,7 @@ static void OnLoadSettings() int Chat_Load() { CHAT_MANAGER_INITDATA data = { &g_Settings, sizeof(MODULEINFO), sizeof(SESSION_INFO), LPGENW("Messaging") L"/" LPGENW("Group chats"), FONTMODE_SKIP }; - mir_getCI(&data); + pci = Chat_GetInterface(&data); saveCI = *pci; pci->OnCreateModule = OnCreateModule; diff --git a/plugins/SendScreenshotPlus/src/CSend.cpp b/plugins/SendScreenshotPlus/src/CSend.cpp index 61e4be2080..d80b7a016b 100644 --- a/plugins/SendScreenshotPlus/src/CSend.cpp +++ b/plugins/SendScreenshotPlus/src/CSend.cpp @@ -222,14 +222,14 @@ void CSend::svcSendMsgExit(const char* szMessage) } GC_INFO gci = { 0 }; int res = GC_RESULT_NOSESSION; - int cnt = (int)CallService(MS_GC_GETSESSIONCOUNT, 0, (LPARAM)m_pszProto); + int cnt = pci->SM_GetCount(m_pszProto); //loop on all gc session to get the right (save) ptszID for the chatroom from m_hContact gci.pszModule = m_pszProto; for (int i = 0; i < cnt; i++) { gci.iItem = i; gci.Flags = GCF_BYINDEX | GCF_HCONTACT | GCF_ID; - CallService(MS_GC_GETINFO, 0, (LPARAM)&gci); + Chat_GetInfo(&gci); if (gci.hContact == m_hContact) { GCDEST gcd = { m_pszProto, gci.pszID, GC_EVENT_SENDMESSAGE }; GCEVENT gce = { sizeof(gce), &gcd }; @@ -239,7 +239,7 @@ void CSend::svcSendMsgExit(const char* szMessage) gce.time = time(NULL); //* returns 0 on success or error code on failure - res = 200 + (int)CallService(MS_GC_EVENT, 0, (LPARAM)&gce); + res = 200 + (int)Chat_Event(0, &gce); break; } } diff --git a/plugins/SendScreenshotPlus/src/Main.cpp b/plugins/SendScreenshotPlus/src/Main.cpp index 6866930af5..7026c4c832 100644 --- a/plugins/SendScreenshotPlus/src/Main.cpp +++ b/plugins/SendScreenshotPlus/src/Main.cpp @@ -30,6 +30,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "Main.h" // Prototypes /////////////////////////////////////////////////////////////////////////// +CHAT_MANAGER *pci; CLIST_INTERFACE *pcli; HINSTANCE g_hSendSS; MGLOBAL g_myGlobals; @@ -258,6 +259,7 @@ ATOM g_clsTargetHighlighter = 0; DLL_EXPORT int Load(void) { mir_getLP(&pluginInfo); + pci = Chat_GetInterface(); pcli = Clist_GetInterface(); INT_PTR result = CallService(MS_IMG_GETINTERFACE, FI_IF_VERSION, (LPARAM)&FIP); diff --git a/plugins/SendScreenshotPlus/src/stdafx.h b/plugins/SendScreenshotPlus/src/stdafx.h index 5a079657bf..a96f88f4d1 100644 --- a/plugins/SendScreenshotPlus/src/stdafx.h +++ b/plugins/SendScreenshotPlus/src/stdafx.h @@ -53,7 +53,7 @@ using namespace std; #include #include #include -#include +#include #include #include #include diff --git a/plugins/TabSRMM/src/chat/main.cpp b/plugins/TabSRMM/src/chat/main.cpp index d1f8cb16e0..e3005afb9f 100644 --- a/plugins/TabSRMM/src/chat/main.cpp +++ b/plugins/TabSRMM/src/chat/main.cpp @@ -265,7 +265,7 @@ int Chat_Load() CheckUpdate(); CHAT_MANAGER_INITDATA data = { &g_Settings, sizeof(MODULEINFO), sizeof(SESSION_INFO), LPGENW("Message Sessions") L"/" LPGENW("Group chats"), FONTMODE_ALTER }; - mir_getCI(&data); + pci = Chat_GetInterface(&data); saveCI = *pci; pci->OnCreateModule = OnCreateModule; pci->OnNewUser = OnNewUser; diff --git a/plugins/Utils.pas/mircontacts.pas b/plugins/Utils.pas/mircontacts.pas index d9e2e2bf7e..7e5337c8c8 100644 --- a/plugins/Utils.pas/mircontacts.pas +++ b/plugins/Utils.pas/mircontacts.pas @@ -45,7 +45,6 @@ function WndToContact(wnd:HWND):TMCONTACT; overload; function WndToContact:TMCONTACT; overload; procedure ShowContactDialog(hContact:TMCONTACT;DblClk:boolean=true;anystatus:boolean=true); -procedure SendToChat(hContact:TMCONTACT;pszText:PWideChar); //----- List of contacts (combobox) ----- @@ -486,50 +485,6 @@ CallService(MS_CLIST_CONTACTDOUBLECLICKED,hContact,0); end; end; -procedure SendChatText(pszID:pointer;pszModule:PAnsiChar;pszText:pointer); -var - gcd:TGCDEST; - gce:TGCEVENT; -begin - gcd.pszModule:=pszModule; - gcd.iType :=GC_EVENT_SENDMESSAGE; - gcd.szID.w :=pszID; - - FillChar(gce,SizeOf(TGCEVENT),0); - gce.cbSize :=SizeOf(TGCEVENT); - gce.pDest :=@gcd; - gce.bIsMe :=true; - gce.szText.w:=pszText; - gce.dwFlags :=GCEF_ADDTOLOG; - gce.time :=GetCurrentTimeStamp; - - CallServiceSync(MS_GC_EVENT,0,lparam(@gce)); -end; - -procedure SendToChat(hContact:TMCONTACT;pszText:PWideChar); -var - gci:TGC_INFO; - pszModule:PAnsiChar; - i,cnt:integer; -begin - pszModule:=GetContactProto(hContact); - cnt:=CallService(MS_GC_GETSESSIONCOUNT,0,lparam(pszModule)); - i:=0; - gci.pszModule:=pszModule; - while i