summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2012-07-19 20:20:22 +0000
committerGeorge Hazan <george.hazan@gmail.com>2012-07-19 20:20:22 +0000
commitd58766cc83b162eaca5cbdf4e9e204305968b435 (patch)
tree9bc0010b2266670346c48a937a05755f7e0a4a97
parent9cefaaec02616cbda530ef58afb9be013499c1d6 (diff)
code cleaning
git-svn-id: http://svn.miranda-ng.org/main/trunk@1053 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r--plugins/StatusPlugins/KeepStatus/keepstatus.cpp10
-rw-r--r--plugins/StatusPlugins/StartupStatus/main.cpp1
-rw-r--r--plugins/StatusPlugins/commonstatus.cpp18
-rw-r--r--plugins/StatusPlugins/commonstatus.h8
-rw-r--r--plugins/StatusPlugins/confirmdialog.cpp2
5 files changed, 17 insertions, 22 deletions
diff --git a/plugins/StatusPlugins/KeepStatus/keepstatus.cpp b/plugins/StatusPlugins/KeepStatus/keepstatus.cpp
index b451325c19..cc4903a511 100644
--- a/plugins/StatusPlugins/KeepStatus/keepstatus.cpp
+++ b/plugins/StatusPlugins/KeepStatus/keepstatus.cpp
@@ -223,7 +223,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]);
@@ -250,7 +250,7 @@ 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 && _tcscmp(szMsg, cs->szMsg)) {
+ if ( szMsg != NULL && lstrcmp(szMsg, cs->szMsg)) {
if ( cs->szMsg != NULL )
free(cs->szMsg);
@@ -277,10 +277,8 @@ static int GetStatus(const TConnectionSettings& cs)
static int SetCurrentStatus()
{
int ret, i, realStatus;
- PROTOCOLSETTINGEX **ps;
-
- ps = GetCurrentProtoSettingsCopy();
- for (i=0;i<connectionSettings.getCount();i++) {
+ PROTOCOLSETTINGEX **ps = GetCurrentProtoSettingsCopy();
+ for (i=0; i < connectionSettings.getCount(); i++) {
realStatus = CallProtoService(ps[i]->szName, PS_GETSTATUS, 0, 0);
if ( (ps[i]->status == ID_STATUS_DISABLED) || (ps[i]->status == realStatus) || (DBGetContactSettingByte(NULL, ps[i]->szName, SETTING_PROTORETRY, 0))) { // ignore this proto by removing it's name (not so nice)
ps[i]->szName = "";
diff --git a/plugins/StatusPlugins/StartupStatus/main.cpp b/plugins/StatusPlugins/StartupStatus/main.cpp
index d28c6a9265..9765482835 100644
--- a/plugins/StatusPlugins/StartupStatus/main.cpp
+++ b/plugins/StatusPlugins/StartupStatus/main.cpp
@@ -30,7 +30,6 @@ static HANDLE
HINSTANCE hInst;
-
int hLangpack = 0;
int CSModuleLoaded( WPARAM, LPARAM );
diff --git a/plugins/StatusPlugins/commonstatus.cpp b/plugins/StatusPlugins/commonstatus.cpp
index 3c7ca4251f..d02986a275 100644
--- a/plugins/StatusPlugins/commonstatus.cpp
+++ b/plugins/StatusPlugins/commonstatus.cpp
@@ -251,14 +251,14 @@ INT_PTR SetStatusEx(WPARAM wParam, LPARAM lParam)
NotifyEventHooks( hCSStatusChangedExEvent, ( WPARAM )&protoSettings, 0 );
// set all status messages first
- for ( int i=0; i < protoList->getCount(); i++ ) {
+ for (int i=0; i < protoList->getCount(); i++) {
char* szProto = protoSettings[i]->szName;
- if ( !CallService( MS_PROTO_ISPROTOCOLLOADED, 0, (LPARAM)szProto )) {
+ if ( !CallService(MS_PROTO_ISPROTOCOLLOADED, 0, (LPARAM)szProto)) {
log_debugA( "CommonStatus: %s is not loaded", szProto );
continue;
}
// some checks
- int newstatus = GetActualStatus( protoSettings[i] );
+ int newstatus = GetActualStatus(protoSettings[i]);
if (newstatus == 0) {
log_debugA("CommonStatus: incorrect status for %s (%d)", szProto, protoSettings[i]->status);
continue;
@@ -275,7 +275,7 @@ INT_PTR SetStatusEx(WPARAM wParam, LPARAM lParam)
long protoFlag = Proto_Status2Flag( newstatus );
int b_Caps2 = CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_2, 0) & protoFlag;
int b_Caps5 = CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_5, 0) & protoFlag;
- if ( newstatus != ID_STATUS_OFFLINE && ( !b_Caps2 || b_Caps5 )) {
+ if (newstatus != ID_STATUS_OFFLINE && ( !b_Caps2 || b_Caps5)) {
// status and status message for this status not supported
//log_debug("CommonStatus: status not supported %s", szProto);
continue;
@@ -283,15 +283,21 @@ INT_PTR SetStatusEx(WPARAM wParam, LPARAM lParam)
int b_Caps1 = CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGSEND & ~PF1_INDIVMODEMSG;
int b_Caps3 = CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_3, 0) & protoFlag;
- if ( newstatus == oldstatus && ( !b_Caps1 || !b_Caps3 )) {
+ if (newstatus == oldstatus && (!b_Caps1 || !b_Caps3)) {
// no status change and status messages are not supported
//log_debug("CommonStatus: no change, %s (%d %d)", szProto, oldstatus, newstatus);
continue;
}
// set status message first
- if ( b_Caps1 && b_Caps3 )
+ if (b_Caps1 && b_Caps3)
SetStatusMsg( protoSettings[i], newstatus );
+
+ // set the status
+ if (newstatus != oldstatus) {
+ log_debugA("CommonStatus sets status for %s to %d", szProto, newstatus);
+ CallProtoService(szProto, PS_SETSTATUS, (WPARAM)newstatus, 0);
+ }
}
if ( globStatus != 0 ) {
diff --git a/plugins/StatusPlugins/commonstatus.h b/plugins/StatusPlugins/commonstatus.h
index 6bd7c562d4..8eccbc3a8f 100644
--- a/plugins/StatusPlugins/commonstatus.h
+++ b/plugins/StatusPlugins/commonstatus.h
@@ -56,14 +56,6 @@
#include "../helpers/gen_helpers.h"
-typedef struct {
- int cbSize;
- char *szName; // pointer to protocol modulename
- char *szMsg; // pointer to the status message (may be NULL)
- WORD status; // the status
- WORD lastStatus;// last status
-} PROTOCOLSETTINGEX_V1;
-
#define UM_STSMSGDLGCLOSED WM_APP+1
#define UM_CLOSECONFIRMDLG WM_APP+2
diff --git a/plugins/StatusPlugins/confirmdialog.cpp b/plugins/StatusPlugins/confirmdialog.cpp
index da3f428062..ffaf7a4c9f 100644
--- a/plugins/StatusPlugins/confirmdialog.cpp
+++ b/plugins/StatusPlugins/confirmdialog.cpp
@@ -288,7 +288,7 @@ static BOOL CALLBACK ConfirmDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM l
else ListView_SetItemText(GetDlgItem(hwndDlg,IDC_STARTUPLIST), lvItem.iItem, 1,
( TCHAR* )CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, proto->status, GSMDF_TCHAR ));
- 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))))
+ 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);