extended group share keys to Posted

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@7608 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2014-10-13 18:31:47 +00:00
parent adbfa89c7b
commit 6e2df7e0de
11 changed files with 54 additions and 31 deletions

View File

@ -99,6 +99,8 @@ virtual bool createGroup(uint32_t &token, RsPostedGroup &group) = 0;
virtual bool createPost(uint32_t &token, RsPostedPost &post) = 0; virtual bool createPost(uint32_t &token, RsPostedPost &post) = 0;
virtual bool updateGroup(uint32_t &token, RsPostedGroup &group) = 0; virtual bool updateGroup(uint32_t &token, RsPostedGroup &group) = 0;
virtual bool groupShareKeys(const RsGxsGroupId& group,const std::list<RsPeerId>& peers) = 0 ;
}; };

View File

@ -62,7 +62,11 @@ RsServiceInfo p3Posted::getServiceInfo()
GXS_POSTED_MIN_MINOR_VERSION); GXS_POSTED_MIN_MINOR_VERSION);
} }
bool p3Posted::groupShareKeys(const RsGxsGroupId& groupId,const std::list<RsPeerId>& peers)
{
RsGenExchange::shareGroupPublishKey(groupId,peers) ;
return true ;
}
bool p3Posted::getGroupData(const uint32_t &token, std::vector<RsPostedGroup> &groups) bool p3Posted::getGroupData(const uint32_t &token, std::vector<RsPostedGroup> &groups)
{ {

View File

@ -70,6 +70,7 @@ virtual bool createGroup(uint32_t &token, RsPostedGroup &group);
virtual bool createPost(uint32_t &token, RsPostedPost &post); virtual bool createPost(uint32_t &token, RsPostedPost &post);
virtual bool updateGroup(uint32_t &token, RsPostedGroup &group); virtual bool updateGroup(uint32_t &token, RsPostedGroup &group);
virtual bool groupShareKeys(const RsGxsGroupId &group, const std::list<RsPeerId>& peers);
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// WRAPPERS due to the separate Interface. // WRAPPERS due to the separate Interface.

View File

@ -26,7 +26,7 @@
#include "PostedGroupDialog.h" #include "PostedGroupDialog.h"
#include "PostedListWidget.h" #include "PostedListWidget.h"
#include "PostedUserNotify.h" #include "PostedUserNotify.h"
//#include "gui/channels/ShareKey.h" #include "gui/gxs/GxsGroupShareKey.h"
#include "gui/settings/rsharesettings.h" #include "gui/settings/rsharesettings.h"
#include <retroshare/rsposted.h> #include <retroshare/rsposted.h>
@ -118,7 +118,7 @@ GxsGroupDialog *PostedDialog::createGroupDialog(TokenQueue *tokenQueue, RsTokenS
int PostedDialog::shareKeyType() int PostedDialog::shareKeyType()
{ {
return 0; //POSTED_KEY_SHARE; return POSTED_KEY_SHARE;
} }
GxsMessageFrameWidget *PostedDialog::createMessageFrameWidget(const RsGxsGroupId &groupId) GxsMessageFrameWidget *PostedDialog::createMessageFrameWidget(const RsGxsGroupId &groupId)

View File

@ -29,7 +29,7 @@
#include "gui/settings/rsharesettings.h" #include "gui/settings/rsharesettings.h"
#include "gui/RetroShareLink.h" #include "gui/RetroShareLink.h"
#include "gui/gxschannels/GxsChannelShareKey.h" #include "gui/gxs/GxsGroupShareKey.h"
#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"
@ -434,7 +434,7 @@ void GxsGroupFrameDialog::shareKey()
// QMessageBox::warning(this, "", "ToDo"); // QMessageBox::warning(this, "", "ToDo");
ChannelShareKey shareUi(this, mGroupId, shareKeyType()); GroupShareKey shareUi(this, mGroupId, shareKeyType());
shareUi.exec(); shareUi.exec();
} }

View File

@ -19,17 +19,19 @@
* Boston, MA 02110-1301, USA. * Boston, MA 02110-1301, USA.
****************************************************************/ ****************************************************************/
#include "GxsChannelShareKey.h" #include "GxsGroupShareKey.h"
#include <QMessageBox> #include <QMessageBox>
#include <algorithm> #include <algorithm>
#include <retroshare/rspeers.h> #include <retroshare/rspeers.h>
#include <retroshare/rsgxschannels.h> #include <retroshare/rsgxschannels.h>
#include <retroshare/rsgxsforums.h>
#include <retroshare/rsposted.h>
#include "gui/common/PeerDefs.h" #include "gui/common/PeerDefs.h"
ChannelShareKey::ChannelShareKey(QWidget *parent, const RsGxsGroupId &grpId, int grpType) : GroupShareKey::GroupShareKey(QWidget *parent, const RsGxsGroupId &grpId, int grpType) :
QDialog(parent, Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint), mGrpId(grpId), mGrpType(grpType) QDialog(parent, Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint), mGrpId(grpId), mGrpType(grpType)
{ {
ui = new Ui::ShareKey(); ui = new Ui::ShareKey();
@ -48,12 +50,12 @@ ChannelShareKey::ChannelShareKey(QWidget *parent, const RsGxsGroupId &grpId, int
ui->keyShareList->start(); ui->keyShareList->start();
} }
ChannelShareKey::~ChannelShareKey() GroupShareKey::~GroupShareKey()
{ {
delete ui; delete ui;
} }
void ChannelShareKey::changeEvent(QEvent *e) void GroupShareKey::changeEvent(QEvent *e)
{ {
QDialog::changeEvent(e); QDialog::changeEvent(e);
switch (e->type()) { switch (e->type()) {
@ -65,7 +67,7 @@ void ChannelShareKey::changeEvent(QEvent *e)
} }
} }
void ChannelShareKey::shareKey() void GroupShareKey::shareKey()
{ {
std::list<RsPeerId> shareList; std::list<RsPeerId> shareList;
ui->keyShareList->selectedIds<RsPeerId,FriendSelectionWidget::IDTYPE_SSL>(shareList, false); ui->keyShareList->selectedIds<RsPeerId,FriendSelectionWidget::IDTYPE_SSL>(shareList, false);
@ -76,23 +78,37 @@ void ChannelShareKey::shareKey()
return; return;
} }
if (mGrpType & CHANNEL_KEY_SHARE) { if (mGrpType == CHANNEL_KEY_SHARE)
{
if (!rsGxsChannels) if (!rsGxsChannels)
return; return;
if (!rsGxsChannels->groupShareKeys(mGrpId, shareList)) { if (!rsGxsChannels->groupShareKeys(mGrpId, shareList)) {
std::cerr << "Failed to share keys!" << std::endl; std::cerr << "Failed to share keys!" << std::endl;
return; return;
} }
} else if(mGrpType & FORUM_KEY_SHARE) { }
else if(mGrpType == FORUM_KEY_SHARE)
{
QMessageBox::warning(NULL,"Not implemented.","Not implemented") ; QMessageBox::warning(NULL,"Not implemented.","Not implemented") ;
// if (!rsForums->forumShareKeys(mGrpId, shareList)) { // if (!rsForums->forumShareKeys(mGrpId, shareList)) {
// std::cerr << "Failed to share keys!" << std::endl; // std::cerr << "Failed to share keys!" << std::endl;
//return; //return;
//} //}
} else { }
else if (mGrpType == POSTED_KEY_SHARE)
{
if (!rsPosted)
return;
if (!rsPosted->groupShareKeys(mGrpId, shareList)) {
std::cerr << "Failed to share keys!" << std::endl;
return;
}
}
else
{
// incorrect type // incorrect type
return; return;
} }

View File

@ -7,8 +7,9 @@
#define CHANNEL_KEY_SHARE 0x00000001 #define CHANNEL_KEY_SHARE 0x00000001
#define FORUM_KEY_SHARE 0x00000002 #define FORUM_KEY_SHARE 0x00000002
#define POSTED_KEY_SHARE 0x00000003
class ChannelShareKey : public QDialog class GroupShareKey : public QDialog
{ {
Q_OBJECT Q_OBJECT
@ -16,8 +17,8 @@ public:
/* /*
*@param chanId The channel id to send request for *@param chanId The channel id to send request for
*/ */
ChannelShareKey(QWidget *parent = 0, const RsGxsGroupId& grpId = RsGxsGroupId(), int grpType = 0); GroupShareKey(QWidget *parent = 0, const RsGxsGroupId& grpId = RsGxsGroupId(), int grpType = 0);
~ChannelShareKey(); ~GroupShareKey();
protected: protected:
void changeEvent(QEvent *e); void changeEvent(QEvent *e);

View File

@ -23,7 +23,7 @@
#include "GxsChannelGroupDialog.h" #include "GxsChannelGroupDialog.h"
#include "GxsChannelPostsWidget.h" #include "GxsChannelPostsWidget.h"
#include "GxsChannelUserNotify.h" #include "GxsChannelUserNotify.h"
#include "GxsChannelShareKey.h" #include "gui/gxs/GxsGroupShareKey.h"
#include "gui/feeds/GxsChannelPostItem.h" #include "gui/feeds/GxsChannelPostItem.h"
#include "gui/settings/rsharesettings.h" #include "gui/settings/rsharesettings.h"
#include "gui/notifyqt.h" #include "gui/notifyqt.h"

View File

@ -24,7 +24,7 @@
#include "GxsForumThreadWidget.h" #include "GxsForumThreadWidget.h"
#include "GxsForumUserNotify.h" #include "GxsForumUserNotify.h"
#include "gui/notifyqt.h" #include "gui/notifyqt.h"
#include "gui/gxschannels/GxsChannelShareKey.h" #include "gui/gxs/GxsGroupShareKey.h"
/** Constructor */ /** Constructor */
GxsForumsDialog::GxsForumsDialog(QWidget *parent) GxsForumsDialog::GxsForumsDialog(QWidget *parent)

View File

@ -1191,7 +1191,6 @@ gxschannels {
gui/gxschannels/GxsChannelPostsWidget.h \ gui/gxschannels/GxsChannelPostsWidget.h \
gui/gxschannels/GxsChannelFilesWidget.h \ gui/gxschannels/GxsChannelFilesWidget.h \
gui/gxschannels/GxsChannelFilesStatusWidget.h \ gui/gxschannels/GxsChannelFilesStatusWidget.h \
gui/gxschannels/GxsChannelShareKey.h \
gui/feeds/GxsChannelPostItem.h \ gui/feeds/GxsChannelPostItem.h \
gui/gxschannels/GxsChannelUserNotify.h gui/gxschannels/GxsChannelUserNotify.h
@ -1199,7 +1198,6 @@ gxschannels {
gui/gxschannels/GxsChannelFilesWidget.ui \ gui/gxschannels/GxsChannelFilesWidget.ui \
gui/gxschannels/GxsChannelFilesStatusWidget.ui \ gui/gxschannels/GxsChannelFilesStatusWidget.ui \
gui/gxschannels/CreateGxsChannelMsg.ui \ gui/gxschannels/CreateGxsChannelMsg.ui \
gui/gxschannels/GxsChannelShareKey.ui \
gui/feeds/GxsChannelPostItem.ui gui/feeds/GxsChannelPostItem.ui
SOURCES += gui/gxschannels/GxsChannelDialog.cpp \ SOURCES += gui/gxschannels/GxsChannelDialog.cpp \
@ -1207,7 +1205,6 @@ gxschannels {
gui/gxschannels/GxsChannelFilesWidget.cpp \ gui/gxschannels/GxsChannelFilesWidget.cpp \
gui/gxschannels/GxsChannelFilesStatusWidget.cpp \ gui/gxschannels/GxsChannelFilesStatusWidget.cpp \
gui/gxschannels/GxsChannelGroupDialog.cpp \ gui/gxschannels/GxsChannelGroupDialog.cpp \
gui/gxschannels/GxsChannelShareKey.cpp \
gui/gxschannels/CreateGxsChannelMsg.cpp \ gui/gxschannels/CreateGxsChannelMsg.cpp \
gui/feeds/GxsChannelPostItem.cpp \ gui/feeds/GxsChannelPostItem.cpp \
gui/gxschannels/GxsChannelUserNotify.cpp gui/gxschannels/GxsChannelUserNotify.cpp
@ -1270,6 +1267,7 @@ gxsgui {
gui/gxs/RsGxsUpdateBroadcastBase.h \ gui/gxs/RsGxsUpdateBroadcastBase.h \
gui/gxs/RsGxsUpdateBroadcastWidget.h \ gui/gxs/RsGxsUpdateBroadcastWidget.h \
gui/gxs/RsGxsUpdateBroadcastPage.h \ gui/gxs/RsGxsUpdateBroadcastPage.h \
gui/gxs/GxsGroupShareKey.h \
gui/gxs/GxsUserNotify.h \ gui/gxs/GxsUserNotify.h \
util/TokenQueue.h \ util/TokenQueue.h \
util/RsGxsUpdateBroadcast.h \ util/RsGxsUpdateBroadcast.h \
@ -1280,10 +1278,10 @@ gxsgui {
gui/gxs/GxsCommentContainer.ui \ gui/gxs/GxsCommentContainer.ui \
gui/gxs/GxsCommentDialog.ui \ gui/gxs/GxsCommentDialog.ui \
gui/gxs/GxsCreateCommentDialog.ui \ gui/gxs/GxsCreateCommentDialog.ui \
gui/gxs/GxsGroupFrameDialog.ui gui/gxs/GxsGroupFrameDialog.ui\
gui/gxs/GxsGroupShareKey.ui
# gui/gxs/GxsMsgDialog.ui \ # gui/gxs/GxsMsgDialog.ui \
# gui/gxs/GxsCommentTreeWidget.ui \ # gui/gxs/GxsCommentTreeWidget.ui
SOURCES += gui/gxs/GxsGroupDialog.cpp \ SOURCES += gui/gxs/GxsGroupDialog.cpp \
gui/gxs/WikiGroupDialog.cpp \ gui/gxs/WikiGroupDialog.cpp \
@ -1291,6 +1289,7 @@ gxsgui {
gui/gxs/GxsIdChooser.cpp \ gui/gxs/GxsIdChooser.cpp \
gui/gxs/GxsIdLabel.cpp \ gui/gxs/GxsIdLabel.cpp \
gui/gxs/GxsCircleChooser.cpp \ gui/gxs/GxsCircleChooser.cpp \
gui/gxs/GxsGroupShareKey.cpp \
gui/gxs/GxsCircleLabel.cpp \ gui/gxs/GxsCircleLabel.cpp \
gui/gxs/GxsIdTreeWidget.cpp \ gui/gxs/GxsIdTreeWidget.cpp \
gui/gxs/GxsIdTreeWidgetItem.cpp \ gui/gxs/GxsIdTreeWidgetItem.cpp \