summaryrefslogtreecommitdiff
path: root/protocols/Steam/src/steam_messages.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'protocols/Steam/src/steam_messages.cpp')
-rw-r--r--protocols/Steam/src/steam_messages.cpp47
1 files changed, 47 insertions, 0 deletions
diff --git a/protocols/Steam/src/steam_messages.cpp b/protocols/Steam/src/steam_messages.cpp
new file mode 100644
index 0000000000..20496bc039
--- /dev/null
+++ b/protocols/Steam/src/steam_messages.cpp
@@ -0,0 +1,47 @@
+#include "common.h"
+
+void CSteamProto::SendMessageThread(void *arg)
+{
+ SendMessageParam *param = (SendMessageParam*)arg;
+
+ ptrA token(getStringA("TokenSecret"));
+ ptrA sessionId(getStringA("SessionID"));
+ ptrA steamId(getStringA(param->hContact, "SteamID"));
+
+ SteamWebApi::MessageApi::SendResult sendResult;
+ SteamWebApi::MessageApi::SendMessage(m_hNetlibUser, token, sessionId, steamId, param->text, &sendResult);
+
+ ProtoBroadcastAck(
+ param->hContact,
+ ACKTYPE_MESSAGE,
+ sendResult.IsSuccess() ? ACKRESULT_SUCCESS : ACKRESULT_FAILED,
+ param->hMessage, 0);
+
+ if (sendResult.IsSuccess())
+ {
+ DBEVENTINFO dbei = { sizeof(dbei) };
+ dbei.szModule = this->m_szModuleName;
+ dbei.timestamp = sendResult.GetTimestamp();
+ dbei.eventType = EVENTTYPE_MESSAGE;
+ dbei.cbBlob = strlen(param->text);
+ dbei.pBlob = (BYTE*)param->text;
+ dbei.flags = DBEF_UTF | DBEF_SENT;
+
+ db_event_add(param->hContact, &dbei);
+ }
+
+ //mir_free((void*)param->text);
+ mir_free(param);
+}
+
+void CSteamProto::SendTypingThread(void *arg)
+{
+ MCONTACT hContact = (MCONTACT)arg;
+
+ ptrA token(getStringA("TokenSecret"));
+ ptrA sessionId(getStringA("SessionID"));
+ ptrA steamId(getStringA(hContact, "SteamID"));
+
+ SteamWebApi::MessageApi::SendResult sendResult;
+ SteamWebApi::MessageApi::SendTyping(m_hNetlibUser, token, sessionId, steamId, &sendResult);
+} \ No newline at end of file