mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-29 01:16:20 -05:00
Merge pull request #2135 from csoler/v0.6-BugFixing_2
Still fixing GUI issues for 0.6.6
This commit is contained in:
commit
f6c554807f
@ -129,6 +129,11 @@ void ftExtraList::hashAFile()
|
||||
mHashedList[details.info.path] = details.info.hash;
|
||||
|
||||
IndicateConfigChanged();
|
||||
|
||||
auto ev = std::make_shared<RsSharedDirectoriesEvent>();
|
||||
ev->mEventCode = RsSharedDirectoriesEventCode::EXTRA_LIST_FILE_ADDED;
|
||||
if(rsEvents)
|
||||
rsEvents->postEvent(ev);
|
||||
}
|
||||
}
|
||||
|
||||
@ -195,6 +200,12 @@ bool ftExtraList::removeExtraFile(const RsFileHash& hash)
|
||||
|
||||
IndicateConfigChanged();
|
||||
|
||||
if(rsEvents)
|
||||
{
|
||||
auto ev = std::make_shared<RsSharedDirectoriesEvent>();
|
||||
ev->mEventCode = RsSharedDirectoriesEventCode::EXTRA_LIST_FILE_REMOVED;
|
||||
rsEvents->postEvent(ev);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -301,35 +301,22 @@ void RsGenExchange::tick()
|
||||
{
|
||||
RS_STACK_MUTEX(mGenMtx) ;
|
||||
|
||||
std::list<RsGxsGroupId> grpIds;
|
||||
std::map<RsGxsGroupId, std::set<RsGxsMessageId> > msgIds;
|
||||
std::vector<RsGxsGroupId> grpIds;
|
||||
GxsMsgReq msgIds;
|
||||
|
||||
mIntegrityCheck->getDeletedIds(grpIds, msgIds);
|
||||
|
||||
if (!grpIds.empty())
|
||||
if(!msgIds.empty())
|
||||
{
|
||||
for(auto& groupId:grpIds)
|
||||
{
|
||||
RsGxsGroupChange* gc = new RsGxsGroupChange(RsGxsNotify::TYPE_GROUP_DELETED,groupId, false);
|
||||
|
||||
#ifdef GEN_EXCH_DEBUG
|
||||
std::cerr << " adding the following grp ids to notification: " << std::endl;
|
||||
for(std::list<RsGxsGroupId>::const_iterator it(grpIds.begin());it!=grpIds.end();++it)
|
||||
std::cerr << " " << *it << std::endl;
|
||||
#endif
|
||||
mNotifications.push_back(gc);
|
||||
uint32_t token1=0;
|
||||
deleteMsgs(token1,msgIds);
|
||||
}
|
||||
|
||||
// also notify the network exchange service that these groups no longer exist.
|
||||
|
||||
if(mNetService)
|
||||
mNetService->removeGroups(grpIds) ;
|
||||
}
|
||||
|
||||
for(auto it(msgIds.begin());it!=msgIds.end();++it)
|
||||
for(auto& msgId:it->second)
|
||||
if(!grpIds.empty())
|
||||
for(auto& grpId: grpIds)
|
||||
{
|
||||
RsGxsMsgChange* c = new RsGxsMsgChange(RsGxsNotify::TYPE_MESSAGE_DELETED,it->first, msgId, false);
|
||||
mNotifications.push_back(c);
|
||||
uint32_t token2=0;
|
||||
deleteGroup(token2,grpId);
|
||||
}
|
||||
|
||||
delete mIntegrityCheck;
|
||||
|
@ -207,13 +207,16 @@ RsGxsIntegrityCheck::RsGxsIntegrityCheck(
|
||||
|
||||
void RsGxsIntegrityCheck::run()
|
||||
{
|
||||
check();
|
||||
std::vector<RsGxsGroupId> grps_to_delete;
|
||||
GxsMsgReq msgs_to_delete;
|
||||
|
||||
check(mGenExchangeClient->serviceType(),mGixs,mDs,mDeletedGrps,mDeletedMsgs);
|
||||
|
||||
RS_STACK_MUTEX(mIntegrityMutex);
|
||||
mDone = true;
|
||||
}
|
||||
|
||||
bool RsGxsIntegrityCheck::check()
|
||||
bool RsGxsIntegrityCheck::check(uint16_t service_type, RsGixs *mgixs, RsGeneralDataService *mds, std::vector<RsGxsGroupId>& grpsToDel, GxsMsgReq& msgsToDel)
|
||||
{
|
||||
#ifdef RS_DEEP_CHANNEL_INDEX
|
||||
bool isGxsChannels = mGenExchangeClient->serviceType() == RS_SERVICE_GXS_TYPE_CHANNELS;
|
||||
@ -222,8 +225,7 @@ bool RsGxsIntegrityCheck::check()
|
||||
|
||||
// first take out all the groups
|
||||
std::map<RsGxsGroupId, RsNxsGrp*> grp;
|
||||
mDs->retrieveNxsGrps(grp, true, true);
|
||||
std::vector<RsGxsGroupId> grpsToDel;
|
||||
mds->retrieveNxsGrps(grp, true, true);
|
||||
GxsMsgReq msgIds;
|
||||
GxsMsgReq grps;
|
||||
|
||||
@ -244,7 +246,7 @@ bool RsGxsIntegrityCheck::check()
|
||||
if(currHash == grp->metaData->mHash)
|
||||
{
|
||||
// get all message ids of group
|
||||
if (mDs->retrieveMsgIds(grp->grpId, msgIds[grp->grpId]) == 1)
|
||||
if (mds->retrieveMsgIds(grp->grpId, msgIds[grp->grpId]) == 1)
|
||||
{
|
||||
// store the group for retrieveNxsMsgs
|
||||
grps[grp->grpId];
|
||||
@ -262,8 +264,7 @@ bool RsGxsIntegrityCheck::check()
|
||||
rsReputations->overallReputationLevel(
|
||||
grp->metaData->mAuthorId ) >
|
||||
RsReputationLevel::LOCALLY_NEGATIVE )
|
||||
used_gxs_ids.insert(std::make_pair(grp->metaData->mAuthorId, RsIdentityUsage(RsServiceType(mGenExchangeClient->serviceType()),
|
||||
RsIdentityUsage::GROUP_AUTHOR_KEEP_ALIVE,grp->grpId)));
|
||||
used_gxs_ids.insert(std::make_pair(grp->metaData->mAuthorId, RsIdentityUsage(RsServiceType(service_type), RsIdentityUsage::GROUP_AUTHOR_KEEP_ALIVE,grp->grpId)));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -317,33 +318,15 @@ bool RsGxsIntegrityCheck::check()
|
||||
#endif // def RS_DEEP_CHANNEL_INDEX
|
||||
}
|
||||
|
||||
if( !(grp->metaData->mSubscribeFlags & GXS_SERV::GROUP_SUBSCRIBE_SUBSCRIBED) &&
|
||||
!(grp->metaData->mSubscribeFlags & GXS_SERV::GROUP_SUBSCRIBE_ADMIN) &&
|
||||
!(grp->metaData->mSubscribeFlags & GXS_SERV::GROUP_SUBSCRIBE_PUBLISH) )
|
||||
{
|
||||
RsGroupNetworkStats stats;
|
||||
mGenExchangeClient->getGroupNetworkStats(grp->grpId,stats);
|
||||
|
||||
if( stats.mSuppliers == 0 && stats.mMaxVisibleCount == 0
|
||||
&& stats.mGrpAutoSync )
|
||||
{
|
||||
#ifdef DEBUG_GXSUTIL
|
||||
GXSUTIL_DEBUG() << "Scheduling group \"" << grp->metaData->mGroupName << "\" ID=" << grp->grpId << " in service " << std::hex << mGenExchangeClient->serviceType() << std::dec << " for deletion because it has no suppliers not any visible data at friends." << std::endl;
|
||||
#endif
|
||||
grpsToDel.push_back(grp->grpId);
|
||||
}
|
||||
}
|
||||
|
||||
delete grp;
|
||||
}
|
||||
|
||||
mDs->removeGroups(grpsToDel);
|
||||
mds->removeGroups(grpsToDel);
|
||||
|
||||
// now messages
|
||||
GxsMsgReq msgsToDel;
|
||||
GxsMsgResult msgs;
|
||||
|
||||
mDs->retrieveNxsMsgs(grps, msgs, false, true);
|
||||
mds->retrieveNxsMsgs(grps, msgs, false, true);
|
||||
|
||||
// check msg ids and messages
|
||||
GxsMsgReq::iterator msgIdsIt;
|
||||
@ -455,7 +438,7 @@ bool RsGxsIntegrityCheck::check()
|
||||
rsReputations->overallReputationLevel(
|
||||
msg->metaData->mAuthorId ) >
|
||||
RsReputationLevel::LOCALLY_NEGATIVE )
|
||||
used_gxs_ids.insert(std::make_pair(msg->metaData->mAuthorId,RsIdentityUsage(RsServiceType(mGenExchangeClient->serviceType()),
|
||||
used_gxs_ids.insert(std::make_pair(msg->metaData->mAuthorId,RsIdentityUsage(RsServiceType(service_type),
|
||||
RsIdentityUsage::MESSAGE_AUTHOR_KEEP_ALIVE,
|
||||
msg->metaData->mGroupId,
|
||||
msg->metaData->mMsgId,
|
||||
@ -468,18 +451,9 @@ bool RsGxsIntegrityCheck::check()
|
||||
}
|
||||
}
|
||||
|
||||
mDs->removeMsgs(msgsToDel);
|
||||
mds->removeMsgs(msgsToDel);
|
||||
|
||||
{
|
||||
RS_STACK_MUTEX(mIntegrityMutex);
|
||||
|
||||
std::vector<RsGxsGroupId>::iterator grpIt;
|
||||
for(grpIt = grpsToDel.begin(); grpIt != grpsToDel.end(); ++grpIt)
|
||||
{
|
||||
mDeletedGrps.push_back(*grpIt);
|
||||
}
|
||||
mDeletedMsgs = msgsToDel;
|
||||
|
||||
#ifdef DEBUG_GXSUTIL
|
||||
GXSUTIL_DEBUG() << "At end of pass, this is the list used GXS ids: " << std::endl;
|
||||
GXSUTIL_DEBUG() << " requesting them to GXS identity service to enforce loading." << std::endl;
|
||||
@ -512,9 +486,9 @@ bool RsGxsIntegrityCheck::check()
|
||||
GXSUTIL_DEBUG() << " requesting ID " << gxs_ids[n].first ;
|
||||
#endif
|
||||
|
||||
if(!mGixs->haveKey(gxs_ids[n].first)) // checks if we have it already in the cache (conservative way to ensure that we atually have it)
|
||||
if(!mgixs->haveKey(gxs_ids[n].first)) // checks if we have it already in the cache (conservative way to ensure that we atually have it)
|
||||
{
|
||||
mGixs->requestKey(gxs_ids[n].first,connected_friends,gxs_ids[n].second);
|
||||
mgixs->requestKey(gxs_ids[n].first,connected_friends,gxs_ids[n].second);
|
||||
|
||||
++nb_requested_not_in_cache ;
|
||||
#ifdef DEBUG_GXSUTIL
|
||||
@ -527,7 +501,7 @@ bool RsGxsIntegrityCheck::check()
|
||||
GXSUTIL_DEBUG() << " ... already in cache" << std::endl;
|
||||
#endif
|
||||
}
|
||||
mGixs->timeStampKey(gxs_ids[n].first,gxs_ids[n].second);
|
||||
mgixs->timeStampKey(gxs_ids[n].first,gxs_ids[n].second);
|
||||
|
||||
gxs_ids[n] = gxs_ids[gxs_ids.size()-1] ;
|
||||
gxs_ids.pop_back() ;
|
||||
@ -546,7 +520,7 @@ bool RsGxsIntegrityCheck::isDone()
|
||||
return mDone;
|
||||
}
|
||||
|
||||
void RsGxsIntegrityCheck::getDeletedIds(std::list<RsGxsGroupId>& grpIds, std::map<RsGxsGroupId, std::set<RsGxsMessageId> >& msgIds)
|
||||
void RsGxsIntegrityCheck::getDeletedIds(std::vector<RsGxsGroupId>& grpIds, GxsMsgReq& msgIds)
|
||||
{
|
||||
RS_STACK_MUTEX(mIntegrityMutex);
|
||||
grpIds = mDeletedGrps;
|
||||
|
@ -175,12 +175,12 @@ public:
|
||||
RsGenExchange *genex, RsSerialType& gxsSerialiser,
|
||||
RsGixs *gixs);
|
||||
|
||||
bool check();
|
||||
static bool check(uint16_t service_type, RsGixs *mgixs, RsGeneralDataService *mds, std::vector<RsGxsGroupId>& grpsToDel, GxsMsgReq& msgsToDel);
|
||||
bool isDone();
|
||||
|
||||
void run();
|
||||
|
||||
void getDeletedIds(std::list<RsGxsGroupId>& grpIds, std::map<RsGxsGroupId, std::set<RsGxsMessageId> > &msgIds);
|
||||
void getDeletedIds(std::vector<RsGxsGroupId> &grpIds, GxsMsgReq &msgIds);
|
||||
|
||||
private:
|
||||
|
||||
@ -191,8 +191,8 @@ private:
|
||||
#endif
|
||||
bool mDone;
|
||||
RsMutex mIntegrityMutex;
|
||||
std::list<RsGxsGroupId> mDeletedGrps;
|
||||
std::map<RsGxsGroupId, std::set<RsGxsMessageId> > mDeletedMsgs;
|
||||
std::vector<RsGxsGroupId> mDeletedGrps;
|
||||
GxsMsgReq mDeletedMsgs;
|
||||
|
||||
RsGixs* mGixs;
|
||||
};
|
||||
|
@ -184,6 +184,8 @@ enum class RsSharedDirectoriesEventCode: uint8_t {
|
||||
HASHING_FILE = 0x02, // mMessage: full path and hashing speed of the file being hashed
|
||||
DIRECTORY_SWEEP_ENDED = 0x03, // (void)
|
||||
SAVING_FILE_INDEX = 0x04, // (void)
|
||||
EXTRA_LIST_FILE_ADDED = 0x05, // (void)
|
||||
EXTRA_LIST_FILE_REMOVED = 0x06, // (void)
|
||||
};
|
||||
|
||||
enum class RsFileTransferEventCode: uint8_t {
|
||||
|
@ -342,6 +342,15 @@ void p3GxsChannels::notifyChanges(std::vector<RsGxsNotify *> &changes)
|
||||
}
|
||||
break;
|
||||
|
||||
case RsGxsNotify::TYPE_UPDATED:
|
||||
{
|
||||
auto ev = std::make_shared<RsGxsChannelEvent>();
|
||||
ev->mChannelGroupId = grpChange->mGroupId;
|
||||
ev->mChannelEventCode = RsChannelEventCode::UPDATED_CHANNEL;
|
||||
rsEvents->postEvent(ev);
|
||||
}
|
||||
break;
|
||||
|
||||
case RsGxsNotify::TYPE_PUBLISHED:
|
||||
case RsGxsNotify::TYPE_RECEIVED_NEW:
|
||||
{
|
||||
|
@ -197,7 +197,9 @@ void p3MsgService::processIncomingMsg(RsMsgItem *mi)
|
||||
}
|
||||
|
||||
// If the peer is allowed to push files, then auto-download the recommended files.
|
||||
if(rsPeers->servicePermissionFlags(mi->PeerId()) & RS_NODE_PERM_ALLOW_PUSH)
|
||||
|
||||
RsIdentityDetails id_details;
|
||||
if(rsIdentity->getIdDetails(RsGxsId(mi->PeerId()),id_details) && !id_details.mPgpId.isNull() && (rsPeers->servicePermissionFlags(id_details.mPgpId) & RS_NODE_PERM_ALLOW_PUSH))
|
||||
{
|
||||
std::list<RsPeerId> srcIds;
|
||||
srcIds.push_back(mi->PeerId());
|
||||
|
@ -208,6 +208,18 @@ void p3PostBase::notifyChanges(std::vector<RsGxsNotify *> &changes)
|
||||
}
|
||||
break;
|
||||
|
||||
case RsGxsNotify::TYPE_UPDATED:
|
||||
{
|
||||
// Happens when the group data has changed. In this case we need to analyse the old and new group in order to detect possible notifications for clients
|
||||
|
||||
auto ev = std::make_shared<RsGxsPostedEvent>();
|
||||
ev->mPostedGroupId = grpChange->mGroupId;
|
||||
ev->mPostedEventCode = RsPostedEventCode::UPDATED_POSTED_GROUP;
|
||||
rsEvents->postEvent(ev);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case RsGxsNotify::TYPE_PUBLISHED:
|
||||
case RsGxsNotify::TYPE_RECEIVED_NEW:
|
||||
{
|
||||
|
@ -564,11 +564,9 @@ void IdEditDialog::createId()
|
||||
{
|
||||
ui->createButton->setEnabled(false);
|
||||
|
||||
RsIdentityDetails det;
|
||||
|
||||
if(rsIdentity->getIdDetails(keyId,det))
|
||||
if(!keyId.isNull())
|
||||
{
|
||||
QMessageBox::information(NULL,tr("Identity creation success"),tr("Your new identity was successfuly created."));
|
||||
QMessageBox::information(NULL,tr("Identity creation success"),tr("Your new identity was successfuly created, its ID is %1.").arg(QString::fromStdString(keyId.toStdString())));
|
||||
close();
|
||||
}
|
||||
else
|
||||
|
@ -30,6 +30,7 @@
|
||||
#include "retroshare/rsfiles.h"
|
||||
#include "retroshare/rspeers.h"
|
||||
#include "util/misc.h"
|
||||
#include "util/qtthreadsutils.h"
|
||||
#include "retroshare/rsexpr.h"
|
||||
|
||||
#include <QDir>
|
||||
@ -63,6 +64,37 @@ RetroshareDirModel::RetroshareDirModel(bool mode, QObject *parent)
|
||||
treeStyle();
|
||||
|
||||
mDirDetails.ref = (void*)intptr_t(0xffffffff) ;
|
||||
|
||||
rsEvents->registerEventsHandler(
|
||||
[this](std::shared_ptr<const RsEvent> event)
|
||||
{
|
||||
RsQThreadUtils::postToObject( [this,event]() { handleEvent_main_thread(event); });
|
||||
},
|
||||
mEventHandlerId,
|
||||
RsEventType::SHARED_DIRECTORIES );
|
||||
}
|
||||
|
||||
RetroshareDirModel::~RetroshareDirModel()
|
||||
{
|
||||
rsEvents->unregisterEventsHandler(mEventHandlerId);
|
||||
}
|
||||
void RetroshareDirModel::handleEvent_main_thread(std::shared_ptr<const RsEvent> event)
|
||||
{
|
||||
if(event->mType != RsEventType::SHARED_DIRECTORIES) return;
|
||||
|
||||
const RsSharedDirectoriesEvent *fe = dynamic_cast<const RsSharedDirectoriesEvent*>(event.get());
|
||||
if(!fe)
|
||||
return;
|
||||
|
||||
switch (fe->mEventCode)
|
||||
{
|
||||
case RsSharedDirectoriesEventCode::EXTRA_LIST_FILE_ADDED:
|
||||
case RsSharedDirectoriesEventCode::EXTRA_LIST_FILE_REMOVED:
|
||||
update();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
TreeStyle_RDM::TreeStyle_RDM(bool mode)
|
||||
|
@ -22,6 +22,7 @@
|
||||
#define REMOTE_DIR_MODEL
|
||||
|
||||
#include <retroshare/rstypes.h>
|
||||
#include <retroshare/rsevents.h>
|
||||
|
||||
#include <QAbstractItemModel>
|
||||
#include <QAction>
|
||||
@ -63,7 +64,7 @@ class RetroshareDirModel : public QAbstractItemModel
|
||||
enum Roles{ FileNameRole = Qt::UserRole+1, SortRole = Qt::UserRole+2, FilterRole = Qt::UserRole+3 };
|
||||
|
||||
RetroshareDirModel(bool mode, QObject *parent = 0);
|
||||
virtual ~RetroshareDirModel() {}
|
||||
virtual ~RetroshareDirModel() ;
|
||||
|
||||
virtual Qt::ItemFlags flags ( const QModelIndex & index ) const;
|
||||
|
||||
@ -107,6 +108,8 @@ class RetroshareDirModel : public QAbstractItemModel
|
||||
protected:
|
||||
bool _visible ;
|
||||
|
||||
void handleEvent_main_thread(std::shared_ptr<const RsEvent> event);
|
||||
|
||||
void treeStyle();
|
||||
void downloadDirectory(const DirDetails & details, int prefixLen);
|
||||
static QString getFlagsString(FileStorageFlags f) ;
|
||||
@ -176,6 +179,8 @@ class RetroshareDirModel : public QAbstractItemModel
|
||||
bool mUpdating ;
|
||||
|
||||
std::set<void*> mFilteredPointers ;
|
||||
|
||||
RsEventsHandlerId_t mEventHandlerId;
|
||||
};
|
||||
|
||||
// This class shows the classical hierarchical directory view of shared files
|
||||
|
@ -27,7 +27,7 @@
|
||||
<item row="1" column="0">
|
||||
<widget class="QTabWidget" name="stabWidget">
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
<number>2</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="tab">
|
||||
<attribute name="title">
|
||||
@ -385,7 +385,7 @@ p, li { white-space: pre-wrap; }
|
||||
<item>
|
||||
<widget class="QCheckBox" name="_allow_push_CB">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>This option allows you to automatically download a file that is recommended in an message coming from this node. This can be used for instance to send files between your own nodes. Applied to all locations of the same node.</p></body></html></string>
|
||||
<string><html><head/><body><p>This option allows you to automatically download a file that is recommended in an message coming from this profile (e.g. when the message author is a signed identity that belongs to this profile). This can be used for instance to send files between your own nodes.</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Auto-download recommended files from this node</string>
|
||||
|
@ -73,6 +73,7 @@ void GxsChannelDialog::handleEvent_main_thread(std::shared_ptr<const RsEvent> ev
|
||||
updateGroupStatisticsReal(e->mChannelGroupId);// update the list immediately
|
||||
break;
|
||||
|
||||
case RsChannelEventCode::UPDATED_CHANNEL: // [[fallthrough]];
|
||||
case RsChannelEventCode::RECEIVED_PUBLISH_KEY: // [[fallthrough]];
|
||||
case RsChannelEventCode::NEW_CHANNEL: // [[fallthrough]];
|
||||
case RsChannelEventCode::DELETED_CHANNEL: // [[fallthrough]];
|
||||
|
@ -938,7 +938,7 @@ void GxsChannelPostsWidgetWithModel::postChannelPostLoad()
|
||||
mChannelFilesModel->setFiles(files);
|
||||
|
||||
ui->channelFiles_TV->setAutoSelect(true);
|
||||
ui->channelFiles_TV->sortByColumn(0, Qt::AscendingOrder);
|
||||
ui->channelFiles_TV->sortByColumn(3, Qt::AscendingOrder);
|
||||
|
||||
ui->infoPosts->setText(QString::number(mChannelPostsModel->getNumberOfPosts()) + " / " + QString::number(mGroup.mMeta.mVisibleMsgCount));
|
||||
|
||||
|
@ -1243,6 +1243,13 @@ void RsGxsForumModel::setMsgReadStatus(const QModelIndex& i,bool read_status,boo
|
||||
recursSetMsgReadStatus(entry,read_status,with_children) ;
|
||||
recursUpdateReadStatusAndTimes(0,has_unread_below,has_read_below);
|
||||
|
||||
// also emit dataChanged() for parents since they need to re-draw
|
||||
|
||||
for(QModelIndex j = i.parent(); j.isValid(); j=j.parent())
|
||||
{
|
||||
emit dataChanged(j,j);
|
||||
j = j.parent();
|
||||
}
|
||||
}
|
||||
|
||||
void RsGxsForumModel::recursSetMsgReadStatus(ForumModelIndex i,bool read_status,bool with_children)
|
||||
|
Loading…
Reference in New Issue
Block a user