summaryrefslogtreecommitdiff
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
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
-rw-r--r--plugins/ExternalAPI/m_statusplugins.h16
-rw-r--r--plugins/SimpleStatusMsg/src/msgbox.cpp64
-rw-r--r--plugins/StatusPlugins/AdvancedAutoAway/vc6.rc2
-rw-r--r--plugins/StatusPlugins/KeepStatus/vc6.rc2
-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
-rw-r--r--plugins/StatusPlugins/confirmdialog.cpp64
-rw-r--r--plugins/StatusPlugins/resource.rc2
14 files changed, 235 insertions, 257 deletions
diff --git a/plugins/ExternalAPI/m_statusplugins.h b/plugins/ExternalAPI/m_statusplugins.h
index 34a3f1da90..065d91119f 100644
--- a/plugins/ExternalAPI/m_statusplugins.h
+++ b/plugins/ExternalAPI/m_statusplugins.h
@@ -68,24 +68,24 @@ typedef struct {
#define MS_SS_GETPROFILECOUNT "StartupStatus/GetProfileCount"
// wParam = profile number
-// lParam = char* (must be allocated, size = 128)
+// lParam = TCHAR* (must be allocated, size = 128)
// returns 0 on success
#define MS_SS_GETPROFILENAME "StartupStatus/GetProfileName"
// -- AdvancedAutoAway --
-typedef enum {
- ACTIVE, // user is active
- STATUS1_SET, // first status change happened
- STATUS2_SET, // second status change happened
- SET_ORGSTATUS, // user was active again, original status will be restored
- HIDDEN_ACTIVE // user is active, but this is not shown to the outside world
+typedef enum {
+ ACTIVE, // user is active
+ STATUS1_SET, // first status change happened
+ STATUS2_SET, // second status change happened
+ SET_ORGSTATUS, // user was active again, original status will be restored
+ HIDDEN_ACTIVE // user is active, but this is not shown to the outside world
} STATES;
typedef struct {
PROTOCOLSETTINGEX* protocolSetting;
int originalStatusMode; // this is set only when going from ACTIVE to STATUS1_SET (or to STATUS2_SET)
// (note: this is therefore not always valid)
- STATES
+ STATES
oldState, // state before the call
curState; // current state
BOOL bStatusChanged; // the status of the protocol will actually be changed
diff --git a/plugins/SimpleStatusMsg/src/msgbox.cpp b/plugins/SimpleStatusMsg/src/msgbox.cpp
index 240c26a441..e7b4a7c436 100644
--- a/plugins/SimpleStatusMsg/src/msgbox.cpp
+++ b/plugins/SimpleStatusMsg/src/msgbox.cpp
@@ -179,19 +179,15 @@ HWND WINAPI CreateStatusComboBoxEx(HWND hwndDlg, struct MsgBoxData *data)
{
int defaultProfile;
int profileCount = (int)CallService(MS_SS_GETPROFILECOUNT, (WPARAM)&defaultProfile, 0);
- char buff1[128];
-
- for (int i = 0; i < profileCount; ++i)
- {
- CallService(MS_SS_GETPROFILENAME, (WPARAM)i, (LPARAM)buff1);
- status_desc = mir_a2u(buff1);
+ for (int i = 0; i < profileCount; ++i) {
+ TCHAR tszProfileName[128];
+ CallService(MS_SS_GETPROFILENAME, (WPARAM)i, (LPARAM)tszProfileName);
cbei.iItem = j;
- cbei.pszText = (LPTSTR)status_desc;
- cbei.cchTextMax = sizeof(status_desc);
- if (data->m_iDlgFlags & DLG_SHOW_STATUS_ICONS)
- {
+ cbei.pszText = (LPTSTR)tszProfileName;
+ cbei.cchTextMax = SIZEOF(tszProfileName);
+ if (data->m_iDlgFlags & DLG_SHOW_STATUS_ICONS) {
int k = GetCurrentStatus(NULL) - ID_STATUS_OFFLINE;
if (k < 0 || k > 9) k = 0; // valid status modes only
cbei.iImage = statusicon_nr[k];
@@ -407,7 +403,7 @@ HWND WINAPI CreateRecentComboBoxEx(HWND hwndDlg, struct MsgBoxData *data)
else
cbei.iIndent = 0;
cbei.lParam = MAKELPARAM(DEFAULT_MSG, 0);
-
+
SendMessage(handle,CBEM_INSERTITEM,0,(LPARAM)&cbei);
}
@@ -437,16 +433,16 @@ HWND WINAPI CreateRecentComboBoxEx(HWND hwndDlg, struct MsgBoxData *data)
VOID APIENTRY HandlePopupMenu(HWND hwnd, POINT pt, HWND edit_control)
{
- HMENU hmenu = LoadMenu(g_hInst, MAKEINTRESOURCE(IDR_EDITMENU));
- if (hmenu == NULL)
- return;
-
- HMENU hmenuTrackPopup = GetSubMenu(hmenu, 0);
-
+ HMENU hmenu = LoadMenu(g_hInst, MAKEINTRESOURCE(IDR_EDITMENU));
+ if (hmenu == NULL)
+ return;
+
+ HMENU hmenuTrackPopup = GetSubMenu(hmenu, 0);
+
TranslateMenu(hmenuTrackPopup);
-
- ClientToScreen(hwnd, (LPPOINT) &pt);
-
+
+ ClientToScreen(hwnd, (LPPOINT) &pt);
+
LPDWORD sel_s = NULL, sel_e = NULL;
SendMessage(edit_control, EM_GETSEL, (WPARAM)&sel_s, (LPARAM)&sel_e);
if (sel_s == sel_e)
@@ -461,7 +457,7 @@ VOID APIENTRY HandlePopupMenu(HWND hwnd, POINT pt, HWND edit_control)
DeleteMenu(hmenuTrackPopup, ID__VARIABLES, MF_BYCOMMAND);
else
DeleteMenu(hmenuTrackPopup, 8, MF_BYPOSITION);
-
+
if (ServiceExists(MS_FORTUNEMSG_GETSTATUSMSG))
DeleteMenu(hmenuTrackPopup, ID__FORTUNEAWAYMSG, MF_BYCOMMAND);
else
@@ -525,14 +521,14 @@ VOID APIENTRY HandlePopupMenu(HWND hwnd, POINT pt, HWND edit_control)
if (len)
{
LPTSTR lptstrCopy;
- HGLOBAL hglbCopy = GlobalAlloc(GMEM_MOVEABLE, (len + 1) * sizeof(TCHAR));
+ HGLOBAL hglbCopy = GlobalAlloc(GMEM_MOVEABLE, (len + 1) * sizeof(TCHAR));
if (hglbCopy == NULL)
- {
- CloseClipboard();
- break;
+ {
+ CloseClipboard();
+ break;
}
- lptstrCopy = (LPTSTR)GlobalLock(hglbCopy);
- memcpy(lptstrCopy, item_string, len * sizeof(TCHAR));
+ lptstrCopy = (LPTSTR)GlobalLock(hglbCopy);
+ memcpy(lptstrCopy, item_string, len * sizeof(TCHAR));
lptstrCopy[len] = (TCHAR)0;
GlobalUnlock(hglbCopy);
@@ -544,7 +540,7 @@ VOID APIENTRY HandlePopupMenu(HWND hwnd, POINT pt, HWND edit_control)
SendMessage(edit_control, WM_PASTE, 0, 0);
break;
}
- DestroyMenu(hmenu);
+ DestroyMenu(hmenu);
}
static LRESULT CALLBACK EditBoxSubProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
@@ -568,7 +564,7 @@ static LRESULT CALLBACK EditBoxSubProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L
else
ScreenToClient(hwndDlg, &pt);
- if (PtInRect(&rc, pt))
+ if (PtInRect(&rc, pt))
HandlePopupMenu(hwndDlg, pt, GetDlgItem(GetParent(hwndDlg), IDC_EDIT1));
return 0;
@@ -1045,7 +1041,7 @@ INT_PTR CALLBACK AwayMsgBoxDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA
copy_init_data->status_icons = AddStatusIconsToImageList(init_data->m_szProto, copy_init_data->m_iStatusModes);
if (copy_init_data->m_iDlgFlags & DLG_SHOW_LIST_ICONS)
copy_init_data->other_icons = AddOtherIconsToImageList(copy_init_data);
-
+
if ((copy_init_data->m_iDlgFlags & DLG_SHOW_BUTTONS) || (copy_init_data->m_iDlgFlags & DLG_SHOW_BUTTONS_FLAT))
{
SendMessage(GetDlgItem(hwndDlg, IDC_BADD), BUTTONADDTOOLTIP, (WPARAM)Translate("Add to Predefined"), 0);
@@ -1204,7 +1200,7 @@ INT_PTR CALLBACK AwayMsgBoxDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA
break;
}
else
- {
+ {
TCHAR str[64];
mir_sntprintf(str, SIZEOF(str), TranslateT("Closing in %d"), msgbox_data->m_iCountdown);
SetDlgItemText(hwndDlg, IDC_OK, str);
@@ -1240,7 +1236,7 @@ INT_PTR CALLBACK AwayMsgBoxDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA
{
char szSetting[80];
if (msgbox_data->m_szProto)
- {
+ {
mir_snprintf(szSetting, SIZEOF(szSetting), "Last%sMsg", msgbox_data->m_szProto);
DBWriteContactSettingString(NULL, "SimpleStatusMsg", szSetting, "");
@@ -1274,7 +1270,7 @@ INT_PTR CALLBACK AwayMsgBoxDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA
DBWriteContactSettingTString(NULL, "SRAway", StatusModeToDbSetting(msgbox_data->m_iStatus, "Msg"), _T("")); // for compatibility with some plugins
}
-
+
if (bCurrentStatus)
SetStatusMessage(msgbox_data->m_szProto, msgbox_data->m_iInitialStatus, ID_STATUS_CURRENT, 0, msgbox_data->m_bOnStartup);
else if (iProfileStatus != 0)
@@ -1773,7 +1769,7 @@ INT_PTR CALLBACK AwayMsgBoxDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA
}
DBWriteContactSettingWord(NULL, "SimpleStatusMsg", "DefMsgCount", (WORD)new_num_def_msgs);
}
-
+
ImageList_Destroy(msgbox_data->status_icons);
ImageList_Destroy(msgbox_data->other_icons);
ReleaseIconEx("cross");
diff --git a/plugins/StatusPlugins/AdvancedAutoAway/vc6.rc b/plugins/StatusPlugins/AdvancedAutoAway/vc6.rc
deleted file mode 100644
index 730cf1e916..0000000000
--- a/plugins/StatusPlugins/AdvancedAutoAway/vc6.rc
+++ /dev/null
@@ -1,2 +0,0 @@
-#include "..\resource.rc"
-#include "..\version.rc" \ No newline at end of file
diff --git a/plugins/StatusPlugins/KeepStatus/vc6.rc b/plugins/StatusPlugins/KeepStatus/vc6.rc
deleted file mode 100644
index 730cf1e916..0000000000
--- a/plugins/StatusPlugins/KeepStatus/vc6.rc
+++ /dev/null
@@ -1,2 +0,0 @@
-#include "..\resource.rc"
-#include "..\version.rc" \ No newline at end of file
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
diff --git a/plugins/StatusPlugins/confirmdialog.cpp b/plugins/StatusPlugins/confirmdialog.cpp
index 81bcaf884f..324946eadc 100644
--- a/plugins/StatusPlugins/confirmdialog.cpp
+++ b/plugins/StatusPlugins/confirmdialog.cpp
@@ -18,7 +18,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 "commonstatus.h"
#include "resource.h"
#define TIMER_ID 1
@@ -65,10 +65,10 @@ static INT_PTR CALLBACK StatusMessageDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam
}
}
else SetDlgItemText(hwndDlg, IDC_STSMSG, protoSetting->szMsg);
-
+
{
TCHAR desc[ 512 ];
- mir_sntprintf(desc, SIZEOF(desc),
+ mir_sntprintf(desc, SIZEOF(desc),
TranslateT("Set %s message for %s."),
CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, GetActualStatus(protoSetting), GSMDF_TCHAR ),
protoSetting->tszAccName );
@@ -117,7 +117,7 @@ static int SetStatusList(HWND hwndDlg)
for ( int i=0; i < confirmSettings->getCount(); i++ ) {
lvItem.pszText = (*confirmSettings)[i].tszAccName;
- if (ListView_GetItemCount(hList) < confirmSettings->getCount())
+ if (ListView_GetItemCount(hList) < confirmSettings->getCount())
ListView_InsertItem(hList,&lvItem);
int actualStatus;
@@ -199,9 +199,9 @@ static INT_PTR CALLBACK ConfirmDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARA
int defaultProfile;
int profileCount = (int)CallService(MS_SS_GETPROFILECOUNT, (WPARAM)&defaultProfile, 0);
for (int i=0; i < profileCount; i++) {
- char profileName[128];
+ TCHAR profileName[128];
CallService(MS_SS_GETPROFILENAME, i, (LPARAM)profileName);
- int item = SendDlgItemMessageA(hwndDlg, IDC_PROFILE, CB_ADDSTRING, 0, (LPARAM)profileName);
+ int item = SendDlgItemMessage(hwndDlg, IDC_PROFILE, CB_ADDSTRING, 0, (LPARAM)profileName);
SendDlgItemMessage(hwndDlg, IDC_PROFILE, CB_SETITEMDATA, item, i);
}
if (profileCount == 0)
@@ -216,7 +216,7 @@ static INT_PTR CALLBACK ConfirmDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARA
SetDlgItemText(hwndDlg, IDC_CLOSE, text);
SetTimer(hwndDlg, TIMER_ID, 1000, NULL);
}
- break;
+ return TRUE;
case WM_TIMER:
{
@@ -271,8 +271,8 @@ static INT_PTR CALLBACK ConfirmDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARA
// LAST STATUS
if (proto->status == ID_STATUS_LAST) {
TCHAR last[80];
- mir_sntprintf(last, SIZEOF(last), _T("%s (%s)"),
- TranslateT("<last>"),
+ mir_sntprintf(last, SIZEOF(last), _T("%s (%s)"),
+ TranslateT("<last>"),
CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, proto->lastStatus, GSMDF_TCHAR ));
ListView_SetItemText(GetDlgItem(hwndDlg,IDC_STARTUPLIST), lvItem.iItem, 1, last);
actualStatus = proto->lastStatus;
@@ -282,13 +282,13 @@ static INT_PTR CALLBACK ConfirmDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARA
else if (proto->status == ID_STATUS_CURRENT) {
int currentStatus = CallProtoService(proto->szName,PS_GETSTATUS, 0, 0);
TCHAR current[80];
- mir_sntprintf(current, SIZEOF(current), _T("%s (%s)"),
+ mir_sntprintf(current, SIZEOF(current), _T("%s (%s)"),
TranslateT("<current>"),
CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, currentStatus, GSMDF_TCHAR ));
ListView_SetItemText(GetDlgItem(hwndDlg,IDC_STARTUPLIST), lvItem.iItem, 1, current);
actualStatus = currentStatus;
}
- else ListView_SetItemText(GetDlgItem(hwndDlg,IDC_STARTUPLIST), lvItem.iItem, 1,
+ else ListView_SetItemText(GetDlgItem(hwndDlg,IDC_STARTUPLIST), lvItem.iItem, 1,
( TCHAR* )CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, proto->status, GSMDF_TCHAR ));
if ((!((CallProtoService(proto->szName, PS_GETCAPS, (WPARAM)PFLAGNUM_1, 0)&PF1_MODEMSGSEND)&~PF1_INDIVMODEMSG)) || (!(CallProtoService(proto->szName, PS_GETCAPS, (WPARAM)PFLAGNUM_3, 0)&Proto_Status2Flag(actualStatus))))
@@ -325,7 +325,7 @@ static INT_PTR CALLBACK ConfirmDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARA
}
}
break;
-
+
case WM_NOTIFY:
switch(((NMHDR*)lParam)->idFrom) {
case IDC_STARTUPLIST:
@@ -337,13 +337,13 @@ static INT_PTR CALLBACK ConfirmDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARA
lvItem.mask = LVIF_TEXT | LVIF_PARAM;
lvItem.iSubItem = 0;
lvItem.iItem = ListView_GetNextItem(GetDlgItem(hwndDlg,IDC_STARTUPLIST),-1,LVNI_SELECTED);
-
+
if ( ListView_GetItem(GetDlgItem(hwndDlg,IDC_STARTUPLIST), &lvItem) == FALSE) {
SetStatusList(hwndDlg);
break;
}
- PROTOCOLSETTINGEX* proto = (PROTOCOLSETTINGEX*)lvItem.lParam;
+ PROTOCOLSETTINGEX *proto = (PROTOCOLSETTINGEX*)lvItem.lParam;
int flags = CallProtoService(proto->szName, PS_GETCAPS,PFLAGNUM_2,0) & ~CallProtoService(proto->szName, PS_GETCAPS, (WPARAM)PFLAGNUM_5, 0);
// clear box and add new status, loop status and check if compatible with proto
SendDlgItemMessage(hwndDlg, IDC_STATUS, CB_RESETCONTENT, 0, 0);
@@ -353,9 +353,9 @@ static INT_PTR CALLBACK ConfirmDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARA
TCHAR buf[100];
mir_sntprintf(buf, SIZEOF(buf), _T("%s (%s)"), TranslateT("<last>"), pcli->pfnGetStatusModeDescription(proto->lastStatus, GSMDF_TCHAR));
int item = SendDlgItemMessage( hwndDlg, IDC_STATUS, CB_ADDSTRING, 0, (LPARAM)buf );
- SendDlgItemMessage( hwndDlg, IDC_STATUS, CB_SETITEMDATA, item, (LPARAM)ID_STATUS_LAST );
+ SendDlgItemMessage(hwndDlg, IDC_STATUS, CB_SETITEMDATA, item, ID_STATUS_LAST);
if (proto->status == ID_STATUS_LAST) {
- SendDlgItemMessage(hwndDlg,IDC_STATUS,CB_SETCURSEL,(WPARAM)item,0);
+ SendDlgItemMessage(hwndDlg,IDC_STATUS,CB_SETCURSEL, item, 0);
actualStatus = proto->lastStatus;
}
@@ -363,36 +363,36 @@ static INT_PTR CALLBACK ConfirmDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARA
int currentStatus = CallProtoService(proto->szName,PS_GETSTATUS, 0, 0);
mir_sntprintf( buf, SIZEOF(buf), _T("%s (%s)"),
TranslateT("<current>"),
- CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, (WPARAM)currentStatus, GSMDF_TCHAR));
- item = SendDlgItemMessage(hwndDlg,IDC_STATUS,CB_ADDSTRING,0,(LPARAM)buf);
- SendDlgItemMessage(hwndDlg,IDC_STATUS,CB_SETITEMDATA,item,(LPARAM)ID_STATUS_CURRENT);
+ CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, currentStatus, GSMDF_TCHAR));
+ item = SendDlgItemMessage(hwndDlg,IDC_STATUS,CB_ADDSTRING, 0, (LPARAM)buf);
+ SendDlgItemMessage(hwndDlg,IDC_STATUS,CB_SETITEMDATA, item, ID_STATUS_CURRENT);
if (proto->status == ID_STATUS_CURRENT) {
- SendDlgItemMessage(hwndDlg,IDC_STATUS,CB_SETCURSEL,(WPARAM)item,0);
+ SendDlgItemMessage(hwndDlg,IDC_STATUS,CB_SETCURSEL, item, 0);
actualStatus = currentStatus;
}
for (int i=0; i < SIZEOF(statusModeList); i++) {
- if ( ((flags&statusModePf2List[i]) || (statusModePf2List[i] == PF2_OFFLINE)) && (!((!(flags)&Proto_Status2Flag(statusModePf2List[i]))) || ((CallProtoService(proto->szName, PS_GETCAPS, (WPARAM)PFLAGNUM_5, 0)&Proto_Status2Flag(statusModePf2List[i]))))) {
- TCHAR* statusMode = ( TCHAR* )CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, statusModeList[i], GSMDF_TCHAR);
- item = SendDlgItemMessage(hwndDlg,IDC_STATUS,CB_ADDSTRING,0,(LPARAM)statusMode);
- SendDlgItemMessage(hwndDlg,IDC_STATUS,CB_SETITEMDATA,item,(LPARAM)statusModeList[i]);
+ if ( ((flags & statusModePf2List[i]) || (statusModePf2List[i] == PF2_OFFLINE)) && (!((!(flags) & Proto_Status2Flag(statusModePf2List[i]))) || ((CallProtoService(proto->szName, PS_GETCAPS, (WPARAM)PFLAGNUM_5, 0)&Proto_Status2Flag(statusModePf2List[i]))))) {
+ TCHAR* statusMode = (TCHAR*)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, statusModeList[i], GSMDF_TCHAR);
+ item = SendDlgItemMessage(hwndDlg,IDC_STATUS,CB_ADDSTRING, 0, (LPARAM)statusMode);
+ SendDlgItemMessage(hwndDlg,IDC_STATUS,CB_SETITEMDATA, item, statusModeList[i]);
if (statusModeList[i] == proto->status)
- SendDlgItemMessage(hwndDlg,IDC_STATUS,CB_SETCURSEL,(WPARAM)item,0);
+ SendDlgItemMessage(hwndDlg,IDC_STATUS,CB_SETCURSEL, item, 0);
}
}
// enable status box
EnableWindow(GetDlgItem(hwndDlg,IDC_STATUS), (ListView_GetNextItem(GetDlgItem(hwndDlg,IDC_STARTUPLIST),-1,LVNI_SELECTED)>=0));
- if ( (!((CallProtoService(proto->szName, PS_GETCAPS, (WPARAM)PFLAGNUM_1, 0)&PF1_MODEMSGSEND)&~PF1_INDIVMODEMSG)) || (!(CallProtoService(proto->szName, PS_GETCAPS, (WPARAM)PFLAGNUM_3, 0)&Proto_Status2Flag(actualStatus))))
+ if ( (!((CallProtoService(proto->szName, PS_GETCAPS, PFLAGNUM_1, 0)&PF1_MODEMSGSEND)&~PF1_INDIVMODEMSG)) || (!(CallProtoService(proto->szName, PS_GETCAPS, PFLAGNUM_3, 0)&Proto_Status2Flag(actualStatus))))
EnableWindow(GetDlgItem(hwndDlg, IDC_SETSTSMSG), FALSE);
- else if ( proto->status == ID_STATUS_LAST || proto->status == ID_STATUS_CURRENT )
+ else if (proto->status == ID_STATUS_LAST || proto->status == ID_STATUS_CURRENT)
EnableWindow(GetDlgItem(hwndDlg, IDC_SETSTSMSG), TRUE);
else
- EnableWindow(GetDlgItem(hwndDlg, IDC_SETSTSMSG), (CallProtoService(proto->szName, PS_GETCAPS, (WPARAM)PFLAGNUM_3, 0)&Proto_Status2Flag(actualStatus))?TRUE:FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_SETSTSMSG), (CallProtoService(proto->szName, PS_GETCAPS, PFLAGNUM_3, 0) & Proto_Status2Flag(actualStatus))?TRUE:FALSE);
}
}
break;
-
+
case UM_STSMSGDLGCLOSED:
SetStatusList(hwndDlg);
break;
@@ -415,7 +415,7 @@ INT_PTR ShowConfirmDialogEx(WPARAM wParam, LPARAM lParam)
if ( wParam == 0 )
return -1;
- delete confirmSettings;
+ delete confirmSettings;
confirmSettings = new OBJLIST<TConfirmSetting>(10, CompareSettings);
OBJLIST<PROTOCOLSETTINGEX>& param = *( OBJLIST<PROTOCOLSETTINGEX>* )wParam;
@@ -428,8 +428,8 @@ INT_PTR ShowConfirmDialogEx(WPARAM wParam, LPARAM lParam)
if (GetWindow(win, 0) == NULL) {
win = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_CONFIRMDIALOG), NULL, ConfirmDlgProc, NULL);
- EnableWindow(win,TRUE);
+ EnableWindow(win, TRUE);
}
-
+
return (INT_PTR)win;
}
diff --git a/plugins/StatusPlugins/resource.rc b/plugins/StatusPlugins/resource.rc
index b34b7a2f52..c1eca44118 100644
--- a/plugins/StatusPlugins/resource.rc
+++ b/plugins/StatusPlugins/resource.rc
@@ -78,7 +78,7 @@ BEGIN
CONTROL "List1",IDC_STARTUPLIST,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,7,23,243,74
PUSHBUTTON "Cancel",IDC_CANCEL,69,100,59,14
LTEXT "Profile",IDC_STATIC,7,9,116,8
- COMBOBOX IDC_PROFILE,185,7,65,89,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP
+ COMBOBOX IDC_PROFILE,185,7,65,89,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
PUSHBUTTON "Message",IDC_SETSTSMSG,131,100,50,14
END