added a FeedItem to warn when publish permissions are received for a channel

This commit is contained in:
csoler 2018-02-27 22:42:48 +01:00
parent aad9397ef8
commit 3bc5b456a5
No known key found for this signature in database
GPG key ID: 7BCA522266C0804C
4 changed files with 77 additions and 40 deletions

View file

@ -389,6 +389,8 @@ int RsGxsNetService::tick()
should_notify = should_notify || !mNewGroupsToNotify.empty() ; should_notify = should_notify || !mNewGroupsToNotify.empty() ;
should_notify = should_notify || !mNewMessagesToNotify.empty() ; should_notify = should_notify || !mNewMessagesToNotify.empty() ;
should_notify = should_notify || !mNewPublishKeysToNotify.empty() ;
should_notify = should_notify || !mNewStatsToNotify.empty() ;
} }
if(should_notify) if(should_notify)
@ -451,8 +453,11 @@ void RsGxsNetService::processObserverNotifications()
if(!grps_copy.empty()) mObserver->notifyNewGroups (grps_copy); if(!grps_copy.empty()) mObserver->notifyNewGroups (grps_copy);
if(!msgs_copy.empty()) mObserver->notifyNewMessages(msgs_copy); if(!msgs_copy.empty()) mObserver->notifyNewMessages(msgs_copy);
for(std::set<RsGxsGroupId>::const_iterator it(keys_copy.begin());it!=keys_copy.end();++it) mObserver->notifyReceivePublishKey(*it); for(std::set<RsGxsGroupId>::const_iterator it(keys_copy.begin());it!=keys_copy.end();++it)
for(std::set<RsGxsGroupId>::const_iterator it(stat_copy.begin());it!=stat_copy.end();++it) mObserver->notifyChangedGroupStats(*it); mObserver->notifyReceivePublishKey(*it);
for(std::set<RsGxsGroupId>::const_iterator it(stat_copy.begin());it!=stat_copy.end();++it)
mObserver->notifyChangedGroupStats(*it);
} }
void RsGxsNetService::rejectMessage(const RsGxsMessageId& msg_id) void RsGxsNetService::rejectMessage(const RsGxsMessageId& msg_id)
@ -4756,6 +4761,7 @@ void RsGxsNetService::handleRecvPublishKeys(RsNxsGroupPublishKeyItem *item)
#ifdef NXS_NET_DEBUG_3 #ifdef NXS_NET_DEBUG_3
GXSNETDEBUG_PG(item->PeerId(),item->grpId)<< " (EE) Publish key already present in database. Discarding message." << std::endl; GXSNETDEBUG_PG(item->PeerId(),item->grpId)<< " (EE) Publish key already present in database. Discarding message." << std::endl;
#endif #endif
mNewPublishKeysToNotify.insert(item->grpId) ;
return ; return ;
} }

View file

@ -58,24 +58,6 @@
#include "common/FeedNotify.h" #include "common/FeedNotify.h"
#include "notifyqt.h" #include "notifyqt.h"
const uint32_t NEWSFEED_PEERLIST = 0x0001;
const uint32_t NEWSFEED_FORUMNEWLIST = 0x0002;
const uint32_t NEWSFEED_FORUMMSGLIST = 0x0003;
const uint32_t NEWSFEED_CHANNELNEWLIST = 0x0004;
//const uint32_t NEWSFEED_CHANNELMSGLIST = 0x0005;
#if 0
const uint32_t NEWSFEED_BLOGNEWLIST = 0x0006;
const uint32_t NEWSFEED_BLOGMSGLIST = 0x0007;
#endif
const uint32_t NEWSFEED_MESSAGELIST = 0x0008;
const uint32_t NEWSFEED_CHATMSGLIST = 0x0009;
const uint32_t NEWSFEED_SECLIST = 0x000a;
const uint32_t NEWSFEED_POSTEDNEWLIST = 0x000b;
const uint32_t NEWSFEED_POSTEDMSGLIST = 0x000c;
const uint32_t NEWSFEED_CIRCLELIST = 0x000d;
#define ROLE_RECEIVED FEED_TREEWIDGET_SORTROLE #define ROLE_RECEIVED FEED_TREEWIDGET_SORTROLE
#define TOKEN_TYPE_GROUP 1 #define TOKEN_TYPE_GROUP 1
@ -281,20 +263,20 @@ void NewsFeed::updateDisplay()
mTokenQueueChannel = new TokenQueue(rsGxsChannels->getTokenService(), instance); mTokenQueueChannel = new TokenQueue(rsGxsChannels->getTokenService(), instance);
} }
RsGxsGroupId grpId(fi.mId1); addFeedItemChannelPublishKey(fi);
if (!grpId.isNull()) {
RsTokReqOptions opts;
opts.mReqType = GXS_REQUEST_TYPE_GROUP_DATA;
std::list<RsGxsGroupId> grpIds; // RsGxsGroupId grpId(fi.mId1);
grpIds.push_back(grpId); // if (!grpId.isNull()) {
// RsTokReqOptions opts;
uint32_t token; // opts.mReqType = GXS_REQUEST_TYPE_GROUP_DATA;
mTokenQueueChannel->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_SUMMARY, opts, grpIds, TOKEN_TYPE_PUBLISHKEY); //
// std::list<RsGxsGroupId> grpIds;
// grpIds.push_back(grpId);
//
// uint32_t token;
// mTokenQueueChannel->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_SUMMARY, opts, grpIds, TOKEN_TYPE_PUBLISHKEY);
// }
} }
}
// if (flags & RS_FEED_TYPE_CHANNEL)
// addFeedItemChannelPublishKey(fi);
break; break;
case RS_FEED_ITEM_FORUM_NEW: case RS_FEED_ITEM_FORUM_NEW:
@ -769,6 +751,14 @@ void NewsFeed::loadChannelPublishKey(const uint32_t &token)
#ifdef UNUSED_CODE #ifdef UNUSED_CODE
MessageComposer::sendChannelPublishKey(groups[0]); MessageComposer::sendChannelPublishKey(groups[0]);
#endif #endif
RsGxsChannelGroup& grp = *groups.begin();
RsFeedItem fi;
fi.mId1 = grp.mMeta.mGroupId.toStdString();
addFeedItemChannelPublishKey(fi);
} }
void NewsFeed::loadForumGroup(const uint32_t &token) void NewsFeed::loadForumGroup(const uint32_t &token)
@ -863,6 +853,8 @@ void NewsFeed::loadForumPublishKey(const uint32_t &token)
#ifdef UNUSED_CODE #ifdef UNUSED_CODE
MessageComposer::sendForumPublishKey(groups[0]); MessageComposer::sendForumPublishKey(groups[0]);
#endif #endif
std::cerr << "(EE) Unimplemented code: received an order to load/display item for received forum publish key, but the implementation is missing." << std::endl;
} }
void NewsFeed::loadPostedGroup(const uint32_t &token) void NewsFeed::loadPostedGroup(const uint32_t &token)
@ -1357,6 +1349,24 @@ void NewsFeed::addFeedItemChannelMsg(const RsFeedItem &fi)
/* add to layout */ /* add to layout */
addFeedItem(item); addFeedItem(item);
#ifdef NEWS_DEBUG
std::cerr << "NewsFeed::addFeedItemChanMsg()";
std::cerr << std::endl;
#endif
}
void NewsFeed::addFeedItemChannelPublishKey(const RsFeedItem &fi)
{
RsGxsGroupId grpId(fi.mId1);
if (grpId.isNull())
return;
/* make new widget */
GxsChannelGroupItem *item = new GxsChannelGroupItem(this, NEWSFEED_CHANNELPUBKEYLIST, grpId, false, true);
/* add to layout */
addFeedItem(item);
#ifdef NEWS_DEBUG #ifdef NEWS_DEBUG
std::cerr << "NewsFeed::addFeedItemChanMsg()"; std::cerr << "NewsFeed::addFeedItemChanMsg()";
std::cerr << std::endl; std::cerr << std::endl;

View file

@ -30,6 +30,25 @@
#define IMAGE_NEWSFEED ":/icons/plugins_128.png" #define IMAGE_NEWSFEED ":/icons/plugins_128.png"
const uint32_t NEWSFEED_PEERLIST = 0x0001;
const uint32_t NEWSFEED_FORUMNEWLIST = 0x0002;
const uint32_t NEWSFEED_FORUMMSGLIST = 0x0003;
const uint32_t NEWSFEED_CHANNELNEWLIST = 0x0004;
//const uint32_t NEWSFEED_CHANNELMSGLIST = 0x0005;
#if 0
const uint32_t NEWSFEED_BLOGNEWLIST = 0x0006;
const uint32_t NEWSFEED_BLOGMSGLIST = 0x0007;
#endif
const uint32_t NEWSFEED_MESSAGELIST = 0x0008;
const uint32_t NEWSFEED_CHATMSGLIST = 0x0009;
const uint32_t NEWSFEED_SECLIST = 0x000a;
const uint32_t NEWSFEED_POSTEDNEWLIST = 0x000b;
const uint32_t NEWSFEED_POSTEDMSGLIST = 0x000c;
const uint32_t NEWSFEED_CIRCLELIST = 0x000d;
const uint32_t NEWSFEED_CHANNELPUBKEYLIST= 0x000e;
namespace Ui { namespace Ui {
class NewsFeed; class NewsFeed;
} }
@ -102,6 +121,7 @@ private:
void addFeedItemChannelNew(const RsFeedItem &fi); void addFeedItemChannelNew(const RsFeedItem &fi);
// void addFeedItemChannelUpdate(const RsFeedItem &fi); // void addFeedItemChannelUpdate(const RsFeedItem &fi);
void addFeedItemChannelMsg(const RsFeedItem &fi); void addFeedItemChannelMsg(const RsFeedItem &fi);
void addFeedItemChannelPublishKey(const RsFeedItem &fi);
void addFeedItemForumNew(const RsFeedItem &fi); void addFeedItemForumNew(const RsFeedItem &fi);
// void addFeedItemForumUpdate(const RsFeedItem &fi); // void addFeedItemForumUpdate(const RsFeedItem &fi);

View file

@ -23,6 +23,7 @@
#include "ui_GxsChannelGroupItem.h" #include "ui_GxsChannelGroupItem.h"
#include "FeedHolder.h" #include "FeedHolder.h"
#include "gui/NewsFeed.h"
#include "gui/RetroShareLink.h" #include "gui/RetroShareLink.h"
/**** /****
@ -144,14 +145,14 @@ void GxsChannelGroupItem::fill()
ui->subscribeButton->setEnabled(true); ui->subscribeButton->setEnabled(true);
} }
// if (mIsNew) switch(mFeedId)
// { {
ui->titleLabel->setText(tr("New Channel")); case NEWSFEED_CHANNELPUBKEYLIST: ui->titleLabel->setText(tr("Publish permission received for channel: "));
// } break ;
// else
// { case NEWSFEED_CHANNELNEWLIST: ui->titleLabel->setText(tr("New Channel: "));
// ui->titleLabel->setText(tr("Updated Channel")); break ;
// } }
if (mIsHome) if (mIsHome)
{ {