diff options
Diffstat (limited to 'plugins/StatusPlugins')
-rw-r--r-- | plugins/StatusPlugins/AdvancedAutoAway/msgoptions.cpp | 21 | ||||
-rw-r--r-- | plugins/StatusPlugins/commonstatus.cpp | 31 |
2 files changed, 10 insertions, 42 deletions
diff --git a/plugins/StatusPlugins/AdvancedAutoAway/msgoptions.cpp b/plugins/StatusPlugins/AdvancedAutoAway/msgoptions.cpp index 5de614c838..ec254d3203 100644 --- a/plugins/StatusPlugins/AdvancedAutoAway/msgoptions.cpp +++ b/plugins/StatusPlugins/AdvancedAutoAway/msgoptions.cpp @@ -122,23 +122,15 @@ INT_PTR CALLBACK DlgProcAutoAwayMsgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L settings[last]->msg = ( char* )realloc(settings[last]->msg, len+1);
SendDlgItemMessageA(hwndDlg, IDC_STATUSMSG, WM_GETTEXT, (LPARAM)(len+1), (WPARAM)settings[last]->msg);
}
+
if (i != -1) {
if (settings[i]->msg != NULL)
SetDlgItemTextA(hwndDlg, IDC_STATUSMSG, settings[i]->msg);
- else if (ServiceExists(MS_AWAYMSG_GETSTATUSMSGT)) {
- TCHAR *msg = (TCHAR*)CallService(MS_AWAYMSG_GETSTATUSMSGT, (WPARAM)settings[i]->status, 0);
- if (msg != NULL) {
- SetDlgItemText(hwndDlg, IDC_STATUSMSG, msg);
- mir_free(msg);
- }
- }
- else if (ServiceExists(MS_AWAYMSG_GETSTATUSMSG)) {
- char *msg = (char*)CallService(MS_AWAYMSG_GETSTATUSMSG, (WPARAM)settings[i]->status, 0);
- if (msg != NULL) {
- SetDlgItemTextA(hwndDlg, IDC_STATUSMSG, msg);
- mir_free(msg);
- }
+ else {
+ ptrT msg((TCHAR*)CallService(MS_AWAYMSG_GETSTATUSMSGT, settings[i]->status, 0));
+ SetDlgItemText(hwndDlg, IDC_STATUSMSG, (msg != NULL) ? msg : _T(""));
}
+
if (settings[i]->useCustom) {
EnableWindow(GetDlgItem(hwndDlg, IDC_STATUSMSG), TRUE);
EnableWindow(GetDlgItem(hwndDlg, IDC_VARIABLESHELP), TRUE);
@@ -150,7 +142,8 @@ INT_PTR CALLBACK DlgProcAutoAwayMsgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L EnableWindow(GetDlgItem(hwndDlg, IDC_VARIABLESHELP), FALSE);
CheckDlgButton(hwndDlg, IDC_RADUSEMIRANDA, TRUE);
CheckDlgButton(hwndDlg, IDC_RADUSECUSTOM, FALSE);
- } }
+ }
+ }
last = i;
}
break;
diff --git a/plugins/StatusPlugins/commonstatus.cpp b/plugins/StatusPlugins/commonstatus.cpp index 3f2963748d..74218f4ebf 100644 --- a/plugins/StatusPlugins/commonstatus.cpp +++ b/plugins/StatusPlugins/commonstatus.cpp @@ -119,34 +119,9 @@ TCHAR* GetDefaultStatusMessage(PROTOCOLSETTINGEX *ps, int newstatus) return mir_tstrdup(ps->szMsg);
}
- if (ServiceExists(MS_AWAYMSG_GETSTATUSMSGT)) {
- TCHAR* tMsg = (TCHAR*)CallService(MS_AWAYMSG_GETSTATUSMSGT, newstatus, (LPARAM)ps->szName);
- log_debugA("CommonStatus: Status message retrieved from general awaysys (TCHAR)");
- return tMsg;
- }
-
- if (ServiceExists(MS_AWAYMSG_GETSTATUSMSG)) {
- char *tMsg;
- if (ServiceExists(MS_SA_ISSARUNNING) && CallService(MS_SA_ISSARUNNING, 0, 0))
- tMsg = (char*)CallService(MS_AWAYMSG_GETSTATUSMSG, (WPARAM)newstatus, (LPARAM)ps->szName);
- else
- tMsg = (char*)CallService(MS_AWAYMSG_GETSTATUSMSG, (WPARAM)newstatus, 0);
-
- log_debugA("CommonStatus: Status message retrieved from general awaysys");
-
- TCHAR* result = mir_a2t(tMsg);
- mir_free(tMsg);
- return result;
- }
-
- /* awaysys doesn't define the service above */
- TCHAR* tMsg = GetDefaultMessage(newstatus);
- if (tMsg != NULL) {
- log_debugA("CommonStatus: Status message retrieved from defaults");
- return mir_tstrdup(tMsg);
- }
-
- return NULL;
+ TCHAR *tMsg = (TCHAR*)CallService(MS_AWAYMSG_GETSTATUSMSGT, newstatus, (LPARAM)ps->szName);
+ log_debugA("CommonStatus: Status message retrieved from general awaysys: %S", tMsg);
+ return tMsg;
}
static int equalsGlobalStatus(PROTOCOLSETTINGEX **ps)
|