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

View File

@ -58,24 +58,6 @@
#include "common/FeedNotify.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 TOKEN_TYPE_GROUP 1
@ -281,20 +263,20 @@ void NewsFeed::updateDisplay()
mTokenQueueChannel = new TokenQueue(rsGxsChannels->getTokenService(), instance);
}
RsGxsGroupId grpId(fi.mId1);
if (!grpId.isNull()) {
RsTokReqOptions opts;
opts.mReqType = GXS_REQUEST_TYPE_GROUP_DATA;
addFeedItemChannelPublishKey(fi);
std::list<RsGxsGroupId> grpIds;
grpIds.push_back(grpId);
uint32_t token;
mTokenQueueChannel->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_SUMMARY, opts, grpIds, TOKEN_TYPE_PUBLISHKEY);
}
// RsGxsGroupId grpId(fi.mId1);
// if (!grpId.isNull()) {
// RsTokReqOptions opts;
// opts.mReqType = GXS_REQUEST_TYPE_GROUP_DATA;
//
// 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;
case RS_FEED_ITEM_FORUM_NEW:
@ -769,6 +751,14 @@ void NewsFeed::loadChannelPublishKey(const uint32_t &token)
#ifdef UNUSED_CODE
MessageComposer::sendChannelPublishKey(groups[0]);
#endif
RsGxsChannelGroup& grp = *groups.begin();
RsFeedItem fi;
fi.mId1 = grp.mMeta.mGroupId.toStdString();
addFeedItemChannelPublishKey(fi);
}
void NewsFeed::loadForumGroup(const uint32_t &token)
@ -863,6 +853,8 @@ void NewsFeed::loadForumPublishKey(const uint32_t &token)
#ifdef UNUSED_CODE
MessageComposer::sendForumPublishKey(groups[0]);
#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)
@ -1357,6 +1349,24 @@ void NewsFeed::addFeedItemChannelMsg(const RsFeedItem &fi)
/* add to layout */
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
std::cerr << "NewsFeed::addFeedItemChanMsg()";
std::cerr << std::endl;

View File

@ -30,6 +30,25 @@
#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 {
class NewsFeed;
}
@ -102,6 +121,7 @@ private:
void addFeedItemChannelNew(const RsFeedItem &fi);
// void addFeedItemChannelUpdate(const RsFeedItem &fi);
void addFeedItemChannelMsg(const RsFeedItem &fi);
void addFeedItemChannelPublishKey(const RsFeedItem &fi);
void addFeedItemForumNew(const RsFeedItem &fi);
// void addFeedItemForumUpdate(const RsFeedItem &fi);

View File

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