From 2704f1deabc2fc0f0d8a59afbe5a63847d2ba8bd Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sat, 15 Jun 2013 18:26:30 +0000 Subject: ProtoBroadcastAck - unified helper for all protocols git-svn-id: http://svn.miranda-ng.org/main/trunk@4963 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/WhatsApp/src/connection.cpp | 10 +++++----- protocols/WhatsApp/src/contacts.cpp | 4 ++-- protocols/WhatsApp/src/messages.cpp | 10 +++++----- 3 files changed, 12 insertions(+), 12 deletions(-) (limited to 'protocols/WhatsApp/src') diff --git a/protocols/WhatsApp/src/connection.cpp b/protocols/WhatsApp/src/connection.cpp index 39cbf96e54..76c2808d12 100644 --- a/protocols/WhatsApp/src/connection.cpp +++ b/protocols/WhatsApp/src/connection.cpp @@ -14,7 +14,7 @@ void WhatsAppProto::ChangeStatus(void*) { this->connection->sendAvailableForChat(); m_iStatus = ID_STATUS_ONLINE; - ProtoBroadcastAck(m_szModuleName, 0, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE) m_iStatus, ID_STATUS_INVISIBLE); + ProtoBroadcastAck(0, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE) m_iStatus, ID_STATUS_INVISIBLE); } } else if (m_iStatus == ID_STATUS_ONLINE && m_iDesiredStatus == ID_STATUS_INVISIBLE) @@ -24,7 +24,7 @@ void WhatsAppProto::ChangeStatus(void*) this->connection->sendClose(); m_iStatus = ID_STATUS_INVISIBLE; SetAllContactStatuses( ID_STATUS_OFFLINE, true ); - ProtoBroadcastAck(m_szModuleName, 0, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE) m_iStatus, ID_STATUS_ONLINE); + ProtoBroadcastAck(0, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE) m_iStatus, ID_STATUS_ONLINE); } } else if (m_iDesiredStatus == ID_STATUS_OFFLINE) @@ -133,13 +133,13 @@ void WhatsAppProto::stayConnectedLoop(void*) this->ToggleStatusMenuItems(false); int prevStatus = this->m_iStatus; this->m_iStatus = ID_STATUS_OFFLINE; - ProtoBroadcastAck(m_szModuleName, 0, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE) m_iStatus, prevStatus); + ProtoBroadcastAck(0, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE) m_iStatus, prevStatus); break; } LOG("Connecting..."); this->m_iStatus = ID_STATUS_CONNECTING; - ProtoBroadcastAck(m_szModuleName, 0, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE) ID_STATUS_OFFLINE, m_iStatus); + ProtoBroadcastAck(0, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE) ID_STATUS_OFFLINE, m_iStatus); CODE_BLOCK_TRY @@ -171,7 +171,7 @@ void WhatsAppProto::stayConnectedLoop(void*) LOG("Set status to online"); this->m_iStatus = desiredStatus; - ProtoBroadcastAck(m_szModuleName, 0, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE )m_iStatus, ID_STATUS_CONNECTING); + ProtoBroadcastAck(0, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE )m_iStatus, ID_STATUS_CONNECTING); this->ToggleStatusMenuItems(true); ForkThread(&WhatsAppProto::ProcessBuddyList, this); diff --git a/protocols/WhatsApp/src/contacts.cpp b/protocols/WhatsApp/src/contacts.cpp index 8e5861efb6..1f942362dd 100644 --- a/protocols/WhatsApp/src/contacts.cpp +++ b/protocols/WhatsApp/src/contacts.cpp @@ -272,7 +272,7 @@ void WhatsAppProto::onLastSeen(const std::string& paramString1, int paramInt, st isr.firstName = ""; isr.lastName = ""; isr.email = ""; - ProtoBroadcastAck(m_szModuleName, NULL, ACKTYPE_SEARCH, ACKRESULT_DATA, targ, (LPARAM)&isr); + ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_DATA, targ, (LPARAM)&isr); // #TODO } */ @@ -348,7 +348,7 @@ void WhatsAppProto::onSendGetPicture(const std::string& jid, const std::vectorhContact, m_szModuleName, "IsGroupMember", 0) == 0) { LOG("not a group member"); - ProtoBroadcastAck(m_szModuleName,data->hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, + ProtoBroadcastAck(data->hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, (HANDLE) (this->msgIdHeader + this->msgId), (LPARAM) "You cannot send messages to groups if you are not a member."); } else if (!db_get_s(data->hContact, m_szModuleName,"ID", &dbv, DBVT_ASCIIZ) && @@ -88,20 +88,20 @@ void WhatsAppProto::SendMsgWorker(void* p) catch (exception &e) { LOG("exception: %s", e.what()); - ProtoBroadcastAck(m_szModuleName,data->hContact,ACKTYPE_MESSAGE,ACKRESULT_FAILED, + ProtoBroadcastAck(data->hContact,ACKTYPE_MESSAGE,ACKRESULT_FAILED, (HANDLE) (this->msgIdHeader + this->msgId), (LPARAM) e.what()); } catch (...) { LOG("unknown exception"); - ProtoBroadcastAck(m_szModuleName,data->hContact,ACKTYPE_MESSAGE,ACKRESULT_FAILED, + ProtoBroadcastAck(data->hContact,ACKTYPE_MESSAGE,ACKRESULT_FAILED, (HANDLE) (this->msgIdHeader + this->msgId), (LPARAM) "Failed sending message"); } } else { LOG("No connection"); - ProtoBroadcastAck(m_szModuleName,data->hContact,ACKTYPE_MESSAGE,ACKRESULT_FAILED, + ProtoBroadcastAck(data->hContact,ACKTYPE_MESSAGE,ACKRESULT_FAILED, (HANDLE) (this->msgIdHeader + this->msgId), (LPARAM) "You cannot send messages when you are offline."); } @@ -189,7 +189,7 @@ void WhatsAppProto::onMessageStatusUpdate(FMessage* fmsg) ss >> id; if (state == 1) - ProtoBroadcastAck(m_szModuleName, hContact, ACKTYPE_MESSAGE, ACKRESULT_SUCCESS, (HANDLE) (header + id),0); + ProtoBroadcastAck(hContact, ACKTYPE_MESSAGE, ACKRESULT_SUCCESS, (HANDLE) (header + id),0); if (db_get_dw(hContact, m_szModuleName, WHATSAPP_KEY_LAST_MSG_ID_HEADER, 0) == header && db_get_dw(hContact, m_szModuleName, WHATSAPP_KEY_LAST_MSG_ID, -1) == id) -- cgit v1.2.3