summaryrefslogtreecommitdiff
path: root/protocols/WhatsApp/src/utils.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2015-01-28 16:30:05 +0000
committerGeorge Hazan <george.hazan@gmail.com>2015-01-28 16:30:05 +0000
commit52c57ef89cc24bdb8c70908f544ae86fd87db129 (patch)
treebbbeb2b8ffa4109a50bae561c2e00aad9e565068 /protocols/WhatsApp/src/utils.cpp
parentf546c968c4ee1add671e8b6545d52dece95cd3f5 (diff)
- statusbar icon added to notify user that a message was read;
- FMessage own numbering removed as atavism; - WAConnection::msg_id followed FMessage::id on its road to hell - WhatsAppProto::GetSerial() added as the only method that increments message numbers git-svn-id: http://svn.miranda-ng.org/main/trunk@11941 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/WhatsApp/src/utils.cpp')
-rw-r--r--protocols/WhatsApp/src/utils.cpp21
1 files changed, 18 insertions, 3 deletions
diff --git a/protocols/WhatsApp/src/utils.cpp b/protocols/WhatsApp/src/utils.cpp
index 0aa95f1a16..2b9ebd2b2f 100644
--- a/protocols/WhatsApp/src/utils.cpp
+++ b/protocols/WhatsApp/src/utils.cpp
@@ -1,11 +1,14 @@
#include "common.h"
-std::string getLastErrorMsg()
+LONG WhatsAppProto::GetSerial()
{
- // Retrieve the system error message for the last-error code
+ return ::_InterlockedIncrement(&m_iSerial);
+}
+std::string getLastErrorMsg()
+{
LPVOID lpMsgBuf;
- DWORD dw = WSAGetLastError();
+ DWORD dw = WSAGetLastError(); // retrieve the system error message for the last-error code
FormatMessageA(
FORMAT_MESSAGE_ALLOCATE_BUFFER |
@@ -22,6 +25,18 @@ std::string getLastErrorMsg()
return ret;
}
+void utils::setStatusMessage(MCONTACT hContact, const TCHAR *ptszMessage)
+{
+ if (ptszMessage != NULL) {
+ StatusTextData st = { 0 };
+ st.cbSize = sizeof(st);
+ st.hIcon = LoadSkinnedIcon(SKINICON_EVENT_MESSAGE);
+ _tcsncpy_s(st.tszText, ptszMessage, _TRUNCATE);
+ CallService(MS_MSG_SETSTATUSTEXT, hContact, (LPARAM)&st);
+ }
+ else CallService(MS_MSG_SETSTATUSTEXT, hContact, NULL);
+}
+
BYTE* utils::md5string(const BYTE *data, int size, BYTE *digest)
{
mir_md5_state_t md5_state;