summaryrefslogtreecommitdiff
path: root/plugins/StatusPlugins/StartupStatus
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2012-07-19 08:02:41 +0000
committerGeorge Hazan <george.hazan@gmail.com>2012-07-19 08:02:41 +0000
commit08dc125be616458112368e7154b29d5d23f1126e (patch)
tree1c27ef9b8525f45913c19bb6f4c18a31b6593749 /plugins/StatusPlugins/StartupStatus
parenta63798c1b60eeb77352323ad4545630cdc5458f2 (diff)
Unicode in status message plugins
git-svn-id: http://svn.miranda-ng.org/main/trunk@1033 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/StatusPlugins/StartupStatus')
-rw-r--r--plugins/StatusPlugins/StartupStatus/options.cpp12
-rw-r--r--plugins/StatusPlugins/StartupStatus/profiles.cpp12
-rw-r--r--plugins/StatusPlugins/StartupStatus/startupstatus.cpp6
-rw-r--r--plugins/StatusPlugins/StartupStatus/startupstatus.h4
4 files changed, 17 insertions, 17 deletions
diff --git a/plugins/StatusPlugins/StartupStatus/options.cpp b/plugins/StatusPlugins/StartupStatus/options.cpp
index 107cf06e99..410412072c 100644
--- a/plugins/StatusPlugins/StartupStatus/options.cpp
+++ b/plugins/StatusPlugins/StartupStatus/options.cpp
@@ -442,7 +442,7 @@ static INT_PTR CALLBACK StartupStatusOptDlgProc(HWND hwndDlg,UINT msg,WPARAM wPa
GetProfile( defProfile, *ps );
for ( int i=0; i < ps->getCount(); i++ )
if ( (*ps)[i].szMsg != NULL )
- (*ps)[i].szMsg = _strdup( (*ps)[i].szMsg );
+ (*ps)[i].szMsg = _tcsdup( (*ps)[i].szMsg );
CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_CMDLOPTIONS), hwndDlg, CmdlOptionsDlgProc, (LPARAM)ps);
}
@@ -551,7 +551,7 @@ static INT_PTR CALLBACK StatusProfilesOptDlgProc(HWND hwndDlg,UINT msg,WPARAM wP
else {
for (int j=0; j < ar.getCount(); j++)
if ( ar[j].szMsg != NULL)
- ar[j].szMsg = _strdup( ar[j].szMsg );
+ ar[j].szMsg = _tcsdup( ar[j].szMsg );
ppo->szName = db_get_sa(NULL, MODULENAME, OptName(i, SETTING_PROFILENAME));
if (ppo->szName == NULL) {
@@ -662,7 +662,7 @@ static INT_PTR CALLBACK StatusProfilesOptDlgProc(HWND hwndDlg,UINT msg,WPARAM wP
CheckRadioButton(hwndDlg, IDC_MIRANDAMSG, IDC_CUSTOMMSG, ps->szMsg!=NULL?IDC_CUSTOMMSG:IDC_MIRANDAMSG);
if (ps->szMsg != NULL)
- SetDlgItemTextA(hwndDlg, IDC_STATUSMSG, ps->szMsg);
+ SetDlgItemText(hwndDlg, IDC_STATUSMSG, ps->szMsg);
bStatusMsg = ( (((CallProtoService(ps->szName, PS_GETCAPS, (WPARAM)PFLAGNUM_1, 0)&PF1_MODEMSGSEND&~PF1_INDIVMODEMSG)) &&
(CallProtoService(ps->szName, PS_GETCAPS, (WPARAM)PFLAGNUM_3, 0)&Proto_Status2Flag(ps->status))) || (ps->status == ID_STATUS_CURRENT) || (ps->status == ID_STATUS_LAST));
@@ -754,7 +754,7 @@ static INT_PTR CALLBACK StatusProfilesOptDlgProc(HWND hwndDlg,UINT msg,WPARAM wP
ps->szMsg = NULL;
if (IsDlgButtonChecked(hwndDlg, IDC_CUSTOMMSG)) {
len = SendDlgItemMessage(hwndDlg, IDC_STATUSMSG, WM_GETTEXTLENGTH, 0, 0);
- ps->szMsg = (char *)malloc(len+1);
+ ps->szMsg = (TCHAR*)calloc(sizeof(TCHAR), len+1);
memset(ps->szMsg, '\0', len+1);
SendDlgItemMessage(hwndDlg, IDC_STATUSMSG, WM_GETTEXT, (WPARAM)len+1, (LPARAM)ps->szMsg);
}
@@ -774,7 +774,7 @@ static INT_PTR CALLBACK StatusProfilesOptDlgProc(HWND hwndDlg,UINT msg,WPARAM wP
ps->szMsg = NULL;
}
int len = SendDlgItemMessageA(hwndDlg, IDC_STATUSMSG, WM_GETTEXTLENGTH, 0, 0);
- ps->szMsg = (char *)malloc(len+1);
+ ps->szMsg = (TCHAR*)calloc(sizeof(TCHAR), len+1);
memset(ps->szMsg, '\0', len+1);
SendDlgItemMessageA(hwndDlg, IDC_STATUSMSG, WM_GETTEXT, (WPARAM)len+1, (LPARAM)ps->szMsg);
}
@@ -851,7 +851,7 @@ static INT_PTR CALLBACK StatusProfilesOptDlgProc(HWND hwndDlg,UINT msg,WPARAM wP
for ( j=0; j < ar.getCount(); j++ ) {
if ( ar[j].szMsg != NULL ) {
mir_snprintf(setting, sizeof(setting), "%s_%s", ar[j].szName, SETTING_PROFILE_STSMSG);
- db_set_s(NULL, MODULENAME, OptName(i, setting), ar[j].szMsg);
+ db_set_ts(NULL, MODULENAME, OptName(i, setting), ar[j].szMsg);
}
db_set_w(NULL, MODULENAME, OptName(i, ar[j].szName), ar[j].status);
}
diff --git a/plugins/StatusPlugins/StartupStatus/profiles.cpp b/plugins/StatusPlugins/StartupStatus/profiles.cpp
index dbf7ebec82..3cb20918f8 100644
--- a/plugins/StatusPlugins/StartupStatus/profiles.cpp
+++ b/plugins/StatusPlugins/StartupStatus/profiles.cpp
@@ -183,7 +183,7 @@ INT_PTR GetProfileCount(WPARAM wParam, LPARAM lParam)
return count;
}
-char *GetStatusMessage(int profile, char *szProto)
+TCHAR *GetStatusMessage(int profile, char *szProto)
{
char dbSetting[80];
DBVARIANT dbv;
@@ -191,10 +191,10 @@ char *GetStatusMessage(int profile, char *szProto)
for ( int i=0; i < pceCount; i++ ) {
if ( (pce[i].profile == profile) && (!strcmp(pce[i].szProto, szProto))) {
_snprintf(dbSetting, sizeof(dbSetting), "%d_%s_%s", profile, szProto, SETTING_PROFILE_STSMSG);
- if (!DBGetContactSetting(NULL, MODULENAME, dbSetting, &dbv)) { // reload from db
- pce[i].msg = ( char* )realloc(pce[i].msg, strlen(dbv.pszVal)+1);
+ if (!DBGetContactSettingTString(NULL, MODULENAME, dbSetting, &dbv)) { // reload from db
+ pce[i].msg = ( TCHAR* )realloc(pce[i].msg, sizeof(TCHAR)*(_tcslen(dbv.ptszVal)+1));
if (pce[i].msg != NULL) {
- strcpy(pce[i].msg, dbv.pszVal);
+ _tcscpy(pce[i].msg, dbv.ptszVal);
}
DBFreeVariant(&dbv);
}
@@ -215,8 +215,8 @@ char *GetStatusMessage(int profile, char *szProto)
pce[pceCount].szProto = _strdup(szProto);
pce[pceCount].msg = NULL;
_snprintf(dbSetting, sizeof(dbSetting), "%d_%s_%s", profile, szProto, SETTING_PROFILE_STSMSG);
- if (!DBGetContactSetting(NULL, MODULENAME, dbSetting, &dbv)) {
- pce[pceCount].msg = _strdup(dbv.pszVal);
+ if (!DBGetContactSettingTString(NULL, MODULENAME, dbSetting, &dbv)) {
+ pce[pceCount].msg = _tcsdup(dbv.ptszVal);
DBFreeVariant(&dbv);
}
pceCount += 1;
diff --git a/plugins/StatusPlugins/StartupStatus/startupstatus.cpp b/plugins/StatusPlugins/StartupStatus/startupstatus.cpp
index 7028868272..e1445a7704 100644
--- a/plugins/StatusPlugins/StartupStatus/startupstatus.cpp
+++ b/plugins/StatusPlugins/StartupStatus/startupstatus.cpp
@@ -64,7 +64,7 @@ TSSSetting::TSSSetting( int profile, PROTOACCOUNT* pa )
szMsg = GetStatusMessage(profile, szName);
if ( szMsg )
- szMsg = _strdup( szMsg );
+ szMsg = _tcsdup( szMsg );
}
TSSSetting::~TSSSetting()
@@ -178,8 +178,8 @@ static void SetLastStatusMessages(TSettingsList& ps)
_snprintf(dbSetting, sizeof(dbSetting), "%s%s", PREFIX_LASTMSG, ps[i].szName);
DBVARIANT dbv;
- if ( ps[i].szMsg == NULL && !DBGetContactSetting(NULL, MODULENAME, dbSetting, &dbv)) {
- ps[i].szMsg = _strdup(dbv.pszVal); // remember this won't be freed
+ if ( ps[i].szMsg == NULL && !DBGetContactSettingTString(NULL, MODULENAME, dbSetting, &dbv)) {
+ ps[i].szMsg = _tcsdup(dbv.ptszVal); // remember this won't be freed
DBFreeVariant(&dbv);
} } }
diff --git a/plugins/StatusPlugins/StartupStatus/startupstatus.h b/plugins/StatusPlugins/StartupStatus/startupstatus.h
index d6248ba4b2..640638f788 100644
--- a/plugins/StatusPlugins/StartupStatus/startupstatus.h
+++ b/plugins/StatusPlugins/StartupStatus/startupstatus.h
@@ -45,7 +45,7 @@ struct PROFILECE
{
int profile;
char *szProto;
- char *msg;
+ TCHAR *msg;
};
struct PROFILEOPTIONS
@@ -152,7 +152,7 @@ TSettingsList* GetCurrentProtoSettings();
// profile
int GetProfile(int profileID, TSettingsList& arSettings );
-char *GetStatusMessage(int profile, char *szProto);
+TCHAR *GetStatusMessage(int profile, char *szProto);
INT_PTR LoadAndSetProfile(WPARAM wParam, LPARAM lParam);
INT_PTR GetProfileCount(WPARAM wParam, LPARAM lParam);