From db4e6bcb736ee6b602e471cbd91425bca9a005f1 Mon Sep 17 00:00:00 2001 From: Tobias Weimer Date: Thu, 18 Sep 2014 19:43:57 +0000 Subject: Core: If database setting FirstRun/ForceShowAccManager = b1 exists, the accounts manager will be opened and that setting will be deleted. Useful for pack creators to get rid of FirstRun Plugin git-svn-id: http://svn.miranda-ng.org/main/trunk@10510 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- src/modules/protocols/protoaccs.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'src/modules/protocols/protoaccs.cpp') diff --git a/src/modules/protocols/protoaccs.cpp b/src/modules/protocols/protoaccs.cpp index e5142abb10..9f7dc933ee 100644 --- a/src/modules/protocols/protoaccs.cpp +++ b/src/modules/protocols/protoaccs.cpp @@ -67,9 +67,9 @@ void LoadDbAccounts(void) { DBVARIANT dbv; int ver = db_get_dw(NULL, "Protocols", "PrVer", -1); - int count = db_get_dw(NULL, "Protocols", "ProtoCount", 0), i; + int count = db_get_dw(NULL, "Protocols", "ProtoCount", 0); - for (i=0; i < count; i++) { + for (int i=0; i < count; i++) { char buf[10]; _itoa(i, buf, 10); if (db_get_s(NULL, "Protocols", buf, &dbv)) @@ -151,8 +151,6 @@ static int enumDB_ProtoProc(const char* szSetting, LPARAM lParam) void WriteDbAccounts() { - int i; - // enum all old settings to delete enumDB_ProtoProcParam param = { 0, NULL }; @@ -165,8 +163,7 @@ void WriteDbAccounts() // delete all settings if (param.arrlen) { - int i; - for (i=0; i < param.arrlen; i++) { + for (int i=0; i < param.arrlen; i++) { db_unset(0, "Protocols", param.pszSettingName[i]); mir_free(param.pszSettingName[i]); } @@ -174,7 +171,7 @@ void WriteDbAccounts() } // write new data - for (i=0; i < accounts.getCount(); i++) { + for (int i=0; i < accounts.getCount(); i++) { PROTOACCOUNT *pa = accounts[i]; char buf[ 20 ]; @@ -242,6 +239,11 @@ static int InitializeStaticAccounts(WPARAM, LPARAM) db_set_b(NULL, "FirstRun", "AccManager", 1); CallService(MS_PROTO_SHOWACCMGR, 0, 0); } + // This is for pack creators with a profile with predefined accounts + else if(db_get_b(NULL, "FirstRun", "ForceShowAccManager", 0)) { + CallService(MS_PROTO_SHOWACCMGR, 0, 0); + db_unset(NULL, "FirstRun", "ForceShowAccManager"); + } return 0; } -- cgit v1.2.3