diff options
| -rw-r--r-- | protocols/Teams/src/teams_contacts.cpp | 7 | ||||
| -rw-r--r-- | protocols/Teams/src/teams_proto.h | 1 | ||||
| -rw-r--r-- | protocols/Teams/src/teams_server.cpp | 28 |
3 files changed, 17 insertions, 19 deletions
diff --git a/protocols/Teams/src/teams_contacts.cpp b/protocols/Teams/src/teams_contacts.cpp index 8579aed3c3..9c7a1f728d 100644 --- a/protocols/Teams/src/teams_contacts.cpp +++ b/protocols/Teams/src/teams_contacts.cpp @@ -17,14 +17,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include "stdafx.h" -uint16_t CTeamsProto::GetContactStatus(MCONTACT hContact) -{ - return getWord(hContact, "Status", ID_STATUS_OFFLINE); -} - void CTeamsProto::SetContactStatus(MCONTACT hContact, uint16_t status) { - uint16_t oldStatus = GetContactStatus(hContact); + uint16_t oldStatus = getWord(hContact, "Status", ID_STATUS_OFFLINE); if (oldStatus != status) { setWord(hContact, "Status", status); if (status == ID_STATUS_OFFLINE) diff --git a/protocols/Teams/src/teams_proto.h b/protocols/Teams/src/teams_proto.h index 986408e3a4..97991a3ca1 100644 --- a/protocols/Teams/src/teams_proto.h +++ b/protocols/Teams/src/teams_proto.h @@ -248,7 +248,6 @@ private: void UpdateProfileAvatar(const JSONNode &root, MCONTACT hContact = NULL); // contacts - uint16_t GetContactStatus(MCONTACT hContact); void SetContactStatus(MCONTACT hContact, uint16_t status); MCONTACT FindContact(const char *skypeId); diff --git a/protocols/Teams/src/teams_server.cpp b/protocols/Teams/src/teams_server.cpp index dc51e1ed67..472360eac7 100644 --- a/protocols/Teams/src/teams_server.cpp +++ b/protocols/Teams/src/teams_server.cpp @@ -155,22 +155,26 @@ void CTeamsProto::CreateSubscription() void CTeamsProto::CreateContactSubscription() { - OBJLIST<char> skypenames(1); + CMStringA szUrl = m_szTrouterSurl; + if (szUrl[szUrl.GetLength() - 1] != '/') + szUrl += "/"; + szUrl += "TeamsUnifiedPresenceService"; + + JSONNode listAdd(JSON_ARRAY); listAdd.set_name("subscriptionsToAdd"); for (auto &hContact : AccContacts()) - if (!isChatRoom(hContact)) - skypenames.insert(newStr(getId(hContact))); - - JSONNode contacts(JSON_ARRAY); contacts.set_name("contacts"); - for (auto &it : skypenames) { - JSONNode contact; - contact << CHAR_PARAM("id", it); - contacts << contact; - } + if (!isChatRoom(hContact)) { + JSONNode contact; + contact << CHAR_PARAM("mri", getId(hContact)); + listAdd << contact; + } + + JSONNode listRemove(JSON_ARRAY); listRemove.set_name("subscriptionsToRemove"); JSONNode node; - node << contacts; + node << CHAR_PARAM("trouterUri", szUrl) << BOOL_PARAM("shouldPurgePreviousSubscriptions", true) + << listAdd << listRemove; - auto *pReq = new AsyncHttpRequest(REQUEST_POST, HOST_DEFAULT, "/users/ME/contacts"); + auto *pReq = new AsyncHttpRequest(REQUEST_POST, HOST_PRESENCE, "/pubsub/subscriptions/" + m_szEndpoint); pReq->m_szParam = node.write().c_str(); PushRequest(pReq); } |
