From a41c9020b7fcbc4d05fcb37097177cc0efc7cdce Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 1 Jul 2012 10:21:56 +0000 Subject: db_helpers.cpp deleted git-svn-id: http://svn.miranda-ng.org/main/trunk@708 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- .../StatusPlugins/KeepStatus/action_keepstatus.cpp | 13 ++++--- plugins/StatusPlugins/StartupStatus/options.cpp | 42 +++++++++++++--------- plugins/StatusPlugins/StartupStatus/profiles.cpp | 12 +++---- .../StatusPlugins/StartupStatus/startupstatus.h | 3 +- plugins/StatusPlugins/commonstatus.h | 1 + 5 files changed, 40 insertions(+), 31 deletions(-) (limited to 'plugins/StatusPlugins') diff --git a/plugins/StatusPlugins/KeepStatus/action_keepstatus.cpp b/plugins/StatusPlugins/KeepStatus/action_keepstatus.cpp index bf71c81543..f51f258ec7 100644 --- a/plugins/StatusPlugins/KeepStatus/action_keepstatus.cpp +++ b/plugins/StatusPlugins/KeepStatus/action_keepstatus.cpp @@ -2,7 +2,6 @@ #include "keepstatus.h" #include "../resource.h" #include "m_trigger.h" -#include "../../helpers/db_helpers.h" extern HINSTANCE hInst; @@ -13,12 +12,12 @@ static BOOL ProtocolEnabled(DWORD id, char *szPrefix, REPORTINFO *ri, char *szPr { char dbSetting[128]; _snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s_%s", szPrefix, id, szProto, SETTING_PROTO_ENABLED); - if (db_getb(dbSetting, 0)) + if ( db_get_b(NULL, MODULENAME, dbSetting, 0)) return TRUE; if ( ri != NULL && ri->td != NULL && (ri->td->dFlags & DF_PROTO) && !strcmp(szProto, ri->td->szProto)) { _snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s_%s", szPrefix, id, STR_PROTOFROMTRIGGER, SETTING_PROTO_ENABLED); - return db_getb(dbSetting, 0); + return db_get_b(NULL, MODULENAME, dbSetting, 0); } return FALSE; @@ -53,7 +52,7 @@ static void BuildProtoList(HWND hList, BOOL bFromTrigger, char* szPrefix, DWORD ListView_InsertItem(hList, &lvItem); _snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s_%s", szPrefix, id, protos[i]->szModuleName, SETTING_PROTO_ENABLED); - ListView_SetCheckState(hList, lvItem.iItem, db_getb(dbSetting, 0)); + ListView_SetCheckState(hList, lvItem.iItem, db_get_b(NULL, MODULENAME, dbSetting, 0)); ListView_SetItem(hList, &lvItem); lvItem.iItem++; if (lvItem.pszText != NULL) @@ -64,7 +63,7 @@ static void BuildProtoList(HWND hList, BOOL bFromTrigger, char* szPrefix, DWORD ListView_InsertItem(hList, &lvItem); lvItem.lParam = (LPARAM)STR_PROTOFROMTRIGGER; _snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s_%s", szPrefix, id, STR_PROTOFROMTRIGGER, SETTING_PROTO_ENABLED); - ListView_SetCheckState(hList, lvItem.iItem, db_getb(dbSetting, 0)); + ListView_SetCheckState(hList, lvItem.iItem, db_get_b(NULL, MODULENAME, dbSetting, 0)); ListView_SetItem(hList, &lvItem); lvItem.iItem++; } @@ -84,10 +83,10 @@ static void SaveProtoList(HWND hList, char *szPrefix, DWORD id) char dbSetting[128]; _snprintf(dbSetting, sizeof(dbSetting), "%s%u_%s_%s", szPrefix, id, (const char*)lvItem.lParam, SETTING_PROTO_ENABLED); if (ListView_GetCheckState(hList, lvItem.iItem)) - db_setb(dbSetting, TRUE); + db_set_b(NULL, MODULENAME, dbSetting, TRUE); else { log_debugA("deleting: %s", dbSetting); - db_del(dbSetting); + db_unset(NULL, MODULENAME, dbSetting); } } } diff --git a/plugins/StatusPlugins/StartupStatus/options.cpp b/plugins/StatusPlugins/StartupStatus/options.cpp index a790561310..63edb34d4c 100644 --- a/plugins/StatusPlugins/StartupStatus/options.cpp +++ b/plugins/StatusPlugins/StartupStatus/options.cpp @@ -16,6 +16,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + #include "../commonstatus.h" #include "startupstatus.h" #include "../resource.h" @@ -552,19 +553,19 @@ static INT_PTR CALLBACK StatusProfilesOptDlgProc(HWND hwndDlg,UINT msg,WPARAM wP if ( ar[j].szMsg != NULL) ar[j].szMsg = _strdup( ar[j].szMsg ); - dat[i].szName = dbi_getAs(i, SETTING_PROFILENAME, NULL); + dat[i].szName = db_get_sa(NULL, MODULENAME, OptName(i, SETTING_PROFILENAME)); if (dat[i].szName == NULL) { if (i == defProfile) dat[i].szName = _strdup(Translate("default")); else dat[i].szName = _strdup(Translate("unknown")); } - dat[i].createTtb = dbi_getb(i, SETTING_CREATETTBBUTTON, 0); - dat[i].showDialog = dbi_getb(i, SETTING_SHOWCONFIRMDIALOG, 0); - dat[i].createMmi = dbi_getb(i, SETTING_CREATEMMITEM, 0); - dat[i].inSubMenu = dbi_getb(i, SETTING_INSUBMENU, 1); - dat[i].regHotkey = dbi_getb(i, SETTING_REGHOTKEY, 0); - dat[i].hotKey = dbi_getw(i, SETTING_HOTKEY, MAKEWORD((char)('0'+i), HOTKEYF_CONTROL|HOTKEYF_SHIFT)); + dat[i].createTtb = db_get_b(NULL, MODULENAME, OptName(i, SETTING_CREATETTBBUTTON), 0); + dat[i].showDialog = db_get_b(NULL, MODULENAME, OptName(i, SETTING_SHOWCONFIRMDIALOG), 0); + dat[i].createMmi = db_get_b(NULL, MODULENAME, OptName(i, SETTING_CREATEMMITEM), 0); + dat[i].inSubMenu = db_get_b(NULL, MODULENAME, OptName(i, SETTING_INSUBMENU), 1); + dat[i].regHotkey = db_get_b(NULL, MODULENAME, OptName(i, SETTING_REGHOTKEY), 0); + dat[i].hotKey = db_get_w(NULL, MODULENAME, OptName(i, SETTING_HOTKEY), MAKEWORD((char)('0'+i), HOTKEYF_CONTROL|HOTKEYF_SHIFT)); } } if ( !ServiceExists( MS_TTB_ADDBUTTON ) && !ServiceExists( MS_TB_ADDBUTTON )) @@ -847,21 +848,21 @@ static INT_PTR CALLBACK StatusProfilesOptDlgProc(HWND hwndDlg,UINT msg,WPARAM wP ClearDatabase(setting); } for (i=0;i #include #include "version.h" + #define MODULENAME "StartupStatus" -#include "../../helpers/db_helpers.h" struct TSSSetting : public PROTOCOLSETTINGEX { @@ -131,6 +131,7 @@ typedef struct { // options int OptionsInit(WPARAM wparam,LPARAM lparam); +char* OptName(int i, const char* setting); // startupstatus int LoadMainOptions(); diff --git a/plugins/StatusPlugins/commonstatus.h b/plugins/StatusPlugins/commonstatus.h index e0909e94ac..797fd6ed4b 100644 --- a/plugins/StatusPlugins/commonstatus.h +++ b/plugins/StatusPlugins/commonstatus.h @@ -39,6 +39,7 @@ #include #include #include +#include #include #include #include -- cgit v1.2.3