summaryrefslogtreecommitdiff
path: root/plugins/StatusPlugins
diff options
context:
space:
mode:
authorKirill Volinsky <mataes2007@gmail.com>2014-12-16 17:06:59 +0000
committerKirill Volinsky <mataes2007@gmail.com>2014-12-16 17:06:59 +0000
commitae6a10ba2621f5dbd9f50ab36d819a8cd160d741 (patch)
tree0ef862a34e4ce361d8f34f3ed16627e363ea70fc /plugins/StatusPlugins
parent50103414521663eb1cecadff387bcf227f1b8b86 (diff)
KeepStatus: changed warning lavel to w4
git-svn-id: http://svn.miranda-ng.org/main/trunk@11470 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/StatusPlugins')
-rw-r--r--plugins/StatusPlugins/KeepStatus/KeepStatus_12.vcxproj8
-rw-r--r--plugins/StatusPlugins/KeepStatus/keepstatus.cpp350
-rw-r--r--plugins/StatusPlugins/KeepStatus/keepstatus.h30
-rw-r--r--plugins/StatusPlugins/KeepStatus/main.cpp40
-rw-r--r--plugins/StatusPlugins/KeepStatus/options.cpp382
-rw-r--r--plugins/StatusPlugins/commonstatus.cpp120
-rw-r--r--plugins/StatusPlugins/commonstatus.h47
-rw-r--r--plugins/StatusPlugins/confirmdialog.cpp310
8 files changed, 645 insertions, 642 deletions
diff --git a/plugins/StatusPlugins/KeepStatus/KeepStatus_12.vcxproj b/plugins/StatusPlugins/KeepStatus/KeepStatus_12.vcxproj
index 30805339cd..f79e8063b6 100644
--- a/plugins/StatusPlugins/KeepStatus/KeepStatus_12.vcxproj
+++ b/plugins/StatusPlugins/KeepStatus/KeepStatus_12.vcxproj
@@ -82,7 +82,7 @@
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>..\commonstatus.h</PrecompiledHeaderFile>
- <WarningLevel>Level3</WarningLevel>
+ <WarningLevel>Level4</WarningLevel>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
<DisableSpecificWarnings>4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<ExceptionHandling>false</ExceptionHandling>
@@ -116,7 +116,7 @@
<FloatingPointModel>Fast</FloatingPointModel>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>..\commonstatus.h</PrecompiledHeaderFile>
- <WarningLevel>Level3</WarningLevel>
+ <WarningLevel>Level4</WarningLevel>
<DisableSpecificWarnings>4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
</ClCompile>
<ResourceCompile>
@@ -148,7 +148,7 @@
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>..\commonstatus.h</PrecompiledHeaderFile>
<PreprocessorDefinitions>NDEBUG;_WINDOWS;_USRDLL;KEEPSTATUS_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <WarningLevel>Level3</WarningLevel>
+ <WarningLevel>Level4</WarningLevel>
<DisableSpecificWarnings>4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
</ClCompile>
<Link>
@@ -176,7 +176,7 @@
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>..\commonstatus.h</PrecompiledHeaderFile>
<PreprocessorDefinitions>_DEBUG;_WINDOWS;_USRDLL;KEEPSTATUS_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <WarningLevel>Level3</WarningLevel>
+ <WarningLevel>Level4</WarningLevel>
<DisableSpecificWarnings>4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<Optimization>Disabled</Optimization>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
diff --git a/plugins/StatusPlugins/KeepStatus/keepstatus.cpp b/plugins/StatusPlugins/KeepStatus/keepstatus.cpp
index f21f169ae5..81461cba9b 100644
--- a/plugins/StatusPlugins/KeepStatus/keepstatus.cpp
+++ b/plugins/StatusPlugins/KeepStatus/keepstatus.cpp
@@ -1,21 +1,21 @@
/*
- KeepStatus Plugin for Miranda-IM (www.miranda-im.org)
- Copyright 2003-2006 P. Boon
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-*/
+ KeepStatus Plugin for Miranda-IM (www.miranda-im.org)
+ Copyright 2003-2006 P. Boon
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
#include "../commonstatus.h"
#include "keepstatus.h"
#include "../resource.h"
@@ -40,12 +40,12 @@ extern PLUGININFOEX pluginInfoEx;
static HWND hMessageWindow = NULL;
-static int CompareConnections( const TConnectionSettings *p1, const TConnectionSettings *p2 )
+static int CompareConnections(const TConnectionSettings *p1, const TConnectionSettings *p2)
{
- return mir_strcmp( p1->szName, p2->szName );
+ return mir_strcmp(p1->szName, p2->szName);
}
-static OBJLIST<TConnectionSettings> connectionSettings( 10, CompareConnections );
+static OBJLIST<TConnectionSettings> connectionSettings(10, CompareConnections);
static UINT_PTR checkConnectionTimerId = 0;
static UINT_PTR afterCheckTimerId = 0;
@@ -68,18 +68,18 @@ static int StopTimer(int timer);
int LoadMainOptions();
static void GetCurrentConnectionSettings();
static int AssignStatus(TConnectionSettings* connSetting, int status, int lastStatus, TCHAR *szMsg);
-static int ProcessProtoAck(WPARAM wParam,LPARAM lParam);
-static VOID CALLBACK CheckConnectingTimer(HWND hwnd,UINT message,UINT_PTR idEvent,DWORD dwTime);
-static VOID CALLBACK CheckAckStatusTimer(HWND hwnd,UINT message,UINT_PTR idEvent,DWORD dwTime);
+static int ProcessProtoAck(WPARAM wParam, LPARAM lParam);
+static VOID CALLBACK CheckConnectingTimer(HWND hwnd, UINT message, UINT_PTR idEvent, DWORD dwTime);
+static VOID CALLBACK CheckAckStatusTimer(HWND hwnd, UINT message, UINT_PTR idEvent, DWORD dwTime);
static int StatusChange(WPARAM wParam, LPARAM lParam);
static int CSStatusChange(WPARAM wParam, LPARAM lParam);
static int CSStatusChangeEx(WPARAM wParam, LPARAM lParam);
-static VOID CALLBACK StatusChangeTimer(HWND hwnd,UINT message,UINT_PTR idEvent,DWORD dwTime);
-static VOID CALLBACK CheckConnectionTimer(HWND hwnd,UINT message, UINT_PTR idEvent,DWORD dwTime);
+static VOID CALLBACK StatusChangeTimer(HWND hwnd, UINT message, UINT_PTR idEvent, DWORD dwTime);
+static VOID CALLBACK CheckConnectionTimer(HWND hwnd, UINT message, UINT_PTR idEvent, DWORD dwTime);
static int StopChecking();
-static VOID CALLBACK AfterCheckTimer(HWND hwnd,UINT message, UINT_PTR idEvent,DWORD dwTime);
+static VOID CALLBACK AfterCheckTimer(HWND hwnd, UINT message, UINT_PTR idEvent, DWORD dwTime);
static void ContinueslyCheckFunction(void *arg);
-static VOID CALLBACK CheckContinueslyTimer(HWND hwnd,UINT message, UINT_PTR idEvent,DWORD dwTime);
+static VOID CALLBACK CheckContinueslyTimer(HWND hwnd, UINT message, UINT_PTR idEvent, DWORD dwTime);
INT_PTR IsProtocolEnabledService(WPARAM wParam, LPARAM lParam);
static int ProcessPopup(int reason, LPARAM lParam);
@@ -88,24 +88,24 @@ LRESULT CALLBACK PopupDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa
static DWORD CALLBACK MessageWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
// options.c
-extern int OptionsInit(WPARAM wparam,LPARAM);
+extern int OptionsInit(WPARAM wparam, LPARAM);
extern int InitCommonStatus();
-TConnectionSettings::TConnectionSettings( PROTOACCOUNT *pa )
+TConnectionSettings::TConnectionSettings(PROTOACCOUNT *pa)
{
cbSize = sizeof(PROTOCOLSETTINGEX);
szName = pa->szModuleName;
tszAccName = pa->tszAccountName;
szMsg = NULL;
- int status = CallProtoService( pa->szModuleName, PS_GETSTATUS, 0, 0);
- AssignStatus( this, status, status, NULL);
+ int status = CallProtoService(pa->szModuleName, PS_GETSTATUS, 0, 0);
+ AssignStatus(this, status, status, NULL);
}
TConnectionSettings::~TConnectionSettings()
{
- if ( szMsg != NULL)
- free( szMsg );
+ if (szMsg != NULL)
+ free(szMsg);
}
int LoadMainOptions()
@@ -121,22 +121,22 @@ int LoadMainOptions()
if (StartTimer(IDT_CHECKCONTIN, -1, FALSE)) {
WSACleanup();
}
- StopTimer(IDT_CHECKCONN|IDT_PROCESSACK|IDT_AFTERCHECK|IDT_CHECKCONTIN|IDT_CHECKCONNECTING);
+ StopTimer(IDT_CHECKCONN | IDT_PROCESSACK | IDT_AFTERCHECK | IDT_CHECKCONTIN | IDT_CHECKCONNECTING);
GetCurrentConnectionSettings();
- if ( db_get_b(NULL, MODULENAME, SETTING_CHECKCONNECTION, FALSE)) {
- if ( db_get_b(NULL, MODULENAME, SETTING_CONTCHECK, FALSE)) {
- if ( db_get_b(NULL, MODULENAME, SETTING_BYPING, FALSE)) {
+ if (db_get_b(NULL, MODULENAME, SETTING_CHECKCONNECTION, FALSE)) {
+ if (db_get_b(NULL, MODULENAME, SETTING_CONTCHECK, FALSE)) {
+ if (db_get_b(NULL, MODULENAME, SETTING_BYPING, FALSE)) {
WSADATA wsaData;
WSAStartup(MAKEWORD(2, 2), &wsaData);
}
StartTimer(IDT_CHECKCONTIN, 0, FALSE);
}
increaseExponential = db_get_b(NULL, MODULENAME, SETTING_INCREASEEXPONENTIAL, FALSE);
- currentDelay = initDelay = 1000*db_get_dw(NULL, MODULENAME, SETTING_INITDELAY, DEFAULT_INITDELAY);
- maxDelay = 1000*db_get_dw(NULL, MODULENAME, SETTING_MAXDELAY, DEFAULT_MAXDELAY);
- maxRetries = db_get_b(NULL, MODULENAME, SETTING_MAXRETRIES,0);
+ currentDelay = initDelay = 1000 * db_get_dw(NULL, MODULENAME, SETTING_INITDELAY, DEFAULT_INITDELAY);
+ maxDelay = 1000 * db_get_dw(NULL, MODULENAME, SETTING_MAXDELAY, DEFAULT_MAXDELAY);
+ maxRetries = db_get_b(NULL, MODULENAME, SETTING_MAXRETRIES, 0);
if (maxRetries == 0)
maxRetries = -1;
hProtoAckHook = HookEvent(ME_PROTO_ACK, ProcessProtoAck);
@@ -144,7 +144,7 @@ int LoadMainOptions()
if (ServiceExists(ME_CS_STATUSCHANGE))
hCSStatusChangeHook = HookEvent(ME_CS_STATUSCHANGE, CSStatusChange);
hCSStatusChangeExHook = HookEvent(ME_CS_STATUSCHANGEEX, CSStatusChangeEx);
- if ( db_get_b(NULL, MODULENAME, SETTING_CHECKAPMRESUME, 0)&&(CallService(MS_SYSTEM_GETVERSION,0,0) >= 0x00040000)) {
+ if (db_get_b(NULL, MODULENAME, SETTING_CHECKAPMRESUME, 0) && (CallService(MS_SYSTEM_GETVERSION, 0, 0) >= 0x00040000)) {
if (!IsWindow(hMessageWindow)) {
hMessageWindow = CreateWindowEx(0, _T("STATIC"), NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL);
SetWindowLongPtr(hMessageWindow, GWLP_WNDPROC, (LONG_PTR)MessageWndProc);
@@ -162,23 +162,23 @@ static void GetCurrentConnectionSettings()
int count;
PROTOACCOUNT** protos;
- ProtoEnumAccounts( &count, &protos );
+ ProtoEnumAccounts(&count, &protos);
- for ( int i=0; i < count; i++ )
- if ( IsSuitableProto( protos[i] ))
- connectionSettings.insert( new TConnectionSettings( protos[i] ));
+ for (int i = 0; i < count; i++)
+ if (IsSuitableProto(protos[i]))
+ connectionSettings.insert(new TConnectionSettings(protos[i]));
}
static PROTOCOLSETTINGEX** GetCurrentProtoSettingsCopy()
{
EnterCriticalSection(&GenStatusCS);
- PROTOCOLSETTINGEX **ps = ( PROTOCOLSETTINGEX** )malloc(connectionSettings.getCount()*sizeof(PROTOCOLSETTINGEX *));
+ PROTOCOLSETTINGEX **ps = (PROTOCOLSETTINGEX**)malloc(connectionSettings.getCount()*sizeof(PROTOCOLSETTINGEX *));
if (ps == NULL) {
LeaveCriticalSection(&GenStatusCS);
return NULL;
}
- for(int i=0;i<connectionSettings.getCount();i++) {
- ps[i] = ( PROTOCOLSETTINGEX* )calloc(1, sizeof(PROTOCOLSETTINGEX));
+ for (int i = 0; i < connectionSettings.getCount(); i++) {
+ ps[i] = (PROTOCOLSETTINGEX*)calloc(1, sizeof(PROTOCOLSETTINGEX));
if (ps[i] == NULL) {
LeaveCriticalSection(&GenStatusCS);
return NULL;
@@ -199,7 +199,7 @@ static PROTOCOLSETTINGEX** GetCurrentProtoSettingsCopy()
static void FreeProtoSettings(PROTOCOLSETTINGEX** ps)
{
- for(int i=0; i < connectionSettings.getCount(); i++) {
+ for (int i = 0; i < connectionSettings.getCount(); i++) {
if (ps[i]->szMsg != NULL)
free(ps[i]->szMsg);
free(ps[i]);
@@ -209,7 +209,7 @@ static void FreeProtoSettings(PROTOCOLSETTINGEX** ps)
static int AssignStatus(TConnectionSettings* cs, int status, int lastStatus, TCHAR *szMsg)
{
- if ( status < MIN_STATUS || status > MAX_STATUS )
+ if (status < MIN_STATUS || status > MAX_STATUS)
return -1;
EnterCriticalSection(&GenStatusCS);
@@ -226,8 +226,8 @@ static int AssignStatus(TConnectionSettings* cs, int status, int lastStatus, TCH
log_infoA("KeepStatus: assigning status %d to %s", cs->status, cs->szName);
- if ( szMsg != NULL && mir_tstrcmp(szMsg, cs->szMsg)) {
- if ( cs->szMsg != NULL )
+ if (szMsg != NULL && mir_tstrcmp(szMsg, cs->szMsg)) {
+ if (cs->szMsg != NULL)
free(cs->szMsg);
cs->szMsg = _tcsdup(szMsg);
@@ -253,7 +253,7 @@ static int GetStatus(const TConnectionSettings& cs)
static int SetCurrentStatus()
{
PROTOCOLSETTINGEX **ps = GetCurrentProtoSettingsCopy();
- for (int i=0; i < connectionSettings.getCount(); i++) {
+ for (int i = 0; i < connectionSettings.getCount(); i++) {
int realStatus = CallProtoService(ps[i]->szName, PS_GETSTATUS, 0, 0);
if (ps[i]->status == ID_STATUS_DISABLED || ps[i]->status == realStatus) { // ignore this proto by removing it's name (not so nice)
ps[i]->szName = "";
@@ -275,18 +275,18 @@ static int StatusChange(WPARAM wParam, LPARAM lParam)
{
char* szProto = (char *)lParam;
if (szProto == NULL) { // global status change
- for (int i=0;i<connectionSettings.getCount();i++) {
+ for (int i = 0; i < connectionSettings.getCount(); i++) {
TConnectionSettings& cs = connectionSettings[i];
if (GetStatus(cs) != ID_STATUS_DISABLED)
- if ( db_get_b(NULL, MODULENAME, SETTING_NOLOCKED, 0) ||
- !db_get_b(NULL, cs.szName, "LockMainStatus", 0 ))
+ if (db_get_b(NULL, MODULENAME, SETTING_NOLOCKED, 0) ||
+ !db_get_b(NULL, cs.szName, "LockMainStatus", 0))
AssignStatus(&cs, wParam, 0, cs.szMsg);
}
}
else {
- for (int i=0;i<connectionSettings.getCount();i++) {
+ for (int i = 0; i < connectionSettings.getCount(); i++) {
TConnectionSettings& cs = connectionSettings[i];
- if ( GetStatus(cs) != ID_STATUS_DISABLED && !strcmp(cs.szName, szProto))
+ if (GetStatus(cs) != ID_STATUS_DISABLED && !strcmp(cs.szName, szProto))
AssignStatus(&cs, wParam, 0, cs.szMsg);
}
}
@@ -299,13 +299,13 @@ static int CSStatusChange(WPARAM wParam, LPARAM)
// the status was changed by commonstatus (old)
if (wParam != 0) {
PROTOCOLSETTING** protoSettings = *(PROTOCOLSETTING***)wParam;
-
- if (protoSettings == NULL)
+
+ if (protoSettings == NULL)
return -1;
- for (int i=0;i<connectionSettings.getCount();i++) {
- for (int j=0;j<connectionSettings.getCount();j++) {
- if ( (protoSettings[i]->szName == NULL) || (connectionSettings[j].szName == NULL))
+ for (int i = 0; i < connectionSettings.getCount(); i++) {
+ for (int j = 0; j < connectionSettings.getCount(); j++) {
+ if ((protoSettings[i]->szName == NULL) || (connectionSettings[j].szName == NULL))
continue;
if (!strcmp(protoSettings[i]->szName, connectionSettings[j].szName))
@@ -323,13 +323,13 @@ static int CSStatusChangeEx(WPARAM wParam, LPARAM)
// the status was changed by commonstatus (new)
if (wParam != 0) {
PROTOCOLSETTINGEX** protoSettings = *(PROTOCOLSETTINGEX***)wParam;
-
+
if (protoSettings == NULL)
return -1;
- for (int i=0;i<connectionSettings.getCount();i++) {
- for (int j=0;j<connectionSettings.getCount();j++) {
- if ( (protoSettings[i]->szName == NULL) || (connectionSettings[j].szName == NULL))
+ for (int i = 0; i < connectionSettings.getCount(); i++) {
+ for (int j = 0; j < connectionSettings.getCount(); j++) {
+ if ((protoSettings[i]->szName == NULL) || (connectionSettings[j].szName == NULL))
continue;
if (!strcmp(protoSettings[i]->szName, connectionSettings[j].szName)) {
if (GetStatus(connectionSettings[j]) != ID_STATUS_DISABLED)
@@ -349,9 +349,9 @@ static int StartTimerFunction(int timer, int timeout, BOOL restart)
EnterCriticalSection(&GenTimerCS);
log_debugA("StartTimer: %d, %d, %d", timer, timeout, restart);
log_debugA("ack: %u, chk: %u, aft: %u, cnt: %u, con: %u", processAckTimerId, checkConnectionTimerId, afterCheckTimerId, checkContinTimerId, checkConnectingTimerId);
- if ( timer & IDT_PROCESSACK ) {
- res = (processAckTimerId == 0)?0:1;
- if ( ((processAckTimerId == 0) && (checkConnectionTimerId == 0)) || (restart)) {
+ if (timer & IDT_PROCESSACK) {
+ res = (processAckTimerId == 0) ? 0 : 1;
+ if (((processAckTimerId == 0) && (checkConnectionTimerId == 0)) || (restart)) {
if (timeout != -1) {
if (restart)
KillTimer(NULL, processAckTimerId);
@@ -363,9 +363,9 @@ static int StartTimerFunction(int timer, int timeout, BOOL restart)
}
}
- if ( timer & IDT_CHECKCONN ) {
- res = (checkConnectionTimerId == 0?0:1)||res;
- if ( (checkConnectionTimerId == 0) || (restart)) {
+ if (timer & IDT_CHECKCONN) {
+ res = (checkConnectionTimerId == 0 ? 0 : 1) || res;
+ if ((checkConnectionTimerId == 0) || (restart)) {
if (timeout != -1) {
if (restart)
KillTimer(NULL, checkConnectionTimerId);
@@ -377,28 +377,28 @@ static int StartTimerFunction(int timer, int timeout, BOOL restart)
}
}
- if ( timer & IDT_AFTERCHECK ) {
- res = (afterCheckTimerId==0?0:1)||res;
- if ( (afterCheckTimerId == 0) || (restart)) {
+ if (timer & IDT_AFTERCHECK) {
+ res = (afterCheckTimerId == 0 ? 0 : 1) || res;
+ if ((afterCheckTimerId == 0) || (restart)) {
if (timeout != -1) {
if (restart)
KillTimer(NULL, afterCheckTimerId);
if (timeout == 0)
- afterCheckTimerId = SetTimer(NULL, 0, initDelay/2, AfterCheckTimer);
+ afterCheckTimerId = SetTimer(NULL, 0, initDelay / 2, AfterCheckTimer);
else
afterCheckTimerId = SetTimer(NULL, 0, timeout, AfterCheckTimer);
}
}
}
- if ( timer & IDT_CHECKCONTIN ) {
- res = (checkContinTimerId==0?0:1)||res;
- if ( (checkContinTimerId == 0) || (restart)) {
+ if (timer & IDT_CHECKCONTIN) {
+ res = (checkContinTimerId == 0 ? 0 : 1) || res;
+ if ((checkContinTimerId == 0) || (restart)) {
if (timeout != -1) {
if (restart)
KillTimer(NULL, checkContinTimerId);
if (timeout == 0) {
- checkContinTimerId = SetTimer(NULL, 0, 1000*db_get_dw(NULL, MODULENAME, SETTING_CNTDELAY, CHECKCONTIN_DELAY), CheckContinueslyTimer);
+ checkContinTimerId = SetTimer(NULL, 0, 1000 * db_get_dw(NULL, MODULENAME, SETTING_CNTDELAY, CHECKCONTIN_DELAY), CheckContinueslyTimer);
}
else
checkContinTimerId = SetTimer(NULL, 0, timeout, CheckContinueslyTimer);
@@ -406,14 +406,14 @@ static int StartTimerFunction(int timer, int timeout, BOOL restart)
}
}
- if ( timer & IDT_CHECKCONNECTING ) {
- res = (checkConnectingTimerId==0?0:1)||res;
- if ( (checkConnectingTimerId == 0) || (restart)) {
+ if (timer & IDT_CHECKCONNECTING) {
+ res = (checkConnectingTimerId == 0 ? 0 : 1) || res;
+ if ((checkConnectingTimerId == 0) || (restart)) {
if (timeout != -1) {
if (restart)
KillTimer(NULL, checkConnectingTimerId);
if (timeout == 0) {
- timeout = initDelay/2;
+ timeout = initDelay / 2;
}
checkConnectingTimerId = SetTimer(NULL, 0, timeout, CheckConnectingTimer);
}
@@ -440,7 +440,7 @@ static int StartTimer(int timer, int timeout, BOOL restart)
if (GetCurrentThreadId() == mainThreadId)
return StartTimerFunction(timer, timeout, restart);
- TimerInfo *ti = ( TimerInfo* )calloc(1, sizeof(struct TimerInfo));
+ TimerInfo *ti = (TimerInfo*)calloc(1, sizeof(struct TimerInfo));
ti->timer = timer;
ti->timeout = timeout;
ti->restart = restart;
@@ -461,7 +461,7 @@ static int StopTimer(int timer)
log_debugA("StopTimer %d", timer);
log_debugA("ack: %u, chk: %u, aft: %u, cnt: %u, con: %u", processAckTimerId, checkConnectionTimerId, afterCheckTimerId, checkContinTimerId, checkConnectingTimerId);
- if ( timer & IDT_PROCESSACK ) {
+ if (timer & IDT_PROCESSACK) {
if (processAckTimerId == 0)
res = 0;
else {
@@ -471,9 +471,9 @@ static int StopTimer(int timer)
}
}
- if ( timer & IDT_CHECKCONN ) {
+ if (timer & IDT_CHECKCONN) {
if (checkConnectionTimerId == 0)
- res = 0||res;
+ res = 0 || res;
else {
KillTimer(NULL, checkConnectionTimerId);
checkConnectionTimerId = 0;
@@ -481,9 +481,9 @@ static int StopTimer(int timer)
}
}
- if ( timer & IDT_AFTERCHECK ) {
+ if (timer & IDT_AFTERCHECK) {
if (afterCheckTimerId == 0)
- res = 0||res;
+ res = 0 || res;
else {
KillTimer(NULL, afterCheckTimerId);
afterCheckTimerId = 0;
@@ -491,9 +491,9 @@ static int StopTimer(int timer)
}
}
- if ( timer & IDT_CHECKCONTIN ) {
+ if (timer & IDT_CHECKCONTIN) {
if (checkContinTimerId == 0)
- res = 0||res;
+ res = 0 || res;
else {
KillTimer(NULL, checkContinTimerId);
checkContinTimerId = 0;
@@ -501,9 +501,9 @@ static int StopTimer(int timer)
}
}
- if ( timer & IDT_CHECKCONNECTING ) {
+ if (timer & IDT_CHECKCONNECTING) {
if (checkConnectingTimerId == 0)
- res = 0||res;
+ res = 0 || res;
else {
KillTimer(NULL, checkConnectingTimerId);
checkConnectingTimerId = 0;
@@ -518,9 +518,9 @@ static int StopTimer(int timer)
return res;
}
-static int ProcessProtoAck(WPARAM,LPARAM lParam)
+static int ProcessProtoAck(WPARAM, LPARAM lParam)
{
- ACKDATA *ack=(ACKDATA*)lParam;
+ ACKDATA *ack = (ACKDATA*)lParam;
if (ack->type != ACKTYPE_STATUS && ack->type != ACKTYPE_LOGIN)
return 0;
@@ -542,7 +542,7 @@ static int ProcessProtoAck(WPARAM,LPARAM lParam)
if (ack->type == ACKTYPE_LOGIN) {
if (ack->lParam == LOGINERR_OTHERLOCATION) {
- for (int i=0; i < connectionSettings.getCount(); i++) {
+ for (int i = 0; i < connectionSettings.getCount(); i++) {
TConnectionSettings& cs = connectionSettings[i];
if (!strcmp(ack->szModule, cs.szName)) {
AssignStatus(&cs, ID_STATUS_OFFLINE, 0, NULL);
@@ -561,53 +561,54 @@ static int ProcessProtoAck(WPARAM,LPARAM lParam)
else if (ack->result == ACKRESULT_FAILED) {
// login failed
NotifyEventHooks(hConnectionEvent, (WPARAM)KS_CONN_STATE_LOGINERROR, (LPARAM)ack->szModule);
- switch ( db_get_b(NULL, MODULENAME, SETTING_LOGINERR, LOGINERR_NOTHING)) {
+ switch (db_get_b(NULL, MODULENAME, SETTING_LOGINERR, LOGINERR_NOTHING)) {
case LOGINERR_CANCEL:
- {
- log_infoA("KeepStatus: cancel on login error (%s)", ack->szModule);
- for (int i = 0; i < connectionSettings.getCount(); i++) {
- TConnectionSettings& cs = connectionSettings[i];
- if (!strcmp(ack->szModule, cs.szName))
- AssignStatus(&cs, ID_STATUS_OFFLINE, 0, NULL);
- }
- ProcessPopup(KS_CONN_STATE_LOGINERROR, (LPARAM)ack->szModule);
- StopChecking();
+ {
+ log_infoA("KeepStatus: cancel on login error (%s)", ack->szModule);
+ for (int i = 0; i < connectionSettings.getCount(); i++) {
+ TConnectionSettings& cs = connectionSettings[i];
+ if (!strcmp(ack->szModule, cs.szName))
+ AssignStatus(&cs, ID_STATUS_OFFLINE, 0, NULL);
}
- break;
+ ProcessPopup(KS_CONN_STATE_LOGINERROR, (LPARAM)ack->szModule);
+ StopChecking();
+ }
+ break;
case LOGINERR_SETDELAY:
- {
- int newDelay = newDelay = 1000*db_get_dw(NULL, MODULENAME, SETTING_LOGINERR_DELAY, DEFAULT_MAXDELAY);
- log_infoA("KeepStatus: set delay to %d on login error (%s)", newDelay/1000, ack->szModule);
- StartTimer(IDT_CHECKCONN, newDelay, TRUE);
- }
- ProcessPopup(KS_CONN_STATE_LOGINERROR, (LPARAM)ack->szModule);
- break;
+ {
+ int newDelay = newDelay = 1000 * db_get_dw(NULL, MODULENAME, SETTING_LOGINERR_DELAY, DEFAULT_MAXDELAY);
+ log_infoA("KeepStatus: set delay to %d on login error (%s)", newDelay / 1000, ack->szModule);
+ StartTimer(IDT_CHECKCONN, newDelay, TRUE);
+ }
+ ProcessPopup(KS_CONN_STATE_LOGINERROR, (LPARAM)ack->szModule);
+ break;
default:
case LOGINERR_NOTHING:
StartTimer(IDT_PROCESSACK, 0, FALSE);
break;
- } } }
+ }
+ }
+ }
return 0;
}
-static VOID CALLBACK CheckConnectingTimer(HWND hwnd,UINT message,UINT_PTR idEvent,DWORD dwTime)
+static VOID CALLBACK CheckConnectingTimer(HWND, UINT, UINT_PTR, DWORD)
{
int maxConnectingTime;
StopTimer(IDT_CHECKCONNECTING);
//log_debugA("KeepStatus: CheckConnectingTimer");
- for (int i=0; i < connectionSettings.getCount(); i++) {
+ for (int i = 0; i < connectionSettings.getCount(); i++) {
TConnectionSettings& cs = connectionSettings[i];
int curStatus = GetStatus(cs);
- int newStatus = CallProtoService(cs.szName,PS_GETSTATUS, 0, 0);
if (curStatus < MAX_CONNECT_RETRIES) { // connecting
maxConnectingTime = db_get_dw(NULL, MODULENAME, SETTING_MAXCONNECTINGTIME, 0);
if (maxConnectingTime > 0) {
- if ( (unsigned int)maxConnectingTime <= ((GetTickCount() - cs.lastStatusAckTime)/1000)) {
+ if ((unsigned int)maxConnectingTime <= ((GetTickCount() - cs.lastStatusAckTime) / 1000)) {
// set offline
log_infoA("KeepStatus: %s is too long connecting; setting offline", cs.szName);
CallProtoService(cs.szName, PS_SETSTATUS, (WPARAM)ID_STATUS_OFFLINE, 0);
@@ -617,25 +618,25 @@ static VOID CALLBACK CheckConnectingTimer(HWND hwnd,UINT message,UINT_PTR idEven
}
}
-static VOID CALLBACK CheckAckStatusTimer(HWND hwnd,UINT message,UINT_PTR idEvent,DWORD dwTime)
+static VOID CALLBACK CheckAckStatusTimer(HWND, UINT, UINT_PTR, DWORD)
{
int maxConnectingTime;
bool needChecking = false;
StopTimer(IDT_PROCESSACK);
- for (int i=0; i < connectionSettings.getCount(); i++) {
+ for (int i = 0; i < connectionSettings.getCount(); i++) {
TConnectionSettings& cs = connectionSettings[i];
int curStatus = GetStatus(cs);
- int newStatus = CallProtoService(cs.szName,PS_GETSTATUS, 0, 0);
+ int newStatus = CallProtoService(cs.szName, PS_GETSTATUS, 0, 0);
// ok, np
- if ( curStatus == ID_STATUS_CURRENT || curStatus == ID_STATUS_DISABLED || curStatus == newStatus || newStatus > MAX_STATUS )
+ if (curStatus == ID_STATUS_CURRENT || curStatus == ID_STATUS_DISABLED || curStatus == newStatus || newStatus > MAX_STATUS)
continue;
if (newStatus < MAX_CONNECT_RETRIES) { // connecting
maxConnectingTime = db_get_dw(NULL, MODULENAME, SETTING_MAXCONNECTINGTIME, 0);
if (maxConnectingTime > 0)
- StartTimer(IDT_CHECKCONNECTING, (maxConnectingTime*1000 - (GetTickCount() - cs.lastStatusAckTime)), FALSE);
+ StartTimer(IDT_CHECKCONNECTING, (maxConnectingTime * 1000 - (GetTickCount() - cs.lastStatusAckTime)), FALSE);
}
// keepstatus' administration was wrong!
else if (newStatus != ID_STATUS_OFFLINE)
@@ -656,7 +657,7 @@ static VOID CALLBACK CheckAckStatusTimer(HWND hwnd,UINT message,UINT_PTR idEvent
StartTimer(IDT_CHECKCONN, initDelay, FALSE);
}
-static VOID CALLBACK CheckConnectionTimer(HWND hwnd,UINT message,UINT_PTR idEvent,DWORD dwTime)
+static VOID CALLBACK CheckConnectionTimer(HWND, UINT, UINT_PTR, DWORD)
{
int shouldBeStatus, realStatus;
HICON hIcon;
@@ -666,7 +667,7 @@ static VOID CALLBACK CheckConnectionTimer(HWND hwnd,UINT message,UINT_PTR idEven
if (showConnectionPopups)
hIcon = LoadSkinnedIcon(SKINICON_STATUS_OFFLINE);
- for (int i=0; i < connectionSettings.getCount() && !setStatus; i++ ) {
+ for (int i = 0; i < connectionSettings.getCount() && !setStatus; i++) {
TConnectionSettings& cs = connectionSettings[i];
realStatus = CallProtoService(cs.szName, PS_GETSTATUS, 0, 0);
shouldBeStatus = GetStatus(cs);
@@ -674,7 +675,7 @@ static VOID CALLBACK CheckConnectionTimer(HWND hwnd,UINT message,UINT_PTR idEven
shouldBeStatus = cs.lastStatus;
if (shouldBeStatus == ID_STATUS_DISABLED)
continue;
- if ( (shouldBeStatus != realStatus) && (realStatus == ID_STATUS_OFFLINE) || (realStatus < MIN_STATUS)) {
+ if ((shouldBeStatus != realStatus) && (realStatus == ID_STATUS_OFFLINE) || (realStatus < MIN_STATUS)) {
setStatus = true;
if (showConnectionPopups)
hIcon = LoadSkinnedProtoIcon(cs.szName, ID_STATUS_OFFLINE);
@@ -682,22 +683,22 @@ static VOID CALLBACK CheckConnectionTimer(HWND hwnd,UINT message,UINT_PTR idEven
}
// one of the status was wrong
- if ( setStatus && ( maxRetries == -1 || retryCount < maxRetries )) {
+ if (setStatus && (maxRetries == -1 || retryCount < maxRetries)) {
if (increaseExponential)
- currentDelay = min(2*currentDelay,maxDelay);
+ currentDelay = min(2 * currentDelay, maxDelay);
- if ( (( db_get_b(NULL, MODULENAME, SETTING_CHKINET, 0)) && (!InternetGetConnectedState(NULL, 0))) || (( db_get_b(NULL, MODULENAME, SETTING_BYPING, FALSE)) && (!bLastPingResult))) {
+ if (((db_get_b(NULL, MODULENAME, SETTING_CHKINET, 0)) && (!InternetGetConnectedState(NULL, 0))) || ((db_get_b(NULL, MODULENAME, SETTING_BYPING, FALSE)) && (!bLastPingResult))) {
// no network
- NotifyEventHooks(hConnectionEvent, (WPARAM)KS_CONN_STATE_RETRYNOCONN, (LPARAM)retryCount+1);
+ NotifyEventHooks(hConnectionEvent, (WPARAM)KS_CONN_STATE_RETRYNOCONN, (LPARAM)retryCount + 1);
ProcessPopup(KS_CONN_STATE_RETRYNOCONN, 0);
}
else {
- NotifyEventHooks(hConnectionEvent, (WPARAM)KS_CONN_STATE_RETRY, (LPARAM)retryCount+1);
+ NotifyEventHooks(hConnectionEvent, (WPARAM)KS_CONN_STATE_RETRY, (LPARAM)retryCount + 1);
/* set the status */
SetCurrentStatus();
}
retryCount += 1;
- StartTimer(IDT_AFTERCHECK, min(currentDelay, AFTERCHECK_DELAY)/2, FALSE);
+ StartTimer(IDT_AFTERCHECK, min(currentDelay, AFTERCHECK_DELAY) / 2, FALSE);
StartTimer(IDT_CHECKCONN, currentDelay, TRUE); // restart this timer
}
else // all status set ok already, or stop checking
@@ -708,14 +709,14 @@ static VOID CALLBACK CheckConnectionTimer(HWND hwnd,UINT message,UINT_PTR idEven
static int StopChecking()
{
- StopTimer(IDT_CHECKCONN|IDT_PROCESSACK|IDT_AFTERCHECK|IDT_CHECKCONNECTING);
+ StopTimer(IDT_CHECKCONN | IDT_PROCESSACK | IDT_AFTERCHECK | IDT_CHECKCONNECTING);
BOOL isOk = TRUE;
- for ( int i=0; i < connectionSettings.getCount() && isOk; i++ ) {
+ for (int i = 0; i < connectionSettings.getCount() && isOk; i++) {
TConnectionSettings& cs = connectionSettings[i];
int curStatus = GetStatus(cs);
int newStatus = CallProtoService(cs.szName, PS_GETSTATUS, 0, 0);
- if ( newStatus != curStatus && curStatus != ID_STATUS_DISABLED ) {
+ if (newStatus != curStatus && curStatus != ID_STATUS_DISABLED) {
AssignStatus(&cs, newStatus, 0, NULL);
isOk = FALSE;
}
@@ -723,21 +724,21 @@ 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_infoA("KeepStatus: stop checking (%s)", isOk ? "success" : "failure");
retryCount = 0;
currentDelay = initDelay;
return 0;
}
-static VOID CALLBACK AfterCheckTimer(HWND hwnd,UINT message,UINT_PTR idEvent,DWORD dwTime)
+static VOID CALLBACK AfterCheckTimer(HWND, UINT, UINT_PTR, DWORD)
{
// after each connection check, this function is called to see if connection was recovered
StopTimer(IDT_AFTERCHECK);
bool setStatus = false;
- for (int i=0; i < connectionSettings.getCount(); i++) {
+ for (int i = 0; i < connectionSettings.getCount(); i++) {
TConnectionSettings& cs = connectionSettings[i];
int realStatus = CallProtoService(cs.szName, PS_GETSTATUS, 0, 0);
int shouldBeStatus = GetStatus(cs);
@@ -745,7 +746,7 @@ static VOID CALLBACK AfterCheckTimer(HWND hwnd,UINT message,UINT_PTR idEvent,DWO
shouldBeStatus = cs.lastStatus;
if (shouldBeStatus == ID_STATUS_DISABLED) // (on ignoring proto)
continue;
- if ( (shouldBeStatus != realStatus) && (realStatus == ID_STATUS_OFFLINE) || (realStatus < MIN_STATUS))
+ if ((shouldBeStatus != realStatus) && (realStatus == ID_STATUS_OFFLINE) || (realStatus < MIN_STATUS))
setStatus = true;
}
@@ -753,7 +754,7 @@ static VOID CALLBACK AfterCheckTimer(HWND hwnd,UINT message,UINT_PTR idEvent,DWO
StopChecking();
}
-static void CheckContinueslyFunction(void *arg)
+static void CheckContinueslyFunction(void *)
{
static int pingFailures = 0;
@@ -762,7 +763,7 @@ static void CheckContinueslyFunction(void *arg)
// do a ping, even if reconnecting
bool doPing = false;
- for ( int i=0; i < connectionSettings.getCount(); i++ ) {
+ for (int i = 0; i < connectionSettings.getCount(); i++) {
TConnectionSettings& cs = connectionSettings[i];
int shouldBeStatus = GetStatus(cs);
if (shouldBeStatus == ID_STATUS_LAST)
@@ -793,7 +794,7 @@ static void CheckContinueslyFunction(void *arg)
char host[MAX_PATH];
DWORD *addr;
struct hostent *hostent;
- char reply[sizeof(ICMP_ECHO_REPLY)+8];
+ char reply[sizeof(ICMP_ECHO_REPLY) + 8];
bLastPingResult = FALSE;
HANDLE hICMPFile = (HANDLE)IcmpCreateFile();
@@ -803,16 +804,16 @@ static void CheckContinueslyFunction(void *arg)
}
if (bLastPingResult == FALSE) {
start = dbv.pszVal;
- while ( (*start != '\0') && (!bLastPingResult)) {
+ while ((*start != '\0') && (!bLastPingResult)) {
end = start;
- while ( (*end != ' ') && (*end != '\0'))
+ while ((*end != ' ') && (*end != '\0'))
end++;
memset(host, '\0', sizeof(host));
- strncpy(host, start, end-start);
+ strncpy(host, start, end - start);
hostent = gethostbyname(host);
if (hostent != NULL) {
- addr = (DWORD *)( *hostent->h_addr_list );
- bLastPingResult = (IcmpSendEcho(hICMPFile, *addr, 0,0,NULL, reply,sizeof(ICMP_ECHO_REPLY)+8,5000) != 0);
+ addr = (DWORD *)(*hostent->h_addr_list);
+ bLastPingResult = (IcmpSendEcho(hICMPFile, *addr, 0, 0, NULL, reply, sizeof(ICMP_ECHO_REPLY) + 8, 5000) != 0);
if (bLastPingResult)
pingFailures = 0;
@@ -838,15 +839,15 @@ static void CheckContinueslyFunction(void *arg)
return; // already connecting, leave
}
- if ( ((!ping) && (!InternetGetConnectedState(NULL, 0))) || ( (ping) && (!bLastPingResult) && (pingFailures >= db_get_w(NULL, MODULENAME, SETTING_PINGCOUNT, DEFAULT_PINGCOUNT)))) {
+ if (((!ping) && (!InternetGetConnectedState(NULL, 0))) || ((ping) && (!bLastPingResult) && (pingFailures >= db_get_w(NULL, MODULENAME, SETTING_PINGCOUNT, DEFAULT_PINGCOUNT)))) {
pingFailures = 0;
int count;
PROTOACCOUNT** protos;
- ProtoEnumAccounts( &count, &protos );
+ ProtoEnumAccounts(&count, &protos);
- for(int i=0; i < count; i++ ) {
- if ( !IsSuitableProto( protos[i] ))
+ for (int i = 0; i < count; i++) {
+ if (!IsSuitableProto(protos[i]))
continue;
if (CallProtoService(protos[i]->szModuleName, PS_GETSTATUS, 0, 0) < MAX_CONNECT_RETRIES) {
@@ -858,7 +859,7 @@ static void CheckContinueslyFunction(void *arg)
CallProtoService(protos[i]->szModuleName, PS_SETSTATUS, (WPARAM)ID_STATUS_OFFLINE, 0);
}
}
- if (StartTimer(IDT_CHECKCONN|IDT_PROCESSACK, -1, FALSE)) {// are our 'set offlines' noticed?
+ if (StartTimer(IDT_CHECKCONN | IDT_PROCESSACK, -1, FALSE)) {// are our 'set offlines' noticed?
log_debugA("CheckContinueslyFunction: currently checking");
LeaveCriticalSection(&CheckContinueslyCS);
return;
@@ -874,9 +875,9 @@ static void CheckContinueslyFunction(void *arg)
LeaveCriticalSection(&CheckContinueslyCS);
}
-static VOID CALLBACK CheckContinueslyTimer(HWND hwnd, UINT message, UINT_PTR idEvent, DWORD dwTime)
+static VOID CALLBACK CheckContinueslyTimer(HWND, UINT, UINT_PTR, DWORD)
{
- if ( db_get_b(NULL, MODULENAME, SETTING_BYPING, FALSE))
+ if (db_get_b(NULL, MODULENAME, SETTING_BYPING, FALSE))
mir_forkthread(CheckContinueslyFunction, NULL);
else
CheckContinueslyFunction(NULL);
@@ -894,10 +895,10 @@ static int ProcessPopup(int reason, LPARAM lParam)
HICON hIcon = NULL;
TCHAR text[MAX_SECONDLINE];
- if ( !db_get_b(NULL, MODULENAME, SETTING_SHOWCONNECTIONPOPUPS,FALSE) || !ServiceExists(MS_POPUP_ADDPOPUPT))
+ if (!db_get_b(NULL, MODULENAME, SETTING_SHOWCONNECTIONPOPUPS, FALSE) || !ServiceExists(MS_POPUP_ADDPOPUPT))
return -1;
- switch(reason) {
+ switch (reason) {
case KS_CONN_STATE_OTHERLOCATION: // lParam = 1 proto
if (!db_get_b(NULL, MODULENAME, SETTING_PUOTHER, TRUE))
return -1;
@@ -911,10 +912,10 @@ static int ProcessPopup(int reason, LPARAM lParam)
return -1;
hIcon = LoadSkinnedProtoIcon((char*)lParam, SKINICON_STATUS_OFFLINE);
- if ( db_get_b(NULL, MODULENAME, SETTING_LOGINERR, LOGINERR_NOTHING) == LOGINERR_CANCEL)
+ 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 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;
@@ -925,9 +926,9 @@ 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)"), GetHumanName(lParam), 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);
+ else mir_sntprintf(text, SIZEOF(text), TranslateT("Status error (next retry (%d) in %d s)"), retryCount + 1, currentDelay / 1000);
break;
case KS_CONN_STATE_RETRY: // lParam = PROTOCOLSETTINGEX**
@@ -941,9 +942,9 @@ static int ProcessPopup(int reason, LPARAM lParam)
_tcscpy(protoInfo, _T("\r\n"));
for (int i = 0; i < connectionSettings.getCount(); i++) {
if (_tcslen(ps[i]->tszAccName) > 0 && strlen(ps[i]->szName) > 0) {
- if ( db_get_b(NULL, MODULENAME, SETTING_PUSHOWEXTRA, TRUE)) {
+ if (db_get_b(NULL, MODULENAME, SETTING_PUSHOWEXTRA, TRUE)) {
mir_sntprintf(protoInfoLine, SIZEOF(protoInfoLine), TranslateT("%s\t(will be set to %s)\r\n"), ps[i]->tszAccName, pcli->pfnGetStatusModeDescription(ps[i]->status, GSMDF_TCHAR));
- _tcsncat(protoInfo, protoInfoLine, SIZEOF(protoInfo) - _tcslen(protoInfo)-1);
+ _tcsncat(protoInfo, protoInfoLine, SIZEOF(protoInfo) - _tcslen(protoInfo) - 1);
}
}
}
@@ -961,7 +962,7 @@ static int ProcessPopup(int reason, LPARAM lParam)
if (!db_get_b(NULL, MODULENAME, SETTING_PUOTHER, TRUE))
return -1;
- if (retryCount == maxRetries-1)
+ if (retryCount == maxRetries - 1)
mir_sntprintf(text, SIZEOF(text), TranslateT("No internet connection seems available... (last try (%d))"), retryCount + 1);
else
mir_sntprintf(text, SIZEOF(text), TranslateT("No internet connection seems available... (next retry (%d) in %d s)"), retryCount + 2, currentDelay / 1000);
@@ -1046,7 +1047,7 @@ LRESULT CALLBACK PopupDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa
}
// =============== services ===================
-INT_PTR StopReconnectingService(WPARAM wParam, LPARAM lParam)
+INT_PTR StopReconnectingService(WPARAM, LPARAM)
{
int ret = StartTimer(IDT_CHECKCONN | IDT_AFTERCHECK, -1, FALSE);
StopChecking();
@@ -1081,9 +1082,8 @@ INT_PTR EnableProtocolService(WPARAM wParam, LPARAM lParam)
return ret;
}
-INT_PTR IsProtocolEnabledService(WPARAM wParam, LPARAM lParam)
+INT_PTR IsProtocolEnabledService(WPARAM, LPARAM lParam)
{
- int ret = -2;
char *szProto = (char *)lParam;
char dbSetting[128];
@@ -1100,14 +1100,14 @@ INT_PTR IsProtocolEnabledService(WPARAM wParam, LPARAM lParam)
return FALSE;
}
-INT_PTR AnnounceStatusChangeService(WPARAM 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->status, newSituation->szName==NULL?"all":newSituation->szName);
+ log_infoA("Another plugin announced a status change to %d for %s", newSituation->status, newSituation->szName == NULL ? "all" : newSituation->szName);
- for ( int i=0; i < connectionSettings.getCount(); i++ ) {
+ for (int i = 0; i < connectionSettings.getCount(); i++) {
TConnectionSettings& cs = connectionSettings[i];
- if ( !mir_strcmp( cs.szName, newSituation->szName ))
+ if (!mir_strcmp(cs.szName, newSituation->szName))
AssignStatus(&cs, newSituation->status, newSituation->lastStatus, newSituation->szMsg);
}
@@ -1116,7 +1116,7 @@ INT_PTR AnnounceStatusChangeService(WPARAM wParam, LPARAM lParam)
// =============== window for suspend ===============
-static DWORD CALLBACK MessageWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
+static DWORD CALLBACK MessageWndProc(HWND, UINT msg, WPARAM wParam, LPARAM lParam)
{
static PROTOCOLSETTINGEX** ps = NULL;
diff --git a/plugins/StatusPlugins/KeepStatus/keepstatus.h b/plugins/StatusPlugins/KeepStatus/keepstatus.h
index d52b7b218f..bf9f3e48f8 100644
--- a/plugins/StatusPlugins/KeepStatus/keepstatus.h
+++ b/plugins/StatusPlugins/KeepStatus/keepstatus.h
@@ -1,21 +1,21 @@
/*
- KeepStatus Plugin for Miranda-IM (www.miranda-im.org)
- Copyright 2003-2006 P. Boon
+ KeepStatus Plugin for Miranda-IM (www.miranda-im.org)
+ Copyright 2003-2006 P. Boon
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-*/
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
#ifndef __KEEPSTATUS_HEADER
#define __KEEPSTATUS_HEADER
@@ -105,7 +105,7 @@
struct TConnectionSettings : public PROTOCOLSETTINGEX
{
- TConnectionSettings( PROTOACCOUNT *pa );
+ TConnectionSettings(PROTOACCOUNT *pa);
~TConnectionSettings();
int lastStatusAckTime; // the time the last status ack was received
diff --git a/plugins/StatusPlugins/KeepStatus/main.cpp b/plugins/StatusPlugins/KeepStatus/main.cpp
index 1baa85e758..c382d17c45 100644
--- a/plugins/StatusPlugins/KeepStatus/main.cpp
+++ b/plugins/StatusPlugins/KeepStatus/main.cpp
@@ -1,21 +1,21 @@
/*
- KeepStatus Plugin for Miranda-IM (www.miranda-im.org)
- Copyright 2003-2006 P. Boon
+ KeepStatus Plugin for Miranda-IM (www.miranda-im.org)
+ Copyright 2003-2006 P. Boon
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-*/
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
#include "../commonstatus.h"
#include "keepstatus.h"
@@ -36,9 +36,9 @@ CLIST_INTERFACE *pcli;
/////////////////////////////////////////////////////////////////////////////////////////
// dll entry point
-BOOL WINAPI DllMain(HINSTANCE hinstDLL,DWORD fdwReason,LPVOID lpvReserved)
+BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID)
{
- hInst=hinstDLL;
+ hInst = hinstDLL;
return TRUE;
}
@@ -46,7 +46,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL,DWORD fdwReason,LPVOID lpvReserved)
// returns plugin's extended information
-PLUGININFOEX pluginInfoEx={
+PLUGININFOEX pluginInfoEx = {
sizeof(PLUGININFOEX),
__PLUGIN_NAME,
PLUGIN_MAKE_VERSION(__MAJOR_VERSION, __MINOR_VERSION, __RELEASE_NUM, __BUILD_NUM),
@@ -59,7 +59,7 @@ PLUGININFOEX pluginInfoEx={
{ 0xa5bb1b7a, 0xb7cd, 0x4cbb, { 0xa7, 0xdb, 0xce, 0xb4, 0xeb, 0x71, 0xda, 0x49 } } // {A5BB1B7A-B7CD-4cbb-A7DB-CEB4EB71DA49}
};
-extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD mirandaVersion)
+extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
{
return &pluginInfoEx;
}
@@ -67,7 +67,7 @@ extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD miranda
/////////////////////////////////////////////////////////////////////////////////////////
// plugin's entry point
-int CSModuleLoaded(WPARAM wParam,LPARAM lParam);
+int CSModuleLoaded(WPARAM wParam, LPARAM lParam);
INT_PTR StopReconnectingService(WPARAM wParam, LPARAM lParam);
INT_PTR EnableProtocolService(WPARAM wParam, LPARAM lParam);
@@ -76,7 +76,7 @@ INT_PTR AnnounceStatusChangeService(WPARAM wParam, LPARAM lParam);
extern "C" int __declspec(dllexport) Load(void)
{
- mir_getLP( &pluginInfoEx );
+ mir_getLP(&pluginInfoEx);
mir_getCLI();
InitCommonStatus();
diff --git a/plugins/StatusPlugins/KeepStatus/options.cpp b/plugins/StatusPlugins/KeepStatus/options.cpp
index c8dede9f74..4b97f46b87 100644
--- a/plugins/StatusPlugins/KeepStatus/options.cpp
+++ b/plugins/StatusPlugins/KeepStatus/options.cpp
@@ -1,32 +1,32 @@
/*
- KeepStatus Plugin for Miranda-IM (www.miranda-im.org)
- Copyright 2003-2006 P. Boon
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-*/
+ KeepStatus Plugin for Miranda-IM (www.miranda-im.org)
+ Copyright 2003-2006 P. Boon
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
#include "../commonstatus.h"
#include "keepstatus.h"
#include "../resource.h"
// prototypes
-INT_PTR CALLBACK OptDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM lParam);
-INT_PTR CALLBACK PopupOptDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM lParam);
+INT_PTR CALLBACK OptDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
+INT_PTR CALLBACK PopupOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
-static INT_PTR CALLBACK DlgProcKSBasicOpts(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM lParam)
+static INT_PTR CALLBACK DlgProcKSBasicOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
- switch(msg) {
+ switch (msg) {
case WM_INITDIALOG:
TranslateDialogDefault(hwndDlg);
{
@@ -35,40 +35,40 @@ static INT_PTR CALLBACK DlgProcKSBasicOpts(HWND hwndDlg,UINT msg,WPARAM wParam,L
int i;
DBVARIANT dbv;
- SetDlgItemInt(hwndDlg, IDC_MAXRETRIES, db_get_b(NULL,MODULENAME,SETTING_MAXRETRIES,DEFAULT_MAXRETRIES),FALSE);
- SetDlgItemInt(hwndDlg, IDC_INITDELAY, db_get_dw(NULL,MODULENAME,SETTING_INITDELAY,DEFAULT_INITDELAY),FALSE);
- CheckDlgButton(hwndDlg, IDC_CHECKCONNECTION, db_get_b(NULL, MODULENAME, SETTING_CHECKCONNECTION,FALSE) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_SHOWCONNECTIONPOPUPS, ( db_get_b(NULL, MODULENAME, SETTING_SHOWCONNECTIONPOPUPS,FALSE)&&ServiceExists(MS_POPUP_SHOWMESSAGE)) ? BST_CHECKED : BST_UNCHECKED);
+ SetDlgItemInt(hwndDlg, IDC_MAXRETRIES, db_get_b(NULL, MODULENAME, SETTING_MAXRETRIES, DEFAULT_MAXRETRIES), FALSE);
+ SetDlgItemInt(hwndDlg, IDC_INITDELAY, db_get_dw(NULL, MODULENAME, SETTING_INITDELAY, DEFAULT_INITDELAY), FALSE);
+ CheckDlgButton(hwndDlg, IDC_CHECKCONNECTION, db_get_b(NULL, MODULENAME, SETTING_CHECKCONNECTION, FALSE) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_SHOWCONNECTIONPOPUPS, (db_get_b(NULL, MODULENAME, SETTING_SHOWCONNECTIONPOPUPS, FALSE) && ServiceExists(MS_POPUP_SHOWMESSAGE)) ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_CHKINET, db_get_b(NULL, MODULENAME, SETTING_CHKINET, FALSE) ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_CONTCHECK, db_get_b(NULL, MODULENAME, SETTING_CONTCHECK, FALSE) ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_BYPING, db_get_b(NULL, MODULENAME, SETTING_BYPING, FALSE) ? BST_CHECKED : BST_UNCHECKED);
if (!db_get(NULL, MODULENAME, SETTING_PINGHOST, &dbv))
SetDlgItemTextA(hwndDlg, IDC_PINGHOST, dbv.pszVal);
// proto list
- HWND hList = GetDlgItem(hwndDlg,IDC_PROTOCOLLIST);
- ListView_SetExtendedListViewStyleEx(hList, LVS_EX_FULLROWSELECT|LVS_EX_CHECKBOXES, LVS_EX_FULLROWSELECT|LVS_EX_CHECKBOXES);
- memset(&lvCol,0,sizeof(lvCol));
- lvCol.mask = LVCF_WIDTH|LVCF_TEXT;
- lvCol.pszText=TranslateT("Protocol");
+ HWND hList = GetDlgItem(hwndDlg, IDC_PROTOCOLLIST);
+ ListView_SetExtendedListViewStyleEx(hList, LVS_EX_FULLROWSELECT | LVS_EX_CHECKBOXES, LVS_EX_FULLROWSELECT | LVS_EX_CHECKBOXES);
+ memset(&lvCol, 0, sizeof(lvCol));
+ lvCol.mask = LVCF_WIDTH | LVCF_TEXT;
+ lvCol.pszText = TranslateT("Protocol");
lvCol.cx = 118;
ListView_InsertColumn(hList, 0, &lvCol);
// fill the list
- memset(&lvItem,0,sizeof(lvItem));
- lvItem.mask=LVIF_TEXT|LVIF_PARAM;
- lvItem.iItem=0;
- lvItem.iSubItem=0;
+ memset(&lvItem, 0, sizeof(lvItem));
+ lvItem.mask = LVIF_TEXT | LVIF_PARAM;
+ lvItem.iItem = 0;
+ lvItem.iSubItem = 0;
int count;
PROTOACCOUNT** protos;
- ProtoEnumAccounts( &count, &protos );
+ ProtoEnumAccounts(&count, &protos);
- for(i=0;i<count;i++) {
- if ( !IsSuitableProto( protos[i] ))
+ for (i = 0; i < count; i++) {
+ if (!IsSuitableProto(protos[i]))
continue;
lvItem.pszText = protos[i]->tszAccountName;
lvItem.lParam = (LPARAM)protos[i]->szModuleName;
- ListView_InsertItem(hList,&lvItem);
+ ListView_InsertItem(hList, &lvItem);
char dbSetting[128];
mir_snprintf(dbSetting, SIZEOF(dbSetting), "%s_enabled", protos[i]->szModuleName);
@@ -76,46 +76,46 @@ static INT_PTR CALLBACK DlgProcKSBasicOpts(HWND hwndDlg,UINT msg,WPARAM wParam,L
lvItem.iItem++;
}
EnableWindow(GetDlgItem(hwndDlg, IDC_MAXRETRIES), IsDlgButtonChecked(hwndDlg, IDC_CHECKCONNECTION));
- EnableWindow(GetDlgItem(hwndDlg, IDC_SHOWCONNECTIONPOPUPS), ServiceExists(MS_POPUP_SHOWMESSAGE)&&IsDlgButtonChecked(hwndDlg, IDC_CHECKCONNECTION));
+ EnableWindow(GetDlgItem(hwndDlg, IDC_SHOWCONNECTIONPOPUPS), ServiceExists(MS_POPUP_SHOWMESSAGE) && IsDlgButtonChecked(hwndDlg, IDC_CHECKCONNECTION));
EnableWindow(GetDlgItem(hwndDlg, IDC_INITDELAY), IsDlgButtonChecked(hwndDlg, IDC_CHECKCONNECTION));
EnableWindow(GetDlgItem(hwndDlg, IDC_PROTOCOLLIST), IsDlgButtonChecked(hwndDlg, IDC_CHECKCONNECTION));
EnableWindow(GetDlgItem(hwndDlg, IDC_CHKINET), IsDlgButtonChecked(hwndDlg, IDC_CHECKCONNECTION));
EnableWindow(GetDlgItem(hwndDlg, IDC_CONTCHECK), IsDlgButtonChecked(hwndDlg, IDC_CHECKCONNECTION));
- EnableWindow(GetDlgItem(hwndDlg, IDC_BYPING), (IsDlgButtonChecked(hwndDlg, IDC_CONTCHECK)&&IsDlgButtonChecked(hwndDlg, IDC_CHECKCONNECTION))?TRUE:FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_PINGHOST), (IsDlgButtonChecked(hwndDlg, IDC_CONTCHECK))&&(IsDlgButtonChecked(hwndDlg, IDC_BYPING)&&IsDlgButtonChecked(hwndDlg, IDC_CHECKCONNECTION))?TRUE:FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_BYPING), (IsDlgButtonChecked(hwndDlg, IDC_CONTCHECK) && IsDlgButtonChecked(hwndDlg, IDC_CHECKCONNECTION)) ? TRUE : FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_PINGHOST), (IsDlgButtonChecked(hwndDlg, IDC_CONTCHECK)) && (IsDlgButtonChecked(hwndDlg, IDC_BYPING) && IsDlgButtonChecked(hwndDlg, IDC_CHECKCONNECTION)) ? TRUE : FALSE);
}
break;
case WM_COMMAND:
- if ( ((HIWORD(wParam) == EN_CHANGE) || (HIWORD(wParam) == BN_CLICKED)) && ((HWND)lParam == GetFocus()))
- SendMessage(GetParent(hwndDlg),PSM_CHANGED,0,0);
+ if (((HIWORD(wParam) == EN_CHANGE) || (HIWORD(wParam) == BN_CLICKED)) && ((HWND)lParam == GetFocus()))
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
// something changed
switch (LOWORD(wParam)) {
case IDC_CHECKCONNECTION:
case IDC_CONTCHECK:
case IDC_BYPING:
EnableWindow(GetDlgItem(hwndDlg, IDC_MAXRETRIES), SendMessage(GetParent(hwndDlg), KS_ISENABLED, (WPARAM)IDC_CHECKCONNECTION, 0));
- EnableWindow(GetDlgItem(hwndDlg, IDC_SHOWCONNECTIONPOPUPS), ServiceExists(MS_POPUP_SHOWMESSAGE)&&SendMessage(GetParent(hwndDlg), KS_ISENABLED, (WPARAM)IDC_CHECKCONNECTION, 0));
+ EnableWindow(GetDlgItem(hwndDlg, IDC_SHOWCONNECTIONPOPUPS), ServiceExists(MS_POPUP_SHOWMESSAGE) && SendMessage(GetParent(hwndDlg), KS_ISENABLED, (WPARAM)IDC_CHECKCONNECTION, 0));
EnableWindow(GetDlgItem(hwndDlg, IDC_INITDELAY), SendMessage(GetParent(hwndDlg), KS_ISENABLED, (WPARAM)IDC_CHECKCONNECTION, 0));
EnableWindow(GetDlgItem(hwndDlg, IDC_PROTOCOLLIST), SendMessage(GetParent(hwndDlg), KS_ISENABLED, (WPARAM)IDC_CHECKCONNECTION, 0));
EnableWindow(GetDlgItem(hwndDlg, IDC_CHKINET), SendMessage(GetParent(hwndDlg), KS_ISENABLED, (WPARAM)IDC_CHECKCONNECTION, 0));
EnableWindow(GetDlgItem(hwndDlg, IDC_CONTCHECK), SendMessage(GetParent(hwndDlg), KS_ISENABLED, (WPARAM)IDC_CHECKCONNECTION, 0));
- EnableWindow(GetDlgItem(hwndDlg, IDC_BYPING), (IsDlgButtonChecked(hwndDlg, IDC_CONTCHECK)&&SendMessage(GetParent(hwndDlg), KS_ISENABLED, (WPARAM)IDC_CHECKCONNECTION, 0))?TRUE:FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_PINGHOST), (IsDlgButtonChecked(hwndDlg, IDC_CONTCHECK))&&(IsDlgButtonChecked(hwndDlg, IDC_BYPING)&&SendMessage(GetParent(hwndDlg), KS_ISENABLED, (WPARAM)IDC_CHECKCONNECTION, 0))?TRUE:FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_BYPING), (IsDlgButtonChecked(hwndDlg, IDC_CONTCHECK) && SendMessage(GetParent(hwndDlg), KS_ISENABLED, (WPARAM)IDC_CHECKCONNECTION, 0)) ? TRUE : FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_PINGHOST), (IsDlgButtonChecked(hwndDlg, IDC_CONTCHECK)) && (IsDlgButtonChecked(hwndDlg, IDC_BYPING) && SendMessage(GetParent(hwndDlg), KS_ISENABLED, (WPARAM)IDC_CHECKCONNECTION, 0)) ? TRUE : FALSE);
break;
}
break;
case WM_NOTIFY:
if (((NMHDR*)lParam)->idFrom == IDC_PROTOCOLLIST) {
- switch(((NMHDR*)lParam)->code) {
+ switch (((NMHDR*)lParam)->code) {
case LVN_ITEMCHANGED:
- {
- NMLISTVIEW *nmlv = (NMLISTVIEW *)lParam;
- if (IsWindowVisible(GetDlgItem(hwndDlg,IDC_PROTOCOLLIST)) && ((nmlv->uNewState^nmlv->uOldState)&LVIS_STATEIMAGEMASK))
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- }
- break;
+ {
+ NMLISTVIEW *nmlv = (NMLISTVIEW *)lParam;
+ if (IsWindowVisible(GetDlgItem(hwndDlg, IDC_PROTOCOLLIST)) && ((nmlv->uNewState^nmlv->uOldState)&LVIS_STATEIMAGEMASK))
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ }
+ break;
}
}
@@ -123,10 +123,10 @@ static INT_PTR CALLBACK DlgProcKSBasicOpts(HWND hwndDlg,UINT msg,WPARAM wParam,L
int i;
LVITEM lvItem;
- db_set_b(NULL, MODULENAME, SETTING_MAXRETRIES, (BYTE)GetDlgItemInt(hwndDlg,IDC_MAXRETRIES, NULL, FALSE));
+ db_set_b(NULL, MODULENAME, SETTING_MAXRETRIES, (BYTE)GetDlgItemInt(hwndDlg, IDC_MAXRETRIES, NULL, FALSE));
db_set_b(NULL, MODULENAME, SETTING_CHECKCONNECTION, (BYTE)SendMessage(GetParent(hwndDlg), KS_ISENABLED, (WPARAM)IDC_CHECKCONNECTION, 0));
db_set_b(NULL, MODULENAME, SETTING_SHOWCONNECTIONPOPUPS, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SHOWCONNECTIONPOPUPS));
- db_set_dw(NULL, MODULENAME, SETTING_INITDELAY, (DWORD)GetDlgItemInt(hwndDlg,IDC_INITDELAY, NULL, FALSE));
+ db_set_dw(NULL, MODULENAME, SETTING_INITDELAY, (DWORD)GetDlgItemInt(hwndDlg, IDC_INITDELAY, NULL, FALSE));
db_set_b(NULL, MODULENAME, SETTING_CHKINET, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_CHKINET));
db_set_b(NULL, MODULENAME, SETTING_CONTCHECK, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_CONTCHECK));
db_set_b(NULL, MODULENAME, SETTING_BYPING, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_BYPING));
@@ -135,20 +135,20 @@ static INT_PTR CALLBACK DlgProcKSBasicOpts(HWND hwndDlg,UINT msg,WPARAM wParam,L
int len = SendDlgItemMessage(hwndDlg, IDC_PINGHOST, WM_GETTEXTLENGTH, 0, 0);
if (len > 0) {
- host = ( char* )malloc(len+1);
+ host = (char*)malloc(len + 1);
if (host != NULL) {
- memset(host, '\0', len+1);
- GetDlgItemTextA(hwndDlg, IDC_PINGHOST, host, len+1);
+ memset(host, '\0', len + 1);
+ GetDlgItemTextA(hwndDlg, IDC_PINGHOST, host, len + 1);
db_set_s(NULL, MODULENAME, SETTING_PINGHOST, host);
}
}
}
- HWND hList = GetDlgItem(hwndDlg,IDC_PROTOCOLLIST);
- memset(&lvItem,0,sizeof(lvItem));
- lvItem.mask=LVIF_PARAM;
- for (i=0;i<ListView_GetItemCount(hList);i++) {
- lvItem.iItem=i;
- lvItem.iSubItem=0;
+ HWND hList = GetDlgItem(hwndDlg, IDC_PROTOCOLLIST);
+ memset(&lvItem, 0, sizeof(lvItem));
+ lvItem.mask = LVIF_PARAM;
+ for (i = 0; i < ListView_GetItemCount(hList); i++) {
+ lvItem.iItem = i;
+ lvItem.iSubItem = 0;
ListView_GetItem(hList, &lvItem);
char dbSetting[128];
@@ -162,37 +162,37 @@ static INT_PTR CALLBACK DlgProcKSBasicOpts(HWND hwndDlg,UINT msg,WPARAM wParam,L
return 0;
}
-static INT_PTR CALLBACK DlgProcKSAdvOpts(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM lParam)
+static INT_PTR CALLBACK DlgProcKSAdvOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
- switch(msg) {
+ switch (msg) {
case WM_INITDIALOG: {
TranslateDialogDefault(hwndDlg);
- SetDlgItemInt(hwndDlg, IDC_MAXDELAY, db_get_dw(NULL,MODULENAME,SETTING_MAXDELAY,DEFAULT_MAXDELAY),FALSE);
- SetDlgItemInt(hwndDlg, IDC_MAXCONNECTINGTIME, db_get_dw(NULL,MODULENAME,SETTING_MAXCONNECTINGTIME,0),FALSE);
- CheckDlgButton(hwndDlg, IDC_INCREASEEXPONENTIAL, db_get_b(NULL, MODULENAME, SETTING_INCREASEEXPONENTIAL,FALSE) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_CNCOTHERLOC, (db_get_b(NULL, MODULENAME, SETTING_CNCOTHERLOC, FALSE)&&(CallService(MS_SYSTEM_GETVERSION,0,0) >= 0x00040000)) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_LOGINERR, db_get_b(NULL, MODULENAME, SETTING_LOGINERR, LOGINERR_NOTHING)==LOGINERR_NOTHING ? BST_UNCHECKED : BST_CHECKED);
- CheckDlgButton(hwndDlg, IDC_CHECKAPMRESUME, (db_get_b(NULL, MODULENAME, SETTING_CHECKAPMRESUME, FALSE)&&(CallService(MS_SYSTEM_GETVERSION,0,0) >= 0x00040000)) ? BST_CHECKED : BST_UNCHECKED);
+ SetDlgItemInt(hwndDlg, IDC_MAXDELAY, db_get_dw(NULL, MODULENAME, SETTING_MAXDELAY, DEFAULT_MAXDELAY), FALSE);
+ SetDlgItemInt(hwndDlg, IDC_MAXCONNECTINGTIME, db_get_dw(NULL, MODULENAME, SETTING_MAXCONNECTINGTIME, 0), FALSE);
+ CheckDlgButton(hwndDlg, IDC_INCREASEEXPONENTIAL, db_get_b(NULL, MODULENAME, SETTING_INCREASEEXPONENTIAL, FALSE) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_CNCOTHERLOC, (db_get_b(NULL, MODULENAME, SETTING_CNCOTHERLOC, FALSE) && (CallService(MS_SYSTEM_GETVERSION, 0, 0) >= 0x00040000)) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_LOGINERR, db_get_b(NULL, MODULENAME, SETTING_LOGINERR, LOGINERR_NOTHING) == LOGINERR_NOTHING ? BST_UNCHECKED : BST_CHECKED);
+ CheckDlgButton(hwndDlg, IDC_CHECKAPMRESUME, (db_get_b(NULL, MODULENAME, SETTING_CHECKAPMRESUME, FALSE) && (CallService(MS_SYSTEM_GETVERSION, 0, 0) >= 0x00040000)) ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_FIRSTOFFLINE, (db_get_b(NULL, MODULENAME, SETTING_FIRSTOFFLINE, FALSE)) ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_NOLOCKED, (db_get_b(NULL, MODULENAME, SETTING_NOLOCKED, FALSE)) ? BST_CHECKED : BST_UNCHECKED);
SetDlgItemInt(hwndDlg, IDC_LOGINERR_DELAY, db_get_dw(NULL, MODULENAME, SETTING_LOGINERR_DELAY, DEFAULT_MAXDELAY), FALSE);
SetDlgItemInt(hwndDlg, IDC_PINGCOUNT, db_get_w(NULL, MODULENAME, SETTING_PINGCOUNT, DEFAULT_PINGCOUNT), FALSE);
SetDlgItemInt(hwndDlg, IDC_CNTDELAY, db_get_dw(NULL, MODULENAME, SETTING_CNTDELAY, CHECKCONTIN_DELAY), FALSE);
- switch ( db_get_b(NULL, MODULENAME, SETTING_LOGINERR, LOGINERR_CANCEL)) {
- case LOGINERR_SETDELAY:
- CheckRadioButton(hwndDlg, IDC_LOGINERR_CANCEL, IDC_LOGINERR_SETDELAY, IDC_LOGINERR_SETDELAY);
- break;
- default:
- case LOGINERR_CANCEL:
- CheckRadioButton(hwndDlg, IDC_LOGINERR_CANCEL, IDC_LOGINERR_SETDELAY, IDC_LOGINERR_CANCEL);
- break;
+ switch (db_get_b(NULL, MODULENAME, SETTING_LOGINERR, LOGINERR_CANCEL)) {
+ case LOGINERR_SETDELAY:
+ CheckRadioButton(hwndDlg, IDC_LOGINERR_CANCEL, IDC_LOGINERR_SETDELAY, IDC_LOGINERR_SETDELAY);
+ break;
+ default:
+ case LOGINERR_CANCEL:
+ CheckRadioButton(hwndDlg, IDC_LOGINERR_CANCEL, IDC_LOGINERR_SETDELAY, IDC_LOGINERR_CANCEL);
+ break;
}
SendMessage(hwndDlg, KS_ENABLEITEMS, 0, 0);
break;
}
case WM_COMMAND:
- if ( ((HIWORD(wParam) == EN_CHANGE) || (HIWORD(wParam) == BN_CLICKED)) && ((HWND)lParam == GetFocus()))
- SendMessage(GetParent(hwndDlg),PSM_CHANGED,0,0);
+ if (((HIWORD(wParam) == EN_CHANGE) || (HIWORD(wParam) == BN_CLICKED)) && ((HWND)lParam == GetFocus()))
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
// something changed
switch (LOWORD(wParam)) {
case IDC_INCREASEEXPONENTIAL:
@@ -203,7 +203,7 @@ static INT_PTR CALLBACK DlgProcKSAdvOpts(HWND hwndDlg,UINT msg,WPARAM wParam,LPA
case IDC_LOGINERR_CANCEL:
case IDC_LOGINERR_SETDELAY:
CheckRadioButton(hwndDlg, IDC_LOGINERR_CANCEL, IDC_LOGINERR_SETDELAY, LOWORD(wParam));
- EnableWindow(GetDlgItem(hwndDlg, IDC_LOGINERR_DELAY), IsDlgButtonChecked(hwndDlg, IDC_LOGINERR_SETDELAY)&&IsDlgButtonChecked(hwndDlg, IDC_LOGINERR)&&SendMessage(GetParent(hwndDlg), KS_ISENABLED, (WPARAM)IDC_CHECKCONNECTION, 0));
+ EnableWindow(GetDlgItem(hwndDlg, IDC_LOGINERR_DELAY), IsDlgButtonChecked(hwndDlg, IDC_LOGINERR_SETDELAY) && IsDlgButtonChecked(hwndDlg, IDC_LOGINERR) && SendMessage(GetParent(hwndDlg), KS_ISENABLED, (WPARAM)IDC_CHECKCONNECTION, 0));
break;
}
break;
@@ -211,8 +211,8 @@ static INT_PTR CALLBACK DlgProcKSAdvOpts(HWND hwndDlg,UINT msg,WPARAM wParam,LPA
case WM_NOTIFY:
if (((LPNMHDR)lParam)->code == PSN_APPLY) {
db_set_b(NULL, MODULENAME, SETTING_INCREASEEXPONENTIAL, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_INCREASEEXPONENTIAL));
- db_set_dw(NULL, MODULENAME, SETTING_MAXDELAY, (DWORD)GetDlgItemInt(hwndDlg,IDC_MAXDELAY, NULL, FALSE));
- db_set_dw(NULL, MODULENAME, SETTING_MAXCONNECTINGTIME, (DWORD)GetDlgItemInt(hwndDlg,IDC_MAXCONNECTINGTIME, NULL, FALSE));
+ db_set_dw(NULL, MODULENAME, SETTING_MAXDELAY, (DWORD)GetDlgItemInt(hwndDlg, IDC_MAXDELAY, NULL, FALSE));
+ db_set_dw(NULL, MODULENAME, SETTING_MAXCONNECTINGTIME, (DWORD)GetDlgItemInt(hwndDlg, IDC_MAXCONNECTINGTIME, NULL, FALSE));
db_set_b(NULL, MODULENAME, SETTING_FIRSTOFFLINE, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_FIRSTOFFLINE));
db_set_b(NULL, MODULENAME, SETTING_NOLOCKED, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_NOLOCKED));
db_set_b(NULL, MODULENAME, SETTING_CNCOTHERLOC, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_CNCOTHERLOC));
@@ -227,21 +227,21 @@ static INT_PTR CALLBACK DlgProcKSAdvOpts(HWND hwndDlg,UINT msg,WPARAM wParam,LPA
else db_set_b(NULL, MODULENAME, SETTING_LOGINERR, LOGINERR_NOTHING);
db_set_b(NULL, MODULENAME, SETTING_CHECKAPMRESUME, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_CHECKAPMRESUME));
- db_set_w(NULL, MODULENAME, SETTING_PINGCOUNT, (WORD)GetDlgItemInt(hwndDlg,IDC_PINGCOUNT, NULL, FALSE));
- db_set_dw(NULL, MODULENAME, SETTING_CNTDELAY, (DWORD)GetDlgItemInt(hwndDlg,IDC_CNTDELAY, NULL, FALSE)==0?CHECKCONTIN_DELAY:GetDlgItemInt(hwndDlg,IDC_CNTDELAY, NULL, FALSE));
+ db_set_w(NULL, MODULENAME, SETTING_PINGCOUNT, (WORD)GetDlgItemInt(hwndDlg, IDC_PINGCOUNT, NULL, FALSE));
+ db_set_dw(NULL, MODULENAME, SETTING_CNTDELAY, (DWORD)GetDlgItemInt(hwndDlg, IDC_CNTDELAY, NULL, FALSE) == 0 ? CHECKCONTIN_DELAY : GetDlgItemInt(hwndDlg, IDC_CNTDELAY, NULL, FALSE));
}
break;
case KS_ENABLEITEMS:
EnableWindow(GetDlgItem(hwndDlg, IDC_INCREASEEXPONENTIAL), SendMessage(GetParent(hwndDlg), KS_ISENABLED, (WPARAM)IDC_CHECKCONNECTION, 0));
EnableWindow(GetDlgItem(hwndDlg, IDC_MAXCONNECTINGTIME), SendMessage(GetParent(hwndDlg), KS_ISENABLED, (WPARAM)IDC_CHECKCONNECTION, 0));
- EnableWindow(GetDlgItem(hwndDlg, IDC_CNCOTHERLOC), SendMessage(GetParent(hwndDlg), KS_ISENABLED, (WPARAM)IDC_CHECKCONNECTION, 0)&&(CallService(MS_SYSTEM_GETVERSION,0,0) >= 0x00040000));
+ EnableWindow(GetDlgItem(hwndDlg, IDC_CNCOTHERLOC), SendMessage(GetParent(hwndDlg), KS_ISENABLED, (WPARAM)IDC_CHECKCONNECTION, 0) && (CallService(MS_SYSTEM_GETVERSION, 0, 0) >= 0x00040000));
EnableWindow(GetDlgItem(hwndDlg, IDC_LOGINERR), SendMessage(GetParent(hwndDlg), KS_ISENABLED, (WPARAM)IDC_CHECKCONNECTION, 0));
- EnableWindow(GetDlgItem(hwndDlg, IDC_LOGINERR_SETDELAY), IsDlgButtonChecked(hwndDlg, IDC_LOGINERR)&&SendMessage(GetParent(hwndDlg), KS_ISENABLED, (WPARAM)IDC_CHECKCONNECTION, 0));
- EnableWindow(GetDlgItem(hwndDlg, IDC_LOGINERR_DELAY), IsDlgButtonChecked(hwndDlg, IDC_LOGINERR_SETDELAY)&&IsDlgButtonChecked(hwndDlg, IDC_LOGINERR)&&SendMessage(GetParent(hwndDlg), KS_ISENABLED, (WPARAM)IDC_CHECKCONNECTION, 0));
- EnableWindow(GetDlgItem(hwndDlg, IDC_LOGINERR_CANCEL), IsDlgButtonChecked(hwndDlg, IDC_LOGINERR)&&SendMessage(GetParent(hwndDlg), KS_ISENABLED, (WPARAM)IDC_CHECKCONNECTION, 0));
- EnableWindow(GetDlgItem(hwndDlg, IDC_MAXDELAY), (IsDlgButtonChecked(hwndDlg, IDC_INCREASEEXPONENTIAL)&&SendMessage(GetParent(hwndDlg), KS_ISENABLED, (WPARAM)IDC_CHECKCONNECTION, 0))?TRUE:FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_CHECKAPMRESUME), SendMessage(GetParent(hwndDlg), KS_ISENABLED, (WPARAM)IDC_CHECKCONNECTION, 0)&&(CallService(MS_SYSTEM_GETVERSION,0,0) >= 0x00040000));
+ EnableWindow(GetDlgItem(hwndDlg, IDC_LOGINERR_SETDELAY), IsDlgButtonChecked(hwndDlg, IDC_LOGINERR) && SendMessage(GetParent(hwndDlg), KS_ISENABLED, (WPARAM)IDC_CHECKCONNECTION, 0));
+ EnableWindow(GetDlgItem(hwndDlg, IDC_LOGINERR_DELAY), IsDlgButtonChecked(hwndDlg, IDC_LOGINERR_SETDELAY) && IsDlgButtonChecked(hwndDlg, IDC_LOGINERR) && SendMessage(GetParent(hwndDlg), KS_ISENABLED, (WPARAM)IDC_CHECKCONNECTION, 0));
+ EnableWindow(GetDlgItem(hwndDlg, IDC_LOGINERR_CANCEL), IsDlgButtonChecked(hwndDlg, IDC_LOGINERR) && SendMessage(GetParent(hwndDlg), KS_ISENABLED, (WPARAM)IDC_CHECKCONNECTION, 0));
+ EnableWindow(GetDlgItem(hwndDlg, IDC_MAXDELAY), (IsDlgButtonChecked(hwndDlg, IDC_INCREASEEXPONENTIAL) && SendMessage(GetParent(hwndDlg), KS_ISENABLED, (WPARAM)IDC_CHECKCONNECTION, 0)) ? TRUE : FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_CHECKAPMRESUME), SendMessage(GetParent(hwndDlg), KS_ISENABLED, (WPARAM)IDC_CHECKCONNECTION, 0) && (CallService(MS_SYSTEM_GETVERSION, 0, 0) >= 0x00040000));
EnableWindow(GetDlgItem(hwndDlg, IDC_FIRSTOFFLINE), SendMessage(GetParent(hwndDlg), KS_ISENABLED, (WPARAM)IDC_CHECKCONNECTION, 0));
EnableWindow(GetDlgItem(hwndDlg, IDC_NOLOCKED), SendMessage(GetParent(hwndDlg), KS_ISENABLED, (WPARAM)IDC_CHECKCONNECTION, 0));
EnableWindow(GetDlgItem(hwndDlg, IDC_PINGCOUNT), SendMessage(GetParent(hwndDlg), KS_ISENABLED, (WPARAM)IDC_BYPING, 0));
@@ -262,48 +262,48 @@ static INT_PTR CALLBACK DlgProcKsTabs(HWND hwndDlg, UINT msg, WPARAM wParam, LPA
{
static HWND hBasicTab;
- switch(msg) {
+ switch (msg) {
case WM_INITDIALOG:
- {
- HWND hShow, hPage;
- RECT rcTabs, rcOptions, rcPage;
+ {
+ HWND hShow, hPage;
+ RECT rcTabs, rcOptions, rcPage;
- TranslateDialogDefault(hwndDlg);
-
- // set tabs
- int tabCount = 0;
- HWND hTab = GetDlgItem(hwndDlg, IDC_TABS);
- GetWindowRect(hTab, &rcTabs);
- GetWindowRect(hwndDlg, &rcOptions);
+ TranslateDialogDefault(hwndDlg);
- // basic tab
- TCITEM tci;
- memset(&tci, 0, sizeof(TCITEM));
- tci.mask = TCIF_TEXT|TCIF_PARAM;
- tci.pszText = TranslateT("Basic");
- hShow = hBasicTab = hPage = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_OPT_KS_BASIC), hwndDlg, DlgProcKSBasicOpts, (LPARAM)GetParent(hwndDlg));
- EnableThemeDialogTexture(hPage, ETDT_ENABLETAB);
-
- tci.lParam = (LPARAM)hPage;
- GetClientRect(hPage, &rcPage);
- MoveWindow(hPage, (rcTabs.left - rcOptions.left) + ((rcTabs.right-rcTabs.left)-(rcPage.right-rcPage.left))/2, 10 + (rcTabs.top - rcOptions.top) + ((rcTabs.bottom-rcTabs.top)-(rcPage.bottom-rcPage.top))/2, rcPage.right-rcPage.left, rcPage.bottom-rcPage.top, TRUE);
- ShowWindow(hPage, SW_HIDE);
- TabCtrl_InsertItem(hTab, tabCount++, &tci);
-
- // advanced tab
- tci.mask = TCIF_TEXT|TCIF_PARAM;
- tci.pszText = TranslateT("Advanced");
- hPage = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_OPT_KS_ADV), hwndDlg, DlgProcKSAdvOpts, (LPARAM)GetParent(hwndDlg));
- EnableThemeDialogTexture(hPage, ETDT_ENABLETAB);
-
- tci.lParam = (LPARAM)hPage;
- GetClientRect(hPage, &rcPage);
- MoveWindow(hPage, (rcTabs.left - rcOptions.left) + ((rcTabs.right-rcTabs.left)-(rcPage.right-rcPage.left))/2, 10 + (rcTabs.top - rcOptions.top) + ((rcTabs.bottom-rcTabs.top)-(rcPage.bottom-rcPage.top))/2, rcPage.right-rcPage.left, rcPage.bottom-rcPage.top, TRUE);
- ShowWindow(hPage, SW_HIDE);
- TabCtrl_InsertItem(hTab, tabCount++, &tci);
- ShowWindow(hShow, SW_SHOW);
- }
- break;
+ // set tabs
+ int tabCount = 0;
+ HWND hTab = GetDlgItem(hwndDlg, IDC_TABS);
+ GetWindowRect(hTab, &rcTabs);
+ GetWindowRect(hwndDlg, &rcOptions);
+
+ // basic tab
+ TCITEM tci;
+ memset(&tci, 0, sizeof(TCITEM));
+ tci.mask = TCIF_TEXT | TCIF_PARAM;
+ tci.pszText = TranslateT("Basic");
+ hShow = hBasicTab = hPage = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_OPT_KS_BASIC), hwndDlg, DlgProcKSBasicOpts, (LPARAM)GetParent(hwndDlg));
+ EnableThemeDialogTexture(hPage, ETDT_ENABLETAB);
+
+ tci.lParam = (LPARAM)hPage;
+ GetClientRect(hPage, &rcPage);
+ MoveWindow(hPage, (rcTabs.left - rcOptions.left) + ((rcTabs.right - rcTabs.left) - (rcPage.right - rcPage.left)) / 2, 10 + (rcTabs.top - rcOptions.top) + ((rcTabs.bottom - rcTabs.top) - (rcPage.bottom - rcPage.top)) / 2, rcPage.right - rcPage.left, rcPage.bottom - rcPage.top, TRUE);
+ ShowWindow(hPage, SW_HIDE);
+ TabCtrl_InsertItem(hTab, tabCount++, &tci);
+
+ // advanced tab
+ tci.mask = TCIF_TEXT | TCIF_PARAM;
+ tci.pszText = TranslateT("Advanced");
+ hPage = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_OPT_KS_ADV), hwndDlg, DlgProcKSAdvOpts, (LPARAM)GetParent(hwndDlg));
+ EnableThemeDialogTexture(hPage, ETDT_ENABLETAB);
+
+ tci.lParam = (LPARAM)hPage;
+ GetClientRect(hPage, &rcPage);
+ MoveWindow(hPage, (rcTabs.left - rcOptions.left) + ((rcTabs.right - rcTabs.left) - (rcPage.right - rcPage.left)) / 2, 10 + (rcTabs.top - rcOptions.top) + ((rcTabs.bottom - rcTabs.top) - (rcPage.bottom - rcPage.top)) / 2, rcPage.right - rcPage.left, rcPage.bottom - rcPage.top, TRUE);
+ ShowWindow(hPage, SW_HIDE);
+ TabCtrl_InsertItem(hTab, tabCount++, &tci);
+ ShowWindow(hShow, SW_SHOW);
+ }
+ break;
case KS_ISENABLED:
SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, (LONG_PTR)IsDlgButtonChecked(hBasicTab, wParam));
@@ -314,7 +314,7 @@ static INT_PTR CALLBACK DlgProcKsTabs(HWND hwndDlg, UINT msg, WPARAM wParam, LPA
break;
case WM_NOTIFY:
- if ( (((NMHDR*)lParam)->idFrom == IDC_TABS)) {
+ if ((((NMHDR*)lParam)->idFrom == IDC_TABS)) {
if (((NMHDR*)lParam)->code == TCN_SELCHANGING) {
TCITEM tci;
@@ -336,8 +336,8 @@ static INT_PTR CALLBACK DlgProcKsTabs(HWND hwndDlg, UINT msg, WPARAM wParam, LPA
tci.mask = TCIF_PARAM;
count = TabCtrl_GetItemCount(GetDlgItem(hwndDlg, IDC_TABS));
- for (i=0;i<count;i++) {
- TabCtrl_GetItem(GetDlgItem(hwndDlg,IDC_TABS), i, &tci);
+ for (i = 0; i < count; i++) {
+ TabCtrl_GetItem(GetDlgItem(hwndDlg, IDC_TABS), i, &tci);
SendMessage((HWND)tci.lParam, WM_NOTIFY, 0, lParam);
}
// let main reload options
@@ -349,18 +349,18 @@ static INT_PTR CALLBACK DlgProcKsTabs(HWND hwndDlg, UINT msg, WPARAM wParam, LPA
return FALSE;
}
-INT_PTR CALLBACK PopupOptDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM lParam)
+INT_PTR CALLBACK PopupOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
static bool bFreeze = false;
- switch(msg) {
+ switch (msg) {
case WM_INITDIALOG:
TranslateDialogDefault(hwndDlg);
bFreeze = true;
// left action
- switch ( db_get_b( NULL, MODULENAME, SETTING_POPUP_LEFTCLICK, POPUP_ACT_CANCEL )) {
+ switch (db_get_b(NULL, MODULENAME, SETTING_POPUP_LEFTCLICK, POPUP_ACT_CANCEL)) {
case POPUP_ACT_CLOSEPOPUP:
CheckDlgButton(hwndDlg, IDC_LCLOSE, BST_CHECKED);
break;
@@ -375,7 +375,7 @@ INT_PTR CALLBACK PopupOptDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM lPar
break;
}
// right action
- switch ( db_get_b( NULL, MODULENAME, SETTING_POPUP_RIGHTCLICK, POPUP_ACT_CANCEL )) {
+ switch (db_get_b(NULL, MODULENAME, SETTING_POPUP_RIGHTCLICK, POPUP_ACT_CANCEL)) {
case POPUP_ACT_CLOSEPOPUP:
CheckDlgButton(hwndDlg, IDC_RCLOSE, BST_CHECKED);
break;
@@ -394,7 +394,7 @@ INT_PTR CALLBACK PopupOptDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM lPar
EnableWindow(GetDlgItem(hwndDlg, IDC_DELAYFROMPU), ServiceExists(MS_POPUP_ADDPOPUPT));
EnableWindow(GetDlgItem(hwndDlg, IDC_DELAYPERMANENT), ServiceExists(MS_POPUP_ADDPOPUPT));
EnableWindow(GetDlgItem(hwndDlg, IDC_DELAY), ServiceExists(MS_POPUP_ADDPOPUPT));
- 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:
CheckDlgButton(hwndDlg, IDC_DELAYCUSTOM, BST_CHECKED);
EnableWindow(GetDlgItem(hwndDlg, IDC_DELAY), ServiceExists(MS_POPUP_ADDPOPUPT));
@@ -412,11 +412,11 @@ INT_PTR CALLBACK PopupOptDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM lPar
break;
}
// delay
- SetDlgItemInt(hwndDlg,IDC_DELAY, db_get_dw(NULL, MODULENAME, SETTING_POPUP_TIMEOUT, 0), FALSE);
+ SetDlgItemInt(hwndDlg, IDC_DELAY, db_get_dw(NULL, MODULENAME, SETTING_POPUP_TIMEOUT, 0), FALSE);
// back color
- SendDlgItemMessage(hwndDlg,IDC_BGCOLOR,CPM_SETCOLOUR,0,db_get_dw(NULL, MODULENAME, SETTING_POPUP_BACKCOLOR, 0xAAAAAA));
+ SendDlgItemMessage(hwndDlg, IDC_BGCOLOR, CPM_SETCOLOUR, 0, db_get_dw(NULL, MODULENAME, SETTING_POPUP_BACKCOLOR, 0xAAAAAA));
// text
- SendDlgItemMessage(hwndDlg,IDC_TEXTCOLOR,CPM_SETCOLOUR,0,db_get_dw(NULL, MODULENAME, SETTING_POPUP_TEXTCOLOR, 0x0000CC));
+ SendDlgItemMessage(hwndDlg, IDC_TEXTCOLOR, CPM_SETCOLOUR, 0, db_get_dw(NULL, MODULENAME, SETTING_POPUP_TEXTCOLOR, 0x0000CC));
// wincolors
CheckDlgButton(hwndDlg, IDC_WINCOLORS, db_get_b(NULL, MODULENAME, SETTING_POPUP_USEWINCOLORS, 0) ? BST_CHECKED : BST_UNCHECKED);
// defaultcolors
@@ -470,50 +470,50 @@ INT_PTR CALLBACK PopupOptDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM lPar
case IDC_PUCONNRETRY:
case IDC_PURESULT:
case IDC_PUSHOWEXTRA:
- if ( !bFreeze )
+ if (!bFreeze)
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
break;
case IDC_PREV:
+ {
+ POPUPDATAT ppd = { NULL };
+
+ ppd.lchContact = NULL;
+ ppd.lchIcon = LoadSkinnedIcon(SKINICON_STATUS_OFFLINE);
+ _tcsncpy(ppd.lptzContactName, TranslateT("KeepStatus"), MAX_CONTACTNAME);
+ _tcsncpy(ppd.lptzText, TranslateT("You broke the Internet!"), MAX_SECONDLINE);
+ if (IsDlgButtonChecked(hwndDlg, IDC_WINCOLORS))
{
- POPUPDATAT ppd = { NULL };
-
- ppd.lchContact = NULL;
- ppd.lchIcon = LoadSkinnedIcon(SKINICON_STATUS_OFFLINE);
- _tcsncpy( ppd.lptzContactName, TranslateT("KeepStatus"), MAX_CONTACTNAME);
- _tcsncpy( ppd.lptzText, TranslateT("You broke the Internet!"), MAX_SECONDLINE);
- if (IsDlgButtonChecked(hwndDlg, IDC_WINCOLORS))
- {
- ppd.colorBack = GetSysColor(COLOR_BTNFACE);
- ppd.colorText = GetSysColor(COLOR_WINDOWTEXT);
- }
- else if (IsDlgButtonChecked(hwndDlg, IDC_DEFAULTCOLORS))
- {
- ppd.colorBack = NULL;
- ppd.colorText = NULL;
- }
- else
- {
- ppd.colorBack = SendDlgItemMessage(hwndDlg,IDC_BGCOLOR,CPM_GETCOLOUR,0,0);
- ppd.colorText = SendDlgItemMessage(hwndDlg,IDC_TEXTCOLOR,CPM_GETCOLOUR,0,0);
- }
- ppd.PluginWindowProc = PopupDlgProc;
- ppd.PluginData = NULL;
- if (IsDlgButtonChecked(hwndDlg, IDC_DELAYFROMPU))
- {
- ppd.iSeconds = 0;
- }
- else if (IsDlgButtonChecked(hwndDlg, IDC_DELAYCUSTOM))
- {
- ppd.iSeconds = GetDlgItemInt(hwndDlg, IDC_DELAY, NULL, FALSE);
- }
- else if (IsDlgButtonChecked(hwndDlg, IDC_DELAYPERMANENT))
- {
- ppd.iSeconds = -1;
- }
- PUAddPopupT(&ppd);
+ ppd.colorBack = GetSysColor(COLOR_BTNFACE);
+ ppd.colorText = GetSysColor(COLOR_WINDOWTEXT);
}
- break;
+ else if (IsDlgButtonChecked(hwndDlg, IDC_DEFAULTCOLORS))
+ {
+ ppd.colorBack = NULL;
+ ppd.colorText = NULL;
+ }
+ else
+ {
+ ppd.colorBack = SendDlgItemMessage(hwndDlg, IDC_BGCOLOR, CPM_GETCOLOUR, 0, 0);
+ ppd.colorText = SendDlgItemMessage(hwndDlg, IDC_TEXTCOLOR, CPM_GETCOLOUR, 0, 0);
+ }
+ ppd.PluginWindowProc = PopupDlgProc;
+ ppd.PluginData = NULL;
+ if (IsDlgButtonChecked(hwndDlg, IDC_DELAYFROMPU))
+ {
+ ppd.iSeconds = 0;
+ }
+ else if (IsDlgButtonChecked(hwndDlg, IDC_DELAYCUSTOM))
+ {
+ ppd.iSeconds = GetDlgItemInt(hwndDlg, IDC_DELAY, NULL, FALSE);
+ }
+ else if (IsDlgButtonChecked(hwndDlg, IDC_DELAYPERMANENT))
+ {
+ ppd.iSeconds = -1;
+ }
+ PUAddPopupT(&ppd);
+ }
+ break;
}
break;
@@ -541,11 +541,11 @@ INT_PTR CALLBACK PopupOptDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM lPar
else if (IsDlgButtonChecked(hwndDlg, IDC_DELAYPERMANENT))
db_set_b(NULL, MODULENAME, SETTING_POPUP_DELAYTYPE, POPUP_DELAYPERMANENT);
// delay
- db_set_dw(NULL, MODULENAME, SETTING_POPUP_TIMEOUT, GetDlgItemInt(hwndDlg,IDC_DELAY, NULL, FALSE));
+ db_set_dw(NULL, MODULENAME, SETTING_POPUP_TIMEOUT, GetDlgItemInt(hwndDlg, IDC_DELAY, NULL, FALSE));
// back color
- db_set_dw(NULL, MODULENAME, SETTING_POPUP_BACKCOLOR, SendDlgItemMessage(hwndDlg,IDC_BGCOLOR,CPM_GETCOLOUR,0,0));
+ db_set_dw(NULL, MODULENAME, SETTING_POPUP_BACKCOLOR, SendDlgItemMessage(hwndDlg, IDC_BGCOLOR, CPM_GETCOLOUR, 0, 0));
// text color
- db_set_dw(NULL, MODULENAME, SETTING_POPUP_TEXTCOLOR, SendDlgItemMessage(hwndDlg,IDC_TEXTCOLOR,CPM_GETCOLOUR,0,0));
+ db_set_dw(NULL, MODULENAME, SETTING_POPUP_TEXTCOLOR, SendDlgItemMessage(hwndDlg, IDC_TEXTCOLOR, CPM_GETCOLOUR, 0, 0));
// use win
db_set_b(NULL, MODULENAME, SETTING_POPUP_USEWINCOLORS, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_WINCOLORS));
// use def
@@ -554,8 +554,8 @@ INT_PTR CALLBACK PopupOptDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM lPar
db_set_b(NULL, MODULENAME, SETTING_PUCONNLOST, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_PUCONNLOST));
db_set_b(NULL, MODULENAME, SETTING_PUOTHER, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_PUOTHER));
db_set_b(NULL, MODULENAME, SETTING_PUCONNRETRY, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_PUCONNRETRY));
- db_set_b(NULL, MODULENAME, SETTING_PURESULT, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_PURESULT));
- db_set_b(NULL, MODULENAME, SETTING_PUSHOWEXTRA, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_PUSHOWEXTRA));
+ db_set_b(NULL, MODULENAME, SETTING_PURESULT, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_PURESULT));
+ db_set_b(NULL, MODULENAME, SETTING_PUSHOWEXTRA, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_PUSHOWEXTRA));
}
break;
}
@@ -563,18 +563,18 @@ INT_PTR CALLBACK PopupOptDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM lPar
return 0;
}
-int OptionsInit(WPARAM wparam,LPARAM lparam)
+int OptionsInit(WPARAM wparam, LPARAM)
{
OPTIONSDIALOGPAGE odp = { sizeof(odp) };
odp.hInstance = hInst;
odp.ptszGroup = LPGENT("Status");
odp.ptszTitle = LPGENT("KeepStatus");
- odp.flags = ODPF_BOLDGROUPS|ODPF_TCHAR;
+ odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_TABS);
odp.pfnDlgProc = DlgProcKsTabs;
Options_AddPage(wparam, &odp);
- if ( ServiceExists( MS_POPUP_ADDPOPUPT )) {
+ if (ServiceExists(MS_POPUP_ADDPOPUPT)) {
memset(&odp, 0, sizeof(odp));
odp.cbSize = sizeof(odp);
odp.position = 150000000;
@@ -584,8 +584,8 @@ int OptionsInit(WPARAM wparam,LPARAM lparam)
odp.pszTemplate = MAKEINTRESOURCEA(IDD_PUOPT_KEEPSTATUS);
odp.ptszTitle = LPGENT("KeepStatus");
odp.pfnDlgProc = PopupOptDlgProc;
- odp.flags = ODPF_BOLDGROUPS|ODPF_TCHAR;
- Options_AddPage(wparam,&odp);
+ odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR;
+ Options_AddPage(wparam, &odp);
}
return 0;
}
diff --git a/plugins/StatusPlugins/commonstatus.cpp b/plugins/StatusPlugins/commonstatus.cpp
index c82053e3c9..46747333a5 100644
--- a/plugins/StatusPlugins/commonstatus.cpp
+++ b/plugins/StatusPlugins/commonstatus.cpp
@@ -1,23 +1,23 @@
/*
- AdvancedAutoAway Plugin for Miranda-IM (www.miranda-im.org)
- KeepStatus Plugin for Miranda-IM (www.miranda-im.org)
- StartupStatus Plugin for Miranda-IM (www.miranda-im.org)
- Copyright 2003-2006 P. Boon
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-*/
+ AdvancedAutoAway Plugin for Miranda-IM (www.miranda-im.org)
+ KeepStatus Plugin for Miranda-IM (www.miranda-im.org)
+ StartupStatus Plugin for Miranda-IM (www.miranda-im.org)
+ Copyright 2003-2006 P. Boon
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
#include "commonstatus.h"
// handles for hooks and other Miranda thingies
@@ -26,7 +26,7 @@ static HANDLE hCSStatusChangedExEvent;
OBJLIST<PROTOCOLSETTINGEX> *protoList;
// prototypes
-char* StatusModeToDbSetting(int status,const char *suffix);
+char* StatusModeToDbSetting(int status, const char *suffix);
DWORD StatusModeToProtoFlag(int status);
INT_PTR SetStatusEx(WPARAM wParam, LPARAM lParam);
int InitCommonStatus();
@@ -36,42 +36,42 @@ int GetProtoCount();
extern INT_PTR ShowConfirmDialogEx(WPARAM wParam, LPARAM lParam);
// some helpers from awaymsg.c ================================================================
-char *StatusModeToDbSetting(int status,const char *suffix)
+char *StatusModeToDbSetting(int status, const char *suffix)
{
char *prefix;
static char str[64];
- switch(status) {
- case ID_STATUS_AWAY: prefix="Away"; break;
- case ID_STATUS_NA: prefix="Na"; break;
- case ID_STATUS_DND: prefix="Dnd"; break;
- case ID_STATUS_OCCUPIED: prefix="Occupied"; break;
- case ID_STATUS_FREECHAT: prefix="FreeChat"; break;
- case ID_STATUS_ONLINE: prefix="On"; break;
- case ID_STATUS_OFFLINE: prefix="Off"; break;
- case ID_STATUS_INVISIBLE: prefix="Inv"; break;
- case ID_STATUS_ONTHEPHONE: prefix="Otp"; break;
- case ID_STATUS_OUTTOLUNCH: prefix="Otl"; break;
- default: return NULL;
+ switch (status) {
+ case ID_STATUS_AWAY: prefix = "Away"; break;
+ case ID_STATUS_NA: prefix = "Na"; break;
+ case ID_STATUS_DND: prefix = "Dnd"; break;
+ case ID_STATUS_OCCUPIED: prefix = "Occupied"; break;
+ case ID_STATUS_FREECHAT: prefix = "FreeChat"; break;
+ case ID_STATUS_ONLINE: prefix = "On"; break;
+ case ID_STATUS_OFFLINE: prefix = "Off"; break;
+ case ID_STATUS_INVISIBLE: prefix = "Inv"; break;
+ case ID_STATUS_ONTHEPHONE: prefix = "Otp"; break;
+ case ID_STATUS_OUTTOLUNCH: prefix = "Otl"; break;
+ default: return NULL;
}
- mir_strcpy(str,prefix); mir_strcat(str,suffix);
+ mir_strcpy(str, prefix); mir_strcat(str, suffix);
return str;
}
DWORD StatusModeToProtoFlag(int status)
{
// *not* the same as in core, <offline>
- switch(status) {
- case ID_STATUS_ONLINE: return PF2_ONLINE;
- case ID_STATUS_OFFLINE: return PF2_OFFLINE;
- case ID_STATUS_INVISIBLE: return PF2_INVISIBLE;
- case ID_STATUS_OUTTOLUNCH: return PF2_OUTTOLUNCH;
- case ID_STATUS_ONTHEPHONE: return PF2_ONTHEPHONE;
- case ID_STATUS_AWAY: return PF2_SHORTAWAY;
- case ID_STATUS_NA: return PF2_LONGAWAY;
- case ID_STATUS_OCCUPIED: return PF2_LIGHTDND;
- case ID_STATUS_DND: return PF2_HEAVYDND;
- case ID_STATUS_FREECHAT: return PF2_FREECHAT;
+ switch (status) {
+ case ID_STATUS_ONLINE: return PF2_ONLINE;
+ case ID_STATUS_OFFLINE: return PF2_OFFLINE;
+ case ID_STATUS_INVISIBLE: return PF2_INVISIBLE;
+ case ID_STATUS_OUTTOLUNCH: return PF2_OUTTOLUNCH;
+ case ID_STATUS_ONTHEPHONE: return PF2_ONTHEPHONE;
+ case ID_STATUS_AWAY: return PF2_SHORTAWAY;
+ case ID_STATUS_NA: return PF2_LONGAWAY;
+ case ID_STATUS_OCCUPIED: return PF2_LIGHTDND;
+ case ID_STATUS_DND: return PF2_HEAVYDND;
+ case ID_STATUS_FREECHAT: return PF2_FREECHAT;
}
return 0;
}
@@ -96,18 +96,18 @@ int GetActualStatus(PROTOCOLSETTINGEX *protoSetting)
// helper, from core
static TCHAR* GetDefaultMessage(int status)
{
- switch(status) {
- case ID_STATUS_AWAY: return TranslateT("I've been away since %time%.");
- case ID_STATUS_NA: return TranslateT("Give it up, I'm not in!");
- case ID_STATUS_OCCUPIED: return TranslateT("Not right now.");
- case ID_STATUS_DND: return TranslateT("Give a guy some peace, would ya?");
- case ID_STATUS_FREECHAT: return TranslateT("I'm a chatbot!");
- case ID_STATUS_ONLINE: return TranslateT("Yep, I'm here.");
- case ID_STATUS_OFFLINE: return TranslateT("Nope, not here.");
- case ID_STATUS_INVISIBLE: return TranslateT("I'm hiding from the mafia.");
- case ID_STATUS_ONTHEPHONE: return TranslateT("That'll be the phone.");
- case ID_STATUS_OUTTOLUNCH: return TranslateT("Mmm... food.");
- case ID_STATUS_IDLE: return TranslateT("idleeeeeeee");
+ switch (status) {
+ case ID_STATUS_AWAY: return TranslateT("I've been away since %time%.");
+ case ID_STATUS_NA: return TranslateT("Give it up, I'm not in!");
+ case ID_STATUS_OCCUPIED: return TranslateT("Not right now.");
+ case ID_STATUS_DND: return TranslateT("Give a guy some peace, would ya?");
+ case ID_STATUS_FREECHAT: return TranslateT("I'm a chatbot!");
+ case ID_STATUS_ONLINE: return TranslateT("Yep, I'm here.");
+ case ID_STATUS_OFFLINE: return TranslateT("Nope, not here.");
+ case ID_STATUS_INVISIBLE: return TranslateT("I'm hiding from the mafia.");
+ case ID_STATUS_ONTHEPHONE: return TranslateT("That'll be the phone.");
+ case ID_STATUS_OUTTOLUNCH: return TranslateT("Mmm... food.");
+ case ID_STATUS_IDLE: return TranslateT("idleeeeeeee");
}
return NULL;
}
@@ -204,7 +204,7 @@ static void SetStatusMsg(PROTOCOLSETTINGEX *ps, int newstatus)
mir_free(tszMsg);
}
-INT_PTR SetStatusEx(WPARAM wParam, LPARAM lParam)
+INT_PTR SetStatusEx(WPARAM wParam, LPARAM)
{
PROTOCOLSETTINGEX** protoSettings = *(PROTOCOLSETTINGEX***)wParam;
if (protoSettings == NULL)
@@ -261,7 +261,7 @@ INT_PTR SetStatusEx(WPARAM wParam, LPARAM lParam)
SetStatusMsg(protoSettings[i], newstatus);
// set the status
- if (newstatus != oldstatus /*&& !(b_Caps1 && b_Caps3 && ServiceExists(MS_NAS_SETSTATE))*/ ) {
+ 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, newstatus, 0);
}
@@ -315,7 +315,7 @@ static int CreateServices()
return 0;
}
-static int onShutdown(WPARAM wParam, LPARAM lParam)
+static int onShutdown(WPARAM, LPARAM)
{
DestroyHookableEvent(hCSStatusChangedExEvent);
return 0;
diff --git a/plugins/StatusPlugins/commonstatus.h b/plugins/StatusPlugins/commonstatus.h
index 3201653858..7efb5977bc 100644
--- a/plugins/StatusPlugins/commonstatus.h
+++ b/plugins/StatusPlugins/commonstatus.h
@@ -1,23 +1,24 @@
/*
- AdvancedAutoAway Plugin for Miranda-IM (www.miranda-im.org)
- KeepStatus Plugin for Miranda-IM (www.miranda-im.org)
- StartupStatus Plugin for Miranda-IM (www.miranda-im.org)
- Copyright 2003-2006 P. Boon
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-*/
+ AdvancedAutoAway Plugin for Miranda-IM (www.miranda-im.org)
+ KeepStatus Plugin for Miranda-IM (www.miranda-im.org)
+ StartupStatus Plugin for Miranda-IM (www.miranda-im.org)
+ Copyright 2003-2006 P. Boon
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
#ifndef COMMONSTATUSHEADER
#define COMMONSTATUSHEADER
@@ -49,9 +50,9 @@
#include <win2k.h>
#if defined( _WIN64 )
- #define __PLATFORM_NAME "64"
+#define __PLATFORM_NAME "64"
#else
- #define __PLATFORM_NAME ""
+#define __PLATFORM_NAME ""
#endif
#include "../helpers/gen_helpers.h"
@@ -69,8 +70,8 @@
#define MIN_STATUS ID_STATUS_OFFLINE
#define DEF_CLOSE_TIME 5 //secs
#define PF2_OFFLINE 0x00000200
-static int statusModeList[]={ID_STATUS_OFFLINE,ID_STATUS_ONLINE,ID_STATUS_AWAY,ID_STATUS_NA,ID_STATUS_OCCUPIED,ID_STATUS_DND,ID_STATUS_FREECHAT,ID_STATUS_INVISIBLE,ID_STATUS_ONTHEPHONE,ID_STATUS_OUTTOLUNCH};
-static int statusModePf2List[]={PF2_OFFLINE,PF2_ONLINE,PF2_SHORTAWAY,PF2_LONGAWAY,PF2_LIGHTDND,PF2_HEAVYDND,PF2_FREECHAT,PF2_INVISIBLE,PF2_ONTHEPHONE,PF2_OUTTOLUNCH};
+static int statusModeList[] = { ID_STATUS_OFFLINE, ID_STATUS_ONLINE, ID_STATUS_AWAY, ID_STATUS_NA, ID_STATUS_OCCUPIED, ID_STATUS_DND, ID_STATUS_FREECHAT, ID_STATUS_INVISIBLE, ID_STATUS_ONTHEPHONE, ID_STATUS_OUTTOLUNCH };
+static int statusModePf2List[] = { PF2_OFFLINE, PF2_ONLINE, PF2_SHORTAWAY, PF2_LONGAWAY, PF2_LIGHTDND, PF2_HEAVYDND, PF2_FREECHAT, PF2_INVISIBLE, PF2_ONTHEPHONE, PF2_OUTTOLUNCH };
TCHAR *GetDefaultStatusMessage(PROTOCOLSETTINGEX *ps, int status);
int GetActualStatus(PROTOCOLSETTINGEX *protoSetting);
diff --git a/plugins/StatusPlugins/confirmdialog.cpp b/plugins/StatusPlugins/confirmdialog.cpp
index 28d917c249..3feff7a963 100644
--- a/plugins/StatusPlugins/confirmdialog.cpp
+++ b/plugins/StatusPlugins/confirmdialog.cpp
@@ -1,23 +1,24 @@
/*
- AdvancedAutoAway Plugin for Miranda-IM (www.miranda-im.org)
- KeepStatus Plugin for Miranda-IM (www.miranda-im.org)
- StartupStatus Plugin for Miranda-IM (www.miranda-im.org)
- Copyright 2003-2006 P. Boon
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-*/
+ AdvancedAutoAway Plugin for Miranda-IM (www.miranda-im.org)
+ KeepStatus Plugin for Miranda-IM (www.miranda-im.org)
+ StartupStatus Plugin for Miranda-IM (www.miranda-im.org)
+ Copyright 2003-2006 P. Boon
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
#include "commonstatus.h"
#include "resource.h"
@@ -29,11 +30,11 @@ static int timeOut;
struct TConfirmSetting : public PROTOCOLSETTINGEX
{
- TConfirmSetting( const PROTOCOLSETTINGEX& x )
+ TConfirmSetting(const PROTOCOLSETTINGEX& x)
{
- memcpy( this, &x, sizeof(PROTOCOLSETTINGEX));
- if ( szMsg )
- szMsg = _tcsdup( szMsg );
+ memcpy(this, &x, sizeof(PROTOCOLSETTINGEX));
+ if (szMsg)
+ szMsg = _tcsdup(szMsg);
}
~TConfirmSetting()
@@ -42,23 +43,24 @@ struct TConfirmSetting : public PROTOCOLSETTINGEX
}
};
-static int CompareSettings( const TConfirmSetting* p1, const TConfirmSetting* p2 )
-{ return mir_strcmp( p1->szName, p2->szName );
+static int CompareSettings(const TConfirmSetting* p1, const TConfirmSetting* p2)
+{
+ return mir_strcmp(p1->szName, p2->szName);
}
static OBJLIST<TConfirmSetting> *confirmSettings;
-static INT_PTR CALLBACK StatusMessageDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM lParam)
+static INT_PTR CALLBACK StatusMessageDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
static PROTOCOLSETTINGEX* protoSetting = NULL;
- switch(msg) {
+ switch (msg) {
case WM_INITDIALOG:
TranslateDialogDefault(hwndDlg);
protoSetting = (PROTOCOLSETTINGEX *)lParam;
if (protoSetting->szMsg == NULL) {
TCHAR* smsg = GetDefaultStatusMessage(protoSetting, GetActualStatus(protoSetting));
- if (smsg != NULL) {
+ if (smsg != NULL) {
SetDlgItemText(hwndDlg, IDC_STSMSG, smsg);
mir_free(smsg);
}
@@ -66,8 +68,8 @@ static INT_PTR CALLBACK StatusMessageDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam
else SetDlgItemText(hwndDlg, IDC_STSMSG, protoSetting->szMsg);
{
- TCHAR desc[ 512 ];
- mir_sntprintf(desc, SIZEOF(desc), TranslateT("Set %s message for %s."),
+ TCHAR desc[512];
+ mir_sntprintf(desc, SIZEOF(desc), TranslateT("Set %s message for %s."),
pcli->pfnGetStatusModeDescription(GetActualStatus(protoSetting), 0), protoSetting->tszAccName);
SetDlgItemText(hwndDlg, IDC_DESCRIPTION, desc);
}
@@ -76,17 +78,17 @@ static INT_PTR CALLBACK StatusMessageDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam
case WM_COMMAND:
switch (LOWORD(wParam)) {
case IDC_OK:
- {
- int len = SendDlgItemMessage(hwndDlg, IDC_STSMSG, WM_GETTEXTLENGTH, 0, 0);
- if (len > 0) {
- protoSetting->szMsg = ( TCHAR* )realloc(protoSetting->szMsg, sizeof(TCHAR)*(len+1));
- if (protoSetting->szMsg != NULL)
- GetDlgItemText(hwndDlg, IDC_STSMSG, protoSetting->szMsg, len+1);
- }
- SendMessage(GetParent(hwndDlg), UM_STSMSGDLGCLOSED, TRUE, 0);
- EndDialog(hwndDlg, IDC_OK);
+ {
+ int len = SendDlgItemMessage(hwndDlg, IDC_STSMSG, WM_GETTEXTLENGTH, 0, 0);
+ if (len > 0) {
+ protoSetting->szMsg = (TCHAR*)realloc(protoSetting->szMsg, sizeof(TCHAR)*(len + 1));
+ if (protoSetting->szMsg != NULL)
+ GetDlgItemText(hwndDlg, IDC_STSMSG, protoSetting->szMsg, len + 1);
}
- break;
+ SendMessage(GetParent(hwndDlg), UM_STSMSGDLGCLOSED, TRUE, 0);
+ EndDialog(hwndDlg, IDC_OK);
+ }
+ break;
case IDC_CANCEL:
SendMessage(GetParent(hwndDlg), UM_STSMSGDLGCLOSED, 0, 0);
@@ -111,25 +113,25 @@ static int SetStatusList(HWND hwndDlg)
LVITEM lvItem = { 0 };
lvItem.mask = LVIF_TEXT | LVIF_PARAM;
- for ( int i=0; i < confirmSettings->getCount(); i++ ) {
+ for (int i = 0; i < confirmSettings->getCount(); i++) {
lvItem.pszText = (*confirmSettings)[i].tszAccName;
if (ListView_GetItemCount(hList) < confirmSettings->getCount())
- ListView_InsertItem(hList,&lvItem);
+ ListView_InsertItem(hList, &lvItem);
int actualStatus;
- switch((*confirmSettings)[i].status) {
- case ID_STATUS_LAST: actualStatus = (*confirmSettings)[i].lastStatus; break;
- case ID_STATUS_CURRENT: actualStatus = CallProtoService((*confirmSettings)[i].szName,PS_GETSTATUS, 0, 0); break;
- default: actualStatus = (*confirmSettings)[i].status;
+ switch ((*confirmSettings)[i].status) {
+ case ID_STATUS_LAST: actualStatus = (*confirmSettings)[i].lastStatus; break;
+ case ID_STATUS_CURRENT: actualStatus = CallProtoService((*confirmSettings)[i].szName, PS_GETSTATUS, 0, 0); break;
+ default: actualStatus = (*confirmSettings)[i].status;
}
TCHAR* status = pcli->pfnGetStatusModeDescription(actualStatus, 0);
- switch((*confirmSettings)[i].status) {
+ switch ((*confirmSettings)[i].status) {
case ID_STATUS_LAST:
mir_sntprintf(buf, SIZEOF(buf), _T("%s (%s)"), TranslateT("<last>"), status);
ListView_SetItemText(hList, lvItem.iItem, 1, buf);
break;
case ID_STATUS_CURRENT:
- mir_sntprintf( buf, SIZEOF(buf), _T("%s (%s)"), TranslateT("<current>"), status);
+ mir_sntprintf(buf, SIZEOF(buf), _T("%s (%s)"), TranslateT("<current>"), status);
ListView_SetItemText(hList, lvItem.iItem, 1, buf);
break;
default:
@@ -137,10 +139,10 @@ static int SetStatusList(HWND hwndDlg)
}
// status message
- if ( !((!((CallProtoService((*confirmSettings)[i].szName, PS_GETCAPS, (WPARAM)PFLAGNUM_1, 0)&PF1_MODEMSGSEND)&~PF1_INDIVMODEMSG)) || (!(CallProtoService((*confirmSettings)[i].szName, PS_GETCAPS, (WPARAM)PFLAGNUM_3, 0)&Proto_Status2Flag(actualStatus))))) {
- TCHAR *msg = GetDefaultStatusMessage( &(*confirmSettings)[i], actualStatus );
- if ( msg != NULL ) {
- TCHAR* fMsg = variables_parsedup( msg, (*confirmSettings)[i].tszAccName, NULL );
+ if (!((!((CallProtoService((*confirmSettings)[i].szName, PS_GETCAPS, (WPARAM)PFLAGNUM_1, 0)&PF1_MODEMSGSEND)&~PF1_INDIVMODEMSG)) || (!(CallProtoService((*confirmSettings)[i].szName, PS_GETCAPS, (WPARAM)PFLAGNUM_3, 0)&Proto_Status2Flag(actualStatus))))) {
+ TCHAR *msg = GetDefaultStatusMessage(&(*confirmSettings)[i], actualStatus);
+ if (msg != NULL) {
+ TCHAR* fMsg = variables_parsedup(msg, (*confirmSettings)[i].tszAccName, NULL);
ListView_SetItemText(hList, lvItem.iItem, 2, fMsg);
mir_free(fMsg);
mir_free(msg);
@@ -152,36 +154,36 @@ static int SetStatusList(HWND hwndDlg)
ListView_SetColumnWidth(hList, 0, LVSCW_AUTOSIZE);
ListView_SetColumnWidth(hList, 2, LVSCW_AUTOSIZE);
lvItem.lParam = (LPARAM)&(*confirmSettings)[i];
- ListView_SetItem(hList,&lvItem);
+ ListView_SetItem(hList, &lvItem);
lvItem.iItem++;
}
// grey out status box
- EnableWindow(GetDlgItem(hwndDlg,IDC_STATUS), (ListView_GetNextItem(GetDlgItem(hwndDlg,IDC_STARTUPLIST),-1,LVNI_SELECTED)>=0));
+ EnableWindow(GetDlgItem(hwndDlg, IDC_STATUS), (ListView_GetNextItem(GetDlgItem(hwndDlg, IDC_STARTUPLIST), -1, LVNI_SELECTED) >= 0));
return 0;
}
-static INT_PTR CALLBACK ConfirmDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM lParam)
+static INT_PTR CALLBACK ConfirmDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
- switch(msg) {
+ switch (msg) {
case WM_INITDIALOG:
TranslateDialogDefault(hwndDlg);
{
HWND hList = GetDlgItem(hwndDlg, IDC_STARTUPLIST);
- SendMessage(hList,LVM_SETEXTENDEDLISTVIEWSTYLE,0,LVS_EX_FULLROWSELECT);
+ SendMessage(hList, LVM_SETEXTENDEDLISTVIEWSTYLE, 0, LVS_EX_FULLROWSELECT);
// create columns
LVCOLUMN lvCol = { 0 };
lvCol.mask = LVCF_TEXT | LVCF_WIDTH | LVCF_SUBITEM;
lvCol.pszText = TranslateT("Protocol");
- ListView_InsertColumn(hList, 0, &lvCol );
+ ListView_InsertColumn(hList, 0, &lvCol);
lvCol.cx = 100;
lvCol.pszText = TranslateT("Status");
- ListView_InsertColumn(hList, 1, &lvCol );
+ ListView_InsertColumn(hList, 1, &lvCol);
lvCol.pszText = TranslateT("Message");
- ListView_InsertColumn(hList, 2, &lvCol );
+ ListView_InsertColumn(hList, 2, &lvCol);
}
// create items
@@ -189,12 +191,12 @@ static INT_PTR CALLBACK ConfirmDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARA
EnableWindow(GetDlgItem(hwndDlg, IDC_SETSTSMSG), FALSE);
// fill profile combo box
- if ( !ServiceExists(MS_SS_GETPROFILE))
+ if (!ServiceExists(MS_SS_GETPROFILE))
EnableWindow(GetDlgItem(hwndDlg, IDC_PROFILE), FALSE);
else {
int defaultProfile;
int profileCount = (int)CallService(MS_SS_GETPROFILECOUNT, (WPARAM)&defaultProfile, 0);
- for (int i=0; i < profileCount; i++) {
+ for (int i = 0; i < profileCount; i++) {
TCHAR profileName[128];
CallService(MS_SS_GETPROFILENAME, i, (LPARAM)profileName);
int item = SendDlgItemMessage(hwndDlg, IDC_PROFILE, CB_ADDSTRING, 0, (LPARAM)profileName);
@@ -215,96 +217,96 @@ static INT_PTR CALLBACK ConfirmDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARA
return TRUE;
case WM_TIMER:
- {
- TCHAR text[32];
- mir_sntprintf(text, SIZEOF(text), TranslateT("Closing in %d"), timeOut-1);
- SetDlgItemText(hwndDlg, IDC_CLOSE, text);
- if (timeOut <= 0) {
- KillTimer(hwndDlg, TIMER_ID);
- SendMessage(hwndDlg, UM_CLOSECONFIRMDLG, 0, 0);
- }
- else timeOut--;
- }
- break;
+ {
+ TCHAR text[32];
+ mir_sntprintf(text, SIZEOF(text), TranslateT("Closing in %d"), timeOut - 1);
+ SetDlgItemText(hwndDlg, IDC_CLOSE, text);
+ if (timeOut <= 0) {
+ KillTimer(hwndDlg, TIMER_ID);
+ SendMessage(hwndDlg, UM_CLOSECONFIRMDLG, 0, 0);
+ }
+ else timeOut--;
+ }
+ break;
case WM_COMMAND:
// stop timer
KillTimer(hwndDlg, TIMER_ID);
SetDlgItemText(hwndDlg, IDC_CLOSE, TranslateT("Close"));
- if ( (HIWORD(wParam) == CBN_SELCHANGE) || (HIWORD(wParam) == BN_CLICKED) || (HIWORD(wParam) == NM_CLICK)) { // something clicked
+ if ((HIWORD(wParam) == CBN_SELCHANGE) || (HIWORD(wParam) == BN_CLICKED) || (HIWORD(wParam) == NM_CLICK)) { // something clicked
switch (LOWORD(wParam)) {
case IDC_PROFILE:
- {
- int profile = (int)SendDlgItemMessage(hwndDlg, IDC_PROFILE, CB_GETITEMDATA, SendDlgItemMessage(hwndDlg, IDC_PROFILE, CB_GETCURSEL, 0, 0), 0);
- for (int i=0; i < confirmSettings->getCount(); i++)
- if ((*confirmSettings)[i].szMsg != NULL) {
- free((*confirmSettings)[i].szMsg);
- (*confirmSettings)[i].szMsg = NULL;
- }
-
- CallService(MS_SS_GETPROFILE, (WPARAM)profile, (LPARAM)confirmSettings);
- for (int i=0; i < confirmSettings->getCount(); i++)
- if ((*confirmSettings)[i].szMsg != NULL) // we free this later, copy to our memory space
- (*confirmSettings)[i].szMsg = _tcsdup((*confirmSettings)[i].szMsg);
+ {
+ int profile = (int)SendDlgItemMessage(hwndDlg, IDC_PROFILE, CB_GETITEMDATA, SendDlgItemMessage(hwndDlg, IDC_PROFILE, CB_GETCURSEL, 0, 0), 0);
+ for (int i = 0; i < confirmSettings->getCount(); i++)
+ if ((*confirmSettings)[i].szMsg != NULL) {
+ free((*confirmSettings)[i].szMsg);
+ (*confirmSettings)[i].szMsg = NULL;
+ }
- SetStatusList(hwndDlg);
- }
- break;
+ CallService(MS_SS_GETPROFILE, (WPARAM)profile, (LPARAM)confirmSettings);
+ for (int i = 0; i < confirmSettings->getCount(); i++)
+ if ((*confirmSettings)[i].szMsg != NULL) // we free this later, copy to our memory space
+ (*confirmSettings)[i].szMsg = _tcsdup((*confirmSettings)[i].szMsg);
+
+ SetStatusList(hwndDlg);
+ }
+ break;
case IDC_STATUS:
- {
- LVITEM lvItem = { 0 };
- lvItem.mask = LVIF_TEXT | LVIF_PARAM;
- lvItem.iSubItem = 0;
- lvItem.iItem = ListView_GetNextItem(GetDlgItem(hwndDlg,IDC_STARTUPLIST),-1,LVNI_SELECTED);
- if (lvItem.iItem == -1)
- break;
-
- ListView_GetItem(GetDlgItem(hwndDlg, IDC_STARTUPLIST), &lvItem);
- PROTOCOLSETTINGEX* proto = (PROTOCOLSETTINGEX*)lvItem.lParam;
- int actualStatus = proto->status = (int)SendDlgItemMessage(hwndDlg, IDC_STATUS, CB_GETITEMDATA, SendDlgItemMessage(hwndDlg, IDC_STATUS, CB_GETCURSEL, 0, 0), 0);
-
- // LAST STATUS
- if (proto->status == ID_STATUS_LAST) {
- TCHAR last[80];
- mir_sntprintf(last, SIZEOF(last), _T("%s (%s)"), TranslateT("<last>"), pcli->pfnGetStatusModeDescription(proto->lastStatus, 0));
- ListView_SetItemText(GetDlgItem(hwndDlg,IDC_STARTUPLIST), lvItem.iItem, 1, last);
- actualStatus = proto->lastStatus;
- }
+ {
+ LVITEM lvItem = { 0 };
+ lvItem.mask = LVIF_TEXT | LVIF_PARAM;
+ lvItem.iSubItem = 0;
+ lvItem.iItem = ListView_GetNextItem(GetDlgItem(hwndDlg, IDC_STARTUPLIST), -1, LVNI_SELECTED);
+ if (lvItem.iItem == -1)
+ break;
- // CURRENT STATUS
- else if (proto->status == ID_STATUS_CURRENT) {
- int currentStatus = CallProtoService(proto->szName,PS_GETSTATUS, 0, 0);
- TCHAR current[80];
- mir_sntprintf(current, SIZEOF(current), _T("%s (%s)"), TranslateT("<current>"), pcli->pfnGetStatusModeDescription(currentStatus, 0));
- ListView_SetItemText(GetDlgItem(hwndDlg,IDC_STARTUPLIST), lvItem.iItem, 1, current);
- actualStatus = currentStatus;
- }
- else ListView_SetItemText(GetDlgItem(hwndDlg,IDC_STARTUPLIST), lvItem.iItem, 1, pcli->pfnGetStatusModeDescription(proto->status, 0));
-
- if ((!((CallProtoService(proto->szName, PS_GETCAPS, (WPARAM)PFLAGNUM_1, 0)&PF1_MODEMSGSEND)&~PF1_INDIVMODEMSG)) || (!(CallProtoService(proto->szName, PS_GETCAPS, (WPARAM)PFLAGNUM_3, 0)&Proto_Status2Flag(actualStatus))))
- EnableWindow(GetDlgItem(hwndDlg, IDC_SETSTSMSG), FALSE);
- else if ( (proto->status == ID_STATUS_LAST) || (proto->status == ID_STATUS_CURRENT))
- EnableWindow(GetDlgItem(hwndDlg, IDC_SETSTSMSG), TRUE);
- else
- EnableWindow(GetDlgItem(hwndDlg, IDC_SETSTSMSG), (CallProtoService(proto->szName, PS_GETCAPS, (WPARAM)PFLAGNUM_3, 0)&Proto_Status2Flag(actualStatus))?TRUE:FALSE);
- SetStatusList(hwndDlg);
+ ListView_GetItem(GetDlgItem(hwndDlg, IDC_STARTUPLIST), &lvItem);
+ PROTOCOLSETTINGEX* proto = (PROTOCOLSETTINGEX*)lvItem.lParam;
+ int actualStatus = proto->status = (int)SendDlgItemMessage(hwndDlg, IDC_STATUS, CB_GETITEMDATA, SendDlgItemMessage(hwndDlg, IDC_STATUS, CB_GETCURSEL, 0, 0), 0);
+
+ // LAST STATUS
+ if (proto->status == ID_STATUS_LAST) {
+ TCHAR last[80];
+ mir_sntprintf(last, SIZEOF(last), _T("%s (%s)"), TranslateT("<last>"), pcli->pfnGetStatusModeDescription(proto->lastStatus, 0));
+ ListView_SetItemText(GetDlgItem(hwndDlg, IDC_STARTUPLIST), lvItem.iItem, 1, last);
+ actualStatus = proto->lastStatus;
}
- break;
- case IDC_SETSTSMSG:
- {
- LVITEM lvItem = { 0 };
- lvItem.mask=LVIF_TEXT|LVIF_PARAM;
- lvItem.iSubItem=0;
- lvItem.iItem = ListView_GetNextItem(GetDlgItem(hwndDlg,IDC_STARTUPLIST),-1,LVNI_SELECTED);
- if (lvItem.iItem == -1)
- break;
-
- ListView_GetItem(GetDlgItem(hwndDlg,IDC_STARTUPLIST), &lvItem);
- DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_SETSTSMSGDIALOG), hwndDlg, StatusMessageDlgProc, lvItem.lParam);
+ // CURRENT STATUS
+ else if (proto->status == ID_STATUS_CURRENT) {
+ int currentStatus = CallProtoService(proto->szName, PS_GETSTATUS, 0, 0);
+ TCHAR current[80];
+ mir_sntprintf(current, SIZEOF(current), _T("%s (%s)"), TranslateT("<current>"), pcli->pfnGetStatusModeDescription(currentStatus, 0));
+ ListView_SetItemText(GetDlgItem(hwndDlg, IDC_STARTUPLIST), lvItem.iItem, 1, current);
+ actualStatus = currentStatus;
}
- break;
+ else ListView_SetItemText(GetDlgItem(hwndDlg, IDC_STARTUPLIST), lvItem.iItem, 1, pcli->pfnGetStatusModeDescription(proto->status, 0));
+
+ if ((!((CallProtoService(proto->szName, PS_GETCAPS, (WPARAM)PFLAGNUM_1, 0)&PF1_MODEMSGSEND)&~PF1_INDIVMODEMSG)) || (!(CallProtoService(proto->szName, PS_GETCAPS, (WPARAM)PFLAGNUM_3, 0)&Proto_Status2Flag(actualStatus))))
+ EnableWindow(GetDlgItem(hwndDlg, IDC_SETSTSMSG), FALSE);
+ else if ((proto->status == ID_STATUS_LAST) || (proto->status == ID_STATUS_CURRENT))
+ EnableWindow(GetDlgItem(hwndDlg, IDC_SETSTSMSG), TRUE);
+ else
+ EnableWindow(GetDlgItem(hwndDlg, IDC_SETSTSMSG), (CallProtoService(proto->szName, PS_GETCAPS, (WPARAM)PFLAGNUM_3, 0)&Proto_Status2Flag(actualStatus)) ? TRUE : FALSE);
+ SetStatusList(hwndDlg);
+ }
+ break;
+
+ case IDC_SETSTSMSG:
+ {
+ LVITEM lvItem = { 0 };
+ lvItem.mask = LVIF_TEXT | LVIF_PARAM;
+ lvItem.iSubItem = 0;
+ lvItem.iItem = ListView_GetNextItem(GetDlgItem(hwndDlg, IDC_STARTUPLIST), -1, LVNI_SELECTED);
+ if (lvItem.iItem == -1)
+ break;
+
+ ListView_GetItem(GetDlgItem(hwndDlg, IDC_STARTUPLIST), &lvItem);
+ DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_SETSTSMSGDIALOG), hwndDlg, StatusMessageDlgProc, lvItem.lParam);
+ }
+ break;
case IDC_CLOSE:
SendMessage(hwndDlg, UM_CLOSECONFIRMDLG, 0, 0);
@@ -318,7 +320,7 @@ static INT_PTR CALLBACK ConfirmDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARA
break;
case WM_NOTIFY:
- switch(((NMHDR*)lParam)->idFrom) {
+ switch (((NMHDR*)lParam)->idFrom) {
case IDC_STARTUPLIST:
if (((NMHDR*)lParam)->code == NM_CLICK) {
KillTimer(hwndDlg, TIMER_ID);
@@ -327,15 +329,15 @@ static INT_PTR CALLBACK ConfirmDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARA
LVITEM lvItem = { 0 };
lvItem.mask = LVIF_TEXT | LVIF_PARAM;
lvItem.iSubItem = 0;
- lvItem.iItem = ListView_GetNextItem(GetDlgItem(hwndDlg,IDC_STARTUPLIST),-1,LVNI_SELECTED);
+ lvItem.iItem = ListView_GetNextItem(GetDlgItem(hwndDlg, IDC_STARTUPLIST), -1, LVNI_SELECTED);
- if ( ListView_GetItem(GetDlgItem(hwndDlg,IDC_STARTUPLIST), &lvItem) == FALSE) {
+ if (ListView_GetItem(GetDlgItem(hwndDlg, IDC_STARTUPLIST), &lvItem) == FALSE) {
SetStatusList(hwndDlg);
break;
}
PROTOCOLSETTINGEX *proto = (PROTOCOLSETTINGEX*)lvItem.lParam;
- int flags = CallProtoService(proto->szName, PS_GETCAPS,PFLAGNUM_2,0) & ~CallProtoService(proto->szName, PS_GETCAPS, (WPARAM)PFLAGNUM_5, 0);
+ int flags = CallProtoService(proto->szName, PS_GETCAPS, PFLAGNUM_2, 0) & ~CallProtoService(proto->szName, PS_GETCAPS, (WPARAM)PFLAGNUM_5, 0);
// clear box and add new status, loop status and check if compatible with proto
SendDlgItemMessage(hwndDlg, IDC_STATUS, CB_RESETCONTENT, 0, 0);
int actualStatus = proto->status;
@@ -343,15 +345,15 @@ static INT_PTR CALLBACK ConfirmDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARA
// last
TCHAR buf[100];
mir_sntprintf(buf, SIZEOF(buf), _T("%s (%s)"), TranslateT("<last>"), pcli->pfnGetStatusModeDescription(proto->lastStatus, 0));
- int item = SendDlgItemMessage( hwndDlg, IDC_STATUS, CB_ADDSTRING, 0, (LPARAM)buf );
+ int item = SendDlgItemMessage(hwndDlg, IDC_STATUS, CB_ADDSTRING, 0, (LPARAM)buf);
SendDlgItemMessage(hwndDlg, IDC_STATUS, CB_SETITEMDATA, item, ID_STATUS_LAST);
if (proto->status == ID_STATUS_LAST) {
- SendDlgItemMessage(hwndDlg,IDC_STATUS,CB_SETCURSEL, item, 0);
+ SendDlgItemMessage(hwndDlg, IDC_STATUS, CB_SETCURSEL, item, 0);
actualStatus = proto->lastStatus;
}
// current
- int currentStatus = CallProtoService(proto->szName,PS_GETSTATUS, 0, 0);
+ int currentStatus = CallProtoService(proto->szName, PS_GETSTATUS, 0, 0);
mir_sntprintf(buf, SIZEOF(buf), _T("%s (%s)"), TranslateT("<current>"), pcli->pfnGetStatusModeDescription(currentStatus, 0));
item = SendDlgItemMessage(hwndDlg, IDC_STATUS, CB_ADDSTRING, 0, (LPARAM)buf);
SendDlgItemMessage(hwndDlg, IDC_STATUS, CB_SETITEMDATA, item, ID_STATUS_CURRENT);
@@ -360,8 +362,8 @@ static INT_PTR CALLBACK ConfirmDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARA
actualStatus = currentStatus;
}
- for (int i=0; i < SIZEOF(statusModeList); i++) {
- if ( ((flags & statusModePf2List[i]) || (statusModePf2List[i] == PF2_OFFLINE)) && (!((!(flags) & Proto_Status2Flag(statusModePf2List[i]))) || ((CallProtoService(proto->szName, PS_GETCAPS, (WPARAM)PFLAGNUM_5, 0)&Proto_Status2Flag(statusModePf2List[i]))))) {
+ for (int i = 0; i < SIZEOF(statusModeList); i++) {
+ if (((flags & statusModePf2List[i]) || (statusModePf2List[i] == PF2_OFFLINE)) && (!((!(flags)& Proto_Status2Flag(statusModePf2List[i]))) || ((CallProtoService(proto->szName, PS_GETCAPS, (WPARAM)PFLAGNUM_5, 0)&Proto_Status2Flag(statusModePf2List[i]))))) {
TCHAR *statusMode = pcli->pfnGetStatusModeDescription(statusModeList[i], 0);
item = SendDlgItemMessage(hwndDlg, IDC_STATUS, CB_ADDSTRING, 0, (LPARAM)statusMode);
SendDlgItemMessage(hwndDlg, IDC_STATUS, CB_SETITEMDATA, item, statusModeList[i]);
@@ -371,13 +373,13 @@ static INT_PTR CALLBACK ConfirmDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARA
}
// enable status box
- EnableWindow(GetDlgItem(hwndDlg,IDC_STATUS), (ListView_GetNextItem(GetDlgItem(hwndDlg,IDC_STARTUPLIST),-1,LVNI_SELECTED)>=0));
- if ( (!((CallProtoService(proto->szName, PS_GETCAPS, PFLAGNUM_1, 0)&PF1_MODEMSGSEND)&~PF1_INDIVMODEMSG)) || (!(CallProtoService(proto->szName, PS_GETCAPS, PFLAGNUM_3, 0)&Proto_Status2Flag(actualStatus))))
+ EnableWindow(GetDlgItem(hwndDlg, IDC_STATUS), (ListView_GetNextItem(GetDlgItem(hwndDlg, IDC_STARTUPLIST), -1, LVNI_SELECTED) >= 0));
+ if ((!((CallProtoService(proto->szName, PS_GETCAPS, PFLAGNUM_1, 0)&PF1_MODEMSGSEND)&~PF1_INDIVMODEMSG)) || (!(CallProtoService(proto->szName, PS_GETCAPS, PFLAGNUM_3, 0)&Proto_Status2Flag(actualStatus))))
EnableWindow(GetDlgItem(hwndDlg, IDC_SETSTSMSG), FALSE);
else if (proto->status == ID_STATUS_LAST || proto->status == ID_STATUS_CURRENT)
EnableWindow(GetDlgItem(hwndDlg, IDC_SETSTSMSG), TRUE);
else
- EnableWindow(GetDlgItem(hwndDlg, IDC_SETSTSMSG), (CallProtoService(proto->szName, PS_GETCAPS, PFLAGNUM_3, 0) & Proto_Status2Flag(actualStatus))?TRUE:FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_SETSTSMSG), (CallProtoService(proto->szName, PS_GETCAPS, PFLAGNUM_3, 0) & Proto_Status2Flag(actualStatus)) ? TRUE : FALSE);
}
}
break;
@@ -401,15 +403,15 @@ static INT_PTR CALLBACK ConfirmDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARA
INT_PTR ShowConfirmDialogEx(WPARAM wParam, LPARAM lParam)
{
- if ( wParam == 0 )
+ if (wParam == 0)
return -1;
delete confirmSettings;
confirmSettings = new OBJLIST<TConfirmSetting>(10, CompareSettings);
- OBJLIST<PROTOCOLSETTINGEX>& param = *( OBJLIST<PROTOCOLSETTINGEX>* )wParam;
- for (int i=0; i < param.getCount(); i++)
- confirmSettings->insert( new TConfirmSetting( param[i] ));
+ OBJLIST<PROTOCOLSETTINGEX>& param = *(OBJLIST<PROTOCOLSETTINGEX>*)wParam;
+ for (int i = 0; i < param.getCount(); i++)
+ confirmSettings->insert(new TConfirmSetting(param[i]));
timeOut = lParam;
if (timeOut < 0)