diff options
author | George Hazan <george.hazan@gmail.com> | 2014-02-24 15:40:33 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2014-02-24 15:40:33 +0000 |
commit | 46a3d5c05b077f7dc3034465b0b7e0a8ea6b5204 (patch) | |
tree | bc3e10982a336de09a92a0887e07b0420eab34ea | |
parent | 60066ee3ab1d80569d5c13fc9c14fe082aa28be4 (diff) |
minor code cleaning
git-svn-id: http://svn.miranda-ng.org/main/trunk@8259 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r-- | plugins/StatusPlugins/AdvancedAutoAway/advancedautoaway.cpp | 60 | ||||
-rw-r--r-- | plugins/StatusPlugins/KeepStatus/keepstatus.cpp | 101 | ||||
-rw-r--r-- | plugins/StatusPlugins/StartupStatus/startupstatus.cpp | 16 | ||||
-rw-r--r-- | plugins/StatusPlugins/commonstatus.cpp | 16 |
4 files changed, 91 insertions, 102 deletions
diff --git a/plugins/StatusPlugins/AdvancedAutoAway/advancedautoaway.cpp b/plugins/StatusPlugins/AdvancedAutoAway/advancedautoaway.cpp index 297ec1d37c..2e5051d89b 100644 --- a/plugins/StatusPlugins/AdvancedAutoAway/advancedautoaway.cpp +++ b/plugins/StatusPlugins/AdvancedAutoAway/advancedautoaway.cpp @@ -32,17 +32,17 @@ /////////////////////////////////////////////////////////////////////////////////////////
-int CompareSettings( const TAAAProtoSetting* p1, const TAAAProtoSetting* p2 )
+int CompareSettings(const TAAAProtoSetting *p1, const TAAAProtoSetting *p2)
{
- return lstrcmpA( p1->szName, p2->szName );
+ return lstrcmpA(p1->szName, p2->szName);
}
TAAAProtoSettingList autoAwaySettings(10, CompareSettings);
-TAAAProtoSetting::TAAAProtoSetting( PROTOACCOUNT* pa )
+TAAAProtoSetting::TAAAProtoSetting(PROTOACCOUNT *pa)
{
cbSize = sizeof(PROTOCOLSETTINGEX);
- szName = pa->szModuleName;
+ szName = pa->szModuleName;
tszAccName = pa->tszAccountName;
lastStatus = status = originalStatusMode = ID_STATUS_CURRENT;
szMsg = NULL;
@@ -117,25 +117,26 @@ void LoadOptions(TAAAProtoSettingList &loadSettings, BOOL override) monitorKeyboard = db_get_b(NULL, MODULENAME, SETTING_MONITORKEYBOARD, TRUE);
lastInput = lastMirandaInput = GetTickCount();
- for ( int i=0; i < loadSettings.getCount(); i++ ) {
+ for (int i = 0; i < loadSettings.getCount(); i++) {
char* protoName;
if ((db_get_b(NULL, MODULENAME, SETTING_SAMESETTINGS, 0)) && !override)
protoName = SETTING_ALL;
else
protoName = loadSettings[i].szName;
- LoadAutoAwaySetting( loadSettings[i], protoName);
+ LoadAutoAwaySetting(loadSettings[i], protoName);
if (!override) {
if (loadSettings[i].optionFlags & FLAG_MONITORMIRANDA)
monitorMiranda = TRUE;
else if (ignoreLockKeys || ignoreSysKeys || ignoreAltCombo || (monitorMouse != monitorKeyboard))
monitorAll = TRUE;
- } }
+ }
+ }
if (db_get_b(NULL, "Idle", "AAEnable", 0))
return;
HookWindowsHooks(monitorMiranda, monitorAll);
- hAutoAwayTimer = SetTimer(NULL,0, db_get_w(NULL, MODULENAME, SETTING_AWAYCHECKTIMEINSECS, 5)*1000,AutoAwayTimer);
+ hAutoAwayTimer = SetTimer(NULL, 0, db_get_w(NULL, MODULENAME, SETTING_AWAYCHECKTIMEINSECS, 5) * 1000, AutoAwayTimer);
}
int LoadAutoAwaySetting(TAAAProtoSetting &autoAwaySetting, char* protoName)
@@ -154,16 +155,16 @@ int LoadAutoAwaySetting(TAAAProtoSetting &autoAwaySetting, char* protoName) if (db_get_b(NULL, MODULENAME, SETTING_SAMESETTINGS, 0))
flags = 0xFFFFFF;
else
- flags = CallProtoService(protoName, PS_GETCAPS,PFLAGNUM_2,0)&~CallProtoService(protoName, PS_GETCAPS, (WPARAM)PFLAGNUM_5, 0);
+ flags = CallProtoService(protoName, PS_GETCAPS, PFLAGNUM_2, 0)&~CallProtoService(protoName, PS_GETCAPS, (WPARAM)PFLAGNUM_5, 0);
mir_snprintf(setting, sizeof(setting), "%s_Lv1Status", protoName);
- autoAwaySetting.lv1Status = db_get_w(NULL, MODULENAME, setting, (flags&StatusModeToProtoFlag(ID_STATUS_AWAY))?ID_STATUS_AWAY:ID_STATUS_OFFLINE);
+ autoAwaySetting.lv1Status = db_get_w(NULL, MODULENAME, setting, (flags&StatusModeToProtoFlag(ID_STATUS_AWAY)) ? ID_STATUS_AWAY : ID_STATUS_OFFLINE);
mir_snprintf(setting, sizeof(setting), "%s_Lv2Status", protoName);
- autoAwaySetting.lv2Status = db_get_w(NULL, MODULENAME, setting, (flags&StatusModeToProtoFlag(ID_STATUS_NA))?ID_STATUS_NA:ID_STATUS_OFFLINE);
+ autoAwaySetting.lv2Status = db_get_w(NULL, MODULENAME, setting, (flags&StatusModeToProtoFlag(ID_STATUS_NA)) ? ID_STATUS_NA : ID_STATUS_OFFLINE);
return 0;
}
-static int ProcessProtoAck(WPARAM wParam,LPARAM lParam)
+static int ProcessProtoAck(WPARAM wParam, LPARAM lParam)
{
ACKDATA *ack = (ACKDATA*)lParam;
if (ack->type != ACKTYPE_STATUS || ack->result != ACKRESULT_SUCCESS)
@@ -188,7 +189,7 @@ static int ProcessProtoAck(WPARAM wParam,LPARAM lParam) /////////////////////////////////////////////////////////////////////////////////////////
// Account control event
-int OnAccChanged(WPARAM wParam,LPARAM lParam)
+int OnAccChanged(WPARAM wParam, LPARAM lParam)
{
PROTOACCOUNT *pa = (PROTOACCOUNT*)lParam;
switch (wParam) {
@@ -221,7 +222,7 @@ static char* status2descr(int status) return "ERROR";
}
-static int changeState(TAAAProtoSetting& setting, STATES newState)
+static int changeState(TAAAProtoSetting &setting, STATES newState)
{
if (setting.curState == newState)
return 0;
@@ -229,8 +230,7 @@ static int changeState(TAAAProtoSetting& setting, STATES newState) setting.oldState = setting.curState;
setting.curState = newState;
- log_debugA("%s state change: %s -> %s", setting.szName,
- status2descr(setting.oldState), status2descr(setting.curState));
+ log_debugA("%s state change: %s -> %s", setting.szName, status2descr(setting.oldState), status2descr(setting.curState));
NotifyEventHooks(hStateChangedEvent, 0, (LPARAM)(AUTOAWAYSETTING*)&setting);
if (setting.curState != SET_ORGSTATUS && setting.curState != ACTIVE && setting.statusChanged) {
@@ -314,8 +314,8 @@ static VOID CALLBACK AutoAwayTimer(HWND hwnd, UINT message, UINT_PTR idEvent, DW aas.lastStatus = CallProtoService(aas.szName, PS_GETSTATUS, 0, 0);
}
else if (((mouseStationaryTimer < sts1Time) && !bTrigger) &&
- ((aas.optionFlags & FLAG_LV2ONINACTIVE) || (!(aas.optionFlags&FLAG_SETNA))) &&
- (aas.optionFlags & FLAG_RESET)) {
+ ((aas.optionFlags & FLAG_LV2ONINACTIVE) || (!(aas.optionFlags&FLAG_SETNA))) &&
+ (aas.optionFlags & FLAG_RESET)) {
/* from STATUS1_SET to SET_ORGSTATUS */
changeState(aas, SET_ORGSTATUS);
}
@@ -351,8 +351,8 @@ static VOID CALLBACK AutoAwayTimer(HWND hwnd, UINT message, UINT_PTR idEvent, DW aas.mStatus = FALSE;
}
else if ((aas.optionFlags & FLAG_SETNA) && currentMode == aas.lv1Status &&
- currentMode != aas.lv2Status && (aas.statusFlags & StatusModeToProtoFlag(currentMode)) &&
- (mouseStationaryTimer >= sts2Time || (sts1setTime >= sts2Time && !(aas.optionFlags & FLAG_LV2ONINACTIVE)))) {
+ currentMode != aas.lv2Status && (aas.statusFlags & StatusModeToProtoFlag(currentMode)) &&
+ (mouseStationaryTimer >= sts2Time || (sts1setTime >= sts2Time && !(aas.optionFlags & FLAG_LV2ONINACTIVE)))) {
/* HIDDEN_ACTIVE to STATUS2_SET */
aas.lastStatus = aas.originalStatusMode = CallProtoService(aas.szName, PS_GETSTATUS, 0, 0);
aas.status = aas.lv2Status;
@@ -447,11 +447,11 @@ static LRESULT CALLBACK MirandaKeyBoardHookFunction(int code, WPARAM wParam, LPA if (code >= 0) {
if (ignoreAltCombo) {
if (((GetKeyState(VK_MENU) < 0) || (wParam == VK_MENU)) ||
- ((GetKeyState(VK_TAB) < 0) || (wParam == VK_TAB)) ||
- ((GetKeyState(VK_SHIFT) < 0) || (wParam == VK_SHIFT)) ||
- ((GetKeyState(VK_CONTROL) < 0) || (wParam == VK_CONTROL)) ||
- ((GetKeyState(VK_ESCAPE) < 0) || (wParam == VK_ESCAPE)) ||
- ((GetKeyState(VK_LWIN) < 0) || (wParam == VK_LWIN)) ||
+ ((GetKeyState(VK_TAB) < 0) || (wParam == VK_TAB)) ||
+ ((GetKeyState(VK_SHIFT) < 0) || (wParam == VK_SHIFT)) ||
+ ((GetKeyState(VK_CONTROL) < 0) || (wParam == VK_CONTROL)) ||
+ ((GetKeyState(VK_ESCAPE) < 0) || (wParam == VK_ESCAPE)) ||
+ ((GetKeyState(VK_LWIN) < 0) || (wParam == VK_LWIN)) ||
((GetKeyState(VK_RWIN) < 0) || (wParam == VK_RWIN)))
{
return CallNextHookEx(hMirandaKeyBoardHook, code, wParam, lParam);
@@ -510,11 +510,11 @@ static LRESULT CALLBACK KeyBoardHookFunction(int code, WPARAM wParam, LPARAM lPa if (code >= 0) {
if (ignoreAltCombo) {
if (((GetKeyState(VK_MENU) < 0) || (wParam == VK_MENU)) ||
- ((GetKeyState(VK_TAB) < 0) || (wParam == VK_TAB)) ||
- ((GetKeyState(VK_SHIFT) < 0) || (wParam == VK_SHIFT)) ||
- ((GetKeyState(VK_CONTROL) < 0) || (wParam == VK_CONTROL)) ||
- ((GetKeyState(VK_ESCAPE) < 0) || (wParam == VK_ESCAPE)) ||
- ((GetKeyState(VK_LWIN) < 0) || (wParam == VK_LWIN)) ||
+ ((GetKeyState(VK_TAB) < 0) || (wParam == VK_TAB)) ||
+ ((GetKeyState(VK_SHIFT) < 0) || (wParam == VK_SHIFT)) ||
+ ((GetKeyState(VK_CONTROL) < 0) || (wParam == VK_CONTROL)) ||
+ ((GetKeyState(VK_ESCAPE) < 0) || (wParam == VK_ESCAPE)) ||
+ ((GetKeyState(VK_LWIN) < 0) || (wParam == VK_LWIN)) ||
((GetKeyState(VK_RWIN) < 0) || (wParam == VK_RWIN)))
{
return CallNextHookEx(hKeyBoardHook, code, wParam, lParam);
diff --git a/plugins/StatusPlugins/KeepStatus/keepstatus.cpp b/plugins/StatusPlugins/KeepStatus/keepstatus.cpp index 6402c42a0f..13bf159ead 100644 --- a/plugins/StatusPlugins/KeepStatus/keepstatus.cpp +++ b/plugins/StatusPlugins/KeepStatus/keepstatus.cpp @@ -40,8 +40,7 @@ extern PLUGININFOEX pluginInfoEx; static HWND hMessageWindow = NULL;
-// variables (general)
-static int CompareConnections( const TConnectionSettings* p1, const TConnectionSettings* p2 )
+static int CompareConnections( const TConnectionSettings *p1, const TConnectionSettings *p2 )
{
return lstrcmpA( p1->szName, p2->szName );
}
@@ -910,15 +909,14 @@ static int ProcessPopup(int reason, LPARAM lParam) case KS_CONN_STATE_LOGINERROR: // lParam = 1 proto
if (!db_get_b(NULL, MODULENAME, SETTING_PUOTHER, TRUE))
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;
- }
+
+ 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
@@ -996,28 +994,27 @@ static INT_PTR ShowPopup(TCHAR *msg, HICON hIcon) ppd.lchIcon = hIcon;
_tcsncpy(ppd.lptzContactName, TranslateT("KeepStatus"), MAX_CONTACTNAME);
_tcsncpy(ppd.lptzText, msg, MAX_SECONDLINE);
- if ( db_get_b(NULL, MODULENAME, SETTING_POPUP_USEWINCOLORS, 0))
- {
+ if (db_get_b(NULL, MODULENAME, SETTING_POPUP_USEWINCOLORS, 0)) {
ppd.colorBack = GetSysColor(COLOR_BTNFACE);
ppd.colorText = GetSysColor(COLOR_WINDOWTEXT);
}
- else if ( !db_get_b(NULL, MODULENAME, SETTING_POPUP_USEDEFCOLORS, 0))
- {
+ else if (!db_get_b(NULL, MODULENAME, SETTING_POPUP_USEDEFCOLORS, 0)) {
ppd.colorBack = db_get_dw(NULL, MODULENAME, SETTING_POPUP_BACKCOLOR, 0xAAAAAA);
ppd.colorText = db_get_dw(NULL, MODULENAME, SETTING_POPUP_TEXTCOLOR, 0x0000CC);
}
ppd.PluginWindowProc = PopupDlgProc;
- switch ( db_get_b(NULL, MODULENAME, SETTING_POPUP_DELAYTYPE, POPUP_DELAYFROMPU)) {
+ switch (db_get_b(NULL, MODULENAME, SETTING_POPUP_DELAYTYPE, POPUP_DELAYFROMPU)) {
case POPUP_DELAYCUSTOM:
ppd.iSeconds = (int)db_get_dw(NULL, MODULENAME, SETTING_POPUP_TIMEOUT, 0);
- if (ppd.iSeconds == 0) {
- ppd.iSeconds = currentDelay/1000-1;
- }
+ if (ppd.iSeconds == 0)
+ ppd.iSeconds = currentDelay / 1000 - 1;
break;
+
case POPUP_DELAYPERMANENT:
ppd.iSeconds = -1;
break;
+
case POPUP_DELAYFROMPU:
default:
ppd.iSeconds = 0;
@@ -1028,12 +1025,12 @@ static INT_PTR ShowPopup(TCHAR *msg, HICON hIcon) LRESULT CALLBACK PopupDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
- switch(message) {
+ switch (message) {
case WM_CONTEXTMENU: // right
case WM_COMMAND: // left
- switch( db_get_b( NULL, MODULENAME,
- (message == WM_COMMAND) ? SETTING_POPUP_LEFTCLICK : SETTING_POPUP_RIGHTCLICK,
- POPUP_ACT_CLOSEPOPUP )) {
+ switch (db_get_b(NULL, MODULENAME,
+ (message == WM_COMMAND) ? SETTING_POPUP_LEFTCLICK : SETTING_POPUP_RIGHTCLICK,
+ POPUP_ACT_CLOSEPOPUP)) {
case POPUP_ACT_CANCEL:
// cancel timer
StopChecking();
@@ -1046,9 +1043,6 @@ LRESULT CALLBACK PopupDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa break;
}
break;
-
- case UM_FREEPLUGINDATA:
- break;
}
return DefWindowProc(hWnd, message, wParam, lParam);
@@ -1057,7 +1051,7 @@ LRESULT CALLBACK PopupDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa // =============== services ===================
INT_PTR StopReconnectingService(WPARAM wParam, LPARAM lParam)
{
- int ret = StartTimer(IDT_CHECKCONN|IDT_AFTERCHECK, -1, FALSE);
+ int ret = StartTimer(IDT_CHECKCONN | IDT_AFTERCHECK, -1, FALSE);
StopChecking();
return ret;
}
@@ -1074,7 +1068,7 @@ INT_PTR EnableProtocolService(WPARAM wParam, LPARAM lParam) return -1;
int ret = -2;
- for ( int i=0; i < connectionSettings.getCount(); i++ ) {
+ for (int i = 0; i < connectionSettings.getCount(); i++) {
TConnectionSettings& cs = connectionSettings[i];
if (!strcmp(szProto, cs.szName)) {
if (wParam) {
@@ -1097,12 +1091,12 @@ INT_PTR IsProtocolEnabledService(WPARAM wParam, LPARAM lParam) char dbSetting[128];
mir_snprintf(dbSetting, sizeof(dbSetting), "%s_enabled", szProto);
- if ( !db_get_b(NULL, MODULENAME, dbSetting, 1 ))
+ if (!db_get_b(NULL, MODULENAME, dbSetting, 1))
return FALSE;
- for ( int i=0; i < connectionSettings.getCount(); i++ ) {
+ for (int i = 0; i < connectionSettings.getCount(); i++) {
TConnectionSettings& cs = connectionSettings[i];
- if ( !strcmp(szProto, cs.szName ))
+ if (!strcmp(szProto, cs.szName))
return GetStatus(cs) != ID_STATUS_DISABLED;
}
@@ -1129,27 +1123,27 @@ static DWORD CALLBACK MessageWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM {
static PROTOCOLSETTINGEX** ps = NULL;
- switch(msg) {
+ switch (msg) {
case WM_POWERBROADCAST:
switch (wParam) {
- case PBT_APMSUSPEND:
+ case PBT_APMSUSPEND:
log_infoA("KeepStatus: suspend state detected: %08X %08X", wParam, lParam);
if (ps == NULL) {
ps = GetCurrentProtoSettingsCopy();
- for ( int i=0; i < connectionSettings.getCount(); i++)
- EnableProtocolService( 0, (LPARAM)ps[i]->szName );
+ for (int i = 0; i < connectionSettings.getCount(); i++)
+ EnableProtocolService(0, (LPARAM)ps[i]->szName);
// set proto's offline, the clist will not try to reconnect in that case
CallService(MS_CLIST_SETSTATUSMODE, (WPARAM)ID_STATUS_OFFLINE, 0);
}
break;
- //case PBT_APMRESUMEAUTOMATIC: ?
+ //case PBT_APMRESUMEAUTOMATIC: ?
case PBT_APMRESUMESUSPEND:
case PBT_APMRESUMECRITICAL:
log_infoA("KeepStatus: resume from suspend state");
if (ps != NULL) {
- for (int i=0;i<connectionSettings.getCount();i++)
+ for (int i = 0; i < connectionSettings.getCount(); i++)
AssignStatus(&connectionSettings[i], ps[i]->status, ps[i]->lastStatus, ps[i]->szMsg);
FreeProtoSettings(ps);
ps = NULL;
@@ -1160,7 +1154,7 @@ static DWORD CALLBACK MessageWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM break;
case WM_DESTROY:
- if ( ps != NULL ) {
+ if (ps != NULL) {
FreeProtoSettings(ps);
ps = NULL;
}
@@ -1173,37 +1167,36 @@ static DWORD CALLBACK MessageWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM /////////////////////////////////////////////////////////////////////////////////////////
// Account control event
-int OnAccChanged(WPARAM wParam,LPARAM lParam)
+int OnAccChanged(WPARAM wParam, LPARAM lParam)
{
- PROTOACCOUNT* pa = ( PROTOACCOUNT* )lParam;
- switch( wParam ) {
+ PROTOACCOUNT* pa = (PROTOACCOUNT*)lParam;
+ switch (wParam) {
case PRAC_ADDED:
- connectionSettings.insert( new TConnectionSettings( pa ));
- return 0;
+ connectionSettings.insert(new TConnectionSettings(pa));
+ break;
case PRAC_REMOVED:
- for ( int i=0; i < connectionSettings.getCount(); i++ ) {
- if ( !lstrcmpA( connectionSettings[i].szName, pa->szModuleName )) {
- connectionSettings.remove( i );
+ for (int i = 0; i < connectionSettings.getCount(); i++) {
+ if (!lstrcmpA(connectionSettings[i].szName, pa->szModuleName)) {
+ connectionSettings.remove(i);
break;
}
}
- return 0;
- default:
- return 0;
+ break;
}
+ return 0;
}
// =============== init stuff =================
-static int onShutdown(WPARAM,LPARAM)
+static int onShutdown(WPARAM, LPARAM)
{
UnhookEvent(hStatusChangeHook);
UnhookEvent(hProtoAckHook);
UnhookEvent(hCSStatusChangeHook);
UnhookEvent(hCSStatusChangeExHook);
- StopTimer(IDT_CHECKCONN|IDT_PROCESSACK|IDT_AFTERCHECK|IDT_CHECKCONTIN);
+ StopTimer(IDT_CHECKCONN | IDT_PROCESSACK | IDT_AFTERCHECK | IDT_CHECKCONTIN);
if (IsWindow(hMessageWindow))
DestroyWindow(hMessageWindow);
@@ -1215,17 +1208,17 @@ static int onShutdown(WPARAM,LPARAM) return 0;
}
-int CSModuleLoaded(WPARAM,LPARAM)
+int CSModuleLoaded(WPARAM, LPARAM)
{
InitializeCriticalSection(&GenTimerCS);
InitializeCriticalSection(&GenStatusCS);
InitializeCriticalSection(&CheckContinueslyCS);
- protoList = ( OBJLIST<PROTOCOLSETTINGEX>* )&connectionSettings;
+ protoList = (OBJLIST<PROTOCOLSETTINGEX>*)&connectionSettings;
hMessageWindow = NULL;
LoadMainOptions();
-
+
HookEvent(ME_OPT_INITIALISE, OptionsInit);
HookEvent(ME_SYSTEM_PRESHUTDOWN, onShutdown);
HookEvent(ME_PROTO_ACCLISTCHANGED, OnAccChanged);
diff --git a/plugins/StatusPlugins/StartupStatus/startupstatus.cpp b/plugins/StatusPlugins/StartupStatus/startupstatus.cpp index 92464e5d90..f43d556e3c 100644 --- a/plugins/StatusPlugins/StartupStatus/startupstatus.cpp +++ b/plugins/StatusPlugins/StartupStatus/startupstatus.cpp @@ -21,14 +21,14 @@ static UINT_PTR setStatusTimerId = 0;
-int CompareSettings(const TSSSetting* p1, const TSSSetting* p2)
+int CompareSettings(const TSSSetting *p1, const TSSSetting *p2)
{
return lstrcmpA(p1->szName, p2->szName);
}
static TSettingsList startupSettings(10, CompareSettings);
-TSSSetting::TSSSetting(PROTOACCOUNT* pa)
+TSSSetting::TSSSetting(PROTOACCOUNT *pa)
{
cbSize = sizeof(PROTOCOLSETTINGEX);
szName = pa->szModuleName;
@@ -67,16 +67,12 @@ TSSSetting::TSSSetting(int profile, PROTOACCOUNT* pa) TSSSetting::~TSSSetting()
{
- if (szMsg != NULL)
- free(szMsg);
+ free(szMsg);
}
/////////////////////////////////////////////////////////////////////////////////////////
-static HANDLE
-hProtoAckHook,
-hCSStatusChangeHook,
-hStatusChangeHook;
+static HANDLE hProtoAckHook, hCSStatusChangeHook, hStatusChangeHook;
static HWND hMessageWindow;
@@ -330,7 +326,9 @@ static int OnOkToExit(WPARAM, LPARAM) if (npi.szMsg != NULL) {
db_set_ts(NULL, MODULENAME, lastMsg, npi.tszMsg);
mir_free(npi.tszMsg);
- } } }
+ }
+ }
+ }
if (db_get_b(NULL, MODULENAME, SETTING_SETPROFILE, 1) || db_get_b(NULL, MODULENAME, SETTING_OFFLINECLOSE, 0)) {
if (ServiceExists(MS_CLIST_SETSTATUSMODE))
diff --git a/plugins/StatusPlugins/commonstatus.cpp b/plugins/StatusPlugins/commonstatus.cpp index fb78e81c39..7369c60148 100644 --- a/plugins/StatusPlugins/commonstatus.cpp +++ b/plugins/StatusPlugins/commonstatus.cpp @@ -288,7 +288,7 @@ INT_PTR SetStatusEx(WPARAM wParam, LPARAM lParam) // set the status
if (newstatus != oldstatus && !(b_Caps1 && b_Caps3 && ServiceExists(MS_NAS_SETSTATE))) {
log_debugA("CommonStatus sets status for %s to %d", szProto, newstatus);
- CallProtoService(szProto, PS_SETSTATUS, (WPARAM)newstatus, 0);
+ CallProtoService(szProto, PS_SETSTATUS, newstatus, 0);
}
}
@@ -298,13 +298,13 @@ INT_PTR SetStatusEx(WPARAM wParam, LPARAM lParam) return -1;
}
log_debugA("CommonStatus: setting global status %u", globStatus);
- CallService(MS_CLIST_SETSTATUSMODE, (WPARAM)globStatus, 0);
+ CallService(MS_CLIST_SETSTATUSMODE, globStatus, 0);
}
return 0;
}
-static INT_PTR GetProtocolCountService(WPARAM wParam, LPARAM lParam)
+static INT_PTR GetProtocolCountService(WPARAM, LPARAM)
{
return GetProtoCount();
}
@@ -316,14 +316,12 @@ bool IsSuitableProto(PROTOACCOUNT *pa) int GetProtoCount()
{
- int pCount = 0;
-
- int count;
- PROTOACCOUNT **protos;
- ProtoEnumAccounts(&count, &protos);
+ int pCount = 0, count;
+ PROTOACCOUNT **accs;
+ ProtoEnumAccounts(&count, &accs);
for (int i = 0; i < count; i++)
- if (IsSuitableProto(protos[i]))
+ if (IsSuitableProto(accs[i]))
pCount++;
return pCount;
|