mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-02-17 21:34:10 -05:00
fixed notifications in forums, posted and channels
This commit is contained in:
parent
fb9282f588
commit
90bb6c0011
@ -656,8 +656,7 @@ void p3GxsTrans::notifyChanges(std::vector<RsGxsNotify*>& changes)
|
|||||||
#ifdef DEBUG_GXSTRANS
|
#ifdef DEBUG_GXSTRANS
|
||||||
std::cout << "p3GxsTrans::notifyChanges(...)" << std::endl;
|
std::cout << "p3GxsTrans::notifyChanges(...)" << std::endl;
|
||||||
#endif
|
#endif
|
||||||
for( std::vector<RsGxsNotify*>::const_iterator it = changes.begin();
|
for( auto it = changes.begin(); it != changes.end(); ++it )
|
||||||
it != changes.end(); ++it )
|
|
||||||
{
|
{
|
||||||
RsGxsGroupChange* grpChange = dynamic_cast<RsGxsGroupChange *>(*it);
|
RsGxsGroupChange* grpChange = dynamic_cast<RsGxsGroupChange *>(*it);
|
||||||
RsGxsMsgChange* msgChange = dynamic_cast<RsGxsMsgChange *>(*it);
|
RsGxsMsgChange* msgChange = dynamic_cast<RsGxsMsgChange *>(*it);
|
||||||
@ -697,8 +696,8 @@ void p3GxsTrans::notifyChanges(std::vector<RsGxsNotify*>& changes)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
delete *it;
|
||||||
}
|
}
|
||||||
RsGxsIfaceHelper::receiveChanges(changes);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t p3GxsTrans::AuthenPolicy()
|
uint32_t p3GxsTrans::AuthenPolicy()
|
||||||
|
@ -110,15 +110,10 @@ enum class RsForumEventCode: uint8_t
|
|||||||
UNKNOWN = 0x00,
|
UNKNOWN = 0x00,
|
||||||
NEW_FORUM = 0x01, /// emitted when new forum is received
|
NEW_FORUM = 0x01, /// emitted when new forum is received
|
||||||
UPDATED_FORUM = 0x02, /// emitted when existing forum is updated
|
UPDATED_FORUM = 0x02, /// emitted when existing forum is updated
|
||||||
|
NEW_MESSAGE = 0x03, /// new message reeived in a particular forum
|
||||||
/// new message reeived in a particular forum
|
UPDATED_MESSAGE = 0x04, /// existing message has been updated in a particular forum
|
||||||
NEW_MESSAGE = 0x03,
|
SUBSCRIBE_STATUS_CHANGED = 0x05, /// forum was subscribed or unsubscribed
|
||||||
|
READ_STATUS_CHANGED = 0x06, /// msg was read or marked unread
|
||||||
/// existing message has been updated in a particular forum
|
|
||||||
UPDATED_MESSAGE = 0x04,
|
|
||||||
|
|
||||||
/// forum was subscribed or unsubscribed
|
|
||||||
SUBSCRIBE_STATUS_CHANGED = 0x05,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct RsGxsForumEvent: RsEvent
|
struct RsGxsForumEvent: RsEvent
|
||||||
|
@ -76,6 +76,7 @@ enum class RsPostedEventCode: uint8_t
|
|||||||
SUBSCRIBE_STATUS_CHANGED = 0x03,
|
SUBSCRIBE_STATUS_CHANGED = 0x03,
|
||||||
UPDATED_POSTED_GROUP = 0x04,
|
UPDATED_POSTED_GROUP = 0x04,
|
||||||
UPDATED_MESSAGE = 0x05,
|
UPDATED_MESSAGE = 0x05,
|
||||||
|
READ_STATUS_CHANGED = 0x06,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -364,13 +364,11 @@ void p3GxsChannels::notifyChanges(std::vector<RsGxsNotify *> &changes)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* shouldn't need to worry about groups - as they need to be subscribed to */
|
/* shouldn't need to worry about groups - as they need to be subscribed to */
|
||||||
|
delete *it;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!unprocessedGroups.empty())
|
if(!unprocessedGroups.empty())
|
||||||
request_SpecificSubscribedGroups(unprocessedGroups);
|
request_SpecificSubscribedGroups(unprocessedGroups);
|
||||||
|
|
||||||
// // the call below deletes changes and its content.
|
|
||||||
// RsGxsIfaceHelper::receiveChanges(changes);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void p3GxsChannels::service_tick()
|
void p3GxsChannels::service_tick()
|
||||||
|
@ -477,8 +477,8 @@ void p3GxsCircles::notifyChanges(std::vector<RsGxsNotify *> &changes)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
p3Notify *notify = RsServer::notify();
|
p3Notify *notify = RsServer::notify();
|
||||||
std::vector<RsGxsNotify *>::iterator it;
|
|
||||||
for(it = changes.begin(); it != changes.end(); ++it)
|
for(auto it = changes.begin(); it != changes.end(); ++it)
|
||||||
{
|
{
|
||||||
RsGxsGroupChange *groupChange = dynamic_cast<RsGxsGroupChange *>(*it);
|
RsGxsGroupChange *groupChange = dynamic_cast<RsGxsGroupChange *>(*it);
|
||||||
RsGxsMsgChange *msgChange = dynamic_cast<RsGxsMsgChange *>(*it);
|
RsGxsMsgChange *msgChange = dynamic_cast<RsGxsMsgChange *>(*it);
|
||||||
@ -605,8 +605,8 @@ void p3GxsCircles::notifyChanges(std::vector<RsGxsNotify *> &changes)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
delete *it;
|
||||||
}
|
}
|
||||||
RsGxsIfaceHelper::receiveChanges(changes); // this clear up the vector and delete its elements
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/********************************************************************************/
|
/********************************************************************************/
|
||||||
|
@ -315,9 +315,9 @@ void p3GxsForums::notifyChanges(std::vector<RsGxsNotify *> &changes)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* shouldn't need to worry about groups - as they need to be subscribed to */
|
/* shouldn't need to worry about groups - as they need to be subscribed to */
|
||||||
}
|
|
||||||
|
|
||||||
RsGxsIfaceHelper::receiveChanges(changes);
|
delete *it;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void p3GxsForums::service_tick()
|
void p3GxsForums::service_tick()
|
||||||
@ -861,12 +861,19 @@ void p3GxsForums::setMessageReadStatus(uint32_t& token, const RsGxsGrpMsgIdPair&
|
|||||||
uint32_t mask = GXS_SERV::GXS_MSG_STATUS_GUI_NEW | GXS_SERV::GXS_MSG_STATUS_GUI_UNREAD;
|
uint32_t mask = GXS_SERV::GXS_MSG_STATUS_GUI_NEW | GXS_SERV::GXS_MSG_STATUS_GUI_UNREAD;
|
||||||
uint32_t status = GXS_SERV::GXS_MSG_STATUS_GUI_UNREAD;
|
uint32_t status = GXS_SERV::GXS_MSG_STATUS_GUI_UNREAD;
|
||||||
if (read)
|
if (read)
|
||||||
{
|
|
||||||
status = 0;
|
status = 0;
|
||||||
}
|
|
||||||
|
|
||||||
setMsgStatusFlags(token, msgId, status, mask);
|
setMsgStatusFlags(token, msgId, status, mask);
|
||||||
|
|
||||||
|
if (rsEvents)
|
||||||
|
{
|
||||||
|
auto ev = std::make_shared<RsGxsForumEvent>();
|
||||||
|
|
||||||
|
ev->mForumMsgId = msgId.second;
|
||||||
|
ev->mForumGroupId = msgId.first;
|
||||||
|
ev->mForumEventCode = RsForumEventCode::READ_STATUS_CHANGED;
|
||||||
|
rsEvents->postEvent(ev);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/********************************************************************************************/
|
/********************************************************************************************/
|
||||||
|
@ -661,9 +661,9 @@ void p3IdService::notifyChanges(std::vector<RsGxsNotify *> &changes)
|
|||||||
changes[i] = NULL ;
|
changes[i] = NULL ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
RsGxsIfaceHelper::receiveChanges(changes);
|
delete changes[i];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/********************************************************************************/
|
/********************************************************************************/
|
||||||
|
@ -87,9 +87,7 @@ void p3PostBase::notifyChanges(std::vector<RsGxsNotify *> &changes)
|
|||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
std::vector<RsGxsNotify *>::iterator it;
|
for(auto it = changes.begin(); it != changes.end(); ++it)
|
||||||
|
|
||||||
for(it = changes.begin(); it != changes.end(); ++it)
|
|
||||||
{
|
{
|
||||||
RsGxsMsgChange *msgChange = dynamic_cast<RsGxsMsgChange *>(*it);
|
RsGxsMsgChange *msgChange = dynamic_cast<RsGxsMsgChange *>(*it);
|
||||||
|
|
||||||
@ -173,8 +171,9 @@ void p3PostBase::notifyChanges(std::vector<RsGxsNotify *> &changes)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
delete *it;
|
||||||
}
|
}
|
||||||
receiveHelperChanges(changes);
|
|
||||||
|
|
||||||
#ifdef POSTBASE_DEBUG
|
#ifdef POSTBASE_DEBUG
|
||||||
std::cerr << "p3PostBase::notifyChanges() -> receiveChanges()";
|
std::cerr << "p3PostBase::notifyChanges() -> receiveChanges()";
|
||||||
@ -206,6 +205,15 @@ void p3PostBase::setMessageReadStatus(uint32_t& token, const RsGxsGrpMsgIdPair&
|
|||||||
|
|
||||||
setMsgStatusFlags(token, msgId, status, mask);
|
setMsgStatusFlags(token, msgId, status, mask);
|
||||||
|
|
||||||
|
if (rsEvents)
|
||||||
|
{
|
||||||
|
auto ev = std::make_shared<RsGxsPostedEvent>();
|
||||||
|
|
||||||
|
ev->mPostedMsgId = msgId.second;
|
||||||
|
ev->mPostedGroupId = msgId.first;
|
||||||
|
ev->mPostedEventCode = RsPostedEventCode::READ_STATUS_CHANGED;
|
||||||
|
rsEvents->postEvent(ev);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -60,14 +60,21 @@ void PostedDialog::handleEvent_main_thread(std::shared_ptr<const RsEvent> event)
|
|||||||
switch(e->mPostedEventCode)
|
switch(e->mPostedEventCode)
|
||||||
{
|
{
|
||||||
case RsPostedEventCode::NEW_MESSAGE:
|
case RsPostedEventCode::NEW_MESSAGE:
|
||||||
case RsPostedEventCode::NEW_POSTED_GROUP: // [[fallthrough]];
|
updateMessageSummaryList(e->mPostedGroupId);
|
||||||
|
break;
|
||||||
|
|
||||||
case RsPostedEventCode::UPDATED_MESSAGE: // [[fallthrough]];
|
case RsPostedEventCode::UPDATED_MESSAGE: // [[fallthrough]];
|
||||||
updateDisplay(false);
|
updateDisplay(false);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case RsPostedEventCode::READ_STATUS_CHANGED: // [[fallthrough]];
|
||||||
|
updateMessageSummaryList(e->mPostedGroupId);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case RsPostedEventCode::NEW_POSTED_GROUP: // [[fallthrough]];
|
||||||
case RsPostedEventCode::SUBSCRIBE_STATUS_CHANGED: // [[fallthrough]];
|
case RsPostedEventCode::SUBSCRIBE_STATUS_CHANGED: // [[fallthrough]];
|
||||||
updateDisplay(true);
|
updateDisplay(true);
|
||||||
break;
|
break;
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -32,6 +32,7 @@
|
|||||||
#include "gui/common/RSTreeWidget.h"
|
#include "gui/common/RSTreeWidget.h"
|
||||||
#include "gui/notifyqt.h"
|
#include "gui/notifyqt.h"
|
||||||
#include "gui/common/UIStateHelper.h"
|
#include "gui/common/UIStateHelper.h"
|
||||||
|
#include "gui/common/UserNotify.h"
|
||||||
#include "GxsCommentDialog.h"
|
#include "GxsCommentDialog.h"
|
||||||
|
|
||||||
//#define DEBUG_GROUPFRAMEDIALOG
|
//#define DEBUG_GROUPFRAMEDIALOG
|
||||||
|
@ -64,12 +64,23 @@ void GxsChannelDialog::handleEvent_main_thread(std::shared_ptr<const RsEvent> ev
|
|||||||
|
|
||||||
switch(e->mChannelEventCode)
|
switch(e->mChannelEventCode)
|
||||||
{
|
{
|
||||||
case RsChannelEventCode::READ_STATUS_CHANGED:
|
case RsChannelEventCode::NEW_MESSAGE:
|
||||||
updateMessageSummaryList(e->mChannelGroupId);
|
updateMessageSummaryList(e->mChannelGroupId);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case RsChannelEventCode::UPDATED_MESSAGE: // [[fallthrough]];
|
||||||
|
updateDisplay(false);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case RsChannelEventCode::READ_STATUS_CHANGED:
|
||||||
|
updateMessageSummaryList(e->mChannelGroupId);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case RsChannelEventCode::NEW_CHANNEL: // [[fallthrough]];
|
||||||
case RsChannelEventCode::SUBSCRIBE_STATUS_CHANGED:
|
case RsChannelEventCode::SUBSCRIBE_STATUS_CHANGED:
|
||||||
updateDisplay(true);
|
updateDisplay(true);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -59,7 +59,21 @@ void GxsForumsDialog::handleEvent_main_thread(std::shared_ptr<const RsEvent> eve
|
|||||||
|
|
||||||
switch(e->mForumEventCode)
|
switch(e->mForumEventCode)
|
||||||
{
|
{
|
||||||
case RsForumEventCode::SUBSCRIBE_STATUS_CHANGED: updateDisplay(true);
|
case RsForumEventCode::NEW_MESSAGE:
|
||||||
|
updateMessageSummaryList(e->mForumGroupId);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case RsForumEventCode::UPDATED_MESSAGE: // [[fallthrough]];
|
||||||
|
updateDisplay(false);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case RsForumEventCode::READ_STATUS_CHANGED:
|
||||||
|
updateMessageSummaryList(e->mForumGroupId);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case RsForumEventCode::NEW_FORUM: // [[fallthrough]];
|
||||||
|
case RsForumEventCode::SUBSCRIBE_STATUS_CHANGED:
|
||||||
|
updateDisplay(true);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user