From 5f8a607f900a42e27bf166b86185001aadf3e9f2 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 27 Feb 2014 13:50:53 +0000 Subject: more fun: - MS_AWAYMSG_GETSTATUSMSGW/T is present in any MIID_SRAWAY plugin, so there's no need to check its existence; - therefore MS_AWAYMSG_GETSTATUSMSG considered useless, cause it has no references git-svn-id: http://svn.miranda-ng.org/main/trunk@8293 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- src/core/stdautoaway/autoaway.cpp | 27 +++++++++------------------ 1 file changed, 9 insertions(+), 18 deletions(-) (limited to 'src/core/stdautoaway') diff --git a/src/core/stdautoaway/autoaway.cpp b/src/core/stdautoaway/autoaway.cpp index 94980f4368..f515a26ad8 100644 --- a/src/core/stdautoaway/autoaway.cpp +++ b/src/core/stdautoaway/autoaway.cpp @@ -35,12 +35,12 @@ static int AutoAwaySound(WPARAM, LPARAM lParam) /////////////////////////////////////////////////////////////////////////////// -static bool Proto_IsAccountEnabled(PROTOACCOUNT* pa) +static bool Proto_IsAccountEnabled(PROTOACCOUNT *pa) { return pa && ((pa->bIsEnabled && !pa->bDynDisabled) || pa->bOldProto); } -static bool Proto_IsAccountLocked(PROTOACCOUNT* pa) +static bool Proto_IsAccountLocked(PROTOACCOUNT *pa) { return pa && db_get_b(NULL, pa->szModuleName, "LockMainStatus", 0) != 0; } @@ -48,18 +48,9 @@ static bool Proto_IsAccountLocked(PROTOACCOUNT* pa) static void Proto_SetStatus(const char* szProto, unsigned status) { if (CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGSEND) { - TCHAR* awayMsg = (TCHAR*)CallService(MS_AWAYMSG_GETSTATUSMSGW, (WPARAM) status, (LPARAM) szProto); - if ((INT_PTR)awayMsg == CALLSERVICE_NOTFOUND) { - char* awayMsgA = (char*)CallService(MS_AWAYMSG_GETSTATUSMSG, (WPARAM) status, (LPARAM) szProto); - if ((INT_PTR)awayMsgA != CALLSERVICE_NOTFOUND) { - awayMsg = mir_a2t(awayMsgA); - mir_free(awayMsgA); - } - } - if ((INT_PTR)awayMsg != CALLSERVICE_NOTFOUND) { - CallProtoService(szProto, PS_SETAWAYMSGT, status, (LPARAM) awayMsg); - mir_free(awayMsg); - } + TCHAR *awayMsg = (TCHAR*)CallService(MS_AWAYMSG_GETSTATUSMSGW, status, (LPARAM)szProto); + CallProtoService(szProto, PS_SETAWAYMSGT, status, (LPARAM)awayMsg); + mir_free(awayMsg); } CallProtoService(szProto, PS_SETSTATUS, status, 0); @@ -81,15 +72,15 @@ static int AutoAwayEvent(WPARAM, LPARAM lParam) PROTOACCOUNT** accounts; ProtoEnumAccounts(&numAccounts, &accounts); - for (int i=0; i < numAccounts; i++) { - PROTOACCOUNT* pa = accounts[i]; - if ( !Proto_IsAccountEnabled(pa) || Proto_IsAccountLocked(pa)) + for (int i = 0; i < numAccounts; i++) { + PROTOACCOUNT *pa = accounts[i]; + if (!Proto_IsAccountEnabled(pa) || Proto_IsAccountLocked(pa)) continue; int currentstatus = CallProtoService(pa->szModuleName, PS_GETSTATUS, 0, 0); int statusbits = CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_2, 0); int status = mii.aaStatus; - if ( !(statusbits & Proto_Status2Flag(status))) { + if (!(statusbits & Proto_Status2Flag(status))) { // the protocol doesnt support the given status if (statusbits & Proto_Status2Flag(ID_STATUS_AWAY)) status = ID_STATUS_AWAY; -- cgit v1.2.3