diff options
author | George Hazan <ghazan@miranda.im> | 2018-03-23 00:08:50 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2018-03-23 00:08:50 +0300 |
commit | 9baf3a90829c501f0a134d3ef1864e08e134e616 (patch) | |
tree | c68d996fd17cab0cbc4e4e066fd5e01d60cdbf7f | |
parent | f4d17396db574acd6f1fff5ab7997924c01ba1bc (diff) |
forgotten service MS_PROTO_CREATEACCOUNT replaced with Proto_CreateAccount() call
-rw-r--r-- | include/m_protocols.h | 15 | ||||
-rw-r--r-- | libs/win32/mir_app.lib | bin | 131280 -> 131654 bytes | |||
-rw-r--r-- | libs/win64/mir_app.lib | bin | 126792 -> 127182 bytes | |||
-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/miranda.h | 2 | ||||
-rw-r--r-- | src/mir_app/src/proto_opts.cpp | 25 | ||||
-rw-r--r-- | src/mir_app/src/protocols.cpp | 16 |
8 files changed, 19 insertions, 41 deletions
diff --git a/include/m_protocols.h b/include/m_protocols.h index c23cdb8cd4..e5713768e7 100644 --- a/include/m_protocols.h +++ b/include/m_protocols.h @@ -295,22 +295,9 @@ MIR_APP_DLL(void) Proto_EnumAccounts(int *nAccs, PROTOACCOUNT ***pAccs); /////////////////////////////////////////////////////////////////////////////////////////
// creates new account
-// wParam = 0
-// lParam = (LPARAM)(ACC_CREATE*) account definition
// return value = PROTOACCOUNT* or NULL
-#define MS_PROTO_CREATEACCOUNT "Proto/CreateAccount"
-
-typedef struct tagACC_CREATE
-{
- const char *pszBaseProto;
- const char *pszInternal;
- const wchar_t *ptszAccountName;
-} ACC_CREATE;
-
-__forceinline PROTOACCOUNT* ProtoCreateAccount(ACC_CREATE *pAccountDef)
-{ return (PROTOACCOUNT*)CallService(MS_PROTO_CREATEACCOUNT, 0, (LPARAM)pAccountDef);
-}
+MIR_APP_DLL(PROTOACCOUNT*) Proto_CreateAccount(const char *pszInternal, const char *pszBaseProto, const wchar_t *ptszAccountName);
/////////////////////////////////////////////////////////////////////////////////////////
// retrieves an account's interface by its physical name (database module)
diff --git a/libs/win32/mir_app.lib b/libs/win32/mir_app.lib Binary files differindex b724da4de1..c7adf43d41 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 2e73c8c596..8f4b79a2af 100644 --- a/libs/win64/mir_app.lib +++ b/libs/win64/mir_app.lib diff --git a/src/mir_app/src/mir_app.def b/src/mir_app/src/mir_app.def index 6623c82e7b..a8d5636259 100644 --- a/src/mir_app/src/mir_app.def +++ b/src/mir_app/src/mir_app.def @@ -490,3 +490,4 @@ Image_Save @507 GetDatabasePlugin @508
?AccContacts@PROTO_INTERFACE@@QBE?AVContacts@@XZ @509 NONAME
SetServiceModePlugin @510
+Proto_CreateAccount @511
diff --git a/src/mir_app/src/mir_app64.def b/src/mir_app/src/mir_app64.def index 642a4031ce..b442569c50 100644 --- a/src/mir_app/src/mir_app64.def +++ b/src/mir_app/src/mir_app64.def @@ -490,3 +490,4 @@ Image_Save @507 GetDatabasePlugin @508
?AccContacts@PROTO_INTERFACE@@QEBA?AVContacts@@XZ @509 NONAME
SetServiceModePlugin @510
+Proto_CreateAccount @511
diff --git a/src/mir_app/src/miranda.h b/src/mir_app/src/miranda.h index e7c1a868c5..c3ea3e82f6 100644 --- a/src/mir_app/src/miranda.h +++ b/src/mir_app/src/miranda.h @@ -138,8 +138,6 @@ extern LIST<PROTOCOLDESCRIPTOR> protos; INT_PTR ProtoCallService(const char *szModule, const char *szService, WPARAM wParam, LPARAM lParam);
-PROTOACCOUNT* Proto_CreateAccount(const char *szModuleName, const char *szBaseProto, const wchar_t *tszAccountName);
-
PROTOACCOUNT* __fastcall Proto_GetAccount(MCONTACT hContact);
PROTO_INTERFACE* AddDefaultAccount(const char *szProtoName);
diff --git a/src/mir_app/src/proto_opts.cpp b/src/mir_app/src/proto_opts.cpp index 6996a88c57..c4d88b9466 100644 --- a/src/mir_app/src/proto_opts.cpp +++ b/src/mir_app/src/proto_opts.cpp @@ -56,30 +56,33 @@ extern HANDLE hAccListChanged; int UnloadPlugin(wchar_t* buf, int bufLen);
-PROTOACCOUNT* Proto_CreateAccount(const char *szModuleName, const char *szBaseProto, const wchar_t *tszAccountName)
+MIR_APP_DLL(PROTOACCOUNT*) Proto_CreateAccount(const char *pszInternal, const char *pszBaseProto, const wchar_t *tszAccountName)
{
+ if (pszBaseProto == nullptr || tszAccountName == nullptr)
+ return nullptr;
+
PROTOACCOUNT *pa = (PROTOACCOUNT*)mir_calloc(sizeof(PROTOACCOUNT));
pa->cbSize = sizeof(PROTOACCOUNT);
pa->bIsEnabled = pa->bIsVisible = true;
pa->iOrder = accounts.getCount();
- pa->szProtoName = mir_strdup(szBaseProto);
+ pa->szProtoName = mir_strdup(pszBaseProto);
// if the internal name is empty, generate new one
- if (mir_strlen(szModuleName) == 0) {
+ if (mir_strlen(pszInternal) == 0) {
char buf[100];
int count = 1;
while (true) {
- mir_snprintf(buf, "%s_%d", szBaseProto, count++);
+ mir_snprintf(buf, "%s_%d", pszBaseProto, count++);
if (ptrA(db_get_sa(0, buf, "AM_BaseProto")) == nullptr)
break;
}
pa->szModuleName = mir_strdup(buf);
}
- else pa->szModuleName = mir_strdup(szModuleName);
+ else pa->szModuleName = mir_strdup(pszInternal);
pa->tszAccountName = mir_wstrdup(tszAccountName);
- db_set_s(0, pa->szModuleName, "AM_BaseProto", szBaseProto);
+ db_set_s(0, pa->szModuleName, "AM_BaseProto", pszBaseProto);
accounts.insert(pa);
if (ActivateAccount(pa)) {
@@ -89,6 +92,8 @@ PROTOACCOUNT* Proto_CreateAccount(const char *szModuleName, const char *szBasePr pa->ppro->OnEvent(EV_PROTO_ONMENU, 0, 0);
}
+ WriteDbAccounts();
+ NotifyEventHooks(hAccListChanged, PRAC_ADDED, (LPARAM)pa);
return pa;
}
@@ -211,10 +216,12 @@ public: m_pa = Proto_CreateAccount(buf, szBaseProto, tszAccName);
}
- else replaceStrW(m_pa->tszAccountName, tszAccName);
+ else {
+ replaceStrW(m_pa->tszAccountName, tszAccName);
- WriteDbAccounts();
- NotifyEventHooks(hAccListChanged, m_action, (LPARAM)m_pa);
+ WriteDbAccounts();
+ NotifyEventHooks(hAccListChanged, m_action, (LPARAM)m_pa);
+ }
SendMessage(GetParent(m_hwnd), WM_MY_REFRESH, 0, 0);
EndModal(IDOK);
diff --git a/src/mir_app/src/protocols.cpp b/src/mir_app/src/protocols.cpp index dd74d726a6..7043c99e2c 100644 --- a/src/mir_app/src/protocols.cpp +++ b/src/mir_app/src/protocols.cpp @@ -279,20 +279,6 @@ MIR_APP_DLL(PROTOACCOUNT*) Proto_GetAccount(const char *accName) return accounts[idx];
}
-static INT_PTR srvProto_CreateAccount(WPARAM, LPARAM lParam)
-{
- ACC_CREATE *p = (ACC_CREATE*)lParam;
- if (p == nullptr)
- return 0;
-
- PROTOACCOUNT *pa = Proto_CreateAccount(p->pszInternal, p->pszBaseProto, p->ptszAccountName);
- if (pa) {
- WriteDbAccounts();
- NotifyEventHooks(hAccListChanged, PRAC_ADDED, (LPARAM)pa);
- }
- return (INT_PTR)pa;
-}
-
MIR_APP_DLL(void) Proto_EnumAccounts(int *nAccs, PROTOACCOUNT ***pAccs)
{
if (nAccs) *nAccs = accounts.getCount();
@@ -426,8 +412,6 @@ int LoadProtocolsModule(void) CreateServiceFunction(MS_PROTO_SELFISTYPING, Proto_SelfIsTyping);
CreateServiceFunction(MS_PROTO_CONTACTISTYPING, Proto_ContactIsTyping);
- CreateServiceFunction(MS_PROTO_CREATEACCOUNT, srvProto_CreateAccount);
-
// just to make QuickSearch happy
CreateServiceFunction("Proto/GetContactBaseAccount", srvProto_GetContactBaseAccount);
|