summaryrefslogtreecommitdiff
path: root/src/modules/protocols/protocols.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2014-08-14 12:12:35 +0000
committerGeorge Hazan <george.hazan@gmail.com>2014-08-14 12:12:35 +0000
commit0a1ec91589a265b41210068b8d21fa469e750a08 (patch)
tree2d439bc1241b12ccadd66660d08f7b325d459ebd /src/modules/protocols/protocols.cpp
parent9f478bb53be99c6ad5cf69c1a61cc14900cf72b8 (diff)
account creation code extracted to the separate service function, MS_PROTO_CREATEACCOUNT
git-svn-id: http://svn.miranda-ng.org/main/trunk@10181 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src/modules/protocols/protocols.cpp')
-rw-r--r--src/modules/protocols/protocols.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/modules/protocols/protocols.cpp b/src/modules/protocols/protocols.cpp
index 6d57eb10e9..f45378d173 100644
--- a/src/modules/protocols/protocols.cpp
+++ b/src/modules/protocols/protocols.cpp
@@ -319,6 +319,20 @@ PROTOACCOUNT* __fastcall Proto_GetAccount(const char* accName)
return accounts[idx];
}
+static INT_PTR srvProto_CreateAccount(WPARAM, LPARAM lParam)
+{
+ ACC_CREATE *p = (ACC_CREATE*)lParam;
+ if (p == NULL)
+ return NULL;
+
+ PROTOACCOUNT *pa = Proto_CreateAccount(p->pszBaseProto, p->pszInternal, p->ptszAccountName);
+ if (pa) {
+ WriteDbAccounts();
+ NotifyEventHooks(hAccListChanged, PRAC_ADDED, (LPARAM)pa);
+ }
+ return (INT_PTR)pa;
+}
+
static INT_PTR srvProto_GetAccount(WPARAM, LPARAM lParam)
{
return (INT_PTR)Proto_GetAccount((char*)lParam);
@@ -682,6 +696,7 @@ int LoadProtocolsModule(void)
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);