fixed forum/channel subscribe notifications

This commit is contained in:
csoler 2019-12-16 22:44:37 +01:00
parent 301874e756
commit a54cf981a6
No known key found for this signature in database
GPG key ID: 7BCA522266C0804C
9 changed files with 254 additions and 135 deletions

View file

@ -25,6 +25,7 @@
#include "GxsForumUserNotify.h"
#include "gui/notifyqt.h"
#include "gui/gxs/GxsGroupShareKey.h"
#include "util/qtthreadsutils.h"
#include "gui/common/GroupTreeWidget.h"
class GxsForumGroupInfoData : public RsUserdata
@ -41,6 +42,29 @@ GxsForumsDialog::GxsForumsDialog(QWidget *parent)
: GxsGroupFrameDialog(rsGxsForums, parent)
{
mCountChildMsgs = true;
mEventHandlerId = 0;
// Needs to be asynced because this function is likely to be called by another thread!
rsEvents->registerEventsHandler( [this](std::shared_ptr<const RsEvent> event) { RsQThreadUtils::postToObject( [=]() { handleEvent_main_thread(event); }, this ); }, mEventHandlerId );
}
void GxsForumsDialog::handleEvent_main_thread(std::shared_ptr<const RsEvent> event)
{
if(event->mType == RsEventType::GXS_FORUMS)
{
const RsGxsForumEvent *e = dynamic_cast<const RsGxsForumEvent*>(event.get());
if(!e)
return;
switch(e->mForumEventCode)
{
case RsGxsForumEvent::SUBSCRIBE_STATUS_CHANGED: updateDisplay(true);
break;
default:
break;
}
}
}
GxsForumsDialog::~GxsForumsDialog()