diff options
author | George Hazan <ghazan@miranda.im> | 2019-03-11 17:12:17 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2019-03-11 17:12:17 +0300 |
commit | 1f0b0e7a2047320d6808ac565eb35d66905252fd (patch) | |
tree | 127467c2414340ff442a517103f7937bfe3958e0 /plugins/StatusManager | |
parent | 5bbeb86b16369c9978d006b445b61a941895ccf3 (diff) |
code cleaning for old shitty helper
Diffstat (limited to 'plugins/StatusManager')
-rw-r--r-- | plugins/StatusManager/src/advancedautoaway.cpp | 8 | ||||
-rw-r--r-- | plugins/StatusManager/src/commonstatus.cpp | 22 | ||||
-rw-r--r-- | plugins/StatusManager/src/keepstatus.cpp | 64 | ||||
-rw-r--r-- | plugins/StatusManager/src/startupstatus.cpp | 14 |
4 files changed, 54 insertions, 54 deletions
diff --git a/plugins/StatusManager/src/advancedautoaway.cpp b/plugins/StatusManager/src/advancedautoaway.cpp index b3a9d10c75..2d42c89007 100644 --- a/plugins/StatusManager/src/advancedautoaway.cpp +++ b/plugins/StatusManager/src/advancedautoaway.cpp @@ -63,11 +63,11 @@ static int ProcessProtoAck(WPARAM, LPARAM lParam) if (ack->type != ACKTYPE_STATUS || ack->result != ACKRESULT_SUCCESS) return 0; - log_debugA("ProcessProtoAck: ack->szModule: %s", ack->szModule); + log_debug(0, "ProcessProtoAck: ack->szModule: %s", ack->szModule); for (auto &it : protoList) { - log_debugA("chk: %s", it->m_szName); + log_debug(0, "chk: %s", it->m_szName); if (!mir_strcmp(it->m_szName, ack->szModule)) { - log_debugA("ack->szModule: %s p.statusChanged: %d", ack->szModule, it->bStatusChanged); + log_debug(0, "ack->szModule: %s p.statusChanged: %d", ack->szModule, it->bStatusChanged); if (!it->bStatusChanged) it->bManualStatus = true; @@ -101,7 +101,7 @@ static int changeState(SMProto &setting, int mode, STATES newState) setting.oldState = setting.curState; setting.curState = newState; - log_debugA("%s state change: %s -> %s", setting.m_szName, status2descr(setting.oldState), status2descr(setting.curState)); + log_debug(0, "%s state change: %s -> %s", setting.m_szName, status2descr(setting.oldState), status2descr(setting.curState)); if (setting.curState != SET_ORGSTATUS && setting.curState != ACTIVE && setting.bStatusChanged) { /* change the awaymessage */ diff --git a/plugins/StatusManager/src/commonstatus.cpp b/plugins/StatusManager/src/commonstatus.cpp index ac86edbddf..d513d87208 100644 --- a/plugins/StatusManager/src/commonstatus.cpp +++ b/plugins/StatusManager/src/commonstatus.cpp @@ -133,7 +133,7 @@ int GetActualStatus(PROTOCOLSETTINGEX *protoSetting) return Proto_GetStatus(protoSetting->m_szName); if ((protoSetting->m_status < ID_STATUS_OFFLINE) || (protoSetting->m_status > ID_STATUS_OUTTOLUNCH)) { - log_debugA("invalid status detected: %d", protoSetting->m_status); + log_debug(0, "invalid status detected: %d", protoSetting->m_status); return 0; } return protoSetting->m_status; @@ -142,12 +142,12 @@ int GetActualStatus(PROTOCOLSETTINGEX *protoSetting) wchar_t* GetDefaultStatusMessage(PROTOCOLSETTINGEX *ps, int newstatus) { if (ps->m_szMsg != nullptr) {// custom message set - log_infoA("CommonStatus: Status message set by calling plugin"); + log_info(0, "CommonStatus: Status message set by calling plugin"); return mir_wstrdup(ps->m_szMsg); } wchar_t *tMsg = (wchar_t*)CallService(MS_AWAYMSG_GETSTATUSMSGW, newstatus, (LPARAM)ps->m_szName); - log_debugA("CommonStatus: Status message retrieved from general awaysys: %S", tMsg); + log_debug(0, "CommonStatus: Status message retrieved from general awaysys: %S", tMsg); return tMsg; } @@ -217,7 +217,7 @@ static void SetStatusMsg(PROTOCOLSETTINGEX *ps, int newstatus) tszMsg = szFormattedMsg; } } - log_debugA("CommonStatus sets status message for %s directly", ps->m_szName); + log_debug(0, "CommonStatus sets status message for %s directly", ps->m_szName); CallProtoService(ps->m_szName, PS_SETAWAYMSG, newstatus, (LPARAM)tszMsg); mir_free(tszMsg); } @@ -237,13 +237,13 @@ int SetStatusEx(TProtoSettings &ps) continue; if (!Proto_GetAccount(p->m_szName)) { - log_debugA("CommonStatus: %s is not loaded", p->m_szName); + log_debug(0, "CommonStatus: %s is not loaded", p->m_szName); continue; } // some checks int newstatus = GetActualStatus(p); if (newstatus == 0) { - log_debugA("CommonStatus: incorrect status for %s (%d)", p->m_szName, p->m_status); + log_debug(0, "CommonStatus: incorrect status for %s (%d)", p->m_szName, p->m_status); continue; } int oldstatus = Proto_GetStatus(p->m_szName); @@ -251,7 +251,7 @@ int SetStatusEx(TProtoSettings &ps) p->m_lastStatus = oldstatus; if (IsStatusConnecting(oldstatus)) { // ignore if connecting, but it didn't came this far if it did - log_debugA("CommonStatus: %s is already connecting", p->m_szName); + log_debug(0, "CommonStatus: %s is already connecting", p->m_szName); continue; } @@ -261,7 +261,7 @@ int SetStatusEx(TProtoSettings &ps) int b_Caps5 = CallProtoService(p->m_szName, PS_GETCAPS, PFLAGNUM_5, 0) & protoFlag; if (newstatus != ID_STATUS_OFFLINE && (!b_Caps2 || b_Caps5)) { // status and status message for this status not supported - //log_debug("CommonStatus: status not supported %s", szProto); + log_debug(0, "CommonStatus: status not supported %s", p->m_szName); continue; } @@ -269,7 +269,7 @@ int SetStatusEx(TProtoSettings &ps) int b_Caps3 = CallProtoService(p->m_szName, PS_GETCAPS, PFLAGNUM_3, 0) & protoFlag; if (newstatus == oldstatus && (!b_Caps1 || !b_Caps3)) { // no status change and status messages are not supported - //log_debug("CommonStatus: no change, %s (%d %d)", szProto, oldstatus, newstatus); + log_debug(0, "CommonStatus: no change, %s (%d %d)", p->m_szName, oldstatus, newstatus); continue; } @@ -279,13 +279,13 @@ int SetStatusEx(TProtoSettings &ps) // set the status if (newstatus != oldstatus /*&& !(b_Caps1 && b_Caps3 && ServiceExists(MS_NAS_SETSTATE))*/) { - log_debugA("CommonStatus sets status for %s to %d", p->m_szName, newstatus); + log_debug(0, "CommonStatus sets status for %s to %d", p->m_szName, newstatus); CallProtoService(p->m_szName, PS_SETSTATUS, newstatus, 0); } } if (globStatus != 0) { - log_debugA("CommonStatus: setting global status %u", globStatus); + log_debug(0, "CommonStatus: setting global status %u", globStatus); Clist_SetStatusMode(globStatus); } diff --git a/plugins/StatusManager/src/keepstatus.cpp b/plugins/StatusManager/src/keepstatus.cpp index 2356f77711..70d94d14cd 100644 --- a/plugins/StatusManager/src/keepstatus.cpp +++ b/plugins/StatusManager/src/keepstatus.cpp @@ -147,7 +147,7 @@ int SMProto::AssignStatus(int iStatus, int iLastStatus, wchar_t *pwszMsg) else m_status = iStatus; - log_infoA("KeepStatus: assigning status %d (%d, %d) to %s", m_status, m_lastStatus, iLastStatus, m_szName); + log_info(0, "KeepStatus: assigning status %d (%d, %d) to %s", m_status, m_lastStatus, iLastStatus, m_szName); if (pwszMsg != nullptr && mir_wstrcmp(pwszMsg, m_szMsg)) { if (m_szMsg != nullptr) @@ -189,11 +189,11 @@ static int SetCurrentStatus() continue; } - log_infoA("KeepStatus: status for %s differs: stored = %d, real = %d", p->m_szName, curStatus, realStatus); + log_info(0, "KeepStatus: status for %s differs: stored = %d, real = %d", p->m_szName, curStatus, realStatus); // force offline before reconnecting? if (realStatus != ID_STATUS_OFFLINE && KSPlugin.getByte(SETTING_FIRSTOFFLINE, FALSE)) { - log_infoA("KeepStatus: Setting %s offline before making a new connection attempt", p->m_szName); + log_info(0, "KeepStatus: Setting %S offline before making a new connection attempt", p->m_szName); CallProtoService(p->m_szName, PS_SETSTATUS, (WPARAM)ID_STATUS_OFFLINE, 0); } } @@ -282,8 +282,8 @@ static INT_PTR CALLBACK StartTimerApcProc(void *param) int res = 0; mir_cslock lck(GenTimerCS); - log_debugA("StartTimer: %d, %d, %d", ti->timer, ti->timeout, ti->restart); - log_debugA("ack: %u, chk: %u, aft: %u, cnt: %u, con: %u", processAckTimerId, checkConnectionTimerId, afterCheckTimerId, checkContinTimerId, checkConnectingTimerId); + log_debug(0, "StartTimer: %d, %d, %d", ti->timer, ti->timeout, ti->restart); + log_debug(0, "ack: %u, chk: %u, aft: %u, cnt: %u, con: %u", processAckTimerId, checkConnectionTimerId, afterCheckTimerId, checkContinTimerId, checkConnectingTimerId); if (ti->timer & IDT_PROCESSACK) { res = (processAckTimerId == 0) ? 0 : 1; if (((processAckTimerId == 0) && (checkConnectionTimerId == 0)) || (ti->restart)) { @@ -352,8 +352,8 @@ static INT_PTR CALLBACK StartTimerApcProc(void *param) } } - log_debugA("ack: %u, chk: %u, aft: %u, cnt: %u, con: %u", processAckTimerId, checkConnectionTimerId, afterCheckTimerId, checkContinTimerId, checkConnectingTimerId); - log_debugA("StartTimer done %d", res); + log_debug(0, "ack: %u, chk: %u, aft: %u, cnt: %u, con: %u", processAckTimerId, checkConnectionTimerId, afterCheckTimerId, checkContinTimerId, checkConnectingTimerId); + log_debug(0, "StartTimer done %d", res); return res; } @@ -368,8 +368,8 @@ static int StopTimer(int timer) int res = 0; mir_cslock lck(GenTimerCS); - log_debugA("StopTimer %d", timer); - log_debugA("ack: %u, chk: %u, aft: %u, cnt: %u, con: %u", processAckTimerId, checkConnectionTimerId, afterCheckTimerId, checkContinTimerId, checkConnectingTimerId); + log_debug(0, "StopTimer %d", timer); + log_debug(0, "ack: %u, chk: %u, aft: %u, cnt: %u, con: %u", processAckTimerId, checkConnectionTimerId, afterCheckTimerId, checkContinTimerId, checkConnectingTimerId); if (timer & IDT_PROCESSACK) { if (processAckTimerId == 0) @@ -421,8 +421,8 @@ static int StopTimer(int timer) } } - log_debugA("ack: %u, chk: %u, aft: %u, cnt: %u, con: %u", processAckTimerId, checkConnectionTimerId, afterCheckTimerId, checkContinTimerId, checkConnectingTimerId); - log_debugA("StopTimer done %d", res); + log_debug(0, "ack: %u, chk: %u, aft: %u, cnt: %u, con: %u", processAckTimerId, checkConnectionTimerId, afterCheckTimerId, checkContinTimerId, checkConnectingTimerId); + log_debug(0, "StopTimer done %d", res); return res; } @@ -468,7 +468,7 @@ static int ProcessProtoAck(WPARAM, LPARAM lParam) switch (KSPlugin.getByte(SETTING_LOGINERR, LOGINERR_NOTHING)) { case LOGINERR_CANCEL: - log_infoA("KeepStatus: cancel on login error (%s)", ack->szModule); + log_info(0, "KeepStatus: cancel on login error (%s)", ack->szModule); for (auto &it : protoList) if (!mir_strcmp(ack->szModule, it->m_szName)) it->AssignStatus(ID_STATUS_OFFLINE); @@ -480,7 +480,7 @@ static int ProcessProtoAck(WPARAM, LPARAM lParam) case LOGINERR_SETDELAY: { int newDelay = 1000 * KSPlugin.getDword(SETTING_LOGINERR_DELAY, DEFAULT_MAXDELAY); - log_infoA("KeepStatus: set delay to %d ms on login error (%s)", newDelay, ack->szModule); + log_info(0, "KeepStatus: set delay to %d ms on login error (%s)", newDelay, ack->szModule); StartTimer(IDT_CHECKCONN, newDelay, TRUE); } ProcessPopup(KS_CONN_STATE_LOGINERROR, (LPARAM)ack->szModule); @@ -508,7 +508,7 @@ static VOID CALLBACK CheckConnectingTimer(HWND, UINT, UINT_PTR, DWORD) if (maxConnectingTime > 0) { if ((unsigned int)maxConnectingTime <= ((GetTickCount() - it->lastStatusAckTime) / 1000)) { // set offline - log_infoA("KeepStatus: %s is too long connecting; setting offline", it->m_szName); + log_info(0, "KeepStatus: %s is too long connecting; setting offline", it->m_szName); CallProtoService(it->m_szName, PS_SETSTATUS, (WPARAM)ID_STATUS_OFFLINE, 0); } } @@ -541,7 +541,7 @@ static VOID CALLBACK CheckAckStatusTimer(HWND, UINT, UINT_PTR, DWORD) else if (newStatus == ID_STATUS_OFFLINE) {// start checking connection if (!StartTimer(IDT_CHECKCONN, -1, FALSE)) { /* check if not already checking */ needChecking = true; - log_infoA("KeepStatus: connection lost! (%s)", it->m_szName); + log_info(0, "KeepStatus: connection lost! (%s)", it->m_szName); NotifyEventHooks(hConnectionEvent, (WPARAM)KS_CONN_STATE_LOST, (LPARAM)it->m_szName); ProcessPopup(KS_CONN_STATE_LOST, (LPARAM)it->m_szName); } @@ -554,7 +554,7 @@ static VOID CALLBACK CheckAckStatusTimer(HWND, UINT, UINT_PTR, DWORD) static VOID CALLBACK CheckConnectionTimer(HWND, UINT, UINT_PTR, DWORD) { - log_debugA("CheckConnectionTimer"); + log_debug(0, "CheckConnectionTimer"); bool setStatus = false; for (auto &it : protoList) { @@ -591,7 +591,7 @@ static VOID CALLBACK CheckConnectionTimer(HWND, UINT, UINT_PTR, DWORD) else // all status set ok already, or stop checking StopChecking(); - log_debugA("CheckConnectionTimer done"); + log_debug(0, "CheckConnectionTimer done"); } static int StopChecking() @@ -611,7 +611,7 @@ static int StopChecking() NotifyEventHooks(hConnectionEvent, (WPARAM)KS_CONN_STATE_STOPPEDCHECKING, (LPARAM)isOk); ProcessPopup(KS_CONN_STATE_STOPPEDCHECKING, (LPARAM)isOk); - log_infoA("KeepStatus: stop checking (%s)", isOk ? "success" : "failure"); + log_info(0, "KeepStatus: stop checking (%s)", isOk ? "success" : "failure"); retryCount = 0; currentDelay = initDelay; @@ -660,13 +660,13 @@ static void CheckContinuouslyFunction(void *) continue; if (shouldBeStatus != ID_STATUS_OFFLINE) { - log_debugA("CheckContinuouslyFunction: %s should be %d", it->m_szName, shouldBeStatus); + log_debug(0, "CheckContinuouslyFunction: %s should be %d", it->m_szName, shouldBeStatus); doPing = true; } } if (!doPing) { - log_debugA("CheckContinuouslyFunction: All protocols should be offline, no need to check connection"); + log_debug(0, "CheckContinuouslyFunction: All protocols should be offline, no need to check connection"); return; } @@ -686,7 +686,7 @@ static void CheckContinuouslyFunction(void *) HANDLE hICMPFile = (HANDLE)IcmpCreateFile(); if (hICMPFile == INVALID_HANDLE_VALUE) { bLastPingResult = TRUE; - log_infoA("KeepStatus: icmp.dll error (2)"); + log_info(0, "KeepStatus: icmp.dll error (2)"); } if (bLastPingResult == FALSE) { start = dbv.pszVal; @@ -706,9 +706,9 @@ static void CheckContinuouslyFunction(void *) else pingFailures++; - log_debugA("CheckContinuouslyFunction: pinging %s (result: %d/%d)", host, bLastPingResult, pingFailures); + log_debug(0, "CheckContinuouslyFunction: pinging %s (result: %d/%d)", host, bLastPingResult, pingFailures); } - else log_debugA("CheckContinuouslyFunction: unable to resolve %s", host); + else log_debug(0, "CheckContinuouslyFunction: unable to resolve %s", host); start = end; while (*start == ' ') @@ -731,21 +731,21 @@ static void CheckContinuouslyFunction(void *) continue; if (IsStatusConnecting(pa->iRealStatus)) { - log_debugA("CheckContinuouslyFunction: %s is connecting", pa->szModuleName); + log_debug(0, "CheckContinuouslyFunction: %s is connecting", pa->szModuleName); continue; // connecting, leave alone } if (IsProtocolEnabledService(0, (LPARAM)pa->szModuleName)) { - log_debugA("CheckContinuouslyFunction: forcing %s offline", pa->szModuleName); + log_debug(0, "CheckContinuouslyFunction: forcing %s offline", pa->szModuleName); CallProtoService(pa->szModuleName, PS_SETSTATUS, (WPARAM)ID_STATUS_OFFLINE, 0); } } if (StartTimer(IDT_CHECKCONN | IDT_PROCESSACK, -1, FALSE)) {// are our 'set offlines' noticed? - log_debugA("CheckContinuouslyFunction: currently checking"); + log_debug(0, "CheckContinuouslyFunction: currently checking"); return; } - log_infoA("KeepStatus: connection lost! (continuesly check)"); + log_info(0, "KeepStatus: connection lost! (continuesly check)"); NotifyEventHooks(hConnectionEvent, (WPARAM)KS_CONN_STATE_LOST, 0); ProcessPopup(KS_CONN_STATE_LOST, 0); maxRetries = KSPlugin.getByte(SETTING_MAXRETRIES, 0); @@ -798,7 +798,7 @@ static INT_PTR ShowPopup(const wchar_t *msg, HICON hIcon) ppd.iSeconds = 0; break; } - return (int)PUAddPopupW(&ppd); + return (INT_PTR)PUAddPopupW(&ppd); } static wchar_t* GetHumanName(LPARAM lParam) @@ -899,7 +899,7 @@ static int ProcessPopup(int reason, LPARAM lParam) if (hIcon == nullptr) hIcon = Skin_LoadIcon(SKINICON_STATUS_OFFLINE); - log_info(L"KeepStatus: %s", wszText.c_str()); + Netlib_Logf(0, "KeepStatus: %s", wszText.c_str()); return ShowPopup(wszText, hIcon); } @@ -983,7 +983,7 @@ INT_PTR IsProtocolEnabledService(WPARAM, LPARAM lParam) INT_PTR AnnounceStatusChangeService(WPARAM, LPARAM lParam) { PROTOCOLSETTINGEX *newSituation = (PROTOCOLSETTINGEX *)lParam; - log_infoA("Another plugin announced a status change to %d for %s", newSituation->m_status, newSituation->m_szName == nullptr ? "all" : newSituation->m_szName); + log_info(0, "Another plugin announced a status change to %d for %s", newSituation->m_status, newSituation->m_szName == nullptr ? "all" : newSituation->m_szName); for (auto &it : protoList) if (!mir_strcmp(it->m_szName, newSituation->m_szName)) @@ -1003,7 +1003,7 @@ static DWORD CALLBACK MessageWndProc(HWND, UINT msg, WPARAM wParam, LPARAM lPara case WM_POWERBROADCAST: switch (wParam) { case PBT_APMSUSPEND: - log_infoA("KeepStatus: suspend state detected: %08X %08X", wParam, lParam); + log_info(0, "KeepStatus: suspend state detected: %08X %08X", wParam, lParam); if (ps == nullptr) { ps = new TProtoSettings(protoList); for (auto &it : *ps) @@ -1017,7 +1017,7 @@ static DWORD CALLBACK MessageWndProc(HWND, UINT msg, WPARAM wParam, LPARAM lPara case PBT_APMRESUMESUSPEND: case PBT_APMRESUMECRITICAL: // case PBT_APMRESUMEAUTOMATIC: ? - log_infoA("KeepStatus: resume from suspend state"); + log_info(0, "KeepStatus: resume from suspend state"); if (ps != nullptr) { for (auto &it : *ps) { SMProto *p = protoList.find(it); diff --git a/plugins/StatusManager/src/startupstatus.cpp b/plugins/StatusManager/src/startupstatus.cpp index f6c539f902..0a9ad2b585 100644 --- a/plugins/StatusManager/src/startupstatus.cpp +++ b/plugins/StatusManager/src/startupstatus.cpp @@ -144,7 +144,7 @@ static int ProcessProtoAck(WPARAM, LPARAM lParam) for (auto &it : protoList) { if (!mir_strcmp(ack->szModule, it->m_szName)) { it->ssDisabled = true; - log_debugA("StartupStatus: %s overridden by ME_PROTO_ACK, status will not be set", ack->szModule); + log_debug(0, "StartupStatus: %s overridden by ME_PROTO_ACK, status will not be set", ack->szModule); } } @@ -161,14 +161,14 @@ static int StatusChange(WPARAM, LPARAM lParam) if (szProto == nullptr) { // global status change for (auto &it : protoList) { it->ssDisabled = true; - log_debugA("StartupStatus: all protos overridden by ME_CLIST_STATUSMODECHANGE, status will not be set"); + log_debug(0, "StartupStatus: all protos overridden by ME_CLIST_STATUSMODECHANGE, status will not be set"); } } else { for (auto &it : protoList) { if (!mir_strcmp(it->m_szName, szProto)) { it->ssDisabled = true; - log_debugA("StartupStatus: %s overridden by ME_CLIST_STATUSMODECHANGE, status will not be set", szProto); + log_debug(0, "StartupStatus: %s overridden by ME_CLIST_STATUSMODECHANGE, status will not be set", szProto); } } } @@ -193,7 +193,7 @@ static int CSStatusChangeEx(WPARAM wParam, LPARAM) continue; if (!mir_strcmp(ps[i]->m_szName, it->m_szName)) { - log_debugA("StartupStatus: %s overridden by MS_CS_SETSTATUSEX, status will not be set", ps[i]->m_szName); + log_debug(0, "StartupStatus: %s overridden by MS_CS_SETSTATUSEX, status will not be set", ps[i]->m_szName); it->ssDisabled = true; } } @@ -311,11 +311,11 @@ static DWORD CALLBACK MessageWndProc(HWND, UINT msg, WPARAM wParam, LPARAM) { switch (msg) { case WM_ENDSESSION: - log_debugA("WM_ENDSESSION"); + log_debug(0, "WM_ENDSESSION"); if (wParam) { - log_debugA("WM_ENDSESSION: calling exit"); + log_debug(0, "WM_ENDSESSION: calling exit"); OnShutdown(0, 0); - log_debugA("WM_ENDSESSION: exit called"); + log_debug(0, "WM_ENDSESSION: exit called"); } break; } |