diff --git a/api/meteorddp.cpp b/api/meteorddp.cpp index ced3ea025b5027822ef572f2072483852737672e..35f0ff54493204df0ff0aa144a7a15db74f4237a 100755 --- a/api/meteorddp.cpp +++ b/api/meteorddp.cpp @@ -41,7 +41,7 @@ void MeteorDDP::init( const QString &pUri, bool pUnsecure ) mWsClient = new Websocket( this ); QString protocol = QStringLiteral( "wss://" ); - + unsecure = pUnsecure; if ( pUnsecure ) { protocol = QStringLiteral( "ws://" ); } @@ -193,6 +193,11 @@ void MeteorDDP::sendJson( const QJsonObject &pMsgObj ) mWsClient->sendTextMessage( msgString ); } +bool MeteorDDP::getUnsecure() const +{ + return unsecure; +} + void MeteorDDP::onConnected() { qDebug() << "connected websocket"; diff --git a/api/meteorddp.h b/api/meteorddp.h index a5f10fe191d90a5cc60beef5971f0605d13f23ab..60418de6d5614ddd7639222ff742094bba734a9d 100755 --- a/api/meteorddp.h +++ b/api/meteorddp.h @@ -60,10 +60,13 @@ class MeteorDDP : public QObject void setUserId( const QString &pUserId ); void registerMessageHandler(MessageListener *); + void registerMessageHandler(MessageListener &); void init( const QString &pServer, bool pUnsecure = false ); - private: + bool getUnsecure() const; + +private: QJsonParseError *mError; void pong(); @@ -71,6 +74,7 @@ class MeteorDDP : public QObject void loadLocale(); void userPresenceOnline(); void sendJson( const QJsonObject & ); + bool unsecure; int frameCount = 0; Websocket *mWsClient = nullptr; diff --git a/rocketchatserver.cpp b/rocketchatserver.cpp index cb9b88586165b51ce4d647cf76ad1ae106b8c652..e02cace088f6696acd948ed316b05e5595f2fb07 100755 --- a/rocketchatserver.cpp +++ b/rocketchatserver.cpp @@ -559,7 +559,11 @@ void RocketChatServerData::offlineLogin() QString RocketChatServerData::getBaseUrl() const { - return "https://"+mBaseUrl; + QString protocol ="https://"; + if(mDdpApi->getUnsecure()){ + protocol ="http://"; + } + return protocol+mBaseUrl; } QVariantList RocketChatServerData::getEmojisByCategory() const