diff --git a/CustomModels/messagemodel.cpp b/CustomModels/messagemodel.cpp index a97a0b27fa15f571028372609ad91f6da9601994..476234fc8287172c224f0e0c924c44ed62e91fd9 100644 --- a/CustomModels/messagemodel.cpp +++ b/CustomModels/messagemodel.cpp @@ -53,6 +53,10 @@ QVariant MessagesModel::data( const QModelIndex &index, int role ) const return messageAtIndex->getAuthor(); } + if ( role == authorId ) { + return messageAtIndex->getAuthorId(); + } + if ( role == date ) { return messageAtIndex->getFormattedDate(); } @@ -93,6 +97,10 @@ QVariant MessagesModel::data( const QModelIndex &index, int role ) const return messageAtIndex->getMessageType(); } + if ( role == blocked ) { + return mBlockedUsers.contains( messageAtIndex->getAuthorId() ); + } + qWarning() << "MessagesModel data not found for row"; return QVariant(); } @@ -156,11 +164,19 @@ bool MessagesModel::addChannel( const QSharedPointer<RocketChatChannel> &channel return true; } +void MessagesModel::addBlockedUser( const QString &pUserId ) +{ + beginResetModel(); + mBlockedUsers.insert( pUserId ); + endResetModel(); +} + QHash<int, QByteArray> MessagesModel::roleNames() const { QHash<int, QByteArray> roles; roles[text] = QByteArrayLiteral( "msg" ); roles[author] = QByteArrayLiteral( "author" ); + roles[authorId] = QByteArrayLiteral( "authorId" ); roles[linkurl] = QByteArrayLiteral( "linkurl" ); roles[type] = QByteArrayLiteral( "type" ); roles[date] = QByteArrayLiteral( "date" ); @@ -171,6 +187,7 @@ QHash<int, QByteArray> MessagesModel::roleNames() const roles[formattedDate ] = QByteArrayLiteral( "formattedDate" ); roles[formattedTime] = QByteArrayLiteral( "formattedTime" ); roles[messageType] = QByteArrayLiteral( "messageType" ); + roles[blocked] = QByteArrayLiteral( "blocked" ); return roles; } diff --git a/CustomModels/messagemodel.h b/CustomModels/messagemodel.h index 73c83e1c989773a7745645b86621491418c80f5d..820c984199394eee6b0a14000809ee1f29b253e8 100644 --- a/CustomModels/messagemodel.h +++ b/CustomModels/messagemodel.h @@ -49,7 +49,9 @@ class MessagesModel : public QAbstractListModel height, formattedDate, formattedTime, - messageType + messageType, + authorId, + blocked }; MessagesModel(); QVariant data( const QModelIndex &index, int role = Qt::DisplayRole ) const; @@ -58,6 +60,8 @@ class MessagesModel : public QAbstractListModel Q_INVOKABLE int rowCount( const QModelIndex &parent = QModelIndex() ) const; void onCurrentChannelChanged(); bool addChannel( const QSharedPointer<RocketChatChannel> & ); + public slots: + void addBlockedUser( const QString &pUserId ); protected: QString current; @@ -72,6 +76,8 @@ class MessagesModel : public QAbstractListModel void onEndInsertList( const QString &pChannelId ); QMap<QString, QSharedPointer<RocketChatChannel>> mChannelMap; QMutex mutex; + QSet<QString> mBlockedUsers; + signals: void currentChannelChanged( void ); void countChanged(); diff --git a/config.h b/config.h index e9187bd7b4a22dd3b95af01cdedab040a26b4b59..d4e822f7fa2b537fb2de3480db9bf42cab91ae7e 100755 --- a/config.h +++ b/config.h @@ -1,7 +1,7 @@ #ifndef CONFIG_H #define CONFIG_H -#define DBVERSION 2 +#define DBVERSION 3 #endif // CONFIG_H diff --git a/ddpRequests/rocketchathideroomrequest.cpp b/ddpRequests/rocketchathideroomrequest.cpp new file mode 100644 index 0000000000000000000000000000000000000000..0e783a710d103a288b08fa88b9aa0f7306e2cee0 --- /dev/null +++ b/ddpRequests/rocketchathideroomrequest.cpp @@ -0,0 +1,8 @@ +#include "rocketchathideroomrequest.h" + +RocketChatHideRoomRequest::RocketChatHideRoomRequest( const QString &pId ) +{ + QJsonArray params; + params.append( pId ); + buildRequest( QStringLiteral( "hideRoom" ), params ); +} diff --git a/ddpRequests/rocketchathideroomrequest.h b/ddpRequests/rocketchathideroomrequest.h new file mode 100644 index 0000000000000000000000000000000000000000..6919a11f1d7d63412c859ad927dfc94322b981d5 --- /dev/null +++ b/ddpRequests/rocketchathideroomrequest.h @@ -0,0 +1,12 @@ +#ifndef ROCKETCHATHIDEROOMREQUEST_H +#define ROCKETCHATHIDEROOMREQUEST_H + +#include "ddpmethodrequest.h" + +class RocketChatHideRoomRequest: public DDPMethodRequest +{ + public: + RocketChatHideRoomRequest( const QString &pId ); +}; + +#endif // ROCKETCHATHIDEROOMREQUEST_H diff --git a/engine.pro b/engine.pro index cd2a9a34233c9eb08e604b3a05b3cb7de3b03c84..0d7a742e834e81366c68faf1d21ca2a1c048993b 100644 --- a/engine.pro +++ b/engine.pro @@ -89,7 +89,8 @@ SOURCES += api/meteorddp.cpp \ ddpRequests/rocketchatblockuserrequest.cpp \ ddpRequests/rocketchatunblockuserrequest.cpp \ restRequests/getserverinforequest.cpp \ - ddpRequests/rocketchatleaveroomrequest.cpp + ddpRequests/rocketchatleaveroomrequest.cpp \ + ddpRequests/rocketchathideroomrequest.cpp HEADERS += \ api/meteorddp.h \ @@ -179,7 +180,8 @@ HEADERS += \ ddpRequests/rocketchatblockuserrequest.h \ ddpRequests/rocketchatunblockuserrequest.h \ restRequests/getserverinforequest.h \ - ddpRequests/rocketchatleaveroomrequest.h + ddpRequests/rocketchatleaveroomrequest.h \ + ddpRequests/rocketchathideroomrequest.h linux{ @@ -270,4 +272,7 @@ CONFIG(release, debug|release) { RESOURCES += \ sql.qrc +DISTFILES += \ + sql/migrations/3.sql + diff --git a/engine.pro.user b/engine.pro.user deleted file mode 100644 index b15144199860c7356e08a54056f0382d56c1904b..0000000000000000000000000000000000000000 --- a/engine.pro.user +++ /dev/null @@ -1,653 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE QtCreatorProject> -<!-- Written by QtCreator 4.2.1, 2017-05-01T19:33:53. --> -<qtcreator> - <data> - <variable>EnvironmentId</variable> - <value type="QByteArray">{7cb7821c-ffc7-4027-8b07-ee24a83956f0}</value> - </data> - <data> - <variable>ProjectExplorer.Project.ActiveTarget</variable> - <value type="int">1</value> - </data> - <data> - <variable>ProjectExplorer.Project.EditorSettings</variable> - <valuemap type="QVariantMap"> - <value type="bool" key="EditorConfiguration.AutoIndent">true</value> - <value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value> - <value type="bool" key="EditorConfiguration.CamelCaseNavigation">true</value> - <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0"> - <value type="QString" key="language">Cpp</value> - <valuemap type="QVariantMap" key="value"> - <value type="QByteArray" key="CurrentPreferences">CppGlobal</value> - </valuemap> - </valuemap> - <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1"> - <value type="QString" key="language">QmlJS</value> - <valuemap type="QVariantMap" key="value"> - <value type="QByteArray" key="CurrentPreferences">QmlJSGlobal</value> - </valuemap> - </valuemap> - <value type="int" key="EditorConfiguration.CodeStyle.Count">2</value> - <value type="QByteArray" key="EditorConfiguration.Codec">UTF-8</value> - <value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value> - <value type="int" key="EditorConfiguration.IndentSize">4</value> - <value type="bool" key="EditorConfiguration.KeyboardTooltips">false</value> - <value type="int" key="EditorConfiguration.MarginColumn">80</value> - <value type="bool" key="EditorConfiguration.MouseHiding">true</value> - <value type="bool" key="EditorConfiguration.MouseNavigation">true</value> - <value type="int" key="EditorConfiguration.PaddingMode">1</value> - <value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value> - <value type="bool" key="EditorConfiguration.ShowMargin">false</value> - <value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value> - <value type="bool" key="EditorConfiguration.SmartSelectionChanging">true</value> - <value type="bool" key="EditorConfiguration.SpacesForTabs">true</value> - <value type="int" key="EditorConfiguration.TabKeyBehavior">0</value> - <value type="int" key="EditorConfiguration.TabSize">8</value> - <value type="bool" key="EditorConfiguration.UseGlobal">true</value> - <value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value> - <value type="bool" key="EditorConfiguration.addFinalNewLine">true</value> - <value type="bool" key="EditorConfiguration.cleanIndentation">true</value> - <value type="bool" key="EditorConfiguration.cleanWhitespace">true</value> - <value type="bool" key="EditorConfiguration.inEntireDocument">false</value> - </valuemap> - </data> - <data> - <variable>ProjectExplorer.Project.PluginSettings</variable> - <valuemap type="QVariantMap"/> - </data> - <data> - <variable>ProjectExplorer.Project.Target.0</variable> - <valuemap type="QVariantMap"> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop Qt 5.8.0 GCC 64bit</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop Qt 5.8.0 GCC 64bit</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">qt.58.gcc_64_kit</value> - <value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">1</value> - <value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value> - <value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value> - <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0"> - <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/beij/code/build-engine-Desktop_Qt_5_8_0_GCC_64bit-Debug</value> - <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> - <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> - <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value> - <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">true</value> - <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value> - <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value> - <value type="bool" key="QtProjectManager.QMakeBuildStep.SeparateDebugInfo">false</value> - <value type="bool" key="QtProjectManager.QMakeBuildStep.UseQtQuickCompiler">false</value> - </valuemap> - <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1"> - <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> - <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"> - <value type="QString">-w</value> - <value type="QString">-r</value> - </valuelist> - <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value> - <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value> - <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value> - </valuemap> - <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value> - </valuemap> - <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1"> - <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> - <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> - <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"> - <value type="QString">-w</value> - <value type="QString">-r</value> - </valuelist> - <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value> - <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value> - <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value> - </valuemap> - <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Bereinigen</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value> - </valuemap> - <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value> - <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value> - <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Debug</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value> - <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</value> - <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value> - </valuemap> - <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1"> - <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/beij/code/build-engine-Desktop_Qt_5_8_0_GCC_64bit-Release</value> - <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> - <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> - <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value> - <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value> - <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value> - <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value> - <value type="bool" key="QtProjectManager.QMakeBuildStep.SeparateDebugInfo">false</value> - <value type="bool" key="QtProjectManager.QMakeBuildStep.UseQtQuickCompiler">false</value> - </valuemap> - <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1"> - <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> - <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"> - <value type="QString">-w</value> - <value type="QString">-r</value> - </valuelist> - <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value> - <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value> - <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value> - </valuemap> - <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value> - </valuemap> - <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1"> - <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> - <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> - <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"> - <value type="QString">-w</value> - <value type="QString">-r</value> - </valuelist> - <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value> - <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value> - <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value> - </valuemap> - <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Bereinigen</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value> - </valuemap> - <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value> - <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value> - <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Release</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value> - <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value> - <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value> - </valuemap> - <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.2"> - <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/beij/code/build-engine-Desktop_Qt_5_8_0_GCC_64bit-Profile</value> - <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> - <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> - <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value> - <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">true</value> - <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value> - <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value> - <value type="bool" key="QtProjectManager.QMakeBuildStep.SeparateDebugInfo">true</value> - <value type="bool" key="QtProjectManager.QMakeBuildStep.UseQtQuickCompiler">false</value> - </valuemap> - <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1"> - <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> - <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"> - <value type="QString">-w</value> - <value type="QString">-r</value> - </valuelist> - <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value> - <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value> - <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value> - </valuemap> - <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value> - </valuemap> - <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1"> - <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> - <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> - <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"> - <value type="QString">-w</value> - <value type="QString">-r</value> - </valuelist> - <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value> - <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value> - <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value> - </valuemap> - <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Bereinigen</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value> - </valuemap> - <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value> - <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value> - <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Profile</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value> - <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value> - <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value> - </valuemap> - <value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">3</value> - <valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0"> - <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> - <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deployment</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value> - </valuemap> - <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Lokales Deployment</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value> - </valuemap> - <value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value> - <valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/> - <valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0"> - <value type="bool" key="Analyzer.QmlProfiler.AggregateTraces">false</value> - <value type="bool" key="Analyzer.QmlProfiler.FlushEnabled">false</value> - <value type="uint" key="Analyzer.QmlProfiler.FlushInterval">1000</value> - <value type="QString" key="Analyzer.QmlProfiler.LastTraceFile"></value> - <value type="bool" key="Analyzer.QmlProfiler.Settings.UseGlobalSettings">true</value> - <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/> - <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value> - <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value> - <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value> - <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value> - <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value> - <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value> - <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value> - <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value> - <value type="int" key="Analyzer.Valgrind.LeakCheckOnFinish">1</value> - <value type="int" key="Analyzer.Valgrind.NumCallers">25</value> - <valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/> - <value type="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">1</value> - <value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value> - <value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value> - <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value> - <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value> - <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds"> - <value type="int">0</value> - <value type="int">1</value> - <value type="int">2</value> - <value type="int">3</value> - <value type="int">4</value> - <value type="int">5</value> - <value type="int">6</value> - <value type="int">7</value> - <value type="int">8</value> - <value type="int">9</value> - <value type="int">10</value> - <value type="int">11</value> - <value type="int">12</value> - <value type="int">13</value> - <value type="int">14</value> - </valuelist> - <value type="int" key="PE.EnvironmentAspect.Base">2</value> - <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/> - <value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.Arguments"></value> - <value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.Executable"></value> - <value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.WorkingDirectory">%{buildDir}</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Benutzerdefinierte ausführbare Datei</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.CustomExecutableRunConfiguration</value> - <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value> - <value type="bool" key="RunConfiguration.UseCppDebugger">false</value> - <value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value> - <value type="bool" key="RunConfiguration.UseMultiProcess">false</value> - <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value> - <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value> - </valuemap> - <value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value> - </valuemap> - </data> - <data> - <variable>ProjectExplorer.Project.Target.1</variable> - <valuemap type="QVariantMap"> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Android für armeabi-v7a (GCC 4.9, Qt 5.8.0)</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Android für armeabi-v7a (GCC 4.9, Qt 5.8.0)</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{fdf1ca81-f569-4a91-9bed-0b53c6c2173a}</value> - <value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value> - <value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value> - <value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value> - <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0"> - <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/beij/code/RocketChatMobile/build-engine-Android_f_r_armeabi_v7a_GCC_4_9_Qt_5_8_0-Debug</value> - <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> - <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> - <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value> - <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">true</value> - <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value> - <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value> - <value type="bool" key="QtProjectManager.QMakeBuildStep.SeparateDebugInfo">false</value> - <value type="bool" key="QtProjectManager.QMakeBuildStep.UseQtQuickCompiler">false</value> - </valuemap> - <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1"> - <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> - <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"> - <value type="QString">-w</value> - <value type="QString">-r</value> - </valuelist> - <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value> - <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">-j5</value> - <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value> - </valuemap> - <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.2"> - <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Anwendungsdaten kopieren</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.AndroidPackageInstallationStep</value> - </valuemap> - <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.3"> - <value type="QString" key="BuildTargetSdk">android-25</value> - <value type="QString" key="KeystoreLocation"></value> - <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Android-APK erstellen</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QmakeProjectManager.AndroidBuildApkStep</value> - <value type="int" key="Qt4ProjectManager.AndroidDeployQtStep.DeployQtAction">2</value> - <value type="bool" key="UseGradle">true</value> - <value type="bool" key="VerboseOutput">false</value> - </valuemap> - <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">4</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value> - </valuemap> - <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1"> - <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> - <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> - <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"> - <value type="QString">-w</value> - <value type="QString">-r</value> - </valuelist> - <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value> - <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value> - <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value> - </valuemap> - <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Bereinigen</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value> - </valuemap> - <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value> - <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value> - <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Debug</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value> - <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</value> - <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value> - </valuemap> - <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1"> - <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/beij/code/RocketChatMobile/build-engine-Android_f_r_armeabi_v7a_GCC_4_9_Qt_5_8_0-Release</value> - <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> - <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> - <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value> - <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value> - <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value> - <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value> - <value type="bool" key="QtProjectManager.QMakeBuildStep.SeparateDebugInfo">false</value> - <value type="bool" key="QtProjectManager.QMakeBuildStep.UseQtQuickCompiler">false</value> - </valuemap> - <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1"> - <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> - <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"> - <value type="QString">-w</value> - <value type="QString">-r</value> - </valuelist> - <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value> - <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value> - <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value> - </valuemap> - <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.2"> - <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Anwendungsdaten kopieren</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.AndroidPackageInstallationStep</value> - </valuemap> - <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.3"> - <value type="QString" key="BuildTargetSdk">android-25</value> - <value type="QString" key="KeystoreLocation"></value> - <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Android-APK erstellen</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QmakeProjectManager.AndroidBuildApkStep</value> - <value type="int" key="Qt4ProjectManager.AndroidDeployQtStep.DeployQtAction">2</value> - <value type="bool" key="UseGradle">false</value> - <value type="bool" key="VerboseOutput">false</value> - </valuemap> - <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">4</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value> - </valuemap> - <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1"> - <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> - <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> - <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"> - <value type="QString">-w</value> - <value type="QString">-r</value> - </valuelist> - <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value> - <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value> - <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value> - </valuemap> - <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Bereinigen</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value> - </valuemap> - <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value> - <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value> - <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Release</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value> - <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value> - <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value> - </valuemap> - <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.2"> - <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/beij/code/RocketChatMobile/build-engine-Android_f_r_armeabi_v7a_GCC_4_9_Qt_5_8_0-Profile</value> - <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> - <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> - <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value> - <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">true</value> - <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value> - <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value> - <value type="bool" key="QtProjectManager.QMakeBuildStep.SeparateDebugInfo">true</value> - <value type="bool" key="QtProjectManager.QMakeBuildStep.UseQtQuickCompiler">false</value> - </valuemap> - <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1"> - <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> - <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"> - <value type="QString">-w</value> - <value type="QString">-r</value> - </valuelist> - <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value> - <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value> - <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value> - </valuemap> - <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.2"> - <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Anwendungsdaten kopieren</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.AndroidPackageInstallationStep</value> - </valuemap> - <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.3"> - <value type="QString" key="BuildTargetSdk">android-25</value> - <value type="QString" key="KeystoreLocation"></value> - <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Android-APK erstellen</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QmakeProjectManager.AndroidBuildApkStep</value> - <value type="int" key="Qt4ProjectManager.AndroidDeployQtStep.DeployQtAction">2</value> - <value type="bool" key="UseGradle">false</value> - <value type="bool" key="VerboseOutput">false</value> - </valuemap> - <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">4</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value> - </valuemap> - <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1"> - <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> - <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> - <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"> - <value type="QString">-w</value> - <value type="QString">-r</value> - </valuelist> - <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value> - <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value> - <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value> - </valuemap> - <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Bereinigen</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value> - </valuemap> - <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value> - <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value> - <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Profile</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value> - <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value> - <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value> - </valuemap> - <value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">3</value> - <valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0"> - <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> - <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> - <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deployment auf Android-Gerät</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.AndroidDeployQtStep</value> - <value type="bool" key="UninstallPreviousPackage">false</value> - </valuemap> - <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deployment</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value> - </valuemap> - <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deployment auf Android-Gerät</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Deployment auf Android-Gerät</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.AndroidDeployConfiguration2</value> - </valuemap> - <value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value> - <valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/> - <valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0"> - <value type="bool" key="Analyzer.QmlProfiler.AggregateTraces">false</value> - <value type="bool" key="Analyzer.QmlProfiler.FlushEnabled">false</value> - <value type="uint" key="Analyzer.QmlProfiler.FlushInterval">1000</value> - <value type="QString" key="Analyzer.QmlProfiler.LastTraceFile"></value> - <value type="bool" key="Analyzer.QmlProfiler.Settings.UseGlobalSettings">true</value> - <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/> - <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value> - <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value> - <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value> - <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value> - <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value> - <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value> - <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value> - <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value> - <value type="int" key="Analyzer.Valgrind.LeakCheckOnFinish">1</value> - <value type="int" key="Analyzer.Valgrind.NumCallers">25</value> - <valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/> - <value type="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">1</value> - <value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value> - <value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value> - <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value> - <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value> - <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds"> - <value type="int">0</value> - <value type="int">1</value> - <value type="int">2</value> - <value type="int">3</value> - <value type="int">4</value> - <value type="int">5</value> - <value type="int">6</value> - <value type="int">7</value> - <value type="int">8</value> - <value type="int">9</value> - <value type="int">10</value> - <value type="int">11</value> - <value type="int">12</value> - <value type="int">13</value> - <value type="int">14</value> - </valuelist> - <value type="int" key="PE.EnvironmentAspect.Base">2</value> - <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/> - <value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.Arguments"></value> - <value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.Executable"></value> - <value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.WorkingDirectory">%{buildDir}</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Benutzerdefinierte ausführbare Datei</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.CustomExecutableRunConfiguration</value> - <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value> - <value type="bool" key="RunConfiguration.UseCppDebugger">false</value> - <value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value> - <value type="bool" key="RunConfiguration.UseMultiProcess">false</value> - <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value> - <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value> - </valuemap> - <value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value> - </valuemap> - </data> - <data> - <variable>ProjectExplorer.Project.TargetCount</variable> - <value type="int">2</value> - </data> - <data> - <variable>ProjectExplorer.Project.Updater.FileVersion</variable> - <value type="int">18</value> - </data> - <data> - <variable>Version</variable> - <value type="int">18</value> - </data> -</qtcreator> diff --git a/persistancelayer.cpp b/persistancelayer.cpp index 78cf4afd6f6932af40354dfbdcacc199b8843f06..119a72aa8f76df8c2471ac39d0f1c74717ec6b6e 100755 --- a/persistancelayer.cpp +++ b/persistancelayer.cpp @@ -107,6 +107,7 @@ void PersistanceLayer::initShema() "(id varchar(12) primary key," "rid varchar(12)," "author varchar(30)," + "user_id varchar(12)," "ts integer," "read BOOLEAN DEFAULT FALSE," "json text)" ) ); @@ -152,6 +153,21 @@ void PersistanceLayer::initShema() qWarning() << query.lastError(); } + query.prepare( QStringLiteral( "CREATE TABLE IF NOT EXISTS blocked_users" + "(id varchar(30) primary key, author varchar(30) )" ) ); + + if ( !query.exec() ) { + qWarning() << query.lastError(); + } + + /* query.prepare( QStringLiteral( "CREATE INDEX authorIdx " + "ON blocked_users (author)" ) ); + + if ( !query.exec() ) { + qWarning() << query.lastError(); + } + */ + commit(); query.prepare( QStringLiteral( "SELECT db_ver FROM app_info WHERE id=0" ) ); @@ -279,6 +295,9 @@ void PersistanceLayer::upgradeSchema() } else if ( dbVersion < 2 ) { currentTarget = 2; sqlFile.setFileName( QStringLiteral( ":/sql/migrations/2.sql" ) ); + } else if ( dbVersion < 3 ) { + currentTarget = 3; + sqlFile.setFileName( QStringLiteral( ":/sql/migrations/3.sql" ) ); } if ( !sqlFile.open( QIODevice::ReadOnly | QIODevice::Text ) ) { @@ -362,7 +381,7 @@ void PersistanceLayer::commit( void ) -void PersistanceLayer::setUserName( QString pUsername ) +void PersistanceLayer::setUserName( const QString &pUsername ) { transaction(); @@ -379,7 +398,7 @@ void PersistanceLayer::setUserName( QString pUsername ) commit(); } -void PersistanceLayer::setPassword( QString pPassword ) +void PersistanceLayer::setPassword( const QString &pPassword ) { transaction(); QSqlQuery setPass; @@ -395,7 +414,7 @@ void PersistanceLayer::setPassword( QString pPassword ) commit(); } -void PersistanceLayer::setToken( QString pToken, uint pExpire ) +void PersistanceLayer::setToken( const QString &pToken, uint pExpire ) { transaction(); QSqlQuery setToken; @@ -413,7 +432,7 @@ void PersistanceLayer::setToken( QString pToken, uint pExpire ) commit(); } -void PersistanceLayer::setUserData( QString pUser, QString pPass ) +void PersistanceLayer::setUserData( const QString &pUser, const QString &pPass ) { transaction(); QSqlQuery setUser; @@ -431,7 +450,7 @@ void PersistanceLayer::setUserData( QString pUser, QString pPass ) commit(); } -QString PersistanceLayer::addFileToTemp( QString pUrl, QString pPath ) +QString PersistanceLayer::addFileToTemp( const QString &pUrl, const QString &pPath ) { QFile file( pPath ); QString urlPrefix = ""; @@ -495,7 +514,7 @@ QString PersistanceLayer::addFileToTemp( QString pUrl, QString pPath ) return newFilePath; } -QString PersistanceLayer::addFileToDocuments( QString pUrl, QString pPath ) +QString PersistanceLayer::addFileToDocuments( const QString &pUrl, const QString &pPath ) { QFile file( pPath ); QString newFilePath = QStandardPaths::writableLocation( QStandardPaths::DocumentsLocation ); @@ -541,7 +560,7 @@ QString PersistanceLayer::addFileToDocuments( QString pUrl, QString pPath ) return newFilePath; } -QString PersistanceLayer::addFileToMusics( QString pUrl, QString pPath ) +QString PersistanceLayer::addFileToMusics( const QString &pUrl, const QString &pPath ) { QFile file( pPath ); QString newFilePath = QStandardPaths::writableLocation( QStandardPaths::MusicLocation ); @@ -587,7 +606,7 @@ QString PersistanceLayer::addFileToMusics( QString pUrl, QString pPath ) return newFilePath; } -QString PersistanceLayer::addFileToVideos( QString pUrl, QString pPath ) +QString PersistanceLayer::addFileToVideos( const QString &pUrl, const QString &pPath ) { QFile file( pPath ); QString newFilePath = QStandardPaths::writableLocation( QStandardPaths::MoviesLocation ); @@ -634,7 +653,7 @@ QString PersistanceLayer::addFileToVideos( QString pUrl, QString pPath ) return newFilePath; } -QString PersistanceLayer::addFileToImages( QString pUrl, QString pPath ) +QString PersistanceLayer::addFileToImages( const QString &pUrl, const QString &pPath ) { QFile file( pPath ); QString newFilePath = QStandardPaths::writableLocation( QStandardPaths::PicturesLocation ); @@ -680,7 +699,7 @@ QString PersistanceLayer::addFileToImages( QString pUrl, QString pPath ) return newFilePath; } -void PersistanceLayer::createFolder( QString pPath ) +void PersistanceLayer::createFolder( const QString &pPath ) { QDir temp; @@ -689,7 +708,7 @@ void PersistanceLayer::createFolder( QString pPath ) } } -void PersistanceLayer::setUserId( QString pUserId ) +void PersistanceLayer::setUserId( const QString &pUserId ) { transaction(); QSqlQuery setUserId; @@ -704,7 +723,7 @@ void PersistanceLayer::setUserId( QString pUserId ) commit(); } -void PersistanceLayer::setCurrentChannel( QString pChannelId, QString pChannelName ) +void PersistanceLayer::setCurrentChannel( const QString &pChannelId, const QString &pChannelName ) { transaction(); QSqlQuery setChannel; @@ -721,7 +740,7 @@ void PersistanceLayer::setCurrentChannel( QString pChannelId, QString pChannelNa commit(); } -void PersistanceLayer::setSetting( QString pProperty, QString pValue ) +void PersistanceLayer::setSetting( const QString &pProperty, const QString &pValue ) { transaction(); QSqlQuery setChannel; @@ -738,7 +757,7 @@ void PersistanceLayer::setSetting( QString pProperty, QString pValue ) } -void PersistanceLayer::addChannel( QString pId, QString pName, QString pType, bool pJoined, bool pReadOnly, QString pMuted, bool pArchived, bool pBlocked ) +void PersistanceLayer::addChannel( const QString &pId, const QString &pName, const QString &pType, bool pJoined, bool pReadOnly, const QString &pMuted, bool pArchived, bool pBlocked ) { transaction(); QSqlQuery setChannel; @@ -760,7 +779,7 @@ void PersistanceLayer::addChannel( QString pId, QString pName, QString pType, bo commit(); } -void PersistanceLayer::addChannel( QString pId, QString pName, QString pType, bool pJoined ) +void PersistanceLayer::addChannel( const QString &pId, const QString &pName, const QString &pType, bool pJoined ) { bool readOnly = false; QString muted = ""; @@ -769,7 +788,7 @@ void PersistanceLayer::addChannel( QString pId, QString pName, QString pType, bo addChannel( pId, pName, pType, pJoined, readOnly, muted, archived, blocked ); } -void PersistanceLayer::deleteChannel( QString pId ) +void PersistanceLayer::deleteChannel( const QString &pId ) { QSqlQuery deleteQuery; deleteQuery.prepare( QStringLiteral( "DELETE FROM rooms WHERE id=:id" ) ); @@ -787,20 +806,21 @@ void PersistanceLayer::deleteChannel( QString pId ) } } -void PersistanceLayer::addMessage( QString pId, QString pRid, QString pAuthor, qint64 pTs, QString pJson ) +void PersistanceLayer::addMessage( const QString &pId, const QString &pRid, const QString &pAuthor, qint64 pTs, const QString &pJson, const QString &pUserId ) { transaction(); QSqlQuery addMessage( mDb ); addMessage.prepare( QStringLiteral( "REPLACE INTO messages " - "(id,rid,author,ts,json,read) VALUES (:id,:rid,:author,:ts,:json,0)" ) ); + "(id,rid,author,ts,json,read, user_id) VALUES (:id,:rid,:author,:ts,:json,0,:user_id)" ) ); addMessage.bindValue( QStringLiteral( ":id" ), pId ); addMessage.bindValue( QStringLiteral( ":rid" ), pRid ); addMessage.bindValue( QStringLiteral( ":author" ), pAuthor ); addMessage.bindValue( QStringLiteral( ":ts" ), pTs ); addMessage.bindValue( QStringLiteral( ":json" ), pJson ); + addMessage.bindValue( QStringLiteral( ":user_id" ), pUserId ); if ( !addMessage.exec() ) { - qWarning() << "id: " << pId << " rid: " << pRid << " author: " << pAuthor << " ts: " << pTs << " json: " << pJson; + qWarning() << "id: " << pId << " rid: " << pRid << " author: " << pAuthor << " ts: " << pTs << " json: " << pJson << "userId: " << pUserId; qWarning() << addMessage.lastQuery(); qWarning() << addMessage.executedQuery(); qWarning() << addMessage.lastError(); @@ -809,7 +829,7 @@ void PersistanceLayer::addMessage( QString pId, QString pRid, QString pAuthor, q commit(); } -void PersistanceLayer::addFileCacheEntry( QString pUrl, QString pPath ) +void PersistanceLayer::addFileCacheEntry( const QString &pUrl, const QString &pPath ) { transaction(); qDebug() << pUrl; @@ -830,16 +850,16 @@ void PersistanceLayer::addFileCacheEntry( QString pUrl, QString pPath ) commit(); } -void PersistanceLayer::addCustomEmoji( QString pTag, QString pPath, QString pHtml, QString pCategory ) +void PersistanceLayer::addCustomEmoji( const QString &pTag, const QString &pPath, const QString &pHtml, const QString &pCategory ) { addCustomEmoji( pTag, pPath, pHtml, pCategory, QString( "" ) ); } -void PersistanceLayer::addCustomEmoji( QString pTag, QString pPath, QString pHtml, QString pCategory, QString pUnicode ) +void PersistanceLayer::addCustomEmoji( const QString &pTag, const QString &pPath, const QString &pHtml, const QString &pCategory, const QString &pUnicode ) { addCustomEmoji( pTag, pPath, pHtml, pCategory, pUnicode, 0 ); } -void PersistanceLayer::addCustomEmoji( QString pTag, QString pPath, QString pHtml, QString pCategory, QString pUnicode, int pOrder ) +void PersistanceLayer::addCustomEmoji( const QString &pTag, const QString &pPath, const QString &pHtml, const QString &pCategory, const QString &pUnicode, int pOrder ) { transaction(); QSqlQuery addCustomEmojiQuery; @@ -859,11 +879,27 @@ void PersistanceLayer::addCustomEmoji( QString pTag, QString pPath, QString pHtm commit(); } +void PersistanceLayer::addUserToBlockList( const QString &pUserId, const QString &pUsername ) +{ + transaction(); + QSqlQuery addUserQuery; + addUserQuery.prepare( QStringLiteral( "INSERT INO blocked_users(id, author) VALUES(:id,:author)" ) ); + addUserQuery.bindValue( ":id", pUserId ); + addUserQuery.bindValue( ":author", pUsername ); + + if ( !addUserQuery.exec() ) { + qWarning() << addUserQuery.lastError(); + } -QHash<QString, QString> PersistanceLayer::getMessageByid( QString pId ) + commit(); + +} + + +QHash<QString, QString> PersistanceLayer::getMessageByid( const QString &pId ) { QSqlQuery message; - message.prepare( QStringLiteral( "SELECT * FROM messages WHERE id=:id" ) ); + message.prepare( QStringLiteral( "SELECT * FROM messages LEFT JOIN blocked_users ON (messages.user_id=blocked_users.user_id) WHERE blocked_users.user_id IS NULL AND id=:id" ) ); message.bindValue( QStringLiteral( ":id" ), pId ); QHash<QString, QString> row; @@ -999,7 +1035,7 @@ QString PersistanceLayer::getUserId() return userId; } -QList<QJsonObject> PersistanceLayer::getMessagesByRid( QString pRid ) +QList<QJsonObject> PersistanceLayer::getMessagesByRid( const QString &pRid ) { QSqlQuery messages; messages.prepare( QStringLiteral( "SELECT * FROM messages WHERE rid=:rid ORDER BY ts DESC LIMIT 20" ) ); @@ -1037,7 +1073,7 @@ QList<QJsonObject> PersistanceLayer::getMessagesByRid( QString pRid ) return rows; } -QList<QJsonObject> PersistanceLayer::getMessagesByRid( QString pRid, qint64 pFrom, qint64 pTo ) +QList<QJsonObject> PersistanceLayer::getMessagesByRid( const QString &pRid, qint64 pFrom, qint64 pTo ) { QSqlQuery messages; messages.prepare( QStringLiteral( "SELECT * FROM messages WHERE rid=:rid AND ts<=:from AND ts>=:to ORDER BY ts DESC LIMIT 50" ) ); @@ -1077,7 +1113,7 @@ QList<QJsonObject> PersistanceLayer::getMessagesByRid( QString pRid, qint64 pFro return rows; } -QList<QJsonObject > PersistanceLayer::getMessagesByRid( QString pRid, qint64 pFrom, int pLimit ) +QList<QJsonObject > PersistanceLayer::getMessagesByRid( const QString &pRid, qint64 pFrom, int pLimit ) { QSqlQuery messages; messages.prepare( QStringLiteral( "SELECT * FROM messages WHERE rid=:rid AND ts<=:from ORDER BY ts DESC LIMIT :limit" ) ); @@ -1122,6 +1158,31 @@ QList<QJsonObject > PersistanceLayer::getMessagesByRid( QString pRid, qint64 pFr return rows; } +QList<QPair<QString, QString >> PersistanceLayer::getListOfBlockedUsers() +{ + QSqlQuery usersQuery; + usersQuery.prepare( QStringLiteral( "SELECT * FROM blocked_users" ) ); + QList<QPair<QString, QString >> retList; + + if ( !usersQuery.exec() ) { + qWarning() << "getList of blocked users "; + qWarning() << usersQuery.lastError(); + } else { + QSqlRecord rec = usersQuery.record(); + int idCol = rec.indexOf( "id" ); + int nameCol = rec.indexOf( "author" ); + + while ( usersQuery.next() ) { + QPair<QString, QString> pair; + pair.first = usersQuery.value( idCol ).String; + pair.second = usersQuery.value( nameCol ).String; + retList.append( pair ); + } + } + + return retList; +} + QList<QVariantHash> PersistanceLayer::getChannels( void ) { @@ -1198,7 +1259,7 @@ QList< QHash<QString, QString > > PersistanceLayer::getCustomEmojis() return returnList; } -QString PersistanceLayer::getFileCacheEntry( QString pUrl ) +QString PersistanceLayer::getFileCacheEntry( const QString &pUrl ) { QSqlQuery cacheEntry; cacheEntry.prepare( QStringLiteral( "SELECT path FROM file_cache WHERE url=:url" ) ); @@ -1229,7 +1290,7 @@ QString PersistanceLayer::getFileCacheEntry( QString pUrl ) return returnString; } -QString PersistanceLayer::getSetting( QString pProperty ) +QString PersistanceLayer::getSetting( const QString &pProperty ) { QSqlQuery settingsEntry; settingsEntry.prepare( QStringLiteral( "SELECT property,value FROM app_settings WHERE property=:property" ) ); @@ -1252,13 +1313,13 @@ QString PersistanceLayer::getSetting( QString pProperty ) } -void PersistanceLayer::removeFileCacheEntry( QString pUrl ) +void PersistanceLayer::removeFileCacheEntry( const QString &pUrl ) { QString fileName = getFileCacheEntry( pUrl ); removeFileCacheEntry( pUrl, fileName ); } -void PersistanceLayer::removeFileCacheEntry( QString pUrl, QString pPath ) +void PersistanceLayer::removeFileCacheEntry( const QString &pUrl, const QString &pPath ) { transaction(); diff --git a/persistancelayer.h b/persistancelayer.h index ef7dfc6ae1ffe55f307427e00260114ffaec8825..23a9d3aacc7b9fcf08986013ba9150eb569cf4fc 100755 --- a/persistancelayer.h +++ b/persistancelayer.h @@ -33,29 +33,31 @@ class PersistanceLayer : public QObject static PersistanceLayer *instance(); public slots: - void setUserData( QString pUser, QString pPass ); - void setCurrentChannel( QString pChannelId, QString pName ); - void setSetting( QString pProperty, QString pValue ); - void setUserName( QString ); - void setPassword( QString ); - void setToken( QString, uint ); - void addChannel( QString pId, QString pName, QString pType, bool pJoined, bool pReadOnly, QString pMuted, bool pArchived, bool pBlocked ); - void addChannel( QString pId, QString pName, QString pType, bool pJoined ); - void deleteChannel( QString pId ); - void addMessage( QString pId, QString pRid, QString pAuthor, qint64 pTs, QString pJson ); - void addFileCacheEntry( QString pUrl, QString pPath ); - void addCustomEmoji( QString pTag, QString pPath, QString pHtml, QString pCategory ); - void addCustomEmoji( QString pTag, QString pPath, QString pHtml, QString pCategory, QString pUnicode ); - void addCustomEmoji( QString pTag, QString pPath, QString pHtml, QString pCategory, QString pUnicode, int pOrder ); + void setUserData( const QString &pUser, const QString &pPass ); + void setCurrentChannel( const QString &pChannelId, const QString &pName ); + void setSetting( const QString &pProperty, const QString &pValue ); + void setUserName( const QString & ); + void setPassword( const QString & ); + void setToken( const QString &, uint ); + void addChannel( const QString &pId, const QString &pName, const QString &pType, bool pJoined, bool pReadOnly, const QString &pMuted, bool pArchived, bool pBlocked ); + void addChannel( const QString &pId, const QString &pName, const QString &pType, bool pJoined ); + void deleteChannel( const QString &pId ); + void addMessage( const QString &pId, const QString &pRid, const QString &pAuthor, qint64 pTs, const QString &pJson, const QString &pUserId ); + void addFileCacheEntry( const QString &pUrl, const QString &pPath ); + void addCustomEmoji( const QString &pTag, const QString &pPath, const QString &pHtml, const QString &pCategory ); + void addCustomEmoji( const QString &pTag, const QString &pPath, const QString &pHtml, const QString &pCategory, const QString &pUnicode ); + void addCustomEmoji( const QString &pTag, const QString &pPath, const QString &pHtml, const QString &pCategory, const QString &pUnicode, int pOrder ); + void addUserToBlockList( const QString &pUserId, const QString &pUsername ); + public: - QString addFileToTemp( QString pUrl, QString pPath ); - QString addFileToDocuments( QString pUrl, QString pPath ); - QString addFileToMusics( QString pUrl, QString pPath ); - QString addFileToVideos( QString pUrl, QString pPath ); - QString addFileToImages( QString pUrl, QString pPath ); - void createFolder( QString pPath ); - void setUserId( QString ); + QString addFileToTemp( const QString &pUrl, const QString &pPath ); + QString addFileToDocuments( const QString &pUrl, const QString &pPath ); + QString addFileToMusics( const QString &pUrl, const QString &pPath ); + QString addFileToVideos( const QString &pUrl, const QString &pPath ); + QString addFileToImages( const QString &pUrl, const QString &pPath ); + void createFolder( const QString &pPath ); + void setUserId( const QString & ); QString getUserName(); std::tuple<QString, QString> getCurrentChannel( void ); @@ -63,21 +65,22 @@ class PersistanceLayer : public QObject QPair<QString, uint> getToken(); QString getUserId(); QList<QVariantHash> getChannels( void ); - QHash<QString, QString> getMessageByid( QString pId ); - QList<QJsonObject> getMessagesByRid( QString pRid ); - QList<QJsonObject> getMessagesByRid( QString pRid, qint64 pFrom, qint64 pTo ); - QList<QJsonObject> getMessagesByRid( QString pRid, qint64 pFrom, int pLimit ); + QHash<QString, QString> getMessageByid( const QString &pId ); + QList<QJsonObject> getMessagesByRid( const QString &pRid ); + QList<QJsonObject> getMessagesByRid( const QString &pRid, qint64 pFrom, qint64 pTo ); + QList<QJsonObject> getMessagesByRid( const QString &pRid, qint64 pFrom, int pLimit ); + QList<QPair<QString, QString >> getListOfBlockedUsers(); QList<QHash<QString, QString > > getCustomEmojis(); Q_INVOKABLE QString getNewVideoPath( void ); Q_INVOKABLE QString getNewImagePath( void ); - QString getFileCacheEntry( QString pUrl ); + QString getFileCacheEntry( const QString &pUrl ); - Q_INVOKABLE QString getSetting( QString pProperty ); + Q_INVOKABLE QString getSetting( const QString &pProperty ); - void removeFileCacheEntry( QString pUrl ); - void removeFileCacheEntry( QString pUrl, QString pPath ); + void removeFileCacheEntry( const QString &pUrl ); + void removeFileCacheEntry( const QString &pUrl, const QString &pPath ); void transaction( void ); void commit( void ); @@ -90,7 +93,7 @@ class PersistanceLayer : public QObject private: PersistanceLayer() {} - QSqlDatabase mDb = QSqlDatabase::addDatabase( "QSQLITE" ); + QSqlDatabase mDb{ QSqlDatabase::addDatabase( "QSQLITE" )}; QMimeDatabase mMimeDb; QMutex mMutex; QAtomicInt counter = 0; diff --git a/repos/entities/rocketchatmessage.cpp b/repos/entities/rocketchatmessage.cpp index 20938c90038ec1a870580d07cab1d59a8cb1bfd9..a7915bd437e9bd7040acefe4bf1a5eac435f0927 100755 --- a/repos/entities/rocketchatmessage.cpp +++ b/repos/entities/rocketchatmessage.cpp @@ -174,3 +174,13 @@ void RocketChatMessage::setEmojiHash( const qint64 &pValue ) { mEmojiHash = pValue; } + +QString RocketChatMessage::getAuthorId() const +{ + return authorId; +} + +void RocketChatMessage::setAuthorId(const QString &value) +{ + authorId = value; +} diff --git a/repos/entities/rocketchatmessage.h b/repos/entities/rocketchatmessage.h index e7aaf10d10ab21df7008226aabe6f3093e7a4a2b..43e1940060c772ba190968a43b703d141b0e7404 100755 --- a/repos/entities/rocketchatmessage.h +++ b/repos/entities/rocketchatmessage.h @@ -90,6 +90,9 @@ class RocketChatMessage qint64 getEmojiHash() const; void setEmojiHash( const qint64 &pValue ); + QString getAuthorId() const; + void setAuthorId( const QString &value ); + protected: bool empty = false; qint64 timestamp = 0; @@ -104,6 +107,7 @@ class RocketChatMessage QString messageString; QString id; QString author; + QString authorId; QString messageType; QList<QSharedPointer<RocketChatAttachment>> attachments; qint64 mEmojiHash = 0; diff --git a/rocketchat.cpp b/rocketchat.cpp index 765f1946d2fd784ccdf2c17a24867f0aa7b79628..fcde95002fb5ea34d68229f7dcfc299e9f24bc70 100755 --- a/rocketchat.cpp +++ b/rocketchat.cpp @@ -229,6 +229,11 @@ void RocketChat::leaveChannel( const QString &pChannelId ) QMetaObject::invokeMethod( mServerMap.first(), "leaveChannel", Q_ARG( QString, pChannelId ) ); } +void RocketChat::hideChannel( const QString &pChannelId ) +{ + QMetaObject::invokeMethod( mServerMap.first(), "hideChannel", Q_ARG( QString, pChannelId ) ); +} + bool RocketChat::newServerByDomain( const QString &domain ) { newServerMutex.lock(); diff --git a/rocketchat.h b/rocketchat.h index dc329004e821aeaefe2d1e197e4c68fcc5ae9409..70c40827ed8b49ea2d94e887bd050f17fbf1dfe9 100755 --- a/rocketchat.h +++ b/rocketchat.h @@ -127,6 +127,8 @@ class RocketChat : public QObject Q_INVOKABLE void leaveChannel( const QString &pChannelId ); + Q_INVOKABLE void hideChannel( const QString &pChannelId ); + void registerServer( RocketChatServerData *pServer ); diff --git a/rocketchatserver.cpp b/rocketchatserver.cpp index 30c1487cfe1a13925f6f47c0a8fe66084a2eec20..f28b51ce49a0fa243f6bb7d97e7bac2aa785c17f 100755 --- a/rocketchatserver.cpp +++ b/rocketchatserver.cpp @@ -91,7 +91,7 @@ void RocketChatServerData::init() loadEmojis(); //mMessageService = new MessageService( mStorage, this, mEmojisMap ); - mMessageService = new MessageService( mStorage, this, mEmojiRepo ); + mMessageService = new MessageService( mStorage, this, mEmojiRepo, &mMessagesModel ); mChannelService = new RocketChatChannelService( this, mMessageService ); mChannelService->setDdp( mDdpApi ); @@ -363,16 +363,36 @@ void RocketChatServerData::blockUser( const QString &pChannelId ) { auto userId = pChannelId; userId.replace( mUserId, "" ); - QSharedPointer<RocketChatBlockUserRequest> blockRequest( new RocketChatBlockUserRequest( pChannelId, userId ) ); - mDdpApi->sendRequest( blockRequest ); + + if ( userId == pChannelId ) { + QString possibleRoom1 = userId + mUserId; + QString possibleRoom2 = mUserId + userId; + QSharedPointer<RocketChatBlockUserRequest> blockRequest1( new RocketChatBlockUserRequest( possibleRoom1, userId ) ); + QSharedPointer<RocketChatBlockUserRequest> blockRequest2( new RocketChatBlockUserRequest( possibleRoom2, userId ) ); + mDdpApi->sendRequest( blockRequest1 ); + mDdpApi->sendRequest( blockRequest2 ); + } else { + QSharedPointer<RocketChatBlockUserRequest> blockRequest( new RocketChatBlockUserRequest( pChannelId, userId ) ); + mDdpApi->sendRequest( blockRequest ); + } } void RocketChatServerData::unBlockUser( const QString &pChannelId ) { auto userId = pChannelId; userId.replace( mUserId, "" ); - QSharedPointer<RocketChatUnblockUserRequest> unBlockRequest( new RocketChatUnblockUserRequest( pChannelId, userId ) ); - mDdpApi->sendRequest( unBlockRequest ); + + if ( userId == pChannelId ) { + QString possibleRoom1 = userId + mUserId; + QString possibleRoom2 = mUserId + userId; + QSharedPointer<RocketChatUnblockUserRequest> unBlockRequest1( new RocketChatUnblockUserRequest( possibleRoom1, userId ) ); + QSharedPointer<RocketChatUnblockUserRequest> unBlockRequest2( new RocketChatUnblockUserRequest( possibleRoom2, userId ) ); + mDdpApi->sendRequest( unBlockRequest1 ); + mDdpApi->sendRequest( unBlockRequest2 ); + } else { + QSharedPointer<RocketChatUnblockUserRequest> unBlockRequest( new RocketChatUnblockUserRequest( pChannelId, userId ) ); + mDdpApi->sendRequest( unBlockRequest ); + } } QString RocketChatServerData::getUserId() const @@ -881,19 +901,42 @@ void RocketChatServerData::handleChannelMessage( const QJsonObject &pMessage ) QString rid = data[QStringLiteral( "rid" )].toString(); bool blocked = false; QString name = data[QStringLiteral( "name" )].toString(); + bool hidden = false; + + if ( data.contains( QStringLiteral( "open" ) ) ) { + hidden = !data[QStringLiteral( "open" )].toBool(); + } if ( data.contains( QStringLiteral( "blocker" ) ) ) { blocked = data[QStringLiteral( "blocker" )].toBool(); - } - if ( mChannels->contains( rid ) && !mChannels->get( rid ).isNull() ) { - auto channel = mChannels->get( rid ); - channel->setName( name ); - channel->setBlocked( blocked ); - channel->setUnreadMessages( unread ); + //TODO: clean this up!, there should be a user service + QString otherUserId = rid.replace( mUserId, "" ); + if ( data.contains( "name" ) ) { + QString otherUserName = data["name"].toString(); + mStorage->addUserToBlockList( otherUserName, otherUserId ); + mMessageService->addUserToBlockList( otherUserId ); + + } + } + + if ( hidden ) { + mChannelService->deleteChannel( rid ); } else { - qWarning() << "channel not in channels repo " << rid; + if ( mChannels->contains( rid ) && !mChannels->get( rid ).isNull() ) { + auto channel = mChannels->get( rid ); + channel->setName( name ); + channel->setBlocked( blocked ); + channel->setUnreadMessages( unread ); + + } else { + QSharedPointer<RocketChatChannel> channel = mChannelService->createChannelObject( rid, name, data["t"].toString() ); + channel->setBlocked( blocked ); + channel->setUnreadMessages( unread ); + mChannels->add( rid, channel ); + + } } } } @@ -1667,6 +1710,11 @@ void RocketChatServerData::leaveChannel( const QString &pId ) mChannelService->leaveChannel( pId ); } +void RocketChatServerData::hideChannel( const QString &pId ) +{ + mChannelService->hideRoom( pId ); +} + QList<QSharedPointer<RocketChatUser> > RocketChatServerData::getUserOfChannel( const QString &pChannelId ) { QList<QSharedPointer<RocketChatUser>> users; diff --git a/rocketchatserver.h b/rocketchatserver.h index 9f8d72d577cdc542b545472fe115737c6c09d991..e52f9dc74ccd750d3d3e033cbf9e9d85d43f15ac 100755 --- a/rocketchatserver.h +++ b/rocketchatserver.h @@ -202,6 +202,8 @@ class RocketChatServerData : public QObject void leaveChannel( const QString &pId ); + void hideChannel( const QString &pId ); + public: QString getServerId() const; @@ -283,6 +285,10 @@ class RocketChatServerData : public QObject std::function<void ( QMultiMap<QString, QSharedPointer<RocketChatMessage>> *messages )> historyLoaded; QString mPendingSwitchRoomRequest; + + //TODO: only a quick and dirty solution, move it out and clean up! + QStringList mBlockedUsers; + void getServerSettings( void ); void onDDPConnected(); void onDDPAuthenticated(); diff --git a/rocketchatserver.h.orig b/rocketchatserver.h.orig new file mode 100755 index 0000000000000000000000000000000000000000..4f7ed3c6041839e7bf49355d8a505c5761cbed65 --- /dev/null +++ b/rocketchatserver.h.orig @@ -0,0 +1,344 @@ +/******************************************************************************************** + * * + * Copyright (C) 2017 Armin Felder, Dennis Beier * + * This file is part of RocketChatMobileEngine <https://git.fairkom.net/chat/fairchat>. * + * * + * RocketChatMobileEngine is free software: you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation, either version 3 of the License, or * + * (at your option) any later version. * + * * + * RocketChatMobileEngine is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with RocketChatMobileEngine. If not, see <http://www.gnu.org/licenses/>. * + * * + ********************************************************************************************/ + + + +#ifndef ROCKETCHATSERVER_H +#define ROCKETCHATSERVER_H + +#include <QObject> +#include <QVariantList> +#include <algorithm> // std::transform +#include <QVariant> +#include <QList> +#include <QString> +#include <QMimeType> +#include <QCryptographicHash> +#include <QJsonArray> + +#include "utils.h" +#include "persistancelayer.h" +#include "api/meteorddp.h" +#include "api/restapi.h" +#include "repos/userrepository.h" +#include "repos/channelrepository.h" +#include "repos/loginmethodsrepository.h" +#include "repos/entities/loginmethod.h" +#include "ddpRequests/pingrequest.h" +#include "ddpRequests/ddploginrequest.h" +#include "ddpRequests/rocketchatsubscribechannelrequest.h" +#include "ddpRequests/ddpufscreaterequest.h" +#include "ddpRequests/rocketchatsubscribeusernotify.h" +#include "ddpRequests/rocketchatnotifynoticesrequest.h" +#include "ddpRequests/rocketchatsubscriptionchangedrequest.h" +#include "ddpRequests/rocketchatmarkchannelasreadrequest.h" +#include "ddpRequests/rocketchatcreatechannelrequest.h" +#include "ddpRequests/ddpunsubscriptionrequest.h" +#include "ddpRequests/rocketchatcreateprivategrouprequest.h" +#include "ddpRequests/rocketchatadduserstochannel.h" +#include "ddpRequests/rocketchatsubscriberoomrequest.h" +#include "ddpRequests/rocketchatupdatepushtokenrequest.h" +#include "ddpRequests/ddplogoutrequest.h" +#include "ddpRequests/rocketchatsubscribeactiveusers.h" +#include "ddpRequests/rocketchatchangeuserpresancedefaultstatus.h" +#include "ddpRequests/rocketchatupdatejitsitimeout.h" +#include "ddpRequests/rocketchatsubscribeloginmethods.h" +#include "ddpRequests/ddpopenidloginrequest.h" +#include "ddpRequests/rocketchatspotlightrequest.h" +#include "ddpRequests/ddpsamlloginrequest.h" +#include "ddpRequests/rocketchatblockuserrequest.h" +#include "ddpRequests/rocketchatunblockuserrequest.h" +#include "restRequests/restrequest.h" +#include "restRequests/restlogoutrequest.h" +#include "restRequests/getserverinforequest.h" +#include "fileuploader.h" +#include "notifications/notifications.h" +#include "services/rocketchatchannelservice.h" +#include "services/messageservice.h" +#include "services/requests/loadhistoryservicerequest.h" +#include "services/fileservice.h" +#include "repos/emojirepo.h" +#include "rocketchatserverconfig.h" +#include "repos/channelrepository.h" +#include "services/emojiservice.h" +#include "restRequests/getrequest.h" +#include "segfaulthandler.h" +#include "CustomModels/usermodel.h" +#include "CustomModels/loginmethodsmodel.h" +#include "restRequests/restmerequest.h" +#include "ddpRequests/rocketchatcreateaccount.h" + +class RocketChatChannelService; +class ChannelRepository; +class FileUploader; +class PersistanceLayer; +typedef QSharedPointer<RestRequest> RestApiRequest; +class MessageService; +class EmojiService; +class DdpLogoutRequest; +class FileService; +class EmojiRepo; +class ChannelModel; +class MessagesModel; + +enum class ConnectionState { + OFFLINE, + CONNECTED, + ONLINE +}; + +class RocketChatServerData : public QObject +{ + + Q_OBJECT + public: + RocketChatServerData( const QString &pId, QString pBaseUrl, + QString pApiUri, + UserModel &pUserModel, + ChannelModel &channelModel, + ChannelModel &groupsModel, + ChannelModel &directModel, + MessagesModel &messagesModel, + LoginMethodsModel &loginMethodsModel ); + + ~RocketChatServerData(); + void setServerId( const QString &pValue ); + + void setServerAddress( const QString &pServerAddress ); + + public slots: + + void init(); + + void createChannel( const QString &pChannelName, const QStringList &pUsers, bool pReadonly ); + void createPrivateGroup( const QString &pChannelName, const QStringList &pUsers, bool pReadonly ); + void addUsersToChannel( const QString &pChannelName, const QStringList &pUsers ); + void sendMessage( const QString &pChannelId, const QString &pMessage ); + + void uploadFile( const QString &pChannelId, const QString &pFile ); + void cancelUpload( const QString &pFileId ); + + void login( const QString &pUsername, const QString &pPassword ); + void loginWithHash( const QString &pUsername, const QString &pHash ); + void loginWithToken( const QString &pUsername, const QString &pToken, bool pResume = false ); + void loginWithOpenIDToken( const QString &pToken, const QString &pSecret ); + void loginWithMethod( const QString &method, const QString &payload ); + void loginWtihSamlToken( const QString &pToken ); + + void joinChannel( const QString &pChannelId ); + void connectWithServer(); + void loadRecentHistory( const QString &pChannelId ); + + void getFileRessource( const QString &pUrl ); + void getFileRessource( const QString &pUrl, const QString &pType ); + + + void getUserSuggestions( const QString &pTerm, const QString &pExceptions ); + void getRoomInformation( const QString &pRoomName ); + void getLoginMethods(); + + void getServerInfo(); + +<<<<<<< HEAD + void leaveChannel( const QString &pId ); + +======= +>>>>>>> master + void logout( void ); + + void setConnectionState( const ConnectionState &pValue ); + + void resume( void ); + + void joinJitsiCall( const QString &pRoomId ); + + void setUnreadMessages( const QString &pChannelId, int count ); + + void openPrivateChannelWith( const QString &pUsername ); + + void setCurrentChannel( const QString &value ); + + void markChannelAsRead( const QString &pChannelId ); + + void sendPushToken( const QString &pToken ); + + void requestAllChannels(); + + void requestUsersOfChannel( const QString &pChannelId ); + + void switchChannel( const QString &pServer, const QString &pRid, const QString &pName, const QString &pType ); + + void switchChannelByRid( const QString &pRid ); + + void requestGetChannelDetails( const QString &pChannelId ); + + void requestIsLoggedIn(); + + void setUserPresenceStatus( int pStatus ); + + void onStateChanged( const Qt::ApplicationState &pState ); + + void createVideoCall( const QString &pRid ); + + void disconnectFromServer(); + + void searchForRoomIdByName( const QString &pName ); + + void blockUser( const QString &pChannelId ); + + void unBlockUser( const QString &pChannelId ); + + + public: + QString getServerId() const; + bool isConnected() const; + bool isWebsocketValid( void ) const; + void getCustomEmojis(); + QList<QSharedPointer<RocketChatUser>> getUserOfChannel( const QString &pChannelId ); + RestApi *getRestApi() const; + ChannelRepository *getChannels() const; + RocketChatChannelService *mChannelService; + void handleChannelMessage( const QJsonObject &pMessage ); + uint diffToLastDDPPing(); + QVariantList getEmojisByCategory() const; + QString parseMessageReceived( const QString &pMessage ); + void sendUnsentMessages( void ); + void sendApiRequest( const RestApiRequest &pRequest, bool pRetry = true ); + void sendDdprequest( const QSharedPointer<DDPRequest> &pRequest, bool pRetry = true, bool pSendWhenConnected = false ); + QJsonObject getMessageData( const QString &pChannelId, const QString &pMesssageId ); + QJsonObject formatMessageTime( const QJsonObject &pJsonObject ); + bool initialised = 0; + ConnectionState getConnectionState() const; + + QString getCurrentChannel() const; + + QString getUsername() const; + void setUsername( const QString &pUsername ); + + QString getUserId() const; + void setUserId( const QString &userId ); + + qint16 getCustomEmojisHash() const; + void setCustomEmojisHash( const qint16 &customEmojisHash ); + + EmojiRepo *getEmojiRepo() const; + void setEmojiRepo( EmojiRepo *emojiRepo ); + void createAccount( const QString &username, const QString &email, const QString &password ); + + void offlineLogin(); + + protected: + + RocketChatServerData(); + ConnectionState mConnectionState = ConnectionState::OFFLINE; + QString mUsername = ""; + QString mUserId = ""; + QString mBaseUrl = ""; + QString mApiUri = ""; + QString mServerId = ""; + uint mTokenExpire = 0; + QString mResumeToken; + + MeteorDDP *mDdpApi = nullptr; + RestApi *mRestApi = nullptr; + UserRepository mUsers; + LoginMethodsRepository mLoginMethodRepo; + ChannelRepository *mChannels = nullptr; + EmojiRepo *mEmojiRepo = nullptr; + QVariantMap mAutocompleteRecords; + RocketChatServerConfig config; + bool mConnected = false; + bool mLoggedIn = false; + bool mResumeOperation = false; + MessageService *mMessageService = nullptr; + PersistanceLayer *mStorage = nullptr; + EmojiService *mEmojiService = nullptr; + FileService *mFileService = nullptr; + QHash<QString, bool> mDownloadsInProgress; + QLinkedList<QSharedPointer<DDPRequest>> mUnsendDdpRequests; + QLinkedList<RestApiRequest> mUnsendRestRequests; + QMap<QString, FileUploader *> mFileUploads; + QString mCurrentChannel; + QMutex mUnsentMutex; + UserModel &userModel; + ChannelModel &channelsModel; + ChannelModel &groupsModel; + ChannelModel &directModel; + MessagesModel &mMessagesModel; + LoginMethodsModel &loginMethodsModel; + std::function<void ( QMultiMap<QString, QSharedPointer<RocketChatMessage>> *messages )> historyLoaded; + QString mPendingSwitchRoomRequest; + + void getServerSettings( void ); + void onDDPConnected(); + void onDDPAuthenticated(); + void onDDPMessageReceived( const QJsonObject &pMessage ); + void onChannelsLoaded( const QVector<QSharedPointer<RocketChatChannel> > &pChannels ); + void onFileDownloaded( const QString &pUrl, const QString &pTempfile ); + void onLoggedIn(); + bool isStreamRoomMessage( const QJsonObject &pMessage ) const; + bool isUserJoinMessage( const QJsonObject &pMessage ) const; + void handleStreamRoomMessage( const QJsonObject &pMessage ); + void handleUserJoinMessage( const QJsonObject &pMessage ); + void onMessageReceived( const QString &pServerId, const QString &pChannelId, const QString &pMessage ); + void onLoginError(); + void onResume(); + void setRestApi( RestApi * ); + + bool customEmojisDirtyFlag = false; + + void loadEmojis(); + void loadHistories( void ); + void checkForMissedMessages( void ); + void onUsersLoaded( const QString &pChannelId, const QVector<QSharedPointer<RocketChatUser>> &pUserList ); + + void onUnreadCountChanged(); + + qint16 mCustomEmojisHash = 0; + + signals: + void ddpConnected( const QString &pServerId ); + void loggedIn( const QString &pServer ); + void onHashLoggedIn( const QString &pServer ); + void privateChannelCreated( const QString &pServerId, const QString &pRid, const QString &pUsername ); + void loginError( void ); + void userJoined( const QString &pChannelId, const QString &pUsername ); + void loggedOut( const QString &pServerId ); + void suggestionsReady( QVariantMap ); + void fileUploadFinished( const QString &pData ); + void fileuploadStarted( const QString &pData ); + void fileUploadProgressChanged( const QString &pData ); + void error( const QString &pError ); + void fileRessourceProcessed( const QString &pUrl, const QString &pPath, bool pShowInline ); + void customEmojisReceived( QVariantList pEmojis ); + void channelSwitchRequest( const QString &pServer, const QString &pRid, const QString &pName, const QString &pType, bool readonlyFlag ); + void openUrl( const QString &url ); + void readyToCheckForPendingNotification(); + void registerForPush(); + void allChannelsReady( const QVariantList &channels ); + void usersReady( const QString &users, const QString &channel ); + void channelDetailsReady( QVariantMap details, const QString &channelId ); + void unreadCountChanged( const QString &pServerId, uint pUnread ); + void newLoginMethod( const QMap<QString, QVariant> &entry ); + void resetLoginMethods(); + +}; + +#endif // ROCKETCHATSERVER_H diff --git a/services/messageservice.cpp b/services/messageservice.cpp index 5d09bb9e952ead6b971c91e2b90810077a9db61a..d14d3a2ecac2bf9fd400cbc17c8a981c9ab34c43 100644 --- a/services/messageservice.cpp +++ b/services/messageservice.cpp @@ -34,7 +34,8 @@ MessageService::MessageService( PersistanceLayer *pPersistanceLayer, RocketChatServerData *pServer, - EmojiRepo *pEmojiRepo ): mEmojiRepo( pEmojiRepo ) + EmojiRepo *pEmojiRepo, + MessagesModel *pMessagesModel ): mEmojiRepo( pEmojiRepo ), mMessagesModel( pMessagesModel ) { this->mPersistanceLayer = pPersistanceLayer; this->mServer = pServer; @@ -83,7 +84,7 @@ void MessageService::persistMessage( QSharedPointer<RocketChatMessage> pMessage if ( !pMessage.isNull() ) { QJsonDocument doc( pMessage->getData() ); QString msg = doc.toJson(); - mPersistanceLayer->addMessage( pMessage->getId(), pMessage->getRoomId(), pMessage->getAuthor(), pMessage->getTimestamp(), msg ); + mPersistanceLayer->addMessage( pMessage->getId(), pMessage->getRoomId(), pMessage->getAuthor(), pMessage->getTimestamp(), msg, pMessage->getAuthorId() ); } } @@ -106,6 +107,7 @@ QSharedPointer<RocketChatMessage> MessageService::parseMessage( const QJsonObjec //QString username = mServer->getUsername(); QString userId = mServer->getUserId(); qint16 emojiHash = mServer->getCustomEmojisHash(); + bool blocked = false; if ( Q_LIKELY( pMessageData.contains( QStringLiteral( "msg" ) ) ) ) { //parse message String @@ -180,6 +182,7 @@ QSharedPointer<RocketChatMessage> MessageService::parseMessage( const QJsonObjec message = ChatMessage( new RocketChatMessage( pMessageData ) ); message->setAttachments( attachments ); message->setOwnMessage( ownMessage ); + message->setAuthorId( authorId ); if ( attachments.size() > 0 ) { auto firstAttachment = attachments.first(); @@ -195,13 +198,35 @@ QSharedPointer<RocketChatMessage> MessageService::parseMessage( const QJsonObjec message->setMessageString( msgString ); message->setMessageType( msgType ); + if ( mBlockedUsers.contains( author ) ) { + blocked = true; + } } if ( Q_UNLIKELY( message.isNull() ) ) { qDebug() << "invalid messag"; } - return message; + if ( !blocked ) { + return message; + } else { + return nullptr; + } +} + +void MessageService::addUserToBlockList( const QString &pId ) +{ + mBlockedUsers.insert( pId ); + QMetaObject::invokeMethod( mMessagesModel, "addBlockedUser", Q_ARG( QString, pId ) ); + +} + +void MessageService::addChannelToBlockList( const QString &pId ) +{ + QString roomId = pId; + QString userId = mServer->getUserId(); + QString otherUserId = roomId.replace( userId, "" ); + addUserToBlockList( otherUserId ); } void MessageService::loadHistoryFromServer( QSharedPointer<LoadHistoryRequestContainer> pContainer ) diff --git a/services/messageservice.h b/services/messageservice.h index 5c71c06147671d81975f136d0393754bf7bd539a..cff2513e511f3e2101fc92299f0c787206ad0086 100644 --- a/services/messageservice.h +++ b/services/messageservice.h @@ -38,6 +38,7 @@ #include "services/requests/loadhistoryservicerequest.h" #include "services/requests/loadHistoryrequestcontainer.h" #include "services/requests/loadmissedmessageservicerequest.h" +#include "CustomModels/messagemodel.h" typedef QList<QSharedPointer<RocketChatMessage>> MessageList; typedef QSharedPointer<RocketChatMessage> ChatMessage; @@ -49,26 +50,28 @@ class MessageService : public QObject Q_OBJECT public: // MessageService(PersistanceLayer *pPersistanceLayer, RocketChatServerData* pServer,QHash<QString, QString> &pEmojisMap); - MessageService( PersistanceLayer *pPersistanceLayer, RocketChatServerData *pServer, EmojiRepo *mEmojiRepo ); + MessageService( PersistanceLayer *pPersistanceLayer, RocketChatServerData *pServer, EmojiRepo *mEmojiRepo, MessagesModel *pMessagesModel ); void loadHistory( QSharedPointer<LoadHistoryServiceRequest> ); void checkForMissingMessages( QSharedPointer<LoadMissedMessageServiceRequest> pRequest ); void sendMessage( QSharedPointer<RocketChatMessage> pMessage ); void persistMessage( QSharedPointer<RocketChatMessage> pMessage ); void persistMessages( MessageList pMessage ); QSharedPointer<RocketChatMessage> parseMessage( const QJsonObject &pMessage, bool linkify = true ); + void addUserToBlockList( const QString &pId ); + void addChannelToBlockList( const QString &pId ); protected: const static int mExpectedSize = 50; PersistanceLayer *mPersistanceLayer; RocketChatServerData *mServer; + MessagesModel *mMessagesModel; void loadHistoryFromServer( QSharedPointer<LoadHistoryRequestContainer> pContainer ); void loadHistoryFromServer( QSharedPointer<LoadHistoryServiceRequest> pContainer ); QMultiMap<QString, ChatMessage> *loadHistoryFromDb( QSharedPointer<LoadHistoryServiceRequest> pRequest ); void loadHistoryFromAutoSource( QSharedPointer<LoadHistoryServiceRequest> pRequest ); QList<QSharedPointer<RocketChatAttachment>> processAttachments( QJsonObject pMessageData ); - // QHash<QString, QString> &mEmojisMap; EmojiRepo *mEmojiRepo; - + QSet<QString> mBlockedUsers; }; #endif // MESSAGESERVICE_H diff --git a/services/rocketchatchannelservice.cpp b/services/rocketchatchannelservice.cpp index 532577773edda5030fed6227d67ce8d3c90bfc98..673a712ca3fe81b3aec0ab3e56e817ec25449742 100755 --- a/services/rocketchatchannelservice.cpp +++ b/services/rocketchatchannelservice.cpp @@ -98,6 +98,10 @@ QVector<QSharedPointer<RocketChatChannel> > RocketChatChannelService::processCha if ( currentChannelObject.contains( "blocker" ) ) { channel->setBlocked( currentChannelObject["blocker"].toBool() ); + + if ( currentChannelObject["blocker"].toBool() ) { + mMessageService->addChannelToBlockList( channel->getRoomId() ); + } } if ( currentChannelObject.contains( "muted" ) ) { @@ -309,7 +313,6 @@ void RocketChatChannelService::leaveChannel( const QString &pId ) auto ddp = getDdp(); ddp->sendRequest( request ); deleteChannel( pId ); - mStorage->deleteChannel( pId ); } } @@ -317,9 +320,19 @@ void RocketChatChannelService::deleteChannel( const QString &pId ) { if ( mChannels->contains( pId ) ) { mChannels->get( pId )->setDeleted( true ); + mStorage->transaction(); + mStorage->deleteChannel( pId ); + mStorage->commit(); } } +void RocketChatChannelService::hideRoom( const QString &pId ) +{ + QSharedPointer<RocketChatHideRoomRequest> request( new RocketChatHideRoomRequest( pId ) ); + mDdp->sendRequest( request ); + deleteChannel( pId ); +} + void RocketChatChannelService::openPrivateChannelWith( QString pUsername ) { QJsonArray params = {pUsername}; diff --git a/services/rocketchatchannelservice.h b/services/rocketchatchannelservice.h index 3595aa30703236deb8eddfabf88f21242be054c1..36c4dd54965480717e05641351f230ce0dbb55bc 100755 --- a/services/rocketchatchannelservice.h +++ b/services/rocketchatchannelservice.h @@ -36,6 +36,7 @@ #include "rocketchatserver.h" #include "ddpRequests/rocketchatgetroomsrequest.h" #include "ddpRequests/rocketchatleaveroomrequest.h" +#include "ddpRequests/rocketchathideroomrequest.h" #include "services/messageservice.h" #include "repos/channelrepository.h" @@ -77,6 +78,8 @@ class RocketChatChannelService : public QObject void deleteChannel( const QString &pId ); + void hideRoom( const QString &pId ); + ~RocketChatChannelService(); diff --git a/sql.qrc b/sql.qrc index fa43fd7a2d369990f03beb3b9d15ad8f25b52975..c3791005f2aaccc9f9b7006f0b449b826713b4f8 100644 --- a/sql.qrc +++ b/sql.qrc @@ -3,5 +3,6 @@ <file>sql/migrations/1.sql</file> <file>sql/emojis.sql</file> <file>sql/migrations/2.sql</file> + <file>sql/migrations/3.sql</file> </qresource> </RCC> diff --git a/sql/migrations/3.sql b/sql/migrations/3.sql new file mode 100644 index 0000000000000000000000000000000000000000..89d33dae2595380f019ac611b7bb4efee6dcbf80 --- /dev/null +++ b/sql/migrations/3.sql @@ -0,0 +1,2 @@ +ALTER TABLE messages ADD user_id varchar(12) DEFAULT ""; +REPLACE INTO app_info (db_ver) VALUES(3);