diff options
Diffstat (limited to 'protocols')
-rw-r--r-- | protocols/SkypeWeb/src/requests/messages.h | 8 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_chatrooms.cpp | 3 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_contacts.cpp | 20 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_messages.cpp | 4 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_proto.cpp | 8 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_proto.h | 2 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_search.cpp | 3 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_trouter.cpp | 2 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_utils.cpp | 6 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/version.h | 2 |
10 files changed, 30 insertions, 28 deletions
diff --git a/protocols/SkypeWeb/src/requests/messages.h b/protocols/SkypeWeb/src/requests/messages.h index 91f9a7ef0c..260ace590f 100644 --- a/protocols/SkypeWeb/src/requests/messages.h +++ b/protocols/SkypeWeb/src/requests/messages.h @@ -29,7 +29,7 @@ struct SendMessageRequest : public AsyncHttpRequest SendMessageRequest(const char *username, time_t timestamp, const char *message, const char *MessageType = nullptr) :
AsyncHttpRequest(REQUEST_POST, HOST_DEFAULT, 0, &CSkypeProto::OnMessageSent)
{
- m_szUrl.AppendFormat("/users/ME/conversations/%s/messages", username);
+ m_szUrl.AppendFormat("/users/ME/conversations/%s/messages", mir_urlEncode(username).c_str());
JSONNode node;
node << INT64_PARAM("clientmessageid", timestamp) << CHAR_PARAM("messagetype", MessageType ? MessageType : "Text")
@@ -43,7 +43,7 @@ struct SendActionRequest : public AsyncHttpRequest SendActionRequest(const char *username, time_t timestamp, const char *message, CSkypeProto *ppro) :
AsyncHttpRequest(REQUEST_POST, HOST_DEFAULT, 0, &CSkypeProto::OnMessageSent)
{
- m_szUrl.AppendFormat("/users/ME/conversations/%s/messages", username);
+ m_szUrl.AppendFormat("/users/ME/conversations/%s/messages", mir_urlEncode(username).c_str());
CMStringA content;
content.AppendFormat("%s %s", ppro->m_szSkypename.c_str(), message);
@@ -71,10 +71,10 @@ struct SendTypingRequest : public AsyncHttpRequest struct MarkMessageReadRequest : public AsyncHttpRequest
{
- MarkMessageReadRequest(const char *username, LONGLONG /*msgId*/, LONGLONG msgTimestamp, bool isChat) :
+ MarkMessageReadRequest(const char *username, LONGLONG /*msgId*/, LONGLONG msgTimestamp) :
AsyncHttpRequest(REQUEST_PUT, HOST_DEFAULT)
{
- m_szUrl.AppendFormat("/users/ME/conversations/%d:%s/properties?name=consumptionhorizon", !isChat ? 8 : 19, username);
+ m_szUrl.AppendFormat("/users/ME/conversations/%s/properties?name=consumptionhorizon", mir_urlEncode(username).c_str());
JSONNode node(JSON_NODE);
node << CHAR_PARAM("consumptionhorizon", CMStringA(::FORMAT, "%lld000;%lld000;%lld000", msgTimestamp, time(NULL), msgTimestamp));
diff --git a/protocols/SkypeWeb/src/skype_chatrooms.cpp b/protocols/SkypeWeb/src/skype_chatrooms.cpp index 15ab54ed8a..64760e026f 100644 --- a/protocols/SkypeWeb/src/skype_chatrooms.cpp +++ b/protocols/SkypeWeb/src/skype_chatrooms.cpp @@ -125,10 +125,9 @@ int CSkypeProto::OnGroupChatEventHook(WPARAM, LPARAM lParam) {
MCONTACT hContact = FindContact(user_id);
if (hContact == NULL) {
- hContact = AddContact(user_id, true);
+ hContact = AddContact(user_id, T2Utf(gch->ptszNick), true);
setWord(hContact, "Status", ID_STATUS_ONLINE);
Contact_Hide(hContact);
- setWString(hContact, "Nick", (gch->ptszNick) ? gch->ptszNick : GetSkypeNick(gch->ptszUID));
}
CallService(MS_MSG_SENDMESSAGEW, hContact, 0);
}
diff --git a/protocols/SkypeWeb/src/skype_contacts.cpp b/protocols/SkypeWeb/src/skype_contacts.cpp index c7e225451d..89a62fad67 100644 --- a/protocols/SkypeWeb/src/skype_contacts.cpp +++ b/protocols/SkypeWeb/src/skype_contacts.cpp @@ -75,7 +75,7 @@ MCONTACT CSkypeProto::FindContact(const wchar_t *skypeId) return 0;
}
-MCONTACT CSkypeProto::AddContact(const char *skypeId, bool isTemporary)
+MCONTACT CSkypeProto::AddContact(const char *skypeId, const char *nick, bool isTemporary)
{
MCONTACT hContact = FindContact(skypeId);
if (hContact)
@@ -85,7 +85,7 @@ MCONTACT CSkypeProto::AddContact(const char *skypeId, bool isTemporary) Proto_AddToContact(hContact, m_szModuleName);
setString(hContact, SKYPE_SETTINGS_ID, skypeId);
- setUString(hContact, "Nick", GetSkypeNick(skypeId));
+ setUString(hContact, "Nick", (nick) ? nick : GetSkypeNick(skypeId));
if (wstrCListGroup) {
Clist_GroupCreate(0, wstrCListGroup);
@@ -115,14 +115,14 @@ void CSkypeProto::LoadContactsAuth(NETLIBHTTPREQUEST *response, AsyncHttpRequest for (auto &it : item["invites"])
eventTime = IsoToUnixTime(it["time"].as_string());
- MCONTACT hContact = AddContact(skypeId.c_str());
+ std::string displayName = item["displayname"].as_string();
+ const char *szNick = (displayName.empty()) ? nullptr : displayName.c_str();
+
+ MCONTACT hContact = AddContact(skypeId.c_str(), szNick);
time_t lastEventTime = getDword(hContact, "LastAuthRequestTime");
if (lastEventTime && lastEventTime >= eventTime)
continue;
- std::string displayName = item["displayname"].as_string();
- if (displayName.empty())
- displayName = skypeId;
setUString(hContact, "Nick", displayName.c_str());
setDword(hContact, "LastAuthRequestTime", eventTime);
@@ -155,14 +155,16 @@ void CSkypeProto::LoadContactList(NETLIBHTTPREQUEST *response, AsyncHttpRequest* const JSONNode &name = item["name"];
std::string skypeId = item["id"].as_string();
- CMStringW display_name = item["display_name"].as_mstring();
CMStringW first_name = name["first"].as_mstring();
CMStringW last_name = name["surname"].as_mstring();
CMStringW avatar_url = item["avatar_url"].as_mstring();
std::string type = item["type"].as_string();
if (type == "skype" || loadAll) {
- MCONTACT hContact = AddContact(skypeId.c_str());
+ std::string displayName = item["displayname"].as_string();
+ const char *szNick = (displayName.empty()) ? nullptr : displayName.c_str();
+
+ MCONTACT hContact = AddContact(skypeId.c_str(), szNick);
if (hContact) {
if (item["authorized"].as_bool()) {
delSetting(hContact, "Auth");
@@ -185,8 +187,6 @@ void CSkypeProto::LoadContactList(NETLIBHTTPREQUEST *response, AsyncHttpRequest* setString(hContact, "Type", type.c_str());
- if (display_name)
- setWString(hContact, "Nick", display_name);
if (first_name)
setWString(hContact, "FirstName", first_name);
if (last_name)
diff --git a/protocols/SkypeWeb/src/skype_messages.cpp b/protocols/SkypeWeb/src/skype_messages.cpp index 5ef867a20b..fa03b94a81 100644 --- a/protocols/SkypeWeb/src/skype_messages.cpp +++ b/protocols/SkypeWeb/src/skype_messages.cpp @@ -107,7 +107,7 @@ void CSkypeProto::OnPrivateMessageEvent(const JSONNode &node) int nEmoteOffset = node["skypeemoteoffset"].as_int();
- MCONTACT hContact = AddContact(szConversationName, true);
+ MCONTACT hContact = AddContact(szConversationName, nullptr, true);
if (m_bHistorySynced)
setDword(hContact, "LastMsgTime", timestamp);
@@ -188,7 +188,7 @@ void CSkypeProto::MarkMessagesRead(MCONTACT hContact, MEVENT hDbEvent) time_t timestamp = dbei.timestamp;
if (getDword(hContact, "LastMsgTime") > (timestamp - 300))
- PushRequest(new MarkMessageReadRequest(getId(hContact), timestamp, timestamp, false));
+ PushRequest(new MarkMessageReadRequest(getId(hContact), timestamp, timestamp));
}
void CSkypeProto::ProcessContactRecv(MCONTACT hContact, time_t timestamp, const char *szContent, const char *szMessageId)
diff --git a/protocols/SkypeWeb/src/skype_proto.cpp b/protocols/SkypeWeb/src/skype_proto.cpp index a8f8e15cfb..f5cc5f5bd9 100644 --- a/protocols/SkypeWeb/src/skype_proto.cpp +++ b/protocols/SkypeWeb/src/skype_proto.cpp @@ -179,12 +179,12 @@ MCONTACT CSkypeProto::AddToList(int, PROTOSEARCHRESULT *psr) if (psr->id.a == nullptr) return NULL; - MCONTACT hContact; + MCONTACT hContact; if (psr->flags & PSR_UNICODE) - hContact = AddContact(T2Utf(psr->id.w)); + hContact = AddContact(T2Utf(psr->id.w), T2Utf(psr->nick.w)); else - hContact = AddContact(psr->id.a); + hContact = AddContact(psr->id.a, psr->nick.a); return hContact; } @@ -206,7 +206,7 @@ MCONTACT CSkypeProto::AddToListByEvent(int, int, MEVENT hDbEvent) DB::AUTH_BLOB blob(dbei.pBlob); - MCONTACT hContact = AddContact(blob.get_email()); + MCONTACT hContact = AddContact(blob.get_email(), blob.get_nick()); return hContact; } diff --git a/protocols/SkypeWeb/src/skype_proto.h b/protocols/SkypeWeb/src/skype_proto.h index 99a18ac1b1..4e0782f5a4 100644 --- a/protocols/SkypeWeb/src/skype_proto.h +++ b/protocols/SkypeWeb/src/skype_proto.h @@ -258,7 +258,7 @@ private: MCONTACT FindContact(const char *skypeId);
MCONTACT FindContact(const wchar_t *skypeId);
- MCONTACT AddContact(const char *skypename, bool isTemporary = false);
+ MCONTACT AddContact(const char *skypename, const char *nick, bool isTemporary = false);
MCONTACT GetContactFromAuthEvent(MEVENT hEvent);
diff --git a/protocols/SkypeWeb/src/skype_search.cpp b/protocols/SkypeWeb/src/skype_search.cpp index 08fe333a3e..b4f52c85d2 100644 --- a/protocols/SkypeWeb/src/skype_search.cpp +++ b/protocols/SkypeWeb/src/skype_search.cpp @@ -46,6 +46,9 @@ void CSkypeProto::OnSearch(NETLIBHTTPREQUEST *response, AsyncHttpRequest*) const JSONNode &item = it["nodeProfileData"];
std::string skypeId = item["skypeId"].as_string();
+ if (UrlToSkypeId(skypeId.c_str()).IsEmpty())
+ skypeId = "8:" + skypeId;
+
std::string name = item["name"].as_string();
PROTOSEARCHRESULT psr = { sizeof(psr) };
diff --git a/protocols/SkypeWeb/src/skype_trouter.cpp b/protocols/SkypeWeb/src/skype_trouter.cpp index 8c4689a899..6f073999c6 100644 --- a/protocols/SkypeWeb/src/skype_trouter.cpp +++ b/protocols/SkypeWeb/src/skype_trouter.cpp @@ -36,7 +36,7 @@ void CSkypeProto::OnReceiveStatus(NETLIBHTTPREQUEST *response, AsyncHttpRequest* for (auto &it : root["Responses"]) {
std::string id = it["Contact"].as_string();
- MCONTACT hContact = AddContact(id.c_str());
+ MCONTACT hContact = AddContact(id.c_str(), nullptr);
if (hContact) {
int status = SkypeToMirandaStatus(it["Payload"]["status"].as_string().c_str());
setWord(hContact, "Status", status);
diff --git a/protocols/SkypeWeb/src/skype_utils.cpp b/protocols/SkypeWeb/src/skype_utils.cpp index 9156c7dbd8..61aa3639c0 100644 --- a/protocols/SkypeWeb/src/skype_utils.cpp +++ b/protocols/SkypeWeb/src/skype_utils.cpp @@ -603,13 +603,13 @@ INT_PTR CSkypeProto::ParseSkypeUriService(WPARAM, LPARAM lParam) return 0; } } - MCONTACT hContact = AddContact(_T2A(szJid), true); + MCONTACT hContact = AddContact(_T2A(szJid), nullptr, true); CallService(MS_MSG_SENDMESSAGE, (WPARAM)hContact, NULL); return 0; } if (!mir_wstrcmpi(szCommand, L"call")) { - MCONTACT hContact = AddContact(_T2A(szJid), true); + MCONTACT hContact = AddContact(_T2A(szJid), nullptr, true); NotifyEventHooks(g_hCallEvent, (WPARAM)hContact, (LPARAM)0); return 0; } @@ -631,7 +631,7 @@ INT_PTR CSkypeProto::ParseSkypeUriService(WPARAM, LPARAM lParam) } if (!mir_wstrcmpi(szCommand, L"sendfile")) { - MCONTACT hContact = AddContact(_T2A(szJid), true); + MCONTACT hContact = AddContact(_T2A(szJid), nullptr, true); CallService(MS_FILE_SENDFILE, hContact, NULL); return 1; } diff --git a/protocols/SkypeWeb/src/version.h b/protocols/SkypeWeb/src/version.h index 58fe64ff9e..a06240b14b 100644 --- a/protocols/SkypeWeb/src/version.h +++ b/protocols/SkypeWeb/src/version.h @@ -1,7 +1,7 @@ #define __MAJOR_VERSION 0
#define __MINOR_VERSION 95
#define __RELEASE_NUM 13
-#define __BUILD_NUM 2
+#define __BUILD_NUM 3
#include <stdver.h>
|