Skip to content
Snippets Groups Projects
Commit cf02cb84 authored by Armin Felder's avatar Armin Felder
Browse files

Merge branch 'dirtyFixBuggyReplyMessage' into 'master'

reply message segfault fix

See merge request chat/RocketChatMobileEngine!79
parents cafe3711 40c80b39
No related branches found
No related tags found
1 merge request!79reply message segfault fix
...@@ -109,10 +109,12 @@ QVariant MessagesModel::data( const QModelIndex &index, int role ) const ...@@ -109,10 +109,12 @@ QVariant MessagesModel::data( const QModelIndex &index, int role ) const
if ( !first.isNull() ) { if ( !first.isNull() ) {
//TODO: WTF!!! //TODO: WTF!!!
auto msg = qSharedPointerCast<RocketChatReplyMessage>( first ); if ( first->getType() == QStringLiteral( "replyMessage" ) ) {
auto msg = qSharedPointerCast<RocketChatReplyMessage>( first );
if ( !msg.isNull() ) { if ( !msg.isNull() ) {
return msg->getMessageString(); return msg->getMessageString();
}
} }
} }
} }
...@@ -127,10 +129,12 @@ QVariant MessagesModel::data( const QModelIndex &index, int role ) const ...@@ -127,10 +129,12 @@ QVariant MessagesModel::data( const QModelIndex &index, int role ) const
if ( !first.isNull() ) { if ( !first.isNull() ) {
//TODO: WTF!!! //TODO: WTF!!!
auto msg = qSharedPointerCast<RocketChatReplyMessage>( first ); if ( first->getType() == QStringLiteral( "replyMessage" ) ) {
auto msg = qSharedPointerCast<RocketChatReplyMessage>( first );
if ( !msg.isNull() ) { if ( !msg.isNull() ) {
return msg->getAuthor(); return msg->getAuthor();
}
} }
} }
} }
......
...@@ -28,10 +28,14 @@ class RocketChatAttachment : public QObject ...@@ -28,10 +28,14 @@ class RocketChatAttachment : public QObject
{ {
Q_OBJECT Q_OBJECT
public: public:
RocketChatAttachment( const QString &pFileUrl, const QString &pType, const QString &pTitle ); enum class attachmentsType {
replyMessage
};
RocketChatAttachment( const QString &pFileUrl, const attachmentsType &pType, const QString &pTitle );
const QString &getUrl() const; const QString &getUrl() const;
const QString &getType() const; const attachmentsType getType() const;
const QString &getTitle() const; const QString &getTitle() const;
int getWidth() const; int getWidth() const;
...@@ -42,7 +46,7 @@ class RocketChatAttachment : public QObject ...@@ -42,7 +46,7 @@ class RocketChatAttachment : public QObject
protected: protected:
QString mUrl; QString mUrl;
QString mType; attachmentsType mType;
QString mTitle; QString mTitle;
int mWidth = -1; int mWidth = -1;
int mHeight = -1; int mHeight = -1;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment