aboutsummaryrefslogtreecommitdiff
path: root/lib/room.cpp
diff options
context:
space:
mode:
authorKitsune Ral <Kitsune-Ral@users.sf.net>2019-09-24 19:56:31 +0900
committerKitsune Ral <Kitsune-Ral@users.sf.net>2019-09-24 19:56:31 +0900
commitc9f99699761e97b16bdb44f584f07baec5488b47 (patch)
treee5cfb5b7bddc01428fd907cdbfaac1094cd19d59 /lib/room.cpp
parent944653463fe4134c82d85e2d01e2bc0fa43fd727 (diff)
downloadlibquotient-c9f99699761e97b16bdb44f584f07baec5488b47.tar.gz
libquotient-c9f99699761e97b16bdb44f584f07baec5488b47.zip
Room: cleanup
Diffstat (limited to 'lib/room.cpp')
-rw-r--r--lib/room.cpp35
1 files changed, 18 insertions, 17 deletions
diff --git a/lib/room.cpp b/lib/room.cpp
index 2f697589..e2195193 100644
--- a/lib/room.cpp
+++ b/lib/room.cpp
@@ -327,7 +327,7 @@ public:
* content passed in \p newMessage.
* \return true if the event has been found and replaced; false otherwise
*/
- bool processReplacement(const RoomMessageEvent& newMessage);
+ bool processReplacement(const RoomMessageEvent& newEvent);
void setTags(TagsMap newTags);
@@ -879,10 +879,10 @@ std::pair<bool, QString> validatedTag(QString name)
if (name.contains('.'))
return { false, name };
- qWarning(MAIN) << "The tag" << name
+ qCWarning(MAIN) << "The tag" << name
<< "doesn't follow the CS API conventions";
name.prepend("u.");
- qWarning(MAIN) << "Using " << name << "instead";
+ qCWarning(MAIN) << "Using " << name << "instead";
return { true, name };
}
@@ -916,7 +916,7 @@ void Room::removeTag(const QString& name)
} else if (!name.startsWith("u."))
removeTag("u." + name);
else
- qWarning(MAIN) << "Tag" << name << "on room" << objectName()
+ qCWarning(MAIN) << "Tag" << name << "on room" << objectName()
<< "not found, nothing to remove";
}
@@ -971,7 +971,7 @@ Room::Private::getEventWithFile(const QString& eventId) const
if (event->hasFileContent())
return event;
}
- qWarning() << "No files to download in event" << eventId;
+ qCWarning(MAIN) << "No files to download in event" << eventId;
return nullptr;
}
@@ -1014,7 +1014,7 @@ QUrl Room::urlToThumbnail(const QString& eventId) const
thumbnail->url,
thumbnail->imageSize);
}
- qDebug() << "Event" << eventId << "has no thumbnail";
+ qCDebug(MAIN) << "Event" << eventId << "has no thumbnail";
return {};
}
@@ -1149,18 +1149,18 @@ QString Room::decryptMessage(QJsonObject personalCipherObject,
try {
decrypted = session->decrypt(&preKeyMessage);
} catch (std::runtime_error& e) {
- qWarning(EVENTS) << "Decrypt failed:" << e.what();
+ qCWarning(EVENTS) << "Decrypt failed:" << e.what();
}
}
else if (type == 1) {
Message message { body };
if (!session->matches(&preKeyMessage, senderKey)) {
- qWarning(EVENTS) << "Invalid encrypted message";
+ qCWarning(EVENTS) << "Invalid encrypted message";
}
try {
decrypted = session->decrypt(&message);
} catch (std::runtime_error& e) {
- qWarning(EVENTS) << "Decrypt failed:" << e.what();
+ qCWarning(EVENTS) << "Decrypt failed:" << e.what();
}
}
@@ -1443,11 +1443,12 @@ QString Room::Private::doSendEvent(const RoomEvent* pEvent)
Room::connect(call, &BaseJob::sentRequest, q, [this, txnId] {
auto it = q->findPendingEvent(txnId);
if (it == unsyncedEvents.end()) {
- qWarning(EVENTS) << "Pending event for transaction" << txnId
+ qCWarning(EVENTS) << "Pending event for transaction" << txnId
<< "not found - got synced so soon?";
return;
}
it->setDeparted();
+ qCDebug(EVENTS) << "Event txn" << txnId << "has departed";
emit q->pendingEventChanged(int(it - unsyncedEvents.begin()));
});
Room::connect(call, &BaseJob::failure, q,
@@ -1457,7 +1458,7 @@ QString Room::Private::doSendEvent(const RoomEvent* pEvent)
emit q->messageSent(txnId, call->eventId());
auto it = q->findPendingEvent(txnId);
if (it == unsyncedEvents.end()) {
- qDebug(EVENTS) << "Pending event for transaction" << txnId
+ qCDebug(EVENTS) << "Pending event for transaction" << txnId
<< "already merged";
return;
}
@@ -1489,7 +1490,7 @@ QString Room::retryMessage(const QString& txnId)
{
const auto it = findPendingEvent(txnId);
Q_ASSERT(it != d->unsyncedEvents.end());
- qDebug(EVENTS) << "Retrying transaction" << txnId;
+ qCDebug(EVENTS) << "Retrying transaction" << txnId;
const auto& transferIt = d->fileTransfers.find(txnId);
if (transferIt != d->fileTransfers.end()) {
Q_ASSERT(transferIt->isUpload);
@@ -1527,7 +1528,7 @@ void Room::discardMessage(const QString& txnId)
return evt->transactionId() == txnId;
});
Q_ASSERT(it != d->unsyncedEvents.end());
- qDebug(EVENTS) << "Discarding transaction" << txnId;
+ qCDebug(EVENTS) << "Discarding transaction" << txnId;
const auto& transferIt = d->fileTransfers.find(txnId);
if (transferIt != d->fileTransfers.end()) {
Q_ASSERT(transferIt->isUpload);
@@ -2192,7 +2193,7 @@ Room::Changes Room::Private::addNewMessageEvents(RoomEvents&& events)
emit q->pendingEventChanged(pendingEvtIdx);
}
emit q->pendingEventAboutToMerge(nextPendingEvt, pendingEvtIdx);
- qDebug(MESSAGES) << "Merging pending event from transaction"
+ qCDebug(MESSAGES) << "Merging pending event from transaction"
<< nextPendingEvt->transactionId() << "into"
<< nextPendingEvt->id();
auto transfer = fileTransfers.take(nextPendingEvt->transactionId());
@@ -2323,13 +2324,13 @@ Room::Changes Room::processStateEvent(const RoomEvent& e)
, [this,oldStateEvent] (const RoomAliasesEvent& ae) {
// clang-format on
if (ae.aliases().isEmpty()) {
- qDebug(STATE).noquote()
+ qCDebug(STATE).noquote()
<< ae.stateKey() << "no more has aliases for room"
<< objectName();
d->aliasServers.remove(ae.stateKey());
} else {
d->aliasServers.insert(ae.stateKey());
- qDebug(STATE).nospace().noquote()
+ qCDebug(STATE).nospace().noquote()
<< "New server with aliases for room " << objectName()
<< ": " << ae.stateKey();
}
@@ -2665,7 +2666,7 @@ void Room::Private::updateDisplayname()
if (swappedName != displayname) {
emit q->displaynameAboutToChange(q);
swap(displayname, swappedName);
- qDebug(MAIN) << q->objectName() << "has changed display name from"
+ qCDebug(MAIN) << q->objectName() << "has changed display name from"
<< swappedName << "to" << displayname;
emit q->displaynameChanged(q, swappedName);
}