mirror of
https://github.com/RetroShare/RetroShare.git
synced 2026-09-14 11:06:01 +05:00
TheWire: Refactor blocking service calls to be asynchronous in WireDialog.cpp
This commit is contained in:
parent
b020001906
commit
bcc80890f5
@ -431,14 +431,20 @@ bool WireDialog::setupPulseAddDialog()
|
||||
|
||||
void WireDialog::subscribe(RsGxsGroupId &groupId)
|
||||
{
|
||||
uint32_t token;
|
||||
rsWire->subscribeToGroup(token, groupId, true);
|
||||
RsThread::async([groupId]()
|
||||
{
|
||||
uint32_t token;
|
||||
rsWire->subscribeToGroup(token, groupId, true);
|
||||
});
|
||||
}
|
||||
|
||||
void WireDialog::unsubscribe(RsGxsGroupId &groupId)
|
||||
{
|
||||
uint32_t token;
|
||||
rsWire->subscribeToGroup(token, groupId, false);
|
||||
RsThread::async([groupId]()
|
||||
{
|
||||
uint32_t token;
|
||||
rsWire->subscribeToGroup(token, groupId, false);
|
||||
});
|
||||
}
|
||||
|
||||
void WireDialog::notifyGroupSelection(WireGroupItem *item)
|
||||
@ -560,7 +566,7 @@ void WireDialog::deleteGroups()
|
||||
}
|
||||
}
|
||||
|
||||
void WireDialog::updateGroups(std::vector<RsWireGroup>& groups)
|
||||
void WireDialog::updateGroups(const std::vector<RsWireGroup>& groups)
|
||||
{
|
||||
mAllGroups.clear();
|
||||
mOwnGroups.clear();
|
||||
@ -730,21 +736,27 @@ void WireDialog::requestGroupData()
|
||||
std::cerr << "WireDialog::requestGroupData()";
|
||||
std::cerr << std::endl;
|
||||
|
||||
std::vector<RsWireGroup> groups;
|
||||
rsWire->getGroups({}, groups);
|
||||
RsThread::async([this]()
|
||||
{
|
||||
std::vector<RsWireGroup> groups;
|
||||
rsWire->getGroups({}, groups);
|
||||
|
||||
updateGroups(groups);
|
||||
showGroups();
|
||||
RsQThreadUtils::postToObject([this, groups]()
|
||||
{
|
||||
updateGroups(groups);
|
||||
showGroups();
|
||||
|
||||
if (!mNavigatePendingGroupId.isNull()) {
|
||||
if (!mNavigatePendingMsgId.isNull()) {
|
||||
requestPulseFocus(mNavigatePendingGroupId, mNavigatePendingMsgId);
|
||||
} else {
|
||||
requestGroupFocus(mNavigatePendingGroupId);
|
||||
}
|
||||
mNavigatePendingGroupId.clear();
|
||||
mNavigatePendingMsgId.clear();
|
||||
}
|
||||
if (!mNavigatePendingGroupId.isNull()) {
|
||||
if (!mNavigatePendingMsgId.isNull()) {
|
||||
requestPulseFocus(mNavigatePendingGroupId, mNavigatePendingMsgId);
|
||||
} else {
|
||||
requestGroupFocus(mNavigatePendingGroupId);
|
||||
}
|
||||
mNavigatePendingGroupId.clear();
|
||||
mNavigatePendingMsgId.clear();
|
||||
}
|
||||
}, this);
|
||||
});
|
||||
}
|
||||
|
||||
rstime_t WireDialog::getFilterTimestamp()
|
||||
@ -879,8 +891,11 @@ void WireDialog::PVHfollow(const RsGxsGroupId &groupId)
|
||||
std::cerr << ")";
|
||||
std::cerr << std::endl;
|
||||
|
||||
uint32_t token;
|
||||
rsWire->subscribeToGroup(token, groupId, true);
|
||||
RsThread::async([groupId]()
|
||||
{
|
||||
uint32_t token;
|
||||
rsWire->subscribeToGroup(token, groupId, true);
|
||||
});
|
||||
}
|
||||
|
||||
void WireDialog::PVHrate(const RsGxsId &authorId)
|
||||
|
||||
@ -163,7 +163,7 @@ private:
|
||||
void deleteGroups();
|
||||
void showGroups();
|
||||
void showSelectedGroups();
|
||||
void updateGroups(std::vector<RsWireGroup> &groups);
|
||||
void updateGroups(const std::vector<RsWireGroup> &groups);
|
||||
|
||||
void processSettings(bool load);
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user