diff options
author | Robert Pösel <robyer@seznam.cz> | 2017-05-07 15:56:26 +0200 |
---|---|---|
committer | Robert Pösel <robyer@seznam.cz> | 2017-05-07 15:56:26 +0200 |
commit | 1dbd2d4f10041f9276cb62d1c27593502c8b8f01 (patch) | |
tree | 02c149ed023bf32bc54cbaeb5b2b9d88caf4f522 /protocols/SkypeWeb/src | |
parent | e04d28cfcfe33f0450b390bb1af6e9df823fc86a (diff) |
SkypeWeb: Fix infinite refreshing in contact details
Note refreshing this info is still broken (gives "User '<self_username>' is not authorized to request resource of user '<username>'" error).
Diffstat (limited to 'protocols/SkypeWeb/src')
-rw-r--r-- | protocols/SkypeWeb/src/skype_login.cpp | 2 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_profile.cpp | 21 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_proto.cpp | 8 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_proto.h | 2 |
4 files changed, 21 insertions, 12 deletions
diff --git a/protocols/SkypeWeb/src/skype_login.cpp b/protocols/SkypeWeb/src/skype_login.cpp index f33ee5170e..98ccf8b66c 100644 --- a/protocols/SkypeWeb/src/skype_login.cpp +++ b/protocols/SkypeWeb/src/skype_login.cpp @@ -286,7 +286,7 @@ void CSkypeProto::OnCapabilitiesSended(const NETLIBHTTPREQUEST *response) if (root)
setString("SelfEndpointName", UrlToSkypename(root["selfLink"].as_string().c_str()));
- PushRequest(new GetProfileRequest(li), &CSkypeProto::LoadProfile);
+ PushRequest(new GetProfileRequest(li), &CSkypeProto::LoadProfile, NULL);
}
void CSkypeProto::OnStatusChanged(const NETLIBHTTPREQUEST *response)
diff --git a/protocols/SkypeWeb/src/skype_profile.cpp b/protocols/SkypeWeb/src/skype_profile.cpp index 95878a3089..0615d93b7a 100644 --- a/protocols/SkypeWeb/src/skype_profile.cpp +++ b/protocols/SkypeWeb/src/skype_profile.cpp @@ -439,19 +439,26 @@ void CSkypeProto::UpdateProfileAvatar(const JSONNode &root, MCONTACT hContact) }
//{"firstname":"Echo \/ Sound Test Service", "lastname" : null, "birthday" : null, "gender" : null, "country" : null, "city" : null, "language" : null, "homepage" : null, "about" : null, "province" : null, "jobtitle" : null, "emails" : [], "phoneMobile" : null, "phoneHome" : null, "phoneOffice" : null, "mood" : null, "richMood" : null, "avatarUrl" : null, "username" : "echo123"}
-void CSkypeProto::LoadProfile(const NETLIBHTTPREQUEST *response)
+void CSkypeProto::LoadProfile(const NETLIBHTTPREQUEST *response, void *arg)
{
- if (response == NULL)
+ MCONTACT hContact = (DWORD_PTR)arg;
+
+ if (response == NULL) {
+ ProtoBroadcastAck(hContact, ACKTYPE_GETINFO, ACKRESULT_FAILED, 0);
return;
+ }
JSONNode root = JSONNode::parse(response->pData);
- if (!root)
+ if (!root) {
+ ProtoBroadcastAck(hContact, ACKTYPE_GETINFO, ACKRESULT_FAILED, 0);
return;
+ }
std::string username = root["username"].as_string();
- MCONTACT hContact = NULL;
- if (!IsMe(username.c_str()))
- hContact = FindContact(username.c_str());
+ if (username.empty()) {
+ ProtoBroadcastAck(hContact, ACKTYPE_GETINFO, ACKRESULT_FAILED, 0);
+ return;
+ }
UpdateProfileFirstName(root, hContact);
UpdateProfileLastName(root, hContact);
@@ -471,4 +478,6 @@ void CSkypeProto::LoadProfile(const NETLIBHTTPREQUEST *response) UpdateProfilePhoneOffice(root, hContact);
//richMood
UpdateProfileAvatar(root, hContact);
+
+ ProtoBroadcastAck(hContact, ACKTYPE_GETINFO, ACKRESULT_SUCCESS, 0);
}
diff --git a/protocols/SkypeWeb/src/skype_proto.cpp b/protocols/SkypeWeb/src/skype_proto.cpp index dd4f476562..fc9f9fea9a 100644 --- a/protocols/SkypeWeb/src/skype_proto.cpp +++ b/protocols/SkypeWeb/src/skype_proto.cpp @@ -215,10 +215,10 @@ int CSkypeProto::AuthRequest(MCONTACT hContact, const wchar_t *szMessage) int CSkypeProto::GetInfo(MCONTACT hContact, int) { - if (!isChatRoom(hContact)) - PushRequest( - new GetProfileRequest(li, Contacts[hContact]), - &CSkypeProto::LoadProfile); + if (isChatRoom(hContact)) + return 1; + + PushRequest(new GetProfileRequest(li, Contacts[hContact]), &CSkypeProto::LoadProfile, (void*)hContact); return 0; } diff --git a/protocols/SkypeWeb/src/skype_proto.h b/protocols/SkypeWeb/src/skype_proto.h index 504ee7b4b0..b1a006fc19 100644 --- a/protocols/SkypeWeb/src/skype_proto.h +++ b/protocols/SkypeWeb/src/skype_proto.h @@ -271,7 +271,7 @@ private: void UpdateProfileXStatusMessage(const JSONNode &root, MCONTACT hContact = NULL);
void UpdateProfileAvatar(const JSONNode &root, MCONTACT hContact = NULL);
- void LoadProfile(const NETLIBHTTPREQUEST *response);
+ void LoadProfile(const NETLIBHTTPREQUEST *response, void *arg);
void __cdecl CSkypeProto::SendFileThread(void *p);
|