diff options
author | Alexander Lantsev <aunsane@gmail.com> | 2015-04-03 21:06:18 +0000 |
---|---|---|
committer | Alexander Lantsev <aunsane@gmail.com> | 2015-04-03 21:06:18 +0000 |
commit | 035b5186bba8c0cab7d349f849c5c1db7cad7e39 (patch) | |
tree | f494a37398b31665d4deb6ebd2e2e52eb98292ef /protocols/SkypeWeb/src/skype_proto.cpp | |
parent | 77633ec5799b374a1899d05ae69a2e5f978f2a7c (diff) |
SkypeWeb: messaging support (patch from MikalaiR)
git-svn-id: http://svn.miranda-ng.org/main/trunk@12595 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/SkypeWeb/src/skype_proto.cpp')
-rw-r--r-- | protocols/SkypeWeb/src/skype_proto.cpp | 37 |
1 files changed, 34 insertions, 3 deletions
diff --git a/protocols/SkypeWeb/src/skype_proto.cpp b/protocols/SkypeWeb/src/skype_proto.cpp index 69d8eed9fc..61b8f2445a 100644 --- a/protocols/SkypeWeb/src/skype_proto.cpp +++ b/protocols/SkypeWeb/src/skype_proto.cpp @@ -108,15 +108,46 @@ int CSkypeProto::RecvContacts(MCONTACT, PROTORECVEVENT*) { return 0; } int CSkypeProto::RecvFile(MCONTACT hContact, PROTOFILEEVENT *pre) { return 0; }
-int CSkypeProto::RecvMsg(MCONTACT hContact, PROTORECVEVENT *pre) { return 0; }
-
int CSkypeProto::RecvUrl(MCONTACT, PROTORECVEVENT*) { return 0; }
int CSkypeProto::SendContacts(MCONTACT, int, int, MCONTACT*) { return 0; }
HANDLE CSkypeProto::SendFile(MCONTACT hContact, const PROTOCHAR *szDescription, PROTOCHAR **ppszFiles) { return 0; }
-int CSkypeProto::SendMsg(MCONTACT hContact, int flags, const char *msg) { return 0; }
+int CSkypeProto::SendMsg(MCONTACT hContact, int flags, const char *msg)
+{
+ UINT hMessage = InterlockedIncrement(&hMessageProcess); + + SendMessageParam *param = (SendMessageParam*)mir_calloc(sizeof(SendMessageParam)); + param->hContact = hContact; + param->hMessage = (HANDLE)hMessage; + param->msg = msg; + 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*/); +}
int CSkypeProto::SendUrl(MCONTACT, int, const char*) { return 0; }
|