diff --git a/libretroshare/src/crypto/chacha20.cpp b/libretroshare/src/crypto/chacha20.cpp
index 5a265b514..472cb9cd7 100644
--- a/libretroshare/src/crypto/chacha20.cpp
+++ b/libretroshare/src/crypto/chacha20.cpp
@@ -44,6 +44,12 @@
//#define DEBUG_CHACHA20
+#if OPENSSL_VERSION_NUMBER >= 0x010100000L
+ #define AEAD_chacha20_poly1305_openssl AEAD_chacha20_poly1305
+#else
+ #define AEAD_chacha20_poly1305_rs AEAD_chacha20_poly1305
+#endif
+
namespace librs {
namespace crypto {
@@ -273,6 +279,7 @@ static void quotient(const uint256_32& n,const uint256_32& p,uint256_32& q,uint2
q += m ;
}
}
+
static void remainder(const uint256_32& n,const uint256_32& p,uint256_32& r)
{
// simple algorithm: add up multiples of u while keeping below *this. Once done, substract.
@@ -356,7 +363,7 @@ static void print(const chacha20_state& s)
}
#endif
-void chacha20_encrypt(uint8_t key[32], uint32_t block_counter, uint8_t nonce[12], uint8_t *data, uint32_t size)
+void chacha20_encrypt_rs(uint8_t key[32], uint32_t block_counter, uint8_t nonce[12], uint8_t *data, uint32_t size)
{
for(uint32_t i=0;i= 0x010100000L
+void chacha20_encrypt_openssl(uint8_t key[32], uint32_t block_counter, uint8_t nonce[12], uint8_t *data, uint32_t size)
+{
+ EVP_CIPHER_CTX *ctx;
+
+ int len;
+ int tmp_len;
+ uint8_t tmp[size];
+ uint8_t iv[16];
+
+ // create iv with nonce and block counter
+ memcpy(iv, &block_counter, 4);
+ memcpy(iv + 4, nonce, 12);
+
+ /* Create and initialise the context */
+ if(!(ctx = EVP_CIPHER_CTX_new())) return;
+
+ /* Initialise the encryption operation. IMPORTANT - ensure you use a key
+ * and IV size appropriate for your cipher
+ * In this example we are using 256 bit AES (i.e. a 256 bit key). The
+ * IV size for *most* modes is the same as the block size. For AES this
+ * is 128 bits */
+ if(1 != EVP_EncryptInit_ex(ctx, EVP_chacha20(), NULL, key, iv)) goto out;
+
+ /* Provide the message to be encrypted, and obtain the encrypted output.
+ * EVP_EncryptUpdate can be called multiple times if necessary
+ */
+ if(1 != EVP_EncryptUpdate(ctx, tmp, &len, data, size)) goto out;
+ tmp_len = len;
+
+ /* Finalise the encryption. Further ciphertext bytes may be written at
+ * this stage.
+ */
+ if(1 != EVP_EncryptFinal_ex(ctx, tmp + len, &len)) goto out;
+ tmp_len += len;
+
+ memcpy(data, tmp, tmp_len);
+
+out:
+ /* Clean up */
+ EVP_CIPHER_CTX_free(ctx);
+}
+#endif
+
struct poly1305_state
{
uint256_32 r ;
@@ -475,7 +526,7 @@ bool constant_time_memory_compare(const uint8_t *m1,const uint8_t *m2,uint32_t s
return !CRYPTO_memcmp(m1,m2,size) ;
}
-bool AEAD_chacha20_poly1305(uint8_t key[32], uint8_t nonce[12],uint8_t *data,uint32_t data_size,uint8_t *aad,uint32_t aad_size,uint8_t tag[16],bool encrypt)
+bool AEAD_chacha20_poly1305_rs(uint8_t key[32], uint8_t nonce[12],uint8_t *data,uint32_t data_size,uint8_t *aad,uint32_t aad_size,uint8_t tag[16],bool encrypt)
{
// encrypt + tag. See RFC7539-2.8
@@ -492,7 +543,7 @@ bool AEAD_chacha20_poly1305(uint8_t key[32], uint8_t nonce[12],uint8_t *data,uin
if(encrypt)
{
- chacha20_encrypt(key,1,nonce,data,data_size);
+ chacha20_encrypt_rs(key,1,nonce,data,data_size);
poly1305_state pls ;
@@ -520,19 +571,107 @@ bool AEAD_chacha20_poly1305(uint8_t key[32], uint8_t nonce[12],uint8_t *data,uin
// decrypt
- chacha20_encrypt(key,1,nonce,data,data_size);
+ chacha20_encrypt_rs(key,1,nonce,data,data_size);
return constant_time_memory_compare(tag,computed_tag,16) ;
}
}
+#if OPENSSL_VERSION_NUMBER >= 0x010100000L
+#define errorOut {ret = false; goto out;}
+
+bool AEAD_chacha20_poly1305_openssl(uint8_t key[32], uint8_t nonce[12], uint8_t *data, uint32_t data_size, uint8_t *aad, uint32_t aad_size, uint8_t tag[16], bool encrypt_or_decrypt)
+{
+ EVP_CIPHER_CTX *ctx;
+
+ bool ret = true;
+ int len;
+ const uint8_t tag_len = 16;
+ int tmp_len;
+ uint8_t tmp[data_size];
+
+ /* Create and initialise the context */
+ if(!(ctx = EVP_CIPHER_CTX_new())) return false;
+
+ if (encrypt_or_decrypt) {
+ /* Initialise the encryption operation. */
+ if(1 != EVP_EncryptInit_ex(ctx, EVP_chacha20_poly1305(), NULL, NULL, NULL)) errorOut
+
+ /* Initialise key and IV */
+ if(1 != EVP_EncryptInit_ex(ctx, NULL, NULL, key, nonce)) errorOut
+
+ /* Provide any AAD data. This can be called zero or more times as
+ * required
+ */
+ if(1 != EVP_EncryptUpdate(ctx, NULL, &len, aad, aad_size)) errorOut
+
+ /* Provide the message to be encrypted, and obtain the encrypted output.
+ * EVP_EncryptUpdate can be called multiple times if necessary
+ */
+ if(1 != EVP_EncryptUpdate(ctx, tmp, &len, data, data_size)) errorOut
+ tmp_len = len;
+
+ /* Finalise the encryption. Normally ciphertext bytes may be written at
+ * this stage, but this does not occur in GCM mode
+ */
+ if(1 != EVP_EncryptFinal_ex(ctx, data + len, &len)) errorOut
+ tmp_len += len;
+
+ /* Get the tag */
+ if(1 != EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_GET_TAG, tag_len, tag)) errorOut
+ } else {
+ /* Initialise the decryption operation. */
+ if(!EVP_DecryptInit_ex(ctx, EVP_chacha20_poly1305(), NULL, key, nonce)) errorOut
+
+ /* Provide any AAD data. This can be called zero or more times as
+ * required
+ */
+ if(!EVP_DecryptUpdate(ctx, NULL, &len, aad, aad_size)) errorOut
+
+ /* Provide the message to be decrypted, and obtain the plaintext output.
+ * EVP_DecryptUpdate can be called multiple times if necessary
+ */
+ if(!EVP_DecryptUpdate(ctx, tmp, &len, data, data_size)) errorOut
+ tmp_len = len;
+
+ /* Set expected tag value. Works in OpenSSL 1.0.1d and later */
+ if(!EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_SET_TAG, tag_len, tag)) errorOut
+
+ /* Finalise the decryption. A positive return value indicates success,
+ * anything else is a failure - the plaintext is not trustworthy.
+ */
+ if(EVP_DecryptFinal_ex(ctx, tmp + len, &len) > 0) {
+ /* Success */
+ tmp_len += len;
+ ret = true;
+ } else {
+ /* Verify failed */
+ errorOut
+ }
+ }
+
+ memcpy(data, tmp, tmp_len);
+
+out:
+ /* Clean up */
+ EVP_CIPHER_CTX_free(ctx);
+ return !!ret;
+}
+
+#undef errorOut
+#endif
+
bool AEAD_chacha20_sha256(uint8_t key[32], uint8_t nonce[12],uint8_t *data,uint32_t data_size,uint8_t *aad,uint32_t aad_size,uint8_t tag[16],bool encrypt)
{
// encrypt + tag. See RFC7539-2.8
if(encrypt)
{
- chacha20_encrypt(key,1,nonce,data,data_size);
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
+ chacha20_encrypt_rs(key,1,nonce,data,data_size);
+#else
+ chacha20_encrypt_openssl(key, 1, nonce, data, data_size);
+#endif
uint8_t computed_tag[EVP_MAX_MD_SIZE];
unsigned int md_size ;
@@ -594,7 +733,11 @@ bool AEAD_chacha20_sha256(uint8_t key[32], uint8_t nonce[12],uint8_t *data,uint3
// decrypt
- chacha20_encrypt(key,1,nonce,data,data_size);
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
+ chacha20_encrypt_rs(key,1,nonce,data,data_size);
+#else
+ chacha20_encrypt_openssl(key, 1, nonce, data, data_size);
+#endif
return constant_time_memory_compare(tag,computed_tag,16) ;
}
@@ -674,7 +817,7 @@ bool perform_tests()
0x74, 0x2e
};
- chacha20_encrypt(key,1,nounce2,plaintext,7*16+2) ;
+ chacha20_encrypt_rs(key,1,nounce2,plaintext,7*16+2) ;
#ifdef DEBUG_CHACHA20
fprintf(stdout,"CipherText: \n") ;
@@ -1154,12 +1297,12 @@ bool perform_tests()
uint8_t tag[16] ;
uint8_t test_tag[16] = { 0x1a,0xe1,0x0b,0x59,0x4f,0x09,0xe2,0x6a,0x7e,0x90,0x2e,0xcb,0xd0,0x60,0x06,0x91 };
- AEAD_chacha20_poly1305(key,nonce,msg,7*16+2,aad,12,tag,true) ;
+ AEAD_chacha20_poly1305_rs(key,nonce,msg,7*16+2,aad,12,tag,true) ;
if(!constant_time_memory_compare(msg,test_msg,7*16+2)) return false ;
if(!constant_time_memory_compare(tag,test_tag,16)) return false ;
- bool res = AEAD_chacha20_poly1305(key,nonce,msg,7*16+2,aad,12,tag,false) ;
+ bool res = AEAD_chacha20_poly1305_rs(key,nonce,msg,7*16+2,aad,12,tag,false) ;
if(!res) return false ;
}
@@ -1197,7 +1340,7 @@ bool perform_tests()
uint8_t received_tag[16] = { 0xee,0xad,0x9d,0x67,0x89,0x0c,0xbb,0x22,0x39,0x23,0x36,0xfe,0xa1,0x85,0x1f,0x38 };
- if(!AEAD_chacha20_poly1305(key,nonce,ciphertext,16*16+9,aad,12,received_tag,false))
+ if(!AEAD_chacha20_poly1305_rs(key,nonce,ciphertext,16*16+9,aad,12,received_tag,false))
return false ;
uint8_t cleartext[16*16+9] = {
@@ -1243,21 +1386,29 @@ bool perform_tests()
{
RsScopeTimer s("AEAD1") ;
- chacha20_encrypt(key, 1, nonce, ten_megabyte_data,SIZE) ;
+ chacha20_encrypt_rs(key, 1, nonce, ten_megabyte_data,SIZE) ;
- std::cerr << " Chacha20 encryption speed : " << SIZE / (1024.0*1024.0) / s.duration() << " MB/s" << std::endl;
+ std::cerr << " Chacha20 encryption speed : " << SIZE / (1024.0*1024.0) / s.duration() << " MB/s" << std::endl;
}
{
RsScopeTimer s("AEAD2") ;
- AEAD_chacha20_poly1305(key,nonce,ten_megabyte_data,SIZE,aad,12,received_tag,true) ;
+ AEAD_chacha20_poly1305_rs(key,nonce,ten_megabyte_data,SIZE,aad,12,received_tag,true) ;
- std::cerr << " AEAD/poly1305 encryption speed: " << SIZE / (1024.0*1024.0) / s.duration() << " MB/s" << std::endl;
+ std::cerr << " AEAD/poly1305 own encryption speed : " << SIZE / (1024.0*1024.0) / s.duration() << " MB/s" << std::endl;
}
+#if OPENSSL_VERSION_NUMBER >= 0x010100000L
{
RsScopeTimer s("AEAD3") ;
+ AEAD_chacha20_poly1305_openssl(key,nonce,ten_megabyte_data,SIZE,aad,12,received_tag,true) ;
+
+ std::cerr << " AEAD/poly1305 openssl encryption speed: " << SIZE / (1024.0*1024.0) / s.duration() << " MB/s" << std::endl;
+ }
+#endif
+ {
+ RsScopeTimer s("AEAD4") ;
AEAD_chacha20_sha256(key,nonce,ten_megabyte_data,SIZE,aad,12,received_tag,true) ;
- std::cerr << " AEAD/sha256 encryption speed : " << SIZE / (1024.0*1024.0) / s.duration() << " MB/s" << std::endl;
+ std::cerr << " AEAD/sha256 encryption speed : " << SIZE / (1024.0*1024.0) / s.duration() << " MB/s" << std::endl;
}
free(ten_megabyte_data) ;
diff --git a/libretroshare/src/ft/ftextralist.cc b/libretroshare/src/ft/ftextralist.cc
index 7548d421c..cd52f5ce5 100644
--- a/libretroshare/src/ft/ftextralist.cc
+++ b/libretroshare/src/ft/ftextralist.cc
@@ -53,11 +53,6 @@ void ftExtraList::data_tick()
bool todo = false;
time_t now = time(NULL);
-#ifdef DEBUG_ELIST
- //std::cerr << "ftExtraList::run() Iteration";
- //std::cerr << std::endl;
-#endif
-
{
RsStackMutex stack(extMutex);
@@ -131,6 +126,7 @@ void ftExtraList::hashAFile()
/* stick it in the available queue */
mFiles[details.info.hash] = details;
+ mHashOfHash[makeEncryptedHash(details.info.hash)] = details.info.hash ;
/* add to the path->hash map */
mHashedList[details.info.path] = details.info.hash;
@@ -169,6 +165,7 @@ bool ftExtraList::addExtraFile(std::string path, const RsFileHash& hash,
/* stick it in the available queue */
mFiles[details.info.hash] = details;
+ mHashOfHash[makeEncryptedHash(details.info.hash)] = details.info.hash ;
IndicateConfigChanged();
@@ -190,6 +187,8 @@ bool ftExtraList::removeExtraFile(const RsFileHash& hash, TransferRequestFlags f
RsStackMutex stack(extMutex);
+ mHashOfHash.erase(makeEncryptedHash(hash)) ;
+
std::map::iterator it;
it = mFiles.find(hash);
if (it == mFiles.end())
@@ -242,29 +241,26 @@ bool ftExtraList::cleanupOldFiles()
time_t now = time(NULL);
std::list toRemove;
- std::list::iterator rit;
- std::map::iterator it;
- for(it = mFiles.begin(); it != mFiles.end(); ++it)
- {
- /* check timestamps */
+ for( std::map::iterator it = mFiles.begin(); it != mFiles.end(); ++it) /* check timestamps */
if ((time_t)it->second.info.age < now)
- {
toRemove.push_back(it->first);
- }
- }
if (toRemove.size() > 0)
{
+ std::map::iterator it;
+
/* remove items */
- for(rit = toRemove.begin(); rit != toRemove.end(); ++rit)
- {
+ for(std::list::iterator rit = toRemove.begin(); rit != toRemove.end(); ++rit)
+ {
if (mFiles.end() != (it = mFiles.find(*rit)))
{
cleanupEntry(it->second.info.path, it->second.info.transfer_info_flags);
mFiles.erase(it);
}
- }
+ mHashOfHash.erase(makeEncryptedHash(*rit)) ;
+ }
+
IndicateConfigChanged();
}
return true;
@@ -333,31 +329,71 @@ bool ftExtraList::hashExtraFileDone(std::string path, FileInfo &info)
**/
bool ftExtraList::search(const RsFileHash &hash, FileSearchFlags /*hintflags*/, FileInfo &info) const
{
-
#ifdef DEBUG_ELIST
- std::cerr << "ftExtraList::search()";
- std::cerr << std::endl;
+ std::cerr << "ftExtraList::search() hash=" << hash ;
#endif
/* find hash */
std::map::const_iterator fit;
if (mFiles.end() == (fit = mFiles.find(hash)))
{
- return false;
+#ifdef DEBUG_ELIST
+ std::cerr << " not found in mFiles. Trying encrypted... " ;
+#endif
+ // File not found. We try to look for encrypted hash.
+
+ std::map::const_iterator hit = mHashOfHash.find(hash) ;
+
+ if(hit == mHashOfHash.end())
+ {
+#ifdef DEBUG_ELIST
+ std::cerr << " not found." << std::endl;
+#endif
+ return false;
+ }
+#ifdef DEBUG_ELIST
+ std::cerr << " found! Reaching data..." ;
+#endif
+
+ fit = mFiles.find(hit->second) ;
+
+ if(fit == mFiles.end()) // not found. This is an error.
+ {
+#ifdef DEBUG_ELIST
+ std::cerr << " no data. Returning false." << std::endl;
+#endif
+ return false ;
+ }
+
+#ifdef DEBUG_ELIST
+ std::cerr << " ok! Accepting encrypted transfer." << std::endl;
+#endif
+ info = fit->second.info;
+ info.storage_permission_flags = FileStorageFlags(DIR_FLAGS_ANONYMOUS_DOWNLOAD) ;
+ info.transfer_info_flags |= RS_FILE_REQ_ENCRYPTED ;
}
+ else
+ {
+#ifdef DEBUG_ELIST
+ std::cerr << " found! Accepting direct transfer" << std::endl;
+#endif
+ info = fit->second.info;
- info = fit->second.info;
-
- // Now setup the file storage flags so that the client can know how to handle permissions
- //
-#warning mr-alice: make sure this is right
- info.storage_permission_flags = FileStorageFlags(0) ;//DIR_FLAGS_BROWSABLE_OTHERS ;
+ // Unencrypted file transfer: We only allow direct transfers. This is not exactly secure since another friend can
+ // swarm the file. But the hash being kept secret, there's no risk here.
+ //
+ info.storage_permission_flags = FileStorageFlags(DIR_FLAGS_BROWSABLE) ;
+ }
if(info.transfer_info_flags & RS_FILE_REQ_ANONYMOUS_ROUTING) info.storage_permission_flags |= DIR_FLAGS_ANONYMOUS_DOWNLOAD ;
return true;
}
+RsFileHash ftExtraList::makeEncryptedHash(const RsFileHash& hash)
+{
+ return RsDirUtil::sha1sum(hash.toByteArray(),hash.SIZE_IN_BYTES);
+}
/***
* Configuration - store extra files.
@@ -472,6 +508,8 @@ bool ftExtraList::loadList(std::list& load)
/* stick it in the available queue */
mFiles[details.info.hash] = details;
+ mHashOfHash[makeEncryptedHash(details.info.hash)] = details.info.hash ;
+
delete (*it);
/* short sleep */
diff --git a/libretroshare/src/ft/ftextralist.h b/libretroshare/src/ft/ftextralist.h
index 19f1be302..211e66dc6 100644
--- a/libretroshare/src/ft/ftextralist.h
+++ b/libretroshare/src/ft/ftextralist.h
@@ -109,66 +109,69 @@ const uint32_t CLEANUP_PERIOD = 600; /* 10 minutes */
class ftExtraList: public RsTickingThread, public p3Config, public ftSearch
{
- public:
+public:
- ftExtraList();
+ ftExtraList();
- /***
+ /***
* If the File is alreay Hashed, then just add it in.
**/
-bool addExtraFile(std::string path, const RsFileHash &hash,
- uint64_t size, uint32_t period, TransferRequestFlags flags);
+ bool addExtraFile(std::string path, const RsFileHash &hash,
+ uint64_t size, uint32_t period, TransferRequestFlags flags);
-bool removeExtraFile(const RsFileHash& hash, TransferRequestFlags flags);
-bool moveExtraFile(std::string fname, const RsFileHash& hash, uint64_t size,
- std::string destpath);
+ bool removeExtraFile(const RsFileHash& hash, TransferRequestFlags flags);
+ bool moveExtraFile(std::string fname, const RsFileHash& hash, uint64_t size,
+ std::string destpath);
- /***
- * Hash file, and add to the files,
+ /***
+ * Hash file, and add to the files,
* file is removed after period.
**/
-bool hashExtraFile(std::string path, uint32_t period, TransferRequestFlags flags);
-bool hashExtraFileDone(std::string path, FileInfo &info);
+ bool hashExtraFile(std::string path, uint32_t period, TransferRequestFlags flags);
+ bool hashExtraFileDone(std::string path, FileInfo &info);
- /***
- * Search Function - used by File Transfer
+ /***
+ * Search Function - used by File Transfer
* implementation of ftSearch.
*
**/
-virtual bool search(const RsFileHash &hash, FileSearchFlags hintflags, FileInfo &info) const;
+ virtual bool search(const RsFileHash &hash, FileSearchFlags hintflags, FileInfo &info) const;
- /***
- * Thread Main Loop
+ /***
+ * Thread Main Loop
**/
-virtual void data_tick();
+ virtual void data_tick();
- /***
+ /***
* Configuration - store extra files.
*
**/
- protected:
-virtual RsSerialiser *setupSerialiser();
-virtual bool saveList(bool &cleanup, std::list&);
-virtual bool loadList(std::list& load);
+protected:
+ virtual RsSerialiser *setupSerialiser();
+ virtual bool saveList(bool &cleanup, std::list&);
+ virtual bool loadList(std::list& load);
- private:
+ static RsFileHash makeEncryptedHash(const RsFileHash& hash);
- /* Worker Functions */
-void hashAFile();
-bool cleanupOldFiles();
-bool cleanupEntry(std::string path, TransferRequestFlags flags);
+private:
- mutable RsMutex extMutex;
+ /* Worker Functions */
+ void hashAFile();
+ bool cleanupOldFiles();
+ bool cleanupEntry(std::string path, TransferRequestFlags flags);
- std::list mToHash;
+ mutable RsMutex extMutex;
- std::map mHashedList; /* path -> hash ( not saved ) */
- std::map mFiles;
+ std::list mToHash;
- time_t cleanup ;
+ std::map mHashedList; /* path -> hash ( not saved ) */
+ std::map mFiles;
+ std::map mHashOfHash; /* sha1(hash) map so as to answer requests to encrypted transfers */
+
+ time_t cleanup ;
};
diff --git a/libretroshare/src/gxs/rsgenexchange.cc b/libretroshare/src/gxs/rsgenexchange.cc
index 420b13fd9..5845a2887 100644
--- a/libretroshare/src/gxs/rsgenexchange.cc
+++ b/libretroshare/src/gxs/rsgenexchange.cc
@@ -1371,6 +1371,18 @@ bool RsGenExchange::getGroupData(const uint32_t &token, std::vectormeta.mPop = 0;
gItem->meta.mVisibleMsgCount = 0;
}
+
+ // Also check the group privacy flags. A while ago, it as possible to publish a group without privacy flags. Now it is not possible anymore.
+ // As a consequence, it's important to supply a correct value in this flag before the data can be edited/updated.
+
+ if((gItem->meta.mGroupFlags & GXS_SERV::FLAG_PRIVACY_MASK) == 0)
+ {
+#ifdef GEN_EXCH_DEBUG
+ std::cerr << "(WW) getGroupData(): mGroupFlags for group " << gItem->meta.mGroupId << " has incorrect value " << std::hex << gItem->meta.mGroupFlags << std::dec << ". Setting value to GXS_SERV::FLAG_PRIVACY_PUBLIC." << std::endl;
+#endif
+ gItem->meta.mGroupFlags |= GXS_SERV::FLAG_PRIVACY_PUBLIC;
+ }
+
grpItem.push_back(gItem);
}
else
diff --git a/libretroshare/src/rsitems/rsitem.h b/libretroshare/src/rsitems/rsitem.h
index 068f9ee83..e123c37dc 100644
--- a/libretroshare/src/rsitems/rsitem.h
+++ b/libretroshare/src/rsitems/rsitem.h
@@ -7,6 +7,8 @@
#include "serialiser/rsserializer.h"
#include "util/stacktrace.h"
+#include
+
class RsItem: public RsMemoryManagement::SmallObject
{
public:
diff --git a/libretroshare/src/rsitems/rsnxsitems.cc b/libretroshare/src/rsitems/rsnxsitems.cc
index 200d45391..91c35ce72 100644
--- a/libretroshare/src/rsitems/rsnxsitems.cc
+++ b/libretroshare/src/rsitems/rsnxsitems.cc
@@ -162,6 +162,19 @@ void RsNxsGrp::clear()
meta.TlvClear();
}
+RsNxsGrp* RsNxsGrp::clone() const {
+ RsNxsGrp* grp = new RsNxsGrp(this->grp.tlvtype);
+ *grp = *this;
+
+ if(this->metaData)
+ {
+ grp->metaData = new RsGxsGrpMetaData();
+ *(grp->metaData) = *(this->metaData);
+ }
+
+ return grp;
+}
+
void RsNxsSyncGrpReqItem::clear()
{
flag = 0;
diff --git a/libretroshare/src/serialiser/rsserial.cc b/libretroshare/src/serialiser/rsserial.cc
index 1436f92fa..230501ea8 100644
--- a/libretroshare/src/serialiser/rsserial.cc
+++ b/libretroshare/src/serialiser/rsserial.cc
@@ -37,6 +37,8 @@
#include
-
-
- 16777215
- 32
-
-
@@ -183,7 +107,10 @@
- Login
+
+
+
+ :/images/logo/logo_splash.png
@@ -202,7 +129,7 @@
- -
+
-
true
@@ -220,13 +147,27 @@
-
- Profile - Location
+ Profile - Location:
-
+ -
+
+
+ Password:
+
+
+
+ -
+
+
+ QLineEdit::Password
+
+
+
-
@@ -240,56 +181,7 @@
- -
-
-
- 9
-
-
- 9
-
-
-
-
-
- Log In
-
-
- true
-
-
- false
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- 61
- 20
-
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- 71
- 20
-
-
-
-
-
-
- -
+
-
Opens a dialog for creating a new profile or
@@ -305,7 +197,7 @@ p, li { white-space: pre-wrap; }
- -
+
-
@@ -333,10 +225,6 @@ p, li { white-space: pre-wrap; }
1
-
- loadButton
- toolButton
-
diff --git a/retroshare-gui/src/gui/chat/ChatLobbyDialog.cpp b/retroshare-gui/src/gui/chat/ChatLobbyDialog.cpp
index 20352b888..1e5361ead 100644
--- a/retroshare-gui/src/gui/chat/ChatLobbyDialog.cpp
+++ b/retroshare-gui/src/gui/chat/ChatLobbyDialog.cpp
@@ -33,6 +33,7 @@
#include
#include "ChatLobbyDialog.h"
+#include "util/QtVersion.h"
#include "gui/ChatLobbyWidget.h"
#include "ChatTabWidget.h"
#include "gui/settings/rsharesettings.h"
@@ -54,10 +55,10 @@
#include
-#define COLUMN_ICON 0
-#define COLUMN_NAME 1
-#define COLUMN_ACTIVITY 2
-#define COLUMN_ID 3
+#define COLUMN_NAME 0
+#define COLUMN_ACTIVITY 1
+#define COLUMN_ID 2
+#define COLUMN_ICON 3
#define COLUMN_COUNT 4
#define ROLE_SORT Qt::UserRole + 1
@@ -80,12 +81,16 @@ ChatLobbyDialog::ChatLobbyDialog(const ChatLobbyId& lid, QWidget *parent, Qt::Wi
connect(ui.filterLineEdit, SIGNAL(textChanged(QString)), this, SLOT(filterChanged(QString)));
int S = QFontMetricsF(font()).height() ;
- ui.participantsList->setIconSize(QSize(1.3*S,1.3*S));
+ ui.participantsList->setIconSize(QSize(1.4*S,1.4*S));
ui.participantsList->setColumnCount(COLUMN_COUNT);
- ui.participantsList->setColumnWidth(COLUMN_ICON, 1.4*S);
+ ui.participantsList->setColumnWidth(COLUMN_ICON, 1.7*S);
ui.participantsList->setColumnHidden(COLUMN_ACTIVITY,true);
ui.participantsList->setColumnHidden(COLUMN_ID,true);
+
+ /* Set header resize modes and initial section sizes */
+ QHeaderView * header = ui.participantsList->header();
+ QHeaderView_setSectionResizeModeColumn(header, COLUMN_NAME, QHeaderView::Stretch);
muteAct = new QAction(QIcon(), tr("Mute participant"), this);
voteNegativeAct = new QAction(QIcon(":/icons/png/thumbs-down.png"), tr("Ban this person (Sets negative opinion)"), this);
diff --git a/retroshare-gui/src/gui/chat/ChatLobbyDialog.ui b/retroshare-gui/src/gui/chat/ChatLobbyDialog.ui
index acc30b281..0a1635735 100644
--- a/retroshare-gui/src/gui/chat/ChatLobbyDialog.ui
+++ b/retroshare-gui/src/gui/chat/ChatLobbyDialog.ui
@@ -145,11 +145,9 @@
false
-
-
- Participants
-
-
+
+ false
+
Name
diff --git a/retroshare-gui/src/gui/settings/AppearancePage.cpp b/retroshare-gui/src/gui/settings/AppearancePage.cpp
index 0e98f819e..e5e742c72 100755
--- a/retroshare-gui/src/gui/settings/AppearancePage.cpp
+++ b/retroshare-gui/src/gui/settings/AppearancePage.cpp
@@ -304,9 +304,9 @@ void AppearancePage::load()
whileBlocking(ui.checkBoxShowNATStatus)-> setChecked(Settings->valueFromGroup("StatusBar", "ShowNAT", QVariant(true)).toBool());
whileBlocking(ui.checkBoxShowDHTStatus)-> setChecked(Settings->valueFromGroup("StatusBar", "ShowDHT", QVariant(true)).toBool());
whileBlocking(ui.checkBoxShowHashingStatus)-> setChecked(Settings->valueFromGroup("StatusBar", "ShowHashing", QVariant(true)).toBool());
- whileBlocking(ui.checkBoxShowDiscStatus)-> setChecked(Settings->valueFromGroup("StatusBar", "ShowDisc", QVariant(true)).toBool());
+ whileBlocking(ui.checkBoxShowDiscStatus)-> setChecked(Settings->valueFromGroup("StatusBar", "ShowDisc", QVariant(true)).toBool());
whileBlocking(ui.checkBoxShowRateStatus)-> setChecked(Settings->valueFromGroup("StatusBar", "ShowRate", QVariant(true)).toBool());
- whileBlocking(ui.checkBoxShowOpModeStatus)-> setChecked(Settings->valueFromGroup("StatusBar", "ShowOpMode", QVariant(true)).toBool());
+ whileBlocking(ui.checkBoxShowOpModeStatus)-> setChecked(Settings->valueFromGroup("StatusBar", "ShowOpMode", QVariant(false)).toBool());
whileBlocking(ui.checkBoxShowSoundStatus)-> setChecked(Settings->valueFromGroup("StatusBar", "ShowSound", QVariant(true)).toBool());
whileBlocking(ui.checkBoxShowToasterDisable)->setChecked(Settings->valueFromGroup("StatusBar", "ShowToaster", QVariant(true)).toBool());
whileBlocking(ui.checkBoxShowSystrayOnStatus)->setChecked(Settings->valueFromGroup("StatusBar", "ShowSysTrayOnStatusBar", QVariant(false)).toBool());
diff --git a/tests/librssimulator/testing/IsolatedServiceTester.cc b/tests/librssimulator/testing/IsolatedServiceTester.cc
index c8ae3854b..e94a59b4e 100644
--- a/tests/librssimulator/testing/IsolatedServiceTester.cc
+++ b/tests/librssimulator/testing/IsolatedServiceTester.cc
@@ -1,6 +1,7 @@
#include
#include "retroshare/rsids.h"
+#include "rsitems/rsitem.h"
#include "serialiser/rsserial.h"
#include "testing/IsolatedServiceTester.h"
diff --git a/tests/librssimulator/testing/SetFilter.cc b/tests/librssimulator/testing/SetFilter.cc
index 40d90f768..d1400f7ba 100644
--- a/tests/librssimulator/testing/SetFilter.cc
+++ b/tests/librssimulator/testing/SetFilter.cc
@@ -1,6 +1,8 @@
#include "SetFilter.h"
+#include "rsitems/rsitem.h"
+
bool SetFilter::filter(const SetPacket &pkt)
{
switch(mFilterMode)
diff --git a/tests/librssimulator/testing/SetServiceTester.h b/tests/librssimulator/testing/SetServiceTester.h
index ed0ea902d..ad03aed4e 100644
--- a/tests/librssimulator/testing/SetServiceTester.h
+++ b/tests/librssimulator/testing/SetServiceTester.h
@@ -2,6 +2,7 @@
#include
#include "retroshare/rsids.h"
+#include "rsitems/rsitem.h"
#include "pqi/p3linkmgr.h"
#include "SetPacket.h"
diff --git a/tests/unittests/libretroshare/gxs/common/data_support.h b/tests/unittests/libretroshare/gxs/common/data_support.h
index ae9919428..0bb026820 100644
--- a/tests/unittests/libretroshare/gxs/common/data_support.h
+++ b/tests/unittests/libretroshare/gxs/common/data_support.h
@@ -1,6 +1,6 @@
#pragma once
-#include "serialiser/rsnxsitems.h"
+#include "rsitems/rsnxsitems.h"
#include "gxs/rsgxsdata.h"
#define RS_SERVICE_TYPE_PLUGIN_SIMPLE_FORUM 0x012
diff --git a/tests/unittests/libretroshare/gxs/data_service/rsdataservice_test.h b/tests/unittests/libretroshare/gxs/data_service/rsdataservice_test.h
index 89d4a4f5c..13084de2f 100644
--- a/tests/unittests/libretroshare/gxs/data_service/rsdataservice_test.h
+++ b/tests/unittests/libretroshare/gxs/data_service/rsdataservice_test.h
@@ -2,7 +2,7 @@
#define RSDATASERVICE_TEST_H
#include "util/rsthreads.h"
-#include "serialiser/rsnxsitems.h"
+#include "rsitems/rsnxsitems.h"
#include "gxs/rsgds.h"
void test_messageStoresAndRetrieve();
diff --git a/tests/unittests/libretroshare/gxs/gen_exchange/rsdummyservices.h b/tests/unittests/libretroshare/gxs/gen_exchange/rsdummyservices.h
index 0bb040aba..caf404728 100644
--- a/tests/unittests/libretroshare/gxs/gen_exchange/rsdummyservices.h
+++ b/tests/unittests/libretroshare/gxs/gen_exchange/rsdummyservices.h
@@ -6,7 +6,7 @@
#include "gxs/rsnxs.h"
#include "gxs/rsgixs.h"
-#include "serialiser/rsgxsitems.h"
+#include "rsitems/rsgxsitems.h"
class RsDummyNetService: public RsNetworkExchangeService
{
diff --git a/tests/unittests/libretroshare/serialiser/rsgxsiditem_test.cc b/tests/unittests/libretroshare/serialiser/rsgxsiditem_test.cc
index 10189367f..e1488441f 100644
--- a/tests/unittests/libretroshare/serialiser/rsgxsiditem_test.cc
+++ b/tests/unittests/libretroshare/serialiser/rsgxsiditem_test.cc
@@ -28,7 +28,7 @@
*/
#include
-#include "serialiser/rsgxsiditems.h"
+#include "rsitems/rsgxsiditems.h"
#include "support.h"
diff --git a/tests/unittests/libretroshare/serialiser/rsgxsupdateitem_test.cc b/tests/unittests/libretroshare/serialiser/rsgxsupdateitem_test.cc
index 1008babc0..ccaeead96 100644
--- a/tests/unittests/libretroshare/serialiser/rsgxsupdateitem_test.cc
+++ b/tests/unittests/libretroshare/serialiser/rsgxsupdateitem_test.cc
@@ -8,7 +8,7 @@
#include
#include "support.h"
-#include "serialiser/rsgxsupdateitems.h"
+#include "rsitems/rsgxsupdateitems.h"
#define RS_SERVICE_TYPE_PLUGIN_SIMPLE_FORUM 0x0010
RsSerialType* init_item(RsGxsGrpUpdateItem& i)
diff --git a/tests/unittests/libretroshare/serialiser/rsmsgitem_test.cc b/tests/unittests/libretroshare/serialiser/rsmsgitem_test.cc
index b3f585cdd..2513ed77a 100644
--- a/tests/unittests/libretroshare/serialiser/rsmsgitem_test.cc
+++ b/tests/unittests/libretroshare/serialiser/rsmsgitem_test.cc
@@ -26,7 +26,7 @@
#include
#include "util/rsrandom.h"
-#include "serialiser/rsmsgitems.h"
+#include "rsitems/rsmsgitems.h"
#include "chat/rschatitems.h"
#include "support.h"
@@ -141,7 +141,7 @@ RsSerialType* init_item(RsMsgItem& mi)
mi.sendTime = mi.recvTime;
mi.msgFlags = mi.recvTime;
- return new RsMsgSerialiser(true);
+ return new RsMsgSerialiser(RsServiceSerializer::SERIALIZATION_FLAG_NONE);
}
RsSerialType* init_item(RsMsgTagType& mtt)
@@ -150,7 +150,7 @@ RsSerialType* init_item(RsMsgTagType& mtt)
mtt.tagId = rand()%24242;
randString(SHORT_STR, mtt.text);
- return new RsMsgSerialiser();
+ return new RsMsgSerialiser(RsServiceSerializer::SERIALIZATION_FLAG_NONE);
}
@@ -163,7 +163,7 @@ RsSerialType* init_item(RsMsgTags& mt)
mt.tagIds.push_back(rand()%21341);
}
- return new RsMsgSerialiser();
+ return new RsMsgSerialiser(RsServiceSerializer::SERIALIZATION_FLAG_NONE);
}
RsSerialType* init_item(RsMsgSrcId& ms)
@@ -171,7 +171,7 @@ RsSerialType* init_item(RsMsgSrcId& ms)
ms.msgId = rand()%434;
ms.srcId = RsPeerId::random();
- return new RsMsgSerialiser();
+ return new RsMsgSerialiser(RsServiceSerializer::SERIALIZATION_FLAG_NONE);
}
RsSerialType* init_item(RsMsgParentId& ms)
@@ -179,7 +179,7 @@ RsSerialType* init_item(RsMsgParentId& ms)
ms.msgId = rand()%354;
ms.msgParentId = rand()%476;
- return new RsMsgSerialiser();
+ return new RsMsgSerialiser(RsServiceSerializer::SERIALIZATION_FLAG_NONE);
}
bool operator ==(const struct VisibleChatLobbyInfo& l, const struct VisibleChatLobbyInfo& r)
@@ -288,7 +288,7 @@ bool operator ==(const RsMsgItem& miLeft, const RsMsgItem& miRight)
if(miLeft.recvTime != miRight.recvTime) return false;
if(miLeft.sendTime != miRight.sendTime) return false;
if(miLeft.subject != miRight.subject) return false;
- if(miLeft.msgId != miRight.msgId) return false;
+ //if(miLeft.msgId != miRight.msgId) return false;
if(!(miLeft.attachment == miRight.attachment)) return false;
if(!(miLeft.rspeerid_msgbcc == miRight.rspeerid_msgbcc)) return false;
diff --git a/tests/unittests/libretroshare/serialiser/rsnxsitems_test.cc b/tests/unittests/libretroshare/serialiser/rsnxsitems_test.cc
index e40e53ea7..87bd33778 100644
--- a/tests/unittests/libretroshare/serialiser/rsnxsitems_test.cc
+++ b/tests/unittests/libretroshare/serialiser/rsnxsitems_test.cc
@@ -1,7 +1,7 @@
#include "support.h"
#include "libretroshare/gxs/common/data_support.h"
-#include "serialiser/rsnxsitems.h"
+#include "rsitems/rsnxsitems.h"
#define NUM_BIN_OBJECTS 5
diff --git a/tests/unittests/libretroshare/serialiser/rsstatusitem_test.cc b/tests/unittests/libretroshare/serialiser/rsstatusitem_test.cc
index c9fc6cb61..1f7e53f14 100644
--- a/tests/unittests/libretroshare/serialiser/rsstatusitem_test.cc
+++ b/tests/unittests/libretroshare/serialiser/rsstatusitem_test.cc
@@ -25,7 +25,7 @@
#include "support.h"
-#include "serialiser/rsstatusitems.h"
+#include "rsitems/rsstatusitems.h"
RsSerialType* init_item(RsStatusItem& rsi)
{
diff --git a/tests/unittests/libretroshare/services/gxs/GxsIsolatedServiceTester.cc b/tests/unittests/libretroshare/services/gxs/GxsIsolatedServiceTester.cc
index 46d4cfdee..1345dc706 100644
--- a/tests/unittests/libretroshare/services/gxs/GxsIsolatedServiceTester.cc
+++ b/tests/unittests/libretroshare/services/gxs/GxsIsolatedServiceTester.cc
@@ -5,7 +5,7 @@
// from libretroshare
#include "services/p3statusservice.h"
-#include "serialiser/rsstatusitems.h"
+#include "rsitems/rsstatusitems.h"
#include "gxs/rsgixs.h"
#include "gxs/rsdataservice.h"
#include "gxs/rsgxsnetservice.h"
diff --git a/tests/unittests/libretroshare/services/gxs/GxsPairServiceTester.cc b/tests/unittests/libretroshare/services/gxs/GxsPairServiceTester.cc
index b56f2c868..7e2776b64 100644
--- a/tests/unittests/libretroshare/services/gxs/GxsPairServiceTester.cc
+++ b/tests/unittests/libretroshare/services/gxs/GxsPairServiceTester.cc
@@ -5,7 +5,7 @@
#include "gxstestservice.h"
// libretroshare
-#include "serialiser/rsnxsitems.h"
+#include "rsitems/rsnxsitems.h"
GxsPairServiceTester::GxsPairServiceTester(const RsPeerId &peerId1, const RsPeerId &peerId2, int testMode, bool useIdentityService)
:SetServiceTester()
diff --git a/tests/unittests/libretroshare/services/gxs/gxscircle_tests.cc b/tests/unittests/libretroshare/services/gxs/gxscircle_tests.cc
index f9844dce9..ca7d0a337 100644
--- a/tests/unittests/libretroshare/services/gxs/gxscircle_tests.cc
+++ b/tests/unittests/libretroshare/services/gxs/gxscircle_tests.cc
@@ -4,7 +4,7 @@
// from librssimulator
// from libretroshare
-#include "serialiser/rsnxsitems.h"
+#include "rsitems/rsnxsitems.h"
// local
#include "GxsPairServiceTester.h"
diff --git a/tests/unittests/libretroshare/services/gxs/nxsbasic_test.cc b/tests/unittests/libretroshare/services/gxs/nxsbasic_test.cc
index 1b4aec879..078eba249 100644
--- a/tests/unittests/libretroshare/services/gxs/nxsbasic_test.cc
+++ b/tests/unittests/libretroshare/services/gxs/nxsbasic_test.cc
@@ -8,7 +8,7 @@
//#include "gxs/rsgixs.h"
//#include "gxs/rsdataservice.h"
//#include "gxs/rsgxsnetservice.h"
-#include "serialiser/rsnxsitems.h"
+#include "rsitems/rsnxsitems.h"
// local
#include "GxsIsolatedServiceTester.h"
diff --git a/tests/unittests/libretroshare/services/gxs/nxspair_tests.cc b/tests/unittests/libretroshare/services/gxs/nxspair_tests.cc
index e8f4b932d..5eaf630e4 100644
--- a/tests/unittests/libretroshare/services/gxs/nxspair_tests.cc
+++ b/tests/unittests/libretroshare/services/gxs/nxspair_tests.cc
@@ -4,7 +4,7 @@
// from librssimulator
// from libretroshare
-#include "serialiser/rsnxsitems.h"
+#include "rsitems/rsnxsitems.h"
// local
#include "GxsPairServiceTester.h"
diff --git a/tests/unittests/libretroshare/services/gxs/rsgxstestitems.h b/tests/unittests/libretroshare/services/gxs/rsgxstestitems.h
index 78379436f..30003e996 100644
--- a/tests/unittests/libretroshare/services/gxs/rsgxstestitems.h
+++ b/tests/unittests/libretroshare/services/gxs/rsgxstestitems.h
@@ -30,7 +30,7 @@
#include "rsitems/rsserviceids.h"
#include "serialiser/rsserial.h"
-#include "serialiser/rsgxsitems.h"
+#include "rsitems/rsgxsitems.h"
#include "gxstestservice.h"
const uint8_t RS_PKT_SUBTYPE_TEST_GROUP_ITEM = 0x02;
diff --git a/tests/unittests/libretroshare/services/status/status_test.cc b/tests/unittests/libretroshare/services/status/status_test.cc
index 59945ad95..06258f450 100644
--- a/tests/unittests/libretroshare/services/status/status_test.cc
+++ b/tests/unittests/libretroshare/services/status/status_test.cc
@@ -7,7 +7,7 @@
// from libretroshare
#include "services/p3statusservice.h"
-#include "serialiser/rsstatusitems.h"
+#include "rsitems/rsstatusitems.h"
#define N_PEERS 10