mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
made retrieval of group data manual instead of automatic
This commit is contained in:
parent
59c51a250b
commit
0e37de3e11
@ -94,7 +94,7 @@ public:
|
||||
RsGxsNetTunnelKeepAliveItem() :RsGxsNetTunnelItem(RS_PKT_SUBTYPE_GXS_NET_TUNNEL_KEEP_ALIVE) {}
|
||||
|
||||
virtual ~RsGxsNetTunnelKeepAliveItem() {}
|
||||
virtual void serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx) {}
|
||||
virtual void serial_process(RsGenericSerializer::SerializeJob /* j */,RsGenericSerializer::SerializeContext& /* ctx */) {}
|
||||
};
|
||||
|
||||
class RsGxsNetTunnelRandomBiasItem: public RsGxsNetTunnelItem
|
||||
@ -314,7 +314,7 @@ bool RsGxsNetTunnelService::receiveTunnelData(uint16_t service_id, unsigned char
|
||||
return true;
|
||||
}
|
||||
|
||||
bool RsGxsNetTunnelService::sendTunnelData(uint16_t service_id,unsigned char *& data,uint32_t data_len,const RsGxsNetTunnelVirtualPeerId& virtual_peer)
|
||||
bool RsGxsNetTunnelService::sendTunnelData(uint16_t /* service_id */,unsigned char *& data,uint32_t data_len,const RsGxsNetTunnelVirtualPeerId& virtual_peer)
|
||||
{
|
||||
RS_STACK_MUTEX(mGxsNetTunnelMtx);
|
||||
// The item is serialized and encrypted using chacha20+SHA256, using the generic turtle encryption, and then sent to the turtle router.
|
||||
@ -398,7 +398,7 @@ bool RsGxsNetTunnelService::requestDistantPeers(uint16_t service_id, const RsGxs
|
||||
return true;
|
||||
}
|
||||
|
||||
bool RsGxsNetTunnelService::releaseDistantPeers(uint16_t service_id,const RsGxsGroupId& group_id)
|
||||
bool RsGxsNetTunnelService::releaseDistantPeers(uint16_t /* service_id */,const RsGxsGroupId& group_id)
|
||||
{
|
||||
RS_STACK_MUTEX(mGxsNetTunnelMtx);
|
||||
|
||||
@ -492,7 +492,7 @@ void RsGxsNetTunnelService::connectToTurtleRouter(p3turtle *tr)
|
||||
mTurtle->registerTunnelService(this) ;
|
||||
}
|
||||
|
||||
bool RsGxsNetTunnelService::handleTunnelRequest(const RsFileHash &hash,const RsPeerId& peer_id)
|
||||
bool RsGxsNetTunnelService::handleTunnelRequest(const RsFileHash &hash,const RsPeerId& /* peer_id */)
|
||||
{
|
||||
RS_STACK_MUTEX(mGxsNetTunnelMtx);
|
||||
// We simply check for wether a managed group has a hash that corresponds to the given hash.
|
||||
|
@ -1125,7 +1125,7 @@ void p3turtle::handleSearchResult(RsTurtleSearchResultItem *item)
|
||||
// This is an error: how could we receive a search result corresponding to a search item we
|
||||
// have forwarded but that it not in the list ??
|
||||
|
||||
std::cerr << __PRETTY_FUNCTION__ << ": search result has no peer direction!" << std::endl ;
|
||||
std::cerr << __PRETTY_FUNCTION__ << ": search result for request " << std::hex << item->request_id << std::dec << " has no peer direction!" << std::endl ;
|
||||
return ;
|
||||
}
|
||||
|
||||
|
@ -430,6 +430,23 @@ QTreeWidgetItem *GroupTreeWidget::addSearchItem(const QString& search_string, ui
|
||||
return item;
|
||||
}
|
||||
|
||||
bool GroupTreeWidget::isSearchRequestResult(QPoint &point,QString& group_id,uint32_t& search_req_id)
|
||||
{
|
||||
QTreeWidgetItem *item = ui->treeWidget->itemAt(point);
|
||||
if (item == NULL)
|
||||
return false;
|
||||
|
||||
QTreeWidgetItem *parent = item->parent();
|
||||
|
||||
if(parent == NULL)
|
||||
return false ;
|
||||
|
||||
search_req_id = parent->data(COLUMN_DATA, ROLE_REQUEST_ID).toUInt();
|
||||
group_id = itemId(item) ;
|
||||
|
||||
return search_req_id > 0;
|
||||
}
|
||||
|
||||
bool GroupTreeWidget::isSearchRequestItem(QPoint &point,uint32_t& search_req_id)
|
||||
{
|
||||
QTreeWidgetItem *item = ui->treeWidget->itemAt(point);
|
||||
|
@ -95,6 +95,7 @@ public:
|
||||
void setUnreadCount(QTreeWidgetItem *item, int unreadCount);
|
||||
|
||||
bool isSearchRequestItem(QPoint &point,uint32_t& search_req_id);
|
||||
bool isSearchRequestResult(QPoint &point, QString &group_id, uint32_t& search_req_id);
|
||||
|
||||
QTreeWidgetItem *getItemFromId(const QString &id);
|
||||
QTreeWidgetItem *activateId(const QString &id, bool focus);
|
||||
|
@ -47,6 +47,7 @@
|
||||
#define IMAGE_SHARE ":/images/share-icon-16.png"
|
||||
#define IMAGE_TABNEW ":/images/tab-new.png"
|
||||
#define IMAGE_DELETE ":/images/delete.png"
|
||||
#define IMAGE_RETRIEVE ":/images/edit_add24.png"
|
||||
#define IMAGE_COMMENT ""
|
||||
|
||||
#define TOKEN_TYPE_GROUP_SUMMARY 1
|
||||
@ -345,6 +346,19 @@ void GxsGroupFrameDialog::groupTreeCustomPopupMenu(QPoint point)
|
||||
return ;
|
||||
}
|
||||
|
||||
// Then check whether we have a searched item, or a normal group
|
||||
|
||||
QString group_id_s ;
|
||||
|
||||
if(ui->groupTreeWidget->isSearchRequestResult(point,group_id_s,search_request_id))
|
||||
{
|
||||
QMenu contextMnu(this);
|
||||
|
||||
contextMnu.addAction(QIcon(IMAGE_RETRIEVE), tr("Request data"), this, SLOT(distantRequestGroupData()))->setData(group_id_s);
|
||||
contextMnu.exec(QCursor::pos());
|
||||
return ;
|
||||
}
|
||||
|
||||
QString id = ui->groupTreeWidget->itemIdAt(point);
|
||||
if (id.isEmpty()) return;
|
||||
|
||||
@ -763,11 +777,6 @@ void GxsGroupFrameDialog::changedCurrentGroup(const QString &groupId)
|
||||
return;
|
||||
}
|
||||
|
||||
// send a request for the group, if it has been distant-searched.
|
||||
|
||||
if(mCachedGroupMetas.find(mGroupId) == mCachedGroupMetas.end())
|
||||
checkRequestGroup(mGroupId) ;
|
||||
|
||||
/* search exisiting tab */
|
||||
GxsMessageFrameWidget *msgWidget = messageWidget(mGroupId, true);
|
||||
|
||||
@ -1198,3 +1207,21 @@ void GxsGroupFrameDialog::searchNetwork(const QString& search_string)
|
||||
mSearchGroupsItems[request_id] = ui->groupTreeWidget->addSearchItem(tr("Search for")+ " \"" + search_string + "\"",(uint32_t)request_id,QIcon(icon(ICON_SEARCH)));
|
||||
}
|
||||
|
||||
void GxsGroupFrameDialog::distantRequestGroupData()
|
||||
{
|
||||
QAction *action = dynamic_cast<QAction*>(sender()) ;
|
||||
|
||||
if(!action)
|
||||
return ;
|
||||
|
||||
RsGxsGroupId group_id(action->data().toString().toStdString());
|
||||
|
||||
if(group_id.isNull())
|
||||
{
|
||||
std::cerr << "Cannot retrieve group! Group id is null!" << std::endl;
|
||||
}
|
||||
|
||||
std::cerr << "Explicit request for group " << group_id << std::endl;
|
||||
checkRequestGroup(group_id) ;
|
||||
}
|
||||
|
||||
|
@ -108,6 +108,7 @@ private slots:
|
||||
|
||||
void restoreGroupKeys();
|
||||
void newGroup();
|
||||
void distantRequestGroupData();
|
||||
|
||||
void changedCurrentGroup(const QString &groupId);
|
||||
void groupTreeMiddleButtonClicked(QTreeWidgetItem *item);
|
||||
|
Loading…
Reference in New Issue
Block a user