Merge branch 'master' into chat-colors-v2

This commit is contained in:
Pooh 2017-08-01 15:03:11 +03:00 committed by GitHub
commit 23babc3519
446 changed files with 19780 additions and 7207 deletions

View File

@ -89,4 +89,4 @@ You can now compile RS into Qt Creator or with terminal
You can change Target and SDK in *./retroshare.pri:82* changing value of QMAKE_MACOSX_DEPLOYMENT_TARGET and QMAKE_MAC_SDK
You can find compiled application on *./retroshare/retroshare-gui/src/RetroShare06.app*
You can find compiled application on *./retroshare/retroshare-gui/src/retroshare.app*

View File

@ -3,14 +3,28 @@ Compile Retroshare for Android
== Introduction
Compiling an application for Android is not as easy as one would imagine, expecially one like RetroShare that has a big codebase and is not well documented. This document is aimed to empower the reader so she can hopefully succed or at least have a significant help in compiling her own RetroShare APK package installable on Android.
Compiling an application for Android is not as easy as one would imagine,
expecially one like RetroShare that has a big codebase and is not well
documented.
This document is aimed to empower the reader so she can hopefully succed or at
least have a significant help in compiling her own RetroShare APK package
installable on Android.
== Preparing The Environement
First of all setup your Qt for Android development environement following the guide on the link:http://doc.qt.io/qt-5/androidgs.html[Qt for android web site].
At this point you should have Android SDK, Android NDK, and Qt for Android working fine, and you should be capable of executing on an Android emulator or on your Android phone Qt for Android examples.
First of all setup your Qt for Android development environement following the
guide on the link:http://doc.qt.io/qt-5/androidgs.html[Qt for android web site].
At this point you should have Android SDK, Android NDK, and Qt for Android
working fine, and you should be capable of executing on an Android emulator or
on your Android phone Qt for Android examples.
But RetroShare is not as simple to compile as those examples. In particular, the Android NDK precompiled toolchain is limited and doesn't support the full C++ specification, and it is missing some part that is needed to build RetroShare. The good news is that Android NDK ships all the necessary to build a custom toolchain that is suitable to build RetroShare. In order to build the toolchain with needed library RetroShare provides the +android-prepare-toolchain.sh+ script; before you execute it you should define some variables the script cannot determine in an easy and reliable manner by itself in your terminal.
But RetroShare is not as simple to compile as those examples. The good news is
that Android NDK ships all the necessary to build a custom toolchain that is
suitable to build RetroShare.
In order to build the toolchain with needed library RetroShare provides the
+android-prepare-toolchain.sh+ script; before you execute it you should define
some variables the script cannot determine in an easy and reliable manner by
itself in your terminal.
[source,bash]
-------------------------------------------------------------------------------
@ -27,56 +41,56 @@ export ANDROID_NDK_ARCH="arm"
## The Android API level the Android device you want to target
export ANDROID_PLATFORM_VER="19"
## The number of core that yout host CPU have (just to speed up compilation) set it to 1 if unsure
## The number of core that yout host CPU have (just to speed up compilation) set
## it to 1 if unsure
export HOST_NUM_CPU=1
./android-prepare-toolchain.sh
-------------------------------------------------------------------------------
Now is time for the bad news: as of today Qt assumes you use the NDK precompiled toolchain and doesn't have an option to use the custom toolchain you just generated, so you need to tweak Qt internals a little to make usage of the custom toolchain. First of all you need to determine your Qt for Android installation path -in my case it is +/opt/Qt5.7.0/+ - then find the +mkspecs+ directory -in my case it is +/opt/Qt5.7.0/5.7/android_armv7/mkspecs+ - and then modify qmake configuration for the android target according to your toolchain, in my case I have done it with the following commands (in the same shell I used before, to take advantage of the already set variables):
WARNING: This may need a slight modification if you have a different Qt version.
[source,bash]
-------------------------------------------------------------------------------
export QT_PATH="/opt/Qt5.7.0/"
export QT_MAJOR_VERSION="5.7"
cd ${QT_PATH}/${QT_MAJOR_VERSION}/android_armv7/mkspecs
sudo --preserve-env -s
cp -r android-g++ android-g++-backup
cd android-g++
sed -i "s|^NDK_TOOLCHAIN_PATH =.*|NDK_TOOLCHAIN_PATH = ${NDK_TOOLCHAIN_PATH}|" qmake.conf
-------------------------------------------------------------------------------
== Preparing Qt Creator
Now that your environement is set up you should configure Qt Creator for Android following the link:http://doc.qt.io/qtcreator/creator-developing-android.html[official guide]. At the end of this step your Qt Creator should recognize the Android compiler and the Qt for Android kit. As we use a custom toolchain one more step is needed.
Now that your environement is set up you should configure Qt Creator for Android
following the
link:http://doc.qt.io/qtcreator/creator-developing-android.html[official guide].
At the end of this step your Qt Creator should recognize the Android compiler
and the Qt for Android kit.
From the top menu click
_Tools -> Options... -> Build & Run -> Compilers -> Android GCC (arm-4.9) -> Clone_
Your Kit is now ready to use. Now you can open RetroShare as a Qt Creator
project and in the Projects left menu add the newly created kit if not already
present, so you can select it on the build type selection button down on the
left.
Now a new compiler (usually named +Clone of Android GCC (arm-4.9)+) should have appeared on your compilers list. Select that compiler and press the Browse button to look for your custom toolchain compiler. You should find it at +$NDK_TOOLCHAIN_PATH/bin/arm-linux-androideabi-gcc+. Select it, then press Apply.
As we use a custom toolchain one more step is needed +
Now go to the Kits tab, select +Android for armeabi-v7a (GCC 4.9, Qt 5.7.0)+ and press the Clone button. A new kit is created (usually named +Clone of Android for armeabi-v7a (GCC 4.9, Qt 5.7.0)+). Now select the new kit and change the compiler to the one you have just created.
_Qt Creator left pane -> Projects -> Build and Run -> Android SOMESTUFF kit ->
Build Environement -> Add
Your Kit is now ready to use. Now you can open RetroShare as a Qt Creator project and in the Projects left menu add the newly created kit if not already present, so you can select it on the build type selection button down on the left.
Variable: +NATIVE_LIBS_TOOLCHAIN_PATH+
Value: +Same value as NDK_TOOLCHAIN_PATH in Preparing The Environement step+
Some of RetroShare modules like +retroshare-gui+, +WebUI+ and +sqlcipher+ are not supported yet on Android so to be able to compile RetroShare without errors you will have to go to +
Some of RetroShare modules like +retroshare-gui+ and +WebUI+ are not available
on Android so to be able to compile RetroShare without errors you will have to
go to +
_Qt Creator left pane -> Projects -> Build and Run -> Android SOMESTUFF kit -> Build Steps -> qmake -> Additional arguments_
_Qt Creator left pane -> Projects -> Build and Run -> Android SOMESTUFF kit ->
Build Steps -> qmake -> Additional arguments_
and add the following configurations
[source,makefile]
-------------------------------------------------------------------------------
CONFIG+=no_retroshare_gui CONFIG+=no_retroshare_nogui CONFIG+=no_retroshare_plugins CONFIG+=retroshare_android_service CONFIG+=libresapilocalserver CONFIG+=no_libresapihttpserver CONFIG+=no_sqlcipher CONFIG+=retroshare_qml_app
CONFIG+=no_retroshare_gui CONFIG+=no_retroshare_nogui CONFIG+=no_retroshare_plugins CONFIG+=retroshare_android_service CONFIG+=libresapilocalserver CONFIG+=no_libresapihttpserver CONFIG+=retroshare_qml_app
-------------------------------------------------------------------------------
WARNING: SQLCipher is not supported yet on RetroShare for Android. This poses a major security concern, we are working to fix this ASAP.
WARNING: SQLCipher is not supported yet on RetroShare for Android. This poses a
major security concern, we are working to fix this ASAP.
WARNING: Some versions of QtCreator try to find the Android SDK in +/opt/android/sdk+. A workaround to this is to make a symbolic link there pointing to your SDK installation path, like +mkdir -p /opt/android/sdk && ln -s /home/user/android-sdk-linux /opt/android/sdk+
WARNING: Some versions of QtCreator try to find the Android SDK in
+/opt/android/sdk+. A workaround to this is to make a symbolic link there
pointing to your SDK installation path, like
+mkdir -p /opt/android/sdk && ln -s /home/user/android-sdk-linux
/opt/android/sdk+
== Quircks

View File

@ -68,8 +68,8 @@ Compilation on Linux
The executables produced will be:
/usr/bin/RetroShare06
/usr/bin/RetroShare06-nogui
/usr/bin/retroshare
/usr/bin/retroshare-nogui
5. Uninstall:
```bash
@ -124,7 +124,7 @@ Using retroshare-nogui & webUI
The webUI needs to be enabled as a parameter option in retroshare-nogui:
```bash
./retroshare-nogui --webinterface 9090 --docroot /usr/share/RetroShare06/webui/
./retroshare-nogui --webinterface 9090 --docroot /usr/share/retroshare/webui/
```
The webUI is only accessible on localhost:9090. It is advised to keep it that way so that your RS

View File

@ -34,15 +34,26 @@ retroshare_nogui {
retroshare_android_service {
SUBDIRS += retroshare_android_service
retroshare_android_service.file = retroshare-android-service/src/retroshare-android-service.pro
retroshare_android_service.depends = libretroshare libresapi
retroshare_android_service.depends = libresapi
retroshare_android_service.target = retroshare_android_service
}
retroshare_android_notify_service {
SUBDIRS += retroshare_android_notify_service
retroshare_android_notify_service.file = retroshare-android-notify-service/src/retroshare-android-notify-service.pro
retroshare_android_notify_service.depends = retroshare_android_service
retroshare_android_notify_service.target = retroshare_android_notify_service
}
retroshare_qml_app {
SUBDIRS += retroshare_qml_app
retroshare_qml_app.file = retroshare-qml-app/src/retroshare-qml-app.pro
retroshare_qml_app.depends = libretroshare retroshare_android_service
retroshare_qml_app.depends = retroshare_android_service
retroshare_qml_app.target = retroshare_qml_app
android-g++ {
retroshare_qml_app.depends += retroshare_android_notify_service
}
}
retroshare_plugins {

View File

@ -4,8 +4,8 @@ set RSPATH=.\retroshare-gui\src\debug
set PATH=%QTDIR%\bin;%LIBS%\bin;%PATH%
If not exist %RSPATH%\RetroShare06.exe (
If not exist %RSPATH%\retroshare.exe (
build-all-mingw32make.bat
)
%RSPATH%\RetroShare06.exe
%RSPATH%\retroshare.exe

View File

@ -97,6 +97,7 @@ install:
# Install toolchain
#- C:\msys64\usr\bin\bash -lc "pacman --noconfirm -S mingw-w64-i686-toolchain mingw-w64-x86_64-toolchain" #Already installed
# Install other binutils
- C:\msys64\usr\bin\bash -lc "pacman --noconfirm -S mingw-w64-i686-curl mingw-w64-x86_64-curl"
- C:\msys64\usr\bin\bash -lc "pacman --noconfirm -S mingw-w64-i686-miniupnpc mingw-w64-x86_64-miniupnpc"
- C:\msys64\usr\bin\bash -lc "pacman --noconfirm -S mingw-w64-i686-sqlite3 mingw-w64-x86_64-sqlite3"
- C:\msys64\usr\bin\bash -lc "pacman --noconfirm -S mingw-w64-i686-speex mingw-w64-x86_64-speex"

View File

@ -34,10 +34,10 @@ How do I create a source package?
You should get as many source packages as wanted distributions. For each
of them you get (example here for wheezy):
retroshare06_0.6.0-0.7829~wheezy.dsc
retroshare06_0.6.0-0.7829~wheezy_source.build
retroshare06_0.6.0-0.7829~wheezy_source.changes
retroshare06_0.6.0-0.7829~wheezy.tar.gz
retroshare_0.6.0-0.7829~wheezy.dsc
retroshare_0.6.0-0.7829~wheezy_source.build
retroshare_0.6.0-0.7829~wheezy_source.changes
retroshare_0.6.0-0.7829~wheezy.tar.gz
How do I create a binary package?
=================================
@ -69,7 +69,7 @@ How do I create a binary package?
*Package compilation*
> pbuilder-dist wheezy build retroshare06_0.6.0~7856~wheezy.dsc
> pbuilder-dist wheezy build retroshare_0.6.0~7856~wheezy.dsc
The generated compiled binary packages (including all package plugins etc)
will be in ~/pbuilder/wheezy_result/

View File

@ -1,4 +1,475 @@
retroshare06 (0.6.2-1.XXXXXX~YYYYYY) YYYYYY; urgency=low
retroshare (0.6.3-1.XXXXXX~YYYYYY) YYYYYY; urgency=low
a16220e csoler Sat, 29 Jul 2017 20:24:13 +0200 switched to RC2
d10dbf1 csoler Sat, 29 Jul 2017 20:20:53 +0200 Merge pull request #966 from csoler/v0.6.3
b8260e5 csoler Fri, 28 Jul 2017 18:41:34 +0200 fixed wording in GenCertDialog
4fdbf39 csoler Fri, 28 Jul 2017 18:32:47 +0200 fixed image replication in profile creation window
c6b6835 csoler Thu, 27 Jul 2017 20:43:08 +0200 exclude own friends from key removal pre-selection
e861f87 csoler Wed, 26 Jul 2017 21:44:24 +0200 removed unused msg item class that caused aliasing warnings (serialisation of time_t as uint32_t)
286e7e0 csoler Wed, 26 Jul 2017 14:01:28 +0200 Merge pull request #961 from csoler/v0.6.3
34ddf71 csoler Wed, 26 Jul 2017 13:54:44 +0200 Merge pull request #957 from PhenomRetroShare/Fix_CppCheckerError
1792273 csoler Wed, 26 Jul 2017 13:50:21 +0200 Merge pull request #946 from PhenomRetroShare/Fix_GuiAutoLogin
ea72c58 csoler Wed, 26 Jul 2017 12:27:38 +0200 fixed unnecessary ()
b0483a0 csoler Wed, 26 Jul 2017 10:23:18 +0200 fixed bug in removeDeleteExistingMsgs()
3ba0256 csoler Tue, 25 Jul 2017 22:23:09 +0200 Merge pull request #955 from PhenomRetroShare/Fix_CopyRSLinkWhenOnlyPlainTextInLobby
7820c1e csoler Tue, 25 Jul 2017 22:10:20 +0200 Merge pull request #960 from PhenomRetroShare/Add_ConfigFlagMacOSVersion
9881b61 csoler Tue, 25 Jul 2017 22:06:18 +0200 cleanup code in RsGenExchange
181a824 csoler Tue, 25 Jul 2017 21:56:20 +0200 fixed memory leak in BWGraphSource due to missing destructor
a382a0f csoler Tue, 25 Jul 2017 21:52:09 +0200 fixed memory leak in p3peermgr config load
041f989 csoler Tue, 25 Jul 2017 21:21:24 +0200 rewrote processRecvdMessages() and processRecvdGroups() in RsGenExchange. Removed mReceivedGrps and mReceivedMsgs, cleaned-up terrible branching and memory management
cbec818 Phenom Tue, 25 Jul 2017 18:08:37 +0200 Add qmake CONFIG flag for MacOS version.
461ccf3 csoler Tue, 25 Jul 2017 00:07:53 +0200 removed aliasing in storeMessages/storeGroups, removed several memory leaks in unittests, improved auto-delete structures in rsgxsutil, added deletion for members of RsGenExchange, removed shared pointers from unittests (they cause a memory leak and are only used in unittests)
ef24459 csoler Mon, 24 Jul 2017 18:48:13 +0200 fixed memory leak in gxssecurity test
79779b8 csoler Mon, 24 Jul 2017 18:45:24 +0200 fixed memory leaks in GxsSecurity
70f72db csoler Mon, 24 Jul 2017 18:20:21 +0200 fixed memory leak in GxsSecurity
bcaafc2 csoler Mon, 24 Jul 2017 14:29:30 +0200 improved template class naming for temporary Gxs grp data structures
df691bd csoler Mon, 24 Jul 2017 12:16:06 +0200 improved tests to avoid memory leak
3b1606c Gioacc Mon, 24 Jul 2017 11:52:23 +0200 Remove misguiding if
03cc2e6 Gioacc Mon, 24 Jul 2017 10:16:24 +0200 Remove miguiding if before delete
764fadf csoler Sun, 23 Jul 2017 22:58:01 +0200 suppressed memory leak in serialisation test code
880eb58 csoler Sun, 23 Jul 2017 22:56:27 +0200 suppressed memory leak in serialisation test code
0242424 csoler Sat, 22 Jul 2017 12:08:28 +0200 reverting last commit that causes crashes
9e2241a csoler Fri, 21 Jul 2017 23:15:50 +0200 attempt to fix memory leak in RsGenExchange. To be tested.
8ce10ea Phenom Fri, 21 Jul 2017 15:31:53 +0200 Fix past commit for p3idservice.cc
733f812 Phenom Fri, 21 Jul 2017 15:20:04 +0200 Fix CppCheck Error in utility_functions.c
36e3772 Phenom Fri, 21 Jul 2017 15:19:17 +0200 Fix CppCheck Error in advancedsearchdialog.cpp
145ce6b Phenom Fri, 21 Jul 2017 15:11:55 +0200 Fix CppCheck Error in ChatPage.cpp
2afc1bf Phenom Fri, 21 Jul 2017 15:04:10 +0200 Fix CppCheck Error in contentvalue.cc
e576743 Phenom Fri, 21 Jul 2017 14:57:43 +0200 Fix CppCheck Error in p3idservice.cc
8d82640 Phenom Fri, 21 Jul 2017 10:58:19 +0200 Fix copy of RSLink when on Only plain text mode in chat lobby. (sss find)
aa471e5 csoler Fri, 21 Jul 2017 10:25:20 +0200 fixed uninitialized memory read in GxsTrans
f370f59 csoler Thu, 20 Jul 2017 22:12:57 +0200 fixed typo in ppa upload script
581c11d csoler Thu, 20 Jul 2017 22:11:35 +0200 fixed various problems with 06 suppression in package control files
baac33d csoler Thu, 20 Jul 2017 21:18:07 +0200 updated revision number
f9d6a78 csoler Thu, 20 Jul 2017 18:19:10 +0200 Merge pull request #954 from PhenomRetroShare/Fix_ShowAuthorInPeopleTabAtStartUp
5b86f44 Phenom Thu, 20 Jul 2017 14:29:31 +0200 Fix Show Author In People Tab at startup
d60bb78 csoler Wed, 19 Jul 2017 18:37:23 +0200 Merge pull request #952 from PhenomRetroShare/Fix_LobbyAutoSubscribe
cbbc392 Phenom Wed, 19 Jul 2017 13:38:26 +0200 Fix Lobby auto-subscribe.
0d681b1 csoler Wed, 19 Jul 2017 18:26:32 +0200 Merge pull request #924 from PhenomRetroShare/Fix_retroshare06_case
71810e8 csoler Wed, 19 Jul 2017 18:18:32 +0200 Merge pull request #950 from PhenomRetroShare/Add_ChatServerFlag
833787e csoler Tue, 18 Jul 2017 23:02:54 +0200 Merge pull request #949 from PhenomRetroShare/Add_AnonIconBeforeName
bb8f93e csoler Tue, 18 Jul 2017 21:19:38 +0200 Merge pull request #951 from PhenomRetroShare/Fix_BadServMntorRegister
5bbb99a Phenom Tue, 18 Jul 2017 19:24:32 +0200 Fix Bad Service Monitor registering.
3a6bcf5 Phenom Tue, 18 Jul 2017 16:34:56 +0200 Add flag for ChatServer
b8f742d Phenom Tue, 18 Jul 2017 14:30:31 +0200 Add :/icons/anonymous_blue_128.png before name for unsigned GxsId
e56340e csoler Mon, 17 Jul 2017 23:12:06 +0200 Merge pull request #386 from PhenomRetroShare/Add_AbilityToChangeOpModeInCmdLine
d39b05c csoler Mon, 17 Jul 2017 22:49:44 +0200 Merge pull request #948 from PhenomRetroShare/Add_FilterIdInFriendList
f4aec11 csoler Mon, 17 Jul 2017 22:48:12 +0200 suppressed warning in p3dhtmgr.cc
4374264 Phenom Sat, 15 Jul 2017 15:07:05 +0200 Fix clang warning: unused variable 'pqiservicezone'
1f39789 Phenom Sat, 15 Jul 2017 18:32:53 +0200 Fix clang warning: 'RSGraphWidget::sizeHint' hides overloaded virtual function
3003598 Phenom Mon, 17 Jul 2017 11:48:08 +0200 Fix clang warning: 'p3ChatService' defined as a struct here but previously declared as a class
91c526f Phenom Mon, 17 Jul 2017 11:43:41 +0200 Fix clang warning: 'p3MsgService' defined as a struct here but previously declared as a class
896ed3e Phenom Mon, 17 Jul 2017 11:38:53 +0200 Fix clang warning: class 'p3Config' was previously declared as a struct
8dbb0d6 Phenom Sat, 15 Jul 2017 10:57:05 +0200 Fix warning: this statement may fall through
7d8b379 csoler Mon, 17 Jul 2017 22:18:53 +0200 Merge pull request #941 from PhenomRetroShare/Add_UnsignedInChatName
b6731ed Gioacc Mon, 17 Jul 2017 16:04:52 +0200 Better naming and doc for warning suppression CONFIG
f888913 Phenom Sat, 13 Aug 2016 14:34:31 +0200 Set Operating Mode in RsInit::InitRetroShare so noGUI could use it.
8563957 Phenom Mon, 16 May 2016 12:10:04 +0200 Add the ability to change OpMode in command line.
c74c865 Phenom Mon, 17 Jul 2017 14:10:26 +0200 Add new Filter by ID in FriendList.
1491a05 csoler Mon, 17 Jul 2017 11:16:48 +0200 fixed deadlock situation in FT causing multiple bugs: lock when DLing from a file list a file that is already being downloaded, and lock when a FT module find a direct source among friends
5bf056c Phenom Mon, 17 Jul 2017 10:44:27 +0200 Rename retroshare06 to retroshare
b12fd11 Phenom Wed, 5 Jul 2017 18:11:52 +0200 Change RetroShare06 to lower case
65326d9 csoler Sun, 16 Jul 2017 22:08:07 +0200 removed DEPRECATED warnings by default
e2fa57d Phenom Sat, 15 Jul 2017 19:03:17 +0200 Fix clang warning: unused variable 'INTERVAL_BETWEEN_DEBUG_DUMP'
a50c4ca Phenom Sat, 15 Jul 2017 18:54:21 +0200 Fix clang warning: unused variable 'kRecognTagClass_DEVELOPMENT'
f2fb05d Phenom Sat, 15 Jul 2017 18:50:32 +0200 Fix clang warning: unused variables 'PARTIAL_VIEW_SIZE', ...
6ee65bc Phenom Sat, 15 Jul 2017 18:42:19 +0200 Fix clang warning: using floating point absolute value function 'fabsf' when argument is of integer type
a0ac6b7 Phenom Sat, 15 Jul 2017 18:40:03 +0200 Fix clang warning: unused variable 'MAX_TUNNEL_REQUESTS_DISPLAY'
64899e4 Phenom Sat, 15 Jul 2017 18:36:14 +0200 Fix clang warning: unused variable 'SFI_DEFAULT_PERIOD'
b31c812 Phenom Sat, 15 Jul 2017 18:35:11 +0200 Fix clang warning: unused variable 'NEWSFEED_CHANNELMSGLIST'
69060f8 Phenom Sat, 15 Jul 2017 18:24:55 +0200 Modify #warning to get author and date.
26397d7 Phenom Sat, 15 Jul 2017 18:22:16 +0200 Fix clang warning: unused variables 'LOWER_LIMIT', ...
903f875 Phenom Sat, 15 Jul 2017 18:17:00 +0200 Fix clang warning: unused variable 'MAX_SERIALIZED_ARRAY_SIZE'
d83a962 Phenom Sat, 15 Jul 2017 16:45:19 +0200 Fix clang warning: unused variables 'GIXS_CUT_OFF', ...
51fa7a5 Phenom Sat, 15 Jul 2017 16:39:24 +0200 Fix clang warning: unused variable 'p3facestartupzone'
13220ec Phenom Sat, 15 Jul 2017 16:33:04 +0200 Fix clang warning: unused variable 'MAX_TIME_KEEP_LOCATION_WITHOUT_CONTACT'
fea1b83 Phenom Sat, 15 Jul 2017 16:32:11 +0200 Fix clang warning: unused variable 'p3facemsgzone'
5a64996 Phenom Sat, 15 Jul 2017 15:04:56 +0200 Fix clang warning: unused variables 'RS_NET_NEEDS_RESET', ...
4152a46 Phenom Sat, 15 Jul 2017 14:58:55 +0200 Fix clang warning: unused variable 'P3CONNMGR_UDP_DEFAULT_DELAY'
5b1323e Phenom Sat, 15 Jul 2017 14:53:04 +0200 Fix clang warning: unused variables 'PQI_HANDLER_NB_PRIORITY_LEVELS', ...
9148fa6 Phenom Sat, 15 Jul 2017 14:38:17 +0200 Fix clang warning: unused variables 'RS_NET_DOWN', ...
e4616c0 Phenom Sat, 15 Jul 2017 14:31:21 +0200 Fix clang warning: unused variable 'STORE_KEY_TIMEOUT'
0479ec0 Phenom Sat, 15 Jul 2017 14:30:06 +0200 Fix clang warning: unused variable 'MAX_MESSAGES_PER_SECONDS_NUMBER'
80ea4de Phenom Sat, 15 Jul 2017 14:28:29 +0200 Fix clang warning: unused variable 'ftserverzone'
8a270af Phenom Sat, 15 Jul 2017 14:27:19 +0200 fixed merging problem
35186c4 Phenom Sat, 15 Jul 2017 14:22:48 +0200 Fix clang warning: unused variable 'res'
7f1e230 Phenom Sat, 15 Jul 2017 14:21:53 +0200 Fix clang warning: unused variable 'FT_TM_CRC_MAP_MAX_WAIT_PER_GIG', ...
8b99c80 Phenom Sat, 15 Jul 2017 14:04:56 +0200 Fix clang warning: 'p3GxsTrans' defined as a class here but previously declared as a struct
fd24ef5 Phenom Sat, 15 Jul 2017 13:35:50 +0200 Fix warning: comparison between signed and unsigned integer expressions and misleading-indentation
431b564 Phenom Sat, 15 Jul 2017 13:32:04 +0200 Fix warning: unused variable popLimit
2444e6e Phenom Sat, 15 Jul 2017 13:29:33 +0200 Fix warning: this statement may fall through
dcb8a35 Phenom Sat, 15 Jul 2017 13:28:05 +0200 Fix warning: unused variable self and misleading-indentation
ca9357c Phenom Sat, 15 Jul 2017 13:25:14 +0200 Fix warning: this if clause does not guard...
b5c503a Phenom Sat, 15 Jul 2017 13:24:07 +0200 Fix warning: unused variable prev_index
3a22c6d Phenom Sat, 15 Jul 2017 13:20:46 +0200 Fix warning: comparison between signed and unsigned integer expressions
6fd0308 Phenom Sat, 15 Jul 2017 13:19:08 +0200 Fix warning: this statement may fall through
f27ce82 Phenom Sat, 15 Jul 2017 13:18:00 +0200 Fix warning: comparison between signed and unsigned integer expressions , misleading-indentation and unused-variable
15bc9c1 Phenom Sat, 15 Jul 2017 13:10:41 +0200 Fix warning: this statement may fall through
f23c84f Phenom Sat, 15 Jul 2017 13:06:19 +0200 Fix warning: this statement may fall through
9a4ed80 Phenom Sat, 15 Jul 2017 13:01:39 +0200 Fix warning: comparison between signed and unsigned integer expressions and unused variables
8455adf Phenom Sat, 15 Jul 2017 12:50:50 +0200 Fix warning: unused parameter type and req
c866bf9 Phenom Sat, 15 Jul 2017 12:49:27 +0200 Fix warning: unused parameter req and resp
9d4967c Phenom Sat, 15 Jul 2017 12:48:04 +0200 Fix warning: unused parameter req
c97269b Phenom Sat, 15 Jul 2017 12:44:55 +0200 Fix warning: this statement may fall through
1813948 Phenom Sat, 15 Jul 2017 11:48:37 +0200 Fix warning: unused parameter grpItem and unused debug variables
e1ea92d Phenom Sat, 15 Jul 2017 11:42:02 +0200 Fix warning: unused parameter n
f193af2 Phenom Sat, 15 Jul 2017 11:40:38 +0200 Fix warning: unused parameter size
d8b0b52 Phenom Sat, 15 Jul 2017 11:39:03 +0200 Fix warning: variable it set but not used
b11022a Phenom Sat, 15 Jul 2017 11:35:18 +0200 Fix warning: this statement may fall through
0e302e2 Phenom Sat, 15 Jul 2017 11:30:08 +0200 Fix warning: this statement may fall through
7b4d3c5 Phenom Sat, 15 Jul 2017 11:25:54 +0200 Fix warning: this statement may fall through
476b581 Phenom Sat, 15 Jul 2017 11:23:51 +0200 Fix warning: this statement may fall through
7bd7c57 Phenom Sat, 15 Jul 2017 11:21:36 +0200 Fix warning: variable pgpNameFound set but not used
a0506c1 Phenom Sat, 15 Jul 2017 11:19:28 +0200 Fix warning: this statement may fall through
b9d4651 Phenom Sat, 15 Jul 2017 11:17:02 +0200 Fix warning: this statement may fall through
e12f51b Phenom Sat, 15 Jul 2017 11:14:53 +0200 Fix warning: variable peerIt1 set but not used
78cfde9 Phenom Sat, 15 Jul 2017 11:11:51 +0200 Fix warning: this statement may fall through
3a6ad82 Phenom Sat, 15 Jul 2017 11:03:58 +0200 Fix warning: this statement may fall through
635246c Phenom Sat, 15 Jul 2017 11:01:16 +0200 Fix warning: this statement may fall through
e718070 Phenom Sat, 15 Jul 2017 10:51:17 +0200 Fix warning: this statement may fall through
714f9bb Phenom Sat, 15 Jul 2017 10:46:32 +0200 Fix warning: this statement may fall through
987c105 csoler Sun, 16 Jul 2017 20:16:31 +0200 Merge pull request #945 from PhenomRetroShare/Add_RSLinkCreateAsStatic
e40dbe8 csoler Sun, 16 Jul 2017 17:03:37 +0200 Merge pull request #947 from csoler/v0.6-ImprovedGUI
1e98de7 csoler Sun, 16 Jul 2017 16:56:23 +0200 fixed filtering for channels when loading items on the fly
82addce Phenom Sun, 16 Jul 2017 13:11:47 +0200 Change RetroShareLink creation methodes as static
2d5e1d6 csoler Sun, 16 Jul 2017 10:08:33 +0200 fixed last update missing commits
-- Retroshare Dev Team <contact@retroshare.net> Wed, 20 Jul 2017 22:00:00 +0100
retroshare06 (0.6.2-1.20170716.2d5e1d63~zesty) zesty; urgency=low
4718125 csoler Sun, 16 Jul 2017 10:05:33 +0200 updated changelog
991049d csoler Sat, 15 Jul 2017 22:20:43 +0200 Merge pull request #944 from csoler/v0.6-ImprovedGUI
08faa3f csoler Sat, 15 Jul 2017 22:16:45 +0200 fixed p3Gxstunnel so that it sends the data packets in the same order it received them. This fixes the bug in distant chat causing images to not transfer correctly in some cases
9c391cb csoler Sat, 15 Jul 2017 22:15:51 +0200 added an additional param to BinToHex so as to limit the size of the output
6a8b74c csoler Sat, 15 Jul 2017 22:00:35 +0200 fixed compilation for computers where qreal is a float
5ffb549 csoler Thu, 13 Jul 2017 21:49:47 +0200 Merge pull request #930 from myfingerhurt/master
3912118 csoler Thu, 13 Jul 2017 21:42:05 +0200 Merge pull request #925 from PhenomRetroShare/Fix_ChannelCommentLineWrap
98b0585 csoler Thu, 13 Jul 2017 21:23:14 +0200 Merge pull request #937 from csoler/v0.6-ImprovedNoGUI
69aa5b6 Gioacc Thu, 13 Jul 2017 13:00:32 +0200 Clean some garbage from the code
fd452af csoler Wed, 12 Jul 2017 23:03:17 +0200 removed some debut output that perturbated the passwd command line
00c1a9a csoler Wed, 12 Jul 2017 22:53:35 +0200 fixed autologin
66268c8 csoler Wed, 12 Jul 2017 18:48:06 +0200 fixed variable shadowing a parameter
1cdb971 csoler Tue, 11 Jul 2017 23:47:51 +0200 fixed compilation pb due to qtcreator bug
4cfdef5 csoler Tue, 11 Jul 2017 23:39:04 +0200 do not display auto-login option when software is compiled without autologin
a5e0b1c csoler Tue, 11 Jul 2017 23:32:22 +0200 fixed -U option in rs-nogui. Removed debug output that would ruin the terminal interface
3e3ee1a csoler Sun, 9 Jul 2017 22:12:01 +0200 little improvement to command line help display
2c6f11e csoler Sun, 9 Jul 2017 21:59:02 +0200 restored terminal output control class
5465e11 csoler Sun, 9 Jul 2017 21:37:39 +0200 fixed debug output
5dfbce7 csoler Sun, 9 Jul 2017 21:16:41 +0200 fixed Terminal Api Client logic
decbd35 csoler Sat, 8 Jul 2017 17:38:09 +0200 improved the login in the interaction between terminal api client and main
7ee527e csoler Sat, 8 Jul 2017 17:35:34 +0200 removed comments
b5976e1 csoler Sat, 8 Jul 2017 16:48:24 +0200 fixed message when passphrase is empty
4f887ff csoler Sat, 8 Jul 2017 16:47:50 +0200 commented out unused line
36a2053 NeverE Sat, 8 Jul 2017 00:20:09 +0900 add new functions to chat
75c8b71 NeverE Sat, 8 Jul 2017 00:18:51 +0900 add new functions for chat
fcec555 Gioacc Fri, 7 Jul 2017 11:57:17 +0200 Merge pull request #927 from Emotyco/libresapi_lobbies_invitation
fc396dd Gioacc Fri, 7 Jul 2017 11:56:12 +0200 Merge pull request #929 from Emotyco/libresapi_empty_cert
e46d91e Gioacc Fri, 7 Jul 2017 11:35:16 +0200 Merge branch 'android_share_intent'
f5912a3 csoler Thu, 6 Jul 2017 22:52:30 +0200 Merge pull request #928 from PhenomRetroShare/Fix_MultiDownload
f0ad687 Konrad Thu, 6 Jul 2017 22:44:45 +0200 Fixed: Libresapi was throwing exception when requested to add new cert which was empty
54047cd Phenom Thu, 6 Jul 2017 22:35:54 +0200 Fix multi download of same file.
42bf6b2 csoler Thu, 6 Jul 2017 20:57:38 +0200 improved display of password request
a778128 csoler Thu, 6 Jul 2017 20:50:59 +0200 fixed multi-digit numbers in terminal account selection
c630f1f Gioacc Thu, 6 Jul 2017 16:28:59 +0200 Fix unused warning in gxstokenqueue
b935bac Gioacc Thu, 6 Jul 2017 16:28:00 +0200 Add missing break in p3IdService::handleResponse
11d02f4 Konrad Thu, 6 Jul 2017 14:08:50 +0200 Added: Handling requests to answer invitation to lobby
c9bfe4b Konrad Thu, 6 Jul 2017 14:07:33 +0200 Added: Handling requests to get lobbies invitations
aca6233 Konrad Thu, 6 Jul 2017 14:05:48 +0200 Added: Handling requests to invite peers to lobby
dad6abd Phenom Wed, 5 Jul 2017 19:30:31 +0200 Fix channel comments line wrap
8e62a8b csoler Wed, 5 Jul 2017 22:32:54 +0200 updated tooltip for opinion in People
141277b csoler Wed, 5 Jul 2017 22:16:14 +0200 removed debug info
c1e18c7 csoler Wed, 5 Jul 2017 22:12:56 +0200 fixed bug causing an infinite subscribe/unsubscribe loop in GxsTrans
370d50b csoler Wed, 5 Jul 2017 21:36:00 +0200 cleaned a bit the code in rsinit.cc
7ee0b45 csoler Tue, 4 Jul 2017 23:27:43 +0200 Merge pull request #922 from csoler/v0.6-ImprovedGUI
5f7df7c csoler Tue, 4 Jul 2017 23:26:57 +0200 update call to notifySettingsChanged() when changing the thread loading of channels
2aac675 csoler Tue, 4 Jul 2017 23:15:09 +0200 merged upstream/master into v0.6-ImprovedGUI
931ddae csoler Tue, 4 Jul 2017 23:13:03 +0200 set load thread to false for channels on default. Fixed missing () in connect
dafaa56 Gioacc Tue, 4 Jul 2017 16:27:12 +0200 Qml App: better Android interaction on URL export
a97ba80 Gioacc Tue, 4 Jul 2017 16:41:14 +0200 Fix missing include
5b1def1 csoler Tue, 4 Jul 2017 10:25:40 +0200 Merge pull request #912 from Emotyco/libresapi_avatar_handlers
3274852 csoler Tue, 4 Jul 2017 10:24:43 +0200 Merge pull request #913 from Emotyco/libresapi_participants_refresh
ee25722 csoler Tue, 4 Jul 2017 10:24:05 +0200 Merge pull request #915 from PhenomRetroShare/Add_AlwaysAllowFriendTimeOffsetFeed
d7f0141 csoler Tue, 4 Jul 2017 10:23:30 +0200 Merge pull request #916 from PhenomRetroShare/Add_WarningToDirectDonwloadCheckBox
d876bb7 csoler Mon, 3 Jul 2017 23:21:31 +0200 fixing async loading of channels. To be tested.
1dea00d csoler Mon, 3 Jul 2017 23:09:17 +0200 attempt to fix channel post auto-size by limiting the number of lines from message to display in summary depending on available size
719b414 csoler Mon, 3 Jul 2017 22:32:08 +0200 fixed merging of comments in channel post with async-ed loading system
f0ed0dd csoler Mon, 3 Jul 2017 22:07:23 +0200 Merge pull request #918 from RetroShare/revert-917-v0.6-ImprovedGUI
9a5e46d csoler Mon, 3 Jul 2017 22:07:06 +0200 Revert "attempt to delay channel post loading on demand when displayed"
f5abf54 csoler Mon, 3 Jul 2017 21:54:22 +0200 Merge pull request #917 from csoler/v0.6-ImprovedGUI
b6d5c55 csoler Mon, 3 Jul 2017 21:48:17 +0200 attempt to delay channel post loading on demand when displayed
3987f75 Phenom Mon, 3 Jul 2017 17:14:16 +0200 Always allow Friend Time Offset Feed item.
2192a43 Phenom Mon, 3 Jul 2017 18:36:47 +0200 Add a warning to Direct download checkbox depends general setting.
f413433 csoler Mon, 3 Jul 2017 11:25:12 +0200 removed zeroing of preferred group causing a bug in GxsTrans
e9f9856 csoler Sun, 2 Jul 2017 10:42:22 +0200 fixed naming in friend groups in GroupChooser
77b064b csoler Sat, 1 Jul 2017 17:24:58 +0200 fixed translation of built-in group names in GxsGroupDialog
c61536e csoler Sat, 1 Jul 2017 16:21:22 +0200 fixed RsGraphWidget by adding an extra data point in the lower right corner, and fixed typo that caused an invalid point to be drawn
f136210 csoler Sat, 1 Jul 2017 16:20:39 +0200 fixed layout in GxsTrans stats
1323a97 csoler Sat, 1 Jul 2017 15:38:57 +0200 updated changelog
-- Retroshare Dev Team <contact@retroshare.net> Sun, 16 Jul 2017 12:00:00 +0100
retroshare06 (0.6.2-1.20170716.1323a974~trusty) trusty; urgency=low
244e8a8 csoler Sat, 1 Jul 2017 15:29:48 +0200 fixed display of GxsTrans statistics
27774ba csoler Thu, 29 Jun 2017 22:13:04 +0200 Merge pull request #911 from csoler/v0.6-GxsTransport
b294b4b csoler Thu, 29 Jun 2017 22:11:44 +0200 changed sorting of popular forums w.r.t. time of last post rather than number of supplier friends
a864cf7 csoler Thu, 29 Jun 2017 21:12:42 +0200 Merge pull request #910 from csoler/v0.6-GxsTransport
4b94b2e csoler Thu, 29 Jun 2017 21:12:02 +0200 improved display of GxsTrans statistics
1b4e8a4 csoler Thu, 29 Jun 2017 18:38:10 +0200 Merge pull request #909 from csoler/v0.6-GxsTransport
64e3fc9 csoler Thu, 29 Jun 2017 18:37:39 +0200 fixed bug preventing correct subscribe in GxsTrans
700d114 csoler Thu, 29 Jun 2017 18:27:00 +0200 fixed bug causing failure of group autosubscribe in GxsTrans
cb31a92 csoler Thu, 29 Jun 2017 18:03:31 +0200 Merge pull request #907 from PhenomRetroShare/Add_GeneralDirectDLSetting
b4071d1 Phenom Mon, 26 Jun 2017 23:35:01 +0200 Add General Direct Download setting.
a3e8b96 csoler Thu, 29 Jun 2017 13:50:41 +0200 Merge pull request #908 from csoler/v0.6-GxsTransport
37edcc1 csoler Thu, 29 Jun 2017 13:44:40 +0200 fixed subscribe policy to GxsTrans groups as a function of last available post and group usage
dc605c0 csoler Thu, 29 Jun 2017 13:15:39 +0200 added a last modif TS in GrpNetworkStats, that is inited from network Grp statistics, and used to provide a value for unsubscribed groups
533e2a8 csoler Wed, 28 Jun 2017 23:23:27 +0200 added check to fix existing wrong storage time value in GxsTrans
f37ba83 csoler Wed, 28 Jun 2017 23:12:33 +0200 moved msg keep period settings to netService and made the initialisation obei the default settings of the service
b96effb csoler Wed, 28 Jun 2017 22:37:50 +0200 Merge pull request #895 from PhenomRetroShare/Add_HelpInRelayTab
3550971 csoler Wed, 28 Jun 2017 22:37:05 +0200 Merge pull request #902 from Emotyco/libresapi_avatar_handlers
12b5628 csoler Tue, 27 Jun 2017 22:21:35 +0200 added more debug info in GxsUtil
51c7e18 csoler Tue, 27 Jun 2017 19:56:21 +0200 added last msg time in GxsTrans stats. Added mutex to protect non atomic mPreferredGroup
579c944 csoler Sun, 25 Jun 2017 21:50:51 +0200 Merge pull request #903 from sehraf/improve-server-page
3c54beb sehraf Sun, 25 Jun 2017 19:19:07 +0200 hide hidden service port for I2P instead of just disabling it (it's not used for I2P)
e128fcb Konrad Sun, 25 Jun 2017 15:35:23 +0200 Added: Creating identity with avatar in libresapi
54166ce Konrad Sun, 25 Jun 2017 14:30:38 +0200 Added: Handling requests to set and get identity avatar
c3a78ce csoler Sat, 24 Jun 2017 13:14:24 +0200 Merge pull request #900 from csoler/v0.6-GxsTransport
8c4396c csoler Sat, 24 Jun 2017 12:54:06 +0200 Merge pull request #899 from Emotyco/libresapi_wrong_password_notification
66a9dad Konrad Sat, 24 Jun 2017 12:05:32 +0200 Fixed: Information about wrong password
2aac999 Konrad Sat, 24 Jun 2017 12:02:28 +0200 Fixed: Duplication of handler declaration
332fedd csoler Sat, 24 Jun 2017 11:38:48 +0200 fixed mismatched free/delete[] in AvatarDefs
2bb49f6 csoler Fri, 23 Jun 2017 21:58:54 +0200 Merge pull request #898 from csoler/v0.6-GxsTransport
0f99647 csoler Fri, 23 Jun 2017 21:58:17 +0200 fixed memory leak in GxsTrans
25a71c9 csoler Fri, 23 Jun 2017 21:24:37 +0200 Merge pull request #897 from PhenomRetroShare/Fix_ChannelPostButton
adfc594 Phenom Fri, 23 Jun 2017 20:33:43 +0200 Fix GxsChannelPostItem button, like "download" or "Play" never shown.
c415e11 Phenom Thu, 22 Jun 2017 18:52:03 +0200 Add help in Relay setting tab.
07ecbec csoler Thu, 22 Jun 2017 18:05:39 +0200 fixed bug in makeSourcePackage which would always grab the release branch
-- Retroshare Dev Team <contact@retroshare.net> Sat, 01 Jul 2017 16:00:00 +0100
retroshare06 (0.6.2-1.20170623.07ecbec6~precise) precise; urgency=low
c34165e csoler Wed, 21 Jun 2017 08:08:29 +0200 pushed new changelog to force update of the date...
8950acc csoler Thu, 22 Jun 2017 00:39:03 +0200 Merge pull request #892 from PhenomRetroShare/Add_MoveRelayPageToNetwork
ea8af8a Phenom Wed, 21 Jun 2017 17:57:14 +0200 Move Relay setting page to network one.
8cc82f9 csoler Wed, 21 Jun 2017 18:32:51 +0200 Merge pull request #891 from PhenomRetroShare/Fix_MessageToHeight
812e606 csoler Tue, 20 Jun 2017 23:40:58 +0200 fixed changelog for typo
1f9320c csoler Tue, 20 Jun 2017 21:17:21 +0200 updated changelog
310c848 csoler Wed, 21 Jun 2017 07:42:15 +0200 Merge pull request #890 from G10h4ck/qml_app_identity_avatar
c46c747 Phenom Wed, 21 Jun 2017 06:35:29 +0200 Fix To, Cc & Bcc height in MessageWidget.
1d03191 Gioacc Tue, 20 Jun 2017 17:16:27 +0200 Created a dedicated component for avatar image
8c62c2a Gioacc Tue, 20 Jun 2017 15:35:05 +0200 Qml app: show contact avatar in details if available
b206015 Gioacc Tue, 20 Jun 2017 15:33:28 +0200 libresapi: expose identity avatar in JSON API
0133be7 csoler Sat, 17 Jun 2017 23:07:10 +0200 Merge pull request #887 from csoler/v0.6-GxsTransport
12a4529 csoler Sat, 17 Jun 2017 23:02:28 +0200 added ifdef for comments on GxsTrans
eb4bb5b csoler Sat, 17 Jun 2017 21:42:00 +0200 fixed bug in gxs trans stats counting
43dcddc csoler Fri, 16 Jun 2017 12:37:09 +0200 Merge pull request #880 from PhenomRetroShare/Add_GxsCircleNotify
a29bc44 csoler Fri, 16 Jun 2017 12:24:45 +0200 Merge pull request #874 from G10h4ck/silent_initiate_distant_chat_api
12eed8e csoler Fri, 16 Jun 2017 12:22:57 +0200 Merge pull request #884 from sehraf/pr-fix-bob-settings
25565a7 csoler Thu, 15 Jun 2017 23:58:29 +0200 merged upstream/master
6633b04 csoler Thu, 15 Jun 2017 23:57:02 +0200 changed constants for GxsTransport anti-spam
26bb865 csoler Thu, 15 Jun 2017 19:32:31 +0200 added code to reject messages based on existing per-user statistics
65ab68b sehraf Thu, 15 Jun 2017 07:20:24 +0200 fix stop button being wrongly disabled
fe5ec8b sehraf Thu, 15 Jun 2017 07:06:52 +0200 reduce BOB log level
09ff94c csoler Wed, 14 Jun 2017 23:19:52 +0200 added new virtual method to refuse incoming msgs (similar to groups) in RsGenExchange, and used it in p3GxsTrans to refuse msgs from peers who send too much
c451d3a csoler Mon, 12 Jun 2017 22:18:34 +0200 Merge pull request #873 from RetroPooh/tunnstats
1e7feec csoler Mon, 12 Jun 2017 22:16:46 +0200 Merge pull request #882 from topcat/iss879
79825eb csoler Mon, 12 Jun 2017 20:36:02 +0200 fixed thread issue in RsGxsCleanupThread that caused random crashes
80ec9b7 Jeetu Mon, 12 Jun 2017 15:51:26 +0530 Included QStringList header in ApiServerLocal.cpp [Issue 879]
aa64c4d Phenom Tue, 30 May 2017 22:23:31 +0200 Add Circle Feed Item.
1766087 csoler Wed, 7 Jun 2017 23:10:59 +0200 fixed update notification and display in GxsTransStatistics
9853b53 csoler Wed, 7 Jun 2017 23:10:24 +0200 fixed debug output in GxsNetService
7691a8e csoler Wed, 7 Jun 2017 21:41:20 +0200 removed debug info
4cb7522 csoler Wed, 7 Jun 2017 21:41:00 +0200 added deleted gxs messages to the reject list of GxsNetService to avoid re-downloading them right away
edd82d0 Gioacc Wed, 7 Jun 2017 21:37:03 +0200 libresapi: stop assuming first chat message is own
318ea31 csoler Sat, 3 Jun 2017 10:30:22 +0200 fixed layout of GxsTrans stats
23156ab csoler Sat, 3 Jun 2017 10:30:02 +0200 fixed malloc problem when chat avatar is missing
e726bd1 csoler Wed, 7 Jun 2017 13:37:38 +0200 attempt to fix the crash in DataStore by not calling deleteMsgs directly
39f003f csoler Tue, 6 Jun 2017 22:00:08 +0200 Merge pull request #875 from csoler/v0.6-GxsTransport
528317d Gioacc Tue, 6 Jun 2017 18:57:32 +0200 libresapi: silent /chat/initiate_distant_chat
f62028b csoler Tue, 6 Jun 2017 00:15:06 +0200 moved metadata info to members of OutgoingRecord, so that the un-serialized meta is not lost when saved. Ensured backward compatibility when reloading old items.
1e652d6 csoler Mon, 5 Jun 2017 22:27:54 +0200 reduced number of calls to indicateConfigChanged(), and renamed mIngoingQueue into mIncomingQueue in GxsTrans
0098433 csoler Mon, 5 Jun 2017 21:51:59 +0200 Merge pull request #871 from Emotyco/changed_socket_path_windows
b7c09bd csoler Mon, 5 Jun 2017 21:15:42 +0200 added calls to indicateConfigChanged() to force saving GxsTrans outgoing records when updated
2d8fd07 RetroP Mon, 5 Jun 2017 14:25:09 +0300 stats tunnels rearranged columns for better readablilty
ca1dc9d Konrad Sun, 4 Jun 2017 22:10:41 +0200 Changed: Unified socket path across systems.
318b2cb csoler Sun, 4 Jun 2017 20:38:20 +0200 Merge pull request #870 from BabushkaRetroShare/master
7fb0419 Babush Sun, 4 Jun 2017 20:34:10 +0200 Typo fixes
458e180 csoler Sun, 4 Jun 2017 18:44:26 +0200 Merge pull request #869 from csoler/v0.6-GxsTransport
1967204 csoler Sun, 4 Jun 2017 18:43:12 +0200 restored GXS trans cleanign delay
831b560 csoler Sun, 4 Jun 2017 18:37:38 +0200 moved deletion of msgs in GxsTransport inside the service thread
5eaab25 csoler Sat, 3 Jun 2017 20:00:54 +0200 Merge pull request #833 from Emotyco/libresapi_network_configuration
861dab3 csoler Sat, 3 Jun 2017 13:27:21 +0200 Merge pull request #863 from G10h4ck/qmlapp_pex_alpha
e3cd3b6 csoler Fri, 2 Jun 2017 23:26:24 +0200 fixed bug causing display of null group in GxsTransportStatistics
fb7ac7a csoler Fri, 2 Jun 2017 23:10:43 +0200 fixed mismatched free/delete (free is used in rschatitems.cc to delete avatars)
efdfa46 Gioacc Fri, 2 Jun 2017 10:39:42 +0200 Merge branch 'libresapi_attempt_connection' into qmlapp_pex_alpha
8b72c9c Gioacc Fri, 2 Jun 2017 10:26:15 +0200 libresapi expose connection attempt method
8e7e700 csoler Thu, 1 Jun 2017 10:16:30 +0200 fixed compilation for windows
59b77da Gioacc Wed, 31 May 2017 12:11:15 +0200 Merge branch 'master' into qmlapp_pex_alpha
1ebcc60 csoler Tue, 30 May 2017 22:22:06 +0200 Merge pull request #861 from RetroShare/v0.6-GxsTransport
d7797f1 csoler Tue, 30 May 2017 21:42:29 +0200 Merge pull request #856 from G10h4ck/GxsTransOptionalChat
eacf23d csoler Tue, 30 May 2017 21:40:41 +0200 Merge pull request #860 from csoler/v0.6-GxsTransport
832ba69 csoler Tue, 30 May 2017 21:38:59 +0200 fixed up cleanup for GxsTransport
a7eb167 csoler Tue, 30 May 2017 20:57:20 +0200 fixed a bug in RsThread which made finished threads unaware of their state
32ad43a csoler Tue, 30 May 2017 20:46:49 +0200 Merge pull request #859 from PhenomRetroShare/Fix_StartDialogMargin
5410c51 csoler Tue, 30 May 2017 20:45:39 +0200 added cleanup thread for GxsTransport
34fbee2 Phenom Tue, 30 May 2017 20:34:12 +0200 Fix StartDialog margins.
5c71d52 Gioacc Tue, 30 May 2017 15:43:43 +0200 async chat disabled by default in GUI
f4c167c csoler Tue, 30 May 2017 13:57:11 +0200 improved display of GXS Transport stats
2e3f62a csoler Mon, 29 May 2017 23:06:31 +0200 added msg ids to GxsTransport statistics.
bd1edbc csoler Sun, 28 May 2017 22:50:34 +0200 Merge pull request #850 from csoler/v0.6-GxsTransport
0868b64 csoler Sun, 28 May 2017 22:49:07 +0200 fixed uninitialized memory read in GxsTrans msg Id
4c07050 csoler Sun, 28 May 2017 22:02:14 +0200 Merge pull request #841 from sehraf/pr-minor-fix
048045a csoler Sun, 28 May 2017 22:01:28 +0200 Merge pull request #849 from PhenomRetroShare/Fix_logo_web_nobackground
54e91e3 csoler Sun, 28 May 2017 22:00:49 +0200 Merge pull request #840 from felisucoibi/master
9121ff6 csoler Sun, 28 May 2017 21:59:48 +0200 Merge pull request #848 from PhenomRetroShare/Fix_WindowsCompil
9d2e0d7 Phenom Sun, 28 May 2017 15:19:27 +0200 Fix Appveyor
5c99297 Phenom Sun, 28 May 2017 13:19:22 +0200 Fix logo_web_nobackground
28119b5 Phenom Sun, 28 May 2017 12:57:36 +0200 Fix Windows Compilation
6d76624 csoler Sat, 27 May 2017 23:16:20 +0200 fixed uninitialized memory read in grouter
e0498ba csoler Sat, 27 May 2017 22:37:14 +0200 Merge pull request #846 from csoler/v0.6-GxsTransport
eea63ac csoler Sat, 27 May 2017 22:19:52 +0200 minor code cleaning in p3GxsTrans (struct->class for consistency, sendMail->sendData), added popularity+subscribed status display in statistics
753867e csoler Sat, 27 May 2017 15:22:32 +0200 Merge pull request #845 from csoler/v0.6-GxsTransport
6da8b2a csoler Sat, 27 May 2017 15:13:23 +0200 fixed up icons in statistics window
e06bd9b csoler Sat, 27 May 2017 14:48:08 +0200 added icon for GxsTransport
4fef4d6 csoler Sat, 27 May 2017 14:23:16 +0200 added display of the various GxsTrans groups and their respective sizes
7c43998 csoler Fri, 26 May 2017 22:04:33 +0200 Merge pull request #842 from csoler/v0.6-GxsTransport
541b42a sehraf Fri, 26 May 2017 20:29:43 +0200 minor fix
a3096f2 csoler Fri, 26 May 2017 20:28:44 +0200 added data hash to GxsTrans display
95b0273 felisu Fri, 26 May 2017 18:54:02 +0200 small fix removed ... from text login screen.
4fa6cbe csoler Fri, 26 May 2017 18:42:52 +0200 fixed display in GxsTrans stats widget
95f1719 felisu Fri, 26 May 2017 18:37:05 +0200 Changed login screen add Profile/Node text.
1e8df12 felisu Fri, 26 May 2017 18:19:06 +0200 Final step to change again size and design of start up login screen. 4/4
7281222 felisu Fri, 26 May 2017 18:15:14 +0200 Login screen 3 / 4
2dbe3a1 felisu Fri, 26 May 2017 18:13:57 +0200 Start login 2/4
0fa3b9e felisu Fri, 26 May 2017 18:12:24 +0200 smaller login screen and less blue 1
873131f csoler Thu, 25 May 2017 22:20:18 +0200 Merge pull request #836 from sehraf/pr-add-i2p-bob-v2.1
14b9a54 csoler Thu, 25 May 2017 16:56:29 +0200 added group data retrieval to GxsTransStatistics
a3ee85a sehraf Sun, 9 Oct 2016 14:32:52 +0200 Add I2P BOB support to libretroashare and RetroShare GUI
9ff81b9 csoler Tue, 23 May 2017 22:06:46 +0200 Merge pull request #835 from felisucoibi/master
483d538 defnax Tue, 23 May 2017 18:46:50 +0200 fit the background image to the login page
a136fb6 csoler Mon, 22 May 2017 23:54:55 +0200 added display of ongoing record status for GxsTrans. Unfinished.
ac66ee7 felisu Mon, 22 May 2017 15:21:06 +0200 Improved GUI gencert
9b67e93 Konrad Sun, 21 May 2017 19:51:52 +0200 Added: Network configuration to libresapi.
fbeb6ff csoler Sun, 21 May 2017 15:57:10 +0200 added infrastructure for gathering statistics about GxsTransport. Unfinished.
8c1babe csoler Sun, 21 May 2017 15:12:49 +0200 Merge pull request #832 from felisucoibi/master
2adde95 felisu Sun, 21 May 2017 15:08:07 +0200 fixed bad uploading of previous pr
dbc2396 csoler Sun, 21 May 2017 14:52:20 +0200 Merge pull request #830 from Gottox/fix-libressl
6bc72dd felisu Sun, 21 May 2017 14:51:43 +0200 restored start dialog and fixed
33ab7fa csoler Sun, 21 May 2017 14:49:13 +0200 Merge pull request #831 from Gottox/fix-musl
b341fea csoler Sun, 21 May 2017 13:49:41 +0200 merged upstream/master
a5cebb9 felisu Sun, 21 May 2017 12:35:43 +0200 simplified and upgraded gui logo added
ecf3fc5 felisu Sun, 21 May 2017 12:34:52 +0200 simplified gui
d83c42d felisu Sun, 21 May 2017 12:33:40 +0200 Add files via upload
a578acd Enno B Sun, 21 May 2017 10:54:19 +0200 fix building with musl libc
2046d9e Enno B Sun, 21 May 2017 10:48:58 +0200 fix building with libressl
95c9b37 defnax Sun, 21 May 2017 04:12:34 +0200 update background image resolution
a439fbf csoler Sat, 20 May 2017 23:01:56 +0200 fixed bug (due to new serializer) that caused a wrong hash to be computed when sending distant messages
ef59a60 csoler Sat, 20 May 2017 22:39:53 +0200 Merge pull request #828 from csoler/v0.6-EditPosts
162095b csoler Sat, 20 May 2017 22:37:31 +0200 fixed count of unread/new posts by not counting older versions
8b079f8 csoler Sat, 20 May 2017 18:34:07 +0200 Merge pull request #827 from csoler/v0.6-EditPosts
0321037 csoler Sat, 20 May 2017 18:15:57 +0200 fixed centering of comments
7a2807a defnax Sat, 20 May 2017 18:06:23 +0200 added missed icon
9da1e1c csoler Sat, 20 May 2017 17:53:25 +0200 fixed proper comment number in channels feeds
51710c1 csoler Sat, 20 May 2017 17:33:05 +0200 merge comments between channel item versions
bda7a50 defnax Sat, 20 May 2017 15:14:43 +0200 Improved look & feel for Generate and Login Window
d79c117 csoler Fri, 19 May 2017 22:12:02 +0200 Merge pull request #826 from PhenomRetroShare/Fix_ChatFontSetting
7acefda Phenom Fri, 19 May 2017 18:40:17 +0200 Fix Chat Font setting saving.
6b09fa0 csoler Thu, 18 May 2017 22:31:52 +0200 allow GxsFeedItems to have versions. Unfinished (does not compile)
db3dad3 Gioacc Thu, 18 May 2017 21:57:24 +0200 Local API binary output support + qml image example
e59366d Gioacc Wed, 17 May 2017 15:49:26 +0200 Qml app: made contact sorting case insensitive
97a0e00 Gioacc Wed, 17 May 2017 15:34:29 +0200 Qml Better debugging for token manager
c1c1d5d Gioacc Wed, 17 May 2017 15:33:10 +0200 Qml app: fixed unread messages count displaying
d5ec641 csoler Tue, 16 May 2017 19:45:27 +0200 changing background color as a function of commenter ID (needs to be further adapted to all styles)
86118d9 csoler Tue, 16 May 2017 10:26:03 +0200 Merge pull request #823 from csoler/v0.6-EditPosts
fd136c1 csoler Tue, 16 May 2017 10:24:23 +0200 made gxs comments multi-lines
b9d19c2 csoler Mon, 15 May 2017 22:17:26 +0200 Merge pull request #822 from csoler/v0.6-EditPosts
2bc36bc csoler Mon, 15 May 2017 22:13:36 +0200 properly merge new version feed items in channels when some items are already present
84e588b csoler Mon, 15 May 2017 21:37:22 +0200 switch file to REMOTE state in subfileitem if the attachment has already been checked in the past but the file is not here anymore
635918e csoler Mon, 15 May 2017 20:09:58 +0200 Merge pull request #821 from G10h4ck/v0.6-GxsTransport
de9a44f Gioacc Mon, 15 May 2017 19:16:08 +0200 Merge branch 'v0.6-GxsTransport' into qmlapp_pex_alpha
10ec527 Gioacc Mon, 15 May 2017 15:00:21 +0200 Fix GxsTrans related serialization regressions
745462a Gioacc Mon, 15 May 2017 15:05:07 +0200 Merge branch 'v0.6-GxsTransport' into qmlapp_pex_alpha
93a6b7d Gioacc Mon, 15 May 2017 15:00:21 +0200 Fix serialization regression in async chat
d335d45 thunder2 Mon, 15 May 2017 09:43:47 +0200 Fixed build script for Windows
32b7003 csoler Sun, 14 May 2017 21:44:08 +0200 Merge pull request #820 from csoler/v0.6-EditPosts
18e37de csoler Sun, 14 May 2017 21:41:26 +0200 hide download buttons when the file is local in sub file item
1824da1 csoler Sun, 14 May 2017 21:29:04 +0200 Merge pull request #819 from csoler/v0.6-EditPosts
f832f3d csoler Sun, 14 May 2017 21:26:45 +0200 added delete button to channel attached files
af57545 csoler Sun, 14 May 2017 20:59:43 +0200 removed unused button in GxsChannelPostsWidget
9077d80 csoler Sun, 14 May 2017 17:52:40 +0200 Merge pull request #817 from csoler/v0.6-EditPosts
2f43927 csoler Sat, 13 May 2017 21:13:24 +0200 Merge pull request #698 from G10h4ck/gxs_mail_experiments
c0c5cc5 csoler Sat, 13 May 2017 21:08:16 +0200 Merge branch 'master' into gxs_mail_experiments
01bb4b0 csoler Sat, 13 May 2017 20:41:56 +0200 added ifdefs around debug info and fixed a few bugs in channel post edit
6859e0d csoler Sat, 13 May 2017 17:13:05 +0200 fixed post replacement algorithm in channel editing
022c545 Gioacc Sat, 13 May 2017 12:52:45 +0200 Qml app: show contact details when avater clicked
0b82b73 Gioacc Sat, 13 May 2017 11:43:31 +0200 Qml app: fixed import/export of plain certificate
659e3c9 csoler Fri, 12 May 2017 23:55:09 +0200 merged upstream/master
305c5d6 csoler Fri, 12 May 2017 23:54:02 +0200 added collapsing of new versions of channel posts
2f17a80 defnax Fri, 12 May 2017 21:39:50 +0200 added missed icons
837fcd7 defnax Fri, 12 May 2017 18:29:39 +0200 Added Placeholder text for Password field, removed "Password:" label.
5044ac1 csoler Thu, 11 May 2017 23:44:57 +0200 moved the edit button from top bar to each channel post
5406da9 csoler Thu, 11 May 2017 23:21:13 +0200 first part of channel post editing
38d0743 csoler Thu, 11 May 2017 18:46:40 +0200 used more saturated colors in stats graph
7a19dee csoler Thu, 11 May 2017 14:52:26 +0200 small fix to statistics view
eb30af5 csoler Thu, 11 May 2017 14:42:06 +0200 improved display in bw statistics
d73e850 defnax Thu, 11 May 2017 18:14:21 +0200 look n feel improvements
7eb5e8e csoler Wed, 10 May 2017 21:37:06 +0200 added warning when switching opmode status to non turtle for the first time
1ff1b89 Phenom Sun, 7 Feb 2016 11:45:55 +0100 Save last state of OpMode status bar droplist and restore it at start.
3cc79fb csoler Wed, 10 May 2017 20:00:42 +0200 Merge pull request #774 from PhenomRetroShare/Fix_LobbyTopic
af18e4c csoler Wed, 10 May 2017 19:34:53 +0200 Merge pull request #816 from PhenomRetroShare/Fix_StartPasswordFocus
6ffae36 Phenom Wed, 10 May 2017 19:06:03 +0200 Fix Start page password focus.
11708c8 csoler Tue, 9 May 2017 22:44:00 +0200 Merge pull request #814 from csoler/v0.6-ImprovedGUI
bd9a8ae csoler Tue, 9 May 2017 22:39:15 +0200 prevent to remove old forum messages that have follow-ups.
5d7d8c0 csoler Tue, 9 May 2017 21:56:22 +0200 Merge pull request #813 from csoler/v0.6-ImprovedGUI
52a0aea csoler Tue, 9 May 2017 21:33:02 +0200 fixed bug causing edited posts to turn into missing messages when they have submessages
0edbc26 csoler Tue, 9 May 2017 19:34:48 +0200 Merge pull request #812 from PhenomRetroShare/Fix_TextColorGrayForumThread
a5386eb Phenom Tue, 9 May 2017 19:19:13 +0200 Fix text's color gray in Forum thread when selected.
0af05d2 csoler Tue, 9 May 2017 19:06:31 +0200 patch to avoid re-asking for rejected plugins when the executable is upgraded.
88525e4 csoler Tue, 9 May 2017 18:55:28 +0200 Merge pull request #811 from PhenomRetroShare/Add_OpenCertFileInHomeAddFriend
237db96 Phenom Mon, 8 May 2017 17:26:12 +0200 Add Open Cert File in Home Add Friend wizard.
34dd68d csoler Mon, 8 May 2017 23:05:16 +0200 Merge pull request #809 from csoler/v0.6-FT
e0cb0f4 csoler Mon, 8 May 2017 23:04:04 +0200 fixed previous commit
9a0df3f csoler Mon, 8 May 2017 22:21:28 +0200 Merge pull request #804 from PhenomRetroShare/Fix_Warnings
9a7f78f csoler Mon, 8 May 2017 22:18:51 +0200 Merge pull request #805 from PhenomRetroShare/Fix_Commit_#77adc82
caa36b4 csoler Mon, 8 May 2017 22:17:09 +0200 Merge pull request #807 from PhenomRetroShare/Fix_ToasterPositionSetting
d74bb2a csoler Mon, 8 May 2017 22:16:39 +0200 Merge pull request #806 from PhenomRetroShare/Fix_LobbySoundNotification
4a2f5f0 csoler Mon, 8 May 2017 22:02:38 +0200 Merge pull request #808 from csoler/v0.6-FT
8a86b9e csoler Mon, 8 May 2017 22:00:51 +0200 added a per-friend upload slots limit in FT. Default is 0=unlimited
39646f3 Gioacc Mon, 8 May 2017 20:44:15 +0200 qml app removed unused icon
d0b881f Gioacc Mon, 8 May 2017 20:35:15 +0200 Added view to show/edit contact details
52a04e1 csoler Mon, 8 May 2017 18:24:32 +0200 updated ubuntu changelog
f67617a Gioacc Mon, 8 May 2017 16:57:37 +0200 Add override and final placeolders for old GCC compatibility
d02cba5 Phenom Sun, 16 Apr 2017 17:53:37 +0200 Fix Lobby Topic not send on invite.
594ab53 Phenom Mon, 8 May 2017 15:37:18 +0200 Fix Toaster Position Setting.
a869a37 Phenom Mon, 8 May 2017 15:29:11 +0200 Fix Lobby's sound notification.
79bbe0e Phenom Mon, 8 May 2017 14:53:53 +0200 Fix Commit #77adc82
ccaf488 Gioacc Mon, 8 May 2017 13:38:29 +0200 Merge branch 'master' into qmlapp_pex_alpha
4a2f688 Phenom Mon, 8 May 2017 13:01:34 +0200 Fix Windows Compilation:
8f30634 Gioacc Mon, 8 May 2017 12:33:40 +0200 Merge branch 'gxs_mail_experiments' into qmlapp_pex_alpha
5022ef0 Phenom Mon, 8 May 2017 12:26:37 +0200 Fix Warnings: this if clause does not guard...
f352939 Phenom Mon, 8 May 2017 12:25:29 +0200 Fix Warnings:
bf47edf Phenom Mon, 8 May 2017 12:22:46 +0200 Fix Warnings:
523730f Phenom Mon, 8 May 2017 12:21:08 +0200 Fix Warnings: unused parameter resp, 'req' & 'resp'
a6acc72 Phenom Mon, 8 May 2017 12:18:51 +0200 Fix Warnings: this if clause does not guard...
58c812a Phenom Mon, 8 May 2017 12:17:01 +0200 Fix Warnings: unused parameter s
ee7e92d Phenom Mon, 8 May 2017 12:15:45 +0200 Fix Warnings: this if clause does not guard...
9b1209d Phenom Mon, 8 May 2017 12:14:04 +0200 Fix Warnings: unused parameter s & 'n'
91e3cc3 Phenom Mon, 8 May 2017 12:08:29 +0200 Fix Warnings: variable p set but not used
ca291b7 Phenom Mon, 8 May 2017 12:05:58 +0200 Fix Warnings: warning: unused variable i2d
9021609 Phenom Mon, 8 May 2017 11:55:23 +0200 Fix Warnings: unused variable p
7892004 Phenom Mon, 8 May 2017 11:53:16 +0200 Fix Warnings: unused parameter member_name
381aca4 Phenom Mon, 8 May 2017 11:49:39 +0200 Fix Warnings: unused parameter j, 'ctx' & 'name'
dd089a9 Phenom Mon, 8 May 2017 11:46:54 +0200 Fix Warnings: this if clause does not guard
5050d4f Phenom Mon, 8 May 2017 11:42:49 +0200 Fix Warnings: unused parameter indent warning: unused parameter indent [-Wunused-parameter] virtual std::ostream& print(std::ostream &out, uint16_t indent = 0) { return out; } // derived from RsItem, but should be removed
8e9b3c9 Gioacc Mon, 8 May 2017 12:03:42 +0200 Fix missing include
add529f csoler Mon, 8 May 2017 11:41:34 +0200 Merge pull request #803 from PhenomRetroShare/Fix_UnitTest
4e2db2f Phenom Mon, 8 May 2017 11:30:54 +0200 Fix UnitTest
-- Retroshare Dev Team <contact@retroshare.net> Mon, 20 Jun 2017 22:00:00 +0100
retroshare06 (0.6.2-1.20170508.52a04e1f~precise) precise; urgency=low
9714409 csoler Mon, 8 May 2017 10:57:00 +0200 Merge pull request #802 from csoler/v0.6-ImprovedGUI
de0f8b9 csoler Mon, 8 May 2017 10:51:15 +0200 moved passphrase box into start dialog, and removed blank logo, replaced it by RS splash logo

View File

@ -1,11 +1,11 @@
#!/bin/sh
rm -f ./libssh-0.5.4.tar.gz.*
rm -f ./retroshare06_0.6.2-1.*_source.build
rm -f ./retroshare06_0.6.2-1.*_source.changes
rm -f ./retroshare06_0.6.2-1.*.tar.gz
rm -f ./retroshare06_0.6.2-1.*.diff.gz
rm -f ./retroshare06_0.6.2-1.*.dsc
rm -f ./retroshare_0.6.3-1.*_source.build
rm -f ./retroshare_0.6.3-1.*_source.changes
rm -f ./retroshare_0.6.3-1.*.tar.gz
rm -f ./retroshare_0.6.3-1.*.diff.gz
rm -f ./retroshare_0.6.3-1.*.dsc
rm -f *.upload
rm -f *~

View File

@ -1,4 +1,4 @@
Source: retroshare06
Source: retroshare
Section: devel
Priority: standard
Maintainer: Cyril Soler <csoler@users.sourceforge.net>
@ -6,34 +6,36 @@ Build-Depends: debhelper (>= 7), libglib2.0-dev, libupnp-dev, libssl-dev, libxs
Standards-Version: 3.9.6
Homepage: http://retroshare.sourceforge.net
Package: retroshare06-voip-plugin
Package: retroshare-voip-plugin
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, retroshare06, libspeex1, libspeexdsp1, libqt5multimedia5
Conflicts: retroshare06-voip-plugin
Depends: ${shlibs:Depends}, ${misc:Depends}, retroshare, libspeex1, libspeexdsp1, libqt5multimedia5
Description: RetroShare VOIP plugin
This package provides a plugin for RetroShare, a secured Friend-to-Friend communication
plateform. The plugin adds voice-over-IP functionality to the private chat window. Both
friends chatting together need the plugin installed to be able to talk together.
Package: retroshare06-feedreader-plugin
Package: retroshare-feedreader-plugin
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, retroshare06
Conflicts: retroshare06-feedreader-plugin
Depends: ${shlibs:Depends}, ${misc:Depends}, retroshare
Description: RetroShare FeedReader plugin
This package provides a plugin for RetroShare, a secured Friend-to-Friend communication
plateform. The plugin adds a RSS feed reader tab to retroshare.
Package: retroshare06-nogui
Package: retroshare-nogui
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, gnome-keyring
Conflicts: retroshare06
Conflicts: retroshare,retroshare06-nogui
Description: Secure communication with friends
This is the command-line client for RetroShare network. This client
can be contacted and talked-to using SSL. Clients exist for portable
devices running e.g. Android.
Package: retroshare06
Package: retroshare
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, gnome-keyring
Conflicts: retroshare06-nogui
Conflicts: retroshare-nogui, retroshare06
Description: Secure communication with friends
RetroShare is a Open Source cross-platform, private and secure decentralised
commmunication platform. It lets you to securely chat and share files with your

View File

@ -1,4 +1,4 @@
Source: retroshare06
Source: retroshare
Section: devel
Priority: standard
Maintainer: Cyril Soler <csoler@users.sourceforge.net>
@ -6,34 +6,36 @@ Build-Depends: debhelper (>= 7), libglib2.0-dev, libupnp-dev, qt4-dev-tools, li
Standards-Version: 3.9.3
Homepage: http://retroshare.sourceforge.net
Package: retroshare06-voip-plugin
Package: retroshare-voip-plugin
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, retroshare06, libspeex1, libspeexdsp1, libqtmultimediakit1
Conflicts: retroshare06-voip-plugin
Depends: ${shlibs:Depends}, ${misc:Depends}, retroshare, libspeex1, libspeexdsp1, libqtmultimediakit1
Description: RetroShare VOIP plugin
This package provides a plugin for RetroShare, a secured Friend-to-Friend communication
plateform. The plugin adds voice-over-IP functionality to the private chat window. Both
friends chatting together need the plugin installed to be able to talk together.
Package: retroshare06-feedreader-plugin
Package: retroshare-feedreader-plugin
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, retroshare06
Conflicts: retroshare06-feedreader-plugin
Depends: ${shlibs:Depends}, ${misc:Depends}, retroshare
Description: RetroShare FeedReader plugin
This package provides a plugin for RetroShare, a secured Friend-to-Friend communication
plateform. The plugin adds a RSS feed reader tab to retroshare.
Package: retroshare06-nogui
Package: retroshare-nogui
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, gnome-keyring
Conflicts: retroshare06
Conflicts: retroshare,retroshare06-nogui
Description: Secure communication with friends
This is the command-line client for RetroShare network. This client
can be contacted and talked-to using SSL. Clients exist for portable
devices running e.g. Android.
Package: retroshare06
Package: retroshare
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, gnome-keyring
Conflicts: retroshare06-nogui
Conflicts: retroshare-nogui,retroshare06
Description: Secure communication with friends
RetroShare is a Open Source cross-platform, private and secure decentralised
commmunication platform. It lets you to securely chat and share files with your

View File

@ -1,4 +1,4 @@
Source: retroshare06
Source: retroshare
Section: devel
Priority: standard
Maintainer: Cyril Soler <csoler@users.sourceforge.net>
@ -6,34 +6,36 @@ Build-Depends: debhelper (>= 7), libglib2.0-dev, libupnp-dev, qt4-dev-tools, li
Standards-Version: 3.9.3
Homepage: http://retroshare.sourceforge.net
Package: retroshare06-voip-plugin
Package: retroshare-voip-plugin
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, retroshare06, libspeex1, libspeexdsp1, libqtmultimediakit1
Conflicts: retroshare06-voip-plugin
Depends: ${shlibs:Depends}, ${misc:Depends}, retroshare, libspeex1, libspeexdsp1, libqtmultimediakit1
Description: RetroShare VOIP plugin
This package provides a plugin for RetroShare, a secured Friend-to-Friend communication
plateform. The plugin adds voice-over-IP functionality to the private chat window. Both
friends chatting together need the plugin installed to be able to talk together.
Package: retroshare06-feedreader-plugin
Package: retroshare-feedreader-plugin
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, retroshare06
Conflicts: retroshare06-feedreader-plugin
Depends: ${shlibs:Depends}, ${misc:Depends}, retroshare
Description: RetroShare FeedReader plugin
This package provides a plugin for RetroShare, a secured Friend-to-Friend communication
plateform. The plugin adds a RSS feed reader tab to retroshare.
Package: retroshare06-nogui
Package: retroshare-nogui
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, gnome-keyring
Conflicts: retroshare06
Conflicts: retroshare,retroshare06-nogui
Description: Secure communication with friends
This is the command-line client for RetroShare network. This client
can be contacted and talked-to using SSL. Clients exist for portable
devices running e.g. Android.
Package: retroshare06
Package: retroshare
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, gnome-keyring
Conflicts: retroshare06-nogui
Conflicts: retroshare-nogui,retroshare06
Description: Secure communication with friends
RetroShare is a Open Source cross-platform, private and secure decentralised
commmunication platform. It lets you to securely chat and share files with your

View File

@ -1,4 +1,4 @@
Source: retroshare06
Source: retroshare
Section: devel
Priority: standard
Maintainer: Cyril Soler <csoler@users.sourceforge.net>
@ -6,34 +6,36 @@ Build-Depends: debhelper (>= 7), libglib2.0-dev, libupnp-dev, libssl-dev, libxs
Standards-Version: 3.9.6
Homepage: http://retroshare.sourceforge.net
Package: retroshare06-voip-plugin
Package: retroshare-voip-plugin
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, retroshare06, libspeex1, libspeexdsp1, libqt5multimedia5
Conflicts: retroshare06-voip-plugin
Depends: ${shlibs:Depends}, ${misc:Depends}, retroshare, libspeex1, libspeexdsp1, libqt5multimedia5
Description: RetroShare VOIP plugin
This package provides a plugin for RetroShare, a secured Friend-to-Friend communication
plateform. The plugin adds voice-over-IP functionality to the private chat window. Both
friends chatting together need the plugin installed to be able to talk together.
Package: retroshare06-feedreader-plugin
Package: retroshare-feedreader-plugin
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, retroshare06
Conflicts: retroshare06-feedreader-plugin
Depends: ${shlibs:Depends}, ${misc:Depends}, retroshare
Description: RetroShare FeedReader plugin
This package provides a plugin for RetroShare, a secured Friend-to-Friend communication
plateform. The plugin adds a RSS feed reader tab to retroshare.
Package: retroshare06-nogui
Package: retroshare-nogui
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, gnome-keyring
Conflicts: retroshare06
Conflicts: retroshare,retroshare06-nogui
Description: Secure communication with friends
This is the command-line client for RetroShare network. This client
can be contacted and talked-to using SSL. Clients exist for portable
devices running e.g. Android.
Package: retroshare06
Package: retroshare
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, gnome-keyring
Conflicts: retroshare06-nogui
Conflicts: retroshare-nogui,retroshare06
Description: Secure communication with friends
RetroShare is a Open Source cross-platform, private and secure decentralised
commmunication platform. It lets you to securely chat and share files with your

View File

@ -8,6 +8,7 @@ Homepage: http://retroshare.sourceforge.net
Package: retroshare-voip-plugin
Architecture: any
Conflicts: retroshare06-voip-plugin
Depends: ${shlibs:Depends}, ${misc:Depends}, retroshare, libspeex1, libspeexdsp1, libqtmultimediakit1
Description: RetroShare VOIP plugin
This package provides a plugin for RetroShare, a secured Friend-to-Friend communication
@ -16,6 +17,7 @@ Description: RetroShare VOIP plugin
Package: retroshare-linkscloud-plugin
Architecture: any
Conflicts: retroshare06-feedreader-plugin
Depends: ${shlibs:Depends}, ${misc:Depends}, retroshare
Description: RetroShare LinksCloud plugin
This package provides a plugin for RetroShare, a secured Friend-to-Friend communication
@ -32,7 +34,7 @@ Description: RetroShare LinksCloud plugin
Package: retroshare-nogui
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, gnome-keyring
Conflicts: retroshare
Conflicts: retroshare,retroshare06-nogui
Description: Secure communication with friends
This is the command-line client for RetroShare network. This client
can be contacted and talked-to using SSL. Clients exist for portable
@ -41,7 +43,7 @@ Description: Secure communication with friends
Package: retroshare
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, gnome-keyring
Conflicts: retroshare-nogui
Conflicts: retroshare-nogui,retroshare06
Description: Secure communication with friends
RetroShare is a Open Source cross-platform, private and secure decentralised
commmunication platform. It lets you to securely chat and share files with your

View File

@ -1,4 +1,4 @@
Source: retroshare06
Source: retroshare
Section: devel
Priority: standard
Maintainer: Cyril Soler <csoler@users.sourceforge.net>
@ -6,34 +6,36 @@ Build-Depends: debhelper (>= 7), libglib2.0-dev, libupnp-dev, libssl-dev, libxs
Standards-Version: 3.9.6
Homepage: http://retroshare.sourceforge.net
Package: retroshare06-voip-plugin
Package: retroshare-voip-plugin
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, retroshare06, libspeex1, libspeexdsp1, libqt5multimedia5
Conflicts: retroshare06-voip-plugin
Depends: ${shlibs:Depends}, ${misc:Depends}, retroshare, libspeex1, libspeexdsp1, libqt5multimedia5
Description: RetroShare VOIP plugin
This package provides a plugin for RetroShare, a secured Friend-to-Friend communication
plateform. The plugin adds voice-over-IP functionality to the private chat window. Both
friends chatting together need the plugin installed to be able to talk together.
Package: retroshare06-feedreader-plugin
Package: retroshare-feedreader-plugin
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, retroshare06
Conflicts: retroshare06-feedreader-plugin
Depends: ${shlibs:Depends}, ${misc:Depends}, retroshare
Description: RetroShare FeedReader plugin
This package provides a plugin for RetroShare, a secured Friend-to-Friend communication
plateform. The plugin adds a RSS feed reader tab to retroshare.
Package: retroshare06-nogui
Package: retroshare-nogui
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, gnome-keyring
Conflicts: retroshare06
Conflicts: retroshare,retroshare06-nogui
Description: Secure communication with friends
This is the command-line client for RetroShare network. This client
can be contacted and talked-to using SSL. Clients exist for portable
devices running e.g. Android.
Package: retroshare06
Package: retroshare
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, gnome-keyring
Conflicts: retroshare06-nogui
Conflicts: retroshare-nogui,retroshare06
Description: Secure communication with friends
RetroShare is a Open Source cross-platform, private and secure decentralised
commmunication platform. It lets you to securely chat and share files with your

View File

@ -1,4 +1,4 @@
Source: retroshare06
Source: retroshare
Section: devel
Priority: standard
Maintainer: Cyril Soler <csoler@users.sourceforge.net>
@ -6,34 +6,36 @@ Build-Depends: debhelper (>= 7), libglib2.0-dev, libupnp-dev, libssl-dev, libxs
Standards-Version: 3.9.6
Homepage: http://retroshare.sourceforge.net
Package: retroshare06-voip-plugin
Package: retroshare-voip-plugin
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, retroshare06, libspeex1, libspeexdsp1, libqt5multimedia5
Conflicts: retroshare06-voip-plugin
Depends: ${shlibs:Depends}, ${misc:Depends}, retroshare, libspeex1, libspeexdsp1, libqt5multimedia5
Description: RetroShare VOIP plugin
This package provides a plugin for RetroShare, a secured Friend-to-Friend communication
plateform. The plugin adds voice-over-IP functionality to the private chat window. Both
friends chatting together need the plugin installed to be able to talk together.
Package: retroshare06-feedreader-plugin
Package: retroshare-feedreader-plugin
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, retroshare06
Conflicts: retroshare06-feedreader-plugin
Depends: ${shlibs:Depends}, ${misc:Depends}, retroshare
Description: RetroShare FeedReader plugin
This package provides a plugin for RetroShare, a secured Friend-to-Friend communication
plateform. The plugin adds a RSS feed reader tab to retroshare.
Package: retroshare06-nogui
Package: retroshare-nogui
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, gnome-keyring
Conflicts: retroshare06
Conflicts: retroshare,retroshare06-nogui
Description: Secure communication with friends
This is the command-line client for RetroShare network. This client
can be contacted and talked-to using SSL. Clients exist for portable
devices running e.g. Android.
Package: retroshare06
Package: retroshare
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, gnome-keyring
Conflicts: retroshare06-nogui
Conflicts: retroshare-nogui,retroshare06
Description: Secure communication with friends
RetroShare is a Open Source cross-platform, private and secure decentralised
commmunication platform. It lets you to securely chat and share files with your

View File

@ -1,4 +1,4 @@
Source: retroshare06
Source: retroshare
Section: devel
Priority: standard
Maintainer: Cyril Soler <csoler@users.sourceforge.net>
@ -6,34 +6,36 @@ Build-Depends: debhelper (>= 7), libglib2.0-dev, libupnp-dev, libssl-dev, libxs
Standards-Version: 3.9.6
Homepage: http://retroshare.sourceforge.net
Package: retroshare06-voip-plugin
Package: retroshare-voip-plugin
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, retroshare06, libspeex1, libspeexdsp1, libqt5multimedia5
Conflicts: retroshare06-voip-plugin
Depends: ${shlibs:Depends}, ${misc:Depends}, retroshare, libspeex1, libspeexdsp1, libqt5multimedia5
Description: RetroShare VOIP plugin
This package provides a plugin for RetroShare, a secured Friend-to-Friend communication
plateform. The plugin adds voice-over-IP functionality to the private chat window. Both
friends chatting together need the plugin installed to be able to talk together.
Package: retroshare06-feedreader-plugin
Package: retroshare-feedreader-plugin
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, retroshare06
Conflicts: retroshare06-feedreader-plugin
Depends: ${shlibs:Depends}, ${misc:Depends}, retroshare
Description: RetroShare FeedReader plugin
This package provides a plugin for RetroShare, a secured Friend-to-Friend communication
plateform. The plugin adds a RSS feed reader tab to retroshare.
Package: retroshare06-nogui
Package: retroshare-nogui
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, gnome-keyring
Conflicts: retroshare06
Conflicts: retroshare,retroshare06-nogui
Description: Secure communication with friends
This is the command-line client for RetroShare network. This client
can be contacted and talked-to using SSL. Clients exist for portable
devices running e.g. Android.
Package: retroshare06
Package: retroshare
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, gnome-keyring
Conflicts: retroshare06-nogui
Conflicts: retroshare-nogui,retroshare06
Description: Secure communication with friends
RetroShare is a Open Source cross-platform, private and secure decentralised
commmunication platform. It lets you to securely chat and share files with your

View File

@ -1,4 +1,4 @@
Source: retroshare06
Source: retroshare
Section: devel
Priority: standard
Maintainer: Cyril Soler <csoler@users.sourceforge.net>
@ -6,34 +6,36 @@ Build-Depends: debhelper (>= 7), libglib2.0-dev, libupnp-dev, qt4-dev-tools, li
Standards-Version: 3.9.3
Homepage: http://retroshare.sourceforge.net
Package: retroshare06-voip-plugin
Package: retroshare-voip-plugin
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, retroshare06, libspeex1, libspeexdsp1, libqtmultimediakit1
Conflicts: retroshare06-voip-plugin
Depends: ${shlibs:Depends}, ${misc:Depends}, retroshare, libspeex1, libspeexdsp1, libqtmultimediakit1
Description: RetroShare VOIP plugin
This package provides a plugin for RetroShare, a secured Friend-to-Friend communication
plateform. The plugin adds voice-over-IP functionality to the private chat window. Both
friends chatting together need the plugin installed to be able to talk together.
Package: retroshare06-feedreader-plugin
Package: retroshare-feedreader-plugin
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, retroshare06
Conflicts: retroshare06-feedreader-plugin
Depends: ${shlibs:Depends}, ${misc:Depends}, retroshare
Description: RetroShare FeedReader plugin
This package provides a plugin for RetroShare, a secured Friend-to-Friend communication
plateform. The plugin adds a RSS feed reader tab to retroshare.
Package: retroshare06-nogui
Package: retroshare-nogui
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, gnome-keyring
Conflicts: retroshare06
Conflicts: retroshare,retroshare06-nogui
Description: Secure communication with friends
This is the command-line client for RetroShare network. This client
can be contacted and talked-to using SSL. Clients exist for portable
devices running e.g. Android.
Package: retroshare06
Package: retroshare
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, gnome-keyring
Conflicts: retroshare06-nogui
Conflicts: retroshare-nogui,retroshare06
Description: Secure communication with friends
RetroShare is a Open Source cross-platform, private and secure decentralised
commmunication platform. It lets you to securely chat and share files with your

View File

@ -0,0 +1,3 @@
debian/tmp/usr/bin/retroshare-nogui
debian/tmp/usr/share/retroshare/bdboot.txt
debian/tmp/usr/share/retroshare/webui/*

View File

@ -0,0 +1,6 @@
debian/tmp/usr/bin/retroshare
debian/tmp/usr/bin/retroshare-nogui
debian/tmp/usr/share/applications/retroshare.desktop
debian/tmp/usr/share/icons/hicolor/*
debian/tmp/usr/share/pixmaps/retroshare.xpm
debian/tmp/usr/share/retroshare/*

View File

@ -1,3 +0,0 @@
debian/tmp/usr/bin/RetroShare06-nogui
debian/tmp/usr/share/RetroShare06/bdboot.txt
debian/tmp/usr/share/RetroShare06/webui/*

View File

@ -1,6 +0,0 @@
debian/tmp/usr/bin/RetroShare06
debian/tmp/usr/bin/RetroShare06-nogui
debian/tmp/usr/share/applications/retroshare06.desktop
debian/tmp/usr/share/icons/hicolor/*
debian/tmp/usr/share/pixmaps/retroshare06.xpm
debian/tmp/usr/share/RetroShare06/*

View File

@ -10,12 +10,12 @@ archis="armhf amd64 i386"
########################################################
./clean.sh
rm -rf retroshare06-0.6.2
rm -rf retroshare-0.6.2
./makeSourcePackage.sh -distribution "$distribs"
for dist in $distribs; do
for arch in $archis; do
pbuilder-dist $dist $arch build retroshare06_0.6.2-1.???????.????????~"$dist".dsc
pbuilder-dist $dist $arch build retroshare.6.2-1.???????.????????~"$dist".dsc
done
done

View File

@ -1,10 +1,10 @@
#!/bin/sh
###################### PARAMETERS ####################
version="0.6.2"
version="0.6.3"
gitpath="https://github.com/RetroShare/RetroShare.git"
workdir=retroshare06-${version}
branch="v0.6.2-official_release"
workdir=retroshare-${version}
branch="master"
#bubba3="Y" # comment out to compile for bubba3
######################################################

View File

@ -1,4 +1,4 @@
#!/bin/sh
for i in `ls retroshare06_0.6.2-1.*.changes` ; do
for i in `ls retroshare_0.6.3-1.*.changes` ; do
dput ppa:retroshare/unstable $i
done

View File

@ -1,9 +1,9 @@
[Desktop Entry]
Version=1.0
Name=RetroShare06
Name=RetroShare
Comment=Securely share files with your friends
Exec=/usr/bin/RetroShare06 %U
Icon=/usr/share/pixmaps/retroshare06.xpm
Exec=/usr/bin/retroshare %U
Icon=/usr/share/pixmaps/retroshare.xpm
Terminal=false
Type=Application
Categories=Network;P2P;

View File

@ -34,7 +34,7 @@ echo "Using revision: ${REV}"
echo "Hit ENTER if this is correct. Otherwise hit Ctrl+C"
read tmp
WORKDIR="retroshare06-${FULL_VERSION}"
WORKDIR="retroshare-${FULL_VERSION}"
if [[ -d ${WORKDIR} ]]
then
@ -80,6 +80,6 @@ do
done
popd >/dev/null
tar -zcf rpm-build/rpm/SOURCES/${WORKDIR}.tar.gz ${WORKDIR}
rpmbuild --define="%rev ${REV}" --define="%_usrsrc $PWD/rpm-build" --define="%_topdir %{_usrsrc}/rpm" -ba retroshare06.spec
rpmbuild --define="%rev ${REV}" --define="%_usrsrc $PWD/rpm-build" --define="%_topdir %{_usrsrc}/rpm" -ba retroshare.spec
rm -rf ${WORKDIR}
exit 0

View File

@ -1,5 +1,5 @@
Summary: Secure communication with friends
Name: retroshare06
Name: retroshare
Version: 0.6.0.%{rev}
Release: 1%{?dist}
License: GPLv3
@ -65,25 +65,25 @@ rm -rf $RPM_BUILD_ROOT
cd src
make INSTALL_ROOT=$RPM_BUILD_ROOT install
#menu
desktop-file-validate $RPM_BUILD_ROOT%{_datadir}/applications/retroshare06.desktop
desktop-file-validate $RPM_BUILD_ROOT%{_datadir}/applications/retroshare.desktop
%clean
rm -rf $RPM_BUILD_ROOT
%files
%defattr(-,root,root,-)
%{_bindir}/RetroShare06
%{_bindir}/retroshare
%defattr(644, root, root)
%{_datadir}/pixmaps/%{name}.xpm
%{_datadir}/icons/hicolor
%{_datadir}/applications/%{name}.desktop
%{_datadir}/RetroShare06
%{_datadir}/retroshare
%files nogui
%defattr(-, root, root)
%{_bindir}/RetroShare06-nogui
%{_bindir}/retroshare-nogui
%defattr(644, root, root)
%{_datadir}/RetroShare06
%{_datadir}/retroshare
%files voip-plugin
%defattr(-, root, root)

View File

@ -116,7 +116,7 @@ echo copy external binaries
copy "%RootPath%\libs\bin\*.dll" "%RsDeployPath%" %Quite%
echo copy dependencies
call :copy_dependencies "%RsDeployPath%\RetroShare06.exe" "%RsDeployPath%"
call :copy_dependencies "%RsDeployPath%\retroshare.exe" "%RsDeployPath%"
echo copy Qt DLL's
copy "%QtPath%\Qt%QtMainVersion1%Svg%QtMainVersion2%.dll" "%RsDeployPath%" %Quite%

View File

@ -41,7 +41,7 @@
!define SOURCEDIR "..\..\.."
# Get version from executable
!GetDllVersion "${RELEASEDIR}\retroshare-gui\src\release\RetroShare06.exe" VERSION_
!GetDllVersion "${RELEASEDIR}\retroshare-gui\src\release\retroshare.exe" VERSION_
!define VERSION ${VERSION_1}.${VERSION_2}.${VERSION_3}${BUILDADD}
;!define REVISION ${VERSION_4}
@ -107,7 +107,7 @@ Var StyleSheetDir
!define MUI_COMPONENTSPAGE_SMALLDESC
!define MUI_FINISHPAGE_LINK "Visit the RetroShare forum for the latest news and support"
!define MUI_FINISHPAGE_LINK_LOCATION "http://retroshare.sourceforge.net/forum/"
!define MUI_FINISHPAGE_RUN "$INSTDIR\RetroShare06.exe"
!define MUI_FINISHPAGE_RUN "$INSTDIR\retroshare.exe"
!define MUI_FINISHPAGE_SHOWREADME $INSTDIR\changelog.txt
!define MUI_FINISHPAGE_SHOWREADME_TEXT changelog.txt
!define MUI_FINISHPAGE_SHOWREADME_NOTCHECKED
@ -180,8 +180,8 @@ Section $(Section_Main) Section_Main
; Main binaries
SetOutPath "$INSTDIR"
File /oname=RetroShare06.exe "${RELEASEDIR}\retroshare-gui\src\release\RetroShare06.exe"
File /oname=retroshare06-nogui.exe "${RELEASEDIR}\retroshare-nogui\src\release\RetroShare06-nogui.exe"
File /oname=retroshare.exe "${RELEASEDIR}\retroshare-gui\src\release\retroshare.exe"
File /oname=retroshare-nogui.exe "${RELEASEDIR}\retroshare-nogui\src\release\retroshare-nogui.exe"
; Qt binaries
File "${QTDIR}\bin\QtCore4.dll"
@ -270,7 +270,7 @@ SectionEnd
; WriteRegStr HKCR retroshare "" "PQI File"
; WriteRegBin HKCR retroshare EditFlags 00000100
; WriteRegStr HKCR "retroshare\shell" "" open
; WriteRegStr HKCR "retroshare\shell\open\command" "" `"$INSTDIR\RetroShare06.exe" "%1"`
; WriteRegStr HKCR "retroshare\shell\open\command" "" `"$INSTDIR\retroshare.exe" "%1"`
;SectionEnd
# Shortcuts
@ -279,15 +279,15 @@ Section $(Section_StartMenu) Section_StartMenu
SetOutPath "$INSTDIR"
CreateDirectory "$SMPROGRAMS\${APPNAME}"
CreateShortCut "$SMPROGRAMS\${APPNAME}\$(Link_Uninstall).lnk" "$INSTDIR\uninstall.exe" "" "$INSTDIR\uninstall.exe" 0
CreateShortCut "$SMPROGRAMS\${APPNAME}\${APPNAME}.lnk" "$INSTDIR\RetroShare06.exe" "" "$INSTDIR\RetroShare06.exe" 0
CreateShortCut "$SMPROGRAMS\${APPNAME}\${APPNAME}.lnk" "$INSTDIR\retroshare.exe" "" "$INSTDIR\retroshare.exe" 0
SectionEnd
Section $(Section_Desktop) Section_Desktop
CreateShortCut "$DESKTOP\${APPNAME}.lnk" "$INSTDIR\RetroShare06.exe" "" "$INSTDIR\RetroShare06.exe" 0
CreateShortCut "$DESKTOP\${APPNAME}.lnk" "$INSTDIR\retroshare.exe" "" "$INSTDIR\retroshare.exe" 0
SectionEnd
Section $(Section_QuickLaunch) Section_QuickLaunch
CreateShortCut "$QUICKLAUNCH\${APPNAME}.lnk" "$INSTDIR\RetroShare06.exe" "" "$INSTDIR\RetroShare06.exe" 0
CreateShortCut "$QUICKLAUNCH\${APPNAME}.lnk" "$INSTDIR\retroshare.exe" "" "$INSTDIR\retroshare.exe" 0
SectionEnd
SectionGroupEnd
@ -296,7 +296,7 @@ Section $(Section_AutoStart) Section_AutoStart
SectionEnd
;Section $(Section_AutoStart) Section_AutoStart
; CreateShortCut "$SMSTARTUP\${APPNAME}.lnk" "$INSTDIR\RetroShare06.exe" "" "$INSTDIR\RetroShare06.exe -m" 0
; CreateShortCut "$SMSTARTUP\${APPNAME}.lnk" "$INSTDIR\retroshare.exe" "" "$INSTDIR\retroshare.exe -m" 0
;SectionEnd
Section -FinishSection
@ -305,7 +305,7 @@ Section -FinishSection
WriteRegStr HKLM "Software\${APPNAME}" "Version" "${VERSION}"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "DisplayName" "${APPNAME}"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "DisplayVersion" "${VERSION}"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "DisplayIcon" "$INSTDIR\RetroShare06.exe"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "DisplayIcon" "$INSTDIR\retroshare.exe"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "Publisher" "${PUBLISHER}"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "NoModify" "1"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "NoRepair" "1"

View File

@ -41,7 +41,7 @@
!define SOURCEDIR "..\..\.."
# Get version from executable
!GetDllVersion "${RELEASEDIR}\retroshare-gui\src\release\RetroShare06.exe" VERSION_
!GetDllVersion "${RELEASEDIR}\retroshare-gui\src\release\retroshare.exe" VERSION_
!define VERSION ${VERSION_1}.${VERSION_2}.${VERSION_3}${BUILDADD}
;!define REVISION ${VERSION_4}
@ -107,7 +107,7 @@ Var StyleSheetDir
!define MUI_COMPONENTSPAGE_SMALLDESC
!define MUI_FINISHPAGE_LINK "Visit the RetroShare forum for the latest news and support"
!define MUI_FINISHPAGE_LINK_LOCATION "http://retroshare.sourceforge.net/forum/"
!define MUI_FINISHPAGE_RUN "$INSTDIR\RetroShare06.exe"
!define MUI_FINISHPAGE_RUN "$INSTDIR\retroshare.exe"
!define MUI_FINISHPAGE_SHOWREADME $INSTDIR\changelog.txt
!define MUI_FINISHPAGE_SHOWREADME_TEXT changelog.txt
!define MUI_FINISHPAGE_SHOWREADME_NOTCHECKED
@ -180,8 +180,8 @@ Section $(Section_Main) Section_Main
; Main binaries
SetOutPath "$INSTDIR"
File /oname=RetroShare06.exe "${RELEASEDIR}\retroshare-gui\src\release\RetroShare06.exe"
File /oname=retroshare06-nogui.exe "${RELEASEDIR}\retroshare-nogui\src\release\RetroShare06-nogui.exe"
File /oname=retroshare.exe "${RELEASEDIR}\retroshare-gui\src\release\retroshare.exe"
File /oname=retroshare-nogui.exe "${RELEASEDIR}\retroshare-nogui\src\release\retroshare-nogui.exe"
; Qt binaries
File "${QTDIR}\bin\Qt5Core.dll"
@ -288,7 +288,7 @@ SectionEnd
; WriteRegStr HKCR retroshare "" "PQI File"
; WriteRegBin HKCR retroshare EditFlags 00000100
; WriteRegStr HKCR "retroshare\shell" "" open
; WriteRegStr HKCR "retroshare\shell\open\command" "" `"$INSTDIR\RetroShare06.exe" "%1"`
; WriteRegStr HKCR "retroshare\shell\open\command" "" `"$INSTDIR\retroshare.exe" "%1"`
;SectionEnd
# Shortcuts
@ -297,15 +297,15 @@ Section $(Section_StartMenu) Section_StartMenu
SetOutPath "$INSTDIR"
CreateDirectory "$SMPROGRAMS\${APPNAME}"
CreateShortCut "$SMPROGRAMS\${APPNAME}\$(Link_Uninstall).lnk" "$INSTDIR\uninstall.exe" "" "$INSTDIR\uninstall.exe" 0
CreateShortCut "$SMPROGRAMS\${APPNAME}\${APPNAME}.lnk" "$INSTDIR\RetroShare06.exe" "" "$INSTDIR\RetroShare06.exe" 0
CreateShortCut "$SMPROGRAMS\${APPNAME}\${APPNAME}.lnk" "$INSTDIR\retroshare.exe" "" "$INSTDIR\retroshare.exe" 0
SectionEnd
Section $(Section_Desktop) Section_Desktop
CreateShortCut "$DESKTOP\${APPNAME}.lnk" "$INSTDIR\RetroShare06.exe" "" "$INSTDIR\RetroShare06.exe" 0
CreateShortCut "$DESKTOP\${APPNAME}.lnk" "$INSTDIR\retroshare.exe" "" "$INSTDIR\retroshare.exe" 0
SectionEnd
Section $(Section_QuickLaunch) Section_QuickLaunch
CreateShortCut "$QUICKLAUNCH\${APPNAME}.lnk" "$INSTDIR\RetroShare06.exe" "" "$INSTDIR\RetroShare06.exe" 0
CreateShortCut "$QUICKLAUNCH\${APPNAME}.lnk" "$INSTDIR\retroshare.exe" "" "$INSTDIR\retroshare.exe" 0
SectionEnd
SectionGroupEnd
@ -314,7 +314,7 @@ Section $(Section_AutoStart) Section_AutoStart
SectionEnd
;Section $(Section_AutoStart) Section_AutoStart
; CreateShortCut "$SMSTARTUP\${APPNAME}.lnk" "$INSTDIR\RetroShare06.exe" "" "$INSTDIR\RetroShare06.exe -m" 0
; CreateShortCut "$SMSTARTUP\${APPNAME}.lnk" "$INSTDIR\retroshare.exe" "" "$INSTDIR\retroshare.exe -m" 0
;SectionEnd
Section -FinishSection
@ -323,7 +323,7 @@ Section -FinishSection
WriteRegStr HKLM "Software\${APPNAME}" "Version" "${VERSION}"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "DisplayName" "${APPNAME}"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "DisplayVersion" "${VERSION}"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "DisplayIcon" "$INSTDIR\RetroShare06.exe"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "DisplayIcon" "$INSTDIR\retroshare.exe"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "Publisher" "${PUBLISHER}"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "NoModify" "1"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "NoRepair" "1"

View File

Before

Width:  |  Height:  |  Size: 9.6 KiB

After

Width:  |  Height:  |  Size: 9.6 KiB

View File

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

View File

Before

Width:  |  Height:  |  Size: 4.3 KiB

After

Width:  |  Height:  |  Size: 4.3 KiB

View File

@ -1,10 +1,10 @@
[Desktop Entry]
Encoding=UTF-8
Version=1.0
Name=RetroShare06
Name=RetroShare
Comment=Securely share files with your friends
Exec=/usr/bin/RetroShare06 %U
Icon=/usr/share/pixmaps/retroshare06.xpm
Exec=/usr/bin/retroshare %U
Icon=/usr/share/pixmaps/retroshare.xpm
Terminal=false
Type=Application
Categories=Application;Network;

View File

@ -1305,6 +1305,7 @@ void bdConnectManager::callbackConnectRequest(bdId *srcId, bdId *proxyId, bdId *
}
}
break;
case BITDHT_CONNECT_ERROR_DUPLICATE: // similar attempt. delay/recycle (ANY/ANY)
{

View File

@ -10,5 +10,5 @@ Quickinfo for builders and packagers
* copy the files in ./webui to
* ./webui (Windows)
* /usr/share/RetroShare06/webui (Linux)
* /usr/share/retroshare/webui (Linux)
* other OS: see RsAccountsDetail::PathDataDirectory()

View File

@ -16,6 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <QStringList>
#include "ApiServerLocal.h"
#include "JsonStream.h"
@ -105,9 +106,17 @@ readPath:
resource_api::Request req(reqJson);
req.mMethod = reqMeth;
req.setPath(reqPath);
std::string resultString = mApiServer->handleRequest(req);
mLocalSocket->write(resultString.c_str(), resultString.length());
// Need this idiom because binary result may contains \0
std::string&& resultString = mApiServer->handleRequest(req);
QByteArray rB(resultString.data(), resultString.length());
// Dirty trick to support avatars answers
if(rB.contains("\n") || !rB.startsWith("{") || !rB.endsWith("}"))
mLocalSocket->write(rB.toBase64());
else mLocalSocket->write(rB);
mLocalSocket->write("\n\0");
mState = WAITING_PATH;
/* Because QLocalSocket is SOCK_STREAM some clients implementations

View File

@ -1,3 +1,22 @@
/*
* libresapi
* Copyright (C) 2015 electron128 <electron128@yahoo.com>
* Copyright (C) 2017 Gioacchino Mazzurco <gio@eigenlab.org>
*
* 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 "ChatHandler.h"
#include "Pagination.h"
#include "Operators.h"
@ -142,6 +161,7 @@ ChatHandler::ChatHandler(StateTokenServer *sts, RsNotify *notify, RsMsgs *msgs,
mMsgStateToken = mStateTokenServer->getNewToken();
mLobbiesStateToken = mStateTokenServer->getNewToken();
mUnreadMsgsStateToken = mStateTokenServer->getNewToken();
mInvitationsStateToken = mStateTokenServer->getNewToken();
addResourceHandler("*", this, &ChatHandler::handleWildcard);
addResourceHandler("lobbies", this, &ChatHandler::handleLobbies);
@ -150,6 +170,9 @@ ChatHandler::ChatHandler(StateTokenServer *sts, RsNotify *notify, RsMsgs *msgs,
addResourceHandler("unsubscribe_lobby", this, &ChatHandler::handleUnsubscribeLobby);
addResourceHandler("autosubscribe_lobby", this, &ChatHandler::handleAutoSubsribeLobby);
addResourceHandler("clear_lobby", this, &ChatHandler::handleClearLobby);
addResourceHandler("invite_to_lobby", this, &ChatHandler::handleInviteToLobby);
addResourceHandler("get_invitations_to_lobby", this, &ChatHandler::handleGetInvitationsToLobby);
addResourceHandler("answer_to_invitation", this, &ChatHandler::handleAnswerToInvitation);
addResourceHandler("lobby_participants", this, &ChatHandler::handleLobbyParticipants);
addResourceHandler("messages", this, &ChatHandler::handleMessages);
addResourceHandler("send_message", this, &ChatHandler::handleSendMessage);
@ -210,6 +233,15 @@ void ChatHandler::notifyChatLobbyEvent(uint64_t lobby_id, uint32_t event_type,
}
}
void ChatHandler::notifyListChange(int list, int /*type*/)
{
if(list == NOTIFY_LIST_CHAT_LOBBY_INVITATION)
{
RS_STACK_MUTEX(mMtx); /********** LOCKED **********/
mStateTokenServer->replaceToken(mInvitationsStateToken);
}
}
void ChatHandler::tick()
{
RS_STACK_MUTEX(mMtx); /********** LOCKED **********/
@ -247,7 +279,8 @@ void ChatHandler::tick()
else
{
LobbyParticipantsInfo& pi = mit->second;
if(!std::equal(pi.participants.begin(), pi.participants.end(), info.gxs_ids.begin()))
if(!std::equal(pi.participants.begin(), pi.participants.end(), info.gxs_ids.begin())
|| pi.participants.size() != info.gxs_ids.size())
{
pi.participants = info.gxs_ids;
mStateTokenServer->replaceToken(pi.state_token);
@ -395,16 +428,18 @@ void ChatHandler::tick()
}
}
else if(msg.chat_id.isDistantChatId())
{
RsIdentityDetails details;
DistantChatPeerInfo dcpinfo ;
if(!gxs_id_failed && rsMsgs->getDistantChatStatus(msg.chat_id.toDistantChatId(),dcpinfo)
&& mRsIdentity->getIdDetails(msg.incoming? dcpinfo.to_id: dcpinfo.own_id, details))
{
info.remote_author_id = details.mId.toStdString();
info.remote_author_name = details.mNickname;
}
{
RsIdentityDetails details;
DistantChatPeerInfo dcpinfo;
if( !gxs_id_failed &&
rsMsgs->getDistantChatStatus(
msg.chat_id.toDistantChatId(), dcpinfo ) &&
mRsIdentity->getIdDetails(dcpinfo.to_id, details) )
{
info.remote_author_id = details.mId.toStdString();
info.remote_author_name = details.mNickname;
}
else
{
gxs_id_failed = true;
@ -914,6 +949,70 @@ void ChatHandler::handleClearLobby(Request &req, Response &resp)
resp.setOk();
}
void ChatHandler::handleInviteToLobby(Request& req, Response& resp)
{
std::string chat_id;
std::string pgp_id;
req.mStream << makeKeyValueReference("chat_id", chat_id);
req.mStream << makeKeyValueReference("pgp_id", pgp_id);
ChatId chatId(chat_id);
RsPgpId pgpId(pgp_id);
std::list<RsPeerId> peerIds;
mRsPeers->getAssociatedSSLIds(pgpId, peerIds);
for(std::list<RsPeerId>::iterator it = peerIds.begin(); it != peerIds.end(); it++)
mRsMsgs->invitePeerToLobby(chatId.toLobbyId(), (*it));
resp.setOk();
}
void ChatHandler::handleGetInvitationsToLobby(Request& /*req*/, Response& resp)
{
std::list<ChatLobbyInvite> invites;
mRsMsgs->getPendingChatLobbyInvites(invites);
resp.mDataStream.getStreamToMember();
for(std::list<ChatLobbyInvite>::const_iterator it = invites.begin(); it != invites.end(); ++it)
{
resp.mDataStream.getStreamToMember()
<< makeKeyValue("peer_id", (*it).peer_id.toStdString())
<< makeKeyValue("lobby_id", (*it).lobby_id)
<< makeKeyValue("lobby_name", (*it).lobby_name)
<< makeKeyValue("lobby_topic", (*it).lobby_topic);
}
resp.mStateToken = mInvitationsStateToken;
resp.setOk();
}
void ChatHandler::handleAnswerToInvitation(Request& req, Response& resp)
{
ChatLobbyId lobbyId = 0;
req.mStream << makeKeyValueReference("lobby_id", lobbyId);
bool join;
req.mStream << makeKeyValueReference("join", join);
std::string gxs_id;
req.mStream << makeKeyValueReference("gxs_id", gxs_id);
RsGxsId gxsId(gxs_id);
if(join)
{
if(rsMsgs->acceptLobbyInvite(lobbyId, gxsId))
resp.setOk();
else
resp.setFail();
}
else
{
rsMsgs->denyLobbyInvite(lobbyId);
resp.setOk();
}
}
ResponseTask* ChatHandler::handleLobbyParticipants(Request &req, Response &resp)
{
RS_STACK_MUTEX(mMtx); /********** LOCKED **********/
@ -936,7 +1035,7 @@ ResponseTask* ChatHandler::handleLobbyParticipants(Request &req, Response &resp)
void ChatHandler::handleMessages(Request &req, Response &resp)
{
/* G10h4ck: Whithout this the request processing won't happen, copied from
* ChatHandler::handleLobbies, is this a work around or is the right whay of
* ChatHandler::handleLobbies, is this a work around or is the right way of
* doing it? */
tick();
@ -1132,24 +1231,28 @@ void ChatHandler::handleUnreadMsgs(Request &/*req*/, Response &resp)
RS_STACK_MUTEX(mMtx); /********** LOCKED **********/
resp.mDataStream.getStreamToMember();
for(std::map<ChatId, std::list<Msg> >::const_iterator mit = mMsgs.begin(); mit != mMsgs.end(); ++mit)
for( std::map<ChatId, std::list<Msg> >::const_iterator mit = mMsgs.begin();
mit != mMsgs.end(); ++mit )
{
uint32_t count = 0;
for(std::list<Msg>::const_iterator lit = mit->second.begin(); lit != mit->second.end(); ++lit)
if(!lit->read)
count++;
for( std::list<Msg>::const_iterator lit = mit->second.begin();
lit != mit->second.end(); ++lit ) if(!lit->read) ++count;
std::map<ChatId, ChatInfo>::iterator mit2 = mChatInfo.find(mit->first);
if(mit2 == mChatInfo.end())
std::cerr << "Error in ChatHandler::handleUnreadMsgs(): ChatInfo not found. It is weird if this happens. Normally it should not happen." << std::endl;
if(count && (mit2 != mChatInfo.end()))
{
resp.mDataStream.getStreamToMember()
<< makeKeyValue("id", mit->first.toStdString())
#warning Gioacchino Mazzurco 2017-03-24: @deprecated using "id" as key can cause problems in some JS based \
languages like Qml @see chat_id instead
<< makeKeyValue("id", mit->first.toStdString())
<< makeKeyValue("chat_id", mit->first.toStdString())
<< makeKeyValueReference("unread_count", count)
<< mit2->second;
}
}
resp.mStateToken = mUnreadMsgsStateToken;
resp.setOk();
}
void ChatHandler::handleInitiateDistantChatConnexion(Request& req, Response& resp)
@ -1176,8 +1279,9 @@ void ChatHandler::handleInitiateDistantChatConnexion(Request& req, Response& res
DistantChatPeerId distant_chat_id;
uint32_t error_code;
if(mRsMsgs->initiateDistantChatConnexion(receiver_id, sender_id, distant_chat_id, error_code))
resp.setOk();
if(mRsMsgs->initiateDistantChatConnexion( receiver_id, sender_id,
distant_chat_id, error_code,
false )) resp.setOk();
else resp.setFail("Failed to initiate distant chat");
ChatId chat_id(distant_chat_id);

View File

@ -35,6 +35,8 @@ public:
virtual void notifyChatLobbyEvent (uint64_t /* lobby id */, uint32_t /* event type */ ,
const RsGxsId& /* nickname */,const std::string& /* any string */);
virtual void notifyListChange(int list, int type);
// from tickable
virtual void tick();
@ -122,6 +124,9 @@ private:
void handleSubscribeLobby(Request& req, Response& resp);
void handleUnsubscribeLobby(Request& req, Response& resp);
void handleAutoSubsribeLobby(Request& req, Response& resp);
void handleInviteToLobby(Request& req, Response& resp);
void handleGetInvitationsToLobby(Request& req, Response& resp);
void handleAnswerToInvitation(Request& req, Response& resp);
void handleClearLobby(Request& req, Response& resp);
ResponseTask* handleLobbyParticipants(Request& req, Response& resp);
void handleMessages(Request& req, Response& resp);
@ -162,6 +167,7 @@ private:
std::map<ChatLobbyId, LobbyParticipantsInfo> mLobbyParticipantsInfos;
StateToken mUnreadMsgsStateToken;
StateToken mInvitationsStateToken;
};
} // namespace resource_api

View File

@ -1,7 +1,28 @@
/*
* libresapi
*
* Copyright (C) 2015 electron128 <electron128@yahoo.com>
* Copyright (C) 2017 Gioacchino Mazzurco <gio@eigenlab.org>
*
* 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 "IdentityHandler.h"
#include <retroshare/rsidentity.h>
#include <retroshare/rspeers.h>
#include <util/radix64.h>
#include <time.h>
#include "Operators.h"
@ -62,7 +83,18 @@ protected:
{
case BEGIN:{
RsIdentityParameters params;
req.mStream << makeKeyValueReference("name", params.nickname) << makeKeyValueReference("pgp_linked", params.isPgpLinked);
req.mStream
<< makeKeyValueReference("name", params.nickname)
<< makeKeyValueReference("pgp_linked", params.isPgpLinked);
std::string avatar;
req.mStream << makeKeyValueReference("avatar", avatar);
std::vector<uint8_t> avatar_data = Radix64::decode(avatar);
uint8_t *p_avatar_data = &avatar_data[0];
uint32_t size = avatar_data.size();
params.mImage.clear();
params.mImage.copy(p_avatar_data, size);
if(params.nickname == "")
{
@ -127,17 +159,22 @@ private:
RsGxsId mId;
};
IdentityHandler::IdentityHandler(StateTokenServer *sts, RsNotify *notify, RsIdentity *identity):
IdentityHandler::IdentityHandler(StateTokenServer *sts, RsNotify *notify,
RsIdentity *identity) :
mStateTokenServer(sts), mNotify(notify), mRsIdentity(identity),
mMtx("IdentityHandler Mtx"), mStateToken(sts->getNewToken())
{
mNotify->registerNotifyClient(this);
mNotify->registerNotifyClient(this);
addResourceHandler("*", this, &IdentityHandler::handleWildcard);
addResourceHandler("own", this, &IdentityHandler::handleOwn);
addResourceHandler("own_ids", this, &IdentityHandler::handleOwnIdsRequest);
addResourceHandler("notown_ids", this, &IdentityHandler::handleNotOwnIdsRequest);
addResourceHandler("notown_ids", this,
&IdentityHandler::handleNotOwnIdsRequest);
addResourceHandler("export_key", this, &IdentityHandler::handleExportKey);
addResourceHandler("import_key", this, &IdentityHandler::handleImportKey);
addResourceHandler("add_contact", this, &IdentityHandler::handleAddContact);
addResourceHandler("remove_contact", this, &IdentityHandler::handleRemoveContact);
@ -147,6 +184,9 @@ IdentityHandler::IdentityHandler(StateTokenServer *sts, RsNotify *notify, RsIden
addResourceHandler("get_identity_details", this, &IdentityHandler::handleGetIdentityDetails);
addResourceHandler("get_avatar", this, &IdentityHandler::handleGetAvatar);
addResourceHandler("set_avatar", this, &IdentityHandler::handleSetAvatar);
addResourceHandler("set_ban_node", this, &IdentityHandler::handleSetBanNode);
addResourceHandler("set_opinion", this, &IdentityHandler::handleSetOpinion);
}
@ -158,12 +198,10 @@ IdentityHandler::~IdentityHandler()
void IdentityHandler::notifyGxsChange(const RsGxsChanges &changes)
{
RS_STACK_MUTEX(mMtx); // ********** LOCKED **********
// if changes come from identity service, invalidate own state token
if(changes.mService == mRsIdentity->getTokenService())
{
mStateTokenServer->replaceToken(mStateToken);
}
RS_STACK_MUTEX(mMtx);
// if changes come from identity service, invalidate own state token
if(changes.mService == mRsIdentity->getTokenService())
mStateTokenServer->replaceToken(mStateToken);
}
void IdentityHandler::handleWildcard(Request & /*req*/, Response &resp)
@ -177,39 +215,44 @@ void IdentityHandler::handleWildcard(Request & /*req*/, Response &resp)
RsTokReqOptions opts;
opts.mReqType = GXS_REQUEST_TYPE_GROUP_DATA;
uint32_t token;
mRsIdentity->getTokenService()->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts);
mRsIdentity->getTokenService()->requestGroupInfo(
token, RS_TOKREQ_ANSTYPE_DATA, opts);
time_t start = time(NULL);
while((mRsIdentity->getTokenService()->requestStatus(token) != RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE)
&&(mRsIdentity->getTokenService()->requestStatus(token) != RsTokenService::GXS_REQUEST_V2_STATUS_FAILED)
&&((time(NULL) < (start+10)))
)
time_t timeout = time(NULL)+10;
uint8_t rStatus = mRsIdentity->getTokenService()->requestStatus(token);
while( rStatus != RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE &&
rStatus != RsTokenService::GXS_REQUEST_V2_STATUS_FAILED &&
time(NULL) < timeout )
{
#ifdef WINDOWS_SYS
Sleep(500);
#else
usleep(500*1000);
#endif
usleep(50*1000);
rStatus = mRsIdentity->getTokenService()->requestStatus(token);
}
if(mRsIdentity->getTokenService()->requestStatus(token) == RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE)
if(rStatus == RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE)
{
std::vector<RsGxsIdGroup> grps;
ok &= mRsIdentity->getGroupData(token, grps);
for(std::vector<RsGxsIdGroup>::iterator vit = grps.begin(); vit != grps.end(); vit++)
for( std::vector<RsGxsIdGroup>::iterator vit = grps.begin();
vit != grps.end(); ++vit )
{
RsGxsIdGroup& grp = *vit;
//electron: not very happy about this, i think the flags should stay hidden in rsidentities
bool own = (grp.mMeta.mSubscribeFlags & GXS_SERV::GROUP_SUBSCRIBE_ADMIN);
bool pgp_linked = (grp.mMeta.mGroupFlags & RSGXSID_GROUPFLAG_REALID_kept_for_compatibility ) ;
resp.mDataStream.getStreamToMember()
<< makeKeyValueReference("id", grp.mMeta.mGroupId) /// @deprecated using "id" as key can cause problems in some JS based languages like Qml @see gxs_id instead
/* electron: not very happy about this, i think the flags should
* stay hidden in rsidentities */
bool own = (grp.mMeta.mSubscribeFlags &
GXS_SERV::GROUP_SUBSCRIBE_ADMIN);
bool pgp_linked = (grp.mMeta.mGroupFlags &
RSGXSID_GROUPFLAG_REALID_kept_for_compatibility);
resp.mDataStream.getStreamToMember()
#warning Gioacchino Mazzurco 2017-03-24: @deprecated using "id" as key can cause problems in some JS based \
languages like Qml @see gxs_id instead
<< makeKeyValueReference("id", grp.mMeta.mGroupId)
<< makeKeyValueReference("gxs_id", grp.mMeta.mGroupId)
<< makeKeyValueReference("pgp_id",grp.mPgpId )
<< makeKeyValueReference("name", grp.mMeta.mGroupName)
<< makeKeyValueReference("contact", grp.mIsAContact)
<< makeKeyValueReference("own", own)
<< makeKeyValueReference("pgp_linked", pgp_linked);
<< makeKeyValueReference("pgp_linked", pgp_linked)
<< makeKeyValueReference("is_contact", grp.mIsAContact);
}
}
else ok = false;
@ -218,7 +261,6 @@ void IdentityHandler::handleWildcard(Request & /*req*/, Response &resp)
else resp.setFail();
}
void IdentityHandler::handleNotOwnIdsRequest(Request & /*req*/, Response &resp)
{
bool ok = true;
@ -230,38 +272,38 @@ void IdentityHandler::handleNotOwnIdsRequest(Request & /*req*/, Response &resp)
RsTokReqOptions opts;
opts.mReqType = GXS_REQUEST_TYPE_GROUP_DATA;
uint32_t token;
mRsIdentity->getTokenService()->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts);
mRsIdentity->getTokenService()->requestGroupInfo(
token, RS_TOKREQ_ANSTYPE_DATA, opts);
time_t start = time(NULL);
while((mRsIdentity->getTokenService()->requestStatus(token) != RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE)
&&(mRsIdentity->getTokenService()->requestStatus(token) != RsTokenService::GXS_REQUEST_V2_STATUS_FAILED)
&&((time(NULL) < (start+10)))
)
time_t timeout = time(NULL)+10;
uint8_t rStatus = mRsIdentity->getTokenService()->requestStatus(token);
while( rStatus != RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE &&
rStatus != RsTokenService::GXS_REQUEST_V2_STATUS_FAILED &&
time(NULL) < timeout )
{
#ifdef WINDOWS_SYS
Sleep(500);
#else
usleep(500*1000);
#endif
usleep(50*1000);
rStatus = mRsIdentity->getTokenService()->requestStatus(token);
}
if(mRsIdentity->getTokenService()->requestStatus(token) == RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE)
if(rStatus == RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE)
{
std::vector<RsGxsIdGroup> grps;
ok &= mRsIdentity->getGroupData(token, grps);
for(std::vector<RsGxsIdGroup>::iterator vit = grps.begin(); vit != grps.end(); vit++)
for(std::vector<RsGxsIdGroup>::iterator vit = grps.begin();
vit != grps.end(); vit++)
{
RsGxsIdGroup& grp = *vit;
//electron: not very happy about this, i think the flags should stay hidden in rsidentities
if(!(grp.mMeta.mSubscribeFlags & GXS_SERV::GROUP_SUBSCRIBE_ADMIN) && grp.mIsAContact)
if(!(grp.mMeta.mSubscribeFlags & GXS_SERV::GROUP_SUBSCRIBE_ADMIN))
{
bool pgp_linked = (grp.mMeta.mGroupFlags & RSGXSID_GROUPFLAG_REALID_kept_for_compatibility ) ;
bool pgp_linked = (
grp.mMeta.mGroupFlags &
RSGXSID_GROUPFLAG_REALID_kept_for_compatibility );
resp.mDataStream.getStreamToMember()
<< makeKeyValueReference("id", grp.mMeta.mGroupId) /// @deprecated using "id" as key can cause problems in some JS based languages like Qml @see gxs_id instead
<< makeKeyValueReference("gxs_id", grp.mMeta.mGroupId)
<< makeKeyValueReference("pgp_id",grp.mPgpId )
<< makeKeyValueReference("name", grp.mMeta.mGroupName)
<< makeKeyValueReference("pgp_linked", pgp_linked);
<< makeKeyValueReference("pgp_linked", pgp_linked)
<< makeKeyValueReference("is_contact", grp.mIsAContact);
}
}
}
@ -468,6 +510,11 @@ void IdentityHandler::handleGetIdentityDetails(Request& req, Response& resp)
RsIdentityDetails details;
mRsIdentity->getIdDetails(RsGxsId(data.mMeta.mGroupId), details);
std::string base64Avatar;
Radix64::encode(details.mAvatar.mData, details.mAvatar.mSize, base64Avatar);
resp.mDataStream << makeKeyValue("avatar", base64Avatar);
StreamBase& usagesStream = resp.mDataStream.getStreamToMember("usages");
usagesStream.getStreamToMember();
@ -482,6 +529,89 @@ void IdentityHandler::handleGetIdentityDetails(Request& req, Response& resp)
resp.setOk();
}
void IdentityHandler::handleSetAvatar(Request& req, Response& resp)
{
std::string gxs_id;
std::string avatar;
req.mStream << makeKeyValueReference("gxs_id", gxs_id);
req.mStream << makeKeyValueReference("avatar", avatar);
RsTokReqOptions opts;
opts.mReqType = GXS_REQUEST_TYPE_GROUP_DATA;
uint32_t token;
std::list<RsGxsGroupId> groupIds;
groupIds.push_back(RsGxsGroupId(gxs_id));
mRsIdentity->getTokenService()->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, groupIds);
time_t start = time(NULL);
while((mRsIdentity->getTokenService()->requestStatus(token) != RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE)
&&(mRsIdentity->getTokenService()->requestStatus(token) != RsTokenService::GXS_REQUEST_V2_STATUS_FAILED)
&&((time(NULL) < (start+10)))
)
{
#ifdef WINDOWS_SYS
Sleep(500);
#else
usleep(500*1000);
#endif
}
RsGxsIdGroup data;
std::vector<RsGxsIdGroup> datavector;
if (!mRsIdentity->getGroupData(token, datavector))
{
resp.setFail();
return;
}
if(datavector.empty())
{
resp.setFail();
return;
}
data = datavector[0];
if(!avatar.empty())
{
std::vector<uint8_t> avatar_data = Radix64::decode(avatar);
uint8_t *p_avatar_data = &avatar_data[0];
uint32_t size = avatar_data.size();
data.mImage.clear();
data.mImage.copy(p_avatar_data, size);
std::string base64Avatar;
Radix64::encode(data.mImage.mData, data.mImage.mSize, base64Avatar);
resp.mDataStream << makeKeyValue("avatar", base64Avatar);
}
else
data.mImage.clear();
uint32_t dummyToken = 0;
mRsIdentity->updateIdentity(dummyToken, data);
resp.setOk();
}
void IdentityHandler::handleGetAvatar(Request& req, Response& resp)
{
std::string gxs_id;
req.mStream << makeKeyValueReference("gxs_id", gxs_id);
RsIdentityDetails details;
bool got = mRsIdentity->getIdDetails(RsGxsId(gxs_id), details);
std::string base64Avatar;
Radix64::encode(details.mAvatar.mData, details.mAvatar.mSize, base64Avatar);
resp.mDataStream << makeKeyValue("avatar", base64Avatar);
if(got)
resp.setOk();
else
resp.setFail();
}
void IdentityHandler::handleSetBanNode(Request& req, Response& resp)
{
std::string pgp_id;
@ -545,9 +675,51 @@ ResponseTask* IdentityHandler::handleCreateIdentity(Request & /* req */, Respons
return new CreateIdentityTask(mRsIdentity);
}
ResponseTask* IdentityHandler::handleDeleteIdentity(Request& /* req */, Response& /* resp */)
void IdentityHandler::handleExportKey(Request& req, Response& resp)
{
return new DeleteIdentityTask(mRsIdentity);
RsGxsId gxs_id;
req.mStream << makeKeyValueReference("gxs_id", gxs_id);
std::string radix;
time_t timeout = time(NULL)+2;
bool found = mRsIdentity->serialiseIdentityToMemory(gxs_id, radix);
while(!found && time(nullptr) < timeout)
{
usleep(5000);
found = mRsIdentity->serialiseIdentityToMemory(gxs_id, radix);
}
if(found)
{
resp.mDataStream << makeKeyValueReference("gxs_id", gxs_id)
<< makeKeyValueReference("radix", radix);
resp.setOk();
return;
}
resp.setFail();
}
void IdentityHandler::handleImportKey(Request& req, Response& resp)
{
std::string radix;
req.mStream << makeKeyValueReference("radix", radix);
RsGxsId gxs_id;
if(mRsIdentity->deserialiseIdentityFromMemory(radix, &gxs_id))
{
resp.mDataStream << makeKeyValueReference("gxs_id", gxs_id)
<< makeKeyValueReference("radix", radix);
resp.setOk();
return;
}
resp.setFail();
}
ResponseTask* IdentityHandler::handleDeleteIdentity(Request& /*req*/,
Response& /*resp*/)
{ return new DeleteIdentityTask(mRsIdentity); }
} // namespace resource_api

View File

@ -1,4 +1,23 @@
#pragma once
/*
* libresapi
*
* Copyright (C) 2015 electron128 <electron128@yahoo.com>
* Copyright (C) 2017 Gioacchino Mazzurco <gio@eigenlab.org>
*
* 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 <retroshare/rsnotify.h>
#include <util/rsthreads.h>
@ -22,15 +41,21 @@ public:
virtual void notifyGxsChange(const RsGxsChanges &changes);
private:
void handleWildcard(Request& req, Response& resp);
void handleWildcard(Request& req, Response& resp);
void handleNotOwnIdsRequest(Request& req, Response& resp);
void handleOwnIdsRequest(Request& req, Response& resp);
void handleExportKey(Request& req, Response& resp);
void handleImportKey(Request& req, Response& resp);
void handleAddContact(Request& req, Response& resp);
void handleRemoveContact(Request& req, Response& resp);
void handleGetIdentityDetails(Request& req, Response& resp);
void handleGetAvatar(Request& req, Response& resp);
void handleSetAvatar(Request& req, Response& resp);
void handleSetBanNode(Request& req, Response& resp);
void handleSetOpinion(Request& req, Response& resp);

View File

@ -1,4 +1,22 @@
#pragma once
/*
* libresapi
* Copyright (C) 2015 electron128 <electron128@yahoo.com>
* Copyright (C) 2017 Gioacchino Mazzurco <gio@eigenlab.org>
*
* 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 "ApiTypes.h"
@ -13,13 +31,6 @@ namespace resource_api
template<class C>
void handlePaginationRequest(Request& req, Response& resp, C& data)
{
/*
if(!req.isGet()){
resp.mDebug << "unsupported method. only GET is allowed." << std::endl;
resp.setFail();
return;
}
*/
if(data.begin() == data.end()){
// set result type to list
resp.mDataStream.getStreamToMember();
@ -30,7 +41,8 @@ void handlePaginationRequest(Request& req, Response& resp, C& data)
std::string begin_after;
std::string last;
req.mStream << makeKeyValueReference("begin_after", begin_after) << makeKeyValueReference("last", last);
req.mStream << makeKeyValueReference("begin_after", begin_after)
<< makeKeyValueReference("last", last);
typename C::iterator it_first = data.begin();
if(begin_after != "begin" && begin_after != "")
@ -62,7 +74,17 @@ void handlePaginationRequest(Request& req, Response& resp, C& data)
++it_last; // increment to get iterator to element after the last wanted element
}
int count = 0;
/* G10h4ck: Guarded message count limitation with
* JSON_API_LIMIT_CHAT_MSG_COUNT_BY_DEFAULT as ATM it seems that handling a
* big bunch of messages hasn't been a problem for client apps, and even in
* that case the client can specify +begin_after+ and +last+ in the request,
* this way we don't make more difficult the life of those who just want get
* the whole list of chat messages that seems to be a common usecase
*/
#ifdef JSON_API_LIMIT_CHAT_MSG_COUNT_BY_DEFAULT
int count = 0;
#endif
for(typename C::iterator it = it_first; it != it_last; ++it)
{
StreamBase& stream = resp.mDataStream.getStreamToMember();
@ -71,11 +93,16 @@ void handlePaginationRequest(Request& req, Response& resp, C& data)
// todo: also handle the case when the last element is specified and the first element is begin
// then want to return the elements near the specified element
count++;
if(count > 20){
resp.mDebug << "limited the number of returned items to 20" << std::endl;
break;
}
// G10h4ck: @see first comment about JSON_API_LIMIT_CHAT_MSG_COUNT_BY_DEFAULT
#ifdef JSON_API_LIMIT_CHAT_MSG_COUNT_BY_DEFAULT
++count;
if(count > 20)
{
resp.mDebug << "limited the number of returned items to 20";
break;
}
#endif
}
resp.setOk();
}

View File

@ -1,3 +1,23 @@
/*
* libresapi
*
* Copyright (C) 2015 electron128 <electron128@yahoo.com>
* Copyright (C) 2017 Gioacchino Mazzurco <gio@eigenlab.org>
*
* 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 "PeersHandler.h"
#include <retroshare/rspeers.h>
@ -5,6 +25,7 @@
#include <util/radix64.h>
#include <retroshare/rsstatus.h>
#include <retroshare/rsiface.h>
#include <retroshare/rsconfig.h>
#include <algorithm>
@ -194,15 +215,19 @@ PeersHandler::PeersHandler(StateTokenServer* sts, RsNotify* notify, RsPeers *pee
mNotify->registerNotifyClient(this);
mStateTokenServer->registerTickClient(this);
addResourceHandler("*", this, &PeersHandler::handleWildcard);
addResourceHandler("attempt_connection", this, &PeersHandler::handleAttemptConnection);
addResourceHandler("get_state_string", this, &PeersHandler::handleGetStateString);
addResourceHandler("set_state_string", this, &PeersHandler::handleSetStateString);
addResourceHandler("get_custom_state_string", this, &PeersHandler::handleGetCustomStateString);
addResourceHandler("set_custom_state_string", this, &PeersHandler::handleSetCustomStateString);
addResourceHandler("get_network_options", this, &PeersHandler::handleGetNetworkOptions);
addResourceHandler("set_network_options", this, &PeersHandler::handleSetNetworkOptions);
addResourceHandler("get_pgp_options", this, &PeersHandler::handleGetPGPOptions);
addResourceHandler("set_pgp_options", this, &PeersHandler::handleSetPGPOptions);
addResourceHandler("get_node_options", this, &PeersHandler::handleGetNodeOptions);
addResourceHandler("set_node_options", this, &PeersHandler::handleSetNodeOptions);
addResourceHandler("examine_cert", this, &PeersHandler::handleExamineCert);
}
PeersHandler::~PeersHandler()
@ -576,19 +601,30 @@ void PeersHandler::handleWildcard(Request &req, Response &resp)
}
RsPeerId peer_id;
RsPgpId pgp_id;
std::string cleanCert;
int error_code;
std::string error_string;
if(mRsPeers->loadCertificateFromString(cert_string, peer_id, pgp_id, error_string)
&& mRsPeers->addFriend(peer_id, pgp_id, flags))
{
ok = true;
resp.mDataStream << makeKeyValueReference("pgp_id", pgp_id);
resp.mDataStream << makeKeyValueReference("peer_id", peer_id);
}
else
{
resp.mDebug << "Error: failed to add peer" << std::endl;
resp.mDebug << error_string << std::endl;
}
if (mRsPeers->cleanCertificate(cert_string, cleanCert, error_code))
{
if(mRsPeers->loadCertificateFromString(cert_string, peer_id, pgp_id, error_string)
&& mRsPeers->addFriend(peer_id, pgp_id, flags))
{
ok = true;
resp.mDataStream << makeKeyValueReference("pgp_id", pgp_id);
resp.mDataStream << makeKeyValueReference("peer_id", peer_id);
}
else
{
resp.mDebug << "Error: failed to add peer" << std::endl;
resp.mDebug << error_string << std::endl;
}
}
else
{
resp.mDebug << "Error: failed to add peer" << std::endl;
resp.mDebug << error_code << std::endl;
}
}
}
if(ok)
@ -601,6 +637,19 @@ void PeersHandler::handleWildcard(Request &req, Response &resp)
}
}
void PeersHandler::handleAttemptConnection(Request &req, Response &resp)
{
std::string ssl_peer_id;
req.mStream << makeKeyValueReference("peer_id", ssl_peer_id);
RsPeerId peerId(ssl_peer_id);
if(peerId.isNull()) resp.setFail("Invalid peer_id");
else
{
mRsPeers->connectAttempt(peerId);
resp.setOk();
}
}
void PeersHandler::handleExamineCert(Request &req, Response &resp)
{
std::string cert_string;
@ -618,6 +667,198 @@ void PeersHandler::handleExamineCert(Request &req, Response &resp)
}
}
void PeersHandler::handleGetNetworkOptions(Request& /*req*/, Response& resp)
{
RsPeerDetails detail;
if (!mRsPeers->getPeerDetails(mRsPeers->getOwnId(), detail))
return;
resp.mDataStream << makeKeyValue("local_address", detail.localAddr);
resp.mDataStream << makeKeyValue("local_port", (int)detail.localPort);
resp.mDataStream << makeKeyValue("external_address", detail.extAddr);
resp.mDataStream << makeKeyValue("external_port", (int)detail.extPort);
resp.mDataStream << makeKeyValue("dyn_dns", detail.dyndns);
int netIndex = 0;
switch(detail.netMode)
{
case RS_NETMODE_EXT:
netIndex = 2;
break;
case RS_NETMODE_UDP:
netIndex = 1;
break;
case RS_NETMODE_UPNP:
netIndex = 0;
break;
}
resp.mDataStream << makeKeyValue("nat_mode", netIndex);
int discoveryIndex = 3; // NONE.
if(detail.vs_dht != RS_VS_DHT_OFF)
{
if(detail.vs_disc != RS_VS_DISC_OFF)
discoveryIndex = 0; // PUBLIC
else
discoveryIndex = 2; // INVERTED
}
else
{
if(detail.vs_disc != RS_VS_DISC_OFF)
discoveryIndex = 1; // PRIVATE
else
discoveryIndex = 3; // NONE
}
resp.mDataStream << makeKeyValue("discovery_mode", discoveryIndex);
int dlrate = 0;
int ulrate = 0;
rsConfig->GetMaxDataRates(dlrate, ulrate);
resp.mDataStream << makeKeyValue("download_limit", dlrate);
resp.mDataStream << makeKeyValue("upload_limit", ulrate);
bool checkIP = mRsPeers->getAllowServerIPDetermination();
resp.mDataStream << makeKeyValue("check_ip", checkIP);
StreamBase& previousIPsStream = resp.mDataStream.getStreamToMember("previous_ips");
previousIPsStream.getStreamToMember();
for(std::list<std::string>::const_iterator it = detail.ipAddressList.begin(); it != detail.ipAddressList.end(); ++it)
previousIPsStream.getStreamToMember() << makeKeyValue("ip_address", *it);
std::list<std::string> ip_servers;
mRsPeers->getIPServersList(ip_servers);
StreamBase& websitesStream = resp.mDataStream.getStreamToMember("websites");
websitesStream.getStreamToMember();
for(std::list<std::string>::const_iterator it = ip_servers.begin(); it != ip_servers.end(); ++it)
websitesStream.getStreamToMember() << makeKeyValue("website", *it);
std::string proxyaddr;
uint16_t proxyport;
uint32_t status ;
// Tor
mRsPeers->getProxyServer(RS_HIDDEN_TYPE_TOR, proxyaddr, proxyport, status);
resp.mDataStream << makeKeyValue("tor_address", proxyaddr);
resp.mDataStream << makeKeyValue("tor_port", (int)proxyport);
// I2P
mRsPeers->getProxyServer(RS_HIDDEN_TYPE_I2P, proxyaddr, proxyport, status);
resp.mDataStream << makeKeyValue("i2p_address", proxyaddr);
resp.mDataStream << makeKeyValue("i2p_port", (int)proxyport);
resp.setOk();
}
void PeersHandler::handleSetNetworkOptions(Request& req, Response& resp)
{
RsPeerDetails detail;
if (!mRsPeers->getPeerDetails(mRsPeers->getOwnId(), detail))
return;
int netIndex = 0;
uint32_t natMode = 0;
req.mStream << makeKeyValueReference("nat_mode", netIndex);
switch(netIndex)
{
case 3:
natMode = RS_NETMODE_HIDDEN;
break;
case 2:
natMode = RS_NETMODE_EXT;
break;
case 1:
natMode = RS_NETMODE_UDP;
break;
default:
case 0:
natMode = RS_NETMODE_UPNP;
break;
}
if (detail.netMode != natMode)
mRsPeers->setNetworkMode(mRsPeers->getOwnId(), natMode);
int discoveryIndex;
uint16_t vs_disc = 0;
uint16_t vs_dht = 0;
req.mStream << makeKeyValueReference("discovery_mode", discoveryIndex);
switch(discoveryIndex)
{
case 0:
vs_disc = RS_VS_DISC_FULL;
vs_dht = RS_VS_DHT_FULL;
break;
case 1:
vs_disc = RS_VS_DISC_FULL;
vs_dht = RS_VS_DHT_OFF;
break;
case 2:
vs_disc = RS_VS_DISC_OFF;
vs_dht = RS_VS_DHT_FULL;
break;
case 3:
default:
vs_disc = RS_VS_DISC_OFF;
vs_dht = RS_VS_DHT_OFF;
break;
}
if ((vs_disc != detail.vs_disc) || (vs_dht != detail.vs_dht))
mRsPeers->setVisState(mRsPeers->getOwnId(), vs_disc, vs_dht);
if (0 != netIndex)
{
std::string localAddr;
int localPort;
std::string extAddr;
int extPort;
req.mStream << makeKeyValueReference("local_address", localAddr);
req.mStream << makeKeyValueReference("local_port", localPort);
req.mStream << makeKeyValueReference("external_address", extAddr);
req.mStream << makeKeyValueReference("external_port", extPort);
mRsPeers->setLocalAddress(mRsPeers->getOwnId(), localAddr, (uint16_t)localPort);
mRsPeers->setExtAddress(mRsPeers->getOwnId(), extAddr, (uint16_t)extPort);
}
std::string dynDNS;
req.mStream << makeKeyValueReference("dyn_dns", dynDNS);
mRsPeers->setDynDNS(mRsPeers->getOwnId(), dynDNS);
int dlrate = 0;
int ulrate = 0;
req.mStream << makeKeyValueReference("download_limit", dlrate);
req.mStream << makeKeyValueReference("upload_limit", ulrate);
rsConfig->SetMaxDataRates(dlrate, ulrate);
bool checkIP;
req.mStream << makeKeyValueReference("check_ip", checkIP);
rsPeers->allowServerIPDetermination(checkIP) ;
// Tor
std::string toraddr;
int torport;
req.mStream << makeKeyValueReference("tor_address", toraddr);
req.mStream << makeKeyValueReference("tor_port", torport);
mRsPeers->setProxyServer(RS_HIDDEN_TYPE_TOR, toraddr, (uint16_t)torport);
// I2P
std::string i2paddr;
int i2pport;
req.mStream << makeKeyValueReference("i2p_address", i2paddr);
req.mStream << makeKeyValueReference("i2p_port", i2pport);
mRsPeers->setProxyServer(RS_HIDDEN_TYPE_I2P, i2paddr, (uint16_t)i2pport);
resp.mStateToken = getCurrentStateToken();
resp.setOk();
}
void PeersHandler::handleGetPGPOptions(Request& req, Response& resp)
{
std::string pgp_id;

View File

@ -1,4 +1,23 @@
#pragma once
/*
* libresapi
*
* Copyright (C) 2015 electron128 <electron128@yahoo.com>
* Copyright (C) 2017 Gioacchino Mazzurco <gio@eigenlab.org>
*
* 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 "ResourceRouter.h"
#include "StateTokenServer.h"
@ -33,8 +52,11 @@ public:
virtual void notifyUnreadMsgCountChanged(const RsPeerId& peer, uint32_t count);
private:
void handleWildcard(Request& req, Response& resp);
void handleExamineCert(Request& req, Response& resp);
void handleWildcard(Request& req, Response& resp);
void handleAttemptConnection(Request& req, Response& resp);
void handleExamineCert(Request& req, Response& resp);
void handleGetStateString(Request& req, Response& resp);
void handleSetStateString(Request& req, Response& resp);
@ -42,6 +64,9 @@ private:
void handleGetCustomStateString(Request& req, Response& resp);
void handleSetCustomStateString(Request& req, Response& resp);
void handleGetNetworkOptions(Request& req, Response& resp);
void handleSetNetworkOptions(Request& req, Response& resp);
void handleGetPGPOptions(Request& req, Response& resp);
void handleSetPGPOptions(Request& req, Response& resp);

View File

@ -14,6 +14,8 @@
#include "GetPluginInterfaces.h"
//#define DEBUG_CONTROL_MODULE 1
namespace resource_api{
RsControlModule::RsControlModule(int argc, char **argv, StateTokenServer* sts, ApiServer *apiserver, bool full_control):
@ -26,6 +28,7 @@ RsControlModule::RsControlModule(int argc, char **argv, StateTokenServer* sts, A
mAutoLoginNextTime(false),
mWantPassword(false),
mPrevIsBad(false),
mCountAttempts(0),
mPassword("")
{
mStateToken = sts->getNewToken();
@ -60,11 +63,21 @@ bool RsControlModule::processShouldExit()
bool RsControlModule::askForPassword(const std::string &title, const std::string &key_details, bool prev_is_bad, std::string &password, bool& cancelled)
{
#ifdef DEBUG_CONTROL_MODULE
std::cerr << "RsControlModule::askForPassword(): current passwd is \"" << mPassword << "\"" << std::endl;
#endif
cancelled = false ;
{
RS_STACK_MUTEX(mDataMtx); // ********** LOCKED **********
mPrevIsBad = prev_is_bad;
mCountAttempts++;
if(mCountAttempts == 3)
{
mPrevIsBad = prev_is_bad;
mCountAttempts = 0;
}
else
mPrevIsBad = false;
if(mFixedPassword != "")
{
@ -106,7 +119,9 @@ bool RsControlModule::askForPassword(const std::string &title, const std::string
void RsControlModule::run()
{
#ifdef DEBUG_CONTROL_MODULE
std::cerr << "RsControlModule: initialising libretroshare..." << std::endl;
#endif
RsInit::InitRsConfig();
int initResult = RsInit::InitRetroShare(argc, argv, true);
@ -117,11 +132,11 @@ void RsControlModule::run()
std::stringstream ss;
switch (initResult) {
case RS_INIT_AUTH_FAILED:
ss << "RsInit::InitRetroShare AuthGPG::InitAuth failed" << std::endl;
ss << "RsControlModule::run() AuthGPG::InitAuth failed" << std::endl;
break;
default:
/* Unexpected return code */
ss << "RsInit::InitRetroShare unexpected return code " << initResult << std::endl;
ss << "ControlModule::run() unexpected return code " << initResult << std::endl;
break;
}
// FATAL ERROR, we can't recover from this. Just send the message to the user.
@ -133,33 +148,57 @@ void RsControlModule::run()
RsControl::earlyInitNotificationSystem();
rsNotify->registerNotifyClient(this);
#ifdef DEBUG_CONTROL_MODULE
std::cerr << "RsControlModule::run() Entering login wait loop." << std::endl;
#endif
bool login_ok = false;
while(!login_ok)
{
#ifdef DEBUG_CONTROL_MODULE
std::cerr << "RsControlModule::run() reseting passwd." << std::endl;
#endif
{
RsStackMutex stack(mDataMtx); // ********** LOCKED **********
mPassword = "";
}
// skip account selection if autologin is available
if(initResult != RS_INIT_HAVE_ACCOUNT)
setRunState(WAITING_ACCOUNT_SELECT);
bool wait_for_account_select = (initResult != RS_INIT_HAVE_ACCOUNT);
// wait for login request
bool auto_login = false;
bool wait_for_account_select = (initResult != RS_INIT_HAVE_ACCOUNT);
if(wait_for_account_select)
{
#ifdef DEBUG_CONTROL_MODULE
std::cerr << "RsControlModule::run() wait_for_account_select=true => setting run state to WAITING_ACCOUNT_SELECT." << std::endl;
#endif
setRunState(WAITING_ACCOUNT_SELECT);
}
while(wait_for_account_select && !processShouldExit())
{
usleep(5*1000);
#ifdef DEBUG_CONTROL_MODULE
std::cerr << "RsControlModule::run() while(wait_for_account_select) mLoadPeerId=" << mLoadPeerId << std::endl;
#endif
usleep(500*1000);
RsStackMutex stack(mDataMtx); // ********** LOCKED **********
wait_for_account_select = mLoadPeerId.isNull();
if(!mLoadPeerId.isNull())
{
wait_for_account_select = wait_for_account_select && !RsAccounts::SelectAccount(mLoadPeerId);
#ifdef DEBUG_CONTROL_MODULE
std::cerr << "RsControlModule::run() mLoadPeerId != NULL, account selection result: " << !wait_for_account_select << std::endl;
#endif
}
auto_login = mAutoLoginNextTime;
if(!wait_for_account_select)
{
wait_for_account_select = !RsAccounts::SelectAccount(mLoadPeerId);
if(wait_for_account_select)
setRunState(WAITING_ACCOUNT_SELECT);
}
//if(!wait_for_account_select)
//{
// if(wait_for_account_select)
// setRunState(WAITING_ACCOUNT_SELECT);
//}
}
if(processShouldExit())
@ -167,6 +206,9 @@ void RsControlModule::run()
bool autoLogin = (initResult == RS_INIT_HAVE_ACCOUNT) | auto_login;
std::string lockFile;
#ifdef DEBUG_CONTROL_MODULE
std::cerr << "RsControlModule::run() trying to load certificate..." << std::endl;
#endif
int retVal = RsInit::LockAndLoadCertificates(autoLogin, lockFile);
std::string error_string;
@ -191,16 +233,24 @@ void RsControlModule::run()
std::cerr << "RsControlModule::run() LockAndLoadCertificates failed. Unexpected switch value: " << retVal << std::endl;
break;
}
#ifdef DEBUG_CONTROL_MODULE
std::cerr << "RsControlModule::run() Error string: \"" << error_string << "\"" << std::endl;
#endif
{
RsStackMutex stack(mDataMtx); // ********** LOCKED **********
mLoadPeerId.clear();
}
}
#ifdef DEBUG_CONTROL_MODULE
std::cerr << "RsControlModule::run() login is ok. Starting up..." << std::endl;
#endif
{
RsStackMutex stack(mDataMtx); // ********** LOCKED **********
mFixedPassword = mPassword;
std::cerr << "***Reseting mPasswd " << std::endl;
mPassword = "";
}
@ -323,13 +373,20 @@ void RsControlModule::handlePassword(Request &req, Response &resp)
RsStackMutex stack(mDataMtx); // ********** LOCKED **********
std::string passwd;
req.mStream << makeKeyValueReference("password", passwd);
if(passwd != "" && mWantPassword)
if(passwd != "")// && mWantPassword)
{
// client sends password
mPassword = passwd;
mWantPassword = false;
mStateTokenServer->replaceToken(mStateToken);
#ifdef DEBUG_CONTROL_MODULE
std::cerr << "RsControlModule::handlePassword(): setting mPasswd=\"" << mPassword << "\"" << std::endl;
#endif
}
#ifdef DEBUG_CONTROL_MODULE
else
std::cerr << "RsControlModule::handlePassword(): not setting mPasswd=\"" << mPassword << "\"!!!" << std::endl;
#endif
resp.mDataStream
<< makeKeyValueReference("want_password", mWantPassword)
@ -443,8 +500,10 @@ void RsControlModule::handleCreateLocation(Request &req, Response &resp)
}
}
if(hidden_port)
RsInit::SetHiddenLocation(hidden_address, hidden_port);
if(hidden_port) {
/// TODO add bob to webui
RsInit::SetHiddenLocation(hidden_address, hidden_port, false);
}
std::string ssl_password = RSRandom::random_alphaNumericString(RsInit::getSslPwdLen()) ;

View File

@ -23,6 +23,8 @@ class ApiServer;
class RsControlModule: public ResourceRouter, NotifyClient, private RsSingleJobThread
{
public:
enum RunState { WAITING_INIT, FATAL_ERROR, WAITING_ACCOUNT_SELECT, WAITING_STARTUP, RUNNING_OK, RUNNING_OK_NO_FULL_CONTROL};
// ApiServer will be called once RS is started, to load additional api modules
// full_control: set to true if this module should handle rsinit and login
// set to false if rsinit is handled by the Qt gui
@ -32,6 +34,9 @@ public:
// returns true if the process should terminate
bool processShouldExit();
// returns the current state of the software booting process
RunState runState() const { return mRunState ; }
// from NotifyClient
virtual bool askForPassword(const std::string &title, const std::string& key_details, bool prev_is_bad , std::string& password,bool& canceled) override;
virtual bool askForDeferredSelfSignature(const void *data, const uint32_t len, unsigned char *sign, unsigned int *signlen,int& signature_result, std::string reason = "") override;
@ -42,7 +47,6 @@ protected:
virtual void run();
private:
enum RunState { WAITING_INIT, FATAL_ERROR, WAITING_ACCOUNT_SELECT, WAITING_STARTUP, RUNNING_OK, RUNNING_OK_NO_FULL_CONTROL};
void handleRunState(Request& req, Response& resp);
void handleIdentities(Request& req, Response& resp);
void handleLocations(Request& req, Response& resp);
@ -78,7 +82,8 @@ private:
// to notify that a password callback is waiting
// to answer the request, clear the flag and set the password
bool mWantPassword;
bool mPrevIsBad ;
bool mPrevIsBad;
int mCountAttempts;
std::string mTitle;
std::string mKeyName;
std::string mPassword;

View File

@ -19,7 +19,7 @@ BUILD / DEVELOPMENT
- the build process watches files for changes, and rebuilds and reloads the page. Build output is in ./public
- use the --webinterface 9090 command line parameter to enable webui in retroshare-nogui
- set the --docroot parameter of retroshare-nogui to point to the "libresapi/src/webui-src/public" directory
(or symlink from /usr/share/RetroShare06/webui on Linux, ./webui on Windows)
(or symlink from /usr/share/retroshare/webui on Linux, ./webui on Windows)
- retroshare-gui does not have a --docroot parameter. Use symlinks then.
CONTRIBUTE

View File

@ -87,8 +87,87 @@ function getLobbyDetails(lobbyid){
return null;
}
function find_next(searchValue){
var els = document.getElementsByClassName("chat msg text");
var middle = document.getElementsByClassName("chat middle")[0];
var find_hidden = document.getElementById("LastWordPos");
var start_index = Number(find_hidden.innerText);
if(!Number.isInteger(start_index)){
console.log(start_index + " is Not Integer");
start_index = 0;
}
if(start_index > els.length)
start_index = 0;
console.log(start_index);
for (var i = start_index; i < els.length; i++) {
var start = els[i].innerHTML.indexOf(searchValue);
if ( start > -1) {
//match has been made
middle.scrollTop = els[i].parentElement.offsetTop - middle.clientHeight/2;
var end = searchValue.length + start;
setSelectionRange(els[i], start, end);
find_hidden.innerText = i + 1;
break;
}
}
}
function setSelectionRange(el, start, end) {
if (document.createRange && window.getSelection) {
var range = document.createRange();
range.selectNodeContents(el);
var textNodes = getTextNodesIn(el);
var foundStart = false;
var charCount = 0, endCharCount;
for (var i = 0, textNode; textNode = textNodes[i++]; ) {
endCharCount = charCount + textNode.length;
if (!foundStart && start >= charCount && (start < endCharCount || (start == endCharCount && i <= textNodes.length))) {
range.setStart(textNode, start - charCount);
foundStart = true;
}
if (foundStart && end <= endCharCount) {
range.setEnd(textNode, end - charCount);
break;
}
charCount = endCharCount;
}
var sel = window.getSelection();
sel.removeAllRanges();
sel.addRange(range);
} else if (document.selection && document.body.createTextRange) {
var textRange = document.body.createTextRange();
textRange.moveToElementText(el);
textRange.collapse(true);
textRange.moveEnd("character", end);
textRange.moveStart("character", start);
textRange.select();
}
}
function getTextNodesIn(node) {
var textNodes = [];
if (node.nodeType == 3) {
textNodes.push(node);
} else {
var children = node.childNodes;
for (var i = 0, len = children.length; i < len; ++i) {
textNodes.push.apply(textNodes, getTextNodesIn(children[i]));
}
}
return textNodes;
}
function sendmsg(msgid){
var txtmsg = document.getElementById("txtNewMsg");
var remove_whitespace = txtmsg.value.replace(/(\r\n|\n|\r|\s)+/g,'');
if( remove_whitespace == '')
return;
rs.request("chat/send_message", {
chat_id: msgid,
msg: txtmsg.value
@ -131,7 +210,7 @@ function lobby(lobbyid){
});
var intro = [
m("h2",lobdt.name),
//m("h2",lobdt.name),
m("p",lobdt.topic ? lobdt.topic: lobdt.location),
m("hr")
]
@ -154,22 +233,61 @@ function lobby(lobbyid){
}),
];
} else {
var el = document.getElementById("CharLobbyName");
el.innerText = lobdt.name;
msg = m(".chat.bottom",[
m("div","enter new message:"),
m("input",{
m("div","enter new message, Ctrl+Enter to submit:"),
m("textarea",{
id:"txtNewMsg",
onkeydown: function(event){
if (event.keyCode == 13){
if (event.ctrlKey && event.keyCode == 13){
sendmsg(lobbyid);
}
}
}),
m("div.btn2", {
style: {textAlign:"center"},
onclick: function(){
sendmsg(lobbyid);
}
},"submit")
m("table.noBorderTable", [
m("tr",[
m("td.noBorderTD",[
m("div.btnSmall", {
style: {textAlign:"center"},
onclick: function(){
var els = document.getElementsByClassName("chat middle");
var el = els[0];
el.scrollTop = el.scrollHeight - el.clientHeight;
}
},"bottom")
]),
m("td.noBorderTD",[
m("div.btnSmall", {
style: {textAlign:"center"},
onclick: function(){
sendmsg(lobbyid);
}
},"submit")
]),
m("td.noBorderTD",[
m("input",{
id:"txtMsgKeyword"
})
]),
m("td.noBorderTD", [
m("div.btnSmall", {
style: {textAlign:"center"},
onclick: function(){
var key = document.getElementById("txtMsgKeyword");
var txtkeyword = key.value;
find_next(txtkeyword);
}
},"Find")
])
])
]),
m("div.hidden", {
id: "LastWordPos"
},""
),
]);
}
if (lobdt.subscribed != undefined
@ -256,11 +374,27 @@ module.exports = {
},[
m(".chat.container", [
m(".chat.header", [
m(
"h2",
{style:{margin:"0px"}},
"chat"
)
m("table.noBorderTable",[
m("tr",[
m("td.noBorderTD",[
m(
"h2",
{style:{margin:"0px"}},
"chat"
)
]),
m("td.noBorderTD",[
m(
"h2",
{
style:{margin:"0px"},
id:"CharLobbyName"
},
"Lobby Name"
)
])
])
])
]),
m(".chat.left", [
m("div.chat.header[style=position:relative]","lobbies:"),

View File

@ -77,11 +77,41 @@ hr {
background-color: midnightblue;
}
.btnSmall{
border-style: solid;
/*border-color: lime;*/
border-color: limeGreen;
/*border-width: 1px;*/
border-radius: 3mm;
padding: 1mm;
font-size: 100%;
cursor: pointer;
margin-bottom: 0mm;
}
.hidden{
display:none;
}
.noBorderTable{
width: 100%;
border: none;
border-collapse: collapse;
}
.noBorderTD{
border: none;
border-collapse: collapse;
vertical-align: center;
}
.filelink{
color: inherit;
}
input, textarea{
input,textarea{
color: lime;
font-family: monospace;
background-color: black;
@ -90,8 +120,8 @@ input, textarea{
border-radius: 3mm;
border-width: 1mm;
padding: 2mm;
margin-bottom: 2mm;
margin-right: 2mm;
margin-bottom: 1mm;
margin-right: 1mm;
/* make the button the whole screen width */
width: 100%;
@ -102,6 +132,45 @@ input:hover{
background-color: midnightblue;
}
textarea#txtNewMsg{
color: lime;
font-family: monospace;
background-color: black;
border-color: lime;
font-size: 100%;
border-radius: 3mm;
border-width: 1mm;
padding: 2mm;
margin-bottom: 0mm;
margin-right: 1mm;
height:110px;
resize: none;
/* make the button the whole screen width */
width: 100%;
/*height: 100%;*/
/* make the text input fit small screens*/
box-sizing: border-box;
}
input#txtMsgKeyword{
color: lime;
font-family: monospace;
background-color: black;
border-color: lime;
font-size: 100%;
border-radius: 3mm;
border-width: 1mm;
padding: 1mm;
margin-bottom: 0mm;
margin-right: 1mm;
/* make the button the whole screen width */
width: 100%;
/* make the text input fit small screens*/
box-sizing: border-box;
}
.checkbox {
width: auto;
}

View File

@ -50,11 +50,24 @@
//#define DEBUG_DISTANT_CHAT
static const uint32_t DISTANT_CHAT_KEEP_ALIVE_TIMEOUT = 6 ; // send keep alive packet so as to avoid tunnel breaks.
#ifdef DEBUG_DISTANT_CHAT
static const uint32_t RS_DISTANT_CHAT_DH_STATUS_UNINITIALIZED = 0x0000 ;
static const uint32_t RS_DISTANT_CHAT_DH_STATUS_HALF_KEY_DONE = 0x0001 ;
static const uint32_t RS_DISTANT_CHAT_DH_STATUS_KEY_AVAILABLE = 0x0002 ;
#include <sys/time.h>
uint32_t msecs_of_day()
{
timeval tv ;
gettimeofday(&tv,NULL) ;
return tv.tv_usec / 1000 ;
}
#define DISTANT_CHAT_DEBUG() std::cerr << time(NULL) << "." << std::setfill('0') << std::setw(3) << msecs_of_day() << " : DISTANT_CHAT : " << __FUNCTION__ << " : "
#endif
//static const uint32_t DISTANT_CHAT_KEEP_ALIVE_TIMEOUT = 6 ; // send keep alive packet so as to avoid tunnel breaks.
//static const uint32_t RS_DISTANT_CHAT_DH_STATUS_UNINITIALIZED = 0x0000 ;
//static const uint32_t RS_DISTANT_CHAT_DH_STATUS_HALF_KEY_DONE = 0x0001 ;
//static const uint32_t RS_DISTANT_CHAT_DH_STATUS_KEY_AVAILABLE = 0x0002 ;
static const uint32_t DISTANT_CHAT_GXS_TUNNEL_SERVICE_ID = 0xa0001 ;
@ -86,7 +99,7 @@ bool DistantChatService::handleOutgoingItem(RsChatItem *item)
}
#ifdef CHAT_DEBUG
std::cerr << "p3ChatService::handleOutgoingItem(): sending to " << item->PeerId() << ": interpreted as a distant chat virtual peer id." << std::endl;
DISTANT_CHAT_DEBUG() << "p3ChatService::handleOutgoingItem(): sending to " << item->PeerId() << ": interpreted as a distant chat virtual peer id." << std::endl;
#endif
uint32_t size = RsChatSerialiser().size(item) ;
@ -98,7 +111,9 @@ bool DistantChatService::handleOutgoingItem(RsChatItem *item)
return false;
}
#ifdef DEBUG_DISTANT_CHAT
std::cerr << " sending: " << RsUtil::BinToHex(mem,size) << std::endl;
DISTANT_CHAT_DEBUG() << " sending: " << RsUtil::BinToHex(mem,size,100) << std::endl;
DISTANT_CHAT_DEBUG() << " size: " << std::dec << size << std::endl;
DISTANT_CHAT_DEBUG() << " hash: " << RsDirUtil::sha1sum(mem,size) << std::endl;
#endif
mGxsTunnels->sendData( RsGxsTunnelId(item->PeerId()),DISTANT_CHAT_GXS_TUNNEL_SERVICE_ID,mem,size);
@ -110,7 +125,7 @@ void DistantChatService::handleRecvChatStatusItem(RsChatStatusItem *cs)
if(cs->flags & RS_CHAT_FLAG_CONNEXION_REFUSED)
{
#ifdef DEBUG_DISTANT_CHAT
std::cerr << "(II) Distant chat: received notification that peer refuses conversation." << std::endl;
DISTANT_CHAT_DEBUG() << "(II) Distant chat: received notification that peer refuses conversation." << std::endl;
#endif
RsServer::notify()->notifyChatStatus(ChatId(DistantChatPeerId(cs->PeerId())),"Connexion refused by distant peer!") ;
}
@ -140,7 +155,7 @@ bool DistantChatService::acceptDataFromPeer(const RsGxsId& gxs_id,const RsGxsTun
if(!res)
{
#ifdef DEBUG_DISTANT_CHAT
std::cerr << "(II) refusing distant chat from peer " << gxs_id << ". Sending a notification back to tunnel " << tunnel_id << std::endl;
DISTANT_CHAT_DEBUG() << "(II) refusing distant chat from peer " << gxs_id << ". Sending a notification back to tunnel " << tunnel_id << std::endl;
#endif
RsChatStatusItem *item = new RsChatStatusItem ;
item->flags = RS_CHAT_FLAG_CONNEXION_REFUSED ;
@ -158,7 +173,11 @@ bool DistantChatService::acceptDataFromPeer(const RsGxsId& gxs_id,const RsGxsTun
return false;
}
std::cerr << " sending: " << RsUtil::BinToHex(mem,size) << std::endl;
#ifdef DEBUG_DISTANT_CHAT
DISTANT_CHAT_DEBUG() << " sending: " << RsUtil::BinToHex(mem,size,100) << std::endl;
DISTANT_CHAT_DEBUG() << " size: " << std::dec << std::endl;
DISTANT_CHAT_DEBUG() << " hash: " << RsDirUtil::sha1sum(mem,size) << std::endl;
#endif
mGxsTunnels->sendData( RsGxsTunnelId(item->PeerId()),DISTANT_CHAT_GXS_TUNNEL_SERVICE_ID,mem,size);
}
@ -169,7 +188,7 @@ bool DistantChatService::acceptDataFromPeer(const RsGxsId& gxs_id,const RsGxsTun
void DistantChatService::notifyTunnelStatus(const RsGxsTunnelService::RsGxsTunnelId &tunnel_id, uint32_t tunnel_status)
{
#ifdef DEBUG_DISTANT_CHAT
std::cerr << "DistantChatService::notifyTunnelStatus(): got notification " << std::hex << tunnel_status << std::dec << " for tunnel " << tunnel_id << std::endl;
DISTANT_CHAT_DEBUG() << "DistantChatService::notifyTunnelStatus(): got notification " << std::hex << tunnel_status << std::dec << " for tunnel " << tunnel_id << std::endl;
#endif
switch(tunnel_status)
@ -195,9 +214,10 @@ void DistantChatService::notifyTunnelStatus(const RsGxsTunnelService::RsGxsTunne
void DistantChatService::receiveData(const RsGxsTunnelService::RsGxsTunnelId &tunnel_id, unsigned char *data, uint32_t data_size)
{
#ifdef DEBUG_DISTANT_CHAT
std::cerr << "DistantChatService::receiveData(): got data of size " << data_size << " for tunnel " << tunnel_id << std::endl;
std::cerr << " received: " << RsUtil::BinToHex(data,data_size) << std::endl;
std::cerr << " deserialising..." << std::endl;
DISTANT_CHAT_DEBUG() << "DistantChatService::receiveData(): got data of size " << std::dec << data_size << " for tunnel " << tunnel_id << std::endl;
DISTANT_CHAT_DEBUG() << " received: " << RsUtil::BinToHex(data,data_size,100) << std::endl;
DISTANT_CHAT_DEBUG() << " hash: " << RsDirUtil::sha1sum(data,data_size) << std::endl;
DISTANT_CHAT_DEBUG() << " deserialising..." << std::endl;
#endif
// always make the contact up to date. This is useful for server side, which doesn't know about the chat until it
@ -243,7 +263,9 @@ void DistantChatService::markDistantChatAsClosed(const DistantChatPeerId& dcpid)
mDistantChatContacts.erase(it) ;
}
bool DistantChatService::initiateDistantChatConnexion(const RsGxsId& to_gxs_id, const RsGxsId& from_gxs_id, DistantChatPeerId& dcpid, uint32_t& error_code)
bool DistantChatService::initiateDistantChatConnexion(
const RsGxsId& to_gxs_id, const RsGxsId& from_gxs_id,
DistantChatPeerId& dcpid, uint32_t& error_code, bool notify )
{
RsGxsTunnelId tunnel_id ;
@ -259,17 +281,19 @@ bool DistantChatService::initiateDistantChatConnexion(const RsGxsId& to_gxs_id,
error_code = RS_DISTANT_CHAT_ERROR_NO_ERROR ;
// Make a self message to raise the chat window
RsChatMsgItem *item = new RsChatMsgItem;
item->message = "[Starting distant chat. Please wait for secure tunnel to be established]" ;
item->chatFlags = RS_CHAT_FLAG_PRIVATE ;
item->sendTime = time(NULL) ;
item->PeerId(RsPeerId(tunnel_id)) ;
handleRecvChatMsgItem(item) ;
delete item ; // item is replaced by NULL if partial, but this is not the case here.
if(notify)
{
// Make a self message to raise the chat window
RsChatMsgItem *item = new RsChatMsgItem;
item->message = "[Starting distant chat. Please wait for secure tunnel";
item->message += " to be established]";
item->chatFlags = RS_CHAT_FLAG_PRIVATE;
item->sendTime = time(NULL);
item->PeerId(RsPeerId(tunnel_id));
handleRecvChatMsgItem(item);
delete item ;
}
return true ;
}
@ -320,7 +344,7 @@ bool DistantChatService::setDistantChatPermissionFlags(uint32_t flags)
{
mDistantChatPermissions = flags ;
#ifdef DEBUG_DISTANT_CHAT
std::cerr << "(II) Changing distant chat permissions to " << flags << ". Existing openned chats will however remain active until closed" << std::endl;
DISTANT_CHAT_DEBUG() << "(II) Changing distant chat permissions to " << flags << ". Existing openned chats will however remain active until closed" << std::endl;
#endif
triggerConfigSave() ;
}
@ -350,7 +374,7 @@ bool DistantChatService::processLoadListItem(const RsItem *item)
if(kit->key == "DISTANT_CHAT_PERMISSION_FLAGS")
{
#ifdef DEBUG_DISTANT_CHAT
std::cerr << "Loaded distant chat permission flags: " << kit->value << std::endl ;
DISTANT_CHAT_DEBUG() << "Loaded distant chat permission flags: " << kit->value << std::endl ;
#endif
if (!kit->value.empty())
{

View File

@ -45,10 +45,15 @@ public:
bool processLoadListItem(const RsItem *item) ;
void addToSaveList(std::list<RsItem*>& list) const;
// Creates the invite if the public key of the distant peer is available.
// Om success, stores the invite in the map above, so that we can respond to tunnel requests.
//
bool initiateDistantChatConnexion(const RsGxsId& to_gxs_id, const RsGxsId &from_gxs_id, DistantChatPeerId& dcpid, uint32_t &error_code) ;
/**
* Creates the invite if the public key of the distant peer is available.
* On success, stores the invite in the map above, so that we can respond
* to tunnel requests. */
bool initiateDistantChatConnexion( const RsGxsId& to_gxs_id,
const RsGxsId &from_gxs_id,
DistantChatPeerId& dcpid,
uint32_t &error_code,
bool notify = true );
bool closeDistantChatConnexion(const DistantChatPeerId &tunnel_id) ;
// Sets flags to only allow connexion from some people.

View File

@ -23,8 +23,9 @@
*
*/
#include <sstream>
#include <iomanip>
#include <math.h>
#include <sstream>
#include <unistd.h>
#include "util/rsprint.h"
@ -54,7 +55,7 @@ static const time_t MIN_DELAY_BETWEEN_PUBLIC_LOBBY_REQ = 20 ; // don't ask fo
static const time_t LOBBY_LIST_AUTO_UPDATE_TIME = 121 ; // regularly ask for available lobbies every 5 minutes, to allow auto-subscribe to work
static const uint32_t MAX_ALLOWED_LOBBIES_IN_LIST_WARNING = 50 ;
static const uint32_t MAX_MESSAGES_PER_SECONDS_NUMBER = 5 ; // max number of messages from a given peer in a window for duration below
//static const uint32_t MAX_MESSAGES_PER_SECONDS_NUMBER = 5 ; // max number of messages from a given peer in a window for duration below
static const uint32_t MAX_MESSAGES_PER_SECONDS_PERIOD = 10 ; // duration window for max number of messages before messages get dropped.
#define IS_PUBLIC_LOBBY(flags) (flags & RS_CHAT_LOBBY_FLAGS_PUBLIC )
@ -535,8 +536,9 @@ void DistributedChatService::handleRecvChatLobbyList(RsChatLobbyListItem *item)
#ifdef DEBUG_CHAT_LOBBIES
std::cerr << " lobby is flagged as autosubscribed. Adding it to subscribe list." << std::endl;
#endif
ChatLobbyId clid = item->lobbies[i].id;
chatLobbyToSubscribe.push_back(clid);
ChatLobbyId clid = item->lobbies[i].id;
if(_chat_lobbys.find(clid) == _chat_lobbys.end())
chatLobbyToSubscribe.push_back(clid);
}
// for subscribed lobbies, check that item->PeerId() is among the participating friends. If not, add him!
@ -554,9 +556,37 @@ void DistributedChatService::handleRecvChatLobbyList(RsChatLobbyListItem *item)
}
}
std::list<ChatLobbyId>::iterator it;
for (it = chatLobbyToSubscribe.begin(); it != chatLobbyToSubscribe.end(); ++it)
joinVisibleChatLobby(*it,_default_identity);
std::list<ChatLobbyId>::iterator it;
for (it = chatLobbyToSubscribe.begin(); it != chatLobbyToSubscribe.end(); ++it)
{
RsGxsId gxsId = _lobby_default_identity[*it];
if (gxsId.isNull())
gxsId = _default_identity;
//Check if gxsId can connect to this lobby
ChatLobbyFlags flags(0);
std::map<ChatLobbyId,VisibleChatLobbyRecord>::const_iterator vlIt = _visible_lobbies.find(*it) ;
if(vlIt != _visible_lobbies.end())
flags = vlIt->second.lobby_flags;
else
{
std::map<ChatLobbyId,ChatLobbyEntry>::const_iterator clIt = _chat_lobbys.find(*it) ;
if(clIt != _chat_lobbys.end())
flags = clIt->second.lobby_flags;
}
RsIdentityDetails idd ;
if(IS_PGP_SIGNED_LOBBY(flags)
&& (!rsIdentity->getIdDetails(gxsId,idd)
|| !(idd.mFlags & RS_IDENTITY_FLAGS_PGP_LINKED)) )
{
std::cerr << "(EE) Attempt to auto-subscribe to signed lobby with non signed Id. Remove it." << std::endl;
setLobbyAutoSubscribe(*it, false);
} else {
joinVisibleChatLobby(*it,gxsId);
}
}
for(std::list<ChatLobbyId>::const_iterator it = invitationNeeded.begin();it!=invitationNeeded.end();++it)
invitePeerToLobby(*it,item->PeerId(),false) ;
@ -1765,13 +1795,18 @@ bool DistributedChatService::setIdentityForChatLobby(const ChatLobbyId& lobby_id
void DistributedChatService::setLobbyAutoSubscribe(const ChatLobbyId& lobby_id, const bool autoSubscribe)
{
if(autoSubscribe)
_known_lobbies_flags[lobby_id] |= RS_CHAT_LOBBY_FLAGS_AUTO_SUBSCRIBE ;
else
if(autoSubscribe){
_known_lobbies_flags[lobby_id] |= RS_CHAT_LOBBY_FLAGS_AUTO_SUBSCRIBE;
RsGxsId gxsId;
if (getIdentityForChatLobby(lobby_id, gxsId))
_lobby_default_identity[lobby_id] = gxsId;
} else {
_known_lobbies_flags[lobby_id] &= ~RS_CHAT_LOBBY_FLAGS_AUTO_SUBSCRIBE ;
_lobby_default_identity.erase(lobby_id);
}
RsServer::notify()->notifyListChange(NOTIFY_LIST_CHAT_LOBBY_LIST, NOTIFY_TYPE_ADD) ;
triggerConfigSave();
triggerConfigSave();
}
bool DistributedChatService::getLobbyAutoSubscribe(const ChatLobbyId& lobby_id)
@ -1891,7 +1926,7 @@ void DistributedChatService::cleanLobbyCaches()
void DistributedChatService::addToSaveList(std::list<RsItem*>& list) const
{
/* Save Lobby Auto Subscribe */
for(std::map<ChatLobbyId,ChatLobbyFlags>::const_iterator it=_known_lobbies_flags.begin();it!=_known_lobbies_flags.end();++it)
for(std::map<ChatLobbyId,ChatLobbyFlags>::const_iterator it=_known_lobbies_flags.begin(); it!=_known_lobbies_flags.end(); ++it)
{
RsChatLobbyConfigItem *clci = new RsChatLobbyConfigItem ;
clci->lobby_Id=it->first;
@ -1899,37 +1934,85 @@ void DistributedChatService::addToSaveList(std::list<RsItem*>& list) const
list.push_back(clci) ;
}
/* Save Default Nick Name */
{
RsConfigKeyValueSet *vitem = new RsConfigKeyValueSet ;
RsTlvKeyValue kv;
kv.key = "DEFAULT_IDENTITY";
kv.value = _default_identity.toStdString();
vitem->tlvkvs.pairs.push_back(kv);
list.push_back(vitem);
}
RsConfigKeyValueSet *vitem = new RsConfigKeyValueSet ;
RsTlvKeyValue kv;
kv.key = "DEFAULT_IDENTITY" ;
kv.value = _default_identity.toStdString() ;
vitem->tlvkvs.pairs.push_back(kv) ;
/* Save Default Nick Name by Lobby*/
for(std::map<ChatLobbyId,RsGxsId>::const_iterator it=_lobby_default_identity.begin(); it!=_lobby_default_identity.end(); ++it)
{
RsConfigKeyValueSet *vitem = new RsConfigKeyValueSet ;
ChatLobbyId cli = it->first;
RsGxsId gxsId = it->second;
std::stringstream stream;
stream << std::setfill ('0') << std::setw(sizeof(ChatLobbyId)*2)
<< std::hex << cli;
std::string strCli( stream.str() );
RsTlvKeyValue kv;
kv.key = "LOBBY_DEFAULT_IDENTITY:"+strCli;
kv.value = gxsId.toStdString();
vitem->tlvkvs.pairs.push_back(kv);
list.push_back(vitem);
}
list.push_back(vitem) ;
}
bool DistributedChatService::processLoadListItem(const RsItem *item)
{
const RsConfigKeyValueSet *vitem = NULL ;
const RsConfigKeyValueSet *vitem = NULL;
const std::string strldID = "LOBBY_DEFAULT_IDENTITY:";
if(NULL != (vitem = dynamic_cast<const RsConfigKeyValueSet*>(item)))
for(std::list<RsTlvKeyValue>::const_iterator kit = vitem->tlvkvs.pairs.begin(); kit != vitem->tlvkvs.pairs.end(); ++kit)
if(kit->key == "DEFAULT_IDENTITY")
{
for(std::list<RsTlvKeyValue>::const_iterator kit = vitem->tlvkvs.pairs.begin(); kit != vitem->tlvkvs.pairs.end(); ++kit)
{
if( kit->key == "DEFAULT_IDENTITY" )
{
#ifdef DEBUG_CHAT_LOBBIES
std::cerr << "Loaded config default nick name for distributed chat: " << kit->value << std::endl ;
std::cerr << "Loaded config default nick name for distributed chat: " << kit->value << std::endl ;
#endif
if (!kit->value.empty())
{
_default_identity = RsGxsId(kit->value) ;
if(_default_identity.isNull())
std::cerr << "ERROR: default identity is malformed." << std::endl;
}
if (!kit->value.empty())
{
_default_identity = RsGxsId(kit->value) ;
if(_default_identity.isNull())
std::cerr << "ERROR: default identity is malformed." << std::endl;
}
return true;
}
return true;
}
if( kit->key.compare(0, strldID.length(), strldID) == 0)
{
#ifdef DEBUG_CHAT_LOBBIES
std::cerr << "Loaded config lobby default nick name: " << kit->key << " " << kit->value << std::endl ;
#endif
std::string strCli = kit->key.substr(strldID.length());
std::stringstream stream;
stream << std::hex << strCli;
ChatLobbyId cli = 0;
stream >> cli;
if (!kit->value.empty() && (cli != 0))
{
RsGxsId gxsId(kit->value);
if (gxsId.isNull())
std::cerr << "ERROR: lobby default identity is malformed." << std::endl;
else
_lobby_default_identity[cli] = gxsId ;
}
return true;
}
}
const RsChatLobbyConfigItem *clci = NULL ;

View File

@ -158,7 +158,8 @@ class DistributedChatService
time_t last_lobby_challenge_time ; // prevents bruteforce attack
time_t last_visible_lobby_info_request_time ; // allows to ask for updates
bool _should_reset_lobby_counts ;
RsGxsId _default_identity ;
RsGxsId _default_identity;
std::map<ChatLobbyId,RsGxsId> _lobby_default_identity;
uint32_t mServType ;
RsMutex mDistributedChatMtx ;

View File

@ -40,6 +40,7 @@
#include "pqi/p3historymgr.h"
#include "rsserver/p3face.h"
#include "services/p3idservice.h"
#include "gxstrans/p3gxstrans.h"
#include "chat/p3chatservice.h"
#include "rsitems/rsconfigitems.h"
@ -53,40 +54,29 @@ static const uint32_t MAX_AVATAR_JPEG_SIZE = 32767; // Maximum size
// don't transfer correctly and can kill the system.
// Images are 96x96, which makes approx. 27000 bytes uncompressed.
p3ChatService::p3ChatService(p3ServiceControl *sc,p3IdService *pids, p3LinkMgr *lm, p3HistoryMgr *historyMgr)
: DistributedChatService(getServiceInfo().mServiceType,sc,historyMgr,pids), mChatMtx("p3ChatService"),mServiceCtrl(sc), mLinkMgr(lm) , mHistoryMgr(historyMgr)
p3ChatService::p3ChatService( p3ServiceControl *sc, p3IdService *pids,
p3LinkMgr *lm, p3HistoryMgr *historyMgr,
p3GxsTrans& gxsTransService ) :
DistributedChatService(getServiceInfo().mServiceType, sc, historyMgr,pids),
mChatMtx("p3ChatService"), mServiceCtrl(sc), mLinkMgr(lm),
mHistoryMgr(historyMgr), _own_avatar(NULL),
_serializer(new RsChatSerialiser()),
mDGMutex("p3ChatService distant id - gxs id map mutex"),
mGxsTransport(gxsTransService)
{
_serializer = new RsChatSerialiser() ;
_own_avatar = NULL ;
_custom_status_string = "" ;
addSerialType(_serializer) ;
addSerialType(_serializer);
mGxsTransport.registerGxsTransClient( GxsTransSubServices::P3_CHAT_SERVICE,
this );
}
const std::string CHAT_APP_NAME = "chat";
const uint16_t CHAT_APP_MAJOR_VERSION = 1;
const uint16_t CHAT_APP_MINOR_VERSION = 0;
const uint16_t CHAT_MIN_MAJOR_VERSION = 1;
const uint16_t CHAT_MIN_MINOR_VERSION = 0;
RsServiceInfo p3ChatService::getServiceInfo()
{
return RsServiceInfo(RS_SERVICE_TYPE_CHAT,
CHAT_APP_NAME,
CHAT_APP_MAJOR_VERSION,
CHAT_APP_MINOR_VERSION,
CHAT_MIN_MAJOR_VERSION,
CHAT_MIN_MINOR_VERSION);
}
{ return RsServiceInfo(RS_SERVICE_TYPE_CHAT, "chat", 1, 0, 1, 0); }
int p3ChatService::tick()
{
if(receivedItems())
receiveChatQueue();
if(receivedItems()) receiveChatQueue();
DistributedChatService::flush() ;
//DistantChatService::flush() ;
DistributedChatService::flush();
return 0;
}
@ -156,7 +146,7 @@ class p3ChatService::AvatarInfo
~AvatarInfo()
{
delete[] _image_data ;
free( _image_data );
_image_data = NULL ;
_image_size = 0 ;
}
@ -169,7 +159,7 @@ class p3ChatService::AvatarInfo
void init(const unsigned char *jpeg_data,int size)
{
_image_size = size ;
_image_data = new unsigned char[size] ;
_image_data = (unsigned char*)rs_malloc(size) ;
memcpy(_image_data,jpeg_data,size) ;
}
AvatarInfo(const unsigned char *jpeg_data,int size)
@ -179,7 +169,13 @@ class p3ChatService::AvatarInfo
void toUnsignedChar(unsigned char *& data,uint32_t& size) const
{
data = new unsigned char[_image_size] ;
if(_image_size == 0)
{
size = 0 ;
data = NULL ;
return ;
}
data = (unsigned char *)rs_malloc(_image_size) ;
size = _image_size ;
memcpy(data,_image_data,size*sizeof(unsigned char)) ;
}
@ -213,37 +209,38 @@ void p3ChatService::sendGroupChatStatusString(const std::string& status_string)
}
}
void p3ChatService::sendStatusString(const ChatId& id , const std::string& status_string)
void p3ChatService::sendStatusString( const ChatId& id,
const std::string& status_string )
{
if(id.isLobbyId())
sendLobbyStatusString(id.toLobbyId(),status_string) ;
else if(id.isBroadcast())
sendGroupChatStatusString(status_string);
else if(id.isPeerId() || id.isDistantChatId())
{
RsChatStatusItem *cs = new RsChatStatusItem ;
if(id.isLobbyId()) sendLobbyStatusString(id.toLobbyId(),status_string);
else if(id.isBroadcast()) sendGroupChatStatusString(status_string);
else if(id.isPeerId() || id.isDistantChatId())
{
RsPeerId vpid;
if(id.isDistantChatId()) vpid = RsPeerId(id.toDistantChatId());
else vpid = id.toPeerId();
cs->status_string = status_string ;
cs->flags = RS_CHAT_FLAG_PRIVATE ;
RsPeerId vpid;
if(id.isDistantChatId())
vpid = RsPeerId(id.toDistantChatId());
else
vpid = id.toPeerId();
cs->PeerId(vpid);
if(isOnline(vpid))
{
RsChatStatusItem *cs = new RsChatStatusItem;
cs->status_string = status_string;
cs->flags = RS_CHAT_FLAG_PRIVATE;
cs->PeerId(vpid);
#ifdef CHAT_DEBUG
std::cerr << "sending chat status packet:" << std::endl ;
cs->print(std::cerr) ;
std::cerr << "sending chat status packet:" << std::endl;
cs->print(std::cerr);
#endif
sendChatItem(cs);
}
else
{
std::cerr << "p3ChatService::sendStatusString() Error: chat id of this type is not handled, is it empty?" << std::endl;
return;
}
sendChatItem(cs);
}
}
else
{
std::cerr << "p3ChatService::sendStatusString() Error: chat id of this "
<< "type is not handled, is it empty?" << std::endl;
return;
}
}
void p3ChatService::clearChatLobby(const ChatId& id)
@ -253,12 +250,12 @@ void p3ChatService::clearChatLobby(const ChatId& id)
void p3ChatService::sendChatItem(RsChatItem *item)
{
if(DistantChatService::handleOutgoingItem(item))
return ;
if(DistantChatService::handleOutgoingItem(item)) return;
#ifdef CHAT_DEBUG
std::cerr << "p3ChatService::sendChatItem(): sending to " << item->PeerId() << ": interpreted as friend peer id." << std::endl;
std::cerr << "p3ChatService::sendChatItem(): sending to " << item->PeerId()
<< ": interpreted as friend peer id." << std::endl;
#endif
sendItem(item) ;
sendItem(item);
}
void p3ChatService::checkSizeAndSendMessage(RsChatMsgItem *msg)
@ -267,6 +264,10 @@ void p3ChatService::checkSizeAndSendMessage(RsChatMsgItem *msg)
static const uint32_t MAX_STRING_SIZE = 15000 ;
#ifdef CHAT_DEBUG
std::cerr << "Sending message: size=" << msg->message.size() << ", sha1sum=" << RsDirUtil::sha1sum((uint8_t*)msg->message.c_str(),msg->message.size()) << std::endl;
#endif
while(msg->message.size() > MAX_STRING_SIZE)
{
// chop off the first 15000 wchars
@ -281,11 +282,17 @@ void p3ChatService::checkSizeAndSendMessage(RsChatMsgItem *msg)
//
item->chatFlags &= (RS_CHAT_FLAG_PRIVATE | RS_CHAT_FLAG_PUBLIC | RS_CHAT_FLAG_LOBBY) ;
#ifdef CHAT_DEBUG
std::cerr << "Creating slice of size " << item->message.size() << std::endl;
#endif
// Indicate that the message is to be continued.
//
item->chatFlags |= RS_CHAT_FLAG_PARTIAL_MESSAGE ;
sendChatItem(item) ;
}
#ifdef CHAT_DEBUG
std::cerr << "Creating slice of size " << msg->message.size() << std::endl;
#endif
sendChatItem(msg) ;
}
@ -336,28 +343,50 @@ bool p3ChatService::sendChat(ChatId destination, std::string msg)
message.incoming = false;
message.online = true;
if(!isOnline(vpid))
if(!isOnline(vpid))
{
/* peer is offline, add to outgoing list */
message.online = false;
RsServer::notify()->notifyChatMessage(message);
// use the history to load pending messages to the gui
// this is not very nice, because the user may think the message was send, while it is still in the queue
mHistoryMgr->addMessage(message);
RsGxsTransId tId = RSRandom::random_u64();
if(destination.isDistantChatId())
{
RS_STACK_MUTEX(mChatMtx);
privateOutgoingList.push_back(ci);
RS_STACK_MUTEX(mDGMutex);
DIDEMap::const_iterator it =
mDistantGxsMap.find(destination.toDistantChatId());
if(it != mDistantGxsMap.end())
{
const DistantEndpoints& de(it->second);
uint32_t sz = _serializer->size(ci);
std::vector<uint8_t> data; data.resize(sz);
_serializer->serialise(ci, &data[0], &sz);
mGxsTransport.sendData(tId, GxsTransSubServices::P3_CHAT_SERVICE,
de.from, de.to, &data[0], sz);
}
else
std::cout << "p3ChatService::sendChat(...) can't find distant"
<< "chat id in mDistantGxsMap this is unxpected!"
<< std::endl;
}
message.online = false;
RsServer::notify()->notifyChatMessage(message);
// peer is offline, add to outgoing list
{
RS_STACK_MUTEX(mChatMtx);
privateOutgoingMap.insert(outMP::value_type(tId, ci));
}
// use the history to load pending messages to the gui
// this is not very nice, because the user may think the message was send, while it is still in the queue
mHistoryMgr->addMessage(message);
IndicateConfigChanged();
return false;
}
IndicateConfigChanged();
return false;
}
{
RsStackMutex stack(mChatMtx); /********** STACK LOCKED MTX ******/
std::map<RsPeerId,AvatarInfo*>::iterator it = _avatars.find(vpid) ;
{
RS_STACK_MUTEX(mChatMtx);
std::map<RsPeerId,AvatarInfo*>::iterator it = _avatars.find(vpid);
if(it == _avatars.end())
{
@ -367,7 +396,7 @@ bool p3ChatService::sendChat(ChatId destination, std::string msg)
if(it->second->_own_is_new)
{
#ifdef CHAT_DEBUG
std::cerr << "p3ChatService::sendChat: new avatar never sent to peer " << id << ". Setting <new> flag to packet." << std::endl;
std::cerr << "p3ChatService::sendChat: new avatar never sent to peer " << vpid << ". Setting <new> flag to packet." << std::endl;
#endif
ci->chatFlags |= RS_CHAT_FLAG_AVATAR_AVAILABLE ;
@ -376,7 +405,7 @@ bool p3ChatService::sendChat(ChatId destination, std::string msg)
}
#ifdef CHAT_DEBUG
std::cerr << "Sending msg to (maybe virtual) peer " << id << ", flags = " << ci->chatFlags << std::endl ;
std::cerr << "Sending msg to (maybe virtual) peer " << vpid << ", flags = " << ci->chatFlags << std::endl ;
std::cerr << "p3ChatService::sendChat() Item:";
std::cerr << std::endl;
ci->print(std::cerr);
@ -416,7 +445,7 @@ bool p3ChatService::sendChat(ChatId destination, std::string msg)
if(should_send_state_string)
{
#ifdef CHAT_DEBUG
std::cerr << "own status string is new for peer " << id << ": sending it." << std::endl ;
std::cerr << "own status string is new for peer " << vpid << ": sending it." << std::endl ;
#endif
RsChatStatusItem *cs = makeOwnCustomStateStringItem() ;
cs->PeerId(vpid) ;
@ -474,7 +503,7 @@ bool p3ChatService::locked_checkAndRebuildPartialMessage(RsChatMsgItem *& ci)
else
{
#ifdef CHAT_DEBUG
std::cerr << "Message is complete, using it now." << std::endl;
std::cerr << "Message is complete, using it now. Size = " << ci->message.size() << ", hash=" << RsDirUtil::sha1sum((uint8_t*)ci->message.c_str(),ci->message.size()) << std::endl;
#endif
return true ;
}
@ -505,50 +534,50 @@ class MsgCounter
void p3ChatService::handleIncomingItem(RsItem *item)
{
#ifdef CHAT_DEBUG
std::cerr << "p3ChatService::receiveChatQueue() Item:" << (void*)item << std::endl ;
std::cerr << "p3ChatService::receiveChatQueue() Item:" << (void*)item
<< std::endl ;
#endif
// RsChatMsgItems needs dynamic_cast, since they have derived siblings.
//
RsChatMsgItem *ci = dynamic_cast<RsChatMsgItem*>(item) ;
if(ci != NULL)
RsChatMsgItem* ci = dynamic_cast<RsChatMsgItem*>(item);
if(ci)
{
handleRecvChatMsgItem(ci);
if(ci)
delete ci ;
return ; // don't delete! It's handled by handleRecvChatMsgItem in some specific cases only.
/* +ci+ deletion is handled by handleRecvChatMsgItem ONLY in some
* specific cases, in case +ci+ has not been handled deleted it here */
delete ci ;
return;
}
// if(DistantChatService::handleRecvItem(dynamic_cast<RsChatItem*>(item)))
// {
// delete item ;
// return ;
// }
if(DistributedChatService::handleRecvItem(dynamic_cast<RsChatItem*>(item)))
if(DistributedChatService::handleRecvItem(dynamic_cast<RsChatItem*>(item)))
{
delete item ;
return ;
delete item;
return;
}
switch(item->PacketSubType())
{
case RS_PKT_SUBTYPE_CHAT_STATUS: handleRecvChatStatusItem(dynamic_cast<RsChatStatusItem*>(item)) ; break ;
case RS_PKT_SUBTYPE_CHAT_AVATAR: handleRecvChatAvatarItem(dynamic_cast<RsChatAvatarItem*>(item)) ; break ;
default:
{
static int already = false ;
if(!already)
{
std::cerr << "Unhandled item subtype " << (int)item->PacketSubType() << " in p3ChatService: " << std::endl;
already = true ;
}
}
case RS_PKT_SUBTYPE_CHAT_STATUS:
handleRecvChatStatusItem(dynamic_cast<RsChatStatusItem*>(item));
break;
case RS_PKT_SUBTYPE_CHAT_AVATAR:
handleRecvChatAvatarItem(dynamic_cast<RsChatAvatarItem*>(item));
break;
default:
{
static int already = false;
if(!already)
{
std::cerr << "Unhandled item subtype "
<< static_cast<int>(item->PacketSubType())
<< " in p3ChatService: " << std::endl;
already = true;
}
}
delete item ;
}
delete item;
}
void p3ChatService::handleRecvChatAvatarItem(RsChatAvatarItem *ca)
@ -676,35 +705,103 @@ bool p3ChatService::checkForMessageSecurity(RsChatMsgItem *ci)
return true ;
}
bool p3ChatService::initiateDistantChatConnexion( const RsGxsId& to_gxs_id,
const RsGxsId& from_gxs_id,
DistantChatPeerId& pid,
uint32_t& error_code,
bool notify )
{
if(DistantChatService::initiateDistantChatConnexion( to_gxs_id,
from_gxs_id, pid,
error_code, notify ))
{
RS_STACK_MUTEX(mDGMutex);
DistantEndpoints ep; ep.from = from_gxs_id; ep.to = to_gxs_id;
mDistantGxsMap.insert(DIDEMap::value_type(pid, ep));
return true;
}
return false;
}
bool p3ChatService::receiveGxsTransMail( const RsGxsId& authorId,
const RsGxsId& recipientId,
const uint8_t* data,
uint32_t dataSize )
{
DistantChatPeerId pid;
uint32_t error_code;
if(initiateDistantChatConnexion(
authorId, recipientId, pid, error_code, false ))
{
RsChatMsgItem* item = static_cast<RsChatMsgItem*>(
_serializer->deserialise(
const_cast<uint8_t*>(data), &dataSize ));
RsPeerId rd(p3GxsTunnelService::makeGxsTunnelId(authorId, recipientId));
item->PeerId(rd);
handleRecvChatMsgItem(item);
delete item;
return true;
}
std::cerr << __PRETTY_FUNCTION__ << " (EE) failed initiating"
<< " distant chat connection error: "<< error_code
<< std::endl;
return false;
}
bool p3ChatService::notifyGxsTransSendStatus(RsGxsTransId mailId,
GxsTransSendStatus status )
{
if ( status != GxsTransSendStatus::RECEIPT_RECEIVED ) return true;
bool changed = false;
{
RS_STACK_MUTEX(mChatMtx);
auto it = privateOutgoingMap.find(mailId);
if( it != privateOutgoingMap.end() )
{
privateOutgoingMap.erase(it);
changed = true;
}
}
if(changed)
{
RsServer::notify()->notifyListChange(
NOTIFY_LIST_PRIVATE_OUTGOING_CHAT, NOTIFY_TYPE_DEL );
IndicateConfigChanged();
}
return true;
}
bool p3ChatService::handleRecvChatMsgItem(RsChatMsgItem *& ci)
{
time_t now = time(NULL);
std::string name;
uint32_t popupChatFlag = RS_POPUP_CHAT;
uint32_t popupChatFlag = RS_POPUP_CHAT;
{
RsStackMutex stack(mChatMtx); /********** STACK LOCKED MTX ******/
{
RS_STACK_MUTEX(mChatMtx);
if(!locked_checkAndRebuildPartialMessage(ci)) // we make sure this call does not take control over the memory
return true ; // message is a subpart of an existing message. So everything ok, but we need to return.
}
// we make sure this call does not take control over the memory
if(!locked_checkAndRebuildPartialMessage(ci)) return true;
/* message is a subpart of an existing message.
* So everything ok, but we need to return. */
}
// Check for security. This avoids bombing messages, and so on.
// Check for security. This avoids bombing messages, and so on.
if(!checkForMessageSecurity(ci)) return false;
if(!checkForMessageSecurity(ci))
return false ;
// If it's a lobby item, we need to bounce it and possibly check for timings etc.
if(!DistributedChatService::handleRecvChatLobbyMsgItem(ci))
return false ;
/* If it's a lobby item, we need to bounce it and possibly check for timings
* etc. */
if(!DistributedChatService::handleRecvChatLobbyMsgItem(ci)) return false;
#ifdef CHAT_DEBUG
std::cerr << "p3ChatService::receiveChatQueue() Item:";
std::cerr << std::endl;
std::cerr << "p3ChatService::receiveChatQueue() Item:" << std::endl;
ci->print(std::cerr);
std::cerr << std::endl;
std::cerr << "Got msg. Flags = " << ci->chatFlags << std::endl ;
std::cerr << std::endl << "Got msg. Flags = " << ci->chatFlags << std::endl;
#endif
// Now treat normal chat stuff such as avatar requests, except for chat lobbies.
@ -759,7 +856,7 @@ bool p3ChatService::handleRecvChatMsgItem(RsChatMsgItem *& ci)
}
}
ci->recvTime = now;
ci->recvTime = time(NULL);
ChatMessage cm;
initChatMessage(ci, cm);
@ -1087,6 +1184,7 @@ RsChatStatusItem *p3ChatService::makeOwnCustomStateStringItem()
return ci ;
}
RsChatAvatarItem *p3ChatService::makeOwnAvatarItem()
{
RsStackMutex stack(mChatMtx); /********** STACK LOCKED MTX ******/
@ -1100,11 +1198,11 @@ RsChatAvatarItem *p3ChatService::makeOwnAvatarItem()
void p3ChatService::sendAvatarJpegData(const RsPeerId& peer_id)
{
#ifdef CHAT_DEBUG
std::cerr << "p3chatservice: sending requested for peer " << peer_id << ", data=" << (void*)_own_avatar << std::endl ;
#endif
#ifdef CHAT_DEBUG
std::cerr << "p3chatservice: sending requested for peer " << peer_id << ", data=" << (void*)_own_avatar << std::endl ;
#endif
if(_own_avatar != NULL)
if(_own_avatar != NULL)
{
RsChatAvatarItem *ci = makeOwnAvatarItem();
ci->PeerId(peer_id);
@ -1144,19 +1242,34 @@ bool p3ChatService::loadList(std::list<RsItem*>& load)
for(std::list<RsItem*>::const_iterator it(load.begin());it!=load.end();++it)
{
if(PrivateOugoingMapItem* om=dynamic_cast<PrivateOugoingMapItem*>(*it))
{
RS_STACK_MUTEX(mChatMtx);
for( auto& pair : om->store )
{
privateOutgoingMap.insert(
outMP::value_type(pair.first,
new RsChatMsgItem(pair.second)) );
}
delete om; continue;
}
RsChatAvatarItem *ai = NULL ;
if(NULL != (ai = dynamic_cast<RsChatAvatarItem *>(*it)))
{
RsStackMutex stack(mChatMtx); /********** STACK LOCKED MTX ******/
RS_STACK_MUTEX(mChatMtx);
if(ai->image_size <= MAX_AVATAR_JPEG_SIZE)
_own_avatar = new AvatarInfo(ai->image_data,ai->image_size) ;
else
std::cerr << "Dropping avatar image, because its size is " << ai->image_size << ", and the maximum allowed size is " << MAX_AVATAR_JPEG_SIZE << std::endl;
std::cerr << "Dropping avatar image, because its size is "
<< ai->image_size << ", and the maximum allowed size "
<< "is " << MAX_AVATAR_JPEG_SIZE << std::endl;
delete *it;
continue;
}
@ -1164,40 +1277,42 @@ bool p3ChatService::loadList(std::list<RsItem*>& load)
if(NULL != (mitem = dynamic_cast<RsChatStatusItem *>(*it)))
{
RsStackMutex stack(mChatMtx); /********** STACK LOCKED MTX ******/
RS_STACK_MUTEX(mChatMtx);
_custom_status_string = mitem->status_string ;
delete *it;
continue;
}
RsPrivateChatMsgConfigItem *citem = NULL ;
if(NULL != (citem = dynamic_cast<RsPrivateChatMsgConfigItem *>(*it)))
/* TODO: G10h4ck 2017/02/27 this block is kept for retrocompatibility,
* and will be used just first time, to load messages in the old format
* should be removed in the following RS version */
if( RsPrivateChatMsgConfigItem *citem =
dynamic_cast<RsPrivateChatMsgConfigItem *>(*it) )
{
RsStackMutex stack(mChatMtx); /********** STACK LOCKED MTX ******/
RS_STACK_MUTEX(mChatMtx);
if (citem->chatFlags & RS_CHAT_FLAG_PRIVATE) {
if (std::find(ssl_peers.begin(), ssl_peers.end(), citem->configPeerId) != ssl_peers.end()) {
if ( citem->chatFlags & RS_CHAT_FLAG_PRIVATE )
{
if ( std::find(ssl_peers.begin(), ssl_peers.end(),
citem->configPeerId) != ssl_peers.end() )
{
RsChatMsgItem *ci = new RsChatMsgItem();
citem->get(ci);
if (citem->configFlags & RS_CHATMSG_CONFIGFLAG_INCOMING) {
if (citem->configFlags & RS_CHATMSG_CONFIGFLAG_INCOMING)
{
locked_storeIncomingMsg(ci);
} else {
privateOutgoingList.push_back(ci);
}
} else {
// no friends
else privateOutgoingMap.insert(
outMP::value_type(RSRandom::random_u64(), ci) );
}
} else {
// ignore all other items
else { /* no friends */ }
}
else { /* ignore all other items */ }
delete *it;
continue;
}
@ -1228,21 +1343,18 @@ bool p3ChatService::saveList(bool& cleanup, std::list<RsItem*>& list)
mChatMtx.lock(); /****** MUTEX LOCKED *******/
PrivateOugoingMapItem* om = new PrivateOugoingMapItem;
typedef std::map<uint64_t, RsChatMsgItem>::value_type vT;
for( auto& pair : privateOutgoingMap )
om->store.insert(vT(pair.first, *pair.second));
list.push_back(om);
RsChatStatusItem *di = new RsChatStatusItem ;
di->status_string = _custom_status_string ;
di->flags = RS_CHAT_FLAG_CUSTOM_STATE ;
list.push_back(di) ;
/* save outgoing private chat messages */
std::list<RsChatMsgItem *>::iterator it;
for (it = privateOutgoingList.begin(); it != privateOutgoingList.end(); it++) {
RsPrivateChatMsgConfigItem *ci = new RsPrivateChatMsgConfigItem;
ci->set(*it, (*it)->PeerId(), 0);
list.push_back(ci);
}
list.push_back(di);
DistributedChatService::addToSaveList(list) ;
DistantChatService::addToSaveList(list) ;
@ -1269,54 +1381,51 @@ RsSerialiser *p3ChatService::setupSerialiser()
void p3ChatService::statusChange(const std::list<pqiServicePeer> &plist)
{
std::list<pqiServicePeer>::const_iterator it;
for (it = plist.begin(); it != plist.end(); ++it) {
for (auto it = plist.cbegin(); it != plist.cend(); ++it)
{
if (it->actions & RS_SERVICE_PEER_CONNECTED)
{
/* send the saved outgoing messages */
bool changed = false;
std::vector<RsChatMsgItem*> to_send ;
std::vector<RsChatMsgItem*> to_send;
if (privateOutgoingList.size())
{
RsStackMutex stack(mChatMtx); /********** STACK LOCKED MTX ******/
RS_STACK_MUTEX(mChatMtx);
RsPeerId ownId = mServiceCtrl->getOwnId();
std::list<RsChatMsgItem *>::iterator cit = privateOutgoingList.begin();
while (cit != privateOutgoingList.end()) {
RsChatMsgItem *c = *cit;
if (c->PeerId() == it->id) {
//mHistoryMgr->addMessage(false, c->PeerId(), ownId, c);
for( auto cit = privateOutgoingMap.begin();
cit != privateOutgoingMap.end(); )
{
RsChatMsgItem *c = cit->second;
if (c->PeerId() == it->id)
{
//mHistoryMgr->addMessage(false, c->PeerId(), ownId, c);
to_send.push_back(c) ;
changed = true;
cit = privateOutgoingList.erase(cit);
cit = privateOutgoingMap.erase(cit);
continue;
}
++cit;
}
} /* UNLOCKED */
}
for(uint32_t i=0;i<to_send.size();++i)
{
ChatMessage message;
initChatMessage(to_send[i], message);
message.incoming = false;
message.online = true;
RsServer::notify()->notifyChatMessage(message);
for(auto toIt = to_send.begin(); toIt != to_send.end(); ++toIt)
{
ChatMessage message;
initChatMessage(*toIt, message);
message.incoming = false;
message.online = true;
RsServer::notify()->notifyChatMessage(message);
checkSizeAndSendMessage(to_send[i]); // delete item
}
checkSizeAndSendMessage(*toIt); // delete item
}
if (changed) {
RsServer::notify()->notifyListChange(NOTIFY_LIST_PRIVATE_OUTGOING_CHAT, NOTIFY_TYPE_DEL);
if (changed)
{
RsServer::notify()->notifyListChange(
NOTIFY_LIST_PRIVATE_OUTGOING_CHAT, NOTIFY_TYPE_DEL);
IndicateConfigChanged();
}
@ -1324,18 +1433,17 @@ void p3ChatService::statusChange(const std::list<pqiServicePeer> &plist)
else if (it->actions & RS_SERVICE_PEER_REMOVED)
{
/* now handle remove */
mHistoryMgr->clear(ChatId(it->id));
mHistoryMgr->clear(ChatId(it->id));
std::list<RsChatMsgItem *>::iterator cit = privateOutgoingList.begin();
while (cit != privateOutgoingList.end()) {
RsChatMsgItem *c = *cit;
if (c->PeerId() == it->id) {
cit = privateOutgoingList.erase(cit);
continue;
}
++cit;
}
IndicateConfigChanged();
RS_STACK_MUTEX(mChatMtx);
for ( auto cit = privateOutgoingMap.begin();
cit != privateOutgoingMap.end(); )
{
RsChatMsgItem *c = cit->second;
if (c->PeerId() == it->id) cit = privateOutgoingMap.erase(cit);
else ++cit;
}
IndicateConfigChanged();
}
}
}

View File

@ -37,6 +37,8 @@
#include "chat/distantchat.h"
#include "chat/distributedchat.h"
#include "retroshare/rsmsgs.h"
#include "gxstrans/p3gxstrans.h"
#include "util/rsdeprecate.h"
class p3ServiceControl;
class p3LinkMgr;
@ -51,10 +53,13 @@ typedef RsPeerId ChatLobbyVirtualPeerId ;
* This service uses rsnotify (callbacks librs clients (e.g. rs-gui))
* @see NotifyBase
*/
class p3ChatService: public p3Service, public DistantChatService, public DistributedChatService, public p3Config, public pqiServiceMonitor
class p3ChatService :
public p3Service, public DistantChatService, public DistributedChatService, public p3Config,
public pqiServiceMonitor, GxsTransClient
{
public:
p3ChatService(p3ServiceControl *cs, p3IdService *pids,p3LinkMgr *cm, p3HistoryMgr *historyMgr);
p3ChatService(p3ServiceControl *cs, p3IdService *pids, p3LinkMgr *cm,
p3HistoryMgr *historyMgr, p3GxsTrans& gxsTransService );
virtual RsServiceInfo getServiceInfo();
@ -66,7 +71,7 @@ public:
* : notifyCustomState, notifyChatStatus, notifyPeerHasNewAvatar
* @see NotifyBase
*/
virtual int tick();
virtual int tick();
/*************** pqiMonitor callback ***********************/
virtual void statusChange(const std::list<pqiServicePeer> &plist);
@ -91,11 +96,11 @@ public:
*/
bool sendPrivateChat(const RsPeerId &id, const std::string &msg);
/*!
* can be used to send 'immediate' status msgs, these status updates are meant for immediate use by peer (not saved by rs)
* e.g currently used to update user when a peer 'is typing' during a chat
*/
void sendStatusString(const ChatId& id,const std::string& status_str) ;
/**
* can be used to send 'immediate' status msgs, these status updates are
* meant for immediate use by peer (not saved by rs) e.g currently used to
* update user when a peer 'is typing' during a chat */
void sendStatusString( const ChatId& id, const std::string& status_str );
/**
* @brief clearChatLobby: Signal chat was cleared by GUI.
@ -161,6 +166,22 @@ public:
*/
bool clearPrivateChatQueue(bool incoming, const RsPeerId &id);
virtual bool initiateDistantChatConnexion( const RsGxsId& to_gxs_id,
const RsGxsId& from_gxs_id,
DistantChatPeerId &pid,
uint32_t& error_code,
bool notify = true );
/// @see GxsTransClient::receiveGxsTransMail(...)
virtual bool receiveGxsTransMail( const RsGxsId& authorId,
const RsGxsId& recipientId,
const uint8_t* data, uint32_t dataSize );
/// @see GxsTransClient::notifySendMailStatus(...)
virtual bool notifyGxsTransSendStatus( RsGxsTransId mailId,
GxsTransSendStatus status );
protected:
/************* from p3Config *******************/
virtual RsSerialiser *setupSerialiser() ;
@ -177,8 +198,9 @@ protected:
/// This is to be used by subclasses/parents to call IndicateConfigChanged()
virtual void triggerConfigSave() { IndicateConfigChanged() ; }
/// Same, for storing messages in incoming list
virtual void locked_storeIncomingMsg(RsChatMsgItem *) ;
RS_DEPRECATED virtual void locked_storeIncomingMsg(RsChatMsgItem *) ;
private:
RsMutex mChatMtx;
@ -231,16 +253,25 @@ private:
p3LinkMgr *mLinkMgr;
p3HistoryMgr *mHistoryMgr;
std::list<RsChatMsgItem *> privateOutgoingList; // messages waiting to be send when peer comes online
/// messages waiting to be send when peer comes online
typedef std::map<uint64_t, RsChatMsgItem *> outMP;
outMP privateOutgoingMap;
AvatarInfo *_own_avatar ;
std::map<RsPeerId,AvatarInfo *> _avatars ;
std::map<RsPeerId,RsChatMsgItem *> _pendingPartialMessages ;
std::map<RsPeerId,RsChatMsgItem *> _pendingPartialMessages;
std::string _custom_status_string ;
std::map<RsPeerId,StateStringInfo> _state_strings ;
RsChatSerialiser *_serializer ;
RsChatSerialiser *_serializer;
struct DistantEndpoints { RsGxsId from; RsGxsId to; };
typedef std::map<DistantChatPeerId, DistantEndpoints> DIDEMap;
DIDEMap mDistantGxsMap;
RsMutex mDGMutex;
p3GxsTrans& mGxsTransport;
};
class p3ChatService::StateStringInfo

View File

@ -35,31 +35,31 @@
//#define CHAT_DEBUG 1
static const uint32_t RS_CHAT_SERIALIZER_FLAGS_NO_SIGNATURE = 0x0001;
//static const uint32_t RS_CHAT_SERIALIZER_FLAGS_NO_SIGNATURE = 0x0001;
RsItem *RsChatSerialiser::create_item(uint16_t service_id,uint8_t item_sub_id) const
{
if (service_id != RS_SERVICE_TYPE_CHAT)
return NULL;
if(service_id != RS_SERVICE_TYPE_CHAT) return NULL;
switch(item_sub_id)
{
case RS_PKT_SUBTYPE_DEFAULT: return new RsChatMsgItem() ;
case RS_PKT_SUBTYPE_PRIVATECHATMSG_CONFIG: return new RsPrivateChatMsgConfigItem() ;
case RS_PKT_SUBTYPE_CHAT_STATUS: return new RsChatStatusItem() ;
case RS_PKT_SUBTYPE_CHAT_AVATAR: return new RsChatAvatarItem() ;
case RS_PKT_SUBTYPE_CHAT_LOBBY_SIGNED_MSG: return new RsChatLobbyMsgItem() ;
case RS_PKT_SUBTYPE_CHAT_LOBBY_INVITE_DEPRECATED: return new RsChatLobbyInviteItem_Deprecated() ; // to be removed (deprecated since May 2017)
case RS_PKT_SUBTYPE_CHAT_LOBBY_INVITE: return new RsChatLobbyInviteItem() ;
case RS_PKT_SUBTYPE_CHAT_LOBBY_CHALLENGE: return new RsChatLobbyConnectChallengeItem() ;
case RS_PKT_SUBTYPE_CHAT_LOBBY_UNSUBSCRIBE: return new RsChatLobbyUnsubscribeItem() ;
case RS_PKT_SUBTYPE_CHAT_LOBBY_SIGNED_EVENT: return new RsChatLobbyEventItem() ;
case RS_PKT_SUBTYPE_CHAT_LOBBY_LIST_REQUEST: return new RsChatLobbyListRequestItem() ;
case RS_PKT_SUBTYPE_CHAT_LOBBY_LIST: return new RsChatLobbyListItem() ;
case RS_PKT_SUBTYPE_CHAT_LOBBY_CONFIG: return new RsChatLobbyConfigItem() ;
default:
std::cerr << "Unknown packet type in chat!" << std::endl ;
return NULL ;
case RS_PKT_SUBTYPE_DEFAULT: return new RsChatMsgItem();
case RS_PKT_SUBTYPE_PRIVATECHATMSG_CONFIG: return new RsPrivateChatMsgConfigItem();
case RS_PKT_SUBTYPE_CHAT_STATUS: return new RsChatStatusItem();
case RS_PKT_SUBTYPE_CHAT_AVATAR: return new RsChatAvatarItem();
case RS_PKT_SUBTYPE_CHAT_LOBBY_SIGNED_MSG: return new RsChatLobbyMsgItem();
case RS_PKT_SUBTYPE_CHAT_LOBBY_INVITE: return new RsChatLobbyInviteItem();
case RS_PKT_SUBTYPE_CHAT_LOBBY_INVITE_DEPRECATED: return new RsChatLobbyInviteItem_Deprecated(); // to be removed (deprecated since May 2017)
case RS_PKT_SUBTYPE_CHAT_LOBBY_CHALLENGE: return new RsChatLobbyConnectChallengeItem();
case RS_PKT_SUBTYPE_CHAT_LOBBY_UNSUBSCRIBE: return new RsChatLobbyUnsubscribeItem();
case RS_PKT_SUBTYPE_CHAT_LOBBY_SIGNED_EVENT: return new RsChatLobbyEventItem();
case RS_PKT_SUBTYPE_CHAT_LOBBY_LIST_REQUEST: return new RsChatLobbyListRequestItem();
case RS_PKT_SUBTYPE_CHAT_LOBBY_LIST: return new RsChatLobbyListItem();
case RS_PKT_SUBTYPE_CHAT_LOBBY_CONFIG: return new RsChatLobbyConfigItem();
case RS_PKT_SUBTYPE_OUTGOING_MAP: return new PrivateOugoingMapItem();
default:
std::cerr << "Unknown packet type in chat!" << std::endl;
return NULL;
}
}
@ -205,4 +205,11 @@ void RsPrivateChatMsgConfigItem::get(RsChatMsgItem *ci)
ci->recvTime = recvTime;
}
/* Necessary to serialize `store` that is an STL container with RsChatMsgItem
* inside which is a subtype of RsItem */
RS_REGISTER_ITEM_TYPE(RsChatMsgItem)
void PrivateOugoingMapItem::serial_process(
RsGenericSerializer::SerializeJob j,
RsGenericSerializer::SerializeContext& ctx )
{ RS_REGISTER_SERIAL_MEMBER(store); }

View File

@ -33,6 +33,7 @@
#include "rsitems/itempriorities.h"
#include "rsitems/rsitem.h"
#include "serialiser/rsserial.h"
#include "util/rsdeprecate.h"
#include "serialiser/rstlvidset.h"
#include "serialiser/rstlvfileitem.h"
@ -77,8 +78,12 @@ const uint8_t RS_PKT_SUBTYPE_DISTANT_CHAT_DH_PUBLIC_KEY = 0x16 ;
const uint8_t RS_PKT_SUBTYPE_CHAT_LOBBY_SIGNED_MSG = 0x17 ;
const uint8_t RS_PKT_SUBTYPE_CHAT_LOBBY_SIGNED_EVENT = 0x18 ;
const uint8_t RS_PKT_SUBTYPE_CHAT_LOBBY_LIST = 0x19 ;
RS_DEPRECATED_FOR(RS_PKT_SUBTYPE_CHAT_LOBBY_INVITE) \
const uint8_t RS_PKT_SUBTYPE_CHAT_LOBBY_INVITE_DEPRECATED = 0x1A ; // to be removed (deprecated since May 2017)
const uint8_t RS_PKT_SUBTYPE_CHAT_LOBBY_INVITE = 0x1B ;
const uint8_t RS_PKT_SUBTYPE_OUTGOING_MAP = 0x1C ;
typedef uint64_t ChatLobbyId ;
typedef uint64_t ChatLobbyMsgId ;
@ -239,8 +244,8 @@ class RsChatLobbyConnectChallengeItem: public RsChatItem
uint64_t challenge_code ;
};
// to be removed (deprecated since May 2017)
class RsChatLobbyInviteItem_Deprecated: public RsChatItem
/// @deprecated since May 2017, to be removed
class RsChatLobbyInviteItem_Deprecated : public RsChatItem
{
public:
RsChatLobbyInviteItem_Deprecated() :RsChatItem(RS_PKT_SUBTYPE_CHAT_LOBBY_INVITE_DEPRECATED) {}
@ -272,27 +277,28 @@ class RsChatLobbyInviteItem: public RsChatItem
* For saving incoming and outgoing chat msgs
* @see p3ChatService
*/
class RsPrivateChatMsgConfigItem: public RsChatItem
struct RsPrivateChatMsgConfigItem : RsChatItem
{
public:
RsPrivateChatMsgConfigItem() :RsChatItem(RS_PKT_SUBTYPE_PRIVATECHATMSG_CONFIG) {}
RsPrivateChatMsgConfigItem() :
RsChatItem(RS_PKT_SUBTYPE_PRIVATECHATMSG_CONFIG) {}
virtual ~RsPrivateChatMsgConfigItem() {}
virtual void clear() {}
virtual ~RsPrivateChatMsgConfigItem() {}
virtual void clear() {}
virtual void serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx);
virtual void serial_process( RsGenericSerializer::SerializeJob j,
RsGenericSerializer::SerializeContext& ctx );
/* set data from RsChatMsgItem to RsPrivateChatMsgConfigItem */
void set(RsChatMsgItem *ci, const RsPeerId &peerId, uint32_t confFlags);
/* get data from RsPrivateChatMsgConfigItem to RsChatMsgItem */
void get(RsChatMsgItem *ci);
/** set data from RsChatMsgItem to RsPrivateChatMsgConfigItem */
void set(RsChatMsgItem *ci, const RsPeerId &peerId, uint32_t confFlags);
/** get data from RsPrivateChatMsgConfigItem to RsChatMsgItem */
void get(RsChatMsgItem *ci);
RsPeerId configPeerId;
uint32_t chatFlags;
uint32_t configFlags;
uint32_t sendTime;
std::string message;
uint32_t recvTime;
RsPeerId configPeerId;
uint32_t chatFlags;
uint32_t configFlags;
uint32_t sendTime;
std::string message;
uint32_t recvTime;
};
class RsChatLobbyConfigItem: public RsChatItem
@ -339,12 +345,23 @@ class RsChatAvatarItem: public RsChatItem
unsigned char *image_data ; // image
};
class RsChatSerialiser: public RsServiceSerializer
{
public:
RsChatSerialiser(SerializationFlags flags = SERIALIZATION_FLAG_NONE)
:RsServiceSerializer(RS_SERVICE_TYPE_CHAT,RsGenericSerializer::FORMAT_BINARY,flags) {}
virtual RsItem *create_item(uint16_t service_id,uint8_t item_sub_id) const ;
struct PrivateOugoingMapItem : RsChatItem
{
PrivateOugoingMapItem() : RsChatItem(RS_PKT_SUBTYPE_OUTGOING_MAP) {}
void serial_process( RsGenericSerializer::SerializeJob j,
RsGenericSerializer::SerializeContext& ctx );
std::map<uint64_t, RsChatMsgItem> store;
};
struct RsChatSerialiser : RsServiceSerializer
{
RsChatSerialiser(SerializationFlags flags = SERIALIZATION_FLAG_NONE) :
RsServiceSerializer( RS_SERVICE_TYPE_CHAT,
RsGenericSerializer::FORMAT_BINARY, flags ) {}
virtual RsItem *create_item(uint16_t service_id,uint8_t item_sub_id) const;
};

View File

@ -975,7 +975,7 @@ bool perform_tests()
fprintf(stdout,"result: q=") ; uint256_32::print(q1) ; fprintf(stdout," r=") ; uint256_32::print(r1) ; fprintf(stdout,"\n") ;
#endif
uint256_32 res(q1) ;
//uint256_32 res(q1) ;
q1 *= p1 ;
q1 += r1 ;

View File

@ -398,6 +398,7 @@ uint32_t PeerConnectStateBox::connectCb_direct()
break;
}
} /* FALLTHROUGH TO START CASE */
/* fallthrough */
default:
case CSB_REVERSE_WAIT:
case CSB_PROXY_WAIT:
@ -411,6 +412,7 @@ uint32_t PeerConnectStateBox::connectCb_direct()
}
} /* FALLTHROUGH TO START CASE */
/* fallthrough */
case CSB_START:
{
/* starting up the connection */
@ -537,6 +539,7 @@ uint32_t PeerConnectStateBox::connectCb_unreachable()
break;
}
} /* FALLTHROUGH TO START CASE */
/* fallthrough */
default:
case CSB_DIRECT_WAIT:
{
@ -548,6 +551,7 @@ uint32_t PeerConnectStateBox::connectCb_unreachable()
}
} /* FALLTHROUGH TO START CASE */
/* fallthrough */
case CSB_START:
{
/* starting up the connection */

View File

@ -188,6 +188,7 @@ void ChunkMap::updateTotalDownloaded()
switch(_map[i])
{
case FileChunksInfo::CHUNK_CHECKING: _file_is_complete = false ;
/* fallthrough */
case FileChunksInfo::CHUNK_DONE: _total_downloaded += sizeOfChunk(i) ;
break ;
default:

View File

@ -99,24 +99,27 @@ ftFileControl::ftFileControl(std::string fname,
}
ftController::ftController(ftDataMultiplex *dm, p3ServiceControl *sc, uint32_t ftServiceId)
: p3Config(),
last_save_time(0),
last_clean_time(0),
mDataplex(dm),
mTurtle(NULL),
mFtServer(NULL),
mServiceCtrl(sc),
mFtServiceType(ftServiceId),
ctrlMutex("ftController"),
doneMutex("ftController"),
mFtActive(false),
mDefaultChunkStrategy(FileChunksInfo::CHUNK_STRATEGY_PROGRESSIVE)
: p3Config(),
last_save_time(0),
last_clean_time(0),
mSearch(NULL),
mDataplex(dm),
mExtraList(NULL),
mTurtle(NULL),
mFtServer(NULL),
mServiceCtrl(sc),
mFtServiceType(ftServiceId),
mDefaultEncryptionPolicy(RS_FILE_CTRL_ENCRYPTION_POLICY_PERMISSIVE),
mFilePermDirectDLPolicy(RS_FILE_PERM_DIRECT_DL_PER_USER),
cnt(0),
ctrlMutex("ftController"),
doneMutex("ftController"),
mFtActive(false),
mFtPendingDone(false),
mDefaultChunkStrategy(FileChunksInfo::CHUNK_STRATEGY_PROGRESSIVE),
_max_active_downloads(5), // default queue size
_max_uploads_per_friend(FT_FILECONTROL_MAX_UPLOAD_SLOTS_DEFAULT)
{
_max_active_downloads = 5 ; // default queue size
mDefaultEncryptionPolicy = RS_FILE_CTRL_ENCRYPTION_POLICY_PERMISSIVE;
_max_uploads_per_friend = FT_FILECONTROL_MAX_UPLOAD_SLOTS_DEFAULT ;
/* TODO */
cnt = 0 ;
}
void ftController::setTurtleRouter(p3turtle *pt) { mTurtle = pt ; }
@ -278,18 +281,27 @@ void ftController::data_tick()
void ftController::searchForDirectSources()
{
RsStackMutex stack(ctrlMutex); /******* LOCKED ********/
if (!mSearch) return;
for(std::map<RsFileHash,ftFileControl*>::iterator it(mDownloads.begin()); it != mDownloads.end(); ++it)
if(it->second->mState != ftFileControl::QUEUED && it->second->mState != ftFileControl::PAUSED)
{
FileInfo info ; // info needs to be re-allocated each time, to start with a clear list of peers (it's not cleared down there)
for(std::map<RsFileHash,ftFileControl*>::iterator it(mDownloads.begin()); it != mDownloads.end(); ++it )
if(it->second->mState != ftFileControl::QUEUED && it->second->mState != ftFileControl::PAUSED )
{
FileInfo info ; // Info needs to be re-allocated each time, to start with a clear list of peers (it's not cleared down there)
if(mSearch->search(it->first, RS_FILE_HINTS_REMOTE | RS_FILE_HINTS_SPEC_ONLY, info))
for(std::list<TransferInfo>::const_iterator pit = info.peers.begin(); pit != info.peers.end(); ++pit)
if(rsPeers->servicePermissionFlags(pit->peerId) & RS_NODE_PERM_DIRECT_DL)
if(it->second->mTransfer->addFileSource(pit->peerId)) /* if the sources don't exist already - add in */
setPeerState(it->second->mTransfer, pit->peerId, FT_CNTRL_STANDARD_RATE, mServiceCtrl->isPeerConnected(mFtServiceType, pit->peerId));
}
if( mSearch->search(it->first, RS_FILE_HINTS_REMOTE | RS_FILE_HINTS_SPEC_ONLY, info) )
for( std::list<TransferInfo>::const_iterator pit = info.peers.begin(); pit != info.peers.end(); ++pit )
{
bool bAllowDirectDL = false;
switch (mFilePermDirectDLPolicy) {
case RS_FILE_PERM_DIRECT_DL_YES: bAllowDirectDL = true; break;
case RS_FILE_PERM_DIRECT_DL_NO: bAllowDirectDL = false; break;
default:bAllowDirectDL = (rsPeers->servicePermissionFlags(pit->peerId) & RS_NODE_PERM_DIRECT_DL); break;
}
if( bAllowDirectDL )
if( it->second->mTransfer->addFileSource(pit->peerId) ) /* if the sources don't exist already - add in */
setPeerState( it->second->mTransfer, pit->peerId, FT_CNTRL_STANDARD_RATE, mServiceCtrl->isPeerConnected(mFtServiceType, pit->peerId) );
}
}
}
void ftController::tickTransfers()
@ -748,7 +760,8 @@ bool ftController::completeFile(const RsFileHash& hash)
std::cerr << std::endl;
#endif
mExtraList->addExtraFile(path, hash, size, period, extraflags);
if(mExtraList)
mExtraList->addExtraFile(path, hash, size, period, extraflags);
}
else
{
@ -855,6 +868,7 @@ bool ftController::alreadyHaveFile(const RsFileHash& hash, FileInfo &info)
return true ;
// check for file lists
if (!mSearch) return false;
if (mSearch->search(hash, RS_FILE_HINTS_LOCAL | RS_FILE_HINTS_EXTRA | RS_FILE_HINTS_SPEC_ONLY, info))
return true ;
@ -944,18 +958,27 @@ bool ftController::FileRequest(const std::string& fname, const RsFileHash& hash
// remove the sources from the list, if they don't have clearance for direct transfer. This happens only for non cache files.
//
for(std::list<RsPeerId>::iterator it = srcIds.begin(); it != srcIds.end(); )
if(!(rsPeers->servicePermissionFlags(*it) & RS_NODE_PERM_DIRECT_DL))
{
std::list<RsPeerId>::iterator tmp(it) ;
++tmp ;
srcIds.erase(it) ;
it = tmp ;
}
else
++it ;
std::list<RsPeerId>::const_iterator it;
for(std::list<RsPeerId>::iterator it = srcIds.begin(); it != srcIds.end(); )
{
bool bAllowDirectDL = false;
switch (mFilePermDirectDLPolicy) {
case RS_FILE_PERM_DIRECT_DL_YES: bAllowDirectDL = true; break;
case RS_FILE_PERM_DIRECT_DL_NO: bAllowDirectDL = false; break;
default:bAllowDirectDL = (rsPeers->servicePermissionFlags(*it) & RS_NODE_PERM_DIRECT_DL); break;
}
if(!bAllowDirectDL)
{
std::list<RsPeerId>::iterator tmp(it);
++tmp;
srcIds.erase(it);
it = tmp;
}
else
++it;
}
std::list<RsPeerId>::const_iterator it;
std::list<TransferInfo>::const_iterator pit;
#ifdef CONTROL_DEBUG
@ -1001,7 +1024,14 @@ bool ftController::FileRequest(const std::string& fname, const RsFileHash& hash
*/
for(it = srcIds.begin(); it != srcIds.end(); ++it)
if(rsPeers->servicePermissionFlags(*it) & RS_NODE_PERM_DIRECT_DL)
{
bool bAllowDirectDL = false;
switch (mFilePermDirectDLPolicy) {
case RS_FILE_PERM_DIRECT_DL_YES: bAllowDirectDL = true; break;
case RS_FILE_PERM_DIRECT_DL_NO: bAllowDirectDL = false; break;
default:bAllowDirectDL = (rsPeers->servicePermissionFlags(*it) & RS_NODE_PERM_DIRECT_DL); break;
}
if(bAllowDirectDL)
{
uint32_t i, j;
if ((dit->second)->mTransfer->getPeerState(*it, i, j))
@ -1020,6 +1050,7 @@ bool ftController::FileRequest(const std::string& fname, const RsFileHash& hash
(dit->second)->mTransfer->addFileSource(*it);
setPeerState(dit->second->mTransfer, *it, rate, mServiceCtrl->isPeerConnected(mFtServiceType, *it));
}
}
if (srcIds.empty())
{
@ -1034,7 +1065,7 @@ bool ftController::FileRequest(const std::string& fname, const RsFileHash& hash
} /******* UNLOCKED ********/
if(!(flags & RS_FILE_REQ_NO_SEARCH))
if(mSearch && !(flags & RS_FILE_REQ_NO_SEARCH))
{
/* do a source search - for any extra sources */
// add sources only in direct mode
@ -1056,7 +1087,14 @@ bool ftController::FileRequest(const std::string& fname, const RsFileHash& hash
#endif
// Because this is auto-add, we only add sources that we allow to DL from using direct transfers.
if ((srcIds.end() == std::find( srcIds.begin(), srcIds.end(), pit->peerId)) && (RS_NODE_PERM_DIRECT_DL & rsPeers->servicePermissionFlags(pit->peerId)))
bool bAllowDirectDL = false;
switch (mFilePermDirectDLPolicy) {
case RS_FILE_PERM_DIRECT_DL_YES: bAllowDirectDL = true; break;
case RS_FILE_PERM_DIRECT_DL_NO: bAllowDirectDL = false; break;
default:bAllowDirectDL = (rsPeers->servicePermissionFlags(pit->peerId) & RS_NODE_PERM_DIRECT_DL); break;
}
if ((srcIds.end() == std::find( srcIds.begin(), srcIds.end(), pit->peerId)) && bAllowDirectDL)
{
srcIds.push_back(pit->peerId);
@ -1729,6 +1767,7 @@ const std::string max_uploads_per_friend_ss("MAX_UPLOADS_PER_FRIEND");
const std::string default_chunk_strategy_ss("DEFAULT_CHUNK_STRATEGY");
const std::string free_space_limit_ss("FREE_SPACE_LIMIT");
const std::string default_encryption_policy_ss("DEFAULT_ENCRYPTION_POLICY");
const std::string file_perm_direct_dl_ss("FILE_PERM_DIRECT_DL");
/* p3Config Interface */
@ -1779,6 +1818,15 @@ bool ftController::saveList(bool &cleanup, std::list<RsItem *>& saveData)
configMap[default_encryption_policy_ss] = (mDefaultEncryptionPolicy==RS_FILE_CTRL_ENCRYPTION_POLICY_PERMISSIVE)?"PERMISSIVE":"STRICT" ;
switch (mFilePermDirectDLPolicy) {
case RS_FILE_PERM_DIRECT_DL_YES: configMap[file_perm_direct_dl_ss] = "YES" ;
break;
case RS_FILE_PERM_DIRECT_DL_NO: configMap[file_perm_direct_dl_ss] = "NO" ;
break;
default: configMap[file_perm_direct_dl_ss] = "PER_USER" ;
break;
}
rs_sprintf(s, "%lu", RsDiscSpace::freeSpaceLimit());
configMap[free_space_limit_ss] = s ;
@ -1995,9 +2043,9 @@ bool ftController::loadConfigMap(std::map<std::string, std::string> &configMap)
{
std::map<std::string, std::string>::iterator mit;
std::string str_true("true");
std::string empty("");
std::string dir = "notempty";
//std::string str_true("true");
//std::string empty("");
//std::string dir = "notempty";
if (configMap.end() != (mit = configMap.find(download_dir_ss)))
setDownloadDirectory(mit->second);
@ -2072,6 +2120,26 @@ bool ftController::loadConfigMap(std::map<std::string, std::string> &configMap)
_max_uploads_per_friend = n ;
}
}
if(configMap.end() != (mit = configMap.find(file_perm_direct_dl_ss)))
{
if(mit->second == "YES")
{
mFilePermDirectDLPolicy = RS_FILE_PERM_DIRECT_DL_YES ;
std::cerr << "Note: loading default value for file permission direct download: YES" << std::endl;
}
else if(mit->second == "NO")
{
mFilePermDirectDLPolicy = RS_FILE_PERM_DIRECT_DL_NO ;
std::cerr << "Note: loading default value for file permission direct download: NO" << std::endl;
}
else if(mit->second == "PER_USER")
{
mFilePermDirectDLPolicy = RS_FILE_PERM_DIRECT_DL_PER_USER ;
std::cerr << "Note: loading default value for file permission direct download: PER_USER" << std::endl;
}
}
return true;
}
@ -2097,6 +2165,22 @@ uint32_t ftController::defaultEncryptionPolicy()
RsStackMutex stack(ctrlMutex); /******* LOCKED ********/
return mDefaultEncryptionPolicy ;
}
void ftController::setFilePermDirectDL(uint32_t perm)
{
RsStackMutex stack(ctrlMutex); /******* LOCKED ********/
if (mFilePermDirectDLPolicy != perm)
{
mFilePermDirectDLPolicy = perm;
IndicateConfigChanged();
}
}
uint32_t ftController::filePermDirectDL()
{
RsStackMutex stack(ctrlMutex); /******* LOCKED ********/
return mFilePermDirectDLPolicy;
}
void ftController::setFreeDiskSpaceLimit(uint32_t size_in_mb)
{
RsDiscSpace::setFreeSpaceLimit(size_in_mb) ;

View File

@ -149,6 +149,9 @@ class ftController: public RsTickingThread, public pqiServiceMonitor, public p3C
void setMaxUploadsPerFriend(uint32_t m) ;
uint32_t getMaxUploadsPerFriend() ;
void setFilePermDirectDL(uint32_t perm) ;
uint32_t filePermDirectDL() ;
bool FileCancel(const RsFileHash& hash);
bool FileControl(const RsFileHash& hash, uint32_t flags);
bool FileClearCompleted();
@ -237,7 +240,8 @@ class ftController: public RsTickingThread, public pqiServiceMonitor, public p3C
ftServer *mFtServer ;
p3ServiceControl *mServiceCtrl;
uint32_t mFtServiceType;
uint32_t mDefaultEncryptionPolicy ;
uint32_t mDefaultEncryptionPolicy;
uint32_t mFilePermDirectDLPolicy;
uint32_t cnt ;
RsMutex ctrlMutex;

View File

@ -31,7 +31,7 @@
#include "crypto/chacha20.h"
#include "retroshare/rstypes.h"
#include "retroshare/rspeers.h"
const int ftserverzone = 29539;
//const int ftserverzone = 29539;
#include "file_sharing/p3filelists.h"
#include "ft/ftturtlefiletransferitem.h"
@ -291,18 +291,28 @@ bool ftServer::activateTunnels(const RsFileHash& hash,uint32_t encryption_policy
return true ;
}
bool ftServer::setDestinationName(const RsFileHash& hash,const std::string& name)
{
return mFtController->setDestinationName(hash,name);
}
bool ftServer::setDestinationDirectory(const RsFileHash& hash,const std::string& directory)
{
return mFtController->setDestinationDirectory(hash,directory);
}
bool ftServer::setDestinationName(const RsFileHash& hash,const std::string& name)
{
return mFtController->setDestinationName(hash,name);
}
bool ftServer::setChunkStrategy(const RsFileHash& hash,FileChunksInfo::ChunkStrategy s)
{
return mFtController->setChunkStrategy(hash,s);
}
void ftServer::setDefaultChunkStrategy(FileChunksInfo::ChunkStrategy s)
{
mFtController->setDefaultChunkStrategy(s) ;
}
FileChunksInfo::ChunkStrategy ftServer::defaultChunkStrategy()
{
return mFtController->defaultChunkStrategy() ;
}
uint32_t ftServer::freeDiskSpaceLimit()const
{
return mFtController->freeDiskSpaceLimit() ;
@ -311,9 +321,10 @@ void ftServer::setFreeDiskSpaceLimit(uint32_t s)
{
mFtController->setFreeDiskSpaceLimit(s) ;
}
void ftServer::setDefaultChunkStrategy(FileChunksInfo::ChunkStrategy s)
void ftServer::setDefaultEncryptionPolicy(uint32_t s)
{
mFtController->setDefaultChunkStrategy(s) ;
mFtController->setDefaultEncryptionPolicy(s) ;
}
uint32_t ftServer::defaultEncryptionPolicy()
{
@ -329,14 +340,15 @@ uint32_t ftServer::getMaxUploadSlotsPerFriend()
return mFtController->getMaxUploadsPerFriend() ;
}
void ftServer::setDefaultEncryptionPolicy(uint32_t s)
void ftServer::setFilePermDirectDL(uint32_t perm)
{
mFtController->setDefaultEncryptionPolicy(s) ;
mFtController->setFilePermDirectDL(perm);
}
FileChunksInfo::ChunkStrategy ftServer::defaultChunkStrategy()
uint32_t ftServer::filePermDirectDL()
{
return mFtController->defaultChunkStrategy() ;
return mFtController->filePermDirectDL() ;
}
bool ftServer::FileCancel(const RsFileHash& hash)
{
// Remove from both queue and ftController, by default.

View File

@ -140,6 +140,8 @@ public:
virtual uint32_t defaultEncryptionPolicy() ;
virtual void setMaxUploadSlotsPerFriend(uint32_t n) ;
virtual uint32_t getMaxUploadSlotsPerFriend() ;
virtual void setFilePermDirectDL(uint32_t perm) ;
virtual uint32_t filePermDirectDL() ;
/***
* Control of Downloads Priority.

View File

@ -53,7 +53,7 @@ const uint32_t FT_TM_MAX_RESETS = 5;
const uint32_t FT_TM_MINIMUM_CHUNK = 1024; /* ie 1Kb / sec */
const uint32_t FT_TM_RESTART_DOWNLOAD = 20; /* 20 seconds */
const uint32_t FT_TM_DOWNLOAD_TIMEOUT = 10; /* 10 seconds */
const uint32_t FT_TM_CRC_MAP_MAX_WAIT_PER_GIG = 20; /* 20 seconds per gigabyte */
//const uint32_t FT_TM_CRC_MAP_MAX_WAIT_PER_GIG = 20; /* 20 seconds per gigabyte */
// const double FT_TM_MAX_INCREASE = 1.00;
// const double FT_TM_MIN_INCREASE = -0.10;
@ -62,13 +62,13 @@ const double FT_TM_RATE_INCREASE_SLOWER = 0.05 ;
const double FT_TM_RATE_INCREASE_AVERAGE = 0.3 ;
const double FT_TM_RATE_INCREASE_FASTER = 1.0 ;
const int32_t FT_TM_FAST_RTT = 1.0;
const int32_t FT_TM_STD_RTT = 5.0;
const int32_t FT_TM_SLOW_RTT = 20.0;
//const int32_t FT_TM_FAST_RTT = 1.0;
//const int32_t FT_TM_STD_RTT = 5.0;
//const int32_t FT_TM_SLOW_RTT = 20.0;
const uint32_t FT_TM_CRC_MAP_STATE_NOCHECK = 0 ;
const uint32_t FT_TM_CRC_MAP_STATE_DONT_HAVE = 1 ;
const uint32_t FT_TM_CRC_MAP_STATE_HAVE = 2 ;
//const uint32_t FT_TM_CRC_MAP_STATE_NOCHECK = 0 ;
//const uint32_t FT_TM_CRC_MAP_STATE_DONT_HAVE = 1 ;
//const uint32_t FT_TM_CRC_MAP_STATE_HAVE = 2 ;
#define FT_TM_FLAG_DOWNLOADING 0
#define FT_TM_FLAG_CANCELED 1

View File

@ -1902,7 +1902,9 @@ bool p3GRouter::encryptDataItem(RsGRouterGenericDataItem *item,const RsGxsId& de
uint32_t encrypted_size =0;
uint32_t error_status ;
if(!mGixs->encryptData(item->data_bytes,item->data_size,encrypted_data,encrypted_size,destination_key,true,error_status))
if(!mGixs->encryptData( item->data_bytes, item->data_size, encrypted_data,
encrypted_size, destination_key, error_status,
true ))
{
std::cerr << "(EE) Cannot encrypt: " ;
if(error_status == RsGixs::RS_GIXS_ERROR_KEY_NOT_AVAILABLE) std::cerr << " key not available for ID = " << destination_key << std::endl;
@ -1936,7 +1938,9 @@ bool p3GRouter::decryptDataItem(RsGRouterGenericDataItem *item)
uint32_t decrypted_size =0;
uint32_t error_status ;
if(!mGixs->decryptData(item->data_bytes,item->data_size,decrypted_data,decrypted_size,item->destination_key,error_status))
if(!mGixs->decryptData( item->data_bytes, item->data_size, decrypted_data,
decrypted_size, item->destination_key, error_status,
true ))
{
if(error_status == RsGixs::RS_GIXS_ERROR_KEY_NOT_AVAILABLE)
std::cerr << "(EE) Cannot decrypt incoming message. Key " << item->destination_key << " unknown." << std::endl;
@ -1986,7 +1990,7 @@ bool p3GRouter::signDataItem(RsGRouterAbstractMsgItem *item,const RsGxsId& signi
std::cerr << "Created signature for data hash: " << RsDirUtil::sha1sum(data,data_size) << " and key id=" << signing_id << std::endl;
//#endif
// Check signature
RsIdentityUsage::UsageCode info;
RsIdentityUsage::UsageCode info = RsIdentityUsage::GLOBAL_ROUTER_SIGNATURE_CREATION;
uint32_t error;
if(verifySignedDataItem(item,info,error))

View File

@ -272,6 +272,8 @@ bool GxsSecurity::generateKeyPair(RsTlvPublicRSAKey& public_key,RsTlvPrivateRSAK
RSA_generate_key_ex(rsa, 2048, ebn, NULL);
RSA *rsa_pub = RSAPublicKey_dup(rsa);
BN_clear_free(ebn) ;
public_key.keyFlags = RSTLV_KEY_TYPE_PUBLIC_ONLY ;
private_key.keyFlags = RSTLV_KEY_TYPE_FULL ;
@ -359,7 +361,8 @@ bool GxsSecurity::getSignature(const char *data, uint32_t data_len, const RsTlvP
ok &= EVP_SignUpdate(mdctx, data, data_len) == 1;
unsigned int siglen = EVP_PKEY_size(key_priv);
unsigned char sigbuf[siglen];
unsigned char sigbuf[siglen] ;
memset(sigbuf,0,siglen) ;
ok &= EVP_SignFinal(mdctx, sigbuf, &siglen, key_priv) == 1;
// clean up
@ -579,6 +582,8 @@ bool GxsSecurity::encrypt(uint8_t *& out, uint32_t &outlen, const uint8_t *in, u
// intialize context and send store encrypted cipher in ek
if(!EVP_SealInit(ctx, EVP_aes_128_cbc(), &ek, &eklen, iv, &public_key, 1)) return false;
EVP_PKEY_free(public_key) ;
// now assign memory to out accounting for data, and cipher block size, key length, and key length val
out = (uint8_t*)rs_malloc(inlen + cipher_block_size + size_net_ekl + eklen + EVP_MAX_IV_LENGTH) ;
@ -856,6 +861,7 @@ bool GxsSecurity::decrypt(uint8_t *& out, uint32_t & outlen, const uint8_t *in,
std::cerr << "(EE) Cannot decrypt data. Most likely reason: private GXS key is missing." << std::endl;
return false;
}
EVP_PKEY_free(privateKey) ;
if(inlen < (uint32_t)in_offset)
{

View File

@ -36,9 +36,10 @@
/*!
* This contains functionality for performing security
* operations needed to validate data received in RsGenExchange
* This contains functionality for performing basic security operations needed
* in RsGenExchange operations.
* Also has routine for creating security objects around msgs and groups
* TODO: Those functions doesn't do param checking!
*/
class GxsSecurity
{

View File

@ -31,7 +31,7 @@
bool GxsTokenQueue::queueRequest(uint32_t token, uint32_t req_type)
{
RsStackMutex stack(mQueueMtx); /********** STACK LOCKED MTX ******/
RS_STACK_MUTEX(mQueueMtx);
mQueue.push_back(GxsTokenQueueItem(token, req_type));
return true;
}

View File

@ -29,41 +29,37 @@
#include "util/rsthreads.h"
/*
*
* A little helper class, to manage callbacks from requests
*
*/
class GxsTokenQueueItem
struct GxsTokenQueueItem
{
public:
GxsTokenQueueItem(const uint32_t token, const uint32_t req_type)
:mToken(token),mReqType(req_type) { return; }
GxsTokenQueueItem(): mToken(0), mReqType(0) { return; }
GxsTokenQueueItem(const uint32_t token, const uint32_t req_type) :
mToken(token), mReqType(req_type) {}
GxsTokenQueueItem(): mToken(0), mReqType(0) {}
uint32_t mToken;
uint32_t mReqType;
};
/**
* A little helper class, to manage callbacks from requests
*/
class GxsTokenQueue
{
public:
public:
GxsTokenQueue(RsGenExchange *gxs) :
mGenExchange(gxs), mQueueMtx("GxsTokenQueueMtx") {}
GxsTokenQueue(RsGenExchange *gxs)
:mGenExchange(gxs), mQueueMtx("GxsTokenQueueMtx") { return; }
bool queueRequest(uint32_t token, uint32_t req_type);
bool queueRequest(uint32_t token, uint32_t req_type);
void checkRequests(); /// must be called by
void checkRequests(); // must be called by
protected:
protected:
/// This must be overloaded to complete the functionality.
virtual void handleResponse(uint32_t token, uint32_t req_type);
// This must be overloaded to complete the functionality.
virtual void handleResponse(uint32_t token, uint32_t req_type);
private:
private:
RsGenExchange *mGenExchange;
RsMutex mQueueMtx;
std::list<GxsTokenQueueItem> mQueue;

View File

@ -702,20 +702,20 @@ RsNxsMsg* RsDataService::locked_getMessage(RetroCursor &c)
return NULL;
}
int RsDataService::storeMessage(std::map<RsNxsMsg *, RsGxsMsgMetaData *> &msg)
int RsDataService::storeMessage(const std::list<RsNxsMsg*>& msg)
{
RsStackMutex stack(mDbMutex);
std::map<RsNxsMsg*, RsGxsMsgMetaData* >::iterator mit = msg.begin();
// start a transaction
mDb->beginTransaction();
for(; mit != msg.end(); ++mit)
for(std::list<RsNxsMsg*>::const_iterator mit = msg.begin(); mit != msg.end(); ++mit)
{
RsNxsMsg* msgPtr = mit->first;
RsGxsMsgMetaData* msgMetaPtr = mit->second;
RsNxsMsg* msgPtr = *mit;
RsGxsMsgMetaData* msgMetaPtr = msgPtr->metaData;
assert(msgMetaPtr != NULL);
#ifdef RS_DATA_SERVICE_DEBUG
std::cerr << "RsDataService::storeMessage() ";
@ -790,16 +790,6 @@ int RsDataService::storeMessage(std::map<RsNxsMsg *, RsGxsMsgMetaData *> &msg)
// finish transaction
bool ret = mDb->commitTransaction();
for(mit = msg.begin(); mit != msg.end(); ++mit)
{
//TODO: API encourages aliasing, remove this abomination
if(mit->second != mit->first->metaData)
delete mit->second;
delete mit->first;
;
}
return ret;
}
@ -811,104 +801,94 @@ bool RsDataService::validSize(RsNxsMsg* msg) const
}
int RsDataService::storeGroup(std::map<RsNxsGrp *, RsGxsGrpMetaData *> &grp)
int RsDataService::storeGroup(const std::list<RsNxsGrp*>& grp)
{
RsStackMutex stack(mDbMutex);
std::map<RsNxsGrp*, RsGxsGrpMetaData* >::iterator sit = grp.begin();
// begin transaction
mDb->beginTransaction();
for(; sit != grp.end(); ++sit)
{
for(std::list<RsNxsGrp*>::const_iterator sit = grp.begin();sit != grp.end(); ++sit)
{
RsNxsGrp* grpPtr = *sit;
RsGxsGrpMetaData* grpMetaPtr = grpPtr->metaData;
RsNxsGrp* grpPtr = sit->first;
RsGxsGrpMetaData* grpMetaPtr = sit->second;
assert(grpMetaPtr != NULL);
// if data is larger than max item size do not add
if(!validSize(grpPtr)) continue;
// if data is larger than max item size do not add
if(!validSize(grpPtr)) continue;
#ifdef RS_DATA_SERVICE_DEBUG
std::cerr << "RsDataService::storeGroup() GrpId: " << grpPtr->grpId.toStdString();
std::cerr << " CircleType: " << (uint32_t) grpMetaPtr->mCircleType;
std::cerr << " CircleId: " << grpMetaPtr->mCircleId.toStdString();
std::cerr << std::endl;
std::cerr << "RsDataService::storeGroup() GrpId: " << grpPtr->grpId.toStdString();
std::cerr << " CircleType: " << (uint32_t) grpMetaPtr->mCircleType;
std::cerr << " CircleId: " << grpMetaPtr->mCircleId.toStdString();
std::cerr << std::endl;
#endif
/*!
* STORE data, data len,
* grpId, flags, publish time stamp, identity,
* id signature, admin signatue, key set, last posting ts
* and meta data
**/
ContentValue cv;
/*!
* STORE data, data len,
* grpId, flags, publish time stamp, identity,
* id signature, admin signatue, key set, last posting ts
* and meta data
**/
ContentValue cv;
uint32_t dataLen = grpPtr->grp.TlvSize();
char grpData[dataLen];
uint32_t offset = 0;
grpPtr->grp.SetTlv(grpData, dataLen, &offset);
cv.put(KEY_NXS_DATA, dataLen, grpData);
uint32_t dataLen = grpPtr->grp.TlvSize();
char grpData[dataLen];
uint32_t offset = 0;
grpPtr->grp.SetTlv(grpData, dataLen, &offset);
cv.put(KEY_NXS_DATA, dataLen, grpData);
cv.put(KEY_NXS_DATA_LEN, (int32_t) dataLen);
cv.put(KEY_GRP_ID, grpPtr->grpId.toStdString());
cv.put(KEY_GRP_NAME, grpMetaPtr->mGroupName);
cv.put(KEY_ORIG_GRP_ID, grpMetaPtr->mOrigGrpId.toStdString());
cv.put(KEY_NXS_SERV_STRING, grpMetaPtr->mServiceString);
cv.put(KEY_NXS_FLAGS, (int32_t)grpMetaPtr->mGroupFlags);
cv.put(KEY_TIME_STAMP, (int32_t)grpMetaPtr->mPublishTs);
cv.put(KEY_GRP_SIGN_FLAGS, (int32_t)grpMetaPtr->mSignFlags);
cv.put(KEY_GRP_CIRCLE_ID, grpMetaPtr->mCircleId.toStdString());
cv.put(KEY_GRP_CIRCLE_TYPE, (int32_t)grpMetaPtr->mCircleType);
cv.put(KEY_GRP_INTERNAL_CIRCLE, grpMetaPtr->mInternalCircle.toStdString());
cv.put(KEY_GRP_ORIGINATOR, grpMetaPtr->mOriginator.toStdString());
cv.put(KEY_GRP_AUTHEN_FLAGS, (int32_t)grpMetaPtr->mAuthenFlags);
cv.put(KEY_PARENT_GRP_ID, grpMetaPtr->mParentGrpId.toStdString());
cv.put(KEY_NXS_HASH, grpMetaPtr->mHash.toStdString());
cv.put(KEY_RECV_TS, (int32_t)grpMetaPtr->mRecvTS);
cv.put(KEY_GRP_REP_CUTOFF, (int32_t)grpMetaPtr->mReputationCutOff);
cv.put(KEY_NXS_IDENTITY, grpMetaPtr->mAuthorId.toStdString());
cv.put(KEY_NXS_DATA_LEN, (int32_t) dataLen);
cv.put(KEY_GRP_ID, grpPtr->grpId.toStdString());
cv.put(KEY_GRP_NAME, grpMetaPtr->mGroupName);
cv.put(KEY_ORIG_GRP_ID, grpMetaPtr->mOrigGrpId.toStdString());
cv.put(KEY_NXS_SERV_STRING, grpMetaPtr->mServiceString);
cv.put(KEY_NXS_FLAGS, (int32_t)grpMetaPtr->mGroupFlags);
cv.put(KEY_TIME_STAMP, (int32_t)grpMetaPtr->mPublishTs);
cv.put(KEY_GRP_SIGN_FLAGS, (int32_t)grpMetaPtr->mSignFlags);
cv.put(KEY_GRP_CIRCLE_ID, grpMetaPtr->mCircleId.toStdString());
cv.put(KEY_GRP_CIRCLE_TYPE, (int32_t)grpMetaPtr->mCircleType);
cv.put(KEY_GRP_INTERNAL_CIRCLE, grpMetaPtr->mInternalCircle.toStdString());
cv.put(KEY_GRP_ORIGINATOR, grpMetaPtr->mOriginator.toStdString());
cv.put(KEY_GRP_AUTHEN_FLAGS, (int32_t)grpMetaPtr->mAuthenFlags);
cv.put(KEY_PARENT_GRP_ID, grpMetaPtr->mParentGrpId.toStdString());
cv.put(KEY_NXS_HASH, grpMetaPtr->mHash.toStdString());
cv.put(KEY_RECV_TS, (int32_t)grpMetaPtr->mRecvTS);
cv.put(KEY_GRP_REP_CUTOFF, (int32_t)grpMetaPtr->mReputationCutOff);
cv.put(KEY_NXS_IDENTITY, grpMetaPtr->mAuthorId.toStdString());
offset = 0;
char keySetData[grpMetaPtr->keys.TlvSize()];
grpMetaPtr->keys.SetTlv(keySetData, grpMetaPtr->keys.TlvSize(), &offset);
cv.put(KEY_KEY_SET, grpMetaPtr->keys.TlvSize(), keySetData);
offset = 0;
char keySetData[grpMetaPtr->keys.TlvSize()];
grpMetaPtr->keys.SetTlv(keySetData, grpMetaPtr->keys.TlvSize(), &offset);
cv.put(KEY_KEY_SET, grpMetaPtr->keys.TlvSize(), keySetData);
offset = 0;
char metaData[grpPtr->meta.TlvSize()];
grpPtr->meta.SetTlv(metaData, grpPtr->meta.TlvSize(), &offset);
cv.put(KEY_NXS_META, grpPtr->meta.TlvSize(), metaData);
offset = 0;
char metaData[grpPtr->meta.TlvSize()];
grpPtr->meta.SetTlv(metaData, grpPtr->meta.TlvSize(), &offset);
cv.put(KEY_NXS_META, grpPtr->meta.TlvSize(), metaData);
// local meta data
cv.put(KEY_GRP_SUBCR_FLAG, (int32_t)grpMetaPtr->mSubscribeFlags);
cv.put(KEY_GRP_POP, (int32_t)grpMetaPtr->mPop);
cv.put(KEY_MSG_COUNT, (int32_t)grpMetaPtr->mVisibleMsgCount);
cv.put(KEY_GRP_STATUS, (int32_t)grpMetaPtr->mGroupStatus);
cv.put(KEY_GRP_LAST_POST, (int32_t)grpMetaPtr->mLastPost);
// local meta data
cv.put(KEY_GRP_SUBCR_FLAG, (int32_t)grpMetaPtr->mSubscribeFlags);
cv.put(KEY_GRP_POP, (int32_t)grpMetaPtr->mPop);
cv.put(KEY_MSG_COUNT, (int32_t)grpMetaPtr->mVisibleMsgCount);
cv.put(KEY_GRP_STATUS, (int32_t)grpMetaPtr->mGroupStatus);
cv.put(KEY_GRP_LAST_POST, (int32_t)grpMetaPtr->mLastPost);
locked_clearGrpMetaCache(grpMetaPtr->mGroupId);
locked_clearGrpMetaCache(grpMetaPtr->mGroupId);
if (!mDb->sqlInsert(GRP_TABLE_NAME, "", cv))
{
std::cerr << "RsDataService::storeGroup() sqlInsert Failed";
std::cerr << std::endl;
std::cerr << "\t For GroupId: " << grpMetaPtr->mGroupId.toStdString();
std::cerr << std::endl;
}
}
if (!mDb->sqlInsert(GRP_TABLE_NAME, "", cv))
{
std::cerr << "RsDataService::storeGroup() sqlInsert Failed";
std::cerr << std::endl;
std::cerr << "\t For GroupId: " << grpMetaPtr->mGroupId.toStdString();
std::cerr << std::endl;
}
}
// finish transaction
bool ret = mDb->commitTransaction();
for(sit = grp.begin(); sit != grp.end(); ++sit)
{
//TODO: API encourages aliasing, remove this abomination
if(sit->second != sit->first->metaData)
delete sit->second;
delete sit->first;
}
return ret;
}
@ -918,21 +898,21 @@ void RsDataService::locked_clearGrpMetaCache(const RsGxsGroupId& gid)
mGrpMetaDataCache_ContainsAllDatabase = false;
}
int RsDataService::updateGroup(std::map<RsNxsGrp *, RsGxsGrpMetaData *> &grp)
int RsDataService::updateGroup(const std::list<RsNxsGrp *> &grp)
{
RsStackMutex stack(mDbMutex);
std::map<RsNxsGrp*, RsGxsGrpMetaData* >::iterator sit = grp.begin();
// begin transaction
mDb->beginTransaction();
for(; sit != grp.end(); ++sit)
for( std::list<RsNxsGrp*>::const_iterator sit = grp.begin(); sit != grp.end(); ++sit)
{
RsNxsGrp* grpPtr = sit->first;
RsGxsGrpMetaData* grpMetaPtr = sit->second;
RsNxsGrp* grpPtr = *sit;
RsGxsGrpMetaData* grpMetaPtr = grpPtr->metaData;
assert(grpMetaPtr != NULL);
// if data is larger than max item size do not add
if(!validSize(grpPtr)) continue;
@ -991,15 +971,6 @@ int RsDataService::updateGroup(std::map<RsNxsGrp *, RsGxsGrpMetaData *> &grp)
// finish transaction
bool ret = mDb->commitTransaction();
for(sit = grp.begin(); sit != grp.end(); ++sit)
{
//TODO: API encourages aliasing, remove this abomination
if(sit->second != sit->first->metaData)
delete sit->second;
delete sit->first;
}
return ret;
}

View File

@ -127,21 +127,21 @@ public:
* @param msg map of message and decoded meta data information
* @return error code
*/
int storeMessage(std::map<RsNxsMsg*, RsGxsMsgMetaData*>& msg);
int storeMessage(const std::list<RsNxsMsg*>& msg);
/*!
* Stores a list of groups in data store
* @param grp map of group and decoded meta data
* @return error code
*/
int storeGroup(std::map<RsNxsGrp*, RsGxsGrpMetaData*>& grp);
int storeGroup(const std::list<RsNxsGrp*>& grp);
/*!
* Updates group entries in Db
* @param grp map of group and decoded meta data
* @return error code
*/
int updateGroup(std::map<RsNxsGrp*, RsGxsGrpMetaData*>& grsp);
int updateGroup(const std::list<RsNxsGrp*>& grsp);
/*!
* @param metaData The meta data item to update

View File

@ -92,6 +92,7 @@ public:
uint32_t mMaxVisibleCount ;
bool mGrpAutoSync ;
bool mAllowMsgSync;
time_t mLastGroupModificationTS ;
};
typedef std::map<RsGxsGroupId, std::vector<RsNxsMsg*> > NxsMsgDataResult;
@ -222,14 +223,14 @@ public:
* @param msg map of message and decoded meta data information
* @return error code
*/
virtual int storeMessage(std::map<RsNxsMsg*, RsGxsMsgMetaData*>& msgs) = 0;
virtual int storeMessage(const std::list<RsNxsMsg*>& msgs) = 0;
/*!
* Stores a list of groups in data store
* @param grp map of group and decoded meta data
* @return error code
*/
virtual int storeGroup(std::map<RsNxsGrp*, RsGxsGrpMetaData*>& grsp) = 0;
virtual int storeGroup(const std::list<RsNxsGrp*>& grsp) = 0;
/*!
@ -237,7 +238,7 @@ public:
* @param grp map of group and decoded meta data
* @return error code
*/
virtual int updateGroup(std::map<RsNxsGrp*, RsGxsGrpMetaData*>& grsp) = 0;
virtual int updateGroup(const std::list<RsNxsGrp*>& grsp) = 0;
/*!
* @param metaData

File diff suppressed because it is too large Load Diff

View File

@ -117,9 +117,7 @@ public:
* @param gixs This is used for verification of msgs and groups received by Gen Exchange using identities.
* @param authenPolicy This determines the authentication used for verfying authorship of msgs and groups
*/
RsGenExchange(RsGeneralDataService* gds, RsNetworkExchangeService* ns,
RsSerialType* serviceSerialiser, uint16_t mServType, RsGixs* gixs, uint32_t authenPolicy,
uint32_t messageStorePeriod = RS_GXS_DEFAULT_MSG_STORE_PERIOD);
RsGenExchange(RsGeneralDataService* gds, RsNetworkExchangeService* ns, RsSerialType* serviceSerialiser, uint16_t mServType, RsGixs* gixs, uint32_t authenPolicy);
virtual ~RsGenExchange();
@ -260,6 +258,17 @@ public:
*/
virtual bool acceptNewGroup(const RsGxsGrpMetaData *grpMeta) ;
/*!
* \brief acceptNewMessage
* Early checks if the message can be accepted. This is mainly used to check wether the group is for instance overloaded and the service wants
* to put limitations to it.
* Returns true unless derived in GXS services.
*
* \param grpMeta Group metadata to check
* \return
*/
virtual bool acceptNewMessage(const RsGxsMsgMetaData *msgMeta, uint32_t size) ;
bool subscribeToGroup(uint32_t& token, const RsGxsGroupId& grpId, bool subscribe);
/*!
@ -299,8 +308,10 @@ protected:
* \return
*/
bool getSerializedGroupData(const uint32_t &token, RsGxsGroupId &id, unsigned char *& data, uint32_t& size);
bool deserializeGroupData(unsigned char *data, uint32_t size);
bool getSerializedGroupData(uint32_t token, RsGxsGroupId &id,
unsigned char *& data, uint32_t& size);
bool deserializeGroupData(unsigned char *data, uint32_t size,
RsGxsGroupId* gId = nullptr);
template<class GrpType>
bool getGroupDataT(const uint32_t &token, std::vector<GrpType*>& grpItem)
@ -338,11 +349,11 @@ public:
* @param token token to be redeemed for message item retrieval
* @param msgItems
*/
bool getMsgData(const uint32_t &token, GxsMsgDataMap& msgItems);
bool getMsgData(uint32_t token, GxsMsgDataMap& msgItems);
template <class MsgType>
bool getMsgDataT(const uint32_t &token, std::map<RsGxsGroupId,
std::vector<MsgType*> >& msgItems)
bool getMsgDataT( uint32_t token, std::map<RsGxsGroupId,
std::vector<MsgType*> >& msgItems)
{
GxsMsgDataMap msgData;
bool ok = getMsgData(token, msgData);
@ -379,7 +390,7 @@ public:
* @param token token to be redeemed for message item retrieval
* @param msgItems
*/
bool getMsgRelatedData(const uint32_t &token, GxsMsgRelatedDataMap& msgItems);
bool getMsgRelatedData(uint32_t token, GxsMsgRelatedDataMap& msgItems);
protected:
@ -652,7 +663,7 @@ public:
* \brief getDefaultStoragePeriod. All times in seconds.
* \return
*/
virtual uint32_t getDefaultStoragePeriod() { return MESSAGE_STORE_PERIOD; }
virtual uint32_t getDefaultStoragePeriod() { return mNetService->getDefaultKeepAge() ; }
virtual uint32_t getStoragePeriod(const RsGxsGroupId& grpId) ;
virtual void setStoragePeriod(const RsGxsGroupId& grpId,uint32_t age_in_secs) ;
@ -732,18 +743,19 @@ private:
*/
uint8_t createGroup(RsNxsGrp* grp, RsTlvSecurityKeySet& keySet);
protected:
/*!
* This completes the creation of an instance on RsNxsMsg
* by assigning it a groupId and signature via SHA1 and EVP_sign respectively
* What signatures are calculated are based on the authentication policy
* of the service
* @param msg the Nxs message to create
* CREATE_FAIL, CREATE_SUCCESS, CREATE_ID_SIGN_NOT_AVAIL
* @return CREATE_SUCCESS for success, CREATE_FAIL for fail,
* CREATE_FAIL_TRY_LATER for Id sign key not avail (but requested)
*/
int createMessage(RsNxsMsg* msg);
private:
/*!
* convenience function to create sign
* @param signSet signatures are stored here
@ -838,7 +850,7 @@ private:
* @param msgs messages to be filtered
* @param msgIdsNotify message notification map to be filtered
*/
void removeDeleteExistingMessages(RsGeneralDataService::MsgStoreMap& msgs, GxsMsgReq& msgIdsNotify);
void removeDeleteExistingMessages(std::list<RsNxsMsg*>& msgs, GxsMsgReq& msgIdsNotify);
RsMutex mGenMtx;
RsGxsDataAccess* mDataAccess;
@ -851,8 +863,8 @@ private:
std::vector<RsNxsMsg*> mReceivedMsgs;
typedef std::vector<GxsPendingItem<RsNxsGrp*, RsGxsGroupId> > NxsGrpPendValidVect;
NxsGrpPendValidVect mReceivedGrps;
typedef std::map<RsGxsGroupId,GxsPendingItem<RsNxsGrp*, RsGxsGroupId> > NxsGrpPendValidVect;
NxsGrpPendValidVect mGrpPendingValidate;
std::vector<GxsGrpPendingSign> mGrpsToPublish;
typedef std::vector<GxsGrpPendingSign> NxsGrpSignPendVect;
@ -873,13 +885,10 @@ private:
/// authentication policy
uint32_t mAuthenPolicy;
std::map<uint32_t, GxsPendingItem<RsGxsMsgItem*, uint32_t> >
mMsgPendingSign;
std::map<uint32_t, GxsPendingItem<RsGxsMsgItem*, uint32_t> > mMsgPendingSign;
std::vector<GxsPendingItem<RsNxsMsg*, RsGxsGrpMsgIdPair> > mMsgPendingValidate;
typedef std::vector<GxsPendingItem<RsNxsMsg*, RsGxsGrpMsgIdPair> > NxsMsgPendingVect;
const uint32_t MESSAGE_STORE_PERIOD;
typedef std::map<RsGxsMessageId,GxsPendingItem<RsNxsMsg*, RsGxsGrpMsgIdPair> > NxsMsgPendingVect;
NxsMsgPendingVect mMsgPendingValidate;
bool mCleaning;
time_t mLastClean;
@ -890,10 +899,10 @@ private:
time_t mLastCheck;
RsGxsIntegrityCheck* mIntegrityCheck;
private:
protected:
enum CreateStatus { CREATE_FAIL, CREATE_SUCCESS, CREATE_FAIL_TRY_LATER };
const uint8_t SIGN_MAX_WAITING_TIME;
// TODO: cleanup this should be an enum!
const uint8_t CREATE_FAIL, CREATE_SUCCESS, CREATE_FAIL_TRY_LATER, SIGN_MAX_WAITING_TIME;
const uint8_t SIGN_FAIL, SIGN_SUCCESS, SIGN_FAIL_TRY_LATER;
const uint8_t VALIDATE_FAIL, VALIDATE_SUCCESS, VALIDATE_FAIL_TRY_LATER, VALIDATE_MAX_WAITING_TIME;

View File

@ -103,7 +103,7 @@ typedef PGPIdType RsPgpId;
class RsGixs
{
public:
// TODO: cleanup this should be an enum!
static const uint32_t RS_GIXS_ERROR_NO_ERROR = 0x0000 ;
static const uint32_t RS_GIXS_ERROR_UNKNOWN = 0x0001 ;
static const uint32_t RS_GIXS_ERROR_KEY_NOT_AVAILABLE = 0x0002 ;
@ -119,8 +119,17 @@ public:
virtual bool signData(const uint8_t *data,uint32_t data_size,const RsGxsId& signer_id,RsTlvKeySignature& signature,uint32_t& signing_error) = 0 ;
virtual bool validateData(const uint8_t *data,uint32_t data_size,const RsTlvKeySignature& signature,bool force_load,const RsIdentityUsage& info,uint32_t& signing_error) = 0 ;
virtual bool encryptData(const uint8_t *clear_data,uint32_t clear_data_size,uint8_t *& encrypted_data,uint32_t& encrypted_data_size,const RsGxsId& encryption_key_id,bool force_load,uint32_t& encryption_error) = 0 ;
virtual bool decryptData(const uint8_t *encrypted_data,uint32_t encrypted_data_size,uint8_t *& clear_data,uint32_t& clear_data_size,const RsGxsId& encryption_key_id,uint32_t& encryption_error) = 0 ;
virtual bool encryptData( const uint8_t *clear_data,
uint32_t clear_data_size,
uint8_t *& encrypted_data,
uint32_t& encrypted_data_size,
const RsGxsId& encryption_key_id,
uint32_t& encryption_error, bool force_load) = 0 ;
virtual bool decryptData( const uint8_t *encrypted_data,
uint32_t encrypted_data_size,
uint8_t *& clear_data, uint32_t& clear_data_size,
const RsGxsId& encryption_key_id,
uint32_t& encryption_error, bool force_load) = 0 ;
virtual bool getOwnIds(std::list<RsGxsId>& ids) = 0;
virtual bool isOwnId(const RsGxsId& key_id) = 0 ;

View File

@ -45,6 +45,11 @@ RsGxsDataAccess::RsGxsDataAccess(RsGeneralDataService* ds) :
mDataStore(ds), mDataMutex("RsGxsDataAccess"), mNextToken(0) {}
RsGxsDataAccess::~RsGxsDataAccess()
{
for(std::map<uint32_t, GxsRequest*>::const_iterator it(mRequests.begin());it!=mRequests.end();++it)
delete it->second ;
}
bool RsGxsDataAccess::requestGroupInfo(uint32_t &token, uint32_t ansType, const RsTokReqOptions &opts,
const std::list<RsGxsGroupId> &groupIds)
{
@ -1803,8 +1808,8 @@ bool RsGxsDataAccess::addGroupData(RsNxsGrp* grp) {
RsStackMutex stack(mDataMutex);
std::map<RsNxsGrp*, RsGxsGrpMetaData*> grpM;
grpM.insert(std::make_pair(grp, grp->metaData));
std::list<RsNxsGrp*> grpM;
grpM.push_back(grp);
return mDataStore->storeGroup(grpM);
}
@ -1812,8 +1817,8 @@ bool RsGxsDataAccess::updateGroupData(RsNxsGrp* grp) {
RsStackMutex stack(mDataMutex);
std::map<RsNxsGrp*, RsGxsGrpMetaData*> grpM;
grpM.insert(std::make_pair(grp, grp->metaData));
std::list<RsNxsGrp*> grpM;
grpM.push_back(grp);
return mDataStore->updateGroup(grpM);
}
@ -1821,8 +1826,8 @@ bool RsGxsDataAccess::addMsgData(RsNxsMsg* msg) {
RsStackMutex stack(mDataMutex);
std::map<RsNxsMsg*, RsGxsMsgMetaData*> msgM;
msgM.insert(std::make_pair(msg, msg->metaData));
std::list<RsNxsMsg*> msgM;
msgM.push_back(msg);
return mDataStore->storeMessage(msgM);
}

View File

@ -38,7 +38,7 @@ class RsGxsDataAccess : public RsTokenService
{
public:
RsGxsDataAccess(RsGeneralDataService* ds);
virtual ~RsGxsDataAccess() { return ;}
virtual ~RsGxsDataAccess() ;
public:

View File

@ -244,11 +244,13 @@
// A small value for MAX_REQLIST_SIZE is likely to help messages to propagate in a chaotic network, but will also slow them down.
// A small SYNC_PERIOD fasten message propagation, but is likely to overload the server side of transactions (e.g. overload outqueues).
//
static const uint32_t GIXS_CUT_OFF = 0;
//static const uint32_t GIXS_CUT_OFF = 0;
static const uint32_t SYNC_PERIOD = 60;
static const uint32_t MAX_REQLIST_SIZE = 20; // No more than 20 items per msg request list => creates smaller transactions that are less likely to be cancelled.
static const uint32_t TRANSAC_TIMEOUT = 2000; // In seconds. Has been increased to avoid epidemic transaction cancelling due to overloaded outqueues.
#ifdef TO_REMOVE
static const uint32_t SECURITY_DELAY_TO_FORCE_CLIENT_REUPDATE = 3600; // force re-update if there happens to be a large delay between our server side TS and the client side TS of friends
#endif
static const uint32_t REJECTED_MESSAGE_RETRY_DELAY = 24*3600; // re-try rejected messages every 24hrs. Most of the time this is because the peer's reputation has changed.
static const uint32_t GROUP_STATS_UPDATE_DELAY = 240; // update unsubscribed group statistics every 3 mins
static const uint32_t GROUP_STATS_UPDATE_NB_PEERS = 2; // number of peers to which the group stats are asked
@ -268,7 +270,7 @@ static const uint32_t RS_NXS_ITEM_ENCRYPTION_STATUS_GXS_KEY_MISSING = 0x05 ;
static const RsPeerId peer_to_print = RsPeerId(std::string("")) ;
static const RsGxsGroupId group_id_to_print = RsGxsGroupId(std::string("")) ; // use this to allow to this group id only, or "" for all IDs
static const uint32_t service_to_print = 0x215 ; // use this to allow to this service id only, or 0 for all services
static const uint32_t service_to_print = RS_SERVICE_TYPE_GXS_TRANS ; // use this to allow to this service id only, or 0 for all services
// warning. Numbers should be SERVICE IDS (see serialiser/rsserviceids.h. E.g. 0x0215 for forums)
class nullstream: public std::ostream {};
@ -311,7 +313,7 @@ RsGxsNetService::RsGxsNetService(uint16_t servType, RsGeneralDataService *gds,
RsNxsNetMgr *netMgr, RsNxsObserver *nxsObs,
const RsServiceInfo serviceInfo,
RsGixsReputation* reputations, RsGcxs* circles, RsGixs *gixs,
PgpAuxUtils *pgpUtils, bool grpAutoSync,bool msgAutoSync)
PgpAuxUtils *pgpUtils, bool grpAutoSync, bool msgAutoSync, uint32_t default_store_period, uint32_t default_sync_period)
: p3ThreadedService(), p3Config(), mTransactionN(0),
mObserver(nxsObs), mDataStore(gds),
mServType(servType), mTransactionTimeOut(TRANSAC_TIMEOUT),
@ -321,11 +323,20 @@ RsGxsNetService::RsGxsNetService(uint16_t servType, RsGeneralDataService *gds,
mCircles(circles), mGixs(gixs),
mReputations(reputations), mPgpUtils(pgpUtils),
mGrpAutoSync(grpAutoSync), mAllowMsgSync(msgAutoSync),
mServiceInfo(serviceInfo)
mServiceInfo(serviceInfo), mDefaultMsgStorePeriod(default_store_period),
mDefaultMsgSyncPeriod(default_sync_period)
{
addSerialType(new RsNxsSerialiser(mServType));
mOwnId = mNetMgr->getOwnId();
mUpdateCounter = 0;
// check the consistency
if(mDefaultMsgStorePeriod > 0 && mDefaultMsgSyncPeriod > mDefaultMsgStorePeriod)
{
std::cerr << "(WW) in GXS service \"" << getServiceInfo().mServiceName << "\": too large message sync period will be set to message store period." << std::endl;
mDefaultMsgSyncPeriod = mDefaultMsgStorePeriod ;
}
}
void RsGxsNetService::getItemNames(std::map<uint8_t,std::string>& names) const
@ -447,6 +458,9 @@ void RsGxsNetService::rejectMessage(const RsGxsMessageId& msg_id)
{
RS_STACK_MUTEX(mNxsMutex) ;
#ifdef NXS_NET_DEBUG_0
GXSNETDEBUG___ << "adding message " << msg_id << " to rejection list for 24hrs." << std::endl;
#endif
mRejectedMessages[msg_id] = time(NULL) ;
}
void RsGxsNetService::cleanRejectedMessages()
@ -537,14 +551,13 @@ void RsGxsNetService::syncWithPeers()
#ifndef GXS_DISABLE_SYNC_MSGS
typedef RsGxsMetaDataTemporaryMap<RsGxsGrpMetaData> GrpMetaMap;
GrpMetaMap grpMeta;
RsGxsGrpMetaTemporaryMap grpMeta;
mDataStore->retrieveGxsGrpMetaData(grpMeta);
GrpMetaMap toRequest;
RsGxsGrpMetaTemporaryMap toRequest;
for(GrpMetaMap::iterator mit = grpMeta.begin(); mit != grpMeta.end(); ++mit)
for(RsGxsGrpMetaTemporaryMap::iterator mit = grpMeta.begin(); mit != grpMeta.end(); ++mit)
{
RsGxsGrpMetaData* meta = mit->second;
@ -582,7 +595,7 @@ void RsGxsNetService::syncWithPeers()
GXSNETDEBUG_P_(peerId) << " syncing messages with peer " << peerId << std::endl;
#endif
GrpMetaMap::const_iterator mmit = toRequest.begin();
RsGxsGrpMetaTemporaryMap::const_iterator mmit = toRequest.begin();
for(; mmit != toRequest.end(); ++mmit)
{
const RsGxsGrpMetaData* meta = mmit->second;
@ -595,9 +608,9 @@ void RsGxsNetService::syncWithPeers()
#ifdef NXS_NET_DEBUG_0
GXSNETDEBUG_PG(peerId,grpId) << " peer can send messages for group " << grpId ;
if(!encrypt_to_this_circle_id.isNull())
std::cerr << " request should be encrypted for circle ID " << encrypt_to_this_circle_id << std::endl;
GXSNETDEBUG_PG(peerId,grpId) << " request should be encrypted for circle ID " << encrypt_to_this_circle_id << std::endl;
else
std::cerr << " request should be sent in clear." << std::endl;
GXSNETDEBUG_PG(peerId,grpId) << " request should be sent in clear." << std::endl;
#endif
// On default, the info has never been received so the TS is 0, meaning the peer has sent that it had no information.
@ -620,8 +633,8 @@ void RsGxsNetService::syncWithPeers()
msg->PeerId(peerId);
msg->updateTS = updateTS;
int req_delay = (int)mServerGrpConfigMap[grpId].msg_req_delay ;
int keep_delay = (int)mServerGrpConfigMap[grpId].msg_keep_delay ;
int req_delay = (int)locked_getGrpConfig(grpId).msg_req_delay ;
int keep_delay = (int)locked_getGrpConfig(grpId).msg_keep_delay ;
// If we store for less than we request, we request less, otherwise the posts will be deleted after being obtained.
@ -664,7 +677,7 @@ void RsGxsNetService::syncGrpStatistics()
#ifdef NXS_NET_DEBUG_6
GXSNETDEBUG___<< "Sync-ing group statistics." << std::endl;
#endif
RsGxsMetaDataTemporaryMap<RsGxsGrpMetaData> grpMeta;
RsGxsGrpMetaTemporaryMap grpMeta;
mDataStore->retrieveGxsGrpMetaData(grpMeta);
@ -678,12 +691,13 @@ void RsGxsNetService::syncGrpStatistics()
for(std::map<RsGxsGroupId,RsGxsGrpMetaData*>::const_iterator it(grpMeta.begin());it!=grpMeta.end();++it)
{
const RsGxsGrpConfig& rec = mServerGrpConfigMap[it->first] ;
const RsGxsGrpConfig& rec = locked_getGrpConfig(it->first) ;
#ifdef NXS_NET_DEBUG_6
GXSNETDEBUG__G(it->first) << " group " << it->first ;
#endif
if(rec.update_TS + GROUP_STATS_UPDATE_DELAY < now && rec.suppliers.ids.size() > 0)
if(rec.statistics_update_TS + GROUP_STATS_UPDATE_DELAY < now && rec.suppliers.ids.size() > 0)
{
#ifdef NXS_NET_DEBUG_6
GXSNETDEBUG__G(it->first) << " needs update. Randomly asking to some friends" << std::endl;
@ -736,7 +750,7 @@ void RsGxsNetService::handleRecvSyncGrpStatistics(RsNxsSyncGrpStatsItem *grs)
#ifdef NXS_NET_DEBUG_6
GXSNETDEBUG_PG(grs->PeerId(),grs->grpId) << "Received Grp update stats Request for group " << grs->grpId << " from friend " << grs->PeerId() << std::endl;
#endif
RsGxsMetaDataTemporaryMap<RsGxsGrpMetaData> grpMetas;
RsGxsGrpMetaTemporaryMap grpMetas;
grpMetas[grs->grpId] = NULL;
mDataStore->retrieveGxsGrpMetaData(grpMetas);
@ -783,7 +797,10 @@ void RsGxsNetService::handleRecvSyncGrpStatistics(RsNxsSyncGrpStatsItem *grs)
grs_resp->grpId = grs->grpId;
grs_resp->PeerId(grs->PeerId()) ;
grs_resp->last_post_TS = 0 ;
grs_resp->last_post_TS = grpMeta->mPublishTs ; // This is not zero, and necessarily older than any message in the group up to clock precision.
// This allows us to use 0 as "uninitialized" proof. If the group meta has been changed, this time
// will be more recent than some messages. This shouldn't be a problem, since this value can only
// be used to discard groups that are not used.
for(uint32_t i=0;i<vec.size();++i)
{
@ -804,14 +821,16 @@ void RsGxsNetService::handleRecvSyncGrpStatistics(RsNxsSyncGrpStatsItem *grs)
GXSNETDEBUG_PG(grs->PeerId(),grs->grpId) << "Received Grp update stats item from peer " << grs->PeerId() << " for group " << grs->grpId << ", reporting " << grs->number_of_posts << " posts." << std::endl;
#endif
RS_STACK_MUTEX(mNxsMutex) ;
RsGxsGrpConfig& rec(mServerGrpConfigMap[grs->grpId]) ;
RsGxsGrpConfig& rec(locked_getGrpConfig(grs->grpId)) ;
uint32_t old_count = rec.max_visible_count ;
uint32_t old_suppliers_count = rec.suppliers.ids.size() ;
rec.suppliers.ids.insert(grs->PeerId()) ;
rec.max_visible_count = std::max(rec.max_visible_count,grs->number_of_posts) ;
rec.update_TS = time(NULL) ;
rec.statistics_update_TS = time(NULL) ;
rec.last_group_modification_TS = grs->last_post_TS;
if (old_count != rec.max_visible_count || old_suppliers_count != rec.suppliers.ids.size())
mNewStatsToNotify.insert(grs->grpId) ;
@ -845,8 +864,8 @@ void RsGxsNetService::subscribeStatusChanged(const RsGxsGroupId& grpId,bool subs
#ifdef NXS_NET_DEBUG_0
GXSNETDEBUG__G(grpId) << "Changing subscribe status for grp " << grpId << " to " << subscribed << ": reseting all server msg time stamps for this group, and server global TS." << std::endl;
#endif
std::map<RsGxsGroupId,RsGxsServerMsgUpdate>::iterator it = mServerMsgUpdateMap.find(grpId) ;
#endif
RsGxsServerMsgUpdate& item(mServerMsgUpdateMap[grpId]) ;
@ -1419,7 +1438,7 @@ bool RsGxsNetService::loadList(std::list<RsItem *> &load)
// the update time stamp is randomised so as not to ask all friends at once about group statistics.
it->second.update_TS = now - GROUP_STATS_UPDATE_DELAY + (RSRandom::random_u32()%(GROUP_STATS_UPDATE_DELAY/10)) ;
it->second.statistics_update_TS = now - GROUP_STATS_UPDATE_DELAY + (RSRandom::random_u32()%(GROUP_STATS_UPDATE_DELAY/10)) ;
// Similarly, we remove all suppliers.
// Actual suppliers will come back automatically.
@ -1839,7 +1858,7 @@ void RsGxsNetService::debugDump()
GXSNETDEBUG_PG(it->first,it2->first) << " group " << it2->first << " - last updated at peer (secs ago): " << nice_time_stamp(time(NULL),it2->second.time_stamp) << ". Message count=" << it2->second.message_count << std::endl;
}
GXSNETDEBUG___<< " List of rejected message ids: " << mRejectedMessages.size() << std::endl;
GXSNETDEBUG___<< " List of rejected message ids: " << std::dec << mRejectedMessages.size() << std::endl;
#endif
}
@ -1885,7 +1904,7 @@ void RsGxsNetService::updateClientSyncTS()
void RsGxsNetService::updateServerSyncTS()
{
RsGxsMetaDataTemporaryMap<RsGxsGrpMetaData> gxsMap;
RsGxsGrpMetaTemporaryMap gxsMap;
#ifdef NXS_NET_DEBUG_0
GXSNETDEBUG___<< "updateServerSyncTS(): updating last modification time stamp of local data." << std::endl;
@ -2293,6 +2312,7 @@ bool RsGxsNetService::getGroupNetworkStats(const RsGxsGroupId& gid,RsGroupNetwor
stats.mMaxVisibleCount = it->second.max_visible_count ;
stats.mAllowMsgSync = mAllowMsgSync ;
stats.mGrpAutoSync = mGrpAutoSync ;
stats.mLastGroupModificationTS = it->second.last_group_modification_TS ;
return true ;
}
@ -2412,7 +2432,9 @@ void RsGxsNetService::locked_processCompletedIncomingTrans(NxsTransaction* tr)
RsPeerId peerFrom = tr->mTransaction->PeerId();
uint32_t updateTS = tr->mTransaction->updateTS;
#ifdef NXS_NET_DEBUG_0
ClientGrpMap::iterator it = mClientGrpUpdateMap.find(peerFrom);
#endif
RsGxsGrpUpdate& item(mClientGrpUpdateMap[peerFrom]) ;
@ -2681,7 +2703,7 @@ void RsGxsNetService::locked_genReqMsgTransaction(NxsTransaction* tr)
uint32_t mcount = msgItemL.size() ;
RsPeerId pid = msgItemL.front()->PeerId() ;
RsGxsGrpConfig& gnsr(mServerGrpConfigMap[grpId]) ;
RsGxsGrpConfig& gnsr(locked_getGrpConfig(grpId));
std::set<RsPeerId>::size_type oldSuppliersCount = gnsr.suppliers.ids.size();
uint32_t oldVisibleCount = gnsr.max_visible_count;
@ -2696,7 +2718,7 @@ void RsGxsNetService::locked_genReqMsgTransaction(NxsTransaction* tr)
GXSNETDEBUG_PG(item->PeerId(),grpId) << " grpId = " << grpId << std::endl;
GXSNETDEBUG_PG(item->PeerId(),grpId) << " retrieving grp mesta data..." << std::endl;
#endif
RsGxsMetaDataTemporaryMap<RsGxsGrpMetaData> grpMetaMap;
RsGxsGrpMetaTemporaryMap grpMetaMap;
grpMetaMap[grpId] = NULL;
mDataStore->retrieveGxsGrpMetaData(grpMetaMap);
@ -2954,7 +2976,7 @@ void RsGxsNetService::locked_genReqGrpTransaction(NxsTransaction* tr)
#endif
std::list<RsNxsSyncGrpItem*> grpItemL;
RsGxsMetaDataTemporaryMap<RsGxsGrpMetaData> grpMetaMap;
RsGxsGrpMetaTemporaryMap grpMetaMap;
for(std::list<RsNxsItem*>::iterator lit = tr->mItems.begin(); lit != tr->mItems.end(); ++lit)
{
@ -3063,7 +3085,7 @@ void RsGxsNetService::locked_genSendGrpsTransaction(NxsTransaction* tr)
std::list<RsNxsItem*>::iterator lit = tr->mItems.begin();
RsGxsMetaDataTemporaryMap<RsNxsGrp> grps ;
t_RsGxsGenericDataTemporaryMap<RsGxsGroupId,RsNxsGrp> grps ;
for(;lit != tr->mItems.end(); ++lit)
{
@ -3780,7 +3802,7 @@ void RsGxsNetService::handleRecvSyncGroup(RsNxsSyncGrpReqItem *item)
return;
}
RsGxsMetaDataTemporaryMap<RsGxsGrpMetaData> grp;
RsGxsGrpMetaTemporaryMap grp;
mDataStore->retrieveGxsGrpMetaData(grp);
#ifdef NXS_NET_DEBUG_0
@ -4055,7 +4077,7 @@ void RsGxsNetService::handleRecvSyncMessage(RsNxsSyncMsgReqItem *item,bool item_
if(grp_is_known || mServerGrpConfigMap.find(item->grpId)!=mServerGrpConfigMap.end())
{
RsGxsGrpConfig & rec(mServerGrpConfigMap[item->grpId]) ; // this creates it if needed. When the grp is unknown (and hashed) this will would create a unused entry
RsGxsGrpConfig& rec(locked_getGrpConfig(item->grpId)); // this creates it if needed. When the grp is unknown (and hashed) this will would create a unused entry
rec.suppliers.ids.insert(peer) ;
}
if(!peer_can_receive_update)
@ -4066,7 +4088,7 @@ void RsGxsNetService::handleRecvSyncMessage(RsNxsSyncMsgReqItem *item,bool item_
return;
}
RsGxsMetaDataTemporaryMap<RsGxsGrpMetaData> grpMetas;
RsGxsGrpMetaTemporaryMap grpMetas;
grpMetas[item->grpId] = NULL;
mDataStore->retrieveGxsGrpMetaData(grpMetas);
@ -4125,7 +4147,7 @@ void RsGxsNetService::handleRecvSyncMessage(RsNxsSyncMsgReqItem *item,bool item_
time_t now = time(NULL) ;
uint32_t max_send_delay = mServerGrpConfigMap[item->grpId].msg_req_delay; // we should use "sync" but there's only one variable used in the GUI: the req one.
uint32_t max_send_delay = locked_getGrpConfig(item->grpId).msg_req_delay; // we should use "sync" but there's only one variable used in the GUI: the req one.
if(canSendMsgIds(msgMetas, *grpMeta, peer, should_encrypt_to_this_circle_id))
{
@ -4414,7 +4436,7 @@ bool RsGxsNetService::checkPermissionsForFriendGroup(const RsPeerId& sslId,const
void RsGxsNetService::pauseSynchronisation(bool /* enabled */)
{
std::cerr << "(EE) RsGxsNetService::pauseSynchronisation() called, but not implemented." << std::endl;
}
void RsGxsNetService::setSyncAge(const RsGxsGroupId &grpId, uint32_t age_in_secs)
@ -4423,7 +4445,7 @@ void RsGxsNetService::setSyncAge(const RsGxsGroupId &grpId, uint32_t age_in_secs
locked_checkDelay(age_in_secs) ;
RsGxsGrpConfig& conf(mServerGrpConfigMap[grpId]) ;
RsGxsGrpConfig& conf(locked_getGrpConfig(grpId));
if(conf.msg_req_delay != age_in_secs)
{
@ -4441,7 +4463,7 @@ void RsGxsNetService::setKeepAge(const RsGxsGroupId &grpId, uint32_t age_in_secs
locked_checkDelay(age_in_secs) ;
RsGxsGrpConfig& conf(mServerGrpConfigMap[grpId]) ;
RsGxsGrpConfig& conf(locked_getGrpConfig(grpId));
if(conf.msg_keep_delay != age_in_secs)
{
@ -4450,27 +4472,39 @@ void RsGxsNetService::setKeepAge(const RsGxsGroupId &grpId, uint32_t age_in_secs
}
}
RsGxsGrpConfig& RsGxsNetService::locked_getGrpConfig(const RsGxsGroupId& grp_id)
{
GrpConfigMap::iterator it = mServerGrpConfigMap.find(grp_id);
if(it == mServerGrpConfigMap.end())
{
RsGxsGrpConfig& conf(mServerGrpConfigMap[grp_id]) ;
conf.msg_keep_delay = mDefaultMsgStorePeriod;
conf.msg_send_delay = mDefaultMsgSyncPeriod;
conf.msg_req_delay = mDefaultMsgSyncPeriod;
conf.max_visible_count = 0 ;
conf.statistics_update_TS = 0 ;
conf.last_group_modification_TS = 0 ;
return conf ;
}
else
return it->second;
}
uint32_t RsGxsNetService::getSyncAge(const RsGxsGroupId& grpId)
{
RS_STACK_MUTEX(mNxsMutex) ;
GrpConfigMap::const_iterator it = mServerGrpConfigMap.find(grpId) ;
if(it == mServerGrpConfigMap.end())
return RS_GXS_DEFAULT_MSG_REQ_PERIOD ;
else
return it->second.msg_req_delay ;
return locked_getGrpConfig(grpId).msg_req_delay ;
}
uint32_t RsGxsNetService::getKeepAge(const RsGxsGroupId& grpId,uint32_t default_value)
uint32_t RsGxsNetService::getKeepAge(const RsGxsGroupId& grpId)
{
RS_STACK_MUTEX(mNxsMutex) ;
GrpConfigMap::const_iterator it = mServerGrpConfigMap.find(grpId) ;
if(it == mServerGrpConfigMap.end())
return default_value ;
else
return it->second.msg_keep_delay ;
return locked_getGrpConfig(grpId).msg_keep_delay ;
}
int RsGxsNetService::requestGrp(const std::list<RsGxsGroupId>& grpId, const RsPeerId& peerId)
@ -4593,7 +4627,7 @@ void RsGxsNetService::sharePublishKeysPending()
// Get the meta data for this group Id
//
RsGxsMetaDataTemporaryMap<RsGxsGrpMetaData> grpMetaMap;
RsGxsGrpMetaTemporaryMap grpMetaMap;
grpMetaMap[mit->first] = NULL;
mDataStore->retrieveGxsGrpMetaData(grpMetaMap);
@ -4677,7 +4711,7 @@ void RsGxsNetService::handleRecvPublishKeys(RsNxsGroupPublishKeyItem *item)
// Get the meta data for this group Id
//
RsGxsMetaDataTemporaryMap<RsGxsGrpMetaData> grpMetaMap;
RsGxsGrpMetaTemporaryMap grpMetaMap;
grpMetaMap[item->grpId] = NULL;
mDataStore->retrieveGxsGrpMetaData(grpMetaMap);
@ -4773,6 +4807,8 @@ bool RsGxsNetService::removeGroups(const std::list<RsGxsGroupId>& groups)
GXSNETDEBUG__G(*git) << " deleting info for group " << *git << std::endl;
#endif
// Here we do not use locked_getGrpConfig() because we dont want the entry to be created if it doesnot already exist.
GrpConfigMap::iterator it = mServerGrpConfigMap.find(*git) ;
if(it != mServerGrpConfigMap.end())

View File

@ -71,13 +71,10 @@ class RsGroupNetworkStatsRecord
* Incoming transaction are in 3 different states
* 1. START 2. RECEIVING 3. END
*/
class RsGxsNetService : public RsNetworkExchangeService, public p3ThreadedService,
public p3Config
class RsGxsNetService : public RsNetworkExchangeService, public p3ThreadedService, public p3Config
{
public:
typedef RsSharedPtr<RsGxsNetService> pointer;
static const uint32_t FRAGMENT_SIZE;
/*!
* only one observer is allowed
@ -88,18 +85,21 @@ public:
* arrive
*/
RsGxsNetService(uint16_t servType, RsGeneralDataService *gds,
RsNxsNetMgr *netMgr,
RsNxsObserver *nxsObs, // used to be = NULL.
const RsServiceInfo serviceInfo,
RsGixsReputation* reputations = NULL, RsGcxs* circles = NULL, RsGixs *gixs=NULL,
PgpAuxUtils *pgpUtils = NULL,
bool grpAutoSync = true, bool msgAutoSync = true);
RsNxsNetMgr *netMgr,
RsNxsObserver *nxsObs, // used to be = NULL.
const RsServiceInfo serviceInfo,
RsGixsReputation* reputations = NULL, RsGcxs* circles = NULL, RsGixs *gixs=NULL,
PgpAuxUtils *pgpUtils = NULL,
bool grpAutoSync = true, bool msgAutoSync = true,
uint32_t default_store_period = RS_GXS_DEFAULT_MSG_STORE_PERIOD,
uint32_t default_sync_period = RS_GXS_DEFAULT_MSG_REQ_PERIOD);
virtual ~RsGxsNetService();
virtual RsServiceInfo getServiceInfo() { return mServiceInfo; }
virtual void getItemNames(std::map<uint8_t,std::string>& names) const ;
public:
@ -111,9 +111,13 @@ public:
virtual void setKeepAge(const RsGxsGroupId& grpId,uint32_t age_in_secs);
virtual uint32_t getSyncAge(const RsGxsGroupId& id);
virtual uint32_t getKeepAge(const RsGxsGroupId& id,uint32_t default_value);
virtual uint32_t getKeepAge(const RsGxsGroupId& id);
virtual uint32_t getDefaultSyncAge() { return RS_GXS_DEFAULT_MSG_REQ_PERIOD ; }
virtual uint32_t getDefaultSyncAge() { return mDefaultMsgSyncPeriod ; }
virtual uint32_t getDefaultKeepAge() { return mDefaultMsgStorePeriod ; }
virtual void setDefaultKeepAge(uint32_t t) { mDefaultMsgStorePeriod = t ; }
virtual void setDefaultSyncAge(uint32_t t) { mDefaultMsgSyncPeriod = t ; }
/*!
* pauses synchronisation of subscribed groups and request for group id
@ -413,6 +417,7 @@ private:
static RsGxsGroupId hashGrpId(const RsGxsGroupId& gid,const RsPeerId& pid) ;
RsGxsGrpConfig& locked_getGrpConfig(const RsGxsGroupId& grp_id);
private:
typedef std::vector<RsNxsGrp*> GrpFragments;
@ -573,6 +578,9 @@ private:
std::set<RsGxsGroupId> mNewPublishKeysToNotify ;
void debugDump();
uint32_t mDefaultMsgStorePeriod ;
uint32_t mDefaultMsgSyncPeriod ;
};
#endif // RSGXSNETSERVICE_H

View File

@ -35,7 +35,9 @@ static const uint32_t MAX_GXS_IDS_REQUESTS_NET = 10 ; // max number of reques
//#define DEBUG_GXSUTIL 1
#define GXSUTIL_DEBUG() std::cerr << time(NULL) << " : GXS_UTIL : " << __FUNCTION__ << " : "
#ifdef DEBUG_GXSUTIL
#define GXSUTIL_DEBUG() std::cerr << "[" << time(NULL) << "] : GXS_UTIL : " << __FUNCTION__ << " : "
#endif
RsGxsMessageCleanUp::RsGxsMessageCleanUp(RsGeneralDataService* const dataService, RsGenExchange *genex, uint32_t chunkSize)
: mDs(dataService), mGenExchangeClient(genex), CHUNK_SIZE(chunkSize)
@ -57,7 +59,8 @@ bool RsGxsMessageCleanUp::clean()
time_t now = time(NULL);
#ifdef DEBUG_GXSUTIL
GXSUTIL_DEBUG() << " Cleaning up groups in service" << std::hex << mGenExchangeClient->serviceType() << std::dec << std::endl;
uint16_t service_type = mGenExchangeClient->serviceType() ;
GXSUTIL_DEBUG() << " Cleaning up groups in service " << std::hex << service_type << std::dec << std::endl;
#endif
while(!mGrpMeta.empty())
{
@ -97,8 +100,10 @@ bool RsGxsMessageCleanUp::clean()
{
RsGxsMsgMetaData* meta = metaV[i];
bool have_kids = (messages_with_kids.find(meta->mMsgId)!=messages_with_kids.end());
// check if expired
bool remove = store_period > 0 && ((meta->mPublishTs + store_period) < now) && (messages_with_kids.find(meta->mMsgId)==messages_with_kids.end());
bool remove = store_period > 0 && ((meta->mPublishTs + store_period) < now) && !have_kids;
// check client does not want the message kept regardless of age
remove &= !(meta->mMsgStatus & GXS_SERV::GXS_MSG_STATUS_KEEP);
@ -107,12 +112,22 @@ bool RsGxsMessageCleanUp::clean()
remove = remove || (grpMeta->mSubscribeFlags & GXS_SERV::GROUP_SUBSCRIBE_NOT_SUBSCRIBED);
remove = remove || !(grpMeta->mSubscribeFlags & GXS_SERV::GROUP_SUBSCRIBE_SUBSCRIBED);
#ifdef DEBUG_GXSUTIL
GXSUTIL_DEBUG() << " msg id " << meta->mMsgId << " in grp " << grpId << ": keep_flag=" << bool(meta->mMsgStatus & GXS_SERV::GXS_MSG_STATUS_KEEP)
<< " subscribed: " << bool(grpMeta->mSubscribeFlags & GXS_SERV::GROUP_SUBSCRIBE_SUBSCRIBED) << " store_period: " << store_period
<< " kids: " << have_kids << " now - meta->mPublishTs: " << now - meta->mPublishTs ;
#endif
if( remove )
{
req[grpId].push_back(meta->mMsgId);
GXSUTIL_DEBUG() << " Scheduling msg id " << meta->mMsgId << " in grp " << grpId << " for removal." << std::endl;
#ifdef DEBUG_GXSUTIL
std::cerr << " Scheduling for removal." << std::endl;
#endif
}
else
std::cerr << std::endl;
delete meta;
}
@ -136,6 +151,9 @@ RsGxsIntegrityCheck::RsGxsIntegrityCheck(RsGeneralDataService* const dataService
void RsGxsIntegrityCheck::run()
{
check();
RsStackMutex stack(mIntegrityMutex);
mDone = true;
}
bool RsGxsIntegrityCheck::check()
@ -286,71 +304,72 @@ bool RsGxsIntegrityCheck::check()
mDs->removeMsgs(msgsToDel);
RsStackMutex stack(mIntegrityMutex);
mDone = true;
{
RsStackMutex stack(mIntegrityMutex);
std::vector<RsGxsGroupId>::iterator grpIt;
for(grpIt = grpsToDel.begin(); grpIt != grpsToDel.end(); ++grpIt)
{
mDeletedGrps.push_back(*grpIt);
}
mDeletedMsgs = msgsToDel;
std::vector<RsGxsGroupId>::iterator grpIt;
for(grpIt = grpsToDel.begin(); grpIt != grpsToDel.end(); ++grpIt)
{
mDeletedGrps.push_back(*grpIt);
}
mDeletedMsgs = msgsToDel;
#ifdef DEBUG_GXSUTIL
GXSUTIL_DEBUG() << "At end of pass, this is the list used GXS ids: " << std::endl;
GXSUTIL_DEBUG() << " requesting them to GXS identity service to enforce loading." << std::endl;
GXSUTIL_DEBUG() << "At end of pass, this is the list used GXS ids: " << std::endl;
GXSUTIL_DEBUG() << " requesting them to GXS identity service to enforce loading." << std::endl;
#endif
std::list<RsPeerId> connected_friends ;
rsPeers->getOnlineList(connected_friends) ;
std::list<RsPeerId> connected_friends ;
rsPeers->getOnlineList(connected_friends) ;
std::vector<std::pair<RsGxsId,RsIdentityUsage> > gxs_ids ;
std::vector<std::pair<RsGxsId,RsIdentityUsage> > gxs_ids ;
for(std::map<RsGxsId,RsIdentityUsage>::const_iterator it(used_gxs_ids.begin());it!=used_gxs_ids.end();++it)
{
gxs_ids.push_back(*it) ;
for(std::map<RsGxsId,RsIdentityUsage>::const_iterator it(used_gxs_ids.begin());it!=used_gxs_ids.end();++it)
{
gxs_ids.push_back(*it) ;
#ifdef DEBUG_GXSUTIL
GXSUTIL_DEBUG() << " " << *it << std::endl;
GXSUTIL_DEBUG() << " " << it->first << std::endl;
#endif
}
uint32_t nb_requested_not_in_cache = 0;
}
uint32_t nb_requested_not_in_cache = 0;
#ifdef DEBUG_GXSUTIL
GXSUTIL_DEBUG() << " issuing random get on friends for non existing IDs" << std::endl;
GXSUTIL_DEBUG() << " issuing random get on friends for non existing IDs" << std::endl;
#endif
// now request a cache update for them, which triggers downloading from friends, if missing.
// now request a cache update for them, which triggers downloading from friends, if missing.
for(;nb_requested_not_in_cache<MAX_GXS_IDS_REQUESTS_NET && !gxs_ids.empty();)
{
uint32_t n = RSRandom::random_u32() % gxs_ids.size() ;
for(;nb_requested_not_in_cache<MAX_GXS_IDS_REQUESTS_NET && !gxs_ids.empty();)
{
uint32_t n = RSRandom::random_u32() % gxs_ids.size() ;
#ifdef DEBUG_GXSUTIL
GXSUTIL_DEBUG() << " requesting ID " << gxs_ids[n] ;
GXSUTIL_DEBUG() << " requesting ID " << gxs_ids[n].first ;
#endif
if(!mGixs->haveKey(gxs_ids[n].first)) // checks if we have it already in the cache (conservative way to ensure that we atually have it)
{
mGixs->requestKey(gxs_ids[n].first,connected_friends,gxs_ids[n].second);
if(!mGixs->haveKey(gxs_ids[n].first)) // checks if we have it already in the cache (conservative way to ensure that we atually have it)
{
mGixs->requestKey(gxs_ids[n].first,connected_friends,gxs_ids[n].second);
++nb_requested_not_in_cache ;
++nb_requested_not_in_cache ;
#ifdef DEBUG_GXSUTIL
GXSUTIL_DEBUG() << " ... from cache/net" << std::endl;
GXSUTIL_DEBUG() << " ... from cache/net" << std::endl;
#endif
}
else
{
}
else
{
#ifdef DEBUG_GXSUTIL
GXSUTIL_DEBUG() << " ... already in cache" << std::endl;
GXSUTIL_DEBUG() << " ... already in cache" << std::endl;
#endif
}
mGixs->timeStampKey(gxs_ids[n].first,gxs_ids[n].second);
}
mGixs->timeStampKey(gxs_ids[n].first,gxs_ids[n].second);
gxs_ids[n] = gxs_ids[gxs_ids.size()-1] ;
gxs_ids.pop_back() ;
}
gxs_ids[n] = gxs_ids[gxs_ids.size()-1] ;
gxs_ids.pop_back() ;
}
#ifdef DEBUG_GXSUTIL
GXSUTIL_DEBUG() << " total actual cache requests: "<< nb_requested_not_in_cache << std::endl;
GXSUTIL_DEBUG() << " total actual cache requests: "<< nb_requested_not_in_cache << std::endl;
#endif
}
return true;
}

View File

@ -33,55 +33,48 @@
class RsGixs ;
class RsGenExchange ;
/*!
* Handy function for cleaning out meta result containers
* @param container
*/
template <class Container, class Item>
void freeAndClearContainerResource(Container container)
{
typename Container::iterator meta_it = container.begin();
for(; meta_it != container.end(); ++meta_it)
if(meta_it->second != NULL)
delete meta_it->second;
container.clear();
}
// temporary holds a map of pointers to class T, and destroys all pointers on delete.
template<class T>
class RsGxsMetaDataTemporaryMap: public std::map<RsGxsGroupId,T*>
class non_copiable
{
public:
virtual ~RsGxsMetaDataTemporaryMap()
non_copiable() {}
private:
non_copiable& operator=(const non_copiable&) { return *this ;}
non_copiable(const non_copiable&) {}
};
template<class IdClass,class IdData>
class t_RsGxsGenericDataTemporaryMap: public std::map<IdClass,IdData *>, public non_copiable
{
public:
virtual ~t_RsGxsGenericDataTemporaryMap()
{
clear() ;
}
virtual void clear()
{
for(typename RsGxsMetaDataTemporaryMap<T>::iterator it = this->begin();it!=this->end();++it)
for(typename t_RsGxsGenericDataTemporaryMap<IdClass,IdData>::iterator it = this->begin();it!=this->end();++it)
if(it->second != NULL)
delete it->second ;
std::map<RsGxsGroupId,T*>::clear() ;
std::map<IdClass,IdData*>::clear() ;
}
};
template<class T>
class RsGxsMetaDataTemporaryMapVector: public std::map<RsGxsGroupId,std::vector<T*> >
class t_RsGxsGenericDataTemporaryMapVector: public std::map<RsGxsGroupId,std::vector<T*> >, public non_copiable
{
public:
virtual ~RsGxsMetaDataTemporaryMapVector()
virtual ~t_RsGxsGenericDataTemporaryMapVector()
{
clear() ;
}
virtual void clear()
{
for(typename RsGxsMetaDataTemporaryMapVector<T>::iterator it = this->begin();it!=this->end();++it)
for(typename t_RsGxsGenericDataTemporaryMapVector<T>::iterator it = this->begin();it!=this->end();++it)
{
for(uint32_t i=0;i<it->second.size();++i)
delete it->second[i] ;
@ -92,6 +85,34 @@ public:
std::map<RsGxsGroupId,std::vector<T*> >::clear() ;
}
};
template<class T>
class t_RsGxsGenericDataTemporaryList: public std::list<T*>, public non_copiable
{
public:
virtual ~t_RsGxsGenericDataTemporaryList()
{
clear() ;
}
virtual void clear()
{
for(typename t_RsGxsGenericDataTemporaryList<T>::iterator it = this->begin();it!=this->end();++it)
delete *it;
std::list<T*>::clear() ;
}
};
typedef t_RsGxsGenericDataTemporaryMap<RsGxsGroupId,RsGxsGrpMetaData> RsGxsGrpMetaTemporaryMap;
typedef t_RsGxsGenericDataTemporaryMap<RsGxsGroupId,RsNxsGrp> RsNxsGrpDataTemporaryMap;
typedef t_RsGxsGenericDataTemporaryMapVector<RsGxsMsgMetaData> RsGxsMsgMetaTemporaryMap ;
typedef t_RsGxsGenericDataTemporaryMapVector<RsNxsMsg> RsNxsMsgDataTemporaryMap ;
typedef t_RsGxsGenericDataTemporaryList<RsNxsGrp> RsNxsGrpDataTemporaryList ;
typedef t_RsGxsGenericDataTemporaryList<RsNxsMsg> RsNxsMsgDataTemporaryList ;
#ifdef UNUSED
template<class T>
class RsGxsMetaDataTemporaryMapVector: public std::vector<T*>

View File

@ -73,9 +73,13 @@ public:
virtual void setKeepAge(const RsGxsGroupId& id,uint32_t age_in_secs) =0;
virtual uint32_t getSyncAge(const RsGxsGroupId& id) =0;
virtual uint32_t getKeepAge(const RsGxsGroupId& id,uint32_t default_value) =0;
virtual uint32_t getKeepAge(const RsGxsGroupId& id) =0;
virtual void setDefaultKeepAge(uint32_t t) =0;
virtual void setDefaultSyncAge(uint32_t t) =0;
virtual uint32_t getDefaultSyncAge() =0;
virtual uint32_t getDefaultKeepAge() =0;
/*!
* Initiates a search through the network

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,330 @@
#pragma once
/*
* GXS Mailing Service
* Copyright (C) 2016-2017 Gioacchino Mazzurco <gio@eigenlab.org>
*
* 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 <stdint.h>
#include <unordered_map>
#include <map>
#include "retroshare/rsgxsifacetypes.h" // For RsGxsId, RsGxsCircleId
#include "gxs/gxstokenqueue.h" // For GxsTokenQueue
#include "gxstrans/p3gxstransitems.h"
#include "services/p3idservice.h" // For p3IdService
#include "util/rsthreads.h"
#include "retroshare/rsgxstrans.h"
class p3GxsTrans;
/// Services who want to make use of p3GxsTrans should inherit this struct
struct GxsTransClient
{
/**
* This will be called by p3GxsTrans to dispatch mails to the subservice
* @param authorId message sender
* @param decryptId recipient id
* @param data buffer containing the decrypted data
* @param dataSize size of the buffer
* @return true if dispatching goes fine, false otherwise
*/
virtual bool receiveGxsTransMail( const RsGxsId& authorId,
const RsGxsId& recipientId,
const uint8_t* data, uint32_t dataSize
) = 0;
/**
* This will be called by p3GxsTrans to notify the subservice about the
* status of a sent email.
* @param originalMessage message for with the notification is made
* @param status the new status of the message
* @return true if notification goes fine, false otherwise (ignored ATM)
*/
virtual bool notifyGxsTransSendStatus( RsGxsTransId mailId,
GxsTransSendStatus status ) = 0;
};
struct MsgSizeCount
{
MsgSizeCount() : size(0),count(0) {}
uint32_t size ;
uint32_t count ;
};
/**
* @brief p3GxsTrans is a mail delivery service based on GXS.
* p3GxsTrans is capable of asynchronous mail delivery and acknowledgement.
* p3GxsTrans is meant to be capable of multiple encryption options,
* @see RsGxsTransEncryptionMode at moment messages are encrypted using RSA
* unless the user ask for them being sent in clear text ( this is not supposed
* to happen in non testing environment so warnings and stack traces are printed
* in the log if an attempt to send something in clear text is made ).
* p3GxsTrans try to hide metadata so the travelling message signed by the author
* but the recipient is not disclosed, instead to avoid everyone trying to
* decrypt every message a hint has been introduced, the hint is calculated in a
* way that one can easily prove that a message is not destined to someone, but
* cannot prove the message is destined to someone
* @see RsGxsTransMailItem::recipientHint for more details.
* p3GxsTrans expose a simple API to send and receive mails, the API also
* provide notification for the sending mail status @see sendMail(...),
* @see querySendStatus(...), @see registerGxsTransClient(...),
* @see GxsTransClient::receiveGxsTransMail(...),
* @see GxsTransClient::notifyGxsTransSendStatus(...).
*/
class p3GxsTrans : public RsGenExchange, public GxsTokenQueue, public p3Config, public RsGxsTrans
{
public:
p3GxsTrans( RsGeneralDataService* gds, RsNetworkExchangeService* nes,
p3IdService& identities ) :
RsGenExchange( gds, nes, new RsGxsTransSerializer(),
RS_SERVICE_TYPE_GXS_TRANS, &identities,
AuthenPolicy()),
GxsTokenQueue(this),
RsGxsTrans(this),
mIdService(identities),
mServClientsMutex("p3GxsTrans client services map mutex"),
mOutgoingMutex("p3GxsTrans outgoing queue map mutex"),
mIngoingMutex("p3GxsTrans ingoing queue map mutex"),
mPerUserStatsMutex("p3GxsTrans user stats mutex"),
mDataMutex("p3GxsTrans data mutex")
{
mLastMsgCleanup = time(NULL) - MAX_DELAY_BETWEEN_CLEANUPS + 30; // always check 30 secs after start
mCleanupThread = NULL ;
}
virtual ~p3GxsTrans();
/*!
* \brief getStatistics
* Gathers all sorts of statistics about the internals of p3GxsTrans, in order to display info about the running status,
* message transport, etc.
* \param stats This structure contains all statistics information.
* \return true is the call succeeds.
*/
virtual bool getStatistics(GxsTransStatistics& stats);
/**
* Send an email to recipient, in the process author of the email is
* disclosed to the network (because the sent GXS item is signed), while
* recipient is not @see RsGxsTransMailItem::recipientHint for details on
* recipient protection.
* This method is part of the public interface of this service.
* @return true if the mail will be sent, false if not
*/
bool sendData( RsGxsTransId& mailId,
GxsTransSubServices service,
const RsGxsId& own_gxsid, const RsGxsId& recipient,
const uint8_t* data, uint32_t size,
RsGxsTransEncryptionMode cm = RsGxsTransEncryptionMode::RSA
);
/**
* This method is part of the public interface of this service.
* @return false if mail is not found in outgoing queue, true otherwise
*/
bool querySendStatus( RsGxsTransId mailId, GxsTransSendStatus& st );
/**
* Register a client service to p3GxsTrans to receive mails via
* GxsTransClient::receiveGxsTransMail(...) callback
* This method is part of the public interface of this service.
*/
void registerGxsTransClient( GxsTransSubServices serviceType,
GxsTransClient* service );
/// @see RsGenExchange::getServiceInfo()
virtual RsServiceInfo getServiceInfo() { return RsServiceInfo( RS_SERVICE_TYPE_GXS_TRANS, "GXS Mails", 0, 1, 0, 1 ); }
static const uint32_t GXS_STORAGE_PERIOD = 15*86400; // 15 days.
static const uint32_t GXS_SYNC_PERIOD = 15*86400;
private:
/** Time interval of inactivity before a distribution group is unsubscribed.
* Approximatively 3 months seems ok ATM. */
const static int32_t UNUSED_GROUP_UNSUBSCRIBE_INTERVAL = 16*86400; // 16 days
/**
* This should be as little as possible as the size of the database can grow
* very fast taking in account we are handling mails for the whole network.
* We do prefer to resend a not acknowledged yet mail after
* GXS_STORAGE_PERIOD has passed and keep it little.
* Tought it can't be too little as this may cause signed receipts to
* get lost thus causing resend and fastly grow perceived async latency, in
* case two sporadically connected users sends mails each other.
* While it is ok for signed acknowledged to stays in the DB for a
* full GXS_STORAGE_PERIOD, mails should be removed as soon as a valid
* signed acknowledged is received for each of them.
* Two weeks seems fair ATM.
*/
static const uint32_t MAX_DELAY_BETWEEN_CLEANUPS ; // every 20 mins. Could be less.
time_t mLastMsgCleanup ;
/// Define how the backend should handle authentication based on signatures
static uint32_t AuthenPolicy();
/// Types to mark queries in tokens queue
enum GxsReqResTypes
{
GROUPS_LIST = 1,
GROUP_CREATE = 2,
MAILS_UPDATE = 3
};
/// Store the id of the preferred GXS group to send emails
RsGxsGroupId mPreferredGroupId;
/// Used for items {de,en}cryption
p3IdService& mIdService;
/// Stores pointers to client services to notify them about new mails
std::map<GxsTransSubServices, GxsTransClient*> mServClients;
RsMutex mServClientsMutex;
/**
* @brief Keep track of outgoing mails.
* Records enter the queue when a mail is sent, and are removed when a
* receipt has been received or sending is considered definetly failed.
* Items are saved in config for consistence accross RetroShare shutdowns.
*/
typedef std::map<RsGxsTransId, OutgoingRecord> prMap;
prMap mOutgoingQueue;
RsMutex mOutgoingMutex;
void locked_processOutgoingRecord(OutgoingRecord& r);
/**
* @brief Ingoing mail and receipt processing queue.
* At shutdown remaining items are saved in config and then deleted in
* destructor for consistence accross RetroShare instances.
* In order to avoid malicious messages ( non malicious collision has 1/2^64
* probablity ) to smash items in the queue thus causing previous incoming
* item to not being processed and memleaked multimap is used instead of map
* for incoming queue.
*/
typedef std::unordered_multimap<RsGxsTransId, RsGxsTransBaseMsgItem*> inMap;
inMap mIncomingQueue;
RsMutex mIngoingMutex;
/// @see GxsTokenQueue::handleResponse(uint32_t token, uint32_t req_type)
virtual void handleResponse(uint32_t token, uint32_t req_type);
/// @see RsGenExchange::service_tick()
virtual void service_tick();
/// @see RsGenExchange::service_CreateGroup(...)
RsGenExchange::ServiceCreate_Return service_CreateGroup(
RsGxsGrpItem* grpItem, RsTlvSecurityKeySet& );
/// @see RsGenExchange::notifyChanges(std::vector<RsGxsNotify *> &changes)
void notifyChanges(std::vector<RsGxsNotify *> &changes);
/// @see p3Config::setupSerialiser()
virtual RsSerialiser* setupSerialiser();
/// @see p3Config::saveList(bool &cleanup, std::list<RsItem *>&)
virtual bool saveList(bool &cleanup, std::list<RsItem *>&saveList);
/// @see p3Config::saveDone()
void saveDone();
/// @see p3Config::loadList(std::list<RsItem *>&)
virtual bool loadList(std::list<RsItem *>& loadList);
/// Request groups list to GXS backend. Async method.
bool requestGroupsData(const std::list<RsGxsGroupId>* groupIds = NULL);
/**
* Check if current preferredGroupId is the best against potentialGrId, if
* the passed one is better update it.
* Useful when GXS backend notifies groups changes, or when a reponse to an
* async grop request (@see GXS_REQUEST_TYPE_GROUP_*) is received.
* @return true if preferredGroupId has been supeseded by potentialGrId
* false otherwise.
*/
bool inline locked_supersedePreferredGroup(const RsGxsGroupId& potentialGrId)
{
if(mPreferredGroupId < potentialGrId)
{
std::cerr << "supersedePreferredGroup(...) " << potentialGrId
<< " supersed " << mPreferredGroupId << std::endl;
mPreferredGroupId = potentialGrId;
return true;
}
return false;
}
/** @return true if has passed more then interval seconds between timeStamp
* and ref. @param ref by default now is taked as reference. */
bool static inline olderThen(time_t timeStamp, int32_t interval,
time_t ref = time(NULL))
{ return (timeStamp + interval) < ref; }
/// Decrypt email content and pass it to dispatchDecryptedMail(...)
bool handleEncryptedMail(const RsGxsTransMailItem* mail);
/// Dispatch the message to the recipient service
bool dispatchDecryptedMail( const RsGxsId& authorId,
const RsGxsId& decryptId,
const uint8_t* decrypted_data,
uint32_t decrypted_data_size );
void notifyClientService(const OutgoingRecord& pr);
/*!
* Checks the integrity message and groups
*/
class GxsTransIntegrityCleanupThread : public RsSingleJobThread
{
enum CheckState { CheckStart, CheckChecking };
public:
GxsTransIntegrityCleanupThread(RsGeneralDataService *const dataService): mDs(dataService),mMtx("GxsTransIntegrityCheck") { mDone=false;}
bool isDone();
void run();
void getDeletedIds(std::list<RsGxsGroupId>& grpIds, std::map<RsGxsGroupId, std::vector<RsGxsMessageId> >& msgIds);
void getMessagesToDelete(GxsMsgReq& req) ;
void getPerUserStatistics(std::map<RsGxsId,MsgSizeCount>& m) ;
private:
RsGeneralDataService* const mDs;
RsMutex mMtx ;
GxsMsgReq mMsgToDel ;
std::map<RsGxsId,MsgSizeCount> total_message_size_and_count;
bool mDone ;
};
// Overloaded from RsGenExchange.
bool acceptNewMessage(const RsGxsMsgMetaData *msgMeta, uint32_t size) ;
GxsTransIntegrityCleanupThread *mCleanupThread ;
// statistics of the load across all groups, per user.
RsMutex mPerUserStatsMutex;
std::map<RsGxsId,MsgSizeCount> per_user_statistics ;
// Mutex to protect local data
RsMutex mDataMutex;
};

View File

@ -0,0 +1,67 @@
/*
* GXS Mailing Service
* Copyright (C) 2016-2017 Gioacchino Mazzurco <gio@eigenlab.org>
*
* 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 "gxstrans/p3gxstransitems.h"
#include "serialiser/rstypeserializer.h"
const RsGxsId RsGxsTransMailItem::allRecipientsHint("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF");
OutgoingRecord_deprecated::OutgoingRecord_deprecated()
: RsItem( RS_PKT_VERSION_SERVICE, RS_SERVICE_TYPE_GXS_TRANS, static_cast<uint8_t>(GxsTransItemsSubtypes::OUTGOING_RECORD_ITEM_deprecated) ) { clear();}
OutgoingRecord::OutgoingRecord()
: RsItem( RS_PKT_VERSION_SERVICE, RS_SERVICE_TYPE_GXS_TRANS, static_cast<uint8_t>(GxsTransItemsSubtypes::OUTGOING_RECORD_ITEM) ) { clear();}
OutgoingRecord::OutgoingRecord( RsGxsId rec, GxsTransSubServices cs,
const uint8_t* data, uint32_t size ) :
RsItem( RS_PKT_VERSION_SERVICE, RS_SERVICE_TYPE_GXS_TRANS,
static_cast<uint8_t>(GxsTransItemsSubtypes::OUTGOING_RECORD_ITEM) ),
status(GxsTransSendStatus::PENDING_PROCESSING), recipient(rec),
clientService(cs)
{
mailData.resize(size);
memcpy(&mailData[0], data, size);
}
RS_REGISTER_ITEM_TYPE(RsGxsTransMailItem) // for mailItem
RS_REGISTER_ITEM_TYPE(RsNxsTransPresignedReceipt) // for presignedReceipt
void OutgoingRecord_deprecated::serial_process(RsGenericSerializer::SerializeJob j, RsGenericSerializer::SerializeContext& ctx)
{
RS_REGISTER_SERIAL_MEMBER_TYPED(status, uint8_t);
RS_REGISTER_SERIAL_MEMBER(recipient);
RS_REGISTER_SERIAL_MEMBER(mailItem);
RS_REGISTER_SERIAL_MEMBER(mailData);
RS_REGISTER_SERIAL_MEMBER_TYPED(clientService, uint16_t);
RS_REGISTER_SERIAL_MEMBER(presignedReceipt);
}
void OutgoingRecord::serial_process(RsGenericSerializer::SerializeJob j,
RsGenericSerializer::SerializeContext& ctx)
{
RS_REGISTER_SERIAL_MEMBER_TYPED(status, uint8_t);
RS_REGISTER_SERIAL_MEMBER(recipient);
RS_REGISTER_SERIAL_MEMBER(author);
RS_REGISTER_SERIAL_MEMBER(group_id);
RS_REGISTER_SERIAL_MEMBER(sent_ts);
RS_REGISTER_SERIAL_MEMBER(mailItem);
RS_REGISTER_SERIAL_MEMBER(mailData);
RS_REGISTER_SERIAL_MEMBER_TYPED(clientService, uint16_t);
RS_REGISTER_SERIAL_MEMBER(presignedReceipt);
}

View File

@ -0,0 +1,268 @@
#pragma once
/*
* GXS Mailing Service
* Copyright (C) 2016-2017 Gioacchino Mazzurco <gio@eigenlab.org>
*
* 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 <string>
#include "rsitems/rsgxsitems.h"
#include "serialiser/rsbaseserial.h"
#include "serialiser/rstlvidset.h"
#include "retroshare/rsgxsflags.h"
#include "retroshare/rsgxstrans.h"
#include "retroshare/rsgxscircles.h" // For: GXS_CIRCLE_TYPE_PUBLIC
#include "services/p3idservice.h"
#include "serialiser/rstypeserializer.h"
class RsNxsTransPresignedReceipt : public RsNxsMsg
{
public:
RsNxsTransPresignedReceipt() : RsNxsMsg(RS_SERVICE_TYPE_GXS_TRANS) {}
virtual ~RsNxsTransPresignedReceipt() {}
};
class RsGxsTransBaseMsgItem : public RsGxsMsgItem
{
public:
RsGxsTransBaseMsgItem(GxsTransItemsSubtypes subtype) :
RsGxsMsgItem( RS_SERVICE_TYPE_GXS_TRANS,
static_cast<uint8_t>(subtype) ), mailId(0) {}
virtual ~RsGxsTransBaseMsgItem() {}
RsGxsTransId mailId;
void inline clear()
{
mailId = 0;
meta = RsMsgMetaData();
}
void serial_process( RsGenericSerializer::SerializeJob j,
RsGenericSerializer::SerializeContext& ctx )
{ RS_REGISTER_SERIAL_MEMBER_TYPED(mailId, uint64_t); }
};
class RsGxsTransPresignedReceipt : public RsGxsTransBaseMsgItem
{
public:
RsGxsTransPresignedReceipt() : RsGxsTransBaseMsgItem(GxsTransItemsSubtypes::GXS_TRANS_SUBTYPE_RECEIPT) {}
virtual ~RsGxsTransPresignedReceipt() {}
};
enum class RsGxsTransEncryptionMode : uint8_t
{
CLEAR_TEXT = 1,
RSA = 2,
UNDEFINED_ENCRYPTION = 250
};
class RsGxsTransMailItem : public RsGxsTransBaseMsgItem
{
public:
RsGxsTransMailItem() :
RsGxsTransBaseMsgItem(GxsTransItemsSubtypes::GXS_TRANS_SUBTYPE_MAIL),
cryptoType(RsGxsTransEncryptionMode::UNDEFINED_ENCRYPTION) {}
virtual ~RsGxsTransMailItem() {}
RsGxsTransEncryptionMode cryptoType;
/**
* @brief recipientHint used instead of plain recipient id, so sender can
* decide the equilibrium between exposing the recipient and the cost of
* completely anonymize it. So a bunch of luky non recipient can conclude
* rapidly that they are not the recipient without trying to decrypt the
* message.
*
* To be able to decide how much metadata we disclose sending a message we
* send an hint instead of the recipient id in clear, the hint cannot be
* false (the recipient would discard the mail) but may be arbitrarly
* obscure like 0xFF...FF so potentially everyone could be the recipient, or
* may expose the complete recipient id or be a middle ground.
* To calculate arbitrary precise hint one do a bitwise OR of the recipients
* keys and an arbitrary salt, the more recipients has the mail and the more
* 1 bits has the salt the less accurate is the hint.
* This way the sender is able to adjust the metadata privacy needed for the
* message, in the more private case (recipientHint == 0xFFF...FFF) no one
* has a clue about who is the actual recipient, while this imply the cost
* that every potencial recipient has to try to decrypt it to know if it is
* for herself. This way a bunch of non recipients can rapidly discover that
* the message is not directed to them without attempting it's decryption.
*
* To check if one id may be the recipient of the mail or not one need to
* bitwise compare the hint with the id, if at least one bit of the hint is
* 0 while the corresponding bit in the id is 1 then the id cannot be the
* recipient of the mail.
*
* Note that by design one can prove that an id is not recipient of the mail
* but cannot prove it is.
* Also in the extreme case of using 0x00...00 as salt that is equivalent
* to not salting at all (aka the plain recipient id is used as hint) a
* malicious observer could not demostrate in a conclusive manner that the
* mail is directed to the actual recipient as the "apparently"
* corresponding hint may be fruit of a "luky" salting of another id.
*/
RsGxsId recipientHint;
void inline saltRecipientHint(const RsGxsId& salt)
{ recipientHint = recipientHint | salt; }
/**
* @brief maybeRecipient given an id and an hint check if they match
* @see recipientHint
* @return true if the id may be recipient of the hint, false otherwise
*/
bool inline maybeRecipient(const RsGxsId& id) const
{ return (~id|recipientHint) == allRecipientsHint; }
const static RsGxsId allRecipientsHint;
/** This should travel encrypted, unless EncryptionMode::CLEAR_TEXT
* is specified */
std::vector<uint8_t> payload;
void serial_process( RsGenericSerializer::SerializeJob j,
RsGenericSerializer::SerializeContext& ctx )
{
RsGxsTransBaseMsgItem::serial_process(j, ctx);
RS_REGISTER_SERIAL_MEMBER_TYPED(cryptoType, uint8_t);
RS_REGISTER_SERIAL_MEMBER(recipientHint);
RS_REGISTER_SERIAL_MEMBER(payload);
}
void clear()
{
RsGxsTransBaseMsgItem::clear();
cryptoType = RsGxsTransEncryptionMode::UNDEFINED_ENCRYPTION;
recipientHint.clear();
payload.clear();
}
/// Maximum mail size in bytes 10 MiB is more than anything sane can need
const static uint32_t MAX_SIZE = 10*8*1024*1024;
};
class RsGxsTransGroupItem : public RsGxsGrpItem
{
public:
RsGxsTransGroupItem() :
RsGxsGrpItem( RS_SERVICE_TYPE_GXS_TRANS,
static_cast<uint8_t>(
GxsTransItemsSubtypes::GXS_TRANS_SUBTYPE_GROUP) )
{
meta.mGroupFlags = GXS_SERV::FLAG_PRIVACY_PUBLIC;
meta.mGroupName = "Mail";
meta.mCircleType = GXS_CIRCLE_TYPE_PUBLIC;
}
virtual ~RsGxsTransGroupItem() {}
// TODO: Talk with Cyril why there is no RsGxsGrpItem::serial_process
virtual void serial_process(RsGenericSerializer::SerializeJob /*j*/,
RsGenericSerializer::SerializeContext& /*ctx*/)
{}
void clear() {}
std::ostream &print(std::ostream &out, uint16_t /*indent = 0*/)
{ return out; }
};
class RsGxsTransSerializer;
class OutgoingRecord_deprecated : public RsItem
{
public:
OutgoingRecord_deprecated( RsGxsId rec, GxsTransSubServices cs, const uint8_t* data, uint32_t size );
virtual ~OutgoingRecord_deprecated() {}
GxsTransSendStatus status;
RsGxsId recipient;
/// Don't use a pointer would be invalid after publish
RsGxsTransMailItem mailItem;
std::vector<uint8_t> mailData;
GxsTransSubServices clientService;
RsNxsTransPresignedReceipt presignedReceipt;
void serial_process( RsGenericSerializer::SerializeJob j,
RsGenericSerializer::SerializeContext& ctx );
void clear() {}
private:
friend class RsGxsTransSerializer;
OutgoingRecord_deprecated();
};
class OutgoingRecord : public RsItem
{
public:
OutgoingRecord( RsGxsId rec, GxsTransSubServices cs,
const uint8_t* data, uint32_t size );
virtual ~OutgoingRecord() {}
GxsTransSendStatus status;
RsGxsId recipient;
RsGxsId author; // These 3 fields cannot be stored in mailItem.meta, which is not serialised.
RsGxsGroupId group_id ;
uint32_t sent_ts ;
/// Don't use a pointer would be invalid after publish
RsGxsTransMailItem mailItem;
std::vector<uint8_t> mailData;
GxsTransSubServices clientService;
RsNxsTransPresignedReceipt presignedReceipt;
void serial_process( RsGenericSerializer::SerializeJob j,
RsGenericSerializer::SerializeContext& ctx );
void clear() {}
private:
friend class RsGxsTransSerializer;
OutgoingRecord();
};
class RsGxsTransSerializer : public RsServiceSerializer
{
public:
RsGxsTransSerializer() : RsServiceSerializer(RS_SERVICE_TYPE_GXS_TRANS) {}
virtual ~RsGxsTransSerializer() {}
RsItem* create_item(uint16_t service_id, uint8_t item_sub_id) const
{
if(service_id != RS_SERVICE_TYPE_GXS_TRANS) return NULL;
switch(static_cast<GxsTransItemsSubtypes>(item_sub_id))
{
case GxsTransItemsSubtypes::GXS_TRANS_SUBTYPE_MAIL: return new RsGxsTransMailItem();
case GxsTransItemsSubtypes::GXS_TRANS_SUBTYPE_RECEIPT: return new RsGxsTransPresignedReceipt();
case GxsTransItemsSubtypes::GXS_TRANS_SUBTYPE_GROUP: return new RsGxsTransGroupItem();
case GxsTransItemsSubtypes::OUTGOING_RECORD_ITEM_deprecated: return new OutgoingRecord_deprecated();
case GxsTransItemsSubtypes::OUTGOING_RECORD_ITEM: return new OutgoingRecord();
default: return NULL;
}
}
};

View File

@ -59,7 +59,9 @@ static const uint32_t RS_GXS_TUNNEL_DATA_PRINT_STORAGE_DELAY = 600 ; // store ol
static const uint32_t GXS_TUNNEL_ENCRYPTION_HMAC_SIZE = SHA_DIGEST_LENGTH ;
static const uint32_t GXS_TUNNEL_ENCRYPTION_IV_SIZE = 8 ;
#ifdef DEBUG_GXS_TUNNEL
static const uint32_t INTERVAL_BETWEEN_DEBUG_DUMP = 10 ;
#endif
static std::string GXS_TUNNEL_APP_NAME = "GxsTunnels" ;
@ -74,6 +76,7 @@ p3GxsTunnelService::p3GxsTunnelService(RsGixs *pids)
: mGixs(pids), mGxsTunnelMtx("GXS tunnel")
{
mTurtle = NULL ;
mCurrentPacketCounter = 0 ;
}
void p3GxsTunnelService::connectToTurtleRouter(p3turtle *tr)
@ -104,6 +107,7 @@ int p3GxsTunnelService::tick()
#ifdef DEBUG_GXS_TUNNEL
time_t now = time(NULL);
static time_t last_dump = 0;
if(now > last_dump + INTERVAL_BETWEEN_DEBUG_DUMP )
{
@ -211,7 +215,7 @@ void p3GxsTunnelService::flush()
if(it->second.last_contact+20+GXS_TUNNEL_KEEP_ALIVE_TIMEOUT < now && it->second.status == RS_GXS_TUNNEL_STATUS_CAN_TALK)
{
#ifdef DEBUG_GXS_TUNNEL
std::cerr << "(II) GxsTunnelService:: connexion interrupted with peer." << std::endl;
std::cerr << "(II) GxsTunnelService:: connection interrupted with peer." << std::endl;
#endif
it->second.status = RS_GXS_TUNNEL_STATUS_TUNNEL_DN ;
@ -288,7 +292,7 @@ void p3GxsTunnelService::handleIncomingItem(const RsGxsTunnelId& tunnel_id,RsGxs
case RS_PKT_SUBTYPE_GXS_TUNNEL_DATA: handleRecvTunnelDataItem(tunnel_id,dynamic_cast<RsGxsTunnelDataItem*>(item)) ;
break ;
case RS_PKT_SUBTYPE_GXS_TUNNEL_DATA_ACK: handleRecvTunnelDataAckItem(tunnel_id,dynamic_cast<RsGxsTunnelDataAckItem*>(item)) ;
case RS_PKT_SUBTYPE_GXS_TUNNEL_DATA_ACK: handleRecvTunnelDataAckItem(tunnel_id,dynamic_cast<RsGxsTunnelDataAckItem*>(item)) ;
break ;
case RS_PKT_SUBTYPE_GXS_TUNNEL_STATUS: handleRecvStatusItem(tunnel_id,dynamic_cast<RsGxsTunnelStatusItem*>(item)) ;
@ -752,7 +756,7 @@ bool p3GxsTunnelService::handleEncryptedData(const uint8_t *data_bytes,uint32_t
std::cerr << " size = " << data_size << std::endl;
std::cerr << " data = " << (void*)data_bytes << std::endl;
std::cerr << " IV = " << std::hex << *(uint64_t*)data_bytes << std::dec << std::endl;
std::cerr << " data = " << RsUtil::BinToHex((char*)data_bytes,data_size) ;
std::cerr << " data = " << RsUtil::BinToHex((unsigned char*)data_bytes,data_size,100) ;
std::cerr << std::endl;
#endif
@ -793,9 +797,9 @@ bool p3GxsTunnelService::handleEncryptedData(const uint8_t *data_bytes,uint32_t
#ifdef DEBUG_GXS_TUNNEL
std::cerr << " Using IV: " << std::hex << *(uint64_t*)data_bytes << std::dec << std::endl;
std::cerr << " Decrypted buffer size: " << decrypted_size << std::endl;
std::cerr << " key : " << RsUtil::BinToHex((char*)aes_key,GXS_TUNNEL_AES_KEY_SIZE) << std::endl;
std::cerr << " hmac : " << RsUtil::BinToHex((char*)data_bytes+GXS_TUNNEL_ENCRYPTION_IV_SIZE,GXS_TUNNEL_ENCRYPTION_HMAC_SIZE) << std::endl;
std::cerr << " data : " << RsUtil::BinToHex((char*)data_bytes,data_size) << std::endl;
std::cerr << " key : " << RsUtil::BinToHex((unsigned char*)aes_key,GXS_TUNNEL_AES_KEY_SIZE) << std::endl;
std::cerr << " hmac : " << RsUtil::BinToHex((unsigned char*)data_bytes+GXS_TUNNEL_ENCRYPTION_IV_SIZE,GXS_TUNNEL_ENCRYPTION_HMAC_SIZE) << std::endl;
std::cerr << " data : " << RsUtil::BinToHex((unsigned char*)data_bytes,data_size,100) << std::endl;
#endif
// first, check the HMAC
@ -1023,7 +1027,8 @@ void p3GxsTunnelService::handleRecvDHPublicKey(RsGxsTunnelDHPublicKeyItem *item)
// Note: for some obscure reason, the typedef does not work here. Looks like a compiler error. So I use the primary type.
GXSTunnelId p3GxsTunnelService::makeGxsTunnelId(const RsGxsId &own_id, const RsGxsId &distant_id) const // creates a unique ID from two GXS ids.
/*static*/ GXSTunnelId p3GxsTunnelService::makeGxsTunnelId(
const RsGxsId &own_id, const RsGxsId &distant_id )
{
unsigned char mem[RsGxsId::SIZE_IN_BYTES * 2] ;
@ -1210,7 +1215,7 @@ bool p3GxsTunnelService::locked_sendClearTunnelData(RsGxsTunnelDHPublicKeyItem *
#ifdef DEBUG_GXS_TUNNEL
std::cerr << " GxsTunnelService::sendClearTunnelData(): Sending clear data to virtual peer: " << item->PeerId() << std::endl;
std::cerr << " gitem->data_size = " << gitem->data_size << std::endl;
std::cerr << " data = " << RsUtil::BinToHex((char*)gitem->data_bytes,gitem->data_size) ;
std::cerr << " data = " << RsUtil::BinToHex((unsigned char*)gitem->data_bytes,gitem->data_size,100) ;
std::cerr << std::endl;
#endif
mTurtle->sendTurtleData(item->PeerId(),gitem) ;
@ -1244,18 +1249,20 @@ bool p3GxsTunnelService::locked_sendEncryptedTunnelData(RsGxsTunnelItem *item)
std::map<RsGxsTunnelId,GxsTunnelPeerInfo>::iterator it = _gxs_tunnel_contacts.find(tunnel_id) ;
if(it == _gxs_tunnel_contacts.end())
{
if(it == _gxs_tunnel_contacts.end())
{
#ifdef DEBUG_GXS_TUNNEL
std::cerr << " Cannot find contact key info for tunnel id " << tunnel_id << ". Cannot send message!" << std::endl;
std::cerr << " Cannot find contact key info for tunnel id "
<< tunnel_id << ". Cannot send message!" << std::endl;
#endif
return false;
}
if(it->second.status != RS_GXS_TUNNEL_STATUS_CAN_TALK)
{
std::cerr << "(EE) Cannot talk to tunnel id " << tunnel_id << ". Tunnel status is: " << it->second.status << std::endl;
return false;
}
return false;
}
if(it->second.status != RS_GXS_TUNNEL_STATUS_CAN_TALK)
{
std::cerr << "(EE) Cannot talk to tunnel id " << tunnel_id
<< ". Tunnel status is: " << it->second.status << std::endl;
return false;
}
it->second.total_sent += rssize ; // counts the size of clear data that is sent
@ -1304,7 +1311,7 @@ bool p3GxsTunnelService::locked_sendEncryptedTunnelData(RsGxsTunnelItem *item)
#ifdef DEBUG_GXS_TUNNEL
std::cerr << "GxsTunnelService::sendEncryptedTunnelData(): Sending encrypted data to virtual peer: " << virtual_peer_id << std::endl;
std::cerr << " gitem->data_size = " << gitem->data_size << std::endl;
std::cerr << " serialised data = " << RsUtil::BinToHex((char*)gitem->data_bytes,gitem->data_size) ;
std::cerr << " serialised data = " << RsUtil::BinToHex((unsigned char*)gitem->data_bytes,gitem->data_size,100) ;
std::cerr << std::endl;
#endif
@ -1343,6 +1350,16 @@ bool p3GxsTunnelService::requestSecuredTunnel(const RsGxsId& to_gxs_id, const Rs
return true ;
}
// This method generates an ID that should be unique for each packet sent to a same peer. Rather than a random value,
// we use this counter because outgoing items are sorted in a map by their counter value. Using an increasing value
// ensures that the packets are sent in the same order than received from the service. This can be useful in some cases,
// for instance when services split their items while expecting them to arrive in the same order.
uint64_t p3GxsTunnelService::locked_getPacketCounter()
{
return mCurrentPacketCounter++ ;
}
bool p3GxsTunnelService::sendData(const RsGxsTunnelId &tunnel_id, uint32_t service_id, const uint8_t *data, uint32_t size)
{
// make sure that the tunnel ID is registered.
@ -1378,7 +1395,7 @@ bool p3GxsTunnelService::sendData(const RsGxsTunnelId &tunnel_id, uint32_t servi
RsGxsTunnelDataItem *item = new RsGxsTunnelDataItem ;
item->unique_item_counter = RSRandom::random_u64(); // this allows to make the item unique, except very rarely, we we don't care.
item->unique_item_counter = locked_getPacketCounter() ;// this allows to make the item unique, while respecting the packet order!
item->flags = 0; // not used yet.
item->service_id = service_id;
item->data_size = size; // encrypted data size

View File

@ -230,9 +230,9 @@ private:
void handleRecvDHPublicKey(RsGxsTunnelDHPublicKeyItem *item) ;
bool locked_sendDHPublicKey(const DH *dh, const RsGxsId& own_gxs_id, const RsPeerId& virtual_peer_id) ;
bool locked_initDHSessionKey(DH *&dh);
uint64_t locked_getPacketCounter();
TurtleVirtualPeerId virtualPeerIdFromHash(const TurtleFileHash& hash) ; // ... and to a hash for p3turtle
RsGxsTunnelId makeGxsTunnelId(const RsGxsId &own_id, const RsGxsId &distant_id) const; // creates a unique ID from two GXS ids.
// item handling
@ -253,8 +253,15 @@ private:
RsGixs *mGixs ;
RsMutex mGxsTunnelMtx ;
uint64_t mCurrentPacketCounter ;
std::map<uint32_t,RsGxsTunnelClientService*> mRegisteredServices ;
void debug_dump();
public:
/// creates a unique tunnel ID from two GXS ids.
static RsGxsTunnelId makeGxsTunnelId( const RsGxsId &own_id,
const RsGxsId &distant_id );
};

View File

@ -140,7 +140,6 @@ PUBLIC_HEADERS = retroshare/rsdisc.h \
retroshare/rsversion.h \
retroshare/rsservicecontrol.h \
HEADERS += plugins/pluginmanager.h \
plugins/dlfcn_win32.h \
rsitems/rspluginitems.h \
@ -429,6 +428,7 @@ HEADERS += pqi/authssl.h \
pqi/pqissl.h \
pqi/pqissllistener.h \
pqi/pqisslpersongrp.h \
pqi/pqissli2pbob.h \
pqi/pqissludp.h \
pqi/pqisslproxy.h \
pqi/pqistore.h \
@ -493,7 +493,9 @@ HEADERS += rsitems/rsitem.h \
rsitems/rsgxsupdateitems.h \
rsitems/rsserviceinfoitems.h \
HEADERS += services/p3msgservice.h \
HEADERS += services/autoproxy/p3i2pbob.h \
services/autoproxy/rsautoproxymonitor.h \
services/p3msgservice.h \
services/p3service.h \
services/p3statusservice.h \
services/p3banlist.h \
@ -518,6 +520,9 @@ HEADERS += util/folderiterator.h \
util/rsnet.h \
util/extaddrfinder.h \
util/dnsresolver.h \
util/radix32.h \
util/radix64.h \
util/rsinitedptr.h \
util/rsprint.h \
util/rsstring.h \
util/rsstd.h \
@ -525,7 +530,6 @@ HEADERS += util/folderiterator.h \
util/rsversioninfo.h \
util/rswin.h \
util/rsrandom.h \
util/radix64.h \
util/pugiconfig.h \
util/rsmemcache.h \
util/rstickevent.h \
@ -580,6 +584,7 @@ SOURCES += pqi/authgpg.cc \
pqi/pqissl.cc \
pqi/pqissllistener.cc \
pqi/pqisslpersongrp.cc \
pqi/pqissli2pbob.cpp \
pqi/pqissludp.cc \
pqi/pqisslproxy.cc \
pqi/pqistore.cc \
@ -638,7 +643,9 @@ SOURCES += serialiser/rsbaseserial.cc \
rsitems/rsgxsupdateitems.cc \
rsitems/rsserviceinfoitems.cc \
SOURCES += services/p3msgservice.cc \
SOURCES += services/autoproxy/rsautoproxymonitor.cc \
services/autoproxy/p3i2pbob.cc \
services/p3msgservice.cc \
services/p3service.cc \
services/p3statusservice.cc \
services/p3banlist.cc \
@ -861,7 +868,10 @@ gxsphotoshare {
rsitems/rsphotoitems.cc \
}
rs_gxs_trans {
HEADERS += gxstrans/p3gxstransitems.h gxstrans/p3gxstrans.h
SOURCES += gxstrans/p3gxstransitems.cc gxstrans/p3gxstrans.cc
}
@ -912,15 +922,15 @@ android-g++ {
## Add this here and not in retroshare.pri because static library are very
## sensible to order in command line, has to be in the end of file for the
## same reason
LIBS += -L$$NDK_TOOLCHAIN_PATH/sysroot/usr/lib/ -lssl
INCLUDEPATH += $$NDK_TOOLCHAIN_PATH/sysroot/usr/include
DEPENDPATH += $$NDK_TOOLCHAIN_PATH/sysroot/usr/include
PRE_TARGETDEPS += $$NDK_TOOLCHAIN_PATH/sysroot/usr/lib/libssl.a
LIBS += -L$$NATIVE_LIBS_TOOLCHAIN_PATH/sysroot/usr/lib/ -lssl
INCLUDEPATH += $$NATIVE_LIBS_TOOLCHAIN_PATH/sysroot/usr/include
DEPENDPATH += $$NATIVE_LIBS_TOOLCHAIN_PATH/sysroot/usr/include
PRE_TARGETDEPS += $$NATIVE_LIBS_TOOLCHAIN_PATH/sysroot/usr/lib/libssl.a
LIBS += -L$$NDK_TOOLCHAIN_PATH/sysroot/usr/lib/ -lcrypto
INCLUDEPATH += $$NDK_TOOLCHAIN_PATH/sysroot/usr/include
DEPENDPATH += $$NDK_TOOLCHAIN_PATH/sysroot/usr/include
PRE_TARGETDEPS += $$NDK_TOOLCHAIN_PATH/sysroot/usr/lib/libcrypto.a
LIBS += -L$$NATIVE_LIBS_TOOLCHAIN_PATH/sysroot/usr/lib/ -lcrypto
INCLUDEPATH += $$NATIVE_LIBS_TOOLCHAIN_PATH/sysroot/usr/include
DEPENDPATH += $$NATIVE_LIBS_TOOLCHAIN_PATH/sysroot/usr/include
PRE_TARGETDEPS += $$NATIVE_LIBS_TOOLCHAIN_PATH/sysroot/usr/lib/libcrypto.a
HEADERS += util/androiddebug.h
}

View File

@ -60,6 +60,7 @@ ops_parse_cb_return_t cb_get_passphrase(const ops_parser_content_t *content_,ops
switch(content_->tag)
{
case OPS_PARSER_CMD_GET_SK_PASSPHRASE_PREV_WAS_BAD: prev_was_bad = true ;
/* fallthrough */
case OPS_PARSER_CMD_GET_SK_PASSPHRASE:
{
std::string passwd;

View File

@ -140,6 +140,8 @@ void RsPluginManager::loadPlugins(const std::vector<std::string>& plugin_directo
// 0 - get the list of files to read
bool first_time = (_accepted_hashes.empty()) && _rejected_hashes.empty() ;
for(uint32_t i=0;i<plugin_directories.size();++i)
{
librs::util::FolderIterator dirIt(plugin_directories[i],true);
@ -164,7 +166,7 @@ void RsPluginManager::loadPlugins(const std::vector<std::string>& plugin_directo
std::cerr << "Found plugin " << fullname << std::endl;
std::cerr << " Loading plugin..." << std::endl;
loadPlugin(fullname) ;
loadPlugin(fullname, first_time) ;
}
dirIt.closedir();
}
@ -262,7 +264,7 @@ bool RsPluginManager::loadPlugin(RsPlugin *p)
return true;
}
bool RsPluginManager::loadPlugin(const std::string& plugin_name)
bool RsPluginManager::loadPlugin(const std::string& plugin_name,bool first_time)
{
std::cerr << " Loading plugin " << plugin_name << std::endl;
@ -289,7 +291,7 @@ bool RsPluginManager::loadPlugin(const std::string& plugin_name)
if(!_allow_all_plugins)
{
if(_accepted_hashes.find(pinfo.file_hash) == _accepted_hashes.end() && _rejected_hashes.find(pinfo.file_hash) == _rejected_hashes.end() )
if(!RsServer::notify()->askForPluginConfirmation(pinfo.file_name,pinfo.file_hash.toStdString()))
if(!RsServer::notify()->askForPluginConfirmation(pinfo.file_name,pinfo.file_hash.toStdString(),first_time))
_rejected_hashes.insert(pinfo.file_hash) ; // accepted hashes are treated at the end, for security.
if(_rejected_hashes.find(pinfo.file_hash) != _rejected_hashes.end() )

View File

@ -106,7 +106,7 @@ class RsPluginManager: public RsPluginHandler, public p3Config
private:
bool loadPlugin(RsPlugin *) ;
bool loadPlugin(const std::string& shared_library_name) ;
bool loadPlugin(const std::string& shared_library_name, bool first_time) ;
RsFileHash hashPlugin(const std::string& shared_library_name) ;
std::vector<PluginInfo> _plugins ;

View File

@ -20,7 +20,7 @@
* USA.
*
* Please report all bugs and problems to "retroshare@lunamutt.com".
*
*
*
*/
@ -46,7 +46,9 @@
#define LIMIT_CERTIFICATE_SIZE 1
#define MAX_CERTIFICATE_SIZE 10000
const time_t STORE_KEY_TIMEOUT = 1 * 60 * 60; //store key is call around every hour
//#define DEBUG_AUTHGPG 1
//const time_t STORE_KEY_TIMEOUT = 1 * 60 * 60; //store key is call around every hour
AuthGPG *AuthGPG::_instance = NULL ;
@ -88,7 +90,6 @@ bool AuthGPG::encryptTextToFile(const std::string& text,const std::string& outfi
std::string pgp_pwd_callback(void * /*hook*/, const char *uid_title, const char *uid_hint, const char * /*passphrase_info*/, int prev_was_bad,bool *cancelled)
{
#define GPG_DEBUG2
#ifdef GPG_DEBUG2
fprintf(stderr, "pgp_pwd_callback() called.\n");
#endif
@ -121,12 +122,12 @@ void AuthGPG::exit()
}
AuthGPG::AuthGPG(const std::string& path_to_public_keyring,const std::string& path_to_secret_keyring,const std::string& path_to_trustdb,const std::string& pgp_lock_file)
:p3Config(),
:p3Config(),
PGPHandler(path_to_public_keyring,path_to_secret_keyring,path_to_trustdb,pgp_lock_file),
gpgMtxService("AuthGPG-service"),
gpgMtxEngine("AuthGPG-engine"),
gpgMtxEngine("AuthGPG-engine"),
gpgMtxData("AuthGPG-data"),
gpgKeySelected(false)
gpgKeySelected(false)
{
_force_sync_database = false ;
mCount = 0;
@ -162,7 +163,9 @@ AuthGPG::AuthGPG(const std::string& path_to_public_keyring,const std::string& pa
*/
int AuthGPG::GPGInit(const RsPgpId &ownId)
{
#ifdef DEBUG_AUTHGPG
std::cerr << "AuthGPG::GPGInit() called with own gpg id : " << ownId.toStdString() << std::endl;
#endif
mOwnGpgId = RsPgpId(ownId);
@ -170,7 +173,9 @@ int AuthGPG::GPGInit(const RsPgpId &ownId)
privateTrustCertificate(ownId, 5);
updateOwnSignatureFlag(mOwnGpgId) ;
#ifdef DEBUG_AUTHGPG
std::cerr << "AuthGPG::GPGInit finished." << std::endl;
#endif
return 1;
}
@ -231,9 +236,9 @@ void AuthGPG::processServices()
}
AuthGPGOperationLoadOrSave *loadOrSave = dynamic_cast<AuthGPGOperationLoadOrSave*>(operation);
if (loadOrSave)
if (loadOrSave)
{
if (loadOrSave->m_load)
if (loadOrSave->m_load)
{
/* process load operation */
@ -285,8 +290,8 @@ void AuthGPG::processServices()
}
service->setGPGOperation(loadOrSave);
}
else
}
else
{
#ifdef GPG_DEBUG
std::cerr << "AuthGPGimpl::processServices() Unknown operation" << std::endl;
@ -313,7 +318,7 @@ bool AuthGPG::parseSignature(const void *sig, unsigned int siglen, RsPgpId& issu
return PGPHandler::parseSignature((unsigned char*)sig,siglen,issuer_id) ;
}
bool AuthGPG::exportProfile(const std::string& fname,const RsPgpId& exported_id)
bool AuthGPG::exportProfile(const std::string& fname,const RsPgpId& exported_id)
{
return PGPHandler::exportGPGKeyPair(fname,exported_id) ;
}
@ -328,7 +333,7 @@ bool AuthGPG::importProfileFromString(const std::string &data, RsPgpId &gpg_id,
return PGPHandler::importGPGKeyPairFromString(data, gpg_id, import_error);
}
bool AuthGPG::active()
{
RsStackMutex stack(gpgMtxData); /******* LOCKED ******/
@ -427,7 +432,7 @@ bool AuthGPG::isKeySupported(const RsPgpId& id) const
return !(pc->_flags & PGPCertificateInfo::PGP_CERTIFICATE_FLAG_UNSUPPORTED_ALGORITHM) ;
}
bool AuthGPG::getGPGDetails(const RsPgpId& pgp_id, RsPeerDetails &d)
bool AuthGPG::getGPGDetails(const RsPgpId& pgp_id, RsPeerDetails &d)
{
RsStackMutex stack(gpgMtxData); /******* LOCKED ******/
@ -458,7 +463,7 @@ bool AuthGPG::getGPGDetails(const RsPgpId& pgp_id, RsPeerDetails &d)
return true;
}
bool AuthGPG::getGPGFilteredList(std::list<RsPgpId>& list,bool (*filter)(const PGPCertificateInfo&))
bool AuthGPG::getGPGFilteredList(std::list<RsPgpId>& list,bool (*filter)(const PGPCertificateInfo&))
{
RsStackMutex stack(gpgMtxData); /******* LOCKED ******/
@ -492,20 +497,20 @@ bool AuthGPG::getGPGSignedList(std::list<RsPgpId> &ids)
// #else
// certificate = PGPHandler::SaveCertificateToString(RsPgpId(id),true) ;
// #endif
//
//
// // #ifdef LIMIT_CERTIFICATE_SIZE
// // std::string cleaned_key ;
// // if(PGPKeyManagement::createMinimalKey(certificate,cleaned_key))
// // certificate = cleaned_key ;
// // #endif
//
//
// return certificate.length() > 0 ;
// }
/*****************************************************************
* Loading and Saving Certificates - this has to
* Loading and Saving Certificates - this has to
* be able to handle both openpgp and X509 certificates.
*
*
* X509 are passed onto AuthSSL, OpenPGP are passed to gpgme.
*
*/
@ -515,7 +520,7 @@ bool AuthGPG::getGPGSignedList(std::list<RsPgpId> &ids)
std::string AuthGPG::SaveCertificateToString(const RsPgpId &id,bool include_signatures)
{
RsStackMutex stack(gpgMtxEngine); /******* LOCKED ******/
return PGPHandler::SaveCertificateToString(id,include_signatures) ;
}
@ -536,10 +541,10 @@ bool AuthGPG::LoadCertificateFromString(const std::string &str, RsPgpId& gpg_id,
/*****************************************************************
* Auth...? Signing, Revoke, Trust are all done at
* the PGP level....
*
*
* Only Signing of SSL is done at setup.
* Auth should be done... ?? not sure
* maybe
* Auth should be done... ?? not sure
* maybe
*
*/
@ -596,12 +601,12 @@ bool AuthGPG::TrustCertificate(const RsPgpId& id, int trustlvl)
return privateTrustCertificate(id, trustlvl) ;
}
bool AuthGPG::encryptDataBin(const RsPgpId& pgp_id,const void *data, unsigned int datalen, unsigned char *sign, unsigned int *signlen)
bool AuthGPG::encryptDataBin(const RsPgpId& pgp_id,const void *data, unsigned int datalen, unsigned char *sign, unsigned int *signlen)
{
return PGPHandler::encryptDataBin(RsPgpId(pgp_id),data,datalen,sign,signlen) ;
}
bool AuthGPG::decryptDataBin(const void *data, unsigned int datalen, unsigned char *sign, unsigned int *signlen)
bool AuthGPG::decryptDataBin(const void *data, unsigned int datalen, unsigned char *sign, unsigned int *signlen)
{
return PGPHandler::decryptDataBin(mOwnGpgId,data,datalen,sign,signlen) ;
}
@ -610,7 +615,7 @@ bool AuthGPG::SignDataBin(const void *data, unsigned int datalen, unsigned char
return DoOwnSignature(data, datalen, sign, signlen, reason);
}
bool AuthGPG::VerifySignBin(const void *data, uint32_t datalen, unsigned char *sign, unsigned int signlen, const PGPFingerprintType& withfingerprint)
bool AuthGPG::VerifySignBin(const void *data, uint32_t datalen, unsigned char *sign, unsigned int signlen, const PGPFingerprintType& withfingerprint)
{
return VerifySignature(data, datalen, sign, signlen, withfingerprint);
}
@ -639,12 +644,12 @@ int AuthGPG::privateTrustCertificate(const RsPgpId& id, int trustlvl)
{
RsStackMutex stack(gpgMtxData); /******* LOCKED ******/
/* The certificate should be in Peers list ??? */
if(!isGPGAccepted(id))
{
std::cerr << "Invalid Certificate" << std::endl;
// csoler: Why are we not allowing this when the peer is not in the accepted peers list??
// The trust level is only a user-defined property that has nothing to
// do with the fact that we allow connections or not.
if(!isGPGAccepted(id))
return 0;
}
int res = PGPHandler::privateTrustCertificate(id,trustlvl) ;
_force_sync_database = true ;
@ -667,7 +672,7 @@ bool AuthGPG::saveList(bool& cleanup, std::list<RsItem*>& lst)
#ifdef GPG_DEBUG
std::cerr << "AuthGPG::saveList() called" << std::endl ;
#endif
std::list<RsPgpId> ids ;
std::list<RsPgpId> ids ;
getGPGAcceptedList(ids) ; // needs to be done before the lock
RsStackMutex stack(gpgMtxData); /******* LOCKED ******/
@ -677,7 +682,7 @@ bool AuthGPG::saveList(bool& cleanup, std::list<RsItem*>& lst)
// Now save config for network digging strategies
RsConfigKeyValueSet *vitem = new RsConfigKeyValueSet ;
for (std::list<RsPgpId>::const_iterator it(ids.begin()); it != ids.end(); ++it)
for (std::list<RsPgpId>::const_iterator it(ids.begin()); it != ids.end(); ++it)
if((*it) != mOwnGpgId) // skip our own id.
{
RsTlvKeyValue kv;
@ -705,7 +710,7 @@ bool AuthGPG::loadList(std::list<RsItem*>& load)
for(it = load.begin(); it != load.end(); ++it)
{
RsConfigKeyValueSet *vitem = dynamic_cast<RsConfigKeyValueSet *>(*it);
if(vitem)
if(vitem)
{
#ifdef GPG_DEBUG
std::cerr << "AuthGPG::loadList() General Variable Config Item:" << std::endl;
@ -715,7 +720,7 @@ bool AuthGPG::loadList(std::list<RsItem*>& load)
std::list<RsTlvKeyValue>::iterator kit;
for(kit = vitem->tlvkvs.pairs.begin(); kit != vitem->tlvkvs.pairs.end(); ++kit)
if (kit->key != mOwnGpgId.toStdString())
if (kit->key != mOwnGpgId.toStdString())
PGPHandler::setAcceptConnexion(RsPgpId(kit->key), (kit->value == "TRUE"));
}
delete (*it);

View File

@ -599,7 +599,8 @@ bool AuthSSLimpl::SignData(const void *data, const uint32_t len, std::string &si
EVP_MD_CTX *mdctx = EVP_MD_CTX_create();
unsigned int signlen = EVP_PKEY_size(mOwnPrivateKey);
unsigned char signature[signlen];
unsigned char signature[signlen] ;
memset(signature,0,signlen) ;
if (0 == EVP_SignInit(mdctx, EVP_sha1()))
{
@ -1586,20 +1587,26 @@ bool AuthSSLimpl::FailedCertificate(X509 *x509, const RsPgpId& gpgid,
switch(auth_diagnostic)
{
case RS_SSL_HANDSHAKE_DIAGNOSTIC_CERTIFICATE_MISSING: RsServer::notify()->AddFeedItem(RS_FEED_ITEM_SEC_MISSING_CERTIFICATE, gpgid.toStdString(), sslid.toStdString(), sslcn, ip_address);
break ;
case RS_SSL_HANDSHAKE_DIAGNOSTIC_CERTIFICATE_NOT_VALID: RsServer::notify()->AddFeedItem(RS_FEED_ITEM_SEC_BAD_CERTIFICATE, gpgid.toStdString(), sslid.toStdString(), sslcn, ip_address);
break ;
case RS_SSL_HANDSHAKE_DIAGNOSTIC_ISSUER_UNKNOWN: RsServer::notify()->AddFeedItem(RS_FEED_ITEM_SEC_UNKNOWN_IN , gpgid.toStdString(), sslid.toStdString(), sslcn, ip_address);
break ;
case RS_SSL_HANDSHAKE_DIAGNOSTIC_MALLOC_ERROR: RsServer::notify()->AddFeedItem(RS_FEED_ITEM_SEC_INTERNAL_ERROR , gpgid.toStdString(), sslid.toStdString(), sslcn, ip_address);
break ;
case RS_SSL_HANDSHAKE_DIAGNOSTIC_WRONG_SIGNATURE: RsServer::notify()->AddFeedItem(RS_FEED_ITEM_SEC_WRONG_SIGNATURE, gpgid.toStdString(), sslid.toStdString(), sslcn, ip_address);
break ;
case RS_SSL_HANDSHAKE_DIAGNOSTIC_OK:
case RS_SSL_HANDSHAKE_DIAGNOSTIC_UNKNOWN:
default:
RsServer::notify()->AddFeedItem(RS_FEED_ITEM_SEC_CONNECT_ATTEMPT, gpgid.toStdString(), sslid.toStdString(), sslcn, ip_address);
case RS_SSL_HANDSHAKE_DIAGNOSTIC_CERTIFICATE_MISSING:
RsServer::notify()->notifyConnectionWithoutCert();
RsServer::notify()->AddFeedItem(RS_FEED_ITEM_SEC_MISSING_CERTIFICATE, gpgid.toStdString(), sslid.toStdString(), sslcn, ip_address);
break ;
case RS_SSL_HANDSHAKE_DIAGNOSTIC_CERTIFICATE_NOT_VALID:
RsServer::notify()->AddFeedItem(RS_FEED_ITEM_SEC_BAD_CERTIFICATE, gpgid.toStdString(), sslid.toStdString(), sslcn, ip_address);
break ;
case RS_SSL_HANDSHAKE_DIAGNOSTIC_ISSUER_UNKNOWN:
RsServer::notify()->AddFeedItem(RS_FEED_ITEM_SEC_UNKNOWN_IN , gpgid.toStdString(), sslid.toStdString(), sslcn, ip_address);
break ;
case RS_SSL_HANDSHAKE_DIAGNOSTIC_MALLOC_ERROR:
RsServer::notify()->AddFeedItem(RS_FEED_ITEM_SEC_INTERNAL_ERROR , gpgid.toStdString(), sslid.toStdString(), sslcn, ip_address);
break ;
case RS_SSL_HANDSHAKE_DIAGNOSTIC_WRONG_SIGNATURE:
RsServer::notify()->AddFeedItem(RS_FEED_ITEM_SEC_WRONG_SIGNATURE, gpgid.toStdString(), sslid.toStdString(), sslcn, ip_address);
break ;
case RS_SSL_HANDSHAKE_DIAGNOSTIC_OK:
case RS_SSL_HANDSHAKE_DIAGNOSTIC_UNKNOWN:
default:
RsServer::notify()->AddFeedItem(RS_FEED_ITEM_SEC_CONNECT_ATTEMPT, gpgid.toStdString(), sslid.toStdString(), sslcn, ip_address);
}
#ifdef AUTHSSL_DEBUG

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