diff --git a/libretroshare/src/gxs/rsgenexchange.cc b/libretroshare/src/gxs/rsgenexchange.cc index 06c640b80..0d10eddf0 100644 --- a/libretroshare/src/gxs/rsgenexchange.cc +++ b/libretroshare/src/gxs/rsgenexchange.cc @@ -1007,7 +1007,7 @@ void RsGenExchange::receiveChanges(std::vector& changes) } else { -#warning cyril: very weird code. Why delete an element without removing it from the array?? +#warning cyril: very weird code. Why delete an element without removing it from the array delete n; } } @@ -1508,6 +1508,14 @@ void RsGenExchange::notifyNewMessages(std::vector& messages) } +void RsGenExchange::notifyReceivePublishKey(const RsGxsGroupId &grpId) +{ + RS_STACK_MUTEX(mGenMtx); + + RsGxsGroupChange* gc = new RsGxsGroupChange(RsGxsNotify::TYPE_PUBLISHKEY, false); + gc->mGrpIdList.push_back(grpId); + mNotifications.push_back(gc); +} void RsGenExchange::publishGroup(uint32_t& token, RsGxsGrpItem *grpItem) { diff --git a/libretroshare/src/gxs/rsgenexchange.h b/libretroshare/src/gxs/rsgenexchange.h index b5f92f5f2..ed0b123aa 100644 --- a/libretroshare/src/gxs/rsgenexchange.h +++ b/libretroshare/src/gxs/rsgenexchange.h @@ -144,12 +144,17 @@ public: /*! * @param messages messages are deleted after function returns */ - void notifyNewMessages(std::vector& messages); + virtual void notifyNewMessages(std::vector& messages); /*! - * @param messages messages are deleted after function returns + * @param groups groups are deleted after function returns */ - void notifyNewGroups(std::vector& groups); + virtual void notifyNewGroups(std::vector& groups); + + /*! + * @param grpId group id + */ + virtual void notifyReceivePublishKey(const RsGxsGroupId &grpId); /** E: Observer implementation **/ diff --git a/libretroshare/src/gxs/rsgxsnetservice.cc b/libretroshare/src/gxs/rsgxsnetservice.cc index a3f2b3152..dd9372a81 100644 --- a/libretroshare/src/gxs/rsgxsnetservice.cc +++ b/libretroshare/src/gxs/rsgxsnetservice.cc @@ -3428,11 +3428,15 @@ void RsGxsNetService::handleRecvPublishKeys(RsNxsGroupPublishKeyItem *item) it->second = item->key ; bool ret = mDataStore->updateGroupKeys(item->grpId,grpMeta->keys, grpMeta->mSubscribeFlags | GXS_SERV::GROUP_SUBSCRIBE_PUBLISH) ; - if(!ret) - std::cerr << "(EE) could not update database. Something went wrong." << std::endl; + if(ret) + { #ifdef NXS_NET_DEBUG - else - std::cerr << " updated database with new publish keys." << std::endl; + std::cerr << " updated database with new publish keys." << std::endl; #endif + mObserver->notifyReceivePublishKey(item->grpId); + } + else + { + std::cerr << "(EE) could not update database. Something went wrong." << std::endl; + } } - diff --git a/libretroshare/src/gxs/rsnxsobserver.h b/libretroshare/src/gxs/rsnxsobserver.h index 627080ae7..2dfb91bdc 100644 --- a/libretroshare/src/gxs/rsnxsobserver.h +++ b/libretroshare/src/gxs/rsnxsobserver.h @@ -45,12 +45,14 @@ public: virtual void notifyNewMessages(std::vector& messages) = 0; /*! - * @param messages messages are deleted after function returns + * @param groups groups are deleted after function returns */ virtual void notifyNewGroups(std::vector& groups) = 0; - - + /*! + * @param grpId group id + */ + virtual void notifyReceivePublishKey(const RsGxsGroupId &grpId) = 0; }; #endif // RSNXSOBSERVER_H diff --git a/libretroshare/src/retroshare/rsgxsservice.h b/libretroshare/src/retroshare/rsgxsservice.h index 2c6b6e877..47f546c35 100644 --- a/libretroshare/src/retroshare/rsgxsservice.h +++ b/libretroshare/src/retroshare/rsgxsservice.h @@ -22,7 +22,7 @@ class RsGxsNotify { public: - enum NotifyType { TYPE_PUBLISH, TYPE_RECEIVE, TYPE_PROCESSED }; + enum NotifyType { TYPE_PUBLISH, TYPE_RECEIVE, TYPE_PROCESSED, TYPE_PUBLISHKEY }; virtual ~RsGxsNotify() {return; } virtual NotifyType getType() = 0; diff --git a/libretroshare/src/retroshare/rsmsgs.h b/libretroshare/src/retroshare/rsmsgs.h index 857aa1354..08a29d4ea 100644 --- a/libretroshare/src/retroshare/rsmsgs.h +++ b/libretroshare/src/retroshare/rsmsgs.h @@ -59,12 +59,14 @@ // system message #define RS_MSG_USER_REQUEST 0x000400 /* user request */ #define RS_MSG_FRIEND_RECOMMENDATION 0x000800 /* friend recommendation */ -#define RS_MSG_SYSTEM (RS_MSG_USER_REQUEST | RS_MSG_FRIEND_RECOMMENDATION) #define RS_MSG_ENCRYPTED 0x001000 /* message is encrypted */ #define RS_MSG_SIGNATURE_CHECKS 0x002000 /* message was signed, and signature checked */ #define RS_MSG_SIGNED 0x004000 /* message was signed and signature didn't check */ #define RS_MSG_LOAD_EMBEDDED_IMAGES 0x008000 /* load embedded images */ #define RS_MSG_DECRYPTED 0x010000 /* message was previously encrypted, and is now decrypted */ +#define RS_MSG_PUBLISH_KEY 0x020000 /* publish key */ + +#define RS_MSG_SYSTEM (RS_MSG_USER_REQUEST | RS_MSG_FRIEND_RECOMMENDATION | RS_MSG_PUBLISH_KEY) #define RS_CHAT_LOBBY_EVENT_PEER_LEFT 0x01 #define RS_CHAT_LOBBY_EVENT_PEER_STATUS 0x02 diff --git a/libretroshare/src/retroshare/rsnotify.h b/libretroshare/src/retroshare/rsnotify.h index efa8f7d33..ae3cd6cae 100644 --- a/libretroshare/src/retroshare/rsnotify.h +++ b/libretroshare/src/retroshare/rsnotify.h @@ -92,10 +92,12 @@ const uint32_t RS_FEED_ITEM_SEC_MISSING_CERTIFICATE = RS_FEED_TYPE_SECURITY | 0 const uint32_t RS_FEED_ITEM_CHANNEL_NEW = RS_FEED_TYPE_CHANNEL | 0x0001; //const uint32_t RS_FEED_ITEM_CHANNEL_UPDATE = RS_FEED_TYPE_CHANNEL | 0x0002; const uint32_t RS_FEED_ITEM_CHANNEL_MSG = RS_FEED_TYPE_CHANNEL | 0x0003; +const uint32_t RS_FEED_ITEM_CHANNEL_PUBLISHKEY = RS_FEED_TYPE_CHANNEL | 0x0004; const uint32_t RS_FEED_ITEM_FORUM_NEW = RS_FEED_TYPE_FORUM | 0x0001; //const uint32_t RS_FEED_ITEM_FORUM_UPDATE = RS_FEED_TYPE_FORUM | 0x0002; const uint32_t RS_FEED_ITEM_FORUM_MSG = RS_FEED_TYPE_FORUM | 0x0003; +const uint32_t RS_FEED_ITEM_FORUM_PUBLISHKEY = RS_FEED_TYPE_FORUM | 0x0004; //const uint32_t RS_FEED_ITEM_BLOG_NEW = RS_FEED_TYPE_BLOG | 0x0001; //const uint32_t RS_FEED_ITEM_BLOG_UPDATE = RS_FEED_TYPE_BLOG | 0x0002; diff --git a/libretroshare/src/serialiser/rsmsgitems.h b/libretroshare/src/serialiser/rsmsgitems.h index 6e426e080..91a69050b 100644 --- a/libretroshare/src/serialiser/rsmsgitems.h +++ b/libretroshare/src/serialiser/rsmsgitems.h @@ -65,7 +65,6 @@ const uint32_t RS_MSG_FLAGS_STAR = 0x00000200; const uint32_t RS_MSG_FLAGS_PARTIAL = 0x00000400; const uint32_t RS_MSG_FLAGS_USER_REQUEST = 0x00000800; const uint32_t RS_MSG_FLAGS_FRIEND_RECOMMENDATION = 0x00001000; -const uint32_t RS_MSG_FLAGS_SYSTEM = RS_MSG_FLAGS_USER_REQUEST | RS_MSG_FLAGS_FRIEND_RECOMMENDATION; const uint32_t RS_MSG_FLAGS_RETURN_RECEPT = 0x00002000; const uint32_t RS_MSG_FLAGS_ENCRYPTED = 0x00004000; const uint32_t RS_MSG_FLAGS_DISTANT = 0x00008000; @@ -74,6 +73,9 @@ const uint32_t RS_MSG_FLAGS_SIGNED = 0x00020000; const uint32_t RS_MSG_FLAGS_LOAD_EMBEDDED_IMAGES = 0x00040000; const uint32_t RS_MSG_FLAGS_DECRYPTED = 0x00080000; const uint32_t RS_MSG_FLAGS_ROUTED = 0x00100000; +const uint32_t RS_MSG_FLAGS_PUBLISH_KEY = 0x00200000; + +const uint32_t RS_MSG_FLAGS_SYSTEM = RS_MSG_FLAGS_USER_REQUEST | RS_MSG_FLAGS_FRIEND_RECOMMENDATION | RS_MSG_FLAGS_PUBLISH_KEY; class RsMessageItem: public RsItem { diff --git a/libretroshare/src/services/p3gxschannels.cc b/libretroshare/src/services/p3gxschannels.cc index 1944b2400..4135c09f2 100644 --- a/libretroshare/src/services/p3gxschannels.cc +++ b/libretroshare/src/services/p3gxschannels.cc @@ -197,17 +197,38 @@ void p3GxsChannels::notifyChanges(std::vector &changes) } else { - if (notify && (*it)->getType() == RsGxsNotify::TYPE_RECEIVE) + if (notify) { - RsGxsGroupChange *grpChange = dynamic_cast(*it); + RsGxsGroupChange *grpChange = dynamic_cast(*it); if (grpChange) { - /* group received */ - std::list &grpList = grpChange->mGrpIdList; - std::list::iterator git; - for (git = grpList.begin(); git != grpList.end(); ++git) + switch (grpChange->getType()) { - notify->AddFeedItem(RS_FEED_ITEM_CHANNEL_NEW, git->toStdString()); + case RsGxsNotify::TYPE_PROCESSED: + case RsGxsNotify::TYPE_PUBLISH: + break; + + case RsGxsNotify::TYPE_RECEIVE: + { + /* group received */ + std::list &grpList = grpChange->mGrpIdList; + std::list::iterator git; + for (git = grpList.begin(); git != grpList.end(); ++git) + { + notify->AddFeedItem(RS_FEED_ITEM_CHANNEL_NEW, git->toStdString()); + } + } + + case RsGxsNotify::TYPE_PUBLISHKEY: + { + /* group received */ + std::list &grpList = grpChange->mGrpIdList; + std::list::iterator git; + for (git = grpList.begin(); git != grpList.end(); ++git) + { + notify->AddFeedItem(RS_FEED_ITEM_CHANNEL_PUBLISHKEY, git->toStdString()); + } + } } } } diff --git a/libretroshare/src/services/p3gxsforums.cc b/libretroshare/src/services/p3gxsforums.cc index 4befc4f70..db4be3c4d 100644 --- a/libretroshare/src/services/p3gxsforums.cc +++ b/libretroshare/src/services/p3gxsforums.cc @@ -110,35 +110,59 @@ void p3GxsForums::notifyChanges(std::vector &changes) for(it = changes.begin(); it != changes.end(); ++it) { RsGxsNotify *c = *it; - if (c->getType() == RsGxsNotify::TYPE_RECEIVE) + + switch (c->getType()) { - RsGxsMsgChange *msgChange = dynamic_cast(c); - if (msgChange) + case RsGxsNotify::TYPE_PROCESSED: + case RsGxsNotify::TYPE_PUBLISH: + break; + + case RsGxsNotify::TYPE_RECEIVE: { - std::map > &msgChangeMap = msgChange->msgChangeMap; - std::map >::iterator mit; - for (mit = msgChangeMap.begin(); mit != msgChangeMap.end(); ++mit) + RsGxsMsgChange *msgChange = dynamic_cast(c); + if (msgChange) { - std::vector::iterator mit1; - for (mit1 = mit->second.begin(); mit1 != mit->second.end(); ++mit1) + std::map > &msgChangeMap = msgChange->msgChangeMap; + std::map >::iterator mit; + for (mit = msgChangeMap.begin(); mit != msgChangeMap.end(); ++mit) { - notify->AddFeedItem(RS_FEED_ITEM_FORUM_MSG, mit->first.toStdString(), mit1->toStdString()); + std::vector::iterator mit1; + for (mit1 = mit->second.begin(); mit1 != mit->second.end(); ++mit1) + { + notify->AddFeedItem(RS_FEED_ITEM_FORUM_MSG, mit->first.toStdString(), mit1->toStdString()); + } } + continue; + } + + RsGxsGroupChange *grpChange = dynamic_cast(*it); + if (grpChange) + { + /* group received */ + std::list &grpList = grpChange->mGrpIdList; + std::list::iterator git; + for (git = grpList.begin(); git != grpList.end(); ++git) + { + notify->AddFeedItem(RS_FEED_ITEM_FORUM_NEW, git->toStdString()); + } + continue; } - continue; } - RsGxsGroupChange *grpChange = dynamic_cast(*it); - if (grpChange) + case RsGxsNotify::TYPE_PUBLISHKEY: { - /* group received */ - std::list &grpList = grpChange->mGrpIdList; - std::list::iterator git; - for (git = grpList.begin(); git != grpList.end(); ++git) + RsGxsGroupChange *grpChange = dynamic_cast(*it); + if (grpChange) { - notify->AddFeedItem(RS_FEED_ITEM_FORUM_NEW, git->toStdString()); + /* group received */ + std::list &grpList = grpChange->mGrpIdList; + std::list::iterator git; + for (git = grpList.begin(); git != grpList.end(); ++git) + { + notify->AddFeedItem(RS_FEED_ITEM_FORUM_PUBLISHKEY, git->toStdString()); + } + continue; } - continue; } } } diff --git a/libretroshare/src/services/p3msgservice.cc b/libretroshare/src/services/p3msgservice.cc index ed50aa3a1..ef8d6ae9b 100644 --- a/libretroshare/src/services/p3msgservice.cc +++ b/libretroshare/src/services/p3msgservice.cc @@ -1087,6 +1087,9 @@ bool p3MsgService::SystemMessage(const std::string &title, const std::string &me if (systemFlag & RS_MSG_FRIEND_RECOMMENDATION) { msg->msgFlags |= RS_MSG_FLAGS_FRIEND_RECOMMENDATION; } + if (systemFlag & RS_MSG_PUBLISH_KEY) { + msg->msgFlags |= RS_MSG_FLAGS_PUBLISH_KEY; + } msg->msgId = 0; msg->sendTime = time(NULL); @@ -1486,6 +1489,7 @@ void p3MsgService::initRsMI(RsMsgItem *msg, MessageInfo &mi) if (msg->msgFlags & RS_MSG_FLAGS_STAR) mi.msgflags |= RS_MSG_STAR; if (msg->msgFlags & RS_MSG_FLAGS_USER_REQUEST) mi.msgflags |= RS_MSG_USER_REQUEST; if (msg->msgFlags & RS_MSG_FLAGS_FRIEND_RECOMMENDATION) mi.msgflags |= RS_MSG_FRIEND_RECOMMENDATION; + if (msg->msgFlags & RS_MSG_FLAGS_PUBLISH_KEY) mi.msgflags |= RS_MSG_PUBLISH_KEY; if (msg->msgFlags & RS_MSG_FLAGS_LOAD_EMBEDDED_IMAGES) mi.msgflags |= RS_MSG_LOAD_EMBEDDED_IMAGES; mi.ts = msg->sendTime; @@ -1584,6 +1588,10 @@ void p3MsgService::initRsMIS(RsMsgItem *msg, MsgInfoSummary &mis) { mis.msgflags |= RS_MSG_FRIEND_RECOMMENDATION; } + if (msg->msgFlags & RS_MSG_FLAGS_PUBLISH_KEY) + { + mis.msgflags |= RS_MSG_PUBLISH_KEY; + } if (msg->msgFlags & RS_MSG_FLAGS_LOAD_EMBEDDED_IMAGES) { mis.msgflags |= RS_MSG_LOAD_EMBEDDED_IMAGES; diff --git a/retroshare-gui/src/gui/MessagesDialog.cpp b/retroshare-gui/src/gui/MessagesDialog.cpp index 781d36e61..f9d578701 100644 --- a/retroshare-gui/src/gui/MessagesDialog.cpp +++ b/retroshare-gui/src/gui/MessagesDialog.cpp @@ -783,6 +783,8 @@ static void InitIconAndFont(QTreeWidgetItem *item) item->setIcon(COLUMN_SUBJECT, QIcon(":/images/user/user_request16.png")); } else if (msgFlags & RS_MSG_FRIEND_RECOMMENDATION) { item->setIcon(COLUMN_SUBJECT, QIcon(":/images/user/friend_suggestion16.png")); + } else if (msgFlags & RS_MSG_PUBLISH_KEY) { + item->setIcon(COLUMN_SUBJECT, QIcon(":/images/share-icon-16.png")); } else if (msgFlags & RS_MSG_UNREAD_BY_USER) { if ((msgFlags & (RS_MSG_REPLIED | RS_MSG_FORWARDED)) == RS_MSG_REPLIED) { item->setIcon(COLUMN_SUBJECT, QIcon(":/images/message-mail-replied.png")); diff --git a/retroshare-gui/src/gui/NewsFeed.cpp b/retroshare-gui/src/gui/NewsFeed.cpp index 6df5c8881..3af2df034 100644 --- a/retroshare-gui/src/gui/NewsFeed.cpp +++ b/retroshare-gui/src/gui/NewsFeed.cpp @@ -79,8 +79,9 @@ const uint32_t NEWSFEED_POSTEDMSGLIST = 0x000c; #define ROLE_RECEIVED FEED_TREEWIDGET_SORTROLE -#define TOKEN_TYPE_GROUP 1 -#define TOKEN_TYPE_MESSAGE 2 +#define TOKEN_TYPE_GROUP 1 +#define TOKEN_TYPE_MESSAGE 2 +#define TOKEN_TYPE_PUBLISHKEY 3 /***** * #define NEWS_DEBUG 1 @@ -255,6 +256,27 @@ void NewsFeed::updateDisplay() if (flags & RS_FEED_TYPE_CHANNEL) addFeedItemChannelMsg(fi); break; + case RS_FEED_ITEM_CHANNEL_PUBLISHKEY: + { + if (!mTokenQueueChannel) { + mTokenQueueChannel = new TokenQueue(rsGxsChannels->getTokenService(), instance); + } + + RsGxsGroupId grpId(fi.mId1); + if (!grpId.isNull()) { + RsTokReqOptions opts; + opts.mReqType = GXS_REQUEST_TYPE_GROUP_DATA; + + std::list 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: if (flags & RS_FEED_TYPE_FORUM) @@ -268,6 +290,27 @@ void NewsFeed::updateDisplay() if (flags & RS_FEED_TYPE_FORUM) addFeedItemForumMsg(fi); break; + case RS_FEED_ITEM_FORUM_PUBLISHKEY: + { + if (!mTokenQueueForum) { + mTokenQueueForum = new TokenQueue(rsGxsForums->getTokenService(), instance); + } + + RsGxsGroupId grpId(fi.mId1); + if (!grpId.isNull()) { + RsTokReqOptions opts; + opts.mReqType = GXS_REQUEST_TYPE_GROUP_DATA; + + std::list grpIds; + grpIds.push_back(grpId); + + uint32_t token; + mTokenQueueForum->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_SUMMARY, opts, grpIds, TOKEN_TYPE_PUBLISHKEY); + } + } +// if (flags & RS_FEED_TYPE_FORUM) +// addFeedItemForumPublishKey(fi); + break; case RS_FEED_ITEM_POSTED_NEW: if (flags & RS_FEED_TYPE_POSTED) @@ -537,6 +580,25 @@ void NewsFeed::loadChannelPost(const uint32_t &token) } } +void NewsFeed::loadChannelPublishKey(const uint32_t &token) +{ + std::vector groups; + if (!rsGxsChannels->getGroupData(token, groups)) { + std::cerr << "NewsFeed::loadChannelPublishKey() ERROR getting data"; + std::cerr << std::endl; + return; + } + + if (groups.size() != 1) + { + std::cerr << "NewsFeed::loadChannelPublishKey() Wrong number of Items"; + std::cerr << std::endl; + return; + } + + MessageComposer::sendChannelPublishKey(groups[0]); +} + void NewsFeed::loadForumGroup(const uint32_t &token) { std::vector forums; @@ -611,6 +673,25 @@ void NewsFeed::loadForumMessage(const uint32_t &token) } } +void NewsFeed::loadForumPublishKey(const uint32_t &token) +{ + std::vector groups; + if (!rsGxsForums->getGroupData(token, groups)) { + std::cerr << "NewsFeed::loadForumPublishKey() ERROR getting data"; + std::cerr << std::endl; + return; + } + + if (groups.size() != 1) + { + std::cerr << "NewsFeed::loadForumPublishKey() Wrong number of Items"; + std::cerr << std::endl; + return; + } + + MessageComposer::sendForumPublishKey(groups[0]); +} + void NewsFeed::loadPostedGroup(const uint32_t &token) { std::vector posted; @@ -697,6 +778,10 @@ void NewsFeed::loadRequest(const TokenQueue *queue, const TokenRequest &req) loadChannelPost(req.mToken); break; + case TOKEN_TYPE_PUBLISHKEY: + loadChannelPublishKey(req.mToken); + break; + default: std::cerr << "NewsFeed::loadRequest() ERROR: INVALID TYPE"; std::cerr << std::endl; @@ -714,6 +799,10 @@ void NewsFeed::loadRequest(const TokenQueue *queue, const TokenRequest &req) loadForumMessage(req.mToken); break; + case TOKEN_TYPE_PUBLISHKEY: + loadForumPublishKey(req.mToken); + break; + default: std::cerr << "NewsFeed::loadRequest() ERROR: INVALID TYPE"; std::cerr << std::endl; diff --git a/retroshare-gui/src/gui/NewsFeed.h b/retroshare-gui/src/gui/NewsFeed.h index 21091c1e2..4d2443139 100644 --- a/retroshare-gui/src/gui/NewsFeed.h +++ b/retroshare-gui/src/gui/NewsFeed.h @@ -118,9 +118,11 @@ private: virtual void loadChannelGroup(const uint32_t &token); virtual void loadChannelPost(const uint32_t &token); + virtual void loadChannelPublishKey(const uint32_t &token); virtual void loadForumGroup(const uint32_t &token); virtual void loadForumMessage(const uint32_t &token); + virtual void loadForumPublishKey(const uint32_t &token); virtual void loadPostedGroup(const uint32_t &token); virtual void loadPostedMessage(const uint32_t &token); diff --git a/retroshare-gui/src/gui/msgs/MessageComposer.cpp b/retroshare-gui/src/gui/msgs/MessageComposer.cpp index 1dfb800c7..5b3b054f1 100644 --- a/retroshare-gui/src/gui/msgs/MessageComposer.cpp +++ b/retroshare-gui/src/gui/msgs/MessageComposer.cpp @@ -45,6 +45,8 @@ #include #include #include +#include +#include #include "gui/notifyqt.h" #include "gui/common/RSTreeWidgetItem.h" @@ -533,6 +535,38 @@ void MessageComposer::sendConnectAttemptMsg(const RsPgpId &gpgId, const RsPeerId rsMsgs->SystemMessage(title.toUtf8().constData(), msgText.toUtf8().constData(), RS_MSG_USER_REQUEST); } +void MessageComposer::sendChannelPublishKey(RsGxsChannelGroup &group) +{ +// QString channelName = QString::fromUtf8(group.mMeta.mGroupName.c_str()); + +// RetroShareLink link; +// if (!link.createGxsGroupLink(RetroShareLink::TYPE_CHANNEL, group.mMeta.mGroupId, channelName)) { +// return; +// } + +// QString title = tr("Publish key for channel %1").arg(channelName); + +// /* create a message */ +// QString msgText = tr("... %1 ...
%2").arg(channelName, link.toHtml()); +// rsMsgs->SystemMessage(title.toUtf8().constData(), msgText.toUtf8().constData(), RS_MSG_PUBLISH_KEY); +} + +void MessageComposer::sendForumPublishKey(RsGxsForumGroup &group) +{ +// QString forumName = QString::fromUtf8(group.mMeta.mGroupName.c_str()); + +// RetroShareLink link; +// if (!link.createGxsGroupLink(RetroShareLink::TYPE_FORUM, group.mMeta.mGroupId, forumName)) { +// return; +// } + +// QString title = tr("Publish key for forum %1").arg(forumName); + +// /* create a message */ +// QString msgText = tr("... %1 ...
%2").arg(forumName, link.toHtml()); +// rsMsgs->SystemMessage(title.toUtf8().constData(), msgText.toUtf8().constData(), RS_MSG_PUBLISH_KEY); +} + void MessageComposer::closeEvent (QCloseEvent * event) { bool bClose = true; diff --git a/retroshare-gui/src/gui/msgs/MessageComposer.h b/retroshare-gui/src/gui/msgs/MessageComposer.h index 3db216d09..10be3fd6c 100644 --- a/retroshare-gui/src/gui/msgs/MessageComposer.h +++ b/retroshare-gui/src/gui/msgs/MessageComposer.h @@ -34,6 +34,8 @@ class QTextEdit; class QTextCharFormat; class RSTreeWidgetItemCompareRole; struct MessageInfo; +class RsGxsChannelGroup; +class RsGxsForumGroup; class MessageComposer : public QMainWindow { @@ -57,6 +59,8 @@ public: static QString recommendMessage(); static void recommendFriend(const std::list &sslIds, const RsPeerId &to = RsPeerId(), const QString &msg = "", bool autoSend = false); static void sendConnectAttemptMsg(const RsPgpId &gpgId, const RsPeerId &sslId, const QString &sslName); + static void sendChannelPublishKey(RsGxsChannelGroup &group); + static void sendForumPublishKey(RsGxsForumGroup &group); static MessageComposer *newMsg(const std::string &msgId = ""); static MessageComposer *replyMsg(const std::string &msgId, bool all);