diff --git a/src/rocketchatrestapi-qt5/chat/getthreadmessagesjob.cpp b/src/rocketchatrestapi-qt5/chat/getthreadmessagesjob.cpp index 3a30beb0..b0aefe6d 100644 --- a/src/rocketchatrestapi-qt5/chat/getthreadmessagesjob.cpp +++ b/src/rocketchatrestapi-qt5/chat/getthreadmessagesjob.cpp @@ -1,110 +1,110 @@ /* Copyright (c) 2019 Montel Laurent This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License or ( at your option ) version 3 or, at the discretion of KDE e.V. ( which shall act as a proxy as in section 14 of the GPLv3 ), any later version. This library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "getthreadmessagesjob.h" #include "restapimethod.h" #include "rocketchatqtrestapi_debug.h" #include #include #include #include using namespace RocketChatRestApi; GetThreadMessagesJob::GetThreadMessagesJob(QObject *parent) : RestApiAbstractJob(parent) { } GetThreadMessagesJob::~GetThreadMessagesJob() { } bool GetThreadMessagesJob::requireHttpAuthentication() const { return true; } bool GetThreadMessagesJob::canStart() const { if (!RestApiAbstractJob::canStart()) { qCWarning(ROCKETCHATQTRESTAPI_LOG) << "Impossible to start GetThreadMessagesJob"; return false; } if (mThreadMessageId.isEmpty()) { qCWarning(ROCKETCHATQTRESTAPI_LOG) << "GetThreadMessagesJob: mThreadMessageId is empty"; return false; } return true; } bool GetThreadMessagesJob::start() { if (!canStart()) { qCWarning(ROCKETCHATQTRESTAPI_LOG) << "Impossible to start GetThreadMessagesJob job"; deleteLater(); return false; } QNetworkReply *reply = mNetworkAccessManager->get(request()); connect(reply, &QNetworkReply::finished, this, &GetThreadMessagesJob::slotGetThreadMessagesFinished); - addLoggerInfo(QByteArrayLiteral("GetThreadMessagesJob: Ask info about rooms")); + addLoggerInfo(QByteArrayLiteral("GetThreadMessagesJob: Ask threads messages")); return true; } void GetThreadMessagesJob::slotGetThreadMessagesFinished() { QNetworkReply *reply = qobject_cast(sender()); if (reply) { const QByteArray data = reply->readAll(); const QJsonDocument replyJson = QJsonDocument::fromJson(data); const QJsonObject replyObject = replyJson.object(); if (replyObject[QStringLiteral("success")].toBool()) { addLoggerInfo(QByteArrayLiteral("GetThreadMessagesJob: success: ") + replyJson.toJson(QJsonDocument::Indented)); Q_EMIT getThreadMessagesDone(replyObject, mThreadMessageId); } else { emitFailedMessage(replyObject); addLoggerWarning(QByteArrayLiteral("GetThreadMessagesJob: Problem: ") + replyJson.toJson(QJsonDocument::Indented)); } reply->deleteLater(); } deleteLater(); } QString GetThreadMessagesJob::threadMessageId() const { return mThreadMessageId; } void GetThreadMessagesJob::setThreadMessageId(const QString &threadMessageId) { mThreadMessageId = threadMessageId; } QNetworkRequest GetThreadMessagesJob::request() const { QUrl url = mRestApiMethod->generateUrl(RestApiUtil::RestApiUrlType::ChatGetThreadMessages); QUrlQuery queryUrl; queryUrl.addQueryItem(QStringLiteral("tmid"), mThreadMessageId); url.setQuery(queryUrl); QNetworkRequest request(url); request.setAttribute(QNetworkRequest::HttpPipeliningAllowedAttribute, true); request.setAttribute(QNetworkRequest::HTTP2AllowedAttribute, true); addAuthRawHeader(request); return request; } diff --git a/src/rocketchatrestapi-qt5/chat/getthreadsjob.cpp b/src/rocketchatrestapi-qt5/chat/getthreadsjob.cpp index 959d08b6..54444f83 100644 --- a/src/rocketchatrestapi-qt5/chat/getthreadsjob.cpp +++ b/src/rocketchatrestapi-qt5/chat/getthreadsjob.cpp @@ -1,110 +1,110 @@ /* Copyright (c) 2019 Montel Laurent This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License or ( at your option ) version 3 or, at the discretion of KDE e.V. ( which shall act as a proxy as in section 14 of the GPLv3 ), any later version. This library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "getthreadsjob.h" #include "restapimethod.h" #include "rocketchatqtrestapi_debug.h" #include #include #include #include using namespace RocketChatRestApi; GetThreadsJob::GetThreadsJob(QObject *parent) : RestApiAbstractJob(parent) { } GetThreadsJob::~GetThreadsJob() { } bool GetThreadsJob::requireHttpAuthentication() const { return true; } bool GetThreadsJob::canStart() const { if (!RestApiAbstractJob::canStart()) { qCWarning(ROCKETCHATQTRESTAPI_LOG) << "Impossible to start GetThreadsJob"; return false; } if (mRoomId.isEmpty()) { qCWarning(ROCKETCHATQTRESTAPI_LOG) << "GetThreadsJob: mRoomId is empty"; return false; } return true; } bool GetThreadsJob::start() { if (!canStart()) { qCWarning(ROCKETCHATQTRESTAPI_LOG) << "Impossible to start GetThreadsJob job"; deleteLater(); return false; } QNetworkReply *reply = mNetworkAccessManager->get(request()); connect(reply, &QNetworkReply::finished, this, &GetThreadsJob::slotGetThreadsFinished); - addLoggerInfo(QByteArrayLiteral("GetThreadsJob: Ask info about rooms")); + addLoggerInfo(QByteArrayLiteral("GetThreadsJob: Ask All threads in room")); return true; } void GetThreadsJob::slotGetThreadsFinished() { QNetworkReply *reply = qobject_cast(sender()); if (reply) { const QByteArray data = reply->readAll(); const QJsonDocument replyJson = QJsonDocument::fromJson(data); const QJsonObject replyObject = replyJson.object(); if (replyObject[QStringLiteral("success")].toBool()) { addLoggerInfo(QByteArrayLiteral("GetThreadsJob: success: ") + replyJson.toJson(QJsonDocument::Indented)); Q_EMIT getThreadsDone(replyObject, mRoomId); } else { emitFailedMessage(replyObject); addLoggerWarning(QByteArrayLiteral("GetThreadsJob: Problem: ") + replyJson.toJson(QJsonDocument::Indented)); } reply->deleteLater(); } deleteLater(); } QString GetThreadsJob::roomId() const { return mRoomId; } void GetThreadsJob::setRoomId(const QString &roomId) { mRoomId = roomId; } QNetworkRequest GetThreadsJob::request() const { QUrl url = mRestApiMethod->generateUrl(RestApiUtil::RestApiUrlType::ChatGetThreadsList); QUrlQuery queryUrl; queryUrl.addQueryItem(QStringLiteral("rid"), mRoomId); url.setQuery(queryUrl); QNetworkRequest request(url); request.setAttribute(QNetworkRequest::HttpPipeliningAllowedAttribute, true); request.setAttribute(QNetworkRequest::HTTP2AllowedAttribute, true); addAuthRawHeader(request); return request; } diff --git a/src/rocketchatrestapi-qt5/rooms/getdiscussionsjob.cpp b/src/rocketchatrestapi-qt5/rooms/getdiscussionsjob.cpp index 568d83f0..731089f4 100644 --- a/src/rocketchatrestapi-qt5/rooms/getdiscussionsjob.cpp +++ b/src/rocketchatrestapi-qt5/rooms/getdiscussionsjob.cpp @@ -1,110 +1,110 @@ /* Copyright (c) 2019 Montel Laurent This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License or ( at your option ) version 3 or, at the discretion of KDE e.V. ( which shall act as a proxy as in section 14 of the GPLv3 ), any later version. This library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "getdiscussionsjob.h" #include "restapimethod.h" #include "rocketchatqtrestapi_debug.h" #include #include #include #include using namespace RocketChatRestApi; GetDiscussionsJob::GetDiscussionsJob(QObject *parent) : RestApiAbstractJob(parent) { } GetDiscussionsJob::~GetDiscussionsJob() { } bool GetDiscussionsJob::requireHttpAuthentication() const { return true; } bool GetDiscussionsJob::canStart() const { if (!RestApiAbstractJob::canStart()) { qCWarning(ROCKETCHATQTRESTAPI_LOG) << "Impossible to start GetDiscussionsJob"; return false; } if (mRoomId.isEmpty()) { qCWarning(ROCKETCHATQTRESTAPI_LOG) << "GetDiscussionsJob: mRoomId is empty"; return false; } return true; } bool GetDiscussionsJob::start() { if (!canStart()) { qCWarning(ROCKETCHATQTRESTAPI_LOG) << "Impossible to start GetDiscussionsJob job"; deleteLater(); return false; } QNetworkReply *reply = mNetworkAccessManager->get(request()); connect(reply, &QNetworkReply::finished, this, &GetDiscussionsJob::slotGetDiscussionsFinished); - addLoggerInfo(QByteArrayLiteral("GetDiscussionsJob: Ask info about rooms")); + addLoggerInfo(QByteArrayLiteral("GetDiscussionsJob: Ask discussions in room")); return true; } void GetDiscussionsJob::slotGetDiscussionsFinished() { QNetworkReply *reply = qobject_cast(sender()); if (reply) { const QByteArray data = reply->readAll(); const QJsonDocument replyJson = QJsonDocument::fromJson(data); const QJsonObject replyObject = replyJson.object(); if (replyObject[QStringLiteral("success")].toBool()) { addLoggerInfo(QByteArrayLiteral("GetDiscussionsJob: success: ") + replyJson.toJson(QJsonDocument::Indented)); Q_EMIT getDiscussionsDone(replyObject, mRoomId); } else { emitFailedMessage(replyObject); addLoggerWarning(QByteArrayLiteral("GetDiscussionsJob: Problem: ") + replyJson.toJson(QJsonDocument::Indented)); } reply->deleteLater(); } deleteLater(); } QString GetDiscussionsJob::roomId() const { return mRoomId; } void GetDiscussionsJob::setRoomId(const QString &roomId) { mRoomId = roomId; } QNetworkRequest GetDiscussionsJob::request() const { QUrl url = mRestApiMethod->generateUrl(RestApiUtil::RestApiUrlType::RoomsGetDiscussions); QUrlQuery queryUrl; queryUrl.addQueryItem(QStringLiteral("roomId"), mRoomId); url.setQuery(queryUrl); QNetworkRequest request(url); request.setAttribute(QNetworkRequest::HttpPipeliningAllowedAttribute, true); request.setAttribute(QNetworkRequest::HTTP2AllowedAttribute, true); addAuthRawHeader(request); return request; } diff --git a/src/rocketchatrestapi-qt5/rooms/getroomsjob.cpp b/src/rocketchatrestapi-qt5/rooms/getroomsjob.cpp index 601a56f3..f98a694d 100644 --- a/src/rocketchatrestapi-qt5/rooms/getroomsjob.cpp +++ b/src/rocketchatrestapi-qt5/rooms/getroomsjob.cpp @@ -1,81 +1,81 @@ /* Copyright (c) 2018-2019 Montel Laurent This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License or ( at your option ) version 3 or, at the discretion of KDE e.V. ( which shall act as a proxy as in section 14 of the GPLv3 ), any later version. This library 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 Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "getroomsjob.h" #include "restapimethod.h" #include "rocketchatqtrestapi_debug.h" #include #include #include using namespace RocketChatRestApi; GetRoomsJob::GetRoomsJob(QObject *parent) : RestApiAbstractJob(parent) { } GetRoomsJob::~GetRoomsJob() { } bool GetRoomsJob::requireHttpAuthentication() const { return true; } bool GetRoomsJob::start() { if (!canStart()) { qCWarning(ROCKETCHATQTRESTAPI_LOG) << "Impossible to start getrooms job"; deleteLater(); return false; } QNetworkReply *reply = mNetworkAccessManager->get(request()); connect(reply, &QNetworkReply::finished, this, &GetRoomsJob::slotGetRoomsFinished); - addLoggerInfo(QByteArrayLiteral("GetRoomsJob: Ask info about rooms")); + addLoggerInfo(QByteArrayLiteral("GetRoomsJob: Ask all rooms")); return true; } void GetRoomsJob::slotGetRoomsFinished() { QNetworkReply *reply = qobject_cast(sender()); if (reply) { const QByteArray data = reply->readAll(); const QJsonDocument replyJson = QJsonDocument::fromJson(data); const QJsonObject replyObject = replyJson.object(); if (replyObject[QStringLiteral("success")].toBool()) { addLoggerInfo(QByteArrayLiteral("GetRoomsJob: success: ") + replyJson.toJson(QJsonDocument::Indented)); Q_EMIT getRoomsDone(replyObject); } else { emitFailedMessage(replyObject); addLoggerWarning(QByteArrayLiteral("GetRoomsJob: Problem: ") + replyJson.toJson(QJsonDocument::Indented)); } reply->deleteLater(); } deleteLater(); } QNetworkRequest GetRoomsJob::request() const { const QUrl url = mRestApiMethod->generateUrl(RestApiUtil::RestApiUrlType::RoomsGet); QNetworkRequest request(url); addAuthRawHeader(request); addRequestAttribute(request); return request; }