Basic sticker support

This commit is contained in:
Nicolas Werner 2021-07-15 20:37:52 +02:00
parent 1dc20f9164
commit 8a1666bc88
No known key found for this signature in database
GPG key ID: C8D75E610773F2D9
17 changed files with 419 additions and 37 deletions

View file

@ -21,6 +21,7 @@
#include "ChatPage.h"
#include "CompletionProxyModel.h"
#include "Config.h"
#include "ImagePackModel.h"
#include "Logging.h"
#include "MainWindow.h"
#include "MatrixClient.h"
@ -501,6 +502,22 @@ InputBar::video(const QString &filename,
room->sendMessageEvent(video, mtx::events::EventType::RoomMessage);
}
void
InputBar::sticker(ImagePackModel *model, int row)
{
if (!model || row < 0)
return;
auto img = model->imageAt(row);
mtx::events::msg::StickerImage sticker{};
sticker.info = img.info.value_or(mtx::common::ImageInfo{});
sticker.url = img.url;
sticker.body = img.body;
room->sendMessageEvent(sticker, mtx::events::EventType::Sticker);
}
void
InputBar::command(QString command, QString args)
{