diff options
Diffstat (limited to 'protocols/SkypeWeb')
-rw-r--r-- | protocols/SkypeWeb/src/requests/chatrooms.h | 25 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/requests/messages.h | 7 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/requests/search.h | 3 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/requests/status.h | 6 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/requests/subscriptions.h | 18 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_avatars.cpp | 1 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_polling.cpp | 1 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_proto.cpp | 7 |
8 files changed, 46 insertions, 22 deletions
diff --git a/protocols/SkypeWeb/src/requests/chatrooms.h b/protocols/SkypeWeb/src/requests/chatrooms.h index 905f6afd47..b78053f7f1 100644 --- a/protocols/SkypeWeb/src/requests/chatrooms.h +++ b/protocols/SkypeWeb/src/requests/chatrooms.h @@ -93,13 +93,21 @@ public: << CHAR_VALUE("Content-Type", "application/json; charset=UTF-8")
<< FORMAT_VALUE("RegistrationToken", "registrationToken=%s", regToken);
- CMStringA data = "{\"members\":[";
+ JSONNode node(JSON_NODE);
+ JSONNode members(JSON_ARRAY);
+
+ members.set_name("members");
+
for (int i = 0; i < skypenames.getCount(); i++)
- data.AppendFormat("{\"id\":\"8:%s\",\"role\":\"%s\"},", skypenames[i], !mir_strcmpi(skypenames[i], selfname) ? "Admin" : "User");
- data.Truncate(data.GetLength() - 1);
- data.Append("]}");
+ {
+ JSONNode member(JSON_NODE);
+ member.push_back(JSONNode("id", CMStringA(::FORMAT, "8:%s", skypenames[i]).GetBuffer()));
+ member.push_back(JSONNode("role", !mir_strcmpi(skypenames[i], selfname) ? "Admin" : "User"));
+ members.push_back(member);
+ }
+ node.push_back(members);
- Body << VALUE(data);
+ Body << VALUE(node.write().c_str());
}
};
@@ -129,8 +137,11 @@ public: << CHAR_VALUE("Content-Type", "application/json; charset=UTF-8")
<< FORMAT_VALUE("RegistrationToken", "registrationToken=%s", regToken);
- CMStringA data(::FORMAT, "{\"role\":\"%s\"}", role);
- Body << VALUE(data);
+ JSONNode node(JSON_NODE);
+
+ node.push_back(JSONNode("role", role));
+
+ Body << VALUE(node.write().c_str());
}
};
diff --git a/protocols/SkypeWeb/src/requests/messages.h b/protocols/SkypeWeb/src/requests/messages.h index b55d759a22..198930fd65 100644 --- a/protocols/SkypeWeb/src/requests/messages.h +++ b/protocols/SkypeWeb/src/requests/messages.h @@ -99,8 +99,11 @@ public: << CHAR_VALUE("Content-Type", "application/json; charset=UTF-8");
//"lastReadMessageTimestamp;modificationTime;lastReadMessageId"
- CMStringA data(::FORMAT, "{\"consumptionhorizon\":\"%lld000;%lld000;%lld000\"}", msgTimestamp, time(NULL), msgTimestamp);
- Body << VALUE(data);
+
+ JSONNode node(JSON_NODE);
+ node.push_back(JSONNode("consumptionhorizon", CMStringA(::FORMAT, "%lld000;%lld000;%lld000", msgTimestamp, time(NULL), msgTimestamp).GetBuffer()));
+
+ Body << VALUE(node.write().c_str());
}
};
diff --git a/protocols/SkypeWeb/src/requests/search.h b/protocols/SkypeWeb/src/requests/search.h index 2b78cdac35..6a6f87d9e4 100644 --- a/protocols/SkypeWeb/src/requests/search.h +++ b/protocols/SkypeWeb/src/requests/search.h @@ -25,8 +25,7 @@ public: HttpRequest(REQUEST_GET, "api.skype.com/search/users/any")
{
Url
- << CHAR_VALUE("keyWord", string)
- << CHAR_VALUE("contactTypes[]", "skype");
+ << CHAR_VALUE("keyWord", string);
Headers
<< CHAR_VALUE("Accept", "application/json")
<< CHAR_VALUE("Connection", "keep-alive")
diff --git a/protocols/SkypeWeb/src/requests/status.h b/protocols/SkypeWeb/src/requests/status.h index a980e431d1..aac7742ef0 100644 --- a/protocols/SkypeWeb/src/requests/status.h +++ b/protocols/SkypeWeb/src/requests/status.h @@ -29,8 +29,10 @@ public: << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", regToken)
<< CHAR_VALUE("Content-Type", "application/json; charset=UTF-8");
- CMStringA data(::FORMAT, "{\"status\":\"%s\"}", status);
- Body << VALUE(data);
+ JSONNode node(JSON_NODE);
+ node.push_back(JSONNode("status", status));
+
+ Body << VALUE(node.write().c_str());
}
};
diff --git a/protocols/SkypeWeb/src/requests/subscriptions.h b/protocols/SkypeWeb/src/requests/subscriptions.h index 7c46df3f35..b29eddc639 100644 --- a/protocols/SkypeWeb/src/requests/subscriptions.h +++ b/protocols/SkypeWeb/src/requests/subscriptions.h @@ -56,13 +56,21 @@ public: << CHAR_VALUE("Content-Type", "application/json; charset=UTF-8")
<< FORMAT_VALUE("RegistrationToken", "registrationToken=%s", regToken);
- CMStringA data = "{\"contacts\":[";
+
+ JSONNode node(JSON_NODE);
+ JSONNode contacts(JSON_ARRAY);
+
+ contacts.set_name("contacts");
+
for (int i = 0; i < skypenames.getCount(); i++)
- data.AppendFormat("{\"id\":\"8:%s\"},", skypenames[i]);
- data.Truncate(data.GetLength() - 1);
- data.Append("]}");
+ {
+ JSONNode contact(JSON_NODE);
+ contact.push_back(JSONNode("id", CMStringA(::FORMAT, "8:%s", skypenames[i]).GetBuffer()));
+ contacts.push_back(contact);
+ }
+ node.push_back(contacts);
- Body << VALUE(data);
+ Body << VALUE(node.write().c_str());
}
};
diff --git a/protocols/SkypeWeb/src/skype_avatars.cpp b/protocols/SkypeWeb/src/skype_avatars.cpp index a058b65115..af599ae7d6 100644 --- a/protocols/SkypeWeb/src/skype_avatars.cpp +++ b/protocols/SkypeWeb/src/skype_avatars.cpp @@ -135,6 +135,7 @@ void CSkypeProto::GetAvatarFileName(MCONTACT hContact, TCHAR* pszDest, size_t cb const TCHAR* szFileType = ProtoGetAvatarExtension(getByte(hContact, "AvatarType", PA_FORMAT_JPEG));
CMStringA username(getStringA(hContact, SKYPE_SETTINGS_ID));
username.Replace("live:", "__live_");
+ username.Replace("facebook:", "__facebook_");
mir_sntprintf(pszDest + tPathLen, MAX_PATH - tPathLen, _T("%s%s"), _A2T(username.GetBuffer()), szFileType);
}
diff --git a/protocols/SkypeWeb/src/skype_polling.cpp b/protocols/SkypeWeb/src/skype_polling.cpp index 3ab4461079..afc4d32d72 100644 --- a/protocols/SkypeWeb/src/skype_polling.cpp +++ b/protocols/SkypeWeb/src/skype_polling.cpp @@ -99,7 +99,6 @@ void CSkypeProto::PollingThread(void*) int errorCode = error.as_int();
if (errorCode == 729)
{
- SendRequest(new CreateEndpointRequest(TokenSecret), &CSkypeProto::OnEndpointCreated);
CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)response);
delete request;
break;
diff --git a/protocols/SkypeWeb/src/skype_proto.cpp b/protocols/SkypeWeb/src/skype_proto.cpp index 656360a366..f01f932b9e 100644 --- a/protocols/SkypeWeb/src/skype_proto.cpp +++ b/protocols/SkypeWeb/src/skype_proto.cpp @@ -174,9 +174,10 @@ int CSkypeProto::AuthRequest(MCONTACT hContact, const TCHAR *szMessage) int CSkypeProto::GetInfo(MCONTACT hContact, int)
{
- PushRequest(
- new GetProfileRequest(ptrA(getStringA("TokenSecret")), ptrA(db_get_sa(hContact, m_szModuleName, SKYPE_SETTINGS_ID))),
- &CSkypeProto::LoadProfile);
+ if (!isChatRoom(hContact))
+ PushRequest(
+ new GetProfileRequest(ptrA(getStringA("TokenSecret")), ptrA(db_get_sa(hContact, m_szModuleName, SKYPE_SETTINGS_ID))),
+ &CSkypeProto::LoadProfile);
return 0;
}
|