Changeset View
Changeset View
Standalone View
Standalone View
src/matrix-sticker-pack.cpp
| Show First 20 Lines • Show All 115 Lines • ▼ Show 20 Lines | QVariant MatrixStickerPack::addSticker(const QString &shortCode, MatrixEvent *event) const | ||||
| if (!info.isUndefined()) { | if (!info.isUndefined()) { | ||||
| sticker["info"] = info; | sticker["info"] = info; | ||||
| } | } | ||||
| source.event = Event(eventJson); | source.event = Event(eventJson); | ||||
| return QVariant::fromValue(source); | return QVariant::fromValue(source); | ||||
| } | } | ||||
| QVariant MatrixStickerPack::removeSticker(const QString &shortCode) const | |||||
| { | |||||
| auto source = m_source.get(); | |||||
| auto eventJson = source.event.raw().get(); | |||||
| if (eventJson.contains("/content/images"_json_pointer) | |||||
| && eventJson["content"]["images"].is_object()) { | |||||
| eventJson["content"]["images"].erase(shortCode.toStdString()); | |||||
| } | |||||
| source.event = Event(eventJson); | |||||
| return QVariant::fromValue(source); | |||||
| } | |||||