mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-22 19:08:58 +03:00
Lint
This commit is contained in:
parent
4e1c8dd663
commit
4166a863b4
4 changed files with 25 additions and 16 deletions
|
@ -62,7 +62,7 @@ public:
|
|||
|
||||
QUrl getHomeServer() { return server_; };
|
||||
int transactionId() { return txn_id_; };
|
||||
int incrementTransactionId() { return ++txn_id_; }; // It is incredibly important that it's incremented first.
|
||||
int incrementTransactionId() { return ++txn_id_; };
|
||||
|
||||
void reset() noexcept;
|
||||
|
||||
|
|
|
@ -50,7 +50,12 @@ struct PendingMessage
|
|||
QString event_id;
|
||||
TimelineItem *widget;
|
||||
|
||||
PendingMessage(matrix::events::MessageEventType ty, int txn_id, QString body, QString filename, QString event_id, TimelineItem *widget)
|
||||
PendingMessage(matrix::events::MessageEventType ty,
|
||||
int txn_id,
|
||||
QString body,
|
||||
QString filename,
|
||||
QString event_id,
|
||||
TimelineItem *widget)
|
||||
: ty(ty)
|
||||
, txn_id(txn_id)
|
||||
, body(body)
|
||||
|
@ -125,9 +130,7 @@ private:
|
|||
// sender's name.
|
||||
bool isSenderRendered(const QString &user_id, TimelineDirection direction);
|
||||
|
||||
bool isPendingMessage(const QString &txnid,
|
||||
const QString &sender,
|
||||
const QString &userid);
|
||||
bool isPendingMessage(const QString &txnid, const QString &sender, const QString &userid);
|
||||
void removePendingMessage(const QString &txnid);
|
||||
|
||||
bool isDuplicate(const QString &event_id) { return eventIds_.contains(event_id); };
|
||||
|
|
|
@ -247,7 +247,8 @@ TimelineView::parseMessageEvent(const QJsonObject &event, TimelineDirection dire
|
|||
eventIds_[text.eventId()] = true;
|
||||
|
||||
QString txnid = text.unsignedData().transactionId();
|
||||
if (!txnid.isEmpty() && isPendingMessage(txnid, text.sender(), local_user_)) {
|
||||
if (!txnid.isEmpty() &&
|
||||
isPendingMessage(txnid, text.sender(), local_user_)) {
|
||||
removePendingMessage(txnid);
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -293,7 +294,8 @@ TimelineView::parseMessageEvent(const QJsonObject &event, TimelineDirection dire
|
|||
eventIds_[img.eventId()] = true;
|
||||
|
||||
QString txnid = img.unsignedData().transactionId();
|
||||
if (!txnid.isEmpty() && isPendingMessage(txnid, img.sender(), local_user_)) {
|
||||
if (!txnid.isEmpty() &&
|
||||
isPendingMessage(txnid, img.sender(), local_user_)) {
|
||||
removePendingMessage(txnid);
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -319,7 +321,8 @@ TimelineView::parseMessageEvent(const QJsonObject &event, TimelineDirection dire
|
|||
eventIds_[emote.eventId()] = true;
|
||||
|
||||
QString txnid = emote.unsignedData().transactionId();
|
||||
if (!txnid.isEmpty() && isPendingMessage(txnid, emote.sender(), local_user_)) {
|
||||
if (!txnid.isEmpty() &&
|
||||
isPendingMessage(txnid, emote.sender(), local_user_)) {
|
||||
removePendingMessage(txnid);
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -546,7 +549,8 @@ TimelineView::addUserMessage(const QString &url, const QString &filename)
|
|||
lastSender_ = user_id;
|
||||
|
||||
int txn_id = client_->incrementTransactionId();
|
||||
PendingMessage message(matrix::events::MessageEventType::Image, txn_id, url, filename, "", view_item);
|
||||
PendingMessage message(
|
||||
matrix::events::MessageEventType::Image, txn_id, url, filename, "", view_item);
|
||||
handleNewUserMessage(message);
|
||||
}
|
||||
|
||||
|
@ -567,7 +571,8 @@ TimelineView::sendNextPendingMessage()
|
|||
PendingMessage &m = pending_msgs_.head();
|
||||
switch (m.ty) {
|
||||
case matrix::events::MessageEventType::Image:
|
||||
client_->sendRoomMessage(m.ty, m.txn_id, room_id_, QFileInfo(m.filename).fileName(), m.body);
|
||||
client_->sendRoomMessage(
|
||||
m.ty, m.txn_id, room_id_, QFileInfo(m.filename).fileName(), m.body);
|
||||
break;
|
||||
default:
|
||||
client_->sendRoomMessage(m.ty, m.txn_id, room_id_, m.body);
|
||||
|
|
|
@ -36,9 +36,10 @@ TimelineViewManager::TimelineViewManager(QSharedPointer<MatrixClient> client, QW
|
|||
connect(
|
||||
client_.data(), &MatrixClient::messageSent, this, &TimelineViewManager::messageSent);
|
||||
|
||||
connect(
|
||||
client_.data(), &MatrixClient::messageSendFailed,
|
||||
this, &TimelineViewManager::messageSendFailed);
|
||||
connect(client_.data(),
|
||||
&MatrixClient::messageSendFailed,
|
||||
this,
|
||||
&TimelineViewManager::messageSendFailed);
|
||||
}
|
||||
|
||||
TimelineViewManager::~TimelineViewManager() {}
|
||||
|
|
Loading…
Reference in a new issue