summaryrefslogtreecommitdiff
path: root/plugins/StatusPlugins/StartupStatus
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2013-03-24 10:14:44 +0000
committerGeorge Hazan <george.hazan@gmail.com>2013-03-24 10:14:44 +0000
commitc1b07589623a9d8401982e10a38faaddecd42496 (patch)
treef4458e6fc2a6dceac7672794316ef69aa81c993c /plugins/StatusPlugins/StartupStatus
parent16b08498841634e581ef4e366d9a0bb533e6b513 (diff)
StartupStatus:
- Unicode profile names; - the correct profile is displayed in the confirmation dialog - special resource files for VC6 removed; - code cleaning; - version bump. git-svn-id: http://svn.miranda-ng.org/main/trunk@4172 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/StatusPlugins/StartupStatus')
-rw-r--r--plugins/StatusPlugins/StartupStatus/main.cpp12
-rw-r--r--plugins/StatusPlugins/StartupStatus/options.cpp161
-rw-r--r--plugins/StatusPlugins/StartupStatus/profiles.cpp65
-rw-r--r--plugins/StatusPlugins/StartupStatus/startupstatus.cpp90
-rw-r--r--plugins/StatusPlugins/StartupStatus/startupstatus.h5
-rw-r--r--plugins/StatusPlugins/StartupStatus/toolbars.cpp4
-rw-r--r--plugins/StatusPlugins/StartupStatus/vc6.rc3
-rw-r--r--plugins/StatusPlugins/StartupStatus/version.h2
8 files changed, 164 insertions, 178 deletions
diff --git a/plugins/StatusPlugins/StartupStatus/main.cpp b/plugins/StatusPlugins/StartupStatus/main.cpp
index e259aaf13a..65488c63a5 100644
--- a/plugins/StatusPlugins/StartupStatus/main.cpp
+++ b/plugins/StatusPlugins/StartupStatus/main.cpp
@@ -75,17 +75,17 @@ extern "C" int __declspec(dllexport) Load(void)
mir_getLP( &pluginInfoEx );
pcli = (CLIST_INTERFACE*)CallService( MS_CLIST_RETRIEVE_INTERFACE, 0, 0);
- if ( DBGetContactSettingByte(NULL, MODULENAME, SETTING_SETPROFILE, 1) ||
- DBGetContactSettingByte(NULL, MODULENAME, SETTING_OFFLINECLOSE, 0))
- DBWriteContactSettingWord(NULL, "CList", "Status", (WORD)ID_STATUS_OFFLINE);
+ if ( db_get_b(NULL, MODULENAME, SETTING_SETPROFILE, 1) ||
+ db_get_b(NULL, MODULENAME, SETTING_OFFLINECLOSE, 0))
+ db_set_w(NULL, "CList", "Status", (WORD)ID_STATUS_OFFLINE);
// docking
- if (DBGetContactSettingByte(NULL, MODULENAME, SETTING_SETDOCKED, 0)) {
- int docked = DBGetContactSettingByte(NULL, MODULENAME, SETTING_DOCKED, DOCKED_NONE);
+ if (db_get_b(NULL, MODULENAME, SETTING_SETDOCKED, 0)) {
+ int docked = db_get_b(NULL, MODULENAME, SETTING_DOCKED, DOCKED_NONE);
if ( docked == DOCKED_LEFT || docked == DOCKED_RIGHT )
docked = -docked;
- DBWriteContactSettingByte(NULL, MODULE_CLIST, SETTING_DOCKED, (BYTE)docked);
+ db_set_b(NULL, MODULE_CLIST, SETTING_DOCKED, (BYTE)docked);
}
// Create service functions; the get functions are created here; they don't rely on commonstatus
diff --git a/plugins/StatusPlugins/StartupStatus/options.cpp b/plugins/StatusPlugins/StartupStatus/options.cpp
index 044913f69e..5d1d4a0ad8 100644
--- a/plugins/StatusPlugins/StartupStatus/options.cpp
+++ b/plugins/StatusPlugins/StartupStatus/options.cpp
@@ -96,7 +96,7 @@ static char* GetCMDLArguments(TSettingsList& protoSettings)
pnt = cmdl + strlen(cmdl);
} }
- if ( DBGetContactSettingByte( NULL, MODULENAME, SETTING_SHOWDIALOG, FALSE ) == TRUE ) {
+ if ( db_get_b( NULL, MODULENAME, SETTING_SHOWDIALOG, FALSE ) == TRUE ) {
*pnt++ = ' ';
*pnt++ = '\0';
cmdl = ( char* )realloc(cmdl, strlen(cmdl) + 12);
@@ -282,24 +282,24 @@ static INT_PTR CALLBACK StartupStatusOptDlgProc(HWND hwndDlg,UINT msg,WPARAM wPa
bInitDone = FALSE;
TranslateDialogDefault(hwndDlg);
- CheckDlgButton(hwndDlg, IDC_SETPROFILE, DBGetContactSettingByte(NULL, MODULENAME, SETTING_SETPROFILE, 1)?TRUE:FALSE);
- CheckDlgButton(hwndDlg, IDC_OVERRIDE, DBGetContactSettingByte(NULL, MODULENAME, SETTING_OVERRIDE, 1)?TRUE:FALSE);
- CheckDlgButton(hwndDlg, IDC_SHOWDIALOG, DBGetContactSettingByte(NULL, MODULENAME, SETTING_SHOWDIALOG, 0)?TRUE:FALSE);
- CheckDlgButton(hwndDlg, IDC_SETWINSTATE, DBGetContactSettingByte(NULL, MODULENAME, SETTING_SETWINSTATE, 0)?TRUE:FALSE);
- CheckDlgButton(hwndDlg, IDC_SETWINLOCATION, DBGetContactSettingByte(NULL, MODULENAME, SETTING_SETWINLOCATION, 0)?TRUE:FALSE);
- CheckDlgButton(hwndDlg, IDC_SETDOCKED, DBGetContactSettingByte(NULL, MODULENAME, SETTING_SETDOCKED, 0)?TRUE:FALSE);
- CheckDlgButton(hwndDlg, IDC_SETWINSIZE, DBGetContactSettingByte(NULL, MODULENAME, SETTING_SETWINSIZE, 0)?TRUE:FALSE);
- CheckDlgButton(hwndDlg, IDC_OFFLINECLOSE, DBGetContactSettingByte(NULL, MODULENAME, SETTING_OFFLINECLOSE, 1)?TRUE:FALSE);
- CheckDlgButton(hwndDlg, IDC_AUTODIAL, DBGetContactSettingByte(NULL, MODULENAME, SETTING_AUTODIAL, 0)?TRUE:FALSE);
- CheckDlgButton(hwndDlg, IDC_AUTOHANGUP, DBGetContactSettingByte(NULL, MODULENAME, SETTING_AUTOHANGUP, 0)?TRUE:FALSE);
- SetDlgItemInt(hwndDlg, IDC_SETPROFILEDELAY, DBGetContactSettingDword(NULL, MODULENAME, SETTING_SETPROFILEDELAY, 500), FALSE);
- SetDlgItemInt(hwndDlg, IDC_DLGTIMEOUT, DBGetContactSettingDword(NULL, MODULENAME, SETTING_DLGTIMEOUT, 5), FALSE);
- SetDlgItemInt(hwndDlg, IDC_XPOS, DBGetContactSettingDword(NULL, MODULENAME, SETTING_XPOS, 0), TRUE);
- SetDlgItemInt(hwndDlg, IDC_YPOS, DBGetContactSettingDword(NULL, MODULENAME, SETTING_YPOS, 0), TRUE);
- SetDlgItemInt(hwndDlg, IDC_WIDTH, DBGetContactSettingDword(NULL, MODULENAME, SETTING_WIDTH, 0), FALSE);
- SetDlgItemInt(hwndDlg, IDC_HEIGHT, DBGetContactSettingDword(NULL, MODULENAME, SETTING_HEIGHT, 0), FALSE);
+ CheckDlgButton(hwndDlg, IDC_SETPROFILE, db_get_b(NULL, MODULENAME, SETTING_SETPROFILE, 1)?TRUE:FALSE);
+ CheckDlgButton(hwndDlg, IDC_OVERRIDE, db_get_b(NULL, MODULENAME, SETTING_OVERRIDE, 1)?TRUE:FALSE);
+ CheckDlgButton(hwndDlg, IDC_SHOWDIALOG, db_get_b(NULL, MODULENAME, SETTING_SHOWDIALOG, 0)?TRUE:FALSE);
+ CheckDlgButton(hwndDlg, IDC_SETWINSTATE, db_get_b(NULL, MODULENAME, SETTING_SETWINSTATE, 0)?TRUE:FALSE);
+ CheckDlgButton(hwndDlg, IDC_SETWINLOCATION, db_get_b(NULL, MODULENAME, SETTING_SETWINLOCATION, 0)?TRUE:FALSE);
+ CheckDlgButton(hwndDlg, IDC_SETDOCKED, db_get_b(NULL, MODULENAME, SETTING_SETDOCKED, 0)?TRUE:FALSE);
+ CheckDlgButton(hwndDlg, IDC_SETWINSIZE, db_get_b(NULL, MODULENAME, SETTING_SETWINSIZE, 0)?TRUE:FALSE);
+ CheckDlgButton(hwndDlg, IDC_OFFLINECLOSE, db_get_b(NULL, MODULENAME, SETTING_OFFLINECLOSE, 1)?TRUE:FALSE);
+ CheckDlgButton(hwndDlg, IDC_AUTODIAL, db_get_b(NULL, MODULENAME, SETTING_AUTODIAL, 0)?TRUE:FALSE);
+ CheckDlgButton(hwndDlg, IDC_AUTOHANGUP, db_get_b(NULL, MODULENAME, SETTING_AUTOHANGUP, 0)?TRUE:FALSE);
+ SetDlgItemInt(hwndDlg, IDC_SETPROFILEDELAY, db_get_dw(NULL, MODULENAME, SETTING_SETPROFILEDELAY, 500), FALSE);
+ SetDlgItemInt(hwndDlg, IDC_DLGTIMEOUT, db_get_dw(NULL, MODULENAME, SETTING_DLGTIMEOUT, 5), FALSE);
+ SetDlgItemInt(hwndDlg, IDC_XPOS, db_get_dw(NULL, MODULENAME, SETTING_XPOS, 0), TRUE);
+ SetDlgItemInt(hwndDlg, IDC_YPOS, db_get_dw(NULL, MODULENAME, SETTING_YPOS, 0), TRUE);
+ SetDlgItemInt(hwndDlg, IDC_WIDTH, db_get_dw(NULL, MODULENAME, SETTING_WIDTH, 0), FALSE);
+ SetDlgItemInt(hwndDlg, IDC_HEIGHT, db_get_dw(NULL, MODULENAME, SETTING_HEIGHT, 0), FALSE);
{
- int val = DBGetContactSettingByte(NULL, MODULENAME, SETTING_DOCKED, DOCKED_NONE);
+ int val = db_get_b(NULL, MODULENAME, SETTING_DOCKED, DOCKED_NONE);
int item = SendDlgItemMessage(hwndDlg, IDC_DOCKED, CB_ADDSTRING, 0, (LPARAM)TranslateT("Left"));
SendDlgItemMessage(hwndDlg, IDC_DOCKED, CB_SETITEMDATA, (WPARAM)item, (LPARAM)DOCKED_LEFT);
if (val == DOCKED_LEFT)
@@ -340,13 +340,13 @@ static INT_PTR CALLBACK StartupStatusOptDlgProc(HWND hwndDlg,UINT msg,WPARAM wPa
else {
TCHAR text[128];
mir_sntprintf(text, SIZEOF(text), TranslateT("size: %d x %d"),
- DBGetContactSettingDword(NULL, MODULE_CLIST, SETTING_WIDTH, 0),
- DBGetContactSettingDword(NULL, MODULE_CLIST, SETTING_HEIGHT, 0));
+ db_get_dw(NULL, MODULE_CLIST, SETTING_WIDTH, 0),
+ db_get_dw(NULL, MODULE_CLIST, SETTING_HEIGHT, 0));
SetDlgItemText(hwndDlg, IDC_CURWINSIZE, text);
mir_sntprintf(text, SIZEOF(text), TranslateT("loc: %d x %d"),
- DBGetContactSettingDword(NULL, MODULE_CLIST, SETTING_XPOS, 0),
- DBGetContactSettingDword(NULL, MODULE_CLIST, SETTING_YPOS, 0));
+ db_get_dw(NULL, MODULE_CLIST, SETTING_XPOS, 0),
+ db_get_dw(NULL, MODULE_CLIST, SETTING_YPOS, 0));
SetDlgItemText(hwndDlg, IDC_CURWINLOC, text);
}
break;
@@ -358,19 +358,19 @@ static INT_PTR CALLBACK StartupStatusOptDlgProc(HWND hwndDlg,UINT msg,WPARAM wPa
int defProfile;
int profileCount = GetProfileCount((WPARAM)&defProfile, 0);
for ( int i=0; i < profileCount; i++ ) {
- char profileName[128];
- if (GetProfileName((WPARAM)i, (LPARAM)profileName))
+ TCHAR profileName[128];
+ if ( GetProfileName(i, (LPARAM)profileName))
continue;
- int item = SendDlgItemMessageA(hwndDlg, IDC_PROFILE, CB_ADDSTRING, 0, (LPARAM)profileName);
- SendDlgItemMessage(hwndDlg, IDC_PROFILE, CB_SETITEMDATA, (WPARAM)item, (LPARAM)i);
+ int item = SendDlgItemMessage(hwndDlg, IDC_PROFILE, CB_ADDSTRING, 0, (LPARAM)profileName);
+ SendDlgItemMessage(hwndDlg, IDC_PROFILE, CB_SETITEMDATA, item, i);
}
- SendDlgItemMessage(hwndDlg, IDC_PROFILE, CB_SETCURSEL, (WPARAM)defProfile, 0);
+ SendDlgItemMessage(hwndDlg, IDC_PROFILE, CB_SETCURSEL, defProfile, 0);
}
break;
case UM_REINITDOCKED:
- EnableWindow(GetDlgItem(hwndDlg, IDC_SETDOCKED), DBGetContactSettingByte(NULL, MODULE_CLIST, SETTING_TOOLWINDOW, 1));
+ EnableWindow(GetDlgItem(hwndDlg, IDC_SETDOCKED), db_get_b(NULL, MODULE_CLIST, SETTING_TOOLWINDOW, 1));
if (!IsWindowEnabled(GetDlgItem(hwndDlg,IDC_SETDOCKED)))
CheckDlgButton(hwndDlg, IDC_SETDOCKED, BST_UNCHECKED);
@@ -379,30 +379,30 @@ static INT_PTR CALLBACK StartupStatusOptDlgProc(HWND hwndDlg,UINT msg,WPARAM wPa
case UM_REINITWINSTATE:
{
- int val = DBGetContactSettingByte(NULL, MODULENAME, SETTING_WINSTATE, SETTING_STATE_NORMAL);
+ int val = db_get_b(NULL, MODULENAME, SETTING_WINSTATE, SETTING_STATE_NORMAL);
SendDlgItemMessage(hwndDlg, IDC_WINSTATE, CB_RESETCONTENT, 0, 0);
int item = SendDlgItemMessage(hwndDlg, IDC_WINSTATE, CB_ADDSTRING, 0, (LPARAM)TranslateT("Hidden"));
- SendDlgItemMessage(hwndDlg, IDC_WINSTATE, CB_SETITEMDATA, (WPARAM)item, (LPARAM)SETTING_STATE_HIDDEN);
+ SendDlgItemMessage(hwndDlg, IDC_WINSTATE, CB_SETITEMDATA, item, (LPARAM)SETTING_STATE_HIDDEN);
if (val == SETTING_STATE_HIDDEN)
- SendDlgItemMessage(hwndDlg, IDC_WINSTATE, CB_SETCURSEL, (WPARAM)item, 0);
+ SendDlgItemMessage(hwndDlg, IDC_WINSTATE, CB_SETCURSEL, item, 0);
- if (!DBGetContactSettingByte(NULL, MODULE_CLIST, SETTING_TOOLWINDOW, 0)) {
+ if (!db_get_b(NULL, MODULE_CLIST, SETTING_TOOLWINDOW, 0)) {
item = SendDlgItemMessage(hwndDlg, IDC_WINSTATE, CB_ADDSTRING, 0, (LPARAM)TranslateT("Minimized"));
- SendDlgItemMessage(hwndDlg, IDC_WINSTATE, CB_SETITEMDATA, (WPARAM)item, (LPARAM)SETTING_STATE_MINIMIZED);
+ SendDlgItemMessage(hwndDlg, IDC_WINSTATE, CB_SETITEMDATA, item, SETTING_STATE_MINIMIZED);
if (val == SETTING_STATE_MINIMIZED)
- SendDlgItemMessage(hwndDlg, IDC_WINSTATE, CB_SETCURSEL, (WPARAM)item, 0);
+ SendDlgItemMessage(hwndDlg, IDC_WINSTATE, CB_SETCURSEL, item, 0);
}
item = SendDlgItemMessage(hwndDlg, IDC_WINSTATE, CB_ADDSTRING, 0, (LPARAM)TranslateT("Normal"));
- SendDlgItemMessage(hwndDlg, IDC_WINSTATE, CB_SETITEMDATA, (WPARAM)item, (LPARAM)SETTING_STATE_NORMAL);
- if ( val == SETTING_STATE_NORMAL || (val == SETTING_STATE_MINIMIZED) && DBGetContactSettingByte(NULL, MODULE_CLIST, SETTING_TOOLWINDOW, 0))
- SendDlgItemMessage(hwndDlg, IDC_WINSTATE, CB_SETCURSEL, (WPARAM)item, 0);
+ SendDlgItemMessage(hwndDlg, IDC_WINSTATE, CB_SETITEMDATA, item, SETTING_STATE_NORMAL);
+ if ( val == SETTING_STATE_NORMAL || (val == SETTING_STATE_MINIMIZED) && db_get_b(NULL, MODULE_CLIST, SETTING_TOOLWINDOW, 0))
+ SendDlgItemMessage(hwndDlg, IDC_WINSTATE, CB_SETCURSEL, item, 0);
}
break;
case UM_REINITWINSIZE:
EnableWindow(GetDlgItem(hwndDlg, IDC_WIDTH), IsDlgButtonChecked(hwndDlg, IDC_SETWINSIZE));
- EnableWindow(GetDlgItem(hwndDlg, IDC_HEIGHT), !DBGetContactSettingByte(NULL, MODULE_CLUI, SETTING_AUTOSIZE, 0)&&IsDlgButtonChecked(hwndDlg, IDC_SETWINSIZE));
+ EnableWindow(GetDlgItem(hwndDlg, IDC_HEIGHT), !db_get_b(NULL, MODULE_CLUI, SETTING_AUTOSIZE, 0)&&IsDlgButtonChecked(hwndDlg, IDC_SETWINSIZE));
case WM_COMMAND:
if ( HIWORD(wParam) == BN_CLICKED || HIWORD(wParam) == LBN_SELCHANGE || HIWORD(wParam) == CBN_SELCHANGE || HIWORD(wParam) == EN_CHANGE )
@@ -467,45 +467,45 @@ static INT_PTR CALLBACK StartupStatusOptDlgProc(HWND hwndDlg,UINT msg,WPARAM wPa
if (((LPNMHDR)lParam)->code == PSN_APPLY) {
int val;
- DBWriteContactSettingByte(NULL, MODULENAME, SETTING_SETPROFILE, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SETPROFILE));
+ db_set_b(NULL, MODULENAME, SETTING_SETPROFILE, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SETPROFILE));
if (IsDlgButtonChecked(hwndDlg, IDC_SETPROFILE))
- DBWriteContactSettingDword(NULL, MODULENAME, SETTING_SETPROFILEDELAY, GetDlgItemInt(hwndDlg, IDC_SETPROFILEDELAY, NULL, FALSE));
+ db_set_dw(NULL, MODULENAME, SETTING_SETPROFILEDELAY, GetDlgItemInt(hwndDlg, IDC_SETPROFILEDELAY, NULL, FALSE));
if (IsDlgButtonChecked(hwndDlg, IDC_SETPROFILE) || IsDlgButtonChecked(hwndDlg, IDC_SHOWDIALOG)) {
val = (int)SendDlgItemMessage(hwndDlg, IDC_PROFILE, CB_GETITEMDATA,
SendDlgItemMessage(hwndDlg, IDC_PROFILE, CB_GETCURSEL, 0, 0), 0);
- DBWriteContactSettingWord(NULL, MODULENAME, SETTING_DEFAULTPROFILE, (WORD)val);
+ db_set_w(NULL, MODULENAME, SETTING_DEFAULTPROFILE, (WORD)val);
}
- DBWriteContactSettingByte(NULL, MODULENAME, SETTING_OVERRIDE, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_OVERRIDE));
- DBWriteContactSettingByte(NULL, MODULENAME, SETTING_SHOWDIALOG, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SHOWDIALOG));
+ db_set_b(NULL, MODULENAME, SETTING_OVERRIDE, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_OVERRIDE));
+ db_set_b(NULL, MODULENAME, SETTING_SHOWDIALOG, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SHOWDIALOG));
if (IsDlgButtonChecked(hwndDlg, IDC_SHOWDIALOG))
- DBWriteContactSettingDword(NULL, MODULENAME, SETTING_DLGTIMEOUT, GetDlgItemInt(hwndDlg, IDC_DLGTIMEOUT, NULL, FALSE));
+ db_set_dw(NULL, MODULENAME, SETTING_DLGTIMEOUT, GetDlgItemInt(hwndDlg, IDC_DLGTIMEOUT, NULL, FALSE));
- DBWriteContactSettingByte(NULL, MODULENAME, SETTING_SETWINSTATE, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SETWINSTATE));
+ db_set_b(NULL, MODULENAME, SETTING_SETWINSTATE, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SETWINSTATE));
if (IsDlgButtonChecked(hwndDlg, IDC_SETWINSTATE)) {
val = (int)SendDlgItemMessage(hwndDlg, IDC_WINSTATE, CB_GETITEMDATA,
SendDlgItemMessage(hwndDlg, IDC_WINSTATE, CB_GETCURSEL, 0, 0), 0);
- DBWriteContactSettingByte(NULL, MODULENAME, SETTING_WINSTATE, (BYTE)val);
+ db_set_b(NULL, MODULENAME, SETTING_WINSTATE, (BYTE)val);
}
- DBWriteContactSettingByte(NULL, MODULENAME, SETTING_SETDOCKED, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SETDOCKED));
+ db_set_b(NULL, MODULENAME, SETTING_SETDOCKED, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SETDOCKED));
if (IsDlgButtonChecked(hwndDlg, IDC_SETDOCKED)) {
val = (int)SendDlgItemMessage(hwndDlg, IDC_DOCKED, CB_GETITEMDATA,
SendDlgItemMessage(hwndDlg, IDC_DOCKED, CB_GETCURSEL, 0, 0), 0);
- DBWriteContactSettingByte(NULL, MODULENAME, SETTING_DOCKED, (BYTE)val);
+ db_set_b(NULL, MODULENAME, SETTING_DOCKED, (BYTE)val);
}
- DBWriteContactSettingByte(NULL, MODULENAME, SETTING_SETWINLOCATION, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SETWINLOCATION));
+ db_set_b(NULL, MODULENAME, SETTING_SETWINLOCATION, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SETWINLOCATION));
if (IsDlgButtonChecked(hwndDlg, IDC_SETWINLOCATION)) {
- DBWriteContactSettingDword(NULL, MODULENAME, SETTING_XPOS, GetDlgItemInt(hwndDlg, IDC_XPOS, NULL, TRUE));
- DBWriteContactSettingDword(NULL, MODULENAME, SETTING_YPOS, GetDlgItemInt(hwndDlg, IDC_YPOS, NULL, TRUE));
+ db_set_dw(NULL, MODULENAME, SETTING_XPOS, GetDlgItemInt(hwndDlg, IDC_XPOS, NULL, TRUE));
+ db_set_dw(NULL, MODULENAME, SETTING_YPOS, GetDlgItemInt(hwndDlg, IDC_YPOS, NULL, TRUE));
}
- DBWriteContactSettingByte(NULL, MODULENAME, SETTING_SETWINSIZE, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SETWINSIZE));
+ db_set_b(NULL, MODULENAME, SETTING_SETWINSIZE, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SETWINSIZE));
if (IsDlgButtonChecked(hwndDlg, IDC_SETWINSIZE)) {
- DBWriteContactSettingDword(NULL, MODULENAME, SETTING_WIDTH, GetDlgItemInt(hwndDlg, IDC_WIDTH, NULL, FALSE));
- DBWriteContactSettingDword(NULL, MODULENAME, SETTING_HEIGHT, GetDlgItemInt(hwndDlg, IDC_HEIGHT, NULL, FALSE));
+ db_set_dw(NULL, MODULENAME, SETTING_WIDTH, GetDlgItemInt(hwndDlg, IDC_WIDTH, NULL, FALSE));
+ db_set_dw(NULL, MODULENAME, SETTING_HEIGHT, GetDlgItemInt(hwndDlg, IDC_HEIGHT, NULL, FALSE));
}
- DBWriteContactSettingByte(NULL, MODULENAME, SETTING_OFFLINECLOSE, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_OFFLINECLOSE));
- DBWriteContactSettingByte(NULL, MODULENAME, SETTING_AUTODIAL, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_AUTODIAL));
- DBWriteContactSettingByte(NULL, MODULENAME, SETTING_AUTOHANGUP, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_AUTOHANGUP));
+ db_set_b(NULL, MODULENAME, SETTING_OFFLINECLOSE, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_OFFLINECLOSE));
+ db_set_b(NULL, MODULENAME, SETTING_AUTODIAL, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_AUTODIAL));
+ db_set_b(NULL, MODULENAME, SETTING_AUTOHANGUP, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_AUTOHANGUP));
}
break;
}
@@ -537,28 +537,28 @@ static INT_PTR CALLBACK StatusProfilesOptDlgProc(HWND hwndDlg,UINT msg,WPARAM wP
}
for (int i=0; i < profileCount; i++) {
- PROFILEOPTIONS* ppo = new PROFILEOPTIONS;
+ PROFILEOPTIONS *ppo = new PROFILEOPTIONS;
ppo->ps = GetCurrentProtoSettings();
TSettingsList& ar = *ppo->ps;
if ( GetProfile(i, ar) == -1) {
/* create an empty profile */
if (i == defProfile)
- ppo->szName = mir_strdup(Translate("default"));
+ ppo->tszName = mir_tstrdup( TranslateT("default"));
else
- ppo->szName = mir_strdup(Translate("unknown"));
+ ppo->tszName = mir_tstrdup( TranslateT("unknown"));
}
else {
for (int j=0; j < ar.getCount(); j++)
if ( ar[j].szMsg != NULL)
ar[j].szMsg = _tcsdup( ar[j].szMsg );
- ppo->szName = db_get_sa(NULL, MODULENAME, OptName(i, SETTING_PROFILENAME));
- if (ppo->szName == NULL) {
+ ppo->tszName = db_get_tsa(NULL, MODULENAME, OptName(i, SETTING_PROFILENAME));
+ if (ppo->tszName == NULL) {
if (i == defProfile)
- ppo->szName = mir_strdup(Translate("default"));
+ ppo->tszName = mir_tstrdup( TranslateT("default"));
else
- ppo->szName = mir_strdup(Translate("unknown"));
+ ppo->tszName = mir_tstrdup( TranslateT("unknown"));
}
ppo->createTtb = db_get_b(NULL, MODULENAME, OptName(i, SETTING_CREATETTBBUTTON), 0);
ppo->showDialog = db_get_b(NULL, MODULENAME, OptName(i, SETTING_SHOWCONFIRMDIALOG), 0);
@@ -584,7 +584,7 @@ static INT_PTR CALLBACK StatusProfilesOptDlgProc(HWND hwndDlg,UINT msg,WPARAM wP
// creates profile combo box according to 'dat'
SendDlgItemMessage(hwndDlg, IDC_PROFILE, CB_RESETCONTENT, 0, 0);
for (int i=0; i < arProfiles.getCount(); i++ ) {
- int item = SendDlgItemMessageA(hwndDlg, IDC_PROFILE, CB_ADDSTRING, 0, (LPARAM)arProfiles[i].szName);
+ int item = SendDlgItemMessage(hwndDlg, IDC_PROFILE, CB_ADDSTRING, 0, (LPARAM)arProfiles[i].tszName);
SendDlgItemMessage(hwndDlg, IDC_PROFILE, CB_SETITEMDATA, (WPARAM)item, (LPARAM)i);
}
SendDlgItemMessage(hwndDlg, IDC_PROFILE, CB_SETCURSEL, 0, 0);
@@ -676,12 +676,12 @@ static INT_PTR CALLBACK StatusProfilesOptDlgProc(HWND hwndDlg,UINT msg,WPARAM wP
case UM_ADDPROFILE:
{
- char *szName = (char *)lParam;
- if (szName == NULL)
+ TCHAR *tszName = (TCHAR*)lParam;
+ if (tszName == NULL)
break;
PROFILEOPTIONS* ppo = new PROFILEOPTIONS;
- ppo->szName = _strdup(szName);
+ ppo->tszName = mir_tstrdup(tszName);
ppo->ps = GetCurrentProtoSettings();
arProfiles.insert(ppo);
@@ -704,7 +704,7 @@ static INT_PTR CALLBACK StatusProfilesOptDlgProc(HWND hwndDlg,UINT msg,WPARAM wP
GetProfileCount((WPARAM)&defProfile, 0);
if (i == defProfile) {
MessageBox(NULL, TranslateT("Your default profile will be changed"), TranslateT("StartupStatus"), MB_OK);
- DBWriteContactSettingWord(NULL, MODULENAME, SETTING_DEFAULTPROFILE, 0);
+ db_set_w(NULL, MODULENAME, SETTING_DEFAULTPROFILE, 0);
}
SendMessage(hwndDlg, UM_REINITPROFILES, 0, 0);
break;
@@ -827,11 +827,9 @@ static INT_PTR CALLBACK StatusProfilesOptDlgProc(HWND hwndDlg,UINT msg,WPARAM wP
case WM_NOTIFY:
if (((LPNMHDR)lParam)->code == PSN_APPLY) {
- int oldCount, i, j;
char setting[128];
-
- oldCount = DBGetContactSettingWord(NULL, MODULENAME, SETTING_PROFILECOUNT, 0);
- for (i=0;i<oldCount;i++) {
+ int i, oldCount = db_get_w(NULL, MODULENAME, SETTING_PROFILECOUNT, 0);
+ for (i=0; i < oldCount; i++) {
mir_snprintf(setting, sizeof(setting), "%d_", i);
ClearDatabase(setting);
}
@@ -843,10 +841,10 @@ static INT_PTR CALLBACK StatusProfilesOptDlgProc(HWND hwndDlg,UINT msg,WPARAM wP
db_set_b(NULL, MODULENAME, OptName(i, SETTING_INSUBMENU), po.inSubMenu);
db_set_b(NULL, MODULENAME, OptName(i, SETTING_REGHOTKEY), po.regHotkey);
db_set_w(NULL, MODULENAME, OptName(i, SETTING_HOTKEY), po.hotKey);
- db_set_s(NULL, MODULENAME, OptName(i, SETTING_PROFILENAME), po.szName);
+ db_set_ts(NULL, MODULENAME, OptName(i, SETTING_PROFILENAME), po.tszName);
TSettingsList& ar = *po.ps;
- for ( j=0; j < ar.getCount(); j++ ) {
+ for (int j=0; j < ar.getCount(); j++) {
if ( ar[j].szMsg != NULL ) {
mir_snprintf(setting, sizeof(setting), "%s_%s", ar[j].szName, SETTING_PROFILE_STSMSG);
db_set_ts(NULL, MODULENAME, OptName(i, setting), ar[j].szMsg);
@@ -854,7 +852,7 @@ static INT_PTR CALLBACK StatusProfilesOptDlgProc(HWND hwndDlg,UINT msg,WPARAM wP
db_set_w(NULL, MODULENAME, OptName(i, ar[j].szName), ar[j].status);
}
}
- DBWriteContactSettingWord(NULL, MODULENAME, SETTING_PROFILECOUNT, (WORD)arProfiles.getCount());
+ db_set_w(NULL, MODULENAME, SETTING_PROFILECOUNT, (WORD)arProfiles.getCount());
// Rebuild status menu
if (bNeedRebuildMenu)
@@ -909,8 +907,7 @@ INT_PTR CALLBACK addProfileDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM lP
int OptionsInit(WPARAM wparam,LPARAM lparam)
{
- OPTIONSDIALOGPAGE odp = { 0 };
- odp.cbSize = sizeof(odp);
+ OPTIONSDIALOGPAGE odp = { sizeof(odp) };
odp.hInstance = hInst;
odp.pszGroup = LPGEN("Status");
odp.pszTitle = LPGEN("StartupStatus");
@@ -925,7 +922,6 @@ int OptionsInit(WPARAM wparam,LPARAM lparam)
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_STATUSPROFILES);
odp.pfnDlgProc = StatusProfilesOptDlgProc;
Options_AddPage(wparam,&odp);
-
return 0;
}
@@ -956,16 +952,15 @@ static int ClearDatabase(char* filter)
{
DBCONTACTENUMSETTINGS dbces;
char** settings;
- int i, settingCount;
+ int i, settingCount = 0;
- settingCount = 0;
settingIndex = 0;
dbces.szModule = MODULENAME;
dbces.lParam = (LPARAM)&settingCount;
dbces.pfnEnumProc = CountSettings;
- CallService(MS_DB_CONTACT_ENUMSETTINGS,0,(LPARAM)&dbces);
+ CallService(MS_DB_CONTACT_ENUMSETTINGS, 0, (LPARAM)&dbces);
- settings = ( char** )malloc(settingCount*sizeof(char*));
+ settings = (char**)malloc(settingCount*sizeof(char*));
dbces.lParam = (LPARAM)&settings;
dbces.pfnEnumProc = DeleteSetting;
CallService(MS_DB_CONTACT_ENUMSETTINGS,0,(LPARAM)&dbces);
diff --git a/plugins/StatusPlugins/StartupStatus/profiles.cpp b/plugins/StatusPlugins/StartupStatus/profiles.cpp
index c38364fd8d..6182262465 100644
--- a/plugins/StatusPlugins/StartupStatus/profiles.cpp
+++ b/plugins/StatusPlugins/StartupStatus/profiles.cpp
@@ -89,21 +89,23 @@ static INT_PTR profileService5(WPARAM wParam, LPARAM lParam)
static int CreateMainMenuItems(WPARAM wParam, LPARAM lParam)
{
- char profilename[128], servicename[128];
+ char servicename[128];
int i, count;
CLISTMENUITEM mi = { sizeof(mi) };
mi.popupPosition = 2000100000;
+ mi.flags = CMIF_TCHAR;
mcount = 0;
count = GetProfileCount(0, 0);
for (i=0; i < count; i++) {
- if ( !db_get_b(NULL, MODULENAME, OptName(i, SETTING_CREATEMMITEM), 0) || GetProfileName((WPARAM)i, (LPARAM)profilename))
+ TCHAR profilename[128];
+ if ( !db_get_b(NULL, MODULENAME, OptName(i, SETTING_CREATEMMITEM), 0) || GetProfileName(i, (LPARAM)profilename))
continue;
if ( db_get_b(NULL, MODULENAME, OptName(i, SETTING_INSUBMENU), 1))
mi.pszPopupName = "StatusProfiles";
- mi.pszName = profilename;
+ mi.ptszName = profilename;
mi.position = 2000100000 + mcount;
mir_snprintf(servicename, sizeof(servicename), "%s%d", MS_SS_MENUSETPROFILEPREFIX, mcount);
switch(mcount) {
@@ -130,10 +132,11 @@ static int CreateMainMenuItems(WPARAM wParam, LPARAM lParam)
return 0;
}
mi.pszService = servicename;
- if (Menu_AddStatusMenuItem(&mi)) {
+ if ( Menu_AddStatusMenuItem(&mi)) {
menuprofiles[mcount] = i;
mcount += 1;
- } }
+ }
+ }
return 0;
}
@@ -143,37 +146,36 @@ static int CreateMainMenuItems(WPARAM wParam, LPARAM lParam)
INT_PTR GetProfileName(WPARAM wParam, LPARAM lParam)
{
int profile = (int)wParam;
- char* buf = (char *)lParam;
+ TCHAR* buf = (TCHAR*)lParam;
if (wParam < 0) // get default profile
- profile = DBGetContactSettingWord(NULL, MODULENAME, SETTING_DEFAULTPROFILE, 0);
+ profile = db_get_w(NULL, MODULENAME, SETTING_DEFAULTPROFILE, 0);
- int count = DBGetContactSettingWord(NULL, MODULENAME, SETTING_PROFILECOUNT, 0);
- if ( profile >= count && count > 0 )
+ int count = db_get_w(NULL, MODULENAME, SETTING_PROFILECOUNT, 0);
+ if (profile >= count && count > 0)
return -1;
if (count == 0) {
- strncpy(buf, Translate("default"), 128-1);
+ _tcsncpy(buf, TranslateT("default"), 128-1);
return 0;
}
DBVARIANT dbv;
char setting[80];
_snprintf(setting, sizeof(setting), "%d_%s", profile, SETTING_PROFILENAME);
- if (DBGetContactSetting(NULL, MODULENAME, setting, &dbv))
+ if ( DBGetContactSettingTString(NULL, MODULENAME, setting, &dbv))
return -1;
- memset(buf, '\0', 128);
- strncpy(buf, dbv.pszVal, 128-1); // assume size >= 128
- DBFreeVariant(&dbv);
+ _tcsncpy(buf, dbv.ptszVal, 128-1); buf[127] = 0;
+ db_free(&dbv);
return 0;
}
INT_PTR GetProfileCount(WPARAM wParam, LPARAM lParam)
{
- int* def = (int *)wParam;
- int count = DBGetContactSettingWord(NULL, MODULENAME, SETTING_PROFILECOUNT, 1);
- if ( def != 0) {
- *def = DBGetContactSettingWord(NULL, MODULENAME, SETTING_DEFAULTPROFILE, 0);
+ int *def = (int*)wParam;
+ int count = db_get_w(NULL, MODULENAME, SETTING_PROFILECOUNT, 1);
+ if (def != 0) {
+ *def = db_get_w(NULL, MODULENAME, SETTING_DEFAULTPROFILE, 0);
if (*def >= count)
*def = 0;
}
@@ -194,7 +196,7 @@ TCHAR *GetStatusMessage(int profile, char *szProto)
if (pce[i].msg != NULL) {
_tcscpy(pce[i].msg, dbv.ptszVal);
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
else {
if (pce[i].msg != NULL) {
@@ -205,7 +207,7 @@ TCHAR *GetStatusMessage(int profile, char *szProto)
return pce[i].msg;
}
}
- pce = ( PROFILECE* )realloc(pce, (pceCount+1)*sizeof(PROFILECE));
+ pce = (PROFILECE*)realloc(pce, (pceCount+1)*sizeof(PROFILECE));
if (pce == NULL)
return NULL;
@@ -215,7 +217,7 @@ TCHAR *GetStatusMessage(int profile, char *szProto)
_snprintf(dbSetting, sizeof(dbSetting), "%d_%s_%s", profile, szProto, SETTING_PROFILE_STSMSG);
if (!DBGetContactSettingTString(NULL, MODULENAME, dbSetting, &dbv)) {
pce[pceCount].msg = _tcsdup(dbv.ptszVal);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
pceCount += 1;
@@ -225,9 +227,9 @@ TCHAR *GetStatusMessage(int profile, char *szProto)
int GetProfile( int profile, TSettingsList& arSettings )
{
if ( profile < 0 ) // get default profile
- profile = DBGetContactSettingWord(NULL, MODULENAME, SETTING_DEFAULTPROFILE, 0);
+ profile = db_get_w(NULL, MODULENAME, SETTING_DEFAULTPROFILE, 0);
- int count = DBGetContactSettingWord(NULL, MODULENAME, SETTING_PROFILECOUNT, 0);
+ int count = db_get_w(NULL, MODULENAME, SETTING_PROFILECOUNT, 0);
if ( profile >= count && count > 0 )
return -1;
@@ -244,14 +246,11 @@ int GetProfile( int profile, TSettingsList& arSettings )
return ( arSettings.getCount() == 0 ) ? -1 : 0;
}
-static VOID CALLBACK releaseTtbTimerFunction(HWND hwnd,UINT message, UINT_PTR idEvent,DWORD dwTime) {
-
- int i;
-
+static VOID CALLBACK releaseTtbTimerFunction(HWND hwnd,UINT message, UINT_PTR idEvent,DWORD dwTime)
+{
KillTimer(NULL, releaseTtbTimerId);
- for(i=0;i<ttbButtonCount;i++) {
+ for(int i=0; i < ttbButtonCount; i++)
CallService(MS_TTB_SETBUTTONSTATE, (WPARAM)ttbButtons[i], TTBST_RELEASED);
- }
}
INT_PTR LoadAndSetProfile(WPARAM wParam, LPARAM lParam)
@@ -262,18 +261,18 @@ INT_PTR LoadAndSetProfile(WPARAM wParam, LPARAM lParam)
TSettingsList profileSettings( 10, CompareSettings );
if ( !GetProfile( profile, profileSettings)) {
- profile = (profile >= 0)?profile:DBGetContactSettingWord(NULL, MODULENAME, SETTING_DEFAULTPROFILE, 0);
+ profile = (profile >= 0)?profile:db_get_w(NULL, MODULENAME, SETTING_DEFAULTPROFILE, 0);
char setting[64];
_snprintf(setting, sizeof(setting), "%d_%s", profile, SETTING_SHOWCONFIRMDIALOG);
- if (!DBGetContactSettingByte(NULL, MODULENAME, setting, 0))
+ if (!db_get_b(NULL, MODULENAME, setting, 0))
CallService(MS_CS_SETSTATUSEX,(WPARAM)&profileSettings, 0);
else
- CallService(MS_CS_SHOWCONFIRMDLGEX, (WPARAM)&profileSettings, (LPARAM)DBGetContactSettingDword(NULL, MODULENAME, SETTING_DLGTIMEOUT, 5));
+ CallService(MS_CS_SHOWCONFIRMDLGEX, (WPARAM)&profileSettings, (LPARAM)db_get_dw(NULL, MODULENAME, SETTING_DLGTIMEOUT, 5));
}
+ // add timer here
if (hTTBModuleLoadedHook)
- // add timer here
releaseTtbTimerId = SetTimer(NULL, 0, 100, releaseTtbTimerFunction);
return 0;
diff --git a/plugins/StatusPlugins/StartupStatus/startupstatus.cpp b/plugins/StatusPlugins/StartupStatus/startupstatus.cpp
index 50848c30bc..5df0dff3b4 100644
--- a/plugins/StatusPlugins/StartupStatus/startupstatus.cpp
+++ b/plugins/StatusPlugins/StartupStatus/startupstatus.cpp
@@ -48,14 +48,14 @@ TSSSetting::TSSSetting( int profile, PROTOACCOUNT* pa )
// load status
char setting[80];
_snprintf(setting, sizeof(setting), "%d_%s", profile, pa->szModuleName);
- int iStatus = DBGetContactSettingWord(NULL, MODULENAME, setting, 0);
+ int iStatus = db_get_w(NULL, MODULENAME, setting, 0);
if ( iStatus < MIN_STATUS || iStatus > MAX_STATUS )
iStatus = DEFAULT_STATUS;
status = iStatus;
// load last status
_snprintf(setting, sizeof(setting), "%s%s", PREFIX_LAST, szName);
- iStatus = DBGetContactSettingWord(NULL, MODULENAME, setting, 0);
+ iStatus = db_get_w(NULL, MODULENAME, setting, 0);
if ( iStatus < MIN_STATUS || iStatus > MAX_STATUS )
iStatus = DEFAULT_STATUS;
lastStatus = iStatus;
@@ -178,7 +178,7 @@ static void SetLastStatusMessages(TSettingsList& ps)
DBVARIANT dbv;
if ( ps[i].szMsg == NULL && !DBGetContactSettingTString(NULL, MODULENAME, dbSetting, &dbv)) {
ps[i].szMsg = _tcsdup(dbv.ptszVal); // remember this won't be freed
- DBFreeVariant(&dbv);
+ db_free(&dbv);
} } }
/////////////////////////////////////////////////////////////////////////////////////////
@@ -213,7 +213,7 @@ static int ProcessProtoAck(WPARAM wParam,LPARAM lParam)
if ( ack->type != ACKTYPE_STATUS && ack->result != ACKRESULT_FAILED )
return 0;
- if ( !DBGetContactSettingByte(NULL, MODULENAME, SETTING_OVERRIDE, 1) || startupSettings.getCount() == 0 )
+ if ( !db_get_b(NULL, MODULENAME, SETTING_OVERRIDE, 1) || startupSettings.getCount() == 0 )
return 0;
for (int i=0; i < startupSettings.getCount(); i++) {
@@ -228,7 +228,7 @@ static int ProcessProtoAck(WPARAM wParam,LPARAM lParam)
static int StatusChange(WPARAM wParam, LPARAM lParam)
{
// change by menu
- if ( !DBGetContactSettingByte(NULL, MODULENAME, SETTING_OVERRIDE, 1) || startupSettings.getCount() == 0 )
+ if ( !db_get_b(NULL, MODULENAME, SETTING_OVERRIDE, 1) || startupSettings.getCount() == 0 )
return 0;
char* szProto = (char *)lParam;
@@ -251,7 +251,7 @@ static int StatusChange(WPARAM wParam, LPARAM lParam)
static int CSStatusChangeEx(WPARAM wParam, LPARAM lParam)
{
// another status plugin made the change
- if ( !DBGetContactSettingByte(NULL, MODULENAME, SETTING_OVERRIDE, 1) || startupSettings.getCount() == 0 )
+ if ( !db_get_b(NULL, MODULENAME, SETTING_OVERRIDE, 1) || startupSettings.getCount() == 0 )
return 0;
if (wParam != 0) {
@@ -301,7 +301,7 @@ static int Exit(WPARAM wParam, LPARAM lParam)
char lastName[128], lastMsg[128];
mir_snprintf(lastName, sizeof(lastName), "%s%s", PREFIX_LAST, protos[i]->szModuleName);
if (CallService(MS_PROTO_ISPROTOCOLLOADED, 0, (LPARAM)protos[i]->szModuleName)) {
- DBWriteContactSettingWord(NULL, MODULENAME, lastName, (WORD)CallProtoService(protos[i]->szModuleName, PS_GETSTATUS, 0, 0));
+ db_set_w(NULL, MODULENAME, lastName, (WORD)CallProtoService(protos[i]->szModuleName, PS_GETSTATUS, 0, 0));
mir_snprintf(lastMsg, sizeof(lastMsg), "%s%s", PREFIX_LASTMSG, protos[i]->szModuleName);
DBDeleteContactSetting(NULL, MODULENAME, lastMsg);
@@ -316,7 +316,7 @@ static int Exit(WPARAM wParam, LPARAM lParam)
continue;
} }
- if ( (DBGetContactSettingByte(NULL, MODULENAME, SETTING_SETPROFILE, 1)) || (DBGetContactSettingByte(NULL, MODULENAME, SETTING_OFFLINECLOSE, 0))) {
+ if ( (db_get_b(NULL, MODULENAME, SETTING_SETPROFILE, 1)) || (db_get_b(NULL, MODULENAME, SETTING_OFFLINECLOSE, 0))) {
if (ServiceExists(MS_CLIST_SETSTATUSMODE))
CallService(MS_CLIST_SETSTATUSMODE, (WPARAM)ID_STATUS_OFFLINE, 0);
else
@@ -324,8 +324,8 @@ static int Exit(WPARAM wParam, LPARAM lParam)
}
// set windowstate and docked for next startup
- if (DBGetContactSettingByte(NULL, MODULENAME, SETTING_SETWINSTATE, 0)) {
- int state = DBGetContactSettingByte(NULL, MODULENAME, SETTING_WINSTATE, SETTING_STATE_NORMAL);
+ if (db_get_b(NULL, MODULENAME, SETTING_SETWINSTATE, 0)) {
+ int state = db_get_b(NULL, MODULENAME, SETTING_WINSTATE, SETTING_STATE_NORMAL);
HWND hClist = (HWND)CallService(MS_CLUI_GETHWND, 0, 0);
BOOL isHidden = !IsWindowVisible(hClist);
switch (state) {
@@ -336,7 +336,7 @@ static int Exit(WPARAM wParam, LPARAM lParam)
break;
case SETTING_STATE_MINIMIZED:
- if (!DBGetContactSettingByte(NULL, MODULE_CLIST, SETTING_TOOLWINDOW, 0))
+ if (!db_get_b(NULL, MODULE_CLIST, SETTING_TOOLWINDOW, 0))
ShowWindow(hClist, SW_SHOWMINIMIZED);
break;
@@ -348,13 +348,13 @@ static int Exit(WPARAM wParam, LPARAM lParam)
} }
// hangup
- if (DBGetContactSettingByte(NULL, MODULENAME, SETTING_AUTOHANGUP, 0))
+ if (db_get_b(NULL, MODULENAME, SETTING_AUTOHANGUP, 0))
InternetAutodialHangup(0);
- int state = DBGetContactSettingByte(NULL, MODULENAME, SETTING_WINSTATE, SETTING_STATE_NORMAL);
+ int state = db_get_b(NULL, MODULENAME, SETTING_WINSTATE, SETTING_STATE_NORMAL);
// set windowstate and docked for next startup
- if (DBGetContactSettingByte(NULL, MODULENAME, SETTING_SETWINSTATE, 0))
- DBWriteContactSettingByte(NULL, MODULE_CLIST, SETTING_WINSTATE, (BYTE)state);
+ if (db_get_b(NULL, MODULENAME, SETTING_SETWINSTATE, 0))
+ db_set_b(NULL, MODULE_CLIST, SETTING_WINSTATE, (BYTE)state);
if ( hMessageWindow )
DestroyWindow(hMessageWindow);
@@ -403,62 +403,58 @@ int CSModuleLoaded(WPARAM wParam, LPARAM lParam)
return 0;// no protocols are loaded
SetLastStatusMessages(startupSettings);
- showDialogOnStartup = (showDialogOnStartup || DBGetContactSettingByte(NULL, MODULENAME, SETTING_SHOWDIALOG, 0));
+ showDialogOnStartup = (showDialogOnStartup || db_get_b(NULL, MODULENAME, SETTING_SHOWDIALOG, 0));
// dial
- if ( showDialogOnStartup || DBGetContactSettingByte(NULL, MODULENAME, SETTING_SETPROFILE, 1))
- if (DBGetContactSettingByte(NULL, MODULENAME, SETTING_AUTODIAL, 0))
+ if (showDialogOnStartup || db_get_b(NULL, MODULENAME, SETTING_SETPROFILE, 1))
+ if (db_get_b(NULL, MODULENAME, SETTING_AUTODIAL, 0))
InternetAutodial(0, NULL);
// set the status!
- if ( showDialogOnStartup || DBGetContactSettingByte(NULL, MODULENAME, SETTING_SHOWDIALOG, 0)) {
- CallService(MS_CS_SHOWCONFIRMDLGEX, (WPARAM)&startupSettings, DBGetContactSettingDword(NULL, MODULENAME, SETTING_DLGTIMEOUT, 5));
- }
- else if (DBGetContactSettingByte(NULL, MODULENAME, SETTING_SETPROFILE, 1)) {
+ if ( showDialogOnStartup || db_get_b(NULL, MODULENAME, SETTING_SHOWDIALOG, 0))
+ CallService(MS_CS_SHOWCONFIRMDLGEX, (WPARAM)&startupSettings, db_get_dw(NULL, MODULENAME, SETTING_DLGTIMEOUT, 5));
+ else if (db_get_b(NULL, MODULENAME, SETTING_SETPROFILE, 1)) {
// set hooks for override
- if (DBGetContactSettingByte(NULL, MODULENAME, SETTING_OVERRIDE, 1)) {
+ if (db_get_b(NULL, MODULENAME, SETTING_OVERRIDE, 1)) {
hProtoAckHook = HookEvent(ME_PROTO_ACK, ProcessProtoAck);
hCSStatusChangeHook = HookEvent(ME_CS_STATUSCHANGEEX, CSStatusChangeEx);
hStatusChangeHook = HookEvent(ME_CLIST_STATUSMODECHANGE, StatusChange);
}
- setStatusTimerId = SetTimer(NULL, 0, DBGetContactSettingDword(NULL,MODULENAME,SETTING_SETPROFILEDELAY,500), SetStatusTimed);
+ setStatusTimerId = SetTimer(NULL, 0, db_get_dw(NULL,MODULENAME,SETTING_SETPROFILEDELAY,500), SetStatusTimed);
}
// win size and location
- if ( DBGetContactSettingByte(NULL, MODULENAME, SETTING_SETWINLOCATION, 0) ||
- DBGetContactSettingByte(NULL, MODULENAME, SETTING_SETWINSIZE, 0))
- {
- WINDOWPLACEMENT wndpl = { 0 };
- wndpl.length = sizeof(wndpl);
-
+ if ( db_get_b(NULL, MODULENAME, SETTING_SETWINLOCATION, 0) || db_get_b(NULL, MODULENAME, SETTING_SETWINSIZE, 0)) {
HWND hClist = (HWND)CallService(MS_CLUI_GETHWND, 0, 0);
// store in db
- if (DBGetContactSettingByte(NULL, MODULENAME, SETTING_SETWINLOCATION, 0)) {
- DBWriteContactSettingDword(NULL, MODULE_CLIST, SETTING_XPOS, DBGetContactSettingDword(NULL, MODULENAME, SETTING_XPOS, 0));
- DBWriteContactSettingDword(NULL, MODULE_CLIST, SETTING_YPOS, DBGetContactSettingDword(NULL, MODULENAME, SETTING_YPOS, 0));
+ if (db_get_b(NULL, MODULENAME, SETTING_SETWINLOCATION, 0)) {
+ db_set_dw(NULL, MODULE_CLIST, SETTING_XPOS, db_get_dw(NULL, MODULENAME, SETTING_XPOS, 0));
+ db_set_dw(NULL, MODULE_CLIST, SETTING_YPOS, db_get_dw(NULL, MODULENAME, SETTING_YPOS, 0));
}
- if (DBGetContactSettingByte(NULL, MODULENAME, SETTING_SETWINSIZE, 0)) {
- DBWriteContactSettingDword(NULL, MODULE_CLIST, SETTING_WIDTH, DBGetContactSettingDword(NULL, MODULENAME, SETTING_WIDTH, 0));
- if (!DBGetContactSettingByte(NULL, MODULE_CLUI, SETTING_AUTOSIZE, 0))
- DBWriteContactSettingDword(NULL, MODULE_CLIST, SETTING_HEIGHT, DBGetContactSettingDword(NULL, MODULENAME, SETTING_HEIGHT, 0));
+ if (db_get_b(NULL, MODULENAME, SETTING_SETWINSIZE, 0)) {
+ db_set_dw(NULL, MODULE_CLIST, SETTING_WIDTH, db_get_dw(NULL, MODULENAME, SETTING_WIDTH, 0));
+ if (!db_get_b(NULL, MODULE_CLUI, SETTING_AUTOSIZE, 0))
+ db_set_dw(NULL, MODULE_CLIST, SETTING_HEIGHT, db_get_dw(NULL, MODULENAME, SETTING_HEIGHT, 0));
}
- if ( GetWindowPlacement( hClist, &wndpl )) {
- if ( wndpl.showCmd == SW_SHOWNORMAL && !CallService(MS_CLIST_DOCKINGISDOCKED, 0, 0)) {
+
+ WINDOWPLACEMENT wndpl = { sizeof(wndpl) };
+ if ( GetWindowPlacement(hClist, &wndpl)) {
+ if (wndpl.showCmd == SW_SHOWNORMAL && !CallService(MS_CLIST_DOCKINGISDOCKED, 0, 0)) {
RECT rc;
- if (GetWindowRect(hClist, &rc)) {
+ if ( GetWindowRect(hClist, &rc)) {
int x = rc.left;
int y = rc.top;
int width = rc.right - rc.left;
int height = rc.bottom - rc.top;
- if (DBGetContactSettingByte(NULL, MODULENAME, SETTING_SETWINLOCATION, 0)) {
- x = DBGetContactSettingDword(NULL, MODULENAME, SETTING_XPOS, x);
- y = DBGetContactSettingDword(NULL, MODULENAME, SETTING_YPOS, y);
+ if (db_get_b(NULL, MODULENAME, SETTING_SETWINLOCATION, 0)) {
+ x = db_get_dw(NULL, MODULENAME, SETTING_XPOS, x);
+ y = db_get_dw(NULL, MODULENAME, SETTING_YPOS, y);
}
- if (DBGetContactSettingByte(NULL, MODULENAME, SETTING_SETWINSIZE, 0)) {
- width = DBGetContactSettingDword(NULL, MODULENAME, SETTING_WIDTH, width);
- if (!DBGetContactSettingByte(NULL, MODULE_CLUI, SETTING_AUTOSIZE, 0))
- height = DBGetContactSettingDword(NULL, MODULENAME, SETTING_HEIGHT, height);
+ if (db_get_b(NULL, MODULENAME, SETTING_SETWINSIZE, 0)) {
+ width = db_get_dw(NULL, MODULENAME, SETTING_WIDTH, width);
+ if (!db_get_b(NULL, MODULE_CLUI, SETTING_AUTOSIZE, 0))
+ height = db_get_dw(NULL, MODULENAME, SETTING_HEIGHT, height);
}
MoveWindow(hClist, x, y, width, height, TRUE);
} } } }
diff --git a/plugins/StatusPlugins/StartupStatus/startupstatus.h b/plugins/StatusPlugins/StartupStatus/startupstatus.h
index a54be8f70c..f7ab3e1b92 100644
--- a/plugins/StatusPlugins/StartupStatus/startupstatus.h
+++ b/plugins/StatusPlugins/StartupStatus/startupstatus.h
@@ -50,11 +50,10 @@ struct PROFILEOPTIONS : public MZeroedObject
__inline ~PROFILEOPTIONS()
{
delete ps;
- if (szName != NULL)
- mir_free(szName);
+ mir_free(tszName);
}
- char *szName;
+ TCHAR *tszName;
TSettingsList* ps;
BOOL showDialog;
BOOL createTtb;
diff --git a/plugins/StatusPlugins/StartupStatus/toolbars.cpp b/plugins/StatusPlugins/StartupStatus/toolbars.cpp
index ffabfcd152..1109eb24f3 100644
--- a/plugins/StatusPlugins/StartupStatus/toolbars.cpp
+++ b/plugins/StatusPlugins/StartupStatus/toolbars.cpp
@@ -56,7 +56,7 @@ int CreateTopToolbarButtons(WPARAM wParam, LPARAM lParam)
for (int i=0; i < profileCount; i++) {
char setting[80];
_snprintf(setting, sizeof(setting), "%d_%s", i, SETTING_CREATETTBBUTTON);
- if (!DBGetContactSettingByte(NULL, MODULENAME, setting, FALSE))
+ if (!db_get_b(NULL, MODULENAME, setting, FALSE))
continue;
DBVARIANT dbv;
@@ -71,7 +71,7 @@ int CreateTopToolbarButtons(WPARAM wParam, LPARAM lParam)
HANDLE ttbAddResult = TopToolbar_AddButton(&ttb);
if (ttbAddResult)
ttbButtons.insert(ttbAddResult);
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
return 0;
}
diff --git a/plugins/StatusPlugins/StartupStatus/vc6.rc b/plugins/StatusPlugins/StartupStatus/vc6.rc
deleted file mode 100644
index 90772d80f6..0000000000
--- a/plugins/StatusPlugins/StartupStatus/vc6.rc
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "..\resource.rc"
-#include "..\version.rc"
-#include "StartupStatus.rc" \ No newline at end of file
diff --git a/plugins/StatusPlugins/StartupStatus/version.h b/plugins/StatusPlugins/StartupStatus/version.h
index 2ea7d0fc6b..a609fe7e19 100644
--- a/plugins/StatusPlugins/StartupStatus/version.h
+++ b/plugins/StatusPlugins/StartupStatus/version.h
@@ -8,7 +8,7 @@
#define __MAJOR_VERSION 0
#define __MINOR_VERSION 8
#define __RELEASE_NUM 0
-#define __BUILD_NUM 44
+#define __BUILD_NUM 45
// minimal MirandaIM version number, with which this plugin supposed to work
#define __PROD_MAJOR_VERSION 0