Fix linting

This commit is contained in:
Joseph Donofry 2021-03-04 19:11:08 -05:00
parent 87bf761dc2
commit 4b12b53133
No known key found for this signature in database
GPG key ID: E8A1D78EF044B0CB
11 changed files with 144 additions and 153 deletions

View file

@ -3566,23 +3566,23 @@ Cache::query_keys(const std::string &user_id,
last_changed = cache_->last_changed; last_changed = cache_->last_changed;
req.token = last_changed; req.token = last_changed;
http::client()->query_keys(req, http::client()->query_keys(
[cb, user_id, last_changed](const mtx::responses::QueryKeys &res, req,
mtx::http::RequestErr err) { [cb, user_id, last_changed](const mtx::responses::QueryKeys &res,
if (err) { mtx::http::RequestErr err) {
nhlog::net()->warn( if (err) {
"failed to query device keys: {},{}", nhlog::net()->warn("failed to query device keys: {},{}",
mtx::errors::to_string(err->matrix_error.errcode), mtx::errors::to_string(err->matrix_error.errcode),
static_cast<int>(err->status_code)); static_cast<int>(err->status_code));
cb({}, err); cb({}, err);
return; return;
} }
cache::updateUserKeys(last_changed, res); cache::updateUserKeys(last_changed, res);
auto keys = cache::userKeys(user_id); auto keys = cache::userKeys(user_id);
cb(keys.value_or(UserKeyCache{}), err); cb(keys.value_or(UserKeyCache{}), err);
}); });
} }
void void

View file

@ -249,7 +249,6 @@ tokenise(std::string_view str, char delim)
ret.second = std::atoi(str.data() + pos + 1); ret.second = std::atoi(str.data() + pos + 1);
return ret; return ret;
} }
} }
void void

View file

@ -599,7 +599,6 @@ newBusMessage(GstBus *bus G_GNUC_UNUSED, GstMessage *msg, gpointer G_GNUC_UNUSED
} }
return TRUE; return TRUE;
} }
} }
#endif #endif

View file

@ -320,12 +320,11 @@ ChatPage::ChatPage(QSharedPointer<UserSettings> userSettings, QWidget *parent)
&ChatPage::setGroupViewState); &ChatPage::setGroupViewState);
connect(this, &ChatPage::initializeRoomList, room_list_, &RoomList::initialize); connect(this, &ChatPage::initializeRoomList, room_list_, &RoomList::initialize);
connect( connect(this,
this, &ChatPage::initializeViews,
&ChatPage::initializeViews, view_manager_,
view_manager_, [this](const mtx::responses::Rooms &rooms) { view_manager_->sync(rooms); },
[this](const mtx::responses::Rooms &rooms) { view_manager_->sync(rooms); }, Qt::QueuedConnection);
Qt::QueuedConnection);
connect(this, connect(this,
&ChatPage::initializeEmptyViews, &ChatPage::initializeEmptyViews,
view_manager_, view_manager_,
@ -390,12 +389,11 @@ ChatPage::ChatPage(QSharedPointer<UserSettings> userSettings, QWidget *parent)
connect( connect(
this, &ChatPage::tryInitialSyncCb, this, &ChatPage::tryInitialSync, Qt::QueuedConnection); this, &ChatPage::tryInitialSyncCb, this, &ChatPage::tryInitialSync, Qt::QueuedConnection);
connect(this, &ChatPage::trySyncCb, this, &ChatPage::trySync, Qt::QueuedConnection); connect(this, &ChatPage::trySyncCb, this, &ChatPage::trySync, Qt::QueuedConnection);
connect( connect(this,
this, &ChatPage::tryDelayedSyncCb,
&ChatPage::tryDelayedSyncCb, this,
this, [this]() { QTimer::singleShot(RETRY_TIMEOUT, this, &ChatPage::trySync); },
[this]() { QTimer::singleShot(RETRY_TIMEOUT, this, &ChatPage::trySync); }, Qt::QueuedConnection);
Qt::QueuedConnection);
connect(this, connect(this,
&ChatPage::newSyncResponse, &ChatPage::newSyncResponse,

View file

@ -41,17 +41,16 @@ CompletionProxyModel::CompletionProxyModel(QAbstractItemModel *model, QObject *p
} }
} }
connect( connect(this,
this, &CompletionProxyModel::newSearchString,
&CompletionProxyModel::newSearchString, this,
this, [this](QString s) {
[this](QString s) { s.remove(":");
s.remove(":"); s.remove("@");
s.remove("@"); searchString = s.toLower();
searchString = s.toLower(); invalidate();
invalidate(); },
}, Qt::QueuedConnection);
Qt::QueuedConnection);
} }
void void

View file

@ -345,7 +345,8 @@ DeviceVerificationFlow::DeviceVerificationFlow(QObject *,
if (err) { if (err) {
nhlog::net()->error( nhlog::net()->error(
"failed to upload signatures: {},{}", "failed to upload signatures: {},{}",
mtx::errors::to_string(err->matrix_error.errcode), mtx::errors::to_string(
err->matrix_error.errcode),
static_cast<int>(err->status_code)); static_cast<int>(err->status_code));
} }

View file

@ -570,7 +570,6 @@ getMediaAttributes(const GstSDPMessage *sdp,
} }
return false; return false;
} }
} }
bool bool

View file

@ -35,7 +35,6 @@ enum class State
}; };
Q_ENUM_NS(State) Q_ENUM_NS(State)
} }
class WebRTCSession : public QObject class WebRTCSession : public QObject

View file

@ -35,60 +35,59 @@ EventStore::EventStore(std::string room_id, QObject *)
this->last = range->last; this->last = range->last;
} }
connect( connect(this,
this, &EventStore::eventFetched,
&EventStore::eventFetched, this,
this, [this](std::string id,
[this](std::string id, std::string relatedTo,
std::string relatedTo, mtx::events::collections::TimelineEvents timeline) {
mtx::events::collections::TimelineEvents timeline) { cache::client()->storeEvent(room_id_, id, {timeline});
cache::client()->storeEvent(room_id_, id, {timeline});
if (!relatedTo.empty()) { if (!relatedTo.empty()) {
auto idx = idToIndex(relatedTo); auto idx = idToIndex(relatedTo);
if (idx) if (idx)
emit dataChanged(*idx, *idx); emit dataChanged(*idx, *idx);
} }
}, },
Qt::QueuedConnection); Qt::QueuedConnection);
connect( connect(this,
this, &EventStore::oldMessagesRetrieved,
&EventStore::oldMessagesRetrieved, this,
this, [this](const mtx::responses::Messages &res) {
[this](const mtx::responses::Messages &res) { if (cache::client()->previousBatchToken(room_id_) == res.end) {
if (cache::client()->previousBatchToken(room_id_) == res.end) { noMoreMessages = true;
noMoreMessages = true; emit fetchedMore();
emit fetchedMore(); return;
return; }
}
uint64_t newFirst = cache::client()->saveOldMessages(room_id_, res); uint64_t newFirst = cache::client()->saveOldMessages(room_id_, res);
if (newFirst == first) if (newFirst == first)
fetchMore(); fetchMore();
else { else {
if (this->last != std::numeric_limits<uint64_t>::max()) { if (this->last != std::numeric_limits<uint64_t>::max()) {
emit beginInsertRows(toExternalIdx(newFirst), emit beginInsertRows(toExternalIdx(newFirst),
toExternalIdx(this->first - 1)); toExternalIdx(this->first - 1));
this->first = newFirst; this->first = newFirst;
emit endInsertRows(); emit endInsertRows();
emit fetchedMore(); emit fetchedMore();
} else { } else {
auto range = cache::client()->getTimelineRange(room_id_); auto range = cache::client()->getTimelineRange(room_id_);
if (range && range->last - range->first != 0) { if (range && range->last - range->first != 0) {
emit beginInsertRows(0, int(range->last - range->first)); emit beginInsertRows(
this->first = range->first; 0, int(range->last - range->first));
this->last = range->last; this->first = range->first;
emit endInsertRows(); this->last = range->last;
emit fetchedMore(); emit endInsertRows();
} else { emit fetchedMore();
fetchMore(); } else {
} fetchMore();
} }
} }
}, }
Qt::QueuedConnection); },
Qt::QueuedConnection);
connect(this, &EventStore::processPending, this, [this]() { connect(this, &EventStore::processPending, this, [this]() {
if (!current_txn.empty()) { if (!current_txn.empty()) {
@ -153,48 +152,46 @@ EventStore::EventStore(std::string room_id, QObject *)
event->data); event->data);
}); });
connect( connect(this,
this, &EventStore::messageFailed,
&EventStore::messageFailed, this,
this, [this](std::string txn_id) {
[this](std::string txn_id) { if (current_txn == txn_id) {
if (current_txn == txn_id) { current_txn_error_count++;
current_txn_error_count++; if (current_txn_error_count > 10) {
if (current_txn_error_count > 10) { nhlog::ui()->debug("failing txn id '{}'", txn_id);
nhlog::ui()->debug("failing txn id '{}'", txn_id); cache::client()->removePendingStatus(room_id_, txn_id);
cache::client()->removePendingStatus(room_id_, txn_id); current_txn_error_count = 0;
current_txn_error_count = 0; }
} }
} QTimer::singleShot(1000, this, [this]() {
QTimer::singleShot(1000, this, [this]() { nhlog::ui()->debug("timeout");
nhlog::ui()->debug("timeout"); this->current_txn = "";
this->current_txn = ""; emit processPending();
emit processPending(); });
}); },
}, Qt::QueuedConnection);
Qt::QueuedConnection);
connect( connect(this,
this, &EventStore::messageSent,
&EventStore::messageSent, this,
this, [this](std::string txn_id, std::string event_id) {
[this](std::string txn_id, std::string event_id) { nhlog::ui()->debug("sent {}", txn_id);
nhlog::ui()->debug("sent {}", txn_id);
http::client()->read_event( http::client()->read_event(
room_id_, event_id, [this, event_id](mtx::http::RequestErr err) { room_id_, event_id, [this, event_id](mtx::http::RequestErr err) {
if (err) { if (err) {
nhlog::net()->warn( nhlog::net()->warn(
"failed to read_event ({}, {})", room_id_, event_id); "failed to read_event ({}, {})", room_id_, event_id);
} }
}); });
cache::client()->removePendingStatus(room_id_, txn_id); cache::client()->removePendingStatus(room_id_, txn_id);
this->current_txn = ""; this->current_txn = "";
this->current_txn_error_count = 0; this->current_txn_error_count = 0;
emit processPending(); emit processPending();
}, },
Qt::QueuedConnection); Qt::QueuedConnection);
} }
void void
@ -360,7 +357,7 @@ struct overloaded : Ts...
using Ts::operator()...; using Ts::operator()...;
}; };
template<class... Ts> template<class... Ts>
overloaded(Ts...) -> overloaded<Ts...>; overloaded(Ts...)->overloaded<Ts...>;
} }
void void

View file

@ -205,12 +205,11 @@ TimelineModel::TimelineModel(TimelineViewManager *manager, QString room_id, QObj
, room_id_(room_id) , room_id_(room_id)
, manager_(manager) , manager_(manager)
{ {
connect( connect(this,
this, &TimelineModel::redactionFailed,
&TimelineModel::redactionFailed, this,
this, [](const QString &msg) { emit ChatPage::instance()->showNotification(msg); },
[](const QString &msg) { emit ChatPage::instance()->showNotification(msg); }, Qt::QueuedConnection);
Qt::QueuedConnection);
connect(this, connect(this,
&TimelineModel::newMessageToSend, &TimelineModel::newMessageToSend,
@ -219,17 +218,17 @@ TimelineModel::TimelineModel(TimelineViewManager *manager, QString room_id, QObj
Qt::QueuedConnection); Qt::QueuedConnection);
connect(this, &TimelineModel::addPendingMessageToStore, &events, &EventStore::addPending); connect(this, &TimelineModel::addPendingMessageToStore, &events, &EventStore::addPending);
connect( connect(&events,
&events, &EventStore::dataChanged,
&EventStore::dataChanged, this,
this, [this](int from, int to) {
[this](int from, int to) { nhlog::ui()->debug("data changed {} to {}",
nhlog::ui()->debug( events.size() - to - 1,
"data changed {} to {}", events.size() - to - 1, events.size() - from - 1); events.size() - from - 1);
emit dataChanged(index(events.size() - to - 1, 0), emit dataChanged(index(events.size() - to - 1, 0),
index(events.size() - from - 1, 0)); index(events.size() - from - 1, 0));
}, },
Qt::QueuedConnection); Qt::QueuedConnection);
connect(&events, &EventStore::beginInsertRows, this, [this](int from, int to) { connect(&events, &EventStore::beginInsertRows, this, [this](int from, int to) {
int first = events.size() - to; int first = events.size() - to;

View file

@ -173,9 +173,10 @@ UserProfile::fetchDeviceList(const QString &userID)
std::string local_user_id = utils::localUser().toStdString(); std::string local_user_id = utils::localUser().toStdString();
if (err) { if (err) {
nhlog::net()->warn("failed to query device keys: {},{}", nhlog::net()->warn(
mtx::errors::to_string(err->matrix_error.errcode), "failed to query device keys: {},{}",
static_cast<int>(err->status_code)); mtx::errors::to_string(err->matrix_error.errcode),
static_cast<int>(err->status_code));
return; return;
} }