summaryrefslogtreecommitdiff
path: root/plugins/StatusPlugins/KeepStatus
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2013-08-07 20:55:03 +0000
committerGeorge Hazan <george.hazan@gmail.com>2013-08-07 20:55:03 +0000
commite2760a3c40e97c14bee952f39b4381cd0b0c939c (patch)
tree62492c4928dae58ef5083ddb6be2048bc6bbc90d /plugins/StatusPlugins/KeepStatus
parent39de8f56fe51fb8fe82f290d1008eb1381c53290 (diff)
crash fix
git-svn-id: http://svn.miranda-ng.org/main/trunk@5619 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/StatusPlugins/KeepStatus')
-rw-r--r--plugins/StatusPlugins/KeepStatus/keepstatus.cpp39
1 files changed, 18 insertions, 21 deletions
diff --git a/plugins/StatusPlugins/KeepStatus/keepstatus.cpp b/plugins/StatusPlugins/KeepStatus/keepstatus.cpp
index d2f58536bb..bad7eeebe4 100644
--- a/plugins/StatusPlugins/KeepStatus/keepstatus.cpp
+++ b/plugins/StatusPlugins/KeepStatus/keepstatus.cpp
@@ -909,44 +909,41 @@ static VOID CALLBACK CheckContinueslyTimer(HWND hwnd, UINT message, UINT_PTR idE
}
// =============== popup ======================
+static TCHAR* GetHumanName(LPARAM lParam)
+{
+ PROTOACCOUNT *ProtoAccount = ProtoGetAccount((char*)lParam);
+ return (ProtoAccount != NULL) ? ProtoAccount->tszAccountName : TranslateT("Protocol");
+}
+
static int ProcessPopup(int reason, LPARAM lParam)
{
HICON hIcon = NULL;
- PROTOACCOUNT *ProtoAccount;
- TCHAR text[MAX_SECONDLINE], ProtoName[128] = {0};
+ TCHAR text[MAX_SECONDLINE];
if ( !db_get_b(NULL, MODULENAME, SETTING_SHOWCONNECTIONPOPUPS,FALSE) || !ServiceExists(MS_POPUP_ADDPOPUP))
return -1;
- // Get human readable account name.
- if (lParam)
- if (ProtoAccount = ProtoGetAccount((char*)lParam))
- _tcscpy(ProtoName, ProtoAccount->tszAccountName);
-
switch(reason) {
case KS_CONN_STATE_OTHERLOCATION: // lParam = 1 proto
if (!db_get_b(NULL, MODULENAME, SETTING_PUOTHER, TRUE))
return -1;
hIcon = LoadSkinnedProtoIcon((char*)lParam, SKINICON_STATUS_OFFLINE);
- mir_sntprintf(text, SIZEOF(text), TranslateT("%s connected from another location"), ProtoName);
+ mir_sntprintf(text, SIZEOF(text), TranslateT("%s connected from another location"), GetHumanName(lParam));
break;
case KS_CONN_STATE_LOGINERROR: // lParam = 1 proto
- /*******************
- rethink this
- ********************/
if (!db_get_b(NULL, MODULENAME, SETTING_PUOTHER, TRUE))
return -1;
-
- hIcon = LoadSkinnedProtoIcon((char*)lParam, SKINICON_STATUS_OFFLINE);
- if ( db_get_b(NULL, MODULENAME, SETTING_LOGINERR, LOGINERR_NOTHING) == LOGINERR_CANCEL)
- mir_sntprintf(text, SIZEOF(text), TranslateT("%s login error, cancel reconnecting"), ProtoName);
- else if ( db_get_b(NULL, MODULENAME, SETTING_LOGINERR, LOGINERR_NOTHING) == LOGINERR_SETDELAY)
- mir_sntprintf(text, SIZEOF(text), TranslateT("%s login error (next retry (%d) in %d s)"), ProtoName, retryCount+1, db_get_dw(NULL, MODULENAME, SETTING_LOGINERR_DELAY, DEFAULT_MAXDELAY));
- else
- return -1;
-
+ else {
+ hIcon = LoadSkinnedProtoIcon((char*)lParam, SKINICON_STATUS_OFFLINE);
+ if ( db_get_b(NULL, MODULENAME, SETTING_LOGINERR, LOGINERR_NOTHING) == LOGINERR_CANCEL)
+ mir_sntprintf(text, SIZEOF(text), TranslateT("%s login error, cancel reconnecting"), GetHumanName(lParam));
+ else if ( db_get_b(NULL, MODULENAME, SETTING_LOGINERR, LOGINERR_NOTHING) == LOGINERR_SETDELAY)
+ mir_sntprintf(text, SIZEOF(text), TranslateT("%s login error (next retry (%d) in %d s)"), GetHumanName(lParam), retryCount+1, db_get_dw(NULL, MODULENAME, SETTING_LOGINERR_DELAY, DEFAULT_MAXDELAY));
+ else
+ return -1;
+ }
break;
case KS_CONN_STATE_LOST: // lParam = 1 proto, or NULL
@@ -955,7 +952,7 @@ static int ProcessPopup(int reason, LPARAM lParam)
if (lParam) { // Указатель на имя модуля.
hIcon = LoadSkinnedProtoIcon((char*)lParam, SKINICON_STATUS_OFFLINE);
- mir_sntprintf(text, SIZEOF(text), TranslateT("%s status error (next retry (%d) in %d s)"), ProtoName, retryCount+1, currentDelay/1000);
+ mir_sntprintf(text, SIZEOF(text), TranslateT("%s status error (next retry (%d) in %d s)"), GetHumanName(lParam), retryCount+1, currentDelay/1000);
}
else mir_sntprintf(text, SIZEOF(text), TranslateT("Status error (next retry (%d) in %d s)"), retryCount+1, currentDelay/1000);
break;