mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
Merge branch 'master' into extra_locators_merge
This commit is contained in:
commit
1dd707710b
34
.travis.yml
34
.travis.yml
@ -13,28 +13,16 @@ matrix:
|
||||
|
||||
before_install:
|
||||
- if [ $TRAVIS_OS_NAME == linux ]; then sudo apt-get update; fi
|
||||
- if [ $TRAVIS_OS_NAME == linux ]; then sudo apt-get install -y build-essential checkinstall cmake libavutil-dev libavcodec-dev libavformat-dev libbz2-dev libcurl4-openssl-dev libcv-dev libopencv-highgui-dev libhighgui-dev libgnome-keyring-dev libgstreamer-plugins-base0.10-dev libgstreamer0.10-dev libjasper-dev libjpeg-dev libmicrohttpd-dev libopencv-dev libprotobuf-dev libqt4-dev libspeex-dev libspeexdsp-dev libsqlite3-dev libssl-dev libswscale-dev libtbb-dev libtiff4-dev libupnp-dev libv4l-dev libxine-dev libxslt1-dev libxss-dev pkg-config protobuf-compiler python-dev qtmobility-dev gdb ; fi
|
||||
- if [ $TRAVIS_OS_NAME == linux ]; then sudo apt-get install -y build-essential libssl-dev libsqlcipher-dev libbz2-dev libmicrohttpd-dev libsqlite3-dev libupnp-dev pkg-config qt5-default libxss-dev qtmultimedia5-dev libqt5x11extras5-dev libqt5designer5 qttools5-dev; fi
|
||||
|
||||
|
||||
# - if [ $TRAVIS_OS_NAME == osx ]; then xcode-select --install ; fi
|
||||
- if [ $TRAVIS_OS_NAME == osx ]; then brew update ; fi
|
||||
# - if [ $TRAVIS_OS_NAME == osx ]; then brew install qt55 openssl miniupnpc libmicrohttpd speex homebrew/science/opencv ffmpeg sqlcipher ; fi
|
||||
- if [ $TRAVIS_OS_NAME == osx ]; then brew install qt55 openssl miniupnpc libmicrohttpd speex speexdsp ffmpeg sqlcipher ; fi
|
||||
- if [ $TRAVIS_OS_NAME == osx ]; then brew install qt55 openssl miniupnpc libmicrohttpd sqlcipher; fi
|
||||
- if [ $TRAVIS_OS_NAME == osx ]; then brew link --force qt55 ; fi
|
||||
#Fix for opencv and numpy already installed by system
|
||||
- if [ $TRAVIS_OS_NAME == osx ]; then rm '/usr/local/bin/f2py'; fi
|
||||
- if [ $TRAVIS_OS_NAME == osx ]; then rm -r '/usr/local/lib/python2.7/site-packages/numpy'; fi
|
||||
- if [ $TRAVIS_OS_NAME == osx ]; then brew install opencv; fi
|
||||
|
||||
# FIX: Now openssl is not linked in /usr/local/include and lib
|
||||
- if [ $TRAVIS_OS_NAME == osx ]; then ln -s /usr/local/opt/openssl/include/* /usr/local/include/; fi
|
||||
- if [ $TRAVIS_OS_NAME == osx ]; then ln -s /usr/local/opt/openssl/lib/*.a /usr/local/lib/; fi
|
||||
- if [ $TRAVIS_OS_NAME == osx ]; then ln -s /usr/local/opt/openssl/lib/*.dylib /usr/local/lib/; fi
|
||||
|
||||
# - if [ $TRAVIS_OS_NAME == linux ]; then sudo apt-get update && sudo apt-get install -y llvm-3.4 llvm-3.4-dev; fi
|
||||
# - rvm use $RVM --install --binary --fuzzy
|
||||
# - gem update --system
|
||||
# - gem --version
|
||||
- wget https://github.com/Tencent/rapidjson/archive/v1.1.0.tar.gz
|
||||
- tar -xf v1.1.0.tar.gz
|
||||
- if [ $TRAVIS_OS_NAME == osx ]; then cp -r rapidjson-1.1.0/include/rapidjson/ /usr/local/include/rapidjson ; fi
|
||||
- if [ $TRAVIS_OS_NAME == linux ]; then sudo cp -r rapidjson-1.1.0/include/rapidjson/ /usr/include/rapidjson ; fi
|
||||
|
||||
env:
|
||||
global:
|
||||
@ -48,16 +36,16 @@ addons:
|
||||
name: "RetroShare/RetroShare"
|
||||
description: "RetroShare Build submitted via Travis CI"
|
||||
build_command_prepend: "qmake CONFIG+=no_sqlcipher; make clean"
|
||||
build_command: "make -j 4"
|
||||
build_command: "make -j4"
|
||||
branch_pattern: coverity_scan
|
||||
|
||||
before_script:
|
||||
- if [ $TRAVIS_OS_NAME == linux ]; then qmake QMAKE_CC=$CC QMAKE_CXX=$CXX CONFIG+=no_sqlcipher CONFIG+=tests ; fi
|
||||
- if [ $TRAVIS_OS_NAME == osx ]; then qmake QMAKE_CC=$CC QMAKE_CXX=$CXX CONFIG+=no_sqlcipher CONFIG+=tests CONFIG+=rs_macos10.12 ; fi
|
||||
- if [ $TRAVIS_OS_NAME == linux ]; then qmake QMAKE_CC=$CC QMAKE_CXX=$CXX; fi
|
||||
- if [ $TRAVIS_OS_NAME == osx ]; then qmake QMAKE_CC=$CC QMAKE_CXX=$CXX CONFIG+=rs_macos10.12 INCLUDEPATH+=/usr/local/opt/openssl/include/ QMAKE_LIBDIR+=/usr/local/opt/openssl/lib/; fi
|
||||
|
||||
script:
|
||||
- if [ $TRAVIS_OS_NAME == linux ] && [ "${COVERITY_SCAN_BRANCH}" != 1 ]; then make && tests/unittests/unittests >/dev/null 2>&1 ; fi
|
||||
- if [ $TRAVIS_OS_NAME == osx ] && [ "${COVERITY_SCAN_BRANCH}" != 1 ]; then make -j 4 ; fi
|
||||
- if [ $TRAVIS_OS_NAME == linux ] && [ "${COVERITY_SCAN_BRANCH}" != 1 ]; then make -j2; fi
|
||||
- if [ $TRAVIS_OS_NAME == osx ] && [ "${COVERITY_SCAN_BRANCH}" != 1 ]; then make -j2; fi
|
||||
|
||||
|
||||
#after_success:
|
||||
|
@ -31,7 +31,7 @@ export ANDROID_NDK_PATH="/opt/android-ndk/"
|
||||
|
||||
## The path where your fresh compiled toolchain will be installed, make sure
|
||||
## the parent exists
|
||||
export NDK_TOOLCHAIN_PATH="${HOME}/Builds/android-toolchains/retroshare-android/"
|
||||
export NATIVE_LIBS_TOOLCHAIN_PATH="${HOME}/Builds/android-toolchains/retroshare-android/"
|
||||
|
||||
## The CPU architecture of the Android device you want to target
|
||||
export ANDROID_NDK_ARCH="arm"
|
||||
@ -66,7 +66,7 @@ _Qt Creator left pane -> Projects -> Build and Run -> Android SOMESTUFF kit ->
|
||||
Build Environement -> Add
|
||||
|
||||
Variable: +NATIVE_LIBS_TOOLCHAIN_PATH+
|
||||
Value: +Same value as NDK_TOOLCHAIN_PATH in Preparing The Environement step+
|
||||
Value: +Same value as NATIVE_LIBS_TOOLCHAIN_PATH in Preparing The Environement step+
|
||||
|
||||
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
|
||||
@ -91,6 +91,8 @@ pointing to your SDK installation path, like
|
||||
|
||||
== Quircks
|
||||
|
||||
=== Protected Apps
|
||||
|
||||
On some Android devices like +Huawei ALE-L21+ background applications are
|
||||
killed when screen is turned off unless they are in the _protected app_ list.
|
||||
At moment seems apps developers don't have a way to have the application
|
||||
@ -106,6 +108,74 @@ To enable enable _protection_: +Android menu -> Settings -> Privacy & security
|
||||
Other devices may offer similar _features_ please report them.
|
||||
|
||||
|
||||
=== APK signature mismatch
|
||||
|
||||
If you try to install a RetroShare APK that comes from a different source
|
||||
(eg: if you try to upgrade from F-Droid when you originally installed an APK
|
||||
build by yourself) Android will prevent that from happening. In that case the
|
||||
only solution is to uninstall the app and then install the new APK but if you do
|
||||
it also the application data and your precious cryptographic keys, friend list
|
||||
etc. will be lost forever.
|
||||
To avoid that you can attempt to manually backup and then restore from the
|
||||
command-line (+adb backup+ seems not working either) to change the app source
|
||||
without erasing the appliation data.
|
||||
|
||||
CAUTION: Following steps require root access on your Android device
|
||||
|
||||
.Backup RetroShare Android application data
|
||||
[source,bash]
|
||||
--------------------------------------------------------------------------------
|
||||
export ORIG_DIR="/data/data/org.retroshare.android.qml_app"
|
||||
export BACKUP_DIR="org.retroshare.android.qml_app.backup"
|
||||
|
||||
adb root
|
||||
|
||||
adb shell am force-stop org.retroshare.android.qml_app
|
||||
sleep 1s
|
||||
|
||||
mkdir ${BACKUP_DIR}
|
||||
|
||||
# Avoid adb pull failing
|
||||
adb shell rm ${ORIG_DIR}/files/.retroshare/libresapi.sock
|
||||
adb pull ${ORIG_DIR}/files/ ${BACKUP_DIR}/files/
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
After this you should be able to uninstall the old APK with your preferred
|
||||
method, as example from the command-line.
|
||||
|
||||
.Uninstall RetroShare Android from the command-line
|
||||
[source,bash]
|
||||
--------------------------------------------------------------------------------
|
||||
adb uninstall org.retroshare.android.qml_app
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
Now you can install a different signature APK and then restore the application
|
||||
data with the following commands.
|
||||
|
||||
[source,bash]
|
||||
--------------------------------------------------------------------------------
|
||||
export ORIG_DIR="/data/data/org.retroshare.android.qml_app"
|
||||
export BACKUP_DIR="org.retroshare.android.qml_app.backup"
|
||||
|
||||
adb root
|
||||
|
||||
## Launch the app to make sure the parent directory exists and has proper owner
|
||||
adb shell monkey -p org.retroshare.android.qml_app -c android.intent.category.LAUNCHER 1
|
||||
sleep 1s
|
||||
|
||||
adb shell am force-stop org.retroshare.android.qml_app
|
||||
sleep 1s
|
||||
|
||||
|
||||
APP_OWNER="$(adb shell busybox ls -lnd ${ORIG_DIR} | awk '{print $3":"$4}')"
|
||||
adb shell rm -rf ${ORIG_DIR}/files
|
||||
adb push ${BACKUP_DIR}/files/ ${ORIG_DIR}/files/
|
||||
adb shell busybox chown -R ${APP_OWNER} ${ORIG_DIR}/files/
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
Opening RetroShare android app now should show your old profile.
|
||||
|
||||
|
||||
== Debugging with GDB
|
||||
|
||||
QtCreator actually support debugging only for the foreground activity, so to
|
||||
|
@ -32,19 +32,19 @@ Compilation on Linux
|
||||
libqt4-dev libssl-dev libxss-dev libgnome-keyring-dev libbz2-dev \
|
||||
libqt4-opengl-dev libqtmultimediakit1 qtmobility-dev libsqlcipher-dev \
|
||||
libspeex-dev libspeexdsp-dev libxslt1-dev libcurl4-openssl-dev \
|
||||
libopencv-dev tcl8.5 libmicrohttpd-dev
|
||||
libopencv-dev tcl8.5 libmicrohttpd-dev rapidjson-dev
|
||||
```
|
||||
* openSUSE
|
||||
```bash
|
||||
sudo zypper install gcc-c++ libqt4-devel libgnome-keyring-devel \
|
||||
glib2-devel speex-devel libssh-devel protobuf-devel libcurl-devel \
|
||||
libxml2-devel libxslt-devel sqlcipher-devel libmicrohttpd-devel \
|
||||
opencv-devel speexdsp-devel libupnp-devel libavcodec-devel
|
||||
opencv-devel speexdsp-devel libupnp-devel libavcodec-devel rapidjson
|
||||
```
|
||||
* Arch Linux
|
||||
```bash
|
||||
pacman -S base-devel libgnome-keyring libmicrohttpd libupnp libxslt \
|
||||
libxss opencv qt4 speex speexdsp sqlcipher
|
||||
libxss opencv qt4 speex speexdsp sqlcipher rapidjson
|
||||
```
|
||||
|
||||
2. Checkout the source code
|
||||
|
@ -1,13 +1,12 @@
|
||||
!include("retroshare.pri"): error("Could not include file retroshare.pri")
|
||||
|
||||
TEMPLATE = subdirs
|
||||
#CONFIG += tests
|
||||
|
||||
SUBDIRS += openpgpsdk
|
||||
openpgpsdk.file = openpgpsdk/src/openpgpsdk.pro
|
||||
|
||||
retrotor {
|
||||
libretroshare.depends = openpgpsdk
|
||||
libretroshare.depends = openpgpsdk
|
||||
} else {
|
||||
SUBDIRS += libbitdht
|
||||
libbitdht.file = libbitdht/src/libbitdht.pro
|
||||
|
@ -1,21 +1,78 @@
|
||||
#!/bin/bash
|
||||
|
||||
## Define default value for variable, take two arguments, $1 variable name,
|
||||
## $2 default variable value, if the variable is not already define define it
|
||||
## with default value.
|
||||
function define_default_value()
|
||||
{
|
||||
VAR_NAME="${1}"
|
||||
DEFAULT_VALUE="${2}"
|
||||
|
||||
[ -z "${!VAR_NAME}" ] && export ${VAR_NAME}="${DEFAULT_VALUE}"
|
||||
}
|
||||
|
||||
## You are supposed to provide the following variables according to your system setup
|
||||
[ -z ${ANDROID_NDK_PATH+x} ] && export ANDROID_NDK_PATH="/opt/android-ndk/"
|
||||
[ -z ${ANDROID_NDK_ARCH+x} ] && export ANDROID_NDK_ARCH="arm"
|
||||
[ -z ${ANDROID_NDK_ABI_VER+x} ] && export ANDROID_NDK_ABI_VER="4.9"
|
||||
[ -z ${ANDROID_PLATFORM_VER+x} ] && export ANDROID_PLATFORM_VER="18"
|
||||
[ -z ${NDK_TOOLCHAIN_PATH+x} ] && export NDK_TOOLCHAIN_PATH="${HOME}/Builds/android-toolchains/retroshare-android-${ANDROID_PLATFORM_VER}-${ANDROID_NDK_ARCH}-abi${ANDROID_NDK_ABI_VER}/"
|
||||
[ -z ${HOST_NUM_CPU+x} ] && export HOST_NUM_CPU=$(grep "^processor" /proc/cpuinfo | wc -l)
|
||||
[ -z ${BZIP2_SOURCE_VERSION+x} ] && export BZIP2_SOURCE_VERSION="1.0.6"
|
||||
[ -z ${OPENSSL_SOURCE_VERSION+x} ] && export OPENSSL_SOURCE_VERSION="1.0.2n"
|
||||
[ -z ${SQLITE_SOURCE_YEAR+x} ] && export SQLITE_SOURCE_YEAR="2018"
|
||||
[ -z ${SQLITE_SOURCE_VERSION+x} ] && export SQLITE_SOURCE_VERSION="3220000"
|
||||
[ -z ${SQLCIPHER_SOURCE_VERSION+x} ] && export SQLCIPHER_SOURCE_VERSION="3.4.2"
|
||||
[ -z ${LIBUPNP_SOURCE_VERSION+x} ] && export LIBUPNP_SOURCE_VERSION="1.6.24"
|
||||
define_default_value ANDROID_NDK_PATH "/opt/android-ndk/"
|
||||
define_default_value ANDROID_NDK_ARCH "arm"
|
||||
define_default_value ANDROID_NDK_ABI_VER "4.9"
|
||||
define_default_value ANDROID_PLATFORM_VER "18"
|
||||
define_default_value NATIVE_LIBS_TOOLCHAIN_PATH "${HOME}/Builds/android-toolchains/retroshare-android-${ANDROID_PLATFORM_VER}-${ANDROID_NDK_ARCH}-abi${ANDROID_NDK_ABI_VER}/"
|
||||
define_default_value HOST_NUM_CPU $(nproc)
|
||||
|
||||
define_default_value BZIP2_SOURCE_VERSION "1.0.6"
|
||||
define_default_value BZIP2_SOURCE_SHA256 a2848f34fcd5d6cf47def00461fcb528a0484d8edef8208d6d2e2909dc61d9cd
|
||||
|
||||
define_default_value OPENSSL_SOURCE_VERSION "1.0.2n"
|
||||
define_default_value OPENSSL_SOURCE_SHA256 370babb75f278c39e0c50e8c4e7493bc0f18db6867478341a832a982fd15a8fe
|
||||
|
||||
define_default_value SQLITE_SOURCE_YEAR "2018"
|
||||
define_default_value SQLITE_SOURCE_VERSION "3220000"
|
||||
define_default_value SQLITE_SOURCE_SHA256 2824ab1238b706bc66127320afbdffb096361130e23291f26928a027b885c612
|
||||
|
||||
define_default_value SQLCIPHER_SOURCE_VERSION "3.4.2"
|
||||
define_default_value SQLCIPHER_SOURCE_SHA256 69897a5167f34e8a84c7069f1b283aba88cdfa8ec183165c4a5da2c816cfaadb
|
||||
|
||||
define_default_value LIBUPNP_SOURCE_VERSION "1.6.24"
|
||||
define_default_value LIBUPNP_SOURCE_SHA256 7d83d79af3bb4062e5c3a58bf2e90d2da5b8b99e2b2d57c23b5b6f766288cf96
|
||||
|
||||
define_default_value INSTALL_QT_ANDROID "false"
|
||||
define_default_value QT_VERSION "5.9.4"
|
||||
define_default_value QT_ANDROID_INSTALLER_SHA256 a214084e2295c9a9f8727e8a0131c37255bf724bfc69e80f7012ba3abeb1f763
|
||||
|
||||
|
||||
## $1 filename, $2 sha256 hash
|
||||
function check_sha256()
|
||||
{
|
||||
echo ${2} "${1}" | sha256sum -c &> /dev/null
|
||||
}
|
||||
|
||||
## $1 filename, $2 sha256 hash, $3 url
|
||||
function verified_download()
|
||||
{
|
||||
FILENAME="$1"
|
||||
SHA256="$2"
|
||||
URL="$3"
|
||||
|
||||
check_sha256 "${FILENAME}" "${SHA256}" ||
|
||||
{
|
||||
rm -rf "${FILENAME}"
|
||||
|
||||
wget -O "${FILENAME}" "$URL" ||
|
||||
{
|
||||
echo "Failed downloading ${FILENAME} from $URL"
|
||||
exit 1
|
||||
}
|
||||
|
||||
check_sha256 "${FILENAME}" "${SHA256}" ||
|
||||
{
|
||||
echo "SHA256 mismatch for ${FILENAME} from ${URL} expected sha256 ${SHA256} got $(sha256sum ${FILENAME} | awk '{print $1}')"
|
||||
exit 1
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
## You should not edit the following variables
|
||||
if [ "${ANDROID_NDK_ARCH}" == "x86" ]; then
|
||||
cArch="i686"
|
||||
eABI=""
|
||||
@ -23,21 +80,104 @@ else
|
||||
cArch="${ANDROID_NDK_ARCH}"
|
||||
eABI="eabi"
|
||||
fi
|
||||
export SYSROOT="${NDK_TOOLCHAIN_PATH}/sysroot"
|
||||
export SYSROOT="${NATIVE_LIBS_TOOLCHAIN_PATH}/sysroot"
|
||||
export PREFIX="${SYSROOT}"
|
||||
export CC="${NDK_TOOLCHAIN_PATH}/bin/${cArch}-linux-android${eABI}-gcc"
|
||||
export CXX="${NDK_TOOLCHAIN_PATH}/bin/${cArch}-linux-android${eABI}-g++"
|
||||
export AR="${NDK_TOOLCHAIN_PATH}/bin/${cArch}-linux-android${eABI}-ar"
|
||||
export RANLIB="${NDK_TOOLCHAIN_PATH}/bin/${cArch}-linux-android${eABI}-ranlib"
|
||||
export CC="${NATIVE_LIBS_TOOLCHAIN_PATH}/bin/${cArch}-linux-android${eABI}-gcc"
|
||||
export CXX="${NATIVE_LIBS_TOOLCHAIN_PATH}/bin/${cArch}-linux-android${eABI}-g++"
|
||||
export AR="${NATIVE_LIBS_TOOLCHAIN_PATH}/bin/${cArch}-linux-android${eABI}-ar"
|
||||
export RANLIB="${NATIVE_LIBS_TOOLCHAIN_PATH}/bin/${cArch}-linux-android${eABI}-ranlib"
|
||||
export ANDROID_DEV="${ANDROID_NDK_PATH}/platforms/android-${ANDROID_PLATFORM_VER}/arch-${ANDROID_NDK_ARCH}/usr"
|
||||
|
||||
|
||||
## More information available at https://android.googlesource.com/platform/ndk/+/ics-mr0/docs/STANDALONE-TOOLCHAIN.html
|
||||
build_toolchain()
|
||||
{
|
||||
rm -rf ${NDK_TOOLCHAIN_PATH}
|
||||
rm -rf ${NATIVE_LIBS_TOOLCHAIN_PATH}
|
||||
[ "${ANDROID_NDK_ARCH}" == "x86" ] && toolchainName="${ANDROID_NDK_ARCH}-${ANDROID_NDK_ABI_VER}" || toolchainName="${ANDROID_NDK_ARCH}-linux-androideabi-${ANDROID_NDK_ABI_VER}"
|
||||
${ANDROID_NDK_PATH}/build/tools/make-standalone-toolchain.sh --ndk-dir=${ANDROID_NDK_PATH} --arch=${ANDROID_NDK_ARCH} --install-dir=${NDK_TOOLCHAIN_PATH} --platform=android-${ANDROID_PLATFORM_VER} --toolchain=${toolchainName} --verbose
|
||||
${ANDROID_NDK_PATH}/build/tools/make-standalone-toolchain.sh --ndk-dir=${ANDROID_NDK_PATH} --arch=${ANDROID_NDK_ARCH} --install-dir=${NATIVE_LIBS_TOOLCHAIN_PATH} --platform=android-${ANDROID_PLATFORM_VER} --toolchain=${toolchainName} --verbose
|
||||
}
|
||||
|
||||
## More information available at https://gitlab.com/relan/provisioners/merge_requests/1 and http://stackoverflow.com/a/34032216
|
||||
install_qt_android()
|
||||
{
|
||||
QT_VERSION_CODE=$(echo $QT_VERSION | tr -d .)
|
||||
QT_INSTALL_PATH=${NATIVE_LIBS_TOOLCHAIN_PATH}/Qt
|
||||
QT_INSTALLER="qt-unified-linux-x64-3.0.2-online.run"
|
||||
|
||||
verified_download $QT_INSTALLER $QT_ANDROID_INSTALLER_SHA256 \
|
||||
http://master.qt.io/archive/online_installers/3.0/${QT_INSTALLER}
|
||||
|
||||
chmod a+x ${QT_INSTALLER}
|
||||
|
||||
QT_INSTALLER_SCRIPT="qt_installer_script.js"
|
||||
cat << EOF > "${QT_INSTALLER_SCRIPT}"
|
||||
function Controller() {
|
||||
installer.autoRejectMessageBoxes();
|
||||
installer.installationFinished.connect(function() {
|
||||
gui.clickButton(buttons.NextButton);
|
||||
});
|
||||
|
||||
var welcomePage = gui.pageWidgetByObjectName("WelcomePage");
|
||||
welcomePage.completeChanged.connect(function() {
|
||||
if (gui.currentPageWidget().objectName == welcomePage.objectName)
|
||||
gui.clickButton(buttons.NextButton);
|
||||
});
|
||||
}
|
||||
|
||||
Controller.prototype.WelcomePageCallback = function() {
|
||||
gui.clickButton(buttons.NextButton);
|
||||
}
|
||||
|
||||
Controller.prototype.CredentialsPageCallback = function() {
|
||||
gui.clickButton(buttons.NextButton);
|
||||
}
|
||||
|
||||
Controller.prototype.IntroductionPageCallback = function() {
|
||||
gui.clickButton(buttons.NextButton);
|
||||
}
|
||||
|
||||
Controller.prototype.TargetDirectoryPageCallback = function() {
|
||||
gui.currentPageWidget().TargetDirectoryLineEdit.setText("$QT_INSTALL_PATH");
|
||||
gui.clickButton(buttons.NextButton);
|
||||
}
|
||||
|
||||
Controller.prototype.ComponentSelectionPageCallback = function() {
|
||||
var widget = gui.currentPageWidget();
|
||||
|
||||
// You can get these component names by running the installer with the
|
||||
// --verbose flag. It will then print out a resource tree.
|
||||
|
||||
widget.deselectComponent("qt.tools.qtcreator");
|
||||
widget.deselectComponent("qt.tools.doc");
|
||||
widget.deselectComponent("qt.tools.examples");
|
||||
|
||||
widget.selectComponent("qt.$QT_VERSION_CODE.android_armv7");
|
||||
|
||||
gui.clickButton(buttons.NextButton);
|
||||
}
|
||||
|
||||
Controller.prototype.LicenseAgreementPageCallback = function() {
|
||||
gui.currentPageWidget().AcceptLicenseRadioButton.setChecked(true);
|
||||
gui.clickButton(buttons.NextButton);
|
||||
}
|
||||
|
||||
Controller.prototype.StartMenuDirectoryPageCallback = function() {
|
||||
gui.clickButton(buttons.NextButton);
|
||||
}
|
||||
|
||||
Controller.prototype.ReadyForInstallationPageCallback = function() {
|
||||
gui.clickButton(buttons.NextButton);
|
||||
}
|
||||
|
||||
Controller.prototype.FinishedPageCallback = function() {
|
||||
var checkBoxForm = gui.currentPageWidget().LaunchQtCreatorCheckBoxForm;
|
||||
if (checkBoxForm && checkBoxForm.launchQtCreatorCheckBox)
|
||||
checkBoxForm.launchQtCreatorCheckBox.checked = false;
|
||||
gui.clickButton(buttons.FinishButton);
|
||||
}
|
||||
EOF
|
||||
|
||||
QT_QPA_PLATFORM=minimal ./${QT_INSTALLER} --script ${QT_INSTALLER_SCRIPT}
|
||||
}
|
||||
|
||||
## More information available at retroshare://file?name=Android%20Native%20Development%20Kit%20Cookbook.pdf&size=29214468&hash=0123361c1b14366ce36118e82b90faf7c7b1b136
|
||||
@ -45,7 +185,10 @@ build_bzlib()
|
||||
{
|
||||
B_dir="bzip2-${BZIP2_SOURCE_VERSION}"
|
||||
rm -rf $B_dir
|
||||
[ -f $B_dir.tar.gz ] || wget http://www.bzip.org/${BZIP2_SOURCE_VERSION}/bzip2-${BZIP2_SOURCE_VERSION}.tar.gz
|
||||
|
||||
verified_download $B_dir.tar.gz $BZIP2_SOURCE_SHA256 \
|
||||
http://www.bzip.org/${BZIP2_SOURCE_VERSION}/bzip2-${BZIP2_SOURCE_VERSION}.tar.gz
|
||||
|
||||
tar -xf $B_dir.tar.gz
|
||||
cd $B_dir
|
||||
sed -i "/^CC=.*/d" Makefile
|
||||
@ -66,7 +209,10 @@ build_openssl()
|
||||
{
|
||||
B_dir="openssl-${OPENSSL_SOURCE_VERSION}"
|
||||
rm -rf $B_dir
|
||||
[ -f $B_dir.tar.gz ] || wget https://www.openssl.org/source/$B_dir.tar.gz
|
||||
|
||||
verified_download $B_dir.tar.gz $OPENSSL_SOURCE_SHA256 \
|
||||
https://www.openssl.org/source/$B_dir.tar.gz
|
||||
|
||||
tar -xf $B_dir.tar.gz
|
||||
cd $B_dir
|
||||
if [ "${ANDROID_NDK_ARCH}" == "arm" ]; then
|
||||
@ -92,24 +238,31 @@ build_openssl()
|
||||
build_sqlite()
|
||||
{
|
||||
B_dir="sqlite-autoconf-${SQLITE_SOURCE_VERSION}"
|
||||
[ -f $B_dir.tar.gz ] || wget https://www.sqlite.org/${SQLITE_SOURCE_YEAR}/$B_dir.tar.gz
|
||||
|
||||
verified_download $B_dir.tar.gz $SQLITE_SOURCE_SHA256 \
|
||||
https://www.sqlite.org/${SQLITE_SOURCE_YEAR}/$B_dir.tar.gz
|
||||
|
||||
tar -xf $B_dir.tar.gz
|
||||
cd $B_dir
|
||||
./configure --prefix="${SYSROOT}/usr" --host=${ANDROID_NDK_ARCH}-linux
|
||||
make -j${HOST_NUM_CPU}
|
||||
make install
|
||||
rm -f ${SYSROOT}/usr/lib/libsqlite3.so*
|
||||
${CC} -shared -o libsqlite3.so -fPIC sqlite3.o -ldl
|
||||
cp libsqlite3.so "${SYSROOT}/usr/lib"
|
||||
# ${CC} -shared -o libsqlite3.so -fPIC sqlite3.o -ldl
|
||||
# cp libsqlite3.so "${SYSROOT}/usr/lib"
|
||||
cd ..
|
||||
}
|
||||
|
||||
build_sqlcipher()
|
||||
{
|
||||
B_dir="sqlcipher-${SQLCIPHER_SOURCE_VERSION}"
|
||||
T_file="${B_dir}.tar.gz"
|
||||
[ -f $T_file ] || wget -O $T_file https://github.com/sqlcipher/sqlcipher/archive/v${SQLCIPHER_SOURCE_VERSION}.tar.gz
|
||||
rm -rf $B_dir
|
||||
|
||||
T_file="${B_dir}.tar.gz"
|
||||
|
||||
verified_download $T_file $SQLCIPHER_SOURCE_SHA256 \
|
||||
https://github.com/sqlcipher/sqlcipher/archive/v${SQLCIPHER_SOURCE_VERSION}.tar.gz
|
||||
|
||||
tar -xf $T_file
|
||||
cd $B_dir
|
||||
./configure --build=$(sh ./config.guess) \
|
||||
@ -127,7 +280,10 @@ build_libupnp()
|
||||
{
|
||||
B_dir="libupnp-${LIBUPNP_SOURCE_VERSION}"
|
||||
rm -rf $B_dir
|
||||
[ -f $B_dir.tar.bz2 ] || wget https://sourceforge.net/projects/pupnp/files/pupnp/libUPnP%20${LIBUPNP_SOURCE_VERSION}/$B_dir.tar.bz2
|
||||
|
||||
verified_download $B_dir.tar.bz2 $LIBUPNP_SOURCE_SHA256 \
|
||||
https://sourceforge.net/projects/pupnp/files/pupnp/libUPnP%20${LIBUPNP_SOURCE_VERSION}/$B_dir.tar.bz2
|
||||
|
||||
tar -xf $B_dir.tar.bz2
|
||||
cd $B_dir
|
||||
## liupnp must be configured as static library because if not the linker will
|
||||
@ -157,11 +313,21 @@ build_libmicrohttpd()
|
||||
cd ..
|
||||
}
|
||||
|
||||
build_rapidjson()
|
||||
{
|
||||
B_dir="rapidjson-1.1.0"
|
||||
[ -f $B_dir.tar.gz ] || wget -O $B_dir.tar.gz https://github.com/Tencent/rapidjson/archive/v1.1.0.tar.gz
|
||||
tar -xf $B_dir.tar.gz
|
||||
cp -r rapidjson-1.1.0/include/rapidjson/ "${SYSROOT}/usr/include/rapidjson"
|
||||
}
|
||||
|
||||
build_toolchain
|
||||
[ "${INSTALL_QT_ANDROID}X" == "trueX" ] && install_qt_android
|
||||
build_bzlib
|
||||
build_openssl
|
||||
build_sqlite
|
||||
build_sqlcipher
|
||||
build_libupnp
|
||||
build_rapidjson
|
||||
|
||||
echo NDK_TOOLCHAIN_PATH=${NDK_TOOLCHAIN_PATH}
|
||||
echo NATIVE_LIBS_TOOLCHAIN_PATH=${NATIVE_LIBS_TOOLCHAIN_PATH}
|
||||
|
155
appveyor.yml
155
appveyor.yml
@ -12,7 +12,7 @@
|
||||
#---------------------------------#
|
||||
|
||||
# version format
|
||||
version: RetroShare 0.6.0.{build}-{branch}
|
||||
version: RetroShare-git-{branch}-{build}
|
||||
|
||||
# you can use {branch} name in version format too
|
||||
# version: 1.0.{build}-{branch}
|
||||
@ -52,7 +52,7 @@ on_finish:
|
||||
#- ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
|
||||
|
||||
# clone directory
|
||||
clone_folder: c:\projects\RetroShare
|
||||
clone_folder: C:\projects\RetroShare
|
||||
|
||||
# fetch repository as zip archive
|
||||
#shallow_clone: true # default is "false"
|
||||
@ -62,19 +62,18 @@ clone_depth: 1 # clone entire repository history if not de
|
||||
|
||||
environment:
|
||||
global:
|
||||
#Qt: https://www.appveyor.com/docs/installed-software#qt
|
||||
QTDIR: C:\Qt\5.4\mingw491_32
|
||||
## Qt: https://www.appveyor.com/docs/installed-software#qt
|
||||
# QTDIR: C:\Qt\5.10.1\mingw53_32
|
||||
MSYS2_ARCH: i686
|
||||
TARGET: i686_32-pc-msys
|
||||
MINGW_PREFIX: C:\msys64\mingw32
|
||||
RS_DEPLOY: RetroShare_deploy
|
||||
|
||||
|
||||
# build cache to preserve files/folders between builds
|
||||
cache:
|
||||
- c:\projects\libs
|
||||
# - packages -> **\packages.config # preserve "packages" directory in the root of build folder but will reset it if packages.config is modified
|
||||
# - projectA\libs
|
||||
# - node_modules # local npm modules
|
||||
# - %APPDATA%\npm-cache # npm cache
|
||||
#cache:
|
||||
# Disabled because it's bigger then supported by appveyor free plan
|
||||
# - C:\msys64\var\cache\pacman\pkg
|
||||
|
||||
# scripts that run after cloning repository
|
||||
#install:
|
||||
@ -89,23 +88,12 @@ install:
|
||||
# Configuring MSys2
|
||||
- set PATH=C:\msys64\usr\bin;%PATH%
|
||||
- set PATH=C:\msys64\mingw32\bin;%PATH%
|
||||
- pacman --noconfirm -S mingw-w64-i686-qt5 mingw-w64-i686-miniupnpc mingw-w64-i686-sqlcipher mingw-w64-i686-libmicrohttpd
|
||||
#- pacman --noconfirm -S mingw-w64-i686-qt5-static mingw-w64-i686-miniupnpc mingw-w64-i686-sqlcipher mingw-w64-i686-libmicrohttpd
|
||||
#- set PATH=C:\msys64\mingw32\qt5-static\bin\;%PATH%
|
||||
|
||||
# Configuring Qt
|
||||
- set PATH=%QTDIR%\bin;C:\Qt\Tools\mingw491_32\bin;%PATH%
|
||||
# Install all default programms
|
||||
#- C:\msys64\usr\bin\bash -lc "pacman --noconfirm -Sy base-devel git mercurial cvs wget p7zip gcc perl ruby python2" #Already installed
|
||||
- C:\msys64\usr\bin\bash -lc "pacman --noconfirm -Sy openssl-devel"
|
||||
# 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"
|
||||
- C:\msys64\usr\bin\bash -lc "pacman --noconfirm -S mingw-w64-i686-speexdsp mingw-w64-x86_64-speexdsp"
|
||||
- C:\msys64\usr\bin\bash -lc "pacman --noconfirm -S mingw-w64-i686-opencv mingw-w64-x86_64-opencv"
|
||||
- C:\msys64\usr\bin\bash -lc "pacman --noconfirm -S mingw-w64-i686-ffmpeg mingw-w64-x86_64-ffmpeg"
|
||||
- C:\msys64\usr\bin\bash -lc "pacman --noconfirm -S mingw-w64-i686-libmicrohttpd mingw-w64-x86_64-libmicrohttpd"
|
||||
- C:\msys64\usr\bin\bash -lc "pacman --noconfirm -S mingw-w64-i686-libxslt mingw-w64-x86_64-libxslt"
|
||||
# - set PATH=%QTDIR%\bin;C:\Qt\Tools\mingw491_32\bin;%PATH%
|
||||
|
||||
# Hack for new MSys2
|
||||
- copy C:\msys64\mingw32\i686-w64-mingw32\bin\ar.exe C:\msys64\mingw32\bin\i686-w64-mingw32-ar.exe
|
||||
@ -114,10 +102,6 @@ install:
|
||||
- copy C:\msys64\mingw64\x86_64-w64-mingw32\bin\ar.exe C:\msys64\mingw64\bin\x86_64-w64-mingw32-ar.exe
|
||||
- copy C:\msys64\mingw64\x86_64-w64-mingw32\bin\ranlib.exe C:\msys64\mingw64\bin\x86_64-w64-mingw32-ranlib.exe
|
||||
- copy C:\msys64\mingw64\bin\windres.exe C:\msys64\mingw64\bin\x86_64-w64-mingw32-windres.exe
|
||||
# Build missing Libs
|
||||
#- C:\msys64\mingw32.exe -lc "cd /c/projects/RetroShare/msys2_build_libs/ && make"
|
||||
# Clone RetroShare
|
||||
#- git clone -q --branch={branch} https://github.com/RetroShare/RetroShare.git C:\projects\RetroShare
|
||||
|
||||
|
||||
#---------------------------------#
|
||||
@ -142,18 +126,112 @@ configuration: Release
|
||||
|
||||
# scripts to run before build
|
||||
before_build:
|
||||
- cd C:\projects\RetroShare
|
||||
# - find C:\ > filelist.txt
|
||||
|
||||
# scripts to run *after* solution is built and *before* automatic packaging occurs (web apps, NuGet packages, Azure Cloud Services)
|
||||
before_package:
|
||||
|
||||
# scripts to run after build
|
||||
after_build:
|
||||
|
||||
# to run your custom scripts instead of automatic MSBuild
|
||||
build_script:
|
||||
- cd C:\projects\RetroShare
|
||||
- qmake CONFIG+=no_sqlcipher
|
||||
- make
|
||||
- qmake -Wall -spec win32-g++ "CONFIG=debug"
|
||||
- mingw32-make -j3
|
||||
|
||||
# scripts to run after build
|
||||
after_build:
|
||||
- mkdir %RS_DEPLOY%
|
||||
- copy retroshare-nogui\src\retroshare-nogui.exe %RS_DEPLOY%\
|
||||
- copy retroshare-gui\src\retroshare.exe %RS_DEPLOY%\
|
||||
|
||||
## In Debug build winedeplyqt forget the non debug Qt libs
|
||||
- copy C:\msys64\mingw32\bin\Qt5Svg.dll %RS_DEPLOY%\
|
||||
- copy C:\msys64\mingw32\bin\Qt5Core.dll %RS_DEPLOY%\
|
||||
- copy C:\msys64\mingw32\bin\Qt5Multimedia.dll %RS_DEPLOY%\
|
||||
- copy C:\msys64\mingw32\bin\Qt5Widgets.dll %RS_DEPLOY%\
|
||||
- copy C:\msys64\mingw32\bin\Qt5Xml.dll %RS_DEPLOY%\
|
||||
- copy C:\msys64\mingw32\bin\Qt5PrintSupport.dll %RS_DEPLOY%\
|
||||
- copy C:\msys64\mingw32\bin\Qt5Gui.dll %RS_DEPLOY%\
|
||||
- copy C:\msys64\mingw32\bin\Qt5Network.dll %RS_DEPLOY%\
|
||||
|
||||
- mkdir %RS_DEPLOY%\playlistformats\
|
||||
- copy C:\msys64\mingw32\share\qt5\plugins\playlistformats\qtmultimedia_m3u.dll %RS_DEPLOY%\playlistformats
|
||||
|
||||
- mkdir %RS_DEPLOY%\printsupport\
|
||||
- copy C:\msys64\mingw32\share\qt5\plugins\printsupport\windowsprintersupport.dll %RS_DEPLOY%\printsupport\
|
||||
|
||||
- mkdir %RS_DEPLOY%\iconengines\
|
||||
- copy C:\msys64\mingw32\share\qt5\plugins\iconengines\qsvgicon.dll %RS_DEPLOY%\iconengines\
|
||||
|
||||
- mkdir %RS_DEPLOY%\bearer\
|
||||
- copy C:\msys64\mingw32\share\qt5\plugins\bearer\qgenericbearer.dll %RS_DEPLOY%\bearer\
|
||||
|
||||
- mkdir %RS_DEPLOY%\mediaservice\
|
||||
- copy C:\msys64\mingw32\share\qt5\plugins\mediaservice\qtmedia_audioengine.dll %RS_DEPLOY%\mediaservice\
|
||||
- copy C:\msys64\mingw32\share\qt5\plugins\mediaservice\dsengine.dll %RS_DEPLOY%\mediaservice\
|
||||
|
||||
- mkdir %RS_DEPLOY%\styles\
|
||||
- copy C:\msys64\mingw32\share\qt5\plugins\styles\qwindowsvistastyle.dll %RS_DEPLOY%\styles\
|
||||
|
||||
- mkdir %RS_DEPLOY%\imageformats\
|
||||
- copy C:\msys64\mingw32\share\qt5\plugins\imageformats\qwebp.dll %RS_DEPLOY%\imageformats\
|
||||
- copy C:\msys64\mingw32\share\qt5\plugins\imageformats\qicns.dll %RS_DEPLOY%\imageformats\
|
||||
- copy C:\msys64\mingw32\share\qt5\plugins\imageformats\qjpeg.dll %RS_DEPLOY%\imageformats\
|
||||
- copy C:\msys64\mingw32\share\qt5\plugins\imageformats\qtiff.dll %RS_DEPLOY%\imageformats\
|
||||
- copy C:\msys64\mingw32\share\qt5\plugins\imageformats\qtga.dll %RS_DEPLOY%\imageformats\
|
||||
- copy C:\msys64\mingw32\share\qt5\plugins\imageformats\qjp2.dll %RS_DEPLOY%\imageformats\
|
||||
- copy C:\msys64\mingw32\share\qt5\plugins\imageformats\qico.dll %RS_DEPLOY%\imageformats\
|
||||
- copy C:\msys64\mingw32\share\qt5\plugins\imageformats\qwbmp.dll %RS_DEPLOY%\imageformats\
|
||||
- copy C:\msys64\mingw32\share\qt5\plugins\imageformats\qicns.dll %RS_DEPLOY%\imageformats\
|
||||
- copy C:\msys64\mingw32\share\qt5\plugins\imageformats\qgif.dll %RS_DEPLOY%\imageformats\
|
||||
- copy C:\msys64\mingw32\share\qt5\plugins\imageformats\qsvg.dll %RS_DEPLOY%\imageformats\
|
||||
|
||||
- mkdir %RS_DEPLOY%\platforms\
|
||||
- copy C:\msys64\mingw32\share\qt5\plugins\platforms\qwindows.dll %RS_DEPLOY%\platforms\
|
||||
|
||||
- mkdir %RS_DEPLOY%\audio\
|
||||
- copy C:\msys64\mingw32\share\qt5\plugins\audio\qtaudio_windows.dll %RS_DEPLOY%\audio\
|
||||
|
||||
- windeployqt %RS_DEPLOY%\retroshare.exe
|
||||
|
||||
- copy C:\msys64\mingw32\bin\libbz2*.dll %RS_DEPLOY%\
|
||||
- copy C:\msys64\mingw32\bin\libeay32.dll %RS_DEPLOY%\
|
||||
- copy C:\msys64\mingw32\bin\libminiupnpc.dll %RS_DEPLOY%\
|
||||
- copy C:\msys64\mingw32\bin\libsqlcipher*.dll %RS_DEPLOY%\
|
||||
- copy C:\msys64\mingw32\bin\libsqlite3*.dll %RS_DEPLOY%\
|
||||
- copy C:\msys64\mingw32\bin\ssleay32.dll %RS_DEPLOY%\
|
||||
- copy C:\msys64\mingw32\bin\zlib*.dll %RS_DEPLOY%\
|
||||
- copy C:\msys64\mingw32\bin\libgcc_s_dw2*.dll %RS_DEPLOY%\
|
||||
- copy C:\msys64\mingw32\bin\libstdc*.dll %RS_DEPLOY%\
|
||||
- copy C:\msys64\mingw32\bin\libwinpthread*.dll %RS_DEPLOY%\
|
||||
- copy C:\msys64\mingw32\bin\libicu*.dll %RS_DEPLOY%\
|
||||
- copy C:\msys64\mingw32\bin\libpcre*.dll %RS_DEPLOY%\
|
||||
- copy C:\msys64\mingw32\bin\libharfbuzz*.dll %RS_DEPLOY%\
|
||||
- copy C:\msys64\mingw32\bin\libpng*.dll %RS_DEPLOY%\
|
||||
- copy C:\msys64\mingw32\bin\libfreetype*.dll %RS_DEPLOY%\
|
||||
- copy C:\msys64\mingw32\bin\libglib*.dll %RS_DEPLOY%\
|
||||
- copy C:\msys64\mingw32\bin\libgraphite2.dll %RS_DEPLOY%\
|
||||
- copy C:\msys64\mingw32\bin\libintl*.dll %RS_DEPLOY%\
|
||||
- copy C:\msys64\mingw32\bin\libiconv*.dll %RS_DEPLOY%\
|
||||
- copy C:\msys64\mingw32\bin\libjasper*.dll %RS_DEPLOY%\
|
||||
- copy C:\msys64\mingw32\bin\libjpeg*.dll %RS_DEPLOY%\
|
||||
- copy C:\msys64\mingw32\bin\libtiff*.dll %RS_DEPLOY%\
|
||||
- copy C:\msys64\mingw32\bin\libwebp*.dll %RS_DEPLOY%\
|
||||
- copy C:\msys64\mingw32\bin\libwebpdemux*.dll %RS_DEPLOY%\
|
||||
- copy C:\msys64\mingw32\bin\liblzma*.dll %RS_DEPLOY%\
|
||||
|
||||
## Needed for libresapi http
|
||||
- copy C:\msys64\mingw32\bin\libmicrohttpd*.dll %RS_DEPLOY%\
|
||||
- copy C:\msys64\mingw32\bin\libgnutls*.dll %RS_DEPLOY%\
|
||||
- copy C:\msys64\mingw32\bin\libgmp*.dll %RS_DEPLOY%\
|
||||
- copy C:\msys64\mingw32\bin\libhogweed*.dll %RS_DEPLOY%\
|
||||
- copy C:\msys64\mingw32\bin\libidn2*.dll %RS_DEPLOY%\
|
||||
- copy C:\msys64\mingw32\bin\libnettle*.dll %RS_DEPLOY%\
|
||||
- copy C:\msys64\mingw32\bin\libp11-kit*.dll %RS_DEPLOY%\
|
||||
- copy C:\msys64\mingw32\bin\libtasn1*.dll %RS_DEPLOY%\
|
||||
- copy C:\msys64\mingw32\bin\libunistring*.dll %RS_DEPLOY%\
|
||||
- copy C:\msys64\mingw32\bin\libffi*.dll %RS_DEPLOY%\
|
||||
|
||||
- find C:\projects\RetroShare >> filelist.txt
|
||||
|
||||
# to disable automatic builds
|
||||
#build: off
|
||||
@ -162,7 +240,10 @@ build_script:
|
||||
# artifacts configuration #
|
||||
#---------------------------------#
|
||||
|
||||
#artifacts:
|
||||
artifacts:
|
||||
- path: $(RS_DEPLOY)
|
||||
- path: '**\*.exe'
|
||||
- path: filelist.txt
|
||||
#
|
||||
# # pushing a single file
|
||||
# - path: test.zip
|
||||
|
@ -1,5 +1,141 @@
|
||||
retroshare (ZZZZZZ-1.XXXXXX~YYYYYY) YYYYYY; urgency=low
|
||||
|
||||
f663600 csoler Fri, 1 Jun 2018 22:27:59 +0200 fixed makeSourcePackage.sh
|
||||
9b16e33 csoler Fri, 11 May 2018 20:53:29 +0200 removed conflicts to retroshare06 in debian control file
|
||||
57dde55 csoler Sat, 26 May 2018 11:23:33 +0200 Merge pull request #1269 from PhenomRetroShare/Add_NeverAskMeForExternalLinkActivated
|
||||
33fe823 csoler Sat, 26 May 2018 11:22:47 +0200 Merge pull request #1271 from sehraf/pr_compile-fix-unused-services
|
||||
65beb2c csoler Sat, 26 May 2018 11:09:41 +0200 Merge pull request #1275 from sehraf/pr_fix-IDdialog-chat-link
|
||||
d8b3fc0 csoler Sat, 26 May 2018 11:08:46 +0200 Merge pull request #1274 from PhenomRetroShare/Fix_AppVeyorCompil
|
||||
f53e5e8 sehraf Fri, 25 May 2018 23:59:02 +0200 Fix displayed chat link name in id dialog before (decimal): Message in chat room 5327517029776505601 after (proper id): Message in chat room LFD6E08C33A98C658
|
||||
428b331 sehraf Fri, 25 May 2018 23:12:35 +0200 fix for Qt 5.11
|
||||
7c77e93 Phenom Fri, 25 May 2018 17:32:36 +0200 Fix AppVeyor Compilation
|
||||
de65cb6 csoler Tue, 22 May 2018 23:59:26 +0200 Merge pull request #1272 from G10h4ck/net_little_fixes
|
||||
1ad1fdc Gioacc Tue, 22 May 2018 19:17:37 +0200 p3NetMgrIMPL::checkNetAddress() notify if port change
|
||||
0bf02e2 Gioacc Tue, 22 May 2018 19:14:25 +0200 pqissludp::Initiate_Connection() check remote_addr to be IPv4 before use
|
||||
0c19a56 sehraf Mon, 21 May 2018 14:55:10 +0200 compile fix gxsphoto
|
||||
92b21d7 sehraf Mon, 21 May 2018 14:26:46 +0200 compile fix wikipoos
|
||||
8f107cc Phenom Sat, 19 May 2018 16:37:29 +0200 Add Never Ask Me For External Link Activated
|
||||
186617f Gioacc Thu, 17 May 2018 16:43:14 +0200 Fix missing include
|
||||
28981b6 csoler Wed, 16 May 2018 13:37:02 +0200 Merge pull request #1251 from PhenomRetroShare/Fix_Cppcheck(duplInheritedMember)InRsItem
|
||||
d11f88c csoler Wed, 16 May 2018 13:33:25 +0200 Merge pull request #1252 from PhenomRetroShare/Fix_Cppcheck(duplInheritedMember)InbdNode
|
||||
2145911 csoler Wed, 16 May 2018 13:30:56 +0200 Merge pull request #1262 from PhenomRetroShare/Fix_PartialDirCheck
|
||||
e232000 csoler Wed, 16 May 2018 13:28:23 +0200 Merge pull request #1266 from csoler/v0.6-FT
|
||||
3f88e3e csoler Wed, 16 May 2018 13:24:52 +0200 added check to avoid hashing files that are currently being modified
|
||||
8451550 csoler Wed, 16 May 2018 11:40:39 +0200 added missing licence to file_tree.h
|
||||
291c86e csoler Wed, 16 May 2018 11:17:22 +0200 Merge pull request #1265 from csoler/v0.6-GxsFix
|
||||
4661329 csoler Wed, 16 May 2018 11:15:18 +0200 fixed bug causing new forums and identities to not show up immediately
|
||||
9f37b63 G10h4c Wed, 16 May 2018 10:49:28 +0200 Merge pull request #1264 from G10h4ck/channel_json_api_v2
|
||||
181d99e Gioacc Wed, 16 May 2018 10:38:47 +0200 Give proper error message if Qt version is too old
|
||||
f12cd57 Phenom Sat, 12 May 2018 14:31:17 +0200 Fix Partial Dir Check
|
||||
57cff61 csoler Fri, 11 May 2018 20:28:53 +0200 fixed merge
|
||||
ecbd115 csoler Fri, 11 May 2018 20:24:24 +0200 added missing include path for libretroshare/src in libresapi
|
||||
fe5ea9e csoler Fri, 11 May 2018 17:37:15 +0200 additional fixes to debian packaging files
|
||||
2173aab csoler Fri, 11 May 2018 17:02:58 +0200 fixed rules file again
|
||||
84a02cb csoler Fri, 11 May 2018 16:39:49 +0200 added missing targets in rules file
|
||||
4b6304e csoler Fri, 11 May 2018 16:33:19 +0200 few fixes according to lintian complaints
|
||||
c2492fe csoler Thu, 10 May 2018 23:10:16 +0200 fixed a few lintian errors in debian/control
|
||||
9f5409b csoler Thu, 10 May 2018 22:04:11 +0200 fixed email to match mentors login
|
||||
45fdbb4 csoler Thu, 10 May 2018 22:03:39 +0200 fixed email to match mentors login
|
||||
b4ada80 csoler Wed, 9 May 2018 13:54:40 +0200 removed > 3.4.1 in debian/control, because pbuilder would not build
|
||||
e81c82e csoler Wed, 9 May 2018 13:37:25 +0200 added notes file for debian release
|
||||
4d287d6 csoler Wed, 9 May 2018 13:27:16 +0200 fixed weird mistake in grouter which causes an issue only in gcc > 8
|
||||
889c277 csoler Wed, 9 May 2018 10:15:32 +0200 fixed packaging script for debian release
|
||||
f406d9a csoler Wed, 9 May 2018 10:15:02 +0200 updated debian/control to be the control file for stretch. Updated copyright notice
|
||||
186ff0f csoler Wed, 9 May 2018 10:12:34 +0200 created proper debian changelog using dch and updated project url
|
||||
6d67936 csoler Tue, 8 May 2018 15:34:44 +0200 Merge pull request #1253 from PhenomRetroShare/Add_LastPostColInGroupTreeWidget
|
||||
2ebacf3 Phenom Tue, 8 May 2018 12:08:08 +0200 Add Last Post Column in GroupTreeWidget.
|
||||
4d748bd Phenom Mon, 7 May 2018 18:05:07 +0200 Fix CppCheck duplInheritedMember warning in bdNode
|
||||
f39fd06 Phenom Mon, 7 May 2018 17:29:11 +0200 Fix CppCheck duplInheritedMember warning in RsItem
|
||||
1352631 thunde Mon, 7 May 2018 06:42:52 +0200 Updated Windows build environment
|
||||
38ac234 thunde Mon, 7 May 2018 07:30:29 +0200 Fixed Windows compile with pre-compiled libraries Added new variable EXTERNAL_LIB_DIR to specify path of external libraries
|
||||
d9a75a9 thunde Sun, 29 Apr 2018 20:40:05 +0200 Added RapidJSON to Windows build environment
|
||||
5b607ad csoler Sun, 6 May 2018 23:53:45 +0200 Merge pull request #1245 from PhenomRetroShare/AddContextMenuForGxsIdInTextChatBrowser
|
||||
a6821f4 csoler Sun, 6 May 2018 23:02:18 +0200 Merge pull request #1249 from sehraf/pr_libsecret
|
||||
c20436e csoler Sun, 6 May 2018 22:59:20 +0200 Merge pull request #1250 from PhenomRetroShare/Fix_CppCheckerWarningInFtController
|
||||
d8dc2a8 csoler Sun, 6 May 2018 22:57:57 +0200 Merge pull request #1246 from PhenomRetroShare/Add_GxsIdInRestoredChatMsg
|
||||
dca33da Phenom Sun, 6 May 2018 18:53:29 +0200 Fix CppCheck in ftcontroller.cc
|
||||
c89e36a sehraf Fri, 4 May 2018 20:52:31 +0200 add auto selection of libsecret with fallback to libgnome-keyring
|
||||
1129bcb sehraf Fri, 4 May 2018 20:47:41 +0200 Add support for libsecret
|
||||
10badf5 sehraf Fri, 4 May 2018 20:43:40 +0200 fix retroshare-nogui.pro autologin
|
||||
676c070 csoler Thu, 3 May 2018 15:55:21 +0200 extended the rapid_json trick to plugins
|
||||
5f12b60 csoler Thu, 3 May 2018 15:22:39 +0200 added -lgnome-keyring to unix LIBS when rs_autologin is set
|
||||
bfe8e40 csoler Thu, 3 May 2018 15:22:03 +0200 updated ubuntu changelog
|
||||
98f0052 Phenom Thu, 3 May 2018 15:04:22 +0200 Add GxsId in Restored Chat Message.
|
||||
ecba4c2 Phenom Wed, 2 May 2018 20:31:52 +0200 Add Context Menu for GxsId in lobby textBrowser.
|
||||
91ed367 csoler Thu, 3 May 2018 13:45:44 +0200 added packaging for ubuntu bionic
|
||||
56e8134 cyril soler Thu, 3 May 2018 11:32:24 +0200 removed sqlite3 lib from ld when using sqlcipher.
|
||||
1366f61 csoler Wed, 2 May 2018 23:51:46 +0200 Merge pull request #1241 from RetroPooh/chatimgattprev1
|
||||
8e111c2 csoler Wed, 2 May 2018 22:46:27 +0200 added rapidjson-1.1.0 code hard-coded in the source directory to allow everyone to compile without the need to tweak too much. When v1.1.0 is mainstream (espcially on ubuntu) we can revert back to an external dependency
|
||||
48c4b4c G10h4c Sat, 28 Apr 2018 09:34:14 +0200 Merge pull request #1242 from beardog108/master
|
||||
ccede9d G10h4c Sat, 28 Apr 2018 09:33:14 +0200 Merge pull request #1243 from sehraf/pr_fix-make-install
|
||||
10daf3b sehraf Sat, 28 Apr 2018 09:06:10 +0200 Fix 'make install'
|
||||
82a00c2 KevinF Fri, 27 Apr 2018 15:34:43 -0500 added rapidjson to package installation command on Debian/OpenSUSE/Arch
|
||||
be75e89 Gioacc Fri, 27 Apr 2018 20:55:38 +0200 Fix compialtion after merge
|
||||
f3ae61b Gioacc Fri, 27 Apr 2018 18:17:09 +0200 Merge branch 'json_experiments'
|
||||
|
||||
-- Retroshare Dev Team <contact@retroshare.net> Thu, 03 May 2018 12:00:00 +0100
|
||||
|
||||
retroshare (0.6.4-1.20180503.676c0701~xenial) xenial; urgency=low
|
||||
|
||||
2dc69cb RetroP Fri, 27 Apr 2018 16:50:00 +0300 embed preview for images on file attach in chat
|
||||
c199199 Gioacc Sun, 8 Apr 2018 12:37:41 +0200 pqissl silence extra debug message
|
||||
8245d74 csoler Sat, 7 Apr 2018 14:33:58 +0200 Merge pull request #1230 from csoler/master
|
||||
2782494 csoler Sat, 7 Apr 2018 14:29:23 +0200 removed debug info
|
||||
e2b0e27 csoler Sat, 7 Apr 2018 00:56:07 +0200 fixed costly polling in RsGenExchange
|
||||
cc091cc Gioacc Sat, 7 Apr 2018 12:48:01 +0200 Fixed hidden nodes listening failure
|
||||
73c6dee csoler Tue, 27 Mar 2018 20:54:31 +0200 Merge pull request #1191 from G10h4ck/IPv6-v3
|
||||
4be73b7 csoler Sat, 24 Mar 2018 10:18:37 +0100 Merge pull request #1216 from beardog108/security
|
||||
599c3d4 Kevin Fri, 23 Mar 2018 23:00:27 -0500 fixed clickjacking attack with x-frame-options
|
||||
24d1f5d csoler Sat, 17 Mar 2018 18:40:32 +0100 Merge pull request #1190 from PhenomRetroShare/Add_ShowEmptySubMenuRemoteTree
|
||||
09de680 csoler Sat, 17 Mar 2018 18:30:21 +0100 Merge pull request #1210 from PhenomRetroShare/Add_BackgroundInProgressBarText
|
||||
1432104 csoler Sat, 17 Mar 2018 18:25:47 +0100 Merge pull request #1214 from csoler/v0.6-FT
|
||||
e1482dd Phenom Sat, 17 Mar 2018 00:00:05 +0100 Add Rounded and Gradient Background to xprogressbar text.
|
||||
7da73b3 Phenom Mon, 5 Mar 2018 20:31:39 +0100 Add differents views depends ProgressBar width
|
||||
311b190 Phenom Sun, 4 Mar 2018 20:06:33 +0100 Add Background to xprogressbar text for more readability.
|
||||
e1ad21c csoler Thu, 15 Mar 2018 13:11:19 +0100 fixed wrong file count in RsCollectionDialog when downloading files
|
||||
b3653d1 csoler Thu, 15 Mar 2018 11:32:55 +0100 enabled aggressive re-request of pending slices at end of transfer, thus fixing the long delay to finish files with mixed fast/slow sources
|
||||
6e8305a csoler Wed, 14 Mar 2018 20:56:30 +0100 Merge pull request #1211 from PhenomRetroShare/Fix_AvatarStatusOverlay
|
||||
c7549a2 csoler Wed, 14 Mar 2018 20:49:42 +0100 Merge pull request #1208 from PhenomRetroShare/Fix_ChangeChatTextColorWhenChangeStyle
|
||||
11cfa7b csoler Wed, 14 Mar 2018 20:34:52 +0100 Merge pull request #1209 from PhenomRetroShare/Add_DescriptionGxsGroupToolTip
|
||||
3fc6314 csoler Wed, 14 Mar 2018 20:33:34 +0100 Merge pull request #1206 from PhenomRetroShare/Fix_AboutIcon
|
||||
0e6d27a csoler Tue, 13 Mar 2018 20:25:38 +0100 fixed bug in FT causing transfer lines to only update when the mouse moves over the widget
|
||||
91634ba thunde Thu, 8 Mar 2018 17:45:24 +0100 Added build of Retrotor to Windows build environment
|
||||
e9b49e1 Gioacc Mon, 12 Mar 2018 17:06:01 +0100 Update Android quirks documentation
|
||||
ce56a20 Gioacc Mon, 12 Mar 2018 16:22:42 +0100 Added sources verification in android toolchain
|
||||
e7078b5 Gioacc Mon, 12 Mar 2018 14:27:59 +0100 Update Android documentation
|
||||
514b31e Gioacc Sun, 11 Mar 2018 20:46:07 +0100 Add Qt installation in android preparation script
|
||||
6f30aa2 Gioacc Sun, 11 Mar 2018 20:45:40 +0100 Merge branch 'master' of git://github.com/RetroShare/RetroShare
|
||||
13b18e3 csoler Sat, 10 Mar 2018 16:05:52 +0100 added missing decoration icon on transfer sources
|
||||
4dd2776 Gioacc Sat, 10 Mar 2018 13:15:53 +0100 Remove android JNI .class from source
|
||||
2b300eb Gioacc Sat, 10 Mar 2018 00:44:24 +0100 Update version in Android Manifest
|
||||
f5a3b26 Gioacc Fri, 9 Mar 2018 20:26:29 +0100 More omogeneous variable naming in android build tools
|
||||
c92b860 thunde Sun, 4 Mar 2018 20:08:15 +0100 Windows build environment: - Updated external libraries - Added compile of plugins to build.bat - Added copy of Qt style DLL to pack.bat and Windows Installer - Removed "CONFIG=console" for release build
|
||||
8b42873 Phenom Sun, 4 Mar 2018 22:45:11 +0100 Fix Friend Avatar status overlay no depends size scale.
|
||||
6877589 Phenom Sun, 4 Mar 2018 18:19:18 +0100 Add description in GroupTreeWidget tooltip.
|
||||
51cc94b Phenom Sun, 4 Mar 2018 17:31:40 +0100 Fix ChatWidget current text edit color when changing appearance style.
|
||||
4e6f2ae Phenom Sun, 4 Mar 2018 14:31:16 +0100 Fix Icon for About page.
|
||||
a89ab8f Phenom Sat, 24 Feb 2018 14:07:32 +0100 Add ShowEmpty sub menu in Tree Remote SharedFilesDialog.
|
||||
|
||||
-- Retroshare Dev Team <contact@retroshare.net> Thu, 03 May 2018 12:00:00 +0100
|
||||
|
||||
retroshare (0.6.4-1.20180313.0e6d27ad~xenial) xenial; urgency=low
|
||||
|
||||
919417a csoler Sat, 3 Mar 2018 19:04:54 +0100 make sure tor executable from config path can be reached
|
||||
b587ac8 csoler Sat, 3 Mar 2018 16:06:49 +0100 Merge pull request #1192 from PhenomRetroShare/Add_WarningMaxFlatViewFile
|
||||
9bcff07 csoler Sat, 3 Mar 2018 15:58:11 +0100 Merge pull request #1203 from PhenomRetroShare/Fix_SharedFileDialogShowColumn
|
||||
ead2aea csoler Sat, 3 Mar 2018 15:56:51 +0100 Merge pull request #1204 from csoler/v0.6-FT
|
||||
dcb3f79 csoler Sat, 3 Mar 2018 15:55:52 +0100 removed some debug info in RSLink
|
||||
1a1dc64 csoler Sat, 3 Mar 2018 15:49:45 +0100 fixed transfers list bug causing ghost entries to appear
|
||||
58d418d Phenom Sat, 3 Mar 2018 12:08:21 +0100 Fix SharedFilesDialog show old hidden column.
|
||||
ab45a97 Phenom Sat, 3 Mar 2018 12:05:13 +0100 Revert "Fix SharedFilesDialog show old hidden column."
|
||||
57f87a6 csoler Fri, 2 Mar 2018 22:58:50 +0100 Merge pull request #1201 from csoler/v0.6-SecurityFixes
|
||||
9386bb9 csoler Fri, 2 Mar 2018 22:57:14 +0100 tried to fix FT list bug.
|
||||
952ff03 csoler Fri, 2 Mar 2018 21:28:09 +0100 Merge pull request #1200 from csoler/v0.6-SecurityFixes
|
||||
e88eebf csoler Fri, 2 Mar 2018 21:26:38 +0100 attempt to fix wrong number of rows in DL list
|
||||
f2a737e csoler Fri, 2 Mar 2018 18:13:09 +0100 fixed font size compilation error
|
||||
ca402c2 csoler Fri, 2 Mar 2018 18:05:11 +0100 fixed column sizing in FT dialog
|
||||
efa5827 csoler Fri, 2 Mar 2018 18:01:56 +0100 fixed missing peer availability maps in FT dialog
|
||||
e5edea3 csoler Thu, 1 Mar 2018 14:10:30 +0100 removed precise and zesty which are obsolete
|
||||
3d7be85 csoler Thu, 1 Mar 2018 11:46:47 +0100 Merge pull request #1199 from csoler/v0.6-SecurityFixes
|
||||
026951f csoler Thu, 1 Mar 2018 11:45:54 +0100 added consistency check in getGroupMeta so that ADMIN/PUBLISH flags always correspond to what the key set reflects
|
||||
028a246 csoler Thu, 1 Mar 2018 09:44:59 +0100 Merge pull request #1197 from csoler/v0.6-SecurityFixes
|
||||
|
46
build_scripts/Debian+Ubuntu/control.bionic
Normal file
46
build_scripts/Debian+Ubuntu/control.bionic
Normal file
@ -0,0 +1,46 @@
|
||||
Source: retroshare
|
||||
Section: devel
|
||||
Priority: standard
|
||||
Maintainer: Cyril Soler <csoler@users.sourceforge.net>
|
||||
Build-Depends: debhelper (>= 7), libglib2.0-dev, libupnp-dev, libssl-dev, libxss-dev, libgnome-keyring-dev, libbz2-dev, libspeex-dev, libspeexdsp-dev, libxslt1-dev, cmake, libcurl4-openssl-dev, libopencv-dev, tcl8.6, libsqlcipher-dev, libmicrohttpd-dev, libavcodec-dev, qtmultimedia5-dev, qttools5-dev, libqt5x11extras5-dev, qt5-default
|
||||
Standards-Version: 3.9.6
|
||||
Homepage: http://retroshare.sourceforge.net
|
||||
|
||||
Package: retroshare-voip-plugin
|
||||
Architecture: any
|
||||
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: retroshare-feedreader-plugin
|
||||
Architecture: any
|
||||
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: retroshare-nogui
|
||||
Architecture: any
|
||||
Depends: ${shlibs:Depends}, ${misc:Depends}, gnome-keyring
|
||||
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: retroshare
|
||||
Architecture: any
|
||||
Depends: ${shlibs:Depends}, ${misc:Depends}, gnome-keyring
|
||||
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
|
||||
friends and family, using a web-of-trust to authenticate peers and OpenSSL to
|
||||
encrypt all communication. RetroShare provides filesharing, chat, messages,
|
||||
forums and channels.
|
||||
|
||||
|
5
build_scripts/Debian+Ubuntu/debian/changelog
Normal file
5
build_scripts/Debian+Ubuntu/debian/changelog
Normal file
@ -0,0 +1,5 @@
|
||||
retroshare (0.6.4) UNRELEASED; urgency=medium
|
||||
|
||||
* Initial release for Debian. (Closes: #659069)
|
||||
|
||||
-- Cyril Soler <csoler@users.sourceforge.net> Wed, 09 May 2018 10:11:31 +0200
|
@ -1 +1 @@
|
||||
7
|
||||
10
|
||||
|
@ -2,45 +2,40 @@ Source: retroshare
|
||||
Section: devel
|
||||
Priority: standard
|
||||
Maintainer: Cyril Soler <csoler@users.sourceforge.net>
|
||||
Build-Depends: debhelper (>= 7), libglib2.0-dev, libupnp-dev, qt4-dev-tools, libqt4-dev, libssl-dev, libxss-dev, libgnome-keyring-dev, libbz2-dev, libqt4-opengl-dev, libqtmultimediakit1, qtmobility-dev, libspeex-dev, libspeexdsp-dev, libxslt1-dev, cmake, libcurl4-openssl-dev, libopencv-dev, tcl8.5, libsqlcipher-dev, libmicrohttpd-dev, libavcodec-dev
|
||||
Standards-Version: 3.9.3
|
||||
Build-Depends: debhelper (>= 9), libglib2.0-dev, libupnp-dev, libssl-dev, libxss-dev, libgnome-keyring-dev, libbz2-dev, libspeex-dev, libspeexdsp-dev, libxslt1-dev, cmake, libcurl4-openssl-dev, libopencv-dev, tcl8.6, libsqlcipher-dev, libmicrohttpd-dev, libavcodec-dev, qtmultimedia5-dev, qttools5-dev, libqt5x11extras5-dev, qtbase5-dev, qt5-qmake, qtbase5-dev-tools
|
||||
Standards-Version: 4.1.4
|
||||
Homepage: http://retroshare.sourceforge.net
|
||||
|
||||
Package: retroshare-voip-plugin
|
||||
Architecture: any
|
||||
Conflicts: retroshare06-voip-plugin
|
||||
Depends: ${shlibs:Depends}, ${misc:Depends}, retroshare, libspeex1, libspeexdsp1, libqtmultimediakit1
|
||||
Conflicts:
|
||||
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
|
||||
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: retroshare-feedreader-plugin
|
||||
Architecture: any
|
||||
Conflicts: retroshare06-feedreader-plugin
|
||||
Conflicts:
|
||||
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.
|
||||
Plugin for Retroshare, adding a RSS feed reader tab to retroshare.
|
||||
|
||||
Package: retroshare-nogui
|
||||
Architecture: any
|
||||
Depends: ${shlibs:Depends}, ${misc:Depends}, gnome-keyring
|
||||
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.
|
||||
Conflicts: retroshare
|
||||
Description: headless version of Retroshare
|
||||
Headless version of the Retroshare platform.
|
||||
|
||||
Package: retroshare
|
||||
Architecture: any
|
||||
Depends: ${shlibs:Depends}, ${misc:Depends}, gnome-keyring
|
||||
Conflicts: retroshare-nogui,retroshare06
|
||||
Conflicts: retroshare-nogui
|
||||
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
|
||||
friends and family, using a web-of-trust to authenticate peers and OpenSSL to
|
||||
encrypt all communication. RetroShare provides filesharing, chat, messages,
|
||||
forums and channels.
|
||||
RetroShare is a Open Source, private and secure decentralised
|
||||
commmunication platform. It creates mesh of computers linked with TLS connections,
|
||||
on top of which it provides file transfer, asynchronous email, forums, channels and chat.
|
||||
|
||||
|
||||
|
@ -7,11 +7,12 @@ configure-stamp:
|
||||
touch $@
|
||||
|
||||
|
||||
build: build-stamp
|
||||
build: build-arch build-indep
|
||||
|
||||
build-stamp: configure-stamp
|
||||
dh_testdir
|
||||
# Add here commands to compile the package.
|
||||
# cd libssh-0.6.4 && mkdir -p build && cd build && cmake -DWITH_STATIC_LIB=ON .. && make
|
||||
# cd libssh-0.6.4 && mkdir -p build && cd build && cmake -DWITH_STATIC_LIB=ON .. && make
|
||||
# cd sqlcipher && ./configure --disable-shared --enable-static --enable-tempstore=yes CFLAGS="-DSQLITE_HAS_CODEC" LDFLAGS="-lcrypto" && make
|
||||
# mkdir lib
|
||||
# cp -r libssh-0.6.4 lib/
|
||||
@ -20,18 +21,24 @@ build-stamp: configure-stamp
|
||||
cd src && $(MAKE)
|
||||
touch $@
|
||||
|
||||
build-indep: build-stamp
|
||||
|
||||
build-arch: build-stamp
|
||||
|
||||
clean:
|
||||
dh_testdir
|
||||
dh_testroot
|
||||
rm -f configure-stamp build-stamp
|
||||
# Add here commands to clean up after the build process.
|
||||
[ ! -f src/Makefile ] || (cd src && $(MAKE) distclean)
|
||||
dh_prep
|
||||
dh_clean
|
||||
|
||||
install: build
|
||||
dh_testdir
|
||||
dh_testroot
|
||||
dh_clean -k
|
||||
dh_prep
|
||||
dh_clean
|
||||
#dh_installdirs
|
||||
cd src && $(MAKE) INSTALL_ROOT=$(CURDIR)/debian/tmp install
|
||||
|
||||
|
1
build_scripts/Debian+Ubuntu/debian/source/format
Normal file
1
build_scripts/Debian+Ubuntu/debian/source/format
Normal file
@ -0,0 +1 @@
|
||||
1.0
|
32
build_scripts/Debian+Ubuntu/debian_release_howto.txt
Normal file
32
build_scripts/Debian+Ubuntu/debian_release_howto.txt
Normal file
@ -0,0 +1,32 @@
|
||||
Creation of a new Debian changelog:
|
||||
|
||||
dch --create --package retroshare --newversion 0.6.4-1
|
||||
|
||||
Note: dch reads email in $DEBMAIL or $USER@$HOSTNAME, so it should be made correct in debian/changlog
|
||||
If the email does not match the email in mentors, the package will be rejected.
|
||||
|
||||
dget command to retrieve source package:
|
||||
|
||||
dget -u https://launchpad.net/~retroshare/+archive/ubuntu/stable/+files/retroshare_0.6.4-1.20180313.0e6d27ad~xenial.dsc
|
||||
|
||||
(-u means don't check PGP signature)
|
||||
|
||||
When ready:
|
||||
* updload the package in a place that can be used to dget the package on mentors.debian.net.
|
||||
|
||||
dput mentors retroshare_0.6.4-1_source.changes
|
||||
|
||||
Checkign with lintian:
|
||||
lintian --pedantic --profile debian retroshare_0.6.4-1_source.changes
|
||||
|
||||
Todo
|
||||
* make a sid binary package.
|
||||
* test in sid using pbuilder chroot system (pbuilder login)
|
||||
* upload to mentors
|
||||
* request for sponsorship
|
||||
|
||||
Getting help:
|
||||
https://webchat.oftc.net/
|
||||
|
||||
Bug creation/report
|
||||
reportbug -B debian
|
@ -3,8 +3,8 @@
|
||||
###################### PARAMETERS ####################
|
||||
gitpath="https://github.com/RetroShare/RetroShare.git"
|
||||
branch="master"
|
||||
#branch="v0.6.3-official_release"
|
||||
#bubba3="Y" # comment out to compile for bubba3
|
||||
#branch="v0.6.4-official_release"
|
||||
#bubba3="Y" # comment out to compile for bubba3
|
||||
######################################################
|
||||
|
||||
RS_MAJOR_VERSION=`fgrep RS_MAJOR_VERSION ../../libretroshare/src/retroshare/rsversion.h | cut -d\\ -f3- | sed -e s\/\ \/\/g | cut -c1`
|
||||
@ -33,7 +33,7 @@ gpgkey="0932399B"
|
||||
|
||||
date=`git log --pretty=format:"%ai" | head -1 | cut -d\ -f1 | sed -e s/-//g`
|
||||
time=`git log --pretty=format:"%aD" | head -1 | cut -d\ -f5 | sed -e s/://g`
|
||||
hhsh=`git log --pretty=format:"%H" | head -1 | cut -c1-8`
|
||||
hhsh=`git log --pretty=format:"%H" | head -1 | cut -c1-8`
|
||||
|
||||
rev=${date}.${hhsh}
|
||||
useretrotor="false"
|
||||
@ -45,7 +45,7 @@ while [ ${#} -gt 0 ]; do
|
||||
shift
|
||||
;;
|
||||
"-retrotor") shift
|
||||
useretrotor="true"
|
||||
useretrotor="true"
|
||||
;;
|
||||
"-distribution") shift
|
||||
dist=${1}
|
||||
@ -68,16 +68,16 @@ while [ ${#} -gt 0 ]; do
|
||||
done
|
||||
|
||||
if test "${useretrotor}" = "true"; then
|
||||
if ! test "${dist}" = "trusty"; then
|
||||
echo ERROR: retro-tor can only be packaged for trusty for now.
|
||||
exit 1;
|
||||
fi
|
||||
#gitpath="https://github.com/csoler/RetroShare.git"
|
||||
#branch="v0.6-TorOnly"
|
||||
if ! test "${dist}" = "trusty"; then
|
||||
echo ERROR: retro-tor can only be packaged for trusty for now.
|
||||
exit 1;
|
||||
fi
|
||||
#gitpath="https://github.com/csoler/RetroShare.git"
|
||||
#branch="v0.6-TorOnly"
|
||||
fi
|
||||
|
||||
if test "${dist}" = "" ; then
|
||||
dist="trusty xenial artful"
|
||||
dist="trusty xenial artful bionic"
|
||||
fi
|
||||
|
||||
echo Attempting to get revision number...
|
||||
@ -96,7 +96,7 @@ echo " Using distributions:"${dist}
|
||||
echo " Using PGP key id :"${gpgkey}
|
||||
|
||||
if test ${useretrotor} = "true"; then
|
||||
echo " "Specific flags : retrotor
|
||||
echo " "Specific flags : retrotor
|
||||
fi
|
||||
|
||||
echo Done.
|
||||
@ -115,15 +115,15 @@ cd ${workdir}/src
|
||||
git clone --depth 1 ${gitpath} --single-branch --branch $branch .
|
||||
|
||||
# if ! test "$hhsh" = "" ; then
|
||||
# echo Checking out revision $hhsh
|
||||
# git checkout $hhsh
|
||||
# echo Checking out revision $hhsh
|
||||
# git checkout $hhsh
|
||||
# fi
|
||||
|
||||
cd -
|
||||
|
||||
if ! test -d ${workdir}/src/libretroshare/; then
|
||||
echo Git clone failed.
|
||||
exit
|
||||
echo Git clone failed.
|
||||
exit
|
||||
fi
|
||||
|
||||
cp -r debian ${workdir}/debian
|
||||
@ -131,6 +131,12 @@ cp -r debian ${workdir}/debian
|
||||
# VOIP tweak
|
||||
cp ${workdir}/src/retroshare-gui/src/gui/chat/PopupChatDialog.ui ${workdir}/src/plugins/VOIP/gui/PopupChatDialog.ui
|
||||
|
||||
# remove unised qml code, only needed on Android
|
||||
|
||||
rm -rf ${workdir}/src/retroshare-qml-app/
|
||||
rm -rf ${workdir}/src/build_scripts/
|
||||
rm ${workdir}/debian/*~
|
||||
|
||||
# Cloning sqlcipher
|
||||
# git clone https://github.com/sqlcipher/sqlcipher.git
|
||||
|
||||
@ -147,21 +153,26 @@ echo Cleaning...
|
||||
|
||||
echo Calling debuild...
|
||||
for i in ${dist}; do
|
||||
echo copying changelog for ${i}
|
||||
sed -e s/XXXXXX/"${rev}"/g -e s/YYYYYY/"${i}"/g -e s/ZZZZZZ/"${version_number}"/g ../changelog > debian/changelog
|
||||
|
||||
if test ${useretrotor} = "true"; then
|
||||
cp ../rules.retrotor debian/rules
|
||||
cp ../control.trusty_retrotor debian/control
|
||||
elif test -f ../control."${i}" ; then
|
||||
echo \/\!\\ Using specific control file for distribution "${i}"
|
||||
cp ../control."${i}" debian/control
|
||||
if ! test "${i}" = "debian"; then
|
||||
echo copying changelog for ${i}
|
||||
sed -e s/XXXXXX/"${rev}"/g -e s/YYYYYY/"${i}"/g -e s/ZZZZZZ/"${version_number}"/g ../changelog > debian/changelog
|
||||
|
||||
if test ${useretrotor} = "true"; then
|
||||
cp ../rules.retrotor debian/rules
|
||||
cp ../control.trusty_retrotor debian/control
|
||||
elif test -f ../control."${i}" ; then
|
||||
echo \/\!\\ Using specific control file for distribution "${i}"
|
||||
cp ../control."${i}" debian/control
|
||||
else
|
||||
echo Using standard control file control."${i}" for distribution "${i}"
|
||||
cp ../debian/control debian/control
|
||||
fi
|
||||
else
|
||||
echo Using standard control file control."${i}" for distribution "${i}"
|
||||
cp ../debian/control debian/control
|
||||
fi
|
||||
echo creating official debian release. Using built-in changelog and control files
|
||||
fi
|
||||
|
||||
debuild -S -k${gpgkey}
|
||||
debuild -S -k${gpgkey} --lintian-opts +pedantic -EviIL
|
||||
done
|
||||
cd -
|
||||
|
||||
|
@ -1,25 +1,24 @@
|
||||
ZLIB_VERSION=1.2.3
|
||||
BZIP2_VERSION=1.0.6
|
||||
MINIUPNPC_VERSION=2.0
|
||||
OPENSSL_VERSION=1.0.2k
|
||||
OPENSSL_VERSION=1.0.2n
|
||||
SPEEX_VERSION=1.2.0
|
||||
SPEEXDSP_VERSION=1.2rc3
|
||||
OPENCV_VERSION=3.2.0
|
||||
LIBXML2_VERSION=2.9.4
|
||||
LIBXSLT_VERSION=1.1.28
|
||||
CURL_VERSION=7.53.1
|
||||
OPENCV_VERSION=3.4.1
|
||||
LIBXML2_VERSION=2.9.7
|
||||
LIBXSLT_VERSION=1.1.32
|
||||
CURL_VERSION=7.58.0
|
||||
TCL_VERSION=8.6.2
|
||||
SQLCIPHER_VERSION=2.2.1
|
||||
LIBMICROHTTPD_VERSION=0.9.52
|
||||
FFMPEG_VERSION=3.2.4
|
||||
|
||||
MAKEFILE_PATH=$(dir $(MAKEFILE_LIST))
|
||||
LIBS_PATH?=$(MAKEFILE_PATH)../../../../libs
|
||||
LIBMICROHTTPD_VERSION=0.9.59
|
||||
FFMPEG_VERSION=3.4
|
||||
RAPIDJSON_VERSION=1.1.0
|
||||
|
||||
DOWNLOAD_PATH?=download
|
||||
COPY_ANSWER?=
|
||||
BUILD_PATH=build
|
||||
LIBS_PATH?=libs
|
||||
|
||||
all: dirs zlib bzip2 miniupnpc openssl speex speexdsp opencv libxml2 libxslt curl sqlcipher libmicrohttpd ffmpeg copylibs
|
||||
all: dirs zlib bzip2 miniupnpc openssl speex speexdsp opencv libxml2 libxslt curl sqlcipher libmicrohttpd ffmpeg rapidjson copylibs
|
||||
|
||||
download: \
|
||||
$(DOWNLOAD_PATH)/zlib-$(ZLIB_VERSION).tar.gz \
|
||||
@ -35,235 +34,246 @@ download: \
|
||||
$(DOWNLOAD_PATH)/tcl$(TCL_VERSION)-src.tar.gz \
|
||||
$(DOWNLOAD_PATH)/sqlcipher-$(SQLCIPHER_VERSION).tar.gz \
|
||||
$(DOWNLOAD_PATH)/libmicrohttpd-$(LIBMICROHTTPD_VERSION).tar.gz \
|
||||
$(DOWNLOAD_PATH)/ffmpeg-$(FFMPEG_VERSION).tar.gz
|
||||
$(DOWNLOAD_PATH)/ffmpeg-$(FFMPEG_VERSION).tar.gz \
|
||||
$(DOWNLOAD_PATH)/rapidjson-$(RAPIDJSON_VERSION).tar.gz
|
||||
|
||||
clean:
|
||||
rm -r -f libs
|
||||
rm -r -f $(BUILD_PATH)
|
||||
rm -r -f $(LIBS_PATH)
|
||||
|
||||
dirs:
|
||||
mkdir -p $(DOWNLOAD_PATH)
|
||||
mkdir -p libs
|
||||
gcc --version | head --lines 1 | tr ' ' '\n' | tail -1 >libs/gcc-version
|
||||
mkdir -p $(BUILD_PATH)
|
||||
gcc --version | head --lines 1 | tr ' ' '\n' | tail -1 >$(BUILD_PATH)/gcc-version
|
||||
|
||||
$(DOWNLOAD_PATH)/zlib-$(ZLIB_VERSION).tar.gz:
|
||||
wget --no-check-certificate http://sourceforge.net/projects/libpng/files/zlib/$(ZLIB_VERSION)/zlib-$(ZLIB_VERSION).tar.gz/download -O $(DOWNLOAD_PATH)/zlib-$(ZLIB_VERSION).tar.gz
|
||||
|
||||
zlib: libs/zlib-$(ZLIB_VERSION)
|
||||
zlib: $(BUILD_PATH)/zlib-$(ZLIB_VERSION)
|
||||
|
||||
libs/zlib-$(ZLIB_VERSION): $(DOWNLOAD_PATH)/zlib-$(ZLIB_VERSION).tar.gz
|
||||
$(BUILD_PATH)/zlib-$(ZLIB_VERSION): $(DOWNLOAD_PATH)/zlib-$(ZLIB_VERSION).tar.gz
|
||||
# prepare
|
||||
rm -r -f libs/zlib-*
|
||||
rm -r -f $(BUILD_PATH)/zlib-*
|
||||
tar xvf $(DOWNLOAD_PATH)/zlib-$(ZLIB_VERSION).tar.gz
|
||||
# build
|
||||
cd zlib-$(ZLIB_VERSION) && ./configure
|
||||
#cd zlib-$(ZLIB_VERSION) && make install prefix="`pwd`/../libs"
|
||||
#cd zlib-$(ZLIB_VERSION) && make install prefix="`pwd`/../$(BUILD_PATH)"
|
||||
cd zlib-$(ZLIB_VERSION) && make
|
||||
# copy files
|
||||
mkdir -p libs/zlib-$(ZLIB_VERSION).tmp/include
|
||||
cp zlib-$(ZLIB_VERSION)/zlib.h libs/zlib-$(ZLIB_VERSION).tmp/include/
|
||||
cp zlib-$(ZLIB_VERSION)/zconf.h libs/zlib-$(ZLIB_VERSION).tmp/include/
|
||||
mkdir -p libs/zlib-$(ZLIB_VERSION).tmp/lib
|
||||
cp zlib-$(ZLIB_VERSION)/libz.a libs/zlib-$(ZLIB_VERSION).tmp/lib/
|
||||
mkdir -p $(BUILD_PATH)/zlib-$(ZLIB_VERSION).tmp/include
|
||||
cp zlib-$(ZLIB_VERSION)/zlib.h $(BUILD_PATH)/zlib-$(ZLIB_VERSION).tmp/include/
|
||||
cp zlib-$(ZLIB_VERSION)/zconf.h $(BUILD_PATH)/zlib-$(ZLIB_VERSION).tmp/include/
|
||||
mkdir -p $(BUILD_PATH)/zlib-$(ZLIB_VERSION).tmp/lib
|
||||
cp zlib-$(ZLIB_VERSION)/libz.a $(BUILD_PATH)/zlib-$(ZLIB_VERSION).tmp/lib/
|
||||
# cleanup
|
||||
rm -r -f zlib-$(ZLIB_VERSION)
|
||||
mv libs/zlib-$(ZLIB_VERSION).tmp libs/zlib-$(ZLIB_VERSION)
|
||||
mv $(BUILD_PATH)/zlib-$(ZLIB_VERSION).tmp $(BUILD_PATH)/zlib-$(ZLIB_VERSION)
|
||||
|
||||
bzip2: libs/bzip2-$(BZIP2_VERSION)
|
||||
bzip2: $(BUILD_PATH)/bzip2-$(BZIP2_VERSION)
|
||||
|
||||
$(DOWNLOAD_PATH)/bzip2-$(BZIP2_VERSION).tar.gz:
|
||||
wget http://bzip.org/$(BZIP2_VERSION)/bzip2-$(BZIP2_VERSION).tar.gz -O $(DOWNLOAD_PATH)/bzip2-$(BZIP2_VERSION).tar.gz
|
||||
|
||||
libs/bzip2-$(BZIP2_VERSION): $(DOWNLOAD_PATH)/bzip2-$(BZIP2_VERSION).tar.gz
|
||||
$(BUILD_PATH)/bzip2-$(BZIP2_VERSION): $(DOWNLOAD_PATH)/bzip2-$(BZIP2_VERSION).tar.gz
|
||||
# prepare
|
||||
rm -r -f libs/bzip2-*
|
||||
rm -r -f $(BUILD_PATH)/bzip2-*
|
||||
tar xvf $(DOWNLOAD_PATH)/bzip2-$(BZIP2_VERSION).tar.gz
|
||||
# build
|
||||
#cd bzip2-$(BZIP2_VERSION) && make install PREFIX="`pwd`/../libs"
|
||||
#cd bzip2-$(BZIP2_VERSION) && make install PREFIX="`pwd`/../$(BUILD_PATH)"
|
||||
cd bzip2-$(BZIP2_VERSION) && make
|
||||
# copy files
|
||||
mkdir -p libs/bzip2-$(BZIP2_VERSION).tmp/include
|
||||
cp bzip2-$(BZIP2_VERSION)/bzlib.h libs/bzip2-$(BZIP2_VERSION).tmp/include/
|
||||
mkdir -p libs/bzip2-$(BZIP2_VERSION).tmp/lib
|
||||
cp bzip2-$(BZIP2_VERSION)/libbz2.a libs/bzip2-$(BZIP2_VERSION).tmp/lib/
|
||||
mkdir -p $(BUILD_PATH)/bzip2-$(BZIP2_VERSION).tmp/include
|
||||
cp bzip2-$(BZIP2_VERSION)/bzlib.h $(BUILD_PATH)/bzip2-$(BZIP2_VERSION).tmp/include/
|
||||
mkdir -p $(BUILD_PATH)/bzip2-$(BZIP2_VERSION).tmp/lib
|
||||
cp bzip2-$(BZIP2_VERSION)/libbz2.a $(BUILD_PATH)/bzip2-$(BZIP2_VERSION).tmp/lib/
|
||||
# cleanup
|
||||
rm -r -f bzip2-$(BZIP2_VERSION)
|
||||
mv libs/bzip2-$(BZIP2_VERSION).tmp libs/bzip2-$(BZIP2_VERSION)
|
||||
mv $(BUILD_PATH)/bzip2-$(BZIP2_VERSION).tmp $(BUILD_PATH)/bzip2-$(BZIP2_VERSION)
|
||||
|
||||
miniupnpc: libs/miniupnpc-$(MINIUPNPC_VERSION)
|
||||
miniupnpc: $(BUILD_PATH)/miniupnpc-$(MINIUPNPC_VERSION)
|
||||
|
||||
$(DOWNLOAD_PATH)/miniupnpc-$(MINIUPNPC_VERSION).tar.gz:
|
||||
wget http://miniupnp.free.fr/files/download.php?file=miniupnpc-$(MINIUPNPC_VERSION).tar.gz -O $(DOWNLOAD_PATH)/miniupnpc-$(MINIUPNPC_VERSION).tar.gz
|
||||
|
||||
libs/miniupnpc-$(MINIUPNPC_VERSION): $(DOWNLOAD_PATH)/miniupnpc-$(MINIUPNPC_VERSION).tar.gz
|
||||
$(BUILD_PATH)/miniupnpc-$(MINIUPNPC_VERSION): $(DOWNLOAD_PATH)/miniupnpc-$(MINIUPNPC_VERSION).tar.gz
|
||||
# prepare
|
||||
rm -r -f libs/miniupnpc-*
|
||||
rm -r -f $(BUILD_PATH)/miniupnpc-*
|
||||
tar xvf $(DOWNLOAD_PATH)/miniupnpc-$(MINIUPNPC_VERSION).tar.gz
|
||||
# build
|
||||
cd miniupnpc-$(MINIUPNPC_VERSION) && export CC=gcc && make -f Makefile.mingw init libminiupnpc.a miniupnpc.dll
|
||||
# copy files
|
||||
mkdir -p libs/miniupnpc-$(MINIUPNPC_VERSION).tmp/include/miniupnpc
|
||||
cp miniupnpc-$(MINIUPNPC_VERSION)/*.h libs/miniupnpc-$(MINIUPNPC_VERSION).tmp/include/miniupnpc/
|
||||
mkdir -p libs/miniupnpc-$(MINIUPNPC_VERSION).tmp/lib
|
||||
cp miniupnpc-$(MINIUPNPC_VERSION)/miniupnpc.lib libs/miniupnpc-$(MINIUPNPC_VERSION).tmp/lib/
|
||||
mkdir -p libs/miniupnpc-$(MINIUPNPC_VERSION).tmp/bin
|
||||
cp miniupnpc-$(MINIUPNPC_VERSION)/miniupnpc.dll libs/miniupnpc-$(MINIUPNPC_VERSION).tmp/bin/
|
||||
mkdir -p $(BUILD_PATH)/miniupnpc-$(MINIUPNPC_VERSION).tmp/include/miniupnpc
|
||||
cp miniupnpc-$(MINIUPNPC_VERSION)/*.h $(BUILD_PATH)/miniupnpc-$(MINIUPNPC_VERSION).tmp/include/miniupnpc/
|
||||
mkdir -p $(BUILD_PATH)/miniupnpc-$(MINIUPNPC_VERSION).tmp/lib
|
||||
cp miniupnpc-$(MINIUPNPC_VERSION)/miniupnpc.lib $(BUILD_PATH)/miniupnpc-$(MINIUPNPC_VERSION).tmp/lib/
|
||||
mkdir -p $(BUILD_PATH)/miniupnpc-$(MINIUPNPC_VERSION).tmp/bin
|
||||
cp miniupnpc-$(MINIUPNPC_VERSION)/miniupnpc.dll $(BUILD_PATH)/miniupnpc-$(MINIUPNPC_VERSION).tmp/bin/
|
||||
# cleanup
|
||||
rm -r -f miniupnpc-$(MINIUPNPC_VERSION)
|
||||
mv libs/miniupnpc-$(MINIUPNPC_VERSION).tmp libs/miniupnpc-$(MINIUPNPC_VERSION)
|
||||
mv $(BUILD_PATH)/miniupnpc-$(MINIUPNPC_VERSION).tmp $(BUILD_PATH)/miniupnpc-$(MINIUPNPC_VERSION)
|
||||
|
||||
openssl: libs/openssl-$(OPENSSL_VERSION)
|
||||
openssl: $(BUILD_PATH)/openssl-$(OPENSSL_VERSION)
|
||||
|
||||
$(DOWNLOAD_PATH)/openssl-$(OPENSSL_VERSION).tar.gz:
|
||||
wget --no-check-certificate https://www.openssl.org/source/openssl-$(OPENSSL_VERSION).tar.gz -O $(DOWNLOAD_PATH)/openssl-$(OPENSSL_VERSION).tar.gz
|
||||
|
||||
libs/openssl-$(OPENSSL_VERSION): $(DOWNLOAD_PATH)/openssl-$(OPENSSL_VERSION).tar.gz
|
||||
$(BUILD_PATH)/openssl-$(OPENSSL_VERSION): $(DOWNLOAD_PATH)/openssl-$(OPENSSL_VERSION).tar.gz
|
||||
# prepare
|
||||
rm -r -f libs/openssl-*
|
||||
rm -r -f $(BUILD_PATH)/openssl-*
|
||||
tar xvf $(DOWNLOAD_PATH)/openssl-$(OPENSSL_VERSION).tar.gz
|
||||
# build
|
||||
#cd openssl-$(OPENSSL_VERSION) && ./config --prefix="`pwd`/../libs"
|
||||
#cd openssl-$(OPENSSL_VERSION) && ./config --prefix="`pwd`/../$(BUILD_PATH)"
|
||||
#cd openssl-$(OPENSSL_VERSION) && make install
|
||||
cd openssl-$(OPENSSL_VERSION) && ./config shared
|
||||
cd openssl-$(OPENSSL_VERSION) && make
|
||||
# copy files
|
||||
mkdir -p libs/openssl-$(OPENSSL_VERSION).tmp/include/openssl
|
||||
cp openssl-$(OPENSSL_VERSION)/include/openssl/*.h libs/openssl-$(OPENSSL_VERSION).tmp/include/openssl/
|
||||
mkdir -p libs/openssl-$(OPENSSL_VERSION).tmp/bin
|
||||
cp openssl-$(OPENSSL_VERSION)/libeay32.dll libs/openssl-$(OPENSSL_VERSION).tmp/bin/
|
||||
cp openssl-$(OPENSSL_VERSION)/ssleay32.dll libs/openssl-$(OPENSSL_VERSION).tmp/bin/
|
||||
mkdir -p libs/openssl-$(OPENSSL_VERSION).tmp/lib
|
||||
cp openssl-$(OPENSSL_VERSION)/libcrypto.dll.a libs/openssl-$(OPENSSL_VERSION).tmp/lib/
|
||||
cp openssl-$(OPENSSL_VERSION)/libssl.dll.a libs/openssl-$(OPENSSL_VERSION).tmp/lib/
|
||||
mkdir -p $(BUILD_PATH)/openssl-$(OPENSSL_VERSION).tmp/include/openssl
|
||||
cp openssl-$(OPENSSL_VERSION)/include/openssl/*.h $(BUILD_PATH)/openssl-$(OPENSSL_VERSION).tmp/include/openssl/
|
||||
mkdir -p $(BUILD_PATH)/openssl-$(OPENSSL_VERSION).tmp/bin
|
||||
cp openssl-$(OPENSSL_VERSION)/libeay32.dll $(BUILD_PATH)/openssl-$(OPENSSL_VERSION).tmp/bin/
|
||||
cp openssl-$(OPENSSL_VERSION)/ssleay32.dll $(BUILD_PATH)/openssl-$(OPENSSL_VERSION).tmp/bin/
|
||||
mkdir -p $(BUILD_PATH)/openssl-$(OPENSSL_VERSION).tmp/lib
|
||||
cp openssl-$(OPENSSL_VERSION)/libcrypto.dll.a $(BUILD_PATH)/openssl-$(OPENSSL_VERSION).tmp/lib/
|
||||
cp openssl-$(OPENSSL_VERSION)/libssl.dll.a $(BUILD_PATH)/openssl-$(OPENSSL_VERSION).tmp/lib/
|
||||
# cleanup
|
||||
rm -r -f openssl-$(OPENSSL_VERSION)
|
||||
mv libs/openssl-$(OPENSSL_VERSION).tmp libs/openssl-$(OPENSSL_VERSION)
|
||||
mv $(BUILD_PATH)/openssl-$(OPENSSL_VERSION).tmp $(BUILD_PATH)/openssl-$(OPENSSL_VERSION)
|
||||
|
||||
speex: libs/speex-$(SPEEX_VERSION)
|
||||
speex: $(BUILD_PATH)/speex-$(SPEEX_VERSION)
|
||||
|
||||
$(DOWNLOAD_PATH)/speex-$(SPEEX_VERSION).tar.gz:
|
||||
wget http://downloads.xiph.org/releases/speex/speex-$(SPEEX_VERSION).tar.gz -O $(DOWNLOAD_PATH)/speex-$(SPEEX_VERSION).tar.gz
|
||||
wget --no-check-certificate http://downloads.xiph.org/releases/speex/speex-$(SPEEX_VERSION).tar.gz -O $(DOWNLOAD_PATH)/speex-$(SPEEX_VERSION).tar.gz
|
||||
|
||||
libs/speex-$(SPEEX_VERSION): $(DOWNLOAD_PATH)/speex-$(SPEEX_VERSION).tar.gz
|
||||
$(BUILD_PATH)/speex-$(SPEEX_VERSION): $(DOWNLOAD_PATH)/speex-$(SPEEX_VERSION).tar.gz
|
||||
# prepare
|
||||
rm -r -f libs/speex-*
|
||||
rm -r -f $(BUILD_PATH)/speex-*
|
||||
tar xvf $(DOWNLOAD_PATH)/speex-$(SPEEX_VERSION).tar.gz
|
||||
# build
|
||||
cd speex-$(SPEEX_VERSION) && ./configure
|
||||
#cd speex-$(SPEEX_VERSION) && make install exec_prefix="`pwd`/../libs"
|
||||
#cd speex-$(SPEEX_VERSION) && make install exec_prefix="`pwd`/../$(BUILD_PATH)"
|
||||
cd speex-$(SPEEX_VERSION) && make
|
||||
# copy files
|
||||
mkdir -p libs/speex-$(SPEEX_VERSION).tmp/include/speex
|
||||
cp speex-$(SPEEX_VERSION)/include/speex/*.h libs/speex-$(SPEEX_VERSION).tmp/include/speex/
|
||||
mkdir -p libs/speex-$(SPEEX_VERSION).tmp/lib
|
||||
cp speex-$(SPEEX_VERSION)/libspeex/.libs/libspeex.a libs/speex-$(SPEEX_VERSION).tmp/lib
|
||||
mkdir -p $(BUILD_PATH)/speex-$(SPEEX_VERSION).tmp/include/speex
|
||||
cp speex-$(SPEEX_VERSION)/include/speex/*.h $(BUILD_PATH)/speex-$(SPEEX_VERSION).tmp/include/speex/
|
||||
mkdir -p $(BUILD_PATH)/speex-$(SPEEX_VERSION).tmp/lib
|
||||
cp speex-$(SPEEX_VERSION)/libspeex/.libs/libspeex.a $(BUILD_PATH)/speex-$(SPEEX_VERSION).tmp/lib
|
||||
# cleanup
|
||||
rm -r -f speex-$(SPEEX_VERSION)
|
||||
mv libs/speex-$(SPEEX_VERSION).tmp libs/speex-$(SPEEX_VERSION)
|
||||
mv $(BUILD_PATH)/speex-$(SPEEX_VERSION).tmp $(BUILD_PATH)/speex-$(SPEEX_VERSION)
|
||||
|
||||
speexdsp: libs/speexdsp-$(SPEEXDSP_VERSION)
|
||||
speexdsp: $(BUILD_PATH)/speexdsp-$(SPEEXDSP_VERSION)
|
||||
|
||||
$(DOWNLOAD_PATH)/speexdsp-$(SPEEXDSP_VERSION).tar.gz:
|
||||
wget http://downloads.xiph.org/releases/speex/speexdsp-$(SPEEXDSP_VERSION).tar.gz -O $(DOWNLOAD_PATH)/speexdsp-$(SPEEXDSP_VERSION).tar.gz
|
||||
wget --no-check-certificate http://downloads.xiph.org/releases/speex/speexdsp-$(SPEEXDSP_VERSION).tar.gz -O $(DOWNLOAD_PATH)/speexdsp-$(SPEEXDSP_VERSION).tar.gz
|
||||
|
||||
libs/speexdsp-$(SPEEXDSP_VERSION): $(DOWNLOAD_PATH)/speexdsp-$(SPEEXDSP_VERSION).tar.gz
|
||||
$(BUILD_PATH)/speexdsp-$(SPEEXDSP_VERSION): $(DOWNLOAD_PATH)/speexdsp-$(SPEEXDSP_VERSION).tar.gz
|
||||
# prepare
|
||||
rm -r -f libs/speexdsp-*
|
||||
rm -r -f $(BUILD_PATH)/speexdsp-*
|
||||
tar xvf $(DOWNLOAD_PATH)/speexdsp-$(SPEEXDSP_VERSION).tar.gz
|
||||
# build
|
||||
cd speexdsp-$(SPEEXDSP_VERSION) && ./configure
|
||||
cd speexdsp-$(SPEEXDSP_VERSION) && make
|
||||
# copy files
|
||||
mkdir -p libs/speexdsp-$(SPEEXDSP_VERSION).tmp/include/speex
|
||||
cp speexdsp-$(SPEEXDSP_VERSION)/include/speex/*.h libs/speexdsp-$(SPEEXDSP_VERSION).tmp/include/speex/
|
||||
mkdir -p libs/speexdsp-$(SPEEXDSP_VERSION).tmp/lib
|
||||
cp speexdsp-$(SPEEXDSP_VERSION)/libspeexdsp/.libs/libspeexdsp.a libs/speexdsp-$(SPEEXDSP_VERSION).tmp/lib
|
||||
mkdir -p $(BUILD_PATH)/speexdsp-$(SPEEXDSP_VERSION).tmp/include/speex
|
||||
cp speexdsp-$(SPEEXDSP_VERSION)/include/speex/*.h $(BUILD_PATH)/speexdsp-$(SPEEXDSP_VERSION).tmp/include/speex/
|
||||
mkdir -p $(BUILD_PATH)/speexdsp-$(SPEEXDSP_VERSION).tmp/lib
|
||||
cp speexdsp-$(SPEEXDSP_VERSION)/libspeexdsp/.libs/libspeexdsp.a $(BUILD_PATH)/speexdsp-$(SPEEXDSP_VERSION).tmp/lib
|
||||
# cleanup
|
||||
rm -r -f speexdsp-$(SPEEXDSP_VERSION)
|
||||
mv libs/speexdsp-$(SPEEXDSP_VERSION).tmp libs/speexdsp-$(SPEEXDSP_VERSION)
|
||||
mv $(BUILD_PATH)/speexdsp-$(SPEEXDSP_VERSION).tmp $(BUILD_PATH)/speexdsp-$(SPEEXDSP_VERSION)
|
||||
|
||||
opencv: libs/opencv-$(OPENCV_VERSION)
|
||||
opencv: $(BUILD_PATH)/opencv-$(OPENCV_VERSION)
|
||||
|
||||
$(DOWNLOAD_PATH)/opencv-$(OPENCV_VERSION).tar.gz:
|
||||
wget --no-check-certificate https://github.com/opencv/opencv/archive/$(OPENCV_VERSION).tar.gz -O $(DOWNLOAD_PATH)/opencv-$(OPENCV_VERSION).tar.gz
|
||||
|
||||
libs/opencv-$(OPENCV_VERSION): $(DOWNLOAD_PATH)/opencv-$(OPENCV_VERSION).tar.gz
|
||||
$(BUILD_PATH)/opencv-$(OPENCV_VERSION): $(DOWNLOAD_PATH)/opencv-$(OPENCV_VERSION).tar.gz
|
||||
# prepare
|
||||
rm -r -f libs/opencv-*
|
||||
rm -r -f $(BUILD_PATH)/opencv-*
|
||||
tar xvf $(DOWNLOAD_PATH)/opencv-$(OPENCV_VERSION).tar.gz
|
||||
# build
|
||||
mkdir -p opencv-$(OPENCV_VERSION)/build
|
||||
#cd opencv-$(OPENCV_VERSION)/build && cmake .. -G"MSYS Makefiles" -DCMAKE_BUILD_TYPE=Release -DBUILD_PERF_TESTS=OFF -DBUILD_TESTS=OFF -DBUILD_SHARED_LIBS=OFF -DCMAKE_INSTALL_PREFIX="`pwd`/../../libs"
|
||||
cd opencv-$(OPENCV_VERSION)/build && cmake .. -G"MSYS Makefiles" -DCMAKE_BUILD_TYPE=Release -DBUILD_PERF_TESTS=OFF -DBUILD_TESTS=OFF -DBUILD_SHARED_LIBS=OFF -DCMAKE_INSTALL_PREFIX="`pwd`/install"
|
||||
#cd opencv-$(OPENCV_VERSION)/build && cmake .. -G"MSYS Makefiles" -DCMAKE_BUILD_TYPE=Release -DBUILD_PERF_TESTS=OFF -DBUILD_TESTS=OFF -DBUILD_SHARED_LIBS=OFF -DCMAKE_INSTALL_PREFIX="`pwd`/../../build"
|
||||
cd opencv-$(OPENCV_VERSION)/build && cmake .. -G"MSYS Makefiles" -DCMAKE_BUILD_TYPE=Release -DBUILD_PERF_TESTS=OFF -DBUILD_TESTS=OFF -DBUILD_SHARED_LIBS=OFF -DENABLE_CXX11=ON -DCMAKE_CXX_FLAGS="${CMAKE_CXX_FLAGS} -DSTRSAFE_NO_DEPRECATE" -DCMAKE_INSTALL_PREFIX="`pwd`/install"
|
||||
cd opencv-$(OPENCV_VERSION)/build && make install
|
||||
# copy files
|
||||
mkdir -p libs/opencv-$(OPENCV_VERSION).tmp/include
|
||||
cp -r opencv-$(OPENCV_VERSION)/build/install/include/* libs/opencv-$(OPENCV_VERSION).tmp/include/
|
||||
mkdir -p libs/opencv-$(OPENCV_VERSION).tmp/lib/opencv
|
||||
cp -r opencv-$(OPENCV_VERSION)/build/install/x86/mingw/staticlib/* libs/opencv-$(OPENCV_VERSION).tmp/lib/opencv/
|
||||
mkdir -p $(BUILD_PATH)/opencv-$(OPENCV_VERSION).tmp/include
|
||||
cp -r opencv-$(OPENCV_VERSION)/build/install/include/* $(BUILD_PATH)/opencv-$(OPENCV_VERSION).tmp/include/
|
||||
mkdir -p $(BUILD_PATH)/opencv-$(OPENCV_VERSION).tmp/lib/opencv
|
||||
cp -r opencv-$(OPENCV_VERSION)/build/install/x86/mingw/staticlib/* $(BUILD_PATH)/opencv-$(OPENCV_VERSION).tmp/lib/opencv/
|
||||
# cleanup
|
||||
rm -r -f opencv-$(OPENCV_VERSION)
|
||||
mv libs/opencv-$(OPENCV_VERSION).tmp libs/opencv-$(OPENCV_VERSION)
|
||||
mv $(BUILD_PATH)/opencv-$(OPENCV_VERSION).tmp $(BUILD_PATH)/opencv-$(OPENCV_VERSION)
|
||||
|
||||
libxml2: libs/libxml2-$(LIBXML2_VERSION)
|
||||
libxml2: $(BUILD_PATH)/libxml2-$(LIBXML2_VERSION)
|
||||
|
||||
$(DOWNLOAD_PATH)/libxml2-$(LIBXML2_VERSION).tar.gz:
|
||||
wget ftp://xmlsoft.org/libxml2/libxml2-$(LIBXML2_VERSION).tar.gz -O $(DOWNLOAD_PATH)/libxml2-$(LIBXML2_VERSION).tar.gz
|
||||
|
||||
libs/libxml2-$(LIBXML2_VERSION): $(DOWNLOAD_PATH)/libxml2-$(LIBXML2_VERSION).tar.gz
|
||||
$(BUILD_PATH)/libxml2-$(LIBXML2_VERSION): $(DOWNLOAD_PATH)/libxml2-$(LIBXML2_VERSION).tar.gz
|
||||
# prepare
|
||||
rm -r -f libs/libxml2-*
|
||||
rm -r -f $(BUILD_PATH)/libxml2-*
|
||||
tar xvf $(DOWNLOAD_PATH)/libxml2-$(LIBXML2_VERSION).tar.gz
|
||||
# build
|
||||
cd libxml2-$(LIBXML2_VERSION) && ./configure --without-iconv -enable-shared=no
|
||||
#cd libxml2-$(LIBXML2_VERSION) && make install exec_prefix="`pwd`/../libs"
|
||||
#cd libxml2-$(LIBXML2_VERSION) && make install exec_prefix="`pwd`/../$(BUILD_PATH)"
|
||||
cd libxml2-$(LIBXML2_VERSION) && make
|
||||
# copy files
|
||||
mkdir -p libs/libxml2-$(LIBXML2_VERSION).tmp/include/libxml
|
||||
cp libxml2-$(LIBXML2_VERSION)/include/libxml/*.h libs/libxml2-$(LIBXML2_VERSION).tmp/include/libxml/
|
||||
mkdir -p libs/libxml2-$(LIBXML2_VERSION).tmp/lib
|
||||
cp libxml2-$(LIBXML2_VERSION)/.libs/libxml2.a libs/libxml2-$(LIBXML2_VERSION).tmp/lib/
|
||||
mkdir -p $(BUILD_PATH)/libxml2-$(LIBXML2_VERSION).tmp/include/libxml
|
||||
cp libxml2-$(LIBXML2_VERSION)/include/libxml/*.h $(BUILD_PATH)/libxml2-$(LIBXML2_VERSION).tmp/include/libxml/
|
||||
mkdir -p $(BUILD_PATH)/libxml2-$(LIBXML2_VERSION).tmp/lib
|
||||
cp libxml2-$(LIBXML2_VERSION)/.libs/libxml2.a $(BUILD_PATH)/libxml2-$(LIBXML2_VERSION).tmp/lib/
|
||||
# cleanup
|
||||
#rm -r -f libxml2-$(LIBXML2_VERSION) # see libxslt
|
||||
mv libs/libxml2-$(LIBXML2_VERSION).tmp libs/libxml2-$(LIBXML2_VERSION)
|
||||
mv $(BUILD_PATH)/libxml2-$(LIBXML2_VERSION).tmp $(BUILD_PATH)/libxml2-$(LIBXML2_VERSION)
|
||||
|
||||
libxslt: libs/libxslt-$(LIBXSLT_VERSION)
|
||||
libxslt: $(BUILD_PATH)/libxslt-$(LIBXSLT_VERSION)
|
||||
|
||||
$(DOWNLOAD_PATH)/libxslt-$(LIBXSLT_VERSION).tar.gz:
|
||||
wget ftp://xmlsoft.org/libxml2/libxslt-$(LIBXSLT_VERSION).tar.gz -O $(DOWNLOAD_PATH)/libxslt-$(LIBXSLT_VERSION).tar.gz
|
||||
|
||||
libs/libxslt-$(LIBXSLT_VERSION): $(DOWNLOAD_PATH)/libxml2-$(LIBXML2_VERSION).tar.gz $(DOWNLOAD_PATH)/libxslt-$(LIBXSLT_VERSION).tar.gz
|
||||
$(BUILD_PATH)/libxslt-$(LIBXSLT_VERSION): $(DOWNLOAD_PATH)/libxml2-$(LIBXML2_VERSION).tar.gz $(DOWNLOAD_PATH)/libxslt-$(LIBXSLT_VERSION).tar.gz
|
||||
# prepare
|
||||
rm -r -f libs/libxslt-*
|
||||
rm -r -f $(BUILD_PATH)/libxslt-*
|
||||
tar xvf $(DOWNLOAD_PATH)/libxml2-$(LIBXML2_VERSION).tar.gz
|
||||
tar xvf $(DOWNLOAD_PATH)/libxslt-$(LIBXSLT_VERSION).tar.gz
|
||||
tar xvf $(MAKEFILE_PATH)libxslt-$(LIBXSLT_VERSION)-fix.tar.gz
|
||||
# build
|
||||
cd libxslt-$(LIBXSLT_VERSION) && ./configure --with-libxml-src=../libxml2-$(LIBXML2_VERSION) -enable-shared=no CFLAGS=-DLIBXML_STATIC
|
||||
cd libxslt-$(LIBXSLT_VERSION) && make
|
||||
# copy files
|
||||
mkdir -p libs/libxslt-$(LIBXSLT_VERSION).tmp/include/libxslt
|
||||
cp libxslt-$(LIBXSLT_VERSION)/libxslt/*.h libs/libxslt-$(LIBXSLT_VERSION).tmp/include/libxslt/
|
||||
mkdir -p libs/libxslt-$(LIBXSLT_VERSION).tmp/lib
|
||||
cp libxslt-$(LIBXSLT_VERSION)/libxslt/.libs/libxslt.a libs/libxslt-$(LIBXSLT_VERSION).tmp/lib/
|
||||
cp libxslt-$(LIBXSLT_VERSION)/libexslt/.libs/libexslt.a libs/libxslt-$(LIBXSLT_VERSION).tmp/lib/
|
||||
mkdir -p $(BUILD_PATH)/libxslt-$(LIBXSLT_VERSION).tmp/include/libxslt
|
||||
cp libxslt-$(LIBXSLT_VERSION)/libxslt/*.h $(BUILD_PATH)/libxslt-$(LIBXSLT_VERSION).tmp/include/libxslt/
|
||||
mkdir -p $(BUILD_PATH)/libxslt-$(LIBXSLT_VERSION).tmp/lib
|
||||
cp libxslt-$(LIBXSLT_VERSION)/libxslt/.libs/libxslt.a $(BUILD_PATH)/libxslt-$(LIBXSLT_VERSION).tmp/lib/
|
||||
cp libxslt-$(LIBXSLT_VERSION)/libexslt/.libs/libexslt.a $(BUILD_PATH)/libxslt-$(LIBXSLT_VERSION).tmp/lib/
|
||||
# cleanup
|
||||
rm -r -f libxml2-$(LIBXML2_VERSION)
|
||||
rm -r -f libxslt-$(LIBXSLT_VERSION)
|
||||
mv libs/libxslt-$(LIBXSLT_VERSION).tmp libs/libxslt-$(LIBXSLT_VERSION)
|
||||
mv $(BUILD_PATH)/libxslt-$(LIBXSLT_VERSION).tmp $(BUILD_PATH)/libxslt-$(LIBXSLT_VERSION)
|
||||
|
||||
curl: libs/curl-$(CURL_VERSION)
|
||||
curl: $(BUILD_PATH)/curl-$(CURL_VERSION)
|
||||
|
||||
$(DOWNLOAD_PATH)/curl-$(CURL_VERSION).tar.gz:
|
||||
wget --no-check-certificate http://curl.haxx.se/$(DOWNLOAD_PATH)/curl-$(CURL_VERSION).tar.gz -O $(DOWNLOAD_PATH)/curl-$(CURL_VERSION).tar.gz
|
||||
wget --no-check-certificate http://curl.haxx.se/download/curl-$(CURL_VERSION).tar.gz -O $(DOWNLOAD_PATH)/curl-$(CURL_VERSION).tar.gz
|
||||
|
||||
libs/curl-$(CURL_VERSION): $(DOWNLOAD_PATH)/curl-$(CURL_VERSION).tar.gz
|
||||
$(BUILD_PATH)/curl-$(CURL_VERSION): $(DOWNLOAD_PATH)/curl-$(CURL_VERSION).tar.gz
|
||||
# prepare
|
||||
rm -r -f libs/curl-*
|
||||
rm -r -f $(BUILD_PATH)/curl-*
|
||||
tar xvf $(DOWNLOAD_PATH)/curl-$(CURL_VERSION).tar.gz
|
||||
# build
|
||||
cd curl-$(CURL_VERSION) && ./configure --disable-shared --with-ssl="`pwd`/../libs/openssl-$(OPENSSL_VERSION)"
|
||||
#cd curl-$(CURL_VERSION) && make install exec_prefix="`pwd`/../libs"
|
||||
cd curl-$(CURL_VERSION) && ./configure --disable-shared --with-ssl="`pwd`/../$(BUILD_PATH)/openssl-$(OPENSSL_VERSION)"
|
||||
#cd curl-$(CURL_VERSION) && make install exec_prefix="`pwd`/../$(BUILD_PATH)"
|
||||
cd curl-$(CURL_VERSION) && make
|
||||
# copy files
|
||||
mkdir -p libs/curl-$(CURL_VERSION).tmp/include/curl
|
||||
cp curl-$(CURL_VERSION)/include/curl/*.h libs/curl-$(CURL_VERSION).tmp/include/curl/
|
||||
mkdir -p libs/curl-$(CURL_VERSION).tmp/lib
|
||||
cp curl-$(CURL_VERSION)/lib/.libs/libcurl.a libs/curl-$(CURL_VERSION).tmp/lib/
|
||||
mkdir -p $(BUILD_PATH)/curl-$(CURL_VERSION).tmp/include/curl
|
||||
cp curl-$(CURL_VERSION)/include/curl/*.h $(BUILD_PATH)/curl-$(CURL_VERSION).tmp/include/curl/
|
||||
mkdir -p $(BUILD_PATH)/curl-$(CURL_VERSION).tmp/lib
|
||||
cp curl-$(CURL_VERSION)/lib/.libs/libcurl.a $(BUILD_PATH)/curl-$(CURL_VERSION).tmp/lib/
|
||||
# cleanup
|
||||
rm -r -f curl-$(CURL_VERSION)
|
||||
mv libs/curl-$(CURL_VERSION).tmp libs/curl-$(CURL_VERSION)
|
||||
mv $(BUILD_PATH)/curl-$(CURL_VERSION).tmp $(BUILD_PATH)/curl-$(CURL_VERSION)
|
||||
|
||||
sqlcipher: libs/sqlcipher-$(SQLCIPHER_VERSION)
|
||||
sqlcipher: $(BUILD_PATH)/sqlcipher-$(SQLCIPHER_VERSION)
|
||||
|
||||
$(DOWNLOAD_PATH)/tcl$(TCL_VERSION)-src.tar.gz:
|
||||
wget --no-check-certificate http://downloads.sourceforge.net/project/tcl/Tcl/$(TCL_VERSION)/tcl$(TCL_VERSION)-src.tar.gz -O $(DOWNLOAD_PATH)/tcl$(TCL_VERSION)-src.tar.gz
|
||||
@ -271,9 +281,9 @@ $(DOWNLOAD_PATH)/tcl$(TCL_VERSION)-src.tar.gz:
|
||||
$(DOWNLOAD_PATH)/sqlcipher-$(SQLCIPHER_VERSION).tar.gz:
|
||||
wget --no-check-certificate https://github.com/sqlcipher/sqlcipher/archive/v$(SQLCIPHER_VERSION).tar.gz -O $(DOWNLOAD_PATH)/sqlcipher-$(SQLCIPHER_VERSION).tar.gz
|
||||
|
||||
libs/sqlcipher-$(SQLCIPHER_VERSION): $(DOWNLOAD_PATH)/tcl$(TCL_VERSION)-src.tar.gz $(DOWNLOAD_PATH)/sqlcipher-$(SQLCIPHER_VERSION).tar.gz
|
||||
$(BUILD_PATH)/sqlcipher-$(SQLCIPHER_VERSION): $(DOWNLOAD_PATH)/tcl$(TCL_VERSION)-src.tar.gz $(DOWNLOAD_PATH)/sqlcipher-$(SQLCIPHER_VERSION).tar.gz
|
||||
# prepare
|
||||
rm -r -f libs/sqlcipher-*
|
||||
rm -r -f $(BUILD_PATH)/sqlcipher-*
|
||||
# tcl
|
||||
tar xvf $(DOWNLOAD_PATH)/tcl$(TCL_VERSION)-src.tar.gz
|
||||
mkdir -p tcl$(TCL_VERSION)/build
|
||||
@ -285,59 +295,73 @@ libs/sqlcipher-$(SQLCIPHER_VERSION): $(DOWNLOAD_PATH)/tcl$(TCL_VERSION)-src.tar.
|
||||
mkdir -p tcl$(TCL_VERSION)/lib
|
||||
ln -s `pwd`/tcl$(TCL_VERSION)/library `pwd`/tcl$(TCL_VERSION)/lib/tcl8.6
|
||||
# build
|
||||
cd sqlcipher-$(SQLCIPHER_VERSION) && PATH=.:$$PATH:`pwd`/../tcl$(TCL_VERSION)/build && export LIBS="-L`pwd`/../libs/openssl-$(OPENSSL_VERSION)/lib -lgdi32 $$LIBS" && ./configure --disable-shared --enable-static --enable-tempstore=yes CFLAGS="-DSQLITE_HAS_CODEC -I`pwd`/../libs/openssl-$(OPENSSL_VERSION)/include -I`pwd`/../tcl$(TCL_VERSION)/generic" LDFLAGS="-L`pwd`/../libs/openssl-$(OPENSSL_VERSION)/lib -lcrypto -lgdi32" --with-tcl="`pwd`/../tcl$(TCL_VERSION)/build" && make install prefix="`pwd`/install"
|
||||
cd sqlcipher-$(SQLCIPHER_VERSION) && PATH=.:$$PATH:`pwd`/../tcl$(TCL_VERSION)/build && export LIBS="-L`pwd`/../$(BUILD_PATH)/openssl-$(OPENSSL_VERSION)/lib -lgdi32 $$LIBS" && ./configure --disable-shared --enable-static --enable-tempstore=yes CFLAGS="-DSQLITE_HAS_CODEC -I`pwd`/../$(BUILD_PATH)/openssl-$(OPENSSL_VERSION)/include -I`pwd`/../tcl$(TCL_VERSION)/generic" LDFLAGS="-L`pwd`/../$(BUILD_PATH)/openssl-$(OPENSSL_VERSION)/lib -lcrypto -lgdi32" --with-tcl="`pwd`/../tcl$(TCL_VERSION)/build" && make install prefix="`pwd`/install"
|
||||
# copy files
|
||||
mkdir -p libs/sqlcipher-$(SQLCIPHER_VERSION).tmp/include
|
||||
cp -r sqlcipher-$(SQLCIPHER_VERSION)/install/include/* libs/sqlcipher-$(SQLCIPHER_VERSION).tmp/include/
|
||||
mkdir -p libs/sqlcipher-$(SQLCIPHER_VERSION).tmp/lib
|
||||
cp sqlcipher-$(SQLCIPHER_VERSION)/install/lib/libsqlcipher.a libs/sqlcipher-$(SQLCIPHER_VERSION).tmp/lib/
|
||||
mkdir -p libs/sqlcipher-$(SQLCIPHER_VERSION).tmp/bin
|
||||
cp sqlcipher-$(SQLCIPHER_VERSION)/install/bin/sqlcipher.exe libs/sqlcipher-$(SQLCIPHER_VERSION).tmp/bin/
|
||||
mkdir -p $(BUILD_PATH)/sqlcipher-$(SQLCIPHER_VERSION).tmp/include
|
||||
cp -r sqlcipher-$(SQLCIPHER_VERSION)/install/include/* $(BUILD_PATH)/sqlcipher-$(SQLCIPHER_VERSION).tmp/include/
|
||||
mkdir -p $(BUILD_PATH)/sqlcipher-$(SQLCIPHER_VERSION).tmp/lib
|
||||
cp sqlcipher-$(SQLCIPHER_VERSION)/install/lib/libsqlcipher.a $(BUILD_PATH)/sqlcipher-$(SQLCIPHER_VERSION).tmp/lib/
|
||||
mkdir -p $(BUILD_PATH)/sqlcipher-$(SQLCIPHER_VERSION).tmp/bin
|
||||
cp sqlcipher-$(SQLCIPHER_VERSION)/install/bin/sqlcipher.exe $(BUILD_PATH)/sqlcipher-$(SQLCIPHER_VERSION).tmp/bin/
|
||||
# cleanup
|
||||
rm -r -f sqlcipher-$(SQLCIPHER_VERSION)
|
||||
rm -r -f tcl$(TCL_VERSION)
|
||||
mv libs/sqlcipher-$(SQLCIPHER_VERSION).tmp libs/sqlcipher-$(SQLCIPHER_VERSION)
|
||||
mv $(BUILD_PATH)/sqlcipher-$(SQLCIPHER_VERSION).tmp $(BUILD_PATH)/sqlcipher-$(SQLCIPHER_VERSION)
|
||||
|
||||
libmicrohttpd: libs/libmicrohttpd-$(LIBMICROHTTPD_VERSION)
|
||||
libmicrohttpd: $(BUILD_PATH)/libmicrohttpd-$(LIBMICROHTTPD_VERSION)
|
||||
|
||||
$(DOWNLOAD_PATH)/libmicrohttpd-$(LIBMICROHTTPD_VERSION).tar.gz:
|
||||
wget --no-check-certificate http://ftp.gnu.org/gnu/libmicrohttpd/libmicrohttpd-$(LIBMICROHTTPD_VERSION).tar.gz -O $(DOWNLOAD_PATH)/libmicrohttpd-$(LIBMICROHTTPD_VERSION).tar.gz
|
||||
|
||||
libs/libmicrohttpd-$(LIBMICROHTTPD_VERSION): $(DOWNLOAD_PATH)/libmicrohttpd-$(LIBMICROHTTPD_VERSION).tar.gz
|
||||
$(BUILD_PATH)/libmicrohttpd-$(LIBMICROHTTPD_VERSION): $(DOWNLOAD_PATH)/libmicrohttpd-$(LIBMICROHTTPD_VERSION).tar.gz
|
||||
# prepare
|
||||
rm -r -f libs/libmicrohttpd-*
|
||||
rm -r -f $(BUILD_PATH)/libmicrohttpd-*
|
||||
tar xvf $(DOWNLOAD_PATH)/libmicrohttpd-$(LIBMICROHTTPD_VERSION).tar.gz
|
||||
# build
|
||||
cd libmicrohttpd-$(LIBMICROHTTPD_VERSION) && ./configure --disable-shared --enable-static --prefix="`pwd`/../libs/libmicrohttpd-$(LIBMICROHTTPD_VERSION).tmp"
|
||||
cd libmicrohttpd-$(LIBMICROHTTPD_VERSION) && ./configure --disable-shared --enable-static --prefix="`pwd`/../$(BUILD_PATH)/libmicrohttpd-$(LIBMICROHTTPD_VERSION).tmp"
|
||||
cd libmicrohttpd-$(LIBMICROHTTPD_VERSION) && make install
|
||||
# copy files
|
||||
# cleanup
|
||||
rm -r -f libmicrohttpd-$(LIBMICROHTTPD_VERSION)
|
||||
mv libs/libmicrohttpd-$(LIBMICROHTTPD_VERSION).tmp libs/libmicrohttpd-$(LIBMICROHTTPD_VERSION)
|
||||
mv $(BUILD_PATH)/libmicrohttpd-$(LIBMICROHTTPD_VERSION).tmp $(BUILD_PATH)/libmicrohttpd-$(LIBMICROHTTPD_VERSION)
|
||||
|
||||
ffmpeg: libs/ffmpeg-$(FFMPEG_VERSION)
|
||||
ffmpeg: $(BUILD_PATH)/ffmpeg-$(FFMPEG_VERSION)
|
||||
|
||||
$(DOWNLOAD_PATH)/ffmpeg-$(FFMPEG_VERSION).tar.gz:
|
||||
wget --no-check-certificate https://ffmpeg.org/releases/ffmpeg-$(FFMPEG_VERSION).tar.gz -O $(DOWNLOAD_PATH)/ffmpeg-$(FFMPEG_VERSION).tar.gz
|
||||
|
||||
libs/ffmpeg-$(FFMPEG_VERSION): $(DOWNLOAD_PATH)/ffmpeg-$(FFMPEG_VERSION).tar.gz
|
||||
$(BUILD_PATH)/ffmpeg-$(FFMPEG_VERSION): $(DOWNLOAD_PATH)/ffmpeg-$(FFMPEG_VERSION).tar.gz
|
||||
# prepare
|
||||
rm -r -f libs/ffmpeg-*
|
||||
rm -r -f $(BUILD_PATH)/ffmpeg-*
|
||||
tar xvf $(DOWNLOAD_PATH)/ffmpeg-$(FFMPEG_VERSION).tar.gz
|
||||
# build
|
||||
cd ffmpeg-$(FFMPEG_VERSION) && ./configure --disable-shared --enable-static --disable-programs --disable-ffmpeg --disable-ffplay --disable-ffprobe --disable-ffserver --disable-doc --disable-htmlpages --disable-manpages --disable-podpages --disable-txtpages --disable-yasm --disable-everything --enable-encoder=mpeg4 --enable-decoder=mpeg4 --prefix="`pwd`/../libs/ffmpeg-$(FFMPEG_VERSION).tmp"
|
||||
cd ffmpeg-$(FFMPEG_VERSION) && ./configure --disable-shared --enable-static --disable-programs --disable-ffmpeg --disable-ffplay --disable-ffprobe --disable-ffserver --disable-doc --disable-htmlpages --disable-manpages --disable-podpages --disable-txtpages --disable-yasm --disable-everything --enable-encoder=mpeg4 --enable-decoder=mpeg4 --prefix="`pwd`/../$(BUILD_PATH)/ffmpeg-$(FFMPEG_VERSION).tmp"
|
||||
cd ffmpeg-$(FFMPEG_VERSION) && make install
|
||||
# copy files
|
||||
# cleanup
|
||||
rm -r -f ffmpeg-$(FFMPEG_VERSION)
|
||||
mv libs/ffmpeg-$(FFMPEG_VERSION).tmp libs/ffmpeg-$(FFMPEG_VERSION)
|
||||
mv $(BUILD_PATH)/ffmpeg-$(FFMPEG_VERSION).tmp $(BUILD_PATH)/ffmpeg-$(FFMPEG_VERSION)
|
||||
|
||||
rapidjson: $(BUILD_PATH)/rapidjson-$(RAPIDJSON_VERSION)
|
||||
|
||||
$(DOWNLOAD_PATH)/rapidjson-$(RAPIDJSON_VERSION).tar.gz:
|
||||
wget --no-check-certificate https://github.com/Tencent/rapidjson/archive/v$(RAPIDJSON_VERSION).tar.gz -O $(DOWNLOAD_PATH)/rapidjson-$(RAPIDJSON_VERSION).tar.gz
|
||||
|
||||
$(BUILD_PATH)/rapidjson-$(RAPIDJSON_VERSION): $(DOWNLOAD_PATH)/rapidjson-$(RAPIDJSON_VERSION).tar.gz
|
||||
# prepare
|
||||
rm -r -f $(BUILD_PATH)/rapidjson-*
|
||||
tar xvf $(DOWNLOAD_PATH)/rapidjson-$(RAPIDJSON_VERSION).tar.gz
|
||||
# build
|
||||
#mkdir -p rapidjson-$(RAPIDJSON_VERSION)/build
|
||||
#cd rapidjson-$(RAPIDJSON_VERSION)/build && cmake .. -G"MSYS Makefiles"
|
||||
#cd rapidjson-$(RAPIDJSON_VERSION)/build && make
|
||||
# copy files
|
||||
mkdir -p $(BUILD_PATH)/rapidjson-$(RAPIDJSON_VERSION).tmp/include
|
||||
cp -r rapidjson-$(RAPIDJSON_VERSION)/include/* $(BUILD_PATH)/rapidjson-$(RAPIDJSON_VERSION).tmp/include/
|
||||
# cleanup
|
||||
rm -r -f rapidjson-$(RAPIDJSON_VERSION)
|
||||
mv $(BUILD_PATH)/rapidjson-$(RAPIDJSON_VERSION).tmp $(BUILD_PATH)/rapidjson-$(RAPIDJSON_VERSION)
|
||||
|
||||
copylibs:
|
||||
if [ "$(COPY_ANSWER)" = "" ] ; then \
|
||||
read -p "Do you want to copy libs to retroshare? (y|n)" answer; \
|
||||
else \
|
||||
answer=$(COPY_ANSWER) ; \
|
||||
fi ; \
|
||||
if [ "$$answer" = "y" ] ; then \
|
||||
rm -r -f $(LIBS_PATH) ; \
|
||||
mkdir -p $(LIBS_PATH) ; \
|
||||
cp ./libs/gcc-version $(LIBS_PATH) ; \
|
||||
find ./libs -mindepth 1 -maxdepth 1 -type d -not -name "*.tmp" -print -exec cp -r {}/. $(LIBS_PATH) \; ; \
|
||||
fi
|
||||
rm -r -f $(LIBS_PATH) ; \
|
||||
mkdir -p $(LIBS_PATH) ; \
|
||||
cp $(BUILD_PATH)/gcc-version $(LIBS_PATH) ; \
|
||||
find $(BUILD_PATH) -mindepth 1 -maxdepth 1 -type d -not -name "*.tmp" -print -exec cp -r {}/. $(LIBS_PATH) \; ; \
|
||||
|
@ -1,5 +1,5 @@
|
||||
:: Usage:
|
||||
:: call build-libs.bat [auto-copy] [make tasks]
|
||||
:: call build-libs.bat [make tasks]
|
||||
|
||||
@echo off
|
||||
|
||||
@ -7,7 +7,6 @@ setlocal
|
||||
|
||||
:: Parameter
|
||||
set MakeParam="DOWNLOAD_PATH=../download"
|
||||
if "%~1"=="auto-copy" set MakeParam=%MakeParam% "COPY_ANSWER=y"& shift /1
|
||||
|
||||
set MakeTask=
|
||||
:param_loop
|
||||
@ -30,6 +29,9 @@ if not exist "%EnvMSYSSH%" %cecho% error "Please install MSYS first." & exit /B
|
||||
call "%~dp0env.bat"
|
||||
if errorlevel 1 goto error_env
|
||||
|
||||
:: Add tools path to PATH environment
|
||||
set PATH=%EnvToolsPath%;%PATH%
|
||||
|
||||
call "%ToolsPath%\msys-path.bat" "%~dp0" MSYSCurPath
|
||||
call "%ToolsPath%\msys-path.bat" "%BuildLibsPath%" MSYSBuildLibsPath
|
||||
|
||||
|
Binary file not shown.
27
build_scripts/Windows/build-retrotor.bat
Normal file
27
build_scripts/Windows/build-retrotor.bat
Normal file
@ -0,0 +1,27 @@
|
||||
@echo off
|
||||
|
||||
setlocal
|
||||
|
||||
:: Initialize environment
|
||||
call "%~dp0env.bat"
|
||||
if errorlevel 1 goto error_env
|
||||
call "%EnvPath%\env.bat"
|
||||
if errorlevel 1 goto error_env
|
||||
|
||||
%cecho% info "Build libraries"
|
||||
call "%~dp0build-libs\build-libs.bat"
|
||||
if errorlevel 1 %cecho% error "Failed to build libraries." & exit /B %ERRORLEVEL%
|
||||
|
||||
%cecho% info "Build %SourceName%"
|
||||
call "%~dp0build\build.bat" retrotor
|
||||
if errorlevel 1 %cecho% error "Failed to build %SourceName%." & exit /B %ERRORLEVEL%
|
||||
|
||||
%cecho% info "Pack %SourceName%"
|
||||
call "%~dp0build\pack.bat" retrotor
|
||||
if errorlevel 1 %cecho% error "Failed to pack %SourceName%." & exit /B %ERRORLEVEL%
|
||||
|
||||
exit /B 0
|
||||
|
||||
:error_env
|
||||
echo Failed to initialize environment.
|
||||
exit /B 1
|
@ -9,15 +9,15 @@ call "%EnvPath%\env.bat"
|
||||
if errorlevel 1 goto error_env
|
||||
|
||||
%cecho% info "Build libraries"
|
||||
call "%~dp0build-libs\build-libs.bat" auto-copy
|
||||
call "%~dp0build-libs\build-libs.bat"
|
||||
if errorlevel 1 %cecho% error "Failed to build libraries." & exit /B %ERRORLEVEL%
|
||||
|
||||
%cecho% info "Build %SourceName%"
|
||||
call "%~dp0build\build.bat"
|
||||
call "%~dp0build\build.bat" standard
|
||||
if errorlevel 1 %cecho% error "Failed to build %SourceName%." & exit /B %ERRORLEVEL%
|
||||
|
||||
%cecho% info "Pack %SourceName%"
|
||||
call "%~dp0build\pack.bat"
|
||||
call "%~dp0build\pack.bat" standard
|
||||
if errorlevel 1 %cecho% error "Failed to pack %SourceName%." & exit /B %ERRORLEVEL%
|
||||
|
||||
%cecho% info "Build installer"
|
||||
|
@ -8,21 +8,18 @@ if errorlevel 1 goto error_env
|
||||
call "%EnvPath%\env.bat"
|
||||
if errorlevel 1 goto error_env
|
||||
|
||||
:: Get gcc versions
|
||||
call "%ToolsPath%\get-gcc-version.bat" GCCVersion
|
||||
if "%GCCVersion%"=="" echo Cannot get gcc version.& exit /B 1
|
||||
:: Initialize environment
|
||||
call "%~dp0env.bat" standard
|
||||
if errorlevel 2 exit /B 2
|
||||
if errorlevel 1 goto error_env
|
||||
|
||||
:: Check external libraries
|
||||
if not exist "%RootPath%\libs" echo Please build external libraries first.& exit /B 1
|
||||
if not exist "%BuildLibsPath%\libs" %cecho% error "Please build external libraries first." & exit /B 1
|
||||
|
||||
:: Check gcc version of external libraries
|
||||
if not exist "%RootPath%\libs\gcc-version" echo Cannot get gcc version of external libraries.& exit /B 1
|
||||
set /P LibsGCCVersion=<"%RootPath%\libs\gcc-version"
|
||||
if "%LibsGCCVersion%" NEQ "%GCCVersion%" echo Please use correct version of external libraries. (gcc %GCCVersion% ^<^> libs %LibsGCCVersion%).& exit /B 1
|
||||
|
||||
:: Initialize environment
|
||||
call "%~dp0env.bat"
|
||||
if errorlevel 1 goto error_env
|
||||
if not exist "%BuildLibsPath%\libs\gcc-version" %cecho% error "Cannot get gcc version of external libraries." & exit /B 1
|
||||
set /P LibsGCCVersion=<"%BuildLibsPath%\libs\gcc-version"
|
||||
if "%LibsGCCVersion%" NEQ "%GCCVersion%" %cecho% error "Please use correct version of external libraries. (gcc %GCCVersion% ^<^> libs %LibsGCCVersion%)." & exit /B 1
|
||||
|
||||
:: Build defines for script
|
||||
set NSIS_PARAM=
|
||||
|
@ -8,21 +8,18 @@ if errorlevel 1 goto error_env
|
||||
call "%EnvPath%\env.bat"
|
||||
if errorlevel 1 goto error_env
|
||||
|
||||
:: Get gcc versions
|
||||
call "%ToolsPath%\get-gcc-version.bat" GCCVersion
|
||||
if "%GCCVersion%"=="" echo Cannot get gcc version.& exit /B 1
|
||||
:: Initialize environment
|
||||
call "%~dp0env.bat" %*
|
||||
if errorlevel 2 exit /B 2
|
||||
if errorlevel 1 goto error_env
|
||||
|
||||
:: Check external libraries
|
||||
if not exist "%RootPath%\libs" echo Please build external libraries first.& exit /B 1
|
||||
if not exist "%BuildLibsPath%\libs" %cecho% error "Please build external libraries first." & exit /B 1
|
||||
|
||||
:: Check gcc version of external libraries
|
||||
if not exist "%RootPath%\libs\gcc-version" echo Cannot get gcc version of external libraries.& exit /B 1
|
||||
set /P LibsGCCVersion=<"%RootPath%\libs\gcc-version"
|
||||
if "%LibsGCCVersion%" NEQ "%GCCVersion%" echo Please use correct version of external libraries. (gcc %GCCVersion% ^<^> libs %LibsGCCVersion%).& exit /B 1
|
||||
|
||||
:: Initialize environment
|
||||
call "%~dp0env.bat"
|
||||
if errorlevel 1 goto error_env
|
||||
if not exist "%BuildLibsPath%\libs\gcc-version" %cecho% error "Cannot get gcc version of external libraries." & exit /B 1
|
||||
set /P LibsGCCVersion=<"%BuildLibsPath%\libs\gcc-version"
|
||||
if "%LibsGCCVersion%" NEQ "%GCCVersion%" %cecho% error "Please use correct version of external libraries. (gcc %GCCVersion% ^<^> libs %LibsGCCVersion%)." & exit /B 1
|
||||
|
||||
:: Check git executable
|
||||
set GitPath=
|
||||
@ -36,7 +33,7 @@ echo.
|
||||
echo === Version
|
||||
echo.
|
||||
|
||||
title Build - %SourceName%-%RsBuildConfig% [Version]
|
||||
title Build - %SourceName%%RsType%-%RsBuildConfig% [Version]
|
||||
|
||||
pushd "%SourcePath%\retroshare-gui\src\gui\images"
|
||||
:: Touch resource file
|
||||
@ -50,16 +47,19 @@ echo.
|
||||
echo === qmake
|
||||
echo.
|
||||
|
||||
title Build - %SourceName%-%RsBuildConfig% [qmake]
|
||||
title Build - %SourceName%%RsType%-%RsBuildConfig% [qmake]
|
||||
|
||||
qmake "%SourcePath%\RetroShare.pro" -r "CONFIG+=%RsBuildConfig% version_detail_bash_script rs_autologin"
|
||||
set RS_QMAKE_CONFIG=%RsBuildConfig% version_detail_bash_script rs_autologin retroshare_plugins
|
||||
if "%RsRetroTor%"=="1" set RS_QMAKE_CONFIG=%RS_QMAKE_CONFIG% retrotor
|
||||
|
||||
qmake "%SourcePath%\RetroShare.pro" -r -spec win32-g++ "CONFIG+=%RS_QMAKE_CONFIG%" "EXTERNAL_LIB_DIR=%BuildLibsPath%\libs"
|
||||
if errorlevel 1 goto error
|
||||
|
||||
echo.
|
||||
echo === make
|
||||
echo.
|
||||
|
||||
title Build - %SourceName%-%RsBuildConfig% [make]
|
||||
title Build - %SourceName%%RsType%-%RsBuildConfig% [make]
|
||||
|
||||
if exist "%EnvJomExe%" (
|
||||
"%EnvJomExe%"
|
||||
|
@ -7,7 +7,7 @@ call "%~dp0..\env.bat"
|
||||
if errorlevel 1 goto error_env
|
||||
call "%EnvPath%\env.bat"
|
||||
if errorlevel 1 goto error_env
|
||||
call "%~dp0env.bat"
|
||||
call "%~dp0env.bat" %*
|
||||
if errorlevel 1 goto error_env
|
||||
|
||||
if not exist "%RsBuildPath%" exit /B 0
|
||||
|
@ -1,3 +1,18 @@
|
||||
if "%~1"=="standard" (
|
||||
set RsRetroTor=
|
||||
set RsType=
|
||||
) else (
|
||||
if "%~1"=="retrotor" (
|
||||
set RsRetroTor=1
|
||||
set RsType=-tor
|
||||
) else (
|
||||
echo.
|
||||
echo Usage: standard^|retrotor
|
||||
echo.
|
||||
exit /B 2
|
||||
)
|
||||
)
|
||||
|
||||
set BuildPath=%EnvRootPath%\builds
|
||||
set DeployPath=%EnvRootPath%\deploy
|
||||
|
||||
@ -7,20 +22,26 @@ if not exist "%DeployPath%" mkdir "%DeployPath%"
|
||||
:: Check Qt environment
|
||||
set QtPath=
|
||||
call "%ToolsPath%\find-in-path.bat" QtPath qmake.exe
|
||||
if "%QtPath%"=="" echo Please run command in the Qt Command Prompt.& exit /B 1
|
||||
if "%QtPath%"=="" %cecho% error "Please run command in the Qt Command Prompt." & exit /B 1
|
||||
|
||||
:: Check MinGW environment
|
||||
set MinGWPath=
|
||||
call "%ToolsPath%\find-in-path.bat" MinGWPath gcc.exe
|
||||
if "%MinGWPath%"=="" echo Please run command in the Qt Command Prompt.& exit /B 1
|
||||
if "%MinGWPath%"=="" %cecho% error "Please run command in the Qt Command Prompt." & exit /B 1
|
||||
|
||||
:: Get Qt version
|
||||
call "%ToolsPath%\get-qt-version.bat" QtVersion
|
||||
if "%QtVersion%"=="" echo Cannot get Qt version.& exit /B 1
|
||||
if "%QtVersion%"=="" %cecho% error "Cannot get Qt version." & exit /B 1
|
||||
|
||||
:: Get gcc versions
|
||||
call "%ToolsPath%\get-gcc-version.bat" GCCVersion
|
||||
if "%GCCVersion%"=="" %cecho% error "Cannot get gcc version." & exit /B 1
|
||||
|
||||
set BuildLibsPath=%EnvRootPath%\build-libs\gcc-%GCCVersion%
|
||||
|
||||
set RsBuildConfig=release
|
||||
set RsBuildPath=%BuildPath%\Qt-%QtVersion%-%RsBuildConfig%
|
||||
set RsDeployPath=%DeployPath%\Qt-%QtVersion%-%RsBuildConfig%
|
||||
set RsBuildPath=%BuildPath%\Qt-%QtVersion%%RsType%-%RsBuildConfig%
|
||||
set RsDeployPath=%DeployPath%\Qt-%QtVersion%%RsType%-%RsBuildConfig%
|
||||
set RsPackPath=%DeployPath%
|
||||
set RsArchiveAdd=
|
||||
|
||||
|
@ -1,19 +1,19 @@
|
||||
:: Usage:
|
||||
:: call git-log.bat [no-ask]
|
||||
:: call git-log.bat standard|retrotor [no-ask]
|
||||
|
||||
@echo off
|
||||
|
||||
setlocal
|
||||
|
||||
set NoAsk=
|
||||
if "%~1"=="no-ask" set NoAsk=1
|
||||
if "%~2"=="no-ask" set NoAsk=1
|
||||
|
||||
:: Initialize environment
|
||||
call "%~dp0..\env.bat"
|
||||
if errorlevel 1 goto error_env
|
||||
call "%EnvPath%\env.bat"
|
||||
if errorlevel 1 goto error_env
|
||||
call "%~dp0env.bat"
|
||||
call "%~dp0env.bat" %1
|
||||
if errorlevel 1 goto error_env
|
||||
|
||||
:: Check git executable
|
||||
@ -58,7 +58,7 @@ for /f "tokens=2 delims==" %%I in ('wmic os get localdatetime /format:list') do
|
||||
set RsDate=%RsDate:~0,4%%RsDate:~4,2%%RsDate:~6,2%
|
||||
|
||||
:: Get last revision
|
||||
set RsLastRefFile=%BuildPath%\Qt-%QtVersion%-%RsBuildConfig%-LastRef.txt
|
||||
set RsLastRefFile=%BuildPath%\Qt-%QtVersion%%RsType%-%RsBuildConfig%-LastRef.txt
|
||||
set RsLastRef=
|
||||
if exist "%RsLastRefFile%" set /P RsLastRef=<"%RsLastRefFile%"
|
||||
|
||||
@ -86,9 +86,9 @@ if %errorlevel%==2 exit /B 1
|
||||
:no_confirm
|
||||
|
||||
if "%RsBuildConfig%" NEQ "release" (
|
||||
set RsGitLog=%DeployPath%\RetroShare-%RsVersion%-Windows-Portable-%RsDate%-%RsRevision%-Qt-%QtVersion%%RsArchiveAdd%-%RsBuildConfig%.txt
|
||||
set RsGitLog=%DeployPath%\RetroShare-%RsVersion%-Windows-Portable-%RsDate%-%RsRevision%-Qt-%QtVersion%%RsType%%RsArchiveAdd%-%RsBuildConfig%.txt
|
||||
) else (
|
||||
set RsGitLog=%DeployPath%\RetroShare-%RsVersion%-Windows-Portable-%RsDate%-%RsRevision%-Qt-%QtVersion%%RsArchiveAdd%.txt
|
||||
set RsGitLog=%DeployPath%\RetroShare-%RsVersion%-Windows-Portable-%RsDate%-%RsRevision%-Qt-%QtVersion%%RsType%%RsArchiveAdd%.txt
|
||||
)
|
||||
|
||||
title %SourceName%-%RsBuildConfig% [git log]
|
||||
|
@ -10,21 +10,18 @@ if errorlevel 1 goto error_env
|
||||
call "%EnvPath%\env.bat"
|
||||
if errorlevel 1 goto error_env
|
||||
|
||||
:: Get gcc versions
|
||||
call "%ToolsPath%\get-gcc-version.bat" GCCVersion
|
||||
if "%GCCVersion%"=="" echo Cannot get gcc version.& exit /B 1
|
||||
:: Initialize environment
|
||||
call "%~dp0env.bat" %*
|
||||
if errorlevel 2 exit /B 2
|
||||
if errorlevel 1 goto error_env
|
||||
|
||||
:: Check external libraries
|
||||
if not exist "%RootPath%\libs" echo Please build external libraries first.& exit /B 1
|
||||
if not exist "%BuildLibsPath%\libs" %cecho% error "Please build external libraries first." & exit /B 1
|
||||
|
||||
:: Check gcc version of external libraries
|
||||
if not exist "%RootPath%\libs\gcc-version" echo Cannot get gcc version of external libraries.& exit /B 1
|
||||
set /P LibsGCCVersion=<"%RootPath%\libs\gcc-version"
|
||||
if "%LibsGCCVersion%" NEQ "%GCCVersion%" echo Please use correct version of external libraries. (gcc %GCCVersion% ^<^> libs %LibsGCCVersion%).& exit /B 1
|
||||
|
||||
:: Initialize environment
|
||||
call "%~dp0env.bat"
|
||||
if errorlevel 1 goto error_env
|
||||
if not exist "%BuildLibsPath%\libs\gcc-version" %cecho% error "Cannot get gcc version of external libraries." & exit /B 1
|
||||
set /P LibsGCCVersion=<"%BuildLibsPath%\libs\gcc-version"
|
||||
if "%LibsGCCVersion%" NEQ "%GCCVersion%" %cecho% error "Please use correct version of external libraries. (gcc %GCCVersion% ^<^> libs %LibsGCCVersion%)." & exit /B 1
|
||||
|
||||
:: Remove deploy path
|
||||
if exist "%RsDeployPath%" rmdir /S /Q "%RsDeployPath%"
|
||||
@ -65,6 +62,17 @@ set RsDate=
|
||||
for /f "tokens=2 delims==" %%I in ('wmic os get localdatetime /format:list') do set RsDate=%%I
|
||||
set RsDate=%RsDate:~0,4%%RsDate:~4,2%%RsDate:~6,2%
|
||||
|
||||
if "%RsRetroTor%"=="1" (
|
||||
:: Check Retrotor
|
||||
if not exist "%EnvDownloadPath%\tor\Tor\tor.exe" (
|
||||
echo Tor binary not found. Please download Tor Expert Bundle from
|
||||
echo https://www.torproject.org/download/download.html.en
|
||||
echo and unpack to
|
||||
echo %EnvDownloadPath%\tor
|
||||
goto error
|
||||
)
|
||||
)
|
||||
|
||||
set QtMainVersion=%QtVersion:~0,1%
|
||||
|
||||
rem Qt 4 = QtSvg4.dll
|
||||
@ -75,9 +83,9 @@ if "%QtMainVersion%"=="4" set QtMainVersion2=4
|
||||
if "%QtMainVersion%"=="5" set QtMainVersion1=5
|
||||
|
||||
if "%RsBuildConfig%" NEQ "release" (
|
||||
set Archive=%RsPackPath%\RetroShare-%RsVersion%-Windows-Portable-%RsDate%-%RsRevision%-Qt-%QtVersion%%RsArchiveAdd%-%RsBuildConfig%.7z
|
||||
set Archive=%RsPackPath%\RetroShare-%RsVersion%-Windows-Portable-%RsDate%-%RsRevision%-Qt-%QtVersion%%RsType%%RsArchiveAdd%-%RsBuildConfig%.7z
|
||||
) else (
|
||||
set Archive=%RsPackPath%\RetroShare-%RsVersion%-Windows-Portable-%RsDate%-%RsRevision%-Qt-%QtVersion%%RsArchiveAdd%.7z
|
||||
set Archive=%RsPackPath%\RetroShare-%RsVersion%-Windows-Portable-%RsDate%-%RsRevision%-Qt-%QtVersion%%RsType%%RsArchiveAdd%.7z
|
||||
)
|
||||
|
||||
if exist "%Archive%" del /Q "%Archive%"
|
||||
@ -85,7 +93,7 @@ if exist "%Archive%" del /Q "%Archive%"
|
||||
:: Create deploy path
|
||||
mkdir "%RsDeployPath%"
|
||||
|
||||
title Pack - %SourceName%-%RsBuildConfig% [copy files]
|
||||
title Pack - %SourceName%%RsType%-%RsBuildConfig% [copy files]
|
||||
|
||||
set ExtensionsFile=%SourcePath%\libretroshare\src\rsserver\rsinit.cc
|
||||
set Extensions=
|
||||
@ -128,6 +136,12 @@ if "%QtMainVersion%"=="5" (
|
||||
copy "%QtPath%\..\plugins\audio\qtaudio_windows.dll" "%RsDeployPath%\audio" %Quite%
|
||||
)
|
||||
|
||||
if exist "%QtPath%\..\plugins\styles\qwindowsvistastyle.dll" (
|
||||
echo Copy styles
|
||||
mkdir "%RsDeployPath%\styles" %Quite%
|
||||
copy "%QtPath%\..\plugins\styles\qwindowsvistastyle.dll" "%RsDeployPath%\styles" %Quite%
|
||||
)
|
||||
|
||||
copy "%QtPath%\..\plugins\imageformats\*.dll" "%RsDeployPath%\imageformats" %Quite%
|
||||
del /Q "%RsDeployPath%\imageformats\*d?.dll" %Quite%
|
||||
|
||||
@ -166,8 +180,13 @@ if exist "%SourcePath%\libresapi\src\webui" (
|
||||
xcopy /S "%SourcePath%\libresapi\src\webui" "%RsDeployPath%\webui" %Quite%
|
||||
)
|
||||
|
||||
if "%RsRetroTor%"=="1" (
|
||||
echo copy tor
|
||||
echo n | copy /-y "%EnvDownloadPath%\tor\Tor\*.*" "%RsDeployPath%" %Quite%
|
||||
)
|
||||
|
||||
rem pack files
|
||||
title Pack - %SourceName%-%RsBuildConfig% [pack files]
|
||||
title Pack - %SourceName%%RsType%-%RsBuildConfig% [pack files]
|
||||
|
||||
"%EnvSevenZipExe%" a -mx=9 -t7z "%Archive%" "%RsDeployPath%\*"
|
||||
|
||||
|
@ -52,7 +52,8 @@ mingw-get.exe install msys-autoconf
|
||||
mingw-get.exe install msys-automake
|
||||
mingw-get.exe install msys-autogen
|
||||
mingw-get.exe install msys-mktemp
|
||||
mingw-get.exe install msys-wget
|
||||
rem Use own wget binary, because MSYS version of wget is to old
|
||||
rem mingw-get.exe install msys-wget
|
||||
popd
|
||||
|
||||
%cecho% info "Unpack CMake"
|
||||
|
@ -4,11 +4,11 @@ if "%EnvRootPath%"=="" exit /B 1
|
||||
|
||||
set CEchoUrl=https://github.com/lordmulder/cecho/releases/download/2015-10-10/cecho.2015-10-10.zip
|
||||
set CEchoInstall=cecho.2015-10-10.zip
|
||||
set SevenZipUrl=http://7-zip.org/a/7z1602.msi
|
||||
set SevenZipInstall=7z1602.msi
|
||||
set SevenZipUrl=https://sourceforge.net/projects/sevenzip/files/7-Zip/18.05/7z1805.msi/download
|
||||
set SevenZipInstall=7z1805.msi
|
||||
::set CurlUrl=https://bintray.com/artifact/download/vszakats/generic/curl-7.50.1-win32-mingw.7z
|
||||
::set CurlInstall=curl-7.50.1-win32-mingw.7z
|
||||
set WgetUrl=https://eternallybored.org/misc/wget/current/wget.exe
|
||||
set WgetUrl=https://eternallybored.org/misc/wget/1.19.4/32/wget.exe
|
||||
set WgetInstall=wget.exe
|
||||
set JomUrl=http://download.qt.io/official_releases/jom/jom.zip
|
||||
set JomInstall=jom.zip
|
||||
@ -20,13 +20,23 @@ set NSISUrl=http://prdownloads.sourceforge.net/nsis/nsis-3.0-setup.exe?download
|
||||
set NSISInstall=nsis-3.0-setup.exe
|
||||
set NSISInstallPath=%EnvToolsPath%\NSIS
|
||||
|
||||
if not exist "%EnvToolsPath%\wget.exe" (
|
||||
echo Download Wget installation
|
||||
|
||||
if not exist "%EnvDownloadPath%\%WgetInstall%" call "%ToolsPath%\winhttpjs.bat" %WgetUrl% -saveTo "%EnvDownloadPath%\%WgetInstall%"
|
||||
if not exist "%EnvDownloadPath%\%WgetInstall%" %cecho% error "Cannot download Wget installation" & goto error
|
||||
|
||||
echo Copy Wget
|
||||
copy "%EnvDownloadPath%\wget.exe" "%EnvToolsPath%"
|
||||
)
|
||||
|
||||
if not exist "%EnvToolsPath%\7z.exe" (
|
||||
call "%ToolsPath%\remove-dir.bat" "%EnvTempPath%"
|
||||
mkdir "%EnvTempPath%"
|
||||
|
||||
echo Download 7z installation
|
||||
|
||||
if not exist "%EnvDownloadPath%\%SevenZipInstall%" call "%ToolsPath%\winhttpjs.bat" %SevenZipUrl% -saveTo "%EnvDownloadPath%\%SevenZipInstall%"
|
||||
if not exist "%EnvDownloadPath%\%SevenZipInstall%" call "%ToolsPath%\download-file.bat" "%SevenZipUrl%" "%EnvDownloadPath%\%SevenZipInstall%"
|
||||
if not exist "%EnvDownloadPath%\%SevenZipInstall%" echo Cannot download 7z installation& goto error
|
||||
|
||||
echo Unpack 7z
|
||||
@ -69,16 +79,6 @@ if not exist "%EnvToolsPath%\cecho.exe" (
|
||||
:: call "%ToolsPath%\remove-dir.bat" "%EnvTempPath%"
|
||||
::)
|
||||
|
||||
if not exist "%EnvToolsPath%\wget.exe" (
|
||||
%cecho% info "Download Wget installation"
|
||||
|
||||
if not exist "%EnvDownloadPath%\%WgetInstall%" call "%ToolsPath%\winhttpjs.bat" %WgetUrl% -saveTo "%EnvDownloadPath%\%WgetInstall%"
|
||||
if not exist "%EnvDownloadPath%\%WgetInstall%" %cecho% error "Cannot download Wget installation" & goto error
|
||||
|
||||
%cecho% info "Copy Wget"
|
||||
copy "%EnvDownloadPath%\wget.exe" "%EnvToolsPath%"
|
||||
)
|
||||
|
||||
if not exist "%EnvToolsPath%\jom.exe" (
|
||||
call "%ToolsPath%\remove-dir.bat" "%EnvTempPath%"
|
||||
mkdir "%EnvTempPath%"
|
||||
@ -118,7 +118,7 @@ if not exist "%EnvToolsPath%\cut.exe" (
|
||||
%cecho% info "Download Unix Tools installation"
|
||||
|
||||
if not exist "%EnvDownloadPath%\%UnixToolsInstall%" call "%ToolsPath%\winhttpjs.bat" %UnixToolsUrl% -saveTo "%EnvDownloadPath%\%UnixToolsInstall%"
|
||||
if not exist "%EnvDownloadPath%\%UnixToolsInstall%" %cecho% error ""Cannot download Unix Tools installation" & goto error
|
||||
if not exist "%EnvDownloadPath%\%UnixToolsInstall%" %cecho% error "Cannot download Unix Tools installation" & goto error
|
||||
|
||||
%cecho% info "Unpack Unix Tools"
|
||||
"%EnvSevenZipExe%" x -o"%EnvTempPath%" "%EnvDownloadPath%\%UnixToolsInstall%"
|
||||
@ -134,7 +134,7 @@ if not exist "%EnvToolsPath%\sed.exe" (
|
||||
%cecho% info "Download Unix Tools installation"
|
||||
|
||||
if not exist "%EnvDownloadPath%\%UnixToolsInstall%" call "%ToolsPath%\winhttpjs.bat" %UnixToolsUrl% -saveTo "%EnvDownloadPath%\%UnixToolsInstall%"
|
||||
if not exist "%EnvDownloadPath%\%UnixToolsInstall%" %cecho% error ""Cannot download Unix Tools installation" & goto error
|
||||
if not exist "%EnvDownloadPath%\%UnixToolsInstall%" %cecho% error "Cannot download Unix Tools installation" & goto error
|
||||
|
||||
%cecho% info "Unpack Unix Tools"
|
||||
"%EnvSevenZipExe%" x -o"%EnvTempPath%" "%EnvDownloadPath%\%UnixToolsInstall%"
|
||||
|
@ -195,11 +195,15 @@ Section $(Section_Main) Section_Main
|
||||
|
||||
; Qt audio
|
||||
SetOutPath "$INSTDIR\audio"
|
||||
File /r "${QTDIR}\plugins\audio\qtaudio_windows.dll"
|
||||
File "${QTDIR}\plugins\audio\qtaudio_windows.dll"
|
||||
|
||||
; Qt platforms
|
||||
SetOutPath "$INSTDIR\platforms"
|
||||
File /r "${QTDIR}\plugins\platforms\qwindows.dll"
|
||||
File "${QTDIR}\plugins\platforms\qwindows.dll"
|
||||
|
||||
; Qt styles
|
||||
SetOutPath "$INSTDIR\styles"
|
||||
File /NONFATAL "${QTDIR}\plugins\styles\qwindowsvistastyle.dll"
|
||||
|
||||
; MinGW binaries
|
||||
SetOutPath "$INSTDIR"
|
||||
|
@ -8,6 +8,6 @@ if "%~2"=="" (
|
||||
)
|
||||
|
||||
::"%EnvCurlExe%" -L -k "%~1" -o "%~2"
|
||||
"%EnvWgetExe%" --continue "%~1" --output-document="%~2"
|
||||
"%EnvWgetExe%" --no-check-certificate --continue "%~1" --output-document="%~2"
|
||||
|
||||
exit /B %ERRORLEVEL%
|
||||
|
@ -72,7 +72,7 @@ bdNodeManager::bdNodeManager(bdNodeId *id, std::string dhtVersion, std::string b
|
||||
:bdNode(id, dhtVersion, bootfile, filterfile, fns, this)
|
||||
{
|
||||
mMode = BITDHT_MGR_STATE_OFF;
|
||||
mFns = fns;
|
||||
mDhtFns = fns;
|
||||
mModeTS = 0 ;
|
||||
mStartTS = 0;
|
||||
mSearchingDone = false;
|
||||
@ -87,7 +87,7 @@ bdNodeManager::bdNodeManager(bdNodeId *id, std::string dhtVersion, std::string b
|
||||
|
||||
#ifdef DEBUG_MGR
|
||||
std::cerr << "bdNodeManager::bdNodeManager() ID: ";
|
||||
mFns->bdPrintNodeId(std::cerr, id);
|
||||
mDhtFns->bdPrintNodeId(std::cerr, id);
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
@ -188,7 +188,7 @@ void bdNodeManager::addFindNode(bdNodeId *id, uint32_t qflags)
|
||||
{
|
||||
#ifdef DEBUG_MGR
|
||||
std::cerr << "bdNodeManager::addFindNode() ";
|
||||
mFns->bdPrintNodeId(std::cerr, id);
|
||||
mDhtFns->bdPrintNodeId(std::cerr, id);
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
/* check if exists already */
|
||||
@ -257,7 +257,7 @@ void bdNodeManager::removeFindNode(bdNodeId *id)
|
||||
{
|
||||
#ifdef DEBUG_MGR
|
||||
std::cerr << "bdNodeManager::removeFindNode() ";
|
||||
mFns->bdPrintNodeId(std::cerr, id);
|
||||
mDhtFns->bdPrintNodeId(std::cerr, id);
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
std::map<bdNodeId, bdQueryPeer>::iterator it;
|
||||
@ -525,7 +525,7 @@ int bdNodeManager::QueryRandomLocalNet()
|
||||
else
|
||||
{
|
||||
/* calculate mid point */
|
||||
mFns->bdRandomMidId(&mOwnId, &(id.id), &targetNodeId);
|
||||
mDhtFns->bdRandomMidId(&mOwnId, &(id.id), &targetNodeId);
|
||||
}
|
||||
|
||||
/* do standard find_peer message */
|
||||
@ -534,13 +534,13 @@ int bdNodeManager::QueryRandomLocalNet()
|
||||
|
||||
#ifdef DEBUG_MGR
|
||||
std::cerr << "bdNodeManager::QueryRandomLocalNet() Querying : ";
|
||||
mFns->bdPrintId(std::cerr, &id);
|
||||
mDhtFns->bdPrintId(std::cerr, &id);
|
||||
std::cerr << " searching for : ";
|
||||
mFns->bdPrintNodeId(std::cerr, &targetNodeId);
|
||||
mDhtFns->bdPrintNodeId(std::cerr, &targetNodeId);
|
||||
|
||||
bdMetric dist;
|
||||
mFns->bdDistance(&targetNodeId, &(mOwnId), &dist);
|
||||
int bucket = mFns->bdBucketDistance(&dist);
|
||||
mDhtFns->bdDistance(&targetNodeId, &(mOwnId), &dist);
|
||||
int bucket = mDhtFns->bdBucketDistance(&dist);
|
||||
std::cerr << " in Bucket: " << bucket;
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
@ -593,7 +593,7 @@ void bdNodeManager::SearchForLocalNet()
|
||||
{
|
||||
#ifdef DEBUG_MGR
|
||||
std::cerr << "bdNodeManager::SearchForLocalNet() Existing Internal Search: ";
|
||||
mFns->bdPrintNodeId(std::cerr, &(it->first));
|
||||
mDhtFns->bdPrintNodeId(std::cerr, &(it->first));
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
@ -630,7 +630,7 @@ void bdNodeManager::SearchForLocalNet()
|
||||
{
|
||||
#ifdef DEBUG_MGR
|
||||
std::cerr << "bdNodeManager::SearchForLocalNet() " << i << " Attempts to find OkNode: ";
|
||||
mFns->bdPrintNodeId(std::cerr, &targetNodeId);
|
||||
mDhtFns->bdPrintNodeId(std::cerr, &targetNodeId);
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
}
|
||||
@ -638,7 +638,7 @@ void bdNodeManager::SearchForLocalNet()
|
||||
{
|
||||
#ifdef DEBUG_MGR
|
||||
std::cerr << "bdNodeManager::SearchForLocalNet() Failed to Find FilterOk this time: ";
|
||||
mFns->bdPrintNodeId(std::cerr, &targetNodeId);
|
||||
mDhtFns->bdPrintNodeId(std::cerr, &targetNodeId);
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
}
|
||||
@ -649,7 +649,7 @@ void bdNodeManager::SearchForLocalNet()
|
||||
|
||||
#ifdef DEBUG_MGR
|
||||
std::cerr << "bdNodeManager::SearchForLocalNet() Adding New Internal Search: ";
|
||||
mFns->bdPrintNodeId(std::cerr, &(targetNodeId));
|
||||
mDhtFns->bdPrintNodeId(std::cerr, &(targetNodeId));
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
}
|
||||
@ -709,7 +709,7 @@ int bdNodeManager::checkStatus()
|
||||
{
|
||||
#ifdef DEBUG_MGR
|
||||
std::cerr << "bdNodeManager::checkStatus() Query in Progress id: ";
|
||||
mFns->bdPrintNodeId(std::cerr, &(it->first));
|
||||
mDhtFns->bdPrintNodeId(std::cerr, &(it->first));
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
}
|
||||
@ -719,7 +719,7 @@ int bdNodeManager::checkStatus()
|
||||
{
|
||||
#ifdef DEBUG_MGR
|
||||
std::cerr << "bdNodeManager::checkStatus() Query Failed: id: ";
|
||||
mFns->bdPrintNodeId(std::cerr, &(it->first));
|
||||
mDhtFns->bdPrintNodeId(std::cerr, &(it->first));
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
// BAD.
|
||||
@ -733,7 +733,7 @@ int bdNodeManager::checkStatus()
|
||||
{
|
||||
#ifdef DEBUG_MGR
|
||||
std::cerr << "bdNodeManager::checkStatus() Found Closest: id: ";
|
||||
mFns->bdPrintNodeId(std::cerr, &(it->first));
|
||||
mDhtFns->bdPrintNodeId(std::cerr, &(it->first));
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
@ -747,7 +747,7 @@ int bdNodeManager::checkStatus()
|
||||
{
|
||||
#ifdef DEBUG_MGR
|
||||
std::cerr << "bdNodeManager::checkStatus() the Peer Online but Unreachable: id: ";
|
||||
mFns->bdPrintNodeId(std::cerr, &(it->first));
|
||||
mDhtFns->bdPrintNodeId(std::cerr, &(it->first));
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
||||
@ -761,7 +761,7 @@ int bdNodeManager::checkStatus()
|
||||
{
|
||||
#ifdef DEBUG_MGR
|
||||
std::cerr << "bdNodeManager::checkStatus() Found Query: id: ";
|
||||
mFns->bdPrintNodeId(std::cerr, &(it->first));
|
||||
mDhtFns->bdPrintNodeId(std::cerr, &(it->first));
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
//foundId =
|
||||
@ -803,7 +803,7 @@ int bdNodeManager::checkStatus()
|
||||
doCallback = false;
|
||||
#ifdef DEBUG_MGR
|
||||
std::cerr << "bdNodeManager::checkStatus() Internal: no cb for id: ";
|
||||
mFns->bdPrintNodeId(std::cerr, &(it->first));
|
||||
mDhtFns->bdPrintNodeId(std::cerr, &(it->first));
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
}
|
||||
@ -1024,7 +1024,7 @@ int bdNodeManager::getDhtPeerAddress(const bdNodeId *id, struct sockaddr_in &fro
|
||||
{
|
||||
#ifdef DEBUG_MGR
|
||||
std::cerr << "bdNodeManager::getDhtPeerAddress() Id: ";
|
||||
mFns->bdPrintNodeId(std::cerr, id);
|
||||
mDhtFns->bdPrintNodeId(std::cerr, id);
|
||||
std::cerr << " ... ? TODO" << std::endl;
|
||||
#else
|
||||
(void) id;
|
||||
@ -1034,7 +1034,7 @@ int bdNodeManager::getDhtPeerAddress(const bdNodeId *id, struct sockaddr_in &fro
|
||||
pit = mActivePeers.find(*id);
|
||||
|
||||
std::cerr << "bdNodeManager::getDhtPeerAddress() Id: ";
|
||||
mFns->bdPrintNodeId(std::cerr, id);
|
||||
mDhtFns->bdPrintNodeId(std::cerr, id);
|
||||
std::cerr << std::endl;
|
||||
|
||||
if (pit != mActivePeers.end())
|
||||
@ -1061,7 +1061,7 @@ int bdNodeManager::getDhtValue(const bdNodeId *id, std::string key, std::string
|
||||
{
|
||||
#ifdef DEBUG_MGR
|
||||
std::cerr << "bdNodeManager::getDhtValue() Id: ";
|
||||
mFns->bdPrintNodeId(std::cerr, id);
|
||||
mDhtFns->bdPrintNodeId(std::cerr, id);
|
||||
std::cerr << " key: " << key;
|
||||
std::cerr << " ... ? TODO" << std::endl;
|
||||
#else
|
||||
@ -1144,7 +1144,7 @@ void bdNodeManager::doNodeCallback(const bdId *id, uint32_t peerflags)
|
||||
{
|
||||
#ifdef DEBUG_MGR
|
||||
std::cerr << "bdNodeManager::doNodeCallback() ";
|
||||
mFns->bdPrintId(std::cerr, id);
|
||||
mDhtFns->bdPrintId(std::cerr, id);
|
||||
std::cerr << "peerflags: " << peerflags;
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
@ -1163,7 +1163,7 @@ void bdNodeManager::doPeerCallback(const bdId *id, uint32_t status)
|
||||
|
||||
#ifdef DEBUG_MGR
|
||||
std::cerr << "bdNodeManager::doPeerCallback()";
|
||||
mFns->bdPrintId(std::cerr, id);
|
||||
mDhtFns->bdPrintId(std::cerr, id);
|
||||
std::cerr << "status: " << status;
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
|
@ -184,7 +184,7 @@ void SearchForLocalNet();
|
||||
time_t mSearchTS;
|
||||
bool mSearchingDone;
|
||||
|
||||
bdDhtFunctions *mFns;
|
||||
bdDhtFunctions *mDhtFns;
|
||||
|
||||
uint32_t mNetworkSize;
|
||||
uint32_t mBdNetworkSize;
|
||||
|
@ -518,7 +518,7 @@ void bdNode::checkPotentialPeer(bdId *id, bdId *src)
|
||||
#ifndef DISABLE_BAD_PEER_FILTER
|
||||
std::cerr << "bdNode::checkPotentialPeer(";
|
||||
mFns->bdPrintId(std::cerr, id);
|
||||
std::cerr << ") MASQARADING AS KNOWN PEER - FLAGGING AS BAD";
|
||||
std::cerr << ") MASQUERADING AS KNOWN PEER - FLAGGING AS BAD";
|
||||
std::cerr << std::endl;
|
||||
|
||||
// Stores in queue for later callback and desemination around the network.
|
||||
@ -603,7 +603,7 @@ void bdNode::addPeer(const bdId *id, uint32_t peerflags)
|
||||
std::cerr << "bdNode::addPeer(";
|
||||
mFns->bdPrintId(std::cerr, id);
|
||||
std::cerr << ", " << std::hex << peerflags << std::dec;
|
||||
std::cerr << ") MASQARADING AS KNOWN PEER - FLAGGING AS BAD";
|
||||
std::cerr << ") MASQUERADING AS KNOWN PEER - FLAGGING AS BAD";
|
||||
std::cerr << std::endl;
|
||||
|
||||
|
||||
|
@ -6,23 +6,10 @@ CONFIG -= qt
|
||||
TARGET = bitdht
|
||||
DESTDIR = lib
|
||||
|
||||
!include("use_libbitdht.pri"):error("Including")
|
||||
|
||||
QMAKE_CXXFLAGS *= -Wall -DBE_DEBUG
|
||||
|
||||
profiling {
|
||||
QMAKE_CXXFLAGS -= -fomit-frame-pointer
|
||||
QMAKE_CXXFLAGS *= -pg -g -fno-omit-frame-pointer
|
||||
}
|
||||
|
||||
release {
|
||||
# not much here yet.
|
||||
}
|
||||
|
||||
#CONFIG += debug
|
||||
debug {
|
||||
QMAKE_CXXFLAGS -= -O2 -fomit-frame-pointer
|
||||
QMAKE_CXXFLAGS *= -g -fno-omit-frame-pointer
|
||||
}
|
||||
|
||||
# treat warnings as error for better removing
|
||||
#QMAKE_CFLAGS += -Werror
|
||||
#QMAKE_CXXFLAGS += -Werror
|
||||
|
5
libbitdht/src/use_libbitdht.pri
Normal file
5
libbitdht/src/use_libbitdht.pri
Normal file
@ -0,0 +1,5 @@
|
||||
DEPENDPATH *= $$system_path($$clean_path($${PWD}/../../libbitdht/src))
|
||||
INCLUDEPATH *= $$system_path($$clean_path($${PWD}/../../libbitdht/src))
|
||||
LIBS *= -L$$system_path($$clean_path($${OUT_PWD}/../../libbitdht/src/lib/)) -lbitdht
|
||||
|
||||
!equals(TARGET, bitdht):PRE_TARGETDEPS *= $$system_path($$clean_path($${OUT_PWD}/../../libbitdht/src/lib/libbitdht.a))
|
@ -17,7 +17,7 @@
|
||||
#include "ChannelsHandler.h"
|
||||
#include "StatsHandler.h"
|
||||
|
||||
#ifdef LIBRESAPI_QT
|
||||
#ifdef LIBRESAPI_SETTINGS
|
||||
#include "SettingsHandler.h"
|
||||
#endif
|
||||
|
||||
@ -240,9 +240,9 @@ public:
|
||||
mTransfersHandler(sts, ifaces.mFiles, ifaces.mPeers, *ifaces.mNotify),
|
||||
mChatHandler(sts, ifaces.mNotify, ifaces.mMsgs, ifaces.mPeers, ifaces.mIdentity, &mPeersHandler),
|
||||
mApiPluginHandler(sts, ifaces),
|
||||
mChannelsHandler(ifaces.mGxsChannels),
|
||||
mChannelsHandler(*ifaces.mGxsChannels),
|
||||
mStatsHandler()
|
||||
#ifdef LIBRESAPI_QT
|
||||
#ifdef LIBRESAPI_SETTINGS
|
||||
,mSettingsHandler(sts)
|
||||
#endif
|
||||
{
|
||||
@ -272,7 +272,7 @@ public:
|
||||
&ChannelsHandler::handleRequest);
|
||||
router.addResourceHandler("stats", dynamic_cast<ResourceRouter*>(&mStatsHandler),
|
||||
&StatsHandler::handleRequest);
|
||||
#ifdef LIBRESAPI_QT
|
||||
#ifdef LIBRESAPI_SETTINGS
|
||||
router.addResourceHandler("settings", dynamic_cast<ResourceRouter*>(&mSettingsHandler),
|
||||
&SettingsHandler::handleRequest);
|
||||
#endif
|
||||
@ -290,7 +290,7 @@ public:
|
||||
ChannelsHandler mChannelsHandler;
|
||||
StatsHandler mStatsHandler;
|
||||
|
||||
#ifdef LIBRESAPI_QT
|
||||
#ifdef LIBRESAPI_SETTINGS
|
||||
SettingsHandler mSettingsHandler;
|
||||
#endif
|
||||
};
|
||||
|
@ -369,6 +369,9 @@ static void secure_queue_response(MHD_Connection *connection, unsigned int statu
|
||||
// tell Internet Explorer to not do content sniffing
|
||||
MHD_add_response_header(response, "X-Content-Type-Options", "nosniff");
|
||||
|
||||
// Prevent clickjacking attacks (also prevented by CSP, but not in all browsers, including FireFox)
|
||||
MHD_add_response_header(response, "X-Frame-Options", "SAMEORIGIN");
|
||||
|
||||
// Content security policy header, its a new technology and not implemented everywhere
|
||||
|
||||
// get own host name as the browser sees it
|
||||
|
@ -1,8 +1,29 @@
|
||||
/*
|
||||
* RetroShare JSON API
|
||||
* Copyright (C) 2018 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 "ChannelsHandler.h"
|
||||
|
||||
#include <retroshare/rsgxschannels.h>
|
||||
#include <util/radix64.h>
|
||||
#include <util/rstime.h>
|
||||
#include <algorithm>
|
||||
#include <time.h>
|
||||
|
||||
#include "Operators.h"
|
||||
|
||||
namespace resource_api
|
||||
@ -21,22 +42,414 @@ StreamBase& operator << (StreamBase& left, RsGxsFile& file)
|
||||
{
|
||||
double size = 0;
|
||||
left << makeKeyValueReference("size", size);
|
||||
file.mSize = size;
|
||||
file.mSize = size;
|
||||
}
|
||||
return left;
|
||||
}
|
||||
|
||||
ChannelsHandler::ChannelsHandler(RsGxsChannels *channels):
|
||||
mChannels(channels)
|
||||
ChannelsHandler::ChannelsHandler(RsGxsChannels& channels): mChannels(channels)
|
||||
{
|
||||
addResourceHandler("create_post", this, &ChannelsHandler::handleCreatePost);
|
||||
addResourceHandler("list_channels", this,
|
||||
&ChannelsHandler::handleListChannels);
|
||||
addResourceHandler("get_channel_info", this, &ChannelsHandler::handleGetChannelInfo);
|
||||
addResourceHandler("get_channel_content", this, &ChannelsHandler::handleGetChannelContent);
|
||||
addResourceHandler("toggle_subscribe", this, &ChannelsHandler::handleToggleSubscription);
|
||||
addResourceHandler("toggle_auto_download", this, &ChannelsHandler::handleToggleAutoDownload);
|
||||
addResourceHandler("toggle_read", this, &ChannelsHandler::handleTogglePostRead);
|
||||
addResourceHandler("create_channel", this, &ChannelsHandler::handleCreateChannel);
|
||||
addResourceHandler("create_post", this, &ChannelsHandler::handleCreatePost);
|
||||
}
|
||||
|
||||
ResponseTask* ChannelsHandler::handleCreatePost(Request &req, Response &resp)
|
||||
void ChannelsHandler::handleListChannels(Request& /*req*/, Response& resp)
|
||||
{
|
||||
RsTokReqOptions opts;
|
||||
opts.mReqType = GXS_REQUEST_TYPE_GROUP_META;
|
||||
uint32_t token;
|
||||
|
||||
RsTokenService& tChannels = *mChannels.getTokenService();
|
||||
|
||||
tChannels.requestGroupInfo(token, RS_DEPRECATED_TOKREQ_ANSTYPE, opts);
|
||||
|
||||
time_t start = time(NULL);
|
||||
while((tChannels.requestStatus(token) != RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE)
|
||||
&&(tChannels.requestStatus(token) != RsTokenService::GXS_REQUEST_V2_STATUS_FAILED)
|
||||
&&((time(NULL) < (start+10)))) rstime::rs_usleep(500*1000);
|
||||
|
||||
std::list<RsGroupMetaData> grps;
|
||||
if( tChannels.requestStatus(token) == RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE
|
||||
&& mChannels.getGroupSummary(token, grps) )
|
||||
{
|
||||
for( RsGroupMetaData& grp : grps )
|
||||
{
|
||||
KeyValueReference<RsGxsGroupId> id("channel_id", grp.mGroupId);
|
||||
KeyValueReference<uint32_t> vis_msg("visible_msg_count", grp.mVisibleMsgCount);
|
||||
bool own = (grp.mSubscribeFlags & GXS_SERV::GROUP_SUBSCRIBE_ADMIN);
|
||||
bool subscribed = IS_GROUP_SUBSCRIBED(grp.mSubscribeFlags);
|
||||
std::string lastPostTsStr = std::to_string(grp.mLastPost);
|
||||
std::string publishTsStr = std::to_string(grp.mPublishTs);
|
||||
resp.mDataStream.getStreamToMember()
|
||||
<< id
|
||||
<< makeKeyValueReference("name", grp.mGroupName)
|
||||
<< makeKeyValueReference("last_post_ts", lastPostTsStr)
|
||||
<< makeKeyValueReference("popularity", grp.mPop)
|
||||
<< makeKeyValueReference("publish_ts", publishTsStr)
|
||||
<< vis_msg
|
||||
<< makeKeyValueReference("group_status", grp.mGroupStatus)
|
||||
<< makeKeyValueReference("author_id", grp.mAuthorId)
|
||||
<< makeKeyValueReference("parent_grp_id", grp.mParentGrpId)
|
||||
<< makeKeyValueReference("own", own)
|
||||
<< makeKeyValueReference("subscribed", subscribed);
|
||||
}
|
||||
|
||||
resp.setOk();
|
||||
}
|
||||
else resp.setFail("Cant get data from GXS!");
|
||||
}
|
||||
|
||||
void ChannelsHandler::handleGetChannelInfo(Request& req, Response& resp)
|
||||
{
|
||||
std::string chanIdStr;
|
||||
req.mStream << makeKeyValueReference("channel_id", chanIdStr);
|
||||
if(chanIdStr.empty())
|
||||
{
|
||||
resp.setFail("channel_id required!");
|
||||
return;
|
||||
}
|
||||
|
||||
RsGxsGroupId chanId(chanIdStr);
|
||||
if(chanId.isNull())
|
||||
{
|
||||
resp.setFail("Invalid channel_id:" + chanIdStr);
|
||||
return;
|
||||
}
|
||||
|
||||
bool wantThumbnail = true;
|
||||
req.mStream << makeKeyValueReference("want_thumbnail", wantThumbnail);
|
||||
|
||||
std::list<RsGxsGroupId> groupIds; groupIds.push_back(chanId);
|
||||
RsTokReqOptions opts;
|
||||
opts.mReqType = GXS_REQUEST_TYPE_GROUP_DATA;
|
||||
uint32_t token;
|
||||
|
||||
RsTokenService& tChannels = *mChannels.getTokenService();
|
||||
tChannels.requestGroupInfo( token, RS_DEPRECATED_TOKREQ_ANSTYPE,
|
||||
opts, groupIds );
|
||||
|
||||
time_t start = time(NULL);
|
||||
while((tChannels.requestStatus(token) != RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE)
|
||||
&&(tChannels.requestStatus(token) != RsTokenService::GXS_REQUEST_V2_STATUS_FAILED)
|
||||
&&((time(NULL) < (start+10)))) rstime::rs_usleep(500*1000);
|
||||
|
||||
std::vector<RsGxsChannelGroup> grps;
|
||||
if( tChannels.requestStatus(token) == RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE
|
||||
&& mChannels.getGroupData(token, grps) )
|
||||
{
|
||||
for( RsGxsChannelGroup& grp : grps )
|
||||
{
|
||||
KeyValueReference<RsGxsGroupId> id("channel_id", grp.mMeta.mGroupId);
|
||||
KeyValueReference<uint32_t> vis_msg("visible_msg_count", grp.mMeta.mVisibleMsgCount);
|
||||
bool own = (grp.mMeta.mSubscribeFlags & GXS_SERV::GROUP_SUBSCRIBE_ADMIN);
|
||||
bool subscribed = IS_GROUP_SUBSCRIBED(grp.mMeta.mSubscribeFlags);
|
||||
std::string lastPostTsStr = std::to_string(grp.mMeta.mLastPost);
|
||||
std::string publishTsStr = std::to_string(grp.mMeta.mPublishTs);
|
||||
StreamBase& rgrp(resp.mDataStream.getStreamToMember());
|
||||
rgrp << id
|
||||
<< makeKeyValueReference("name", grp.mMeta.mGroupName)
|
||||
<< makeKeyValueReference("last_post_ts", lastPostTsStr)
|
||||
<< makeKeyValueReference("popularity", grp.mMeta.mPop)
|
||||
<< makeKeyValueReference("publish_ts", publishTsStr)
|
||||
<< vis_msg
|
||||
<< makeKeyValueReference("group_status", grp.mMeta.mGroupStatus)
|
||||
<< makeKeyValueReference("author_id", grp.mMeta.mAuthorId)
|
||||
<< makeKeyValueReference("parent_grp_id", grp.mMeta.mParentGrpId)
|
||||
<< makeKeyValueReference("description", grp.mDescription)
|
||||
<< makeKeyValueReference("own", own)
|
||||
<< makeKeyValueReference("subscribed", subscribed)
|
||||
<< makeKeyValueReference("auto_download", grp.mAutoDownload);
|
||||
|
||||
if(wantThumbnail)
|
||||
{
|
||||
std::string thumbnail_base64;
|
||||
Radix64::encode(grp.mImage.mData, grp.mImage.mSize, thumbnail_base64);
|
||||
rgrp << makeKeyValueReference("thumbnail_base64_png", thumbnail_base64);
|
||||
}
|
||||
}
|
||||
|
||||
resp.setOk();
|
||||
}
|
||||
else resp.setFail("Cant get data from GXS!");
|
||||
}
|
||||
|
||||
void ChannelsHandler::handleGetChannelContent(Request& req, Response& resp)
|
||||
{
|
||||
std::string chanIdStr;
|
||||
req.mStream << makeKeyValueReference("channel_id", chanIdStr);
|
||||
if(chanIdStr.empty())
|
||||
{
|
||||
resp.setFail("channel_id required!");
|
||||
return;
|
||||
}
|
||||
|
||||
RsGxsGroupId chanId(chanIdStr);
|
||||
if(chanId.isNull())
|
||||
{
|
||||
resp.setFail("Invalid channel_id:" + chanIdStr);
|
||||
return;
|
||||
}
|
||||
|
||||
std::list<RsGxsGroupId> groupIds; groupIds.push_back(chanId);
|
||||
uint32_t token;
|
||||
RsTokReqOptions opts;
|
||||
opts.mReqType = GXS_REQUEST_TYPE_MSG_DATA;
|
||||
|
||||
if(! mChannels.getTokenService()->
|
||||
requestMsgInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, groupIds) )
|
||||
{
|
||||
resp.setFail("Unknown GXS error!");
|
||||
return;
|
||||
}
|
||||
|
||||
time_t start = time(NULL);
|
||||
while((mChannels.getTokenService()->requestStatus(token) != RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE)
|
||||
&&(mChannels.getTokenService()->requestStatus(token) != RsTokenService::GXS_REQUEST_V2_STATUS_FAILED)
|
||||
&&((time(NULL) < (start+10)))) rstime::rs_usleep(500*1000);
|
||||
|
||||
std::vector<RsGxsChannelPost> posts;
|
||||
std::vector<RsGxsComment> comments;
|
||||
if( mChannels.getTokenService()->requestStatus(token) ==
|
||||
RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE &&
|
||||
mChannels.getPostData(token, posts, comments) )
|
||||
{
|
||||
for( std::vector<RsGxsChannelPost>::iterator vit = posts.begin();
|
||||
vit != posts.end(); ++vit )
|
||||
{
|
||||
RsGxsChannelPost& post = *vit;
|
||||
RsMsgMetaData& pMeta = post.mMeta;
|
||||
resp.mDataStream.getStreamToMember()
|
||||
<< makeKeyValueReference("channel_id", pMeta.mGroupId)
|
||||
<< makeKeyValueReference("name", pMeta.mMsgName)
|
||||
<< makeKeyValueReference("post_id", pMeta.mMsgId)
|
||||
<< makeKeyValueReference("parent_id", pMeta.mParentId)
|
||||
<< makeKeyValueReference("author_id", pMeta.mAuthorId)
|
||||
<< makeKeyValueReference("orig_msg_id", pMeta.mOrigMsgId)
|
||||
<< makeKeyValueReference("thread_id", pMeta.mThreadId)
|
||||
<< makeKeyValueReference("message", post.mMsg);
|
||||
}
|
||||
|
||||
for( std::vector<RsGxsComment>::iterator vit = comments.begin();
|
||||
vit != comments.end(); ++vit )
|
||||
{
|
||||
RsGxsComment& comment = *vit;
|
||||
RsMsgMetaData& cMeta = comment.mMeta;
|
||||
std::string scoreStr = std::to_string(comment.mScore);
|
||||
resp.mDataStream.getStreamToMember()
|
||||
<< makeKeyValueReference("channel_id", cMeta.mGroupId)
|
||||
<< makeKeyValueReference("name", cMeta.mMsgName)
|
||||
<< makeKeyValueReference("comment_id", cMeta.mMsgId)
|
||||
<< makeKeyValueReference("parent_id", cMeta.mParentId)
|
||||
<< makeKeyValueReference("author_id", cMeta.mAuthorId)
|
||||
<< makeKeyValueReference("orig_msg_id", cMeta.mOrigMsgId)
|
||||
<< makeKeyValueReference("thread_id", cMeta.mThreadId)
|
||||
<< makeKeyValueReference("score", scoreStr)
|
||||
<< makeKeyValueReference("message", comment.mComment);
|
||||
}
|
||||
|
||||
resp.setOk();
|
||||
}
|
||||
else resp.setFail("Cant get data from GXS!");
|
||||
}
|
||||
|
||||
void ChannelsHandler::handleToggleSubscription(Request& req, Response& resp)
|
||||
{
|
||||
std::string chanIdStr;
|
||||
bool subscribe = true;
|
||||
|
||||
req.mStream << makeKeyValueReference("channel_id", chanIdStr)
|
||||
<< makeKeyValueReference("subscribe", subscribe);
|
||||
|
||||
if(chanIdStr.empty())
|
||||
{
|
||||
resp.setFail("channel_id required!");
|
||||
return;
|
||||
}
|
||||
|
||||
RsGxsGroupId chanId(chanIdStr);
|
||||
if(chanId.isNull())
|
||||
{
|
||||
resp.setFail("Invalid channel_id:" + chanIdStr);
|
||||
return;
|
||||
}
|
||||
|
||||
uint32_t token;
|
||||
if(mChannels.subscribeToGroup(token, chanId, subscribe))
|
||||
{
|
||||
RsTokenService& tChannels = *mChannels.getTokenService();
|
||||
|
||||
time_t start = time(NULL);
|
||||
while((tChannels.requestStatus(token) != RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE)
|
||||
&&(tChannels.requestStatus(token) != RsTokenService::GXS_REQUEST_V2_STATUS_FAILED)
|
||||
&&((time(NULL) < (start+10)))) rstime::rs_usleep(500*1000);
|
||||
|
||||
if(tChannels.requestStatus(token) == RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE)
|
||||
resp.setOk();
|
||||
else resp.setFail("Unknown GXS error!");
|
||||
}
|
||||
else resp.setFail("Unknown GXS error!");
|
||||
}
|
||||
|
||||
void ChannelsHandler::handleCreateChannel(Request& req, Response& resp)
|
||||
{
|
||||
RsGxsChannelGroup chan;
|
||||
RsGroupMetaData& cMeta = chan.mMeta;
|
||||
std::string authorIdStr;
|
||||
std::string thumbnail_base64;
|
||||
|
||||
req.mStream << makeKeyValueReference("author_id", authorIdStr)
|
||||
<< makeKeyValueReference("name", cMeta.mGroupName)
|
||||
<< makeKeyValueReference("description", chan.mDescription)
|
||||
<< makeKeyValueReference("thumbnail_base64_png", thumbnail_base64);
|
||||
|
||||
if(cMeta.mGroupName.empty())
|
||||
{
|
||||
resp.setFail("Channel name required!");
|
||||
return;
|
||||
}
|
||||
|
||||
if(thumbnail_base64.empty()) chan.mImage.clear();
|
||||
else
|
||||
{
|
||||
std::vector<uint8_t> png_data = Radix64::decode(thumbnail_base64);
|
||||
if(!png_data.empty())
|
||||
{
|
||||
if(png_data.size() < 8)
|
||||
{
|
||||
resp.setFail("Decoded thumbnail_base64_png is smaller than 8 byte. This can't be a valid png file!");
|
||||
return;
|
||||
}
|
||||
uint8_t png_magic_number[] = {0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a};
|
||||
if(!std::equal(&png_magic_number[0],&png_magic_number[8],png_data.begin()))
|
||||
{
|
||||
resp.setFail("Decoded thumbnail_base64_png does not seem to be a png file. (Header is missing magic number)");
|
||||
return;
|
||||
}
|
||||
chan.mImage.copy(png_data.data(), png_data.size());
|
||||
}
|
||||
}
|
||||
|
||||
if(!authorIdStr.empty()) cMeta.mAuthorId = RsGxsId(authorIdStr);
|
||||
|
||||
// ATM supports creating only public channels
|
||||
cMeta.mGroupFlags = GXS_SERV::FLAG_PRIVACY_PUBLIC;
|
||||
|
||||
// I am not sure about those flags I have reversed them with the debugger
|
||||
// that gives 520 as value of this member when a channel with default
|
||||
// options is created from Qt Gui
|
||||
cMeta.mSignFlags = GXS_SERV::MSG_AUTHEN_CHILD_AUTHOR_SIGN |
|
||||
GXS_SERV::FLAG_AUTHOR_AUTHENTICATION_REQUIRED;
|
||||
|
||||
uint32_t token;
|
||||
if(mChannels.createGroup(token, chan))
|
||||
{
|
||||
RsTokenService& tChannels = *mChannels.getTokenService();
|
||||
|
||||
time_t start = time(NULL);
|
||||
while((tChannels.requestStatus(token) != RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE)
|
||||
&&(tChannels.requestStatus(token) != RsTokenService::GXS_REQUEST_V2_STATUS_FAILED)
|
||||
&&((time(NULL) < (start+10)))) rstime::rs_usleep(500*1000);
|
||||
|
||||
if(tChannels.requestStatus(token) == RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE)
|
||||
resp.setOk();
|
||||
else resp.setFail("Unknown GXS error!");
|
||||
}
|
||||
else resp.setFail("Unkown GXS error!");
|
||||
}
|
||||
|
||||
void ChannelsHandler::handleToggleAutoDownload(Request& req, Response& resp)
|
||||
{
|
||||
|
||||
std::string chanIdStr;
|
||||
bool autoDownload = true;
|
||||
|
||||
req.mStream << makeKeyValueReference("channel_id", chanIdStr)
|
||||
<< makeKeyValueReference("auto_download", autoDownload);
|
||||
|
||||
if(chanIdStr.empty())
|
||||
{
|
||||
resp.setFail("channel_id required!");
|
||||
return;
|
||||
}
|
||||
|
||||
RsGxsGroupId chanId(chanIdStr);
|
||||
if(chanId.isNull())
|
||||
{
|
||||
resp.setFail("Invalid channel_id:" + chanIdStr);
|
||||
return;
|
||||
}
|
||||
|
||||
if(mChannels.setChannelAutoDownload(chanId, autoDownload))
|
||||
resp.setOk();
|
||||
else resp.setFail();
|
||||
}
|
||||
|
||||
void ChannelsHandler::handleTogglePostRead(Request& req, Response& resp)
|
||||
{
|
||||
std::string chanIdStr;
|
||||
std::string postIdStr;
|
||||
bool read = true;
|
||||
|
||||
req.mStream << makeKeyValueReference("channel_id", chanIdStr)
|
||||
<< makeKeyValueReference("post_id", postIdStr)
|
||||
<< makeKeyValueReference("read", read);
|
||||
|
||||
if(chanIdStr.empty())
|
||||
{
|
||||
resp.setFail("channel_id required!");
|
||||
return;
|
||||
}
|
||||
|
||||
RsGxsGroupId chanId(chanIdStr);
|
||||
if(chanId.isNull())
|
||||
{
|
||||
resp.setFail("Invalid channel_id:" + chanIdStr);
|
||||
return;
|
||||
}
|
||||
|
||||
if(postIdStr.empty())
|
||||
{
|
||||
resp.setFail("post_id required!");
|
||||
return;
|
||||
}
|
||||
|
||||
RsGxsMessageId postId(postIdStr);
|
||||
if(postId.isNull())
|
||||
{
|
||||
resp.setFail("Invalid post_id:" + postIdStr);
|
||||
return;
|
||||
}
|
||||
|
||||
std::cerr << __PRETTY_FUNCTION__ << " " << chanIdStr << " " << postIdStr
|
||||
<< " " << read << std::endl;
|
||||
|
||||
uint32_t token;
|
||||
mChannels.setMessageReadStatus(token, std::make_pair(chanId,postId), read);
|
||||
|
||||
RsTokenService& tChannels = *mChannels.getTokenService();
|
||||
|
||||
time_t start = time(NULL);
|
||||
while((tChannels.requestStatus(token) != RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE)
|
||||
&&(tChannels.requestStatus(token) != RsTokenService::GXS_REQUEST_V2_STATUS_FAILED)
|
||||
&&((time(NULL) < (start+10)))) rstime::rs_usleep(500*1000);
|
||||
|
||||
if(tChannels.requestStatus(token) == RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE)
|
||||
resp.setOk();
|
||||
else resp.setFail("Unknown GXS error!");
|
||||
}
|
||||
|
||||
void ChannelsHandler::handleCreatePost(Request &req, Response &resp)
|
||||
{
|
||||
RsGxsChannelPost post;
|
||||
|
||||
req.mStream << makeKeyValueReference("group_id", post.mMeta.mGroupId);
|
||||
req.mStream << makeKeyValueReference("channel_id", post.mMeta.mGroupId);
|
||||
req.mStream << makeKeyValueReference("subject", post.mMeta.mMsgName);
|
||||
req.mStream << makeKeyValueReference("message", post.mMsg);
|
||||
|
||||
@ -53,36 +466,36 @@ ResponseTask* ChannelsHandler::handleCreatePost(Request &req, Response &resp)
|
||||
|
||||
if(post.mMeta.mGroupId.isNull())
|
||||
{
|
||||
resp.setFail("groupd_id is null");
|
||||
return 0;
|
||||
resp.setFail("groupd_id is null");
|
||||
return;
|
||||
}
|
||||
if(post.mMeta.mMsgName.empty())
|
||||
{
|
||||
resp.setFail("subject is empty");
|
||||
return 0;
|
||||
resp.setFail("subject is empty");
|
||||
return;
|
||||
}
|
||||
if(post.mMsg.empty())
|
||||
{
|
||||
resp.setFail("msg text is empty");
|
||||
return 0;
|
||||
resp.setFail("msg text is empty");
|
||||
return;
|
||||
}
|
||||
// empty file list is ok, but files have to be valid
|
||||
for(std::list<RsGxsFile>::iterator lit = post.mFiles.begin(); lit != post.mFiles.end(); ++lit)
|
||||
{
|
||||
if(lit->mHash.isNull())
|
||||
{
|
||||
resp.setFail("at least one file hash is empty");
|
||||
return 0;
|
||||
resp.setFail("at least one file hash is empty");
|
||||
return;
|
||||
}
|
||||
if(lit->mName.empty())
|
||||
{
|
||||
resp.setFail("at leats one file name is empty");
|
||||
return 0;
|
||||
resp.setFail("at leats one file name is empty");
|
||||
return;
|
||||
}
|
||||
if(lit->mSize == 0)
|
||||
{
|
||||
resp.setFail("at least one file size is empty");
|
||||
return 0;
|
||||
resp.setFail("at least one file size is empty");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@ -91,22 +504,33 @@ ResponseTask* ChannelsHandler::handleCreatePost(Request &req, Response &resp)
|
||||
{
|
||||
if(png_data.size() < 8)
|
||||
{
|
||||
resp.setFail("Decoded thumbnail_base64_png is smaller than 8 byte. This can't be a valid png file!");
|
||||
return 0;
|
||||
resp.setFail("Decoded thumbnail_base64_png is smaller than 8 byte. This can't be a valid png file!");
|
||||
return;
|
||||
}
|
||||
uint8_t png_magic_number[] = {0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a};
|
||||
if(!std::equal(&png_magic_number[0],&png_magic_number[8],png_data.begin()))
|
||||
{
|
||||
resp.setFail("Decoded thumbnail_base64_png does not seem to be a png file. (Header is missing magic number)");
|
||||
return 0;
|
||||
resp.setFail("Decoded thumbnail_base64_png does not seem to be a png file. (Header is missing magic number)");
|
||||
return;
|
||||
}
|
||||
post.mThumbnail.copy(png_data.data(), png_data.size());
|
||||
}
|
||||
|
||||
uint32_t token;
|
||||
mChannels->createPost(token, post);
|
||||
// TODO: grp creation acknowledge
|
||||
return 0;
|
||||
if(mChannels.createPost(token, post))
|
||||
{
|
||||
RsTokenService& tChannels = *mChannels.getTokenService();
|
||||
|
||||
time_t start = time(NULL);
|
||||
while((tChannels.requestStatus(token) != RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE)
|
||||
&&(tChannels.requestStatus(token) != RsTokenService::GXS_REQUEST_V2_STATUS_FAILED)
|
||||
&&((time(NULL) < (start+10)))) rstime::rs_usleep(500*1000);
|
||||
|
||||
if(tChannels.requestStatus(token) == RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE)
|
||||
resp.setOk();
|
||||
else resp.setFail("Unknown GXS error!");
|
||||
}
|
||||
else resp.setFail("Unknown GXS error!");
|
||||
}
|
||||
|
||||
} // namespace resource_api
|
||||
|
@ -1,4 +1,21 @@
|
||||
#pragma once
|
||||
/*
|
||||
* RetroShare JSON API
|
||||
* Copyright (C) 2018 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"
|
||||
|
||||
@ -7,15 +24,21 @@ class RsGxsChannels;
|
||||
namespace resource_api
|
||||
{
|
||||
|
||||
class ChannelsHandler : public ResourceRouter
|
||||
struct ChannelsHandler : ResourceRouter
|
||||
{
|
||||
public:
|
||||
ChannelsHandler(RsGxsChannels* channels);
|
||||
ChannelsHandler(RsGxsChannels& channels);
|
||||
|
||||
private:
|
||||
ResponseTask* handleCreatePost(Request& req, Response& resp);
|
||||
void handleListChannels(Request& req, Response& resp);
|
||||
void handleGetChannelInfo(Request& req, Response& resp);
|
||||
void handleGetChannelContent(Request& req, Response& resp);
|
||||
void handleToggleSubscription(Request& req, Response& resp);
|
||||
void handleCreateChannel(Request& req, Response& resp);
|
||||
void handleToggleAutoDownload(Request& req, Response& resp);
|
||||
void handleTogglePostRead(Request& req, Response& resp);
|
||||
void handleCreatePost(Request& req, Response& resp);
|
||||
|
||||
RsGxsChannels* mChannels;
|
||||
RsGxsChannels& mChannels;
|
||||
};
|
||||
|
||||
} // namespace resource_api
|
||||
|
@ -37,6 +37,16 @@ FileSharingHandler::FileSharingHandler(StateTokenServer *sts, RsFiles *files,
|
||||
addResourceHandler("get_dir_parent", this, &FileSharingHandler::handleGetDirectoryParent);
|
||||
addResourceHandler("get_dir_childs", this, &FileSharingHandler::handleGetDirectoryChilds);
|
||||
|
||||
addResourceHandler( "get_download_directory", this,
|
||||
&FileSharingHandler::handleGetDownloadDirectory );
|
||||
addResourceHandler( "set_download_directory", this,
|
||||
&FileSharingHandler::handleSetDownloadDirectory );
|
||||
|
||||
addResourceHandler( "get_partials_directory", this,
|
||||
&FileSharingHandler::handleGetPartialsDirectory );
|
||||
addResourceHandler( "set_partials_directory", this,
|
||||
&FileSharingHandler::handleSetPartialsDirectory );
|
||||
|
||||
addResourceHandler("is_dl_dir_shared", this, &FileSharingHandler::handleIsDownloadDirShared);
|
||||
addResourceHandler("share_dl_dir", this, &FileSharingHandler::handleShareDownloadDirectory);
|
||||
|
||||
@ -513,4 +523,48 @@ void FileSharingHandler::handleDownload(Request& req, Response& resp)
|
||||
resp.setFail("Couldn't download file");
|
||||
}
|
||||
|
||||
void FileSharingHandler::handleGetDownloadDirectory( Request& /*req*/,
|
||||
Response& resp )
|
||||
{
|
||||
std::string dlDir = mRsFiles->getDownloadDirectory();
|
||||
resp.mDataStream << makeKeyValueReference("download_directory", dlDir);
|
||||
resp.setOk();
|
||||
}
|
||||
|
||||
void FileSharingHandler::handleSetDownloadDirectory( Request& req,
|
||||
Response& resp )
|
||||
{
|
||||
std::string dlDir;
|
||||
req.mStream << makeKeyValueReference("download_directory", dlDir);
|
||||
|
||||
if(dlDir.empty()) resp.setFail("missing download_directory");
|
||||
else
|
||||
{
|
||||
mRsFiles->setDownloadDirectory(dlDir);
|
||||
resp.setOk();
|
||||
}
|
||||
}
|
||||
|
||||
void FileSharingHandler::handleGetPartialsDirectory( Request& /*req*/,
|
||||
Response& resp )
|
||||
{
|
||||
std::string partialsDir = mRsFiles->getPartialsDirectory();
|
||||
resp.mDataStream << makeKeyValueReference("partials_directory", partialsDir);
|
||||
resp.setOk();
|
||||
}
|
||||
|
||||
void FileSharingHandler::handleSetPartialsDirectory( Request& req,
|
||||
Response& resp )
|
||||
{
|
||||
std::string partialsDir;
|
||||
req.mStream << makeKeyValueReference("partials_directory", partialsDir);
|
||||
|
||||
if(partialsDir.empty()) resp.setFail("missing partials_directory");
|
||||
else
|
||||
{
|
||||
mRsFiles->setPartialsDirectory(partialsDir);
|
||||
resp.setOk();
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace resource_api
|
||||
|
@ -57,6 +57,12 @@ private:
|
||||
|
||||
void handleDownload(Request& req, Response& resp);
|
||||
|
||||
void handleGetDownloadDirectory(Request& req, Response& resp);
|
||||
void handleSetDownloadDirectory(Request& req, Response& resp);
|
||||
|
||||
void handleGetPartialsDirectory(Request& req, Response& resp);
|
||||
void handleSetPartialsDirectory(Request& req, Response& resp);
|
||||
|
||||
/// Token indicating change in local shared files
|
||||
StateToken mLocalDirStateToken;
|
||||
|
||||
|
@ -15,6 +15,14 @@ TransfersHandler::TransfersHandler(StateTokenServer *sts, RsFiles *files, RsPeer
|
||||
addResourceHandler("downloads", this, &TransfersHandler::handleDownloads);
|
||||
addResourceHandler("uploads", this, &TransfersHandler::handleUploads);
|
||||
addResourceHandler("control_download", this, &TransfersHandler::handleControlDownload);
|
||||
|
||||
addResourceHandler( "set_file_destination_directory", this,
|
||||
&TransfersHandler::handleSetFileDestinationDirectory );
|
||||
addResourceHandler( "set_file_destination_name", this,
|
||||
&TransfersHandler::handleSetFileDestinationName );
|
||||
addResourceHandler( "set_file_chunk_strategy", this,
|
||||
&TransfersHandler::handleSetFileChunkStrategy );
|
||||
|
||||
mStateToken = mStateTokenServer->getNewToken();
|
||||
mStateTokenServer->registerTickClient(this);
|
||||
mNotify.registerNotifyClient(this);
|
||||
@ -288,4 +296,58 @@ void TransfersHandler::handleUploads(Request & /* req */, Response &resp)
|
||||
resp.setOk();
|
||||
}
|
||||
|
||||
void TransfersHandler::handleSetFileDestinationDirectory( Request& req,
|
||||
Response& resp )
|
||||
{
|
||||
mStateTokenServer->replaceToken(mStateToken);
|
||||
|
||||
std::string hashString;
|
||||
std::string newPath;
|
||||
req.mStream << makeKeyValueReference("path", newPath);
|
||||
req.mStream << makeKeyValueReference("hash", hashString);
|
||||
RsFileHash hash(hashString);
|
||||
|
||||
if (mFiles->setDestinationDirectory(hash, newPath)) resp.setOk();
|
||||
else resp.setFail();
|
||||
}
|
||||
|
||||
void TransfersHandler::handleSetFileDestinationName( Request& req,
|
||||
Response& resp )
|
||||
{
|
||||
mStateTokenServer->replaceToken(mStateToken);
|
||||
|
||||
std::string hashString;
|
||||
std::string newName;
|
||||
req.mStream << makeKeyValueReference("name", newName);
|
||||
req.mStream << makeKeyValueReference("hash", hashString);
|
||||
RsFileHash hash(hashString);
|
||||
|
||||
if (mFiles->setDestinationName(hash, newName)) resp.setOk();
|
||||
else resp.setFail();
|
||||
}
|
||||
|
||||
void TransfersHandler::handleSetFileChunkStrategy(Request& req, Response& resp)
|
||||
{
|
||||
mStateTokenServer->replaceToken(mStateToken);
|
||||
|
||||
std::string hashString;
|
||||
std::string newChunkStrategyStr;
|
||||
req.mStream << makeKeyValueReference("chuck_stategy", newChunkStrategyStr);
|
||||
req.mStream << makeKeyValueReference("hash", hashString);
|
||||
|
||||
RsFileHash hash(hashString);
|
||||
FileChunksInfo::ChunkStrategy newStrategy =
|
||||
FileChunksInfo::CHUNK_STRATEGY_PROGRESSIVE;
|
||||
|
||||
if ( newChunkStrategyStr == "streaming" )
|
||||
newStrategy = FileChunksInfo::CHUNK_STRATEGY_STREAMING;
|
||||
else if ( newChunkStrategyStr == "random" )
|
||||
newStrategy = FileChunksInfo::CHUNK_STRATEGY_RANDOM;
|
||||
else if ( newChunkStrategyStr == "progressive" )
|
||||
newStrategy = FileChunksInfo::CHUNK_STRATEGY_PROGRESSIVE;
|
||||
|
||||
if (mFiles->setChunkStrategy(hash, newStrategy)) resp.setOk();
|
||||
else resp.setFail();
|
||||
}
|
||||
|
||||
} // namespace resource_api
|
||||
|
@ -30,6 +30,9 @@ private:
|
||||
void handleControlDownload(Request& req, Response& resp);
|
||||
void handleDownloads(Request& req, Response& resp);
|
||||
void handleUploads(Request& req, Response& resp);
|
||||
void handleSetFileDestinationDirectory(Request& req, Response& resp);
|
||||
void handleSetFileDestinationName(Request& req, Response& resp);
|
||||
void handleSetFileChunkStrategy(Request& req, Response& resp);
|
||||
|
||||
StateTokenServer* mStateTokenServer;
|
||||
RsFiles* mFiles;
|
||||
|
@ -2,50 +2,26 @@
|
||||
|
||||
TEMPLATE = lib
|
||||
CONFIG += staticlib
|
||||
CONFIG += create_prl
|
||||
CONFIG -= qt
|
||||
TARGET = resapi
|
||||
TARGET_PRL = libresapi
|
||||
DESTDIR = lib
|
||||
|
||||
DEPENDPATH += ../../libretroshare/src/
|
||||
!include(use_libresapi.pri):error("Including")
|
||||
|
||||
INCLUDEPATH += ../../libretroshare/src
|
||||
|
||||
libresapilocalserver {
|
||||
SOURCES *= api/ApiServerLocal.cpp
|
||||
HEADERS *= api/ApiServerLocal.h
|
||||
}
|
||||
|
||||
retroshare_android_service {
|
||||
win32 {
|
||||
OBJECTS_DIR = temp/obj
|
||||
|
||||
LIBS_DIR = $$PWD/../../libs/lib
|
||||
LIBS += $$OUT_PWD/../../libretroshare/src/lib/libretroshare.a
|
||||
LIBS += $$OUT_PWD/../../openpgpsdk/src/lib/libops.a
|
||||
|
||||
for(lib, LIB_DIR):LIBS += -L"$$lib"
|
||||
for(bin, BIN_DIR):LIBS += -L"$$bin"
|
||||
|
||||
|
||||
LIBS += -lssl -lcrypto -lpthread -lminiupnpc -lz -lws2_32
|
||||
LIBS += -luuid -lole32 -liphlpapi -lcrypt32 -lgdi32
|
||||
LIBS += -lwinmm
|
||||
|
||||
DEFINES *= WINDOWS_SYS WIN32_LEAN_AND_MEAN _USE_32BIT_TIME_T
|
||||
|
||||
DEPENDPATH += . $$INC_DIR
|
||||
INCLUDEPATH += . $$INC_DIR
|
||||
|
||||
greaterThan(QT_MAJOR_VERSION, 4) {
|
||||
# Qt 5
|
||||
RC_INCLUDEPATH += $$_PRO_FILE_PWD_/../../libretroshare/src
|
||||
} else {
|
||||
# Qt 4
|
||||
QMAKE_RC += --include-dir=$$_PRO_FILE_PWD_/../../libretroshare/src
|
||||
}
|
||||
}
|
||||
libresapi_settings {
|
||||
SOURCES += api/SettingsHandler.cpp
|
||||
HEADERS += api/SettingsHandler.h
|
||||
}
|
||||
|
||||
libresapihttpserver {
|
||||
CONFIG += libmicrohttpd
|
||||
|
||||
unix {
|
||||
|
||||
webui_files.path = "$${DATA_DIR}/webui"
|
||||
@ -121,20 +97,13 @@ libresapihttpserver {
|
||||
DEFINES *= WINDOWS_SYS
|
||||
INCLUDEPATH += . $$INC_DIR
|
||||
|
||||
greaterThan(QT_MAJOR_VERSION, 4) {
|
||||
# Qt 5
|
||||
PRO_PATH=$$shell_path($$_PRO_FILE_PWD_)
|
||||
MAKE_SRC=$$shell_path($$PRO_PATH/webui-src/make-src)
|
||||
} else {
|
||||
# Qt 4
|
||||
PRO_PATH=$$replace(_PRO_FILE_PWD_, /, \\)
|
||||
MAKE_SRC=$$PRO_PATH\\webui-src\\make-src
|
||||
}
|
||||
PRO_PATH=$$shell_path($$_PRO_FILE_PWD_)
|
||||
MAKE_SRC=$$shell_path($$PRO_PATH/webui-src/make-src)
|
||||
|
||||
#create_webfiles.commands = $$MAKE_SRC\\build.bat $$PRO_PATH
|
||||
#QMAKE_EXTRA_TARGETS += create_webfiles
|
||||
#PRE_TARGETDEPS += create_webfiles
|
||||
QMAKE_POST_LINK=$$MAKE_SRC\\build.bat $$PRO_PATH
|
||||
#create_webfiles.commands = $$MAKE_SRC\\build.bat $$PRO_PATH
|
||||
#QMAKE_EXTRA_TARGETS += create_webfiles
|
||||
#PRE_TARGETDEPS += create_webfiles
|
||||
QMAKE_POST_LINK=$$MAKE_SRC\\build.bat $$PRO_PATH
|
||||
|
||||
# create dummy files
|
||||
system($$MAKE_SRC\\init.bat .)
|
||||
@ -211,18 +180,3 @@ HEADERS += \
|
||||
api/ChannelsHandler.h \
|
||||
api/StatsHandler.h \
|
||||
api/FileSharingHandler.h
|
||||
|
||||
libresapilocalserver {
|
||||
CONFIG *= qt
|
||||
QT *= network
|
||||
SOURCES *= api/ApiServerLocal.cpp
|
||||
HEADERS *= api/ApiServerLocal.h
|
||||
}
|
||||
|
||||
qt_dependencies {
|
||||
CONFIG *= qt
|
||||
QT *= core
|
||||
|
||||
SOURCES += api/SettingsHandler.cpp
|
||||
HEADERS += api/SettingsHandler.h
|
||||
}
|
||||
|
37
libresapi/src/use_libresapi.pri
Normal file
37
libresapi/src/use_libresapi.pri
Normal file
@ -0,0 +1,37 @@
|
||||
DEPENDPATH *= $$system_path($$clean_path($$PWD/../../libresapi/src))
|
||||
INCLUDEPATH *= $$system_path($$clean_path($${PWD}/../../libresapi/src))
|
||||
LIBS *= -L$$system_path($$clean_path($${OUT_PWD}/../../libresapi/src/lib/)) -lresapi
|
||||
|
||||
!equals(TARGET, resapi):PRE_TARGETDEPS *= $$system_path($$clean_path($${OUT_PWD}/../../libresapi/src/lib/libresapi.a))
|
||||
|
||||
!include("../../libretroshare/src/use_libretroshare.pri"):error("Including")
|
||||
|
||||
sLibs =
|
||||
mLibs =
|
||||
dLibs =
|
||||
|
||||
libresapilocalserver {
|
||||
CONFIG *= qt
|
||||
QT *= network
|
||||
}
|
||||
|
||||
libresapi_settings {
|
||||
CONFIG *= qt
|
||||
QT *= core
|
||||
}
|
||||
|
||||
libresapihttpserver {
|
||||
mLibs *= microhttpd
|
||||
}
|
||||
|
||||
static {
|
||||
sLibs *= $$mLibs
|
||||
} else {
|
||||
dLibs *= $$mLibs
|
||||
}
|
||||
|
||||
LIBS += $$linkStaticLibs(sLibs)
|
||||
PRE_TARGETDEPS += $$pretargetStaticLibs(sLibs)
|
||||
|
||||
LIBS += $$linkDynamicLibs(dLibs)
|
||||
|
@ -30,7 +30,7 @@
|
||||
|
||||
typedef RsPeerId ChatLobbyVirtualPeerId ;
|
||||
|
||||
class RsItem ;
|
||||
struct RsItem;
|
||||
class p3HistoryMgr ;
|
||||
class p3IdService ;
|
||||
class p3ServiceControl;
|
||||
|
@ -205,11 +205,8 @@ 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); }
|
||||
{ RS_SERIAL_PROCESS(store); }
|
||||
|
@ -623,7 +623,7 @@ bool LocalDirectoryStorage::locked_getFileSharingPermissions(const EntryIndex& i
|
||||
|
||||
if(it == mLocalDirs.end())
|
||||
{
|
||||
std::cerr << "(EE) very weird bug: base directory \"" << base_dir << "\" not found in shared dir list." << std::endl;
|
||||
std::cerr << "(II) base directory \"" << base_dir << "\" not found in shared dir list." << std::endl;
|
||||
return false ;
|
||||
}
|
||||
|
||||
|
@ -73,10 +73,23 @@ void LocalDirectoryUpdater::data_tick()
|
||||
{
|
||||
if(now > mDelayBetweenDirectoryUpdates + mLastSweepTime)
|
||||
{
|
||||
if(sweepSharedDirectories())
|
||||
bool some_files_not_ready = false ;
|
||||
|
||||
if(sweepSharedDirectories(some_files_not_ready))
|
||||
{
|
||||
mNeedsFullRecheck = false;
|
||||
mLastSweepTime = now ;
|
||||
if(some_files_not_ready)
|
||||
{
|
||||
mNeedsFullRecheck = true ;
|
||||
mLastSweepTime = now - mDelayBetweenDirectoryUpdates + 60 ; // retry 20 secs from now
|
||||
|
||||
std::cerr << "(II) some files being modified. Will re-scan in 60 secs." << std::endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
mNeedsFullRecheck = false ;
|
||||
mLastSweepTime = now ;
|
||||
}
|
||||
|
||||
mSharedDirectories->notifyTSChanged();
|
||||
mForceUpdate = false ;
|
||||
}
|
||||
@ -111,7 +124,7 @@ void LocalDirectoryUpdater::forceUpdate()
|
||||
mHashCache->togglePauseHashingProcess();
|
||||
}
|
||||
|
||||
bool LocalDirectoryUpdater::sweepSharedDirectories()
|
||||
bool LocalDirectoryUpdater::sweepSharedDirectories(bool& some_files_not_ready)
|
||||
{
|
||||
if(mHashSalt.isNull())
|
||||
{
|
||||
@ -158,8 +171,8 @@ bool LocalDirectoryUpdater::sweepSharedDirectories()
|
||||
#endif
|
||||
existing_dirs.insert(RsDirUtil::removeSymLinks(stored_dir_it.name()));
|
||||
|
||||
recursUpdateSharedDir(stored_dir_it.name(), *stored_dir_it,existing_dirs,1) ; // here we need to use the list that was stored, instead of the shared dir list, because the two
|
||||
// are not necessarily in the same order.
|
||||
recursUpdateSharedDir(stored_dir_it.name(), *stored_dir_it,existing_dirs,1,some_files_not_ready) ; // here we need to use the list that was stored, instead of the shared dir list, because the two
|
||||
// are not necessarily in the same order.
|
||||
}
|
||||
|
||||
RsServer::notify()->notifyListChange(NOTIFY_LIST_DIRLIST_LOCAL, 0);
|
||||
@ -168,7 +181,7 @@ bool LocalDirectoryUpdater::sweepSharedDirectories()
|
||||
return true ;
|
||||
}
|
||||
|
||||
void LocalDirectoryUpdater::recursUpdateSharedDir(const std::string& cumulated_path, DirectoryStorage::EntryIndex indx,std::set<std::string>& existing_directories,uint32_t current_depth)
|
||||
void LocalDirectoryUpdater::recursUpdateSharedDir(const std::string& cumulated_path, DirectoryStorage::EntryIndex indx,std::set<std::string>& existing_directories,uint32_t current_depth,bool& some_files_not_ready)
|
||||
{
|
||||
#ifdef DEBUG_LOCAL_DIR_UPDATER
|
||||
std::cerr << "[directory storage] parsing directory " << cumulated_path << ", index=" << indx << std::endl;
|
||||
@ -187,6 +200,8 @@ void LocalDirectoryUpdater::recursUpdateSharedDir(const std::string& cumulated_p
|
||||
return;
|
||||
}
|
||||
|
||||
time_t now = time(NULL) ;
|
||||
|
||||
if(mNeedsFullRecheck || dirIt.dir_modtime() > dir_local_mod_time) // the > is because we may have changed the virtual name, and therefore the TS wont match.
|
||||
// we only want to detect when the directory has changed on the disk
|
||||
{
|
||||
@ -200,11 +215,23 @@ void LocalDirectoryUpdater::recursUpdateSharedDir(const std::string& cumulated_p
|
||||
{
|
||||
switch(dirIt.file_type())
|
||||
{
|
||||
case librs::util::FolderIterator::TYPE_FILE: subfiles[dirIt.file_name()].modtime = dirIt.file_modtime() ;
|
||||
subfiles[dirIt.file_name()].size = dirIt.file_size();
|
||||
case librs::util::FolderIterator::TYPE_FILE:
|
||||
|
||||
if(dirIt.file_modtime() + MIN_TIME_AFTER_LAST_MODIFICATION < now)
|
||||
{
|
||||
subfiles[dirIt.file_name()].modtime = dirIt.file_modtime() ;
|
||||
subfiles[dirIt.file_name()].size = dirIt.file_size();
|
||||
#ifdef DEBUG_LOCAL_DIR_UPDATER
|
||||
std::cerr << " adding sub-file \"" << dirIt.file_name() << "\"" << std::endl;
|
||||
std::cerr << " adding sub-file \"" << dirIt.file_name() << "\"" << std::endl;
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
some_files_not_ready = true ;
|
||||
|
||||
std::cerr << "(WW) file " << dirIt.file_fullpath() << " is probably being modified. Keeping it for later." << std::endl;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case librs::util::FolderIterator::TYPE_DIR:
|
||||
@ -276,7 +303,7 @@ void LocalDirectoryUpdater::recursUpdateSharedDir(const std::string& cumulated_p
|
||||
#ifdef DEBUG_LOCAL_DIR_UPDATER
|
||||
std::cerr << " recursing into " << stored_dir_it.name() << std::endl;
|
||||
#endif
|
||||
recursUpdateSharedDir(cumulated_path + "/" + stored_dir_it.name(), *stored_dir_it,existing_directories,current_depth+1) ;
|
||||
recursUpdateSharedDir(cumulated_path + "/" + stored_dir_it.name(), *stored_dir_it,existing_directories,current_depth+1,some_files_not_ready) ;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -70,8 +70,8 @@ protected:
|
||||
virtual void hash_callback(uint32_t client_param, const std::string& name, const RsFileHash& hash, uint64_t size);
|
||||
virtual bool hash_confirm(uint32_t client_param) ;
|
||||
|
||||
void recursUpdateSharedDir(const std::string& cumulated_path, DirectoryStorage::EntryIndex indx, std::set<std::string>& existing_directories, uint32_t current_depth);
|
||||
bool sweepSharedDirectories();
|
||||
void recursUpdateSharedDir(const std::string& cumulated_path, DirectoryStorage::EntryIndex indx, std::set<std::string>& existing_directories, uint32_t current_depth,bool& files_not_ready);
|
||||
bool sweepSharedDirectories(bool &some_files_not_ready);
|
||||
|
||||
private:
|
||||
bool filterFile(const std::string& fname) const ; // reponds true if the file passes the ignore lists test.
|
||||
|
@ -34,16 +34,16 @@ static const uint32_t DELAY_BETWEEN_REMOTE_DIRECTORIES_SWEEP = 60 ; // 60 se
|
||||
static const uint32_t DELAY_BEFORE_DELETE_NON_EMPTY_REMOTE_DIR = 60*24*86400 ; // delete non empty remoe directories after 60 days of inactivity
|
||||
static const uint32_t DELAY_BEFORE_DELETE_EMPTY_REMOTE_DIR = 5*24*86400 ; // delete empty remote directories after 5 days of inactivity
|
||||
|
||||
static const std::string HASH_CACHE_DURATION_SS = "HASH_CACHE_DURATION" ; // key string to store hash remembering time
|
||||
static const std::string WATCH_FILE_DURATION_SS = "WATCH_FILES_DELAY" ; // key to store delay before re-checking for new files
|
||||
static const std::string WATCH_FILE_ENABLED_SS = "WATCH_FILES_ENABLED"; // key to store ON/OFF flags for file whatch
|
||||
static const std::string FOLLOW_SYMLINKS_SS = "FOLLOW_SYMLINKS"; // dereference symbolic links, or just ignore them.
|
||||
static const std::string IGNORE_DUPLICATES = "IGNORE_DUPLICATES"; // do not index files that are referenced multiple times because of links
|
||||
static const std::string WATCH_HASH_SALT_SS = "WATCH_HASH_SALT"; // Salt that is used to hash directory names
|
||||
static const std::string IGNORED_PREFIXES_SS = "IGNORED_PREFIXES"; // ignore file prefixes
|
||||
static const std::string IGNORED_SUFFIXES_SS = "IGNORED_SUFFIXES"; // ignore file suffixes
|
||||
static const std::string IGNORE_LIST_FLAGS_SS = "IGNORED_FLAGS"; // ignore file flags
|
||||
static const std::string MAX_SHARE_DEPTH = "MAX_SHARE_DEPTH"; // maximum depth of shared directories
|
||||
static const std::string HASH_CACHE_DURATION_SS = "HASH_CACHE_DURATION" ; // key string to store hash remembering time
|
||||
static const std::string WATCH_FILE_DURATION_SS = "WATCH_FILES_DELAY" ; // key to store delay before re-checking for new files
|
||||
static const std::string WATCH_FILE_ENABLED_SS = "WATCH_FILES_ENABLED"; // key to store ON/OFF flags for file whatch
|
||||
static const std::string FOLLOW_SYMLINKS_SS = "FOLLOW_SYMLINKS"; // dereference symbolic links, or just ignore them.
|
||||
static const std::string IGNORE_DUPLICATES = "IGNORE_DUPLICATES"; // do not index files that are referenced multiple times because of links
|
||||
static const std::string WATCH_HASH_SALT_SS = "WATCH_HASH_SALT"; // Salt that is used to hash directory names
|
||||
static const std::string IGNORED_PREFIXES_SS = "IGNORED_PREFIXES"; // ignore file prefixes
|
||||
static const std::string IGNORED_SUFFIXES_SS = "IGNORED_SUFFIXES"; // ignore file suffixes
|
||||
static const std::string IGNORE_LIST_FLAGS_SS = "IGNORED_FLAGS"; // ignore file flags
|
||||
static const std::string MAX_SHARE_DEPTH = "MAX_SHARE_DEPTH"; // maximum depth of shared directories
|
||||
|
||||
static const std::string FILE_SHARING_DIR_NAME = "file_sharing" ; // hard-coded directory name to store friend file lists, hash cache, etc.
|
||||
static const std::string HASH_CACHE_FILE_NAME = "hash_cache.bin" ; // hard-coded directory name to store encrypted hash cache.
|
||||
@ -51,6 +51,7 @@ static const std::string LOCAL_SHARED_DIRS_FILE_NAME = "local_dir_hierarchy.bin"
|
||||
|
||||
static const uint32_t MIN_INTERVAL_BETWEEN_HASH_CACHE_SAVE = 20 ; // never save hash cache more often than every 20 secs.
|
||||
static const uint32_t MIN_INTERVAL_BETWEEN_REMOTE_DIRECTORY_SAVE = 23 ; // never save remote directories more often than this
|
||||
static const uint32_t MIN_TIME_AFTER_LAST_MODIFICATION = 20 ; // never hash a file that is just being modified, otherwise we end up with a corrupted hash
|
||||
|
||||
static const uint32_t MAX_DIR_SYNC_RESPONSE_DATA_SIZE = 20000 ; // Maximum RsItem data size in bytes for serialised directory transmission
|
||||
static const uint32_t DEFAULT_HASH_STORAGE_DURATION_DAYS = 30 ; // remember deleted/inaccessible files for 30 days
|
||||
|
@ -1,3 +1,28 @@
|
||||
/*
|
||||
* RetroShare C++ File lists IO methods.
|
||||
*
|
||||
* file_sharing/file_tree.h
|
||||
*
|
||||
* Copyright 2017 by csoler
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License Version 2 as published by the Free Software Foundation.
|
||||
*
|
||||
* This library 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
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||
* USA.
|
||||
*
|
||||
* Please report all bugs and problems to "retroshare.project@gmail.com".
|
||||
*
|
||||
*/
|
||||
|
||||
#include "retroshare/rsfiles.h"
|
||||
|
||||
class FileTreeImpl: public FileTree
|
||||
|
@ -39,6 +39,7 @@
|
||||
static const uint32_t SOURCE_CHUNK_MAP_UPDATE_PERIOD = 60 ; //! TTL for chunkmap info
|
||||
static const uint32_t INACTIVE_CHUNK_TIME_LAPSE = 3600 ; //! TTL for an inactive chunk
|
||||
static const uint32_t FT_CHUNKMAP_MAX_CHUNK_JUMP = 50 ; //! Maximum chunk jump in progressive DL mode
|
||||
static const uint32_t FT_CHUNKMAP_MAX_SLICE_REASK_DELAY = 10 ; //! Maximum time to re-ask a slice to another peer at end of transfer
|
||||
|
||||
std::ostream& operator<<(std::ostream& o,const ftChunk& c)
|
||||
{
|
||||
@ -120,7 +121,7 @@ void ChunkMap::setAvailabilityMap(const CompressedChunkMap& map)
|
||||
}
|
||||
}
|
||||
|
||||
void ChunkMap::dataReceived(const ftChunk::ChunkId& cid)
|
||||
void ChunkMap::dataReceived(const ftChunk::OffsetInFile& cid)
|
||||
{
|
||||
// 1 - find which chunk contains the received data.
|
||||
//
|
||||
@ -139,7 +140,7 @@ void ChunkMap::dataReceived(const ftChunk::ChunkId& cid)
|
||||
return ;
|
||||
}
|
||||
|
||||
std::map<ftChunk::ChunkId,uint32_t>::iterator it(itc->second._slices.find(cid)) ;
|
||||
std::map<ftChunk::OffsetInFile,ChunkDownloadInfo::SliceRequestInfo>::iterator it(itc->second._slices.find(cid)) ;
|
||||
|
||||
if(it == itc->second._slices.end())
|
||||
{
|
||||
@ -150,8 +151,8 @@ void ChunkMap::dataReceived(const ftChunk::ChunkId& cid)
|
||||
return ;
|
||||
}
|
||||
|
||||
_total_downloaded += it->second ;
|
||||
itc->second._remains -= it->second ;
|
||||
_total_downloaded += it->second.size ;
|
||||
itc->second._remains -= it->second.size ;
|
||||
itc->second._slices.erase(it) ;
|
||||
itc->second._last_data_received = time(NULL) ; // update time stamp
|
||||
|
||||
@ -256,6 +257,38 @@ void ChunkMap::setChunkCheckingResult(uint32_t chunk_number,bool check_succeeded
|
||||
}
|
||||
}
|
||||
|
||||
bool ChunkMap::reAskPendingChunk( const RsPeerId& peer_id,
|
||||
uint32_t /*size_hint*/,
|
||||
uint64_t& offset, uint32_t& size)
|
||||
{
|
||||
// make sure that we're at the end of the file. No need to be too greedy in the middle of it.
|
||||
|
||||
for(uint32_t i=0;i<_map.size();++i)
|
||||
if(_map[i] == FileChunksInfo::CHUNK_OUTSTANDING)
|
||||
return false ;
|
||||
|
||||
time_t now = time(NULL);
|
||||
|
||||
for(std::map<uint32_t,ChunkDownloadInfo>::iterator it(_slices_to_download.begin());it!=_slices_to_download.end();++it)
|
||||
for(std::map<ftChunk::OffsetInFile,ChunkDownloadInfo::SliceRequestInfo >::iterator it2(it->second._slices.begin());it2!=it->second._slices.end();++it2)
|
||||
if(it2->second.request_time + FT_CHUNKMAP_MAX_SLICE_REASK_DELAY < now && it2->second.peers.end()==it2->second.peers.find(peer_id))
|
||||
{
|
||||
offset = it2->first;
|
||||
size = it2->second.size ;
|
||||
|
||||
#ifdef DEBUG_FTCHUNK
|
||||
std::cerr << "*** ChunkMap::reAskPendingChunk: re-asking slice (" << offset << ", " << size << ") to peer " << peer_id << std::endl;
|
||||
#endif
|
||||
|
||||
it2->second.request_time = now ;
|
||||
it2->second.peers.insert(peer_id) ;
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
return false ;
|
||||
}
|
||||
|
||||
// Warning: a chunk may be empty, but still being downloaded, so asking new slices from it
|
||||
// will produce slices of size 0. This happens at the end of each chunk.
|
||||
// --> I need to get slices from the next chunk, in such a case.
|
||||
@ -295,7 +328,7 @@ bool ChunkMap::getDataChunk(const RsPeerId& peer_id,uint32_t size_hint,ftChunk&
|
||||
ChunkDownloadInfo& cdi(_slices_to_download[c]) ;
|
||||
falsafe_it = pit ; // let's keep this one just in case.
|
||||
|
||||
if(cdi._slices.rbegin() != cdi._slices.rend() && cdi._slices.rbegin()->second*0.7 <= (float)size_hint)
|
||||
if(cdi._slices.rbegin() != cdi._slices.rend() && cdi._slices.rbegin()->second.size*0.7 <= (float)size_hint)
|
||||
{
|
||||
it = pit ;
|
||||
#ifdef DEBUG_FTCHUNK
|
||||
@ -348,9 +381,14 @@ bool ChunkMap::getDataChunk(const RsPeerId& peer_id,uint32_t size_hint,ftChunk&
|
||||
// Get the first slice of the chunk, that is at most of length size
|
||||
//
|
||||
it->second.getSlice(size_hint,chunk) ;
|
||||
_slices_to_download[chunk.offset/_chunk_size]._slices[chunk.id] = chunk.size ;
|
||||
_slices_to_download[chunk.offset/_chunk_size]._last_data_received = time(NULL) ;
|
||||
|
||||
ChunkDownloadInfo::SliceRequestInfo& r(_slices_to_download[chunk.offset/_chunk_size]._slices[chunk.id]);
|
||||
|
||||
r.size = chunk.size ;
|
||||
r.request_time = time(NULL);
|
||||
r.peers.insert(peer_id);
|
||||
|
||||
chunk.peer_id = peer_id ;
|
||||
|
||||
#ifdef DEBUG_FTCHUNK
|
||||
@ -362,7 +400,7 @@ bool ChunkMap::getDataChunk(const RsPeerId& peer_id,uint32_t size_hint,ftChunk&
|
||||
return true ;
|
||||
}
|
||||
|
||||
void ChunkMap::removeInactiveChunks(std::vector<ftChunk::ChunkId>& to_remove)
|
||||
void ChunkMap::removeInactiveChunks(std::vector<ftChunk::OffsetInFile>& to_remove)
|
||||
{
|
||||
to_remove.clear() ;
|
||||
time_t now = time(NULL) ;
|
||||
@ -377,7 +415,7 @@ void ChunkMap::removeInactiveChunks(std::vector<ftChunk::ChunkId>& to_remove)
|
||||
//
|
||||
std::map<ChunkNumber,ChunkDownloadInfo>::iterator tmp(it) ;
|
||||
|
||||
for(std::map<ftChunk::ChunkId,uint32_t>::const_iterator it2(it->second._slices.begin());it2!=it->second._slices.end();++it2)
|
||||
for(std::map<ftChunk::OffsetInFile,ChunkDownloadInfo::SliceRequestInfo>::const_iterator it2(it->second._slices.begin());it2!=it->second._slices.end();++it2)
|
||||
to_remove.push_back(it2->first) ;
|
||||
|
||||
_map[it->first] = FileChunksInfo::CHUNK_OUTSTANDING ; // reset the chunk
|
||||
|
@ -32,7 +32,7 @@ class ftController ;
|
||||
class ftChunk
|
||||
{
|
||||
public:
|
||||
typedef uint64_t ChunkId ;
|
||||
typedef uint64_t OffsetInFile ;
|
||||
|
||||
ftChunk():offset(0), size(0), id(0), ts(0),ref_cnt(NULL) {}
|
||||
|
||||
@ -40,7 +40,7 @@ class ftChunk
|
||||
|
||||
uint64_t offset; // current offset of the slice
|
||||
uint64_t size; // size remaining to download
|
||||
ChunkId id ; // id of the chunk. Equal to the starting offset of the chunk
|
||||
OffsetInFile id ; // id of the chunk. Equal to the starting offset of the chunk
|
||||
time_t ts; // time of last data received
|
||||
int *ref_cnt; // shared counter of number of sub-blocks. Used when a slice gets split.
|
||||
RsPeerId peer_id ;
|
||||
@ -70,10 +70,17 @@ class Chunk
|
||||
uint64_t _end ; // const
|
||||
};
|
||||
|
||||
class ChunkDownloadInfo
|
||||
struct ChunkDownloadInfo
|
||||
{
|
||||
public:
|
||||
std::map<ftChunk::ChunkId,uint32_t> _slices ;
|
||||
struct SliceRequestInfo
|
||||
{
|
||||
uint32_t size ; // size of the slice
|
||||
time_t request_time ; // last request time
|
||||
std::set<RsPeerId> peers ; // peers the slice was requested to. Normally only one, except at the end of the file.
|
||||
};
|
||||
|
||||
std::map<ftChunk::OffsetInFile,SliceRequestInfo> _slices ;
|
||||
uint32_t _remains ;
|
||||
time_t _last_data_received ;
|
||||
};
|
||||
@ -109,24 +116,29 @@ class ChunkMap
|
||||
/// destructor
|
||||
virtual ~ChunkMap() {}
|
||||
|
||||
/// Returns an slice of data to be asked to the peer within a chunk.
|
||||
/// Returns an slice of data to be asked to the peer within a chunk.
|
||||
/// If a chunk is already been downloaded by this peer, take a slice at
|
||||
/// the beginning of this chunk, or at least where it starts.
|
||||
/// If not, randomly/streamly select a new chunk depending on the strategy.
|
||||
/// adds an entry in the chunk_ids map, and sets up 1 interval for it.
|
||||
/// the chunk should be available from the designated peer.
|
||||
/// If not, randomly/streamly select a new chunk depending on the strategy.
|
||||
/// adds an entry in the chunk_ids map, and sets up 1 interval for it.
|
||||
/// the chunk should be available from the designated peer.
|
||||
/// On return:
|
||||
/// - source_chunk_map_needed = true if the source map should be asked
|
||||
|
||||
virtual bool getDataChunk(const RsPeerId& peer_id,uint32_t size_hint,ftChunk& chunk,bool& source_chunk_map_needed) ;
|
||||
|
||||
/// Notify received a slice of data. This needs to
|
||||
/// - carve in the map of chunks what is received, what is not.
|
||||
/// - tell which chunks are finished. For this, each interval must know what chunk number it has been attributed
|
||||
/// when the interval is split in the middle, the number of intervals for the chunk is increased. If the interval is
|
||||
/// completely covered by the data, the interval number is decreased.
|
||||
/// Returns an already pending slice that was being downloaded but hasn't arrived yet. This is mostly used at the end of the file
|
||||
/// in order to re-ask pendign slices to active peers while slow peers take a lot of time to send their remaining slices.
|
||||
///
|
||||
bool reAskPendingChunk(const RsPeerId& peer_id,uint32_t size_hint,uint64_t& offset,uint32_t& size);
|
||||
|
||||
virtual void dataReceived(const ftChunk::ChunkId& c_id) ;
|
||||
/// Notify received a slice of data. This needs to
|
||||
/// - carve in the map of chunks what is received, what is not.
|
||||
/// - tell which chunks are finished. For this, each interval must know what chunk number it has been attributed
|
||||
/// when the interval is split in the middle, the number of intervals for the chunk is increased. If the interval is
|
||||
/// completely covered by the data, the interval number is decreased.
|
||||
|
||||
virtual void dataReceived(const ftChunk::OffsetInFile& c_id) ;
|
||||
|
||||
/// Decides how chunks are selected.
|
||||
/// STREAMING: the 1st chunk is always returned
|
||||
@ -163,7 +175,7 @@ class ChunkMap
|
||||
|
||||
/// Remove active chunks that have not received any data for the last 60 seconds, and return
|
||||
/// the list of slice numbers that should be canceled.
|
||||
void removeInactiveChunks(std::vector<ftChunk::ChunkId>& to_remove) ;
|
||||
void removeInactiveChunks(std::vector<ftChunk::OffsetInFile>& to_remove) ;
|
||||
|
||||
/// Updates the peer's availablility map
|
||||
//
|
||||
@ -214,7 +226,7 @@ class ChunkMap
|
||||
uint32_t _chunk_size ; //! Size of chunks. Common to all chunks.
|
||||
FileChunksInfo::ChunkStrategy _strategy ; //! how do we allocate new chunks
|
||||
std::map<RsPeerId,Chunk> _active_chunks_feed ; //! vector of chunks being downloaded. Exactly 1 chunk per peer.
|
||||
std::map<ChunkNumber,ChunkDownloadInfo> _slices_to_download ; //! list of (slice id,slice size)
|
||||
std::map<ChunkNumber,ChunkDownloadInfo> _slices_to_download ; //! list of (slice offset,slice size) currently being downloaded
|
||||
std::vector<FileChunksInfo::ChunkState> _map ; //! vector of chunk state over the whole file
|
||||
std::map<RsPeerId,SourceChunksInfo> _peers_chunks_availability ; //! what does each source peer have
|
||||
uint64_t _total_downloaded ; //! completion for the file
|
||||
|
@ -88,16 +88,13 @@ ftFileControl::ftFileControl()
|
||||
return;
|
||||
}
|
||||
|
||||
ftFileControl::ftFileControl(std::string fname,
|
||||
std::string tmppath, std::string dest,
|
||||
uint64_t size, const RsFileHash &hash, TransferRequestFlags flags,
|
||||
ftFileCreator *fc, ftTransferModule *tm)
|
||||
:mName(fname), mCurrentPath(tmppath), mDestination(dest),
|
||||
mTransfer(tm), mCreator(fc), mState(DOWNLOADING), mHash(hash),
|
||||
mSize(size), mFlags(flags), mCreateTime(0), mQueuePriority(0), mQueuePosition(0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
ftFileControl::ftFileControl(const std::string& fname, const std::string& tmppath, const std::string& dest
|
||||
, uint64_t size, const RsFileHash &hash, TransferRequestFlags flags
|
||||
, ftFileCreator *fc, ftTransferModule *tm)
|
||||
: mName(fname), mCurrentPath(tmppath), mDestination(dest)
|
||||
, mTransfer(tm), mCreator(fc), mState(DOWNLOADING), mHash(hash)
|
||||
, mSize(size), mFlags(flags), mCreateTime(0), mQueuePriority(0), mQueuePosition(0)
|
||||
{}
|
||||
|
||||
ftController::ftController(ftDataMultiplex *dm, p3ServiceControl *sc, uint32_t ftServiceId)
|
||||
: p3Config(),
|
||||
@ -1475,24 +1472,24 @@ bool ftController::setPartialsDirectory(std::string path)
|
||||
|
||||
/* check it is not a subdir of download / shared directories (BAD) - TODO */
|
||||
{
|
||||
RsStackMutex stack(ctrlMutex);
|
||||
RsStackMutex stack(ctrlMutex);
|
||||
|
||||
path = RsDirUtil::convertPathToUnix(path);
|
||||
path = RsDirUtil::convertPathToUnix(path);
|
||||
|
||||
if (!path.find(mDownloadPath)) {
|
||||
return false;
|
||||
}
|
||||
if (path.find(mDownloadPath) != std::string::npos) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (rsFiles) {
|
||||
std::list<SharedDirInfo>::iterator it;
|
||||
std::list<SharedDirInfo> dirs;
|
||||
rsFiles->getSharedDirectories(dirs);
|
||||
for (it = dirs.begin(); it != dirs.end(); ++it) {
|
||||
if (!path.find((*it).filename)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (rsFiles) {
|
||||
std::list<SharedDirInfo>::iterator it;
|
||||
std::list<SharedDirInfo> dirs;
|
||||
rsFiles->getSharedDirectories(dirs);
|
||||
for (it = dirs.begin(); it != dirs.end(); ++it) {
|
||||
if (path.find((*it).filename) != std::string::npos) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* check if it exists */
|
||||
|
@ -73,9 +73,9 @@ class ftFileControl
|
||||
};
|
||||
|
||||
ftFileControl();
|
||||
ftFileControl(std::string fname, std::string tmppath, std::string dest,
|
||||
uint64_t size, const RsFileHash& hash, TransferRequestFlags flags,
|
||||
ftFileCreator *fc, ftTransferModule *tm);
|
||||
ftFileControl( const std::string& fname, const std::string& tmppath, const std::string& dest
|
||||
, uint64_t size, const RsFileHash& hash, TransferRequestFlags flags
|
||||
, ftFileCreator *fc, ftTransferModule *tm);
|
||||
|
||||
std::string mName;
|
||||
std::string mCurrentPath; /* current full path (including name) */
|
||||
@ -175,8 +175,8 @@ class ftController: public RsTickingThread, public pqiServiceMonitor, public p3C
|
||||
void FileDownloads(std::list<RsFileHash> &hashs);
|
||||
|
||||
/* Directory Handling */
|
||||
bool setDownloadDirectory(std::string path);
|
||||
bool setPartialsDirectory(std::string path);
|
||||
bool setDownloadDirectory(std::string path);
|
||||
bool setPartialsDirectory(std::string path);
|
||||
std::string getDownloadDirectory();
|
||||
std::string getPartialsDirectory();
|
||||
bool FileDetails(const RsFileHash &hash, FileInfo &info);
|
||||
|
@ -240,7 +240,7 @@ void ftFileCreator::removeInactiveChunks()
|
||||
#ifdef FILE_DEBUG
|
||||
std::cerr << "ftFileCreator::removeInactiveChunks(): looking for old chunks." << std::endl ;
|
||||
#endif
|
||||
std::vector<ftChunk::ChunkId> to_remove ;
|
||||
std::vector<ftChunk::OffsetInFile> to_remove ;
|
||||
|
||||
chunkMap.removeInactiveChunks(to_remove) ;
|
||||
|
||||
@ -421,7 +421,9 @@ int ftFileCreator::locked_notifyReceived(uint64_t offset, uint32_t chunk_size)
|
||||
|
||||
if(!found)
|
||||
{
|
||||
#ifdef FILE_DEBUG
|
||||
std::cerr << "ftFileCreator::locked_notifyReceived(): failed to find an active slice for " << offset << "+" << chunk_size << ", hash = " << hash << ": dropping data." << std::endl;
|
||||
#endif
|
||||
return 0; /* ignoring */
|
||||
}
|
||||
}
|
||||
@ -531,7 +533,14 @@ bool ftFileCreator::getMissingChunk(const RsPeerId& peer_id,uint32_t size_hint,u
|
||||
ftChunk chunk ;
|
||||
|
||||
if(!chunkMap.getDataChunk(peer_id,size_hint,chunk,source_chunk_map_needed))
|
||||
{
|
||||
// No chunks are available. We brutally re-ask an ongoing chunk to another peer.
|
||||
|
||||
if(chunkMap.reAskPendingChunk(peer_id,size_hint,offset,size))
|
||||
return true ;
|
||||
|
||||
return false ;
|
||||
}
|
||||
|
||||
#ifdef FILE_DEBUG
|
||||
std::cerr << "ffc::getMissingChunk() Retrieved new chunk: " << chunk << std::endl ;
|
||||
|
@ -23,35 +23,40 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include <iostream>
|
||||
#include <time.h>
|
||||
#include "util/rsdebug.h"
|
||||
#include "util/rsdir.h"
|
||||
#include "util/rsprint.h"
|
||||
#include "crypto/chacha20.h"
|
||||
#include "retroshare/rstypes.h"
|
||||
#include "retroshare/rspeers.h"
|
||||
//const int ftserverzone = 29539;
|
||||
|
||||
#include "file_sharing/p3filelists.h"
|
||||
#include "ft/ftturtlefiletransferitem.h"
|
||||
#include "ft/ftserver.h"
|
||||
#include "ft/ftextralist.h"
|
||||
#include "ft/ftfilesearch.h"
|
||||
#include "ft/ftcontroller.h"
|
||||
#include "ft/ftfileprovider.h"
|
||||
#include "ft/ftdatamultiplex.h"
|
||||
//#include "ft/ftdwlqueue.h"
|
||||
#include "turtle/p3turtle.h"
|
||||
#include "pqi/p3notify.h"
|
||||
#include "rsserver/p3face.h"
|
||||
#include "ft/ftextralist.h"
|
||||
#include "ft/ftfileprovider.h"
|
||||
#include "ft/ftfilesearch.h"
|
||||
#include "ft/ftserver.h"
|
||||
#include "ft/ftturtlefiletransferitem.h"
|
||||
|
||||
#include "pqi/pqi.h"
|
||||
#include "pqi/p3linkmgr.h"
|
||||
#include "pqi/p3notify.h"
|
||||
#include "pqi/pqi.h"
|
||||
|
||||
#include "retroshare/rstypes.h"
|
||||
#include "retroshare/rspeers.h"
|
||||
|
||||
#include "rsitems/rsfiletransferitems.h"
|
||||
#include "rsitems/rsserviceids.h"
|
||||
|
||||
#include "rsserver/p3face.h"
|
||||
#include "rsserver/rsaccounts.h"
|
||||
#include "turtle/p3turtle.h"
|
||||
|
||||
#include "util/rsdebug.h"
|
||||
#include "util/rsdir.h"
|
||||
#include "util/rsprint.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <time.h>
|
||||
|
||||
/***
|
||||
* #define SERVER_DEBUG 1
|
||||
* #define SERVER_DEBUG_CACHE 1
|
||||
@ -145,9 +150,19 @@ void ftServer::SetupFtServer()
|
||||
/* make Controller */
|
||||
mFtController = new ftController(mFtDataplex, mServiceCtrl, getServiceInfo().mServiceType);
|
||||
mFtController -> setFtSearchNExtra(mFtSearch, mFtExtra);
|
||||
std::string tmppath = ".";
|
||||
mFtController->setPartialsDirectory(tmppath);
|
||||
mFtController->setDownloadDirectory(tmppath);
|
||||
|
||||
std::string emergencySaveDir = rsAccounts->PathAccountDirectory();
|
||||
std::string emergencyPartialsDir = rsAccounts->PathAccountDirectory();
|
||||
if (emergencySaveDir != "")
|
||||
{
|
||||
emergencySaveDir += "/";
|
||||
emergencyPartialsDir += "/";
|
||||
}
|
||||
emergencySaveDir += "Downloads";
|
||||
emergencyPartialsDir += "Partials";
|
||||
|
||||
mFtController->setDownloadDirectory(emergencySaveDir);
|
||||
mFtController->setPartialsDirectory(emergencyPartialsDir);
|
||||
|
||||
/* complete search setup */
|
||||
mFtSearch->addSearchMode(mFtExtra, RS_FILE_HINTS_EXTRA);
|
||||
@ -412,9 +427,9 @@ void ftServer::requestDirUpdate(void *ref)
|
||||
}
|
||||
|
||||
/* Directory Handling */
|
||||
void ftServer::setDownloadDirectory(std::string path)
|
||||
bool ftServer::setDownloadDirectory(std::string path)
|
||||
{
|
||||
mFtController->setDownloadDirectory(path);
|
||||
return mFtController->setDownloadDirectory(path);
|
||||
}
|
||||
|
||||
std::string ftServer::getDownloadDirectory()
|
||||
@ -422,9 +437,9 @@ std::string ftServer::getDownloadDirectory()
|
||||
return mFtController->getDownloadDirectory();
|
||||
}
|
||||
|
||||
void ftServer::setPartialsDirectory(std::string path)
|
||||
bool ftServer::setPartialsDirectory(std::string path)
|
||||
{
|
||||
mFtController->setPartialsDirectory(path);
|
||||
return mFtController->setPartialsDirectory(path);
|
||||
}
|
||||
|
||||
std::string ftServer::getPartialsDirectory()
|
||||
|
@ -202,8 +202,8 @@ public:
|
||||
* Directory Handling
|
||||
***/
|
||||
virtual void requestDirUpdate(void *ref) ; // triggers the update of the given reference. Used when browsing.
|
||||
virtual void setDownloadDirectory(std::string path);
|
||||
virtual void setPartialsDirectory(std::string path);
|
||||
virtual bool setDownloadDirectory(std::string path);
|
||||
virtual bool setPartialsDirectory(std::string path);
|
||||
virtual std::string getDownloadDirectory();
|
||||
virtual std::string getPartialsDirectory();
|
||||
|
||||
|
@ -34,7 +34,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <grouter/grouteritems.h>
|
||||
|
||||
class RsItem ;
|
||||
struct RsItem;
|
||||
|
||||
static const uint32_t GROUTER_CLIENT_SERVICE_DATA_STATUS_UNKNOWN = 0x0000 ; // unused.
|
||||
static const uint32_t GROUTER_CLIENT_SERVICE_DATA_STATUS_RECEIVED = 0x0001 ; // sent when data has been received and a receipt is available.
|
||||
|
@ -31,7 +31,7 @@
|
||||
#include "retroshare/rsgrouter.h"
|
||||
#include "groutertypes.h"
|
||||
|
||||
class RsItem ;
|
||||
struct RsItem;
|
||||
|
||||
// The routing matrix records the event clues received from each friend
|
||||
//
|
||||
|
@ -540,7 +540,7 @@ if(itm == NULL)
|
||||
|
||||
void GRouterTunnelInfo::removeVirtualPeer(const TurtleVirtualPeerId& vpid)
|
||||
{
|
||||
std::set<TurtleVirtualPeerId,RsGRouterTransactionChunkItem*>::iterator it = virtual_peers.find(vpid) ;
|
||||
std::set<TurtleVirtualPeerId>::iterator it = virtual_peers.find(vpid) ;
|
||||
|
||||
if(it == virtual_peers.end())
|
||||
{
|
||||
|
@ -952,6 +952,8 @@ void RsDataService::locked_updateGrpMetaCache(const RsGxsGrpMetaData& meta)
|
||||
|
||||
if(it != mGrpMetaDataCache.end())
|
||||
*(it->second) = meta ;
|
||||
else
|
||||
mGrpMetaDataCache[meta.mGroupId] = new RsGxsGrpMetaData(meta) ;
|
||||
}
|
||||
|
||||
void RsDataService::locked_clearGrpMetaCache(const RsGxsGroupId& gid)
|
||||
@ -1215,7 +1217,7 @@ int RsDataService::retrieveNxsMsgs(const GxsMsgReq &reqIds, GxsMsgResult &msg, b
|
||||
const RsGxsGroupId& grpId = mit->first;
|
||||
|
||||
// if vector empty then request all messages
|
||||
const std::vector<RsGxsMessageId>& msgIdV = mit->second;
|
||||
const std::set<RsGxsMessageId>& msgIdV = mit->second;
|
||||
std::vector<RsNxsMsg*> msgSet;
|
||||
|
||||
if(msgIdV.empty()){
|
||||
@ -1233,7 +1235,7 @@ int RsDataService::retrieveNxsMsgs(const GxsMsgReq &reqIds, GxsMsgResult &msg, b
|
||||
}else{
|
||||
|
||||
// request each grp
|
||||
std::vector<RsGxsMessageId>::const_iterator sit = msgIdV.begin();
|
||||
std::set<RsGxsMessageId>::const_iterator sit = msgIdV.begin();
|
||||
|
||||
for(; sit!=msgIdV.end();++sit){
|
||||
const RsGxsMessageId& msgId = *sit;
|
||||
@ -1303,7 +1305,7 @@ int RsDataService::retrieveGxsMsgMetaData(const GxsMsgReq& reqIds, GxsMsgMetaRes
|
||||
const RsGxsGroupId& grpId = mit->first;
|
||||
|
||||
// if vector empty then request all messages
|
||||
const std::vector<RsGxsMessageId>& msgIdV = mit->second;
|
||||
const std::set<RsGxsMessageId>& msgIdV = mit->second;
|
||||
std::vector<RsGxsMsgMetaData*> metaSet;
|
||||
|
||||
if(msgIdV.empty()){
|
||||
@ -1319,7 +1321,7 @@ int RsDataService::retrieveGxsMsgMetaData(const GxsMsgReq& reqIds, GxsMsgMetaRes
|
||||
}else{
|
||||
|
||||
// request each grp
|
||||
std::vector<RsGxsMessageId>::const_iterator sit = msgIdV.begin();
|
||||
std::set<RsGxsMessageId>::const_iterator sit = msgIdV.begin();
|
||||
|
||||
for(; sit!=msgIdV.end(); ++sit){
|
||||
const RsGxsMessageId& msgId = *sit;
|
||||
@ -1559,7 +1561,7 @@ int RsDataService::removeMsgs(const GxsMsgReq& msgIds)
|
||||
|
||||
for(; mit != msgIds.end(); ++mit)
|
||||
{
|
||||
const std::vector<RsGxsMessageId>& msgIdV = mit->second;
|
||||
const std::set<RsGxsMessageId>& msgIdV = mit->second;
|
||||
const RsGxsGroupId& grpId = mit->first;
|
||||
|
||||
// delete messages
|
||||
@ -1620,7 +1622,7 @@ int RsDataService::retrieveGroupIds(std::vector<RsGxsGroupId> &grpIds)
|
||||
return 1;
|
||||
}
|
||||
|
||||
int RsDataService::retrieveMsgIds(const RsGxsGroupId& grpId, RsGxsMessageId::std_vector& msgIds)
|
||||
int RsDataService::retrieveMsgIds(const RsGxsGroupId& grpId, RsGxsMessageId::std_set& msgIds)
|
||||
{
|
||||
#ifdef RS_DATA_SERVICE_DEBUG_TIME
|
||||
rstime::RsScopeTimer timer("");
|
||||
@ -1641,7 +1643,7 @@ int RsDataService::retrieveMsgIds(const RsGxsGroupId& grpId, RsGxsMessageId::std
|
||||
if(c->columnCount() != 1)
|
||||
std::cerr << "(EE) ********* not retrieving all columns!!" << std::endl;
|
||||
|
||||
msgIds.push_back(RsGxsMessageId(msgId));
|
||||
msgIds.insert(RsGxsMessageId(msgId));
|
||||
valid = c->moveToNext();
|
||||
|
||||
#ifdef RS_DATA_SERVICE_DEBUG_TIME
|
||||
@ -1672,8 +1674,8 @@ bool RsDataService::locked_removeMessageEntries(const GxsMsgReq& msgIds)
|
||||
for(; mit != msgIds.end(); ++mit)
|
||||
{
|
||||
const RsGxsGroupId& grpId = mit->first;
|
||||
const std::vector<RsGxsMessageId>& msgsV = mit->second;
|
||||
std::vector<RsGxsMessageId>::const_iterator vit = msgsV.begin();
|
||||
const std::set<RsGxsMessageId>& msgsV = mit->second;
|
||||
std::set<RsGxsMessageId>::const_iterator vit = msgsV.begin();
|
||||
|
||||
for(; vit != msgsV.end(); ++vit)
|
||||
{
|
||||
|
@ -110,7 +110,7 @@ public:
|
||||
* @param msgId msgsids retrieved
|
||||
* @return error code
|
||||
*/
|
||||
int retrieveMsgIds(const RsGxsGroupId& grpId, RsGxsMessageId::std_vector& msgId);
|
||||
int retrieveMsgIds(const RsGxsGroupId& grpId, RsGxsMessageId::std_set& msgId);
|
||||
|
||||
/*!
|
||||
* @return the cache size set for this RsGeneralDataService in bytes
|
||||
|
@ -208,7 +208,7 @@ public:
|
||||
* @param msgId msgsids retrieved
|
||||
* @return error code
|
||||
*/
|
||||
virtual int retrieveMsgIds(const RsGxsGroupId& grpId, RsGxsMessageId::std_vector& msgId) = 0;
|
||||
virtual int retrieveMsgIds(const RsGxsGroupId& grpId, RsGxsMessageId::std_set& msgId) = 0;
|
||||
|
||||
/*!
|
||||
* @return the cache size set for this RsGeneralDataService in bytes
|
||||
|
@ -217,7 +217,7 @@ void RsGenExchange::tick()
|
||||
RS_STACK_MUTEX(mGenMtx) ;
|
||||
|
||||
std::list<RsGxsGroupId> grpIds;
|
||||
std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > msgIds;
|
||||
std::map<RsGxsGroupId, std::set<RsGxsMessageId> > msgIds;
|
||||
mIntegrityCheck->getDeletedIds(grpIds, msgIds);
|
||||
|
||||
if (!grpIds.empty())
|
||||
@ -1078,23 +1078,19 @@ bool RsGenExchange::checkAuthenFlag(const PrivacyBitPos& pos, const uint8_t& fla
|
||||
}
|
||||
}
|
||||
|
||||
static void addMessageChanged(std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > &msgs, const std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > &msgChanged)
|
||||
static void addMessageChanged(std::map<RsGxsGroupId, std::set<RsGxsMessageId> > &msgs, const std::map<RsGxsGroupId, std::set<RsGxsMessageId> > &msgChanged)
|
||||
{
|
||||
if (msgs.empty()) {
|
||||
msgs = msgChanged;
|
||||
} else {
|
||||
std::map<RsGxsGroupId, std::vector<RsGxsMessageId> >::const_iterator mapIt;
|
||||
for (mapIt = msgChanged.begin(); mapIt != msgChanged.end(); ++mapIt) {
|
||||
for (auto mapIt = msgChanged.begin(); mapIt != msgChanged.end(); ++mapIt)
|
||||
{
|
||||
const RsGxsGroupId &grpId = mapIt->first;
|
||||
const std::vector<RsGxsMessageId> &srcMsgIds = mapIt->second;
|
||||
std::vector<RsGxsMessageId> &destMsgIds = msgs[grpId];
|
||||
const std::set<RsGxsMessageId> &srcMsgIds = mapIt->second;
|
||||
std::set<RsGxsMessageId> &destMsgIds = msgs[grpId];
|
||||
|
||||
std::vector<RsGxsMessageId>::const_iterator msgIt;
|
||||
for (msgIt = srcMsgIds.begin(); msgIt != srcMsgIds.end(); ++msgIt) {
|
||||
if (std::find(destMsgIds.begin(), destMsgIds.end(), *msgIt) == destMsgIds.end()) {
|
||||
destMsgIds.push_back(*msgIt);
|
||||
}
|
||||
}
|
||||
for (auto msgIt = srcMsgIds.begin(); msgIt != srcMsgIds.end(); ++msgIt)
|
||||
destMsgIds.insert(*msgIt) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1789,8 +1785,8 @@ void RsGenExchange::deleteMsgs(uint32_t& token, const GxsMsgReq& msgs)
|
||||
|
||||
if(mNetService != NULL)
|
||||
for(GxsMsgReq::const_iterator it(msgs.begin());it!=msgs.end();++it)
|
||||
for(uint32_t i=0;i<it->second.size();++i)
|
||||
mNetService->rejectMessage(it->second[i]) ;
|
||||
for(auto it2(it->second.begin());it2!=it->second.end();++it2)
|
||||
mNetService->rejectMessage(*it2);
|
||||
}
|
||||
|
||||
void RsGenExchange::publishMsg(uint32_t& token, RsGxsMsgItem *msgItem)
|
||||
@ -1961,8 +1957,8 @@ void RsGenExchange::processMsgMetaChanges()
|
||||
if(m.val.getAsInt32(RsGeneralDataService::MSG_META_STATUS+GXS_MASK, mask))
|
||||
{
|
||||
GxsMsgReq req;
|
||||
std::vector<RsGxsMessageId> msgIdV;
|
||||
msgIdV.push_back(m.msgId.second);
|
||||
std::set<RsGxsMessageId> msgIdV;
|
||||
msgIdV.insert(m.msgId.second);
|
||||
req.insert(std::make_pair(m.msgId.first, msgIdV));
|
||||
GxsMsgMetaResult result;
|
||||
mDataStore->retrieveGxsMsgMetaData(req, result);
|
||||
@ -1994,7 +1990,7 @@ void RsGenExchange::processMsgMetaChanges()
|
||||
mDataAccess->updatePublicRequestStatus(token, RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE);
|
||||
if (changed)
|
||||
{
|
||||
msgIds[m.msgId.first].push_back(m.msgId.second);
|
||||
msgIds[m.msgId.first].insert(m.msgId.second);
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -2010,7 +2006,7 @@ void RsGenExchange::processMsgMetaChanges()
|
||||
|
||||
if (!msgIds.empty()) {
|
||||
RS_STACK_MUTEX(mGenMtx);
|
||||
RsGxsMsgChange* c = new RsGxsMsgChange(RsGxsNotify::TYPE_PROCESSED, true);
|
||||
RsGxsMsgChange* c = new RsGxsMsgChange(RsGxsNotify::TYPE_PROCESSED, false);
|
||||
c->msgChangeMap = msgIds;
|
||||
mNotifications.push_back(c);
|
||||
}
|
||||
@ -2145,7 +2141,7 @@ void RsGenExchange::publishMsgs()
|
||||
mMsgsToPublish.insert(std::make_pair(sign_it->first, item.mItem));
|
||||
}
|
||||
|
||||
std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > msgChangeMap;
|
||||
std::map<RsGxsGroupId, std::set<RsGxsMessageId> > msgChangeMap;
|
||||
std::map<uint32_t, RsGxsMsgItem*>::iterator mit = mMsgsToPublish.begin();
|
||||
|
||||
for(; mit != mMsgsToPublish.end(); ++mit)
|
||||
@ -2273,7 +2269,7 @@ void RsGenExchange::publishMsgs()
|
||||
mDataAccess->addMsgData(msg);
|
||||
delete msg ;
|
||||
|
||||
msgChangeMap[grpId].push_back(msgId);
|
||||
msgChangeMap[grpId].insert(msgId);
|
||||
|
||||
delete[] metaDataBuff;
|
||||
|
||||
@ -2860,8 +2856,10 @@ void RsGenExchange::processRecvdMessages()
|
||||
|
||||
time_t now = time(NULL);
|
||||
|
||||
if(mMsgPendingValidate.empty())
|
||||
return ;
|
||||
#ifdef GEN_EXCH_DEBUG
|
||||
if(!mMsgPendingValidate.empty())
|
||||
else
|
||||
std::cerr << "processing received messages" << std::endl;
|
||||
#endif
|
||||
// 1 - First, make sure items metadata is deserialised, clean old failed items, and collect the groups Ids we have to check
|
||||
@ -2904,9 +2902,11 @@ void RsGenExchange::processRecvdMessages()
|
||||
}
|
||||
}
|
||||
|
||||
// 2 - Retrieve the metadata for the associated groups.
|
||||
// 2 - Retrieve the metadata for the associated groups. The test is here to avoid the default behavior to
|
||||
// retrieve all groups when the list is empty
|
||||
|
||||
mDataStore->retrieveGxsGrpMetaData(grpMetas);
|
||||
if(!grpMetas.empty())
|
||||
mDataStore->retrieveGxsGrpMetaData(grpMetas);
|
||||
|
||||
GxsMsgReq msgIds;
|
||||
RsNxsMsgDataTemporaryList msgs_to_store;
|
||||
@ -2934,7 +2934,7 @@ void RsGenExchange::processRecvdMessages()
|
||||
// }
|
||||
|
||||
#ifdef GEN_EXCH_DEBUG
|
||||
std::cerr << " deserialised info: grp id=" << meta->mGroupId << ", msg id=" << meta->mMsgId ;
|
||||
std::cerr << " deserialised info: grp id=" << msg->grpId << ", msg id=" << msg->msgId ;
|
||||
#endif
|
||||
std::map<RsGxsGroupId, RsGxsGrpMetaData*>::iterator mit = grpMetas.find(msg->grpId);
|
||||
|
||||
@ -2968,17 +2968,17 @@ void RsGenExchange::processRecvdMessages()
|
||||
msg->metaData->mMsgStatus = GXS_SERV::GXS_MSG_STATUS_UNPROCESSED | GXS_SERV::GXS_MSG_STATUS_GUI_NEW | GXS_SERV::GXS_MSG_STATUS_GUI_UNREAD;
|
||||
msgs_to_store.push_back(msg);
|
||||
|
||||
std::vector<RsGxsMessageId> &msgv = msgIds[msg->grpId];
|
||||
|
||||
if (std::find(msgv.begin(), msgv.end(), msg->msgId) == msgv.end())
|
||||
msgv.push_back(msg->msgId);
|
||||
msgIds[msg->grpId].insert(msg->msgId);
|
||||
// std::vector<RsGxsMessageId> &msgv = msgIds[msg->grpId];
|
||||
// if (std::find(msgv.begin(), msgv.end(), msg->msgId) == msgv.end())
|
||||
// msgv.push_back(msg->msgId);
|
||||
|
||||
computeHash(msg->msg, msg->metaData->mHash);
|
||||
msg->metaData->recvTS = time(NULL);
|
||||
|
||||
#ifdef GEN_EXCH_DEBUG
|
||||
std::cerr << " new status flags: " << meta->mMsgStatus << std::endl;
|
||||
std::cerr << " computed hash: " << meta->mHash << std::endl;
|
||||
std::cerr << " new status flags: " << msg->metaData->mMsgStatus << std::endl;
|
||||
std::cerr << " computed hash: " << msg->metaData->mHash << std::endl;
|
||||
std::cerr << "Message received. Identity=" << msg->metaData->mAuthorId << ", from peer " << msg->PeerId() << std::endl;
|
||||
#endif
|
||||
|
||||
@ -3062,9 +3062,6 @@ void RsGenExchange::processRecvdGroups()
|
||||
GxsPendingItem<RsNxsGrp*, RsGxsGroupId>& gpsi = vit->second;
|
||||
RsNxsGrp* grp = gpsi.mItem;
|
||||
|
||||
#ifdef GEN_EXCH_DEBUG
|
||||
std::cerr << " processing validation for group " << meta->mGroupId << ", original attempt time: " << time(NULL) - gpsi.mFirstTryTS << " seconds ago" << std::endl;
|
||||
#endif
|
||||
if(grp->metaData == NULL)
|
||||
{
|
||||
RsGxsGrpMetaData* meta = new RsGxsGrpMetaData();
|
||||
@ -3074,6 +3071,9 @@ void RsGenExchange::processRecvdGroups()
|
||||
else
|
||||
delete meta ;
|
||||
}
|
||||
#ifdef GEN_EXCH_DEBUG
|
||||
std::cerr << " processing validation for group " << grp->metaData->mGroupId << ", original attempt time: " << time(NULL) - gpsi.mFirstTryTS << " seconds ago" << std::endl;
|
||||
#endif
|
||||
|
||||
// early deletion of group from the pending list if it's malformed, not accepted, or has been tried unsuccessfully for too long
|
||||
|
||||
@ -3102,7 +3102,7 @@ void RsGenExchange::processRecvdGroups()
|
||||
if(!grp->metaData->mAuthorId.isNull())
|
||||
{
|
||||
#ifdef GEN_EXCH_DEBUG
|
||||
std::cerr << "Group routage info: Identity=" << meta->mAuthorId << " from " << grp->PeerId() << std::endl;
|
||||
std::cerr << "Group routage info: Identity=" << grp->metaData->mAuthorId << " from " << grp->PeerId() << std::endl;
|
||||
#endif
|
||||
mRoutingClues[grp->metaData->mAuthorId].insert(grp->PeerId()) ;
|
||||
}
|
||||
@ -3326,7 +3326,7 @@ void RsGenExchange::removeDeleteExistingMessages( std::list<RsNxsMsg*>& msgs, Gx
|
||||
|
||||
//RsGxsGroupId::std_list grpIds(mGrpIdsUnique.begin(), mGrpIdsUnique.end());
|
||||
//RsGxsGroupId::std_list::const_iterator it = grpIds.begin();
|
||||
typedef std::map<RsGxsGroupId, RsGxsMessageId::std_vector> MsgIdReq;
|
||||
typedef std::map<RsGxsGroupId, RsGxsMessageId::std_set> MsgIdReq;
|
||||
MsgIdReq msgIdReq;
|
||||
|
||||
// now get a list of all msgs ids for each group
|
||||
@ -3346,20 +3346,21 @@ void RsGenExchange::removeDeleteExistingMessages( std::list<RsNxsMsg*>& msgs, Gx
|
||||
// now for each msg to be stored that exist in the retrieved msg/grp "index" delete and erase from map
|
||||
for(std::list<RsNxsMsg*>::iterator cit2 = msgs.begin(); cit2 != msgs.end();)
|
||||
{
|
||||
const RsGxsMessageId::std_vector& msgIds = msgIdReq[(*cit2)->metaData->mGroupId];
|
||||
const RsGxsMessageId::std_set& msgIds = msgIdReq[(*cit2)->metaData->mGroupId];
|
||||
|
||||
#ifdef GEN_EXCH_DEBUG
|
||||
std::cerr << " grpid=" << cit2->second->mGroupId << ", msgid=" << cit2->second->mMsgId ;
|
||||
std::cerr << " grpid=" << (*cit2)->grpId << ", msgid=" << (*cit2)->msgId ;
|
||||
#endif
|
||||
|
||||
// Avoid storing messages that are already in the database, as well as messages that are too old (or generally do not pass the database storage test)
|
||||
//
|
||||
if(std::find(msgIds.begin(), msgIds.end(), (*cit2)->metaData->mMsgId) != msgIds.end() || !messagePublicationTest( *(*cit2)->metaData))
|
||||
if(msgIds.find((*cit2)->metaData->mMsgId) != msgIds.end() || !messagePublicationTest( *(*cit2)->metaData))
|
||||
{
|
||||
// msg exist in retrieved index. We should use a std::set here instead of a vector.
|
||||
|
||||
RsGxsMessageId::std_vector& notifyIds = msgIdsNotify[ (*cit2)->metaData->mGroupId];
|
||||
RsGxsMessageId::std_vector::iterator it2 = std::find(notifyIds.begin(), notifyIds.end(), (*cit2)->metaData->mMsgId);
|
||||
RsGxsMessageId::std_set& notifyIds = msgIdsNotify[ (*cit2)->metaData->mGroupId];
|
||||
RsGxsMessageId::std_set::iterator it2 = notifyIds.find((*cit2)->metaData->mMsgId);
|
||||
|
||||
if(it2 != notifyIds.end())
|
||||
{
|
||||
notifyIds.erase(it2);
|
||||
@ -3369,7 +3370,7 @@ void RsGenExchange::removeDeleteExistingMessages( std::list<RsNxsMsg*>& msgs, Gx
|
||||
}
|
||||
}
|
||||
#ifdef GEN_EXCH_DEBUG
|
||||
std::cerr << " discarding " << cit2->second->mMsgId << std::endl;
|
||||
std::cerr << " discarding " << (*cit2)->msgId << std::endl;
|
||||
#endif
|
||||
|
||||
delete *cit2;
|
||||
|
@ -225,7 +225,7 @@ bool RsGxsDataAccess::requestMsgInfo(uint32_t &token, uint32_t ansType,
|
||||
MsgMetaReq* mmr = new MsgMetaReq();
|
||||
|
||||
for(; lit != grpIds.end(); ++lit)
|
||||
mmr->mMsgIds[*lit] = std::vector<RsGxsMessageId>();
|
||||
mmr->mMsgIds[*lit] = std::set<RsGxsMessageId>();
|
||||
|
||||
req = mmr;
|
||||
}else if(reqType & GXS_REQUEST_TYPE_MSG_DATA)
|
||||
@ -233,7 +233,7 @@ bool RsGxsDataAccess::requestMsgInfo(uint32_t &token, uint32_t ansType,
|
||||
MsgDataReq* mdr = new MsgDataReq();
|
||||
|
||||
for(; lit != grpIds.end(); ++lit)
|
||||
mdr->mMsgIds[*lit] = std::vector<RsGxsMessageId>();
|
||||
mdr->mMsgIds[*lit] = std::set<RsGxsMessageId>();
|
||||
|
||||
req = mdr;
|
||||
}else if(reqType & GXS_REQUEST_TYPE_MSG_IDS)
|
||||
@ -241,7 +241,7 @@ bool RsGxsDataAccess::requestMsgInfo(uint32_t &token, uint32_t ansType,
|
||||
MsgIdReq* mir = new MsgIdReq();
|
||||
|
||||
for(; lit != grpIds.end(); ++lit)
|
||||
mir->mMsgIds[*lit] = std::vector<RsGxsMessageId>();
|
||||
mir->mMsgIds[*lit] = std::set<RsGxsMessageId>();
|
||||
|
||||
req = mir;
|
||||
}
|
||||
@ -1191,7 +1191,7 @@ bool RsGxsDataAccess::getMsgList(const GxsMsgReq& msgIds, const RsTokReqOptions&
|
||||
// Add the discovered Latest Msgs.
|
||||
for(oit = origMsgTs.begin(); oit != origMsgTs.end(); ++oit)
|
||||
{
|
||||
msgIdsOut[grpId].push_back(oit->second.first);
|
||||
msgIdsOut[grpId].insert(oit->second.first);
|
||||
}
|
||||
|
||||
}
|
||||
@ -1228,7 +1228,7 @@ bool RsGxsDataAccess::getMsgList(const GxsMsgReq& msgIds, const RsTokReqOptions&
|
||||
|
||||
if (add)
|
||||
{
|
||||
msgIdsOut[grpId].push_back(msgMeta->mMsgId);
|
||||
msgIdsOut[grpId].insert(msgMeta->mMsgId);
|
||||
metaFilter[grpId].insert(std::make_pair(msgMeta->mMsgId, msgMeta));
|
||||
}
|
||||
|
||||
@ -1373,7 +1373,7 @@ bool RsGxsDataAccess::getMsgRelatedInfo(MsgRelatedInfoReq *req)
|
||||
// get meta data for all in group
|
||||
GxsMsgMetaResult result;
|
||||
GxsMsgReq msgIds;
|
||||
msgIds.insert(std::make_pair(grpMsgIdPair.first, std::vector<RsGxsMessageId>()));
|
||||
msgIds.insert(std::make_pair(grpMsgIdPair.first, std::set<RsGxsMessageId>()));
|
||||
mDataStore->retrieveGxsMsgMetaData(msgIds, result);
|
||||
std::vector<RsGxsMsgMetaData*>& metaV = result[grpMsgIdPair.first];
|
||||
std::vector<RsGxsMsgMetaData*>::iterator vit_meta;
|
||||
@ -1382,7 +1382,7 @@ bool RsGxsDataAccess::getMsgRelatedInfo(MsgRelatedInfoReq *req)
|
||||
const RsGxsMessageId& msgId = grpMsgIdPair.second;
|
||||
const RsGxsGroupId& grpId = grpMsgIdPair.first;
|
||||
|
||||
std::vector<RsGxsMessageId> outMsgIds;
|
||||
std::set<RsGxsMessageId> outMsgIds;
|
||||
|
||||
RsGxsMsgMetaData* origMeta = NULL;
|
||||
for(vit_meta = metaV.begin(); vit_meta != metaV.end(); ++vit_meta)
|
||||
@ -1477,7 +1477,7 @@ bool RsGxsDataAccess::getMsgRelatedInfo(MsgRelatedInfoReq *req)
|
||||
// Add the discovered Latest Msgs.
|
||||
for(oit = origMsgTs.begin(); oit != origMsgTs.end(); ++oit)
|
||||
{
|
||||
outMsgIds.push_back(oit->second.first);
|
||||
outMsgIds.insert(oit->second.first);
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -1502,7 +1502,7 @@ bool RsGxsDataAccess::getMsgRelatedInfo(MsgRelatedInfoReq *req)
|
||||
}
|
||||
}
|
||||
}
|
||||
outMsgIds.push_back(latestMsgId);
|
||||
outMsgIds.insert(latestMsgId);
|
||||
metaMap.insert(std::make_pair(latestMsgId, latestMeta));
|
||||
}
|
||||
}
|
||||
@ -1514,7 +1514,7 @@ bool RsGxsDataAccess::getMsgRelatedInfo(MsgRelatedInfoReq *req)
|
||||
|
||||
if (meta->mOrigMsgId == origMsgId)
|
||||
{
|
||||
outMsgIds.push_back(meta->mMsgId);
|
||||
outMsgIds.insert(meta->mMsgId);
|
||||
metaMap.insert(std::make_pair(meta->mMsgId, meta));
|
||||
}
|
||||
}
|
||||
@ -1556,7 +1556,7 @@ bool RsGxsDataAccess::getGroupStatistic(GroupStatisticRequest *req)
|
||||
{
|
||||
// filter based on options
|
||||
GxsMsgIdResult metaReq;
|
||||
metaReq[req->mGrpId] = std::vector<RsGxsMessageId>();
|
||||
metaReq[req->mGrpId] = std::set<RsGxsMessageId>();
|
||||
GxsMsgMetaResult metaResult;
|
||||
mDataStore->retrieveGxsMsgMetaData(metaReq, metaResult);
|
||||
|
||||
@ -1672,7 +1672,7 @@ bool RsGxsDataAccess::getMsgList(MsgIdReq* req)
|
||||
for(; vit != vit_end; ++vit)
|
||||
{
|
||||
RsGxsMsgMetaData* meta = *vit;
|
||||
req->mMsgIdResult[grpId].push_back(meta->mMsgId);
|
||||
req->mMsgIdResult[grpId].insert(meta->mMsgId);
|
||||
delete meta; // discard meta data mem
|
||||
}
|
||||
}
|
||||
@ -1718,8 +1718,8 @@ void RsGxsDataAccess::filterMsgList(GxsMsgIdResult& msgIds, const RsTokReqOption
|
||||
if(cit == msgMetas.end())
|
||||
continue;
|
||||
|
||||
std::vector<RsGxsMessageId>& msgs = mit->second;
|
||||
std::vector<RsGxsMessageId>::iterator vit = msgs.begin();
|
||||
std::set<RsGxsMessageId>& msgs = mit->second;
|
||||
std::set<RsGxsMessageId>::iterator vit = msgs.begin();
|
||||
const std::map<RsGxsMessageId, RsGxsMsgMetaData*>& meta = cit->second;
|
||||
std::map<RsGxsMessageId, RsGxsMsgMetaData*>::const_iterator cit2;
|
||||
|
||||
|
@ -784,7 +784,7 @@ void RsGxsNetService::handleRecvSyncGrpStatistics(RsNxsSyncGrpStatsItem *grs)
|
||||
// now count available messages
|
||||
|
||||
GxsMsgReq reqIds;
|
||||
reqIds[grs->grpId] = std::vector<RsGxsMessageId>();
|
||||
reqIds[grs->grpId] = std::set<RsGxsMessageId>();
|
||||
GxsMsgMetaResult result;
|
||||
|
||||
#ifdef NXS_NET_DEBUG_6
|
||||
@ -2757,7 +2757,7 @@ void RsGxsNetService::locked_genReqMsgTransaction(NxsTransaction* tr)
|
||||
#endif
|
||||
|
||||
GxsMsgReq reqIds;
|
||||
reqIds[grpId] = std::vector<RsGxsMessageId>();
|
||||
reqIds[grpId] = std::set<RsGxsMessageId>();
|
||||
GxsMsgMetaResult result;
|
||||
mDataStore->retrieveGxsMsgMetaData(reqIds, result);
|
||||
std::vector<RsGxsMsgMetaData*> &msgMetaV = result[grpId];
|
||||
@ -3296,7 +3296,7 @@ void RsGxsNetService::locked_genSendMsgsTransaction(NxsTransaction* tr)
|
||||
RsNxsSyncMsgItem* item = dynamic_cast<RsNxsSyncMsgItem*>(*lit);
|
||||
if (item)
|
||||
{
|
||||
msgIds[item->grpId].push_back(item->msgId);
|
||||
msgIds[item->grpId].insert(item->msgId);
|
||||
|
||||
if(grpId.isNull())
|
||||
grpId = item->grpId;
|
||||
@ -4127,7 +4127,7 @@ void RsGxsNetService::handleRecvSyncMessage(RsNxsSyncMsgReqItem *item,bool item_
|
||||
}
|
||||
|
||||
GxsMsgReq req;
|
||||
req[item->grpId] = std::vector<RsGxsMessageId>();
|
||||
req[item->grpId] = std::set<RsGxsMessageId>();
|
||||
|
||||
GxsMsgMetaResult metaResult;
|
||||
mDataStore->retrieveGxsMsgMetaData(req, metaResult);
|
||||
|
@ -67,7 +67,7 @@ bool RsGxsMessageCleanUp::clean()
|
||||
GxsMsgReq req;
|
||||
GxsMsgMetaResult result;
|
||||
|
||||
req[grpId] = std::vector<RsGxsMessageId>();
|
||||
req[grpId] = std::set<RsGxsMessageId>();
|
||||
mDs->retrieveGxsMsgMetaData(req, result);
|
||||
|
||||
GxsMsgMetaResult::iterator mit = result.begin();
|
||||
@ -117,7 +117,7 @@ bool RsGxsMessageCleanUp::clean()
|
||||
|
||||
if( remove )
|
||||
{
|
||||
req[grpId].push_back(meta->mMsgId);
|
||||
req[grpId].insert(meta->mMsgId);
|
||||
|
||||
#ifdef DEBUG_GXSUTIL
|
||||
std::cerr << " Scheduling for removal." << std::endl;
|
||||
@ -241,9 +241,9 @@ bool RsGxsIntegrityCheck::check()
|
||||
for (msgIdsIt = msgIds.begin(); msgIdsIt != msgIds.end(); ++msgIdsIt)
|
||||
{
|
||||
const RsGxsGroupId& grpId = msgIdsIt->first;
|
||||
std::vector<RsGxsMessageId> &msgIdV = msgIdsIt->second;
|
||||
std::set<RsGxsMessageId> &msgIdV = msgIdsIt->second;
|
||||
|
||||
std::vector<RsGxsMessageId>::iterator msgIdIt;
|
||||
std::set<RsGxsMessageId>::iterator msgIdIt;
|
||||
for (msgIdIt = msgIdV.begin(); msgIdIt != msgIdV.end(); ++msgIdIt)
|
||||
{
|
||||
const RsGxsMessageId& msgId = *msgIdIt;
|
||||
@ -261,7 +261,7 @@ bool RsGxsIntegrityCheck::check()
|
||||
|
||||
if (nxsMsgIt == nxsMsgV.end())
|
||||
{
|
||||
msgsToDel[grpId].push_back(msgId);
|
||||
msgsToDel[grpId].insert(msgId);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -284,7 +284,7 @@ bool RsGxsIntegrityCheck::check()
|
||||
if(msg->metaData == NULL || currHash != msg->metaData->mHash)
|
||||
{
|
||||
std::cerr << "(EE) deleting message data with wrong hash or null meta data. meta=" << (void*)msg->metaData << std::endl;
|
||||
msgsToDel[msg->grpId].push_back(msg->msgId);
|
||||
msgsToDel[msg->grpId].insert(msg->msgId);
|
||||
}
|
||||
else if(!msg->metaData->mAuthorId.isNull() && subscribed_groups.find(msg->metaData->mGroupId)!=subscribed_groups.end())
|
||||
{
|
||||
@ -377,7 +377,7 @@ bool RsGxsIntegrityCheck::isDone()
|
||||
return mDone;
|
||||
}
|
||||
|
||||
void RsGxsIntegrityCheck::getDeletedIds(std::list<RsGxsGroupId>& grpIds, std::map<RsGxsGroupId, std::vector<RsGxsMessageId> >& msgIds)
|
||||
void RsGxsIntegrityCheck::getDeletedIds(std::list<RsGxsGroupId>& grpIds, std::map<RsGxsGroupId, std::set<RsGxsMessageId> >& msgIds)
|
||||
{
|
||||
RsStackMutex stack(mIntegrityMutex);
|
||||
|
||||
|
@ -208,7 +208,7 @@ public:
|
||||
|
||||
void run();
|
||||
|
||||
void getDeletedIds(std::list<RsGxsGroupId>& grpIds, std::map<RsGxsGroupId, std::vector<RsGxsMessageId> >& msgIds);
|
||||
void getDeletedIds(std::list<RsGxsGroupId>& grpIds, std::map<RsGxsGroupId, std::set<RsGxsMessageId> > &msgIds);
|
||||
|
||||
private:
|
||||
|
||||
@ -217,7 +217,7 @@ private:
|
||||
bool mDone;
|
||||
RsMutex mIntegrityMutex;
|
||||
std::list<RsGxsGroupId> mDeletedGrps;
|
||||
std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > mDeletedMsgs;
|
||||
std::map<RsGxsGroupId, std::set<RsGxsMessageId> > mDeletedMsgs;
|
||||
|
||||
RsGixs *mGixs ;
|
||||
};
|
||||
|
@ -455,7 +455,7 @@ void p3GxsTrans::GxsTransIntegrityCleanupThread::run()
|
||||
|
||||
if(stored_msgs.end() != it2)
|
||||
{
|
||||
msgsToDel[it2->second.first].push_back(it2->second.second);
|
||||
msgsToDel[it2->second.first].insert(it2->second.second);
|
||||
|
||||
#ifdef DEBUG_GXSTRANS
|
||||
std::cerr << " scheduling msg " << std::hex << it2->second.first << "," << it2->second.second << " for deletion." << std::endl;
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* GXS Mailing Service
|
||||
* Copyright (C) 2016-2017 Gioacchino Mazzurco <gio@eigenlab.org>
|
||||
* Copyright (C) 2016-2018 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
|
||||
@ -38,30 +38,28 @@ OutgoingRecord::OutgoingRecord( RsGxsId rec, GxsTransSubServices cs,
|
||||
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)
|
||||
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);
|
||||
RS_SERIAL_PROCESS(status);
|
||||
RS_SERIAL_PROCESS(recipient);
|
||||
RS_SERIAL_PROCESS(mailItem);
|
||||
RS_SERIAL_PROCESS(mailData);
|
||||
RS_SERIAL_PROCESS(clientService);
|
||||
RS_SERIAL_PROCESS(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);
|
||||
RS_SERIAL_PROCESS(status);
|
||||
RS_SERIAL_PROCESS(recipient);
|
||||
RS_SERIAL_PROCESS(author);
|
||||
RS_SERIAL_PROCESS(group_id);
|
||||
RS_SERIAL_PROCESS(sent_ts);
|
||||
RS_SERIAL_PROCESS(mailItem);
|
||||
RS_SERIAL_PROCESS(mailData);
|
||||
RS_SERIAL_PROCESS(clientService);
|
||||
RS_SERIAL_PROCESS(presignedReceipt);
|
||||
}
|
||||
|
@ -55,7 +55,7 @@ public:
|
||||
|
||||
void serial_process( RsGenericSerializer::SerializeJob j,
|
||||
RsGenericSerializer::SerializeContext& ctx )
|
||||
{ RS_REGISTER_SERIAL_MEMBER_TYPED(mailId, uint64_t); }
|
||||
{ RS_SERIAL_PROCESS(mailId); }
|
||||
};
|
||||
|
||||
class RsGxsTransPresignedReceipt : public RsGxsTransBaseMsgItem
|
||||
@ -140,9 +140,9 @@ public:
|
||||
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);
|
||||
RS_SERIAL_PROCESS(cryptoType);
|
||||
RS_SERIAL_PROCESS(recipientHint);
|
||||
RS_SERIAL_PROCESS(payload);
|
||||
}
|
||||
|
||||
void clear()
|
||||
|
@ -102,6 +102,9 @@ template<> void RsTypeSerializer::print_data(const std::string& name,BIGNUM
|
||||
std::cerr << "[BIGNUM] : " << name << std::endl;
|
||||
}
|
||||
|
||||
RS_TYPE_SERIALIZER_TO_JSON_NOT_IMPLEMENTED_DEF(BIGNUM*)
|
||||
RS_TYPE_SERIALIZER_FROM_JSON_NOT_IMPLEMENTED_DEF(BIGNUM*)
|
||||
|
||||
void RsGxsTunnelStatusItem::serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx)
|
||||
{
|
||||
RsTypeSerializer::serial_process<uint32_t>(j,ctx,status,"status") ;
|
||||
|
@ -2,30 +2,17 @@
|
||||
|
||||
TEMPLATE = lib
|
||||
CONFIG += staticlib
|
||||
CONFIG += create_prl
|
||||
CONFIG -= qt
|
||||
TARGET = retroshare
|
||||
TARGET_PRL = libretroshare
|
||||
DESTDIR = lib
|
||||
|
||||
#CONFIG += dsdv
|
||||
|
||||
retrotor {
|
||||
DEFINES *= RETROTOR
|
||||
CONFIG -= bitdht
|
||||
} else {
|
||||
CONFIG += bitdht
|
||||
}
|
||||
!include("use_libretroshare.pri"):error("Including")
|
||||
|
||||
# the dht stunner is used to obtain RS external ip addr. when it is natted
|
||||
# this system is unreliable and rs supports a newer and better one (asking connected peers)
|
||||
# CONFIG += useDhtStunner
|
||||
|
||||
profiling {
|
||||
QMAKE_CXXFLAGS -= -fomit-frame-pointer
|
||||
QMAKE_CXXFLAGS *= -pg -g -fno-omit-frame-pointer
|
||||
}
|
||||
|
||||
# treat warnings as error for better removing
|
||||
#QMAKE_CFLAGS += -Werror
|
||||
#QMAKE_CXXFLAGS += -Werror
|
||||
@ -203,21 +190,11 @@ linux-* {
|
||||
|
||||
PKGCONFIG *= libssl libupnp
|
||||
PKGCONFIG *= libcrypto zlib
|
||||
LIBS *= -lpthread -ldl
|
||||
}
|
||||
no_sqlcipher:PKGCONFIG *= sqlite3
|
||||
LIBS *= -ldl
|
||||
|
||||
linux-* {
|
||||
DEFINES *= PLUGIN_DIR=\"\\\"$${PLUGIN_DIR}\\\"\"
|
||||
DEFINES *= DATA_DIR=\"\\\"$${DATA_DIR}\\\"\"
|
||||
|
||||
## where to put the librarys interface
|
||||
#include_rsiface.path = "$${INC_DIR}"
|
||||
#include_rsiface.files = $$PUBLIC_HEADERS
|
||||
#INSTALLS += include_rsiface
|
||||
|
||||
## where to put the shared library itself
|
||||
#target.path = "$$LIB_DIR"
|
||||
#INSTALLS *= target
|
||||
}
|
||||
|
||||
linux-g++ {
|
||||
@ -234,7 +211,7 @@ version_detail_bash_script {
|
||||
PRE_TARGETDEPS = write_version_detail
|
||||
write_version_detail.commands = $$PWD/version_detail.sh
|
||||
}
|
||||
win32 {
|
||||
win32-* {
|
||||
QMAKE_EXTRA_TARGETS += write_version_detail
|
||||
PRE_TARGETDEPS = write_version_detail
|
||||
write_version_detail.commands = $$PWD/version_detail.bat
|
||||
@ -263,13 +240,11 @@ win32-x-g++ {
|
||||
}
|
||||
################################# Windows ##########################################
|
||||
|
||||
win32 {
|
||||
win32-g++ {
|
||||
QMAKE_CC = $${QMAKE_CXX}
|
||||
OBJECTS_DIR = temp/obj
|
||||
MOC_DIR = temp/moc
|
||||
DEFINES *= WINDOWS_SYS WIN32 STATICLIB MINGW WIN32_LEAN_AND_MEAN _USE_32BIT_TIME_T
|
||||
# This defines the platform to be WinXP or later and is needed for getaddrinfo (_WIN32_WINNT_WINXP)
|
||||
DEFINES *= WINVER=0x0501
|
||||
DEFINES *= STATICLIB
|
||||
|
||||
# Switch on extra warnings
|
||||
QMAKE_CFLAGS += -Wextra
|
||||
@ -287,17 +262,8 @@ win32 {
|
||||
|
||||
DEFINES += USE_CMD_ARGS
|
||||
|
||||
CONFIG += upnp_miniupnpc
|
||||
|
||||
no_sqlcipher {
|
||||
PKGCONFIG *= sqlite3
|
||||
LIBS += -lsqlite3
|
||||
} else {
|
||||
LIBS += -lsqlcipher
|
||||
}
|
||||
|
||||
DEPENDPATH += . $$INC_DIR
|
||||
INCLUDEPATH += . $$INC_DIR
|
||||
wLibs = ws2_32 gdi32 uuid iphlpapi crypt32 ole32 winmm
|
||||
LIBS += $$linkDynamicLibs(wLibs)
|
||||
}
|
||||
|
||||
################################# MacOSX ##########################################
|
||||
@ -306,22 +272,10 @@ mac {
|
||||
QMAKE_CC = $${QMAKE_CXX}
|
||||
OBJECTS_DIR = temp/obj
|
||||
MOC_DIR = temp/moc
|
||||
#DEFINES = WINDOWS_SYS WIN32 STATICLIB MINGW
|
||||
#DEFINES *= MINIUPNPC_VERSION=13
|
||||
|
||||
CONFIG += upnp_miniupnpc
|
||||
CONFIG += c++11
|
||||
|
||||
# zeroconf disabled at the end of libretroshare.pro (but need the code)
|
||||
#CONFIG += zeroconf
|
||||
#CONFIG += zcnatassist
|
||||
|
||||
# Beautiful Hack to fix 64bit file access.
|
||||
QMAKE_CXXFLAGS *= -Dfseeko64=fseeko -Dftello64=ftello -Dfopen64=fopen -Dvstatfs64=vstatfs
|
||||
|
||||
#GPG_ERROR_DIR = ../../../../libgpg-error-1.7
|
||||
#GPGME_DIR = ../../../../gpgme-1.1.8
|
||||
|
||||
for(lib, LIB_DIR):LIBS += -L"$$lib"
|
||||
for(bin, BIN_DIR):LIBS += -L"$$bin"
|
||||
|
||||
@ -562,7 +516,7 @@ SOURCES += ft/ftchunkmap.cc \
|
||||
ft/ftfilesearch.cc \
|
||||
ft/ftserver.cc \
|
||||
ft/fttransfermodule.cc \
|
||||
ft/ftturtlefiletransferitem.cc
|
||||
ft/ftturtlefiletransferitem.cc
|
||||
|
||||
SOURCES += crypto/chacha20.cpp \
|
||||
crypto/hashstream.cc
|
||||
@ -656,6 +610,7 @@ SOURCES += serialiser/rsbaseserial.cc \
|
||||
rsitems/rsgxsupdateitems.cc \
|
||||
rsitems/rsserviceinfoitems.cc \
|
||||
|
||||
|
||||
SOURCES += services/autoproxy/rsautoproxymonitor.cc \
|
||||
services/autoproxy/p3i2pbob.cc \
|
||||
services/p3msgservice.cc \
|
||||
@ -699,13 +654,16 @@ SOURCES += util/folderiterator.cc \
|
||||
util/rstime.cc \
|
||||
util/rsurl.cc
|
||||
|
||||
|
||||
upnp_miniupnpc {
|
||||
HEADERS += upnp/upnputil.h upnp/upnphandler_miniupnp.h
|
||||
SOURCES += upnp/upnputil.c upnp/upnphandler_miniupnp.cc
|
||||
## Added for retrocompatibility remove ASAP
|
||||
isEmpty(RS_UPNP_LIB) {
|
||||
upnp_miniupnpc:RS_UPNP_LIB=miniupnpc
|
||||
upnp_libupnp:RS_UPNP_LIB="upnp ixml threadutil"
|
||||
}
|
||||
|
||||
upnp_libupnp {
|
||||
equals(RS_UPNP_LIB, miniupnpc) {
|
||||
HEADERS += upnp/upnputil.h upnp/upnphandler_miniupnp.h
|
||||
SOURCES += upnp/upnputil.c upnp/upnphandler_miniupnp.cc
|
||||
} else {
|
||||
HEADERS += upnp/UPnPBase.h upnp/upnphandler_linux.h
|
||||
SOURCES += upnp/UPnPBase.cpp upnp/upnphandler_linux.cc
|
||||
DEFINES *= RS_USE_LIBUPNP
|
||||
@ -795,7 +753,8 @@ SOURCES += gxstunnel/p3gxstunnel.cc \
|
||||
gxstunnel/rsgxstunnelitems.cc
|
||||
|
||||
# new serialization code
|
||||
HEADERS += serialiser/rsserializer.h \
|
||||
HEADERS += serialiser/rsserializable.h \
|
||||
serialiser/rsserializer.h \
|
||||
serialiser/rstypeserializer.h
|
||||
|
||||
SOURCES += serialiser/rsserializer.cc \
|
||||
@ -936,19 +895,13 @@ android-* {
|
||||
DEFINES *= "fopen64=fopen"
|
||||
DEFINES *= "fseeko64=fseeko"
|
||||
DEFINES *= "ftello64=ftello"
|
||||
LIBS *= -lbz2 -lupnp -lixml -lthreadutil -lsqlite3
|
||||
|
||||
## Static library are verysensible to order in command line, has to be in the
|
||||
## end of file for this reason
|
||||
## Static library are very susceptible to order in command line
|
||||
sLibs = bz2 $$RS_UPNP_LIB $$RS_SQL_LIB ssl crypto
|
||||
|
||||
LIBS += -L$$NATIVE_LIBS_TOOLCHAIN_PATH/sysroot/usr/lib/ -lsqlcipher
|
||||
PRE_TARGETDEPS += $$NATIVE_LIBS_TOOLCHAIN_PATH/sysroot/usr/lib/libsqlcipher.a
|
||||
|
||||
LIBS += -L$$NATIVE_LIBS_TOOLCHAIN_PATH/sysroot/usr/lib/ -lssl
|
||||
PRE_TARGETDEPS += $$NATIVE_LIBS_TOOLCHAIN_PATH/sysroot/usr/lib/libssl.a
|
||||
|
||||
LIBS += -L$$NATIVE_LIBS_TOOLCHAIN_PATH/sysroot/usr/lib/ -lcrypto
|
||||
PRE_TARGETDEPS += $$NATIVE_LIBS_TOOLCHAIN_PATH/sysroot/usr/lib/libcrypto.a
|
||||
LIBS += $$linkStaticLibs(sLibs)
|
||||
PRE_TARGETDEPS += $$pretargetStaticLibs(sLibs)
|
||||
|
||||
HEADERS += util/androiddebug.h
|
||||
}
|
||||
|
||||
|
@ -67,7 +67,7 @@ p3HistoryMgr::~p3HistoryMgr()
|
||||
|
||||
/***** p3HistoryMgr *****/
|
||||
|
||||
//void p3HistoryMgr::addMessage(bool incoming, const RsPeerId &chatPeerId, const RsPeerId &peerId, const RsChatMsgItem *chatItem)
|
||||
//void p3HistoryMgr::addMessage(bool incoming, const RsPeerId &chatPeerId, const RsPeerId &msgPeerId, const RsChatMsgItem *chatItem)
|
||||
void p3HistoryMgr::addMessage(const ChatMessage& cm)
|
||||
{
|
||||
uint32_t addMsgId = 0;
|
||||
@ -84,48 +84,48 @@ void p3HistoryMgr::addMessage(const ChatMessage& cm)
|
||||
RsStackMutex stack(mHistoryMtx); /********** STACK LOCKED MTX ******/
|
||||
|
||||
|
||||
RsPeerId peerId; // id of sending peer
|
||||
RsPeerId chatPeerId; // id of chat endpoint
|
||||
std::string peerName; //name of sending peer
|
||||
RsPeerId msgPeerId; // id of sending peer
|
||||
RsPeerId chatPeerId; // id of chat endpoint
|
||||
std::string peerName; //name of sending peer
|
||||
|
||||
bool enabled = false;
|
||||
if (cm.chat_id.isBroadcast() && mPublicEnable == true) {
|
||||
peerName = rsPeers->getPeerName(cm.broadcast_peer_id);
|
||||
enabled = true;
|
||||
bool enabled = false;
|
||||
if (cm.chat_id.isBroadcast() && mPublicEnable == true) {
|
||||
peerName = rsPeers->getPeerName(cm.broadcast_peer_id);
|
||||
enabled = true;
|
||||
}
|
||||
if (cm.chat_id.isPeerId() && mPrivateEnable == true) {
|
||||
msgPeerId = cm.incoming ? cm.chat_id.toPeerId() : rsPeers->getOwnId();
|
||||
peerName = rsPeers->getPeerName(msgPeerId);
|
||||
enabled = true;
|
||||
}
|
||||
if (cm.chat_id.isLobbyId() && mLobbyEnable == true) {
|
||||
peerName = cm.lobby_peer_gxs_id.toStdString();
|
||||
enabled = true;
|
||||
}
|
||||
if (cm.chat_id.isPeerId() && mPrivateEnable == true) {
|
||||
peerId = cm.incoming ? cm.chat_id.toPeerId() : rsPeers->getOwnId();
|
||||
peerName = rsPeers->getPeerName(peerId);
|
||||
enabled = true;
|
||||
}
|
||||
if (cm.chat_id.isLobbyId() && mLobbyEnable == true) {
|
||||
peerName = cm.lobby_peer_gxs_id.toStdString();
|
||||
enabled = true;
|
||||
}
|
||||
|
||||
if(cm.chat_id.isDistantChatId())
|
||||
{
|
||||
DistantChatPeerInfo dcpinfo;
|
||||
if (rsMsgs->getDistantChatStatus(cm.chat_id.toDistantChatId(), dcpinfo))
|
||||
peerName = cm.chat_id.toPeerId().toStdString();
|
||||
enabled = true;
|
||||
}
|
||||
if(cm.chat_id.isDistantChatId())
|
||||
{
|
||||
DistantChatPeerInfo dcpinfo;
|
||||
if (rsMsgs->getDistantChatStatus(cm.chat_id.toDistantChatId(), dcpinfo))
|
||||
peerName = cm.chat_id.toPeerId().toStdString();
|
||||
enabled = true;
|
||||
}
|
||||
|
||||
if(enabled == false)
|
||||
return;
|
||||
if(enabled == false)
|
||||
return;
|
||||
|
||||
if(!chatIdToVirtualPeerId(cm.chat_id, chatPeerId))
|
||||
return;
|
||||
if(!chatIdToVirtualPeerId(cm.chat_id, chatPeerId))
|
||||
return;
|
||||
|
||||
RsHistoryMsgItem* item = new RsHistoryMsgItem;
|
||||
item->chatPeerId = chatPeerId;
|
||||
item->incoming = cm.incoming;
|
||||
item->peerId = peerId;
|
||||
item->peerName = peerName;
|
||||
item->sendTime = cm.sendTime;
|
||||
item->recvTime = cm.recvTime;
|
||||
item->incoming = cm.incoming;
|
||||
item->msgPeerId = msgPeerId;
|
||||
item->peerName = peerName;
|
||||
item->sendTime = cm.sendTime;
|
||||
item->recvTime = cm.recvTime;
|
||||
|
||||
item->message = cm.msg ;
|
||||
item->message = cm.msg ;
|
||||
//librs::util::ConvertUtf16ToUtf8(chatItem->message, item->message);
|
||||
|
||||
std::map<RsPeerId, std::map<uint32_t, RsHistoryMsgItem*> >::iterator mit = mMessages.find(item->chatPeerId);
|
||||
@ -138,7 +138,7 @@ void p3HistoryMgr::addMessage(const ChatMessage& cm)
|
||||
uint32_t limit;
|
||||
if (chatPeerId.isNull())
|
||||
limit = mPublicSaveCount;
|
||||
else if (cm.chat_id.isLobbyId())
|
||||
else if (cm.chat_id.isLobbyId())
|
||||
limit = mLobbySaveCount;
|
||||
else
|
||||
limit = mPrivateSaveCount;
|
||||
@ -424,7 +424,7 @@ static void convertMsg(const RsHistoryMsgItem* item, HistoryMsg &msg)
|
||||
msg.msgId = item->msgId;
|
||||
msg.chatPeerId = item->chatPeerId;
|
||||
msg.incoming = item->incoming;
|
||||
msg.peerId = item->peerId;
|
||||
msg.peerId = item->msgPeerId;
|
||||
msg.peerName = item->peerName;
|
||||
msg.sendTime = item->sendTime;
|
||||
msg.recvTime = item->recvTime;
|
||||
|
@ -57,6 +57,7 @@ static struct RsLog::logInfo p3connectzoneInfo = {RsLog::Default, "p3connect"};
|
||||
|
||||
/****
|
||||
* #define LINKMGR_DEBUG 1
|
||||
* #define LINKMGR_DEBUG_LOG 1
|
||||
* #define LINKMGR_DEBUG_CONNFAIL 1
|
||||
* #define LINKMGR_DEBUG_ACTIONS 1
|
||||
* #define LINKMGR_DEBUG_LINKTYPE 1
|
||||
@ -621,7 +622,9 @@ bool p3LinkMgrIMPL::connectAttempt(const RsPeerId &id, struct sockaddr_storage &
|
||||
|
||||
}
|
||||
|
||||
#ifdef LINKMGR_DEBUG_LOG
|
||||
rslog(RSL_WARNING, p3connectzone, "p3LinkMgrIMPL::connectAttempt() called id: " + id.toStdString());
|
||||
#endif
|
||||
|
||||
it->second.lastattempt = time(NULL);
|
||||
it->second.inConnAttempt = true;
|
||||
@ -824,7 +827,9 @@ bool p3LinkMgrIMPL::connectResult(const RsPeerId &id, bool success, bool isIncom
|
||||
out += " FAILED ATTEMPT (Not Connected)";
|
||||
}
|
||||
}
|
||||
#ifdef LINKMGR_DEBUG_LOG
|
||||
rslog(RSL_WARNING, p3connectzone, out);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@ -2060,8 +2065,9 @@ bool p3LinkMgrIMPL::locked_ConnectAttempt_Complete(peerConnectState *peer)
|
||||
|
||||
int p3LinkMgrIMPL::addFriend(const RsPeerId &id, bool isVisible)
|
||||
{
|
||||
#ifdef LINKMGR_DEBUG_LOG
|
||||
rslog(RSL_WARNING, p3connectzone, "p3LinkMgr::addFriend() id: " + id.toStdString());
|
||||
|
||||
#endif
|
||||
{
|
||||
RsStackMutex stack(mLinkMtx); /****** STACK LOCK MUTEX *******/
|
||||
|
||||
|
@ -987,8 +987,8 @@ bool p3NetMgrIMPL::checkNetAddress()
|
||||
bool addrChanged = false;
|
||||
bool validAddr = false;
|
||||
|
||||
struct sockaddr_storage prefAddr;
|
||||
struct sockaddr_storage oldAddr;
|
||||
sockaddr_storage prefAddr;
|
||||
sockaddr_storage oldAddr;
|
||||
|
||||
if (mNetMode & RS_NET_MODE_TRY_LOOPBACK)
|
||||
{
|
||||
@ -996,7 +996,7 @@ bool p3NetMgrIMPL::checkNetAddress()
|
||||
std::cerr << "p3NetMgrIMPL::checkNetAddress() LOOPBACK ... forcing to 127.0.0.1";
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
sockaddr_storage_ipv4_aton(prefAddr, "127.0.0.1");
|
||||
sockaddr_storage_ipv4_aton(prefAddr, "127.0.0.1");
|
||||
validAddr = true;
|
||||
}
|
||||
else
|
||||
@ -1012,7 +1012,7 @@ bool p3NetMgrIMPL::checkNetAddress()
|
||||
std::vector<sockaddr_storage> addrs;
|
||||
if (getLocalAddresses(addrs))
|
||||
{
|
||||
for (auto it = addrs.begin(); it!=addrs.end(); ++it)
|
||||
for (auto it = addrs.begin(); it != addrs.end(); ++it)
|
||||
{
|
||||
sockaddr_storage& addr(*it);
|
||||
if( sockaddr_storage_isValidNet(addr) &&
|
||||
@ -1060,8 +1060,8 @@ bool p3NetMgrIMPL::checkNetAddress()
|
||||
|
||||
{
|
||||
RS_STACK_MUTEX(mNetMtx);
|
||||
|
||||
oldAddr = mLocalAddr;
|
||||
|
||||
sockaddr_storage_copy(mLocalAddr, oldAddr);
|
||||
addrChanged = !sockaddr_storage_sameip(prefAddr, mLocalAddr);
|
||||
|
||||
#ifdef NETMGR_DEBUG_TICK
|
||||
@ -1087,7 +1087,7 @@ bool p3NetMgrIMPL::checkNetAddress()
|
||||
|
||||
// update address.
|
||||
sockaddr_storage_copyip(mLocalAddr, prefAddr);
|
||||
mNetFlags.mLocalAddr = mLocalAddr;
|
||||
sockaddr_storage_copy(mLocalAddr, mNetFlags.mLocalAddr);
|
||||
|
||||
if(sockaddr_storage_isLoopbackNet(mLocalAddr))
|
||||
{
|
||||
@ -1129,9 +1129,13 @@ bool p3NetMgrIMPL::checkNetAddress()
|
||||
* are the same (modify server)... this mismatch can
|
||||
* occur when the local port is changed....
|
||||
*/
|
||||
if (sockaddr_storage_sameip(mLocalAddr, mExtAddr))
|
||||
if (sockaddr_storage_sameip(mLocalAddr, mExtAddr) && sockaddr_storage_port(mLocalAddr) != sockaddr_storage_port(mExtAddr))
|
||||
{
|
||||
#ifdef NETMGR_DEBUG_RESET
|
||||
std::cerr << "p3NetMgrIMPL::checkNetAddress() local and external ports are not the same. Setting external port to " << sockaddr_storage_port(mLocalAddr) << std::endl;
|
||||
#endif
|
||||
sockaddr_storage_setport(mExtAddr, sockaddr_storage_port(mLocalAddr));
|
||||
addrChanged = true;
|
||||
}
|
||||
|
||||
// ensure that address family is set, otherwise windows Barfs.
|
||||
|
@ -74,6 +74,7 @@ static struct RsLog::logInfo p3peermgrzoneInfo = {RsLog::Default, "p3peermgr"};
|
||||
|
||||
/****
|
||||
* #define PEER_DEBUG 1
|
||||
* #define PEER_DEBUG_LOG 1
|
||||
***/
|
||||
|
||||
#define MAX_AVAIL_PERIOD 230 //times a peer stay in available state when not connected
|
||||
@ -909,8 +910,9 @@ bool p3PeerMgrIMPL::addFriend(const RsPeerId& input_id, const RsPgpId& input_gpg
|
||||
RsPeerId id = input_id ;
|
||||
RsPgpId gpg_id = input_gpg_id ;
|
||||
|
||||
#ifdef PEER_DEBUG_LOG
|
||||
rslog(RSL_WARNING, p3peermgrzone, "p3PeerMgr::addFriend() id: " + id.toStdString());
|
||||
|
||||
#endif
|
||||
{
|
||||
RsStackMutex stack(mPeerMtx); /****** STACK LOCK MUTEX *******/
|
||||
|
||||
@ -1237,11 +1239,11 @@ bool p3PeerMgrIMPL::UpdateOwnAddress( const sockaddr_storage& pLocalAddr,
|
||||
sockaddr_storage_copy(pExtAddr, extAddr);
|
||||
sockaddr_storage_ipv6_to_ipv4(extAddr);
|
||||
|
||||
#ifdef PEER_DEBUG
|
||||
//#ifdef PEER_DEBUG
|
||||
std::cerr << "p3PeerMgrIMPL::UpdateOwnAddress("
|
||||
<< sockaddr_storage_tostring(localAddr) << ", "
|
||||
<< sockaddr_storage_tostring(extAddr) << ")" << std::endl;
|
||||
#endif
|
||||
//#endif
|
||||
|
||||
if( rsBanList &&
|
||||
!rsBanList->isAddressAccepted(localAddr,
|
||||
@ -1472,21 +1474,25 @@ bool p3PeerMgrIMPL::setLocalAddress( const RsPeerId &id,
|
||||
return changed;
|
||||
}
|
||||
|
||||
bool p3PeerMgrIMPL::setExtAddress(const RsPeerId &id, const struct sockaddr_storage &addr)
|
||||
bool p3PeerMgrIMPL::setExtAddress( const RsPeerId &id,
|
||||
const sockaddr_storage &addr )
|
||||
{
|
||||
bool changed = false;
|
||||
uint32_t check_res = 0 ;
|
||||
bool changed = false;
|
||||
uint32_t check_res = 0;
|
||||
|
||||
if(rsBanList!=NULL && !rsBanList->isAddressAccepted(addr,RSBANLIST_CHECKING_FLAGS_BLACKLIST,&check_res))
|
||||
{
|
||||
std::cerr << "(SS) trying to set external contact address for peer " << id << " to a banned address " << sockaddr_storage_iptostring(addr )<< std::endl;
|
||||
return false ;
|
||||
}
|
||||
if( rsBanList!=NULL && !rsBanList->isAddressAccepted(
|
||||
addr, RSBANLIST_CHECKING_FLAGS_BLACKLIST, &check_res) )
|
||||
{
|
||||
std::cerr << "(SS) trying to set external contact address for peer "
|
||||
<< id << " to a banned address "
|
||||
<< sockaddr_storage_iptostring(addr) << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (id == AuthSSL::getAuthSSL()->OwnId())
|
||||
{
|
||||
{
|
||||
RsStackMutex stack(mPeerMtx); /****** STACK LOCK MUTEX *******/
|
||||
RS_STACK_MUTEX(mPeerMtx);
|
||||
if (!sockaddr_storage_same(mOwnState.serveraddr, addr))
|
||||
{
|
||||
mOwnState.serveraddr = addr;
|
||||
@ -1499,7 +1505,7 @@ bool p3PeerMgrIMPL::setExtAddress(const RsPeerId &id, const struct sockaddr_s
|
||||
return changed;
|
||||
}
|
||||
|
||||
RsStackMutex stack(mPeerMtx); /****** STACK LOCK MUTEX *******/
|
||||
RS_STACK_MUTEX(mPeerMtx);
|
||||
/* check if it is a friend */
|
||||
std::map<RsPeerId, peerState>::iterator it;
|
||||
if (mFriendList.end() == (it = mFriendList.find(id)))
|
||||
@ -1507,7 +1513,9 @@ bool p3PeerMgrIMPL::setExtAddress(const RsPeerId &id, const struct sockaddr_s
|
||||
if (mOthersList.end() == (it = mOthersList.find(id)))
|
||||
{
|
||||
#ifdef PEER_DEBUG
|
||||
std::cerr << "p3PeerMgrIMPL::setLocalAddress() cannot add addres info : peer id not found in friend list id: " << id << std::endl;
|
||||
std::cerr << "p3PeerMgrIMPL::setLocalAddress() cannot add addres "
|
||||
<< "info : peer id not found in friend list id: " << id
|
||||
<< std::endl;
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
@ -2058,7 +2066,7 @@ bool p3PeerMgrIMPL::saveList(bool &cleanup, std::list<RsItem *>& saveData)
|
||||
RsPeerNetItem *item = new RsPeerNetItem();
|
||||
item->clear();
|
||||
|
||||
item->peerId = getOwnId();
|
||||
item->nodePeerId = getOwnId();
|
||||
item->pgpId = mOwnState.gpg_id;
|
||||
item->location = mOwnState.location;
|
||||
|
||||
@ -2109,7 +2117,7 @@ bool p3PeerMgrIMPL::saveList(bool &cleanup, std::list<RsItem *>& saveData)
|
||||
item = new RsPeerNetItem();
|
||||
item->clear();
|
||||
|
||||
item->peerId = it->first;
|
||||
item->nodePeerId = it->first;
|
||||
item->pgpId = (it->second).gpg_id;
|
||||
item->location = (it->second).location;
|
||||
item->netMode = (it->second).netMode;
|
||||
@ -2309,7 +2317,7 @@ bool p3PeerMgrIMPL::loadList(std::list<RsItem *>& load)
|
||||
RsPeerNetItem *pitem = dynamic_cast<RsPeerNetItem *>(*it);
|
||||
if (pitem)
|
||||
{
|
||||
RsPeerId peer_id = pitem->peerId ;
|
||||
RsPeerId peer_id = pitem->nodePeerId ;
|
||||
RsPgpId peer_pgp_id = pitem->pgpId ;
|
||||
|
||||
if (peer_id == ownId)
|
||||
@ -2336,7 +2344,7 @@ bool p3PeerMgrIMPL::loadList(std::list<RsItem *>& load)
|
||||
/* ************* */
|
||||
// permission flags is used as a mask for the existing perms, so we set it to 0xffff
|
||||
addFriend(peer_id, peer_pgp_id, pitem->netMode, pitem->vs_disc, pitem->vs_dht, pitem->lastContact, RS_NODE_PERM_ALL);
|
||||
setLocation(pitem->peerId, pitem->location);
|
||||
setLocation(pitem->nodePeerId, pitem->location);
|
||||
}
|
||||
|
||||
if (pitem->netMode == RS_NET_MODE_HIDDEN)
|
||||
|
@ -38,7 +38,7 @@
|
||||
class PQInterface;
|
||||
class RSTrafficClue;
|
||||
class RsBwRates;
|
||||
class RsItem;
|
||||
struct RsItem;
|
||||
class RsRawItem;
|
||||
|
||||
class SearchModule
|
||||
|
@ -27,7 +27,7 @@
|
||||
|
||||
#include <stddef.h> // for NULL
|
||||
|
||||
class RsItem;
|
||||
struct RsItem;
|
||||
|
||||
/***
|
||||
#define LOOPBACK_DEBUG 1
|
||||
|
@ -31,7 +31,7 @@
|
||||
#include "pqi/pqi_base.h" // for NetInterface (ptr only), PQInterface
|
||||
#include "retroshare/rstypes.h" // for RsPeerId
|
||||
|
||||
class RsItem;
|
||||
struct RsItem;
|
||||
|
||||
class pqiloopback: public PQInterface
|
||||
{
|
||||
|
@ -45,6 +45,7 @@ static std::list<RsPeerId> waitingIds;
|
||||
|
||||
/****
|
||||
*#define PGRP_DEBUG 1
|
||||
*#define PGRP_DEBUG_LOG 1
|
||||
****/
|
||||
|
||||
#define DEFAULT_DOWNLOAD_KB_RATE (200.0)
|
||||
@ -420,7 +421,9 @@ int pqipersongrp::addPeer(const RsPeerId& id)
|
||||
sm -> pqi = pqip;
|
||||
|
||||
// reset it to start it working.
|
||||
#ifdef PGRP_DEBUG_LOG
|
||||
pqioutput(PQL_WARNING, pqipersongrpzone, "pqipersongrp::addPeer() => reset() called to initialise new person");
|
||||
#endif
|
||||
pqip -> reset();
|
||||
pqip -> listen();
|
||||
|
||||
|
@ -67,7 +67,7 @@ const int PQISSL_UDP_FLAG = 0x02;
|
||||
|
||||
//#define PQISSL_DEBUG 1
|
||||
//#define PQISSL_LOG_DEBUG 1
|
||||
|
||||
//#define PQISSL_LOG_DEBUG2 1
|
||||
|
||||
static const int PQISSL_MAX_READ_ZERO_COUNT = 20;
|
||||
static const time_t PQISSL_MAX_READ_ZERO_TIME = 15; // 15 seconds of no data => reset. (atm HeartBeat pkt sent 5 secs)
|
||||
@ -238,7 +238,9 @@ int pqissl::reset_locked()
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef PQISSL_LOG_DEBUG2
|
||||
rslog(RSL_ALERT, pqisslzone, outLog);
|
||||
#endif
|
||||
|
||||
// notify people of problem!
|
||||
// but only if we really shut something down.
|
||||
@ -585,12 +587,12 @@ int pqissl::Delay_Connection()
|
||||
int pqissl::Initiate_Connection()
|
||||
{
|
||||
#ifdef PQISSL_DEBUG
|
||||
std::cout << __PRETTY_FUNCTION__ << std::endl;
|
||||
std::cerr << __PRETTY_FUNCTION__ << " "
|
||||
<< sockaddr_storage_tostring(remote_addr) << std::endl;
|
||||
#endif
|
||||
|
||||
int err;
|
||||
sockaddr_storage addr = remote_addr;
|
||||
|
||||
sockaddr_storage addr; sockaddr_storage_copy(remote_addr, addr);
|
||||
|
||||
if(waiting != WAITING_DELAY)
|
||||
{
|
||||
@ -638,13 +640,6 @@ int pqissl::Initiate_Connection()
|
||||
return -1;
|
||||
}
|
||||
|
||||
{
|
||||
std::string out;
|
||||
rs_sprintf(out, "pqissl::Initiate_Connection() Connecting To: %s via: ", PeerId().toStdString().c_str());
|
||||
out += sockaddr_storage_tostring(addr);
|
||||
rslog(RSL_WARNING, pqisslzone, out);
|
||||
}
|
||||
|
||||
if (sockaddr_storage_isnull(addr))
|
||||
{
|
||||
rslog(RSL_WARNING, pqisslzone, "pqissl::Initiate_Connection() Invalid (0.0.0.0) Remote Address, Aborting Connect.");
|
||||
@ -721,6 +716,12 @@ int pqissl::Initiate_Connection()
|
||||
//std::cerr << "Setting Connect Timeout " << mConnectTimeout << " Seconds into Future " << std::endl;
|
||||
|
||||
sockaddr_storage_ipv4_to_ipv6(addr);
|
||||
#ifdef PQISSL_DEBUG
|
||||
std::cerr << __PRETTY_FUNCTION__ << " Connecting To: "
|
||||
<< PeerId().toStdString() <<" via: "
|
||||
<< sockaddr_storage_tostring(addr) << std::endl;
|
||||
#endif
|
||||
|
||||
if (0 != (err = unix_connect(osock, addr)))
|
||||
{
|
||||
switch (errno)
|
||||
@ -730,11 +731,13 @@ int pqissl::Initiate_Connection()
|
||||
sockfd = osock;
|
||||
return 0;
|
||||
default:
|
||||
#ifdef PQISSL_DEBUG
|
||||
std::cerr << __PRETTY_FUNCTION__ << " Failure connect "
|
||||
<< sockaddr_storage_tostring(addr)
|
||||
<< " returns: "
|
||||
<< err << " -> errno: " << errno << " "
|
||||
<< socket_errorType(errno) << std::endl;
|
||||
#endif
|
||||
|
||||
net_internal_close(osock);
|
||||
osock = -1;
|
||||
@ -777,10 +780,14 @@ bool pqissl::CheckConnectionTimeout()
|
||||
std::string out;
|
||||
rs_sprintf(out, "pqissl::Basic_Connection_Complete() Connection Timed Out. Peer: %s Period: %lu", PeerId().toStdString().c_str(), mConnectTimeout);
|
||||
|
||||
#ifdef PQISSL_LOG_DEBUG2
|
||||
rslog(RSL_WARNING, pqisslzone, out);
|
||||
#endif
|
||||
/* as sockfd is valid, this should close it all up */
|
||||
|
||||
#ifdef PQISSL_LOG_DEBUG2
|
||||
rslog(RSL_ALERT, pqisslzone, "pqissl::Basic_Connection_Complete() -> calling reset()");
|
||||
#endif
|
||||
reset_locked();
|
||||
return true;
|
||||
}
|
||||
@ -919,7 +926,9 @@ int pqissl::Basic_Connection_Complete()
|
||||
{
|
||||
std::string out;
|
||||
rs_sprintf(out, "pqissl::Basic_Connection_Complete() TCP Connection Complete: cert: %s on osock: ", PeerId().toStdString().c_str(), sockfd);
|
||||
#ifdef PQISSL_LOG_DEBUG2
|
||||
rslog(RSL_WARNING, pqisslzone, out);
|
||||
#endif
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
@ -60,8 +60,10 @@ static struct RsLog::logInfo pqissllistenzoneInfo = {RsLog::Default, "p3peermgr"
|
||||
|
||||
|
||||
pqissllistenbase::pqissllistenbase(const sockaddr_storage &addr, p3PeerMgr *pm)
|
||||
: laddr(addr), mPeerMgr(pm), active(false)
|
||||
: mPeerMgr(pm), active(false)
|
||||
{
|
||||
sockaddr_storage_copy(addr, laddr);
|
||||
|
||||
if (!(AuthSSL::getAuthSSL()-> active()))
|
||||
{
|
||||
pqioutput(PQL_ALERT, pqissllistenzone,
|
||||
@ -117,8 +119,10 @@ int pqissllistenbase::setuplisten()
|
||||
reinterpret_cast<uint8_t*>(&no), sizeof(no));
|
||||
if (err) std::cerr << __PRETTY_FUNCTION__
|
||||
<< ": Error setting IPv6 socket dual stack" << std::endl;
|
||||
#ifdef DEBUG_LISTENNER
|
||||
else std::cerr << __PRETTY_FUNCTION__
|
||||
<< ": Success setting IPv6 socket dual stack" << std::endl;
|
||||
#endif
|
||||
#endif // IPV6_V6ONLY
|
||||
|
||||
/********************************** WINDOWS/UNIX SPECIFIC PART ******************/
|
||||
@ -208,26 +212,20 @@ int pqissllistenbase::setuplisten()
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef OPEN_UNIVERSAL_PORT
|
||||
struct sockaddr_storage tmpaddr = laddr;
|
||||
if (!mPeerMgr->isHidden())
|
||||
{
|
||||
tmpaddr.ss_family = PF_INET6;
|
||||
sockaddr_storage_zeroip(tmpaddr);
|
||||
}
|
||||
struct sockaddr_storage tmpaddr;
|
||||
sockaddr_storage_copy(laddr, tmpaddr);
|
||||
sockaddr_storage_ipv4_to_ipv6(tmpaddr);
|
||||
if (!mPeerMgr->isHidden()) sockaddr_storage_zeroip(tmpaddr);
|
||||
|
||||
if (0 != (err = rs_bind(lsock, tmpaddr)))
|
||||
#else
|
||||
if (0 != (err = universal_bind(lsock, laddr)))
|
||||
#endif
|
||||
{
|
||||
std::string out = "pqissllistenbase::setuplisten() Cannot Bind to Local Address!\n";
|
||||
showSocketError(out);
|
||||
pqioutput(PQL_ALERT, pqissllistenzone, out);
|
||||
std::cerr << out << std::endl;
|
||||
std::cerr << "laddr: " << sockaddr_storage_tostring(laddr) << std::endl;
|
||||
#ifdef OPEN_UNIVERSAL_PORT
|
||||
if (!mPeerMgr->isHidden()) std::cerr << "Zeroed tmpaddr: " << sockaddr_storage_tostring(tmpaddr) << std::endl;
|
||||
#endif
|
||||
std::cerr << out << std::endl
|
||||
<< "tmpaddr: " << sockaddr_storage_tostring(tmpaddr)
|
||||
<< std::endl;
|
||||
print_stacktrace();
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
@ -42,6 +42,7 @@ static struct RsLog::logInfo pqisslproxyzoneInfo = {RsLog::Default, "pqisslproxy
|
||||
#define pqisslproxyzone &pqisslproxyzoneInfo
|
||||
|
||||
// #define PROXY_DEBUG 1
|
||||
// #define PROXY_DEBUG_LOG 1
|
||||
|
||||
#define PROXY_STATE_FAILED 0
|
||||
#define PROXY_STATE_INIT 1
|
||||
@ -593,8 +594,9 @@ bool pqisslproxy::connect_parameter(uint32_t type, const std::string &value)
|
||||
{
|
||||
std::string out;
|
||||
rs_sprintf(out, "pqisslproxy::connect_parameter() Peer: %s DOMAIN_ADDRESS: %s", PeerId().toStdString().c_str(), value.c_str());
|
||||
#ifdef PROXY_DEBUG_LOG
|
||||
rslog(RSL_WARNING, pqisslproxyzone, out);
|
||||
|
||||
#endif
|
||||
mDomainAddress = value;
|
||||
#ifdef PROXY_DEBUG
|
||||
std::cerr << out << std::endl;
|
||||
@ -615,8 +617,9 @@ bool pqisslproxy::connect_parameter(uint32_t type, uint32_t value)
|
||||
{
|
||||
std::string out;
|
||||
rs_sprintf(out, "pqisslproxy::connect_parameter() Peer: %s REMOTE_PORT: %lu", PeerId().toStdString().c_str(), value);
|
||||
#ifdef PROXY_DEBUG_LOG
|
||||
rslog(RSL_WARNING, pqisslproxyzone, out);
|
||||
|
||||
#endif
|
||||
mRemotePort = value;
|
||||
#ifdef PROXY_DEBUG
|
||||
std::cerr << out << std::endl;
|
||||
|
@ -227,6 +227,15 @@ int pqissludp::Initiate_Connection()
|
||||
return -1;
|
||||
}
|
||||
|
||||
if(!sockaddr_storage_ipv6_to_ipv4(remote_addr))
|
||||
{
|
||||
std::cerr << __PRETTY_FUNCTION__ << "Error: remote_addr is not "
|
||||
<< "valid IPv4!" << std::endl;
|
||||
sockaddr_storage_dump(remote_addr);
|
||||
print_stacktrace();
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
mTimeoutTS = time(NULL) + mConnectTimeout;
|
||||
//std::cerr << "Setting Connect Timeout " << mConnectTimeout << " Seconds into Future " << std::endl;
|
||||
//std::cerr << " Connect Period is:" << mConnectPeriod << std::endl;
|
||||
@ -254,32 +263,22 @@ int pqissludp::Initiate_Connection()
|
||||
struct sockaddr_in proxyaddr;
|
||||
struct sockaddr_in remoteaddr;
|
||||
|
||||
bool nonIpV4 = false;
|
||||
if(!sockaddr_storage_ipv6_to_ipv4(remote_addr))
|
||||
{
|
||||
nonIpV4 = true;
|
||||
std::cerr << __PRETTY_FUNCTION__ << "Error: remote_addr is not "
|
||||
<< "valid IPv4!" << std::endl;
|
||||
sockaddr_storage_dump(remote_addr);
|
||||
}
|
||||
if(!sockaddr_storage_ipv6_to_ipv4(mConnectSrcAddr))
|
||||
{
|
||||
nonIpV4 = true;
|
||||
std::cerr << __PRETTY_FUNCTION__ << "Error: mConnectSrcAddr is "
|
||||
<< "not valid IPv4!" << std::endl;
|
||||
sockaddr_storage_dump(mConnectSrcAddr);
|
||||
print_stacktrace();
|
||||
return -EINVAL;
|
||||
}
|
||||
if(!sockaddr_storage_ipv6_to_ipv4(mConnectProxyAddr))
|
||||
{
|
||||
nonIpV4 = true;
|
||||
std::cerr << __PRETTY_FUNCTION__ << "Error: mConnectProxyAddr "
|
||||
<< "is not valid IPv4!" << std::endl;
|
||||
sockaddr_storage_dump(mConnectProxyAddr);
|
||||
}
|
||||
if(!nonIpV4)
|
||||
{
|
||||
print_stacktrace();
|
||||
return -EINVAL;
|
||||
|
||||
}
|
||||
|
||||
struct sockaddr_in *rap = (struct sockaddr_in *) &remote_addr;
|
||||
@ -301,7 +300,6 @@ int pqissludp::Initiate_Connection()
|
||||
err = tou_connect_via_relay(sockfd, &srcaddr, &proxyaddr, &remoteaddr);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*** It seems that the UDP Layer sees x 1.2 the traffic of the SSL layer.
|
||||
* We need to compensate somewhere... we drop the maximum traffic to 75% of limit
|
||||
|
@ -38,7 +38,7 @@
|
||||
#include "retroshare/rstypes.h" // for RsPeerId
|
||||
#include "util/rsthreads.h" // for RsMutex
|
||||
|
||||
class RsItem;
|
||||
struct RsItem;
|
||||
class RsSerialiser;
|
||||
|
||||
struct PartialPacketRecord
|
||||
|
@ -182,7 +182,7 @@ private:
|
||||
class StringExpression: public Expression
|
||||
{
|
||||
public:
|
||||
StringExpression(enum StringOperator op, std::list<std::string> &t, bool ic): Op(op),terms(t), IgnoreCase(ic){}
|
||||
StringExpression(enum StringOperator op, const std::list<std::string> &t, bool ic): Op(op),terms(t), IgnoreCase(ic){}
|
||||
|
||||
virtual void linearize(LinearizedExpression& e) const ;
|
||||
virtual std::string toStdString(const std::string& varstr) const;
|
||||
@ -275,7 +275,7 @@ Some implementations of StringExpressions.
|
||||
class NameExpression: public StringExpression
|
||||
{
|
||||
public:
|
||||
NameExpression(enum StringOperator op, std::list<std::string> &t, bool ic):
|
||||
NameExpression(enum StringOperator op, const std::list<std::string> &t, bool ic):
|
||||
StringExpression(op,t,ic) {}
|
||||
bool eval(const ExpFileEntry& file);
|
||||
|
||||
@ -290,7 +290,7 @@ public:
|
||||
|
||||
class PathExpression: public StringExpression {
|
||||
public:
|
||||
PathExpression(enum StringOperator op, std::list<std::string> &t, bool ic):
|
||||
PathExpression(enum StringOperator op, const std::list<std::string> &t, bool ic):
|
||||
StringExpression(op,t,ic) {}
|
||||
bool eval(const ExpFileEntry& file);
|
||||
|
||||
@ -305,7 +305,7 @@ public:
|
||||
|
||||
class ExtExpression: public StringExpression {
|
||||
public:
|
||||
ExtExpression(enum StringOperator op, std::list<std::string> &t, bool ic):
|
||||
ExtExpression(enum StringOperator op, const std::list<std::string> &t, bool ic):
|
||||
StringExpression(op,t,ic) {}
|
||||
bool eval(const ExpFileEntry& file);
|
||||
|
||||
@ -320,7 +320,7 @@ public:
|
||||
|
||||
class HashExpression: public StringExpression {
|
||||
public:
|
||||
HashExpression(enum StringOperator op, std::list<std::string> &t):
|
||||
HashExpression(enum StringOperator op, const std::list<std::string> &t):
|
||||
StringExpression(op,t, true) {}
|
||||
bool eval(const ExpFileEntry& file);
|
||||
|
||||
|
@ -168,10 +168,9 @@ public:
|
||||
|
||||
class RsFiles
|
||||
{
|
||||
public:
|
||||
|
||||
RsFiles() { return; }
|
||||
virtual ~RsFiles() { return; }
|
||||
public:
|
||||
RsFiles() {}
|
||||
virtual ~RsFiles() {}
|
||||
|
||||
/**
|
||||
* Provides file data for the gui: media streaming or rpc clients.
|
||||
@ -278,8 +277,8 @@ class RsFiles
|
||||
***/
|
||||
virtual void requestDirUpdate(void *ref) =0 ; // triggers the update of the given reference. Used when browsing.
|
||||
|
||||
virtual void setDownloadDirectory(std::string path) = 0;
|
||||
virtual void setPartialsDirectory(std::string path) = 0;
|
||||
virtual bool setDownloadDirectory(std::string path) = 0;
|
||||
virtual bool setPartialsDirectory(std::string path) = 0;
|
||||
virtual std::string getDownloadDirectory() = 0;
|
||||
virtual std::string getPartialsDirectory() = 0;
|
||||
|
||||
|
@ -124,24 +124,27 @@ class RsGxsComment
|
||||
};
|
||||
|
||||
|
||||
class RsGxsCommentService
|
||||
struct RsGxsCommentService
|
||||
{
|
||||
public:
|
||||
RsGxsCommentService() {}
|
||||
virtual ~RsGxsCommentService() {}
|
||||
|
||||
RsGxsCommentService() { return; }
|
||||
virtual ~RsGxsCommentService() { return; }
|
||||
/** Get previously requested comment data with token */
|
||||
virtual bool getCommentData( uint32_t token,
|
||||
std::vector<RsGxsComment> &comments ) = 0;
|
||||
virtual bool getRelatedComments( uint32_t token,
|
||||
std::vector<RsGxsComment> &comments ) = 0;
|
||||
|
||||
virtual bool getCommentData(const uint32_t &token, std::vector<RsGxsComment> &comments) = 0;
|
||||
virtual bool getRelatedComments(const uint32_t &token, std::vector<RsGxsComment> &comments) = 0;
|
||||
virtual bool createComment(uint32_t &token, RsGxsComment &comment) = 0;
|
||||
virtual bool createVote(uint32_t &token, RsGxsVote &vote) = 0;
|
||||
|
||||
//virtual bool getDetailedCommentData(const uint32_t &token, std::vector<RsGxsComment> &comments);
|
||||
|
||||
virtual bool createComment(uint32_t &token, RsGxsComment &comment) = 0;
|
||||
virtual bool createVote(uint32_t &token, RsGxsVote &vote) = 0;
|
||||
|
||||
virtual bool acknowledgeComment(const uint32_t& token, std::pair<RsGxsGroupId, RsGxsMessageId>& msgId) = 0;
|
||||
virtual bool acknowledgeVote(const uint32_t& token, std::pair<RsGxsGroupId, RsGxsMessageId>& msgId) = 0;
|
||||
virtual bool acknowledgeComment(
|
||||
uint32_t token,
|
||||
std::pair<RsGxsGroupId, RsGxsMessageId>& msgId ) = 0;
|
||||
|
||||
virtual bool acknowledgeVote(
|
||||
uint32_t token,
|
||||
std::pair<RsGxsGroupId, RsGxsMessageId>& msgId ) = 0;
|
||||
};
|
||||
|
||||
|
||||
|
@ -40,8 +40,8 @@ class RsGxsChanges
|
||||
public:
|
||||
RsGxsChanges(): mService(0){}
|
||||
RsTokenService *mService;
|
||||
std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > mMsgs;
|
||||
std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > mMsgsMeta;
|
||||
std::map<RsGxsGroupId, std::set<RsGxsMessageId> > mMsgs;
|
||||
std::map<RsGxsGroupId, std::set<RsGxsMessageId> > mMsgsMeta;
|
||||
std::list<RsGxsGroupId> mGrps;
|
||||
std::list<RsGxsGroupId> mGrpsMeta;
|
||||
};
|
||||
|
@ -1,3 +1,23 @@
|
||||
/*
|
||||
* rsgxsifacetypes.h
|
||||
*
|
||||
* Copyright (C) 2013 crispy
|
||||
* Copyright (C) 2018 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/>.
|
||||
*/
|
||||
|
||||
/*
|
||||
* rsgxsifacetypes.h
|
||||
*
|
||||
@ -13,18 +33,20 @@
|
||||
#include <string>
|
||||
#include <inttypes.h>
|
||||
|
||||
#include <retroshare/rstypes.h>
|
||||
#include <retroshare/rsids.h>
|
||||
#include "retroshare/rstypes.h"
|
||||
#include "retroshare/rsids.h"
|
||||
#include "serialiser/rsserializable.h"
|
||||
#include "serialiser/rstypeserializer.h"
|
||||
|
||||
typedef GXSGroupId RsGxsGroupId;
|
||||
typedef Sha1CheckSum RsGxsMessageId;
|
||||
typedef GXSId RsGxsId;
|
||||
typedef GXSCircleId RsGxsCircleId;
|
||||
|
||||
typedef std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > GxsMsgIdResult;
|
||||
typedef std::map<RsGxsGroupId, std::set<RsGxsMessageId> > GxsMsgIdResult;
|
||||
typedef std::pair<RsGxsGroupId, RsGxsMessageId> RsGxsGrpMsgIdPair;
|
||||
typedef std::map<RsGxsGrpMsgIdPair, std::vector<RsGxsMessageId> > MsgRelatedIdResult;
|
||||
typedef std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > GxsMsgReq;
|
||||
typedef std::map<RsGxsGrpMsgIdPair, std::set<RsGxsMessageId> > MsgRelatedIdResult;
|
||||
typedef std::map<RsGxsGroupId, std::set<RsGxsMessageId> > GxsMsgReq;
|
||||
|
||||
struct RsMsgMetaData;
|
||||
|
||||
@ -34,7 +56,7 @@ typedef std::map<RsGxsGroupId, std::vector<RsMsgMetaData> > MsgMetaResult;
|
||||
class RsGxsGrpMetaData;
|
||||
class RsGxsMsgMetaData;
|
||||
|
||||
struct RsGroupMetaData
|
||||
struct RsGroupMetaData : RsSerializable
|
||||
{
|
||||
// (csoler) The correct default value to be used in mCircleType is GXS_CIRCLE_TYPE_PUBLIC, which is defined in rsgxscircles.h,
|
||||
// but because of a loop in the includes, I cannot include it here. So I replaced with its current value 0x0001.
|
||||
@ -73,6 +95,30 @@ struct RsGroupMetaData
|
||||
std::string mServiceString; // Service Specific Free-Form extra storage.
|
||||
RsPeerId mOriginator;
|
||||
RsGxsCircleId mInternalCircle;
|
||||
|
||||
/// @see RsSerializable
|
||||
void serial_process( RsGenericSerializer::SerializeJob j,
|
||||
RsGenericSerializer::SerializeContext& ctx )
|
||||
{
|
||||
RS_SERIAL_PROCESS(mGroupId);
|
||||
RS_SERIAL_PROCESS(mGroupName);
|
||||
RS_SERIAL_PROCESS(mGroupFlags);
|
||||
RS_SERIAL_PROCESS(mSignFlags);
|
||||
RS_SERIAL_PROCESS(mPublishTs);
|
||||
RS_SERIAL_PROCESS(mAuthorId);
|
||||
RS_SERIAL_PROCESS(mCircleId);
|
||||
RS_SERIAL_PROCESS(mCircleType);
|
||||
RS_SERIAL_PROCESS(mAuthenFlags);
|
||||
RS_SERIAL_PROCESS(mParentGrpId);
|
||||
RS_SERIAL_PROCESS(mSubscribeFlags);
|
||||
RS_SERIAL_PROCESS(mPop);
|
||||
RS_SERIAL_PROCESS(mVisibleMsgCount);
|
||||
RS_SERIAL_PROCESS(mLastPost);
|
||||
RS_SERIAL_PROCESS(mGroupStatus);
|
||||
RS_SERIAL_PROCESS(mServiceString);
|
||||
RS_SERIAL_PROCESS(mOriginator);
|
||||
RS_SERIAL_PROCESS(mInternalCircle);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
@ -46,7 +46,7 @@ class RsGxsMsgChange : public RsGxsNotify
|
||||
{
|
||||
public:
|
||||
RsGxsMsgChange(NotifyType type, bool metaChange) : NOTIFY_TYPE(type), mMetaChange(metaChange) {}
|
||||
std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > msgChangeMap;
|
||||
std::map<RsGxsGroupId, std::set<RsGxsMessageId> > msgChangeMap;
|
||||
NotifyType getType(){ return NOTIFY_TYPE;}
|
||||
bool metaChange() { return mMetaChange; }
|
||||
private:
|
||||
|
@ -6,7 +6,8 @@
|
||||
*
|
||||
* RetroShare C++ Interface.
|
||||
*
|
||||
* Copyright 2012-2012 by Robert Fernie.
|
||||
* Copyright (C) 2012 Robert Fernie.
|
||||
* Copyright (C) 2018 Gioacchino Mazzurco <gio@eigenlab.org>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
@ -36,9 +37,12 @@
|
||||
#include "retroshare/rsids.h"
|
||||
#include "serialiser/rstlvimage.h"
|
||||
#include "retroshare/rsgxscommon.h"
|
||||
#include "serialiser/rsserializable.h"
|
||||
#include "serialiser/rstypeserializer.h"
|
||||
#include "util/rsdeprecate.h"
|
||||
|
||||
/* The Main Interface Class - for information about your Peers */
|
||||
class RsIdentity;
|
||||
struct RsIdentity;
|
||||
extern RsIdentity *rsIdentity;
|
||||
|
||||
|
||||
@ -63,6 +67,7 @@ extern RsIdentity *rsIdentity;
|
||||
#define RSID_RELATION_OTHER 0x0008
|
||||
#define RSID_RELATION_UNKNOWN 0x0010
|
||||
|
||||
/// @deprecated remove toghether with RsGxsIdGroup::mRecognTags
|
||||
#define RSRECOGN_MAX_TAGINFO 5
|
||||
|
||||
// Unicode symbols. NOT utf-8 bytes, because of multi byte characters
|
||||
@ -77,27 +82,36 @@ static const uint32_t RS_IDENTITY_FLAGS_PGP_KNOWN = 0x0004;
|
||||
static const uint32_t RS_IDENTITY_FLAGS_IS_OWN_ID = 0x0008;
|
||||
static const uint32_t RS_IDENTITY_FLAGS_IS_DEPRECATED= 0x0010; // used to denote keys with deprecated fingerprint format.
|
||||
|
||||
class GxsReputation
|
||||
struct GxsReputation : RsSerializable
|
||||
{
|
||||
public:
|
||||
GxsReputation();
|
||||
GxsReputation();
|
||||
|
||||
bool updateIdScore(bool pgpLinked, bool pgpKnown);
|
||||
bool update(); // checks ranges and calculates overall score.
|
||||
int mOverallScore;
|
||||
int mIdScore; // PGP, Known, etc.
|
||||
int mOwnOpinion;
|
||||
int mPeerOpinion;
|
||||
bool updateIdScore(bool pgpLinked, bool pgpKnown);
|
||||
bool update(); /// checks ranges and calculates overall score.
|
||||
|
||||
int32_t mOverallScore;
|
||||
int32_t mIdScore; /// PGP, Known, etc.
|
||||
int32_t mOwnOpinion;
|
||||
int32_t mPeerOpinion;
|
||||
|
||||
/// @see RsSerializable
|
||||
void serial_process( RsGenericSerializer::SerializeJob j,
|
||||
RsGenericSerializer::SerializeContext& ctx )
|
||||
{
|
||||
RS_SERIAL_PROCESS(mOverallScore);
|
||||
RS_SERIAL_PROCESS(mIdScore);
|
||||
RS_SERIAL_PROCESS(mOwnOpinion);
|
||||
RS_SERIAL_PROCESS(mPeerOpinion);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
struct RsGxsIdGroup
|
||||
struct RsGxsIdGroup : RsSerializable
|
||||
{
|
||||
RsGxsIdGroup() :
|
||||
mLastUsageTS(0), mPgpKnown(false), mIsAContact(false) {}
|
||||
~RsGxsIdGroup() {}
|
||||
|
||||
|
||||
RsGroupMetaData mMeta;
|
||||
|
||||
// In GroupMetaData.
|
||||
@ -120,7 +134,7 @@ struct RsGxsIdGroup
|
||||
std::string mPgpIdSign;
|
||||
|
||||
// Recognition Strings. MAX# defined above.
|
||||
std::list<std::string> mRecognTags;
|
||||
RS_DEPRECATED std::list<std::string> mRecognTags;
|
||||
|
||||
// Avatar
|
||||
RsGxsImage mImage ;
|
||||
@ -131,8 +145,11 @@ struct RsGxsIdGroup
|
||||
bool mIsAContact; // change that into flags one day
|
||||
RsPgpId mPgpId;
|
||||
GxsReputation mReputation;
|
||||
};
|
||||
|
||||
/// @see RsSerializable
|
||||
void serial_process( RsGenericSerializer::SerializeJob j,
|
||||
RsGenericSerializer::SerializeContext& ctx );
|
||||
};
|
||||
|
||||
std::ostream &operator<<(std::ostream &out, const RsGxsIdGroup &group);
|
||||
|
||||
@ -149,12 +166,11 @@ class RsRecognTag
|
||||
};
|
||||
|
||||
|
||||
class RsRecognTagDetails
|
||||
struct RsRecognTagDetails
|
||||
{
|
||||
public:
|
||||
RsRecognTagDetails()
|
||||
:valid_from(0), valid_to(0), tag_class(0), tag_type(0),
|
||||
is_valid(false), is_pending(false) { return; }
|
||||
RsRecognTagDetails() :
|
||||
valid_from(0), valid_to(0), tag_class(0), tag_type(0), is_valid(false),
|
||||
is_pending(false) {}
|
||||
|
||||
time_t valid_from;
|
||||
time_t valid_to;
|
||||
@ -167,105 +183,166 @@ class RsRecognTagDetails
|
||||
bool is_pending;
|
||||
};
|
||||
|
||||
class RsIdOpinion
|
||||
{
|
||||
public:
|
||||
RsGxsId id;
|
||||
int rating;
|
||||
};
|
||||
|
||||
|
||||
class RsIdentityParameters
|
||||
struct RsIdentityParameters
|
||||
{
|
||||
public:
|
||||
RsIdentityParameters(): isPgpLinked(false) { return; }
|
||||
RsIdentityParameters() :
|
||||
isPgpLinked(false) {}
|
||||
|
||||
bool isPgpLinked;
|
||||
std::string nickname;
|
||||
RsGxsImage mImage ;
|
||||
std::string nickname;
|
||||
RsGxsImage mImage;
|
||||
};
|
||||
|
||||
class RsIdentityUsage
|
||||
struct RsIdentityUsage : RsSerializable
|
||||
{
|
||||
public:
|
||||
enum UsageCode { UNKNOWN_USAGE = 0x00,
|
||||
GROUP_ADMIN_SIGNATURE_CREATION = 0x01, // These 2 are normally not normal GXS identities, but nothing prevents it to happen either.
|
||||
GROUP_ADMIN_SIGNATURE_VALIDATION = 0x02,
|
||||
GROUP_AUTHOR_SIGNATURE_CREATION = 0x03, // not typically used, since most services do not require group author signatures
|
||||
GROUP_AUTHOR_SIGNATURE_VALIDATION = 0x04,
|
||||
MESSAGE_AUTHOR_SIGNATURE_CREATION = 0x05, // most common use case. Messages are signed by authors in e.g. forums.
|
||||
MESSAGE_AUTHOR_SIGNATURE_VALIDATION = 0x06,
|
||||
GROUP_AUTHOR_KEEP_ALIVE = 0x07, // Identities are stamped regularly by crawlign the set of messages for all groups. That helps keepign the useful identities in hand.
|
||||
MESSAGE_AUTHOR_KEEP_ALIVE = 0x08, // Identities are stamped regularly by crawlign the set of messages for all groups. That helps keepign the useful identities in hand.
|
||||
CHAT_LOBBY_MSG_VALIDATION = 0x09, // Chat lobby msgs are signed, so each time one comes, or a chat lobby event comes, a signature verificaiton happens.
|
||||
GLOBAL_ROUTER_SIGNATURE_CHECK = 0x0a, // Global router message validation
|
||||
GLOBAL_ROUTER_SIGNATURE_CREATION = 0x0b, // Global router message signature
|
||||
GXS_TUNNEL_DH_SIGNATURE_CHECK = 0x0c, //
|
||||
GXS_TUNNEL_DH_SIGNATURE_CREATION = 0x0d, //
|
||||
IDENTITY_DATA_UPDATE = 0x0e, // Group update on that identity data. Can be avatar, name, etc.
|
||||
IDENTITY_GENERIC_SIGNATURE_CHECK = 0x0f, // Any signature verified for that identity
|
||||
IDENTITY_GENERIC_SIGNATURE_CREATION = 0x10, // Any signature made by that identity
|
||||
IDENTITY_GENERIC_ENCRYPTION = 0x11,
|
||||
IDENTITY_GENERIC_DECRYPTION = 0x12,
|
||||
CIRCLE_MEMBERSHIP_CHECK = 0x13
|
||||
} ;
|
||||
enum UsageCode : uint8_t
|
||||
{
|
||||
UNKNOWN_USAGE = 0x00,
|
||||
|
||||
explicit RsIdentityUsage(uint16_t service,const RsIdentityUsage::UsageCode& code,const RsGxsGroupId& gid=RsGxsGroupId(),const RsGxsMessageId& mid=RsGxsMessageId(),uint64_t additional_id=0,const std::string& comment = std::string());
|
||||
/** These 2 are normally not normal GXS identities, but nothing prevents
|
||||
* it to happen either. */
|
||||
GROUP_ADMIN_SIGNATURE_CREATION = 0x01,
|
||||
GROUP_ADMIN_SIGNATURE_VALIDATION = 0x02,
|
||||
|
||||
uint16_t mServiceId; // Id of the service using that identity, as understood by rsServiceControl
|
||||
UsageCode mUsageCode; // Specific code to use. Will allow forming the correct translated message in the GUI if necessary.
|
||||
RsGxsGroupId mGrpId; // Group ID using the identity
|
||||
/** Not typically used, since most services do not require group author
|
||||
* signatures */
|
||||
GROUP_AUTHOR_SIGNATURE_CREATION = 0x03,
|
||||
GROUP_AUTHOR_SIGNATURE_VALIDATION = 0x04,
|
||||
|
||||
RsGxsMessageId mMsgId; // Message ID using the identity
|
||||
uint64_t mAdditionalId; // Some additional ID. Can be used for e.g. chat lobbies.
|
||||
std::string mComment ; // additional comment to be used mainly for debugging, but not GUI display
|
||||
/// most common use case. Messages are signed by authors in e.g. forums.
|
||||
MESSAGE_AUTHOR_SIGNATURE_CREATION = 0x05,
|
||||
MESSAGE_AUTHOR_SIGNATURE_VALIDATION = 0x06,
|
||||
|
||||
bool operator<(const RsIdentityUsage& u) const
|
||||
{
|
||||
return mHash < u.mHash ;
|
||||
}
|
||||
RsFileHash mHash ;
|
||||
/** Identities are stamped regularly by crawlign the set of messages for
|
||||
* all groups. That helps keepign the useful identities in hand. */
|
||||
GROUP_AUTHOR_KEEP_ALIVE = 0x07,
|
||||
MESSAGE_AUTHOR_KEEP_ALIVE = 0x08,
|
||||
|
||||
/** Chat lobby msgs are signed, so each time one comes, or a chat lobby
|
||||
* event comes, a signature verificaiton happens. */
|
||||
CHAT_LOBBY_MSG_VALIDATION = 0x09,
|
||||
|
||||
/// Global router message validation
|
||||
GLOBAL_ROUTER_SIGNATURE_CHECK = 0x0a,
|
||||
|
||||
/// Global router message signature
|
||||
GLOBAL_ROUTER_SIGNATURE_CREATION = 0x0b,
|
||||
|
||||
GXS_TUNNEL_DH_SIGNATURE_CHECK = 0x0c,
|
||||
GXS_TUNNEL_DH_SIGNATURE_CREATION = 0x0d,
|
||||
|
||||
/// Group update on that identity data. Can be avatar, name, etc.
|
||||
IDENTITY_DATA_UPDATE = 0x0e,
|
||||
|
||||
/// Any signature verified for that identity
|
||||
IDENTITY_GENERIC_SIGNATURE_CHECK = 0x0f,
|
||||
|
||||
/// Any signature made by that identity
|
||||
IDENTITY_GENERIC_SIGNATURE_CREATION = 0x10,
|
||||
|
||||
IDENTITY_GENERIC_ENCRYPTION = 0x11,
|
||||
IDENTITY_GENERIC_DECRYPTION = 0x12,
|
||||
CIRCLE_MEMBERSHIP_CHECK = 0x13
|
||||
} ;
|
||||
|
||||
RsIdentityUsage( uint16_t service, const RsIdentityUsage::UsageCode& code,
|
||||
const RsGxsGroupId& gid = RsGxsGroupId(),
|
||||
const RsGxsMessageId& mid = RsGxsMessageId(),
|
||||
uint64_t additional_id=0,
|
||||
const std::string& comment = std::string() );
|
||||
|
||||
/// Id of the service using that identity, as understood by rsServiceControl
|
||||
uint16_t mServiceId;
|
||||
|
||||
/** Specific code to use. Will allow forming the correct translated message
|
||||
* in the GUI if necessary. */
|
||||
UsageCode mUsageCode;
|
||||
|
||||
/// Group ID using the identity
|
||||
RsGxsGroupId mGrpId;
|
||||
|
||||
/// Message ID using the identity
|
||||
RsGxsMessageId mMsgId;
|
||||
|
||||
/// Some additional ID. Can be used for e.g. chat lobbies.
|
||||
uint64_t mAdditionalId;
|
||||
|
||||
/// additional comment to be used mainly for debugging, but not GUI display
|
||||
std::string mComment;
|
||||
|
||||
bool operator<(const RsIdentityUsage& u) const { return mHash < u.mHash; }
|
||||
RsFileHash mHash ;
|
||||
|
||||
/// @see RsSerializable
|
||||
void serial_process( RsGenericSerializer::SerializeJob j,
|
||||
RsGenericSerializer::SerializeContext& ctx )
|
||||
{
|
||||
RS_SERIAL_PROCESS(mServiceId);
|
||||
RS_SERIAL_PROCESS(mUsageCode);
|
||||
RS_SERIAL_PROCESS(mGrpId);
|
||||
RS_SERIAL_PROCESS(mMsgId);
|
||||
RS_SERIAL_PROCESS(mAdditionalId);
|
||||
RS_SERIAL_PROCESS(mComment);
|
||||
RS_SERIAL_PROCESS(mHash);
|
||||
}
|
||||
|
||||
friend struct RsTypeSerializer;
|
||||
private:
|
||||
/** Accessible only to friend class RsTypeSerializer needed for
|
||||
* deserialization */
|
||||
RsIdentityUsage();
|
||||
};
|
||||
|
||||
class RsIdentityDetails
|
||||
|
||||
struct RsIdentityDetails : RsSerializable
|
||||
{
|
||||
public:
|
||||
RsIdentityDetails()
|
||||
: mFlags(0), mLastUsageTS(0) { return; }
|
||||
RsIdentityDetails() : mFlags(0), mLastUsageTS(0) {}
|
||||
|
||||
RsGxsId mId;
|
||||
|
||||
// identity details.
|
||||
std::string mNickname;
|
||||
|
||||
uint32_t mFlags ;
|
||||
uint32_t mFlags;
|
||||
|
||||
// PGP Stuff.
|
||||
RsPgpId mPgpId;
|
||||
RsPgpId mPgpId;
|
||||
|
||||
// Recogn details.
|
||||
std::list<RsRecognTag> mRecognTags;
|
||||
/// @deprecated Recogn details.
|
||||
RS_DEPRECATED std::list<RsRecognTag> mRecognTags;
|
||||
|
||||
// Cyril: Reputation details. At some point we might want to merge information
|
||||
// between the two into a single global score. Since the old reputation system
|
||||
// is not finished yet, I leave this in place. We should decide what to do with it.
|
||||
RsReputations::ReputationInfo mReputation;
|
||||
/** Cyril: Reputation details. At some point we might want to merge
|
||||
* information between the two into a single global score. Since the old
|
||||
* reputation system is not finished yet, I leave this in place. We should
|
||||
* decide what to do with it.
|
||||
*/
|
||||
RsReputations::ReputationInfo mReputation;
|
||||
|
||||
// avatar
|
||||
RsGxsImage mAvatar ;
|
||||
RsGxsImage mAvatar;
|
||||
|
||||
// last usage
|
||||
time_t mLastUsageTS ;
|
||||
std::map<RsIdentityUsage,time_t> mUseCases ;
|
||||
time_t mLastUsageTS;
|
||||
|
||||
std::map<RsIdentityUsage,time_t> mUseCases;
|
||||
|
||||
/// @see RsSerializable
|
||||
virtual void serial_process(RsGenericSerializer::SerializeJob j,
|
||||
RsGenericSerializer::SerializeContext& ctx)
|
||||
{
|
||||
RS_SERIAL_PROCESS(mId);
|
||||
RS_SERIAL_PROCESS(mNickname);
|
||||
RS_SERIAL_PROCESS(mFlags);
|
||||
RS_SERIAL_PROCESS(mPgpId);
|
||||
//RS_SERIAL_PROCESS(mReputation);
|
||||
//RS_SERIAL_PROCESS(mAvatar);
|
||||
RS_SERIAL_PROCESS(mLastUsageTS);
|
||||
RS_SERIAL_PROCESS(mUseCases);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
class RsIdentity: public RsGxsIfaceHelper
|
||||
struct RsIdentity : RsGxsIfaceHelper
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
explicit RsIdentity(RsGxsIface *gxs): RsGxsIfaceHelper(gxs) {}
|
||||
virtual ~RsIdentity() {}
|
||||
|
||||
|
@ -61,14 +61,17 @@
|
||||
|
||||
/* TODO CLEANUP: RS_TOKREQ_ANSTYPE_* values are meaningless and not used by
|
||||
* RsTokenService or its implementation, and may be arbitrarly defined by each
|
||||
* GXS client as they are of no usage, their use is deprecated */
|
||||
* GXS client as they are of no usage, their use is deprecated, up until the
|
||||
* definitive cleanup is done new code must use RS_DEPRECATED_TOKREQ_ANSTYPE for
|
||||
* easier cleanup. */
|
||||
#ifndef RS_NO_WARN_DEPRECATED
|
||||
# warning RS_TOKREQ_ANSTYPE_* macros are deprecated!
|
||||
#endif
|
||||
#define RS_TOKREQ_ANSTYPE_LIST 0x0001
|
||||
#define RS_TOKREQ_ANSTYPE_SUMMARY 0x0002
|
||||
#define RS_TOKREQ_ANSTYPE_DATA 0x0003
|
||||
#define RS_TOKREQ_ANSTYPE_ACK 0x0004
|
||||
#define RS_DEPRECATED_TOKREQ_ANSTYPE 0x0000
|
||||
#define RS_TOKREQ_ANSTYPE_LIST 0x0001
|
||||
#define RS_TOKREQ_ANSTYPE_SUMMARY 0x0002
|
||||
#define RS_TOKREQ_ANSTYPE_DATA 0x0003
|
||||
#define RS_TOKREQ_ANSTYPE_ACK 0x0004
|
||||
|
||||
|
||||
/*!
|
||||
|
@ -36,6 +36,8 @@
|
||||
|
||||
#include <retroshare/rsids.h>
|
||||
#include <retroshare/rsflags.h>
|
||||
#include <serialiser/rsserializable.h>
|
||||
#include <serialiser/rstypeserializer.h>
|
||||
|
||||
#define USE_NEW_CHUNK_CHECKING_CODE
|
||||
|
||||
@ -118,13 +120,21 @@ class Condition
|
||||
std::string name;
|
||||
};
|
||||
|
||||
class PeerBandwidthLimits
|
||||
struct PeerBandwidthLimits : RsSerializable
|
||||
{
|
||||
public:
|
||||
PeerBandwidthLimits() : max_up_rate_kbs(0), max_dl_rate_kbs(0) {}
|
||||
|
||||
uint32_t max_up_rate_kbs ;
|
||||
uint32_t max_dl_rate_kbs ;
|
||||
PeerBandwidthLimits() : max_up_rate_kbs(0), max_dl_rate_kbs(0) {}
|
||||
|
||||
uint32_t max_up_rate_kbs;
|
||||
uint32_t max_dl_rate_kbs;
|
||||
|
||||
|
||||
/// @see RsSerializable
|
||||
void serial_process(RsGenericSerializer::SerializeJob j,
|
||||
RsGenericSerializer::SerializeContext& ctx)
|
||||
{
|
||||
RS_SERIAL_PROCESS(max_up_rate_kbs);
|
||||
RS_SERIAL_PROCESS(max_dl_rate_kbs);
|
||||
}
|
||||
};
|
||||
|
||||
//class SearchRequest // unused stuff.
|
||||
@ -295,7 +305,7 @@ class FileChunksInfo
|
||||
std::map<uint32_t, std::vector<SliceInfo> > pending_slices ;
|
||||
};
|
||||
|
||||
class CompressedChunkMap
|
||||
class CompressedChunkMap : public RsSerializable
|
||||
{
|
||||
public:
|
||||
CompressedChunkMap() {}
|
||||
@ -345,10 +355,16 @@ class CompressedChunkMap
|
||||
inline void set(uint32_t j) { _map[j >> 5] |= (1 << (j & 31)) ; }
|
||||
inline void reset(uint32_t j) { _map[j >> 5] &= ~(1 << (j & 31)) ; }
|
||||
|
||||
/// compressed map, one bit per chunk
|
||||
std::vector<uint32_t> _map ;
|
||||
/// compressed map, one bit per chunk
|
||||
std::vector<uint32_t> _map;
|
||||
|
||||
/// @see RsSerializable
|
||||
void serial_process(RsGenericSerializer::SerializeJob j,
|
||||
RsGenericSerializer::SerializeContext& ctx)
|
||||
{ RS_SERIAL_PROCESS(_map); }
|
||||
};
|
||||
|
||||
|
||||
template<class CRCTYPE> class t_CRCMap
|
||||
{
|
||||
public:
|
||||
|
@ -48,8 +48,8 @@ void RsBanListItem::serial_process(RsGenericSerializer::SerializeJob j,RsGeneric
|
||||
|
||||
void RsBanListConfigItem::serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx)
|
||||
{
|
||||
RsTypeSerializer::serial_process<uint32_t>(j,ctx,type,"type") ;
|
||||
RsTypeSerializer::serial_process (j,ctx,peerId,"peerId") ;
|
||||
RsTypeSerializer::serial_process<uint32_t>(j,ctx,banListType,"type") ;
|
||||
RsTypeSerializer::serial_process (j,ctx,banListPeerId,"peerId") ;
|
||||
RsTypeSerializer::serial_process<time_t> (j,ctx,update_time,"update_time") ;
|
||||
RsTypeSerializer::serial_process (j,ctx,banned_peers,"banned_peers") ;
|
||||
}
|
||||
|
@ -60,18 +60,20 @@ class RsBanListItem: public RsItem
|
||||
class RsBanListConfigItem: public RsItem
|
||||
{
|
||||
public:
|
||||
RsBanListConfigItem()
|
||||
:RsItem(RS_PKT_VERSION_SERVICE, RS_SERVICE_TYPE_BANLIST, RS_PKT_SUBTYPE_BANLIST_CONFIG_ITEM) {}
|
||||
RsBanListConfigItem()
|
||||
: RsItem(RS_PKT_VERSION_SERVICE, RS_SERVICE_TYPE_BANLIST, RS_PKT_SUBTYPE_BANLIST_CONFIG_ITEM)
|
||||
, banListType(0), update_time(0)
|
||||
{}
|
||||
|
||||
virtual ~RsBanListConfigItem(){}
|
||||
virtual void clear() { banned_peers.TlvClear() ; }
|
||||
virtual ~RsBanListConfigItem(){}
|
||||
virtual void clear() { banned_peers.TlvClear() ; }
|
||||
|
||||
void serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx);
|
||||
|
||||
uint32_t type ;
|
||||
RsPeerId peerId ;
|
||||
time_t update_time ;
|
||||
RsTlvBanList banned_peers;
|
||||
uint32_t banListType ;
|
||||
RsPeerId banListPeerId ;
|
||||
time_t update_time ;
|
||||
RsTlvBanList banned_peers;
|
||||
};
|
||||
|
||||
class RsBanListSerialiser: public RsServiceSerializer
|
||||
|
@ -28,6 +28,7 @@
|
||||
#include "rsitems/rsconfigitems.h"
|
||||
#include "retroshare/rspeers.h" // Needed for RsGroupInfo.
|
||||
|
||||
#include "serialiser/rsserializable.h"
|
||||
#include "serialiser/rstypeserializer.h"
|
||||
/***
|
||||
* #define RSSERIAL_DEBUG 1
|
||||
@ -89,7 +90,7 @@ void RsFileTransfer::serial_process(RsGenericSerializer::SerializeJob j,RsGeneri
|
||||
|
||||
RsTypeSerializer::serial_process<uint32_t> (j,ctx,flags,"flags") ;
|
||||
RsTypeSerializer::serial_process<uint32_t> (j,ctx,chunk_strategy,"chunk_strategy") ;
|
||||
RsTypeSerializer::serial_process (j,ctx,compressed_chunk_map,"compressed_chunk_map") ;
|
||||
RS_SERIAL_PROCESS(compressed_chunk_map);
|
||||
}
|
||||
|
||||
void RsFileConfigItem::serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx)
|
||||
@ -136,9 +137,9 @@ RsItem *RsPeerConfigSerialiser::create_item(uint8_t item_type,uint8_t item_subty
|
||||
|
||||
void RsPeerNetItem::clear()
|
||||
{
|
||||
peerId.clear();
|
||||
pgpId.clear();
|
||||
location.clear();
|
||||
nodePeerId.clear();
|
||||
pgpId.clear();
|
||||
location.clear();
|
||||
netMode = 0;
|
||||
vs_disc = 0;
|
||||
vs_dht = 0;
|
||||
@ -159,7 +160,7 @@ void RsPeerNetItem::clear()
|
||||
}
|
||||
void RsPeerNetItem::serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx)
|
||||
{
|
||||
RsTypeSerializer::serial_process(j,ctx,peerId,"peerId") ;
|
||||
RsTypeSerializer::serial_process(j,ctx,nodePeerId,"peerId") ;
|
||||
RsTypeSerializer::serial_process(j,ctx,pgpId,"pgpId") ;
|
||||
RsTypeSerializer::serial_process(j,ctx,TLV_TYPE_STR_LOCATION,location,"location") ;
|
||||
|
||||
@ -192,31 +193,6 @@ void RsPeerStunItem::serial_process(RsGenericSerializer::SerializeJob j,RsGeneri
|
||||
RsTypeSerializer::serial_process<RsTlvItem>(j,ctx,stunList,"stunList") ;
|
||||
}
|
||||
|
||||
template<> uint32_t RsTypeSerializer::serial_size(const PeerBandwidthLimits& /*s*/)
|
||||
{
|
||||
return 4+4 ;
|
||||
}
|
||||
|
||||
template<> bool RsTypeSerializer::serialize(uint8_t data[], uint32_t size, uint32_t &offset,const PeerBandwidthLimits& s)
|
||||
{
|
||||
bool ok = true ;
|
||||
ok = ok && setRawUInt32(data,size,&offset,s.max_up_rate_kbs);
|
||||
ok = ok && setRawUInt32(data,size,&offset,s.max_dl_rate_kbs);
|
||||
return ok;
|
||||
}
|
||||
|
||||
template<> bool RsTypeSerializer::deserialize(const uint8_t data[], uint32_t size,uint32_t& offset,PeerBandwidthLimits& s)
|
||||
{
|
||||
bool ok = true ;
|
||||
ok = ok && getRawUInt32(data,size,&offset,&s.max_up_rate_kbs);
|
||||
ok = ok && getRawUInt32(data,size,&offset,&s.max_dl_rate_kbs);
|
||||
return ok;
|
||||
}
|
||||
|
||||
template<> void RsTypeSerializer::print_data(const std::string& /*n*/, const PeerBandwidthLimits& s)
|
||||
{
|
||||
std::cerr << " [Peer BW limit] " << s.max_up_rate_kbs << " / " << s.max_dl_rate_kbs << std::endl;
|
||||
}
|
||||
|
||||
RsNodeGroupItem::RsNodeGroupItem(const RsGroupInfo& g)
|
||||
:RsItem(RS_PKT_VERSION1, RS_PKT_CLASS_CONFIG, RS_PKT_TYPE_PEER_CONFIG, RS_PKT_SUBTYPE_NODE_GROUP)
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user