From 27035a4a46167dc714b770c77561f14e8d0b945d Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 25 Sep 2012 16:44:33 +0000 Subject: draft version of the dynamic accounts' removal git-svn-id: http://svn.miranda-ng.org/main/trunk@1655 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- src/modules/protocols/protoaccs.cpp | 48 +++++++++++++++++++++---------------- 1 file changed, 28 insertions(+), 20 deletions(-) (limited to 'src/modules/protocols/protoaccs.cpp') diff --git a/src/modules/protocols/protoaccs.cpp b/src/modules/protocols/protoaccs.cpp index 3fd5aeee6b..65ad1e3de7 100644 --- a/src/modules/protocols/protoaccs.cpp +++ b/src/modules/protocols/protoaccs.cpp @@ -452,28 +452,27 @@ BOOL ActivateAccount(PROTOACCOUNT* pa) CreateProtoServiceEx(pa->szModuleName, PS_GETNAME, (MIRANDASERVICEOBJ)stub41, pa->ppro); CreateProtoServiceEx(pa->szModuleName, PS_GETSTATUS, (MIRANDASERVICEOBJ)stub42, pa->ppro); + char szServiceName[ 200 ]; + mir_snprintf(szServiceName, SIZEOF(szServiceName), "%s%s", pa->szModuleName, PS_GETAVATARINFO); + if ( !ServiceExists(szServiceName)) { + mir_snprintf(szServiceName, SIZEOF(szServiceName), "%s%s", pa->szModuleName, PS_GETAVATARINFOW); + if (ServiceExists(szServiceName)) + CreateProtoServiceEx(pa->szModuleName, PS_GETAVATARINFO, (MIRANDASERVICEOBJ)stub43, pa->ppro); + } - char szServiceName[ 200 ]; - mir_snprintf(szServiceName, SIZEOF(szServiceName), "%s%s", pa->szModuleName, PS_GETAVATARINFO); - if ( !ServiceExists(szServiceName)) { - mir_snprintf(szServiceName, SIZEOF(szServiceName), "%s%s", pa->szModuleName, PS_GETAVATARINFOW); - if (ServiceExists(szServiceName)) - CreateProtoServiceEx(pa->szModuleName, PS_GETAVATARINFO, (MIRANDASERVICEOBJ)stub43, pa->ppro); - } - - mir_snprintf(szServiceName, SIZEOF(szServiceName), "%s%s", pa->szModuleName, PS_GETMYAVATAR); - if ( !ServiceExists(szServiceName)) { - mir_snprintf(szServiceName, SIZEOF(szServiceName), "%s%s", pa->szModuleName, PS_GETMYAVATARW); - if (ServiceExists(szServiceName)) - CreateProtoServiceEx(pa->szModuleName, PS_GETMYAVATAR, (MIRANDASERVICEOBJ)stub44, pa->ppro); - } + mir_snprintf(szServiceName, SIZEOF(szServiceName), "%s%s", pa->szModuleName, PS_GETMYAVATAR); + if ( !ServiceExists(szServiceName)) { + mir_snprintf(szServiceName, SIZEOF(szServiceName), "%s%s", pa->szModuleName, PS_GETMYAVATARW); + if (ServiceExists(szServiceName)) + CreateProtoServiceEx(pa->szModuleName, PS_GETMYAVATAR, (MIRANDASERVICEOBJ)stub44, pa->ppro); + } - mir_snprintf(szServiceName, SIZEOF(szServiceName), "%s%s", pa->szModuleName, PS_SETMYAVATAR); - if ( !ServiceExists(szServiceName)) { - mir_snprintf(szServiceName, SIZEOF(szServiceName), "%s%s", pa->szModuleName, PS_SETMYAVATARW); - if (ServiceExists(szServiceName)) - CreateProtoServiceEx(pa->szModuleName, PS_SETMYAVATAR, (MIRANDASERVICEOBJ)stub45, pa->ppro); - } + mir_snprintf(szServiceName, SIZEOF(szServiceName), "%s%s", pa->szModuleName, PS_SETMYAVATAR); + if ( !ServiceExists(szServiceName)) { + mir_snprintf(szServiceName, SIZEOF(szServiceName), "%s%s", pa->szModuleName, PS_SETMYAVATARW); + if (ServiceExists(szServiceName)) + CreateProtoServiceEx(pa->szModuleName, PS_SETMYAVATAR, (MIRANDASERVICEOBJ)stub45, pa->ppro); + } return TRUE; } @@ -615,6 +614,15 @@ void UnloadAccountsModule() ///////////////////////////////////////////////////////////////////////////////////////// +void KillProtoAccounts(const char *szProtoName) +{ + for (int i=0; i < accounts.getCount(); i++) + if ( !strcmp(szProtoName, accounts[i]->szProtoName)) + DeactivateAccount(accounts[i], true, false); +} + +///////////////////////////////////////////////////////////////////////////////////////// + void BuildProtoMenus() { for (int i=0; i < accounts.getCount(); i++) { -- cgit v1.2.3