diff options
author | Alexander Lantsev <aunsane@gmail.com> | 2015-04-03 21:57:47 +0000 |
---|---|---|
committer | Alexander Lantsev <aunsane@gmail.com> | 2015-04-03 21:57:47 +0000 |
commit | 2b82b6fe83df09a31a60288871227b3ea97d39a5 (patch) | |
tree | 5cc35c182e7e5be1db2007e4886fa10d19075a21 /protocols/SkypeWeb/src/skype_messages.cpp | |
parent | 035b5186bba8c0cab7d349f849c5c1db7cad7e39 (diff) |
SkypeWeb: cleanup
git-svn-id: http://svn.miranda-ng.org/main/trunk@12597 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/SkypeWeb/src/skype_messages.cpp')
-rw-r--r-- | protocols/SkypeWeb/src/skype_messages.cpp | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/protocols/SkypeWeb/src/skype_messages.cpp b/protocols/SkypeWeb/src/skype_messages.cpp index 869d7e75d5..70436ce0e7 100644 --- a/protocols/SkypeWeb/src/skype_messages.cpp +++ b/protocols/SkypeWeb/src/skype_messages.cpp @@ -25,7 +25,37 @@ int CSkypeProto::OnReceiveMessage(const char *from, const char *convLink, time_t // outcoming message flow
int CSkypeProto::OnSendMessage(MCONTACT hContact, int flags, const char *szMessage)
{
- return 0;
+ UINT hMessage = InterlockedIncrement(&hMessageProcess);
+
+ SendMessageParam *param = (SendMessageParam*)mir_calloc(sizeof(SendMessageParam));
+ param->hContact = hContact;
+ param->hMessage = (HANDLE)hMessage;
+ param->msg = szMessage;
+ param->flags = flags;
+
+ ForkThread(&CSkypeProto::SendMsgThread, (void*)param);
+
+ return hMessage;
+}
+
+void CSkypeProto::SendMsgThread(void *arg)
+{
+ SendMessageParam *param = (SendMessageParam*)arg;
+
+ if (!IsOnline())
+ {
+ ProtoBroadcastAck(param->hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, param->hMessage, (LPARAM)Translate("You cannot send messages when you are offline."));
+ mir_free(param);
+ return;
+ }
+
+ CMStringA message = (param->flags & PREF_UNICODE) ? ptrA(mir_utf8encode(param->msg)) : param->msg; // TODO: mir_utf8encode check taken from FacebookRM, is it needed? Usually we get PREF_UTF8 flag instead.
+
+ ptrA token(getStringA("registrationToken"));
+ ptrA username(getStringA(param->hContact, "Skypename"));
+ PushRequest(
+ new SendMsgRequest(token, username, message, getStringA("Server"))/*,
+ &CSkypeProto::OnMessageSent*/);
}
void CSkypeProto::OnMessageSent(const NETLIBHTTPREQUEST *response, void *arg)
|