From da9a433d8d2eca414ce34399f855dd607c7bb4ef Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 4 Dec 2013 18:06:39 +0000 Subject: KeepStatus: - nasty clutch for IRC's reconnect removed - version bump git-svn-id: http://svn.miranda-ng.org/main/trunk@7049 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/StatusPlugins/KeepStatus/keepstatus.cpp | 33 ++++++--------- plugins/StatusPlugins/KeepStatus/keepstatus.h | 1 - plugins/StatusPlugins/KeepStatus/version.h | 56 ++++++++++++------------- 3 files changed, 40 insertions(+), 50 deletions(-) (limited to 'plugins/StatusPlugins') diff --git a/plugins/StatusPlugins/KeepStatus/keepstatus.cpp b/plugins/StatusPlugins/KeepStatus/keepstatus.cpp index 1e710ba312..6402c42a0f 100644 --- a/plugins/StatusPlugins/KeepStatus/keepstatus.cpp +++ b/plugins/StatusPlugins/KeepStatus/keepstatus.cpp @@ -253,14 +253,13 @@ static int GetStatus(const TConnectionSettings& cs) static int SetCurrentStatus() { - int realStatus; PROTOCOLSETTINGEX **ps = GetCurrentProtoSettingsCopy(); for (int 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) || ( db_get_b(NULL, ps[i]->szName, SETTING_PROTORETRY, 0))) { // ignore this proto by removing it's name (not so nice) + 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 = ""; } - else if ( (ps[i]->status != ID_STATUS_DISABLED) && (ps[i]->status != realStatus) && (realStatus != ID_STATUS_OFFLINE) && ( db_get_b(NULL, MODULENAME, SETTING_FIRSTOFFLINE, FALSE))) { + else if ((ps[i]->status != ID_STATUS_DISABLED) && (ps[i]->status != realStatus) && (realStatus != ID_STATUS_OFFLINE) && (db_get_b(NULL, MODULENAME, SETTING_FIRSTOFFLINE, FALSE))) { // force offline before reconnecting log_infoA("KeepStatus: Setting %s offline before making a new connection attempt", ps[i]->szName); CallProtoService(ps[i]->szName, PS_SETSTATUS, (WPARAM)ID_STATUS_OFFLINE, 0); @@ -524,7 +523,7 @@ static int ProcessProtoAck(WPARAM,LPARAM lParam) { ACKDATA *ack=(ACKDATA*)lParam; - if ( (ack->type != ACKTYPE_STATUS) && (ack->type != ACKTYPE_LOGIN)) + if (ack->type != ACKTYPE_STATUS && ack->type != ACKTYPE_LOGIN) return 0; char dbSetting[128]; @@ -532,15 +531,10 @@ static int ProcessProtoAck(WPARAM,LPARAM lParam) if (!db_get_b(NULL, MODULENAME, dbSetting, 1)) return 0; - if ( db_get_b(NULL, ack->szModule, SETTING_PROTORETRY, 0)) { - log_infoA("KeepStatus: %s has built-in reconnection enabled", ack->szModule); - return 0; - } - - if ( ack->type == ACKTYPE_STATUS && ack->result == ACKRESULT_SUCCESS ) { - for (int i=0; i < connectionSettings.getCount(); i++ ) { + if (ack->type == ACKTYPE_STATUS && ack->result == ACKRESULT_SUCCESS) { + for (int i = 0; i < connectionSettings.getCount(); i++) { TConnectionSettings& cs = connectionSettings[i]; - if ( !strcmp( cs.szName, ack->szModule )) + if (!strcmp(cs.szName, ack->szModule)) cs.lastStatusAckTime = GetTickCount(); } StartTimer(IDT_PROCESSACK, 0, FALSE); @@ -549,14 +543,13 @@ static int ProcessProtoAck(WPARAM,LPARAM lParam) if (ack->type == ACKTYPE_LOGIN) { if (ack->lParam == LOGINERR_OTHERLOCATION) { - - for (int i=0;iszModule, cs.szName)) { AssignStatus(&cs, ID_STATUS_OFFLINE, 0, NULL); - if ( db_get_b(NULL, MODULENAME, SETTING_CNCOTHERLOC, 0)) { + if (db_get_b(NULL, MODULENAME, SETTING_CNCOTHERLOC, 0)) { StopTimer(IDT_PROCESSACK); - for (int j=0;jszModule); - for ( int i=0; i szModule, cs.szName)) AssignStatus(&cs, ID_STATUS_OFFLINE, 0, NULL); @@ -607,7 +600,7 @@ static VOID CALLBACK CheckConnectingTimer(HWND hwnd,UINT message,UINT_PTR idEven StopTimer(IDT_CHECKCONNECTING); //log_debugA("KeepStatus: CheckConnectingTimer"); - for (int i=0;i