2
0
mirror of https://github.com/ars3niy/tdlib-purple synced 2025-08-30 21:45:09 +00:00

Change group description when chat topic is changed

This commit is contained in:
Arseniy Lartsev
2020-06-01 11:13:23 +02:00
parent 2f1d3329a5
commit 0c7381e0f0
3 changed files with 33 additions and 1 deletions

View File

@@ -1719,6 +1719,30 @@ void PurpleTdClient::deleteSupergroupResponse(uint64_t requestId, td::td_api::ob
}
}
void PurpleTdClient::setGroupDescription(int purpleChatId, const char *description)
{
const td::td_api::chat *chat = m_data.getChatByPurpleId(purpleChatId);
if (!chat) {
purple_debug_warning(config::pluginId, "Unknown libpurple chat id %d\n", purpleChatId);
return;
}
if (getBasicGroupId(*chat) || getSupergroupId(*chat)) {
auto request = td::td_api::make_object<td::td_api::setChatDescription>();
request->chat_id_ = chat->id_;
request->description_ = description ? description : "";
m_transceiver.sendQuery(std::move(request), &PurpleTdClient::setGroupDescriptionResponse);
}
}
void PurpleTdClient::setGroupDescriptionResponse(uint64_t requestId, td::td_api::object_ptr<td::td_api::Object> object)
{
if (!object || (object->get_id() != td::td_api::ok::ID)) {
std::string message = getDisplayedError(object);
purple_notify_error(m_account, _("Error"), _("Failed to set group description"), message.c_str());
}
}
void PurpleTdClient::removeTempFile(int64_t messageId)
{
std::string path = m_data.extractTempFileUpload(messageId);