Merge pull request #2629 from csoler/v0.6-TokenSystem

continue cleaning the old token system
This commit is contained in:
csoler 2022-08-16 22:32:13 +02:00 committed by GitHub
commit 8595425e0b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 14 additions and 76 deletions

View File

@ -584,12 +584,13 @@ void CreateCircleDialog::createCircle()
circle.mMeta.mCircleType = GXS_CIRCLE_TYPE_LOCAL; circle.mMeta.mCircleType = GXS_CIRCLE_TYPE_LOCAL;
} }
bool is_existing_circle(mIsExistingCircle);
RsThread::async([&circle,this]() RsThread::async([circle,is_existing_circle]()
{ {
RsGxsCircleId circleId; RsGxsCircleId circleId;
if(mIsExistingCircle) if(is_existing_circle)
{ {
#ifdef DEBUG_CREATE_CIRCLE_DIALOG #ifdef DEBUG_CREATE_CIRCLE_DIALOG
std::cerr << "CreateCircleDialog::updateCircle() : mCircleType: " << circle.mMeta.mCircleType << std::endl; std::cerr << "CreateCircleDialog::updateCircle() : mCircleType: " << circle.mMeta.mCircleType << std::endl;
@ -598,7 +599,7 @@ void CreateCircleDialog::createCircle()
std::cerr << "CreateCircleDialog::updateCircle() Checks and Balances Okay - calling service proper.."<< std::endl; std::cerr << "CreateCircleDialog::updateCircle() Checks and Balances Okay - calling service proper.."<< std::endl;
#endif #endif
rsGxsCircles->editCircle(circle); rsGxsCircles->editCircle(*const_cast<RsGxsCircleGroup*>(&circle)); // const_cast: Not nice, but simpler.
circleId = RsGxsCircleId(circle.mMeta.mGroupId); circleId = RsGxsCircleId(circle.mMeta.mGroupId);
} }
@ -619,14 +620,14 @@ void CreateCircleDialog::createCircle()
circle.mLocalFriends); circle.mLocalFriends);
} }
RsQThreadUtils::postToObject( [this,circle,circleId]() if(!is_existing_circle)
{ RsQThreadUtils::postToObject( [circle,circleId]()
if(!mIsExistingCircle) {
QMessageBox::information(nullptr,tr("Circle created"), QMessageBox::information(nullptr,tr("Circle created"),
tr("Your new circle has been created:\n Name: %1\n Id: %2.") tr("Your new circle has been created:\n Name: %1\n Id: %2.")
.arg(QString::fromUtf8(circle.mMeta.mGroupName.c_str())) .arg(QString::fromUtf8(circle.mMeta.mGroupName.c_str()))
.arg(QString::fromStdString(circleId.toStdString()))); .arg(QString::fromStdString(circleId.toStdString())));
}); });
}); });
close(); close();

View File

@ -24,7 +24,6 @@
#include <retroshare-gui/mainpage.h> #include <retroshare-gui/mainpage.h>
#include "gui/feeds/FeedHolder.h" #include "gui/feeds/FeedHolder.h"
#include "util/TokenQueue.h"
#include <retroshare-gui/RsAutoUpdatePage.h> #include <retroshare-gui/RsAutoUpdatePage.h>
#define IMAGE_NEWSFEED ":/icons/png/newsfeed.png" #define IMAGE_NEWSFEED ":/icons/png/newsfeed.png"

View File

@ -1213,48 +1213,3 @@ void PostedListWidgetWithModel::voteMsg(RsGxsGrpMsgIdPair msg,bool up_or_down)
updateDisplay(true); updateDisplay(true);
} }
#ifdef TODO
class PostedPostsReadData
{
public:
PostedPostsReadData(bool read)
{
mRead = read;
mLastToken = 0;
}
public:
bool mRead;
uint32_t mLastToken;
};
static void setAllMessagesReadCallback(FeedItem *feedItem, void *data)
{
GxsChannelPostItem *channelPostItem = dynamic_cast<GxsChannelPostItem*>(feedItem);
if (!channelPostItem) {
return;
}
GxsChannelPostsReadData *readData = (GxsChannelPostsReadData*) data;
bool isRead = !channelPostItem->isUnread() ;
if(channelPostItem->isLoaded() && (isRead == readData->mRead))
return ;
RsGxsGrpMsgIdPair msgPair = std::make_pair(channelPostItem->groupId(), channelPostItem->messageId());
rsGxsChannels->setMessageReadStatus(readData->mLastToken, msgPair, readData->mRead);
}
void PostedListWidgetWithModel::setAllMessagesReadDo(bool read, uint32_t &token)
{
if (groupId().isNull() || !IS_GROUP_SUBSCRIBED(mGroup.mMeta.mSubscribeFlags)) {
return;
}
GxsChannelPostsReadData data(read);
//ui->feedWidget->withAll(setAllMessagesReadCallback, &data);
token = data.mLastToken;
}
#endif

View File

@ -24,8 +24,6 @@
#include <retroshare/rsgxscircles.h> #include <retroshare/rsgxscircles.h>
#include "FeedItem.h" #include "FeedItem.h"
#include "util/TokenQueue.h"
namespace Ui { namespace Ui {
class GxsCircleItem; class GxsCircleItem;
} }

View File

@ -672,15 +672,9 @@ void GxsGroupDialog::createGroup()
if (service_createGroup(meta)) if (service_createGroup(meta))
{ {
// now update the UI
#warning Missing code here! #warning Missing code here!
#ifdef TODO // now update the UI
// }
// get the Queue to handle response. What is this for?
if(mExternalTokenQueue != NULL)
mExternalTokenQueue->queueRequest(token, TOKENREQ_GROUPINFO, RS_TOKREQ_ANSTYPE_ACK, GXSGROUP_NEWGROUPID);
#endif
}
close(); close();
} }

View File

@ -23,8 +23,6 @@
#include "ui_GxsGroupDialog.h" #include "ui_GxsGroupDialog.h"
#include "util/TokenQueue.h"
/******** /********
* Notes: * Notes:
* *
@ -284,9 +282,6 @@ private:
std::list<std::string> mShareList; std::list<std::string> mShareList;
QPixmap mPicture; QPixmap mPicture;
RsTokenService *mTokenService;
TokenQueue *mExternalTokenQueue;
TokenQueue *mInternalTokenQueue;
RsGroupMetaData mGrpMeta; RsGroupMetaData mGrpMeta;
Mode mMode; Mode mMode;

View File

@ -56,8 +56,6 @@
* #define DEBUG_CHANNEL * #define DEBUG_CHANNEL
***/ ***/
//static const int mTokenTypeGroupData = 1;
static const int CHANNEL_TABS_DETAILS= 0; static const int CHANNEL_TABS_DETAILS= 0;
static const int CHANNEL_TABS_POSTS = 1; static const int CHANNEL_TABS_POSTS = 1;
static const int CHANNEL_TABS_FILES = 2; static const int CHANNEL_TABS_FILES = 2;
@ -1430,12 +1428,10 @@ public:
explicit GxsChannelPostsReadData(bool read) explicit GxsChannelPostsReadData(bool read)
{ {
mRead = read; mRead = read;
mLastToken = 0;
} }
public: public:
bool mRead; bool mRead;
uint32_t mLastToken;
}; };
void GxsChannelPostsWidgetWithModel::setAllMessagesReadDo(bool read) void GxsChannelPostsWidgetWithModel::setAllMessagesReadDo(bool read)