mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-02-03 02:50:07 -05:00
removed TokenQueue from IdEditDialog PGP Signed identities still not working
This commit is contained in:
parent
d9b74beb44
commit
0cc871da60
@ -45,13 +45,14 @@
|
|||||||
enum class TokenRequestType: uint8_t
|
enum class TokenRequestType: uint8_t
|
||||||
{
|
{
|
||||||
UNDEFINED = 0x00,
|
UNDEFINED = 0x00,
|
||||||
GROUP_INFO = 0x01,
|
GROUP_DATA = 0x01,
|
||||||
POSTS = 0x02,
|
GROUP_META = 0x02,
|
||||||
ALL_POSTS = 0x03,
|
POSTS = 0x03,
|
||||||
MSG_RELATED_INFO = 0x04,
|
ALL_POSTS = 0x04,
|
||||||
GROUP_STATISTICS = 0x05,
|
MSG_RELATED_INFO = 0x05,
|
||||||
SERVICE_STATISTICS = 0x06,
|
GROUP_STATISTICS = 0x06,
|
||||||
NO_KILL_TYPE = 0x07,
|
SERVICE_STATISTICS = 0x07,
|
||||||
|
NO_KILL_TYPE = 0x08,
|
||||||
};
|
};
|
||||||
|
|
||||||
class RsGxsIfaceHelper
|
class RsGxsIfaceHelper
|
||||||
@ -252,12 +253,23 @@ public:
|
|||||||
/// @see RsTokenService::requestGroupInfo
|
/// @see RsTokenService::requestGroupInfo
|
||||||
bool requestGroupInfo( uint32_t& token, const RsTokReqOptions& opts, const std::list<RsGxsGroupId> &groupIds, bool high_priority_request = false )
|
bool requestGroupInfo( uint32_t& token, const RsTokReqOptions& opts, const std::list<RsGxsGroupId> &groupIds, bool high_priority_request = false )
|
||||||
{
|
{
|
||||||
cancelActiveRequestTokens(TokenRequestType::GROUP_INFO);
|
TokenRequestType token_request_type;
|
||||||
|
|
||||||
|
switch(opts.mReqType)
|
||||||
|
{
|
||||||
|
case GXS_REQUEST_TYPE_GROUP_DATA: token_request_type = TokenRequestType::GROUP_DATA; break;
|
||||||
|
case GXS_REQUEST_TYPE_GROUP_META: token_request_type = TokenRequestType::GROUP_META; break;
|
||||||
|
default:
|
||||||
|
RsErr() << __PRETTY_FUNCTION__ << "(EE) Unexpected request type " << opts.mReqType << "!!" << std::endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
cancelActiveRequestTokens(token_request_type);
|
||||||
|
|
||||||
if( mTokenService.requestGroupInfo(token, 0, opts, groupIds))
|
if( mTokenService.requestGroupInfo(token, 0, opts, groupIds))
|
||||||
{
|
{
|
||||||
RS_STACK_MUTEX(mMtx);
|
RS_STACK_MUTEX(mMtx);
|
||||||
mActiveTokens[token]=high_priority_request? (TokenRequestType::NO_KILL_TYPE) : (TokenRequestType::GROUP_INFO);
|
mActiveTokens[token]=high_priority_request? (TokenRequestType::NO_KILL_TYPE) : token_request_type;
|
||||||
locked_dumpTokens();
|
locked_dumpTokens();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -268,12 +280,24 @@ public:
|
|||||||
/// @see RsTokenService::requestGroupInfo
|
/// @see RsTokenService::requestGroupInfo
|
||||||
bool requestGroupInfo(uint32_t& token, const RsTokReqOptions& opts, bool high_priority_request = false)
|
bool requestGroupInfo(uint32_t& token, const RsTokReqOptions& opts, bool high_priority_request = false)
|
||||||
{
|
{
|
||||||
cancelActiveRequestTokens(TokenRequestType::GROUP_INFO);
|
TokenRequestType token_request_type;
|
||||||
|
|
||||||
|
switch(opts.mReqType)
|
||||||
|
{
|
||||||
|
case GXS_REQUEST_TYPE_GROUP_DATA: token_request_type = TokenRequestType::GROUP_DATA; break;
|
||||||
|
case GXS_REQUEST_TYPE_GROUP_META: token_request_type = TokenRequestType::GROUP_META; break;
|
||||||
|
default:
|
||||||
|
RsErr() << __PRETTY_FUNCTION__ << "(EE) Unexpected request type " << opts.mReqType << "!!" << std::endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
cancelActiveRequestTokens(token_request_type);
|
||||||
|
|
||||||
|
|
||||||
if( mTokenService.requestGroupInfo(token, 0, opts))
|
if( mTokenService.requestGroupInfo(token, 0, opts))
|
||||||
{
|
{
|
||||||
RS_STACK_MUTEX(mMtx);
|
RS_STACK_MUTEX(mMtx);
|
||||||
mActiveTokens[token]=high_priority_request? (TokenRequestType::NO_KILL_TYPE) : (TokenRequestType::GROUP_INFO);
|
mActiveTokens[token]=high_priority_request? (TokenRequestType::NO_KILL_TYPE) : token_request_type;
|
||||||
locked_dumpTokens();
|
locked_dumpTokens();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1301,8 +1301,7 @@ bool IdDialog::fillIdListItem(const RsGxsIdGroup& data, QTreeWidgetItem *&item,
|
|||||||
RsIdentityDetails idd ;
|
RsIdentityDetails idd ;
|
||||||
rsIdentity->getIdDetails(RsGxsId(data.mMeta.mGroupId),idd) ;
|
rsIdentity->getIdDetails(RsGxsId(data.mMeta.mGroupId),idd) ;
|
||||||
|
|
||||||
bool isBanned = idd.mReputation.mOverallReputationLevel ==
|
bool isBanned = idd.mReputation.mOverallReputationLevel == RsReputationLevel::LOCALLY_NEGATIVE;
|
||||||
RsReputationLevel::LOCALLY_NEGATIVE;
|
|
||||||
uint32_t item_flags = 0;
|
uint32_t item_flags = 0;
|
||||||
|
|
||||||
/* do filtering */
|
/* do filtering */
|
||||||
@ -1494,6 +1493,9 @@ void IdDialog::loadIdentities(const std::map<RsGxsGroupId,RsGxsIdGroup>& ids_set
|
|||||||
|
|
||||||
QTreeWidgetItem *parent_item = item->parent() ;
|
QTreeWidgetItem *parent_item = item->parent() ;
|
||||||
|
|
||||||
|
// if(it->second.mMeta.mPublishTs > time(NULL) - 20 || it->second.mMeta.mGroupId == RsGxsGroupId("3de2172503675206b3a23c997e5ee688"))
|
||||||
|
// std::cerr << "Captured ID " <<it->second.mMeta.mGroupId << std::endl;
|
||||||
|
|
||||||
if( (parent_item == allItem && it->second.mIsAContact) || (parent_item == contactsItem && !it->second.mIsAContact))
|
if( (parent_item == allItem && it->second.mIsAContact) || (parent_item == contactsItem && !it->second.mIsAContact))
|
||||||
{
|
{
|
||||||
delete item ; // do not remove from the list, so that it is added again in the correct place.
|
delete item ; // do not remove from the list, so that it is added again in the correct place.
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
#include "gui/common/UIStateHelper.h"
|
#include "gui/common/UIStateHelper.h"
|
||||||
#include "gui/common/AvatarDialog.h"
|
#include "gui/common/AvatarDialog.h"
|
||||||
#include "gui/gxs/GxsIdDetails.h"
|
#include "gui/gxs/GxsIdDetails.h"
|
||||||
#include "util/TokenQueue.h"
|
#include "util/qtthreadsutils.h"
|
||||||
#include "util/misc.h"
|
#include "util/misc.h"
|
||||||
|
|
||||||
#include <retroshare/rsidentity.h>
|
#include <retroshare/rsidentity.h>
|
||||||
@ -88,17 +88,13 @@ IdEditDialog::IdEditDialog(QWidget *parent) :
|
|||||||
/* Initialize ui */
|
/* Initialize ui */
|
||||||
ui->lineEdit_Nickname->setMaxLength(RSID_MAXIMUM_NICKNAME_SIZE);
|
ui->lineEdit_Nickname->setMaxLength(RSID_MAXIMUM_NICKNAME_SIZE);
|
||||||
|
|
||||||
mIdQueue = new TokenQueue(rsIdentity->getTokenService(), this);
|
|
||||||
ui->pushButton_Tag->setEnabled(false);
|
ui->pushButton_Tag->setEnabled(false);
|
||||||
ui->pushButton_Tag->hide(); // unfinished
|
ui->pushButton_Tag->hide(); // unfinished
|
||||||
ui->plainTextEdit_Tag->hide();
|
ui->plainTextEdit_Tag->hide();
|
||||||
ui->label_TagCheck->hide();
|
ui->label_TagCheck->hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
IdEditDialog::~IdEditDialog()
|
IdEditDialog::~IdEditDialog() {}
|
||||||
{
|
|
||||||
delete(mIdQueue);
|
|
||||||
}
|
|
||||||
|
|
||||||
void IdEditDialog::changeAvatar()
|
void IdEditDialog::changeAvatar()
|
||||||
{
|
{
|
||||||
@ -205,44 +201,32 @@ void IdEditDialog::setupExistingId(const RsGxsGroupId &keyId)
|
|||||||
ui->headerFrame->setHeaderImage(QPixmap(":/icons/png/person.png"));
|
ui->headerFrame->setHeaderImage(QPixmap(":/icons/png/person.png"));
|
||||||
ui->headerFrame->setHeaderText(tr("Edit identity"));
|
ui->headerFrame->setHeaderText(tr("Edit identity"));
|
||||||
|
|
||||||
|
mStateHelper->setLoading(IDEDITDIALOG_LOADID, true);
|
||||||
|
|
||||||
mIsNew = false;
|
mIsNew = false;
|
||||||
mGroupId.clear();
|
mGroupId.clear();
|
||||||
|
|
||||||
mStateHelper->setLoading(IDEDITDIALOG_LOADID, true);
|
RsThread::async([this,keyId]()
|
||||||
|
|
||||||
RsTokReqOptions opts;
|
|
||||||
opts.mReqType = GXS_REQUEST_TYPE_GROUP_DATA;
|
|
||||||
|
|
||||||
std::list<RsGxsGroupId> groupIds;
|
|
||||||
groupIds.push_back(keyId);
|
|
||||||
|
|
||||||
uint32_t token;
|
|
||||||
mIdQueue->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, groupIds, IDEDITDIALOG_LOADID);
|
|
||||||
}
|
|
||||||
|
|
||||||
void IdEditDialog::enforceNoAnonIds()
|
|
||||||
{
|
{
|
||||||
ui->radioButton_GpgId->setChecked(true);
|
std::vector<RsGxsIdGroup> datavector;
|
||||||
ui->radioButton_GpgId->setEnabled(false);
|
|
||||||
ui->radioButton_Pseudo->setEnabled(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
void IdEditDialog::loadExistingId(uint32_t token)
|
bool res = rsIdentity->getIdentitiesInfo(std::set<RsGxsId>({(RsGxsId)keyId}),datavector);
|
||||||
|
|
||||||
|
RsQThreadUtils::postToObject( [this,keyId,res,datavector]()
|
||||||
{
|
{
|
||||||
|
/* Here it goes any code you want to be executed on the Qt Gui
|
||||||
|
* thread, for example to update the data model with new information
|
||||||
|
* after a blocking call to RetroShare API complete, note that
|
||||||
|
* Qt::QueuedConnection is important!
|
||||||
|
*/
|
||||||
|
|
||||||
mStateHelper->setLoading(IDEDITDIALOG_LOADID, false);
|
mStateHelper->setLoading(IDEDITDIALOG_LOADID, false);
|
||||||
|
|
||||||
/* get details from libretroshare */
|
/* get details from libretroshare */
|
||||||
std::vector<RsGxsIdGroup> datavector;
|
|
||||||
if (!rsIdentity->getGroupData(token, datavector))
|
|
||||||
{
|
|
||||||
ui->lineEdit_KeyId->setText(tr("Error getting key!"));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (datavector.size() != 1)
|
if (!res || datavector.size() != 1)
|
||||||
{
|
{
|
||||||
std::cerr << "IdDialog::insertIdDetails() Invalid datavector size";
|
std::cerr << __PRETTY_FUNCTION__ << " failed to collect group info for identity " << keyId << std::endl;
|
||||||
std::cerr << std::endl;
|
|
||||||
|
|
||||||
ui->lineEdit_KeyId->setText(tr("Error KeyID invalid"));
|
ui->lineEdit_KeyId->setText(tr("Error KeyID invalid"));
|
||||||
ui->lineEdit_Nickname->setText("");
|
ui->lineEdit_Nickname->setText("");
|
||||||
@ -253,7 +237,22 @@ void IdEditDialog::loadExistingId(uint32_t token)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
mEditGroup = datavector[0];
|
loadExistingId(datavector[0]);
|
||||||
|
|
||||||
|
}, this );
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
void IdEditDialog::enforceNoAnonIds()
|
||||||
|
{
|
||||||
|
ui->radioButton_GpgId->setChecked(true);
|
||||||
|
ui->radioButton_GpgId->setEnabled(false);
|
||||||
|
ui->radioButton_Pseudo->setEnabled(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
void IdEditDialog::loadExistingId(const RsGxsIdGroup& id_group)
|
||||||
|
{
|
||||||
|
mEditGroup = id_group;
|
||||||
mGroupId = mEditGroup.mMeta.mGroupId;
|
mGroupId = mEditGroup.mMeta.mGroupId;
|
||||||
|
|
||||||
QPixmap avatar;
|
QPixmap avatar;
|
||||||
@ -539,14 +538,22 @@ void IdEditDialog::createId()
|
|||||||
else
|
else
|
||||||
params.mImage.clear();
|
params.mImage.clear();
|
||||||
|
|
||||||
uint32_t token = 0;
|
RsGxsId keyId;
|
||||||
rsIdentity->createIdentity(token, params);
|
|
||||||
|
|
||||||
|
if(rsIdentity->createIdentity(keyId,params.nickname,params.mImage,!params.isPgpLinked))
|
||||||
|
{
|
||||||
ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
|
ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
|
||||||
|
|
||||||
mIdQueue->queueRequest(token, 0, 0, IDEDITDIALOG_CREATEID);
|
RsIdentityDetails det;
|
||||||
|
rsIdentity->getIdDetails(keyId,det);
|
||||||
|
|
||||||
|
setupExistingId((RsGxsGroupId)keyId);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
QMessageBox::critical(NULL,tr("Identity creation failed"),tr("Cannot create identity. Something went wrong."));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef TO_REMOVE
|
||||||
void IdEditDialog::idCreated(uint32_t token)
|
void IdEditDialog::idCreated(uint32_t token)
|
||||||
{
|
{
|
||||||
if (!rsIdentity->acknowledgeGrp(token, mGroupId)) {
|
if (!rsIdentity->acknowledgeGrp(token, mGroupId)) {
|
||||||
@ -559,6 +566,7 @@ void IdEditDialog::idCreated(uint32_t token)
|
|||||||
|
|
||||||
accept();
|
accept();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void IdEditDialog::updateId()
|
void IdEditDialog::updateId()
|
||||||
{
|
{
|
||||||
@ -594,11 +602,12 @@ void IdEditDialog::updateId()
|
|||||||
mEditGroup.mImage.clear();
|
mEditGroup.mImage.clear();
|
||||||
|
|
||||||
uint32_t dummyToken = 0;
|
uint32_t dummyToken = 0;
|
||||||
rsIdentity->updateIdentity(dummyToken, mEditGroup);
|
rsIdentity->updateIdentity(mEditGroup);
|
||||||
|
|
||||||
accept();
|
accept();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef TO_REMOVE
|
||||||
void IdEditDialog::loadRequest(const TokenQueue */*queue*/, const TokenRequest &req)
|
void IdEditDialog::loadRequest(const TokenQueue */*queue*/, const TokenRequest &req)
|
||||||
{
|
{
|
||||||
std::cerr << "IdDialog::loadRequest() UserType: " << req.mUserType;
|
std::cerr << "IdDialog::loadRequest() UserType: " << req.mUserType;
|
||||||
@ -615,3 +624,4 @@ void IdEditDialog::loadRequest(const TokenQueue */*queue*/, const TokenRequest &
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
@ -34,7 +34,7 @@ namespace Ui {
|
|||||||
class IdEditDialog;
|
class IdEditDialog;
|
||||||
}
|
}
|
||||||
|
|
||||||
class IdEditDialog : public QDialog, public TokenResponse
|
class IdEditDialog : public QDialog
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
@ -48,8 +48,6 @@ public:
|
|||||||
|
|
||||||
RsGxsGroupId groupId() { return mGroupId; }
|
RsGxsGroupId groupId() { return mGroupId; }
|
||||||
|
|
||||||
void loadRequest(const TokenQueue *queue, const TokenRequest &req);
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void idTypeToggled(bool checked);
|
void idTypeToggled(bool checked);
|
||||||
void submit();
|
void submit();
|
||||||
@ -68,7 +66,7 @@ private:
|
|||||||
void createId();
|
void createId();
|
||||||
void updateId();
|
void updateId();
|
||||||
void updateIdType(bool pseudo);
|
void updateIdType(bool pseudo);
|
||||||
void loadExistingId(uint32_t token);
|
void loadExistingId(const RsGxsIdGroup& id_group);
|
||||||
void setAvatar(const QPixmap &avatar);
|
void setAvatar(const QPixmap &avatar);
|
||||||
void idCreated(uint32_t token);
|
void idCreated(uint32_t token);
|
||||||
|
|
||||||
@ -83,8 +81,6 @@ protected:
|
|||||||
UIStateHelper *mStateHelper;
|
UIStateHelper *mStateHelper;
|
||||||
|
|
||||||
RsGxsIdGroup mEditGroup;
|
RsGxsIdGroup mEditGroup;
|
||||||
|
|
||||||
TokenQueue *mIdQueue;
|
|
||||||
RsGxsGroupId mGroupId;
|
RsGxsGroupId mGroupId;
|
||||||
|
|
||||||
QPixmap mAvatar; // Avatar from identity (not calculated)
|
QPixmap mAvatar; // Avatar from identity (not calculated)
|
||||||
|
@ -207,28 +207,6 @@ GxsMessageFrameWidget *GxsForumsDialog::createMessageFrameWidget(const RsGxsGrou
|
|||||||
return new GxsForumThreadWidget(groupId);
|
return new GxsForumThreadWidget(groupId);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef TO_REMOVE
|
|
||||||
void GxsForumsDialog::loadGroupSummaryToken(const uint32_t &token, std::list<RsGroupMetaData> &groupInfo, RsUserdata *&userdata)
|
|
||||||
{
|
|
||||||
std::vector<RsGxsForumGroup> groups;
|
|
||||||
rsGxsForums->getGroupData(token, groups);
|
|
||||||
|
|
||||||
/* Save groups to fill description */
|
|
||||||
GxsForumGroupInfoData *forumData = new GxsForumGroupInfoData;
|
|
||||||
userdata = forumData;
|
|
||||||
|
|
||||||
std::vector<RsGxsForumGroup>::iterator groupIt;
|
|
||||||
for (groupIt = groups.begin(); groupIt != groups.end(); ++groupIt) {
|
|
||||||
RsGxsForumGroup &group = *groupIt;
|
|
||||||
groupInfo.push_back(group.mMeta);
|
|
||||||
|
|
||||||
if (!group.mDescription.empty()) {
|
|
||||||
forumData->mDescription[group.mMeta.mGroupId] = QString::fromUtf8(group.mDescription.c_str());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void GxsForumsDialog::groupInfoToGroupItemInfo(const RsGxsGenericGroupData *groupData, GroupItemInfo &groupItemInfo)
|
void GxsForumsDialog::groupInfoToGroupItemInfo(const RsGxsGenericGroupData *groupData, GroupItemInfo &groupItemInfo)
|
||||||
{
|
{
|
||||||
GxsGroupFrameDialog::groupInfoToGroupItemInfo(groupData, groupItemInfo);
|
GxsGroupFrameDialog::groupInfoToGroupItemInfo(groupData, groupItemInfo);
|
||||||
@ -249,27 +227,3 @@ void GxsForumsDialog::groupInfoToGroupItemInfo(const RsGxsGenericGroupData *grou
|
|||||||
groupItemInfo.icon = QIcon(":icons/png/forums-signed.png");
|
groupItemInfo.icon = QIcon(":icons/png/forums-signed.png");
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef TO_REMOVE
|
|
||||||
void ::groupInfoToGroupItemInfo(const RsGroupMetaData &groupInfo, GroupItemInfo &groupItemInfo, const RsUserdata *userdata)
|
|
||||||
{
|
|
||||||
GxsGroupFrameDialog::groupInfoToGroupItemInfo(groupInfo, groupItemInfo, userdata);
|
|
||||||
|
|
||||||
const GxsForumGroupInfoData *forumData = dynamic_cast<const GxsForumGroupInfoData*>(userdata);
|
|
||||||
if (!forumData) {
|
|
||||||
std::cerr << "GxsForumsDialog::groupInfoToGroupItemInfo() Failed to cast data to GxsForumGroupInfoData";
|
|
||||||
std::cerr << std::endl;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
QMap<RsGxsGroupId, QString>::const_iterator descriptionIt = forumData->mDescription.find(groupInfo.mGroupId);
|
|
||||||
if (descriptionIt != forumData->mDescription.end()) {
|
|
||||||
groupItemInfo.description = descriptionIt.value();
|
|
||||||
}
|
|
||||||
|
|
||||||
//if (IS_GROUP_ADMIN(groupInfo.mSubscribeFlags))
|
|
||||||
// groupItemInfo.icon = QIcon(":images/konv_message2.png");
|
|
||||||
if ((IS_GROUP_PGP_AUTHED(groupInfo.mSignFlags)) || (IS_GROUP_MESSAGE_TRACKING(groupInfo.mSignFlags)) )
|
|
||||||
groupItemInfo.icon = QIcon(":icons/png/forums-signed.png");
|
|
||||||
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user