merged with upstream/master

This commit is contained in:
csoler 2017-11-14 21:39:46 +01:00
commit ce14219cee
1766 changed files with 1850 additions and 748 deletions

View File

@ -1,5 +1,168 @@
retroshare (0.6.3-1.XXXXXX~YYYYYY) YYYYYY; urgency=low
68b35f3 Phenom Tue, 15 Aug 2017 19:45:26 +0200 Fix CppCheck in notifytxt.cc
0b8d684 Phenom Tue, 15 Aug 2017 19:11:32 +0200 Fix CppCheck in framecatcher.cpp
deb6693 Phenom Tue, 15 Aug 2017 19:00:17 +0200 Fix CppCheck in idle.cpp
589e61f Phenom Sun, 13 Aug 2017 20:44:34 +0200 Fix CppCheck in rsettings.cpp
5554f4a Phenom Sun, 13 Aug 2017 19:47:16 +0200 Fix CppCheck in MimeTextEdit.h
8438d70 Phenom Sun, 13 Aug 2017 18:47:36 +0200 Fix CppCheck in GroupTreeWidget.h
f82ec64 Phenom Fri, 28 Jul 2017 09:38:24 +0200 Fix CppCheck in rsrttitems.h
7e47be5 Phenom Thu, 27 Jul 2017 20:41:17 +0200 Fix CppCheck rsitem.h
4780713 Phenom Thu, 27 Jul 2017 20:27:02 +0200 Fix CppCheck in rsgxsrecognitems.h
732898a Phenom Thu, 27 Jul 2017 20:29:03 +0200 Fix CppCheck in rsgxsupdateitems.h
942eba3 Phenom Thu, 27 Jul 2017 19:33:31 +0200 Fix CppCheck in rsconfigitems.h
a1fb8f7 Phenom Thu, 27 Jul 2017 16:56:10 +0200 Fix CppCheck in rswire.h
a248ee7 Phenom Thu, 27 Jul 2017 16:54:56 +0200 Fix CppCheck in rsservicecontrol.h
1c862de Phenom Thu, 27 Jul 2017 12:56:12 +0200 Fix CppCheck in rsposted.h
ba75294 Phenom Thu, 27 Jul 2017 12:53:47 +0200 Fix CppChecker in rsidentity.h
fee7d45 Phenom Wed, 26 Jul 2017 11:43:11 +0200 Fix CppCheck in rsgxsforums.h
10c46ee Phenom Thu, 27 Jul 2017 12:54:57 +0200 Fix CppChecker in rsphoto.h
dd4ed2a Phenom Wed, 26 Jul 2017 11:39:54 +0200 Fix CppCheck in rsgxschannels.h
6219b31 Phenom Wed, 26 Jul 2017 10:52:40 +0200 Fix CppCheck in pqiqos.h
87947b1 Phenom Wed, 26 Jul 2017 10:35:57 +0200 Fix CppCheck in pqiindic.h
225058a csoler Sun, 5 Nov 2017 19:37:03 +0100 Merge pull request #1100 from hunbernd/feature/image-embed3
5d03ceb hunber Sun, 5 Nov 2017 18:58:07 +0100 Fixed resize bug
2046249 Phenom Wed, 26 Jul 2017 10:33:55 +0200 Fix CppCheck in pqihandler.cc
b77d027 Phenom Wed, 26 Jul 2017 10:30:33 +0200 Fix CppCheck in p3linkmgr.cc
73e1ddc Phenom Wed, 26 Jul 2017 10:29:17 +0200 Fix CppCheck in pqi_base.h
50a9d8a Phenom Fri, 21 Jul 2017 19:08:38 +0200 Fix CppCheck in p3servicecontrol
d21b41f Phenom Fri, 21 Jul 2017 19:02:34 +0200 Fix CppCheck in p3netmgr.cc
6a0fd11 Phenom Fri, 21 Jul 2017 18:59:59 +0200 Fix CppCheck in p3historymgr.cc
bd56035 Phenom Fri, 21 Jul 2017 18:42:42 +0200 Fix CppCheck in p3cfgmgr.h
0a82ff0 Phenom Fri, 21 Jul 2017 18:40:43 +0200 Fix CppCheck in authssl.cc
4fc7787 Phenom Fri, 21 Jul 2017 18:12:59 +0200 Fix CppCheck in authgpg
cd040f6 Phenom Fri, 21 Jul 2017 18:09:54 +0200 Fix CppCheck in pluginmanager.h
60d4762 Phenom Fri, 21 Jul 2017 18:03:35 +0200 Fix CppCheck in rscertificate.h
f91756a Phenom Fri, 21 Jul 2017 17:57:15 +0200 Fix CppCheck in pgphandler.h
aeb7b33 csoler Sun, 5 Nov 2017 17:00:26 +0100 Merge pull request #1099 from csoler/v0.6-PRTest
722d98e Phenom Fri, 21 Jul 2017 17:30:26 +0200 Fix CppCheck in rsgxstunnelitems.h
4ed663a Phenom Fri, 21 Jul 2017 17:23:02 +0200 Fix CppCheck in p3gxstunnel.h
242cc9d Phenom Fri, 21 Jul 2017 17:22:16 +0200 Fix CppCheck in p3gxstransitems.h
3702cf2 Phenom Fri, 21 Jul 2017 17:20:11 +0200 Fix CppCheck in p3gxstrans.h
77c1ab4 Phenom Fri, 21 Jul 2017 16:31:17 +0200 Fix CppCheck in rsgxsdataaccess.h
718c09e Phenom Fri, 21 Jul 2017 16:29:49 +0200 Fix CppCheck in rsgixs.h
eb7655c Phenom Fri, 21 Jul 2017 16:18:09 +0200 Fix CppCheck in rsgenexchange.cc
344bc27 Phenom Fri, 21 Jul 2017 15:55:40 +0200 Fix CppCheck in gxstokenqueue.h
f81c6ae Phenom Fri, 21 Jul 2017 15:54:29 +0200 Fix CppCheck in p3grouter
1072194 Phenom Fri, 21 Jul 2017 14:01:20 +0200 Fix CppCheck in grouteritems.h
10233ef Phenom Fri, 21 Jul 2017 13:53:44 +0200 Fix CppCheck in groutertypes.h
5dbefc5 csoler Sun, 5 Nov 2017 16:36:49 +0100 Merge pull request #1098 from csoler/v0.6-PRTest
a622194 Phenom Fri, 21 Jul 2017 13:46:38 +0200 Fix CppCheck in ftturtlefiletransferitem.h
edfd2ad Phenom Fri, 21 Jul 2017 13:36:10 +0200 Fix CppCheck in fttransfermodule
c8548b2 Phenom Fri, 21 Jul 2017 13:33:11 +0200 Fix CppCheck in ftserver.cc
51ed032 Phenom Fri, 21 Jul 2017 13:13:48 +0200 Fix CppCheck ftfilecreator.cc
6893449 Phenom Fri, 21 Jul 2017 13:00:03 +0200 Fix CppCheck in ftchunkmap.h
f8d4d6c Phenom Fri, 21 Jul 2017 12:57:17 +0200 Fix CppCheck in p3filelists.h
0d5b1ed Phenom Fri, 21 Jul 2017 12:47:04 +0200 Fix CppCheck in rsfilelistitems.h
0e014d6 Phenom Fri, 21 Jul 2017 12:43:06 +0200 Fix CppCheck in p3filelists.cc
d9965ac Phenom Fri, 21 Jul 2017 12:39:05 +0200 Fix CppCheck in hash_cache.h
f18a842 Phenom Fri, 21 Jul 2017 12:27:45 +0200 Fix CppCheck in directory_storage.h and directory_storage.cc
1456bdd Phenom Fri, 21 Jul 2017 12:18:42 +0200 Fix CppCheck in dir_hierarchy.h and dir_hierarchy.cc
b426941 csoler Sun, 5 Nov 2017 13:57:31 +0100 Merge pull request #1086 from PhenomRetroShare/Fix_SpeedQueuePositionSorting
8a4c1bd csoler Sun, 5 Nov 2017 13:56:39 +0100 Merge pull request #1097 from PhenomRetroShare/Add_MoveFixedColorToQss
f27d312 Phenom Sat, 4 Nov 2017 23:37:02 +0100 Move some Fixed Color to Qss files
8072d24 Phenom Sat, 4 Nov 2017 13:57:55 +0100 Use macro for priority values instead of constants.
c5c406b Phenom Sun, 29 Oct 2017 16:45:45 +0100 Fix Speed/Queue Position column sorting
37f6e7e csoler Fri, 3 Nov 2017 23:49:30 +0100 Merge pull request #1064 from PhenomRetroShare/Fix_OpModeRestore
1bcebb8 defnax Fri, 3 Nov 2017 13:26:51 +0100 attempt to fix
fc26ebc defnax Fri, 3 Nov 2017 13:04:38 +0100 Fixed one Emojione icon
eb6bc79 defnax Fri, 3 Nov 2017 03:02:40 +0100 reorder the main people emoticons
48bd151 csoler Thu, 2 Nov 2017 23:16:30 +0100 removed useless root item in RsCollection dialog
2d18335 csoler Thu, 2 Nov 2017 22:52:30 +0100 added tool button to choose DL directory in rscollection dialog
6381608 csoler Thu, 2 Nov 2017 22:46:53 +0100 remove filename field in RsCollectionDialog when downloading a collection of links
aa4c209 csoler Thu, 2 Nov 2017 22:20:43 +0100 fixed formula to compute score based on up/dn votes in comments
42c720f csoler Wed, 1 Nov 2017 20:36:57 +0100 Merge pull request #1082 from RetroPooh/forumoptsimagescb
1a01181 csoler Wed, 1 Nov 2017 20:35:29 +0100 Merge pull request #1063 from PhenomRetroShare/Fix_BlankPageWhenClearLobbyInWebInterface
d8c4f88 csoler Wed, 1 Nov 2017 20:34:35 +0100 Merge pull request #1094 from PhenomRetroShare/Add_HideFileLabelInChannelPost
2d8e9d5 csoler Wed, 1 Nov 2017 20:33:54 +0100 Merge pull request #1090 from csoler/v0.6-DHT
a9c4362 csoler Wed, 1 Nov 2017 20:31:49 +0100 removed debug info. Added explaination about the new method
fe5dd00 Gioacc Wed, 1 Nov 2017 14:34:01 +0100 Add context to debug message
346d5c1 Gioacc Wed, 1 Nov 2017 14:13:04 +0100 Merge pull request #1087 from Emotyco/libresapilocal_debug
f409e8e defnax Wed, 1 Nov 2017 00:24:03 +0100 Update to Emojione 3.0
a4eedf7 Phenom Mon, 30 Oct 2017 18:35:56 +0100 Hide zero File Label (size) in channel post.
69278e6 csoler Mon, 30 Oct 2017 11:07:36 +0100 only print non empty buckets
9f9c34c csoler Mon, 30 Oct 2017 10:58:48 +0100 tried to improve DHT size estimation code
b77e895 csoler Sun, 29 Oct 2017 21:31:10 +0100 Merge pull request #1084 from csoler/v0.6-Links2
337980e csoler Sun, 29 Oct 2017 21:28:12 +0100 Merge pull request #1088 from csoler/v0.6-FileLists
3bb694f csoler Sun, 29 Oct 2017 21:24:34 +0100 added display of hashing speed. Changed hashing buffer size to 10MB to improve performance
9ad635a csoler Sun, 29 Oct 2017 20:33:56 +0100 added post into forum menu entry in SharedFilesDialog
c41f6a2 Konrad Sun, 29 Oct 2017 19:40:37 +0100 Added: Debug output in Android app of callback functions
0c97d5b csoler Fri, 27 Oct 2017 22:03:42 +0200 added sorting of channels to push to, and auto-fill of channel subject
2e9f520 csoler Thu, 26 Oct 2017 19:41:13 +0200 fixed compilation
299d0b6 csoler Thu, 26 Oct 2017 19:40:12 +0200 added missing test for subscribed channels in share-on-channel menu
0c3fc05 Gioacc Thu, 26 Oct 2017 08:18:30 +0200 Merge pull request #1066 from Emotyco/libresapi_filesharing
54d49f1 RetroP Thu, 26 Oct 2017 00:05:45 +0300 friendlist - hide id column by default
f8fca19 RetroP Wed, 25 Oct 2017 23:07:34 +0300 removed wrong tooltip for hidden node in options
5296641 RetroP Wed, 25 Oct 2017 20:50:34 +0300 fix saving of forum options checkbox for load images
0931779 csoler Wed, 25 Oct 2017 18:51:16 +0200 Merge pull request #1081 from Artistic-Cabbage/close-fd-after-blacklist
3975999 Arthur Wed, 25 Oct 2017 17:42:09 +0200 Add missing close after blacklisted connection attempt.
1c2d17b csoler Tue, 24 Oct 2017 18:47:34 +0200 Merge pull request #1077 from hunbernd/feature/image-embed3
cd5eb5c hunber Tue, 24 Oct 2017 18:23:22 +0200 Got rid of QMath
06f489e csoler Mon, 23 Oct 2017 22:14:06 +0200 Merge pull request #1065 from csoler/v0.6-Links2
603ea7e csoler Mon, 23 Oct 2017 22:12:52 +0200 removed debug info from RsCollection
f4fae15 csoler Mon, 23 Oct 2017 21:15:40 +0200 Merge pull request #1078 from RetroPooh/addfr-cb
ead8cb2 csoler Mon, 23 Oct 2017 21:13:56 +0200 Merge pull request #1076 from RetroPooh/chatsearchbut
7af436d csoler Mon, 23 Oct 2017 21:12:26 +0200 Merge pull request #1075 from Kcchouette/patch-1
e441cae csoler Mon, 23 Oct 2017 21:11:08 +0200 Merge pull request #1074 from RetroPooh/sett-nodiscocb
b275039 csoler Mon, 23 Oct 2017 21:09:54 +0200 Merge pull request #1073 from RetroPooh/hid1
1d7d53a csoler Mon, 23 Oct 2017 21:07:23 +0200 Merge pull request #1070 from RetroPooh/posted-descr
e2bbbad RetroP Mon, 23 Oct 2017 20:01:35 +0300 fix checkboxes state for already accepted/signed keys on add friend dialog
64481de hunber Mon, 23 Oct 2017 17:04:20 +0200 Set the proper size limits
b968974 RetroP Mon, 23 Oct 2017 17:51:39 +0300 fix chat search button position
f434e65 hunber Sun, 11 Jun 2017 00:31:20 +0200 Use binary search to find the right file size
c17a8e7 hunber Sat, 10 Jun 2017 01:43:02 +0200 Optimalizations
af48173 hunber Fri, 9 Jun 2017 23:29:39 +0200 Convert image into 4 bit color table format
9af2730 hunber Thu, 8 Jun 2017 23:00:33 +0200 Downscale image automatically
e24febf Kcchou Mon, 23 Oct 2017 14:52:10 +0200 Fix some markdown checkbox
4a1ddcc RetroP Mon, 23 Oct 2017 12:24:56 +0300 removed show discovery checkbox from network options, it is in appearance now
4594c1a Pooh Mon, 23 Oct 2017 11:51:22 +0300 Update MainWindow.cpp
1cc6506 Pooh Mon, 23 Oct 2017 11:49:05 +0300 Update ServerPage.cpp
a0f6a74 Pooh Mon, 23 Oct 2017 11:46:39 +0300 Merge branch 'master' into hid1
78037a6 RetroP Mon, 23 Oct 2017 11:42:03 +0300 disable nat/dht indicators for hidden mode, hide irrelevant network options elements
0359795 csoler Sun, 22 Oct 2017 20:08:22 +0200 fixed regression preventing context menu to open in destination directory for RsCollection
01c82c3 csoler Sun, 22 Oct 2017 20:02:27 +0200 Merge pull request #1072 from hunbernd/fix/html-in-forum-title
a81956c csoler Sun, 22 Oct 2017 20:01:49 +0200 Merge pull request #1071 from hunbernd/fix/crash-at-startup-removed-buttons
0c39b5c hunber Sun, 22 Oct 2017 19:44:14 +0200 Fix bug causing RS to crash at startup when some icons were removed from toolbar For example: disabled plugins
4e16042 hunber Sun, 22 Oct 2017 19:11:52 +0200 Part of the forum title is not displayed when it is enclosed in < >
723016e RetroP Sun, 22 Oct 2017 19:39:44 +0300 fix descriptions display in Posted
6a0ccc4 csoler Sun, 22 Oct 2017 18:28:36 +0200 added means to select download directory in RsCollectionDialog
ee2120a csoler Sun, 22 Oct 2017 17:36:19 +0200 fixed bug causing FileTree links to open empty
f503510 csoler Sun, 22 Oct 2017 16:00:08 +0200 Merge pull request #1069 from RetroPooh/postbuttonlabels
34eb971 csoler Sun, 22 Oct 2017 15:57:24 +0200 Merge pull request #1068 from RetroPooh/winsize
9cc09d6 csoler Sun, 22 Oct 2017 15:55:48 +0200 Merge pull request #1067 from PhenomRetroShare/Fix_SecurityIpItemIsSame
749a34d RetroP Sun, 22 Oct 2017 15:55:08 +0300 add text labels to post buttons in forums and channels; fix version selector placement
b48916c RetroP Sun, 22 Oct 2017 13:49:38 +0300 add windows size/pos saving
ef13e03 Phenom Sun, 22 Oct 2017 11:52:00 +0200 Fix SecurityIpItem isSame
b6aeacb csoler Sat, 21 Oct 2017 23:48:27 +0200 fixed share on channel code
770add8 csoler Sat, 21 Oct 2017 21:23:40 +0200 added code to share a file/dir on channel
edffbc3 csoler Sat, 21 Oct 2017 18:09:26 +0200 fixed bug in removing top dirs when creating file hierarhies
cbcf402 csoler Sat, 21 Oct 2017 17:42:17 +0200 setup proper title in RsCollectionEditor when in download mode
2cfa866 csoler Sat, 21 Oct 2017 17:35:06 +0200 merge of trees and single files before paste in DL queue so that all use the CollectionEditor
fe516c6 csoler Sat, 21 Oct 2017 16:16:23 +0200 fixed pasting of FileTree links in download queue
6581fa0 csoler Sat, 21 Oct 2017 15:44:45 +0200 code cleaning
b6f102c Gioacc Sat, 21 Oct 2017 13:00:36 +0200 Fix TokenManager.qml JSON API request
fca10c2 Konrad Fri, 20 Oct 2017 21:24:52 +0200 Removed in libresapi unused code that caused compilation error
ef52e09 Konrad Fri, 20 Oct 2017 20:57:37 +0200 Added in Libresapi: Handlers to interact with shared files
0ebe885 Konrad Fri, 20 Oct 2017 20:55:56 +0200 Added in Libresapi: Handler to get uploading files
2293b60 Konrad Fri, 20 Oct 2017 20:49:59 +0200 Added in Libresapi: Handler to get search result
0fbcf01 csoler Thu, 19 Oct 2017 22:20:23 +0200 code cleaning. Removed comments at end of conditional
74d5069 csoler Thu, 19 Oct 2017 22:14:04 +0200 renamed RsCollectionEditor into RsCollection. Added download of FileTree links
32be006 csoler Thu, 19 Oct 2017 10:19:56 +0200 various improvements to collection links
9206dac csoler Wed, 18 Oct 2017 23:20:19 +0200 fixed up collection link display
e1d5014 csoler Wed, 18 Oct 2017 22:32:15 +0200 added copy links from file hierarchy
f98edd4 csoler Wed, 18 Oct 2017 00:04:04 +0200 added FileTree class to implement a compact representation of file hierarchies
847c1b2 csoler Sun, 15 Oct 2017 21:10:29 +0200 renamed RsCollectionFile into RsCollectionEditor
68763f5 csoler Sun, 15 Oct 2017 20:52:21 +0200 added links machinery to handle file hierarchies
e63217e Phenom Tue, 17 Oct 2017 15:39:25 +0200 Fix OpMode Restore
130e3d6 Phenom Tue, 17 Oct 2017 14:57:09 +0200 Fix Blank Page When Clear Lobby in Web Interface
034d88c Gioacc Mon, 16 Oct 2017 20:07:52 +0200 Fix android compilation with newer Qt
ebf99a4 csoler Sat, 14 Oct 2017 18:10:55 +0200 removed vivid in defautl ubuntu distr list
f161aa8 csoler Sat, 14 Oct 2017 14:57:20 +0200 updated changelog
-- Retroshare Dev Team <contact@retroshare.net> Thu, 07 Nov 2017 22:00:00 +0100
retroshare (0.6.3-1.20171014.1f624042~trusty) trusty; urgency=low
d61a5cd csoler Mon, 2 Oct 2017 22:23:26 +0200 attempt at fixing the re-hash bug. Now only using canonicalized filenames in hash cache
22942dc csoler Sun, 1 Oct 2017 20:20:26 +0200 fixed bug causing suffix/prefix lists to contain an empty string
bc05aaa csoler Sat, 30 Sep 2017 18:58:31 +0200 switched tokenQueue speed to 10 calls/sec, thus improving loading speeds. Still need to test for CPU load

View File

@ -1024,6 +1024,11 @@ int bdSpace::getDhtBucket(const int idx, bdBucket &bucket)
}
uint32_t bdSpace::calcNetworkSize()
{
return calcNetworkSizeWithFlag(~0u) ;
}
uint32_t bdSpace::calcNetworkSizeWithFlag(uint32_t withFlag)
{
std::vector<bdBucket>::iterator it;
@ -1031,76 +1036,66 @@ uint32_t bdSpace::calcNetworkSize()
unsigned long long sum = 0;
unsigned long long no_peers = 0;
uint32_t count = 0;
bool doPrint = false;
bool doAvg = false;
#ifdef BITDHT_DEBUG
std::cerr << "Estimating DHT network size. Flags=" << std::hex << withFlag << std::dec << std::endl;
#endif
int i = 0;
for(it = buckets.begin(); it != buckets.end(); it++, i++)
{
int size = it->entries.size();
int size = 0;
std::list<bdPeer>::iterator lit;
for(lit = it->entries.begin(); lit != it->entries.end(); lit++)
if (withFlag & lit->mPeerFlags)
size++;
int shift = BITDHT_KEY_BITLEN - i;
bool toBig = false;
if (shift > BITDHT_ULLONG_BITS - mFns->bdBucketBitSize() - 1)
{
toBig = true;
shift = BITDHT_ULLONG_BITS - mFns->bdBucketBitSize() - 1;
}
continue ;
unsigned long long no_nets = ((unsigned long long) 1 << shift);
/* use doPrint so it acts as a single switch */
if (size && !doAvg && !doPrint)
{
doAvg = true;
}
no_peers = no_nets * size;
if (size && !doPrint)
{
doPrint = true;
}
if (size == 0)
if(size < mFns->bdNodesPerBucket() && size > 0)
{
/* reset counters - if empty slot - to discount outliers in average */
sum = 0;
no_peers = 0;
count = 0;
sum += no_peers;
count++;
}
if (!toBig)
{
no_peers = no_nets * size;
}
if (doPrint && doAvg && !toBig)
{
if (size == mFns->bdNodesPerBucket())
{
/* last average */
doAvg = false;
}
if (no_peers != 0)
{
sum += no_peers;
count++;
}
}
#ifdef BITDHT_DEBUG
if(size > 0)
std::cerr << " Bucket " << shift << ": " << size << " / " << mFns->bdNodesPerBucket() << " peers. no_nets=" << no_nets << ". no_peers=" << no_peers << "." << std::endl;
#endif
}
uint32_t NetSize = 0;
if (count != 0)
{
NetSize = sum / count;
}
//std::cerr << "bdSpace::calcNetworkSize() : " << NetSize;
//std::cerr << std::endl;
#ifdef BITDHT_DEBUG
std::cerr << "Estimated net size: " << NetSize << ". Old style estimate: " << calcNetworkSizeWithFlag_old(withFlag) << std::endl;
#endif
return NetSize;
}
uint32_t bdSpace::calcNetworkSizeWithFlag(uint32_t withFlag)
/* (csoler) This is the old method for computing the DHT size estimate. The method is based on averaging the
* estimate given by each bucket: n 2^b where n is the bucket size and b is the number of similar bits
* in this bucket. The idea is that buckets that are not empty nor full give a estimate of the network
* size.
*
* The existing implementation of this method was not using all non empty/full buckets, in order to avoid
* outliers, but this method is also biased, and tends to give a lower value (because it skips the largest buckets)
* especially when the network is very sparse.
*
* The new implementation respects the original estimate without bias, but it still notoriously wrong. Only averaging
* the estimate over a large period of time would produce a reliable value.
*/
uint32_t bdSpace::calcNetworkSizeWithFlag_old(uint32_t withFlag)
{
std::vector<bdBucket>::iterator it;
@ -1140,12 +1135,12 @@ uint32_t bdSpace::calcNetworkSizeWithFlag(uint32_t withFlag)
/* use doPrint so it acts as a single switch */
if (size && !doAvg && !doPrint)
{
{
doAvg = true;
}
if (size && !doPrint)
{
{
doPrint = true;
}
@ -1172,7 +1167,7 @@ uint32_t bdSpace::calcNetworkSizeWithFlag(uint32_t withFlag)
if (no_peers != 0)
{
sum += no_peers;
count++;
count++;
}
}
}
@ -1190,7 +1185,6 @@ uint32_t bdSpace::calcNetworkSizeWithFlag(uint32_t withFlag)
return NetSize;
}
uint32_t bdSpace::calcSpaceSize()
{
std::vector<bdBucket>::iterator it;

View File

@ -184,6 +184,7 @@ int getDhtBucket(const int idx, bdBucket &bucket);
uint32_t calcNetworkSize();
uint32_t calcNetworkSizeWithFlag(uint32_t withFlag);
uint32_t calcNetworkSizeWithFlag_old(uint32_t withFlag);
uint32_t calcSpaceSize();
uint32_t calcSpaceSizeWithFlag(uint32_t withFlag);

View File

@ -236,7 +236,8 @@ public:
mForumHandler(ifaces.mGxsForums),
mServiceControlHandler(ifaces.mServiceControl),
mFileSearchHandler(sts, ifaces.mNotify, ifaces.mTurtle, ifaces.mFiles),
mTransfersHandler(sts, ifaces.mFiles),
mFileSharingHandler(sts, ifaces.mFiles),
mTransfersHandler(sts, ifaces.mFiles, ifaces.mPeers),
mChatHandler(sts, ifaces.mNotify, ifaces.mMsgs, ifaces.mPeers, ifaces.mIdentity, &mPeersHandler),
mApiPluginHandler(sts, ifaces),
mChannelsHandler(ifaces.mGxsChannels),
@ -259,6 +260,8 @@ public:
&ServiceControlHandler::handleRequest);
router.addResourceHandler("filesearch", dynamic_cast<ResourceRouter*>(&mFileSearchHandler),
&FileSearchHandler::handleRequest);
router.addResourceHandler("filesharing", dynamic_cast<ResourceRouter*>(&mFileSharingHandler),
&FileSharingHandler::handleRequest);
router.addResourceHandler("transfers", dynamic_cast<ResourceRouter*>(&mTransfersHandler),
&TransfersHandler::handleRequest);
router.addResourceHandler("chat", dynamic_cast<ResourceRouter*>(&mChatHandler),
@ -280,6 +283,7 @@ public:
ForumHandler mForumHandler;
ServiceControlHandler mServiceControlHandler;
FileSearchHandler mFileSearchHandler;
FileSharingHandler mFileSharingHandler;
TransfersHandler mTransfersHandler;
ChatHandler mChatHandler;
ApiPluginHandler mApiPluginHandler;

View File

@ -9,6 +9,7 @@
#include "ServiceControlHandler.h"
#include "StateTokenServer.h"
#include "FileSearchHandler.h"
#include "FileSharingHandler.h"
#include "TransfersHandler.h"
#include "LivereloadHandler.h"
#include "TmpBlobStore.h"

View File

@ -2,6 +2,7 @@
#include "FileSearchHandler.h"
#include <retroshare/rspeers.h>
#include <retroshare/rsexpr.h>
#include <sstream>
@ -10,13 +11,14 @@
namespace resource_api
{
FileSearchHandler::FileSearchHandler(StateTokenServer *sts, RsNotify *notify, RsTurtle *turtle, RsFiles */*files*/):
mStateTokenServer(sts), mNotify(notify), mTurtle(turtle),// mFiles(files),
FileSearchHandler::FileSearchHandler(StateTokenServer *sts, RsNotify *notify, RsTurtle *turtle, RsFiles *files):
mStateTokenServer(sts), mNotify(notify), mTurtle(turtle), mRsFiles(files),
mMtx("FileSearchHandler")
{
mNotify->registerNotifyClient(this);
addResourceHandler("*", this, &FileSearchHandler::handleWildcard);
addResourceHandler("create_search", this, &FileSearchHandler::handleCreateSearch);
addResourceHandler("create_search", this, &FileSearchHandler::handleCreateSearch);
addResourceHandler("get_search_result", this, &FileSearchHandler::handleGetSearchResult);
mSearchesStateToken = mStateTokenServer->getNewToken();
}
@ -102,8 +104,11 @@ void FileSearchHandler::handleWildcard(Request &req, Response &resp)
<< makeKeyValueReference("id", fd.hash)
<< makeKeyValueReference("name", fd.name)
<< makeKeyValueReference("hash", fd.hash)
<< makeKeyValueReference("path", fd.path)
<< makeKeyValue("peer_id", fd.id.toStdString())
<< makeKeyValueReference("size", size)
<< makeKeyValueReference("rank", fd.rank);
<< makeKeyValueReference("rank", fd.rank)
<< makeKeyValueReference("age", fd.age);
}
}
}
@ -194,7 +199,7 @@ void FileSearchHandler::handleCreateSearch(Request &req, Response &resp)
if(local)
{
std::list<DirDetails> local_results;
rsFiles->SearchBoolExp(&exprs, local_results, RS_FILE_HINTS_LOCAL);
mRsFiles->SearchBoolExp(&exprs, local_results, RS_FILE_HINTS_LOCAL);
for(std::list<DirDetails>::iterator lit = local_results.begin(); lit != local_results.end(); ++lit)
{
@ -206,7 +211,7 @@ void FileSearchHandler::handleCreateSearch(Request &req, Response &resp)
if(remote)
{
std::list<DirDetails> remote_results;
rsFiles->SearchBoolExp(&exprs, remote_results, RS_FILE_HINTS_REMOTE);
mRsFiles->SearchBoolExp(&exprs, remote_results, RS_FILE_HINTS_REMOTE);
for(std::list<DirDetails>::iterator lit = remote_results.begin(); lit != remote_results.end(); ++lit)
{
FileDetail fd;
@ -239,4 +244,60 @@ void FileSearchHandler::handleCreateSearch(Request &req, Response &resp)
resp.setOk();
}
void FileSearchHandler::handleGetSearchResult(Request& req, Response& resp)
{
std::string search_id;
req.mStream << makeKeyValueReference("search_id", search_id);
if(search_id.size() != 8)
{
resp.setFail("Error: id has wrong size, should be 8 characters");
return;
}
uint32_t id = 0;
for(uint8_t i = 0; i < 8; i++)
{
id += (uint32_t(search_id[i]-'A')) << (i*4);
}
{
RsStackMutex stackMtx(mMtx); // ********** STACK LOCKED MTX **********
std::map<uint32_t, Search>::iterator mit = mSearches.find(id);
if(mit == mSearches.end())
{
resp.setFail("Error: search id invalid");
return;
}
Search& search = mit->second;
resp.mStateToken = search.mStateToken;
resp.mDataStream.getStreamToMember();
RsPgpId ownId = rsPeers->getGPGOwnId();
for(std::list<FileDetail>::iterator lit = search.mResults.begin(); lit != search.mResults.end(); ++lit)
{
FileDetail& fd = *lit;
bool isFriend = rsPeers->isFriend(fd.id);
bool isOwn = false;
if(ownId == rsPeers->getGPGId(fd.id))
isOwn = true;
double size = fd.size;
resp.mDataStream.getStreamToMember()
<< makeKeyValueReference("id", fd.hash)
<< makeKeyValueReference("name", fd.name)
<< makeKeyValueReference("hash", fd.hash)
<< makeKeyValueReference("path", fd.path)
<< makeKeyValue("peer_id", fd.id.toStdString())
<< makeKeyValueReference("is_friends", isFriend)
<< makeKeyValueReference("is_own", isOwn)
<< makeKeyValueReference("size", size)
<< makeKeyValueReference("rank", fd.rank)
<< makeKeyValueReference("age", fd.age);
}
}
resp.setOk();
}
} // namespace resource_api

View File

@ -19,12 +19,13 @@ public:
virtual void notifyTurtleSearchResult(uint32_t search_id, const std::list<TurtleFileInfo>& files);
private:
void handleWildcard(Request& req, Response& resp);
void handleCreateSearch(Request& req, Response& resp);
void handleCreateSearch(Request& req, Response& resp);
void handleGetSearchResult(Request& req, Response& resp);
StateTokenServer* mStateTokenServer;
RsNotify* mNotify;
RsTurtle* mTurtle;
//RsFiles* mFiles;
RsFiles* mRsFiles;
class Search{
public:

View File

@ -0,0 +1,474 @@
/*
* libresapi
*
* Copyright (C) 2017, Konrad Dębiec <konradd@tutanota.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "FileSharingHandler.h"
namespace resource_api
{
FileSharingHandler::FileSharingHandler(StateTokenServer *sts, RsFiles *files):
mStateTokenServer(sts), mRsFiles(files)
{
addResourceHandler("*", this, &FileSharingHandler::handleWildcard);
addResourceHandler("force_check", this, &FileSharingHandler::handleForceCheck);
addResourceHandler("get_shared_dirs", this, &FileSharingHandler::handleGetSharedDir);
addResourceHandler("set_shared_dir", this, &FileSharingHandler::handleSetSharedDir);
addResourceHandler("update_shared_dir", this, &FileSharingHandler::handleUpdateSharedDir);
addResourceHandler("remove_shared_dir", this, &FileSharingHandler::handleRemoveSharedDir);
addResourceHandler("get_dir_parent", this, &FileSharingHandler::handleGetDirectoryParent);
addResourceHandler("get_dir_childs", this, &FileSharingHandler::handleGetDirectoryChilds);
addResourceHandler("is_dl_dir_shared", this, &FileSharingHandler::handleIsDownloadDirShared);
addResourceHandler("share_dl_dir", this, &FileSharingHandler::handleShareDownloadDirectory);
addResourceHandler("download", this, &FileSharingHandler::handleDownload);
mStateToken = mStateTokenServer->getNewToken();
}
void FileSharingHandler::handleWildcard(Request & /*req*/, Response & /*resp*/)
{
}
void FileSharingHandler::handleForceCheck(Request&, Response& resp)
{
mRsFiles->ForceDirectoryCheck();
resp.setOk();
}
void FileSharingHandler::handleGetSharedDir(Request& req, Response& resp)
{
DirDetails dirDetails;
mRsFiles->RequestDirDetails(NULL, dirDetails, RS_FILE_HINTS_LOCAL);
resp.mDataStream << makeKeyValue("parent_reference", *reinterpret_cast<int*>(&dirDetails.ref));
resp.mDataStream << makeKeyValue("path", dirDetails.path);
StreamBase &childsStream = resp.mDataStream.getStreamToMember("childs");
for(std::vector<DirStub>::iterator it = dirDetails.children.begin(); it != dirDetails.children.end(); ++it)
{
DirDetails dirDetails;
mRsFiles->RequestDirDetails((*it).ref, dirDetails, RS_FILE_HINTS_LOCAL);
for(std::vector<DirStub>::iterator vit = dirDetails.children.begin(); vit != dirDetails.children.end(); ++vit)
{
DirDetails dirDetails;
mRsFiles->RequestDirDetails((*vit).ref, dirDetails, RS_FILE_HINTS_LOCAL);
std::string type;
switch(dirDetails.type)
{
case DIR_TYPE_PERSON:
type = "person";
break;
case DIR_TYPE_DIR:
type = "folder";
break;
case DIR_TYPE_FILE:
type = "file";
break;
}
bool browsable = false;
bool anon_dl = false;
bool anon_search = false;
if(dirDetails.flags & DIR_FLAGS_BROWSABLE)
browsable = true;
if(dirDetails.flags & DIR_FLAGS_ANONYMOUS_DOWNLOAD)
anon_dl = true;
if(dirDetails.flags & DIR_FLAGS_ANONYMOUS_SEARCH)
anon_search = true;
StreamBase &streamBase = childsStream.getStreamToMember()
<< makeKeyValue("name", dirDetails.name)
<< makeKeyValue("path", dirDetails.path)
<< makeKeyValue("hash", dirDetails.hash.toStdString())
<< makeKeyValue("parent_reference", *reinterpret_cast<int*>(&dirDetails.parent))
<< makeKeyValue("reference", *reinterpret_cast<int*>(&dirDetails.ref))
<< makeKeyValue("count", static_cast<int>(dirDetails.count))
<< makeKeyValueReference("type", type)
<< makeKeyValueReference("browsable", browsable)
<< makeKeyValueReference("anon_dl", anon_dl)
<< makeKeyValueReference("anon_search", anon_search);
int contain_files = 0;
int contain_folders = 0;
if(dirDetails.count != 0)
{
for(std::vector<DirStub>::iterator vit = dirDetails.children.begin(); vit != dirDetails.children.end(); ++vit)
{
DirDetails dirDetails;
mRsFiles->RequestDirDetails((*vit).ref, dirDetails, RS_FILE_HINTS_LOCAL);
switch(dirDetails.type)
{
case DIR_TYPE_DIR:
contain_folders++;
break;
case DIR_TYPE_FILE:
contain_files++;
break;
}
}
}
streamBase
<< makeKeyValueReference("contain_files", contain_files)
<< makeKeyValueReference("contain_folders", contain_folders);
}
}
}
void FileSharingHandler::handleSetSharedDir(Request& req, Response& resp)
{
std::string dir;
bool browsable = false;
bool anon_dl = false;
bool anon_search = false;
req.mStream << makeKeyValueReference("directory", dir);
req.mStream << makeKeyValueReference("browsable", browsable);
req.mStream << makeKeyValueReference("anon_dl", anon_dl);
req.mStream << makeKeyValueReference("anon_search", anon_search);
SharedDirInfo sDI;
sDI.filename = dir;
sDI.virtualname.clear();
sDI.shareflags.clear();
if(browsable)
sDI.shareflags |= DIR_FLAGS_BROWSABLE;
if(anon_dl)
sDI.shareflags |= DIR_FLAGS_ANONYMOUS_DOWNLOAD;
if(anon_search)
sDI.shareflags |= DIR_FLAGS_ANONYMOUS_SEARCH;
if(mRsFiles->addSharedDirectory(sDI))
resp.setOk();
else
resp.setFail("Couldn't share folder");
}
void FileSharingHandler::handleUpdateSharedDir(Request& req, Response& resp)
{
std::string dir;
std::string virtualname;
bool browsable = false;
bool anon_dl = false;
bool anon_search = false;
req.mStream << makeKeyValueReference("directory", dir);
req.mStream << makeKeyValueReference("virtualname", virtualname);
req.mStream << makeKeyValueReference("browsable", browsable);
req.mStream << makeKeyValueReference("anon_dl", anon_dl);
req.mStream << makeKeyValueReference("anon_search", anon_search);
SharedDirInfo sDI;
sDI.filename = dir;
sDI.virtualname = virtualname;
sDI.shareflags.clear();
if(browsable)
sDI.shareflags |= DIR_FLAGS_BROWSABLE;
if(anon_dl)
sDI.shareflags |= DIR_FLAGS_ANONYMOUS_DOWNLOAD;
if(anon_search)
sDI.shareflags |= DIR_FLAGS_ANONYMOUS_SEARCH;
if(mRsFiles->updateShareFlags(sDI))
resp.setOk();
else
resp.setFail("Couldn't update shared folder's flags");
}
void FileSharingHandler::handleRemoveSharedDir(Request& req, Response& resp)
{
std::string dir;
req.mStream << makeKeyValueReference("directory", dir);
if(mRsFiles->removeSharedDirectory(dir))
resp.setOk();
else
resp.setFail("Couldn't remove shared directory.");
}
void FileSharingHandler::handleGetDirectoryParent(Request& req, Response& resp)
{
int reference;
bool remote = false;
bool local = true;
req.mStream << makeKeyValueReference("reference", reference);
req.mStream << makeKeyValueReference("remote", remote);
req.mStream << makeKeyValueReference("local", local);
void *ref = reinterpret_cast<void*>(reference);
FileSearchFlags flags;
if(remote)
flags |= RS_FILE_HINTS_REMOTE;
if(local)
flags |= RS_FILE_HINTS_LOCAL;
DirDetails dirDetails;
mRsFiles->RequestDirDetails(ref, dirDetails, flags);
mRsFiles->RequestDirDetails(dirDetails.parent, dirDetails, flags);
resp.mDataStream << makeKeyValue("parent_reference", *reinterpret_cast<int*>(&dirDetails.ref));
resp.mDataStream << makeKeyValue("path", dirDetails.path);
StreamBase &childsStream = resp.mDataStream.getStreamToMember("childs");
if(dirDetails.count != 0)
{
for(std::vector<DirStub>::iterator vit = dirDetails.children.begin(); vit != dirDetails.children.end(); ++vit)
{
DirDetails dirDetails;
mRsFiles->RequestDirDetails((*vit).ref, dirDetails, flags);
std::string type;
switch(dirDetails.type)
{
case DIR_TYPE_PERSON:
type = "person";
break;
case DIR_TYPE_DIR:
type = "folder";
break;
case DIR_TYPE_FILE:
type = "file";
break;
}
bool browsable = false;
bool anon_dl = false;
bool anon_search = false;
if(dirDetails.flags & DIR_FLAGS_BROWSABLE)
browsable = true;
if(dirDetails.flags & DIR_FLAGS_ANONYMOUS_DOWNLOAD)
anon_dl = true;
if(dirDetails.flags & DIR_FLAGS_ANONYMOUS_SEARCH)
anon_search = true;
StreamBase &streamBase = childsStream.getStreamToMember()
<< makeKeyValue("name", dirDetails.name)
<< makeKeyValue("path", dirDetails.path)
<< makeKeyValue("hash", dirDetails.hash.toStdString())
<< makeKeyValue("parent_reference", *reinterpret_cast<int*>(&dirDetails.parent))
<< makeKeyValue("reference", *reinterpret_cast<int*>(&dirDetails.ref))
<< makeKeyValue("count", static_cast<int>(dirDetails.count))
<< makeKeyValueReference("type", type)
<< makeKeyValueReference("browsable", browsable)
<< makeKeyValueReference("anon_dl", anon_dl)
<< makeKeyValueReference("anon_search", anon_search);
int contain_files = 0;
int contain_folders = 0;
if(dirDetails.count != 0)
{
for(std::vector<DirStub>::iterator vit = dirDetails.children.begin(); vit != dirDetails.children.end(); ++vit)
{
DirDetails dirDetails;
mRsFiles->RequestDirDetails((*vit).ref, dirDetails, flags);
switch(dirDetails.type)
{
case DIR_TYPE_DIR:
contain_folders++;
break;
case DIR_TYPE_FILE:
contain_files++;
break;
}
}
}
streamBase
<< makeKeyValueReference("contain_files", contain_files)
<< makeKeyValueReference("contain_folders", contain_folders);
}
}
}
void FileSharingHandler::handleGetDirectoryChilds(Request& req, Response& resp)
{
int reference = 0;
bool remote = false;
bool local = true;
req.mStream << makeKeyValueReference("reference", reference);
req.mStream << makeKeyValueReference("remote", remote);
req.mStream << makeKeyValueReference("local", local);
void *ref = reinterpret_cast<void*>(reference);
FileSearchFlags flags;
if(remote)
flags |= RS_FILE_HINTS_REMOTE;
if(local)
flags |= RS_FILE_HINTS_LOCAL;
DirDetails dirDetails;
mRsFiles->RequestDirDetails(ref, dirDetails, flags);
resp.mDataStream << makeKeyValue("parent_reference", *reinterpret_cast<int*>(&dirDetails.ref));
resp.mDataStream << makeKeyValue("path", dirDetails.path);
resp.mDataStream << makeKeyValue("hash", dirDetails.hash.toStdString());
StreamBase &childsStream = resp.mDataStream.getStreamToMember("childs");
if(dirDetails.count != 0)
{
for(std::vector<DirStub>::iterator vit = dirDetails.children.begin(); vit != dirDetails.children.end(); ++vit)
{
DirDetails dirDetails;
mRsFiles->RequestDirDetails((*vit).ref, dirDetails, flags);
std::string type;
switch(dirDetails.type)
{
case DIR_TYPE_PERSON:
type = "person";
break;
case DIR_TYPE_DIR:
type = "folder";
break;
case DIR_TYPE_FILE:
type = "file";
break;
}
bool browsable = false;
bool anon_dl = false;
bool anon_search = false;
if(dirDetails.flags & DIR_FLAGS_BROWSABLE)
browsable = true;
if(dirDetails.flags & DIR_FLAGS_ANONYMOUS_DOWNLOAD)
anon_dl = true;
if(dirDetails.flags & DIR_FLAGS_ANONYMOUS_SEARCH)
anon_search = true;
StreamBase &streamBase = childsStream.getStreamToMember()
<< makeKeyValue("name", dirDetails.name)
<< makeKeyValue("path", dirDetails.path)
<< makeKeyValue("hash", dirDetails.hash.toStdString())
<< makeKeyValue("parent_reference", *reinterpret_cast<int*>(&dirDetails.parent))
<< makeKeyValue("reference", *reinterpret_cast<int*>(&dirDetails.ref))
<< makeKeyValue("count", static_cast<int>(dirDetails.count))
<< makeKeyValueReference("type", type)
<< makeKeyValueReference("browsable", browsable)
<< makeKeyValueReference("anon_dl", anon_dl)
<< makeKeyValueReference("anon_search", anon_search);
int contain_files = 0;
int contain_folders = 0;
if(dirDetails.count != 0)
{
for(std::vector<DirStub>::iterator vit = dirDetails.children.begin(); vit != dirDetails.children.end(); ++vit)
{
DirDetails dirDetails;
mRsFiles->RequestDirDetails((*vit).ref, dirDetails, flags);
switch(dirDetails.type)
{
case DIR_TYPE_DIR:
contain_folders++;
break;
case DIR_TYPE_FILE:
contain_files++;
break;
}
}
}
streamBase
<< makeKeyValueReference("contain_files", contain_files)
<< makeKeyValueReference("contain_folders", contain_folders);
}
}
}
void FileSharingHandler::handleIsDownloadDirShared(Request&, Response& resp)
{
bool shared = mRsFiles->getShareDownloadDirectory();
resp.mDataStream.getStreamToMember()
<< makeKeyValueReference("shared", shared);
resp.setOk();
}
void FileSharingHandler::handleShareDownloadDirectory(Request& req, Response& resp)
{
bool share;
req.mStream << makeKeyValueReference("share", share);
if(mRsFiles->shareDownloadDirectory(share))
resp.setOk();
else
resp.setFail("Couldn't share/unshare download directory.");
}
void FileSharingHandler::handleDownload(Request& req, Response& resp)
{
int size;
std::string hashString;
std::string name;
req.mStream << makeKeyValueReference("hash", hashString);
req.mStream << makeKeyValueReference("name", name);
req.mStream << makeKeyValueReference("size", size);
std::list<RsPeerId> srcIds;
RsFileHash hash(hashString);
FileInfo finfo;
mRsFiles->FileDetails(hash, RS_FILE_HINTS_REMOTE, finfo);
for(std::list<TransferInfo>::const_iterator it(finfo.peers.begin());it!=finfo.peers.end();++it)
srcIds.push_back((*it).peerId);
if(!mRsFiles->FileRequest(name, hash, static_cast<uint64_t>(size), "",
RS_FILE_REQ_ANONYMOUS_ROUTING, srcIds))
{
resp.setOk();
return;
}
resp.setFail("Couldn't download file");
}
} // namespace resource_api

View File

@ -0,0 +1,57 @@
/*
* libresapi
*
* Copyright (C) 2017, Konrad Dębiec <konradd@tutanota.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include "ResourceRouter.h"
#include "StateTokenServer.h"
#include <retroshare/rsfiles.h>
namespace resource_api
{
class FileSharingHandler: public ResourceRouter
{
public:
FileSharingHandler(StateTokenServer* sts, RsFiles* files);
private:
void handleWildcard(Request& req, Response& resp);
void handleForceCheck(Request& req, Response& resp);
void handleGetSharedDir(Request& req, Response& resp);
void handleSetSharedDir(Request& req, Response& resp);
void handleUpdateSharedDir(Request& req, Response& resp);
void handleRemoveSharedDir(Request& req, Response& resp);
void handleGetDirectoryParent(Request& req, Response& resp);
void handleGetDirectoryChilds(Request& req, Response& resp);
void handleIsDownloadDirShared(Request& req, Response& resp);
void handleShareDownloadDirectory(Request& req, Response& resp);
void handleDownload(Request& req, Response& resp);
StateToken mStateToken;
StateTokenServer* mStateTokenServer;
RsFiles* mRsFiles;
};
} // namespace resource_api

View File

@ -1,179 +1,278 @@
#include "TransfersHandler.h"
#include "Operators.h"
#include <algorithm>
#include <time.h>
namespace resource_api
{
TransfersHandler::TransfersHandler(StateTokenServer *sts, RsFiles *files):
mStateTokenServer(sts), mFiles(files), mLastUpdateTS(0)
{
addResourceHandler("*", this, &TransfersHandler::handleWildcard);
addResourceHandler("downloads", this, &TransfersHandler::handleDownloads);
addResourceHandler("control_download", this, &TransfersHandler::handleControlDownload);
mStateToken = mStateTokenServer->getNewToken();
mStateTokenServer->registerTickClient(this);
}
TransfersHandler::~TransfersHandler()
{
mStateTokenServer->unregisterTickClient(this);
}
const int UPDATE_PERIOD_SECONDS = 5;
void TransfersHandler::tick()
{
if(time(0) > (mLastUpdateTS + UPDATE_PERIOD_SECONDS))
mStateTokenServer->replaceToken(mStateToken);
// extra check: was the list of files changed?
// if yes, replace state token immediately
std::list<RsFileHash> dls;
mFiles->FileDownloads(dls);
// there is no guarantee of the order
// so have to sort before comparing the lists
dls.sort();
if(!std::equal(dls.begin(), dls.end(), mDownloadsAtLastCheck.begin()))
{
mDownloadsAtLastCheck.swap(dls);
mStateTokenServer->replaceToken(mStateToken);
}
}
void TransfersHandler::handleWildcard(Request & /*req*/, Response & /*resp*/)
{
}
void TransfersHandler::handleControlDownload(Request &req, Response &resp)
{
mStateTokenServer->replaceToken(mStateToken);
RsFileHash hash;
std::string action;
req.mStream << makeKeyValueReference("action", action);
if(action == "begin")
{
std::string fname;
double size;
req.mStream << makeKeyValueReference("name", fname);
req.mStream << makeKeyValueReference("size", size);
req.mStream << makeKeyValueReference("hash", hash);
std::list<RsPeerId> scrIds;
bool ok = req.mStream.isOK();
if(ok)
ok = mFiles->FileRequest(fname, hash, size, "", RS_FILE_REQ_ANONYMOUS_ROUTING, scrIds);
if(ok)
resp.setOk();
else
resp.setFail("something went wrong. are all fields filled in? is the file already downloaded?");
return;
}
req.mStream << makeKeyValueReference("id", hash);
if(!req.mStream.isOK())
{
resp.setFail("error: could not deserialise the request");
return;
}
bool ok = false;
bool handled = false;
if(action == "pause")
{
handled = true;
ok = mFiles->FileControl(hash, RS_FILE_CTRL_PAUSE);
}
if(action == "start")
{
handled = true;
ok = mFiles->FileControl(hash, RS_FILE_CTRL_START);
}
if(action == "check")
{
handled = true;
ok = mFiles->FileControl(hash, RS_FILE_CTRL_FORCE_CHECK);
}
if(action == "cancel")
{
handled = true;
ok = mFiles->FileCancel(hash);
}
if(ok)
resp.setOk();
else
resp.setFail("something went wrong. not sure what or why.");
if(handled)
return;
resp.setFail("error: action not handled");
}
void TransfersHandler::handleDownloads(Request & /* req */, Response &resp)
{
tick();
resp.mStateToken = mStateToken;
resp.mDataStream.getStreamToMember();
for(std::list<RsFileHash>::iterator lit = mDownloadsAtLastCheck.begin();
lit != mDownloadsAtLastCheck.end(); ++lit)
{
FileInfo fi;
if(mFiles->FileDetails(*lit, RS_FILE_HINTS_DOWNLOAD, fi))
{
StreamBase& stream = resp.mDataStream.getStreamToMember();
stream << makeKeyValueReference("id", fi.hash)
<< makeKeyValueReference("hash", fi.hash)
<< makeKeyValueReference("name", fi.fname);
double size = fi.size;
double transfered = fi.transfered;
stream << makeKeyValueReference("size", size)
<< makeKeyValueReference("transfered", transfered)
<< makeKeyValue("transfer_rate", fi.tfRate);
std::string dl_status;
/*
const uint32_t FT_STATE_FAILED = 0x0000 ;
const uint32_t FT_STATE_OKAY = 0x0001 ;
const uint32_t FT_STATE_WAITING = 0x0002 ;
const uint32_t FT_STATE_DOWNLOADING = 0x0003 ;
const uint32_t FT_STATE_COMPLETE = 0x0004 ;
const uint32_t FT_STATE_QUEUED = 0x0005 ;
const uint32_t FT_STATE_PAUSED = 0x0006 ;
const uint32_t FT_STATE_CHECKING_HASH = 0x0007 ;
*/
switch(fi.downloadStatus)
{
case FT_STATE_FAILED:
dl_status = "failed";
break;
case FT_STATE_OKAY:
dl_status = "okay";
break;
case FT_STATE_WAITING:
dl_status = "waiting";
break;
case FT_STATE_DOWNLOADING:
dl_status = "downloading";
break;
case FT_STATE_COMPLETE:
dl_status = "complete";
break;
case FT_STATE_QUEUED:
dl_status = "queued";
break;
case FT_STATE_PAUSED:
dl_status = "paused";
break;
case FT_STATE_CHECKING_HASH:
dl_status = "checking";
break;
default:
dl_status = "error_unknown";
}
stream << makeKeyValueReference("download_status", dl_status);
}
}
resp.setOk();
}
} // namespace resource_api
#include "TransfersHandler.h"
#include "Operators.h"
#include <algorithm>
#include <time.h>
namespace resource_api
{
TransfersHandler::TransfersHandler(StateTokenServer *sts, RsFiles *files, RsPeers *peers):
mStateTokenServer(sts), mFiles(files), mRsPeers(peers), mLastUpdateTS(0)
{
addResourceHandler("*", this, &TransfersHandler::handleWildcard);
addResourceHandler("downloads", this, &TransfersHandler::handleDownloads);
addResourceHandler("uploads", this, &TransfersHandler::handleUploads);
addResourceHandler("control_download", this, &TransfersHandler::handleControlDownload);
mStateToken = mStateTokenServer->getNewToken();
mStateTokenServer->registerTickClient(this);
}
TransfersHandler::~TransfersHandler()
{
mStateTokenServer->unregisterTickClient(this);
}
const int UPDATE_PERIOD_SECONDS = 5;
void TransfersHandler::tick()
{
if(time(0) > (mLastUpdateTS + UPDATE_PERIOD_SECONDS))
mStateTokenServer->replaceToken(mStateToken);
bool replace = false;
// extra check: was the list of files changed?
// if yes, replace state token immediately
std::list<RsFileHash> dls;
mFiles->FileDownloads(dls);
// there is no guarantee of the order
// so have to sort before comparing the lists
dls.sort();
if(!std::equal(dls.begin(), dls.end(), mDownloadsAtLastCheck.begin()))
mDownloadsAtLastCheck.swap(dls);
std::list<RsFileHash> upls;
mFiles->FileUploads(upls);
upls.sort();
if(!std::equal(upls.begin(), upls.end(), mUploadsAtLastCheck.begin()))
mUploadsAtLastCheck.swap(upls);
if(replace)
mStateTokenServer->replaceToken(mStateToken);
}
void TransfersHandler::handleWildcard(Request & /*req*/, Response & /*resp*/)
{
}
void TransfersHandler::handleControlDownload(Request &req, Response &resp)
{
mStateTokenServer->replaceToken(mStateToken);
std::string hashString;
std::string action;
req.mStream << makeKeyValueReference("action", action);
req.mStream << makeKeyValueReference("hash", hashString);
RsFileHash hash(hashString);
if(action == "begin")
{
std::string fname;
double size;
req.mStream << makeKeyValueReference("name", fname);
req.mStream << makeKeyValueReference("size", size);
std::list<RsPeerId> srcIds;
FileInfo finfo;
mFiles->FileDetails(hash, RS_FILE_HINTS_REMOTE, finfo);
for(std::list<TransferInfo>::const_iterator it(finfo.peers.begin());it!=finfo.peers.end();++it)
srcIds.push_back((*it).peerId);
bool ok = req.mStream.isOK();
if(ok)
ok = mFiles->FileRequest(fname, hash, size, "", RS_FILE_REQ_ANONYMOUS_ROUTING, srcIds);
if(ok)
resp.setOk();
else
resp.setFail("something went wrong. are all fields filled in? is the file already downloaded?");
return;
}
if(!req.mStream.isOK())
{
resp.setFail("error: could not deserialise the request");
return;
}
bool ok = false;
bool handled = false;
if(action == "pause")
{
handled = true;
ok = mFiles->FileControl(hash, RS_FILE_CTRL_PAUSE);
}
if(action == "start")
{
handled = true;
ok = mFiles->FileControl(hash, RS_FILE_CTRL_START);
}
if(action == "check")
{
handled = true;
ok = mFiles->FileControl(hash, RS_FILE_CTRL_FORCE_CHECK);
}
if(action == "cancel")
{
handled = true;
ok = mFiles->FileCancel(hash);
}
if(ok)
resp.setOk();
else
resp.setFail("something went wrong. not sure what or why.");
if(handled)
return;
resp.setFail("error: action not handled");
}
void TransfersHandler::handleDownloads(Request & /* req */, Response &resp)
{
tick();
resp.mStateToken = mStateToken;
resp.mDataStream.getStreamToMember();
for(std::list<RsFileHash>::iterator lit = mDownloadsAtLastCheck.begin();
lit != mDownloadsAtLastCheck.end(); ++lit)
{
FileInfo fi;
if(mFiles->FileDetails(*lit, RS_FILE_HINTS_DOWNLOAD, fi))
{
StreamBase& stream = resp.mDataStream.getStreamToMember();
stream << makeKeyValueReference("id", fi.hash)
<< makeKeyValueReference("hash", fi.hash)
<< makeKeyValueReference("name", fi.fname);
double size = fi.size;
double transfered = fi.transfered;
stream << makeKeyValueReference("size", size)
<< makeKeyValueReference("transferred", transfered)
<< makeKeyValue("transfer_rate", fi.tfRate);
std::string dl_status;
switch(fi.downloadStatus)
{
case FT_STATE_FAILED:
dl_status = "failed";
break;
case FT_STATE_OKAY:
dl_status = "okay";
break;
case FT_STATE_WAITING:
dl_status = "waiting";
break;
case FT_STATE_DOWNLOADING:
dl_status = "downloading";
break;
case FT_STATE_COMPLETE:
dl_status = "complete";
break;
case FT_STATE_QUEUED:
dl_status = "queued";
break;
case FT_STATE_PAUSED:
dl_status = "paused";
break;
case FT_STATE_CHECKING_HASH:
dl_status = "checking";
break;
default:
dl_status = "error_unknown";
}
stream << makeKeyValueReference("download_status", dl_status);
}
}
resp.setOk();
}
void TransfersHandler::handleUploads(Request & /* req */, Response &resp)
{
tick();
resp.mStateToken = mStateToken;
resp.mDataStream.getStreamToMember();
RsPeerId ownId = mRsPeers->getOwnId();
for(std::list<RsFileHash>::iterator lit = mUploadsAtLastCheck.begin();
lit != mUploadsAtLastCheck.end(); ++lit)
{
FileInfo fi;
if(mFiles->FileDetails(*lit, RS_FILE_HINTS_UPLOAD, fi))
{
std::list<TransferInfo>::iterator pit;
for(pit = fi.peers.begin(); pit != fi.peers.end(); ++pit)
{
if (pit->peerId == ownId) //don't display transfer to ourselves
continue ;
std::string sourceName = mRsPeers->getPeerName(pit->peerId);
bool isAnon = false;
bool isEncryptedE2E = false;
if(sourceName == "")
{
isAnon = true;
sourceName = pit->peerId.toStdString();
if(rsFiles->isEncryptedSource(pit->peerId))
isEncryptedE2E = true;
}
std::string status;
switch(pit->status)
{
case FT_STATE_FAILED:
status = "Failed";
break;
case FT_STATE_OKAY:
status = "Okay";
break;
case FT_STATE_WAITING:
status = "Waiting";
break;
case FT_STATE_DOWNLOADING:
status = "Uploading";
break;
case FT_STATE_COMPLETE:
status = "Complete";
break;
default:
status = "Complete";
break;
}
CompressedChunkMap cChunkMap;
if(!rsFiles->FileUploadChunksDetails(*lit, pit->peerId, cChunkMap))
continue;
double dlspeed = pit->tfRate;
double fileSize = fi.size;
double completed = pit->transfered;
uint32_t chunk_size = 1024*1024;
uint32_t nb_chunks = (uint32_t)((fi.size + (uint64_t)chunk_size - 1) / (uint64_t)(chunk_size));
uint32_t filled_chunks = cChunkMap.filledChunks(nb_chunks);
if(filled_chunks > 0 && nb_chunks > 0)
completed = cChunkMap.computeProgress(fi.size, chunk_size);
else
completed = pit->transfered % chunk_size;
resp.mDataStream.getStreamToMember()
<< makeKeyValueReference("hash", fi.hash)
<< makeKeyValueReference("name", fi.fname)
<< makeKeyValueReference("source", sourceName)
<< makeKeyValueReference("size", fileSize)
<< makeKeyValueReference("transferred", completed)
<< makeKeyValueReference("is_anonymous", isAnon)
<< makeKeyValueReference("is_encrypted_e2e", isEncryptedE2E)
<< makeKeyValueReference("transfer_rate", dlspeed)
<< makeKeyValueReference("status", status);
}
}
}
resp.setOk();
}
} // namespace resource_api

View File

@ -1,10 +1,10 @@
#pragma once
#pragma once
#include "ResourceRouter.h"
#include "StateTokenServer.h"
#include <retroshare/rsfiles.h>
#include <retroshare/rspeers.h>
namespace resource_api
{
@ -12,7 +12,7 @@ namespace resource_api
class TransfersHandler: public ResourceRouter, Tickable
{
public:
TransfersHandler(StateTokenServer* sts, RsFiles* files);
TransfersHandler(StateTokenServer* sts, RsFiles* files, RsPeers *peers);
virtual ~TransfersHandler();
// from Tickable
@ -21,14 +21,17 @@ private:
void handleWildcard(Request& req, Response& resp);
void handleControlDownload(Request& req, Response& resp);
void handleDownloads(Request& req, Response& resp);
void handleUploads(Request& req, Response& resp);
StateTokenServer* mStateTokenServer;
RsFiles* mFiles;
RsPeers* mRsPeers;
StateToken mStateToken;
time_t mLastUpdateTS;
std::list<RsFileHash> mDownloadsAtLastCheck;
std::list<RsFileHash> mUploadsAtLastCheck;
};
} // namespace resource_api

View File

@ -182,7 +182,8 @@ SOURCES += \
util/ContentTypes.cpp \
api/ApiPluginHandler.cpp \
api/ChannelsHandler.cpp \
api/StatsHandler.cpp
api/StatsHandler.cpp \
api/FileSharingHandler.cpp
HEADERS += \
api/ApiServer.h \
@ -209,7 +210,8 @@ HEADERS += \
util/ContentTypes.h \
api/ApiPluginHandler.h \
api/ChannelsHandler.h \
api/StatsHandler.h
api/StatsHandler.h \
api/FileSharingHandler.h
libresapilocalserver {
CONFIG *= qt

View File

@ -234,9 +234,11 @@ function lobby(lobbyid){
];
} else {
var el = document.getElementById("CharLobbyName");
el.innerText = lobdt.name;
var cln = document.getElementById("ChatLobbyName");
if (cln != null) {
cln.innerText = lobdt.name;
}
msg = m(".chat.bottom",[
m("div","enter new message, Ctrl+Enter to submit:"),
m("textarea",{
@ -388,7 +390,7 @@ module.exports = {
"h2",
{
style:{margin:"0px"},
id:"CharLobbyName"
id:"ChatLobbyName"
},
"Lobby Name"
)

View File

@ -887,7 +887,10 @@ void InternalFileHierarchyStorage::print() const
std::cerr << "(EE) Error: unknown type node found!" << std::endl;
}
std::cerr << "Total nodes: " << mNodes.size() << " (" << nfiles << " files, " << ndirs << " dirs, " << nempty << " empty slots)" << std::endl;
std::cerr << "Total nodes: " << mNodes.size() << " (" << nfiles << " files, " << ndirs << " dirs, " << nempty << " empty slots";
if (nunknown > 0) std::cerr << ", " << nunknown << " unknown";
std::cerr << ")" << std::endl;
recursPrint(0,DirectoryStorage::EntryIndex(0));

View File

@ -68,7 +68,7 @@ public:
class DirEntry: public FileStorageNode
{
public:
DirEntry(const std::string& name) : dir_name(name), dir_modtime(0),dir_most_recent_time(0),dir_update_time(0) {}
explicit DirEntry(const std::string& name) : dir_name(name), dir_modtime(0),dir_most_recent_time(0),dir_update_time(0) {}
virtual ~DirEntry() {}
virtual uint32_t type() const { return FileStorageNode::TYPE_DIR ; }

View File

@ -576,7 +576,7 @@ bool LocalDirectoryStorage::getFileInfo(DirectoryStorage::EntryIndex i,FileInfo&
info.transfered = 0;
info.tfRate = 0; /* in kbytes */
info.downloadStatus = FT_STATE_COMPLETE ;
std::list<TransferInfo> peers;
//std::list<TransferInfo> peers;
info.priority = SPEED_NORMAL;
info.lastTS = 0;

View File

@ -97,7 +97,7 @@ class DirectoryStorage
class FileIterator
{
public:
FileIterator(DirIterator& d); // crawls all files in specified directory
explicit FileIterator(DirIterator& d); // crawls all files in specified directory
FileIterator(DirectoryStorage *d,EntryIndex e); // crawls all files in specified directory
FileIterator& operator++() ;

View File

@ -24,6 +24,7 @@
*/
#include "util/rsdir.h"
#include "util/rsprint.h"
#include "util/rsscopetimer.h"
#include "rsserver/p3face.h"
#include "pqi/authssl.h"
#include "hash_cache.h"
@ -43,8 +44,11 @@ HashStorage::HashStorage(const std::string& save_file_name)
mLastSaveTime = 0 ;
mTotalSizeToHash = 0;
mTotalFilesToHash = 0;
mCurrentHashingSpeed = 0 ;
mMaxStorageDurationDays = DEFAULT_HASH_STORAGE_DURATION_DAYS ;
mHashingProcessPaused = false;
mHashedBytes = 0 ;
mHashingTime = 0 ;
{
RS_STACK_MUTEX(mHashMtx) ;
@ -178,32 +182,48 @@ void HashStorage::data_tick()
#endif
std::string tmpout;
rs_sprintf(tmpout, "%lu/%lu (%s - %d%%) : %s", (unsigned long int)mHashCounter+1, (unsigned long int)mTotalFilesToHash, friendlyUnit(mTotalHashedSize).c_str(), int(mTotalHashedSize/double(mTotalSizeToHash)*100.0), job.full_path.c_str()) ;
if(mCurrentHashingSpeed > 0)
rs_sprintf(tmpout, "%lu/%lu (%s - %d%%, %d MB/s) : %s", (unsigned long int)mHashCounter+1, (unsigned long int)mTotalFilesToHash, friendlyUnit(mTotalHashedSize).c_str(), int(mTotalHashedSize/double(mTotalSizeToHash)*100.0), mCurrentHashingSpeed,job.full_path.c_str()) ;
else
rs_sprintf(tmpout, "%lu/%lu (%s - %d%%) : %s", (unsigned long int)mHashCounter+1, (unsigned long int)mTotalFilesToHash, friendlyUnit(mTotalHashedSize).c_str(), int(mTotalHashedSize/double(mTotalSizeToHash)*100.0), job.full_path.c_str()) ;
RsServer::notify()->notifyHashingInfo(NOTIFY_HASHTYPE_HASH_FILE, tmpout) ;
if(RsDirUtil::getFileHash(job.full_path, hash,size, this))
{
// store the result
double seconds_origin = RsScopeTimer::currentTime() ;
if(RsDirUtil::getFileHash(job.full_path, hash,size, this))
{
// store the result
#ifdef HASHSTORAGE_DEBUG
std::cerr << "done."<< std::endl;
std::cerr << "done."<< std::endl;
#endif
RS_STACK_MUTEX(mHashMtx) ;
HashStorageInfo& info(mFiles[job.real_path]);
RS_STACK_MUTEX(mHashMtx) ;
HashStorageInfo& info(mFiles[job.real_path]);
info.filename = job.real_path ;
info.size = size ;
info.modf_stamp = job.ts ;
info.time_stamp = time(NULL);
info.hash = hash;
info.filename = job.real_path ;
info.size = size ;
info.modf_stamp = job.ts ;
info.time_stamp = time(NULL);
info.hash = hash;
mChanged = true ;
mTotalHashedSize += size ;
}
else
std::cerr << "ERROR: cannot hash file " << job.full_path << std::endl;
mChanged = true ;
mTotalHashedSize += size ;
}
else
std::cerr << "ERROR: cannot hash file " << job.full_path << std::endl;
mHashingTime += RsScopeTimer::currentTime() - seconds_origin ;
mHashedBytes += size ;
if(mHashingTime > 3)
{
mCurrentHashingSpeed = (int)(mHashedBytes / mHashingTime ) / (1024*1024) ;
mHashingTime = 0 ;
mHashedBytes = 0 ;
}
++mHashCounter ;
}

View File

@ -54,7 +54,7 @@ public:
class HashStorage: public RsTickingThread
{
public:
HashStorage(const std::string& save_file_name) ;
explicit HashStorage(const std::string& save_file_name) ;
/*!
* \brief requestHash Requests the hash for the given file, assuming size and mod_time are the same.
@ -140,5 +140,11 @@ private:
uint64_t mTotalHashedSize ;
uint64_t mTotalFilesToHash ;
time_t mLastSaveTime ;
// The following is used to estimate hashing speed.
double mHashingTime ;
uint64_t mHashedBytes ;
uint32_t mCurrentHashingSpeed ; // in MB/s
};

View File

@ -437,14 +437,14 @@ bool p3FileDatabase::loadList(std::list<RsItem *>& load)
if (NULL != (rskv = dynamic_cast<RsConfigKeyValueSet *>(*it)))
{
/* make into map */
std::map<std::string, std::string> configMap;
std::map<std::string, std::string>::const_iterator mit ;
//std::map<std::string, std::string> configMap;
//std::map<std::string, std::string>::const_iterator mit ;
for(std::list<RsTlvKeyValue>::const_iterator kit = rskv->tlvkvs.pairs.begin(); kit != rskv->tlvkvs.pairs.end(); ++kit)
if (kit->key == HASH_CACHE_DURATION_SS)
{
uint32_t t=0 ;
if(sscanf(kit->value.c_str(),"%d",&t) == 1)
if(sscanf(kit->value.c_str(),"%u",&t) == 1)
mHashCache->setRememberHashFilesDuration(t);
}
else if(kit->key == WATCH_FILE_DURATION_SS)
@ -1744,7 +1744,7 @@ void p3FileDatabase::locked_recursSweepRemoteDirectory(RemoteDirectoryStorage *r
{
time_t now = time(NULL) ;
std::string indent(2*depth,' ') ;
//std::string indent(2*depth,' ') ;
// if not up to date, request update, and return (content is not certified, so no need to recurs yet).
// if up to date, return, because TS is about the last modif TS below, so no need to recurs either.

View File

@ -83,7 +83,7 @@ class p3FileDatabase: public p3Service, public p3Config, public ftSearch //, pub
// [...] more to add here
};
p3FileDatabase(p3ServiceControl *mpeers) ;
explicit p3FileDatabase(p3ServiceControl *mpeers) ;
~p3FileDatabase();
/*!

View File

@ -49,7 +49,7 @@ const uint8_t RS_PKT_SUBTYPE_FILELISTS_CONFIG_ITEM = 0x03;
class RsFileListsItem : public RsItem
{
public:
RsFileListsItem(uint8_t subtype)
explicit RsFileListsItem(uint8_t subtype)
: RsItem(RS_PKT_VERSION_SERVICE, RS_SERVICE_TYPE_FILE_DATABASE, subtype)
{
setPriorityLevel(QOS_PRIORITY_RS_SLOW_SYNC_REQUEST); // this is the default. Someitems may be faster, on demand.
@ -75,7 +75,7 @@ class RsFileListsSyncRequestItem : public RsFileListsItem
{
public:
RsFileListsSyncRequestItem() : RsFileListsItem(RS_PKT_SUBTYPE_FILELISTS_SYNC_REQ_ITEM) {}
RsFileListsSyncRequestItem() : RsFileListsItem(RS_PKT_SUBTYPE_FILELISTS_SYNC_REQ_ITEM), flags(0), last_known_recurs_modf_TS(0), request_id(0) {}
virtual void clear(){}
@ -91,7 +91,7 @@ class RsFileListsSyncResponseItem : public RsFileListsItem
{
public:
RsFileListsSyncResponseItem() : RsFileListsItem(RS_PKT_SUBTYPE_FILELISTS_SYNC_RSP_ITEM) {}
RsFileListsSyncResponseItem() : RsFileListsItem(RS_PKT_SUBTYPE_FILELISTS_SYNC_RSP_ITEM), flags(0), last_known_recurs_modf_TS(0), request_id(0) {}
virtual void clear();

View File

@ -34,7 +34,7 @@ class ftChunk
public:
typedef uint64_t ChunkId ;
ftChunk():offset(0), size(0), ts(0),ref_cnt(NULL) {}
ftChunk():offset(0), size(0), id(0), ts(0),ref_cnt(NULL) {}
friend std::ostream& operator<<(std::ostream& o,const ftChunk& f) ;

View File

@ -83,7 +83,7 @@ bool ftFileCreator::getFileData(const RsPeerId& peer_id,uint64_t offset, uint32_
// try if we have data from an incomplete or not veryfied chunk
if(!have_it && allow_unverified)
{
std::map<uint64_t, ftChunk>::iterator it;
//std::map<uint64_t, ftChunk>::iterator it;
have_it = true;
// this map contains chunks which are currently being downloaded
for(std::map<uint64_t,ftChunk>::iterator it=mChunks.begin(); it!=mChunks.end(); ++it)
@ -542,6 +542,7 @@ bool ftFileCreator::getMissingChunk(const RsPeerId& peer_id,uint32_t size_hint,u
mChunks[chunk.offset] = chunk ;
offset = chunk.offset ;
// cppcheck-suppress unreadVariable
size = chunk.size ;
++chunks_for_this_peer ; // increase number of chunks for this peer.

View File

@ -131,8 +131,8 @@ void ftServer::SetupFtServer()
{
/* setup FiStore/Monitor */
std::string localcachedir = mConfigPath + "/cache/local";
std::string remotecachedir = mConfigPath + "/cache/remote";
//std::string localcachedir = mConfigPath + "/cache/local";
//std::string remotecachedir = mConfigPath + "/cache/remote";
RsPeerId ownId = mServiceCtrl->getOwnId();
/* search/extras List */

View File

@ -155,7 +155,7 @@ bool ftTransferModule::addFileSource(const RsPeerId& peerId)
/* add in new source */
peerInfo pInfo(peerId);
mFileSources.insert(std::pair<RsPeerId,peerInfo>(peerId,pInfo));
mit = mFileSources.find(peerId);
//mit = mFileSources.find(peerId);
mMultiplexor->sendChunkMapRequest(peerId, mHash,false) ;
#ifdef FT_DEBUG
@ -545,7 +545,7 @@ bool ftTransferModule::isCheckingHash()
class HashThread: public RsSingleJobThread
{
public:
HashThread(ftFileCreator *m)
explicit HashThread(ftFileCreator *m)
: _hashThreadMtx("HashThread"), _m(m),_finished(false),_hash("") {}
virtual void run()

View File

@ -56,7 +56,7 @@ class HashThread ;
class peerInfo
{
public:
peerInfo(const RsPeerId& peerId_in):peerId(peerId_in),state(PQIPEER_NOT_ONLINE),desiredRate(0),actualRate(0),
explicit peerInfo(const RsPeerId& peerId_in):peerId(peerId_in),state(PQIPEER_NOT_ONLINE),desiredRate(0),actualRate(0),
lastTS(0),
recvTS(0), lastTransfers(0), nResets(0),
rtt(0), rttActive(false), rttStart(0), rttOffset(0),
@ -111,7 +111,7 @@ public:
};
ftFileStatus():hash(""),stat(PQIFILE_INIT) {}
ftFileStatus(const RsFileHash& hash_in):hash(hash_in),stat(PQIFILE_INIT) {}
explicit ftFileStatus(const RsFileHash& hash_in):hash(hash_in),stat(PQIFILE_INIT) {}
RsFileHash hash;
Status stat;

View File

@ -33,7 +33,7 @@
class RsTurtleFileRequestItem: public RsTurtleGenericTunnelItem
{
public:
RsTurtleFileRequestItem() : RsTurtleGenericTunnelItem(RS_TURTLE_SUBTYPE_FILE_REQUEST) { setPriorityLevel(QOS_PRIORITY_RS_TURTLE_FILE_REQUEST);}
RsTurtleFileRequestItem() : RsTurtleGenericTunnelItem(RS_TURTLE_SUBTYPE_FILE_REQUEST), chunk_offset(0), chunk_size(0) { setPriorityLevel(QOS_PRIORITY_RS_TURTLE_FILE_REQUEST);}
virtual bool shouldStampTunnel() const { return false ; }
virtual Direction travelingDirection() const { return DIRECTION_SERVER ; }
@ -49,7 +49,7 @@ class RsTurtleFileRequestItem: public RsTurtleGenericTunnelItem
class RsTurtleFileDataItem: public RsTurtleGenericTunnelItem
{
public:
RsTurtleFileDataItem() : RsTurtleGenericTunnelItem(RS_TURTLE_SUBTYPE_FILE_DATA) { setPriorityLevel(QOS_PRIORITY_RS_TURTLE_FILE_DATA) ;}
RsTurtleFileDataItem() : RsTurtleGenericTunnelItem(RS_TURTLE_SUBTYPE_FILE_DATA), chunk_offset(0), chunk_size(0), chunk_data(NULL) { setPriorityLevel(QOS_PRIORITY_RS_TURTLE_FILE_DATA) ;}
~RsTurtleFileDataItem() { clear() ; }
virtual bool shouldStampTunnel() const { return true ; }
@ -99,13 +99,13 @@ class RsTurtleFileMapItem: public RsTurtleGenericTunnelItem
class RsTurtleChunkCrcRequestItem: public RsTurtleGenericTunnelItem
{
public:
RsTurtleChunkCrcRequestItem() : RsTurtleGenericTunnelItem(RS_TURTLE_SUBTYPE_CHUNK_CRC_REQUEST) { setPriorityLevel(QOS_PRIORITY_RS_CHUNK_CRC_REQUEST);}
RsTurtleChunkCrcRequestItem() : RsTurtleGenericTunnelItem(RS_TURTLE_SUBTYPE_CHUNK_CRC_REQUEST), chunk_number(0) { setPriorityLevel(QOS_PRIORITY_RS_CHUNK_CRC_REQUEST);}
virtual bool shouldStampTunnel() const { return false ; }
virtual Direction travelingDirection() const { return DIRECTION_SERVER ; }
uint32_t chunk_number ; // id of the chunk to CRC.
void clear() {}
void serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx);
};
@ -113,7 +113,7 @@ class RsTurtleChunkCrcRequestItem: public RsTurtleGenericTunnelItem
class RsTurtleChunkCrcItem: public RsTurtleGenericTunnelItem
{
public:
RsTurtleChunkCrcItem() : RsTurtleGenericTunnelItem(RS_TURTLE_SUBTYPE_CHUNK_CRC) { setPriorityLevel(QOS_PRIORITY_RS_CHUNK_CRC);}
RsTurtleChunkCrcItem() : RsTurtleGenericTunnelItem(RS_TURTLE_SUBTYPE_CHUNK_CRC), chunk_number(0) { setPriorityLevel(QOS_PRIORITY_RS_CHUNK_CRC);}
virtual bool shouldStampTunnel() const { return true ; }
virtual Direction travelingDirection() const { return DIRECTION_CLIENT ; }

View File

@ -59,7 +59,7 @@ const uint8_t QOS_PRIORITY_RS_GROUTER = 4 ; // relevant for items that travel
class RsGRouterItem: public RsItem
{
public:
RsGRouterItem(uint8_t grouter_subtype) : RsItem(RS_PKT_VERSION_SERVICE,RS_SERVICE_TYPE_GROUTER,grouter_subtype) {}
explicit RsGRouterItem(uint8_t grouter_subtype) : RsItem(RS_PKT_VERSION_SERVICE,RS_SERVICE_TYPE_GROUTER,grouter_subtype) {}
virtual ~RsGRouterItem() {}
@ -90,7 +90,7 @@ class RsGRouterNonCopyableObject
class RsGRouterAbstractMsgItem: public RsGRouterItem
{
public:
RsGRouterAbstractMsgItem(uint8_t pkt_subtype) : RsGRouterItem(pkt_subtype) {}
explicit RsGRouterAbstractMsgItem(uint8_t pkt_subtype) : RsGRouterItem(pkt_subtype), flags(0) {}
virtual ~RsGRouterAbstractMsgItem() {}
GRouterMsgPropagationId routing_id ;
@ -103,7 +103,7 @@ public:
class RsGRouterGenericDataItem: public RsGRouterAbstractMsgItem, public RsGRouterNonCopyableObject
{
public:
RsGRouterGenericDataItem() : RsGRouterAbstractMsgItem(RS_PKT_SUBTYPE_GROUTER_DATA) { setPriorityLevel(QOS_PRIORITY_RS_GROUTER) ; }
RsGRouterGenericDataItem() : RsGRouterAbstractMsgItem(RS_PKT_SUBTYPE_GROUTER_DATA), data_size(0), data_bytes(NULL), duplication_factor(0) { setPriorityLevel(QOS_PRIORITY_RS_GROUTER) ; }
virtual ~RsGRouterGenericDataItem() { clear() ; }
virtual void clear()
@ -144,7 +144,7 @@ class RsGRouterSignedReceiptItem: public RsGRouterAbstractMsgItem
class RsGRouterTransactionItem: public RsGRouterItem
{
public:
RsGRouterTransactionItem(uint8_t pkt_subtype) : RsGRouterItem(pkt_subtype) {}
explicit RsGRouterTransactionItem(uint8_t pkt_subtype) : RsGRouterItem(pkt_subtype) {}
virtual ~RsGRouterTransactionItem() {}
@ -156,7 +156,7 @@ class RsGRouterTransactionItem: public RsGRouterItem
class RsGRouterTransactionChunkItem: public RsGRouterTransactionItem, public RsGRouterNonCopyableObject
{
public:
RsGRouterTransactionChunkItem() : RsGRouterTransactionItem(RS_PKT_SUBTYPE_GROUTER_TRANSACTION_CHUNK) { setPriorityLevel(QOS_PRIORITY_RS_GROUTER) ; }
RsGRouterTransactionChunkItem() : RsGRouterTransactionItem(RS_PKT_SUBTYPE_GROUTER_TRANSACTION_CHUNK), chunk_start(0), chunk_size(0), total_size(0), chunk_data(NULL) { setPriorityLevel(QOS_PRIORITY_RS_GROUTER) ; }
virtual ~RsGRouterTransactionChunkItem() { free(chunk_data) ; }
@ -217,7 +217,7 @@ class RsGRouterMatrixCluesItem: public RsGRouterItem
class RsGRouterMatrixTrackItem: public RsGRouterItem
{
public:
RsGRouterMatrixTrackItem() : RsGRouterItem(RS_PKT_SUBTYPE_GROUTER_MATRIX_TRACK)
RsGRouterMatrixTrackItem() : RsGRouterItem(RS_PKT_SUBTYPE_GROUTER_MATRIX_TRACK), time_stamp(0)
{ setPriorityLevel(0) ; } // this item is never sent through the network
virtual void serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx);
@ -271,7 +271,7 @@ class RsGRouterRoutingInfoItem: public RsGRouterItem, public GRouterRoutingInfo,
class RsGRouterSerialiser: public RsServiceSerializer
{
public:
RsGRouterSerialiser(SerializationFlags flags = SERIALIZATION_FLAG_NONE) : RsServiceSerializer(RS_SERVICE_TYPE_GROUTER,RsGenericSerializer::FORMAT_BINARY,flags) {}
explicit RsGRouterSerialiser(SerializationFlags flags = SERIALIZATION_FLAG_NONE) : RsServiceSerializer(RS_SERVICE_TYPE_GROUTER,RsGenericSerializer::FORMAT_BINARY,flags) {}
virtual RsItem *create_item(uint16_t service,uint8_t subtype) const ;
};

View File

@ -97,11 +97,17 @@ class GRouterRoutingInfo
// ovoids lots of duplications if the class is copied.
public:
GRouterRoutingInfo()
{
data_transaction_TS = 0 ; // this is not serialised.
data_item = NULL ;
receipt_item = NULL ;
}
: data_status(0)
, tunnel_status(0)
, received_time_TS(0)
, last_sent_TS(0)
, last_tunnel_request_TS(0)
, sending_attempts(0)
, routing_flags(0)
, data_item(NULL)
, receipt_item(NULL)
, data_transaction_TS(0) // this is not serialised.
{}
uint32_t data_status ; // pending, waiting, etc.
uint32_t tunnel_status ; // status of tunnel handling.

View File

@ -204,7 +204,7 @@
const std::string p3GRouter::SERVICE_INFO_APP_NAME = "Global Router" ;
p3GRouter::p3GRouter(p3ServiceControl *sc, RsGixs *is)
: p3Service(), p3Config(), mServiceControl(sc), mGixs(is), grMtx("GRouter")
: p3Service(), p3Config(), mServiceControl(sc), mTurtle(NULL), mGixs(is), grMtx("GRouter")
{
addSerialType(new RsGRouterSerialiser()) ;
@ -2292,6 +2292,8 @@ bool p3GRouter::saveList(bool& cleanup,std::list<RsItem*>& items)
{
RsGRouterRoutingInfoItem *item = new RsGRouterRoutingInfoItem ;
#warning: Cppcheck(cstyleCast): C-style pointer casting
// cppcheck-suppress cstyleCast
*(GRouterRoutingInfo*)item = it->second ; // copy all members
item->data_item = it->second.data_item->duplicate() ; // deep copy, because we call delete on the object, and the item might be removed before we handle it in the client.

View File

@ -79,7 +79,7 @@ class GRouterDataInfo
{
// ! This class does not have a copy constructor that duplicates the incoming data buffer. This is on purpose!
public:
GRouterDataInfo()
GRouterDataInfo() : last_activity_TS(0)
{
incoming_data_buffer = NULL ;
}
@ -339,7 +339,7 @@ private:
p3ServiceControl *mServiceControl ;
p3turtle *mTurtle ;
RsGixs *mGixs ;
p3LinkMgr *mLinkMgr ;
//p3LinkMgr *mLinkMgr ;
// Multi-thread protection mutex.
//

View File

@ -48,7 +48,7 @@ struct GxsTokenQueueItem
class GxsTokenQueue
{
public:
GxsTokenQueue(RsGenExchange *gxs) :
explicit GxsTokenQueue(RsGenExchange *gxs) :
mGenExchange(gxs), mQueueMtx("GxsTokenQueueMtx") {}
bool queueRequest(uint32_t token, uint32_t req_type);

View File

@ -82,6 +82,7 @@ RsGenExchange::RsGenExchange(RsGeneralDataService *gds, RsNetworkExchangeService
mLastClean((int)time(NULL) - (int)(RSRandom::random_u32() % MSG_CLEANUP_PERIOD)), // this helps unsynchronising the checks for the different services
mMsgCleanUp(NULL),
mChecking(false),
mCheckStarted(false),
mLastCheck((int)time(NULL) - (int)(RSRandom::random_u32() % INTEGRITY_CHECK_PERIOD) + 120), // this helps unsynchronising the checks for the different services, with 2 min security to avoid checking right away before statistics come up.
mIntegrityCheck(NULL),
SIGN_MAX_WAITING_TIME(60),
@ -1234,7 +1235,7 @@ bool RsGenExchange::getMsgMeta(const uint32_t &token,
#ifdef GEN_EXCH_DEBUG
std::cerr << "RsGenExchange::getMsgMeta(): retrieving meta data for token " << token << std::endl;
#endif
std::list<RsGxsMsgMetaData*> metaL;
//std::list<RsGxsMsgMetaData*> metaL;
GxsMsgMetaResult result;
bool ok = mDataAccess->getMsgSummary(token, result);
@ -2168,15 +2169,13 @@ void RsGenExchange::publishMsgs()
uint32_t size = mSerialiser->size(msgItem);
char* mData = new char[size];
bool serialOk = false;
// for fatal sign creation
bool createOk = false;
// if sign requests to try later
bool tryLater = false;
serialOk = mSerialiser->serialise(msgItem, mData, &size);
bool serialOk = mSerialiser->serialise(msgItem, mData, &size);
if(serialOk)
{
@ -2266,6 +2265,8 @@ void RsGenExchange::publishMsgs()
char* metaDataBuff = new char[size];
bool s = msg->metaData->serialise(metaDataBuff, &size);
s &= msg->meta.setBinData(metaDataBuff, size);
if (!s)
std::cerr << "(WW) Can't serialise or set bin data" << std::endl;
msg->metaData->mMsgStatus = GXS_SERV::GXS_MSG_STATUS_UNPROCESSED;
msgId = msg->msgId;

View File

@ -176,7 +176,7 @@ public:
class GixsReputation
{
public:
GixsReputation() {}
GixsReputation() :reputation_level(0) {}
RsGxsId id;
uint32_t reputation_level ;

View File

@ -37,7 +37,7 @@ typedef std::map< RsGxsGroupId, RsGxsGrpMetaData* > GrpMetaFilter;
class RsGxsDataAccess : public RsTokenService
{
public:
RsGxsDataAccess(RsGeneralDataService* ds);
explicit RsGxsDataAccess(RsGeneralDataService* ds);
virtual ~RsGxsDataAccess() ;
public:

View File

@ -293,7 +293,7 @@ private:
enum CheckState { CheckStart, CheckChecking };
public:
GxsTransIntegrityCleanupThread(RsGeneralDataService *const dataService): mDs(dataService),mMtx("GxsTransIntegrityCheck") { mDone=false;}
explicit GxsTransIntegrityCleanupThread(RsGeneralDataService *const dataService): mDs(dataService),mMtx("GxsTransIntegrityCheck") { mDone=false;}
bool isDone();
void run();

View File

@ -39,7 +39,7 @@ public:
class RsGxsTransBaseMsgItem : public RsGxsMsgItem
{
public:
RsGxsTransBaseMsgItem(GxsTransItemsSubtypes subtype) :
explicit RsGxsTransBaseMsgItem(GxsTransItemsSubtypes subtype) :
RsGxsMsgItem( RS_SERVICE_TYPE_GXS_TRANS,
static_cast<uint8_t>(subtype) ), mailId(0) {}

View File

@ -124,7 +124,7 @@ static const uint32_t GXS_TUNNEL_AES_KEY_SIZE = 16 ;
class p3GxsTunnelService: public RsGxsTunnelService, public RsTurtleClientService, public p3Service
{
public:
p3GxsTunnelService(RsGixs *pids) ;
explicit p3GxsTunnelService(RsGixs *pids) ;
virtual void connectToTurtleRouter(p3turtle *) ;
// Creates the invite if the public key of the distant peer is available.

View File

@ -53,7 +53,7 @@ typedef uint64_t GxsTunnelDHSessionId ;
class RsGxsTunnelItem: public RsItem
{
public:
RsGxsTunnelItem(uint8_t item_subtype) : RsItem(RS_PKT_VERSION_SERVICE,RS_SERVICE_TYPE_GXS_TUNNEL,item_subtype)
explicit RsGxsTunnelItem(uint8_t item_subtype) : RsItem(RS_PKT_VERSION_SERVICE,RS_SERVICE_TYPE_GXS_TUNNEL,item_subtype)
{
setPriorityLevel(QOS_PRIORITY_RS_CHAT_ITEM) ;
}
@ -72,8 +72,8 @@ class RsGxsTunnelItem: public RsItem
class RsGxsTunnelDataItem: public RsGxsTunnelItem
{
public:
RsGxsTunnelDataItem() :RsGxsTunnelItem(RS_PKT_SUBTYPE_GXS_TUNNEL_DATA) { data=NULL ;data_size=0;service_id=0;unique_item_counter=0; }
RsGxsTunnelDataItem(uint8_t subtype) :RsGxsTunnelItem(subtype) { data=NULL ;data_size=0; }
RsGxsTunnelDataItem() :RsGxsTunnelItem(RS_PKT_SUBTYPE_GXS_TUNNEL_DATA), unique_item_counter(0), flags(0), service_id(0), data_size(0), data(NULL) {}
explicit RsGxsTunnelDataItem(uint8_t subtype) :RsGxsTunnelItem(subtype) , unique_item_counter(0), flags(0), service_id(0), data_size(0), data(NULL) {}
virtual ~RsGxsTunnelDataItem() {}
virtual void clear() {}
@ -108,7 +108,7 @@ class RsGxsTunnelStatusItem: public RsGxsTunnelItem
class RsGxsTunnelDataAckItem: public RsGxsTunnelItem
{
public:
RsGxsTunnelDataAckItem() :RsGxsTunnelItem(RS_PKT_SUBTYPE_GXS_TUNNEL_DATA_ACK) {}
RsGxsTunnelDataAckItem() :RsGxsTunnelItem(RS_PKT_SUBTYPE_GXS_TUNNEL_DATA_ACK), unique_item_counter(0) {}
RsGxsTunnelDataAckItem(void *data,uint32_t size) ; // deserialization
virtual ~RsGxsTunnelDataAckItem() {}
@ -125,7 +125,7 @@ class RsGxsTunnelDataAckItem: public RsGxsTunnelItem
class RsGxsTunnelDHPublicKeyItem: public RsGxsTunnelItem
{
public:
RsGxsTunnelDHPublicKeyItem() :RsGxsTunnelItem(RS_PKT_SUBTYPE_GXS_TUNNEL_DH_PUBLIC_KEY) {}
RsGxsTunnelDHPublicKeyItem() :RsGxsTunnelItem(RS_PKT_SUBTYPE_GXS_TUNNEL_DH_PUBLIC_KEY), public_key(NULL) {}
RsGxsTunnelDHPublicKeyItem(void *data,uint32_t size) ; // deserialization
virtual ~RsGxsTunnelDHPublicKeyItem() ;
@ -141,8 +141,8 @@ class RsGxsTunnelDHPublicKeyItem: public RsGxsTunnelItem
private:
// make the object non copy-able
RsGxsTunnelDHPublicKeyItem(const RsGxsTunnelDHPublicKeyItem&) : RsGxsTunnelItem(RS_PKT_SUBTYPE_GXS_TUNNEL_DH_PUBLIC_KEY) {}
const RsGxsTunnelDHPublicKeyItem& operator=(const RsGxsTunnelDHPublicKeyItem&) { return *this ;}
RsGxsTunnelDHPublicKeyItem(const RsGxsTunnelDHPublicKeyItem&) : RsGxsTunnelItem(RS_PKT_SUBTYPE_GXS_TUNNEL_DH_PUBLIC_KEY), public_key(NULL) {}
const RsGxsTunnelDHPublicKeyItem& operator=(const RsGxsTunnelDHPublicKeyItem&) { public_key = NULL; return *this ;}
};
class RsGxsTunnelSerialiser: public RsServiceSerializer

View File

@ -92,8 +92,10 @@ class PGPHandler
// The client should supply a memory chunk to store the data. The length will be updated to the real length of the data.
//
bool encryptDataBin(const RsPgpId& key_id,const void *data, const uint32_t len, unsigned char *encrypted_data, unsigned int *encrypted_data_len) ;
bool decryptDataBin(const RsPgpId& key_id,const void *data, const uint32_t len, unsigned char *decrypted_data, unsigned int *decrypted_data_len) ;
bool encryptDataBin(const RsPgpId& key_id,const void *data, const uint32_t len
, unsigned char *encrypted_data, unsigned int *encrypted_data_len) ;
bool decryptDataBin(const RsPgpId& key_id,const void *encrypted_data, const uint32_t encrypted_len
, unsigned char *data, unsigned int *data_len) ;
bool encryptTextToFile(const RsPgpId& key_id,const std::string& text,const std::string& outfile) ;
bool decryptTextFromFile(const RsPgpId& key_id,std::string& text,const std::string& encrypted_inputfile) ;

View File

@ -72,7 +72,7 @@ void RsCertificate::addPacket(uint8_t ptag, const unsigned char *mem, size_t siz
std::string RsCertificate::toStdString() const
{
std::string res ;
//std::string res ;
size_t BS = 1000 ;
size_t p = 0 ;
unsigned char *buf = new unsigned char[BS] ;

View File

@ -13,7 +13,7 @@ class RsCertificate
// Constructs from text.
// - new format: The input string should only contain radix chars and spaces/LF/tabs.
//
RsCertificate(const std::string& input_string) ;
explicit RsCertificate(const std::string& input_string) ;
// Constructs from binary gpg key, and RsPeerDetails.
//
@ -52,7 +52,11 @@ class RsCertificate
static void addPacket(uint8_t ptag, const unsigned char *mem, size_t size, unsigned char *& buf, size_t& offset, size_t& buf_size) ;
RsCertificate(const RsCertificate&) {} // non copy-able
const RsCertificate& operator=(const RsCertificate&) { return *this ;} // non copy-able
const RsCertificate& operator=(const RsCertificate&)
{ memset(ipv4_external_ip_and_port,0,6); memset(ipv4_internal_ip_and_port,0,6);
binary_pgp_key = NULL; binary_pgp_key_size = 0;
only_pgp = false; hidden_node = false;
return *this ;} // non copy-able
unsigned char ipv4_external_ip_and_port[6] ;
unsigned char ipv4_internal_ip_and_port[6] ;

View File

@ -45,7 +45,7 @@ public:
class RsPluginManager: public RsPluginHandler, public p3Config
{
public:
RsPluginManager(const RsFileHash& current_executable_sha1_hash) ;
explicit RsPluginManager(const RsFileHash& current_executable_sha1_hash) ;
virtual ~RsPluginManager() {}
// ------------ Derived from RsPluginHandler ----------------//

View File

@ -127,11 +127,12 @@ AuthGPG::AuthGPG(const std::string& path_to_public_keyring,const std::string& pa
gpgMtxService("AuthGPG-service"),
gpgMtxEngine("AuthGPG-engine"),
gpgMtxData("AuthGPG-data"),
gpgKeySelected(false)
mStoreKeyTime(0),
gpgKeySelected(false),
_force_sync_database(false),
mCount(0)
{
_force_sync_database = false ;
mCount = 0;
start("AuthGPG");
start("AuthGPG");
}
/* This function is called when retroshare is first started

View File

@ -55,7 +55,7 @@ class RsPeerDetails;
class AuthGPGOperation
{
public:
AuthGPGOperation(void *userdata)
explicit AuthGPGOperation(void *userdata)
{
m_userdata = userdata;
}

View File

@ -246,6 +246,7 @@ sslcert::sslcert(X509 *x509, const RsPeerId& pid)
certificate = x509;
id = pid;
#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
// cppcheck-suppress useInitializationList
name = getX509CNString(x509->cert_info->subject);
org = getX509OrgString(x509->cert_info->subject);
location = getX509LocString(x509->cert_info->subject);
@ -363,7 +364,8 @@ static int initLib = 0;
//
// std::string dh_prime_2048_dec = "30651576830996935311378276950670996791883170963804289256203421500259588715033040934547350194073369837229137842804826417332761673984632102152477971341551955103053338169949165519208562998954887445690136488713010579430413255432398961330773637820158790237012997356731669148258317860643591694814197514454546928317578771868379525705082166818553884557266645700906836702542808787791878865135741211056957383668479369231868698451684633965462539374994559481908068730787128654626819903401038534403722014687647173327537458614224702967073490136394698912372792187651228785689025073104374674728645661275001416541267543884923191810923";
//
std::string dh_prime_2048_hex = "B3B86A844550486C7EA459FA468D3A8EFD71139593FE1C658BBEFA9B2FC0AD2628242C2CDC2F91F5B220ED29AAC271192A7374DFA28CDDCA70252F342D0821273940344A7A6A3CB70C7897A39864309F6CAC5C7EA18020EF882693CA2C12BB211B7BA8367D5A7C7252A5B5E840C9E8F081469EBA0B98BCC3F593A4D9C4D5DF539362084F1B9581316C1F80FDAD452FD56DBC6B8ED0775F596F7BB22A3FE2B4753764221528D33DB4140DE58083DB660E3E105123FC963BFF108AC3A268B7380FFA72005A1515C371287C5706FFA6062C9AC73A9B1A6AC842C2764CDACFC85556607E86611FDF486C222E4896CDF6908F239E177ACC641FCBFF72A758D1C10CBB" ;
//Not used (should be here: /libretroshare/src/gxstunnel/p3gxstunnel.cc:1131
//std::string dh_prime_2048_hex = "B3B86A844550486C7EA459FA468D3A8EFD71139593FE1C658BBEFA9B2FC0AD2628242C2CDC2F91F5B220ED29AAC271192A7374DFA28CDDCA70252F342D0821273940344A7A6A3CB70C7897A39864309F6CAC5C7EA18020EF882693CA2C12BB211B7BA8367D5A7C7252A5B5E840C9E8F081469EBA0B98BCC3F593A4D9C4D5DF539362084F1B9581316C1F80FDAD452FD56DBC6B8ED0775F596F7BB22A3FE2B4753764221528D33DB4140DE58083DB660E3E105123FC963BFF108AC3A268B7380FFA72005A1515C371287C5706FFA6062C9AC73A9B1A6AC842C2764CDACFC85556607E86611FDF486C222E4896CDF6908F239E177ACC641FCBFF72A758D1C10CBB" ;
std::string dh_prime_4096_hex = "A6F5777292D9E6BB95559C9124B9119E6771F11F2048C8FE74F4E8140494520972A087EF1D60B73894F1C5D509DD15D96CF379E9DDD46CE51B748085BACB440D915565782C73AF3A9580CE788441D1DA4D114E3D302CAB45A061ABCFC1F7E9200AE019CB923B77E096FA9377454A16FFE91D86535FF23E075B3E714F785CD7606E9CBD9D06F01CAFA2271883D649F13ABE170D714F6B6EC064C5BF35C4F4BDA5EF5ED5E70D5DC78F1AC1CDC04EEDAE8ADD65C4A9E27368E0B2C8595DD7626D763BFFB15364B3CCA9FCE814B9226B35FE652F4B041F0FF6694D6A482B0EF48CA41163D083AD2DE7B7A068BB05C0453E9D008551C7F67993A3EF2C4874F0244F78C4E0997BD31AB3BD88446916B499B2513DD5BA002063BD38D2CE55D29D071399D5CEE99458AF6FDC104A61CA3FACDAC803CBDE62B4C0EAC946D0E12F05CE9E94497110D64E611D957423B8AA412D84EC83E6E70E0977A31D6EE056D0527D4667D7242A77C9B679D191562E4026DA9C35FF85666296D872ED548E0FFE1A677FCC373C1F490CAB4F53DFD8735C0F1DF02FEAD824A217FDF4E3404D38A5BBC719C6622630FCD34F6F1968AF1B66A4AB1A9FCF653DA96EB3A42AF6FCFEA0547B8F314A527C519949007D7FA1726FF3D33EC46393B0207AA029E5EA574BDAC94D78894B22A2E3303E65A3F820DF57DB44951DE4E973C016C57F7A242D0BC53BC563AF" ;
@ -816,8 +818,6 @@ X509 *AuthSSLimpl::SignX509ReqWithGPG(X509_REQ *req, long /*days*/)
const EVP_MD *type = EVP_sha1();
EVP_MD_CTX *ctx = EVP_MD_CTX_create();
unsigned char *buf_in=NULL;
unsigned char *buf_hashout=NULL,*buf_sigout=NULL;
int inl=0,hashoutl=0;
int sigoutl=0;
X509_ALGOR *a;
@ -854,17 +854,18 @@ X509 *AuthSSLimpl::SignX509ReqWithGPG(X509_REQ *req, long /*days*/)
/* input buffer */
#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
inl=i2d(data,NULL);
buf_in=(unsigned char *)OPENSSL_malloc((unsigned int)inl);
unsigned char *buf_in=(unsigned char *)OPENSSL_malloc((unsigned int)inl);
unsigned char *p=NULL;
#else
unsigned char *buf_in=NULL;
inl=i2d_re_X509_tbs(x509,&buf_in) ; // this does the i2d over x509->cert_info
#endif
hashoutl=EVP_MD_size(type);
buf_hashout=(unsigned char *)OPENSSL_malloc((unsigned int)hashoutl);
unsigned char *buf_hashout=(unsigned char *)OPENSSL_malloc((unsigned int)hashoutl);
sigoutl=2048; // hashoutl; //EVP_PKEY_size(pkey);
buf_sigout=(unsigned char *)OPENSSL_malloc((unsigned int)sigoutl);
unsigned char *buf_sigout=(unsigned char *)OPENSSL_malloc((unsigned int)sigoutl);
if ((buf_in == NULL) || (buf_hashout == NULL) || (buf_sigout == NULL))
{
@ -995,25 +996,24 @@ bool AuthSSLimpl::AuthX509WithGPG(X509 *x509,uint32_t& diagnostic)
const EVP_MD *type = EVP_sha1();
EVP_MD_CTX *ctx = EVP_MD_CTX_create();
unsigned char *buf_in=NULL;
unsigned char *buf_hashout=NULL,*buf_sigout=NULL;
int inl=0,hashoutl=0;
int sigoutl=0;
/* input buffer */
#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
inl=i2d(data,NULL);
buf_in=(unsigned char *)OPENSSL_malloc((unsigned int)inl);
unsigned char *buf_in=(unsigned char *)OPENSSL_malloc((unsigned int)inl);
unsigned char *p=NULL;
#else
unsigned char *buf_in=NULL;
inl=i2d_re_X509_tbs(x509,&buf_in) ; // this does the i2d over x509->cert_info
#endif
hashoutl=EVP_MD_size(type);
buf_hashout=(unsigned char *)OPENSSL_malloc((unsigned int)hashoutl);
unsigned char *buf_hashout=(unsigned char *)OPENSSL_malloc((unsigned int)hashoutl);
sigoutl=2048; //hashoutl; //EVP_PKEY_size(pkey);
buf_sigout=(unsigned char *)OPENSSL_malloc((unsigned int)sigoutl);
unsigned char *buf_sigout=(unsigned char *)OPENSSL_malloc((unsigned int)sigoutl);
#ifdef AUTHSSL_DEBUG
std::cerr << "Buffer Sizes: in: " << inl;
@ -1445,10 +1445,9 @@ bool AuthSSLimpl::decrypt(void *&out, int &outlen, const void *in, int inlen)
// outlen = inlen;
EVP_CIPHER_CTX *ctx = EVP_CIPHER_CTX_new();
int eklen = 0, net_ekl = 0;
unsigned char *ek = NULL;
unsigned char iv[EVP_MAX_IV_LENGTH];
int ek_mkl = EVP_PKEY_size(mOwnPrivateKey);
ek = (unsigned char*)malloc(ek_mkl);
unsigned char *ek = (unsigned char*)malloc(ek_mkl);
if(ek == NULL)
{
@ -1505,7 +1504,7 @@ bool AuthSSLimpl::decrypt(void *&out, int &outlen, const void *in, int inlen)
return false;
}
in_offset += out_currOffset;
//in_offset += out_currOffset;
outlen += out_currOffset;
if(!EVP_OpenFinal(ctx, (unsigned char*)out + out_currOffset, &out_currOffset)) {

View File

@ -151,7 +151,7 @@ class p3ConfigMgr
/**
* @param bdir base directory: where config files will be saved
*/
p3ConfigMgr(std::string bdir);
explicit p3ConfigMgr(std::string bdir);
/**
* checks and update all added configurations

View File

@ -350,7 +350,7 @@ bool p3HistoryMgr::loadList(std::list<RsItem*>& load)
if (kit->key == "MAX_STORAGE_TIME") {
uint32_t val ;
if (sscanf(kit->value.c_str(), "%d", &val) == 1)
if (sscanf(kit->value.c_str(), "%u", &val) == 1)
mMaxStorageDurationSeconds = val ;
#ifdef HISTMGR_DEBUG

View File

@ -326,7 +326,6 @@ void p3LinkMgrIMPL::statusTick()
std::cerr << "p3LinkMgrIMPL::statusTick()" << std::endl;
#endif
std::list<RsPeerId> retryIds;
std::list<RsPeerId>::iterator it2;
//std::list<std::string> dummyToRemove;
{
@ -362,8 +361,8 @@ void p3LinkMgrIMPL::statusTick()
}
#ifndef P3CONNMGR_NO_AUTO_CONNECTION
for(it2 = retryIds.begin(); it2 != retryIds.end(); ++it2)
std::list<RsPeerId>::iterator it2;
for(it2 = retryIds.begin(); it2 != retryIds.end(); ++it2)
{
#ifdef LINKMGR_DEBUG_TICK
std::cerr << "p3LinkMgrIMPL::statusTick() RETRY TIMEOUT for: ";

View File

@ -923,8 +923,8 @@ void p3NetMgrIMPL::netExtCheck()
//pqiNotify *notify = getPqiNotify();
//if (notify)
{
std::string title =
"Warning: Bad Firewall Configuration";
//std::string title =
// "Warning: Bad Firewall Configuration";
std::string msg;
msg += " **** WARNING **** \n";
@ -1814,7 +1814,7 @@ void p3NetMgrIMPL::updateNetStateBox_temporal()
std::cerr << std::endl;
std::cerr << "\tNetState: " << netstatestr;
std::cerr << std::endl;
std::cerr << "\tConnectModes: " << netstatestr;
std::cerr << "\tConnectModes: " << connectstr;
std::cerr << std::endl;
std::cerr << "\tNetworkMode: " << netmodestr;
std::cerr << std::endl;

View File

@ -42,17 +42,17 @@ static const uint8_t RS_PKT_SUBTYPE_SERVICE_CONTROL_SERVICE_PERMISSIONS = 0x01 ;
class RsServiceControlItem: public RsItem
{
public:
RsServiceControlItem(uint8_t item_subtype) : RsItem(RS_PKT_VERSION_SERVICE,RS_SERVICE_TYPE_SERVICE_CONTROL,item_subtype) {}
explicit RsServiceControlItem(uint8_t item_subtype) : RsItem(RS_PKT_VERSION_SERVICE,RS_SERVICE_TYPE_SERVICE_CONTROL,item_subtype) {}
};
class RsServicePermissionItem: public RsServiceControlItem, public RsServicePermissions
{
public:
RsServicePermissionItem(): RsServiceControlItem(RS_PKT_SUBTYPE_SERVICE_CONTROL_SERVICE_PERMISSIONS) {}
RsServicePermissionItem(const RsServicePermissions& perms) : RsServiceControlItem(RS_PKT_SUBTYPE_SERVICE_CONTROL_SERVICE_PERMISSIONS), RsServicePermissions(perms) {}
RsServicePermissionItem(): RsServiceControlItem(RS_PKT_SUBTYPE_SERVICE_CONTROL_SERVICE_PERMISSIONS) {}
explicit RsServicePermissionItem(const RsServicePermissions& perms) : RsServiceControlItem(RS_PKT_SUBTYPE_SERVICE_CONTROL_SERVICE_PERMISSIONS), RsServicePermissions(perms) {}
virtual void serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx)
{
virtual void serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx)
{
RsTypeSerializer::serial_process<uint32_t>(j,ctx,mServiceId,"mServiceId") ;
RsTypeSerializer::serial_process (j,ctx,TLV_TYPE_STR_NAME,mServiceName,"mServiceName") ;
RsTypeSerializer::serial_process<bool> (j,ctx,mDefaultAllowed,"mDefaultAllowed") ;
@ -86,9 +86,10 @@ public:
RsServiceControl *rsServiceControl = NULL;
p3ServiceControl::p3ServiceControl(p3LinkMgr *linkMgr)
:RsServiceControl(), p3Config(),
mLinkMgr(linkMgr), mOwnPeerId(linkMgr->getOwnId()),
mCtrlMtx("p3ServiceControl"), mMonitorMtx("P3ServiceControl::Monitor")
: RsServiceControl(), p3Config(),
mLinkMgr(linkMgr), mOwnPeerId(linkMgr->getOwnId()),
mCtrlMtx("p3ServiceControl"), mMonitorMtx("P3ServiceControl::Monitor"),
mServiceServer(NULL)
{
mSerialiser = new ServiceControlSerialiser ;
}
@ -356,7 +357,7 @@ bool p3ServiceControl::getServicePermissions(uint32_t serviceId, RsServicePermis
return true;
}
bool p3ServiceControl::createDefaultPermissions_locked(uint32_t serviceId, std::string serviceName, bool defaultOn)
bool p3ServiceControl::createDefaultPermissions_locked(uint32_t serviceId, const std::string& serviceName, bool defaultOn)
{
std::map<uint32_t, RsServicePermissions>::iterator it;
it = mServicePermissionMap.find(serviceId);
@ -780,7 +781,7 @@ void p3ServiceControl::recordFilterChanges_locked(const RsPeerId &peerId,
#endif
/* find differences */
std::map<uint32_t, bool> changes;
//std::map<uint32_t, bool> changes;
std::set<uint32_t>::const_iterator it1, it2, eit1, eit2;
it1 = originalFilter.mAllowedServices.begin();
eit1 = originalFilter.mAllowedServices.end();
@ -796,7 +797,7 @@ void p3ServiceControl::recordFilterChanges_locked(const RsPeerId &peerId,
std::cerr << std::endl;
#endif
// removal
changes[*it1] = false;
//changes[*it1] = false;
filterChangeRemoved_locked(peerId, *it1);
++it1;
}
@ -808,7 +809,7 @@ void p3ServiceControl::recordFilterChanges_locked(const RsPeerId &peerId,
#endif
// addition.
filterChangeAdded_locked(peerId, *it2);
changes[*it2] = true;
//changes[*it2] = true;
++it2;
}
else
@ -826,7 +827,7 @@ void p3ServiceControl::recordFilterChanges_locked(const RsPeerId &peerId,
std::cerr << std::endl;
#endif
// removal
changes[*it1] = false;
//changes[*it1] = false;
filterChangeRemoved_locked(peerId, *it1);
}
@ -837,7 +838,7 @@ void p3ServiceControl::recordFilterChanges_locked(const RsPeerId &peerId,
std::cerr << std::endl;
#endif
// addition.
changes[*it2] = true;
//changes[*it2] = true;
filterChangeAdded_locked(peerId, *it2);
}
@ -938,7 +939,7 @@ void p3ServiceControl::filterChangeRemoved_locked(const RsPeerId &peerId, uint32
std::cerr << std::endl;
#endif
std::map<uint32_t, std::set<RsPeerId> >::iterator mit;
//std::map<uint32_t, std::set<RsPeerId> >::iterator mit;
std::set<RsPeerId> &peerSet = mServicePeerMap[serviceId];
std::set<RsPeerId>::iterator sit;
@ -969,7 +970,7 @@ void p3ServiceControl::filterChangeAdded_locked(const RsPeerId &peerId, uint32_t
std::cerr << std::endl;
#endif
std::map<uint32_t, std::set<RsPeerId> >::iterator mit;
//std::map<uint32_t, std::set<RsPeerId> >::iterator mit;
std::set<RsPeerId> &peerSet = mServicePeerMap[serviceId];
@ -1366,7 +1367,7 @@ void RsServicePermissions::resetPermission(const RsPeerId& peerId)
RsServiceInfo::RsServiceInfo(
const uint16_t service_type,
const std::string service_name,
const std::string& service_name,
const uint16_t version_major,
const uint16_t version_minor,
const uint16_t min_version_major,

View File

@ -66,7 +66,7 @@ public:
/**
*/
p3ServiceControl(p3LinkMgr *linkMgr);
explicit p3ServiceControl(p3LinkMgr *linkMgr);
/**
* checks and update all added configurations
@ -171,7 +171,7 @@ bool updateFilterByPeer_locked(const RsPeerId &peerId);
void filterChangeAdded_locked(const RsPeerId &peerId, uint32_t serviceId);
void filterChangeRemoved_locked(const RsPeerId &peerId, uint32_t serviceId);
bool createDefaultPermissions_locked(uint32_t serviceId, std::string serviceName, bool defaultOn);
bool createDefaultPermissions_locked(uint32_t serviceId, const std::string& serviceName, bool defaultOn);
bool peerHasPermissionForService_locked(const RsPeerId &peerId, uint32_t serviceId);
p3LinkMgr *mLinkMgr;

View File

@ -192,7 +192,7 @@ class NetInterface;
class PQInterface: public RateInterface
{
public:
PQInterface(const RsPeerId &id) :peerId(id) { return; }
explicit PQInterface(const RsPeerId &id) :peerId(id) { return; }
virtual ~PQInterface() { return; }
/*!

View File

@ -196,7 +196,7 @@ bool pqihandler::AddSearchModule(SearchModule *mod)
{
RsStackMutex stack(coreMtx); /**************** LOCKED MUTEX ****************/
// if peerid used -> error.
std::map<RsPeerId, SearchModule *>::iterator it;
//std::map<RsPeerId, SearchModule *>::iterator it;
if (mod->peerid != mod->pqi->PeerId())
{
// ERROR!

View File

@ -36,7 +36,7 @@
class Indicator
{
public:
Indicator(uint16_t n = 1)
explicit Indicator(uint16_t n = 1)
:num(n), changeFlags(n) {IndicateChanged();}
void IndicateChanged()
{

View File

@ -60,9 +60,11 @@ public:
{
public:
ItemQueue()
{
_item_count =0 ;
}
: _threshold(0.0)
, _counter(0.0)
, _inc(0.0)
, _item_count(0)
{}
void *pop()
{
if(_items.empty())

View File

@ -378,6 +378,11 @@ int pqissllistenbase::acceptconnection()
if(rsBanList != NULL && !rsBanList->isAddressAccepted(remote_addr, RSBANLIST_CHECKING_FLAGS_BLACKLIST))
{
std::cerr << " => early rejected at this point, because of blacklist." << std::endl;
#ifndef WINDOWS_SYS
close(fd);
#else
closesocket(fd);
#endif
return false ;
}
else

View File

@ -79,9 +79,9 @@ class RsGxsChannels: public RsGxsIfaceHelper, public RsGxsCommentService
{
public:
RsGxsChannels(RsGxsIface *gxs)
:RsGxsIfaceHelper(gxs) { return; }
virtual ~RsGxsChannels() { return; }
explicit RsGxsChannels(RsGxsIface *gxs)
:RsGxsIfaceHelper(gxs) {}
virtual ~RsGxsChannels() {}
/* Specific Service Data */
virtual bool getGroupData(const uint32_t &token, std::vector<RsGxsChannelGroup> &groups) = 0;

View File

@ -63,9 +63,9 @@ class RsGxsForums: public RsGxsIfaceHelper
{
public:
RsGxsForums(RsGxsIface *gxs)
:RsGxsIfaceHelper(gxs) { return; }
virtual ~RsGxsForums() { return; }
explicit RsGxsForums(RsGxsIface *gxs)
:RsGxsIfaceHelper(gxs) {}
virtual ~RsGxsForums() {}
/* Specific Service Data */
virtual bool getGroupData(const uint32_t &token, std::vector<RsGxsForumGroup> &groups) = 0;

View File

@ -266,8 +266,8 @@ class RsIdentity: public RsGxsIfaceHelper
public:
RsIdentity(RsGxsIface *gxs): RsGxsIfaceHelper(gxs) { return; }
virtual ~RsIdentity() { return; }
explicit RsIdentity(RsGxsIface *gxs): RsGxsIfaceHelper(gxs) {}
virtual ~RsIdentity() {}
/********************************************************************************************/
/********************************************************************************************/

View File

@ -159,7 +159,7 @@ class RsPhotoComment
public:
RsPhotoComment();
RsPhotoComment(const RsGxsPhotoCommentItem& comment);
explicit RsPhotoComment(const RsGxsPhotoCommentItem& comment);
RsPhotoComment& operator=(const RsGxsPhotoCommentItem& comment);

View File

@ -78,8 +78,8 @@ class RsPosted : public RsGxsIfaceHelper, public RsGxsCommentService
//static const uint32_t FLAG_MSGTYPE_POST;
//static const uint32_t FLAG_MSGTYPE_MASK;
RsPosted(RsGxsIface* gxs) : RsGxsIfaceHelper(gxs) { return; }
virtual ~RsPosted() { return; }
explicit RsPosted(RsGxsIface* gxs) : RsGxsIfaceHelper(gxs) {}
virtual ~RsPosted() {}
/* Specific Service Data */
virtual bool getGroupData(const uint32_t &token, std::vector<RsPostedGroup> &groups) = 0;

View File

@ -43,7 +43,7 @@ class RsServiceInfo
RsServiceInfo();
RsServiceInfo(
const uint16_t service_type,
const std::string service_name,
const std::string& service_name,
const uint16_t version_major,
const uint16_t version_minor,
const uint16_t min_version_major,

View File

@ -108,8 +108,8 @@ class RsWire: public RsGxsIfaceHelper
{
public:
RsWire(RsGxsIface *gxs): RsGxsIfaceHelper(gxs) { return; }
virtual ~RsWire() { return; }
explicit RsWire(RsGxsIface *gxs): RsGxsIfaceHelper(gxs) {}
virtual ~RsWire() {}
/* Specific Service Data */
virtual bool getGroupData(const uint32_t &token, std::vector<RsWireGroup> &groups) = 0;

View File

@ -72,9 +72,11 @@ class RsPeerNetItem: public RsItem
{
public:
RsPeerNetItem()
:RsItem(RS_PKT_VERSION1, RS_PKT_CLASS_CONFIG,
RS_PKT_TYPE_PEER_CONFIG,
RS_PKT_SUBTYPE_PEER_NET) {}
:RsItem(RS_PKT_VERSION1, RS_PKT_CLASS_CONFIG,
RS_PKT_TYPE_PEER_CONFIG,
RS_PKT_SUBTYPE_PEER_NET)
, netMode(0), vs_disc(0), vs_dht(0), lastContact(0), domain_port(0)
{}
virtual ~RsPeerNetItem(){}
virtual void clear();
@ -143,7 +145,7 @@ class RsPeerBandwidthLimitsItem : public RsItem
class RsNodeGroupItem: public RsItem
{
public:
RsNodeGroupItem(): RsItem(RS_PKT_VERSION1, RS_PKT_CLASS_CONFIG, RS_PKT_TYPE_PEER_CONFIG, RS_PKT_SUBTYPE_NODE_GROUP){}
RsNodeGroupItem(): RsItem(RS_PKT_VERSION1, RS_PKT_CLASS_CONFIG, RS_PKT_TYPE_PEER_CONFIG, RS_PKT_SUBTYPE_NODE_GROUP), flag(0) {}
virtual ~RsNodeGroupItem() {}
virtual void clear() { pgpList.TlvClear();}
@ -240,7 +242,7 @@ const uint32_t RS_FILE_CONFIG_CLEANUP_DELETE = 0x0001;
class RsFileConfigItem: public RsItem
{
public:
RsFileConfigItem() :RsItem(RS_PKT_VERSION1, RS_PKT_CLASS_CONFIG, RS_PKT_TYPE_FILE_CONFIG, RS_PKT_SUBTYPE_FILE_ITEM) {}
RsFileConfigItem() :RsItem(RS_PKT_VERSION1, RS_PKT_CLASS_CONFIG, RS_PKT_TYPE_FILE_CONFIG, RS_PKT_SUBTYPE_FILE_ITEM), flags(0) {}
virtual ~RsFileConfigItem() {}
virtual void clear() { parent_groups.TlvClear(); }

View File

@ -53,7 +53,9 @@
class RsGxsRecognReqItem: public RsItem
{
public:
RsGxsRecognReqItem() :RsItem(RS_PKT_VERSION_SERVICE, RS_SERVICE_TYPE_GXS_RECOGN, RS_PKT_SUBTYPE_RECOGN_REQ)
RsGxsRecognReqItem()
:RsItem(RS_PKT_VERSION_SERVICE, RS_SERVICE_TYPE_GXS_RECOGN, RS_PKT_SUBTYPE_RECOGN_REQ)
, issued_at(0), period(0), tag_class(0), tag_type(0)
{
setPriorityLevel(QOS_PRIORITY_DEFAULT);
return;
@ -79,7 +81,9 @@ public:
class RsGxsRecognTagItem: public RsItem
{
public:
RsGxsRecognTagItem() :RsItem(RS_PKT_VERSION_SERVICE, RS_SERVICE_TYPE_GXS_RECOGN, RS_PKT_SUBTYPE_RECOGN_TAG)
RsGxsRecognTagItem()
:RsItem(RS_PKT_VERSION_SERVICE, RS_SERVICE_TYPE_GXS_RECOGN, RS_PKT_SUBTYPE_RECOGN_TAG)
, valid_from(0), valid_to(0), tag_class(0), tag_type(0)
{
setPriorityLevel(QOS_PRIORITY_DEFAULT);
return;

View File

@ -85,7 +85,7 @@ public:
class RsGxsGrpConfigItem : public RsGxsNetServiceItem, public RsGxsGrpConfig
{
public:
RsGxsGrpConfigItem(uint16_t servType) : RsGxsNetServiceItem(servType, RS_PKT_SUBTYPE_GXS_GRP_CONFIG) {}
explicit RsGxsGrpConfigItem(uint16_t servType) : RsGxsNetServiceItem(servType, RS_PKT_SUBTYPE_GXS_GRP_CONFIG) {}
RsGxsGrpConfigItem(const RsGxsGrpConfig& m,uint16_t servType) : RsGxsNetServiceItem(servType, RS_PKT_SUBTYPE_GXS_GRP_CONFIG),RsGxsGrpConfig(m) {}
virtual ~RsGxsGrpConfigItem() {}
@ -106,7 +106,7 @@ public:
class RsGxsGrpUpdateItem : public RsGxsNetServiceItem, public RsGxsGrpUpdate
{
public:
RsGxsGrpUpdateItem(uint16_t servType) : RsGxsNetServiceItem(servType, RS_PKT_SUBTYPE_GXS_GRP_UPDATE) {clear();}
explicit RsGxsGrpUpdateItem(uint16_t servType) : RsGxsNetServiceItem(servType, RS_PKT_SUBTYPE_GXS_GRP_UPDATE) {clear();}
RsGxsGrpUpdateItem(const RsGxsGrpUpdate& u,uint16_t serv_type) : RsGxsNetServiceItem(serv_type, RS_PKT_SUBTYPE_GXS_GRP_UPDATE), RsGxsGrpUpdate(u) {}
virtual ~RsGxsGrpUpdateItem() {}
@ -128,7 +128,7 @@ public:
class RsGxsServerGrpUpdateItem : public RsGxsNetServiceItem, public RsGxsServerGrpUpdate
{
public:
RsGxsServerGrpUpdateItem(uint16_t servType) : RsGxsNetServiceItem(servType, RS_PKT_SUBTYPE_GXS_SERVER_GRP_UPDATE) { clear();}
explicit RsGxsServerGrpUpdateItem(uint16_t servType) : RsGxsNetServiceItem(servType, RS_PKT_SUBTYPE_GXS_SERVER_GRP_UPDATE) { clear();}
RsGxsServerGrpUpdateItem(const RsGxsServerGrpUpdate& u,uint16_t serv_type) : RsGxsNetServiceItem(serv_type, RS_PKT_SUBTYPE_GXS_SERVER_GRP_UPDATE), RsGxsServerGrpUpdate(u) {}
virtual ~RsGxsServerGrpUpdateItem() {}
@ -154,7 +154,7 @@ public:
class RsGxsMsgUpdateItem : public RsGxsNetServiceItem, public RsGxsMsgUpdate
{
public:
RsGxsMsgUpdateItem(uint16_t servType) : RsGxsNetServiceItem(servType, RS_PKT_SUBTYPE_GXS_MSG_UPDATE) { clear();}
explicit RsGxsMsgUpdateItem(uint16_t servType) : RsGxsNetServiceItem(servType, RS_PKT_SUBTYPE_GXS_MSG_UPDATE) { clear();}
RsGxsMsgUpdateItem(const RsGxsMsgUpdate& m,uint16_t servType) : RsGxsNetServiceItem(servType, RS_PKT_SUBTYPE_GXS_MSG_UPDATE), RsGxsMsgUpdate(m) {}
virtual ~RsGxsMsgUpdateItem() {}
@ -176,7 +176,7 @@ public:
class RsGxsServerMsgUpdateItem : public RsGxsNetServiceItem, public RsGxsServerMsgUpdate
{
public:
RsGxsServerMsgUpdateItem(uint16_t servType) : RsGxsNetServiceItem(servType, RS_PKT_SUBTYPE_GXS_SERVER_MSG_UPDATE) { clear();}
explicit RsGxsServerMsgUpdateItem(uint16_t servType) : RsGxsNetServiceItem(servType, RS_PKT_SUBTYPE_GXS_SERVER_MSG_UPDATE) { clear();}
RsGxsServerMsgUpdateItem(const RsGxsServerMsgUpdate& m,uint16_t servType) : RsGxsNetServiceItem(servType, RS_PKT_SUBTYPE_GXS_SERVER_MSG_UPDATE),RsGxsServerMsgUpdate(m) {}
virtual ~RsGxsServerMsgUpdateItem() {}
@ -191,7 +191,7 @@ class RsGxsUpdateSerialiser : public RsServiceSerializer
{
public:
RsGxsUpdateSerialiser(uint16_t servtype) : RsServiceSerializer(servtype), SERVICE_TYPE(servtype) {}
explicit RsGxsUpdateSerialiser(uint16_t servtype) : RsServiceSerializer(servtype), SERVICE_TYPE(servtype) {}
virtual ~RsGxsUpdateSerialiser() {}

View File

@ -12,7 +12,7 @@
class RsItem: public RsMemoryManagement::SmallObject
{
public:
RsItem(uint32_t t);
explicit RsItem(uint32_t t);
RsItem(uint8_t ver, uint8_t cls, uint8_t t, uint8_t subtype);
#ifdef DO_STATISTICS
void *operator new(size_t s) ;

View File

@ -96,7 +96,7 @@ public:
static const uint8_t FLAG_USE_SYNC_HASH;
static const uint8_t FLAG_ONLY_CURRENT; // only send most current version of grps / ignores sync hash
RsNxsSyncGrpReqItem(uint16_t servtype) : RsNxsItem(servtype, RS_PKT_SUBTYPE_NXS_SYNC_GRP_REQ_ITEM) { clear();}
explicit RsNxsSyncGrpReqItem(uint16_t servtype) : RsNxsItem(servtype, RS_PKT_SUBTYPE_NXS_SYNC_GRP_REQ_ITEM) { clear();}
virtual void clear();
virtual void serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx);
@ -114,7 +114,10 @@ class RsNxsSyncGrpStatsItem : public RsNxsItem
{
public:
RsNxsSyncGrpStatsItem(uint16_t servtype) : RsNxsItem(servtype, RS_PKT_SUBTYPE_NXS_SYNC_GRP_STATS_ITEM) {}
explicit RsNxsSyncGrpStatsItem(uint16_t servtype)
: RsNxsItem(servtype, RS_PKT_SUBTYPE_NXS_SYNC_GRP_STATS_ITEM)
, request_type(0), number_of_posts(0), last_post_TS(0)
{}
virtual void clear() {}
@ -137,7 +140,7 @@ public:
class RsNxsGroupPublishKeyItem : public RsNxsItem
{
public:
RsNxsGroupPublishKeyItem(uint16_t servtype) : RsNxsItem(servtype, RS_PKT_SUBTYPE_NXS_GRP_PUBLISH_KEY_ITEM) { clear(); }
explicit RsNxsGroupPublishKeyItem(uint16_t servtype) : RsNxsItem(servtype, RS_PKT_SUBTYPE_NXS_GRP_PUBLISH_KEY_ITEM) { clear(); }
virtual void clear();
@ -180,7 +183,7 @@ public:
static const uint16_t FLAG_TYPE_MSGS;
static const uint16_t FLAG_TYPE_ENCRYPTED_DATA;
RsNxsTransacItem(uint16_t servtype) : RsNxsItem(servtype, RS_PKT_SUBTYPE_NXS_TRANSAC_ITEM) { clear(); }
explicit RsNxsTransacItem(uint16_t servtype) : RsNxsItem(servtype, RS_PKT_SUBTYPE_NXS_TRANSAC_ITEM) { clear(); }
virtual ~RsNxsTransacItem() {}
virtual void clear();
@ -208,7 +211,7 @@ public:
static const uint8_t FLAG_RESPONSE;
static const uint8_t FLAG_USE_SYNC_HASH;
RsNxsSyncGrpItem(uint16_t servtype) : RsNxsItem(servtype, RS_PKT_SUBTYPE_NXS_SYNC_GRP_ITEM) { clear();}
explicit RsNxsSyncGrpItem(uint16_t servtype) : RsNxsItem(servtype, RS_PKT_SUBTYPE_NXS_SYNC_GRP_ITEM) { clear();}
virtual ~RsNxsSyncGrpItem() {}
virtual void clear();
@ -234,7 +237,7 @@ class RsNxsSessionKeyItem : public RsNxsItem
public:
RsNxsSessionKeyItem(uint16_t servtype) : RsNxsItem(servtype, RS_PKT_SUBTYPE_NXS_SESSION_KEY_ITEM) { clear(); }
explicit RsNxsSessionKeyItem(uint16_t servtype) : RsNxsItem(servtype, RS_PKT_SUBTYPE_NXS_SESSION_KEY_ITEM) { clear(); }
virtual ~RsNxsSessionKeyItem() {}
virtual void clear();
@ -254,11 +257,11 @@ class RsNxsEncryptedDataItem : public RsNxsItem
public:
RsNxsEncryptedDataItem(uint16_t servtype) : RsNxsItem(servtype, RS_PKT_SUBTYPE_NXS_ENCRYPTED_DATA_ITEM),encrypted_data(servtype)
{
encrypted_data.tlvtype = TLV_TYPE_BIN_ENCRYPTED ;
clear();
}
explicit RsNxsEncryptedDataItem(uint16_t servtype) : RsNxsItem(servtype, RS_PKT_SUBTYPE_NXS_ENCRYPTED_DATA_ITEM),encrypted_data(servtype)
{
encrypted_data.tlvtype = TLV_TYPE_BIN_ENCRYPTED ;
clear();
}
virtual ~RsNxsEncryptedDataItem() {}
virtual void clear();
@ -280,9 +283,10 @@ class RsNxsGrp : public RsNxsItem
public:
RsNxsGrp(uint16_t servtype) :
RsNxsItem(servtype, RS_PKT_SUBTYPE_NXS_GRP_ITEM), grp(servtype),
meta(servtype), metaData(NULL) { clear(); }
explicit RsNxsGrp(uint16_t servtype)
: RsNxsItem(servtype, RS_PKT_SUBTYPE_NXS_GRP_ITEM), grp(servtype)
, meta(servtype), metaData(NULL)
{ clear(); }
virtual ~RsNxsGrp() { delete metaData; }
RsNxsGrp* clone() const;
@ -324,7 +328,7 @@ public:
#endif
static const uint8_t FLAG_USE_HASHED_GROUP_ID;
RsNxsSyncMsgReqItem(uint16_t servtype) : RsNxsItem(servtype, RS_PKT_SUBTYPE_NXS_SYNC_MSG_REQ_ITEM) { clear(); }
explicit RsNxsSyncMsgReqItem(uint16_t servtype) : RsNxsItem(servtype, RS_PKT_SUBTYPE_NXS_SYNC_MSG_REQ_ITEM) { clear(); }
virtual void clear();
@ -348,7 +352,7 @@ public:
static const uint8_t FLAG_REQUEST;
static const uint8_t FLAG_RESPONSE;
static const uint8_t FLAG_USE_SYNC_HASH;
RsNxsSyncMsgItem(uint16_t servtype) : RsNxsItem(servtype, RS_PKT_SUBTYPE_NXS_SYNC_MSG_ITEM) { clear(); }
explicit RsNxsSyncMsgItem(uint16_t servtype) : RsNxsItem(servtype, RS_PKT_SUBTYPE_NXS_SYNC_MSG_ITEM) { clear(); }
virtual void clear();
@ -368,9 +372,10 @@ public:
*/
struct RsNxsMsg : RsNxsItem
{
RsNxsMsg(uint16_t servtype) :
RsNxsItem(servtype, RS_PKT_SUBTYPE_NXS_MSG_ITEM), meta(servtype),
msg(servtype), metaData(NULL) { clear(); }
explicit RsNxsMsg(uint16_t servtype)
: RsNxsItem(servtype, RS_PKT_SUBTYPE_NXS_MSG_ITEM)
, pos(0), count(0), meta(servtype), msg(servtype), metaData(NULL)
{ clear(); }
virtual ~RsNxsMsg() { delete metaData; }
virtual void serial_process( RsGenericSerializer::SerializeJob j,
@ -407,7 +412,10 @@ class RsNxsSearchReqItem : public RsNxsItem
{
public:
RsNxsSearchReqItem(uint16_t servtype): RsNxsItem(servtype, RS_PKT_SUBTYPE_EXT_SEARCH_REQ), serviceSearchItem(servtype) {}
explicit RsNxsSearchReqItem(uint16_t servtype)
: RsNxsItem(servtype, RS_PKT_SUBTYPE_EXT_SEARCH_REQ)
, nHops(0), token(0), serviceSearchItem(servtype), expiration(0)
{}
virtual ~RsNxsSearchReqItem() {}
virtual void clear() {}
@ -428,7 +436,9 @@ class RsNxsSearchResultMsgItem
{
public:
RsNxsSearchResultMsgItem() : context(0) {}
RsNxsSearchResultMsgItem()
: token(0), context(0), expiration(0)
{}
void clear() {}
@ -497,8 +507,8 @@ class RsNxsSerialiser : public RsServiceSerializer
{
public:
RsNxsSerialiser(uint16_t servtype) : RsServiceSerializer(servtype), SERVICE_TYPE(servtype) {}
virtual ~RsNxsSerialiser() {}
explicit RsNxsSerialiser(uint16_t servtype) : RsServiceSerializer(servtype), SERVICE_TYPE(servtype) {}
virtual ~RsNxsSerialiser() {}
virtual RsItem *create_item(uint16_t service_id,uint8_t item_subtype) const ;

View File

@ -36,7 +36,7 @@ const uint8_t RS_PKT_CLASS_PLUGIN_SUBTYPE_HASHSET = 0x01 ;
class RsPluginItem: public RsItem
{
public:
RsPluginItem(uint8_t plugin_item_subtype): RsItem(RS_PKT_VERSION1,RS_PKT_CLASS_CONFIG,RS_PKT_TYPE_PLUGIN_CONFIG,plugin_item_subtype) {}
explicit RsPluginItem(uint8_t plugin_item_subtype): RsItem(RS_PKT_VERSION1,RS_PKT_CLASS_CONFIG,RS_PKT_TYPE_PLUGIN_CONFIG,plugin_item_subtype) {}
virtual ~RsPluginItem() {}
virtual void clear() {}

View File

@ -43,17 +43,20 @@ const uint8_t RS_PKT_SUBTYPE_RTT_PONG = 0x02;
class RsRttItem: public RsItem
{
public:
RsRttItem(uint8_t subtype) : RsItem(RS_PKT_VERSION_SERVICE,RS_SERVICE_TYPE_RTT,subtype)
{ setPriorityLevel(QOS_PRIORITY_RS_RTT_PING) ;} // should be refined later.
explicit RsRttItem(uint8_t subtype) : RsItem(RS_PKT_VERSION_SERVICE,RS_SERVICE_TYPE_RTT,subtype)
{ setPriorityLevel(QOS_PRIORITY_RS_RTT_PING) ;} // should be refined later.
virtual ~RsRttItem() {};
virtual void clear() {};
virtual ~RsRttItem() {}
virtual void clear() {}
};
class RsRttPingItem: public RsRttItem
{
public:
RsRttPingItem() :RsRttItem(RS_PKT_SUBTYPE_RTT_PING) {}
RsRttPingItem()
: RsRttItem(RS_PKT_SUBTYPE_RTT_PING)
, mSeqNo(0), mPingTS(0)
{}
virtual ~RsRttPingItem(){}
virtual void clear(){}
@ -67,7 +70,10 @@ class RsRttPingItem: public RsRttItem
class RsRttPongItem: public RsRttItem
{
public:
RsRttPongItem() :RsRttItem(RS_PKT_SUBTYPE_RTT_PONG) {}
RsRttPongItem()
: RsRttItem(RS_PKT_SUBTYPE_RTT_PONG)
, mSeqNo(0), mPingTS(0), mPongTS(0)
{}
virtual ~RsRttPongItem(){}
virtual void clear(){}

View File

@ -39,7 +39,7 @@ class p3Status : public RsStatus
{
public:
p3Status(p3StatusService* statusSrv);
explicit p3Status(p3StatusService* statusSrv);
virtual ~p3Status();

View File

@ -56,7 +56,7 @@
RsAccountsDetail *rsAccounts;
/* Uses private class - so must be hidden */
static bool checkAccount(std::string accountdir, AccountDetails &account,std::map<std::string,std::vector<std::string> >& unsupported_keys);
static bool checkAccount(const std::string &accountdir, AccountDetails &account,std::map<std::string,std::vector<std::string> >& unsupported_keys);
AccountDetails::AccountDetails()
:mSslId(""), mAccountDir(""), mPgpId(""), mPgpName(""), mPgpEmail(""),
@ -660,7 +660,7 @@ bool RsAccountsDetail::getAvailableAccounts(std::map<RsPeerId, AccountDetails> &
static bool checkAccount(std::string accountdir, AccountDetails &account,std::map<std::string,std::vector<std::string> >& unsupported_keys)
static bool checkAccount(const std::string &accountdir, AccountDetails &account,std::map<std::string,std::vector<std::string> >& unsupported_keys)
{
/* check if the cert/key file exists */
@ -671,7 +671,7 @@ static bool checkAccount(std::string accountdir, AccountDetails &account,std::ma
basename += "user";
std::string cert_name = basename + "_cert.pem";
std::string userName;
//std::string userName;
#ifdef AUTHSSL_DEBUG
std::cerr << "checkAccount() dir: " << accountdir << std::endl;
@ -806,6 +806,7 @@ static bool checkAccount(std::string accountdir, AccountDetails &account,std::ma
#elif defined(ANDROID)
dataDirectory = defaultBaseDirectory()+"/usr/share/retroshare";
#elif defined(DATA_DIR)
// cppcheck-suppress ConfigurationNotChecked
dataDirectory = DATA_DIR;
// For all other OS the data directory must be set in libretroshare.pro
#else
@ -1003,7 +1004,7 @@ bool RsAccountsDetail::GenerateSSLCertificate(const RsPgpId& pgp_id, const s
int nbits = 4096;
std::string pgp_name = AuthGPG::getAuthGPG()->getGPGName(pgp_id);
//std::string pgp_name = AuthGPG::getAuthGPG()->getGPGName(pgp_id);
// Create the filename .....
// Temporary Directory for creating files....
@ -1054,8 +1055,7 @@ bool RsAccountsDetail::GenerateSSLCertificate(const RsPgpId& pgp_id, const s
bool gen_ok = true;
/* Print the signed Certificate! */
BIO *bio_out = NULL;
bio_out = BIO_new(BIO_s_file());
BIO *bio_out = BIO_new(BIO_s_file());
BIO_set_fp(bio_out,stdout,BIO_NOCLOSE);
/* Print it out */

View File

@ -190,7 +190,7 @@ void RsInit::InitRsConfig()
rsInitConfig->passwd = "";
rsInitConfig->debugLevel = PQL_WARNING;
rsInitConfig->udpListenerOnly = false;
rsInitConfig->opModeStr = std::string("FULL");
rsInitConfig->opModeStr = std::string("");
/* setup the homePath (default save location) */
// rsInitConfig->homePath = getHomePath();
@ -1011,9 +1011,11 @@ int RsServer::StartupRetroShare()
RestrictedUdpLayer *url = (RestrictedUdpLayer *) mDhtStack->getUdpLayer();
url->addRestrictedPortRange(lport, uport);
}
#else
#else //LOCALNET_TESTING
#ifdef RS_USE_BITDHT
rsUdpStack *mDhtStack = new rsUdpStack(tmpladdr);
#endif
#endif //LOCALNET_TESTING
#ifdef RS_USE_BITDHT
@ -1153,10 +1155,10 @@ int RsServer::StartupRetroShare()
#ifdef RS_USE_DHT_STUNNER
mNetMgr->setAddrAssist(new stunAddrAssist(mDhtStunner), new stunAddrAssist(mProxyStunner));
#endif // RS_USE_DHT_STUNNER
#else
#else //RS_USE_BITDHT
/* install NULL Pointer for rsDht Interface */
rsDht = NULL;
#endif
#endif //RS_USE_BITDHT
/**************************** BITDHT ***********************************/
@ -1605,7 +1607,7 @@ int RsServer::StartupRetroShare()
#endif
//mConfigMgr->addConfiguration("photo.cfg", photo_ns);
//mConfigMgr->addConfiguration("wire.cfg", wire_ns);
#endif
#endif //RS_ENABLE_GXS
mConfigMgr->addConfiguration("I2PBOB.cfg", mI2pBob);
mPluginsManager->addConfigurations(mConfigMgr) ;

View File

@ -95,6 +95,9 @@ template<class ID_CLASS,uint32_t TLV_TYPE> class t_RsTlvIdSet: public RsTlvItem
}
if(*offset != tlvend)
std::cerr << "(EE) deserialisaiton error in " << __PRETTY_FUNCTION__ << std::endl;
else if(!ok)
std::cerr << "(WW) something wrong in ID_CLASS.deserialise in " << __PRETTY_FUNCTION__ << std::endl;
return *offset == tlvend ;
}
virtual std::ostream &print(std::ostream &out, uint16_t /* indent */) const

View File

@ -37,7 +37,7 @@
class RsTlvStringSet: public RsTlvItem
{
public:
RsTlvStringSet(uint16_t type);
explicit RsTlvStringSet(uint16_t type);
virtual ~RsTlvStringSet() { return; }
virtual uint32_t TlvSize() const;
virtual void TlvClear();

View File

@ -173,7 +173,7 @@ class p3PeerMgr;
class p3I2pBob : public RsTickingThread, public p3Config, public autoProxyService
{
public:
p3I2pBob(p3PeerMgr *peerMgr);
explicit p3I2pBob(p3PeerMgr *peerMgr);
// autoProxyService interface
public:

View File

@ -74,7 +74,7 @@ class BwCtrlData
class p3BandwidthControl: public p3Service, public pqiServiceMonitor
{
public:
p3BandwidthControl(pqipersongrp *pg);
explicit p3BandwidthControl(pqipersongrp *pg);
virtual RsServiceInfo getServiceInfo();
/***** overloaded from RsBanList *****/

View File

@ -913,7 +913,7 @@ void p3discovery2::processContactInfo(const SSLID &fromId, const RsDiscContactIt
/* insert! */
DiscSslInfo sslInfo;
it->second.mSslIds[item->sslId] = sslInfo;
sit = it->second.mSslIds.find(item->sslId);
//sit = it->second.mSslIds.find(item->sslId);
should_notify_discovery = true;

View File

@ -394,18 +394,28 @@ bool p3GxsCommentService::getGxsRelatedComments(const uint32_t &token, std::vect
double p3GxsCommentService::calculateBestScore(int upVotes, int downVotes)
{
static float z = 1.0;
float score;
int n = upVotes - downVotes;
int n = upVotes + downVotes;
if(n==0)
{
score = 0.0;
}
else
{
float phat = upVotes;
score = sqrt(phat+z*z/(2*n)-z*((phat*(1-phat)+z*z/(4*n))/n))/(1+z*z/n);
// See https://github.com/reddit/reddit/blob/master/r2/r2/lib/db/_sorts.pyx#L45 for the source of this nice formula.
// http://www.evanmiller.org/how-not-to-sort-by-average-rating.html for the mathematical explanation.
float p = upVotes/n;
float z = 1.281551565545 ;
float left = p + 1/(2*n)*z*z ;
float right = z*sqrt(p*(1-p)/n + z*z/(4*n*n)) ;
float under = 1+1/n*z*z ;
score = (left - right)/under ;
//static float z = 1.0;
//score = sqrt(phat+z*z/(2*n)-z*((phat*(1-phat)+z*z/(4*n))/n))/(1+z*z/n);
}
return score;
}

View File

@ -625,7 +625,7 @@ bool extractPostCache(const std::string &str, PostStats &s)
{
uint32_t iupvotes, idownvotes, icomments;
if (3 == sscanf(str.c_str(), "%d %d %d", &icomments, &iupvotes, &idownvotes))
if (3 == sscanf(str.c_str(), "%u %u %u", &icomments, &iupvotes, &idownvotes))
{
s.comments = icomments;
s.up_votes = iupvotes;

View File

@ -1447,7 +1447,7 @@ void p3turtle::handleTunnelRequest(RsTurtleOpenTunnelItem *item)
// We're off-mutex here.
bool found = false ;
std::string info ;
//std::string info ;
RsTurtleClientService *service = NULL ;
if(item->PeerId() != _own_id)
@ -1872,13 +1872,12 @@ void p3turtle::monitorTunnels(const RsFileHash& hash,RsTurtleClientService *clie
// First, check if the hash is tagged for removal (there's a delay)
if(_hashes_to_remove.find(hash) != _hashes_to_remove.end())
{
_hashes_to_remove.erase(hash) ;
if(_hashes_to_remove.erase(hash) > 0)
{
#ifdef P3TURTLE_DEBUG
std::cerr << "p3turtle: File hash " << hash << " Was scheduled for removal. Canceling the removal." << std::endl ;
std::cerr << "p3turtle: File hash " << hash << " Was scheduled for removal. Canceling the removal." << std::endl ;
#endif
}
}
// Then, check if the hash is already there
//

View File

@ -66,8 +66,8 @@ private:
public:
CUPnPPortMapping(
int in_port = 0,
int ex_port = 0,
int in_port = 0,
const std::string &protocol = stdEmptyString,
bool enabled = false,
const std::string &description = stdEmptyString);
@ -106,7 +106,7 @@ public:
CUPnPControlPoint &m_ctrlPoint;
public:
CUPnPLib(CUPnPControlPoint &ctrlPoint);
explicit CUPnPLib(CUPnPControlPoint &ctrlPoint);
~CUPnPLib() {}
// Convenience function so we don't have to write explicit calls
@ -574,7 +574,7 @@ public:
CUPnPService *m_WanService;
std::string m_getStateVariableLastResult;
static CUPnPControlPoint *s_CtrlPoint;
CUPnPControlPoint(unsigned short udpPort);
explicit CUPnPControlPoint(unsigned short udpPort);
~CUPnPControlPoint();
char* getInternalIpAddress();
std::string getExternalAddress();

View File

@ -536,7 +536,10 @@ bool RsDirUtil::getFileHash(const std::string& filepath, RsFileHash &hash, uint6
int len;
SHA_CTX *sha_ctx = new SHA_CTX;
unsigned char sha_buf[SHA_DIGEST_LENGTH];
unsigned char gblBuf[512];
static const uint32_t HASH_BUFFER_SIZE = 1024*1024*10 ;// allocate a 10MB buffer. Too small a buffer will cause multiple HD hits and slow down the hashing process.
RsTemporaryMemory gblBuf(HASH_BUFFER_SIZE) ;
//unsigned char gblBuf[512];
/* determine size */
fseeko64(fd, 0, SEEK_END);
@ -548,7 +551,7 @@ bool RsDirUtil::getFileHash(const std::string& filepath, RsFileHash &hash, uint6
int runningCheckCount = 0;
SHA1_Init(sha_ctx);
while(isRunning && (len = fread(gblBuf,1, 512, fd)) > 0)
while(isRunning && (len = fread(gblBuf,1, HASH_BUFFER_SIZE, fd)) > 0)
{
SHA1_Update(sha_ctx, gblBuf, len);

View File

@ -43,8 +43,7 @@ public:
void start();
double duration();
private:
double currentTime();
static double currentTime();
private:
std::string _name ;

View File

@ -43,7 +43,7 @@ public:
xmlNodePtr node(unsigned int index);
protected:
XPathWrapper(XMLWrapper &xmlWrapper);
explicit XPathWrapper(XMLWrapper &xmlWrapper);
XMLWrapper &mXMLWrapper;
xmlXPathContextPtr mContext;

View File

@ -187,15 +187,32 @@ void DLListDelegate::paint(QPainter * painter, const QStyleOptionViewItem & opti
}
painter->drawText(option.rect, Qt::AlignCenter, newopt.text);
break;
case COLUMN_SOURCES:
{
double dblValue = index.data().toDouble();
case COLUMN_SOURCES:
{
double dblValue = index.data().toDouble();
temp = dblValue!=0 ? QString("%1 (%2)").arg((int)dblValue).arg((int)((fmod(dblValue,1)*1000)+0.5)) : "";
painter->drawText(option.rect, Qt::AlignCenter, temp);
}
break;
case COLUMN_DOWNLOADTIME:
temp = dblValue!=0 ? QString("%1 (%2)").arg((int)dblValue).arg((int)((fmod(dblValue,1)*1000)+0.5)) : "";
painter->drawText(option.rect, Qt::AlignCenter, temp);
}
break;
case COLUMN_PRIORITY:
{
double dblValue = index.data().toDouble();
if (dblValue == PRIORITY_NULL)
temp = "";
else if (dblValue == PRIORITY_FASTER)
temp = tr("Faster");
else if (dblValue == PRIORITY_AVERAGE)
temp = tr("Average");
else if (dblValue == PRIORITY_SLOWER)
temp = tr("Slower");
else
temp = QString::number((uint32_t)dblValue);
painter->drawText(option.rect, Qt::AlignCenter, temp);
}
break;
case COLUMN_DOWNLOADTIME:
downloadtime = index.data().toLongLong();
minutes = downloadtime / 60;
seconds = downloadtime % 60;

View File

@ -42,6 +42,11 @@
#define COLUMN_PATH 12
#define COLUMN_COUNT 13
#define PRIORITY_NULL 0.0
#define PRIORITY_FASTER 0.1
#define PRIORITY_AVERAGE 0.2
#define PRIORITY_SLOWER 0.3
#define MAX_CHAR_TMP 128

View File

@ -1166,6 +1166,7 @@ void SearchDialog::insertFile(qulonglong searchId, const FileDetail& file, int s
// 1 - look in result window whether the file already exists.
//
bool found = false ;
bool altname = false ;
int sources;
int friendSource = 0;
int anonymousSource = 0;
@ -1193,7 +1194,11 @@ void SearchDialog::insertFile(qulonglong searchId, const FileDetail& file, int s
(*it)->setText(SR_SOURCES_COL,modifiedResult);
(*it)->setData(SR_SOURCES_COL, ROLE_SORT, fltRes);
QTreeWidgetItem *item = (*it);
found = true ;
if(QString::compare((*it)->text(SR_NAME_COL), QString::fromUtf8(file.name.c_str()), Qt::CaseSensitive)!=0)
altname = true;
if (!item->data(SR_DATA_COL, SR_ROLE_LOCAL).toBool()) {
@ -1233,9 +1238,20 @@ void SearchDialog::insertFile(qulonglong searchId, const FileDetail& file, int s
item->setForeground(i, brush);
}
}
break ;
}
if(altname)
{
QTreeWidgetItem *item = new RSTreeWidgetItem(compareResultRole);
item->setText(SR_NAME_COL, QString::fromUtf8(file.name.c_str()));
item->setText(SR_HASH_COL, QString::fromStdString(file.hash.toStdString()));
setIconAndType(item, QString::fromUtf8(file.name.c_str()));
item->setText(SR_SIZE_COL, QString::number(file.size));
setIconAndType(item, QString::fromUtf8(file.name.c_str()));
(*it)->addChild(item);
}
}
if(!found)
{
++nb_results[searchId] ;

View File

@ -42,6 +42,7 @@
#include "gui/msgs/MessageComposer.h"
#include "gui/settings/AddFileAssociationDialog.h"
#include "gui/gxschannels/GxsChannelDialog.h"
#include "gui/gxsforums/GxsForumsDialog.h"
#include "gui/settings/rsharesettings.h"
#include "util/QtVersion.h"
#include "util/RsAction.h"
@ -64,6 +65,7 @@
#define IMAGE_OPENFILE ":/images/fileopen.png"
#define IMAGE_LIBRARY ":/images/library.png"
#define IMAGE_CHANNEL ":/images/channels32.png"
#define IMAGE_FORUMS ":/icons/png/forums.png"
#define IMAGE_COLLCREATE ":/images/library_add.png"
#define IMAGE_COLLMODIF ":/images/library_edit.png"
#define IMAGE_COLLVIEW ":/images/library_view.png"
@ -963,6 +965,15 @@ void SharedFilesDialog::postModDirectories(bool local)
QCoreApplication::flush();
}
class ChannelCompare
{
public:
bool operator()(const std::pair<std::string,RsGxsGroupId>& id1,const std::pair<std::string,RsGxsGroupId>& id2) const
{
return id1.first < id2.first ;
}
};
void LocalSharedFilesDialog::spawnCustomPopupMenu( QPoint point )
{
if (!rsPeers) return; /* not ready yet! */
@ -1017,26 +1028,55 @@ void LocalSharedFilesDialog::spawnCustomPopupMenu( QPoint point )
}
GxsChannelDialog *channelDialog = dynamic_cast<GxsChannelDialog*>(MainWindow::getPage(MainWindow::Channels));
QMenu shareChannelMenu(tr("Share on channel...")) ; // added here because the shareChannelMenu QMenu object is deleted afterwards
if(channelDialog != NULL)
{
QMenu shareChannelMenu(tr("Share on channel...")) ;
shareChannelMenu.setIcon(QIcon(IMAGE_CHANNEL));
std::list<RsGroupMetaData> grp_metas ;
channelDialog->getGroupList(grp_metas) ;
std::vector<std::pair<std::string,RsGxsGroupId> > grplist ; // I dont use a std::map because two or more channels may have the same name.
for(auto it(grp_metas.begin());it!=grp_metas.end();++it)
if(IS_GROUP_PUBLISHER((*it).mSubscribeFlags))
shareChannelMenu.addAction(QString::fromUtf8((*it).mGroupName.c_str()), this, SLOT(shareOnChannel()))->setData(QString::fromStdString((*it).mGroupId.toStdString())) ;
if(IS_GROUP_PUBLISHER((*it).mSubscribeFlags) && IS_GROUP_SUBSCRIBED((*it).mSubscribeFlags))
grplist.push_back(std::make_pair((*it).mGroupName, (*it).mGroupId));
std::sort(grplist.begin(),grplist.end(),ChannelCompare()) ;
for(auto it(grplist.begin());it!=grplist.end();++it)
shareChannelMenu.addAction(QString::fromUtf8((*it).first.c_str()), this, SLOT(shareOnChannel()))->setData(QString::fromStdString((*it).second.toStdString())) ;
contextMnu.addMenu(&shareChannelMenu) ;
contextMnu.exec(QCursor::pos()) ; // added here because the shareChannelMenu QMenu object is deleted afterwards
}
else
contextMnu.exec(QCursor::pos()) ;
}
GxsForumsDialog *forumsDialog = dynamic_cast<GxsForumsDialog*>(MainWindow::getPage(MainWindow::Forums));
QMenu shareForumMenu(tr("Share on forum...")) ; // added here because the shareChannelMenu QMenu object is deleted afterwards
if(forumsDialog != NULL)
{
shareForumMenu.setIcon(QIcon(IMAGE_FORUMS));
std::list<RsGroupMetaData> grp_metas ;
forumsDialog->getGroupList(grp_metas) ;
std::vector<std::pair<std::string,RsGxsGroupId> > grplist ; // I dont use a std::map because two or more channels may have the same name.
for(auto it(grp_metas.begin());it!=grp_metas.end();++it)
if(IS_GROUP_SUBSCRIBED((*it).mSubscribeFlags))
grplist.push_back(std::make_pair((*it).mGroupName, (*it).mGroupId));
std::sort(grplist.begin(),grplist.end(),ChannelCompare()) ;
for(auto it(grplist.begin());it!=grplist.end();++it)
shareForumMenu.addAction(QString::fromUtf8((*it).first.c_str()), this, SLOT(shareInForum()))->setData(QString::fromStdString((*it).second.toStdString())) ;
contextMnu.addMenu(&shareForumMenu) ;
}
contextMnu.exec(QCursor::pos()) ;
}
void LocalSharedFilesDialog::shareOnChannel()
{
RsGxsGroupId groupId(qobject_cast<QAction*>(sender())->data().toString().toStdString());
@ -1055,6 +1095,24 @@ void LocalSharedFilesDialog::shareOnChannel()
channelDialog->shareOnChannel(groupId,file_links_list) ;
}
void LocalSharedFilesDialog::shareInForum()
{
RsGxsGroupId groupId(qobject_cast<QAction*>(sender())->data().toString().toStdString());
GxsForumsDialog *forumsDialog = dynamic_cast<GxsForumsDialog*>(MainWindow::getPage(MainWindow::Forums));
if(forumsDialog == NULL)
return ;
std::list<DirDetails> files_info ;
QList<RetroShareLink> file_links_list ;
bool has_unhashed_files ;
copyLinks(getSelected(),false,file_links_list,has_unhashed_files) ;
forumsDialog->shareInMessage(groupId,file_links_list) ;
}
//============================================================================

View File

@ -160,6 +160,7 @@ class LocalSharedFilesDialog : public SharedFilesDialog
void tryToAddNewAssotiation();
void forceCheck();
void shareOnChannel();
void shareInForum();
QAction* fileAssotiationAction(const QString fileName);

View File

@ -159,32 +159,6 @@ public:
}
};
class PriorityItem : public SortByNameItem
{
public:
PriorityItem(QHeaderView *header) : SortByNameItem(header) {}
virtual bool operator<(const QStandardItem &other) const
{
const int role = model() ? model()->sortRole() : Qt::DisplayRole;
QString l = data(role).value<QString>();
QString r = other.data(role).value<QString>();
bool bl,br ;
int nl = l.toInt(&bl) ;
int nr = r.toInt(&br) ;
if(bl && br)
return nl < nr ;
if(bl ^ br)
return br ;
return SortByNameItem::operator<(other);
}
};
/** Constructor */
TransfersDialog::TransfersDialog(QWidget *parent)
: RsAutoUpdatePage(1000,parent)
@ -911,16 +885,18 @@ int TransfersDialog::addDLItem(int row, const FileInfo &fileInfo)
default: status = tr("Unknown"); break;
}
QString priority;
double priority = PRIORITY_NULL;
if (fileInfo.downloadStatus == FT_STATE_QUEUED) {
priority = QString::number(fileInfo.queue_position);
priority = fileInfo.queue_position;
} else if (fileInfo.downloadStatus == FT_STATE_COMPLETE) {
priority = 0;
} else {
switch (fileInfo.priority) {
case SPEED_LOW: priority = tr("Slower");break;
case SPEED_NORMAL: priority = tr("Average");break;
case SPEED_HIGH: priority = tr("Faster");break;
default: priority = tr("Average");break;
case SPEED_LOW: priority = PRIORITY_SLOWER; break;
case SPEED_NORMAL: priority = PRIORITY_AVERAGE; break;
case SPEED_HIGH: priority = PRIORITY_FASTER; break;
default: priority = PRIORITY_AVERAGE; break;
}
}
@ -982,7 +958,6 @@ int TransfersDialog::addDLItem(int row, const FileInfo &fileInfo)
// change progress column to own class for sorting
DLListModel->setItem(row, COLUMN_PROGRESS, new ProgressItem(NULL));
DLListModel->setItem(row, COLUMN_PRIORITY, new PriorityItem(NULL));
DLListModel->setData(DLListModel->index(row, COLUMN_SIZE), QVariant((qlonglong) fileInfo.size));
DLListModel->setData(DLListModel->index(row, COLUMN_ID), fileHash, Qt::DisplayRole);
@ -1107,7 +1082,7 @@ int TransfersDialog::addPeerToDLItem(QStandardItem *dlItem, const RsPeerId& peer
iProgress->setData(QVariant::fromValue(peerInfo), Qt::UserRole);
iSource->setData(QVariant(QString()), Qt::DisplayRole);
iPriority->setData(QVariant(QString()), Qt::DisplayRole); // blank field for priority
iPriority->setData(QVariant((double)PRIORITY_NULL), Qt::DisplayRole); // blank field for priority
iRemaining->setData(QVariant(QString()), Qt::DisplayRole);
iDownloadTime->setData(QVariant(QString()), Qt::DisplayRole);
iID->setData(QVariant() , Qt::DisplayRole);

View File

@ -144,6 +144,7 @@ QList<int> sizes;
RsAutoUpdatePage::lockAllEvents();
ui.friendList->setColumnVisible(FriendList::COLUMN_LAST_CONTACT, false);
ui.friendList->setColumnVisible(FriendList::COLUMN_IP, false);
ui.friendList->setColumnVisible(FriendList::COLUMN_ID, false);
ui.friendList->setShowGroups(true);
processSettings(true);
RsAutoUpdatePage::unlockAllEvents();

View File

@ -1489,7 +1489,7 @@ void MainWindow::processLastArgs()
opModeStatus->setCurrentIndex(RS_OPMODE_GAMING - 1);
} else if (opmode == "minimal") {
opModeStatus->setCurrentIndex(RS_OPMODE_MINIMAL - 1);
} else {
} else if (opmode != "") {
opModeStatus->setCurrentIndex(RS_OPMODE_FULL - 1);
}
opModeStatus->setOpMode();

View File

@ -32,9 +32,6 @@
#include <iostream>
#define COLOR_NORMAL QColor(248, 248, 248)
#define COLOR_NEW QColor(220, 236, 253)
/** Constructor */
PostedItem::PostedItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsGroupId &groupId, const RsGxsMessageId &messageId, bool isHome, bool autoUpdate) :
@ -427,16 +424,9 @@ void PostedItem::setReadStatus(bool isNew, bool isUnread)
ui->newLabel->setVisible(isNew);
/* unpolish widget to clear the stylesheet's palette cache */
ui->mainFrame->style()->unpolish(ui->mainFrame);
QPalette palette = ui->mainFrame->palette();
palette.setColor(ui->mainFrame->backgroundRole(), isNew ? COLOR_NEW : COLOR_NORMAL); // QScrollArea
palette.setColor(QPalette::Base, isNew ? COLOR_NEW : COLOR_NORMAL); // QTreeWidget
ui->mainFrame->setPalette(palette);
ui->mainFrame->setProperty("new", isNew);
Rshare::refreshStyleSheet(ui->mainFrame, false);
ui->mainFrame->style()->unpolish(ui->mainFrame);
ui->mainFrame->style()->polish( ui->mainFrame);
}
void PostedItem::readToggled(bool checked)

View File

@ -1129,7 +1129,8 @@ static void processList(const QStringList &list, const QString &textSingular, co
links.append(*linkIt);
}
if (flag & RSLINK_PROCESS_NOTIFY_ASK) {
if (flag & RSLINK_PROCESS_NOTIFY_ASK)
{
/* ask for some types of link */
QStringList fileAdd;
QStringList personAdd;
@ -1153,12 +1154,9 @@ static void processList(const QStringList &list, const QString &textSingular, co
case TYPE_CERTIFICATE:
case TYPE_PUBLIC_MSG:
case TYPE_PRIVATE_CHAT:
// no need to ask
break;
case TYPE_FILE:
case TYPE_EXTRAFILE:
fileAdd.append(link.name());
// no need to ask
break;
case TYPE_PERSON:
@ -1166,30 +1164,6 @@ static void processList(const QStringList &list, const QString &textSingular, co
break;
}
}
QString content;
if (!fileAdd.isEmpty()) {
processList(fileAdd, QObject::tr("Add file"), QObject::tr("Add files"), content);
}
//if (personAdd.size()) {
// processList(personAdd, QObject::tr("Add friend"), QObject::tr("Add friends"), content);
//}
if (content.isEmpty() == false) {
QString question = "<html><body>";
if (links.size() == 1) {
question += QObject::tr("Do you want to process the link ?");
} else {
question += QObject::tr("Do you want to process %1 links ?").arg(links.size());
}
question += "<br><br>" + content + "</body></html>";
QMessageBox mb(QObject::tr("Confirmation"), question, QMessageBox::Question, QMessageBox::Yes,QMessageBox::No, 0);
if (mb.exec() == QMessageBox::No) {
return 0;
}
}
}
int countInvalid = 0;
@ -1305,9 +1279,8 @@ static void processList(const QStringList &list, const QString &textSingular, co
}
break;
case TYPE_FILE:
case TYPE_EXTRAFILE:
{
{
#ifdef DEBUG_RSLINK
std::cerr << " RetroShareLink::process FileRequest : fileName : " << link.name().toUtf8().constData() << ". fileHash : " << link.hash().toStdString() << ". fileSize : " << link.size() << std::endl;
#endif
@ -1388,9 +1361,18 @@ static void processList(const QStringList &list, const QString &textSingular, co
} else {
if (!bFileOpened) fileExist.append(link.name());
}
}
}
break;
case TYPE_FILE:
{
RsCollection col ;
col.merge_in(link.name(),link.size(),RsFileHash(link.hash().toStdString())) ;
col.downloadFiles();
}
break;
case TYPE_FILE_TREE:
{
FileTree *ft = FileTree::create(link.radix().toStdString()) ;

View File

@ -499,7 +499,7 @@ bool ChatWidget::eventFilter(QObject *obj, QEvent *event)
bTextselected=true;
}
}
ui->searchButton->setChecked(!ui->searchButton->isChecked() | bTextselected);
ui->searchButton->setChecked(!ui->searchButton->isChecked() || bTextselected);
ui->leSearch->setVisible(bTextselected);//To discard re-selection of text
on_searchButton_clicked(ui->searchButton->isChecked());
return true; // eat event

View File

@ -32,10 +32,10 @@
#include "RsAutoUpdatePage.h"
#include "PopupDistantChatDialog.h"
#define IMAGE_RED_LED ":/icons/bullet_red_64.png"
#define IMAGE_YEL_LED ":/icons/bullet_yellow_64.png"
#define IMAGE_GRN_LED ":/icons/bullet_green_64.png"
#define IMAGE_GRY_LED ":/icons/bullet_grey_64.png"
#define IMAGE_RED_LED ":/icons/bullet_red_128.png"
#define IMAGE_YEL_LED ":/icons/bullet_yellow_128.png"
#define IMAGE_GRN_LED ":/icons/bullet_green_128.png"
#define IMAGE_GRY_LED ":/icons/bullet_grey_128.png"
PopupDistantChatDialog::~PopupDistantChatDialog()
{

View File

@ -74,7 +74,9 @@ class FlowLayoutItem : public QWidget
Q_OBJECT
public:
FlowLayoutItem(QString name=QString(), QWidget *parent=0) : QWidget(parent), m_myName(name){
FlowLayoutItem(QString name=QString(), QWidget *parent=0)
: QWidget(parent), m_myName(name), m_isSelected(false), m_isCurrent(false)
{
setFocusPolicy(Qt::StrongFocus);
setAcceptDrops(true);
}

Some files were not shown because too many files have changed in this diff Show More