summary refs log tree commit diff
path: root/src/timeline/InputBar.cpp
diff options
context:
space:
mode:
authorNicolas Werner <nicolas.werner@hotmail.de>2021-07-15 20:37:52 +0200
committerNicolas Werner <nicolas.werner@hotmail.de>2021-07-19 01:28:07 +0200
commit8a1666bc889d963693b5dff8f0b4c7612319644a (patch)
tree80cdae27c4a88287fc08d707e638feecfd36d3da /src/timeline/InputBar.cpp
parentMerge pull request #646 from Nheko-Reborn/historical-key-sharing (diff)
downloadnheko-8a1666bc889d963693b5dff8f0b4c7612319644a.tar.xz
Basic sticker support
Diffstat (limited to 'src/timeline/InputBar.cpp')
-rw-r--r--src/timeline/InputBar.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/timeline/InputBar.cpp b/src/timeline/InputBar.cpp

index b0747a7c..0f210722 100644 --- a/src/timeline/InputBar.cpp +++ b/src/timeline/InputBar.cpp
@@ -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" @@ -502,6 +503,22 @@ InputBar::video(const QString &filename, } 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) { if (command == "me") {