mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-08-15 17:40:35 -04:00
messages and group refactor done and tested!
author and circles left git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.6-IdCleaning@7156 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
350ee35ac9
commit
5c36c8f4b6
26 changed files with 201 additions and 183 deletions
|
@ -283,9 +283,7 @@ RsGxsGrpMetaData* RsDataService::locked_getGrpMeta(RetroCursor &c)
|
||||||
c.getString(COL_ORIG_GRP_ID, tempId);
|
c.getString(COL_ORIG_GRP_ID, tempId);
|
||||||
grpMeta->mOrigGrpId = tempId;
|
grpMeta->mOrigGrpId = tempId;
|
||||||
c.getString(COL_GRP_SERV_STRING, grpMeta->mServiceString);
|
c.getString(COL_GRP_SERV_STRING, grpMeta->mServiceString);
|
||||||
|
c.getString(COL_HASH, grpMeta->mHash);
|
||||||
c.getString(COL_HASH, tempId);
|
|
||||||
grpMeta->mHash = tempId ;
|
|
||||||
grpMeta->mSignFlags = c.getInt32(COL_GRP_SIGN_FLAGS);
|
grpMeta->mSignFlags = c.getInt32(COL_GRP_SIGN_FLAGS);
|
||||||
|
|
||||||
grpMeta->mPublishTs = c.getInt32(COL_TIME_STAMP);
|
grpMeta->mPublishTs = c.getInt32(COL_TIME_STAMP);
|
||||||
|
@ -393,22 +391,21 @@ RsGxsMsgMetaData* RsDataService::locked_getMsgMeta(RetroCursor &c)
|
||||||
char* data = NULL;
|
char* data = NULL;
|
||||||
|
|
||||||
|
|
||||||
std::string gId,tempId;
|
std::string gId;
|
||||||
c.getString(COL_GRP_ID, gId);
|
c.getString(COL_GRP_ID, gId);
|
||||||
msgMeta->mGroupId = RsGxsGroupId(gId);
|
msgMeta->mGroupId = RsGxsGroupId(gId);
|
||||||
c.getString(COL_MSG_ID, tempId) ;
|
std::string temp;
|
||||||
msgMeta->mMsgId = tempId ;
|
c.getString(COL_MSG_ID, temp);
|
||||||
|
msgMeta->mMsgId = temp;
|
||||||
// without these, a msg is meaningless
|
// without these, a msg is meaningless
|
||||||
ok &= (!msgMeta->mGroupId.isNull()) && (!msgMeta->mMsgId.isNull());
|
ok &= (!msgMeta->mGroupId.isNull()) && (!msgMeta->mMsgId.isNull());
|
||||||
|
|
||||||
c.getString(COL_ORIG_MSG_ID, tempId) ;
|
c.getString(COL_ORIG_MSG_ID, temp);
|
||||||
msgMeta->mOrigMsgId = tempId ;
|
msgMeta->mOrigMsgId = temp;
|
||||||
c.getString(COL_IDENTITY, msgMeta->mAuthorId);
|
c.getString(COL_IDENTITY, msgMeta->mAuthorId);
|
||||||
c.getString(COL_MSG_NAME, msgMeta->mMsgName);
|
c.getString(COL_MSG_NAME, msgMeta->mMsgName);
|
||||||
c.getString(COL_MSG_SERV_STRING, msgMeta->mServiceString);
|
c.getString(COL_MSG_SERV_STRING, msgMeta->mServiceString);
|
||||||
c.getString(COL_HASH, tempId) ;
|
c.getString(COL_HASH, msgMeta->mHash);
|
||||||
msgMeta->mHash = tempId;
|
|
||||||
msgMeta->recvTS = c.getInt32(COL_MSG_RECV_TS);
|
msgMeta->recvTS = c.getInt32(COL_MSG_RECV_TS);
|
||||||
|
|
||||||
offset = 0;
|
offset = 0;
|
||||||
|
@ -422,8 +419,10 @@ RsGxsMsgMetaData* RsDataService::locked_getMsgMeta(RetroCursor &c)
|
||||||
offset = 0; data_len = 0;
|
offset = 0; data_len = 0;
|
||||||
|
|
||||||
// thread and parent id
|
// thread and parent id
|
||||||
c.getString(COL_THREAD_ID, tempId) ; msgMeta->mThreadId = tempId ;
|
c.getString(COL_THREAD_ID, temp);
|
||||||
c.getString(COL_PARENT_ID, tempId) ; msgMeta->mParentId = tempId ;
|
msgMeta->mThreadId = temp;
|
||||||
|
c.getString(COL_PARENT_ID, temp);
|
||||||
|
msgMeta->mParentId = temp;
|
||||||
|
|
||||||
// local meta
|
// local meta
|
||||||
msgMeta->mMsgStatus = c.getInt32(COL_MSG_STATUS);
|
msgMeta->mMsgStatus = c.getInt32(COL_MSG_STATUS);
|
||||||
|
@ -445,12 +444,13 @@ RsNxsMsg* RsDataService::locked_getMessage(RetroCursor &c)
|
||||||
RsNxsMsg* msg = new RsNxsMsg(mServType);
|
RsNxsMsg* msg = new RsNxsMsg(mServType);
|
||||||
|
|
||||||
bool ok = true;
|
bool ok = true;
|
||||||
std::string tempId ;
|
|
||||||
uint32_t data_len = 0,
|
uint32_t data_len = 0,
|
||||||
offset = 0;
|
offset = 0;
|
||||||
char* data = NULL;
|
char* data = NULL;
|
||||||
c.getStringT<RsGxsGroupId>(COL_ACT_GROUP_ID, msg->grpId);
|
c.getStringT<RsGxsGroupId>(COL_ACT_GROUP_ID, msg->grpId);
|
||||||
c.getString(COL_ACT_MSG_ID, tempId) ; msg->msgId = tempId ;
|
std::string temp;
|
||||||
|
c.getString(COL_ACT_MSG_ID, temp);
|
||||||
|
msg->msgId = temp;
|
||||||
|
|
||||||
ok &= (!msg->grpId.isNull()) && (!msg->msgId.isNull());
|
ok &= (!msg->grpId.isNull()) && (!msg->msgId.isNull());
|
||||||
|
|
||||||
|
@ -522,7 +522,7 @@ int RsDataService::storeMessage(std::map<RsNxsMsg *, RsGxsMsgMetaData *> &msg)
|
||||||
cv.put(KEY_MSG_ID, msgMetaPtr->mMsgId.toStdString());
|
cv.put(KEY_MSG_ID, msgMetaPtr->mMsgId.toStdString());
|
||||||
cv.put(KEY_GRP_ID, msgMetaPtr->mGroupId.toStdString());
|
cv.put(KEY_GRP_ID, msgMetaPtr->mGroupId.toStdString());
|
||||||
cv.put(KEY_NXS_SERV_STRING, msgMetaPtr->mServiceString);
|
cv.put(KEY_NXS_SERV_STRING, msgMetaPtr->mServiceString);
|
||||||
cv.put(KEY_NXS_HASH, msgMetaPtr->mHash.toStdString());
|
cv.put(KEY_NXS_HASH, msgMetaPtr->mHash);
|
||||||
cv.put(KEY_RECV_TS, (int32_t)msgMetaPtr->recvTS);
|
cv.put(KEY_RECV_TS, (int32_t)msgMetaPtr->recvTS);
|
||||||
|
|
||||||
|
|
||||||
|
@ -631,7 +631,7 @@ int RsDataService::storeGroup(std::map<RsNxsGrp *, RsGxsGrpMetaData *> &grp)
|
||||||
cv.put(KEY_GRP_ORIGINATOR, grpMetaPtr->mOriginator.toStdString());
|
cv.put(KEY_GRP_ORIGINATOR, grpMetaPtr->mOriginator.toStdString());
|
||||||
cv.put(KEY_GRP_AUTHEN_FLAGS, (int32_t)grpMetaPtr->mAuthenFlags);
|
cv.put(KEY_GRP_AUTHEN_FLAGS, (int32_t)grpMetaPtr->mAuthenFlags);
|
||||||
cv.put(KEY_PARENT_GRP_ID, grpMetaPtr->mParentGrpId.toStdString());
|
cv.put(KEY_PARENT_GRP_ID, grpMetaPtr->mParentGrpId.toStdString());
|
||||||
cv.put(KEY_NXS_HASH, grpMetaPtr->mHash.toStdString());
|
cv.put(KEY_NXS_HASH, grpMetaPtr->mHash);
|
||||||
cv.put(KEY_RECV_TS, (int32_t)grpMetaPtr->mRecvTS);
|
cv.put(KEY_RECV_TS, (int32_t)grpMetaPtr->mRecvTS);
|
||||||
|
|
||||||
if(! (grpMetaPtr->mAuthorId.empty()) ){
|
if(! (grpMetaPtr->mAuthorId.empty()) ){
|
||||||
|
@ -723,7 +723,7 @@ int RsDataService::updateGroup(std::map<RsNxsGrp *, RsGxsGrpMetaData *> &grp)
|
||||||
cv.put(KEY_GRP_INTERNAL_CIRCLE, grpMetaPtr->mInternalCircle);
|
cv.put(KEY_GRP_INTERNAL_CIRCLE, grpMetaPtr->mInternalCircle);
|
||||||
cv.put(KEY_GRP_ORIGINATOR, grpMetaPtr->mOriginator.toStdString());
|
cv.put(KEY_GRP_ORIGINATOR, grpMetaPtr->mOriginator.toStdString());
|
||||||
cv.put(KEY_GRP_AUTHEN_FLAGS, (int32_t)grpMetaPtr->mAuthenFlags);
|
cv.put(KEY_GRP_AUTHEN_FLAGS, (int32_t)grpMetaPtr->mAuthenFlags);
|
||||||
cv.put(KEY_NXS_HASH, grpMetaPtr->mHash.toStdString());
|
cv.put(KEY_NXS_HASH, grpMetaPtr->mHash);
|
||||||
|
|
||||||
if(! (grpMetaPtr->mAuthorId.empty()) ){
|
if(! (grpMetaPtr->mAuthorId.empty()) ){
|
||||||
cv.put(KEY_NXS_IDENTITY, grpMetaPtr->mAuthorId);
|
cv.put(KEY_NXS_IDENTITY, grpMetaPtr->mAuthorId);
|
||||||
|
@ -1416,9 +1416,10 @@ void RsDataService::locked_getMessageOffsets(const RsGxsGroupId& grpId, std::vec
|
||||||
{
|
{
|
||||||
RsGxsMessageId msgId;
|
RsGxsMessageId msgId;
|
||||||
int32_t msgLen;
|
int32_t msgLen;
|
||||||
int32_t msgOffSet;
|
int32_t msgOffSet;
|
||||||
std::string tempId ;
|
std::string temp;
|
||||||
c->getString(0, tempId) ; msgId = tempId;
|
c->getString(0, temp);
|
||||||
|
msgId = temp;
|
||||||
msgOffSet = c->getInt32(1);
|
msgOffSet = c->getInt32(1);
|
||||||
msgLen = c->getInt32(2);
|
msgLen = c->getInt32(2);
|
||||||
|
|
||||||
|
|
|
@ -690,7 +690,9 @@ int RsGenExchange::createMessage(RsNxsMsg* msg)
|
||||||
// get hash of msg data to create msg id
|
// get hash of msg data to create msg id
|
||||||
pqihash hash;
|
pqihash hash;
|
||||||
hash.addData(allMsgData, allMsgDataLen);
|
hash.addData(allMsgData, allMsgDataLen);
|
||||||
hash.Complete(msg->msgId);
|
std::string hashId;
|
||||||
|
hash.Complete(hashId);
|
||||||
|
msg->msgId = hashId;
|
||||||
|
|
||||||
// assign msg id to msg meta
|
// assign msg id to msg meta
|
||||||
msg->metaData->mMsgId = msg->msgId;
|
msg->metaData->mMsgId = msg->msgId;
|
||||||
|
@ -1769,7 +1771,7 @@ void RsGenExchange::publishMsgs()
|
||||||
{
|
{
|
||||||
// empty orig msg id means this is the original
|
// empty orig msg id means this is the original
|
||||||
// msg
|
// msg
|
||||||
if(msg->metaData->mOrigMsgId.isNull())
|
if(msg->metaData->mOrigMsgId.isNull())
|
||||||
{
|
{
|
||||||
msg->metaData->mOrigMsgId = msg->metaData->mMsgId;
|
msg->metaData->mOrigMsgId = msg->metaData->mMsgId;
|
||||||
}
|
}
|
||||||
|
@ -2218,7 +2220,7 @@ void RsGenExchange::processRecvdData()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void RsGenExchange::computeHash(const RsTlvBinaryData& data, RsFileHash& hash)
|
void RsGenExchange::computeHash(const RsTlvBinaryData& data, std::string& hash)
|
||||||
{
|
{
|
||||||
pqihash pHash;
|
pqihash pHash;
|
||||||
pHash.addData(data.bin_data, data.bin_len);
|
pHash.addData(data.bin_data, data.bin_len);
|
||||||
|
|
|
@ -228,10 +228,10 @@ bool RsGxsMsgMetaData::serialise(void *data, uint32_t *size)
|
||||||
offset += 8;
|
offset += 8;
|
||||||
|
|
||||||
ok &= mGroupId.serialise(data, *size, offset);
|
ok &= mGroupId.serialise(data, *size, offset);
|
||||||
ok &= mMsgId.serialise(data, *size, offset) ;
|
ok &= mMsgId.serialise(data, *size, offset);
|
||||||
ok &= mThreadId.serialise(data, *size, offset) ;
|
ok &= mThreadId.serialise(data, *size, offset);
|
||||||
ok &= mParentId.serialise(data, *size, offset) ;
|
ok &= mParentId.serialise(data, *size, offset);
|
||||||
ok &= mOrigMsgId.serialise(data, *size, offset) ;
|
ok &= mOrigMsgId.serialise(data, *size, offset);
|
||||||
ok &= SetTlvString(data, *size, &offset, 0, mAuthorId);
|
ok &= SetTlvString(data, *size, &offset, 0, mAuthorId);
|
||||||
|
|
||||||
ok &= signSet.SetTlv(data, *size, &offset);
|
ok &= signSet.SetTlv(data, *size, &offset);
|
||||||
|
@ -255,10 +255,10 @@ bool RsGxsMsgMetaData::deserialise(void *data, uint32_t *size)
|
||||||
if(!ok) return false;
|
if(!ok) return false;
|
||||||
|
|
||||||
ok &= mGroupId.deserialise(data, *size, offset);
|
ok &= mGroupId.deserialise(data, *size, offset);
|
||||||
ok &= mMsgId.serialise(data, *size, offset) ;
|
ok &= mMsgId.deserialise(data, *size, offset);
|
||||||
ok &= mThreadId.serialise(data, *size,offset) ;
|
ok &= mThreadId.deserialise(data, *size, offset);
|
||||||
ok &= mParentId.serialise(data, *size, offset) ;
|
ok &= mParentId.deserialise(data, *size, offset);
|
||||||
ok &= mOrigMsgId.serialise(data, *size, offset) ;
|
ok &= mOrigMsgId.deserialise(data, *size, offset);
|
||||||
ok &= GetTlvString(data, *size, &offset, 0, mAuthorId);
|
ok &= GetTlvString(data, *size, &offset, 0, mAuthorId);
|
||||||
|
|
||||||
ok &= signSet.GetTlv(data, *size, &offset);
|
ok &= signSet.GetTlv(data, *size, &offset);
|
||||||
|
|
|
@ -1490,7 +1490,7 @@ void RsGxsNetService::locked_genReqMsgTransaction(NxsTransaction* tr)
|
||||||
std::vector<RsGxsMsgMetaData*> &msgMetaV = result[grpId];
|
std::vector<RsGxsMsgMetaData*> &msgMetaV = result[grpId];
|
||||||
|
|
||||||
std::vector<RsGxsMsgMetaData*>::const_iterator vit = msgMetaV.begin();
|
std::vector<RsGxsMsgMetaData*>::const_iterator vit = msgMetaV.begin();
|
||||||
std::set<RsGxsMessageId> msgIdSet;
|
std::set<RsGxsMessageId> msgIdSet;
|
||||||
|
|
||||||
// put ids in set for each searching
|
// put ids in set for each searching
|
||||||
for(; vit != msgMetaV.end(); vit++)
|
for(; vit != msgMetaV.end(); vit++)
|
||||||
|
@ -1517,7 +1517,7 @@ void RsGxsNetService::locked_genReqMsgTransaction(NxsTransaction* tr)
|
||||||
for(; llit != msgItemL.end(); llit++)
|
for(; llit != msgItemL.end(); llit++)
|
||||||
{
|
{
|
||||||
RsNxsSyncMsgItem*& syncItem = *llit;
|
RsNxsSyncMsgItem*& syncItem = *llit;
|
||||||
const RsGxsMessageId& msgId = syncItem->msgId;
|
const RsGxsMessageId& msgId = syncItem->msgId;
|
||||||
|
|
||||||
if(msgIdSet.find(msgId) == msgIdSet.end()){
|
if(msgIdSet.find(msgId) == msgIdSet.end()){
|
||||||
|
|
||||||
|
@ -2221,7 +2221,7 @@ void RsGxsNetService::handleRecvSyncMessage(RsNxsSyncMsg* item)
|
||||||
if(grpMeta == NULL)
|
if(grpMeta == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
req[item->grpId] = std::vector<RsGxsMessageId>();
|
req[item->grpId] = std::vector<RsGxsMessageId>();
|
||||||
mDataStore->retrieveGxsMsgMetaData(req, metaResult);
|
mDataStore->retrieveGxsMsgMetaData(req, metaResult);
|
||||||
std::vector<RsGxsMsgMetaData*>& msgMetas = metaResult[item->grpId];
|
std::vector<RsGxsMsgMetaData*>& msgMetas = metaResult[item->grpId];
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,7 @@ class RsGxsFile
|
||||||
public:
|
public:
|
||||||
RsGxsFile();
|
RsGxsFile();
|
||||||
std::string mName;
|
std::string mName;
|
||||||
RsFileHash mHash;
|
RsFileHash mHash;
|
||||||
uint64_t mSize;
|
uint64_t mSize;
|
||||||
//std::string mPath;
|
//std::string mPath;
|
||||||
};
|
};
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
#include <retroshare/rsids.h>
|
#include <retroshare/rsids.h>
|
||||||
|
|
||||||
typedef GXSGroupId RsGxsGroupId;
|
typedef GXSGroupId RsGxsGroupId;
|
||||||
typedef RsFileHash RsGxsMessageId;
|
typedef Sha1CheckSum RsGxsMessageId;
|
||||||
|
|
||||||
typedef std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > GxsMsgIdResult;
|
typedef std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > GxsMsgIdResult;
|
||||||
typedef std::pair<RsGxsGroupId, RsGxsMessageId> RsGxsGrpMsgIdPair;
|
typedef std::pair<RsGxsGroupId, RsGxsMessageId> RsGxsGrpMsgIdPair;
|
||||||
|
|
|
@ -145,14 +145,17 @@ template<uint32_t ID_SIZE_IN_BYTES,bool UPPER_CASE,uint32_t UNIQUE_IDENTIFIER> s
|
||||||
|
|
||||||
return res ;
|
return res ;
|
||||||
}
|
}
|
||||||
|
void chris_test();
|
||||||
template<uint32_t ID_SIZE_IN_BYTES,bool UPPER_CASE,uint32_t UNIQUE_IDENTIFIER> t_RsGenericIdType<ID_SIZE_IN_BYTES,UPPER_CASE,UNIQUE_IDENTIFIER>::t_RsGenericIdType(const std::string& s)
|
template<uint32_t ID_SIZE_IN_BYTES,bool UPPER_CASE,uint32_t UNIQUE_IDENTIFIER> t_RsGenericIdType<ID_SIZE_IN_BYTES,UPPER_CASE,UNIQUE_IDENTIFIER>::t_RsGenericIdType(const std::string& s)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
int n=0;
|
int n=0;
|
||||||
if(s.length() != ID_SIZE_IN_BYTES*2)
|
if(s.length() != ID_SIZE_IN_BYTES*2)
|
||||||
|
{
|
||||||
throw std::runtime_error("t_RsGenericIdType<>::t_RsGenericIdType(std::string&): supplied string in constructor has wrong size.") ;
|
throw std::runtime_error("t_RsGenericIdType<>::t_RsGenericIdType(std::string&): supplied string in constructor has wrong size.") ;
|
||||||
|
chris_test();
|
||||||
|
}
|
||||||
|
|
||||||
for(uint32_t i = 0; i < ID_SIZE_IN_BYTES; ++i)
|
for(uint32_t i = 0; i < ID_SIZE_IN_BYTES; ++i)
|
||||||
{
|
{
|
||||||
|
@ -176,6 +179,7 @@ template<uint32_t ID_SIZE_IN_BYTES,bool UPPER_CASE,uint32_t UNIQUE_IDENTIFIER> t
|
||||||
catch(std::exception& e)
|
catch(std::exception& e)
|
||||||
{
|
{
|
||||||
std::cerr << e.what() << std::endl;
|
std::cerr << e.what() << std::endl;
|
||||||
|
chris_test();
|
||||||
clear() ;
|
clear() ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -212,6 +216,5 @@ typedef t_RsGenericIdType< PGP_KEY_FINGERPRINT_SIZE, true, RS_GENERIC_ID_PGP_F
|
||||||
|
|
||||||
typedef t_RsGenericIdType< CERT_SIGN_LEN , false, RS_GENERIC_ID_GXS_GROUP_ID_TYPE > GXSGroupId ;
|
typedef t_RsGenericIdType< CERT_SIGN_LEN , false, RS_GENERIC_ID_GXS_GROUP_ID_TYPE > GXSGroupId ;
|
||||||
typedef t_RsGenericIdType< CERT_SIGN_LEN , false, RS_GENERIC_ID_GXS_ID_TYPE > GXSId ;
|
typedef t_RsGenericIdType< CERT_SIGN_LEN , false, RS_GENERIC_ID_GXS_ID_TYPE > GXSId ;
|
||||||
typedef t_RsGenericIdType< SHA1_SIZE , false, RS_GENERIC_ID_GXS_MSG_ID_TYPE > GXSMsgId ;
|
|
||||||
typedef t_RsGenericIdType< CERT_SIGN_LEN , false, RS_GENERIC_ID_GXS_CIRCLE_ID_TYPE > GXSCircleId ;
|
typedef t_RsGenericIdType< CERT_SIGN_LEN , false, RS_GENERIC_ID_GXS_CIRCLE_ID_TYPE > GXSCircleId ;
|
||||||
|
|
||||||
|
|
|
@ -1401,7 +1401,7 @@ int RsServer::StartupRetroShare()
|
||||||
RsGxsNetService* gxsid_ns = new RsGxsNetService(
|
RsGxsNetService* gxsid_ns = new RsGxsNetService(
|
||||||
RS_SERVICE_GXSV2_TYPE_GXSID, gxsid_ds, nxsMgr,
|
RS_SERVICE_GXSV2_TYPE_GXSID, gxsid_ds, nxsMgr,
|
||||||
mGxsIdService, mGxsIdService, mGxsCircles,
|
mGxsIdService, mGxsIdService, mGxsCircles,
|
||||||
false); // don't synchronise group automatic (need explicit group request)
|
true); // don't synchronise group automatic (need explicit group request)
|
||||||
|
|
||||||
mGxsIdService->setNes(gxsid_ns);
|
mGxsIdService->setNes(gxsid_ns);
|
||||||
/**** GxsCircle service ****/
|
/**** GxsCircle service ****/
|
||||||
|
@ -1815,3 +1815,10 @@ int RsServer::StartupRetroShare()
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void chris_test()
|
||||||
|
{
|
||||||
|
std::cout << "tested\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -204,7 +204,7 @@ bool RsNxsSerialiser::serialiseNxsSynMsgItem(RsNxsSyncMsgItem *item, void *data,
|
||||||
ok &= setRawUInt32(data, *size, &offset, item->transactionNumber);
|
ok &= setRawUInt32(data, *size, &offset, item->transactionNumber);
|
||||||
ok &= setRawUInt8(data, *size, &offset, item->flag);
|
ok &= setRawUInt8(data, *size, &offset, item->flag);
|
||||||
ok &= item->grpId.serialise(data, *size, offset);
|
ok &= item->grpId.serialise(data, *size, offset);
|
||||||
ok &= item->msgId.serialise(data, *size, offset) ;
|
ok &= item->msgId.serialise(data, *size, offset);
|
||||||
ok &= SetTlvString(data, *size, &offset, TLV_TYPE_STR_NAME, item->authorId);
|
ok &= SetTlvString(data, *size, &offset, TLV_TYPE_STR_NAME, item->authorId);
|
||||||
|
|
||||||
if(offset != tlvsize){
|
if(offset != tlvsize){
|
||||||
|
@ -253,7 +253,7 @@ bool RsNxsSerialiser::serialiseNxsMsg(RsNxsMsg *item, void *data, uint32_t *size
|
||||||
|
|
||||||
ok &= setRawUInt32(data, *size, &offset, item->transactionNumber);
|
ok &= setRawUInt32(data, *size, &offset, item->transactionNumber);
|
||||||
ok &= setRawUInt8(data, *size, &offset, item->pos);
|
ok &= setRawUInt8(data, *size, &offset, item->pos);
|
||||||
ok &= item->msgId.serialise(data, tlvsize, offset) ;
|
ok &= item->msgId.serialise(data, *size, offset);
|
||||||
ok &= item->grpId.serialise(data, *size, offset);
|
ok &= item->grpId.serialise(data, *size, offset);
|
||||||
ok &= item->msg.SetTlv(data, tlvsize, &offset);
|
ok &= item->msg.SetTlv(data, tlvsize, &offset);
|
||||||
ok &= item->meta.SetTlv(data, *size, &offset);
|
ok &= item->meta.SetTlv(data, *size, &offset);
|
||||||
|
@ -643,7 +643,7 @@ RsNxsMsg* RsNxsSerialiser::deserialNxsMsg(void *data, uint32_t *size){
|
||||||
|
|
||||||
ok &= getRawUInt32(data, *size, &offset, &(item->transactionNumber));
|
ok &= getRawUInt32(data, *size, &offset, &(item->transactionNumber));
|
||||||
ok &= getRawUInt8(data, *size, &offset, &(item->pos));
|
ok &= getRawUInt8(data, *size, &offset, &(item->pos));
|
||||||
ok &= item->msgId.deserialise(data, *size, offset) ;
|
ok &= item->msgId.deserialise(data, *size, offset);
|
||||||
ok &= item->grpId.deserialise(data, *size, offset);
|
ok &= item->grpId.deserialise(data, *size, offset);
|
||||||
ok &= item->msg.GetTlv(data, *size, &offset);
|
ok &= item->msg.GetTlv(data, *size, &offset);
|
||||||
ok &= item->meta.GetTlv(data, *size, &offset);
|
ok &= item->meta.GetTlv(data, *size, &offset);
|
||||||
|
@ -917,7 +917,7 @@ RsNxsSyncMsgItem* RsNxsSerialiser::deserialNxsSyncMsgItem(void *data, uint32_t *
|
||||||
ok &= getRawUInt32(data, *size, &offset, &(item->transactionNumber));
|
ok &= getRawUInt32(data, *size, &offset, &(item->transactionNumber));
|
||||||
ok &= getRawUInt8(data, *size, &offset, &(item->flag));
|
ok &= getRawUInt8(data, *size, &offset, &(item->flag));
|
||||||
ok &= item->grpId.deserialise(data, *size, offset);
|
ok &= item->grpId.deserialise(data, *size, offset);
|
||||||
ok &= item->msgId.deserialise(data, *size, offset) ;
|
ok &= item->msgId.deserialise(data, *size, offset);
|
||||||
ok &= GetTlvString(data, *size, &offset, TLV_TYPE_STR_NAME, item->authorId);
|
ok &= GetTlvString(data, *size, &offset, TLV_TYPE_STR_NAME, item->authorId);
|
||||||
|
|
||||||
if (offset != rssize)
|
if (offset != rssize)
|
||||||
|
|
|
@ -296,7 +296,7 @@ public:
|
||||||
uint8_t pos; /// used for splitting up msg
|
uint8_t pos; /// used for splitting up msg
|
||||||
uint8_t count; /// number of split up messages
|
uint8_t count; /// number of split up messages
|
||||||
RsGxsGroupId grpId; /// group id, forms part of version id
|
RsGxsGroupId grpId; /// group id, forms part of version id
|
||||||
RsFileHash msgId; /// msg id
|
RsGxsMessageId msgId; /// msg id
|
||||||
static int refcount;
|
static int refcount;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
|
|
@ -598,7 +598,7 @@ void p3GxsChannels::handleUnprocessedPost(const RsGxsChannelPost &msg)
|
||||||
for(fit = msg.mFiles.begin(); fit != msg.mFiles.end(); fit++)
|
for(fit = msg.mFiles.begin(); fit != msg.mFiles.end(); fit++)
|
||||||
{
|
{
|
||||||
std::string fname = fit->mName;
|
std::string fname = fit->mName;
|
||||||
RsFileHash hash = fit->mHash;
|
Sha1CheckSum hash = Sha1CheckSum(fit->mHash);
|
||||||
uint64_t size = fit->mSize;
|
uint64_t size = fit->mSize;
|
||||||
|
|
||||||
std::list<RsPeerId> srcIds;
|
std::list<RsPeerId> srcIds;
|
||||||
|
@ -685,6 +685,7 @@ bool p3GxsChannels::autoDownloadEnabled(const RsGxsGroupId &id)
|
||||||
|
|
||||||
bool SSGxsChannelGroup::load(const std::string &input)
|
bool SSGxsChannelGroup::load(const std::string &input)
|
||||||
{
|
{
|
||||||
|
char line[RSGXSCHANNEL_MAX_SERVICE_STRING];
|
||||||
int download_val;
|
int download_val;
|
||||||
mAutoDownload = false;
|
mAutoDownload = false;
|
||||||
if (1 == sscanf(input.c_str(), "D:%d", &download_val))
|
if (1 == sscanf(input.c_str(), "D:%d", &download_val))
|
||||||
|
@ -831,10 +832,11 @@ bool p3GxsChannels::ExtraFileHash(const std::string &path, std::string filename)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool p3GxsChannels::ExtraFileRemove(const RsFileHash &hash)
|
bool p3GxsChannels::ExtraFileRemove(const std::string &hash)
|
||||||
{
|
{
|
||||||
TransferRequestFlags tflags = RS_FILE_REQ_ANONYMOUS_ROUTING | RS_FILE_REQ_EXTRA;
|
TransferRequestFlags tflags = RS_FILE_REQ_ANONYMOUS_ROUTING | RS_FILE_REQ_EXTRA;
|
||||||
return rsFiles->ExtraFileRemove(hash, tflags);
|
RsFileHash fh = RsFileHash(hash);
|
||||||
|
return rsFiles->ExtraFileRemove(fh, tflags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1015,7 +1017,7 @@ void p3GxsChannels::dummy_tick()
|
||||||
RsGxsGroupId grpId = ref.mGroupId;
|
RsGxsGroupId grpId = ref.mGroupId;
|
||||||
RsGxsMessageId parentId = ref.mMsgId;
|
RsGxsMessageId parentId = ref.mMsgId;
|
||||||
mGenThreadId = ref.mThreadId;
|
mGenThreadId = ref.mThreadId;
|
||||||
if (mGenThreadId.isNull())
|
if (mGenThreadId.empty())
|
||||||
{
|
{
|
||||||
mGenThreadId = parentId;
|
mGenThreadId = parentId;
|
||||||
}
|
}
|
||||||
|
@ -1037,7 +1039,7 @@ void p3GxsChannels::dummy_tick()
|
||||||
RsGxsGroupId grpId = ref.mGroupId;
|
RsGxsGroupId grpId = ref.mGroupId;
|
||||||
RsGxsMessageId parentId = ref.mMsgId;
|
RsGxsMessageId parentId = ref.mMsgId;
|
||||||
mGenThreadId = ref.mThreadId;
|
mGenThreadId = ref.mThreadId;
|
||||||
if (mGenThreadId.isNull())
|
if (mGenThreadId.empty())
|
||||||
{
|
{
|
||||||
mGenThreadId = parentId;
|
mGenThreadId = parentId;
|
||||||
}
|
}
|
||||||
|
@ -1059,7 +1061,7 @@ void p3GxsChannels::dummy_tick()
|
||||||
RsGxsGroupId grpId = ref.mGroupId;
|
RsGxsGroupId grpId = ref.mGroupId;
|
||||||
RsGxsMessageId parentId = ref.mMsgId;
|
RsGxsMessageId parentId = ref.mMsgId;
|
||||||
mGenThreadId = ref.mThreadId;
|
mGenThreadId = ref.mThreadId;
|
||||||
if (mGenThreadId.isNull())
|
if (mGenThreadId.empty())
|
||||||
{
|
{
|
||||||
mGenThreadId = parentId;
|
mGenThreadId = parentId;
|
||||||
}
|
}
|
||||||
|
@ -1107,7 +1109,7 @@ bool p3GxsChannels::generateComment(uint32_t &token, const RsGxsGroupId &grpId,
|
||||||
std::string rndId = genRandomId();
|
std::string rndId = genRandomId();
|
||||||
|
|
||||||
rs_sprintf(msg.mComment, "Channel Comment: GroupId: %s, ThreadId: %s, ParentId: %s + some randomness: %s",
|
rs_sprintf(msg.mComment, "Channel Comment: GroupId: %s, ThreadId: %s, ParentId: %s + some randomness: %s",
|
||||||
grpId.toStdString().c_str(), threadId.toStdString().c_str(), parentId.toStdString().c_str(), rndId.c_str());
|
grpId.toStdString().c_str(), threadId.c_str(), parentId.c_str(), rndId.c_str());
|
||||||
|
|
||||||
msg.mMeta.mMsgName = msg.mComment;
|
msg.mMeta.mMsgName = msg.mComment;
|
||||||
|
|
||||||
|
|
|
@ -414,14 +414,14 @@ bool p3GxsCommentService::createGxsVote(uint32_t &token, RsGxsVote &vote)
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
|
|
||||||
/* vote must be associated with another item */
|
/* vote must be associated with another item */
|
||||||
if (vote.mMeta.mThreadId.isNull())
|
if (vote.mMeta.mThreadId.isNull())
|
||||||
{
|
{
|
||||||
std::cerr << "p3GxsCommentService::createGxsVote() ERROR Missing Required ThreadId";
|
std::cerr << "p3GxsCommentService::createGxsVote() ERROR Missing Required ThreadId";
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (vote.mMeta.mParentId.isNull())
|
if (vote.mMeta.mParentId.isNull())
|
||||||
{
|
{
|
||||||
std::cerr << "p3GxsCommentService::createGxsVote() ERROR Missing Required ParentId";
|
std::cerr << "p3GxsCommentService::createGxsVote() ERROR Missing Required ParentId";
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
|
|
|
@ -396,7 +396,7 @@ void p3GxsForums::dummy_tick()
|
||||||
RsGxsGroupId grpId = ref.mGroupId;
|
RsGxsGroupId grpId = ref.mGroupId;
|
||||||
RsGxsMessageId parentId = ref.mMsgId;
|
RsGxsMessageId parentId = ref.mMsgId;
|
||||||
mGenThreadId = ref.mThreadId;
|
mGenThreadId = ref.mThreadId;
|
||||||
if (mGenThreadId.isNull())
|
if (mGenThreadId.isNull())
|
||||||
{
|
{
|
||||||
mGenThreadId = parentId;
|
mGenThreadId = parentId;
|
||||||
}
|
}
|
||||||
|
@ -420,7 +420,7 @@ bool p3GxsForums::generateMessage(uint32_t &token, const RsGxsGroupId &grpId, co
|
||||||
std::string rndId = genRandomId();
|
std::string rndId = genRandomId();
|
||||||
|
|
||||||
rs_sprintf(msg.mMsg, "Forum Msg: GroupId: %s, ThreadId: %s, ParentId: %s + some randomness: %s",
|
rs_sprintf(msg.mMsg, "Forum Msg: GroupId: %s, ThreadId: %s, ParentId: %s + some randomness: %s",
|
||||||
grpId.toStdString().c_str(), threadId.toStdString().c_str(), parentId.toStdString().c_str(), rndId.c_str());
|
grpId.toStdString().c_str(), threadId.toStdString().c_str(), parentId.toStdString().c_str(), rndId.c_str());
|
||||||
|
|
||||||
msg.mMeta.mMsgName = msg.mMsg;
|
msg.mMeta.mMsgName = msg.mMsg;
|
||||||
|
|
||||||
|
|
|
@ -429,7 +429,7 @@ void p3PostBase::background_loadMsgs(const uint32_t &token, bool unprocessed)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 3 types expected: PostedPost, Comment and Vote */
|
/* 3 types expected: PostedPost, Comment and Vote */
|
||||||
if (parentId.isNull())
|
if (parentId.isNull())
|
||||||
{
|
{
|
||||||
/* we don't care about top-level (Posts) */
|
/* we don't care about top-level (Posts) */
|
||||||
std::cerr << "\tIgnoring TopLevel Item";
|
std::cerr << "\tIgnoring TopLevel Item";
|
||||||
|
|
|
@ -88,9 +88,9 @@ void GxsCommentTreeWidget::customPopUpMenu(const QPoint& point)
|
||||||
{
|
{
|
||||||
QMenu contextMnu( this );
|
QMenu contextMnu( this );
|
||||||
QAction* action = contextMnu.addAction(QIcon(IMAGE_MESSAGE), tr("Reply to Comment"), this, SLOT(replyToComment()));
|
QAction* action = contextMnu.addAction(QIcon(IMAGE_MESSAGE), tr("Reply to Comment"), this, SLOT(replyToComment()));
|
||||||
action->setDisabled(mCurrentMsgId.empty());
|
action->setDisabled(mCurrentMsgId.isNull());
|
||||||
action = contextMnu.addAction(QIcon(IMAGE_MESSAGE), tr("Submit Comment"), this, SLOT(makeComment()));
|
action = contextMnu.addAction(QIcon(IMAGE_MESSAGE), tr("Submit Comment"), this, SLOT(makeComment()));
|
||||||
action->setDisabled(mThreadId.first.empty());
|
action->setDisabled(mThreadId.first.isNull());
|
||||||
|
|
||||||
contextMnu.addSeparator();
|
contextMnu.addSeparator();
|
||||||
|
|
||||||
|
@ -100,7 +100,7 @@ void GxsCommentTreeWidget::customPopUpMenu(const QPoint& point)
|
||||||
action->setDisabled(mVoterId.empty());
|
action->setDisabled(mVoterId.empty());
|
||||||
|
|
||||||
|
|
||||||
if (!mCurrentMsgId.empty())
|
if (!mCurrentMsgId.isNull())
|
||||||
{
|
{
|
||||||
contextMnu.addSeparator();
|
contextMnu.addSeparator();
|
||||||
QMenu *rep_menu = contextMnu.addMenu(tr("Reputation"));
|
QMenu *rep_menu = contextMnu.addMenu(tr("Reputation"));
|
||||||
|
@ -264,12 +264,12 @@ void GxsCommentTreeWidget::clearItems()
|
||||||
void GxsCommentTreeWidget::completeItems()
|
void GxsCommentTreeWidget::completeItems()
|
||||||
{
|
{
|
||||||
/* handle pending items */
|
/* handle pending items */
|
||||||
std::string parentId;
|
RsGxsMessageId parentId;
|
||||||
QTreeWidgetItem *parent = NULL;
|
QTreeWidgetItem *parent = NULL;
|
||||||
QList<QTreeWidgetItem *> topLevelItems;
|
QList<QTreeWidgetItem *> topLevelItems;
|
||||||
|
|
||||||
std::map<std::string, QTreeWidgetItem *>::iterator lit;
|
std::map<RsGxsMessageId, QTreeWidgetItem *>::iterator lit;
|
||||||
std::multimap<std::string, QTreeWidgetItem *>::iterator pit;
|
std::multimap<RsGxsMessageId, QTreeWidgetItem *>::iterator pit;
|
||||||
|
|
||||||
std::cerr << "GxsCommentTreeWidget::completeItems() " << mPendingInsertMap.size();
|
std::cerr << "GxsCommentTreeWidget::completeItems() " << mPendingInsertMap.size();
|
||||||
std::cerr << " PendingItems";
|
std::cerr << " PendingItems";
|
||||||
|
@ -334,7 +334,7 @@ void GxsCommentTreeWidget::completeItems()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void GxsCommentTreeWidget::addItem(std::string itemId, std::string parentId, QTreeWidgetItem *item)
|
void GxsCommentTreeWidget::addItem(RsGxsMessageId itemId, RsGxsMessageId parentId, QTreeWidgetItem *item)
|
||||||
{
|
{
|
||||||
std::cerr << "GxsCommentTreeWidget::addItem() Id: " << itemId;
|
std::cerr << "GxsCommentTreeWidget::addItem() Id: " << itemId;
|
||||||
std::cerr << " ParentId: " << parentId;
|
std::cerr << " ParentId: " << parentId;
|
||||||
|
@ -343,7 +343,7 @@ void GxsCommentTreeWidget::addItem(std::string itemId, std::string parentId, QTr
|
||||||
/* store in map -> for children */
|
/* store in map -> for children */
|
||||||
mLoadingMap[itemId] = item;
|
mLoadingMap[itemId] = item;
|
||||||
|
|
||||||
std::map<std::string, QTreeWidgetItem *>::iterator it;
|
std::map<RsGxsMessageId, QTreeWidgetItem *>::iterator it;
|
||||||
it = mLoadingMap.find(parentId);
|
it = mLoadingMap.find(parentId);
|
||||||
if (it != mLoadingMap.end())
|
if (it != mLoadingMap.end())
|
||||||
{
|
{
|
||||||
|
@ -437,10 +437,10 @@ void GxsCommentTreeWidget::service_loadThread(const uint32_t &token)
|
||||||
text = QString::number(comment.mOwnVote);
|
text = QString::number(comment.mOwnVote);
|
||||||
item->setText(PCITEM_COLUMN_OWNVOTE, text);
|
item->setText(PCITEM_COLUMN_OWNVOTE, text);
|
||||||
|
|
||||||
text = QString::fromUtf8(comment.mMeta.mMsgId.c_str());
|
text = QString::fromUtf8(comment.mMeta.mMsgId.toStdString().c_str());
|
||||||
item->setText(PCITEM_COLUMN_MSGID, text);
|
item->setText(PCITEM_COLUMN_MSGID, text);
|
||||||
|
|
||||||
text = QString::fromUtf8(comment.mMeta.mParentId.c_str());
|
text = QString::fromUtf8(comment.mMeta.mParentId.toStdString().c_str());
|
||||||
item->setText(PCITEM_COLUMN_PARENTID, text);
|
item->setText(PCITEM_COLUMN_PARENTID, text);
|
||||||
|
|
||||||
|
|
||||||
|
@ -467,7 +467,7 @@ QTreeWidgetItem *GxsCommentTreeWidget::service_createMissingItem(const RsGxsMess
|
||||||
item->setText(PCITEM_COLUMN_MSGID, text);
|
item->setText(PCITEM_COLUMN_MSGID, text);
|
||||||
|
|
||||||
|
|
||||||
text = QString::fromUtf8(parent.c_str());
|
text = QString::fromUtf8(parent.toStdString().c_str());
|
||||||
item->setText(PCITEM_COLUMN_PARENTID, text);
|
item->setText(PCITEM_COLUMN_PARENTID, text);
|
||||||
|
|
||||||
return item;
|
return item;
|
||||||
|
|
|
@ -60,7 +60,7 @@ protected:
|
||||||
|
|
||||||
void loadThread(const uint32_t &token);
|
void loadThread(const uint32_t &token);
|
||||||
|
|
||||||
void addItem(std::string itemId, std::string parentId, QTreeWidgetItem *item);
|
void addItem(RsGxsMessageId itemId, RsGxsMessageId parentId, QTreeWidgetItem *item);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void customPopUpMenu(const QPoint& point);
|
void customPopUpMenu(const QPoint& point);
|
||||||
|
@ -88,8 +88,8 @@ protected:
|
||||||
RsGxsMessageId mCurrentMsgId;
|
RsGxsMessageId mCurrentMsgId;
|
||||||
RsGxsId mVoterId;
|
RsGxsId mVoterId;
|
||||||
|
|
||||||
std::map<std::string, QTreeWidgetItem *> mLoadingMap;
|
std::map<RsGxsMessageId, QTreeWidgetItem *> mLoadingMap;
|
||||||
std::multimap<std::string, QTreeWidgetItem *> mPendingInsertMap;
|
std::multimap<RsGxsMessageId, QTreeWidgetItem *> mPendingInsertMap;
|
||||||
|
|
||||||
TokenQueue *mTokenQueue;
|
TokenQueue *mTokenQueue;
|
||||||
RsTokenService *mRsTokenService;
|
RsTokenService *mRsTokenService;
|
||||||
|
|
|
@ -167,7 +167,7 @@ void GxsFeedItem::requestGroupMeta()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::list<std::string> ids;
|
std::list<RsGxsGroupId> ids;
|
||||||
ids.push_back(mGroupId);
|
ids.push_back(mGroupId);
|
||||||
|
|
||||||
RsTokReqOptions opts;
|
RsTokReqOptions opts;
|
||||||
|
|
|
@ -46,7 +46,7 @@
|
||||||
//#define ENABLE_GENERATE
|
//#define ENABLE_GENERATE
|
||||||
|
|
||||||
/** Constructor */
|
/** Constructor */
|
||||||
CreateGxsForumMsg::CreateGxsForumMsg(const std::string &fId, const std::string &pId)
|
CreateGxsForumMsg::CreateGxsForumMsg(const RsGxsGroupId &fId, const RsGxsMessageId &pId)
|
||||||
: QDialog(NULL, Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint), mForumId(fId), mParentId(pId)
|
: QDialog(NULL, Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint), mForumId(fId), mParentId(pId)
|
||||||
{
|
{
|
||||||
/* Invoke the Qt Designer generated object setup routine */
|
/* Invoke the Qt Designer generated object setup routine */
|
||||||
|
@ -71,7 +71,7 @@ CreateGxsForumMsg::CreateGxsForumMsg(const std::string &fId, const std::string &
|
||||||
mStateHelper->addLoadPlaceholder(CREATEGXSFORUMMSG_PARENTMSG, ui.forumSubject);
|
mStateHelper->addLoadPlaceholder(CREATEGXSFORUMMSG_PARENTMSG, ui.forumSubject);
|
||||||
mStateHelper->addClear(CREATEGXSFORUMMSG_PARENTMSG, ui.forumName);
|
mStateHelper->addClear(CREATEGXSFORUMMSG_PARENTMSG, ui.forumName);
|
||||||
|
|
||||||
QString text = pId.empty() ? tr("Start New Thread") : tr("Post Forum Message");
|
QString text = pId.isNull() ? tr("Start New Thread") : tr("Post Forum Message");
|
||||||
setWindowTitle(text);
|
setWindowTitle(text);
|
||||||
|
|
||||||
ui.headerFrame->setHeaderImage(QPixmap(":/images/konversation64.png"));
|
ui.headerFrame->setHeaderImage(QPixmap(":/images/konversation64.png"));
|
||||||
|
@ -119,7 +119,7 @@ void CreateGxsForumMsg::newMsg()
|
||||||
/* fill in the available OwnIds for signing */
|
/* fill in the available OwnIds for signing */
|
||||||
ui.idChooser->loadIds(IDCHOOSER_ID_REQUIRED, "");
|
ui.idChooser->loadIds(IDCHOOSER_ID_REQUIRED, "");
|
||||||
|
|
||||||
if (mForumId.empty()) {
|
if (mForumId.isNull()) {
|
||||||
mStateHelper->setActive(CREATEGXSFORUMMSG_FORUMINFO, false);
|
mStateHelper->setActive(CREATEGXSFORUMMSG_FORUMINFO, false);
|
||||||
mStateHelper->setActive(CREATEGXSFORUMMSG_PARENTMSG, false);
|
mStateHelper->setActive(CREATEGXSFORUMMSG_PARENTMSG, false);
|
||||||
mStateHelper->clear(CREATEGXSFORUMMSG_FORUMINFO);
|
mStateHelper->clear(CREATEGXSFORUMMSG_FORUMINFO);
|
||||||
|
@ -135,7 +135,7 @@ void CreateGxsForumMsg::newMsg()
|
||||||
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(mForumId);
|
groupIds.push_back(mForumId);
|
||||||
|
|
||||||
std::cerr << "ForumsV2Dialog::newMsg() Requesting Group Summary(" << mForumId << ")";
|
std::cerr << "ForumsV2Dialog::newMsg() Requesting Group Summary(" << mForumId << ")";
|
||||||
|
@ -145,7 +145,7 @@ void CreateGxsForumMsg::newMsg()
|
||||||
mForumQueue->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_SUMMARY, opts, groupIds, CREATEGXSFORUMMSG_FORUMINFO);
|
mForumQueue->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_SUMMARY, opts, groupIds, CREATEGXSFORUMMSG_FORUMINFO);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mParentId.empty())
|
if (mParentId.isNull())
|
||||||
{
|
{
|
||||||
mStateHelper->setActive(CREATEGXSFORUMMSG_PARENTMSG, true);
|
mStateHelper->setActive(CREATEGXSFORUMMSG_PARENTMSG, true);
|
||||||
mParentMsgLoaded = true;
|
mParentMsgLoaded = true;
|
||||||
|
@ -171,7 +171,7 @@ void CreateGxsForumMsg::newMsg()
|
||||||
|
|
||||||
void CreateGxsForumMsg::loadFormInformation()
|
void CreateGxsForumMsg::loadFormInformation()
|
||||||
{
|
{
|
||||||
if (!mParentId.empty()) {
|
if (!mParentId.isNull()) {
|
||||||
if (mParentMsgLoaded) {
|
if (mParentMsgLoaded) {
|
||||||
mStateHelper->setActive(CREATEGXSFORUMMSG_PARENTMSG, true);
|
mStateHelper->setActive(CREATEGXSFORUMMSG_PARENTMSG, true);
|
||||||
mStateHelper->setLoading(CREATEGXSFORUMMSG_PARENTMSG, false);
|
mStateHelper->setLoading(CREATEGXSFORUMMSG_PARENTMSG, false);
|
||||||
|
@ -205,7 +205,7 @@ void CreateGxsForumMsg::loadFormInformation()
|
||||||
|
|
||||||
QString name = QString::fromUtf8(mForumMeta.mGroupName.c_str());
|
QString name = QString::fromUtf8(mForumMeta.mGroupName.c_str());
|
||||||
QString subj;
|
QString subj;
|
||||||
if (!mParentId.empty())
|
if (!mParentId.isNull())
|
||||||
{
|
{
|
||||||
QString title = QString::fromUtf8(mParentMsg.mMeta.mMsgName.c_str());
|
QString title = QString::fromUtf8(mParentMsg.mMeta.mMsgName.c_str());
|
||||||
name += " " + tr("In Reply to") + ": ";
|
name += " " + tr("In Reply to") + ": ";
|
||||||
|
@ -373,7 +373,8 @@ void CreateGxsForumMsg::fileHashingFinished(QList<HashedFile> hashedFiles)
|
||||||
for (it = hashedFiles.begin(); it != hashedFiles.end(); ++it) {
|
for (it = hashedFiles.begin(); it != hashedFiles.end(); ++it) {
|
||||||
HashedFile& hashedFile = *it;
|
HashedFile& hashedFile = *it;
|
||||||
RetroShareLink link;
|
RetroShareLink link;
|
||||||
if (link.createFile(hashedFile.filename, hashedFile.size, QString::fromStdString(hashedFile.hash))) {
|
if (link.createFile(hashedFile.filename, hashedFile.size,
|
||||||
|
QString::fromStdString(hashedFile.hash.toStdString()))) {
|
||||||
mesgString += link.toHtmlSize() + "<br>";
|
mesgString += link.toHtmlSize() + "<br>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,7 +35,7 @@ class CreateGxsForumMsg : public QDialog, public TokenResponse
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CreateGxsForumMsg(const std::string &fId, const std::string &pId);
|
CreateGxsForumMsg(const RsGxsGroupId &fId, const RsGxsMessageId &pId);
|
||||||
~CreateGxsForumMsg();
|
~CreateGxsForumMsg();
|
||||||
|
|
||||||
void newMsg(); /* cleanup */
|
void newMsg(); /* cleanup */
|
||||||
|
@ -59,8 +59,8 @@ private:
|
||||||
void loadForumInfo(const uint32_t &token);
|
void loadForumInfo(const uint32_t &token);
|
||||||
void loadParentMsg(const uint32_t &token);
|
void loadParentMsg(const uint32_t &token);
|
||||||
|
|
||||||
std::string mForumId;
|
RsGxsGroupId mForumId;
|
||||||
std::string mParentId;
|
RsGxsMessageId mParentId;
|
||||||
|
|
||||||
bool mParentMsgLoaded;
|
bool mParentMsgLoaded;
|
||||||
bool mForumMetaLoaded;
|
bool mForumMetaLoaded;
|
||||||
|
|
|
@ -86,7 +86,7 @@
|
||||||
#define TOKEN_TYPE_INSERT_POST 2
|
#define TOKEN_TYPE_INSERT_POST 2
|
||||||
#define TOKEN_TYPE_REPLY_MESSAGE 3
|
#define TOKEN_TYPE_REPLY_MESSAGE 3
|
||||||
|
|
||||||
GxsForumThreadWidget::GxsForumThreadWidget(const std::string &forumId, QWidget *parent) :
|
GxsForumThreadWidget::GxsForumThreadWidget(const RsGxsGroupId &forumId, QWidget *parent) :
|
||||||
RsGxsUpdateBroadcastWidget(rsGxsForums, parent),
|
RsGxsUpdateBroadcastWidget(rsGxsForums, parent),
|
||||||
ui(new Ui::GxsForumThreadWidget)
|
ui(new Ui::GxsForumThreadWidget)
|
||||||
{
|
{
|
||||||
|
@ -256,16 +256,16 @@ void GxsForumThreadWidget::processSettings(bool load)
|
||||||
mInProcessSettings = false;
|
mInProcessSettings = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GxsForumThreadWidget::setForumId(const std::string &forumId)
|
void GxsForumThreadWidget::setForumId(const RsGxsGroupId &forumId)
|
||||||
{
|
{
|
||||||
if (mForumId == forumId) {
|
if (mForumId == forumId) {
|
||||||
if (!forumId.empty()) {
|
if (!forumId.isNull()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mForumId = forumId;
|
mForumId = forumId;
|
||||||
ui->forumName->setText(mForumId.empty () ? "" : tr("Loading"));
|
ui->forumName->setText(mForumId.isNull () ? "" : tr("Loading"));
|
||||||
mNewCount = 0;
|
mNewCount = 0;
|
||||||
mUnreadCount = 0;
|
mUnreadCount = 0;
|
||||||
|
|
||||||
|
@ -276,7 +276,7 @@ void GxsForumThreadWidget::setForumId(const std::string &forumId)
|
||||||
|
|
||||||
QString GxsForumThreadWidget::forumName(bool withUnreadCount)
|
QString GxsForumThreadWidget::forumName(bool withUnreadCount)
|
||||||
{
|
{
|
||||||
QString name = mForumId.empty () ? tr("No name") : ui->forumName->text();
|
QString name = mForumId.isNull () ? tr("No name") : ui->forumName->text();
|
||||||
|
|
||||||
if (withUnreadCount && mUnreadCount) {
|
if (withUnreadCount && mUnreadCount) {
|
||||||
name += QString(" (%1)").arg(mUnreadCount);
|
name += QString(" (%1)").arg(mUnreadCount);
|
||||||
|
@ -414,7 +414,7 @@ void GxsForumThreadWidget::threadListCustomPopupMenu(QPoint /*point*/)
|
||||||
contextMnu.addAction(newthreadAct);
|
contextMnu.addAction(newthreadAct);
|
||||||
contextMnu.addAction(replyauthorAct);
|
contextMnu.addAction(replyauthorAct);
|
||||||
QAction* action = contextMnu.addAction(QIcon(IMAGE_COPYLINK), tr("Copy RetroShare Link"), this, SLOT(copyMessageLink()));
|
QAction* action = contextMnu.addAction(QIcon(IMAGE_COPYLINK), tr("Copy RetroShare Link"), this, SLOT(copyMessageLink()));
|
||||||
action->setEnabled(!mForumId.empty() && !mThreadId.empty());
|
action->setEnabled(!mForumId.isNull() && !mThreadId.isNull());
|
||||||
contextMnu.addSeparator();
|
contextMnu.addSeparator();
|
||||||
contextMnu.addAction(markMsgAsRead);
|
contextMnu.addAction(markMsgAsRead);
|
||||||
contextMnu.addAction(markMsgAsReadChildren);
|
contextMnu.addAction(markMsgAsReadChildren);
|
||||||
|
@ -489,7 +489,7 @@ void GxsForumThreadWidget::clickedThread(QTreeWidgetItem *item, int column)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mForumId.empty() || !IS_GROUP_SUBSCRIBED(mSubscribeFlags)) {
|
if (mForumId.isNull() || !IS_GROUP_SUBSCRIBED(mSubscribeFlags)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -804,7 +804,7 @@ QTreeWidgetItem *GxsForumThreadWidget::convertMsgToThreadWidget(const RsGxsForum
|
||||||
item->setText(COLUMN_THREAD_DATE, text);
|
item->setText(COLUMN_THREAD_DATE, text);
|
||||||
item->setData(COLUMN_THREAD_DATE, ROLE_THREAD_SORT, sort);
|
item->setData(COLUMN_THREAD_DATE, ROLE_THREAD_SORT, sort);
|
||||||
|
|
||||||
item->setText(COLUMN_THREAD_AUTHOR, QString::fromStdString(msg.mMeta.mAuthorId.toStdString()));
|
item->setText(COLUMN_THREAD_AUTHOR, QString::fromStdString(msg.mMeta.mAuthorId));
|
||||||
//item->setId(msg.mMeta.mAuthorId, COLUMN_THREAD_AUTHOR);
|
//item->setId(msg.mMeta.mAuthorId, COLUMN_THREAD_AUTHOR);
|
||||||
//#TODO
|
//#TODO
|
||||||
#if 0
|
#if 0
|
||||||
|
@ -840,7 +840,7 @@ QTreeWidgetItem *GxsForumThreadWidget::convertMsgToThreadWidget(const RsGxsForum
|
||||||
item->setText(COLUMN_THREAD_CONTENT, doc.toPlainText().replace(QString("\n"), QString(" ")));
|
item->setText(COLUMN_THREAD_CONTENT, doc.toPlainText().replace(QString("\n"), QString(" ")));
|
||||||
}
|
}
|
||||||
|
|
||||||
item->setData(COLUMN_THREAD_DATA, ROLE_THREAD_MSGID, QString::fromStdString(msg.mMeta.mMsgId));
|
item->setData(COLUMN_THREAD_DATA, ROLE_THREAD_MSGID, QString::fromStdString(msg.mMeta.mMsgId.toStdString()));
|
||||||
//#TODO
|
//#TODO
|
||||||
#if 0
|
#if 0
|
||||||
if (IS_GROUP_SUBSCRIBED(subscribeFlags) && !(msginfo.mMsgFlags & RS_DISTRIB_MISSING_MSG)) {
|
if (IS_GROUP_SUBSCRIBED(subscribeFlags) && !(msginfo.mMsgFlags & RS_DISTRIB_MISSING_MSG)) {
|
||||||
|
@ -857,11 +857,11 @@ QTreeWidgetItem *GxsForumThreadWidget::convertMsgToThreadWidget(const RsGxsForum
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
QTreeWidgetItem *GxsForumThreadWidget::generateMissingItem(const std::string &msgId)
|
QTreeWidgetItem *GxsForumThreadWidget::generateMissingItem(const RsGxsMessageId &msgId)
|
||||||
{
|
{
|
||||||
GxsIdRSTreeWidgetItem *item = new GxsIdRSTreeWidgetItem(mThreadCompareRole);
|
GxsIdRSTreeWidgetItem *item = new GxsIdRSTreeWidgetItem(mThreadCompareRole);
|
||||||
item->setText(COLUMN_THREAD_TITLE, tr("[ ... Missing Message ... ]"));
|
item->setText(COLUMN_THREAD_TITLE, tr("[ ... Missing Message ... ]"));
|
||||||
item->setData(COLUMN_THREAD_DATA, ROLE_THREAD_MSGID, QString::fromStdString(msgId));
|
item->setData(COLUMN_THREAD_DATA, ROLE_THREAD_MSGID, QString::fromStdString(msgId.toStdString()));
|
||||||
item->setData(COLUMN_THREAD_DATA, ROLE_THREAD_MISSING, true);
|
item->setData(COLUMN_THREAD_DATA, ROLE_THREAD_MISSING, true);
|
||||||
|
|
||||||
return item;
|
return item;
|
||||||
|
@ -891,7 +891,7 @@ void GxsForumThreadWidget::insertThreads()
|
||||||
mSubscribeFlags = 0;
|
mSubscribeFlags = 0;
|
||||||
mForumDescription.clear();
|
mForumDescription.clear();
|
||||||
|
|
||||||
if (mForumId.empty())
|
if (mForumId.isNull())
|
||||||
{
|
{
|
||||||
/* not an actual forum - clear */
|
/* not an actual forum - clear */
|
||||||
mStateHelper->setActive(TOKEN_TYPE_CURRENTFORUM, false);
|
mStateHelper->setActive(TOKEN_TYPE_CURRENTFORUM, false);
|
||||||
|
@ -899,8 +899,8 @@ void GxsForumThreadWidget::insertThreads()
|
||||||
mStateHelper->clear(TOKEN_TYPE_CURRENTFORUM);
|
mStateHelper->clear(TOKEN_TYPE_CURRENTFORUM);
|
||||||
mStateHelper->clear(TOKEN_TYPE_INSERT_POST);
|
mStateHelper->clear(TOKEN_TYPE_INSERT_POST);
|
||||||
/* clear last stored forumID */
|
/* clear last stored forumID */
|
||||||
mForumId.erase();
|
mForumId.clear();
|
||||||
mLastForumID.erase();
|
mLastForumID.clear();
|
||||||
|
|
||||||
#ifdef DEBUG_FORUMS
|
#ifdef DEBUG_FORUMS
|
||||||
std::cerr << "GxsForumsDialog::insertThreads() Current Thread Invalid" << std::endl;
|
std::cerr << "GxsForumsDialog::insertThreads() Current Thread Invalid" << std::endl;
|
||||||
|
@ -1131,7 +1131,7 @@ void GxsForumThreadWidget::fillChildren(QTreeWidgetItem *parentItem, QTreeWidget
|
||||||
|
|
||||||
void GxsForumThreadWidget::insertPost()
|
void GxsForumThreadWidget::insertPost()
|
||||||
{
|
{
|
||||||
if (mForumId.empty())
|
if (mForumId.isNull())
|
||||||
{
|
{
|
||||||
mStateHelper->setActive(TOKEN_TYPE_CURRENTFORUM, false);
|
mStateHelper->setActive(TOKEN_TYPE_CURRENTFORUM, false);
|
||||||
mStateHelper->setActive(TOKEN_TYPE_INSERT_POST, false);
|
mStateHelper->setActive(TOKEN_TYPE_INSERT_POST, false);
|
||||||
|
@ -1143,7 +1143,7 @@ void GxsForumThreadWidget::insertPost()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mThreadId.empty())
|
if (mThreadId.isNull())
|
||||||
{
|
{
|
||||||
mStateHelper->setActive(TOKEN_TYPE_INSERT_POST, false);
|
mStateHelper->setActive(TOKEN_TYPE_INSERT_POST, false);
|
||||||
mStateHelper->clear(TOKEN_TYPE_INSERT_POST);
|
mStateHelper->clear(TOKEN_TYPE_INSERT_POST);
|
||||||
|
@ -1169,7 +1169,7 @@ void GxsForumThreadWidget::insertPost()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
mStateHelper->setWidgetEnabled(ui->newmessageButton, (IS_GROUP_SUBSCRIBED(mSubscribeFlags) && mThreadId.empty() == false));
|
mStateHelper->setWidgetEnabled(ui->newmessageButton, (IS_GROUP_SUBSCRIBED(mSubscribeFlags) && mThreadId.isNull() == false));
|
||||||
|
|
||||||
/* blank text, incase we get nothing */
|
/* blank text, incase we get nothing */
|
||||||
ui->postText->clear();
|
ui->postText->clear();
|
||||||
|
@ -1227,7 +1227,8 @@ void GxsForumThreadWidget::insertPostData(const RsGxsForumMsg &msg)
|
||||||
|
|
||||||
ui->time_label->setText(DateTime::formatLongDateTime(msg.mMeta.mPublishTs));
|
ui->time_label->setText(DateTime::formatLongDateTime(msg.mMeta.mPublishTs));
|
||||||
|
|
||||||
std::string authorName = rsPeers->getPeerName(msg.mMeta.mAuthorId);
|
std::string authorName;
|
||||||
|
//= rsPeers->getPeerName(msg.mMeta.mAuthorId);
|
||||||
QString text = QString::fromUtf8(authorName.c_str());
|
QString text = QString::fromUtf8(authorName.c_str());
|
||||||
|
|
||||||
if (text.isEmpty())
|
if (text.isEmpty())
|
||||||
|
@ -1424,7 +1425,7 @@ void GxsForumThreadWidget::setMsgReadStatus(QList<QTreeWidgetItem*> &rows, bool
|
||||||
|
|
||||||
void GxsForumThreadWidget::markMsgAsReadUnread (bool read, bool children, bool forum)
|
void GxsForumThreadWidget::markMsgAsReadUnread (bool read, bool children, bool forum)
|
||||||
{
|
{
|
||||||
if (mForumId.empty() || !IS_GROUP_SUBSCRIBED(mSubscribeFlags)) {
|
if (mForumId.isNull() || !IS_GROUP_SUBSCRIBED(mSubscribeFlags)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1499,7 +1500,7 @@ void GxsForumThreadWidget::setAllMsgReadStatus(bool read)
|
||||||
|
|
||||||
void GxsForumThreadWidget::copyMessageLink()
|
void GxsForumThreadWidget::copyMessageLink()
|
||||||
{
|
{
|
||||||
if (mForumId.empty() || mThreadId.empty()) {
|
if (mForumId.isNull() || mThreadId.isNull()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1524,7 +1525,7 @@ void GxsForumThreadWidget::copyMessageLink()
|
||||||
|
|
||||||
void GxsForumThreadWidget::createmessage()
|
void GxsForumThreadWidget::createmessage()
|
||||||
{
|
{
|
||||||
if (mForumId.empty () || !IS_GROUP_SUBSCRIBED(mSubscribeFlags)) {
|
if (mForumId.isNull () || !IS_GROUP_SUBSCRIBED(mSubscribeFlags)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1536,12 +1537,12 @@ void GxsForumThreadWidget::createmessage()
|
||||||
|
|
||||||
void GxsForumThreadWidget::createthread()
|
void GxsForumThreadWidget::createthread()
|
||||||
{
|
{
|
||||||
if (mForumId.empty ()) {
|
if (mForumId.isNull ()) {
|
||||||
QMessageBox::information(this, tr("RetroShare"), tr("No Forum Selected!"));
|
QMessageBox::information(this, tr("RetroShare"), tr("No Forum Selected!"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
CreateGxsForumMsg *cfm = new CreateGxsForumMsg(mForumId, "");
|
CreateGxsForumMsg *cfm = new CreateGxsForumMsg(mForumId, RsGxsMessageId());
|
||||||
cfm->show();
|
cfm->show();
|
||||||
|
|
||||||
/* window will destroy itself! */
|
/* window will destroy itself! */
|
||||||
|
@ -1550,7 +1551,7 @@ void GxsForumThreadWidget::createthread()
|
||||||
static QString buildReplyHeader(const RsMsgMetaData &meta)
|
static QString buildReplyHeader(const RsMsgMetaData &meta)
|
||||||
{
|
{
|
||||||
RetroShareLink link;
|
RetroShareLink link;
|
||||||
link.createMessage(meta.mAuthorId, "");
|
//link.createMessage(meta.mAuthorId, "");
|
||||||
QString from = link.toHtml();
|
QString from = link.toHtml();
|
||||||
|
|
||||||
QString header = QString("<span>-----%1-----").arg(QApplication::translate("GxsForumsDialog", "Original Message"));
|
QString header = QString("<span>-----%1-----").arg(QApplication::translate("GxsForumsDialog", "Original Message"));
|
||||||
|
@ -1567,7 +1568,7 @@ static QString buildReplyHeader(const RsMsgMetaData &meta)
|
||||||
|
|
||||||
void GxsForumThreadWidget::replytomessage()
|
void GxsForumThreadWidget::replytomessage()
|
||||||
{
|
{
|
||||||
if (mForumId.empty() || mThreadId.empty()) {
|
if (mForumId.isNull() || mThreadId.isNull()) {
|
||||||
QMessageBox::information(this, tr("RetroShare"),tr("You cant reply to a non-existant Message"));
|
QMessageBox::information(this, tr("RetroShare"),tr("You cant reply to a non-existant Message"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1587,14 +1588,14 @@ void GxsForumThreadWidget::replyMessageData(const RsGxsForumMsg &msg)
|
||||||
}
|
}
|
||||||
|
|
||||||
// NB: TODO REMOVE rsPeers references.
|
// NB: TODO REMOVE rsPeers references.
|
||||||
if (rsPeers->getPeerName(msg.mMeta.mAuthorId) !="")
|
if (rsPeers->getPeerName(RsPeerId(msg.mMeta.mAuthorId)) !="")
|
||||||
{
|
{
|
||||||
MessageComposer *msgDialog = MessageComposer::newMsg();
|
MessageComposer *msgDialog = MessageComposer::newMsg();
|
||||||
msgDialog->setTitleText(QString::fromUtf8(msg.mMeta.mMsgName.c_str()), MessageComposer::REPLY);
|
msgDialog->setTitleText(QString::fromUtf8(msg.mMeta.mMsgName.c_str()), MessageComposer::REPLY);
|
||||||
|
|
||||||
msgDialog->setQuotedMsg(QString::fromUtf8(msg.mMsg.c_str()), buildReplyHeader(msg.mMeta));
|
msgDialog->setQuotedMsg(QString::fromUtf8(msg.mMsg.c_str()), buildReplyHeader(msg.mMeta));
|
||||||
|
|
||||||
msgDialog->addRecipient(MessageComposer::TO, msg.mMeta.mAuthorId, false);
|
//msgDialog->addRecipient(MessageComposer::TO, msg.mMeta.mAuthorId, false);
|
||||||
msgDialog->show();
|
msgDialog->show();
|
||||||
msgDialog->activateWindow();
|
msgDialog->activateWindow();
|
||||||
|
|
||||||
|
@ -1678,7 +1679,7 @@ bool GxsForumThreadWidget::filterItem(QTreeWidgetItem *item, const QString &text
|
||||||
/** Request / Response of Data ********************************/
|
/** Request / Response of Data ********************************/
|
||||||
/*********************** **** **** **** ***********************/
|
/*********************** **** **** **** ***********************/
|
||||||
|
|
||||||
void GxsForumThreadWidget::requestGroupSummary_CurrentForum(const std::string &forumId)
|
void GxsForumThreadWidget::requestGroupSummary_CurrentForum(const RsGxsGroupId &forumId)
|
||||||
{
|
{
|
||||||
ui->progressBar->reset();
|
ui->progressBar->reset();
|
||||||
mStateHelper->setLoading(TOKEN_TYPE_CURRENTFORUM, true);
|
mStateHelper->setLoading(TOKEN_TYPE_CURRENTFORUM, true);
|
||||||
|
@ -1690,7 +1691,7 @@ void GxsForumThreadWidget::requestGroupSummary_CurrentForum(const std::string &f
|
||||||
|
|
||||||
mThreadQueue->cancelActiveRequestTokens(TOKEN_TYPE_CURRENTFORUM);
|
mThreadQueue->cancelActiveRequestTokens(TOKEN_TYPE_CURRENTFORUM);
|
||||||
|
|
||||||
std::list<std::string> grpIds;
|
std::list<RsGxsGroupId> grpIds;
|
||||||
grpIds.push_back(forumId);
|
grpIds.push_back(forumId);
|
||||||
|
|
||||||
std::cerr << "GxsForumsDialog::requestGroupSummary_CurrentForum(" << forumId << ")";
|
std::cerr << "GxsForumsDialog::requestGroupSummary_CurrentForum(" << forumId << ")";
|
||||||
|
|
|
@ -25,7 +25,7 @@ class GxsForumThreadWidget : public RsGxsUpdateBroadcastWidget, public TokenResp
|
||||||
Q_PROPERTY(QColor textColorMissing READ textColorMissing WRITE setTextColorMissing)
|
Q_PROPERTY(QColor textColorMissing READ textColorMissing WRITE setTextColorMissing)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit GxsForumThreadWidget(const std::string &forumId, QWidget *parent = NULL);
|
explicit GxsForumThreadWidget(const RsGxsGroupId &forumId, QWidget *parent = NULL);
|
||||||
~GxsForumThreadWidget();
|
~GxsForumThreadWidget();
|
||||||
|
|
||||||
QColor textColorRead() const { return mTextColorRead; }
|
QColor textColorRead() const { return mTextColorRead; }
|
||||||
|
@ -40,15 +40,15 @@ public:
|
||||||
void setTextColorNotSubscribed(QColor color) { mTextColorNotSubscribed = color; }
|
void setTextColorNotSubscribed(QColor color) { mTextColorNotSubscribed = color; }
|
||||||
void setTextColorMissing(QColor color) { mTextColorMissing = color; }
|
void setTextColorMissing(QColor color) { mTextColorMissing = color; }
|
||||||
|
|
||||||
std::string forumId() { return mForumId; }
|
RsGxsGroupId forumId() { return mForumId; }
|
||||||
void setForumId(const std::string &forumId);
|
void setForumId(const RsGxsGroupId &forumId);
|
||||||
QString forumName(bool withUnreadCount);
|
QString forumName(bool withUnreadCount);
|
||||||
QIcon forumIcon();
|
QIcon forumIcon();
|
||||||
unsigned int newCount() { return mNewCount; }
|
unsigned int newCount() { return mNewCount; }
|
||||||
unsigned int unreadCount() { return mUnreadCount; }
|
unsigned int unreadCount() { return mUnreadCount; }
|
||||||
|
|
||||||
QTreeWidgetItem *convertMsgToThreadWidget(const RsGxsForumMsg &msg, bool useChildTS, uint32_t filterColumn);
|
QTreeWidgetItem *convertMsgToThreadWidget(const RsGxsForumMsg &msg, bool useChildTS, uint32_t filterColumn);
|
||||||
QTreeWidgetItem *generateMissingItem(const std::string &msgId);
|
QTreeWidgetItem *generateMissingItem(const RsGxsMessageId &msgId);
|
||||||
|
|
||||||
void setAllMsgReadStatus(bool read);
|
void setAllMsgReadStatus(bool read);
|
||||||
|
|
||||||
|
@ -129,9 +129,9 @@ private:
|
||||||
|
|
||||||
void processSettings(bool bLoad);
|
void processSettings(bool bLoad);
|
||||||
|
|
||||||
std::string mForumId;
|
RsGxsGroupId mForumId;
|
||||||
std::string mLastForumID;
|
RsGxsGroupId mLastForumID;
|
||||||
std::string mThreadId;
|
RsGxsMessageId mThreadId;
|
||||||
QString mForumDescription;
|
QString mForumDescription;
|
||||||
int mSubscribeFlags;
|
int mSubscribeFlags;
|
||||||
bool mInProcessSettings;
|
bool mInProcessSettings;
|
||||||
|
@ -143,7 +143,7 @@ private:
|
||||||
unsigned int mUnreadCount;
|
unsigned int mUnreadCount;
|
||||||
unsigned int mNewCount;
|
unsigned int mNewCount;
|
||||||
|
|
||||||
void requestGroupSummary_CurrentForum(const std::string &forumId);
|
void requestGroupSummary_CurrentForum(const RsGxsGroupId &forumId);
|
||||||
void loadGroupSummary_CurrentForum(const uint32_t &token);
|
void loadGroupSummary_CurrentForum(const uint32_t &token);
|
||||||
|
|
||||||
void requestMsgData_InsertPost(const RsGxsGrpMsgIdPair &msgId);
|
void requestMsgData_InsertPost(const RsGxsGrpMsgIdPair &msgId);
|
||||||
|
|
|
@ -172,7 +172,7 @@ void GxsForumsDialog::settingsChanged()
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!mThreadWidget) {
|
if (!mThreadWidget) {
|
||||||
mThreadWidget = createThreadWidget("");
|
mThreadWidget = createThreadWidget(RsGxsGroupId());
|
||||||
// remove close button of the the first tab
|
// remove close button of the the first tab
|
||||||
ui.threadTabWidget->hideCloseButton(ui.threadTabWidget->indexOf(mThreadWidget));
|
ui.threadTabWidget->hideCloseButton(ui.threadTabWidget->indexOf(mThreadWidget));
|
||||||
}
|
}
|
||||||
|
@ -181,7 +181,7 @@ void GxsForumsDialog::settingsChanged()
|
||||||
|
|
||||||
void GxsForumsDialog::forumListCustomPopupMenu(QPoint /*point*/)
|
void GxsForumsDialog::forumListCustomPopupMenu(QPoint /*point*/)
|
||||||
{
|
{
|
||||||
int subscribeFlags = ui.forumTreeWidget->subscribeFlags(QString::fromStdString(mForumId));
|
int subscribeFlags = ui.forumTreeWidget->subscribeFlags(QString::fromStdString(mForumId.toStdString()));
|
||||||
|
|
||||||
QMenu contextMnu(this);
|
QMenu contextMnu(this);
|
||||||
|
|
||||||
|
@ -200,14 +200,14 @@ void GxsForumsDialog::forumListCustomPopupMenu(QPoint /*point*/)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
QAction *action = contextMnu.addAction(QIcon(IMAGE_SUBSCRIBE), tr("Subscribe to Forum"), this, SLOT(subscribeToForum()));
|
QAction *action = contextMnu.addAction(QIcon(IMAGE_SUBSCRIBE), tr("Subscribe to Forum"), this, SLOT(subscribeToForum()));
|
||||||
action->setDisabled (mForumId.empty() || IS_GROUP_SUBSCRIBED(subscribeFlags));
|
action->setDisabled (mForumId.isNull() || IS_GROUP_SUBSCRIBED(subscribeFlags));
|
||||||
|
|
||||||
action = contextMnu.addAction(QIcon(IMAGE_UNSUBSCRIBE), tr("Unsubscribe to Forum"), this, SLOT(unsubscribeToForum()));
|
action = contextMnu.addAction(QIcon(IMAGE_UNSUBSCRIBE), tr("Unsubscribe to Forum"), this, SLOT(unsubscribeToForum()));
|
||||||
action->setEnabled (!mForumId.empty() && IS_GROUP_SUBSCRIBED(subscribeFlags));
|
action->setEnabled (!mForumId.isNull() && IS_GROUP_SUBSCRIBED(subscribeFlags));
|
||||||
|
|
||||||
if (!Settings->getForumOpenAllInNewTab()) {
|
if (!Settings->getForumOpenAllInNewTab()) {
|
||||||
action = contextMnu.addAction(QIcon(""), tr("Open in new tab"), this, SLOT(openInNewTab()));
|
action = contextMnu.addAction(QIcon(""), tr("Open in new tab"), this, SLOT(openInNewTab()));
|
||||||
if (mForumId.empty() || forumThreadWidget(mForumId)) {
|
if (mForumId.isNull() || forumThreadWidget(mForumId)) {
|
||||||
action->setEnabled(false);
|
action->setEnabled(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -217,31 +217,31 @@ void GxsForumsDialog::forumListCustomPopupMenu(QPoint /*point*/)
|
||||||
contextMnu.addAction(QIcon(IMAGE_NEWFORUM), tr("New Forum"), this, SLOT(newforum()));
|
contextMnu.addAction(QIcon(IMAGE_NEWFORUM), tr("New Forum"), this, SLOT(newforum()));
|
||||||
|
|
||||||
action = contextMnu.addAction(QIcon(IMAGE_INFO), tr("Show Forum Details"), this, SLOT(showForumDetails()));
|
action = contextMnu.addAction(QIcon(IMAGE_INFO), tr("Show Forum Details"), this, SLOT(showForumDetails()));
|
||||||
action->setEnabled (!mForumId.empty ());
|
action->setEnabled (!mForumId.isNull());
|
||||||
|
|
||||||
action = contextMnu.addAction(QIcon(":/images/settings16.png"), tr("Edit Forum Details"), this, SLOT(editForumDetails()));
|
action = contextMnu.addAction(QIcon(":/images/settings16.png"), tr("Edit Forum Details"), this, SLOT(editForumDetails()));
|
||||||
action->setEnabled (!mForumId.empty () && IS_GROUP_ADMIN(subscribeFlags));
|
action->setEnabled (!mForumId.isNull() && IS_GROUP_ADMIN(subscribeFlags));
|
||||||
|
|
||||||
QAction *shareKeyAct = new QAction(QIcon(":/images/gpgp_key_generate.png"), tr("Share Forum"), &contextMnu);
|
QAction *shareKeyAct = new QAction(QIcon(":/images/gpgp_key_generate.png"), tr("Share Forum"), &contextMnu);
|
||||||
connect( shareKeyAct, SIGNAL( triggered() ), this, SLOT( shareKey() ) );
|
connect( shareKeyAct, SIGNAL( triggered() ), this, SLOT( shareKey() ) );
|
||||||
shareKeyAct->setEnabled(!mForumId.empty() && IS_GROUP_ADMIN(subscribeFlags));
|
shareKeyAct->setEnabled(!mForumId.isNull() && IS_GROUP_ADMIN(subscribeFlags));
|
||||||
contextMnu.addAction( shareKeyAct);
|
contextMnu.addAction( shareKeyAct);
|
||||||
|
|
||||||
QAction *restoreKeysAct = new QAction(QIcon(":/images/settings16.png"), tr("Restore Publish Rights for Forum" ), &contextMnu);
|
QAction *restoreKeysAct = new QAction(QIcon(":/images/settings16.png"), tr("Restore Publish Rights for Forum" ), &contextMnu);
|
||||||
connect( restoreKeysAct , SIGNAL( triggered() ), this, SLOT( restoreForumKeys() ) );
|
connect( restoreKeysAct , SIGNAL( triggered() ), this, SLOT( restoreForumKeys() ) );
|
||||||
restoreKeysAct->setEnabled(!mForumId.empty() && !IS_GROUP_ADMIN(subscribeFlags));
|
restoreKeysAct->setEnabled(!mForumId.isNull() && !IS_GROUP_ADMIN(subscribeFlags));
|
||||||
contextMnu.addAction( restoreKeysAct);
|
contextMnu.addAction( restoreKeysAct);
|
||||||
|
|
||||||
action = contextMnu.addAction(QIcon(IMAGE_COPYLINK), tr("Copy RetroShare Link"), this, SLOT(copyForumLink()));
|
action = contextMnu.addAction(QIcon(IMAGE_COPYLINK), tr("Copy RetroShare Link"), this, SLOT(copyForumLink()));
|
||||||
action->setEnabled(!mForumId.empty());
|
action->setEnabled(!mForumId.isNull());
|
||||||
|
|
||||||
contextMnu.addSeparator();
|
contextMnu.addSeparator();
|
||||||
|
|
||||||
action = contextMnu.addAction(QIcon(":/images/message-mail-read.png"), tr("Mark all as read"), this, SLOT(markMsgAsRead()));
|
action = contextMnu.addAction(QIcon(":/images/message-mail-read.png"), tr("Mark all as read"), this, SLOT(markMsgAsRead()));
|
||||||
action->setEnabled (!mForumId.empty () && IS_GROUP_SUBSCRIBED(subscribeFlags));
|
action->setEnabled (!mForumId.isNull() && IS_GROUP_SUBSCRIBED(subscribeFlags));
|
||||||
|
|
||||||
action = contextMnu.addAction(QIcon(":/images/message-mail.png"), tr("Mark all as unread"), this, SLOT(markMsgAsUnread()));
|
action = contextMnu.addAction(QIcon(":/images/message-mail.png"), tr("Mark all as unread"), this, SLOT(markMsgAsUnread()));
|
||||||
action->setEnabled (!mForumId.empty () && IS_GROUP_SUBSCRIBED(subscribeFlags));
|
action->setEnabled (!mForumId.isNull() && IS_GROUP_SUBSCRIBED(subscribeFlags));
|
||||||
|
|
||||||
contextMnu.exec(QCursor::pos());
|
contextMnu.exec(QCursor::pos());
|
||||||
}
|
}
|
||||||
|
@ -265,7 +265,7 @@ void GxsForumsDialog::updateDisplay(bool complete)
|
||||||
|
|
||||||
void GxsForumsDialog::forumInfoToGroupItemInfo(const RsGroupMetaData &forumInfo, GroupItemInfo &groupItemInfo)
|
void GxsForumsDialog::forumInfoToGroupItemInfo(const RsGroupMetaData &forumInfo, GroupItemInfo &groupItemInfo)
|
||||||
{
|
{
|
||||||
groupItemInfo.id = QString::fromStdString(forumInfo.mGroupId);
|
groupItemInfo.id = QString::fromStdString(forumInfo.mGroupId.toStdString());
|
||||||
groupItemInfo.name = QString::fromUtf8(forumInfo.mGroupName.c_str());
|
groupItemInfo.name = QString::fromUtf8(forumInfo.mGroupName.c_str());
|
||||||
//groupItemInfo.description = QString::fromUtf8(forumInfo.forumDesc);
|
//groupItemInfo.description = QString::fromUtf8(forumInfo.forumDesc);
|
||||||
groupItemInfo.popularity = forumInfo.mPop;
|
groupItemInfo.popularity = forumInfo.mPop;
|
||||||
|
@ -350,10 +350,10 @@ void GxsForumsDialog::insertForumsData(const std::list<RsGroupMetaData> &forumLi
|
||||||
ui.forumTreeWidget->fillGroupItems(popularForums, popList);
|
ui.forumTreeWidget->fillGroupItems(popularForums, popList);
|
||||||
ui.forumTreeWidget->fillGroupItems(otherForums, otherList);
|
ui.forumTreeWidget->fillGroupItems(otherForums, otherList);
|
||||||
|
|
||||||
updateMessageSummaryList("");
|
updateMessageSummaryList(RsGxsGroupId());
|
||||||
}
|
}
|
||||||
|
|
||||||
GxsForumThreadWidget *GxsForumsDialog::forumThreadWidget(const std::string &forumId)
|
GxsForumThreadWidget *GxsForumsDialog::forumThreadWidget(const RsGxsGroupId &forumId)
|
||||||
{
|
{
|
||||||
int tabCount = ui.threadTabWidget->count();
|
int tabCount = ui.threadTabWidget->count();
|
||||||
for (int index = 0; index < tabCount; ++index) {
|
for (int index = 0; index < tabCount; ++index) {
|
||||||
|
@ -370,7 +370,7 @@ GxsForumThreadWidget *GxsForumsDialog::forumThreadWidget(const std::string &foru
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
GxsForumThreadWidget *GxsForumsDialog::createThreadWidget(const std::string &forumId)
|
GxsForumThreadWidget *GxsForumsDialog::createThreadWidget(const RsGxsGroupId &forumId)
|
||||||
{
|
{
|
||||||
GxsForumThreadWidget *threadWidget = new GxsForumThreadWidget(forumId);
|
GxsForumThreadWidget *threadWidget = new GxsForumThreadWidget(forumId);
|
||||||
int index = ui.threadTabWidget->addTab(threadWidget, threadWidget->forumName(true));
|
int index = ui.threadTabWidget->addTab(threadWidget, threadWidget->forumName(true));
|
||||||
|
@ -383,14 +383,14 @@ GxsForumThreadWidget *GxsForumsDialog::createThreadWidget(const std::string &for
|
||||||
void GxsForumsDialog::changedForum(const QString &forumId)
|
void GxsForumsDialog::changedForum(const QString &forumId)
|
||||||
{
|
{
|
||||||
mForumId = forumId.toStdString();
|
mForumId = forumId.toStdString();
|
||||||
if (mForumId.empty()) {
|
if (mForumId.isNull()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// requestGroupSummary_CurrentForum(mForumId);
|
// requestGroupSummary_CurrentForum(mForumId);
|
||||||
|
|
||||||
/* search exisiting tab */
|
/* search exisiting tab */
|
||||||
GxsForumThreadWidget *threadWidget = forumThreadWidget(mForumId);
|
GxsForumThreadWidget *threadWidget = forumThreadWidget(mForumId);
|
||||||
|
|
||||||
if (!threadWidget) {
|
if (!threadWidget) {
|
||||||
if (mThreadWidget) {
|
if (mThreadWidget) {
|
||||||
|
@ -399,7 +399,7 @@ void GxsForumsDialog::changedForum(const QString &forumId)
|
||||||
threadWidget->setForumId(mForumId);
|
threadWidget->setForumId(mForumId);
|
||||||
} else {
|
} else {
|
||||||
/* create new tab */
|
/* create new tab */
|
||||||
threadWidget = createThreadWidget(mForumId);
|
threadWidget = createThreadWidget(mForumId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -408,7 +408,7 @@ void GxsForumsDialog::changedForum(const QString &forumId)
|
||||||
|
|
||||||
void GxsForumsDialog::forumTreeMiddleButtonClicked(QTreeWidgetItem *item)
|
void GxsForumsDialog::forumTreeMiddleButtonClicked(QTreeWidgetItem *item)
|
||||||
{
|
{
|
||||||
openForumInNewTab(ui.forumTreeWidget->itemId(item).toStdString());
|
openForumInNewTab(RsGxsGroupId(ui.forumTreeWidget->itemId(item).toStdString()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void GxsForumsDialog::openInNewTab()
|
void GxsForumsDialog::openInNewTab()
|
||||||
|
@ -416,9 +416,9 @@ void GxsForumsDialog::openInNewTab()
|
||||||
openForumInNewTab(mForumId);
|
openForumInNewTab(mForumId);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GxsForumsDialog::openForumInNewTab(const std::string &forumId)
|
void GxsForumsDialog::openForumInNewTab(const RsGxsGroupId &forumId)
|
||||||
{
|
{
|
||||||
if (forumId.empty()) {
|
if (forumId.isNull()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -453,7 +453,7 @@ void GxsForumsDialog::threadTabChanged(int index)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ui.forumTreeWidget->activateId(QString::fromStdString(threadWidget->forumId()), false);
|
ui.forumTreeWidget->activateId(QString::fromStdString(threadWidget->forumId().toStdString()), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GxsForumsDialog::threadTabInfoChanged(QWidget *widget)
|
void GxsForumsDialog::threadTabInfoChanged(QWidget *widget)
|
||||||
|
@ -474,7 +474,7 @@ void GxsForumsDialog::threadTabInfoChanged(QWidget *widget)
|
||||||
|
|
||||||
void GxsForumsDialog::copyForumLink()
|
void GxsForumsDialog::copyForumLink()
|
||||||
{
|
{
|
||||||
if (mForumId.empty()) {
|
if (mForumId.isNull()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -531,7 +531,7 @@ void GxsForumsDialog::unsubscribeToForum()
|
||||||
|
|
||||||
void GxsForumsDialog::forumSubscribe(bool subscribe)
|
void GxsForumsDialog::forumSubscribe(bool subscribe)
|
||||||
{
|
{
|
||||||
if (mForumId.empty()) {
|
if (mForumId.isNull()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -542,7 +542,7 @@ void GxsForumsDialog::forumSubscribe(bool subscribe)
|
||||||
|
|
||||||
void GxsForumsDialog::showForumDetails()
|
void GxsForumsDialog::showForumDetails()
|
||||||
{
|
{
|
||||||
if (mForumId.empty()) {
|
if (mForumId.isNull()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -552,7 +552,7 @@ void GxsForumsDialog::showForumDetails()
|
||||||
|
|
||||||
void GxsForumsDialog::editForumDetails()
|
void GxsForumsDialog::editForumDetails()
|
||||||
{
|
{
|
||||||
if (mForumId.empty()) {
|
if (mForumId.isNull()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -565,11 +565,11 @@ void GxsForumsDialog::editForumDetails()
|
||||||
|
|
||||||
void GxsForumsDialog::shareKey()
|
void GxsForumsDialog::shareKey()
|
||||||
{
|
{
|
||||||
ShareKey shareUi(this, mForumId, FORUM_KEY_SHARE);
|
ShareKey shareUi(this, mForumId.toStdString(), FORUM_KEY_SHARE);
|
||||||
shareUi.exec();
|
shareUi.exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GxsForumsDialog::updateMessageSummaryList(std::string forumId)
|
void GxsForumsDialog::updateMessageSummaryList( RsGxsGroupId forumId)
|
||||||
{
|
{
|
||||||
QTreeWidgetItem *items[2] = { yourForums, subscribedForums };
|
QTreeWidgetItem *items[2] = { yourForums, subscribedForums };
|
||||||
|
|
||||||
|
@ -583,7 +583,7 @@ void GxsForumsDialog::updateMessageSummaryList(std::string forumId)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (forumId.empty() || childId == forumId) {
|
if (forumId.isNull() || childId == forumId.toStdString()) {
|
||||||
/* calculate unread messages */
|
/* calculate unread messages */
|
||||||
unsigned int newMessageCount = 0;
|
unsigned int newMessageCount = 0;
|
||||||
unsigned int unreadMessageCount = 0;
|
unsigned int unreadMessageCount = 0;
|
||||||
|
@ -595,7 +595,7 @@ void GxsForumsDialog::updateMessageSummaryList(std::string forumId)
|
||||||
|
|
||||||
ui.forumTreeWidget->setUnreadCount(childItem, unreadMessageCount);
|
ui.forumTreeWidget->setUnreadCount(childItem, unreadMessageCount);
|
||||||
|
|
||||||
if (forumId.empty() == false) {
|
if (forumId.isNull() == false) {
|
||||||
/* Calculate only this forum */
|
/* Calculate only this forum */
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -604,13 +604,13 @@ void GxsForumsDialog::updateMessageSummaryList(std::string forumId)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GxsForumsDialog::navigate(const std::string& forumId, const std::string& msgId)
|
bool GxsForumsDialog::navigate(const RsGxsGroupId forumId, const std::string& msgId)
|
||||||
{
|
{
|
||||||
if (forumId.empty()) {
|
if (forumId.isNull()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ui.forumTreeWidget->activateId(QString::fromStdString(forumId), msgId.empty()) == NULL) {
|
if (ui.forumTreeWidget->activateId(QString::fromStdString(forumId.toStdString()), msgId.empty()) == NULL) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -718,7 +718,7 @@ void GxsForumsDialog::acknowledgeSubscribeChange(const uint32_t &token)
|
||||||
/*********************** **** **** **** ***********************/
|
/*********************** **** **** **** ***********************/
|
||||||
/*********************** **** **** **** ***********************/
|
/*********************** **** **** **** ***********************/
|
||||||
|
|
||||||
//void GxsForumsDialog::requestGroupSummary_CurrentForum(const std::string &forumId)
|
//void GxsForumsDialog::requestGroupSummary_CurrentForum(const RsGxsGroupId &forumId)
|
||||||
//{
|
//{
|
||||||
// RsTokReqOptions opts;
|
// RsTokReqOptions opts;
|
||||||
// opts.mReqType = GXS_REQUEST_TYPE_GROUP_META;
|
// opts.mReqType = GXS_REQUEST_TYPE_GROUP_META;
|
||||||
|
|
|
@ -49,7 +49,7 @@ public:
|
||||||
|
|
||||||
// virtual UserNotify *getUserNotify(QObject *parent);
|
// virtual UserNotify *getUserNotify(QObject *parent);
|
||||||
|
|
||||||
bool navigate(const std::string& forumId, const std::string& msgId);
|
bool navigate(const RsGxsGroupId forumId, const std::string& msgId);
|
||||||
|
|
||||||
// Callback for all Loads.
|
// Callback for all Loads.
|
||||||
virtual void loadRequest(const TokenQueue *queue, const TokenRequest &req);
|
virtual void loadRequest(const TokenQueue *queue, const TokenRequest &req);
|
||||||
|
@ -90,11 +90,11 @@ private slots:
|
||||||
private:
|
private:
|
||||||
void insertForums();
|
void insertForums();
|
||||||
|
|
||||||
void updateMessageSummaryList(std::string forumId);
|
void updateMessageSummaryList( RsGxsGroupId forumId);
|
||||||
// void forumInfoToGroupItemInfo(const ForumInfo &forumInfo, GroupItemInfo &groupItemInfo);
|
// void forumInfoToGroupItemInfo(const ForumInfo &forumInfo, GroupItemInfo &groupItemInfo);
|
||||||
void forumInfoToGroupItemInfo(const RsGroupMetaData &forumInfo, GroupItemInfo &groupItemInfo);
|
void forumInfoToGroupItemInfo(const RsGroupMetaData &forumInfo, GroupItemInfo &groupItemInfo);
|
||||||
|
|
||||||
void openForumInNewTab(const std::string &forumId);
|
void openForumInNewTab(const RsGxsGroupId &forumId);
|
||||||
void forumSubscribe(bool subscribe);
|
void forumSubscribe(bool subscribe);
|
||||||
|
|
||||||
void processSettings(bool load);
|
void processSettings(bool load);
|
||||||
|
@ -108,13 +108,13 @@ private:
|
||||||
// subscribe/unsubscribe ack.
|
// subscribe/unsubscribe ack.
|
||||||
void acknowledgeSubscribeChange(const uint32_t &token);
|
void acknowledgeSubscribeChange(const uint32_t &token);
|
||||||
|
|
||||||
GxsForumThreadWidget *forumThreadWidget(const std::string &forumId);
|
GxsForumThreadWidget *forumThreadWidget(const RsGxsGroupId &forumId);
|
||||||
GxsForumThreadWidget *createThreadWidget(const std::string &forumId);
|
GxsForumThreadWidget *createThreadWidget(const RsGxsGroupId &forumId);
|
||||||
|
|
||||||
// void requestGroupSummary_CurrentForum(const std::string &forumId);
|
// void requestGroupSummary_CurrentForum(const RsGxsGroupId &forumId);
|
||||||
// void loadGroupSummary_CurrentForum(const uint32_t &token);
|
// void loadGroupSummary_CurrentForum(const uint32_t &token);
|
||||||
|
|
||||||
std::string mForumId;
|
RsGxsGroupId mForumId;
|
||||||
TokenQueue *mForumQueue;
|
TokenQueue *mForumQueue;
|
||||||
GxsForumThreadWidget *mThreadWidget;
|
GxsForumThreadWidget *mThreadWidget;
|
||||||
|
|
||||||
|
|
|
@ -101,7 +101,7 @@ void GxsForumsFillThread::run()
|
||||||
opts.mReqType = GXS_REQUEST_TYPE_MSG_DATA;
|
opts.mReqType = GXS_REQUEST_TYPE_MSG_DATA;
|
||||||
opts.mOptions = RS_TOKREQOPT_MSG_LATEST;
|
opts.mOptions = RS_TOKREQOPT_MSG_LATEST;
|
||||||
|
|
||||||
std::list<std::string> grpIds;
|
std::list<RsGxsGroupId> grpIds;
|
||||||
grpIds.push_back(mForumId);
|
grpIds.push_back(mForumId);
|
||||||
|
|
||||||
#ifdef DEBUG_FORUMS
|
#ifdef DEBUG_FORUMS
|
||||||
|
@ -169,7 +169,7 @@ void GxsForumsFillThread::run()
|
||||||
|
|
||||||
const RsGxsForumMsg &msg = *msgIt;
|
const RsGxsForumMsg &msg = *msgIt;
|
||||||
|
|
||||||
if (!msg.mMeta.mParentId.empty()) {
|
if (!msg.mMeta.mParentId.isNull()) {
|
||||||
++msgIt;
|
++msgIt;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -179,7 +179,7 @@ void GxsForumsFillThread::run()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
QTreeWidgetItem *item = mParent->convertMsgToThreadWidget(msg, mUseChildTS, mFilterColumn);
|
QTreeWidgetItem *item = mParent->convertMsgToThreadWidget(msg, mUseChildTS, mFilterColumn);
|
||||||
threadList.push_back(QPair<std::string, QTreeWidgetItem*>(msg.mMeta.mMsgId, item));
|
threadList.push_back(QPair<std::string, QTreeWidgetItem*>(msg.mMeta.mMsgId.toStdString(), item));
|
||||||
calculateExpand(msg, item);
|
calculateExpand(msg, item);
|
||||||
|
|
||||||
mItems.append(item);
|
mItems.append(item);
|
||||||
|
@ -209,7 +209,7 @@ void GxsForumsFillThread::run()
|
||||||
for (msgIt = msgs.begin(); msgIt != msgs.end(); ) {
|
for (msgIt = msgs.begin(); msgIt != msgs.end(); ) {
|
||||||
const RsGxsForumMsg &msg = *msgIt;
|
const RsGxsForumMsg &msg = *msgIt;
|
||||||
|
|
||||||
if (msg.mMeta.mParentId != threadPair.first) {
|
if (msg.mMeta.mParentId.toStdString() != threadPair.first) {
|
||||||
++msgIt;
|
++msgIt;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -228,7 +228,7 @@ void GxsForumsFillThread::run()
|
||||||
calculateExpand(msg, item);
|
calculateExpand(msg, item);
|
||||||
|
|
||||||
/* add item to process list */
|
/* add item to process list */
|
||||||
threadList.push_back(QPair<std::string, QTreeWidgetItem*>(msg.mMeta.mMsgId, item));
|
threadList.push_back(QPair<std::string, QTreeWidgetItem*>(msg.mMeta.mMsgId.toStdString(), item));
|
||||||
|
|
||||||
if (++step >= steps) {
|
if (++step >= steps) {
|
||||||
step = 0;
|
step = 0;
|
||||||
|
@ -275,7 +275,7 @@ void GxsForumsFillThread::run()
|
||||||
|
|
||||||
/* add dummy item */
|
/* add dummy item */
|
||||||
QTreeWidgetItem *item = mParent->generateMissingItem(msg.mMeta.mParentId);
|
QTreeWidgetItem *item = mParent->generateMissingItem(msg.mMeta.mParentId);
|
||||||
threadList.push_back(QPair<std::string, QTreeWidgetItem*>(msg.mMeta.mParentId, item));
|
threadList.push_back(QPair<std::string, QTreeWidgetItem*>(msg.mMeta.mParentId.toStdString(), item));
|
||||||
|
|
||||||
mItems.append(item);
|
mItems.append(item);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
#define GXSFORUMSFILLTHREAD_H
|
#define GXSFORUMSFILLTHREAD_H
|
||||||
|
|
||||||
#include <QThread>
|
#include <QThread>
|
||||||
|
#include "retroshare/rsgxsifacetypes.h"
|
||||||
|
|
||||||
class GxsForumThreadWidget;
|
class GxsForumThreadWidget;
|
||||||
class RsGxsForumMsg;
|
class RsGxsForumMsg;
|
||||||
|
@ -25,7 +26,7 @@ signals:
|
||||||
void status(QString text);
|
void status(QString text);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
std::string mForumId;
|
RsGxsGroupId mForumId;
|
||||||
int mFilterColumn;
|
int mFilterColumn;
|
||||||
int mSubscribeFlags;
|
int mSubscribeFlags;
|
||||||
bool mFillComplete;
|
bool mFillComplete;
|
||||||
|
|
|
@ -112,23 +112,23 @@ ApplicationWindow::ApplicationWindow(QWidget* parent, Qt::WindowFlags flags)
|
||||||
createPageAction(QIcon(IMAGE_PHOTO), tr("Photos"), grp));
|
createPageAction(QIcon(IMAGE_PHOTO), tr("Photos"), grp));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
PostedDialog *postedDialog = NULL;
|
// PostedDialog *postedDialog = NULL;
|
||||||
ui.stackPages->add(postedDialog = new PostedDialog(ui.stackPages),
|
// ui.stackPages->add(postedDialog = new PostedDialog(ui.stackPages),
|
||||||
createPageAction(QIcon(IMAGE_POSTED), tr("Posted Links"), grp));
|
// createPageAction(QIcon(IMAGE_POSTED), tr("Posted Links"), grp));
|
||||||
postedDialog->setup();
|
// postedDialog->setup();
|
||||||
|
//
|
||||||
WikiDialog *wikiDialog = NULL;
|
// WikiDialog *wikiDialog = NULL;
|
||||||
ui.stackPages->add(wikiDialog = new WikiDialog(ui.stackPages),
|
// ui.stackPages->add(wikiDialog = new WikiDialog(ui.stackPages),
|
||||||
createPageAction(QIcon(IMAGE_WIKI), tr("Wiki Pages"), grp));
|
// createPageAction(QIcon(IMAGE_WIKI), tr("Wiki Pages"), grp));
|
||||||
|
//
|
||||||
GxsForumsDialog *gxsforumsDialog = NULL;
|
GxsForumsDialog *gxsforumsDialog = NULL;
|
||||||
ui.stackPages->add(gxsforumsDialog = new GxsForumsDialog(ui.stackPages),
|
ui.stackPages->add(gxsforumsDialog = new GxsForumsDialog(ui.stackPages),
|
||||||
createPageAction(QIcon(IMAGE_GXSFORUMS), tr("GxsForums"), grp));
|
createPageAction(QIcon(IMAGE_GXSFORUMS), tr("GxsForums"), grp));
|
||||||
|
//
|
||||||
ChannelDialog *gxschannelDialog = NULL;
|
// ChannelDialog *gxschannelDialog = NULL;
|
||||||
ui.stackPages->add(gxschannelDialog = new ChannelDialog(ui.stackPages),
|
// ui.stackPages->add(gxschannelDialog = new ChannelDialog(ui.stackPages),
|
||||||
createPageAction(QIcon(IMAGE_GXSCHANNELS), tr("GxsChannels"), grp));
|
// createPageAction(QIcon(IMAGE_GXSCHANNELS), tr("GxsChannels"), grp));
|
||||||
gxschannelDialog->setup();
|
// gxschannelDialog->setup();
|
||||||
|
|
||||||
// THESE HAVE TO BE CONVERTED TO VEG FORMAT
|
// THESE HAVE TO BE CONVERTED TO VEG FORMAT
|
||||||
#if USE_VEG_SERVICE
|
#if USE_VEG_SERVICE
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue