From 51f835c7711083e9b3288eaa8d4513f6ee955a45 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 23 Jan 2019 15:52:20 +0300 Subject: code cleaning --- protocols/FacebookRM/src/contacts.cpp | 5 ----- protocols/FacebookRM/src/proto.h | 1 - protocols/Gadu-Gadu/src/gg_proto.cpp | 21 ++++++--------------- protocols/MSN/src/msn_proto.cpp | 2 +- protocols/Twitter/src/contacts.cpp | 8 ++------ 5 files changed, 9 insertions(+), 28 deletions(-) diff --git a/protocols/FacebookRM/src/contacts.cpp b/protocols/FacebookRM/src/contacts.cpp index 300abe9649..15471d2819 100644 --- a/protocols/FacebookRM/src/contacts.cpp +++ b/protocols/FacebookRM/src/contacts.cpp @@ -541,11 +541,6 @@ void FacebookProto::RefreshUserInfo(void *data) ProtoBroadcastAck(hContact, ACKTYPE_GETINFO, ACKRESULT_SUCCESS, nullptr); } -HANDLE FacebookProto::GetAwayMsg(MCONTACT) -{ - return nullptr; // Status messages are disabled -} - void FacebookProto::OnContactDeleted(MCONTACT hContact) { // Remove this contact from caches diff --git a/protocols/FacebookRM/src/proto.h b/protocols/FacebookRM/src/proto.h index e4cba9e30f..f635e33b83 100644 --- a/protocols/FacebookRM/src/proto.h +++ b/protocols/FacebookRM/src/proto.h @@ -121,7 +121,6 @@ public: int SetStatus(int iNewStatus) override; - HANDLE GetAwayMsg(MCONTACT hContact) override; int SetAwayMsg(int iStatus, const wchar_t* msg) override; int UserIsTyping(MCONTACT hContact, int type) override; diff --git a/protocols/Gadu-Gadu/src/gg_proto.cpp b/protocols/Gadu-Gadu/src/gg_proto.cpp index 686dd12c0c..186a283c06 100644 --- a/protocols/Gadu-Gadu/src/gg_proto.cpp +++ b/protocols/Gadu-Gadu/src/gg_proto.cpp @@ -588,27 +588,18 @@ int GaduProto::SetStatus(int iNewStatus) return 0; } +////////////////////////////////////////////////////////// +// when away message is requested + void __cdecl GaduProto::getawaymsgthread(void *arg) { - DBVARIANT dbv; - MCONTACT hContact = (UINT_PTR)arg; - debugLogA("getawaymsgthread(): started"); gg_sleep(100, FALSE, "getawaymsgthread", 106, 1); - if (!db_get_s(hContact, "CList", GG_KEY_STATUSDESCR, &dbv, DBVT_WCHAR)) { - ProtoBroadcastAck(hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, (HANDLE)1, (LPARAM)dbv.pwszVal); - debugLogW(L"getawaymsgthread(): Reading away msg <%s>.", dbv.pwszVal); - db_free(&dbv); - } - else { - ProtoBroadcastAck(hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, (HANDLE)1, 0); - } - debugLogA("getawaymsgthread(): end"); + + ptrW wszMsg(db_get_wsa(hContact, "CList", "StatusMsg")); + ProtoBroadcastAck(hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, (HANDLE)1, wszMsg); } -////////////////////////////////////////////////////////// -// when away message is requested -// HANDLE GaduProto::GetAwayMsg(MCONTACT hContact) { #ifdef DEBUGMODE diff --git a/protocols/MSN/src/msn_proto.cpp b/protocols/MSN/src/msn_proto.cpp index 0c111cd119..7cf5e8e644 100644 --- a/protocols/MSN/src/msn_proto.cpp +++ b/protocols/MSN/src/msn_proto.cpp @@ -635,7 +635,7 @@ void __cdecl CMsnProto::MsnGetAwayMsgThread(void* arg) HANDLE CMsnProto::GetAwayMsg(MCONTACT hContact) { - AwayMsgInfo* inf = (AwayMsgInfo*)mir_alloc(sizeof(AwayMsgInfo)); + AwayMsgInfo *inf = (AwayMsgInfo*)mir_alloc(sizeof(AwayMsgInfo)); inf->hContact = hContact; inf->id = MSN_GenRandom(); diff --git a/protocols/Twitter/src/contacts.cpp b/protocols/Twitter/src/contacts.cpp index 248cd0d59d..c87dafb226 100644 --- a/protocols/Twitter/src/contacts.cpp +++ b/protocols/Twitter/src/contacts.cpp @@ -161,12 +161,8 @@ void TwitterProto::GetAwayMsgWorker(void *arg) if (hContact == 0) return; - DBVARIANT dbv; - if (!db_get_ws(hContact, "CList", "StatusMsg", &dbv)) { - ProtoBroadcastAck(hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, (HANDLE)1, (LPARAM)dbv.pwszVal); - db_free(&dbv); - } - else ProtoBroadcastAck(hContact, ACKTYPE_AWAYMSG, ACKRESULT_FAILED, (HANDLE)1, 0); + ptrW wszMsg(db_get_wsa(hContact, "CList", "StatusMsg")); + ProtoBroadcastAck(hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, (HANDLE)1, wszMsg); } HANDLE TwitterProto::GetAwayMsg(MCONTACT hContact) -- cgit v1.2.3