summaryrefslogtreecommitdiff
path: root/protocols/Steam/src/steam_proto.cpp
diff options
context:
space:
mode:
authorAlexander Lantsev <aunsane@gmail.com>2014-04-06 18:55:34 +0000
committerAlexander Lantsev <aunsane@gmail.com>2014-04-06 18:55:34 +0000
commitdea767bfe91ba408b09e4f9bcd503dd2150276a7 (patch)
treed44ac7a5e0460144feee1c2996dac5a1d02e67f5 /protocols/Steam/src/steam_proto.cpp
parent8457a7c95db2775bd977ba8de5091f5d5d9277eb (diff)
Steam: server polling, status changing, messaging
git-svn-id: http://svn.miranda-ng.org/main/trunk@8873 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Steam/src/steam_proto.cpp')
-rw-r--r--protocols/Steam/src/steam_proto.cpp35
1 files changed, 26 insertions, 9 deletions
diff --git a/protocols/Steam/src/steam_proto.cpp b/protocols/Steam/src/steam_proto.cpp
index 97a11c8d62..7b5b808339 100644
--- a/protocols/Steam/src/steam_proto.cpp
+++ b/protocols/Steam/src/steam_proto.cpp
@@ -1,7 +1,8 @@
#include "common.h"
CSteamProto::CSteamProto(const char* protoName, const TCHAR* userName) :
- PROTO<CSteamProto>(protoName, userName)
+ PROTO<CSteamProto>(protoName, userName),
+ hMessageProcess(1)
{
CreateProtoService(PS_CREATEACCMGRUI, &CSteamProto::OnAccountManagerInit);
@@ -133,7 +134,15 @@ int __cdecl CSteamProto::RecvFile(MCONTACT hContact, PROTORECVFILET* pre)
int __cdecl CSteamProto::RecvMsg(MCONTACT hContact, PROTORECVEVENT* pre)
{
- return 0;
+ DBEVENTINFO dbei = { sizeof(dbei) };
+ dbei.szModule = this->m_szModuleName;
+ dbei.timestamp = pre->timestamp;
+ dbei.eventType = EVENTTYPE_MESSAGE;
+ dbei.cbBlob = lstrlenA(pre->szMessage);
+ dbei.pBlob = (BYTE*)pre->szMessage;
+ dbei.flags = DBEF_UTF;
+
+ return (INT_PTR)db_event_add(hContact, &dbei);
}
int __cdecl CSteamProto::RecvUrl(MCONTACT hContact, PROTORECVEVENT *) { return 0; }
@@ -150,7 +159,16 @@ HANDLE __cdecl CSteamProto::SendFile(MCONTACT hContact, const TCHAR *szDescripti
int __cdecl CSteamProto::SendMsg(MCONTACT hContact, int flags, const char *msg)
{
- return 0;
+ UINT hMessage = InterlockedIncrement(&hMessageProcess);
+
+ SendMessageParam *param = (SendMessageParam*)mir_calloc(sizeof(SendMessageParam));
+ param->hContact = hContact;
+ param->text = mir_utf8encode(msg);
+ param->hMessage = (HANDLE)hMessage;
+
+ ForkThread(&CSteamProto::SendMessageThread, param);
+
+ return hMessage;
}
int __cdecl CSteamProto::SendUrl(MCONTACT hContact, int flags, const char *url) { return 0; }
@@ -168,7 +186,6 @@ int CSteamProto::SetStatus(int new_status)
if (new_status == ID_STATUS_OFFLINE)
{
m_bTerminated = true;
-
ForkThread(&CSteamProto::LogOutThread, NULL);
m_iStatus = m_iDesiredStatus = ID_STATUS_OFFLINE;
@@ -176,8 +193,8 @@ int CSteamProto::SetStatus(int new_status)
if (!Miranda_Terminated())
{
- /*this->SetAllContactStatus(ID_STATUS_OFFLINE);
- this->CloseAllChatSessions();*/
+ SetAllContactsStatus(ID_STATUS_OFFLINE);
+ //this->CloseAllChatSessions();
}
return 0;
@@ -191,11 +208,11 @@ int CSteamProto::SetStatus(int new_status)
}
else
{
- /*if (IsOnline())
+ if (IsOnline())
{
- SetServerStatus(new_status);
+ ForkThread(&CSteamProto::SetServerStatusThread, &new_status);
return 0;
- }*/
+ }
ProtoBroadcastAck(NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)old_status, m_iStatus);