summaryrefslogtreecommitdiff
path: root/protocols/WhatsApp/src/utils.cpp
diff options
context:
space:
mode:
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;