From 4056ab703967ccbba528aebc93802f732ae13884 Mon Sep 17 00:00:00 2001 From: MikalaiR Date: Tue, 7 Apr 2015 13:32:34 +0000 Subject: SkypeWeb: Chats support part 1.1. git-svn-id: http://svn.miranda-ng.org/main/trunk@12651 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/SkypeWeb/src/skype_chats.cpp | 11 +++++++++++ protocols/SkypeWeb/src/skype_poll_processing.cpp | 5 ++--- protocols/SkypeWeb/src/skype_proto.cpp | 4 +++- protocols/SkypeWeb/src/skype_proto.h | 2 +- 4 files changed, 17 insertions(+), 5 deletions(-) diff --git a/protocols/SkypeWeb/src/skype_chats.cpp b/protocols/SkypeWeb/src/skype_chats.cpp index ff3cbc607f..db3f37e8f2 100644 --- a/protocols/SkypeWeb/src/skype_chats.cpp +++ b/protocols/SkypeWeb/src/skype_chats.cpp @@ -24,4 +24,15 @@ MCONTACT CSkypeProto::AddChatRoom(const char *chatname) setByte(hContact, "ChatRoom", 1); } return hContact; +} + +void CSkypeProto::SetChatStatus(MCONTACT hContact, int iStatus) +{ + ptrT tszChatID(getTStringA(hContact, "ChatID")); + if (tszChatID == NULL) + return; + + GCDEST gcd = { m_szModuleName, tszChatID, GC_EVENT_CONTROL }; + GCEVENT gce = { sizeof(gce), &gcd }; + CallServiceSync(MS_GC_EVENT, (iStatus == ID_STATUS_OFFLINE) ? SESSION_OFFLINE : SESSION_ONLINE, (LPARAM)&gce); } \ No newline at end of file diff --git a/protocols/SkypeWeb/src/skype_poll_processing.cpp b/protocols/SkypeWeb/src/skype_poll_processing.cpp index 376e366eae..cdf2457813 100644 --- a/protocols/SkypeWeb/src/skype_poll_processing.cpp +++ b/protocols/SkypeWeb/src/skype_poll_processing.cpp @@ -86,9 +86,8 @@ void CSkypeProto::ProcessNewMessageRes(JSONNODE *node) { ptrA chatname(ChatUrlToName(conversationLink)); ptrA topic(mir_t2a(ptrT(json_as_string(json_get(node, "threadtopic"))))); - if (GetContact(chatname) == NULL) - AddChatRoom(chatname); - + MCONTACT chatContact = AddChatRoom(chatname); + SetChatStatus(chatContact, ID_STATUS_ONLINE); if (!mir_strcmpi(messageType, "Text") || !mir_strcmpi(messageType, "RichText")) { diff --git a/protocols/SkypeWeb/src/skype_proto.cpp b/protocols/SkypeWeb/src/skype_proto.cpp index 6434ec4b90..f9e43ba97c 100644 --- a/protocols/SkypeWeb/src/skype_proto.cpp +++ b/protocols/SkypeWeb/src/skype_proto.cpp @@ -49,7 +49,7 @@ DWORD_PTR CSkypeProto::GetCaps(int type, MCONTACT) switch (type) { case PFLAGNUM_1: - return PF1_IM | PF1_AUTHREQ; + return PF1_IM | PF1_AUTHREQ | PF1_CHAT; case PFLAGNUM_2: return PF2_ONLINE | PF2_INVISIBLE | PF2_SHORTAWAY | PF2_HEAVYDND; case PFLAGNUM_3: @@ -162,8 +162,10 @@ int CSkypeProto::SetStatus(int iNewStatus) { // logout isTerminated = true; + //if (m_pollingConnection) // CallService(MS_NETLIB_SHUTDOWN, (WPARAM)m_pollingConnection, 0); + LogoutRequest *logoutRequest = new LogoutRequest(); if (!cookies.empty()) { diff --git a/protocols/SkypeWeb/src/skype_proto.h b/protocols/SkypeWeb/src/skype_proto.h index 426b40706b..fc2c55f1b3 100644 --- a/protocols/SkypeWeb/src/skype_proto.h +++ b/protocols/SkypeWeb/src/skype_proto.h @@ -206,7 +206,7 @@ private: //chats MCONTACT AddChatRoom(const char *chatname); - + void SetChatStatus(MCONTACT hContact, int iStatus); //polling void __cdecl ParsePollData(JSONNODE *data); void __cdecl PollingThread(void*); -- cgit v1.2.3