diff options
author | George Hazan <george.hazan@gmail.com> | 2015-06-19 14:24:12 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2015-06-19 14:24:12 +0000 |
commit | 83310365c69bd40365ee0ae0e16c99c28e24cd0b (patch) | |
tree | 10ac18bfdc3fcf0fd62a5aba3ccb5dedffa2e410 /src | |
parent | d68cd04d6f7b997692476b531bdc30f546a50efd (diff) |
- all static protocol services replaced with functions;
- m_protomod.h removed as useless
git-svn-id: http://svn.miranda-ng.org/main/trunk@14260 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src')
36 files changed, 127 insertions, 180 deletions
diff --git a/src/core/stdauth/src/authdialogs.cpp b/src/core/stdauth/src/authdialogs.cpp index a1a7897249..4d4674d81c 100644 --- a/src/core/stdauth/src/authdialogs.cpp +++ b/src/core/stdauth/src/authdialogs.cpp @@ -53,7 +53,7 @@ INT_PTR CALLBACK DlgProcAdded(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, CallProtoService(dbei.szModule, PS_LOADICON, PLI_PROTOCOL | PLIF_SMALL, 0));
SendMessage(hwndDlg, WM_SETICON, ICON_BIG, CallProtoService(dbei.szModule, PS_LOADICON, PLI_PROTOCOL | PLIF_LARGE, 0));
- PROTOACCOUNT* acc = ProtoGetAccount(dbei.szModule);
+ PROTOACCOUNT* acc = Proto_GetAccount(dbei.szModule);
TCHAR* lastT = dbei.flags & DBEF_UTF ? Utf8DecodeT(last) : mir_a2t(last);
TCHAR* firstT = dbei.flags & DBEF_UTF ? Utf8DecodeT(first) : mir_a2t(first);
@@ -177,7 +177,7 @@ INT_PTR CALLBACK DlgProcAuthReq(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, CallProtoService(dbei.szModule, PS_LOADICON, PLI_PROTOCOL | PLIF_SMALL, 0));
SendMessage(hwndDlg, WM_SETICON, ICON_BIG, CallProtoService(dbei.szModule, PS_LOADICON, PLI_PROTOCOL | PLIF_LARGE, 0));
- PROTOACCOUNT* acc = ProtoGetAccount(dbei.szModule);
+ PROTOACCOUNT* acc = Proto_GetAccount(dbei.szModule);
ptrT lastT(dbei.flags & DBEF_UTF ? Utf8DecodeT(last) : mir_a2t(last));
ptrT firstT(dbei.flags & DBEF_UTF ? Utf8DecodeT(first) : mir_a2t(first));
diff --git a/src/core/stdauth/src/commonheaders.h b/src/core/stdauth/src/commonheaders.h index 1ba20c8690..9ac9abbf2a 100644 --- a/src/core/stdauth/src/commonheaders.h +++ b/src/core/stdauth/src/commonheaders.h @@ -54,7 +54,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include <m_clistint.h>
#include <m_button.h>
#include <m_protosvc.h>
-#include <m_protomod.h>
#include <m_protocols.h>
#include <m_options.h>
#include <m_skin.h>
diff --git a/src/core/stdautoaway/src/autoaway.cpp b/src/core/stdautoaway/src/autoaway.cpp index e3aa0603de..9084ab7f61 100644 --- a/src/core/stdautoaway/src/autoaway.cpp +++ b/src/core/stdautoaway/src/autoaway.cpp @@ -69,7 +69,7 @@ static int AutoAwayEvent(WPARAM, LPARAM lParam) int numAccounts;
PROTOACCOUNT** accounts;
- ProtoEnumAccounts(&numAccounts, &accounts);
+ Proto_EnumAccounts(&numAccounts, &accounts);
for (int i = 0; i < numAccounts; i++) {
PROTOACCOUNT *pa = accounts[i];
diff --git a/src/core/stdautoaway/src/commonheaders.h b/src/core/stdautoaway/src/commonheaders.h index efdb7396e7..4e6c33ab90 100644 --- a/src/core/stdautoaway/src/commonheaders.h +++ b/src/core/stdautoaway/src/commonheaders.h @@ -51,7 +51,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include <m_langpack.h>
#include <m_button.h>
#include <m_protosvc.h>
-#include <m_protomod.h>
#include <m_protocols.h>
#include <m_options.h>
#include <m_skin.h>
diff --git a/src/core/stdaway/src/commonheaders.h b/src/core/stdaway/src/commonheaders.h index ea2707e767..cac3b84b67 100644 --- a/src/core/stdaway/src/commonheaders.h +++ b/src/core/stdaway/src/commonheaders.h @@ -52,7 +52,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include <m_clistint.h>
#include <m_button.h>
#include <m_protosvc.h>
-#include <m_protomod.h>
#include <m_protocols.h>
#include <m_options.h>
#include <m_skin.h>
diff --git a/src/core/stdaway/src/sendmsg.cpp b/src/core/stdaway/src/sendmsg.cpp index 1347036dd4..f40abdec32 100644 --- a/src/core/stdaway/src/sendmsg.cpp +++ b/src/core/stdaway/src/sendmsg.cpp @@ -186,7 +186,7 @@ void ChangeAllProtoMessages(char *szProto, int statusMode, TCHAR *msg) if (szProto == NULL) {
int nAccounts;
PROTOACCOUNT **accounts;
- ProtoEnumAccounts(&nAccounts, &accounts);
+ Proto_EnumAccounts(&nAccounts, &accounts);
for (int i = 0; i < nAccounts; i++) {
PROTOACCOUNT *pa = accounts[i];
@@ -575,7 +575,7 @@ static int AwayMsgSendAccountsChanged(WPARAM, LPARAM) int nAccounts;
PROTOACCOUNT** accounts;
- ProtoEnumAccounts(&nAccounts, &accounts);
+ Proto_EnumAccounts(&nAccounts, &accounts);
for (int i = 0; i < nAccounts; i++) {
if (!Proto_IsAccountEnabled(accounts[i]))
continue;
diff --git a/src/core/stdchat/src/chat.h b/src/core/stdchat/src/chat.h index 6e66536072..d2706c8605 100644 --- a/src/core/stdchat/src/chat.h +++ b/src/core/stdchat/src/chat.h @@ -46,7 +46,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include <m_langpack.h>
#include <m_skin.h>
#include <m_button.h>
-#include <m_protomod.h>
#include <m_protosvc.h>
#include <m_clist.h>
#include <m_clistint.h>
diff --git a/src/core/stdclist/src/clistopts.cpp b/src/core/stdclist/src/clistopts.cpp index aad1364110..4c4d871ec1 100644 --- a/src/core/stdclist/src/clistopts.cpp +++ b/src/core/stdclist/src/clistopts.cpp @@ -127,9 +127,9 @@ static INT_PTR CALLBACK DlgProcGenOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP int count;
PROTOACCOUNT **accs;
- ProtoEnumAccounts(&count, &accs);
+ Proto_EnumAccounts(&count, &accs);
for (int i = 0; i < count; i++) {
- if (!IsAccountEnabled(accs[i]) || CallProtoService(accs[i]->szModuleName, PS_GETCAPS, PFLAGNUM_2, 0) == 0)
+ if (!Proto_IsAccountEnabled(accs[i]) || CallProtoService(accs[i]->szModuleName, PS_GETCAPS, PFLAGNUM_2, 0) == 0)
continue;
item = SendDlgItemMessage(hwndDlg, IDC_PRIMARYSTATUS, CB_ADDSTRING, 0, (LPARAM)accs[i]->tszAccountName);
diff --git a/src/core/stdcrypt/src/commonheaders.h b/src/core/stdcrypt/src/commonheaders.h index 43da7d6c65..32c6f26034 100644 --- a/src/core/stdcrypt/src/commonheaders.h +++ b/src/core/stdcrypt/src/commonheaders.h @@ -50,7 +50,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include <m_langpack.h>
#include <m_button.h>
#include <m_protosvc.h>
-#include <m_protomod.h>
#include <m_protocols.h>
#include <m_options.h>
#include <m_skin.h>
diff --git a/src/core/stdemail/src/commonheaders.h b/src/core/stdemail/src/commonheaders.h index 537c6293fa..5d64b310f8 100644 --- a/src/core/stdemail/src/commonheaders.h +++ b/src/core/stdemail/src/commonheaders.h @@ -51,7 +51,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include <m_clistint.h>
#include <m_button.h>
#include <m_protosvc.h>
-#include <m_protomod.h>
#include <m_protocols.h>
#include <m_options.h>
#include <m_skin.h>
diff --git a/src/core/stdfile/src/commonheaders.h b/src/core/stdfile/src/commonheaders.h index b476a77cf1..c028084e09 100644 --- a/src/core/stdfile/src/commonheaders.h +++ b/src/core/stdfile/src/commonheaders.h @@ -56,7 +56,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include <m_clistint.h>
#include <m_button.h>
#include <m_protosvc.h>
-#include <m_protomod.h>
#include <m_protocols.h>
#include <m_protoint.h>
#include <m_options.h>
diff --git a/src/core/stdhelp/src/commonheaders.h b/src/core/stdhelp/src/commonheaders.h index e1763c4cc8..ef3c230d8f 100644 --- a/src/core/stdhelp/src/commonheaders.h +++ b/src/core/stdhelp/src/commonheaders.h @@ -52,7 +52,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include <m_clistint.h>
#include <m_button.h>
#include <m_protosvc.h>
-#include <m_protomod.h>
#include <m_protocols.h>
#include <m_options.h>
#include <m_skin.h>
diff --git a/src/core/stdidle/src/commonheaders.h b/src/core/stdidle/src/commonheaders.h index 4294473f85..565408f1ba 100644 --- a/src/core/stdidle/src/commonheaders.h +++ b/src/core/stdidle/src/commonheaders.h @@ -53,7 +53,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include <m_clistint.h>
#include <m_button.h>
#include <m_protosvc.h>
-#include <m_protomod.h>
#include <m_protocols.h>
#include <m_options.h>
#include <m_skin.h>
diff --git a/src/core/stduihist/src/commonheaders.h b/src/core/stduihist/src/commonheaders.h index 93fb17ecb2..52ab245752 100644 --- a/src/core/stduihist/src/commonheaders.h +++ b/src/core/stduihist/src/commonheaders.h @@ -52,7 +52,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include <m_clistint.h>
#include <m_button.h>
#include <m_protosvc.h>
-#include <m_protomod.h>
#include <m_protocols.h>
#include <m_options.h>
#include <m_skin.h>
diff --git a/src/core/stdurl/commonheaders.h b/src/core/stdurl/commonheaders.h index 6651d1f240..3acf6d5748 100644 --- a/src/core/stdurl/commonheaders.h +++ b/src/core/stdurl/commonheaders.h @@ -52,7 +52,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include <m_clistint.h>
#include <m_button.h>
#include <m_protosvc.h>
-#include <m_protomod.h>
#include <m_protocols.h>
#include <m_options.h>
#include <m_skin.h>
diff --git a/src/core/stduserinfo/src/commonheaders.h b/src/core/stduserinfo/src/commonheaders.h index ec79f2ea84..49583b6a21 100644 --- a/src/core/stduserinfo/src/commonheaders.h +++ b/src/core/stduserinfo/src/commonheaders.h @@ -54,7 +54,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include <m_clistint.h>
#include <m_button.h>
#include <m_protosvc.h>
-#include <m_protomod.h>
#include <m_protocols.h>
#include <m_options.h>
#include <m_skin.h>
diff --git a/src/core/stduseronline/src/commonheaders.h b/src/core/stduseronline/src/commonheaders.h index 774e7c6dcc..df5c89598e 100644 --- a/src/core/stduseronline/src/commonheaders.h +++ b/src/core/stduseronline/src/commonheaders.h @@ -51,7 +51,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include <m_clistint.h>
#include <m_button.h>
#include <m_protosvc.h>
-#include <m_protomod.h>
#include <m_protocols.h>
#include <m_options.h>
#include <m_skin.h>
diff --git a/src/core/stduseronline/src/useronline.cpp b/src/core/stduseronline/src/useronline.cpp index e2cb2cc85b..32e5bcb2b8 100644 --- a/src/core/stduseronline/src/useronline.cpp +++ b/src/core/stduseronline/src/useronline.cpp @@ -93,7 +93,7 @@ static int UserOnlineModulesLoaded(WPARAM, LPARAM) {
int numAccounts;
PROTOACCOUNT** accounts;
- ProtoEnumAccounts(&numAccounts, &accounts);
+ Proto_EnumAccounts(&numAccounts, &accounts);
// reset the counter
for (int i = 0; i < numAccounts; i++)
diff --git a/src/mir_app/src/chat_clist.cpp b/src/mir_app/src/chat_clist.cpp index 26dbd2ed74..cd633f600b 100644 --- a/src/mir_app/src/chat_clist.cpp +++ b/src/mir_app/src/chat_clist.cpp @@ -59,7 +59,7 @@ MCONTACT AddRoom(const char *pszModule, const TCHAR *pszRoom, const TCHAR *pszDi if ((hContact = (MCONTACT)CallService(MS_DB_CONTACT_ADD, 0, 0)) == NULL)
return NULL;
- CallService(MS_PROTO_ADDTOCONTACT, hContact, (LPARAM)pszModule);
+ Proto_AddToContact(hContact, pszModule);
if (pszGroup[0])
db_set_ts(hContact, "CList", "Group", pszGroup);
else
diff --git a/src/mir_app/src/chat_tools.cpp b/src/mir_app/src/chat_tools.cpp index 9d7936f926..00b3f90e5d 100644 --- a/src/mir_app/src/chat_tools.cpp +++ b/src/mir_app/src/chat_tools.cpp @@ -183,7 +183,7 @@ int ShowPopup(MCONTACT hContact, SESSION_INFO *si, HICON hIcon, char *pszProtoNa else
pd.lchIcon = LoadIconEx("window", FALSE);
- PROTOACCOUNT *pa = ProtoGetAccount(pszProtoName);
+ PROTOACCOUNT *pa = Proto_GetAccount(pszProtoName);
mir_sntprintf(pd.lptzContactName, SIZEOF(pd.lptzContactName), _T("%s - %s"),
(pa == NULL) ? _A2T(pszProtoName) : pa->tszAccountName,
cli.pfnGetContactDisplayName(hContact, 0));
diff --git a/src/mir_app/src/contacts.cpp b/src/mir_app/src/contacts.cpp index 2d1729ad73..90ee313f47 100644 --- a/src/mir_app/src/contacts.cpp +++ b/src/mir_app/src/contacts.cpp @@ -100,7 +100,7 @@ static INT_PTR GetContactInfo(WPARAM, LPARAM lParam) DBVARIANT dbv;
CONTACTINFO *ci = (CONTACTINFO*)lParam;
if (ci == NULL) return 1;
- if (ci->szProto == NULL) ci->szProto = (char*)CallService(MS_PROTO_GETCONTACTBASEACCOUNT, (WPARAM)ci->hContact, 0);
+ if (ci->szProto == NULL) ci->szProto = Proto_GetBaseAccountName(ci->hContact);
if (ci->szProto == NULL) return 1;
ci->type = 0;
diff --git a/src/mir_app/src/ignore.cpp b/src/mir_app/src/ignore.cpp index b8c1af1b1b..5fc8208104 100644 --- a/src/mir_app/src/ignore.cpp +++ b/src/mir_app/src/ignore.cpp @@ -365,30 +365,34 @@ static INT_PTR Unignore(WPARAM wParam, LPARAM lParam) static INT_PTR IgnoreRecvMessage(WPARAM wParam, LPARAM lParam)
{
- if (IsIgnored((WPARAM)((CCSDATA*)lParam)->hContact, IGNOREEVENT_MESSAGE))
+ CCSDATA *ccs = (CCSDATA*)lParam;
+ if (IsIgnored(ccs->hContact, IGNOREEVENT_MESSAGE))
return 1;
- return CallService(MS_PROTO_CHAINRECV, wParam, lParam);
+ return Proto_ChainRecv(wParam, ccs);
}
static INT_PTR IgnoreRecvUrl(WPARAM wParam, LPARAM lParam)
{
- if ( IsIgnored((WPARAM)((CCSDATA*)lParam)->hContact, IGNOREEVENT_URL))
+ CCSDATA *ccs = (CCSDATA*)lParam;
+ if (IsIgnored(ccs->hContact, IGNOREEVENT_URL))
return 1;
- return CallService(MS_PROTO_CHAINRECV, wParam, lParam);
+ return Proto_ChainRecv(wParam, ccs);
}
static INT_PTR IgnoreRecvFile(WPARAM wParam, LPARAM lParam)
{
- if ( IsIgnored((WPARAM)((CCSDATA*)lParam)->hContact, IGNOREEVENT_FILE))
+ CCSDATA *ccs = (CCSDATA*)lParam;
+ if (IsIgnored(ccs->hContact, IGNOREEVENT_FILE))
return 1;
- return CallService(MS_PROTO_CHAINRECV, wParam, lParam);
+ return Proto_ChainRecv(wParam, ccs);
}
static INT_PTR IgnoreRecvAuth(WPARAM wParam, LPARAM lParam)
{
- if ( IsIgnored((WPARAM)((CCSDATA*)lParam)->hContact, IGNOREEVENT_AUTHORIZATION))
+ CCSDATA *ccs = (CCSDATA*)lParam;
+ if (IsIgnored(ccs->hContact, IGNOREEVENT_AUTHORIZATION))
return 1;
- return CallService(MS_PROTO_CHAINRECV, wParam, lParam);
+ return Proto_ChainRecv(wParam, ccs);
}
static int IgnoreAddedNotify(WPARAM, LPARAM lParam)
@@ -420,10 +424,11 @@ static int IgnoreModernOptInit(WPARAM wParam, LPARAM) int LoadIgnoreModule(void)
{
- PROTOCOLDESCRIPTOR pd = { sizeof(pd) };
+ PROTOCOLDESCRIPTOR pd = { 0 };
+ pd.cbSize = sizeof(pd);
pd.szName = "Ignore";
pd.type = PROTOTYPE_IGNORE;
- CallService(MS_PROTO_REGISTERMODULE, 0, (LPARAM)&pd);
+ Proto_RegisterModule(&pd);
CreateProtoServiceFunction("Ignore", PSR_MESSAGE, IgnoreRecvMessage);
CreateProtoServiceFunction("Ignore", PSR_URL, IgnoreRecvUrl);
diff --git a/src/mir_app/src/meta_edit.cpp b/src/mir_app/src/meta_edit.cpp index 70f0944e59..b82d3f531c 100644 --- a/src/mir_app/src/meta_edit.cpp +++ b/src/mir_app/src/meta_edit.cpp @@ -63,7 +63,7 @@ static void FillContactList(HWND hList) LvItem.iSubItem = 1; // id
char *szProto = GetContactProto(g_data.hContact[i]);
if (szProto) {
- PROTOACCOUNT *pa = ProtoGetAccount(szProto);
+ PROTOACCOUNT *pa = Proto_GetAccount(szProto);
char *szField = (char *)CallProtoService(szProto, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0);
diff --git a/src/mir_app/src/meta_main.cpp b/src/mir_app/src/meta_main.cpp index 3add80aee5..3c18940afe 100644 --- a/src/mir_app/src/meta_main.cpp +++ b/src/mir_app/src/meta_main.cpp @@ -73,11 +73,11 @@ int LoadMetacontacts(void) pd.cbSize = sizeof(pd);
pd.szName = META_FILTER;
pd.type = PROTOTYPE_FILTER;
- CallService(MS_PROTO_REGISTERMODULE, 0, (LPARAM)&pd);
+ Proto_RegisterModule(&pd);
pd.szName = META_PROTO;
pd.type = PROTOTYPE_VIRTUAL;
- CallService(MS_PROTO_REGISTERMODULE, 0, (LPARAM)&pd);
+ Proto_RegisterModule(&pd);
// further db setup done in modules loaded (nick [protocol string required] & clist display name)
Meta_InitServices();
diff --git a/src/mir_app/src/meta_menu.cpp b/src/mir_app/src/meta_menu.cpp index b2c168b169..49901c6412 100644 --- a/src/mir_app/src/meta_menu.cpp +++ b/src/mir_app/src/meta_menu.cpp @@ -64,7 +64,7 @@ INT_PTR Meta_Convert(WPARAM wParam, LPARAM) currDb->MetaSetDefault(cc); // explicitly write default sub to a db
// Add the MetaContact protocol to the new meta contact
- CallService(MS_PROTO_ADDTOCONTACT, hMetaContact, (LPARAM)META_PROTO);
+ Proto_AddToContact(hMetaContact, META_PROTO);
if (tszGroup)
db_set_ts(hMetaContact, "CList", "Group", tszGroup);
diff --git a/src/mir_app/src/meta_services.cpp b/src/mir_app/src/meta_services.cpp index 0721e6640e..5c6962f8cd 100644 --- a/src/mir_app/src/meta_services.cpp +++ b/src/mir_app/src/meta_services.cpp @@ -134,7 +134,7 @@ static INT_PTR MetaFilter_RecvMessage(WPARAM wParam, LPARAM lParam) if (cc && cc->IsSub())
Meta_SetSrmmSub(cc->parentID, cc->contactID);
- CallService(MS_PROTO_CHAINRECV, wParam, lParam);
+ Proto_ChainRecv(wParam, ccs);
return 0;
}
@@ -231,7 +231,7 @@ INT_PTR Meta_SendMessage(WPARAM wParam, LPARAM lParam) if (cc == NULL || cc->nDefault == -1) {
// This is a simple contact, let through the stack of protocols
// (this should normally not happen, since linked contacts do not appear on the list.)
- return CallService(MS_PROTO_CHAINSEND, wParam, lParam);
+ return Proto_ChainSend(wParam, ccs);
}
MCONTACT hMostOnline = db_mc_getSrmmSub(cc->contactID);
@@ -599,7 +599,7 @@ static int Meta_SrmmIconClicked(WPARAM hMeta, LPARAM lParam) char *szProto = GetContactProto(cc->pSubs[i]);
if (szProto == NULL) continue;
- PROTOACCOUNT *pa = ProtoGetAccount(szProto);
+ PROTOACCOUNT *pa = Proto_GetAccount(szProto);
if (pa == NULL)
continue;
diff --git a/src/mir_app/src/mir_app.def b/src/mir_app/src/mir_app.def index 6eb3303181..e7a09d548a 100644 --- a/src/mir_app/src/mir_app.def +++ b/src/mir_app/src/mir_app.def @@ -129,3 +129,16 @@ ProtoWindowAdd @126 ProtoWindowRemove @127
Proto_IsProtocolLoaded @128
GetPluginFakeId @129
+Proto_GetAccount @130
+Proto_EnumProtocols @131
+Proto_EnumAccounts @132
+Proto_IsAccountEnabled @133
+Proto_IsAccountLocked @134
+Proto_GetBaseAccountName @135
+GetContactProto @136
+Proto_AddToContact @137
+Proto_ChainRecv @138
+Proto_ChainSend @139
+Proto_IsProtoOnContact @140
+Proto_RegisterModule @141
+Proto_RemoveFromContact @142
diff --git a/src/mir_app/src/mir_app64.def b/src/mir_app/src/mir_app64.def index 4bd307a4ff..39b2b30b5c 100644 --- a/src/mir_app/src/mir_app64.def +++ b/src/mir_app/src/mir_app64.def @@ -129,3 +129,16 @@ ProtoWindowAdd @126 ProtoWindowRemove @127
Proto_IsProtocolLoaded @128
GetPluginFakeId @129
+Proto_GetAccount @130
+Proto_EnumProtocols @131
+Proto_EnumAccounts @132
+Proto_IsAccountEnabled @133
+Proto_IsAccountLocked @134
+Proto_GetBaseAccountName @135
+GetContactProto @136
+Proto_AddToContact @137
+Proto_ChainRecv @138
+Proto_ChainSend @139
+Proto_IsProtoOnContact @140
+Proto_RegisterModule @141
+Proto_RemoveFromContact @142
diff --git a/src/mir_app/src/miranda.h b/src/mir_app/src/miranda.h index a1fad48c77..24486ff3aa 100644 --- a/src/mir_app/src/miranda.h +++ b/src/mir_app/src/miranda.h @@ -148,10 +148,8 @@ INT_PTR ProtoCallService(LPCSTR szModule, const char *szService, WPARAM wParam, PROTOACCOUNT* Proto_CreateAccount(const char *szModuleName, const char *szBaseProto, const TCHAR *tszAccountName);
-PROTOACCOUNT* __fastcall Proto_GetAccount(const char *accName);
PROTOACCOUNT* __fastcall Proto_GetAccount(MCONTACT hContact);
-bool __fastcall Proto_IsAccountEnabled(PROTOACCOUNT *pa);
bool __fastcall Proto_IsAccountLocked(PROTOACCOUNT *pa);
PROTO_INTERFACE* AddDefaultAccount(const char *szProtoName);
diff --git a/src/mir_app/src/path.cpp b/src/mir_app/src/path.cpp index 1df4dab0ea..8e6ea249a9 100644 --- a/src/mir_app/src/path.cpp +++ b/src/mir_app/src/path.cpp @@ -254,7 +254,7 @@ XCHAR *GetInternalVariable(XCHAR *key, size_t keyLength, MCONTACT hContact) else if (!_xcscmp(theKey, XSTR(key, "proto")))
theValue = mir_a2x(key, GetContactProto(hContact));
else if (!_xcscmp(theKey, XSTR(key, "accountname"))) {
- PROTOACCOUNT *acc = ProtoGetAccount(GetContactProto(hContact));
+ PROTOACCOUNT *acc = Proto_GetAccount(GetContactProto(hContact));
if (acc != NULL)
theValue = mir_a2x(key, _T2A(acc->tszAccountName));
}
diff --git a/src/mir_app/src/proto_chains.cpp b/src/mir_app/src/proto_chains.cpp index e7f4348fe0..e8b425e3e1 100644 --- a/src/mir_app/src/proto_chains.cpp +++ b/src/mir_app/src/proto_chains.cpp @@ -23,7 +23,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "stdafx.h"
-#include <m_protomod.h>
extern LIST<PROTOCOLDESCRIPTOR> filters;
@@ -56,48 +55,15 @@ static int GetProtocolP(MCONTACT hContact, char *szBuf, int cbLen) /////////////////////////////////////////////////////////////////////////////////////////
-MIR_APP_DLL(INT_PTR) CallContactService(MCONTACT hContact, const char *szProtoService, WPARAM wParam, LPARAM lParam)
+MIR_APP_DLL(INT_PTR) Proto_ChainSend(int iOrder, CCSDATA *ccs)
{
INT_PTR ret;
- CCSDATA ccs = { hContact, szProtoService, wParam, lParam };
- for (int i = 0; i < filters.getCount(); i++) {
- if ((ret = CallProtoServiceInt(hContact, filters[i]->szName, szProtoService, i + 1, (LPARAM)&ccs)) != CALLSERVICE_NOTFOUND) {
- //chain was started, exit
- return ret;
- }
- }
-
- char szProto[40];
- if (GetProtocolP((MCONTACT)hContact, szProto, sizeof(szProto)))
+ if (iOrder == (WPARAM)(-1))
return 1;
- PROTOACCOUNT *pa = Proto_GetAccount(szProto);
- if (pa == NULL || pa->ppro == NULL)
- return 1;
-
- if (pa->bOldProto)
- ret = CallProtoServiceInt(hContact, szProto, szProtoService, (WPARAM)(-1), (LPARAM)&ccs);
- else
- ret = CallProtoServiceInt(hContact, szProto, szProtoService, wParam, lParam);
- if (ret == CALLSERVICE_NOTFOUND)
- ret = 1;
-
- return ret;
-}
-
-/////////////////////////////////////////////////////////////////////////////////////////
-
-INT_PTR Proto_CallContactService(WPARAM wParam, LPARAM lParam)
-{
- CCSDATA *ccs = (CCSDATA*)lParam;
- INT_PTR ret;
-
- if (wParam == (WPARAM)(-1))
- return 1;
-
- for (int i = wParam; i < filters.getCount(); i++) {
- if ((ret = CallProtoServiceInt(NULL, filters[i]->szName, ccs->szProtoService, i + 1, lParam)) != CALLSERVICE_NOTFOUND) {
+ for (int i = iOrder; i < filters.getCount(); i++) {
+ if ((ret = CallProtoServiceInt(NULL, filters[i]->szName, ccs->szProtoService, i + 1, iOrder)) != CALLSERVICE_NOTFOUND) {
//chain was started, exit
return ret;
}
@@ -123,22 +89,33 @@ INT_PTR Proto_CallContactService(WPARAM wParam, LPARAM lParam) /////////////////////////////////////////////////////////////////////////////////////////
-static INT_PTR Proto_RecvChain(WPARAM wParam, LPARAM lParam)
+MIR_APP_DLL(INT_PTR) CallContactService(MCONTACT hContact, const char *szProtoService, WPARAM wParam, LPARAM lParam)
+{
+ CCSDATA ccs = { hContact, szProtoService, wParam, lParam };
+ return Proto_ChainSend(0, &ccs);
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
+MIR_APP_DLL(INT_PTR) Proto_ChainRecv(int iOrder, CCSDATA *ccs)
{
- CCSDATA *ccs = (CCSDATA*)lParam;
INT_PTR ret;
- if (wParam == (WPARAM)(-1)) return 1; //shouldn't happen - sanity check
- if (wParam == 0) { //begin processing by finding end of chain
+ // shouldn't happen - sanity check
+ if (iOrder == -1)
+ return 1;
+
+ // begin processing by finding end of chain
+ if (iOrder == 0) {
if (GetCurrentThreadId() != hMainThreadId) // restart this function in the main thread
- return CallServiceSync(MS_PROTO_CHAINRECV, wParam, lParam);
+ return Proto_ChainRecv(iOrder, ccs);
- wParam = filters.getCount();
+ iOrder = filters.getCount();
}
- else wParam--;
+ else iOrder--;
- for (int i = wParam - 1; i >= 0; i--)
- if ((ret = CallProtoServiceInt(NULL, filters[i]->szName, ccs->szProtoService, i + 1, lParam)) != CALLSERVICE_NOTFOUND)
+ for (int i = iOrder - 1; i >= 0; i--)
+ if ((ret = CallProtoServiceInt(NULL, filters[i]->szName, ccs->szProtoService, i + 1, (LPARAM)ccs)) != CALLSERVICE_NOTFOUND)
//chain was started, exit
return ret;
@@ -173,26 +150,25 @@ PROTOACCOUNT* __fastcall Proto_GetAccount(MCONTACT hContact) return Proto_GetAccount(szProto);
}
-static INT_PTR Proto_GetContactBaseProto(WPARAM wParam, LPARAM)
+MIR_APP_DLL(char*) GetContactProto(MCONTACT hContact)
{
- PROTOACCOUNT *pa = Proto_GetAccount(wParam);
- return (INT_PTR)(Proto_IsAccountEnabled(pa) ? pa->szModuleName : NULL);
+ PROTOACCOUNT *pa = Proto_GetAccount(hContact);
+ return Proto_IsAccountEnabled(pa) ? pa->szModuleName : NULL;
}
-static INT_PTR Proto_GetContactBaseAccount(WPARAM wParam, LPARAM)
+MIR_APP_DLL(char*) Proto_GetBaseAccountName(MCONTACT hContact)
{
- PROTOACCOUNT *pa = Proto_GetAccount(wParam);
- return (INT_PTR)(pa ? pa->szModuleName : NULL);
+ PROTOACCOUNT *pa = Proto_GetAccount(hContact);
+ return pa ? pa->szModuleName : NULL;
}
-static INT_PTR Proto_IsProtoOnContact(WPARAM wParam, LPARAM lParam)
+MIR_APP_DLL(int) Proto_IsProtoOnContact(MCONTACT hContact, const char *szProto)
{
- char *szProto = (char*)lParam;
if (szProto == NULL)
return 0;
char szContactProto[40];
- if (!GetProtocolP(wParam, szContactProto, sizeof(szContactProto)))
+ if (!GetProtocolP(hContact, szContactProto, sizeof(szContactProto)))
if (!_stricmp(szProto, szContactProto))
return -1;
@@ -203,51 +179,32 @@ static INT_PTR Proto_IsProtoOnContact(WPARAM wParam, LPARAM lParam) return 0;
}
-static INT_PTR Proto_AddToContact(WPARAM wParam, LPARAM lParam)
+MIR_APP_DLL(int) Proto_AddToContact(MCONTACT hContact, const char *szProto)
{
- char *szProto = (char*)lParam;
PROTOCOLDESCRIPTOR *pd = Proto_IsProtocolLoaded(szProto);
if (pd == NULL) {
PROTOACCOUNT *pa = Proto_GetAccount(szProto);
if (pa) {
- db_set_s(wParam, "Protocol", "p", szProto);
+ db_set_s(hContact, "Protocol", "p", szProto);
return 0;
}
return 1;
}
if (pd->type == PROTOTYPE_PROTOCOL || pd->type == PROTOTYPE_VIRTUAL)
- db_set_s(wParam, "Protocol", "p", szProto);
+ db_set_s(hContact, "Protocol", "p", szProto);
return 0;
}
-static INT_PTR Proto_RemoveFromContact(WPARAM wParam, LPARAM lParam)
+MIR_APP_DLL(int) Proto_RemoveFromContact(MCONTACT hContact, const char *szProto)
{
- switch (Proto_IsProtoOnContact(wParam, lParam)) {
+ switch (Proto_IsProtoOnContact(hContact, szProto)) {
case 0:
return 1;
case -1:
- db_unset(wParam, "Protocol", "p");
- }
-
- return 0;
-}
-
-int LoadProtoChains(void)
-{
- if (!db_get_b(NULL, "Compatibility", "Filters", 0)) {
- CallService(MS_DB_MODULE_DELETE, 0, (LPARAM)"_Filters");
- db_set_b(NULL, "Compatibility", "Filters", 1);
+ db_unset(hContact, "Protocol", "p");
}
- CreateServiceFunction(MS_PROTO_CALLCONTACTSERVICE, Proto_CallContactService);
- CreateServiceFunction(MS_PROTO_CHAINSEND, Proto_CallContactService);
- CreateServiceFunction(MS_PROTO_CHAINRECV, Proto_RecvChain);
- CreateServiceFunction(MS_PROTO_GETCONTACTBASEPROTO, Proto_GetContactBaseProto);
- CreateServiceFunction(MS_PROTO_GETCONTACTBASEACCOUNT, Proto_GetContactBaseAccount);
- CreateServiceFunction(MS_PROTO_ISPROTOONCONTACT, Proto_IsProtoOnContact);
- CreateServiceFunction(MS_PROTO_ADDTOCONTACT, Proto_AddToContact);
- CreateServiceFunction(MS_PROTO_REMOVEFROMCONTACT, Proto_RemoveFromContact);
return 0;
}
diff --git a/src/mir_app/src/proto_opts.cpp b/src/mir_app/src/proto_opts.cpp index 6d042b30cc..c34ffdc6d0 100644 --- a/src/mir_app/src/proto_opts.cpp +++ b/src/mir_app/src/proto_opts.cpp @@ -182,7 +182,7 @@ static INT_PTR CALLBACK AccFormDlgProc(HWND hwndDlg, UINT message, WPARAM wParam {
PROTOCOLDESCRIPTOR **proto;
int protoCount, i, cnt = 0;
- CallService(MS_PROTO_ENUMPROTOS, (WPARAM)&protoCount, (LPARAM)&proto);
+ Proto_EnumProtocols(&protoCount, &proto);
for (i = 0; i < protoCount; i++) {
PROTOCOLDESCRIPTOR* pd = proto[i];
if (pd->type == PROTOTYPE_PROTOCOL && pd->cbSize == sizeof(*pd)) {
diff --git a/src/mir_app/src/proto_ui.cpp b/src/mir_app/src/proto_ui.cpp index b5cb6483eb..891ed883de 100644 --- a/src/mir_app/src/proto_ui.cpp +++ b/src/mir_app/src/proto_ui.cpp @@ -25,7 +25,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. HINSTANCE ProtoGetInstance(const char *szModuleName)
{
- PROTOACCOUNT *pa = ProtoGetAccount(szModuleName);
+ PROTOACCOUNT *pa = Proto_GetAccount(szModuleName);
if (pa == NULL)
return NULL;
diff --git a/src/mir_app/src/proto_utils.cpp b/src/mir_app/src/proto_utils.cpp index e69cb89891..0c2f053f8e 100644 --- a/src/mir_app/src/proto_utils.cpp +++ b/src/mir_app/src/proto_utils.cpp @@ -46,6 +46,14 @@ MIR_APP_DLL(PROTOCOLDESCRIPTOR*) Proto_IsProtocolLoaded(const char *szProtoName) /////////////////////////////////////////////////////////////////////////////////////////
+MIR_APP_DLL(void) Proto_EnumProtocols(int *nProtos, PROTOCOLDESCRIPTOR ***pProtos)
+{
+ if (nProtos) *nProtos = protos.getCount();
+ if (pProtos) *pProtos = protos.getArray();
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
MIR_APP_DLL(void) ProtoLogA(struct PROTO_INTERFACE *pThis, LPCSTR szFormat, va_list args)
{
char buf[4096];
diff --git a/src/mir_app/src/protocols.cpp b/src/mir_app/src/protocols.cpp index 8620c9ae50..6d9ee1b9e9 100644 --- a/src/mir_app/src/protocols.cpp +++ b/src/mir_app/src/protocols.cpp @@ -24,7 +24,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "stdafx.h"
-int LoadProtoChains(void);
int LoadProtoOptions(void);
HANDLE hAckEvent;
@@ -96,19 +95,16 @@ LIST<PROTOCOLDESCRIPTOR> filters(10, CompareProtos); void FreeFilesMatrix(TCHAR ***files);
-INT_PTR srvProto_IsLoaded(WPARAM, LPARAM lParam)
-{
- return (INT_PTR)Proto_IsProtocolLoaded((char*)lParam);
-}
-
static PROTO_INTERFACE* defInitProto(const char* szModule, const TCHAR*)
{
return AddDefaultAccount(szModule);
}
-static INT_PTR srvProto_RegisterModule(WPARAM, LPARAM lParam)
+MIR_APP_DLL(int) Proto_RegisterModule(PROTOCOLDESCRIPTOR *pd)
{
- PROTOCOLDESCRIPTOR *pd = (PROTOCOLDESCRIPTOR*)lParam;
+ if (pd == NULL)
+ return 1;
+
if (pd->cbSize != sizeof(PROTOCOLDESCRIPTOR) && pd->cbSize != PROTOCOLDESCRIPTOR_V3_SIZE)
return 1;
@@ -303,7 +299,7 @@ HICON Proto_GetIcon(PROTO_INTERFACE *ppro, int iconIndex) /////////////////////////////////////////////////////////////////////////////////////////
// 0.8.0+ - accounts
-PROTOACCOUNT* __fastcall Proto_GetAccount(const char* accName)
+MIR_APP_DLL(PROTOACCOUNT*) Proto_GetAccount(const char *accName)
{
if (accName == NULL)
return NULL;
@@ -331,49 +327,25 @@ static INT_PTR srvProto_CreateAccount(WPARAM, LPARAM lParam) return (INT_PTR)pa;
}
-static INT_PTR srvProto_GetAccount(WPARAM, LPARAM lParam)
+MIR_APP_DLL(void) Proto_EnumAccounts(int *nAccs, PROTOACCOUNT ***pAccs)
{
- return (INT_PTR)Proto_GetAccount((char*)lParam);
+ if (nAccs) *nAccs = accounts.getCount();
+ if (pAccs) *pAccs = accounts.getArray();
}
-static INT_PTR Proto_EnumAccounts(WPARAM wParam, LPARAM lParam)
-{
- *(int*)wParam = accounts.getCount();
- *(PROTOACCOUNT***)lParam = accounts.getArray();
- return 0;
-}
-
-bool __fastcall Proto_IsAccountEnabled(PROTOACCOUNT *pa)
+MIR_APP_DLL(bool) Proto_IsAccountEnabled(const PROTOACCOUNT *pa)
{
return pa && ((pa->bIsEnabled && !pa->bDynDisabled) || pa->bOldProto);
}
-static INT_PTR srvProto_IsAccountEnabled(WPARAM, LPARAM lParam)
-{
- return (INT_PTR)Proto_IsAccountEnabled((PROTOACCOUNT*)lParam);
-}
-
bool __fastcall Proto_IsAccountLocked(PROTOACCOUNT *pa)
{
return pa && db_get_b(NULL, pa->szModuleName, "LockMainStatus", 0) != 0;
}
-static INT_PTR srvProto_IsAccountLocked(WPARAM, LPARAM lParam)
-{
- return (INT_PTR)Proto_IsAccountLocked(Proto_GetAccount((char*)lParam));
-}
-
-static INT_PTR Proto_BroadcastAck(WPARAM, LPARAM lParam)
+MIR_APP_DLL(bool) Proto_IsAccountLocked(const char *pszModuleName)
{
- ACKDATA *ack = (ACKDATA*)lParam;
- return ProtoBroadcastAck(ack->szModule, ack->hContact, ack->type, ack->result, ack->hProcess, ack->lParam);
-}
-
-static INT_PTR Proto_EnumProtocols(WPARAM wParam, LPARAM lParam)
-{
- *(int*)wParam = protos.getCount();
- *(PROTOCOLDESCRIPTOR***)lParam = protos.getArray();
- return 0;
+ return Proto_IsAccountLocked(Proto_GetAccount(pszModuleName));
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -475,36 +447,31 @@ INT_PTR ProtoCallService(const char *szModule, const char *szService, WPARAM wPa /////////////////////////////////////////////////////////////////////////////////////////
+static INT_PTR srvProto_GetContactBaseAccount(WPARAM wParam, LPARAM)
+{
+ return (INT_PTR)Proto_GetBaseAccountName(wParam);
+}
+
int LoadProtocolsModule(void)
{
bModuleInitialized = TRUE;
- if (LoadProtoChains())
- return 1;
-
qsort(serviceItems, _countof(serviceItems), sizeof(serviceItems[0]), CompareServiceItems);
+ hAckEvent = CreateHookableEvent(ME_PROTO_ACK);
hTypeEvent = CreateHookableEvent(ME_PROTO_CONTACTISTYPING);
hAccListChanged = CreateHookableEvent(ME_PROTO_ACCLISTCHANGED);
- hAckEvent = CreateHookableEvent(ME_PROTO_ACK);
- CreateServiceFunction(MS_PROTO_ENUMPROTOS, Proto_EnumProtocols);
- CreateServiceFunction(MS_PROTO_BROADCASTACK, Proto_BroadcastAck);
- CreateServiceFunction(MS_PROTO_ISPROTOCOLLOADED, srvProto_IsLoaded);
- CreateServiceFunction(MS_PROTO_REGISTERMODULE, srvProto_RegisterModule);
CreateServiceFunction(MS_PROTO_SELFISTYPING, Proto_SelfIsTyping);
CreateServiceFunction(MS_PROTO_CONTACTISTYPING, Proto_ContactIsTyping);
CreateServiceFunction(MS_PROTO_RECVMSG, Proto_RecvMessage);
CreateServiceFunction(MS_PROTO_AUTHRECV, Proto_AuthRecv);
- CreateServiceFunction("Proto/EnumProtocols", Proto_EnumAccounts);
- CreateServiceFunction(MS_PROTO_ENUMACCOUNTS, Proto_EnumAccounts);
CreateServiceFunction(MS_PROTO_CREATEACCOUNT, srvProto_CreateAccount);
- CreateServiceFunction(MS_PROTO_GETACCOUNT, srvProto_GetAccount);
- CreateServiceFunction(MS_PROTO_ISACCOUNTENABLED, srvProto_IsAccountEnabled);
- CreateServiceFunction(MS_PROTO_ISACCOUNTLOCKED, srvProto_IsAccountLocked);
+ // just to make QuickSearch happy
+ CreateServiceFunction("Proto/GetContactBaseAccount", srvProto_GetContactBaseAccount);
return LoadProtoOptions();
}
diff --git a/src/mir_app/src/stdafx.h b/src/mir_app/src/stdafx.h index f4ffff15c9..b619bcf35a 100644 --- a/src/mir_app/src/stdafx.h +++ b/src/mir_app/src/stdafx.h @@ -72,7 +72,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include <m_avatars.h>
#include <m_button.h>
#include <m_protosvc.h>
-#include <m_protomod.h>
#include <m_protocols.h>
#include <m_protoint.h>
#include <m_options.h>
|