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 /src | |
parent | f4d17396db574acd6f1fff5ab7997924c01ba1bc (diff) |
forgotten service MS_PROTO_CREATEACCOUNT replaced with Proto_CreateAccount() call
Diffstat (limited to 'src')
-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 |
5 files changed, 18 insertions, 27 deletions
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);
|