mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-08-14 00:55:46 -04:00
ID cleaning in gxschannels
git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.6-IdCleaning@7158 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
cbb2636c90
commit
badb48f20e
4 changed files with 39 additions and 34 deletions
|
@ -40,7 +40,7 @@
|
||||||
#define CREATEMSG_CHANNELINFO 0x002
|
#define CREATEMSG_CHANNELINFO 0x002
|
||||||
|
|
||||||
/** Constructor */
|
/** Constructor */
|
||||||
CreateGxsChannelMsg::CreateGxsChannelMsg(std::string cId)
|
CreateGxsChannelMsg::CreateGxsChannelMsg(const RsGxsGroupId &cId)
|
||||||
: QDialog (NULL, Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint), mChannelId(cId) ,mCheckAttachment(true), mAutoMediaThumbNail(false)
|
: QDialog (NULL, Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint), mChannelId(cId) ,mCheckAttachment(true), mAutoMediaThumbNail(false)
|
||||||
{
|
{
|
||||||
/* Invoke the Qt Designer generated object setup routine */
|
/* Invoke the Qt Designer generated object setup routine */
|
||||||
|
@ -122,9 +122,11 @@ void CreateGxsChannelMsg::pasteLink()
|
||||||
|
|
||||||
std::cerr << "Pasting " << (*it).toString().toStdString() << std::endl;
|
std::cerr << "Pasting " << (*it).toString().toStdString() << std::endl;
|
||||||
|
|
||||||
FileInfo info ;
|
FileInfo info ;
|
||||||
if(rsFiles->alreadyHaveFile( (*it).hash().toStdString(),info ) )
|
RsFileHash hash( (*it).hash().toStdString()) ;
|
||||||
addAttachment((*it).hash().toStdString(), (*it).name().toUtf8().constData(), (*it).size(), true, RsPeerId()) ;
|
|
||||||
|
if(rsFiles->alreadyHaveFile( hash,info ) )
|
||||||
|
addAttachment(hash, (*it).name().toUtf8().constData(), (*it).size(), true, RsPeerId()) ;
|
||||||
else
|
else
|
||||||
not_have.push_back( *it ) ;
|
not_have.push_back( *it ) ;
|
||||||
}
|
}
|
||||||
|
@ -283,7 +285,7 @@ void CreateGxsChannelMsg::parseRsFileListAttachments(const std::string &attachLi
|
||||||
quint64 qsize = 0;
|
quint64 qsize = 0;
|
||||||
|
|
||||||
std::string fname;
|
std::string fname;
|
||||||
std::string hash;
|
RsFileHash hash;
|
||||||
uint64_t size = 0;
|
uint64_t size = 0;
|
||||||
RsPeerId source;
|
RsPeerId source;
|
||||||
|
|
||||||
|
@ -297,7 +299,7 @@ void CreateGxsChannelMsg::parseRsFileListAttachments(const std::string &attachLi
|
||||||
fname = it2->toStdString();
|
fname = it2->toStdString();
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
hash = it2->toStdString();
|
hash = RsFileHash(it2->toStdString());
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
qsize = it2->toULongLong(&ok, 10);
|
qsize = it2->toULongLong(&ok, 10);
|
||||||
|
@ -316,21 +318,21 @@ void CreateGxsChannelMsg::parseRsFileListAttachments(const std::string &attachLi
|
||||||
std::cerr << "\tsize: " << size << std::endl;
|
std::cerr << "\tsize: " << size << std::endl;
|
||||||
std::cerr << "\tsource: " << source << std::endl;
|
std::cerr << "\tsource: " << source << std::endl;
|
||||||
|
|
||||||
/* basic error checking */
|
/* basic error checking */
|
||||||
if ((ok) && (hash.size() == 40))
|
if (ok && !hash.isNull())
|
||||||
{
|
{
|
||||||
std::cerr << "Item Ok" << std::endl;
|
std::cerr << "Item Ok" << std::endl;
|
||||||
addAttachment(hash, fname, size, source.isNull(), source);
|
addAttachment(hash, fname, size, source.isNull(), source);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::cerr << "Error Decode: Hash size: " << hash.size() << std::endl;
|
std::cerr << "Error Decode: Hash is not a hash: " << hash << std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void CreateGxsChannelMsg::addAttachment(const std::string &hash, const std::string &fname, uint64_t size, bool local, const RsPeerId &srcId)
|
void CreateGxsChannelMsg::addAttachment(const RsFileHash &hash, const std::string &fname, uint64_t size, bool local, const RsPeerId &srcId)
|
||||||
{
|
{
|
||||||
/* add a SubFileItem to the attachment section */
|
/* add a SubFileItem to the attachment section */
|
||||||
std::cerr << "CreateGxsChannelMsg::addAttachment()";
|
std::cerr << "CreateGxsChannelMsg::addAttachment()";
|
||||||
|
@ -403,9 +405,12 @@ void CreateGxsChannelMsg::addAttachment(const std::string &path)
|
||||||
FileInfo fInfo;
|
FileInfo fInfo;
|
||||||
std::string filename;
|
std::string filename;
|
||||||
uint64_t size = 0;
|
uint64_t size = 0;
|
||||||
std::string hash = "";
|
RsFileHash hash ;
|
||||||
|
|
||||||
rsGxsChannels->ExtraFileHash(path, filename);
|
rsGxsChannels->ExtraFileHash(path, filename);
|
||||||
|
|
||||||
|
#error: hash is used uninitialized below ?!?
|
||||||
|
|
||||||
// only path and filename are valid.
|
// only path and filename are valid.
|
||||||
// destroyed when fileFrame (this subfileitem) is destroyed
|
// destroyed when fileFrame (this subfileitem) is destroyed
|
||||||
//SubFileItem *file = new SubFileItem(hash, filename, path, size, flags, mChannelId);
|
//SubFileItem *file = new SubFileItem(hash, filename, path, size, flags, mChannelId);
|
||||||
|
@ -537,7 +542,7 @@ void CreateGxsChannelMsg::newChannelMsg()
|
||||||
RsTokReqOptions opts;
|
RsTokReqOptions opts;
|
||||||
opts.mReqType = GXS_REQUEST_TYPE_GROUP_META;
|
opts.mReqType = GXS_REQUEST_TYPE_GROUP_META;
|
||||||
|
|
||||||
std::list<std::string> groupIds;
|
std::list<RsGxsGroupId> groupIds;
|
||||||
groupIds.push_back(mChannelId);
|
groupIds.push_back(mChannelId);
|
||||||
|
|
||||||
std::cerr << "CreateGxsChannelMsg::newChannelMsg() Req Group Summary(" << mChannelId << ")";
|
std::cerr << "CreateGxsChannelMsg::newChannelMsg() Req Group Summary(" << mChannelId << ")";
|
||||||
|
|
|
@ -38,13 +38,13 @@ class CreateGxsChannelMsg : public QDialog, public TokenResponse, private Ui::Cr
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/** Default Constructor */
|
/** Default Constructor */
|
||||||
CreateGxsChannelMsg(std::string cId);
|
CreateGxsChannelMsg(const RsGxsGroupId& cId);
|
||||||
|
|
||||||
/** Default Destructor */
|
/** Default Destructor */
|
||||||
~CreateGxsChannelMsg();
|
~CreateGxsChannelMsg();
|
||||||
|
|
||||||
void addAttachment(const std::string &path);
|
void addAttachment(const std::string &path);
|
||||||
void addAttachment(const std::string &hash, const std::string &fname, uint64_t size, bool local, const RsPeerId &srcId);
|
void addAttachment(const RsFileHash &hash, const std::string &fname, uint64_t size, bool local, const RsPeerId &srcId);
|
||||||
|
|
||||||
void newChannelMsg();
|
void newChannelMsg();
|
||||||
|
|
||||||
|
@ -77,7 +77,7 @@ private:
|
||||||
void sendMessage(const std::string &subject, const std::string &msg, const std::list<RsGxsFile> &files);
|
void sendMessage(const std::string &subject, const std::string &msg, const std::list<RsGxsFile> &files);
|
||||||
bool setThumbNail(const std::string& path, int frame);
|
bool setThumbNail(const std::string& path, int frame);
|
||||||
|
|
||||||
std::string mChannelId;
|
RsGxsGroupId mChannelId;
|
||||||
RsGroupMetaData mChannelMeta;
|
RsGroupMetaData mChannelMeta;
|
||||||
bool mChannelMetaLoaded;
|
bool mChannelMetaLoaded;
|
||||||
|
|
||||||
|
|
|
@ -143,7 +143,7 @@ void GxsChannelDialog::updateDisplay(bool complete)
|
||||||
/* Update channel list */
|
/* Update channel list */
|
||||||
insertChannels();
|
insertChannels();
|
||||||
}
|
}
|
||||||
if (!mChannelId.empty() && std::find(grpIds.begin(), grpIds.end(), mChannelId) != grpIds.end()) {
|
if (!mChannelId.isNull() && std::find(grpIds.begin(), grpIds.end(), mChannelId) != grpIds.end()) {
|
||||||
requestGroupData(mChannelId);
|
requestGroupData(mChannelId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -192,12 +192,12 @@ void GxsChannelDialog::processSettings(bool load)
|
||||||
|
|
||||||
void GxsChannelDialog::channelListCustomPopupMenu( QPoint /*point*/ )
|
void GxsChannelDialog::channelListCustomPopupMenu( QPoint /*point*/ )
|
||||||
{
|
{
|
||||||
if (mChannelId.empty())
|
if (mChannelId.isNull())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t subscribeFlags = ui.treeWidget->subscribeFlags(QString::fromStdString(mChannelId));
|
uint32_t subscribeFlags = ui.treeWidget->subscribeFlags(QString::fromStdString(mChannelId.toStdString()));
|
||||||
|
|
||||||
QMenu contextMnu(this);
|
QMenu contextMnu(this);
|
||||||
|
|
||||||
|
@ -272,7 +272,7 @@ void GxsChannelDialog::channelListCustomPopupMenu( QPoint /*point*/ )
|
||||||
|
|
||||||
contextMnu.addSeparator();
|
contextMnu.addSeparator();
|
||||||
QAction *action = contextMnu.addAction(QIcon(":/images/copyrslink.png"), tr("Copy RetroShare Link"), this, SLOT(copyChannelLink()));
|
QAction *action = contextMnu.addAction(QIcon(":/images/copyrslink.png"), tr("Copy RetroShare Link"), this, SLOT(copyChannelLink()));
|
||||||
action->setEnabled(!mChannelId.empty());
|
action->setEnabled(!mChannelId.isNull());
|
||||||
|
|
||||||
contextMnu.exec(QCursor::pos());
|
contextMnu.exec(QCursor::pos());
|
||||||
|
|
||||||
|
@ -340,7 +340,7 @@ void GxsChannelDialog::channelListCustomPopupMenu( QPoint /*point*/ )
|
||||||
|
|
||||||
contextMnu.addSeparator();
|
contextMnu.addSeparator();
|
||||||
QAction *action = contextMnu.addAction(QIcon(":/images/copyrslink.png"), tr("Copy RetroShare Link"), this, SLOT(copyChannelLink()));
|
QAction *action = contextMnu.addAction(QIcon(":/images/copyrslink.png"), tr("Copy RetroShare Link"), this, SLOT(copyChannelLink()));
|
||||||
action->setEnabled(!mChannelId.empty());
|
action->setEnabled(!mChannelId.isNull());
|
||||||
|
|
||||||
contextMnu.exec(QCursor::pos());
|
contextMnu.exec(QCursor::pos());
|
||||||
|
|
||||||
|
@ -389,7 +389,7 @@ void GxsChannelDialog::shareKey()
|
||||||
void GxsChannelDialog::copyChannelLink()
|
void GxsChannelDialog::copyChannelLink()
|
||||||
{
|
{
|
||||||
#if 0
|
#if 0
|
||||||
if (mChannelId.empty()) {
|
if (mChannelId.isNull()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -407,7 +407,7 @@ void GxsChannelDialog::copyChannelLink()
|
||||||
|
|
||||||
void GxsChannelDialog::createMsg()
|
void GxsChannelDialog::createMsg()
|
||||||
{
|
{
|
||||||
if (mChannelId.empty()) {
|
if (mChannelId.isNull()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -440,7 +440,7 @@ void GxsChannelDialog::selectChannel(const QString &id)
|
||||||
|
|
||||||
static void channelInfoToGroupItemInfo(const RsGroupMetaData &channelInfo, GroupItemInfo &groupItemInfo)
|
static void channelInfoToGroupItemInfo(const RsGroupMetaData &channelInfo, GroupItemInfo &groupItemInfo)
|
||||||
{
|
{
|
||||||
groupItemInfo.id = QString::fromStdString(channelInfo.mGroupId);
|
groupItemInfo.id = QString::fromStdString(channelInfo.mGroupId.toStdString());
|
||||||
groupItemInfo.name = QString::fromUtf8(channelInfo.mGroupName.c_str());
|
groupItemInfo.name = QString::fromUtf8(channelInfo.mGroupName.c_str());
|
||||||
groupItemInfo.popularity = channelInfo.mPop;
|
groupItemInfo.popularity = channelInfo.mPop;
|
||||||
groupItemInfo.lastpost = QDateTime::fromTime_t(channelInfo.mLastPost);
|
groupItemInfo.lastpost = QDateTime::fromTime_t(channelInfo.mLastPost);
|
||||||
|
@ -774,7 +774,7 @@ void GxsChannelDialog::unsubscribeChannel()
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (mChannelId.empty())
|
if (mChannelId.isNull())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
uint32_t token = 0;
|
uint32_t token = 0;
|
||||||
|
@ -789,7 +789,7 @@ void GxsChannelDialog::subscribeChannel()
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (mChannelId.empty())
|
if (mChannelId.isNull())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
uint32_t token = 0;
|
uint32_t token = 0;
|
||||||
|
@ -800,7 +800,7 @@ void GxsChannelDialog::subscribeChannel()
|
||||||
void GxsChannelDialog::showChannelDetails()
|
void GxsChannelDialog::showChannelDetails()
|
||||||
{
|
{
|
||||||
#if 0
|
#if 0
|
||||||
if (mChannelId.empty()) {
|
if (mChannelId.isNull()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -818,7 +818,7 @@ void GxsChannelDialog::showChannelDetails()
|
||||||
void GxsChannelDialog::setAllAsReadClicked()
|
void GxsChannelDialog::setAllAsReadClicked()
|
||||||
{
|
{
|
||||||
#if 0
|
#if 0
|
||||||
if (mChannelId.empty()) {
|
if (mChannelId.isNull()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -846,7 +846,7 @@ void GxsChannelDialog::setAllAsReadClicked()
|
||||||
|
|
||||||
void GxsChannelDialog::toggleAutoDownload()
|
void GxsChannelDialog::toggleAutoDownload()
|
||||||
{
|
{
|
||||||
if (mChannelId.empty())
|
if (mChannelId.isNull())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
bool autoDl = rsGxsChannels->getChannelAutoDownload(mChannelId);
|
bool autoDl = rsGxsChannels->getChannelAutoDownload(mChannelId);
|
||||||
|
@ -864,11 +864,11 @@ void GxsChannelDialog::toggleAutoDownload()
|
||||||
bool GxsChannelDialog::navigate(const std::string& channelId, const std::string& msgId)
|
bool GxsChannelDialog::navigate(const std::string& channelId, const std::string& msgId)
|
||||||
{
|
{
|
||||||
#if 0
|
#if 0
|
||||||
if (channelId.empty()) {
|
if (channelId.isNull()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (treeWidget->activateId(QString::fromStdString(channelId), msgId.empty()) == NULL) {
|
if (treeWidget->activateId(QString::fromStdString(channelId), msgId.isNull()) == NULL) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -877,7 +877,7 @@ bool GxsChannelDialog::navigate(const std::string& channelId, const std::string&
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (msgId.empty()) {
|
if (msgId.isNull()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -976,7 +976,7 @@ void GxsChannelDialog::requestGroupData(const RsGxsGroupId &grpId)
|
||||||
|
|
||||||
mChannelQueue->cancelActiveRequestTokens(TOKEN_TYPE_GROUP_DATA);
|
mChannelQueue->cancelActiveRequestTokens(TOKEN_TYPE_GROUP_DATA);
|
||||||
|
|
||||||
if (grpId.empty()) {
|
if (grpId.isNull()) {
|
||||||
mStateHelper->setActive(TOKEN_TYPE_GROUP_DATA, false);
|
mStateHelper->setActive(TOKEN_TYPE_GROUP_DATA, false);
|
||||||
mStateHelper->setLoading(TOKEN_TYPE_GROUP_DATA, false);
|
mStateHelper->setLoading(TOKEN_TYPE_GROUP_DATA, false);
|
||||||
mStateHelper->clear(TOKEN_TYPE_GROUP_DATA);
|
mStateHelper->clear(TOKEN_TYPE_GROUP_DATA);
|
||||||
|
@ -1043,7 +1043,7 @@ void GxsChannelDialog::requestPosts(const RsGxsGroupId &grpId)
|
||||||
|
|
||||||
mChannelQueue->cancelActiveRequestTokens(TOKEN_TYPE_POSTS);
|
mChannelQueue->cancelActiveRequestTokens(TOKEN_TYPE_POSTS);
|
||||||
|
|
||||||
if (grpId.empty()) {
|
if (grpId.isNull()) {
|
||||||
mStateHelper->setActive(TOKEN_TYPE_POSTS, false);
|
mStateHelper->setActive(TOKEN_TYPE_POSTS, false);
|
||||||
mStateHelper->setLoading(TOKEN_TYPE_POSTS, false);
|
mStateHelper->setLoading(TOKEN_TYPE_POSTS, false);
|
||||||
mStateHelper->clear(TOKEN_TYPE_POSTS);
|
mStateHelper->clear(TOKEN_TYPE_POSTS);
|
||||||
|
|
|
@ -118,7 +118,7 @@ private:
|
||||||
void acknowledgeGroupUpdate(const uint32_t &token);
|
void acknowledgeGroupUpdate(const uint32_t &token);
|
||||||
void acknowledgeMessageUpdate(const uint32_t &token);
|
void acknowledgeMessageUpdate(const uint32_t &token);
|
||||||
|
|
||||||
std::string mChannelId; /* current Channel */
|
RsGxsGroupId mChannelId; /* current Channel */
|
||||||
TokenQueue *mChannelQueue;
|
TokenQueue *mChannelQueue;
|
||||||
|
|
||||||
/* Layout Pointers */
|
/* Layout Pointers */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue