summaryrefslogtreecommitdiff
path: root/src/core/stdautoaway
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2014-02-27 13:50:53 +0000
committerGeorge Hazan <george.hazan@gmail.com>2014-02-27 13:50:53 +0000
commit5f8a607f900a42e27bf166b86185001aadf3e9f2 (patch)
tree6c69f5caebc55e84437ddc23013fada0a69af397 /src/core/stdautoaway
parent5e0f2fb896d874f9b7f5c069a90de64305089542 (diff)
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
Diffstat (limited to 'src/core/stdautoaway')
-rw-r--r--src/core/stdautoaway/autoaway.cpp27
1 files changed, 9 insertions, 18 deletions
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;