diff options
author | George Hazan <george.hazan@gmail.com> | 2014-09-18 21:52:10 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2014-09-18 21:52:10 +0000 |
commit | 6d932bfaf11e4699355fedc45e28b353b8877130 (patch) | |
tree | 78d3f6741cf9762d2c6b97ed1f5bc472e850e15f /protocols/WhatsApp/src/chat.cpp | |
parent | 4dd774d667df90583315c04696537b6397f6fc02 (diff) |
merge into trunk
git-svn-id: http://svn.miranda-ng.org/main/trunk@10515 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/WhatsApp/src/chat.cpp')
-rw-r--r-- | protocols/WhatsApp/src/chat.cpp | 67 |
1 files changed, 31 insertions, 36 deletions
diff --git a/protocols/WhatsApp/src/chat.cpp b/protocols/WhatsApp/src/chat.cpp index bef230ecfd..d06e8f357e 100644 --- a/protocols/WhatsApp/src/chat.cpp +++ b/protocols/WhatsApp/src/chat.cpp @@ -2,12 +2,12 @@ // #TODO Remove, as we are not using the chat-module for groups anymore
-INT_PTR WhatsAppProto::OnJoinChat(WPARAM,LPARAM)
+INT_PTR WhatsAppProto::OnJoinChat(WPARAM, LPARAM)
{
return 0;
}
-INT_PTR WhatsAppProto::OnLeaveChat(WPARAM,LPARAM)
+INT_PTR WhatsAppProto::OnLeaveChat(WPARAM, LPARAM)
{
return 0;
}
@@ -18,55 +18,50 @@ int WhatsAppProto::OnChatOutgoing(WPARAM wParam, LPARAM lParam) char *text;
char *id;
- if (strcmp(hook->pDest->pszModule,m_szModuleName))
+ if (strcmp(hook->pDest->pszModule, m_szModuleName))
return 0;
- switch(hook->pDest->iType)
- {
+ switch (hook->pDest->iType) {
case GC_USER_MESSAGE:
- {
- text = mir_t2a_cp(hook->ptszText,CP_UTF8);
- std::string msg = text;
+ text = mir_t2a_cp(hook->ptszText, CP_UTF8);
+ {
+ std::string msg = text;
- id = mir_t2a_cp(hook->pDest->ptszID,CP_UTF8);
- std::string chat_id = id;
+ id = mir_t2a_cp(hook->pDest->ptszID, CP_UTF8);
+ std::string chat_id = id;
- mir_free(text);
- mir_free(id);
-
- if (isOnline()) {
- MCONTACT hContact = this->ContactIDToHContact(chat_id);
- if (hContact)
- {
- debugLogA("**Chat - Outgoing message: %s", text);
- this->SendMsg(hContact, IS_CHAT, msg.c_str());
-
- // #TODO Move to SendMsgWorker, otherwise all messages are "acknowledged" by Miranda
+ mir_free(text);
+ mir_free(id);
- GCDEST gcd = { m_szModuleName, hook->pDest->ptszID, GC_EVENT_MESSAGE };
- GCEVENT gce = { sizeof(gce), &gcd };
- gce.dwFlags = GCEF_ADDTOLOG;
- gce.ptszNick = mir_a2t(this->nick.c_str());
- gce.ptszUID = mir_a2t(this->jid.c_str());
- gce.time = time(NULL);
- gce.ptszText = hook->ptszText;
- gce.bIsMe = TRUE;
- CallServiceSync(MS_GC_EVENT, 0, (LPARAM)&gce);
+ if (isOnline()) {
+ MCONTACT hContact = this->ContactIDToHContact(chat_id);
+ if (hContact) {
+ debugLogA("**Chat - Outgoing message: %s", text);
+ this->SendMsg(hContact, IS_CHAT, msg.c_str());
- mir_free((void*)gce.ptszUID);
- mir_free((void*)gce.ptszNick);
+ // #TODO Move to SendMsgWorker, otherwise all messages are "acknowledged" by Miranda
+
+ GCDEST gcd = { m_szModuleName, hook->pDest->ptszID, GC_EVENT_MESSAGE };
+ GCEVENT gce = { sizeof(gce), &gcd };
+ gce.dwFlags = GCEF_ADDTOLOG;
+ gce.ptszNick = mir_a2t(this->nick.c_str());
+ gce.ptszUID = mir_a2t(this->jid.c_str());
+ gce.time = time(NULL);
+ gce.ptszText = hook->ptszText;
+ gce.bIsMe = TRUE;
+ CallServiceSync(MS_GC_EVENT, 0, (LPARAM)&gce);
+
+ mir_free((void*)gce.ptszUID);
+ mir_free((void*)gce.ptszNick);
+ }
}
}
-
break;
- }
case GC_USER_LEAVE:
case GC_SESSION_TERMINATE:
- {
break;
}
- }
return 0;
}
|