From e164ace17434d7f21bd831f41211a9515feebeda Mon Sep 17 00:00:00 2001 From: Kirill Volinsky Date: Fri, 3 Apr 2015 12:02:42 +0000 Subject: notification when cotact typing git-svn-id: http://svn.miranda-ng.org/main/trunk@12587 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/SkypeWeb/src/skype_poll_processing.cpp | 44 +++++++++++++++++------- protocols/SkypeWeb/src/skype_polling.cpp | 1 - protocols/SkypeWeb/src/skype_proto.cpp | 10 +----- 3 files changed, 32 insertions(+), 23 deletions(-) (limited to 'protocols/SkypeWeb') diff --git a/protocols/SkypeWeb/src/skype_poll_processing.cpp b/protocols/SkypeWeb/src/skype_poll_processing.cpp index 803e37d5b0..c69722d93d 100644 --- a/protocols/SkypeWeb/src/skype_poll_processing.cpp +++ b/protocols/SkypeWeb/src/skype_poll_processing.cpp @@ -80,20 +80,38 @@ void CSkypeProto::ProcessNewMessageRes(JSONNODE *node) ptrA messagetype(mir_t2a(ptrT(json_as_string(json_get(node, "messagetype"))))); ptrA from(mir_t2a(ptrT(json_as_string(json_get(node, "from"))))); ptrA content(mir_t2a(ptrT(json_as_string(json_get(node, "content"))))); - //ptrA composeTime(mir_t2a(ptrT(json_as_string(json_get(node, "composetime"))))); TCHAR *composeTime = json_as_string (json_get(node, "composetime")); ptrA conversationLink(mir_t2a(ptrT(json_as_string(json_get(node, "conversationLink"))))); - time_t timeStamp = IsoToUnixTime(composeTime);//time(NULL); // it should be rewritten - - if (!mir_strcmpi(messagetype, "Text") || !mir_strcmpi(messagetype, "RichText")) { - PROTORECVEVENT recv = { 0 }; - recv.flags = PREF_UTF; - recv.timestamp = timeStamp; - recv.szMessage = content; - debugLogA("Incoming message from %s", ContactUrlToName(from)); - if (IsMe(ContactUrlToName(from))) - return; //it should be rewritten - MCONTACT hContact = GetContact(ContactUrlToName(from)); - OnReceiveMessage(hContact, &recv); + time_t timeStamp = IsoToUnixTime(composeTime); + char *convname; + if (strstr(conversationLink, "/19:")) + { + const char *chatname, *topic; + chatname = ContactUrlToName(conversationLink); + convname = mir_strdup(chatname); + return; //chats not supported + } + else if (strstr(conversationLink, "/8:")) + { + if (!mir_strcmpi(messagetype, "Control/Typing")) + { + MCONTACT hContact = GetContact(ContactUrlToName(from)); + CallService(MS_PROTO_CONTACTISTYPING, hContact, 5); + } + else if (!mir_strcmpi(messagetype, "Control/ClearTyping")) + { + return; + } + else if (!mir_strcmpi(messagetype, "Text") || !mir_strcmpi(messagetype, "RichText")) { + PROTORECVEVENT recv = { 0 }; + recv.flags = PREF_UTF; + recv.timestamp = timeStamp; + recv.szMessage = content; + debugLogA("Incoming message from %s", ContactUrlToName(from)); + if (IsMe(ContactUrlToName(from))) + return; //it should be rewritten + MCONTACT hContact = GetContact(ContactUrlToName(from)); + OnReceiveMessage(hContact, &recv); + } } } \ No newline at end of file diff --git a/protocols/SkypeWeb/src/skype_polling.cpp b/protocols/SkypeWeb/src/skype_polling.cpp index c9dda8f31a..668359667f 100644 --- a/protocols/SkypeWeb/src/skype_polling.cpp +++ b/protocols/SkypeWeb/src/skype_polling.cpp @@ -38,7 +38,6 @@ void CSkypeProto::ParsePollData(JSONNODE *data) { continue; } - } } } diff --git a/protocols/SkypeWeb/src/skype_proto.cpp b/protocols/SkypeWeb/src/skype_proto.cpp index 88a9241d0f..69d8eed9fc 100644 --- a/protocols/SkypeWeb/src/skype_proto.cpp +++ b/protocols/SkypeWeb/src/skype_proto.cpp @@ -187,15 +187,7 @@ int CSkypeProto::SetAwayMsg(int, const PROTOCHAR *msg) { return 0; } int CSkypeProto::UserIsTyping(MCONTACT hContact, int type) { - switch (type) { - case PROTOTYPE_SELFTYPING_OFF: - PushRequest(new SendTypingRequest(getStringA("registrationToken"), db_get_sa(hContact, m_szModuleName, "Skypename"), false, getStringA("Server"))); - break; - case PROTOTYPE_SELFTYPING_ON: - PushRequest(new SendTypingRequest(getStringA("registrationToken"), db_get_sa(hContact, m_szModuleName, "Skypename"), true, getStringA("Server"))); - break; - } - return 0; + return 0; } int CSkypeProto::OnEvent(PROTOEVENTTYPE iEventType, WPARAM wParam, LPARAM lParam) -- cgit v1.2.3