diff options
| author | George Hazan <george.hazan@gmail.com> | 2025-04-18 16:12:38 +0300 |
|---|---|---|
| committer | George Hazan <george.hazan@gmail.com> | 2025-04-18 16:12:38 +0300 |
| commit | 3b3dea953dc54158db9cb35378852175e55c669d (patch) | |
| tree | 5cf71e6fa5e4be13b0158f0ded6a61bec17847fc /protocols/Teams/src/requests | |
| parent | 536b626a052525f226165f3834f4ea06c6a7ad11 (diff) | |
Teams: new format of subscription request + massive code cleaning
Diffstat (limited to 'protocols/Teams/src/requests')
| -rw-r--r-- | protocols/Teams/src/requests/chatrooms.h | 2 | ||||
| -rw-r--r-- | protocols/Teams/src/requests/profile.h | 33 | ||||
| -rw-r--r-- | protocols/Teams/src/requests/subscriptions.h | 56 |
3 files changed, 1 insertions, 90 deletions
diff --git a/protocols/Teams/src/requests/chatrooms.h b/protocols/Teams/src/requests/chatrooms.h index cfef7dd8e0..d94f66a13a 100644 --- a/protocols/Teams/src/requests/chatrooms.h +++ b/protocols/Teams/src/requests/chatrooms.h @@ -40,7 +40,7 @@ struct CreateChatroomRequest : public AsyncHttpRequest struct GetChatMembersRequest : public AsyncHttpRequest { GetChatMembersRequest(const LIST<char> &ids, SESSION_INFO *si) : - AsyncHttpRequest(REQUEST_POST, HOST_PEOPLE, "/profiles", &CTeamsProto::OnGetChatMembers) + AsyncHttpRequest(REQUEST_POST, HOST_DEFAULT, "/profiles", &CTeamsProto::OnGetChatMembers) { JSONNode node, mris(JSON_ARRAY); mris.set_name("mris"); for (auto &it : ids) diff --git a/protocols/Teams/src/requests/profile.h b/protocols/Teams/src/requests/profile.h deleted file mode 100644 index a19772e3cc..0000000000 --- a/protocols/Teams/src/requests/profile.h +++ /dev/null @@ -1,33 +0,0 @@ -/* -Copyright (c) 2015-25 Miranda NG team (https://miranda-ng.org) - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation version 2 -of the License. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>. -*/ - -#ifndef _SKYPE_REQUEST_PROFILE_H_ -#define _SKYPE_REQUEST_PROFILE_H_ - -struct GetProfileRequest : public AsyncHttpRequest -{ - GetProfileRequest(CTeamsProto *ppro, MCONTACT hContact) : - AsyncHttpRequest(REQUEST_GET, HOST_API, 0, &CTeamsProto::LoadProfile) - { - m_szUrl.AppendFormat("/users/%s/profile", (hContact == 0) ? "self" : mir_urlEncode(ppro->getId(hContact))); - pUserInfo = (void *)hContact; - - AddHeader("Accept", "application/json"); - } -}; - -#endif //_SKYPE_REQUEST_PROFILE_H_ diff --git a/protocols/Teams/src/requests/subscriptions.h b/protocols/Teams/src/requests/subscriptions.h deleted file mode 100644 index 81f8cefdb7..0000000000 --- a/protocols/Teams/src/requests/subscriptions.h +++ /dev/null @@ -1,56 +0,0 @@ -/* -Copyright (c) 2015-25 Miranda NG team (https://miranda-ng.org) - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation version 2 -of the License. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>. -*/ - -#ifndef _SKYPE_REQUEST_SUBSCIPTIONS_H_ -#define _SKYPE_REQUEST_SUBSCIPTIONS_H_ - -struct CreateSubscriptionsRequest : public AsyncHttpRequest -{ - CreateSubscriptionsRequest() : - AsyncHttpRequest(REQUEST_POST, HOST_DEFAULT, "/users/ME/endpoints/SELF/subscriptions", &CTeamsProto::OnSubscriptionsCreated) - { - JSONNode interestedResources(JSON_ARRAY); interestedResources.set_name("interestedResources"); - interestedResources << CHAR_PARAM("", "/v1/users/ME/conversations/ALL/properties") - << CHAR_PARAM("", "/v1/users/ME/conversations/ALL/messages") - << CHAR_PARAM("", "/v1/users/ME/contacts/ALL") - << CHAR_PARAM("", "/v1/threads/ALL"); - - JSONNode node; - node << CHAR_PARAM("channelType", "httpLongPoll") << CHAR_PARAM("template", "raw") << interestedResources; - m_szParam = node.write().c_str(); - } -}; - -struct CreateContactsSubscriptionRequest : public AsyncHttpRequest -{ - CreateContactsSubscriptionRequest(const LIST<char> &skypenames) : - AsyncHttpRequest(REQUEST_POST, HOST_DEFAULT, "/users/ME/contacts") - { - JSONNode contacts(JSON_ARRAY); contacts.set_name("contacts"); - for (auto &it : skypenames) { - JSONNode contact; - contact << CHAR_PARAM("id", it); - contacts << contact; - } - - JSONNode node; - node << contacts; - m_szParam = node.write().c_str(); - } -}; - -#endif //_SKYPE_REQUEST_SUBSCIPTIONS_H_ |
