diff options
author | Felix Rohrbach <fxrh@gmx.de> | 2016-04-09 04:56:22 +0200 |
---|---|---|
committer | Felix Rohrbach <fxrh@gmx.de> | 2016-04-09 21:54:31 +0200 |
commit | a53779d8ebb045e5bc5304f96120fa52d8612d44 (patch) | |
tree | 89a0b5f44aa0c4f93e5a3d246c0aba1de9c2508d /events/roommessageevent.h | |
parent | 32bd6ce054a77d760d98eb3f13fa58704980924b (diff) | |
download | libquotient-a53779d8ebb045e5bc5304f96120fa52d8612d44.tar.gz libquotient-a53779d8ebb045e5bc5304f96120fa52d8612d44.zip |
Implement different types of messages
Diffstat (limited to 'events/roommessageevent.h')
-rw-r--r-- | events/roommessageevent.h | 75 |
1 files changed, 74 insertions, 1 deletions
diff --git a/events/roommessageevent.h b/events/roommessageevent.h index dcc5b547..939113d1 100644 --- a/events/roommessageevent.h +++ b/events/roommessageevent.h @@ -19,10 +19,25 @@ #ifndef QMATRIXCLIENT_ROOMMESSAGEEVENT_H #define QMATRIXCLIENT_ROOMMESSAGEEVENT_H +#include <QtCore/QUrl> + #include "event.h" namespace QMatrixClient { + enum class MessageEventType + { + Text, Emote, Notice, Image, File, Location, Video, Audio, Unkown + }; + + class MessageEventContent + { + public: + virtual ~MessageEventContent() {} + + QString body; + }; + class RoomMessageEvent: public Event { public: @@ -30,9 +45,11 @@ namespace QMatrixClient virtual ~RoomMessageEvent(); QString userId() const; - QString msgtype() const; + MessageEventType msgtype() const; QString body() const; QDateTime hsob_ts() const; + + MessageEventContent* content() const; static RoomMessageEvent* fromJson( const QJsonObject& obj ); @@ -40,6 +57,62 @@ namespace QMatrixClient class Private; Private* d; }; + + class ImageEventContent: public MessageEventContent + { + public: + QUrl url; + int height; + int width; + int size; + QString mimetype; + }; + + class FileEventContent: public MessageEventContent + { + public: + QString filename; + QString mimetype; + int size; + QUrl url; + }; + + class LocationEventContent: public MessageEventContent + { + public: + QString geoUri; + int thumbnailHeight; + int thumbnailWidth; + QString thumbnailMimetype; + int thumbnailSize; + QUrl thumbnailUrl; + }; + + class VideoEventContent: public MessageEventContent + { + public: + QUrl url; + int duration; + int width; + int height; + int size; + QString mimetype; + int thumbnailWidth; + int thumbnailHeight; + int thumbnailSize; + QString thumbnailMimetype; + QUrl thumbnailUrl; + }; + + class AudioEventContent: public MessageEventContent + { + public: + QUrl url; + int size; + int duration; + QString mimetype; + }; + } #endif // QMATRIXCLIENT_ROOMMESSAGEEVENT_H
\ No newline at end of file |