diff options
author | George Hazan <george.hazan@gmail.com> | 2012-07-01 10:21:56 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2012-07-01 10:21:56 +0000 |
commit | a41c9020b7fcbc4d05fcb37097177cc0efc7cdce (patch) | |
tree | 5bda74986883a9152123474152c6546547211b9d /plugins/StatusPlugins | |
parent | 0ae8779546586eba91408d03949d45ec9ced5133 (diff) |
db_helpers.cpp deleted
git-svn-id: http://svn.miranda-ng.org/main/trunk@708 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/StatusPlugins')
-rw-r--r-- | plugins/StatusPlugins/KeepStatus/action_keepstatus.cpp | 13 | ||||
-rw-r--r-- | plugins/StatusPlugins/StartupStatus/options.cpp | 42 | ||||
-rw-r--r-- | plugins/StatusPlugins/StartupStatus/profiles.cpp | 12 | ||||
-rw-r--r-- | plugins/StatusPlugins/StartupStatus/startupstatus.h | 3 | ||||
-rw-r--r-- | plugins/StatusPlugins/commonstatus.h | 1 |
5 files changed, 40 insertions, 31 deletions
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<profileCount;i++) {
- dbi_setb(i, SETTING_SHOWCONFIRMDIALOG, dat[i].showDialog);
- dbi_setb(i, SETTING_CREATETTBBUTTON, dat[i].createTtb);
- dbi_setb(i, SETTING_CREATEMMITEM, dat[i].createMmi);
- dbi_setb(i, SETTING_INSUBMENU, dat[i].inSubMenu);
- dbi_setb(i, SETTING_REGHOTKEY, dat[i].regHotkey);
- dbi_setw(i, SETTING_HOTKEY, dat[i].hotKey);
- dbi_setAs(i, SETTING_PROFILENAME, dat[i].szName);
+ db_set_b(NULL, MODULENAME, OptName(i, SETTING_SHOWCONFIRMDIALOG), dat[i].showDialog);
+ db_set_b(NULL, MODULENAME, OptName(i, SETTING_CREATETTBBUTTON), dat[i].createTtb);
+ db_set_b(NULL, MODULENAME, OptName(i, SETTING_CREATEMMITEM), dat[i].createMmi);
+ db_set_b(NULL, MODULENAME, OptName(i, SETTING_INSUBMENU), dat[i].inSubMenu);
+ db_set_b(NULL, MODULENAME, OptName(i, SETTING_REGHOTKEY), dat[i].regHotkey);
+ db_set_w(NULL, MODULENAME, OptName(i, SETTING_HOTKEY), dat[i].hotKey);
+ db_set_s(NULL, MODULENAME, OptName(i, SETTING_PROFILENAME), dat[i].szName);
TSettingsList& ar = *dat[i].ps;
for ( j=0; j < ar.getCount(); j++ ) {
if ( ar[j].szMsg != NULL ) {
mir_snprintf(setting, sizeof(setting), "%s_%s", ar[j].szName, SETTING_PROFILE_STSMSG);
- dbi_setAs(i, setting, ar[j].szMsg);
+ db_set_s(NULL, MODULENAME, OptName(i, setting), ar[j].szMsg);
}
- dbi_setw(i, ar[j].szName, ar[j].status);
+ db_set_w(NULL, MODULENAME, OptName(i, ar[j].szName), ar[j].status);
}
}
DBWriteContactSettingWord(NULL, MODULENAME, SETTING_PROFILECOUNT, (WORD)profileCount);
@@ -988,7 +989,7 @@ static int ClearDatabase(char* filter) dbces.lParam = (LPARAM)&settings;
dbces.pfnEnumProc = DeleteSetting;
CallService(MS_DB_CONTACT_ENUMSETTINGS,(WPARAM)NULL,(LPARAM)&dbces);
- for (i=0;i<settingCount;i++) {
+ for (i=0; i < settingCount; i++) {
if ((filter == NULL) || (!strncmp(filter, settings[i], strlen(filter))))
DBDeleteContactSetting(NULL, MODULENAME, settings[i]);
free(settings[i]);
@@ -1016,3 +1017,10 @@ static int DeleteSetting(const char *szSetting,LPARAM lParam) return 0;
}
+
+char* OptName(int i, const char* setting)
+{
+ static char buf[100];
+ mir_snprintf(buf, sizeof(buf), "%d_%s", i, setting);
+ return buf;
+}
diff --git a/plugins/StatusPlugins/StartupStatus/profiles.cpp b/plugins/StatusPlugins/StartupStatus/profiles.cpp index 309c249a6a..3d93f1b37d 100644 --- a/plugins/StatusPlugins/StartupStatus/profiles.cpp +++ b/plugins/StatusPlugins/StartupStatus/profiles.cpp @@ -98,12 +98,12 @@ static int CreateMainMenuItems(WPARAM wParam, LPARAM lParam) mi.popupPosition = 2000100000;
mcount = 0;
count = GetProfileCount(0, 0);
- for (i=0;i<count;i++) {
- if ( !dbi_getb(i, SETTING_CREATEMMITEM, 0) || GetProfileName((WPARAM)i, (LPARAM)profilename))
+ for (i=0; i < count; i++) {
+ if ( !db_get_b(NULL, MODULENAME, OptName(i, SETTING_CREATEMMITEM), 0) || GetProfileName((WPARAM)i, (LPARAM)profilename))
continue;
- if (dbi_getb(i, SETTING_INSUBMENU, 1))
- mi.pszPopupName = Translate("StatusProfiles");
+ if ( db_get_b(NULL, MODULENAME, OptName(i, SETTING_INSUBMENU), 1))
+ mi.pszPopupName = "StatusProfiles";
mi.pszName = profilename;
mi.position = 2000100000 + mcount;
@@ -315,10 +315,10 @@ static int RegisterHotKeys() int count = GetProfileCount(0, 0);
for ( int i=0; i < count; i++ ) {
- if (!dbi_getb(i, SETTING_REGHOTKEY, 0))
+ if (!db_get_b(NULL, MODULENAME, OptName(i, SETTING_REGHOTKEY), 0))
continue;
- WORD wHotKey = dbi_getw(i, SETTING_HOTKEY, 0);
+ WORD wHotKey = db_get_w(NULL, MODULENAME, OptName(i, SETTING_HOTKEY), 0);
hkInfo = ( HKINFO* )realloc(hkInfo, (hkiCount+1)*sizeof(HKINFO));
if (hkInfo == NULL)
return -1;
diff --git a/plugins/StatusPlugins/StartupStatus/startupstatus.h b/plugins/StatusPlugins/StartupStatus/startupstatus.h index 0d9a325839..e3ce6e8acb 100644 --- a/plugins/StatusPlugins/StartupStatus/startupstatus.h +++ b/plugins/StatusPlugins/StartupStatus/startupstatus.h @@ -27,8 +27,8 @@ #include <m_toptoolbar.h>
#include <m_toolbar.h>
#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 <m_database.h>
#include <m_protosvc.h>
#include <m_clist.h>
+#include <m_clistint.h>
#include <m_langpack.h>
#include <m_popup.h>
#include <m_variables.h>
|