summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMikalaiR <nikolay.romanovich@narod.ru>2015-04-07 13:11:14 +0000
committerMikalaiR <nikolay.romanovich@narod.ru>2015-04-07 13:11:14 +0000
commit01f445ee06bc3f303d4e7d8fb00938220adbf618 (patch)
treed4dfe5dbe1f8923f1601cd4e568328aba5475825
parent00d6d7d71a015dfeb34e891f0ebe39a7795ea57f (diff)
SkypeWeb: Chats support part 1.
git-svn-id: http://svn.miranda-ng.org/main/trunk@12649 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r--protocols/SkypeWeb/SkypeWeb_10.vcxproj1
-rw-r--r--protocols/SkypeWeb/SkypeWeb_10.vcxproj.filters3
-rw-r--r--protocols/SkypeWeb/src/skype_poll_processing.cpp37
-rw-r--r--protocols/SkypeWeb/src/skype_polling.cpp4
-rw-r--r--protocols/SkypeWeb/src/skype_proto.h13
-rw-r--r--protocols/SkypeWeb/src/skype_utils.cpp21
6 files changed, 71 insertions, 8 deletions
diff --git a/protocols/SkypeWeb/SkypeWeb_10.vcxproj b/protocols/SkypeWeb/SkypeWeb_10.vcxproj
index 03dd3355ba..e9c86e3d59 100644
--- a/protocols/SkypeWeb/SkypeWeb_10.vcxproj
+++ b/protocols/SkypeWeb/SkypeWeb_10.vcxproj
@@ -224,6 +224,7 @@
<ClCompile Include="src\main.cpp" />
<ClCompile Include="src\request_queue.cpp" />
<ClCompile Include="src\skype_avatars.cpp" />
+ <ClCompile Include="src\skype_chats.cpp" />
<ClCompile Include="src\skype_poll_processing.cpp" />
<ClCompile Include="src\skype_profile.cpp" />
<ClCompile Include="src\skype_request.cpp" />
diff --git a/protocols/SkypeWeb/SkypeWeb_10.vcxproj.filters b/protocols/SkypeWeb/SkypeWeb_10.vcxproj.filters
index 7153f5d342..1a1383d6b4 100644
--- a/protocols/SkypeWeb/SkypeWeb_10.vcxproj.filters
+++ b/protocols/SkypeWeb/SkypeWeb_10.vcxproj.filters
@@ -134,6 +134,9 @@
<ClCompile Include="src\skype_avatars.cpp">
<Filter>Source Files</Filter>
</ClCompile>
+ <ClCompile Include="src\skype_chats.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="res\resource.rc">
diff --git a/protocols/SkypeWeb/src/skype_poll_processing.cpp b/protocols/SkypeWeb/src/skype_poll_processing.cpp
index 4f9a2cf241..376e366eae 100644
--- a/protocols/SkypeWeb/src/skype_poll_processing.cpp
+++ b/protocols/SkypeWeb/src/skype_poll_processing.cpp
@@ -84,8 +84,31 @@ void CSkypeProto::ProcessNewMessageRes(JSONNODE *node)
time_t timestamp = IsoToUnixTime(composeTime);
if (strstr(conversationLink, "/19:"))
{
- const char *chatname;
- chatname = ContactUrlToName(conversationLink);
+ ptrA chatname(ChatUrlToName(conversationLink));
+ ptrA topic(mir_t2a(ptrT(json_as_string(json_get(node, "threadtopic")))));
+ if (GetContact(chatname) == NULL)
+ AddChatRoom(chatname);
+
+ if (!mir_strcmpi(messageType, "Text") || !mir_strcmpi(messageType, "RichText"))
+ {
+
+ }
+ else if (!mir_strcmpi(messageType, "ThreadActivity/AddMember"))
+ {
+
+ }
+ else if (!mir_strcmpi(messageType, "ThreadActivity/DeleteMember"))
+ {
+
+ }
+ else if (!mir_strcmpi(messageType, "ThreadActivity/TopicUpdate"))
+ {
+
+ }
+ else if (!mir_strcmpi(messageType, "ThreadActivity/RoleUpdate"))
+ {
+
+ }
return; //chats not supported
}
else if (strstr(conversationLink, "/8:"))
@@ -119,4 +142,14 @@ void CSkypeProto::ProcessNewMessageRes(JSONNODE *node)
return; //not supported
}
}
+}
+
+void CSkypeProto::ProcessConversationUpdateRes(JSONNODE *node)
+{
+ return;
+}
+
+void CSkypeProto::ProcessThreadUpdateRes(JSONNODE *node)
+{
+ return;
} \ No newline at end of file
diff --git a/protocols/SkypeWeb/src/skype_polling.cpp b/protocols/SkypeWeb/src/skype_polling.cpp
index a426848a12..ad882e10a9 100644
--- a/protocols/SkypeWeb/src/skype_polling.cpp
+++ b/protocols/SkypeWeb/src/skype_polling.cpp
@@ -30,11 +30,11 @@ void CSkypeProto::ParsePollData(JSONNODE *data)
}
else if (!mir_tstrcmpi(resourceType, L"ConversationUpdate"))
{
- continue;
+ ProcessConversationUpdateRes(resource);
}
else if (!mir_tstrcmpi(resourceType, L"ThreadUpdate"))
{
- continue;
+ ProcessThreadUpdateRes(resource);
}
}
}
diff --git a/protocols/SkypeWeb/src/skype_proto.h b/protocols/SkypeWeb/src/skype_proto.h
index d85ccb797c..426b40706b 100644
--- a/protocols/SkypeWeb/src/skype_proto.h
+++ b/protocols/SkypeWeb/src/skype_proto.h
@@ -204,13 +204,17 @@ private:
void OnGetServerHistory(const NETLIBHTTPREQUEST *response);
+ //chats
+ MCONTACT AddChatRoom(const char *chatname);
+
//polling
void __cdecl ParsePollData(JSONNODE *data);
void __cdecl PollingThread(void*);
- void CSkypeProto::ProcessEndpointPresenceRes(JSONNODE *node);
- void CSkypeProto::ProcessUserPresenceRes(JSONNODE *node);
- void CSkypeProto::ProcessNewMessageRes(JSONNODE *node);
-
+ void ProcessEndpointPresenceRes(JSONNODE *node);
+ void ProcessUserPresenceRes(JSONNODE *node);
+ void ProcessNewMessageRes(JSONNODE *node);
+ void ProcessConversationUpdateRes(JSONNODE *node);
+ void ProcessThreadUpdateRes(JSONNODE *node);
// utils
bool IsOnline();
MEVENT AddEventToDb(MCONTACT hContact, WORD type, DWORD timestamp, DWORD flags, DWORD cbBlob, PBYTE pBlob);
@@ -223,6 +227,7 @@ private:
static void ShowNotification(const TCHAR *caption, const TCHAR *message, int flags = 0, MCONTACT hContact = NULL);
void SetServerStatus(int iNewStatus);
static bool IsFileExists(std::tstring path);
+ char *ChatUrlToName(const char *url);
char *ContactUrlToName(const char *url);
char *SelfUrlToName(const char *url);
char *GetServerFromUrl(const char *url);
diff --git a/protocols/SkypeWeb/src/skype_utils.cpp b/protocols/SkypeWeb/src/skype_utils.cpp
index d9c1501b0b..d86b745480 100644
--- a/protocols/SkypeWeb/src/skype_utils.cpp
+++ b/protocols/SkypeWeb/src/skype_utils.cpp
@@ -195,6 +195,27 @@ char *CSkypeProto::SelfUrlToName(const char *url)
return tempname;
}
+char *CSkypeProto::ChatUrlToName(const char *url)
+{
+ char *tempname = NULL;
+ const char *start, *end;
+ start = strstr(url, "/19:");
+
+ if (!start)
+ return NULL;
+ start = start + 4;
+ if ((end = strchr(start, '/')))
+ {
+ mir_free(tempname);
+ tempname = mir_strndup(start, end - start);
+ return tempname;
+ }
+ mir_free(tempname);
+ tempname = mir_strdup(start);
+
+ return tempname;
+}
+
char *CSkypeProto::GetServerFromUrl(const char *url)
{
char *tempname = NULL;