From da90bfec084e48f7b795a8dfee9834b08934a8c4 Mon Sep 17 00:00:00 2001
From: Chozabu
Date: Tue, 1 Sep 2015 13:43:29 +0100
Subject: [PATCH 001/240] add option to disable updates to systray tooltip
---
retroshare-gui/src/gui/MainWindow.cpp | 9 +++-
retroshare-gui/src/gui/MainWindow.h | 1 +
.../src/gui/settings/AppearancePage.cpp | 3 ++
.../src/gui/settings/AppearancePage.ui | 42 +++++++++++++++++--
4 files changed, 50 insertions(+), 5 deletions(-)
diff --git a/retroshare-gui/src/gui/MainWindow.cpp b/retroshare-gui/src/gui/MainWindow.cpp
index be269db84..593df8248 100644
--- a/retroshare-gui/src/gui/MainWindow.cpp
+++ b/retroshare-gui/src/gui/MainWindow.cpp
@@ -677,12 +677,19 @@ void MainWindow::updateTrayCombine()
updateFriends();
}
+void MainWindow::toggleStatusToolTip(bool toggle){
+ QString tray = "RetroShare\n";
+ tray += "\n" + nameAndLocation;
+ trayIcon->setToolTip(tray);
+}
+
void MainWindow::updateStatus()
{
// This call is essential to remove locks due to QEventLoop re-entrance while asking gpg passwds. Dont' remove it!
if(RsAutoUpdatePage::eventsLocked())
return;
-
+ if(Settings->valueFromGroup("StatusBar", "DisableSysTrayToolTip", QVariant(false)).toBool())
+ return;
float downKb = 0;
float upKb = 0;
rsConfig->GetCurrentDataRates(downKb, upKb);
diff --git a/retroshare-gui/src/gui/MainWindow.h b/retroshare-gui/src/gui/MainWindow.h
index fae0dacbd..897740123 100644
--- a/retroshare-gui/src/gui/MainWindow.h
+++ b/retroshare-gui/src/gui/MainWindow.h
@@ -184,6 +184,7 @@ public slots:
void setNewPage(int page);
void setCompactStatusMode(bool compact);
+ void toggleStatusToolTip(bool toggle);
protected:
/** Default Constructor */
MainWindow(QWidget *parent = 0, Qt::WindowFlags flags = 0);
diff --git a/retroshare-gui/src/gui/settings/AppearancePage.cpp b/retroshare-gui/src/gui/settings/AppearancePage.cpp
index 5f16bdc45..f132d43c2 100755
--- a/retroshare-gui/src/gui/settings/AppearancePage.cpp
+++ b/retroshare-gui/src/gui/settings/AppearancePage.cpp
@@ -45,6 +45,7 @@ AppearancePage::AppearancePage(QWidget * parent, Qt::WindowFlags flags)
connect(ui.checkBoxHideSoundStatus, SIGNAL(toggled(bool)), pMainWindow->soundStatusInstance(), SLOT(setHidden(bool)));
connect(ui.checkBoxHideToasterDisable, SIGNAL(toggled(bool)), pMainWindow->toasterDisableInstance(), SLOT(setHidden(bool)));
connect(ui.checkBoxShowSystrayOnStatus, SIGNAL(toggled(bool)), pMainWindow->sysTrayStatusInstance(), SLOT(setVisible(bool)));
+ connect(ui.checkBoxDisableSysTrayToolTip, SIGNAL(toggled(bool)), pMainWindow, SLOT(toggleStatusToolTip(bool)));
/* Populate combo boxes */
foreach (QString code, LanguageSupport::languageCodes()) {
@@ -142,6 +143,7 @@ bool AppearancePage::save(QString &errmsg)
Settings->setValueToGroup("StatusBar", "HideSound", QVariant(ui.checkBoxHideSoundStatus->isChecked()));
Settings->setValueToGroup("StatusBar", "HideToaster", QVariant(ui.checkBoxHideToasterDisable->isChecked()));
Settings->setValueToGroup("StatusBar", "ShowSysTrayOnStatusBar", QVariant(ui.checkBoxShowSystrayOnStatus->isChecked()));
+ Settings->setValueToGroup("StatusBar", "DisableSysTrayToolTip", QVariant(ui.checkBoxDisableSysTrayToolTip->isChecked()));
return true;
}
@@ -228,6 +230,7 @@ void AppearancePage::load()
ui.checkBoxHideSoundStatus->setChecked(Settings->valueFromGroup("StatusBar", "HideSound", QVariant(false)).toBool());
ui.checkBoxHideToasterDisable->setChecked(Settings->valueFromGroup("StatusBar", "HideToaster", QVariant(false)).toBool());
ui.checkBoxShowSystrayOnStatus->setChecked(Settings->valueFromGroup("StatusBar", "ShowSysTrayOnStatusBar", QVariant(false)).toBool());
+ ui.checkBoxDisableSysTrayToolTip->setChecked(Settings->valueFromGroup("StatusBar", "DisableSysTrayToolTip", QVariant(false)).toBool());
}
diff --git a/retroshare-gui/src/gui/settings/AppearancePage.ui b/retroshare-gui/src/gui/settings/AppearancePage.ui
index 027668dc2..95f3bf297 100755
--- a/retroshare-gui/src/gui/settings/AppearancePage.ui
+++ b/retroshare-gui/src/gui/settings/AppearancePage.ui
@@ -14,7 +14,16 @@
Qt::NoContextMenu
-
+
+ 6
+
+
+ 6
+
+
+ 6
+
+
6
@@ -199,7 +208,16 @@
QFrame::Plain
-
+
+ 2
+
+
+ 2
+
+
+ 2
+
+
2
-
@@ -212,7 +230,7 @@
-
- On List Item
+ On List Ite&m
@@ -248,7 +266,16 @@
QFrame::Plain
-
+
+ 2
+
+
+ 2
+
+
+ 2
+
+
2
-
@@ -461,6 +488,13 @@
+ -
+
+
+ Disable SysTray ToolTip
+
+
+
From 1630577e0418bdbe59b7b1e441d38e6f51ec16f7 Mon Sep 17 00:00:00 2001
From: Chozabu
Date: Wed, 2 Sep 2015 01:09:39 +0100
Subject: [PATCH 002/240] dont set tooltip if enabling updates, set tooltip on
save incase of update between click and save
---
retroshare-gui/src/gui/MainWindow.cpp | 1 +
retroshare-gui/src/gui/settings/AppearancePage.cpp | 1 +
2 files changed, 2 insertions(+)
diff --git a/retroshare-gui/src/gui/MainWindow.cpp b/retroshare-gui/src/gui/MainWindow.cpp
index 593df8248..e3b975843 100644
--- a/retroshare-gui/src/gui/MainWindow.cpp
+++ b/retroshare-gui/src/gui/MainWindow.cpp
@@ -678,6 +678,7 @@ void MainWindow::updateTrayCombine()
}
void MainWindow::toggleStatusToolTip(bool toggle){
+ if(!toggle)return;
QString tray = "RetroShare\n";
tray += "\n" + nameAndLocation;
trayIcon->setToolTip(tray);
diff --git a/retroshare-gui/src/gui/settings/AppearancePage.cpp b/retroshare-gui/src/gui/settings/AppearancePage.cpp
index f132d43c2..0d431e996 100755
--- a/retroshare-gui/src/gui/settings/AppearancePage.cpp
+++ b/retroshare-gui/src/gui/settings/AppearancePage.cpp
@@ -144,6 +144,7 @@ bool AppearancePage::save(QString &errmsg)
Settings->setValueToGroup("StatusBar", "HideToaster", QVariant(ui.checkBoxHideToasterDisable->isChecked()));
Settings->setValueToGroup("StatusBar", "ShowSysTrayOnStatusBar", QVariant(ui.checkBoxShowSystrayOnStatus->isChecked()));
Settings->setValueToGroup("StatusBar", "DisableSysTrayToolTip", QVariant(ui.checkBoxDisableSysTrayToolTip->isChecked()));
+ MainWindow::getInstance()->toggleStatusToolTip(ui.checkBoxDisableSysTrayToolTip->isChecked());
return true;
}
From 3d6e9783f6aa805811c40507e54e5289f40c37d8 Mon Sep 17 00:00:00 2001
From: defnax
Date: Wed, 2 Sep 2015 13:06:15 +0200
Subject: [PATCH 003/240] Fixed Status Label on Distant Chat
---
.../src/gui/chat/PopupDistantChatDialog.cpp | 15 +++++++++------
.../src/gui/chat/PopupDistantChatDialog.h | 2 +-
2 files changed, 10 insertions(+), 7 deletions(-)
diff --git a/retroshare-gui/src/gui/chat/PopupDistantChatDialog.cpp b/retroshare-gui/src/gui/chat/PopupDistantChatDialog.cpp
index 334ab1b82..890fd0e40 100644
--- a/retroshare-gui/src/gui/chat/PopupDistantChatDialog.cpp
+++ b/retroshare-gui/src/gui/chat/PopupDistantChatDialog.cpp
@@ -46,8 +46,11 @@ PopupDistantChatDialog::~PopupDistantChatDialog()
PopupDistantChatDialog::PopupDistantChatDialog(QWidget *parent, Qt::WindowFlags flags)
: PopupChatDialog(parent,flags)
{
- _status_label = new QLabel ;
+ _status_label = new QToolButton ;
_update_timer = new QTimer ;
+
+ _status_label->setAutoRaise(true);
+ _status_label->setIconSize(QSize(24,24));
_update_timer->setInterval(1000) ;
QObject::connect(_update_timer,SIGNAL(timeout()),this,SLOT(updateDisplay())) ;
@@ -94,7 +97,7 @@ void PopupDistantChatDialog::updateDisplay()
switch(status)
{
case RS_DISTANT_CHAT_STATUS_UNKNOWN: //std::cerr << "Unknown hash. Error!" << std::endl;
- _status_label->setPixmap(QPixmap(IMAGE_GRY_LED)) ;
+ _status_label->setIcon(QIcon(IMAGE_GRY_LED)) ;
msg = tr("Hash Error. No tunnel.");
_status_label->setToolTip(msg) ;
getChatWidget()->updateStatusString("%1", msg, true);
@@ -102,7 +105,7 @@ void PopupDistantChatDialog::updateDisplay()
setPeerStatus(RS_STATUS_OFFLINE) ;
break ;
case RS_DISTANT_CHAT_STATUS_REMOTELY_CLOSED: std::cerr << "Chat remotely closed. " << std::endl;
- _status_label->setPixmap(QPixmap(IMAGE_RED_LED)) ;
+ _status_label->setIcon(QIcon(IMAGE_RED_LED)) ;
_status_label->setToolTip(QObject::tr("Distant peer has closed the chat")) ;
getChatWidget()->updateStatusString("%1", tr("The person you're talking to has deleted the secured chat tunnel. You may remove the chat window now."), true);
@@ -111,7 +114,7 @@ void PopupDistantChatDialog::updateDisplay()
break ;
case RS_DISTANT_CHAT_STATUS_TUNNEL_DN: //std::cerr << "Tunnel asked. Waiting for reponse. " << std::endl;
- _status_label->setPixmap(QPixmap(IMAGE_RED_LED)) ;
+ _status_label->setIcon(QIcon(IMAGE_RED_LED)) ;
msg = QObject::tr("Tunnel is pending...");
_status_label->setToolTip(msg) ;
getChatWidget()->updateStatusString("%1", msg, true);
@@ -119,7 +122,7 @@ void PopupDistantChatDialog::updateDisplay()
setPeerStatus(RS_STATUS_OFFLINE) ;
break ;
case RS_DISTANT_CHAT_STATUS_TUNNEL_OK: //std::cerr << "Tunnel is ok. " << std::endl;
- _status_label->setPixmap(QPixmap(IMAGE_YEL_LED)) ;
+ _status_label->setIcon(QIcon(IMAGE_YEL_LED)) ;
msg = QObject::tr("Secured tunnel established. Waiting for ACK...");
_status_label->setToolTip(msg) ;
getChatWidget()->updateStatusString("%1", msg, true);
@@ -127,7 +130,7 @@ void PopupDistantChatDialog::updateDisplay()
setPeerStatus(RS_STATUS_ONLINE) ;
break ;
case RS_DISTANT_CHAT_STATUS_CAN_TALK: //std::cerr << "Tunnel is ok and data is transmitted." << std::endl;
- _status_label->setPixmap(QPixmap(IMAGE_GRN_LED)) ;
+ _status_label->setIcon(QIcon(IMAGE_GRN_LED)) ;
msg = QObject::tr("Secured tunnel is working. You can talk!");
_status_label->setToolTip(msg) ;
getChatWidget()->unblockSending();
diff --git a/retroshare-gui/src/gui/chat/PopupDistantChatDialog.h b/retroshare-gui/src/gui/chat/PopupDistantChatDialog.h
index 62c17a5c0..2747ef09a 100644
--- a/retroshare-gui/src/gui/chat/PopupDistantChatDialog.h
+++ b/retroshare-gui/src/gui/chat/PopupDistantChatDialog.h
@@ -49,7 +49,7 @@ class PopupDistantChatDialog: public PopupChatDialog
private:
QTimer *_update_timer ;
RsGxsId _pid ;
- QLabel *_status_label ;
+ QToolButton *_status_label ;
friend class ChatDialog;
};
From 661453653c039659d69263118d71b0748eb6018b Mon Sep 17 00:00:00 2001
From: thunder2
Date: Fri, 4 Sep 2015 01:00:55 +0200
Subject: [PATCH 004/240] Added register of codecs to VOIP.
---
plugins/VOIP/VOIPPlugin.cpp | 2 ++
1 file changed, 2 insertions(+)
diff --git a/plugins/VOIP/VOIPPlugin.cpp b/plugins/VOIP/VOIPPlugin.cpp
index 08a2dbac3..f914aa81b 100644
--- a/plugins/VOIP/VOIPPlugin.cpp
+++ b/plugins/VOIP/VOIPPlugin.cpp
@@ -98,6 +98,8 @@ VOIPPlugin::VOIPPlugin()
Q_INIT_RESOURCE(VOIP_images);
Q_INIT_RESOURCE(VOIP_qss);
+
+ avcodec_register_all();
}
void VOIPPlugin::setInterfaces(RsPlugInInterfaces &interfaces)
From 0a843989e467dedd9df100bfb4e61cf11612436d Mon Sep 17 00:00:00 2001
From: Phenom
Date: Thu, 3 Sep 2015 19:14:30 +0200
Subject: [PATCH 005/240] Fix VOIP compilation with recent libavutil-dev
package. /usr/include/libavutil/common.h error 'UINT64C' was not declared in
this scope.
---
plugins/VOIP/VOIP.pro | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/plugins/VOIP/VOIP.pro b/plugins/VOIP/VOIP.pro
index e560a8501..660a17221 100644
--- a/plugins/VOIP/VOIP.pro
+++ b/plugins/VOIP/VOIP.pro
@@ -24,8 +24,6 @@ linux-* {
}
win32 {
- # ffmpeg
- QMAKE_CXXFLAGS += -D__STDC_CONSTANT_MACROS
LIBS_DIR = $$PWD/../../../libs
LIBS += -L"$$LIBS_DIR/lib/opencv"
@@ -34,6 +32,9 @@ win32 {
LIBS += -lopencv_core$$OPENCV_VERSION -lopencv_highgui$$OPENCV_VERSION -lopencv_imgproc$$OPENCV_VERSION -llibjpeg -llibtiff -llibpng -llibjasper -lIlmImf -lole32 -loleaut32 -luuid -lavicap32 -lavifil32 -lvfw32 -lz
}
+# ffmpeg (and libavutil: https://github.com/ffms/ffms2/issues/11)
+QMAKE_CXXFLAGS += -D__STDC_CONSTANT_MACROS
+
QMAKE_CXXFLAGS *= -Wall
SOURCES = VOIPPlugin.cpp \
From 6b94248d3bcb9259a74ba1e293528d7ebe14e606 Mon Sep 17 00:00:00 2001
From: Phenom
Date: Fri, 4 Sep 2015 17:28:45 +0200
Subject: [PATCH 006/240] Fix Travis CI compilation by adding libavutil-dev
package.
---
.travis.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.travis.yml b/.travis.yml
index d2d2c2781..5be37e084 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -7,7 +7,7 @@ before_install:
- echo $LANG
- echo $LC_ALL
- sudo apt-get update
- - sudo apt-get install build-essential checkinstall cmake g++ git libavcodec-dev libavformat-dev libbz2-dev libcurl4-openssl-dev libdc1394-22-dev libglib2.0-dev libcv-dev libopencv-highgui-dev libhighgui-dev
+ - sudo apt-get install build-essential checkinstall cmake g++ git libavutil-dev libavcodec-dev libavformat-dev libbz2-dev libcurl4-openssl-dev libdc1394-22-dev libglib2.0-dev libcv-dev libopencv-highgui-dev libhighgui-dev
- sudo apt-get install libgnome-keyring-dev libgstreamer-plugins-base0.10-dev libgstreamer0.10-dev libjasper-dev libjpeg-dev libmicrohttpd-dev libopencv-dev libprotobuf-dev libqt4-dev
- sudo apt-get install libspeex-dev libspeexdsp-dev libsqlite3-dev libssl-dev libswscale-dev
- sudo apt-get install libtbb-dev libtiff4-dev libupnp-dev libv4l-dev libxine-dev libxslt1-dev libxss-dev make pkg-config protobuf-compiler python-dev python-numpy subversion git yasm qtmobility-dev
From 22816f0b9e84d3927450348218de1316a8a567b1 Mon Sep 17 00:00:00 2001
From: AsamK
Date: Fri, 4 Sep 2015 14:51:05 +0200
Subject: [PATCH 007/240] Remove unnecessary includes from VideoProcessor
libavutil/channel_layout.h isn't available on debian 7 wheezy
---
plugins/VOIP/gui/VideoProcessor.cpp | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/plugins/VOIP/gui/VideoProcessor.cpp b/plugins/VOIP/gui/VideoProcessor.cpp
index 20aca0410..27129216f 100644
--- a/plugins/VOIP/gui/VideoProcessor.cpp
+++ b/plugins/VOIP/gui/VideoProcessor.cpp
@@ -20,11 +20,11 @@ extern "C" {
#include
#include
-#include
-#include
+//#include
+//#include
#include
-#include
-#include
+//#include
+//#include
}
//#define DEBUG_MPEG_VIDEO 1
From 484edc3445467d47dc935ca9ac62f79aff05563a Mon Sep 17 00:00:00 2001
From: AsamK
Date: Fri, 4 Sep 2015 15:46:00 +0200
Subject: [PATCH 008/240] Fix build for openSUSE
Use qmake built-in pkgconfig functionality
---
plugins/VOIP/VOIP.pro | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/plugins/VOIP/VOIP.pro b/plugins/VOIP/VOIP.pro
index 660a17221..f8531bc5e 100644
--- a/plugins/VOIP/VOIP.pro
+++ b/plugins/VOIP/VOIP.pro
@@ -19,8 +19,12 @@ INCLUDEPATH += ../../retroshare-gui/src/temp/ui ../../libretroshare/src
#################################### Windows #####################################
linux-* {
- INCLUDEPATH += /usr/include
- LIBS += $$system(pkg-config --libs opencv)
+ CONFIG += link_pkgconfig
+
+ # Necessary for openSUSE
+ PKGCONFIG += libavcodec libavutil
+
+ PKGCONFIG += opencv
}
win32 {
From 976f53bba29007aaba3355b19b2737e8887fd02b Mon Sep 17 00:00:00 2001
From: AsamK
Date: Fri, 4 Sep 2015 17:29:50 +0200
Subject: [PATCH 009/240] Remove -lavformat from VOIP, it's unused
---
plugins/VOIP/VOIP.pro | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/plugins/VOIP/VOIP.pro b/plugins/VOIP/VOIP.pro
index f8531bc5e..013a5c39e 100644
--- a/plugins/VOIP/VOIP.pro
+++ b/plugins/VOIP/VOIP.pro
@@ -104,4 +104,4 @@ TRANSLATIONS += \
lang/VOIP_tr.ts \
lang/VOIP_zh_CN.ts
-LIBS += -lspeex -lspeexdsp -lavformat -lavcodec -lavutil
+LIBS += -lspeex -lspeexdsp -lavcodec -lavutil
From efc057e128ec2a2a19df4e1a66a566e25885c0a9 Mon Sep 17 00:00:00 2001
From: AsamK
Date: Fri, 4 Sep 2015 23:42:26 +0200
Subject: [PATCH 010/240] Fix build with libavcodec < 55
---
plugins/VOIP/gui/VideoProcessor.cpp | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/plugins/VOIP/gui/VideoProcessor.cpp b/plugins/VOIP/gui/VideoProcessor.cpp
index 27129216f..60b57e716 100644
--- a/plugins/VOIP/gui/VideoProcessor.cpp
+++ b/plugins/VOIP/gui/VideoProcessor.cpp
@@ -536,12 +536,24 @@ bool FFmpegVideo::encodeData(const QImage& image, uint32_t target_encoding_bitra
AVPacket pkt ;
av_init_packet(&pkt);
+#if LIBAVCODEC_VERSION_MAJOR < 55
+ pkt.size = avpicture_get_size(encoding_context->pix_fmt, encoding_context->width, encoding_context->height);
+ pkt.data = (uint8_t*)av_malloc(pkt.size);
+
+ // do
+ // {
+ int ret = avcodec_encode_video(encoding_context, pkt.data, pkt.size, frame) ;
+ if (ret > 0) {
+ got_output = ret;
+ }
+#else
pkt.data = NULL; // packet data will be allocated by the encoder
pkt.size = 0;
// do
// {
int ret = avcodec_encode_video2(encoding_context, &pkt, frame, &got_output) ;
+#endif
if (ret < 0)
{
From f2994b7558d47a1bf6992ff2ab05c26f8dc593b7 Mon Sep 17 00:00:00 2001
From: AsamK
Date: Fri, 4 Sep 2015 23:59:13 +0200
Subject: [PATCH 011/240] Old libav versions used constant without AV_ prefix
From Jenster
---
plugins/VOIP/gui/VideoProcessor.cpp | 19 +++++++++++++++----
1 file changed, 15 insertions(+), 4 deletions(-)
diff --git a/plugins/VOIP/gui/VideoProcessor.cpp b/plugins/VOIP/gui/VideoProcessor.cpp
index 60b57e716..0bc16dab0 100644
--- a/plugins/VOIP/gui/VideoProcessor.cpp
+++ b/plugins/VOIP/gui/VideoProcessor.cpp
@@ -325,8 +325,11 @@ FFmpegVideo::FFmpegVideo()
//AVCodecID codec_id = AV_CODEC_ID_H264 ;
//AVCodecID codec_id = AV_CODEC_ID_MPEG2VIDEO;
+#if LIBAVCODEC_VERSION_MAJOR < 55
+ CodecID codec_id = CODEC_ID_MPEG4;
+#else
AVCodecID codec_id = AV_CODEC_ID_MPEG4;
-
+#endif
uint8_t endcode[] = { 0, 0, 1, 0xb7 };
/* find the mpeg1 video encoder */
@@ -385,10 +388,15 @@ FFmpegVideo::FFmpegVideo()
*/
encoding_context->gop_size = 100;
//encoding_context->max_b_frames = 1;
+#if LIBAVCODEC_VERSION_MAJOR < 55
+ encoding_context->pix_fmt = PIX_FMT_YUV420P; //context->pix_fmt = PIX_FMT_RGB24;
+ if (codec_id == CODEC_ID_H264) {
+#else
encoding_context->pix_fmt = AV_PIX_FMT_YUV420P; //context->pix_fmt = AV_PIX_FMT_RGB24;
-
- if (codec_id == AV_CODEC_ID_H264)
+ if (codec_id == AV_CODEC_ID_H264) {
+#endif
av_opt_set(encoding_context->priv_data, "preset", "slow", 0);
+ }
/* open it */
if (avcodec_open2(encoding_context, encoding_codec, NULL) < 0)
@@ -428,7 +436,11 @@ FFmpegVideo::FFmpegVideo()
decoding_context->width = encoding_context->width;
decoding_context->height = encoding_context->height;
+#if LIBAVCODEC_VERSION_MAJOR < 55
+ decoding_context->pix_fmt = PIX_FMT_YUV420P;
+#else
decoding_context->pix_fmt = AV_PIX_FMT_YUV420P;
+#endif
if(decoding_codec->capabilities & CODEC_CAP_TRUNCATED)
decoding_context->flags |= CODEC_FLAG_TRUNCATED; // we do not send complete frames
@@ -694,4 +706,3 @@ bool FFmpegVideo::decodeData(const RsVOIPDataChunk& chunk,QImage& image)
return true ;
}
-
From 4e917ea26c6bdb3a4c60accb8b0b426a151adb57 Mon Sep 17 00:00:00 2001
From: AsamK
Date: Fri, 4 Sep 2015 17:43:52 +0200
Subject: [PATCH 012/240] Disable compiling of pegmarkdown by default, only
used for wiki
- Move unfinished CONFIGs to common retroshare.pri file
- Compile and link pegmarkdown only if CONFIG+=wikipoos is set
---
RetroShare.pro | 11 +++++++----
retroshare-gui/src/retroshare-gui.pro | 18 ++++--------------
retroshare.pri | 7 +++++++
3 files changed, 18 insertions(+), 18 deletions(-)
diff --git a/RetroShare.pro b/RetroShare.pro
index 4a1be6b49..c4c937448 100644
--- a/RetroShare.pro
+++ b/RetroShare.pro
@@ -7,7 +7,6 @@ SUBDIRS += \
libbitdht \
libretroshare \
libresapi \
- pegmarkdown \
retroshare_gui \
retroshare_nogui \
plugins
@@ -22,10 +21,8 @@ libretroshare.depends = openpgpsdk libbitdht
libresapi.file = libresapi/src/libresapi.pro
libresapi.depends = libretroshare
-pegmarkdown.file = supportlibs/pegmarkdown/pegmarkdown.pro
-
retroshare_gui.file = retroshare-gui/src/retroshare-gui.pro
-retroshare_gui.depends = libretroshare libresapi pegmarkdown
+retroshare_gui.depends = libretroshare libresapi
retroshare_gui.target = retroshare-gui
retroshare_nogui.file = retroshare-nogui/src/retroshare-nogui.pro
@@ -35,3 +32,9 @@ retroshare_nogui.target = retroshare-nogui
plugins.file = plugins/plugins.pro
plugins.depends = retroshare_gui
plugins.target = plugins
+
+wikipoos {
+ SUBDIRS += pegmarkdown
+ pegmarkdown.file = supportlibs/pegmarkdown/pegmarkdown.pro
+ retroshare_gui.depends += pegmarkdown
+}
diff --git a/retroshare-gui/src/retroshare-gui.pro b/retroshare-gui/src/retroshare-gui.pro
index 9727227e1..956e22a9f 100644
--- a/retroshare-gui/src/retroshare-gui.pro
+++ b/retroshare-gui/src/retroshare-gui.pro
@@ -34,13 +34,6 @@ CONFIG += gxsgui
DEFINES += RS_ENABLE_GXS
-unfinished {
- CONFIG += gxscircles
- CONFIG += gxsthewire
- CONFIG += gxsphotoshare
- CONFIG += wikipoos
-}
-
# Other Disabled Bits.
#CONFIG += framecatcher
#CONFIG += blogs
@@ -80,8 +73,6 @@ linux-* {
LIBS += ../../libretroshare/src/lib/libretroshare.a
LIBS *= -lX11 -lXss
- LIBS += ../../supportlibs/pegmarkdown/lib/libpegmarkdown.a
-
#LIBS *= -lglib-2.0
LIBS *= -rdynamic -ldl
DEFINES *= HAVE_XSS # for idle time, libx screensaver extensions
@@ -199,7 +190,6 @@ win32 {
LIBS += ../../libretroshare/src/lib/libretroshare.a
LIBS += -L"$$LIBS_DIR/lib"
- LIBS += ../../supportlibs/pegmarkdown/lib/libpegmarkdown.a
LIBS += -lsqlcipher
LIBS += -lssl -lcrypto -lpthread -lminiupnpc -lz -lws2_32
@@ -245,8 +235,6 @@ macx {
LIBS += -framework CoreFoundation
LIBS += -framework Security
- LIBS += ../../supportlibs/pegmarkdown/lib/libpegmarkdown.a
-
LIBS += ../../../lib/libsqlcipher.a
#LIBS += -lsqlite3
@@ -266,7 +254,6 @@ freebsd-* {
LIBS *= -lgnome-keyring
PRE_TARGETDEPS *= ../../libretroshare/src/lib/libretroshare.a
- LIBS += ../../supportlibs/pegmarkdown/lib/libpegmarkdown.a
LIBS += -lsqlite3
}
@@ -284,7 +271,6 @@ openbsd-* {
LIBS *= -lgnome-keyring
PRE_TARGETDEPS *= ../../libretroshare/src/lib/libretroshare.a
- LIBS += ../../supportlibs/pegmarkdown/lib/libpegmarkdown.a
LIBS += -lsqlite3
LIBS *= -rdynamic
@@ -302,6 +288,10 @@ openbsd-* {
DEPENDPATH += . ../../libretroshare/src/
INCLUDEPATH += ../../libretroshare/src/
+wikipoos {
+ LIBS += ../../supportlibs/pegmarkdown/lib/libpegmarkdown.a
+}
+
# webinterface
DEPENDPATH += ../../libresapi/src
INCLUDEPATH += ../../libresapi/src
diff --git a/retroshare.pri b/retroshare.pri
index b85b40cbc..3ed53ec47 100644
--- a/retroshare.pri
+++ b/retroshare.pri
@@ -5,3 +5,10 @@ unix {
isEmpty(LIB_DIR) { LIB_DIR = "$${PREFIX}/lib" }
isEmpty(DATA_DIR) { DATA_DIR = "$${PREFIX}/share/RetroShare06" }
}
+
+unfinished {
+ CONFIG += gxscircles
+ CONFIG += gxsthewire
+ CONFIG += gxsphotoshare
+ CONFIG += wikipoos
+}
From 1f134d343183f8319bc76a408cc7258ed123c794 Mon Sep 17 00:00:00 2001
From: AsamK
Date: Fri, 4 Sep 2015 17:48:20 +0200
Subject: [PATCH 013/240] Remove gxs CONFIG, it's always enabled now anyways
---
libretroshare/src/libretroshare.pro | 219 ++++++++++------------
retroshare-gui/src/retroshare-gui.pro | 4 -
retroshare-nogui/src/retroshare-nogui.pro | 4 -
retroshare.pri | 3 +
4 files changed, 107 insertions(+), 123 deletions(-)
diff --git a/libretroshare/src/libretroshare.pro b/libretroshare/src/libretroshare.pro
index 18ded24a5..1f07ca0b7 100644
--- a/libretroshare/src/libretroshare.pro
+++ b/libretroshare/src/libretroshare.pro
@@ -7,11 +7,6 @@ CONFIG -= qt
TARGET = retroshare
TARGET_PRL = libretroshare
-
-#GXS Stuff.
-# This should be disabled for releases until further notice.
-CONFIG += gxs
-
#CONFIG += dsdv
profiling {
@@ -464,8 +459,8 @@ HEADERS += serialiser/itempriorities.h \
serialiser/rsheartbeatitems.h \
serialiser/rsrttitems.h \
serialiser/rsgxsrecognitems.h \
- serialiser/rsgxsupdateitems.h \
- serialiser/rsserviceinfoitems.h \
+ serialiser/rsgxsupdateitems.h \
+ serialiser/rsserviceinfoitems.h \
HEADERS += services/p3msgservice.h \
services/p3service.h \
@@ -614,8 +609,8 @@ SOURCES += serialiser/rsbaseserial.cc \
serialiser/rsheartbeatitems.cc \
serialiser/rsrttitems.cc \
serialiser/rsgxsrecognitems.cc \
- serialiser/rsgxsupdateitems.cc \
- serialiser/rsserviceinfoitems.cc \
+ serialiser/rsgxsupdateitems.cc \
+ serialiser/rsserviceinfoitems.cc \
SOURCES += services/p3msgservice.cc \
services/p3service.cc \
@@ -696,129 +691,126 @@ SOURCES += zeroconf/p3zcnatassist.cc \
# new gxs cache system
# this should be disabled for releases until further notice.
-gxs {
- DEFINES *= RS_ENABLE_GXS
- DEFINES *= SQLITE_HAS_CODEC
- DEFINES *= GXS_ENABLE_SYNC_MSGS
+DEFINES *= SQLITE_HAS_CODEC
+DEFINES *= GXS_ENABLE_SYNC_MSGS
- HEADERS += serialiser/rsnxsitems.h \
- gxs/rsgds.h \
- gxs/rsgxs.h \
- gxs/rsdataservice.h \
- gxs/rsgxsnetservice.h \
- retroshare/rsgxsflags.h \
- retroshare/rsgxsifacetypes.h \
- gxs/rsgenexchange.h \
- gxs/rsnxsobserver.h \
- gxs/rsgxsdata.h \
- retroshare/rstokenservice.h \
- gxs/rsgxsdataaccess.h \
- retroshare/rsgxsservice.h \
- serialiser/rsgxsitems.h \
- util/retrodb.h \
- util/rsdbbind.h \
- gxs/rsgxsutil.h \
- util/contentvalue.h \
- gxs/gxssecurity.h \
- gxs/rsgxsifacehelper.h \
- gxs/gxstokenqueue.h \
- gxs/rsgxsnetutils.h \
- gxs/rsgxsiface.h \
- gxs/rsgxsrequesttypes.h
+HEADERS += serialiser/rsnxsitems.h \
+ gxs/rsgds.h \
+ gxs/rsgxs.h \
+ gxs/rsdataservice.h \
+ gxs/rsgxsnetservice.h \
+ retroshare/rsgxsflags.h \
+ retroshare/rsgxsifacetypes.h \
+ gxs/rsgenexchange.h \
+ gxs/rsnxsobserver.h \
+ gxs/rsgxsdata.h \
+ retroshare/rstokenservice.h \
+ gxs/rsgxsdataaccess.h \
+ retroshare/rsgxsservice.h \
+ serialiser/rsgxsitems.h \
+ util/retrodb.h \
+ util/rsdbbind.h \
+ gxs/rsgxsutil.h \
+ util/contentvalue.h \
+ gxs/gxssecurity.h \
+ gxs/rsgxsifacehelper.h \
+ gxs/gxstokenqueue.h \
+ gxs/rsgxsnetutils.h \
+ gxs/rsgxsiface.h \
+ gxs/rsgxsrequesttypes.h
- SOURCES += serialiser/rsnxsitems.cc \
- gxs/rsdataservice.cc \
- gxs/rsgenexchange.cc \
- gxs/rsgxsnetservice.cc \
- gxs/rsgxsdata.cc \
- serialiser/rsgxsitems.cc \
- gxs/rsgxsdataaccess.cc \
- util/retrodb.cc \
- util/contentvalue.cc \
- util/rsdbbind.cc \
- gxs/gxssecurity.cc \
- gxs/gxstokenqueue.cc \
- gxs/rsgxsnetutils.cc \
- gxs/rsgxsutil.cc \
- gxs/rsgxsrequesttypes.cc
+SOURCES += serialiser/rsnxsitems.cc \
+ gxs/rsdataservice.cc \
+ gxs/rsgenexchange.cc \
+ gxs/rsgxsnetservice.cc \
+ gxs/rsgxsdata.cc \
+ serialiser/rsgxsitems.cc \
+ gxs/rsgxsdataaccess.cc \
+ util/retrodb.cc \
+ util/contentvalue.cc \
+ util/rsdbbind.cc \
+ gxs/gxssecurity.cc \
+ gxs/gxstokenqueue.cc \
+ gxs/rsgxsnetutils.cc \
+ gxs/rsgxsutil.cc \
+ gxs/rsgxsrequesttypes.cc
- # Identity Service
- HEADERS += retroshare/rsidentity.h \
- gxs/rsgixs.h \
- services/p3idservice.h \
- serialiser/rsgxsiditems.h \
- services/p3gxsreputation.h \
- serialiser/rsgxsreputationitems.h \
+# Identity Service
+HEADERS += retroshare/rsidentity.h \
+ gxs/rsgixs.h \
+ services/p3idservice.h \
+ serialiser/rsgxsiditems.h \
+ services/p3gxsreputation.h \
+ serialiser/rsgxsreputationitems.h \
- SOURCES += services/p3idservice.cc \
- serialiser/rsgxsiditems.cc \
- services/p3gxsreputation.cc \
- serialiser/rsgxsreputationitems.cc \
+SOURCES += services/p3idservice.cc \
+ serialiser/rsgxsiditems.cc \
+ services/p3gxsreputation.cc \
+ serialiser/rsgxsreputationitems.cc \
- # GxsCircles Service
- HEADERS += services/p3gxscircles.h \
- serialiser/rsgxscircleitems.h \
- retroshare/rsgxscircles.h \
+# GxsCircles Service
+HEADERS += services/p3gxscircles.h \
+ serialiser/rsgxscircleitems.h \
+ retroshare/rsgxscircles.h \
- SOURCES += services/p3gxscircles.cc \
- serialiser/rsgxscircleitems.cc \
+SOURCES += services/p3gxscircles.cc \
+ serialiser/rsgxscircleitems.cc \
- # GxsForums Service
- HEADERS += retroshare/rsgxsforums.h \
- services/p3gxsforums.h \
- serialiser/rsgxsforumitems.h
+# GxsForums Service
+HEADERS += retroshare/rsgxsforums.h \
+ services/p3gxsforums.h \
+ serialiser/rsgxsforumitems.h
- SOURCES += services/p3gxsforums.cc \
- serialiser/rsgxsforumitems.cc \
+SOURCES += services/p3gxsforums.cc \
+ serialiser/rsgxsforumitems.cc \
- # GxsChannels Service
- HEADERS += retroshare/rsgxschannels.h \
- services/p3gxschannels.h \
- services/p3gxscommon.h \
- serialiser/rsgxscommentitems.h \
- serialiser/rsgxschannelitems.h \
+# GxsChannels Service
+HEADERS += retroshare/rsgxschannels.h \
+ services/p3gxschannels.h \
+ services/p3gxscommon.h \
+ serialiser/rsgxscommentitems.h \
+ serialiser/rsgxschannelitems.h \
- SOURCES += services/p3gxschannels.cc \
- services/p3gxscommon.cc \
- serialiser/rsgxscommentitems.cc \
- serialiser/rsgxschannelitems.cc \
+SOURCES += services/p3gxschannels.cc \
+ services/p3gxscommon.cc \
+ serialiser/rsgxscommentitems.cc \
+ serialiser/rsgxschannelitems.cc \
- # Wiki Service
- HEADERS += retroshare/rswiki.h \
- services/p3wiki.h \
- serialiser/rswikiitems.h
+# Wiki Service
+HEADERS += retroshare/rswiki.h \
+ services/p3wiki.h \
+ serialiser/rswikiitems.h
- SOURCES += services/p3wiki.cc \
- serialiser/rswikiitems.cc \
+SOURCES += services/p3wiki.cc \
+ serialiser/rswikiitems.cc \
- # Wire Service
- HEADERS += retroshare/rswire.h \
- services/p3wire.h \
- serialiser/rswireitems.h
+# Wire Service
+HEADERS += retroshare/rswire.h \
+ services/p3wire.h \
+ serialiser/rswireitems.h
- SOURCES += services/p3wire.cc \
- serialiser/rswireitems.cc \
+SOURCES += services/p3wire.cc \
+ serialiser/rswireitems.cc \
- # Posted Service
- HEADERS += services/p3postbase.h \
- services/p3posted.h \
- retroshare/rsposted.h \
- serialiser/rsposteditems.h
+# Posted Service
+HEADERS += services/p3postbase.h \
+ services/p3posted.h \
+ retroshare/rsposted.h \
+ serialiser/rsposteditems.h
- SOURCES += services/p3postbase.cc \
- services/p3posted.cc \
- serialiser/rsposteditems.cc
+SOURCES += services/p3postbase.cc \
+ services/p3posted.cc \
+ serialiser/rsposteditems.cc
- #Photo Service
- HEADERS += services/p3photoservice.h \
- retroshare/rsphoto.h \
- serialiser/rsphotoitems.h \
+#Photo Service
+HEADERS += services/p3photoservice.h \
+ retroshare/rsphoto.h \
+ serialiser/rsphotoitems.h \
- SOURCES += services/p3photoservice.cc \
- serialiser/rsphotoitems.cc \
-}
+SOURCES += services/p3photoservice.cc \
+ serialiser/rsphotoitems.cc \
@@ -858,6 +850,3 @@ test_bitdht {
# ENABLED UDP NOW.
}
-
-
-
diff --git a/retroshare-gui/src/retroshare-gui.pro b/retroshare-gui/src/retroshare-gui.pro
index 956e22a9f..658a86d5f 100644
--- a/retroshare-gui/src/retroshare-gui.pro
+++ b/retroshare-gui/src/retroshare-gui.pro
@@ -30,10 +30,6 @@ CONFIG += gxschannels
CONFIG += posted
CONFIG += gxsgui
-# Gxs is always enabled now.
-
-DEFINES += RS_ENABLE_GXS
-
# Other Disabled Bits.
#CONFIG += framecatcher
#CONFIG += blogs
diff --git a/retroshare-nogui/src/retroshare-nogui.pro b/retroshare-nogui/src/retroshare-nogui.pro
index a15cb1bb2..179187945 100644
--- a/retroshare-nogui/src/retroshare-nogui.pro
+++ b/retroshare-nogui/src/retroshare-nogui.pro
@@ -10,10 +10,6 @@ CONFIG += webui
CONFIG -= qt xml gui
CONFIG += link_prl
-# if you are linking against the libretroshare with gxs.
-# this option links against the required sqlite library.
-CONFIG += gxs
-
#CONFIG += debug
debug {
QMAKE_CFLAGS -= -O2
diff --git a/retroshare.pri b/retroshare.pri
index 3ed53ec47..5be591800 100644
--- a/retroshare.pri
+++ b/retroshare.pri
@@ -1,3 +1,6 @@
+# Gxs is always enabled now.
+DEFINES *= RS_ENABLE_GXS
+
unix {
isEmpty(PREFIX) { PREFIX = "/usr" }
isEmpty(BIN_DIR) { BIN_DIR = "$${PREFIX}/bin" }
From 2bf81be6a7afdac9f8c5a9e66e76858b2d9dfed5 Mon Sep 17 00:00:00 2001
From: AsamK
Date: Fri, 4 Sep 2015 17:52:25 +0200
Subject: [PATCH 014/240] Disable compiling of wikis in libretroshare
It is disabled in the gui anyway
---
libretroshare/src/libretroshare.pro | 42 +++++++++++++++------------
libretroshare/src/rsserver/rsinit.cc | 15 ++++++++--
retroshare-gui/src/retroshare-gui.pro | 9 +++---
retroshare.pri | 2 ++
4 files changed, 43 insertions(+), 25 deletions(-)
diff --git a/libretroshare/src/libretroshare.pro b/libretroshare/src/libretroshare.pro
index 1f07ca0b7..28c1c344d 100644
--- a/libretroshare/src/libretroshare.pro
+++ b/libretroshare/src/libretroshare.pro
@@ -778,21 +778,25 @@ SOURCES += services/p3gxschannels.cc \
serialiser/rsgxscommentitems.cc \
serialiser/rsgxschannelitems.cc \
-# Wiki Service
-HEADERS += retroshare/rswiki.h \
- services/p3wiki.h \
- serialiser/rswikiitems.h
+wikipoos {
+ # Wiki Service
+ HEADERS += retroshare/rswiki.h \
+ services/p3wiki.h \
+ serialiser/rswikiitems.h
-SOURCES += services/p3wiki.cc \
- serialiser/rswikiitems.cc \
+ SOURCES += services/p3wiki.cc \
+ serialiser/rswikiitems.cc \
+}
-# Wire Service
-HEADERS += retroshare/rswire.h \
- services/p3wire.h \
- serialiser/rswireitems.h
+gxsthewire {
+ # Wire Service
+ HEADERS += retroshare/rswire.h \
+ services/p3wire.h \
+ serialiser/rswireitems.h
-SOURCES += services/p3wire.cc \
- serialiser/rswireitems.cc \
+ SOURCES += services/p3wire.cc \
+ serialiser/rswireitems.cc \
+}
# Posted Service
HEADERS += services/p3postbase.h \
@@ -804,13 +808,15 @@ SOURCES += services/p3postbase.cc \
services/p3posted.cc \
serialiser/rsposteditems.cc
-#Photo Service
-HEADERS += services/p3photoservice.h \
- retroshare/rsphoto.h \
- serialiser/rsphotoitems.h \
+gxsphotoshare {
+ #Photo Service
+ HEADERS += services/p3photoservice.h \
+ retroshare/rsphoto.h \
+ serialiser/rsphotoitems.h \
-SOURCES += services/p3photoservice.cc \
- serialiser/rsphotoitems.cc \
+ SOURCES += services/p3photoservice.cc \
+ serialiser/rsphotoitems.cc \
+}
diff --git a/libretroshare/src/rsserver/rsinit.cc b/libretroshare/src/rsserver/rsinit.cc
index c0e7697fa..766e9bcf7 100644
--- a/libretroshare/src/rsserver/rsinit.cc
+++ b/libretroshare/src/rsserver/rsinit.cc
@@ -1364,9 +1364,9 @@ int RsServer::StartupRetroShare()
RS_SERVICE_GXS_TYPE_WIKI,
NULL, rsInitConfig->gxs_passwd);
+#ifdef RS_USE_WIKI
p3Wiki *mWiki = new p3Wiki(wiki_ds, NULL, mGxsIdService);
-
- // create GXS photo service
+ // create GXS wiki service
RsGxsNetService* wiki_ns = new RsGxsNetService(
RS_SERVICE_GXS_TYPE_WIKI, wiki_ds, nxsMgr,
mWiki, mWiki->getServiceInfo(),
@@ -1374,6 +1374,7 @@ int RsServer::StartupRetroShare()
pgpAuxUtils);
mWiki->setNetworkExchangeService(wiki_ns) ;
+#endif
/**** Forum GXS service ****/
@@ -1443,7 +1444,9 @@ int RsServer::StartupRetroShare()
pqih->addService(gxsid_ns, true);
pqih->addService(gxscircles_ns, true);
pqih->addService(posted_ns, true);
+#ifdef RS_USE_WIKI
pqih->addService(wiki_ns, true);
+#endif
pqih->addService(gxsforums_ns, true);
pqih->addService(gxschannels_ns, true);
//pqih->addService(photo_ns, true);
@@ -1619,7 +1622,9 @@ int RsServer::StartupRetroShare()
mConfigMgr->addConfiguration("gxschannels.cfg", gxschannels_ns);
mConfigMgr->addConfiguration("gxscircles.cfg", gxscircles_ns);
mConfigMgr->addConfiguration("posted.cfg", posted_ns);
+#ifdef RS_USE_WIKI
mConfigMgr->addConfiguration("wiki.cfg", wiki_ns);
+#endif
//mConfigMgr->addConfiguration("photo.cfg", photo_ns);
//mConfigMgr->addConfiguration("wire.cfg", wire_ns);
#endif
@@ -1728,7 +1733,9 @@ int RsServer::StartupRetroShare()
// Must Set the GXS pointers before starting threads.
rsIdentity = mGxsIdService;
rsGxsCircles = mGxsCircles;
+#if RS_USE_WIKI
rsWiki = mWiki;
+#endif
rsPosted = mPosted;
rsGxsForums = mGxsForums;
rsGxsChannels = mGxsChannels;
@@ -1739,7 +1746,9 @@ int RsServer::StartupRetroShare()
startServiceThread(mGxsIdService);
startServiceThread(mGxsCircles);
startServiceThread(mPosted);
+#if RS_USE_WIKI
startServiceThread(mWiki);
+#endif
startServiceThread(mGxsForums);
startServiceThread(mGxsChannels);
@@ -1750,7 +1759,9 @@ int RsServer::StartupRetroShare()
startServiceThread(gxsid_ns);
startServiceThread(gxscircles_ns);
startServiceThread(posted_ns);
+#if RS_USE_WIKI
startServiceThread(wiki_ns);
+#endif
startServiceThread(gxsforums_ns);
startServiceThread(gxschannels_ns);
diff --git a/retroshare-gui/src/retroshare-gui.pro b/retroshare-gui/src/retroshare-gui.pro
index 658a86d5f..c3ce9f59a 100644
--- a/retroshare-gui/src/retroshare-gui.pro
+++ b/retroshare-gui/src/retroshare-gui.pro
@@ -1108,7 +1108,8 @@ wikipoos {
HEADERS += gui/WikiPoos/WikiDialog.h \
gui/WikiPoos/WikiAddDialog.h \
gui/WikiPoos/WikiEditDialog.h \
-
+ gui/gxs/WikiGroupDialog.h \
+
FORMS += gui/WikiPoos/WikiDialog.ui \
gui/WikiPoos/WikiAddDialog.ui \
gui/WikiPoos/WikiEditDialog.ui \
@@ -1116,10 +1117,10 @@ wikipoos {
SOURCES += gui/WikiPoos/WikiDialog.cpp \
gui/WikiPoos/WikiAddDialog.cpp \
gui/WikiPoos/WikiEditDialog.cpp \
-
+ gui/gxs/WikiGroupDialog.cpp \
+
RESOURCES += gui/WikiPoos/Wiki_images.qrc
- DEFINES *= RS_USE_WIKI
}
@@ -1293,7 +1294,6 @@ posted {
gxsgui {
HEADERS += gui/gxs/GxsGroupDialog.h \
- gui/gxs/WikiGroupDialog.h \
gui/gxs/GxsIdDetails.h \
gui/gxs/GxsIdChooser.h \
gui/gxs/GxsIdLabel.h \
@@ -1330,7 +1330,6 @@ gxsgui {
# gui/gxs/GxsCommentTreeWidget.ui
SOURCES += gui/gxs/GxsGroupDialog.cpp \
- gui/gxs/WikiGroupDialog.cpp \
gui/gxs/GxsIdDetails.cpp \
gui/gxs/GxsIdChooser.cpp \
gui/gxs/GxsIdLabel.cpp \
diff --git a/retroshare.pri b/retroshare.pri
index 5be591800..6bbebfb39 100644
--- a/retroshare.pri
+++ b/retroshare.pri
@@ -15,3 +15,5 @@ unfinished {
CONFIG += gxsphotoshare
CONFIG += wikipoos
}
+
+wikipoos:DEFINES *= RS_USE_WIKI
From ae43058520bbabb93dd33e50723b9faf986e6c19 Mon Sep 17 00:00:00 2001
From: AsamK
Date: Fri, 4 Sep 2015 22:05:00 +0200
Subject: [PATCH 015/240] Make wikis compile
- rsWiki->updated() doesn't exist anymore, so I ported WikiDialog to
inherit from RsGxsUpdateBroadcastPage
- add -lglib-2.0 to pegmarkdown.pro
---
.../src/gui/WikiPoos/WikiDialog.cpp | 47 ++++++++-----------
retroshare-gui/src/gui/WikiPoos/WikiDialog.h | 11 ++---
.../src/gui/WikiPoos/WikiEditDialog.cpp | 4 +-
retroshare-gui/src/retroshare-gui.pro | 1 -
supportlibs/pegmarkdown/pegmarkdown.pro | 2 +
5 files changed, 28 insertions(+), 37 deletions(-)
diff --git a/retroshare-gui/src/gui/WikiPoos/WikiDialog.cpp b/retroshare-gui/src/gui/WikiPoos/WikiDialog.cpp
index b4a26dddb..a4be2189f 100644
--- a/retroshare-gui/src/gui/WikiPoos/WikiDialog.cpp
+++ b/retroshare-gui/src/gui/WikiPoos/WikiDialog.cpp
@@ -79,7 +79,7 @@
/** Constructor */
WikiDialog::WikiDialog(QWidget *parent)
-: MainPage(parent)
+: RsGxsUpdateBroadcastPage(rsWiki, parent)
{
/* Invoke the Qt Designer generated object setup routine */
ui.setupUi(this);
@@ -103,11 +103,6 @@ WikiDialog::WikiDialog(QWidget *parent)
connect(ui.groupTreeWidget, SIGNAL(treeCustomContextMenuRequested(QPoint)), this, SLOT(groupListCustomPopupMenu(QPoint)));
connect(ui.groupTreeWidget, SIGNAL(treeItemActivated(QString)), this, SLOT(wikiGroupChanged(QString)));
-
- QTimer *timer = new QTimer(this);
- timer->connect(timer, SIGNAL(timeout()), this, SLOT(checkUpdate()));
- timer->start(1000);
-
/* setup TokenQueue */
mWikiQueue = new TokenQueue(rsWiki->getTokenService(), this);
@@ -118,8 +113,6 @@ WikiDialog::WikiDialog(QWidget *parent)
mPopularGroups = ui.groupTreeWidget->addCategoryItem(tr("Popular Groups"), QIcon(IMAGE_FOLDERGREEN), false);
mOtherGroups = ui.groupTreeWidget->addCategoryItem(tr("Other Groups"), QIcon(IMAGE_FOLDERYELLOW), false);
- //Auto refresh seems not to work, temporary solution at start
- insertWikiGroups();
}
WikiDialog::~WikiDialog()
@@ -127,20 +120,6 @@ WikiDialog::~WikiDialog()
delete(mWikiQueue);
}
-void WikiDialog::checkUpdate()
-{
- /* update */
- if (!rsWiki)
- return;
-
- if (rsWiki->updated())
- {
- insertWikiGroups();
- }
-
- return;
-}
-
void WikiDialog::OpenOrShowAddPageDialog()
{
RsGxsGroupId groupId = getSelectedGroup();
@@ -362,11 +341,6 @@ const RsGxsGroupId& WikiDialog::getSelectedGroup()
/************************** Request / Response *************************/
/*** Loading Main Index ***/
-void WikiDialog::insertWikiGroups()
-{
- requestGroupMeta();
-}
-
void WikiDialog::requestGroupMeta()
{
std::cerr << "WikiDialog::requestGroupMeta()";
@@ -528,7 +502,7 @@ void WikiDialog::loadRequest(const TokenQueue *queue, const TokenRequest &req)
#define GXSGROUP_NEWGROUPID 1
case GXSGROUP_NEWGROUPID:
- insertWikiGroups();
+ requestGroupMeta();
break;
default:
std::cerr << "WikiDialog::loadRequest() ERROR: INVALID TYPE";
@@ -716,3 +690,20 @@ void WikiDialog::todo()
"Auto update Group trees"
"");
}
+
+void WikiDialog::updateDisplay(bool complete)
+{
+ if (complete || !getGrpIds().empty() || !getGrpIdsMeta().empty()) {
+ /* Update group list */
+ requestGroupMeta();
+ } else {
+ /* Update all groups of changed messages */
+ std::map > msgIds;
+ getAllMsgIds(msgIds);
+
+ std::map >::iterator msgIt;
+ for (msgIt = msgIds.begin(); msgIt != msgIds.end(); ++msgIt) {
+ wikiGroupChanged(QString::fromStdString(msgIt->first.toStdString()));
+ }
+ }
+}
diff --git a/retroshare-gui/src/gui/WikiPoos/WikiDialog.h b/retroshare-gui/src/gui/WikiPoos/WikiDialog.h
index f0dbd8c64..bf6a609ee 100644
--- a/retroshare-gui/src/gui/WikiPoos/WikiDialog.h
+++ b/retroshare-gui/src/gui/WikiPoos/WikiDialog.h
@@ -26,7 +26,7 @@
#include
-#include "retroshare-gui/mainpage.h"
+#include "gui/gxs/RsGxsUpdateBroadcastPage.h"
#include "ui_WikiDialog.h"
#include
@@ -40,7 +40,7 @@
class WikiAddDialog;
class WikiEditDialog;
-class WikiDialog : public MainPage, public TokenResponse
+class WikiDialog : public RsGxsUpdateBroadcastPage, public TokenResponse
{
Q_OBJECT
@@ -52,12 +52,13 @@ public:
virtual QString pageName() const { return tr("Wiki Pages") ; } //MainPage
virtual QString helpText() const { return ""; } //MainPage
+ void loadRequest(const TokenQueue *queue, const TokenRequest &req);
-void loadRequest(const TokenQueue *queue, const TokenRequest &req);
+public:
+ virtual void updateDisplay(bool complete);
private slots:
- void checkUpdate();
void OpenOrShowAddPageDialog();
void OpenOrShowAddGroupDialog();
void OpenOrShowEditDialog();
@@ -69,8 +70,6 @@ private slots:
void showGroupDetails();
void editGroupDetails();
- void insertWikiGroups();
-
// GroupTreeWidget stuff.
void groupListCustomPopupMenu(QPoint point);
void subscribeToGroup();
diff --git a/retroshare-gui/src/gui/WikiPoos/WikiEditDialog.cpp b/retroshare-gui/src/gui/WikiPoos/WikiEditDialog.cpp
index be5bc0721..709d0262c 100644
--- a/retroshare-gui/src/gui/WikiPoos/WikiEditDialog.cpp
+++ b/retroshare-gui/src/gui/WikiPoos/WikiEditDialog.cpp
@@ -733,7 +733,7 @@ void WikiEditDialog::loadBaseHistory(const uint32_t &token)
modItem->setText(WET_COL_DATE, text);
modItem->setData(WET_COL_DATE, WET_ROLE_SORT, sort);
}
- modItem->setId(page.mMeta.mAuthorId, WET_COL_AUTHORID);
+ modItem->setId(page.mMeta.mAuthorId, WET_COL_AUTHORID, false);
modItem->setText(WET_COL_PAGEID, QString::fromStdString(page.mMeta.mMsgId.toStdString()));
ui.treeWidget_History->addTopLevelItem(modItem);
@@ -847,7 +847,7 @@ void WikiEditDialog::loadEditTreeData(const uint32_t &token)
modItem->setText(WET_COL_DATE, text);
modItem->setData(WET_COL_DATE, WET_ROLE_SORT, sort);
}
- modItem->setId(snapshot.mMeta.mAuthorId, WET_COL_AUTHORID);
+ modItem->setId(snapshot.mMeta.mAuthorId, WET_COL_AUTHORID, false);
modItem->setText(WET_COL_PAGEID, QString::fromStdString(snapshot.mMeta.mMsgId.toStdString()));
/* find the parent */
diff --git a/retroshare-gui/src/retroshare-gui.pro b/retroshare-gui/src/retroshare-gui.pro
index c3ce9f59a..1d84cff73 100644
--- a/retroshare-gui/src/retroshare-gui.pro
+++ b/retroshare-gui/src/retroshare-gui.pro
@@ -69,7 +69,6 @@ linux-* {
LIBS += ../../libretroshare/src/lib/libretroshare.a
LIBS *= -lX11 -lXss
- #LIBS *= -lglib-2.0
LIBS *= -rdynamic -ldl
DEFINES *= HAVE_XSS # for idle time, libx screensaver extensions
DEFINES *= UBUNTU
diff --git a/supportlibs/pegmarkdown/pegmarkdown.pro b/supportlibs/pegmarkdown/pegmarkdown.pro
index 31bda9f64..ca818cc39 100644
--- a/supportlibs/pegmarkdown/pegmarkdown.pro
+++ b/supportlibs/pegmarkdown/pegmarkdown.pro
@@ -1,5 +1,6 @@
TEMPLATE = lib
CONFIG += staticlib
+CONFIG += create_prl
CONFIG -= qt
TARGET = pegmarkdown
@@ -15,6 +16,7 @@ debug {
################################# Linux ##########################################
linux-* {
DESTDIR = lib
+ LIBS *= -lglib-2.0
}
linux-g++ {
From d6f50c71f2f6559e4cc2c3fc83460725d8119cb7 Mon Sep 17 00:00:00 2001
From: AsamK
Date: Sat, 5 Sep 2015 15:44:10 +0200
Subject: [PATCH 016/240] Fix libav version check
- Off-by-one error in the #ifs
- Libav actually contains the old constants and functions as well,
marked as deprecated. Just the CodecID enum was removed completely.
---
plugins/VOIP/gui/VideoProcessor.cpp | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/plugins/VOIP/gui/VideoProcessor.cpp b/plugins/VOIP/gui/VideoProcessor.cpp
index 0bc16dab0..8389f713d 100644
--- a/plugins/VOIP/gui/VideoProcessor.cpp
+++ b/plugins/VOIP/gui/VideoProcessor.cpp
@@ -325,7 +325,7 @@ FFmpegVideo::FFmpegVideo()
//AVCodecID codec_id = AV_CODEC_ID_H264 ;
//AVCodecID codec_id = AV_CODEC_ID_MPEG2VIDEO;
-#if LIBAVCODEC_VERSION_MAJOR < 55
+#if LIBAVCODEC_VERSION_MAJOR < 54
CodecID codec_id = CODEC_ID_MPEG4;
#else
AVCodecID codec_id = AV_CODEC_ID_MPEG4;
@@ -388,7 +388,7 @@ FFmpegVideo::FFmpegVideo()
*/
encoding_context->gop_size = 100;
//encoding_context->max_b_frames = 1;
-#if LIBAVCODEC_VERSION_MAJOR < 55
+#if LIBAVCODEC_VERSION_MAJOR < 54
encoding_context->pix_fmt = PIX_FMT_YUV420P; //context->pix_fmt = PIX_FMT_RGB24;
if (codec_id == CODEC_ID_H264) {
#else
@@ -436,7 +436,7 @@ FFmpegVideo::FFmpegVideo()
decoding_context->width = encoding_context->width;
decoding_context->height = encoding_context->height;
-#if LIBAVCODEC_VERSION_MAJOR < 55
+#if LIBAVCODEC_VERSION_MAJOR < 54
decoding_context->pix_fmt = PIX_FMT_YUV420P;
#else
decoding_context->pix_fmt = AV_PIX_FMT_YUV420P;
@@ -548,7 +548,7 @@ bool FFmpegVideo::encodeData(const QImage& image, uint32_t target_encoding_bitra
AVPacket pkt ;
av_init_packet(&pkt);
-#if LIBAVCODEC_VERSION_MAJOR < 55
+#if LIBAVCODEC_VERSION_MAJOR < 54
pkt.size = avpicture_get_size(encoding_context->pix_fmt, encoding_context->width, encoding_context->height);
pkt.data = (uint8_t*)av_malloc(pkt.size);
From d4226b6815199e4090e9b600cf14e20df3b1eda4 Mon Sep 17 00:00:00 2001
From: thunder2
Date: Sat, 5 Sep 2015 21:31:38 +0200
Subject: [PATCH 017/240] Fixed Windows compile. Moved "-lsqlcipher" to
libretroshare.pro
---
libretroshare/src/libretroshare.pro | 2 ++
retroshare-gui/src/retroshare-gui.pro | 2 --
retroshare-nogui/src/retroshare-nogui.pro | 4 ----
3 files changed, 2 insertions(+), 6 deletions(-)
diff --git a/libretroshare/src/libretroshare.pro b/libretroshare/src/libretroshare.pro
index 28c1c344d..57ae12601 100644
--- a/libretroshare/src/libretroshare.pro
+++ b/libretroshare/src/libretroshare.pro
@@ -263,6 +263,8 @@ win32 {
CONFIG += upnp_miniupnpc
+ LIBS += -lsqlcipher
+
LIBS_DIR = $$PWD/../../../libs
OPENPGPSDK_DIR = $$PWD/../../openpgpsdk/src
diff --git a/retroshare-gui/src/retroshare-gui.pro b/retroshare-gui/src/retroshare-gui.pro
index 1d84cff73..db03e2df5 100644
--- a/retroshare-gui/src/retroshare-gui.pro
+++ b/retroshare-gui/src/retroshare-gui.pro
@@ -185,8 +185,6 @@ win32 {
LIBS += ../../libretroshare/src/lib/libretroshare.a
LIBS += -L"$$LIBS_DIR/lib"
- LIBS += -lsqlcipher
-
LIBS += -lssl -lcrypto -lpthread -lminiupnpc -lz -lws2_32
LIBS += -luuid -lole32 -liphlpapi -lcrypt32 -lgdi32
LIBS += -lole32 -lwinmm
diff --git a/retroshare-nogui/src/retroshare-nogui.pro b/retroshare-nogui/src/retroshare-nogui.pro
index 179187945..cb4b79bac 100644
--- a/retroshare-nogui/src/retroshare-nogui.pro
+++ b/retroshare-nogui/src/retroshare-nogui.pro
@@ -93,10 +93,6 @@ win32 {
DEPENDPATH += $$LIBS_DIR/include
INCLUDEPATH += $$LIBS_DIR/include
-
- gxs {
- LIBS += -lsqlcipher
- }
}
##################################### MacOS ######################################
From 1de2f01d2271dd361a0cf5c28c0cecbefaf6f97d Mon Sep 17 00:00:00 2001
From: csoler
Date: Sat, 5 Sep 2015 16:21:30 -0400
Subject: [PATCH 018/240] updated ubuntu changelog
---
build_scripts/Debian+Ubuntu/changelog | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)
diff --git a/build_scripts/Debian+Ubuntu/changelog b/build_scripts/Debian+Ubuntu/changelog
index ff2101d8a..4fa99bacc 100644
--- a/build_scripts/Debian+Ubuntu/changelog
+++ b/build_scripts/Debian+Ubuntu/changelog
@@ -1,5 +1,20 @@
retroshare06 (0.6.0-1.XXXXXX~YYYYYY) YYYYYY; urgency=low
-
+
+ 6bc6e22 ( ) Merge pull request #92 from AsamK/fix_travis_voip
+ f2994b7 (VOIP ) Old libav versions used constant without AV_ prefix
+ efc057e (VOIP ) Fix build with libavcodec < 55
+ 7385dd1 ( ) Merge pull request #91 from AsamK/fix_opensuse_compile
+ fd19349 ( ) Merge pull request #90 from PhenomRetroShare/Fix_Travis_CI_Compilation
+ 976f53b (VOIP ) Remove -lavformat from VOIP, it's unused
+ 484edc3 (VOIP ) Fix build for openSUSE
+ 22816f0 (VOIP ) Remove unnecessary includes from VideoProcessor
+ 6b94248 (VOIP ) Fix Travis CI compilation by adding libavutil-dev package.
+ c892f8a (VOIP ) Merge pull request #85 from PhenomRetroShare/Fix_VOIP_CompilWithRecentLibavutil
+ 0a84398 (VOIP ) Fix VOIP compilation with recent libavutil-dev package. /usr/include/libavutil/common.h error 'UINT64C' was n
+ 6614536 (VOIP ) Added register of codecs to VOIP.
+ 738dada (VOIP ) Fixed Windows compile of VOIP.
+ 9bbdefa (Packaging ) Added "QMAKE_LFLAGS += -Wl,--start-group" to pluigns for Windows compile.
+ b1b2de6 (Packaging ) Fixed Windows compile. - Set name for prl file in libretroshare.pro - Use "QMAKE_LFLAGS += -Wl,--start-group"
a276986 ( ) Merge pull request #60 from PhenomRetroShare/Fix_AllowChatTextFormatOption
88a6931 (GUI ) Allow Chat Text Format Option working.
0b5b20d ( ) Merge pull request #59 from AsamK/qmake_improvements
From 8bb76c95acf500c933ce93e83d32d1046d8125a9 Mon Sep 17 00:00:00 2001
From: csoler
Date: Sat, 5 Sep 2015 16:21:49 -0400
Subject: [PATCH 019/240] fixed VOIP compilation on ubuntu 14.04
---
plugins/VOIP/gui/VideoProcessor.cpp | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/plugins/VOIP/gui/VideoProcessor.cpp b/plugins/VOIP/gui/VideoProcessor.cpp
index 0bc16dab0..12b54edf5 100644
--- a/plugins/VOIP/gui/VideoProcessor.cpp
+++ b/plugins/VOIP/gui/VideoProcessor.cpp
@@ -21,7 +21,7 @@ extern "C" {
#include
//#include
-//#include
+#include
#include
//#include
//#include
@@ -330,7 +330,6 @@ FFmpegVideo::FFmpegVideo()
#else
AVCodecID codec_id = AV_CODEC_ID_MPEG4;
#endif
- uint8_t endcode[] = { 0, 0, 1, 0xb7 };
/* find the mpeg1 video encoder */
encoding_codec = avcodec_find_encoder(codec_id);
@@ -548,7 +547,7 @@ bool FFmpegVideo::encodeData(const QImage& image, uint32_t target_encoding_bitra
AVPacket pkt ;
av_init_packet(&pkt);
-#if LIBAVCODEC_VERSION_MAJOR < 55
+#if LIBAVCODEC_VERSION_MAJOR < 54
pkt.size = avpicture_get_size(encoding_context->pix_fmt, encoding_context->width, encoding_context->height);
pkt.data = (uint8_t*)av_malloc(pkt.size);
From 869077b4a53e6db186497bf1e1c5a9dbc62aff7c Mon Sep 17 00:00:00 2001
From: thunder2
Date: Sat, 5 Sep 2015 12:46:18 +0200
Subject: [PATCH 020/240] Combined selects in
RsDataService::retrieveNxsGrps/RsDataService::retrieveNxsMsgs.
---
libretroshare/src/gxs/rsdataservice.cc | 223 ++++++++-----------------
libretroshare/src/gxs/rsdataservice.h | 17 +-
2 files changed, 83 insertions(+), 157 deletions(-)
diff --git a/libretroshare/src/gxs/rsdataservice.cc b/libretroshare/src/gxs/rsdataservice.cc
index 01af6efd3..50b12dba1 100644
--- a/libretroshare/src/gxs/rsdataservice.cc
+++ b/libretroshare/src/gxs/rsdataservice.cc
@@ -152,6 +152,11 @@ RsDataService::RsDataService(const std::string &serviceDir, const std::string &d
mColMsg_MetaData = addColumn(mMsgColumns, KEY_NXS_META);
mColMsg_MsgId = addColumn(mMsgColumns, KEY_MSG_ID);
+ // for retrieving msg data with meta
+ mMsgColumnsWithMeta = mMsgColumns;
+ mColMsg_WithMetaOffset = mMsgColumnsWithMeta.size();
+ mMsgColumnsWithMeta.insert(mMsgColumnsWithMeta.end(), mMsgMetaColumns.begin(), mMsgMetaColumns.end());
+
// for retrieving grp meta data
mColGrpMeta_GrpId = addColumn(mGrpMetaColumns, KEY_GRP_ID);
mColGrpMeta_TimeStamp = addColumn(mGrpMetaColumns, KEY_TIME_STAMP);
@@ -184,6 +189,11 @@ RsDataService::RsDataService(const std::string &serviceDir, const std::string &d
mColGrp_NxsData = addColumn(mGrpColumns, KEY_NXS_DATA);
mColGrp_MetaData = addColumn(mGrpColumns, KEY_NXS_META);
+ // for retrieving grp data with meta
+ mGrpColumnsWithMeta = mGrpColumns;
+ mColGrp_WithMetaOffset = mGrpColumnsWithMeta.size();
+ mGrpColumnsWithMeta.insert(mGrpColumnsWithMeta.end(), mGrpMetaColumns.begin(), mGrpMetaColumns.end());
+
// Group id columns
mColGrpId_GrpId = addColumn(mGrpIdColumn, KEY_GRP_ID);
@@ -474,7 +484,7 @@ bool RsDataService::finishReleaseUpdate(int release, bool result)
return result;
}
-RsGxsGrpMetaData* RsDataService::locked_getGrpMeta(RetroCursor &c)
+RsGxsGrpMetaData* RsDataService::locked_getGrpMeta(RetroCursor &c, int colOffset)
{
#ifdef RS_DATA_SERVICE_DEBUG
std::cerr << "RsDataService::locked_getGrpMeta()";
@@ -492,27 +502,27 @@ RsGxsGrpMetaData* RsDataService::locked_getGrpMeta(RetroCursor &c)
// grpId
std::string tempId;
- c.getString(mColGrpMeta_GrpId, tempId);
+ c.getString(mColGrpMeta_GrpId + colOffset, tempId);
grpMeta->mGroupId = RsGxsGroupId(tempId);
- c.getString(mColGrpMeta_NxsIdentity, tempId);
+ c.getString(mColGrpMeta_NxsIdentity + colOffset, tempId);
grpMeta->mAuthorId = RsGxsId(tempId);
- c.getString(mColGrpMeta_Name, grpMeta->mGroupName);
- c.getString(mColGrpMeta_OrigGrpId, tempId);
+ c.getString(mColGrpMeta_Name + colOffset, grpMeta->mGroupName);
+ c.getString(mColGrpMeta_OrigGrpId + colOffset, tempId);
grpMeta->mOrigGrpId = RsGxsGroupId(tempId);
- c.getString(mColGrpMeta_ServString, grpMeta->mServiceString);
+ c.getString(mColGrpMeta_ServString + colOffset, grpMeta->mServiceString);
std::string temp;
- c.getString(mColGrpMeta_NxsHash, temp);
+ c.getString(mColGrpMeta_NxsHash + colOffset, temp);
grpMeta->mHash = RsFileHash(temp);
- grpMeta->mReputationCutOff = c.getInt32(mColGrpMeta_RepCutoff);
- grpMeta->mSignFlags = c.getInt32(mColGrpMeta_SignFlags);
+ grpMeta->mReputationCutOff = c.getInt32(mColGrpMeta_RepCutoff + colOffset);
+ grpMeta->mSignFlags = c.getInt32(mColGrpMeta_SignFlags + colOffset);
- grpMeta->mPublishTs = c.getInt32(mColGrpMeta_TimeStamp);
- grpMeta->mGroupFlags = c.getInt32(mColGrpMeta_NxsFlags);
- grpMeta->mGrpSize = c.getInt32(mColGrpMeta_NxsDataLen);
+ grpMeta->mPublishTs = c.getInt32(mColGrpMeta_TimeStamp + colOffset);
+ grpMeta->mGroupFlags = c.getInt32(mColGrpMeta_NxsFlags + colOffset);
+ grpMeta->mGrpSize = c.getInt32(mColGrpMeta_NxsDataLen + colOffset);
offset = 0; data = NULL; data_len = 0;
- data = (char*)c.getData(mColGrpMeta_KeySet, data_len);
+ data = (char*)c.getData(mColGrpMeta_KeySet + colOffset, data_len);
if(data)
ok &= grpMeta->keys.GetTlv(data, data_len, &offset);
@@ -520,22 +530,22 @@ RsGxsGrpMetaData* RsDataService::locked_getGrpMeta(RetroCursor &c)
grpMeta->keys.TlvClear() ;
// local meta
- grpMeta->mSubscribeFlags = c.getInt32(mColGrpMeta_SubscrFlag);
- grpMeta->mPop = c.getInt32(mColGrpMeta_Pop);
- grpMeta->mVisibleMsgCount = c.getInt32(mColGrpMeta_MsgCount);
- grpMeta->mLastPost = c.getInt32(mColGrpMeta_LastPost);
- grpMeta->mGroupStatus = c.getInt32(mColGrpMeta_Status);
+ grpMeta->mSubscribeFlags = c.getInt32(mColGrpMeta_SubscrFlag + colOffset);
+ grpMeta->mPop = c.getInt32(mColGrpMeta_Pop + colOffset);
+ grpMeta->mVisibleMsgCount = c.getInt32(mColGrpMeta_MsgCount + colOffset);
+ grpMeta->mLastPost = c.getInt32(mColGrpMeta_LastPost + colOffset);
+ grpMeta->mGroupStatus = c.getInt32(mColGrpMeta_Status + colOffset);
- c.getString(mColGrpMeta_CircleId, tempId);
+ c.getString(mColGrpMeta_CircleId + colOffset, tempId);
grpMeta->mCircleId = RsGxsCircleId(tempId);
- grpMeta->mCircleType = c.getInt32(mColGrpMeta_CircleType);
- c.getString(mColGrpMeta_InternCircle, tempId);
+ grpMeta->mCircleType = c.getInt32(mColGrpMeta_CircleType + colOffset);
+ c.getString(mColGrpMeta_InternCircle + colOffset, tempId);
grpMeta->mInternalCircle = RsGxsCircleId(tempId);
- std::string s ; c.getString(mColGrpMeta_Originator, s) ;
+ std::string s ; c.getString(mColGrpMeta_Originator + colOffset, s) ;
grpMeta->mOriginator = RsPeerId(s);
- grpMeta->mAuthenFlags = c.getInt32(mColGrpMeta_AuthenFlags);
- grpMeta->mRecvTS = c.getInt32(mColGrpMeta_RecvTs);
+ grpMeta->mAuthenFlags = c.getInt32(mColGrpMeta_AuthenFlags + colOffset);
+ grpMeta->mRecvTS = c.getInt32(mColGrpMeta_RecvTs + colOffset);
c.getString(mColGrpMeta_ParentGrpId, tempId);
@@ -591,7 +601,7 @@ RsNxsGrp* RsDataService::locked_getGroup(RetroCursor &c)
return NULL;
}
-RsGxsMsgMetaData* RsDataService::locked_getMsgMeta(RetroCursor &c)
+RsGxsMsgMetaData* RsDataService::locked_getMsgMeta(RetroCursor &c, int colOffset)
{
RsGxsMsgMetaData* msgMeta = new RsGxsMsgMetaData();
@@ -602,44 +612,44 @@ RsGxsMsgMetaData* RsDataService::locked_getMsgMeta(RetroCursor &c)
char* data = NULL;
std::string gId;
- c.getString(mColMsgMeta_GrpId, gId);
+ c.getString(mColMsgMeta_GrpId + colOffset, gId);
msgMeta->mGroupId = RsGxsGroupId(gId);
std::string temp;
- c.getString(mColMsgMeta_MsgId, temp);
+ c.getString(mColMsgMeta_MsgId + colOffset, temp);
msgMeta->mMsgId = RsGxsMessageId(temp);
// without these, a msg is meaningless
ok &= (!msgMeta->mGroupId.isNull()) && (!msgMeta->mMsgId.isNull());
- c.getString(mColMsgMeta_OrigMsgId, temp);
+ c.getString(mColMsgMeta_OrigMsgId + colOffset, temp);
msgMeta->mOrigMsgId = RsGxsMessageId(temp);
- c.getString(mColMsgMeta_NxsIdentity, temp);
+ c.getString(mColMsgMeta_NxsIdentity + colOffset, temp);
msgMeta->mAuthorId = RsGxsId(temp);
- c.getString(mColMsgMeta_Name, msgMeta->mMsgName);
- c.getString(mColMsgMeta_NxsServString, msgMeta->mServiceString);
+ c.getString(mColMsgMeta_Name + colOffset, msgMeta->mMsgName);
+ c.getString(mColMsgMeta_NxsServString + colOffset, msgMeta->mServiceString);
- c.getString(mColMsgMeta_NxsHash, temp);
+ c.getString(mColMsgMeta_NxsHash + colOffset, temp);
msgMeta->mHash = RsFileHash(temp);
- msgMeta->recvTS = c.getInt32(mColMsgMeta_RecvTs);
+ msgMeta->recvTS = c.getInt32(mColMsgMeta_RecvTs + colOffset);
offset = 0;
- data = (char*)c.getData(mColMsgMeta_SignSet, data_len);
+ data = (char*)c.getData(mColMsgMeta_SignSet + colOffset, data_len);
msgMeta->signSet.GetTlv(data, data_len, &offset);
- msgMeta->mMsgSize = c.getInt32(mColMsgMeta_NxsDataLen);
+ msgMeta->mMsgSize = c.getInt32(mColMsgMeta_NxsDataLen + colOffset);
- msgMeta->mMsgFlags = c.getInt32(mColMsgMeta_NxsFlags);
- msgMeta->mPublishTs = c.getInt32(mColMsgMeta_TimeStamp);
+ msgMeta->mMsgFlags = c.getInt32(mColMsgMeta_NxsFlags + colOffset);
+ msgMeta->mPublishTs = c.getInt32(mColMsgMeta_TimeStamp + colOffset);
offset = 0; data_len = 0;
// thread and parent id
- c.getString(mColMsgMeta_MsgThreadId, temp);
+ c.getString(mColMsgMeta_MsgThreadId + colOffset, temp);
msgMeta->mThreadId = RsGxsMessageId(temp);
- c.getString(mColMsgMeta_MsgParentId, temp);
+ c.getString(mColMsgMeta_MsgParentId + colOffset, temp);
msgMeta->mParentId = RsGxsMessageId(temp);
// local meta
- msgMeta->mMsgStatus = c.getInt32(mColMsgMeta_MsgStatus);
- msgMeta->mChildTs = c.getInt32(mColMsgMeta_ChildTs);
+ msgMeta->mMsgStatus = c.getInt32(mColMsgMeta_MsgStatus + colOffset);
+ msgMeta->mChildTs = c.getInt32(mColMsgMeta_ChildTs + colOffset);
if(ok)
return msgMeta;
@@ -1020,13 +1030,13 @@ int RsDataService::retrieveNxsGrps(std::map &grp, bool
if(grp.empty()){
RsStackMutex stack(mDbMutex);
- RetroCursor* c = mDb->sqlQuery(GRP_TABLE_NAME, mGrpColumns, "", "");
+ RetroCursor* c = mDb->sqlQuery(GRP_TABLE_NAME, withMeta ? mGrpColumnsWithMeta : mGrpColumns, "", "");
if(c)
{
std::vector grps;
- locked_retrieveGroups(c, grps);
+ locked_retrieveGroups(c, grps, withMeta ? mColGrp_WithMetaOffset : 0);
std::vector::iterator vit = grps.begin();
#ifdef RS_DATA_SERVICE_DEBUG_TIME
@@ -1051,12 +1061,12 @@ int RsDataService::retrieveNxsGrps(std::map &grp, bool
for(; mit != grp.end(); ++mit)
{
const RsGxsGroupId& grpId = mit->first;
- RetroCursor* c = mDb->sqlQuery(GRP_TABLE_NAME, mGrpColumns, "grpId='" + grpId.toStdString() + "'", "");
+ RetroCursor* c = mDb->sqlQuery(GRP_TABLE_NAME, withMeta ? mGrpColumnsWithMeta : mGrpColumns, "grpId='" + grpId.toStdString() + "'", "");
if(c)
{
std::vector grps;
- locked_retrieveGroups(c, grps);
+ locked_retrieveGroups(c, grps, withMeta ? mColGrp_WithMetaOffset : 0);
if(!grps.empty())
{
@@ -1085,38 +1095,10 @@ int RsDataService::retrieveNxsGrps(std::map &grp, bool
std::cerr << "RsDataService::retrieveNxsGrps() " << mDbName << ", Requests: " << requestedGroups << ", Results: " << resultCount << ", Time: " << timer.duration() << std::endl;
#endif
- if(withMeta && !grp.empty())
- {
- std::map metaMap;
- std::map::iterator mit = grp.begin();
- for(; mit != grp.end(); ++mit)
- metaMap.insert(std::make_pair(mit->first, (RsGxsGrpMetaData*)(NULL)));
-
- retrieveGxsGrpMetaData(metaMap);
-
- mit = grp.begin();
- for(; mit != grp.end(); ++mit)
- {
- RsNxsGrp* grpPtr = grp[mit->first];
- grpPtr->metaData = metaMap[mit->first];
-
-#ifdef RS_DATA_SERVICE_DEBUG
- std::cerr << "RsDataService::retrieveNxsGrps() GrpId: " << mit->first.toStdString();
- std::cerr << " CircleType: " << (uint32_t) grpPtr->metaData->mCircleType;
- std::cerr << " CircleId: " << grpPtr->metaData->mCircleId.toStdString();
- std::cerr << std::endl;
-#endif
- }
-
-#ifdef RS_DATA_SERVICE_DEBUG_TIME
- std::cerr << "RsDataService::retrieveNxsGrps() " << mDbName << ", Time with meta: " << timer.duration() << std::endl;
-#endif
- }
-
return 1;
}
-void RsDataService::locked_retrieveGroups(RetroCursor* c, std::vector& grps){
+void RsDataService::locked_retrieveGroups(RetroCursor* c, std::vector& grps, int metaOffset){
if(c){
bool valid = c->moveToFirst();
@@ -1127,6 +1109,9 @@ void RsDataService::locked_retrieveGroups(RetroCursor* c, std::vector
// only add the latest grp info
if(g)
{
+ if (metaOffset) {
+ g->metaData = locked_getGrpMeta(*c, metaOffset);
+ }
grps.push_back(g);
}
valid = c->moveToNext();
@@ -1143,8 +1128,6 @@ int RsDataService::retrieveNxsMsgs(const GxsMsgReq &reqIds, GxsMsgResult &msg, b
GxsMsgReq::const_iterator mit = reqIds.begin();
- GxsMsgReq metaReqIds;// collects metaReqIds if needed
-
for(; mit != reqIds.end(); ++mit)
{
@@ -1158,11 +1141,11 @@ int RsDataService::retrieveNxsMsgs(const GxsMsgReq &reqIds, GxsMsgResult &msg, b
RsStackMutex stack(mDbMutex);
- RetroCursor* c = mDb->sqlQuery(MSG_TABLE_NAME, mMsgColumns, KEY_GRP_ID+ "='" + grpId.toStdString() + "'", "");
+ RetroCursor* c = mDb->sqlQuery(MSG_TABLE_NAME, withMeta ? mMsgColumnsWithMeta : mMsgColumns, KEY_GRP_ID+ "='" + grpId.toStdString() + "'", "");
if(c)
{
- locked_retrieveMessages(c, msgSet);
+ locked_retrieveMessages(c, msgSet, withMeta ? mColMsg_WithMetaOffset : 0);
#ifdef RS_DATA_SERVICE_DEBUG_TIME
resultCount += msgSet.size();
@@ -1180,12 +1163,12 @@ int RsDataService::retrieveNxsMsgs(const GxsMsgReq &reqIds, GxsMsgResult &msg, b
RsStackMutex stack(mDbMutex);
- RetroCursor* c = mDb->sqlQuery(MSG_TABLE_NAME, mMsgColumns, KEY_GRP_ID+ "='" + grpId.toStdString()
+ RetroCursor* c = mDb->sqlQuery(MSG_TABLE_NAME, withMeta ? mMsgColumnsWithMeta : mMsgColumns, KEY_GRP_ID+ "='" + grpId.toStdString()
+ "' AND " + KEY_MSG_ID + "='" + msgId.toStdString() + "'", "");
if(c)
{
- locked_retrieveMessages(c, msgSet);
+ locked_retrieveMessages(c, msgSet, withMeta ? mColMsg_WithMetaOffset : 0);
#ifdef RS_DATA_SERVICE_DEBUG_TIME
resultCount += c->getResultCount();
@@ -1198,18 +1181,6 @@ int RsDataService::retrieveNxsMsgs(const GxsMsgReq &reqIds, GxsMsgResult &msg, b
msg[grpId] = msgSet;
- if(withMeta)
- {
- std::vector msgIds;
-
- std::vector::iterator lit = msgSet.begin(),
- lit_end = msgSet.end();
-
- for(; lit != lit_end; ++lit)
- msgIds.push_back( (*lit)->msgId );
-
- metaReqIds[grpId] = msgIds;
- }
msgSet.clear();
}
@@ -1217,73 +1188,19 @@ int RsDataService::retrieveNxsMsgs(const GxsMsgReq &reqIds, GxsMsgResult &msg, b
std::cerr << "RsDataService::retrieveNxsMsgs() " << mDbName << ", Requests: " << reqIds.size() << ", Results: " << resultCount << ", Time: " << timer.duration() << std::endl;
#endif
- // tres expensive !?
- if(withMeta)
- {
-
- GxsMsgMetaResult metaResult;
-
- // request with meta ids so there is no chance of
- // a mem leak being left over
- retrieveGxsMsgMetaData(metaReqIds, metaResult);
-
- GxsMsgResult::iterator mit2 = msg.begin(), mit2_end = msg.end();
-
- for(; mit2 != mit2_end; ++mit2)
- {
- const RsGxsGroupId& grpId = mit2->first;
- std::vector& msgV = msg[grpId];
- std::vector::iterator lit = msgV.begin(),
- lit_end = msgV.end();
-
- // as retrieval only attempts to retrieve what was found this elimiates chance
- // of a memory fault as all are assigned
- for(; lit != lit_end; ++lit)
- {
- std::vector& msgMetaV = metaResult[grpId];
- std::vector::iterator meta_lit = msgMetaV.begin();
- RsNxsMsg* msgPtr = *lit;
- for(; meta_lit != msgMetaV.end(); )
- {
- RsGxsMsgMetaData* meta = *meta_lit;
- if(meta->mMsgId == msgPtr->msgId)
- {
- msgPtr->metaData = meta;
- meta_lit = msgMetaV.erase(meta_lit);
- }else{
- ++meta_lit;
- }
- }
- }
-
- std::vector& msgMetaV = metaResult[grpId];
- std::vector::iterator meta_lit;
-
- // clean up just in case, should not go in here
- for(meta_lit = msgMetaV.begin(); meta_lit !=
- msgMetaV.end(); )
- {
- RsGxsMsgMetaData* meta = *meta_lit;
- delete meta;
- meta_lit = msgMetaV.erase(meta_lit);
- }
- }
-
-#ifdef RS_DATA_SERVICE_DEBUG_TIME
- std::cerr << "RsDataService::retrieveNxsMsgs() " << mDbName << ", Time with meta: " << timer.duration() << std::endl;
-#endif
- }
-
return 1;
}
-void RsDataService::locked_retrieveMessages(RetroCursor *c, std::vector &msgs)
+void RsDataService::locked_retrieveMessages(RetroCursor *c, std::vector &msgs, int metaOffset)
{
bool valid = c->moveToFirst();
while(valid){
RsNxsMsg* m = locked_getMessage(*c);
if(m){
+ if (metaOffset) {
+ m->metaData = locked_getMsgMeta(*c, metaOffset);
+ }
msgs.push_back(m);
}
@@ -1361,7 +1278,7 @@ void RsDataService::locked_retrieveMsgMeta(RetroCursor *c, std::vectormoveToFirst();
while(valid){
- RsGxsMsgMetaData* m = locked_getMsgMeta(*c);
+ RsGxsMsgMetaData* m = locked_getMsgMeta(*c, 0);
if(m != NULL)
msgMeta.push_back(m);
@@ -1402,7 +1319,7 @@ int RsDataService::retrieveGxsGrpMetaData(std::mapmGroupId] = g;
@@ -1431,7 +1348,7 @@ int RsDataService::retrieveGxsGrpMetaData(std::map& msgs);
+ void locked_retrieveMessages(RetroCursor* c, std::vector& msgs, int metaOffset);
/*!
* Retrieves all the grp results from a cursor
* @param c cursor to result set
* @param grps groups retrieved from cursor are stored here
+ * @param withMeta this initialise the metaData member of the nxsgroups retrieved
*/
- void locked_retrieveGroups(RetroCursor* c, std::vector& grps);
+ void locked_retrieveGroups(RetroCursor* c, std::vector& grps, int metaOffset);
/*!
* Retrieves all the msg meta results from a cursor
@@ -201,13 +202,13 @@ private:
* extracts a msg meta item from a cursor at its
* current position
*/
- RsGxsMsgMetaData* locked_getMsgMeta(RetroCursor& c);
+ RsGxsMsgMetaData* locked_getMsgMeta(RetroCursor& c, int colOffset);
/*!
* extracts a grp meta item from a cursor at its
* current position
*/
- RsGxsGrpMetaData* locked_getGrpMeta(RetroCursor& c);
+ RsGxsGrpMetaData* locked_getGrpMeta(RetroCursor& c, int colOffset);
/*!
* extracts a msg item from a cursor at its
@@ -257,10 +258,12 @@ private:
std::list mMsgColumns;
std::list mMsgMetaColumns;
+ std::list mMsgColumnsWithMeta;
std::list mMsgIdColumn;
std::list mGrpColumns;
std::list mGrpMetaColumns;
+ std::list mGrpColumnsWithMeta;
std::list mGrpIdColumn;
// Message meta column
@@ -287,6 +290,9 @@ private:
int mColMsg_MetaData;
int mColMsg_MsgId;
+ // Message columns with meta
+ int mColMsg_WithMetaOffset;
+
// Group meta columns
int mColGrpMeta_GrpId;
int mColGrpMeta_TimeStamp;
@@ -319,6 +325,9 @@ private:
int mColGrp_NxsData;
int mColGrp_MetaData;
+ // Group columns with meta
+ int mColGrp_WithMetaOffset;
+
// Group id columns
int mColGrpId_GrpId;
From 5f36500d02f665345ce74dda8faf1528a0b268be Mon Sep 17 00:00:00 2001
From: thunder2
Date: Sun, 6 Sep 2015 14:21:05 +0200
Subject: [PATCH 021/240] Fixed click in column "Friend nodes" in FriendList.
---
retroshare-gui/src/gui/common/FriendList.cpp | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/retroshare-gui/src/gui/common/FriendList.cpp b/retroshare-gui/src/gui/common/FriendList.cpp
index 3dbdfdd13..2db31d734 100644
--- a/retroshare-gui/src/gui/common/FriendList.cpp
+++ b/retroshare-gui/src/gui/common/FriendList.cpp
@@ -500,6 +500,10 @@ static void getNameWidget(QTreeWidget *treeWidget, QTreeWidgetItem *item, Elided
nameLabel = new ElidedLabel(widget);
textLabel = new ElidedLabel(widget);
+ widget->setAttribute(Qt::WA_TransparentForMouseEvents, true);
+ nameLabel->setAttribute(Qt::WA_TransparentForMouseEvents, true);
+ textLabel->setAttribute(Qt::WA_TransparentForMouseEvents, true);
+
widget->setProperty("nameLabel", qVariantFromValue(nameLabel));
widget->setProperty("textLabel", qVariantFromValue(textLabel));
From b8e3a434cf5566dcee48a3c01031e97fbd51daaa Mon Sep 17 00:00:00 2001
From: thunder2
Date: Sun, 6 Sep 2015 21:28:34 +0200
Subject: [PATCH 022/240] Auto download of recommended files adds the sender as
source of the download.
---
libretroshare/src/services/p3msgservice.cc | 21 ++++++++++++++-------
1 file changed, 14 insertions(+), 7 deletions(-)
diff --git a/libretroshare/src/services/p3msgservice.cc b/libretroshare/src/services/p3msgservice.cc
index 45e6ebfba..2b69cd205 100644
--- a/libretroshare/src/services/p3msgservice.cc
+++ b/libretroshare/src/services/p3msgservice.cc
@@ -187,19 +187,26 @@ void p3MsgService::processMsg(RsMsgItem *mi, bool incoming)
msi->srcId = mi->PeerId();
mSrcIds.insert(std::pair(msi->msgId, msi));
IndicateConfigChanged(); /**** INDICATE MSG CONFIG CHANGED! *****/
+
+ /**** STACK UNLOCKED ***/
}
- // If the peer is allowed to push files, then auto-download the recommended files.
-
- if(rsPeers->servicePermissionFlags(mi->PeerId()) & RS_NODE_PERM_ALLOW_PUSH)
- for(std::list::const_iterator it(mi->attachment.items.begin());it!=mi->attachment.items.end();++it)
- rsFiles->FileRequest((*it).name,(*it).hash,(*it).filesize,std::string(),RS_FILE_REQ_ANONYMOUS_ROUTING,std::list()) ;
+ if (incoming)
+ {
+ // If the peer is allowed to push files, then auto-download the recommended files.
+ if(rsPeers->servicePermissionFlags(mi->PeerId()) & RS_NODE_PERM_ALLOW_PUSH)
+ {
+ std::list srcIds;
+ srcIds.push_back(mi->PeerId());
+ for(std::list::const_iterator it(mi->attachment.items.begin());it!=mi->attachment.items.end();++it)
+ rsFiles->FileRequest((*it).name,(*it).hash,(*it).filesize,std::string(),RS_FILE_REQ_ANONYMOUS_ROUTING,srcIds) ;
+ }
+ }
RsServer::notify()->notifyListChange(NOTIFY_LIST_MESSAGELIST,NOTIFY_TYPE_ADD);
-
- /**** STACK UNLOCKED ***/
}
+
bool p3MsgService::checkAndRebuildPartialMessage(RsMsgItem *ci)
{
// Check is the item is ending an incomplete item.
From 66b9557833485285e21462f0bcf47533b50e35ea Mon Sep 17 00:00:00 2001
From: AsamK
Date: Sat, 5 Sep 2015 23:48:24 +0200
Subject: [PATCH 023/240] Use PKGCONFIG instead of manually specifying LIBS for
Linux
- The advantage is that this method automatically includes additional
dependencies of LIBS (e.g. libupnp needs -lixml).
- Also if some distribution moves headers to non default locations the
correct locations get added by PKGCONFIG
---
libbitdht/src/libbitdht.pro | 2 --
libresapi/src/libresapi.pro | 8 +++++++
libretroshare/src/libretroshare.pro | 26 +++++++++--------------
plugins/FeedReader/FeedReader.pro | 8 ++-----
plugins/VOIP/VOIP.pro | 7 +++---
retroshare-gui/src/retroshare-gui.pro | 12 +++++------
retroshare-nogui/src/retroshare-nogui.pro | 4 ++--
supportlibs/pegmarkdown/pegmarkdown.pro | 5 +++--
8 files changed, 34 insertions(+), 38 deletions(-)
diff --git a/libbitdht/src/libbitdht.pro b/libbitdht/src/libbitdht.pro
index 7d6dca1d6..fcc6eb473 100644
--- a/libbitdht/src/libbitdht.pro
+++ b/libbitdht/src/libbitdht.pro
@@ -168,5 +168,3 @@ SOURCES += \
bitdht/bdquerymgr.cc \
util/bdbloom.cc \
bitdht/bdfriendlist.cc \
-
-
diff --git a/libresapi/src/libresapi.pro b/libresapi/src/libresapi.pro
index a45255e45..d814219db 100644
--- a/libresapi/src/libresapi.pro
+++ b/libresapi/src/libresapi.pro
@@ -2,8 +2,10 @@
TEMPLATE = lib
CONFIG += staticlib
+CONFIG += create_prl
CONFIG -= qt
TARGET = resapi
+TARGET_PRL = libresapi
DESTDIR = lib
CONFIG += libmicrohttpd
@@ -26,6 +28,12 @@ win32{
}
libmicrohttpd{
+ linux {
+ CONFIG += link_pkgconfig
+ PKGCONFIG *= libmicrohttpd
+ } else {
+ LIBS *= -lmicrohttpd
+ }
SOURCES += \
api/ApiServerMHD.cpp
diff --git a/libretroshare/src/libretroshare.pro b/libretroshare/src/libretroshare.pro
index 57ae12601..b814503cf 100644
--- a/libretroshare/src/libretroshare.pro
+++ b/libretroshare/src/libretroshare.pro
@@ -120,8 +120,7 @@ HEADERS += $$PUBLIC_HEADERS
################################# Linux ##########################################
linux-* {
- # These two lines fixe compilation on ubuntu natty. Probably a ubuntu packaging error.
- INCLUDEPATH += $$system(pkg-config --cflags glib-2.0 | sed -e "s/-I//g")
+ CONFIG += link_pkgconfig
OPENPGPSDK_DIR = ../../openpgpsdk/src
DEPENDPATH *= $${OPENPGPSDK_DIR} ../openpgpsdk
@@ -131,17 +130,12 @@ linux-* {
QMAKE_CXXFLAGS *= -Wall -D_FILE_OFFSET_BITS=64
QMAKE_CC = g++
- SSL_DIR = /usr/include/openssl
- UPNP_DIR = /usr/include/upnp
- DEPENDPATH += . $${SSL_DIR} $${UPNP_DIR}
- INCLUDEPATH += . $${SSL_DIR} $${UPNP_DIR}
-
contains(CONFIG, NO_SQLCIPHER) {
DEFINES *= NO_SQLCIPHER
- LIBS *= -lsqlite3
+ PKGCONFIG *= sqlite3
} else {
- SQLCIPHER_OK = $$system(pkg-config --exists sqlcipher && echo yes)
- isEmpty(SQLCIPHER_OK) {
+ SQLCIPHER_OK = $$system(pkg-config --exists sqlcipher && echo yes)
+ isEmpty(SQLCIPHER_OK) {
# We need a explicit path here, to force using the home version of sqlite3 that really encrypts the database.
exists(../../../lib/sqlcipher/.libs/libsqlcipher.a) {
LIBS += ../../../lib/sqlcipher/.libs/libsqlcipher.a
@@ -151,7 +145,7 @@ linux-* {
error("libsqlcipher is not installed and libsqlcipher.a not found. SQLCIPHER is necessary for encrypted database, to build with unencrypted database, run: qmake CONFIG+=NO_SQLCIPHER")
}
} else {
- LIBS *= -lsqlcipher
+ PKGCONFIG *= sqlcipher
}
}
@@ -163,7 +157,7 @@ linux-* {
CONFIG += upnp_libupnp
# Check if the systems libupnp has been Debian-patched
- system(grep -E 'char[[:space:]]+PublisherUrl' $${UPNP_DIR}/upnp.h >/dev/null 2>&1) {
+ system(grep -E 'char[[:space:]]+PublisherUrl' /usr/include/upnp/upnp.h >/dev/null 2>&1) {
# Normal libupnp
} else {
# Patched libupnp or new unreleased version
@@ -171,10 +165,10 @@ linux-* {
}
DEFINES *= UBUNTU
- INCLUDEPATH += /usr/include/glib-2.0/ /usr/lib/glib-2.0/include
- LIBS *= -lgnome-keyring
- LIBS *= -lssl -lupnp -lixml
- LIBS *= -lcrypto -lz -lpthread
+ PKGCONFIG *= gnome-keyring-1
+ PKGCONFIG *= libssl libupnp
+ PKGCONFIG *= libcrypto zlib
+ LIBS *= -lpthread -ldl
}
unix {
diff --git a/plugins/FeedReader/FeedReader.pro b/plugins/FeedReader/FeedReader.pro
index 4cebc5f48..b415b5711 100644
--- a/plugins/FeedReader/FeedReader.pro
+++ b/plugins/FeedReader/FeedReader.pro
@@ -81,12 +81,9 @@ TRANSLATIONS += \
lang/FeedReader_zh_CN.ts
linux-* {
- LIBXML2_DIR = /usr/include/libxml2
+ CONFIG += link_pkgconfig
- DEPENDPATH += $${LIBXML2_DIR}
- INCLUDEPATH += $${LIBXML2_DIR}
-
- LIBS += -lcurl -lxml2 -lxslt
+ PKGCONFIG *= libcurl libxml-2.0 libxslt
}
win32 {
@@ -102,4 +99,3 @@ openbsd-* {
LIBS += -lcurl -lxml2 -lxslt
}
-
diff --git a/plugins/VOIP/VOIP.pro b/plugins/VOIP/VOIP.pro
index 013a5c39e..dde97ea93 100644
--- a/plugins/VOIP/VOIP.pro
+++ b/plugins/VOIP/VOIP.pro
@@ -21,10 +21,11 @@ INCLUDEPATH += ../../retroshare-gui/src/temp/ui ../../libretroshare/src
linux-* {
CONFIG += link_pkgconfig
- # Necessary for openSUSE
PKGCONFIG += libavcodec libavutil
-
+ PKGCONFIG += speex speexdsp
PKGCONFIG += opencv
+} else {
+ LIBS += -lspeex -lspeexdsp -lavcodec -lavutil
}
win32 {
@@ -103,5 +104,3 @@ TRANSLATIONS += \
lang/VOIP_sv.ts \
lang/VOIP_tr.ts \
lang/VOIP_zh_CN.ts
-
-LIBS += -lspeex -lspeexdsp -lavcodec -lavutil
diff --git a/retroshare-gui/src/retroshare-gui.pro b/retroshare-gui/src/retroshare-gui.pro
index db03e2df5..2af6d874f 100644
--- a/retroshare-gui/src/retroshare-gui.pro
+++ b/retroshare-gui/src/retroshare-gui.pro
@@ -1,8 +1,10 @@
!include("../../retroshare.pri"): error("Could not include file ../../retroshare.pri")
+TEMPLATE = app
QT += network xml
CONFIG += qt gui uic qrc resources idle bitdht
CONFIG += link_prl
+TARGET = RetroShare06
# Plz never commit the .pro with these flags enabled.
# Use this flag when developping new features only.
@@ -34,9 +36,6 @@ CONFIG += gxsgui
#CONFIG += framecatcher
#CONFIG += blogs
-TEMPLATE = app
-TARGET = RetroShare06
-
DEFINES += RS_RELEASE_VERSION
RCC_DIR = temp/qrc
UI_DIR = temp/ui
@@ -61,15 +60,16 @@ INCLUDEPATH *= retroshare-gui
################################# Linux ##########################################
# Put lib dir in QMAKE_LFLAGS so it appears before -L/usr/lib
linux-* {
+ CONFIG += link_pkgconfig
#CONFIG += version_detail_bash_script
QMAKE_CXXFLAGS *= -D_FILE_OFFSET_BITS=64
PRE_TARGETDEPS *= ../../libretroshare/src/lib/libretroshare.a
LIBS += ../../libretroshare/src/lib/libretroshare.a
- LIBS *= -lX11 -lXss
+ PKGCONFIG *= x11 xscrnsaver
- LIBS *= -rdynamic -ldl
+ LIBS *= -rdynamic
DEFINES *= HAVE_XSS # for idle time, libx screensaver extensions
DEFINES *= UBUNTU
}
@@ -289,7 +289,7 @@ wikipoos {
DEPENDPATH += ../../libresapi/src
INCLUDEPATH += ../../libresapi/src
PRE_TARGETDEPS *= ../../libresapi/src/lib/libresapi.a
-LIBS += ../../libresapi/src/lib/libresapi.a -lmicrohttpd
+LIBS += ../../libresapi/src/lib/libresapi.a
# Input
HEADERS += rshare.h \
diff --git a/retroshare-nogui/src/retroshare-nogui.pro b/retroshare-nogui/src/retroshare-nogui.pro
index cb4b79bac..201896155 100644
--- a/retroshare-nogui/src/retroshare-nogui.pro
+++ b/retroshare-nogui/src/retroshare-nogui.pro
@@ -27,7 +27,7 @@ linux-* {
QMAKE_CXXFLAGS *= -D_FILE_OFFSET_BITS=64
LIBS += ../../libretroshare/src/lib/libretroshare.a
- LIBS *= -rdynamic -ldl
+ LIBS *= -rdynamic
}
unix {
@@ -169,7 +169,7 @@ introserver {
webui {
DEFINES *= ENABLE_WEBUI
PRE_TARGETDEPS *= ../../libresapi/src/lib/libresapi.a
- LIBS += ../../libresapi/src/lib/libresapi.a -lmicrohttpd
+ LIBS += ../../libresapi/src/lib/libresapi.a
DEPENDPATH += ../../libresapi/src
INCLUDEPATH += ../../libresapi/src
HEADERS += \
diff --git a/supportlibs/pegmarkdown/pegmarkdown.pro b/supportlibs/pegmarkdown/pegmarkdown.pro
index ca818cc39..e43e0c1ad 100644
--- a/supportlibs/pegmarkdown/pegmarkdown.pro
+++ b/supportlibs/pegmarkdown/pegmarkdown.pro
@@ -15,8 +15,9 @@ debug {
################################# Linux ##########################################
linux-* {
- DESTDIR = lib
- LIBS *= -lglib-2.0
+ CONFIG += link_pkgconfig
+
+ PKGCONFIG *= glib-2.0
}
linux-g++ {
From 571336e1f4dc3724cf06579c5632e2aec7b4e58f Mon Sep 17 00:00:00 2001
From: AsamK
Date: Sat, 5 Sep 2015 23:49:15 +0200
Subject: [PATCH 024/240] Move duplicate common stuff out of platform parts
---
libbitdht/src/libbitdht.pro | 8 ++---
libretroshare/src/libretroshare.pro | 43 +++++++----------------
retroshare-gui/src/retroshare-gui.pro | 22 +++---------
retroshare-nogui/src/retroshare-nogui.pro | 13 ++-----
supportlibs/pegmarkdown/pegmarkdown.pro | 5 +--
5 files changed, 23 insertions(+), 68 deletions(-)
diff --git a/libbitdht/src/libbitdht.pro b/libbitdht/src/libbitdht.pro
index fcc6eb473..80919c16a 100644
--- a/libbitdht/src/libbitdht.pro
+++ b/libbitdht/src/libbitdht.pro
@@ -4,6 +4,8 @@ TEMPLATE = lib
CONFIG += staticlib
CONFIG -= qt
TARGET = bitdht
+DESTDIR = lib
+
QMAKE_CXXFLAGS *= -Wall -DBE_DEBUG
profiling {
@@ -27,7 +29,6 @@ debug {
################################# Linux ##########################################
linux-* {
- DESTDIR = lib
QMAKE_CC = g++
}
@@ -50,7 +51,6 @@ unix {
win32-x-g++ {
OBJECTS_DIR = temp/win32xgcc/obj
- DESTDIR = lib.win32xgcc
# These have been replaced by _WIN32 && __MINGW32__
# DEFINES *= WINDOWS_SYS WIN32 WIN_CROSS_UBUNTU
QMAKE_CXXFLAGS *= -Wmissing-include-dirs
@@ -70,7 +70,6 @@ win32 {
DEFINES *= STATICLIB WIN32_LEAN_AND_MEAN _USE_32BIT_TIME_T
# These have been replaced by _WIN32 && __MINGW32__
#DEFINES *= WINDOWS_SYS WIN32 STATICLIB MINGW
- DESTDIR = lib
# Switch on extra warnings
QMAKE_CFLAGS += -Wextra
@@ -93,19 +92,16 @@ mac {
QMAKE_CC = g++
OBJECTS_DIR = temp/obj
MOC_DIR = temp/moc
- DESTDIR = lib
}
################################# FreeBSD ##########################################
freebsd-* {
- DESTDIR = lib
}
################################# OpenBSD ##########################################
openbsd-* {
- DESTDIR = lib
}
################################### COMMON stuff ##################################
diff --git a/libretroshare/src/libretroshare.pro b/libretroshare/src/libretroshare.pro
index b814503cf..381567c2d 100644
--- a/libretroshare/src/libretroshare.pro
+++ b/libretroshare/src/libretroshare.pro
@@ -6,6 +6,7 @@ CONFIG += create_prl
CONFIG -= qt
TARGET = retroshare
TARGET_PRL = libretroshare
+DESTDIR = lib
#CONFIG += dsdv
@@ -72,15 +73,13 @@ SOURCES += tcponudp/udppeer.cc \
tcponudp/udpstunner.cc \
tcponudp/udprelay.cc \
+ DEFINES *= RS_USE_BITDHT
- BITDHT_DIR = ../../libbitdht/src
+ BITDHT_DIR = ../../libbitdht/src
DEPENDPATH += . $${BITDHT_DIR}
INCLUDEPATH += . $${BITDHT_DIR}
- # The next line is for compliance with debian packages. Keep it!
- INCLUDEPATH += ../libbitdht
- DEFINES *= RS_USE_BITDHT
- PRE_TARGETDEPS *= ../../libbitdht/src/lib/libbitdht.a
- LIBS += ../../libbitdht/src/lib/libbitdht.a
+ PRE_TARGETDEPS *= $${BITDHT_DIR}/lib/libbitdht.a
+ LIBS *= $${BITDHT_DIR}/lib/libbitdht.a
}
@@ -122,11 +121,6 @@ HEADERS += $$PUBLIC_HEADERS
linux-* {
CONFIG += link_pkgconfig
- OPENPGPSDK_DIR = ../../openpgpsdk/src
- DEPENDPATH *= $${OPENPGPSDK_DIR} ../openpgpsdk
- INCLUDEPATH *= $${OPENPGPSDK_DIR} ../openpgpsdk
-
- DESTDIR = lib
QMAKE_CXXFLAGS *= -Wall -D_FILE_OFFSET_BITS=64
QMAKE_CC = g++
@@ -151,7 +145,6 @@ linux-* {
#CONFIG += version_detail_bash_script
-
# linux/bsd can use either - libupnp is more complete and packaged.
#CONFIG += upnp_miniupnpc
CONFIG += upnp_libupnp
@@ -210,7 +203,6 @@ version_detail_bash_script {
win32-x-g++ {
OBJECTS_DIR = temp/win32xgcc/obj
- DESTDIR = lib.win32xgcc
DEFINES *= WINDOWS_SYS WIN32 WIN_CROSS_UBUNTU
QMAKE_CXXFLAGS *= -Wmissing-include-dirs
QMAKE_CC = i586-mingw32msvc-g++
@@ -237,7 +229,6 @@ win32 {
DEFINES *= MINIUPNPC_VERSION=13
# This defines the platform to be WinXP or later and is needed for getaddrinfo (_WIN32_WINNT_WINXP)
DEFINES *= WINVER=0x0501
- DESTDIR = lib
# Switch on extra warnings
QMAKE_CFLAGS += -Wextra
@@ -260,10 +251,9 @@ win32 {
LIBS += -lsqlcipher
LIBS_DIR = $$PWD/../../../libs
- OPENPGPSDK_DIR = $$PWD/../../openpgpsdk/src
- DEPENDPATH += . $$LIBS_DIR/include $$LIBS_DIR/include/miniupnpc $$OPENPGPSDK_DIR
- INCLUDEPATH += . $$LIBS_DIR/include $$LIBS_DIR/include/miniupnpc $$OPENPGPSDK_DIR
+ DEPENDPATH += . $$LIBS_DIR/include $$LIBS_DIR/include/miniupnpc
+ INCLUDEPATH += . $$LIBS_DIR/include $$LIBS_DIR/include/miniupnpc
}
################################# MacOSX ##########################################
@@ -274,7 +264,6 @@ mac {
MOC_DIR = temp/moc
#DEFINES = WINDOWS_SYS WIN32 STATICLIB MINGW
#DEFINES *= MINIUPNPC_VERSION=13
- DESTDIR = lib
CONFIG += upnp_miniupnpc
@@ -289,12 +278,8 @@ mac {
#GPG_ERROR_DIR = ../../../../libgpg-error-1.7
#GPGME_DIR = ../../../../gpgme-1.1.8
- OPENPGPSDK_DIR = ../../openpgpsdk/src
-
INCLUDEPATH += . $${UPNPC_DIR}
- INCLUDEPATH += $${OPENPGPSDK_DIR}
- #../openpgpsdk
#INCLUDEPATH += . $${UPNPC_DIR} $${GPGME_DIR}/src $${GPG_ERROR_DIR}/src
}
@@ -309,8 +294,6 @@ freebsd-* {
# linux/bsd can use either - libupnp is more complete and packaged.
#CONFIG += upnp_miniupnpc
CONFIG += upnp_libupnp
-
- DESTDIR = lib
}
################################# OpenBSD ##########################################
@@ -319,21 +302,19 @@ openbsd-* {
INCLUDEPATH *= /usr/local/include
INCLUDEPATH += $$system(pkg-config --cflags glib-2.0 | sed -e "s/-I//g")
- OPENPGPSDK_DIR = ../../openpgpsdk/src
- INCLUDEPATH *= $${OPENPGPSDK_DIR} ../openpgpsdk
-
QMAKE_CXXFLAGS *= -Dfseeko64=fseeko -Dftello64=ftello -Dstat64=stat -Dstatvfs64=statvfs -Dfopen64=fopen
CONFIG += upnp_libupnp
-
- DESTDIR = lib
}
################################### COMMON stuff ##################################
# openpgpsdk
-PRE_TARGETDEPS *= ../../openpgpsdk/src/lib/libops.a
-LIBS *= ../../openpgpsdk/src/lib/libops.a -lbz2
+OPENPGPSDK_DIR = ../../openpgpsdk/src
+DEPENDPATH *= $${OPENPGPSDK_DIR}
+INCLUDEPATH *= $${OPENPGPSDK_DIR}
+PRE_TARGETDEPS *= $${OPENPGPSDK_DIR}/lib/libops.a
+LIBS *= $${OPENPGPSDK_DIR}/lib/libops.a -lbz2
HEADERS += dbase/cachestrapper.h \
dbase/fimonitor.h \
diff --git a/retroshare-gui/src/retroshare-gui.pro b/retroshare-gui/src/retroshare-gui.pro
index 2af6d874f..be66e1f12 100644
--- a/retroshare-gui/src/retroshare-gui.pro
+++ b/retroshare-gui/src/retroshare-gui.pro
@@ -64,9 +64,6 @@ linux-* {
#CONFIG += version_detail_bash_script
QMAKE_CXXFLAGS *= -D_FILE_OFFSET_BITS=64
- PRE_TARGETDEPS *= ../../libretroshare/src/lib/libretroshare.a
-
- LIBS += ../../libretroshare/src/lib/libretroshare.a
PKGCONFIG *= x11 xscrnsaver
LIBS *= -rdynamic
@@ -130,7 +127,6 @@ version_detail_bash_script {
win32-x-g++ {
OBJECTS_DIR = temp/win32-x-g++/obj
- LIBS += ../../libretroshare/src/lib.win32xgcc/libretroshare.a
LIBS += ../../../../lib/win32-x-g++-v0.5/libssl.a
LIBS += ../../../../lib/win32-x-g++-v0.5/libcrypto.a
LIBS += ../../../../lib/win32-x-g++-v0.5/libgpgme.dll.a
@@ -178,11 +174,8 @@ win32 {
#LIBS += -L"D/Qt/2009.03/qt/plugins/imageformats"
#QTPLUGIN += qjpeg
- PRE_TARGETDEPS *= ../../libretroshare/src/lib/libretroshare.a
-
LIBS_DIR = $$PWD/../../../libs
- LIBS += ../../libretroshare/src/lib/libretroshare.a
LIBS += -L"$$LIBS_DIR/lib"
LIBS += -lssl -lcrypto -lpthread -lminiupnpc -lz -lws2_32
@@ -221,7 +214,6 @@ macx {
QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.4
CONFIG += version_detail_bash_script
- LIBS += ../../libretroshare/src/lib/libretroshare.a
LIBS += -lssl -lcrypto -lz
#LIBS += -lssl -lcrypto -lz -lgpgme -lgpg-error -lassuan
LIBS += ../../../miniupnpc-1.0/libminiupnpc.a
@@ -240,12 +232,10 @@ macx {
freebsd-* {
INCLUDEPATH *= /usr/local/include/gpgme
- LIBS *= ../../libretroshare/src/lib/libretroshare.a
LIBS *= -lssl
LIBS *= -lgpgme
LIBS *= -lupnp
LIBS *= -lgnome-keyring
- PRE_TARGETDEPS *= ../../libretroshare/src/lib/libretroshare.a
LIBS += -lsqlite3
}
@@ -255,17 +245,11 @@ freebsd-* {
openbsd-* {
INCLUDEPATH *= /usr/local/include
- PRE_TARGETDEPS *= ../../libretroshare/src/lib/libretroshare.a
-
- LIBS *= ../../libretroshare/src/lib/libretroshare.a
LIBS *= -lssl -lcrypto
LIBS *= -lgpgme
LIBS *= -lupnp
LIBS *= -lgnome-keyring
- PRE_TARGETDEPS *= ../../libretroshare/src/lib/libretroshare.a
-
LIBS += -lsqlite3
-
LIBS *= -rdynamic
}
@@ -281,8 +265,12 @@ openbsd-* {
DEPENDPATH += . ../../libretroshare/src/
INCLUDEPATH += ../../libretroshare/src/
+PRE_TARGETDEPS *= ../../libretroshare/src/lib/libretroshare.a
+LIBS *= ../../libretroshare/src/lib/libretroshare.a
+
wikipoos {
- LIBS += ../../supportlibs/pegmarkdown/lib/libpegmarkdown.a
+ PRE_TARGETDEPS *= ../../supportlibs/pegmarkdown/lib/libpegmarkdown.a
+ LIBS *= ../../supportlibs/pegmarkdown/lib/libpegmarkdown.a
}
# webinterface
diff --git a/retroshare-nogui/src/retroshare-nogui.pro b/retroshare-nogui/src/retroshare-nogui.pro
index 201896155..74f3c9fdb 100644
--- a/retroshare-nogui/src/retroshare-nogui.pro
+++ b/retroshare-nogui/src/retroshare-nogui.pro
@@ -26,7 +26,6 @@ linux-* {
#CONFIG += version_detail_bash_script
QMAKE_CXXFLAGS *= -D_FILE_OFFSET_BITS=64
- LIBS += ../../libretroshare/src/lib/libretroshare.a
LIBS *= -rdynamic
}
@@ -48,7 +47,6 @@ linux-g++-64 {
win32-x-g++ {
OBJECTS_DIR = temp/win32-x-g++/obj
- LIBS += ../../../../lib/win32-x-g++/libretroshare.a
LIBS += ../../../../lib/win32-x-g++/libssl.a
LIBS += ../../../../lib/win32-x-g++/libcrypto.a
LIBS += ../../../../lib/win32-x-g++/libminiupnpc.a
@@ -74,11 +72,8 @@ win32 {
# solve linker warnings because of the order of the libraries
QMAKE_LFLAGS += -Wl,--start-group
- PRE_TARGETDEPS *= ../../libretroshare/src/lib/libretroshare.a
-
LIBS_DIR = $$PWD/../../../libs
- LIBS += ../../libretroshare/src/lib/libretroshare.a
LIBS += -L"$$LIBS_DIR/lib"
LIBS += -lssl -lcrypto -lpthread -lminiupnpc -lz
LIBS += -lcrypto -lws2_32 -lgdi32
@@ -102,7 +97,6 @@ macx {
# CONFIG += ppc x86
LIBS += -Wl,-search_paths_first
- LIBS += ../../libretroshare/src/lib/libretroshare.a
LIBS += -lssl -lcrypto -lz
LIBS += ../../../miniupnpc-1.0/libminiupnpc.a
LIBS += -framework CoreFoundation
@@ -127,12 +121,10 @@ macx {
freebsd-* {
INCLUDEPATH *= /usr/local/include/gpgme
- LIBS *= ../../libretroshare/src/lib/libretroshare.a
LIBS *= -lssl
LIBS *= -lgpgme
LIBS *= -lupnp
LIBS *= -lgnome-keyring
- PRE_TARGETDEPS *= ../../libretroshare/src/lib/libretroshare.a
}
##################################### OpenBSD ######################################
@@ -140,12 +132,10 @@ freebsd-* {
openbsd-* {
INCLUDEPATH *= /usr/local/include
QMAKE_CXXFLAGS *= -Dfseeko64=fseeko -Dftello64=ftello -Dstat64=stat -Dstatvfs64=statvfs -Dfopen64=fopen
- LIBS *= ../../libretroshare/src/lib/libretroshare.a
LIBS *= -lssl -lcrypto
LIBS *= -lgpgme
LIBS *= -lupnp
LIBS *= -lgnome-keyring
- PRE_TARGETDEPS *= ../../libretroshare/src/lib/libretroshare.a
LIBS *= -rdynamic
}
@@ -155,6 +145,9 @@ openbsd-* {
DEPENDPATH += . ../../libretroshare/src
INCLUDEPATH += . ../../libretroshare/src
+PRE_TARGETDEPS *= ../../libretroshare/src/lib/libretroshare.a
+LIBS *= ../../libretroshare/src/lib/libretroshare.a
+
# Input
HEADERS += notifytxt.h
SOURCES += notifytxt.cc \
diff --git a/supportlibs/pegmarkdown/pegmarkdown.pro b/supportlibs/pegmarkdown/pegmarkdown.pro
index e43e0c1ad..cc21ccaf3 100644
--- a/supportlibs/pegmarkdown/pegmarkdown.pro
+++ b/supportlibs/pegmarkdown/pegmarkdown.pro
@@ -3,6 +3,7 @@ CONFIG += staticlib
CONFIG += create_prl
CONFIG -= qt
TARGET = pegmarkdown
+DESTDIR = lib
QMAKE_CFLAGS *= -Wall -ansi -D_GNU_SOURCE
QMAKE_CC = gcc
@@ -33,7 +34,6 @@ linux-g++-64 {
win32 {
OBJECTS_DIR = temp/obj
MOC_DIR = temp/moc
- DESTDIR = lib
# Switch on extra warnings
QMAKE_CFLAGS += -Wextra
@@ -56,7 +56,6 @@ win32 {
mac {
OBJECTS_DIR = temp/obj
MOC_DIR = temp/moc
- DESTDIR = lib
CONFIG += dummy_glib
}
@@ -64,13 +63,11 @@ mac {
################################# FreeBSD ##########################################
freebsd-* {
- DESTDIR = lib
}
################################# OpenBSD ##########################################
openbsd-* {
- DESTDIR = lib
}
################################### COMMON stuff ##################################
From fe1ec9d510200a906c0ede6e9ee6176094ebb999 Mon Sep 17 00:00:00 2001
From: AsamK
Date: Sat, 5 Sep 2015 22:49:57 +0200
Subject: [PATCH 025/240] Fixed mac compile. Moved sqlcipher.a to
libretroshare.pro
---
libretroshare/src/libretroshare.pro | 4 ++++
retroshare-gui/src/retroshare-gui.pro | 3 ---
retroshare-nogui/src/retroshare-nogui.pro | 6 ------
3 files changed, 4 insertions(+), 9 deletions(-)
diff --git a/libretroshare/src/libretroshare.pro b/libretroshare/src/libretroshare.pro
index 381567c2d..6862c1b6c 100644
--- a/libretroshare/src/libretroshare.pro
+++ b/libretroshare/src/libretroshare.pro
@@ -281,6 +281,10 @@ mac {
INCLUDEPATH += . $${UPNPC_DIR}
#INCLUDEPATH += . $${UPNPC_DIR} $${GPGME_DIR}/src $${GPG_ERROR_DIR}/src
+
+ # We need a explicit path here, to force using the home version of sqlite3 that really encrypts the database.
+ LIBS += ../../../lib/libsqlcipher.a
+ #LIBS += -lsqlite3
}
################################# FreeBSD ##########################################
diff --git a/retroshare-gui/src/retroshare-gui.pro b/retroshare-gui/src/retroshare-gui.pro
index be66e1f12..c2a513519 100644
--- a/retroshare-gui/src/retroshare-gui.pro
+++ b/retroshare-gui/src/retroshare-gui.pro
@@ -220,9 +220,6 @@ macx {
LIBS += -framework CoreFoundation
LIBS += -framework Security
- LIBS += ../../../lib/libsqlcipher.a
- #LIBS += -lsqlite3
-
INCLUDEPATH += .
#DEFINES* = MAC_IDLE # for idle feature
CONFIG -= uitools
diff --git a/retroshare-nogui/src/retroshare-nogui.pro b/retroshare-nogui/src/retroshare-nogui.pro
index 74f3c9fdb..043933278 100644
--- a/retroshare-nogui/src/retroshare-nogui.pro
+++ b/retroshare-nogui/src/retroshare-nogui.pro
@@ -102,12 +102,6 @@ macx {
LIBS += -framework CoreFoundation
LIBS += -framework Security
- gxs {
- # We need a explicit path here, to force using the home version of sqlite3 that really encrypts the database.
- # LIBS += ../../../lib/sqlcipher/.libs/libsqlcipher.a
- LIBS += ../../../lib/libsqlcipher.a
- }
-
sshserver {
LIBS += -L../../../lib
#LIBS += -L../../../lib/libssh-0.6.0
From 0793a6a52d0553eb5b99e2e064acbd0ded57b49d Mon Sep 17 00:00:00 2001
From: AsamK
Date: Sun, 6 Sep 2015 14:19:21 +0200
Subject: [PATCH 026/240] Use PLUGIN_DIR to define plugin directory only once
---
libretroshare/src/libretroshare.pro | 2 +-
libretroshare/src/rsserver/rsinit.cc | 2 +-
plugins/Common/retroshare_plugin.pri | 2 +-
retroshare.pri | 1 +
4 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/libretroshare/src/libretroshare.pro b/libretroshare/src/libretroshare.pro
index 6862c1b6c..c64f349a3 100644
--- a/libretroshare/src/libretroshare.pro
+++ b/libretroshare/src/libretroshare.pro
@@ -165,7 +165,7 @@ linux-* {
}
unix {
- DEFINES *= LIB_DIR=\"\\\"$${LIB_DIR}\\\"\"
+ DEFINES *= PLUGIN_DIR=\"\\\"$${PLUGIN_DIR}\\\"\"
DEFINES *= DATA_DIR=\"\\\"$${DATA_DIR}\\\"\"
## where to put the librarys interface
diff --git a/libretroshare/src/rsserver/rsinit.cc b/libretroshare/src/rsserver/rsinit.cc
index 766e9bcf7..833579c7d 100644
--- a/libretroshare/src/rsserver/rsinit.cc
+++ b/libretroshare/src/rsserver/rsinit.cc
@@ -1251,7 +1251,7 @@ int RsServer::StartupRetroShare()
std::vector plugins_directories ;
#ifndef WINDOWS_SYS
- plugins_directories.push_back(std::string(LIB_DIR) + "/retroshare/extensions6/") ;
+ plugins_directories.push_back(std::string(PLUGIN_DIR)) ;
#endif
std::string extensions_dir = rsAccounts->PathBaseDirectory() + "/extensions6/" ;
plugins_directories.push_back(extensions_dir) ;
diff --git a/plugins/Common/retroshare_plugin.pri b/plugins/Common/retroshare_plugin.pri
index 3c9644c55..d9a03cdc6 100644
--- a/plugins/Common/retroshare_plugin.pri
+++ b/plugins/Common/retroshare_plugin.pri
@@ -7,7 +7,7 @@ DEPENDPATH += ../../libretroshare/src/ ../../retroshare-gui/src/
INCLUDEPATH += ../../libretroshare/src/ ../../retroshare-gui/src/
unix {
- target.path = "$${LIB_DIR}/retroshare/extensions6"
+ target.path = "$${PLUGIN_DIR}"
INSTALLS += target
}
diff --git a/retroshare.pri b/retroshare.pri
index 6bbebfb39..6e2ea0c9e 100644
--- a/retroshare.pri
+++ b/retroshare.pri
@@ -7,6 +7,7 @@ unix {
isEmpty(INC_DIR) { INC_DIR = "$${PREFIX}/include/retroshare06" }
isEmpty(LIB_DIR) { LIB_DIR = "$${PREFIX}/lib" }
isEmpty(DATA_DIR) { DATA_DIR = "$${PREFIX}/share/RetroShare06" }
+ isEmpty(PLUGIN_DIR) { PLUGIN_DIR = "$${LIB_DIR}/retroshare/extensions6" }
}
unfinished {
From 2c1743f5bb5f71ef506a0a0aac0355eda7b24c37 Mon Sep 17 00:00:00 2001
From: defnax
Date: Mon, 7 Sep 2015 15:13:32 +0200
Subject: [PATCH 027/240] Added send message function for Participants list.
---
.../src/gui/chat/ChatLobbyDialog.cpp | 44 +++++++++++++++++--
retroshare-gui/src/gui/chat/ChatLobbyDialog.h | 4 +-
2 files changed, 43 insertions(+), 5 deletions(-)
diff --git a/retroshare-gui/src/gui/chat/ChatLobbyDialog.cpp b/retroshare-gui/src/gui/chat/ChatLobbyDialog.cpp
index a72c72bae..9eb7ff11c 100644
--- a/retroshare-gui/src/gui/chat/ChatLobbyDialog.cpp
+++ b/retroshare-gui/src/gui/chat/ChatLobbyDialog.cpp
@@ -34,6 +34,7 @@
#include "gui/settings/RsharePeerSettings.h"
#include "gui/MainWindow.h"
#include "gui/FriendsDialog.h"
+#include "gui/msgs/MessageComposer.h"
#include
#include "gui/common/RSTreeWidgetItem.h"
#include "gui/common/FriendSelectionDialog.h"
@@ -73,11 +74,13 @@ ChatLobbyDialog::ChatLobbyDialog(const ChatLobbyId& lid, QWidget *parent, Qt::Wi
ui.participantsList->setColumnHidden(COLUMN_ACTIVITY,true);
ui.participantsList->setColumnHidden(COLUMN_ID,true);
- muteAct = new QAction(QIcon(), tr("Mute participant"), this);
- distantChatAct = new QAction(QIcon(), tr("Start private chat"), this);
+ muteAct = new QAction(QIcon(), tr("Mute participant"), this);
+ distantChatAct = new QAction(QIcon(":/images/chat_24.png"), tr("Start private chat"), this);
+ sendMessageAct = new QAction(QIcon(":/images/mail_new.png"), tr("Send Message"), this);
connect(muteAct, SIGNAL(triggered()), this, SLOT(changePartipationState()));
connect(distantChatAct, SIGNAL(triggered()), this, SLOT(distantChatParticipant()));
+ connect(sendMessageAct, SIGNAL(triggered()), this, SLOT(sendMessage()));
// Add a button to invite friends.
//
@@ -170,12 +173,15 @@ void ChatLobbyDialog::participantsTreeWidgetCustomPopupMenu(QPoint)
QMenu contextMnu(this);
- contextMnu.addAction(muteAct);
contextMnu.addAction(distantChatAct);
+ contextMnu.addAction(sendMessageAct);
+ contextMnu.addSeparator();
+ contextMnu.addAction(muteAct);
+
muteAct->setCheckable(true);
muteAct->setEnabled(false);
- muteAct->setChecked(false);
+ muteAct->setChecked(false);
if (selectedItems.size())
{
@@ -571,6 +577,36 @@ void ChatLobbyDialog::distantChatParticipant()
}
}
+void ChatLobbyDialog::sendMessage()
+{
+
+ QList selectedItems = ui.participantsList->selectedItems();
+
+ if (selectedItems.isEmpty())
+ return;
+
+ QList::iterator item;
+ for (item = selectedItems.begin(); item != selectedItems.end(); ++item) {
+
+ RsGxsId gxs_id ;
+ dynamic_cast(*item)->getId(gxs_id) ;
+
+
+ MessageComposer *nMsgDialog = MessageComposer::newMsg();
+ if (nMsgDialog == NULL) {
+ return;
+ }
+
+ nMsgDialog->addRecipient(MessageComposer::TO, RsGxsId(gxs_id));
+ nMsgDialog->show();
+ nMsgDialog->activateWindow();
+
+ /* window will destroy itself! */
+
+ }
+
+}
+
void ChatLobbyDialog::muteParticipant(const RsGxsId& nickname)
{
diff --git a/retroshare-gui/src/gui/chat/ChatLobbyDialog.h b/retroshare-gui/src/gui/chat/ChatLobbyDialog.h
index 7729abba8..a11a1d73b 100644
--- a/retroshare-gui/src/gui/chat/ChatLobbyDialog.h
+++ b/retroshare-gui/src/gui/chat/ChatLobbyDialog.h
@@ -77,6 +77,7 @@ protected slots:
void changePartipationState();
void distantChatParticipant();
void participantsTreeWidgetDoubleClicked(QTreeWidgetItem *item, int column);
+ void sendMessage();
private:
void updateParticipantsList();
@@ -101,9 +102,10 @@ private:
/** Ignored Users in Chatlobby by nickname until we had implemented Peer Ids in ver 0.6 */
std::set mutedParticipants;
- QAction *muteAct;
+ QAction *muteAct;
QAction *distantChatAct;
QWidgetAction *checkableAction;
+ QAction *sendMessageAct;
GxsIdChooser *ownIdChooser ;
};
From c17d0e14983f92fa37ac7e7a4082399a230f2350 Mon Sep 17 00:00:00 2001
From: sehraf
Date: Mon, 7 Sep 2015 11:22:15 +0200
Subject: [PATCH 028/240] add i2p support to libretroshare
---
libretroshare/src/pqi/p3linkmgr.cc | 6 +-
libretroshare/src/pqi/p3linkmgr.h | 3 +-
libretroshare/src/pqi/p3peermgr.cc | 174 ++++++++++++++++++++---
libretroshare/src/pqi/p3peermgr.h | 28 ++--
libretroshare/src/pqi/pqi_base.h | 3 +-
libretroshare/src/pqi/pqibin.cc | 2 +-
libretroshare/src/pqi/pqipersongrp.cc | 11 +-
libretroshare/src/pqi/pqisslpersongrp.cc | 6 +-
libretroshare/src/retroshare/rspeers.h | 5 +
libretroshare/src/rsserver/p3peers.cc | 6 +-
10 files changed, 206 insertions(+), 38 deletions(-)
diff --git a/libretroshare/src/pqi/p3linkmgr.cc b/libretroshare/src/pqi/p3linkmgr.cc
index 016e47d5c..c10f2472b 100644
--- a/libretroshare/src/pqi/p3linkmgr.cc
+++ b/libretroshare/src/pqi/p3linkmgr.cc
@@ -2026,7 +2026,11 @@ void p3LinkMgrIMPL::locked_ConnectAttempt_ProxyAddress(peerConnectState *peer,
peerConnectAddress pca;
pca.addr = proxy_addr;
- pca.type = RS_NET_CONN_TCP_HIDDEN;
+ if (mPeerMgr->hiddenDomainToHiddenType(domain_addr) == RS_HIDDEN_TYPE_I2P)
+ pca.type = RS_NET_CONN_TCP_HIDDEN_I2P;
+ else
+ /* default tor */
+ pca.type = RS_NET_CONN_TCP_HIDDEN_TOR;
//for the delay, we add a random time and some more time when the friend list is big
pca.delay = P3CONNMGR_TCP_DEFAULT_DELAY;
diff --git a/libretroshare/src/pqi/p3linkmgr.h b/libretroshare/src/pqi/p3linkmgr.h
index a35bf508c..1f2521883 100644
--- a/libretroshare/src/pqi/p3linkmgr.h
+++ b/libretroshare/src/pqi/p3linkmgr.h
@@ -46,7 +46,8 @@ const uint32_t RS_NET_CONN_UDP_ALL = 0x00f0;
const uint32_t RS_NET_CONN_TCP_LOCAL = 0x0001;
const uint32_t RS_NET_CONN_TCP_EXTERNAL = 0x0002;
const uint32_t RS_NET_CONN_TCP_UNKNOW_TOPOLOGY = 0x0004;
-const uint32_t RS_NET_CONN_TCP_HIDDEN = 0x0008;
+const uint32_t RS_NET_CONN_TCP_HIDDEN_TOR = 0x0008;
+const uint32_t RS_NET_CONN_TCP_HIDDEN_I2P = 0x0010;
const uint32_t RS_NET_CONN_UDP_DHT_SYNC = 0x0010;
const uint32_t RS_NET_CONN_UDP_PEER_SYNC = 0x0020; /* coming soon */
diff --git a/libretroshare/src/pqi/p3peermgr.cc b/libretroshare/src/pqi/p3peermgr.cc
index dde9d3569..4d8d2e29a 100644
--- a/libretroshare/src/pqi/p3peermgr.cc
+++ b/libretroshare/src/pqi/p3peermgr.cc
@@ -130,13 +130,18 @@ p3PeerMgrIMPL::p3PeerMgrIMPL(const RsPeerId& ssl_own_id, const RsPgpId& gpg_own_
lastGroupId = 1;
// setup default ProxyServerAddress.
- sockaddr_storage_clear(mProxyServerAddress);
- sockaddr_storage_ipv4_aton(mProxyServerAddress,
+ sockaddr_storage_clear(mProxyServerAddressTor);
+ sockaddr_storage_ipv4_aton(mProxyServerAddressTor,
kConfigDefaultProxyServerIpAddr.c_str());
- sockaddr_storage_ipv4_setport(mProxyServerAddress,
+ sockaddr_storage_ipv4_setport(mProxyServerAddressTor,
kConfigDefaultProxyServerPort);
+ sockaddr_storage_clear(mProxyServerAddressI2P);
+ sockaddr_storage_ipv4_aton(mProxyServerAddressI2P,
+ kConfigDefaultProxyServerIpAddr.c_str());
+ sockaddr_storage_ipv4_setport(mProxyServerAddressI2P,
+ kConfigDefaultProxyServerPort);
- mProxyServerStatus = RS_NET_PROXY_STATUS_UNKNOWN ;
+ mProxyServerStatusTor = RS_NET_PROXY_STATUS_UNKNOWN ;
}
#ifdef PEER_DEBUG
@@ -397,6 +402,100 @@ bool p3PeerMgrIMPL::isHiddenPeer(const RsPeerId &ssl_id)
return (it->second).hiddenNode;
}
+bool p3PeerMgrIMPL::isHiddenTor()
+{
+ RsStackMutex stack(mPeerMtx); /****** STACK LOCK MUTEX *******/
+ return mOwnState.hiddenType == RS_HIDDEN_TYPE_TOR;
+}
+
+bool p3PeerMgrIMPL::isHiddenTorPeer(const RsPeerId &ssl_id)
+{
+ RsStackMutex stack(mPeerMtx); /****** STACK LOCK MUTEX *******/
+
+ /* check for existing */
+ std::map::iterator it;
+ it = mFriendList.find(ssl_id);
+ if (it == mFriendList.end())
+ {
+#ifdef PEER_DEBUG
+ std::cerr << "p3PeerMgrIMPL::isHiddenTorPeer(" << ssl_id << ") Missing Peer => false";
+ std::cerr << std::endl;
+#endif
+
+ return false;
+ }
+
+#ifdef PEER_DEBUG
+ std::cerr << "p3PeerMgrIMPL::isHiddenTorPeer(" << ssl_id << ") = " << (it->second).hiddenType;
+ std::cerr << std::endl;
+#endif
+ return (it->second).hiddenType == RS_HIDDEN_TYPE_TOR;
+}
+
+bool p3PeerMgrIMPL::isHiddenI2P()
+{
+ RsStackMutex stack(mPeerMtx); /****** STACK LOCK MUTEX *******/
+ return mOwnState.hiddenType == RS_HIDDEN_TYPE_I2P;
+}
+
+bool p3PeerMgrIMPL::isHiddenI2PPeer(const RsPeerId &ssl_id)
+{
+ RsStackMutex stack(mPeerMtx); /****** STACK LOCK MUTEX *******/
+
+ /* check for existing */
+ std::map::iterator it;
+ it = mFriendList.find(ssl_id);
+ if (it == mFriendList.end())
+ {
+#ifdef PEER_DEBUG
+ std::cerr << "p3PeerMgrIMPL::isHiddenI2PPeer(" << ssl_id << ") Missing Peer => false";
+ std::cerr << std::endl;
+#endif
+
+ return false;
+ }
+
+#ifdef PEER_DEBUG
+ std::cerr << "p3PeerMgrIMPL::isHiddenI2PPeer(" << ssl_id << ") = " << (it->second).hiddenType;
+ std::cerr << std::endl;
+#endif
+ return (it->second).hiddenType == RS_HIDDEN_TYPE_I2P;
+}
+
+bool hasEnding (std::string const &fullString, std::string const &ending) {
+ if (fullString.length() < ending.length())
+ return false;
+
+ return (0 == fullString.compare (fullString.length() - ending.length(), ending.length(), ending));
+}
+
+/**
+ * @brief resolves the hidden type (tor or i2p) from a domain
+ * @param domain to check
+ * @return RS_HIDDEN_TYPE_TOR, RS_HIDDEN_TYPE_I2P or RS_HIDDEN_TYPE_NONE
+ *
+ * Tor: ^[a-z2-7]{16}\.onion$
+ *
+ * I2P: There is more than one address:
+ * - pub. key in base64
+ * - hash in base32 ( ^[a-z2-7]{52}\.b32\.i2p$ )
+ * - "normal" .i2p domains
+ */
+uint32_t p3PeerMgrIMPL::hiddenDomainToHiddenType(const std::string &domain)
+{
+ if(hasEnding(domain, ".onion"))
+ return RS_HIDDEN_TYPE_TOR;
+ if(hasEnding(domain, ".i2p"))
+ return RS_HIDDEN_TYPE_I2P;
+
+#ifdef PEER_DEBUG
+ std::cerr << "p3PeerMgrIMPL::hiddenDomainToHiddenType() unknown hidden type: " << domain;
+ std::cerr << std::endl;
+#endif
+ return RS_HIDDEN_TYPE_NONE;
+
+}
+
bool p3PeerMgrIMPL::setHiddenDomainPort(const RsPeerId &ssl_id, const std::string &domain_addr, const uint16_t domain_port)
{
RsStackMutex stack(mPeerMtx); /****** STACK LOCK MUTEX *******/
@@ -426,6 +525,7 @@ bool p3PeerMgrIMPL::setHiddenDomainPort(const RsPeerId &ssl_id, const std::strin
mOwnState.hiddenNode = true;
mOwnState.hiddenDomain = domain;
mOwnState.hiddenPort = domain_port;
+ mOwnState.hiddenType = hiddenDomainToHiddenType(domain);
#ifdef PEER_DEBUG
std::cerr << "p3PeerMgrIMPL::setHiddenDomainPort() Set own State";
std::cerr << std::endl;
@@ -448,6 +548,7 @@ bool p3PeerMgrIMPL::setHiddenDomainPort(const RsPeerId &ssl_id, const std::strin
it->second.hiddenDomain = domain;
it->second.hiddenPort = domain_port;
it->second.hiddenNode = true;
+ it->second.hiddenType = hiddenDomainToHiddenType(domain);
#ifdef PEER_DEBUG
std::cerr << "p3PeerMgrIMPL::setHiddenDomainPort() Set Peers State";
std::cerr << std::endl;
@@ -456,15 +557,28 @@ bool p3PeerMgrIMPL::setHiddenDomainPort(const RsPeerId &ssl_id, const std::strin
return true;
}
-bool p3PeerMgrIMPL::setProxyServerAddress(const struct sockaddr_storage &proxy_addr)
+bool p3PeerMgrIMPL::setProxyServerAddress(const uint32_t type, const struct sockaddr_storage &proxy_addr)
{
RsStackMutex stack(mPeerMtx); /****** STACK LOCK MUTEX *******/
- if (!sockaddr_storage_same(mProxyServerAddress,proxy_addr))
- {
- IndicateConfigChanged(); /**** INDICATE MSG CONFIG CHANGED! *****/
- mProxyServerAddress = proxy_addr;
+ switch (type) {
+ case RS_HIDDEN_TYPE_I2P:
+ if (!sockaddr_storage_same(mProxyServerAddressI2P,proxy_addr))
+ {
+ IndicateConfigChanged(); /**** INDICATE MSG CONFIG CHANGED! *****/
+ mProxyServerAddressI2P = proxy_addr;
+ }
+ break;
+ case RS_HIDDEN_TYPE_TOR:
+ default:
+ if (!sockaddr_storage_same(mProxyServerAddressTor,proxy_addr))
+ {
+ IndicateConfigChanged(); /**** INDICATE MSG CONFIG CHANGED! *****/
+ mProxyServerAddressTor = proxy_addr;
+ }
+ break;
}
+
return true;
}
@@ -480,18 +594,36 @@ bool p3PeerMgrIMPL::resetOwnExternalAddressList()
return true ;
}
-bool p3PeerMgrIMPL::getProxyServerStatus(uint32_t& proxy_status)
-{
- RsStackMutex stack(mPeerMtx); /****** STACK LOCK MUTEX *******/
-
- proxy_status = mProxyServerStatus;
- return true;
-}
-bool p3PeerMgrIMPL::getProxyServerAddress(struct sockaddr_storage &proxy_addr)
+bool p3PeerMgrIMPL::getProxyServerStatus(const uint32_t type, uint32_t& proxy_status)
{
RsStackMutex stack(mPeerMtx); /****** STACK LOCK MUTEX *******/
- proxy_addr = mProxyServerAddress;
+ switch (type) {
+ case RS_HIDDEN_TYPE_I2P:
+ proxy_status = mProxyServerStatusI2P;
+ break;
+ case RS_HIDDEN_TYPE_TOR:
+ default:
+ proxy_status = mProxyServerStatusTor;
+ break;
+ }
+
+ return true;
+}
+
+bool p3PeerMgrIMPL::getProxyServerAddress(const uint32_t type, struct sockaddr_storage &proxy_addr)
+{
+ RsStackMutex stack(mPeerMtx); /****** STACK LOCK MUTEX *******/
+
+ switch (type) {
+ case RS_HIDDEN_TYPE_I2P:
+ proxy_addr = mProxyServerAddressI2P;
+ break;
+ case RS_HIDDEN_TYPE_TOR:
+ default:
+ proxy_addr = mProxyServerAddressTor;
+ break;
+ }
return true;
}
@@ -515,7 +647,11 @@ bool p3PeerMgrIMPL::getProxyAddress(const RsPeerId &ssl_id, struct sockaddr_stor
domain_addr = it->second.hiddenDomain;
domain_port = it->second.hiddenPort;
- proxy_addr = mProxyServerAddress;
+ if(it->second.hiddenType == RS_HIDDEN_TYPE_I2P)
+ proxy_addr = mProxyServerAddressI2P;
+ else
+ /* default tor */
+ proxy_addr = mProxyServerAddressTor;
return true;
}
diff --git a/libretroshare/src/pqi/p3peermgr.h b/libretroshare/src/pqi/p3peermgr.h
index 2af81855a..f9474465c 100644
--- a/libretroshare/src/pqi/p3peermgr.h
+++ b/libretroshare/src/pqi/p3peermgr.h
@@ -90,6 +90,7 @@ class peerState
bool hiddenNode; /* all IP addresses / dyndns must be blank */
std::string hiddenDomain;
uint16_t hiddenPort;
+ uint32_t hiddenType;
std::string location;
std::string name;
@@ -185,11 +186,15 @@ virtual bool getPeerName(const RsPeerId &ssl_id, std::string &name) = 0;
virtual bool getGpgId(const RsPeerId &sslId, RsPgpId &gpgId) = 0;
virtual uint32_t getConnectionType(const RsPeerId &sslId) = 0;
-virtual bool setProxyServerAddress(const struct sockaddr_storage &proxy_addr) = 0;
-virtual bool getProxyServerAddress(struct sockaddr_storage &proxy_addr) = 0;
-virtual bool getProxyServerStatus(uint32_t& status) = 0;
+virtual bool setProxyServerAddress(const uint32_t type, const struct sockaddr_storage &proxy_addr) = 0;
+virtual bool getProxyServerAddress(const uint32_t type, struct sockaddr_storage &proxy_addr) = 0;
+virtual bool getProxyServerStatus(const uint32_t type, uint32_t& status) = 0;
virtual bool isHidden() = 0;
virtual bool isHiddenPeer(const RsPeerId &ssl_id) = 0;
+virtual bool isHiddenTor() = 0;
+virtual bool isHiddenTorPeer(const RsPeerId &ssl_id) = 0;
+virtual bool isHiddenI2P() = 0;
+virtual bool isHiddenI2PPeer(const RsPeerId &ssl_id) = 0;
virtual bool getProxyAddress(const RsPeerId &ssl_id, struct sockaddr_storage &proxy_addr, std::string &domain_addr, uint16_t &domain_port) = 0;
@@ -288,12 +293,17 @@ virtual bool getPeerName(const RsPeerId& ssl_id, std::string& name);
virtual bool getGpgId(const RsPeerId& sslId, RsPgpId& gpgId);
virtual uint32_t getConnectionType(const RsPeerId& sslId);
-virtual bool setProxyServerAddress(const struct sockaddr_storage &proxy_addr);
-virtual bool getProxyServerAddress(struct sockaddr_storage &proxy_addr);
-virtual bool getProxyServerStatus(uint32_t &proxy_status);
+virtual bool setProxyServerAddress(const uint32_t type, const struct sockaddr_storage &proxy_addr);
+virtual bool getProxyServerAddress(const uint32_t type, struct sockaddr_storage &proxy_addr);
+virtual bool getProxyServerStatus(const uint32_t type, uint32_t &proxy_status);
virtual bool isHidden();
virtual bool isHiddenPeer(const RsPeerId& ssl_id);
+virtual bool isHiddenTor();
+virtual bool isHiddenTorPeer(const RsPeerId &ssl_id);
+virtual bool isHiddenI2P();
+virtual bool isHiddenI2PPeer(const RsPeerId &ssl_id);
virtual bool getProxyAddress(const RsPeerId& ssl_id, struct sockaddr_storage &proxy_addr, std::string &domain_addr, uint16_t &domain_port);
+virtual uint32_t hiddenDomainToHiddenType(const std::string &domain);
virtual int getFriendCount(bool ssl, bool online);
@@ -369,8 +379,10 @@ private:
std::map mFriendsPermissionFlags ; // permission flags for each gpg key
- struct sockaddr_storage mProxyServerAddress;
- uint32_t mProxyServerStatus ;
+ struct sockaddr_storage mProxyServerAddressTor;
+ struct sockaddr_storage mProxyServerAddressI2P;
+ uint32_t mProxyServerStatusTor ;
+ uint32_t mProxyServerStatusI2P ;
};
diff --git a/libretroshare/src/pqi/pqi_base.h b/libretroshare/src/pqi/pqi_base.h
index 2f2446315..d6128b579 100644
--- a/libretroshare/src/pqi/pqi_base.h
+++ b/libretroshare/src/pqi/pqi_base.h
@@ -249,7 +249,8 @@ class PQInterface: public RateInterface
const uint32_t PQI_CONNECT_TCP = 0x0001;
const uint32_t PQI_CONNECT_UDP = 0x0002;
-const uint32_t PQI_CONNECT_HIDDEN_TCP = 0x0004;
+const uint32_t PQI_CONNECT_HIDDEN_TOR_TCP = 0x0004;
+const uint32_t PQI_CONNECT_HIDDEN_I2P_TCP = 0x0008;
#define BIN_FLAGS_NO_CLOSE 0x0001
diff --git a/libretroshare/src/pqi/pqibin.cc b/libretroshare/src/pqi/pqibin.cc
index 3c9ed7731..10a67c77f 100644
--- a/libretroshare/src/pqi/pqibin.cc
+++ b/libretroshare/src/pqi/pqibin.cc
@@ -500,7 +500,7 @@ void printNetBinID(std::ostream &out, const RsPeerId& id, uint32_t t)
{
out << "TCP)";
}
- else if (t == PQI_CONNECT_HIDDEN_TCP)
+ else if (t == PQI_CONNECT_HIDDEN_TOR_TCP || t == PQI_CONNECT_HIDDEN_I2P_TCP)
{
out << "HTCP";
}
diff --git a/libretroshare/src/pqi/pqipersongrp.cc b/libretroshare/src/pqi/pqipersongrp.cc
index 9336736b4..8563ac0ac 100644
--- a/libretroshare/src/pqi/pqipersongrp.cc
+++ b/libretroshare/src/pqi/pqipersongrp.cc
@@ -617,10 +617,15 @@ int pqipersongrp::connectPeer(const RsPeerId& id
uint32_t ptype;
if (type & RS_NET_CONN_TCP_ALL)
{
- if (type == RS_NET_CONN_TCP_HIDDEN)
+ if (type == RS_NET_CONN_TCP_HIDDEN_TOR)
{
- ptype = PQI_CONNECT_HIDDEN_TCP;
- timeout = RS_TCP_HIDDEN_TIMEOUT_PERIOD;
+ ptype = PQI_CONNECT_HIDDEN_TOR_TCP;
+ timeout = RS_TCP_HIDDEN_TIMEOUT_PERIOD;
+ }
+ else if (type == RS_NET_CONN_TCP_HIDDEN_I2P)
+ {
+ ptype = PQI_CONNECT_HIDDEN_I2P_TCP;
+ timeout = RS_TCP_HIDDEN_TIMEOUT_PERIOD;
}
else
{
diff --git a/libretroshare/src/pqi/pqisslpersongrp.cc b/libretroshare/src/pqi/pqisslpersongrp.cc
index 8988d8872..fb285d7ba 100644
--- a/libretroshare/src/pqi/pqisslpersongrp.cc
+++ b/libretroshare/src/pqi/pqisslpersongrp.cc
@@ -91,7 +91,11 @@ pqiperson * pqisslpersongrp::locked_createPerson(const RsPeerId& id, pqilistener
pqiconnect *pqisc = new pqiconnect(pqip, rss, pqis);
- pqip -> addChildInterface(PQI_CONNECT_HIDDEN_TCP, pqisc);
+ if (mPeerMgr->isHiddenI2P() | mPeerMgr->isHiddenI2PPeer(id))
+ pqip -> addChildInterface(PQI_CONNECT_HIDDEN_I2P_TCP, pqisc);
+ else
+ /* default tor */
+ pqip -> addChildInterface(PQI_CONNECT_HIDDEN_TOR_TCP, pqisc);
}
else
{
diff --git a/libretroshare/src/retroshare/rspeers.h b/libretroshare/src/retroshare/rspeers.h
index afb3f1a81..e8c3884f3 100644
--- a/libretroshare/src/retroshare/rspeers.h
+++ b/libretroshare/src/retroshare/rspeers.h
@@ -63,6 +63,11 @@ const uint32_t RS_NETMODE_EXT = 0x0003;
const uint32_t RS_NETMODE_HIDDEN = 0x0004;
const uint32_t RS_NETMODE_UNREACHABLE = 0x0005;
+/* Hidden Type */
+const uint32_t RS_HIDDEN_TYPE_NONE = 0x0000;
+const uint32_t RS_HIDDEN_TYPE_TOR = 0x0001;
+const uint32_t RS_HIDDEN_TYPE_I2P = 0x0002;
+
/* Visibility */
const uint32_t RS_VS_DISC_OFF = 0x0000;
const uint32_t RS_VS_DISC_MINIMAL = 0x0001;
diff --git a/libretroshare/src/rsserver/p3peers.cc b/libretroshare/src/rsserver/p3peers.cc
index 54819d40a..0a0c8717e 100644
--- a/libretroshare/src/rsserver/p3peers.cc
+++ b/libretroshare/src/rsserver/p3peers.cc
@@ -930,10 +930,10 @@ bool p3Peers::getProxyServer(std::string &addr, uint16_t &port, uint32_t &status
#endif
struct sockaddr_storage proxy_addr;
- mPeerMgr->getProxyServerAddress(proxy_addr);
+ mPeerMgr->getProxyServerAddressTor(proxy_addr);
addr = sockaddr_storage_iptostring(proxy_addr);
port = sockaddr_storage_port(proxy_addr);
- mPeerMgr->getProxyServerStatus(status);
+ mPeerMgr->getProxyServerStatusTor(status);
return true;
}
@@ -958,7 +958,7 @@ bool p3Peers::setProxyServer(const std::string &addr_str, const uint16_t port)
#endif
/********************************** WINDOWS/UNIX SPECIFIC PART *******************/
{
- return mPeerMgr->setProxyServerAddress(addr);
+ return mPeerMgr->setProxyServerAddressTor(addr);
}
else
{
From ba74c04581586e146e67225eeb4c84bb0c367673 Mon Sep 17 00:00:00 2001
From: sehraf
Date: Mon, 7 Sep 2015 11:51:24 +0200
Subject: [PATCH 029/240] removed duplicated code, fixed compile, few additions
---
libretroshare/src/pqi/p3peermgr.cc | 195 +++++++++++++----------
libretroshare/src/pqi/p3peermgr.h | 14 +-
libretroshare/src/pqi/pqisslpersongrp.cc | 2 +-
libretroshare/src/retroshare/rspeers.h | 4 +-
libretroshare/src/rsserver/p3peers.cc | 18 +--
libretroshare/src/rsserver/p3peers.h | 6 +-
6 files changed, 133 insertions(+), 106 deletions(-)
diff --git a/libretroshare/src/pqi/p3peermgr.cc b/libretroshare/src/pqi/p3peermgr.cc
index 4d8d2e29a..be0c565f9 100644
--- a/libretroshare/src/pqi/p3peermgr.cc
+++ b/libretroshare/src/pqi/p3peermgr.cc
@@ -77,8 +77,10 @@ static const std::string kConfigDefaultProxyServerIpAddr = "127.0.0.1";
static const uint16_t kConfigDefaultProxyServerPort = 9050; // standard port.
static const std::string kConfigKeyExtIpFinder = "USE_EXTR_IP_FINDER";
-static const std::string kConfigKeyProxyServerIpAddr = "PROXY_SERVER_IPADDR";
-static const std::string kConfigKeyProxyServerPort = "PROXY_SERVER_PORT";
+static const std::string kConfigKeyProxyServerIpAddrTor = "PROXY_SERVER_IPADDR";
+static const std::string kConfigKeyProxyServerPortTor = "PROXY_SERVER_PORT";
+static const std::string kConfigKeyProxyServerIpAddrI2P = "PROXY_SERVER_IPADDR_I2P";
+static const std::string kConfigKeyProxyServerPortI2P = "PROXY_SERVER_PORT_I2P";
void printConnectState(std::ostream &out, peerState &peer);
@@ -373,12 +375,42 @@ bool p3PeerMgrIMPL::getGpgId(const RsPeerId &ssl_id, RsPgpId &gpgId)
bool p3PeerMgrIMPL::isHidden()
{
- RsStackMutex stack(mPeerMtx); /****** STACK LOCK MUTEX *******/
- return mOwnState.hiddenNode;
+ return isHidden(RS_HIDDEN_TYPE_NONE);
}
+/**
+ * @brief checks the hidden type of the own peer. When type RS_HIDDEN_TYPE_NONE is choosen it returns the 'hiddenNode' value instead
+ * @param type type to check. Use RS_HIDDEN_TYPE_NONE to check 'hiddenNode' value
+ * @return true when the peer has the same hidden type than type
+ */
+bool p3PeerMgrIMPL::isHidden(const uint32_t type)
+{
+ RsStackMutex stack(mPeerMtx); /****** STACK LOCK MUTEX *******/
+ switch (type) {
+ case RS_HIDDEN_TYPE_TOR:
+ return mOwnState.hiddenType == RS_HIDDEN_TYPE_TOR;
+ break;
+ case RS_HIDDEN_TYPE_I2P:
+ return mOwnState.hiddenType == RS_HIDDEN_TYPE_I2P;
+ break;
+ default:
+ return mOwnState.hiddenNode;
+ break;
+ }
+}
bool p3PeerMgrIMPL::isHiddenPeer(const RsPeerId &ssl_id)
+{
+ return isHiddenPeer(ssl_id, RS_HIDDEN_TYPE_NONE);
+}
+
+/**
+ * @brief checks the hidden type of a given ssl id. When type RS_HIDDEN_TYPE_NONE is choosen it returns the 'hiddenNode' value instead
+ * @param ssl_id to check
+ * @param type type to check. Use RS_HIDDEN_TYPE_NONE to check 'hiddenNode' value
+ * @return true when the peer has the same hidden type than type
+ */
+bool p3PeerMgrIMPL::isHiddenPeer(const RsPeerId &ssl_id, const uint32_t type)
{
RsStackMutex stack(mPeerMtx); /****** STACK LOCK MUTEX *******/
@@ -399,67 +431,17 @@ bool p3PeerMgrIMPL::isHiddenPeer(const RsPeerId &ssl_id)
std::cerr << "p3PeerMgrIMPL::isHiddenPeer(" << ssl_id << ") = " << (it->second).hiddenNode;
std::cerr << std::endl;
#endif
- return (it->second).hiddenNode;
-}
-
-bool p3PeerMgrIMPL::isHiddenTor()
-{
- RsStackMutex stack(mPeerMtx); /****** STACK LOCK MUTEX *******/
- return mOwnState.hiddenType == RS_HIDDEN_TYPE_TOR;
-}
-
-bool p3PeerMgrIMPL::isHiddenTorPeer(const RsPeerId &ssl_id)
-{
- RsStackMutex stack(mPeerMtx); /****** STACK LOCK MUTEX *******/
-
- /* check for existing */
- std::map::iterator it;
- it = mFriendList.find(ssl_id);
- if (it == mFriendList.end())
- {
-#ifdef PEER_DEBUG
- std::cerr << "p3PeerMgrIMPL::isHiddenTorPeer(" << ssl_id << ") Missing Peer => false";
- std::cerr << std::endl;
-#endif
-
- return false;
+ switch (type) {
+ case RS_HIDDEN_TYPE_TOR:
+ return (it->second).hiddenType == RS_HIDDEN_TYPE_TOR;
+ break;
+ case RS_HIDDEN_TYPE_I2P:
+ return (it->second).hiddenType == RS_HIDDEN_TYPE_I2P;
+ break;
+ default:
+ return (it->second).hiddenNode;
+ break;
}
-
-#ifdef PEER_DEBUG
- std::cerr << "p3PeerMgrIMPL::isHiddenTorPeer(" << ssl_id << ") = " << (it->second).hiddenType;
- std::cerr << std::endl;
-#endif
- return (it->second).hiddenType == RS_HIDDEN_TYPE_TOR;
-}
-
-bool p3PeerMgrIMPL::isHiddenI2P()
-{
- RsStackMutex stack(mPeerMtx); /****** STACK LOCK MUTEX *******/
- return mOwnState.hiddenType == RS_HIDDEN_TYPE_I2P;
-}
-
-bool p3PeerMgrIMPL::isHiddenI2PPeer(const RsPeerId &ssl_id)
-{
- RsStackMutex stack(mPeerMtx); /****** STACK LOCK MUTEX *******/
-
- /* check for existing */
- std::map::iterator it;
- it = mFriendList.find(ssl_id);
- if (it == mFriendList.end())
- {
-#ifdef PEER_DEBUG
- std::cerr << "p3PeerMgrIMPL::isHiddenI2PPeer(" << ssl_id << ") Missing Peer => false";
- std::cerr << std::endl;
-#endif
-
- return false;
- }
-
-#ifdef PEER_DEBUG
- std::cerr << "p3PeerMgrIMPL::isHiddenI2PPeer(" << ssl_id << ") = " << (it->second).hiddenType;
- std::cerr << std::endl;
-#endif
- return (it->second).hiddenType == RS_HIDDEN_TYPE_I2P;
}
bool hasEnding (std::string const &fullString, std::string const &ending) {
@@ -1756,10 +1738,6 @@ bool p3PeerMgrIMPL::saveList(bool &cleanup, std::list& saveData)
cleanup = false;
bool useExtAddrFinder = mNetMgr->getIPServersEnabled();
- // Store Proxy Server.
- struct sockaddr_storage proxy_addr;
- getProxyServerAddress(proxy_addr);
-
mPeerMtx.lock(); /****** MUTEX LOCKED *******/
RsPeerNetItem *item = new RsPeerNetItem();
@@ -1869,16 +1847,37 @@ bool p3PeerMgrIMPL::saveList(bool &cleanup, std::list& saveData)
vitem->tlvkvs.pairs.push_back(kv) ;
+ // Store Proxy Server.
+ // Tor
+ struct sockaddr_storage proxy_addr;
+ getProxyServerAddress(RS_HIDDEN_TYPE_TOR, proxy_addr);
+
#ifdef PEER_DEBUG
- std::cerr << "Saving proxyServerAddress: " << sockaddr_storage_tostring(proxy_addr);
+ std::cerr << "Saving proxyServerAddress for Tor: " << sockaddr_storage_tostring(proxy_addr);
std::cerr << std::endl;
#endif
- kv.key = kConfigKeyProxyServerIpAddr;
+ kv.key = kConfigKeyProxyServerIpAddrTor;
kv.value = sockaddr_storage_iptostring(proxy_addr);
vitem->tlvkvs.pairs.push_back(kv) ;
- kv.key = kConfigKeyProxyServerPort;
+ kv.key = kConfigKeyProxyServerPortTor;
+ kv.value = sockaddr_storage_porttostring(proxy_addr);
+ vitem->tlvkvs.pairs.push_back(kv) ;
+
+ // I2P
+ getProxyServerAddress(RS_HIDDEN_TYPE_I2P, proxy_addr);
+
+#ifdef PEER_DEBUG
+ std::cerr << "Saving proxyServerAddress for I2P: " << sockaddr_storage_tostring(proxy_addr);
+ std::cerr << std::endl;
+#endif
+
+ kv.key = kConfigKeyProxyServerIpAddrI2P;
+ kv.value = sockaddr_storage_iptostring(proxy_addr);
+ vitem->tlvkvs.pairs.push_back(kv) ;
+
+ kv.key = kConfigKeyProxyServerPortI2P;
kv.value = sockaddr_storage_porttostring(proxy_addr);
vitem->tlvkvs.pairs.push_back(kv) ;
@@ -1915,8 +1914,10 @@ bool p3PeerMgrIMPL::loadList(std::list& load)
// DEFAULTS.
bool useExtAddrFinder = true;
- std::string proxyIpAddress = kConfigDefaultProxyServerIpAddr;
- uint16_t proxyPort = kConfigDefaultProxyServerPort;
+ std::string proxyIpAddressTor = kConfigDefaultProxyServerIpAddr;
+ uint16_t proxyPortTor = kConfigDefaultProxyServerPort;
+ std::string proxyIpAddressI2P = kConfigDefaultProxyServerIpAddr;
+ uint16_t proxyPortI2P = kConfigDefaultProxyServerPort;
if (load.empty()) {
std::cerr << "p3PeerMgrIMPL::loadList() list is empty, it may be a configuration problem." << std::endl;
@@ -2012,20 +2013,39 @@ bool p3PeerMgrIMPL::loadList(std::list& load)
std::cerr << "setting use_extr_addr_finder to " << useExtAddrFinder << std::endl ;
#endif
}
- else if (kit->key == kConfigKeyProxyServerIpAddr)
+ // Tor
+ else if (kit->key == kConfigKeyProxyServerIpAddrTor)
{
- proxyIpAddress = kit->value;
+ proxyIpAddressTor = kit->value;
#ifdef PEER_DEBUG
- std::cerr << "Loaded proxyIpAddress: " << proxyIpAddress;
+ std::cerr << "Loaded proxyIpAddress for Tor: " << proxyIpAddress;
std::cerr << std::endl ;
#endif
}
- else if (kit->key == kConfigKeyProxyServerPort)
+ else if (kit->key == kConfigKeyProxyServerPortTor)
{
- proxyPort = atoi(kit->value.c_str());
+ proxyPortTor = atoi(kit->value.c_str());
#ifdef PEER_DEBUG
- std::cerr << "Loaded proxyPort: " << proxyPort;
+ std::cerr << "Loaded proxyPort for Tor: " << proxyPort;
+ std::cerr << std::endl ;
+#endif
+ }
+ // I2p
+ else if (kit->key == kConfigKeyProxyServerIpAddrI2P)
+ {
+ proxyIpAddressI2P = kit->value;
+#ifdef PEER_DEBUG
+ std::cerr << "Loaded proxyIpAddress for I2P: " << proxyIpAddress;
+ std::cerr << std::endl ;
+#endif
+
+ }
+ else if (kit->key == kConfigKeyProxyServerPortI2P)
+ {
+ proxyPortI2P = atoi(kit->value.c_str());
+#ifdef PEER_DEBUG
+ std::cerr << "Loaded proxyPort for I2P: " << proxyPort;
std::cerr << std::endl ;
#endif
}
@@ -2141,13 +2161,24 @@ bool p3PeerMgrIMPL::loadList(std::list& load)
// Configure Proxy Server.
struct sockaddr_storage proxy_addr;
+ // Tor
sockaddr_storage_clear(proxy_addr);
- sockaddr_storage_ipv4_aton(proxy_addr, proxyIpAddress.c_str());
- sockaddr_storage_ipv4_setport(proxy_addr, proxyPort);
+ sockaddr_storage_ipv4_aton(proxy_addr, proxyIpAddressTor.c_str());
+ sockaddr_storage_ipv4_setport(proxy_addr, proxyPortTor);
if (sockaddr_storage_isValidNet(proxy_addr))
{
- setProxyServerAddress(proxy_addr);
+ setProxyServerAddress(RS_HIDDEN_TYPE_TOR, proxy_addr);
+ }
+
+ // I2P
+ sockaddr_storage_clear(proxy_addr);
+ sockaddr_storage_ipv4_aton(proxy_addr, proxyIpAddressI2P.c_str());
+ sockaddr_storage_ipv4_setport(proxy_addr, proxyPortI2P);
+
+ if (sockaddr_storage_isValidNet(proxy_addr))
+ {
+ setProxyServerAddress(RS_HIDDEN_TYPE_I2P, proxy_addr);
}
return true;
diff --git a/libretroshare/src/pqi/p3peermgr.h b/libretroshare/src/pqi/p3peermgr.h
index f9474465c..2941ba182 100644
--- a/libretroshare/src/pqi/p3peermgr.h
+++ b/libretroshare/src/pqi/p3peermgr.h
@@ -190,11 +190,9 @@ virtual bool setProxyServerAddress(const uint32_t type, const struct sockaddr
virtual bool getProxyServerAddress(const uint32_t type, struct sockaddr_storage &proxy_addr) = 0;
virtual bool getProxyServerStatus(const uint32_t type, uint32_t& status) = 0;
virtual bool isHidden() = 0;
+virtual bool isHidden(const uint32_t type) = 0;
virtual bool isHiddenPeer(const RsPeerId &ssl_id) = 0;
-virtual bool isHiddenTor() = 0;
-virtual bool isHiddenTorPeer(const RsPeerId &ssl_id) = 0;
-virtual bool isHiddenI2P() = 0;
-virtual bool isHiddenI2PPeer(const RsPeerId &ssl_id) = 0;
+virtual bool isHiddenPeer(const RsPeerId &ssl_id, const uint32_t type) = 0;
virtual bool getProxyAddress(const RsPeerId &ssl_id, struct sockaddr_storage &proxy_addr, std::string &domain_addr, uint16_t &domain_port) = 0;
@@ -297,11 +295,9 @@ virtual bool setProxyServerAddress(const uint32_t type, const struct sockaddr
virtual bool getProxyServerAddress(const uint32_t type, struct sockaddr_storage &proxy_addr);
virtual bool getProxyServerStatus(const uint32_t type, uint32_t &proxy_status);
virtual bool isHidden();
-virtual bool isHiddenPeer(const RsPeerId& ssl_id);
-virtual bool isHiddenTor();
-virtual bool isHiddenTorPeer(const RsPeerId &ssl_id);
-virtual bool isHiddenI2P();
-virtual bool isHiddenI2PPeer(const RsPeerId &ssl_id);
+virtual bool isHidden(const uint32_t type);
+virtual bool isHiddenPeer(const RsPeerId &ssl_id);
+virtual bool isHiddenPeer(const RsPeerId &ssl_id, const uint32_t type);
virtual bool getProxyAddress(const RsPeerId& ssl_id, struct sockaddr_storage &proxy_addr, std::string &domain_addr, uint16_t &domain_port);
virtual uint32_t hiddenDomainToHiddenType(const std::string &domain);
diff --git a/libretroshare/src/pqi/pqisslpersongrp.cc b/libretroshare/src/pqi/pqisslpersongrp.cc
index fb285d7ba..94a7ed853 100644
--- a/libretroshare/src/pqi/pqisslpersongrp.cc
+++ b/libretroshare/src/pqi/pqisslpersongrp.cc
@@ -91,7 +91,7 @@ pqiperson * pqisslpersongrp::locked_createPerson(const RsPeerId& id, pqilistener
pqiconnect *pqisc = new pqiconnect(pqip, rss, pqis);
- if (mPeerMgr->isHiddenI2P() | mPeerMgr->isHiddenI2PPeer(id))
+ if (mPeerMgr->isHidden(RS_HIDDEN_TYPE_I2P) | mPeerMgr->isHiddenPeer(id, RS_HIDDEN_TYPE_I2P))
pqip -> addChildInterface(PQI_CONNECT_HIDDEN_I2P_TCP, pqisc);
else
/* default tor */
diff --git a/libretroshare/src/retroshare/rspeers.h b/libretroshare/src/retroshare/rspeers.h
index e8c3884f3..4b21fadef 100644
--- a/libretroshare/src/retroshare/rspeers.h
+++ b/libretroshare/src/retroshare/rspeers.h
@@ -355,8 +355,8 @@ class RsPeers
virtual bool setNetworkMode(const RsPeerId &ssl_id, uint32_t netMode) = 0;
virtual bool setVisState(const RsPeerId &ssl_id, uint16_t vs_disc, uint16_t vs_dht) = 0;
- virtual bool getProxyServer(std::string &addr, uint16_t &port,uint32_t& status_flags) = 0;
- virtual bool setProxyServer(const std::string &addr, const uint16_t port) = 0;
+ virtual bool getProxyServer(const uint32_t type, std::string &addr, uint16_t &port,uint32_t& status_flags) = 0;
+ virtual bool setProxyServer(const uint32_t type, const std::string &addr, const uint16_t port) = 0;
virtual void getIPServersList(std::list& ip_servers) = 0;
virtual void allowServerIPDetermination(bool) = 0;
diff --git a/libretroshare/src/rsserver/p3peers.cc b/libretroshare/src/rsserver/p3peers.cc
index 0a0c8717e..97e81b073 100644
--- a/libretroshare/src/rsserver/p3peers.cc
+++ b/libretroshare/src/rsserver/p3peers.cc
@@ -435,7 +435,7 @@ bool p3Peers::getPeerDetails(const RsPeerId& id, RsPeerDetails &d)
}
else if (pcs.state & RS_PEER_S_CONNECTED)
{
- if(isProxyAddress(pcs.connectaddr) || mPeerMgr->isHidden())
+ if(isProxyAddress(RS_HIDDEN_TYPE_TOR, pcs.connectaddr) || isProxyAddress(RS_HIDDEN_TYPE_I2P, pcs.connectaddr) || mPeerMgr->isHidden())
d.connectState = RS_PEER_CONNECTSTATE_CONNECTED_TOR;
else if (pcs.connecttype == RS_NET_CONN_TCP_ALL)
{
@@ -457,13 +457,13 @@ bool p3Peers::getPeerDetails(const RsPeerId& id, RsPeerDetails &d)
return true;
}
-bool p3Peers::isProxyAddress(const sockaddr_storage& addr)
+bool p3Peers::isProxyAddress(const uint32_t type, const sockaddr_storage& addr)
{
uint16_t port ;
std::string string_addr;
- uint32_t status ;
+ uint32_t status ;
- if(!getProxyServer(string_addr, port, status))
+ if(!getProxyServer(type, string_addr, port, status))
return false ;
return sockaddr_storage_iptostring(addr)==string_addr && sockaddr_storage_port(addr)==port ;
@@ -923,21 +923,21 @@ bool p3Peers::setVisState(const RsPeerId &id, uint16_t vs_disc, uint16_t vs_dht)
return mPeerMgr->setVisState(id, vs_disc, vs_dht);
}
-bool p3Peers::getProxyServer(std::string &addr, uint16_t &port, uint32_t &status)
+bool p3Peers::getProxyServer(const uint32_t type, std::string &addr, uint16_t &port, uint32_t &status)
{
#ifdef P3PEERS_DEBUG
std::cerr << "p3Peers::getProxyServer()" << std::endl;
#endif
struct sockaddr_storage proxy_addr;
- mPeerMgr->getProxyServerAddressTor(proxy_addr);
+ mPeerMgr->getProxyServerAddress(type, proxy_addr);
addr = sockaddr_storage_iptostring(proxy_addr);
port = sockaddr_storage_port(proxy_addr);
- mPeerMgr->getProxyServerStatusTor(status);
+ mPeerMgr->getProxyServerStatus(type, status);
return true;
}
-bool p3Peers::setProxyServer(const std::string &addr_str, const uint16_t port)
+bool p3Peers::setProxyServer(const uint32_t type, const std::string &addr_str, const uint16_t port)
{
#ifdef P3PEERS_DEBUG
std::cerr << "p3Peers::setProxyServer() " << std::endl;
@@ -958,7 +958,7 @@ bool p3Peers::setProxyServer(const std::string &addr_str, const uint16_t port)
#endif
/********************************** WINDOWS/UNIX SPECIFIC PART *******************/
{
- return mPeerMgr->setProxyServerAddressTor(addr);
+ return mPeerMgr->setProxyServerAddress(type, addr);
}
else
{
diff --git a/libretroshare/src/rsserver/p3peers.h b/libretroshare/src/rsserver/p3peers.h
index 66540003e..3f4fb8763 100644
--- a/libretroshare/src/rsserver/p3peers.h
+++ b/libretroshare/src/rsserver/p3peers.h
@@ -94,9 +94,9 @@ virtual bool setDynDNS(const RsPeerId &id, const std::string &dyndns);
virtual bool setNetworkMode(const RsPeerId &id, uint32_t netMode);
virtual bool setVisState(const RsPeerId &id, uint16_t vs_disc, uint16_t vs_dht);
-virtual bool getProxyServer(std::string &addr, uint16_t &port,uint32_t& status);
-virtual bool setProxyServer(const std::string &addr, const uint16_t port);
-virtual bool isProxyAddress(const sockaddr_storage&);
+virtual bool getProxyServer(const uint32_t type, std::string &addr, uint16_t &port,uint32_t& status);
+virtual bool setProxyServer(const uint32_t type,const std::string &addr, const uint16_t port);
+virtual bool isProxyAddress(const uint32_t type,const sockaddr_storage&);
virtual void getIPServersList(std::list& ip_servers) ;
virtual void allowServerIPDetermination(bool) ;
From 0107f4e4064439610ea5d0ed30cf8aea62655c96 Mon Sep 17 00:00:00 2001
From: sehraf
Date: Mon, 7 Sep 2015 12:59:21 +0200
Subject: [PATCH 030/240] first run on gui integration
---
libretroshare/src/retroshare/rspeers.h | 3 +-
libretroshare/src/rsserver/p3peers.cc | 8 +-
retroshare-gui/src/gui/common/StatusDefs.cpp | 8 ++
.../src/gui/settings/ServerPage.cpp | 59 ++++++++-----
retroshare-gui/src/gui/settings/ServerPage.h | 8 +-
retroshare-gui/src/gui/settings/ServerPage.ui | 86 ++++++++++++++++---
6 files changed, 137 insertions(+), 35 deletions(-)
diff --git a/libretroshare/src/retroshare/rspeers.h b/libretroshare/src/retroshare/rspeers.h
index 4b21fadef..6d8adf050 100644
--- a/libretroshare/src/retroshare/rspeers.h
+++ b/libretroshare/src/retroshare/rspeers.h
@@ -101,7 +101,8 @@ const uint32_t RS_PEER_CONNECTSTATE_TRYING_UDP = 3;
const uint32_t RS_PEER_CONNECTSTATE_CONNECTED_TCP = 4;
const uint32_t RS_PEER_CONNECTSTATE_CONNECTED_UDP = 5;
const uint32_t RS_PEER_CONNECTSTATE_CONNECTED_TOR = 6;
-const uint32_t RS_PEER_CONNECTSTATE_CONNECTED_UNKNOWN = 7;
+const uint32_t RS_PEER_CONNECTSTATE_CONNECTED_I2P = 7;
+const uint32_t RS_PEER_CONNECTSTATE_CONNECTED_UNKNOWN = 8;
/* Error codes for certificate cleaning and cert parsing. Numbers should not overlap. */
diff --git a/libretroshare/src/rsserver/p3peers.cc b/libretroshare/src/rsserver/p3peers.cc
index 97e81b073..b5112b984 100644
--- a/libretroshare/src/rsserver/p3peers.cc
+++ b/libretroshare/src/rsserver/p3peers.cc
@@ -435,8 +435,14 @@ bool p3Peers::getPeerDetails(const RsPeerId& id, RsPeerDetails &d)
}
else if (pcs.state & RS_PEER_S_CONNECTED)
{
- if(isProxyAddress(RS_HIDDEN_TYPE_TOR, pcs.connectaddr) || isProxyAddress(RS_HIDDEN_TYPE_I2P, pcs.connectaddr) || mPeerMgr->isHidden())
+ if(isProxyAddress(RS_HIDDEN_TYPE_TOR, pcs.connectaddr) || mPeerMgr->isHidden(RS_HIDDEN_TYPE_TOR))
+ {
d.connectState = RS_PEER_CONNECTSTATE_CONNECTED_TOR;
+ }
+ else if (isProxyAddress(RS_HIDDEN_TYPE_I2P, pcs.connectaddr) || mPeerMgr->isHidden(RS_HIDDEN_TYPE_I2P))
+ {
+ d.connectState = RS_PEER_CONNECTSTATE_CONNECTED_I2P;
+ }
else if (pcs.connecttype == RS_NET_CONN_TCP_ALL)
{
d.connectState = RS_PEER_CONNECTSTATE_CONNECTED_TCP;
diff --git a/retroshare-gui/src/gui/common/StatusDefs.cpp b/retroshare-gui/src/gui/common/StatusDefs.cpp
index b0756c88f..486312c61 100644
--- a/retroshare-gui/src/gui/common/StatusDefs.cpp
+++ b/retroshare-gui/src/gui/common/StatusDefs.cpp
@@ -182,6 +182,10 @@ QString StatusDefs::connectStateString(RsPeerDetails &details)
stateString = qApp->translate("StatusDefs", "Connected: Tor");
isConnected = true;
break;
+ case RS_PEER_CONNECTSTATE_CONNECTED_I2P:
+ stateString = qApp->translate("StatusDefs", "Connected: I2P");
+ isConnected = true;
+ break;
case RS_PEER_CONNECTSTATE_CONNECTED_UNKNOWN:
stateString = qApp->translate("StatusDefs", "Connected: Unknown");
isConnected = true;
@@ -231,6 +235,7 @@ QString StatusDefs::connectStateWithoutTransportTypeString(RsPeerDetails &detail
case RS_PEER_CONNECTSTATE_CONNECTED_TCP:
case RS_PEER_CONNECTSTATE_CONNECTED_UDP:
case RS_PEER_CONNECTSTATE_CONNECTED_TOR:
+ case RS_PEER_CONNECTSTATE_CONNECTED_I2P:
case RS_PEER_CONNECTSTATE_CONNECTED_UNKNOWN:
stateString = qApp->translate("StatusDefs", "Connected");
break;
@@ -258,6 +263,9 @@ QString StatusDefs::connectStateIpString(RsPeerDetails &details)
case RS_PEER_CONNECTSTATE_CONNECTED_TOR:
stateString += QString(details.actAsServer ? qApp->translate("StatusDefs", "Tor-in") : qApp->translate("StatusDefs", "Tor-out"));
break;
+ case RS_PEER_CONNECTSTATE_CONNECTED_I2P:
+ stateString += QString(details.actAsServer ? qApp->translate("StatusDefs", "I2P-in") : qApp->translate("StatusDefs", "I2P-out"));
+ break;
case RS_PEER_CONNECTSTATE_CONNECTED_UNKNOWN:
stateString += qApp->translate("StatusDefs", "unkown");
break;
diff --git a/retroshare-gui/src/gui/settings/ServerPage.cpp b/retroshare-gui/src/gui/settings/ServerPage.cpp
index e44e275cc..7e6e82026 100755
--- a/retroshare-gui/src/gui/settings/ServerPage.cpp
+++ b/retroshare-gui/src/gui/settings/ServerPage.cpp
@@ -306,9 +306,14 @@ void ServerPage::load()
std::string proxyaddr;
uint16_t proxyport;
uint32_t status ;
- rsPeers->getProxyServer(proxyaddr, proxyport, status);
- ui.torpage_proxyAddress -> setText(QString::fromStdString(proxyaddr));
- ui.torpage_proxyPort -> setValue(proxyport);
+ // Tor
+ rsPeers->getProxyServer(RS_HIDDEN_TYPE_TOR, proxyaddr, proxyport, status);
+ ui.hiddenpage_proxyAddress_tor -> setText(QString::fromStdString(proxyaddr));
+ ui.hiddenpage_proxyPort_tor -> setValue(proxyport);
+ // I2P
+ rsPeers->getProxyServer(RS_HIDDEN_TYPE_I2P, proxyaddr, proxyport, status);
+ ui.hiddenpage_proxyAddress_i2p -> setText(QString::fromStdString(proxyaddr));
+ ui.hiddenpage_proxyPort_i2p -> setValue(proxyport);
updateTorOutProxyIndicator();
}
@@ -807,17 +812,29 @@ void ServerPage::saveAddresses()
rsConfig->SetMaxDataRates( ui.totalDownloadRate->value(), ui.totalUploadRate->value() );
// HANDLE PROXY SERVER.
- std::string orig_proxyaddr;
- uint16_t orig_proxyport;
- uint32_t status ;
- rsPeers->getProxyServer(orig_proxyaddr, orig_proxyport,status);
+ std::string orig_proxyaddr,new_proxyaddr;
+ uint16_t orig_proxyport, new_proxyport;
+ uint32_t status ;
+ // Tor
+ rsPeers->getProxyServer(RS_HIDDEN_TYPE_TOR, orig_proxyaddr, orig_proxyport,status);
- std::string new_proxyaddr = ui.torpage_proxyAddress -> text().toStdString();
- uint16_t new_proxyport = ui.torpage_proxyPort -> value();
+ new_proxyaddr = ui.hiddenpage_proxyAddress_tor -> text().toStdString();
+ new_proxyport = ui.hiddenpage_proxyPort_tor -> value();
if ((new_proxyaddr != orig_proxyaddr) || (new_proxyport != orig_proxyport))
{
- rsPeers->setProxyServer(new_proxyaddr, new_proxyport);
+ rsPeers->setProxyServer(RS_HIDDEN_TYPE_TOR, new_proxyaddr, new_proxyport);
+ }
+
+ // I2P
+ rsPeers->getProxyServer(RS_HIDDEN_TYPE_I2P, orig_proxyaddr, orig_proxyport,status);
+
+ new_proxyaddr = ui.hiddenpage_proxyAddress_i2p -> text().toStdString();
+ new_proxyport = ui.hiddenpage_proxyPort_i2p -> value();
+
+ if ((new_proxyaddr != orig_proxyaddr) || (new_proxyport != orig_proxyport))
+ {
+ rsPeers->setProxyServer(RS_HIDDEN_TYPE_I2P, new_proxyaddr, new_proxyport);
}
load();
@@ -935,9 +952,9 @@ void ServerPage::loadHiddenNode()
std::string proxyaddr;
uint16_t proxyport;
uint32_t proxy_state_flags;
- rsPeers->getProxyServer(proxyaddr, proxyport, proxy_state_flags);
- ui.torpage_proxyAddress -> setText(QString::fromStdString(proxyaddr));
- ui.torpage_proxyPort -> setValue(proxyport);
+ rsPeers->getProxyServer(RS_HIDDEN_TYPE_TOR, proxyaddr, proxyport, proxy_state_flags);
+ ui.hiddenpage_proxyAddress_tor -> setText(QString::fromStdString(proxyaddr));
+ ui.hiddenpage_proxyPort_tor -> setValue(proxyport);
updateTorOutProxyIndicator();
@@ -1053,14 +1070,14 @@ void ServerPage::saveAddressesHiddenNode()
std::string orig_proxyaddr;
uint16_t orig_proxyport;
uint32_t state_flags ;
- rsPeers->getProxyServer(orig_proxyaddr, orig_proxyport,state_flags);
+ rsPeers->getProxyServer(RS_HIDDEN_TYPE_TOR, orig_proxyaddr, orig_proxyport,state_flags);
- std::string new_proxyaddr = ui.torpage_proxyAddress -> text().toStdString();
- uint16_t new_proxyport = ui.torpage_proxyPort -> value();
+ std::string new_proxyaddr = ui.hiddenpage_proxyAddress_tor -> text().toStdString();
+ uint16_t new_proxyport = ui.hiddenpage_proxyPort_tor -> value();
if ((new_proxyaddr != orig_proxyaddr) || (new_proxyport != orig_proxyport))
{
- rsPeers->setProxyServer(new_proxyaddr, new_proxyport);
+ rsPeers->setProxyServer(RS_HIDDEN_TYPE_TOR, new_proxyaddr, new_proxyport);
}
rsConfig->SetMaxDataRates( ui.totalDownloadRate->value(), ui.totalUploadRate->value() );
@@ -1069,7 +1086,7 @@ void ServerPage::saveAddressesHiddenNode()
void ServerPage::updateTorOutProxyIndicator()
{
QTcpSocket socket ;
- socket.connectToHost(ui.torpage_proxyAddress->text(),ui.torpage_proxyPort->text().toInt());
+ socket.connectToHost(ui.hiddenpage_proxyAddress_tor->text(),ui.hiddenpage_proxyPort_tor->text().toInt());
if(socket.waitForConnected(500))
{
@@ -1113,8 +1130,8 @@ void ServerPage::updateTorInProxyIndicator()
QNetworkProxy proxy ;
proxy.setType(QNetworkProxy::Socks5Proxy);
- proxy.setHostName(ui.torpage_proxyAddress->text());
- proxy.setPort(ui.torpage_proxyPort->text().toInt());
+ proxy.setHostName(ui.hiddenpage_proxyAddress_tor->text());
+ proxy.setPort(ui.hiddenpage_proxyPort_tor->text().toInt());
proxy.setCapabilities(QNetworkProxy::HostNameLookupCapability | proxy.capabilities()) ;
//ui.iconlabel_tor_incoming->setPixmap(QPixmap(ICON_STATUS_UNKNOWN)) ;
@@ -1127,7 +1144,7 @@ void ServerPage::updateTorInProxyIndicator()
QUrl url("https://"+ui.torpage_onionAddress->text() + ":" + ui.torpage_onionPort->text()) ;
- std::cerr << "Setting proxy hostname+port to " << std::dec << ui.torpage_proxyAddress->text().toStdString() << ":" << ui.torpage_proxyPort->text().toInt() << std::endl;
+ std::cerr << "Setting proxy hostname+port to " << std::dec << ui.hiddenpage_proxyAddress_tor->text().toStdString() << ":" << ui.hiddenpage_proxyPort_tor->text().toInt() << std::endl;
std::cerr << "Connecting to " << url.toString().toStdString() << std::endl;
connect(manager, SIGNAL(finished(QNetworkReply*)),this,SLOT(handleNetworkReply(QNetworkReply*))) ;
diff --git a/retroshare-gui/src/gui/settings/ServerPage.h b/retroshare-gui/src/gui/settings/ServerPage.h
index 1c84e10b5..4a212e0b9 100755
--- a/retroshare-gui/src/gui/settings/ServerPage.h
+++ b/retroshare-gui/src/gui/settings/ServerPage.h
@@ -52,6 +52,7 @@ public slots:
void updateStatus();
private slots:
+ // ban list
void updateSelectedBlackListIP(int row, int, int, int);
void updateSelectedWhiteListIP(int row,int,int,int);
void addIpRangeToBlackList();
@@ -69,6 +70,8 @@ private slots:
void ipFilterContextMenu(const QPoint &);
void ipWhiteListContextMenu(const QPoint &point);
void removeBannedIp();
+
+ // server
void saveAddresses();
void toggleUPnP();
void toggleIpDetermination(bool) ;
@@ -78,11 +81,12 @@ private slots:
void updateTorInProxyIndicator();
private:
-
- // Alternative Versions for HiddenNode Mode.
+ // ban list
void addPeerToIPTable(QTableWidget *table, int row, const BanListPeer &blp);
bool removeCurrentRowFromBlackList(sockaddr_storage& collected_addr,int& masked_bytes);
bool removeCurrentRowFromWhiteList(sockaddr_storage &collected_addr, int &masked_bytes);
+
+ // Alternative Versions for HiddenNode Mode.
void loadHiddenNode();
void updateStatusHiddenNode();
void saveAddressesHiddenNode();
diff --git a/retroshare-gui/src/gui/settings/ServerPage.ui b/retroshare-gui/src/gui/settings/ServerPage.ui
index 5a481d8b5..4e3119ce1 100755
--- a/retroshare-gui/src/gui/settings/ServerPage.ui
+++ b/retroshare-gui/src/gui/settings/ServerPage.ui
@@ -11,13 +11,22 @@
-
+
+ 6
+
+
+ 6
+
+
+ 6
+
+
6
-
- 0
+ 2
@@ -515,7 +524,7 @@ behind a firewall or a VPN.
0
-
+
IP blacklist
@@ -756,15 +765,15 @@ behind a firewall or a VPN.
-
+
- Tor Configuration
+ Hidden Service Configuration
-
- Outgoing Tor Connections
+ Outgoing Connections
-
@@ -779,10 +788,10 @@ behind a firewall or a VPN.
-
-
+
-
-
+
10
@@ -822,12 +831,67 @@ behind a firewall or a VPN.
+ -
+
+
+ 0
+
+
+ 0
+
+
-
+
+
-
+
+
+ I2P Socks Proxy
+
+
+
+ -
+
+
+ -
+
+
+ 10
+
+
+ 65535
+
+
+
+
+
+ -
+
+
-
+
+
+
+
+
+ :/images/ledoff1.png
+
+
+
+ -
+
+
+ I2P outgoing Okay
+
+
+
+
+
+
+
-
16777215
- 100
+ 145
@@ -839,8 +903,10 @@ behind a firewall or a VPN.
Tor Socks Proxy default: 127.0.0.1:9050. Set in torrc config and update here.
+I2P Socks Proxy: see http://127.0.0.1:7657/i2ptunnelmgr for setting up a client tunnel.
+
You can connect to Hidden Nodes, even if you
-are running a standard Node, so why not setup Tor?
+are running a standard Node, so why not setup Tor and/or I2P?
From 95d6b06eb545fac7a317a03edac5c53040aac3a3 Mon Sep 17 00:00:00 2001
From: sehraf
Date: Mon, 7 Sep 2015 18:46:19 +0200
Subject: [PATCH 031/240] first working version
---
libretroshare/src/pqi/p3linkmgr.h | 8 +-
libretroshare/src/pqi/p3peermgr.cc | 50 +++++++-----
libretroshare/src/rsserver/p3peers.cc | 4 +-
.../src/gui/settings/ServerPage.cpp | 81 +++++++++++--------
retroshare-gui/src/gui/settings/ServerPage.h | 3 +-
5 files changed, 85 insertions(+), 61 deletions(-)
diff --git a/libretroshare/src/pqi/p3linkmgr.h b/libretroshare/src/pqi/p3linkmgr.h
index 1f2521883..5be0b2707 100644
--- a/libretroshare/src/pqi/p3linkmgr.h
+++ b/libretroshare/src/pqi/p3linkmgr.h
@@ -40,8 +40,8 @@ class DNSResolver ;
/* order of attempts ... */
-const uint32_t RS_NET_CONN_TCP_ALL = 0x000f;
-const uint32_t RS_NET_CONN_UDP_ALL = 0x00f0;
+const uint32_t RS_NET_CONN_TCP_ALL = 0x001f;
+const uint32_t RS_NET_CONN_UDP_ALL = 0x00e0;
const uint32_t RS_NET_CONN_TCP_LOCAL = 0x0001;
const uint32_t RS_NET_CONN_TCP_EXTERNAL = 0x0002;
@@ -49,8 +49,8 @@ const uint32_t RS_NET_CONN_TCP_UNKNOW_TOPOLOGY = 0x0004;
const uint32_t RS_NET_CONN_TCP_HIDDEN_TOR = 0x0008;
const uint32_t RS_NET_CONN_TCP_HIDDEN_I2P = 0x0010;
-const uint32_t RS_NET_CONN_UDP_DHT_SYNC = 0x0010;
-const uint32_t RS_NET_CONN_UDP_PEER_SYNC = 0x0020; /* coming soon */
+const uint32_t RS_NET_CONN_UDP_DHT_SYNC = 0x0020;
+const uint32_t RS_NET_CONN_UDP_PEER_SYNC = 0x0040; /* coming soon */
// These are set in pqipersongroup.
const uint32_t RS_TCP_STD_TIMEOUT_PERIOD = 5; /* 5 seconds! */
diff --git a/libretroshare/src/pqi/p3peermgr.cc b/libretroshare/src/pqi/p3peermgr.cc
index be0c565f9..3801355d6 100644
--- a/libretroshare/src/pqi/p3peermgr.cc
+++ b/libretroshare/src/pqi/p3peermgr.cc
@@ -86,7 +86,7 @@ void printConnectState(std::ostream &out, peerState &peer);
peerState::peerState()
:netMode(RS_NET_MODE_UNKNOWN), vs_disc(RS_VS_DISC_FULL), vs_dht(RS_VS_DHT_FULL), lastcontact(0),
- hiddenNode(false), hiddenPort(0)
+ hiddenNode(false), hiddenPort(0), hiddenType(RS_HIDDEN_TYPE_NONE)
{
sockaddr_storage_clear(localaddr);
sockaddr_storage_clear(serveraddr);
@@ -132,11 +132,13 @@ p3PeerMgrIMPL::p3PeerMgrIMPL(const RsPeerId& ssl_own_id, const RsPgpId& gpg_own_
lastGroupId = 1;
// setup default ProxyServerAddress.
+ // Tor
sockaddr_storage_clear(mProxyServerAddressTor);
sockaddr_storage_ipv4_aton(mProxyServerAddressTor,
kConfigDefaultProxyServerIpAddr.c_str());
sockaddr_storage_ipv4_setport(mProxyServerAddressTor,
kConfigDefaultProxyServerPort);
+ // I2P
sockaddr_storage_clear(mProxyServerAddressI2P);
sockaddr_storage_ipv4_aton(mProxyServerAddressI2P,
kConfigDefaultProxyServerIpAddr.c_str());
@@ -144,6 +146,7 @@ p3PeerMgrIMPL::p3PeerMgrIMPL(const RsPeerId& ssl_own_id, const RsPgpId& gpg_own_
kConfigDefaultProxyServerPort);
mProxyServerStatusTor = RS_NET_PROXY_STATUS_UNKNOWN ;
+ mProxyServerStatusI2P = RS_NET_PROXY_STATUS_UNKNOWN;
}
#ifdef PEER_DEBUG
@@ -176,6 +179,7 @@ bool p3PeerMgrIMPL::setupHiddenNode(const std::string &hiddenAddress, const uint
mOwnState.hiddenNode = true;
mOwnState.hiddenPort = hiddenPort;
mOwnState.hiddenDomain = hiddenAddress;
+ mOwnState.hiddenType = hiddenDomainToHiddenType(hiddenAddress);
}
forceHiddenNode();
@@ -375,12 +379,13 @@ bool p3PeerMgrIMPL::getGpgId(const RsPeerId &ssl_id, RsPgpId &gpgId)
bool p3PeerMgrIMPL::isHidden()
{
- return isHidden(RS_HIDDEN_TYPE_NONE);
+ RsStackMutex stack(mPeerMtx); /****** STACK LOCK MUTEX *******/
+ return mOwnState.hiddenNode;
}
/**
- * @brief checks the hidden type of the own peer. When type RS_HIDDEN_TYPE_NONE is choosen it returns the 'hiddenNode' value instead
- * @param type type to check. Use RS_HIDDEN_TYPE_NONE to check 'hiddenNode' value
+ * @brief checks the hidden type of the own peer.
+ * @param type type to check
* @return true when the peer has the same hidden type than type
*/
bool p3PeerMgrIMPL::isHidden(const uint32_t type)
@@ -394,7 +399,11 @@ bool p3PeerMgrIMPL::isHidden(const uint32_t type)
return mOwnState.hiddenType == RS_HIDDEN_TYPE_I2P;
break;
default:
- return mOwnState.hiddenNode;
+#ifdef PEER_DEBUG
+ std::cerr << "p3PeerMgrIMPL::isHidden(" << type << ") unkown type -> false";
+ std::cerr << std::endl;
+#endif
+ return false;
break;
}
}
@@ -475,7 +484,6 @@ uint32_t p3PeerMgrIMPL::hiddenDomainToHiddenType(const std::string &domain)
std::cerr << std::endl;
#endif
return RS_HIDDEN_TYPE_NONE;
-
}
bool p3PeerMgrIMPL::setHiddenDomainPort(const RsPeerId &ssl_id, const std::string &domain_addr, const uint16_t domain_port)
@@ -1738,6 +1746,11 @@ bool p3PeerMgrIMPL::saveList(bool &cleanup, std::list& saveData)
cleanup = false;
bool useExtAddrFinder = mNetMgr->getIPServersEnabled();
+ /* gather these information before mPeerMtx is locked! */
+ struct sockaddr_storage proxy_addr_tor, proxy_addr_i2p;
+ getProxyServerAddress(RS_HIDDEN_TYPE_TOR, proxy_addr_tor);
+ getProxyServerAddress(RS_HIDDEN_TYPE_I2P, proxy_addr_i2p);
+
mPeerMtx.lock(); /****** MUTEX LOCKED *******/
RsPeerNetItem *item = new RsPeerNetItem();
@@ -1849,36 +1862,31 @@ bool p3PeerMgrIMPL::saveList(bool &cleanup, std::list& saveData)
// Store Proxy Server.
// Tor
- struct sockaddr_storage proxy_addr;
- getProxyServerAddress(RS_HIDDEN_TYPE_TOR, proxy_addr);
-
#ifdef PEER_DEBUG
- std::cerr << "Saving proxyServerAddress for Tor: " << sockaddr_storage_tostring(proxy_addr);
+ std::cerr << "Saving proxyServerAddress for Tor: " << sockaddr_storage_tostring(proxy_addr_tor);
std::cerr << std::endl;
#endif
kv.key = kConfigKeyProxyServerIpAddrTor;
- kv.value = sockaddr_storage_iptostring(proxy_addr);
+ kv.value = sockaddr_storage_iptostring(proxy_addr_tor);
vitem->tlvkvs.pairs.push_back(kv) ;
kv.key = kConfigKeyProxyServerPortTor;
- kv.value = sockaddr_storage_porttostring(proxy_addr);
+ kv.value = sockaddr_storage_porttostring(proxy_addr_tor);
vitem->tlvkvs.pairs.push_back(kv) ;
// I2P
- getProxyServerAddress(RS_HIDDEN_TYPE_I2P, proxy_addr);
-
#ifdef PEER_DEBUG
- std::cerr << "Saving proxyServerAddress for I2P: " << sockaddr_storage_tostring(proxy_addr);
+ std::cerr << "Saving proxyServerAddress for I2P: " << sockaddr_storage_tostring(proxy_addr_tor);
std::cerr << std::endl;
#endif
kv.key = kConfigKeyProxyServerIpAddrI2P;
- kv.value = sockaddr_storage_iptostring(proxy_addr);
+ kv.value = sockaddr_storage_iptostring(proxy_addr_i2p);
vitem->tlvkvs.pairs.push_back(kv) ;
kv.key = kConfigKeyProxyServerPortI2P;
- kv.value = sockaddr_storage_porttostring(proxy_addr);
+ kv.value = sockaddr_storage_porttostring(proxy_addr_i2p);
vitem->tlvkvs.pairs.push_back(kv) ;
saveData.push_back(vitem);
@@ -2018,7 +2026,7 @@ bool p3PeerMgrIMPL::loadList(std::list& load)
{
proxyIpAddressTor = kit->value;
#ifdef PEER_DEBUG
- std::cerr << "Loaded proxyIpAddress for Tor: " << proxyIpAddress;
+ std::cerr << "Loaded proxyIpAddress for Tor: " << proxyIpAddressTor;
std::cerr << std::endl ;
#endif
@@ -2027,7 +2035,7 @@ bool p3PeerMgrIMPL::loadList(std::list& load)
{
proxyPortTor = atoi(kit->value.c_str());
#ifdef PEER_DEBUG
- std::cerr << "Loaded proxyPort for Tor: " << proxyPort;
+ std::cerr << "Loaded proxyPort for Tor: " << proxyPortTor;
std::cerr << std::endl ;
#endif
}
@@ -2036,7 +2044,7 @@ bool p3PeerMgrIMPL::loadList(std::list& load)
{
proxyIpAddressI2P = kit->value;
#ifdef PEER_DEBUG
- std::cerr << "Loaded proxyIpAddress for I2P: " << proxyIpAddress;
+ std::cerr << "Loaded proxyIpAddress for I2P: " << proxyIpAddressI2P;
std::cerr << std::endl ;
#endif
@@ -2045,7 +2053,7 @@ bool p3PeerMgrIMPL::loadList(std::list& load)
{
proxyPortI2P = atoi(kit->value.c_str());
#ifdef PEER_DEBUG
- std::cerr << "Loaded proxyPort for I2P: " << proxyPort;
+ std::cerr << "Loaded proxyPort for I2P: " << proxyPortI2P;
std::cerr << std::endl ;
#endif
}
diff --git a/libretroshare/src/rsserver/p3peers.cc b/libretroshare/src/rsserver/p3peers.cc
index b5112b984..d31a4639a 100644
--- a/libretroshare/src/rsserver/p3peers.cc
+++ b/libretroshare/src/rsserver/p3peers.cc
@@ -435,11 +435,11 @@ bool p3Peers::getPeerDetails(const RsPeerId& id, RsPeerDetails &d)
}
else if (pcs.state & RS_PEER_S_CONNECTED)
{
- if(isProxyAddress(RS_HIDDEN_TYPE_TOR, pcs.connectaddr) || mPeerMgr->isHidden(RS_HIDDEN_TYPE_TOR))
+ if (mPeerMgr->isHidden(RS_HIDDEN_TYPE_TOR) || isProxyAddress(RS_HIDDEN_TYPE_TOR, pcs.connectaddr))
{
d.connectState = RS_PEER_CONNECTSTATE_CONNECTED_TOR;
}
- else if (isProxyAddress(RS_HIDDEN_TYPE_I2P, pcs.connectaddr) || mPeerMgr->isHidden(RS_HIDDEN_TYPE_I2P))
+ else if (mPeerMgr->isHidden(RS_HIDDEN_TYPE_I2P) || isProxyAddress(RS_HIDDEN_TYPE_I2P, pcs.connectaddr))
{
d.connectState = RS_PEER_CONNECTSTATE_CONNECTED_I2P;
}
diff --git a/retroshare-gui/src/gui/settings/ServerPage.cpp b/retroshare-gui/src/gui/settings/ServerPage.cpp
index 7e6e82026..69825d04d 100755
--- a/retroshare-gui/src/gui/settings/ServerPage.cpp
+++ b/retroshare-gui/src/gui/settings/ServerPage.cpp
@@ -302,7 +302,7 @@ void ServerPage::load()
for(std::list::const_iterator it(detail.ipAddressList.begin());it!=detail.ipAddressList.end();++it)
ui.ipAddressList->addItem(QString::fromStdString(*it));
- /* TOR PAGE SETTINGS - only Proxy (outgoing) */
+ /* HIDDEN PAGE SETTINGS - only Proxy (outgoing) */
std::string proxyaddr;
uint16_t proxyport;
uint32_t status ;
@@ -315,7 +315,7 @@ void ServerPage::load()
ui.hiddenpage_proxyAddress_i2p -> setText(QString::fromStdString(proxyaddr));
ui.hiddenpage_proxyPort_i2p -> setValue(proxyport);
- updateTorOutProxyIndicator();
+ updateOutProxyIndicator();
}
void ServerPage::toggleAutoIncludeFriends(bool b)
@@ -702,7 +702,7 @@ void ServerPage::updateStatus()
ui.iconlabel_ext->setPixmap(QPixmap(":/images/ledoff1.png"));
// check for Tor
- updateTorOutProxyIndicator();
+ updateOutProxyIndicator();
}
void ServerPage::toggleUPnP()
@@ -949,14 +949,20 @@ void ServerPage::loadHiddenNode()
ui.torpage_onionAddress->setText(QString::fromStdString(detail.hiddenNodeAddress));
ui.torpage_onionPort -> setValue(detail.hiddenNodePort);
+ /* out proxy settings */
std::string proxyaddr;
- uint16_t proxyport;
- uint32_t proxy_state_flags;
- rsPeers->getProxyServer(RS_HIDDEN_TYPE_TOR, proxyaddr, proxyport, proxy_state_flags);
+ uint16_t proxyport;
+ uint32_t status ;
+ // Tor
+ rsPeers->getProxyServer(RS_HIDDEN_TYPE_TOR, proxyaddr, proxyport, status);
ui.hiddenpage_proxyAddress_tor -> setText(QString::fromStdString(proxyaddr));
ui.hiddenpage_proxyPort_tor -> setValue(proxyport);
+ // I2P
+ rsPeers->getProxyServer(RS_HIDDEN_TYPE_I2P, proxyaddr, proxyport, status);
+ ui.hiddenpage_proxyAddress_i2p -> setText(QString::fromStdString(proxyaddr));
+ ui.hiddenpage_proxyPort_i2p -> setValue(proxyport);
- updateTorOutProxyIndicator();
+ updateOutProxyIndicator();
QString expected = "HiddenServiceDir \n";
expected += "HiddenServicePort ";
@@ -1022,7 +1028,7 @@ void ServerPage::updateStatusHiddenNode()
#endif
- updateTorOutProxyIndicator();
+ updateOutProxyIndicator();
}
void ServerPage::saveAddressesHiddenNode()
@@ -1067,27 +1073,40 @@ void ServerPage::saveAddressesHiddenNode()
}
// HANDLE PROXY SERVER.
- std::string orig_proxyaddr;
- uint16_t orig_proxyport;
- uint32_t state_flags ;
- rsPeers->getProxyServer(RS_HIDDEN_TYPE_TOR, orig_proxyaddr, orig_proxyport,state_flags);
+ std::string orig_proxyaddr,new_proxyaddr;
+ uint16_t orig_proxyport, new_proxyport;
+ uint32_t status ;
+ // Tor
+ rsPeers->getProxyServer(RS_HIDDEN_TYPE_TOR, orig_proxyaddr, orig_proxyport,status);
- std::string new_proxyaddr = ui.hiddenpage_proxyAddress_tor -> text().toStdString();
- uint16_t new_proxyport = ui.hiddenpage_proxyPort_tor -> value();
+ new_proxyaddr = ui.hiddenpage_proxyAddress_tor -> text().toStdString();
+ new_proxyport = ui.hiddenpage_proxyPort_tor -> value();
if ((new_proxyaddr != orig_proxyaddr) || (new_proxyport != orig_proxyport))
{
rsPeers->setProxyServer(RS_HIDDEN_TYPE_TOR, new_proxyaddr, new_proxyport);
}
+ // I2P
+ rsPeers->getProxyServer(RS_HIDDEN_TYPE_I2P, orig_proxyaddr, orig_proxyport,status);
+
+ new_proxyaddr = ui.hiddenpage_proxyAddress_i2p -> text().toStdString();
+ new_proxyport = ui.hiddenpage_proxyPort_i2p -> value();
+
+ if ((new_proxyaddr != orig_proxyaddr) || (new_proxyport != orig_proxyport))
+ {
+ rsPeers->setProxyServer(RS_HIDDEN_TYPE_I2P, new_proxyaddr, new_proxyport);
+ }
+
rsConfig->SetMaxDataRates( ui.totalDownloadRate->value(), ui.totalUploadRate->value() );
load();
}
-void ServerPage::updateTorOutProxyIndicator()
+void ServerPage::updateOutProxyIndicator()
{
QTcpSocket socket ;
- socket.connectToHost(ui.hiddenpage_proxyAddress_tor->text(),ui.hiddenpage_proxyPort_tor->text().toInt());
+ // Tor
+ socket.connectToHost(ui.hiddenpage_proxyAddress_tor->text(),ui.hiddenpage_proxyPort_tor->text().toInt());
if(socket.waitForConnected(500))
{
socket.disconnectFromHost();
@@ -1099,24 +1118,22 @@ void ServerPage::updateTorOutProxyIndicator()
ui.iconlabel_tor_outgoing->setPixmap(QPixmap(ICON_STATUS_UNKNOWN)) ;
ui.iconlabel_tor_outgoing->setToolTip(tr("Tor proxy is not enabled")) ;
}
-}
-void ServerPage::updateLocInProxyIndicator()
-{
- QTcpSocket socket ;
- socket.connectToHost(ui.torpage_localAddress->text(),ui.torpage_localPort->text().toInt());
- if(socket.waitForConnected(1000))
- {
- socket.disconnectFromHost();
- ui.iconlabel_tor_incoming->setPixmap(QPixmap(ICON_STATUS_OK)) ;
- ui.iconlabel_tor_incoming->setToolTip(tr("You are reachable through Tor.")) ;
- }
- else
- {
- ui.iconlabel_tor_incoming->setPixmap(QPixmap(ICON_STATUS_UNKNOWN)) ;
- ui.iconlabel_tor_incoming->setToolTip(tr("Tor proxy is not enabled or broken.\nAre you running a Tor hidden service?\nCheck your ports!")) ;
- }
+ // I2P
+ socket.connectToHost(ui.hiddenpage_proxyAddress_i2p->text(),ui.hiddenpage_proxyPort_i2p->text().toInt());
+ if(socket.waitForConnected(500))
+ {
+ socket.disconnectFromHost();
+ ui.iconlabel_i2p_outgoing->setPixmap(QPixmap(ICON_STATUS_OK)) ;
+ ui.iconlabel_i2p_outgoing->setToolTip(tr("Proxy seems to work.")) ;
+ }
+ else
+ {
+ ui.iconlabel_i2p_outgoing->setPixmap(QPixmap(ICON_STATUS_UNKNOWN)) ;
+ ui.iconlabel_i2p_outgoing->setToolTip(tr("Tor proxy is not enabled")) ;
+ }
}
+
void ServerPage::updateTorInProxyIndicator()
{
// need to find a proper way to do this
diff --git a/retroshare-gui/src/gui/settings/ServerPage.h b/retroshare-gui/src/gui/settings/ServerPage.h
index 4a212e0b9..c660c2188 100755
--- a/retroshare-gui/src/gui/settings/ServerPage.h
+++ b/retroshare-gui/src/gui/settings/ServerPage.h
@@ -90,8 +90,7 @@ private:
void loadHiddenNode();
void updateStatusHiddenNode();
void saveAddressesHiddenNode();
- void updateTorOutProxyIndicator();
- void updateLocInProxyIndicator();
+ void updateOutProxyIndicator();
void loadFilteredIps() ;
Ui::ServerPage ui;
From fed43450ae71091bd085462fbbcdd30e3e9633bf Mon Sep 17 00:00:00 2001
From: sehraf
Date: Mon, 7 Sep 2015 22:57:54 +0200
Subject: [PATCH 032/240] made server settings more generic and added i2p
support
---
libretroshare/src/pqi/p3linkmgr.h | 12 +--
libretroshare/src/pqi/p3peermgr.h | 1 +
libretroshare/src/retroshare/rspeers.h | 1 +
libretroshare/src/rsserver/p3peers.cc | 5 +-
.../src/gui/settings/ServerPage.cpp | 88 ++++++++++++-------
retroshare-gui/src/gui/settings/ServerPage.h | 3 +-
retroshare-gui/src/gui/settings/ServerPage.ui | 22 ++---
7 files changed, 82 insertions(+), 50 deletions(-)
diff --git a/libretroshare/src/pqi/p3linkmgr.h b/libretroshare/src/pqi/p3linkmgr.h
index 5be0b2707..8208546be 100644
--- a/libretroshare/src/pqi/p3linkmgr.h
+++ b/libretroshare/src/pqi/p3linkmgr.h
@@ -40,17 +40,17 @@ class DNSResolver ;
/* order of attempts ... */
-const uint32_t RS_NET_CONN_TCP_ALL = 0x001f;
-const uint32_t RS_NET_CONN_UDP_ALL = 0x00e0;
+const uint32_t RS_NET_CONN_TCP_ALL = 0x00ff;
+const uint32_t RS_NET_CONN_UDP_ALL = 0x0f00;
const uint32_t RS_NET_CONN_TCP_LOCAL = 0x0001;
const uint32_t RS_NET_CONN_TCP_EXTERNAL = 0x0002;
const uint32_t RS_NET_CONN_TCP_UNKNOW_TOPOLOGY = 0x0004;
-const uint32_t RS_NET_CONN_TCP_HIDDEN_TOR = 0x0008;
-const uint32_t RS_NET_CONN_TCP_HIDDEN_I2P = 0x0010;
+const uint32_t RS_NET_CONN_TCP_HIDDEN_TOR = 0x0008;
+const uint32_t RS_NET_CONN_TCP_HIDDEN_I2P = 0x0010;
-const uint32_t RS_NET_CONN_UDP_DHT_SYNC = 0x0020;
-const uint32_t RS_NET_CONN_UDP_PEER_SYNC = 0x0040; /* coming soon */
+const uint32_t RS_NET_CONN_UDP_DHT_SYNC = 0x0100;
+const uint32_t RS_NET_CONN_UDP_PEER_SYNC = 0x0200; /* coming soon */
// These are set in pqipersongroup.
const uint32_t RS_TCP_STD_TIMEOUT_PERIOD = 5; /* 5 seconds! */
diff --git a/libretroshare/src/pqi/p3peermgr.h b/libretroshare/src/pqi/p3peermgr.h
index 2941ba182..a6150863c 100644
--- a/libretroshare/src/pqi/p3peermgr.h
+++ b/libretroshare/src/pqi/p3peermgr.h
@@ -194,6 +194,7 @@ virtual bool isHidden(const uint32_t type) = 0;
virtual bool isHiddenPeer(const RsPeerId &ssl_id) = 0;
virtual bool isHiddenPeer(const RsPeerId &ssl_id, const uint32_t type) = 0;
virtual bool getProxyAddress(const RsPeerId &ssl_id, struct sockaddr_storage &proxy_addr, std::string &domain_addr, uint16_t &domain_port) = 0;
+virtual uint32_t hiddenDomainToHiddenType(const std::string &domain) = 0;
virtual int getFriendCount(bool ssl, bool online) = 0;
diff --git a/libretroshare/src/retroshare/rspeers.h b/libretroshare/src/retroshare/rspeers.h
index 6d8adf050..aa7423ae9 100644
--- a/libretroshare/src/retroshare/rspeers.h
+++ b/libretroshare/src/retroshare/rspeers.h
@@ -238,6 +238,7 @@ class RsPeerDetails
bool isHiddenNode;
std::string hiddenNodeAddress;
uint16_t hiddenNodePort;
+ uint32_t hiddenType;
// Filled in for Standard Node.
std::string localAddr;
diff --git a/libretroshare/src/rsserver/p3peers.cc b/libretroshare/src/rsserver/p3peers.cc
index d31a4639a..0b95b2ec6 100644
--- a/libretroshare/src/rsserver/p3peers.cc
+++ b/libretroshare/src/rsserver/p3peers.cc
@@ -313,6 +313,7 @@ bool p3Peers::getPeerDetails(const RsPeerId& id, RsPeerDetails &d)
d.isHiddenNode = true;
d.hiddenNodeAddress = ps.hiddenDomain;
d.hiddenNodePort = ps.hiddenPort;
+ d.hiddenType = ps.hiddenType;
d.localAddr = sockaddr_storage_iptostring(ps.localaddr);
d.localPort = sockaddr_storage_port(ps.localaddr);
d.extAddr = "hidden";
@@ -324,6 +325,7 @@ bool p3Peers::getPeerDetails(const RsPeerId& id, RsPeerDetails &d)
d.isHiddenNode = false;
d.hiddenNodeAddress = "";
d.hiddenNodePort = 0;
+ d.hiddenType = RS_HIDDEN_TYPE_NONE;
d.localAddr = sockaddr_storage_iptostring(ps.localaddr);
d.localPort = sockaddr_storage_port(ps.localaddr);
@@ -1113,6 +1115,7 @@ bool p3Peers::loadDetailsFromStringCert(const std::string &certstr, RsPeerDetai
{
pd.hiddenNodeAddress = domain;
pd.hiddenNodePort = port;
+ pd.hiddenType = mPeerMgr->hiddenDomainToHiddenType(domain);
}
}
else
@@ -1317,7 +1320,7 @@ RsPeerDetails::RsPeerDetails()
hasSignedMe(false),accept_connection(false),
state(0),localAddr(""),localPort(0),extAddr(""),extPort(0),netMode(0),vs_disc(0), vs_dht(0),
lastConnect(0),connectState(0),connectStateString(""),connectPeriod(0),foundDHT(false),
- wasDeniedConnection(false), deniedTS(0)
+ wasDeniedConnection(false), deniedTS(0), hiddenType(RS_HIDDEN_TYPE_NONE)
{
}
diff --git a/retroshare-gui/src/gui/settings/ServerPage.cpp b/retroshare-gui/src/gui/settings/ServerPage.cpp
index 69825d04d..18715d823 100755
--- a/retroshare-gui/src/gui/settings/ServerPage.cpp
+++ b/retroshare-gui/src/gui/settings/ServerPage.cpp
@@ -53,7 +53,7 @@
//#define SERVER_DEBUG 1
ServerPage::ServerPage(QWidget * parent, Qt::WindowFlags flags)
- : ConfigPage(parent, flags), mIsHiddenNode(false)
+ : ConfigPage(parent, flags), mIsHiddenNode(false), mHiddenType(RS_HIDDEN_TYPE_NONE)
{
/* Invoke the Qt Designer generated object setup routine */
ui.setupUi(this);
@@ -61,7 +61,7 @@ ServerPage::ServerPage(QWidget * parent, Qt::WindowFlags flags)
connect( ui.netModeComboBox, SIGNAL( activated ( int ) ), this, SLOT( toggleUPnP( ) ) );
connect( ui.allowIpDeterminationCB, SIGNAL( toggled( bool ) ), this, SLOT( toggleIpDetermination(bool) ) );
connect( ui.cleanKnownIPs_PB, SIGNAL( clicked( ) ), this, SLOT( clearKnownAddressList() ) );
- connect( ui.testIncomingTor_PB, SIGNAL( clicked( ) ), this, SLOT( updateTorInProxyIndicator() ) );
+ connect( ui.testIncoming_PB, SIGNAL( clicked( ) ), this, SLOT( updateInProxyIndicator() ) );
manager = NULL ;
@@ -105,7 +105,7 @@ ServerPage::ServerPage(QWidget * parent, Qt::WindowFlags flags)
for(std::list::const_iterator it(ip_servers.begin());it!=ip_servers.end();++it)
ui.IPServersLV->addItem(QString::fromStdString(*it)) ;
- ui.torpage_incoming->setVisible(false);
+ ui.hiddenpage_incoming->setVisible(false);
#ifdef SERVER_DEBUG
std::cerr << "ServerPage::ServerPage() called";
@@ -218,6 +218,7 @@ void ServerPage::load()
if (mIsHiddenNode)
{
+ mHiddenType = detail.hiddenType;
ui.tabWidget->setTabEnabled(1,false) ;
loadHiddenNode();
return;
@@ -910,7 +911,7 @@ void ServerPage::loadHiddenNode()
ui.label_dynDNS->setVisible(false);
ui.dynDNS ->setVisible(false);
- ui.torpage_incoming->setVisible(true);
+ ui.hiddenpage_incoming->setVisible(true);
/* Addresses must be set here - otherwise can't edit it */
/* set local address */
@@ -918,7 +919,7 @@ void ServerPage::loadHiddenNode()
ui.localPort -> setValue(detail.localPort);
/* set the server address */
- ui.extAddress->setText(tr("Hidden - See Tor Config"));
+ ui.extAddress->setText(tr("Hidden - See Config"));
ui.showDiscStatusBar->setChecked(Settings->getStatusBarFlags() & STATUSBAR_DISC);
ui.showDiscStatusBar->hide() ; // hidden because not functional at the moment.
@@ -941,13 +942,15 @@ void ServerPage::loadHiddenNode()
/* TOR PAGE SETTINGS */
/* set local address */
- ui.torpage_localAddress->setEnabled(false);
- ui.torpage_localAddress->setText(QString::fromStdString(detail.localAddr));
- ui.torpage_localPort -> setValue(detail.localPort);
+ ui.hiddenpage_localAddress->setEnabled(false);
+ ui.hiddenpage_localAddress->setText(QString::fromStdString(detail.localAddr));
+ ui.hiddenpage_localPort -> setValue(detail.localPort);
/* set the server address */
- ui.torpage_onionAddress->setText(QString::fromStdString(detail.hiddenNodeAddress));
- ui.torpage_onionPort -> setValue(detail.hiddenNodePort);
+ ui.hiddenpage_serviceAddress->setText(QString::fromStdString(detail.hiddenNodeAddress));
+ ui.hiddenpage_servicePort -> setValue(detail.hiddenNodePort);
+ /* in I2P there is no port - there is only the address */
+ ui.hiddenpage_servicePort->setEnabled(detail.hiddenType != RS_HIDDEN_TYPE_I2P);
/* out proxy settings */
std::string proxyaddr;
@@ -964,15 +967,29 @@ void ServerPage::loadHiddenNode()
updateOutProxyIndicator();
- QString expected = "HiddenServiceDir \n";
- expected += "HiddenServicePort ";
- expected += QString::number(detail.hiddenNodePort);
- expected += " ";
- expected += QString::fromStdString(detail.localAddr);
- expected += ":";
- expected += QString::number(detail.localPort);
+ QString expected;
+ switch (mHiddenType) {
+ case RS_HIDDEN_TYPE_I2P:
+ ui.l_serviceAddress->setText(tr("I2P Address"));
+ ui.l_incomingTestResult->setText(tr("I2P incoming ok"));
- ui.torpage_configuration->setPlainText(expected);
+ expected = "--TODO-- see http://127.0.0.1:7657/i2ptunnelmgr";
+ break;
+ case RS_HIDDEN_TYPE_TOR:
+ default:
+ ui.l_serviceAddress->setText(tr("Onion Address"));
+ ui.l_incomingTestResult->setText(tr("Tor incoming ok"));
+
+ expected = "HiddenServiceDir \n";
+ expected += "HiddenServicePort ";
+ expected += QString::number(detail.hiddenNodePort);
+ expected += " ";
+ expected += QString::fromStdString(detail.localAddr);
+ expected += ":";
+ expected += QString::number(detail.localPort);
+ break;
+ }
+ ui.hiddenpage_configuration->setPlainText(expected);
}
/** Loads the settings for this page */
@@ -1059,14 +1076,14 @@ void ServerPage::saveAddressesHiddenNode()
if ((vs_disc != detail.vs_disc) || (vs_dht != detail.vs_dht))
rsPeers->setVisState(ownId, vs_disc, vs_dht);
- if (detail.localPort != ui.torpage_localPort->value())
+ if (detail.localPort != ui.hiddenpage_localPort->value())
{
// Set Local Address - force to 127.0.0.1
- rsPeers->setLocalAddress(ownId, "127.0.0.1", ui.torpage_localPort->value());
+ rsPeers->setLocalAddress(ownId, "127.0.0.1", ui.hiddenpage_localPort->value());
}
- std::string hiddenAddr = ui.torpage_onionAddress->text().toStdString();
- uint16_t hiddenPort = ui.torpage_onionPort->value();
+ std::string hiddenAddr = ui.hiddenpage_serviceAddress->text().toStdString();
+ uint16_t hiddenPort = ui.hiddenpage_servicePort->value();
if ((hiddenAddr != detail.hiddenNodeAddress) || (hiddenPort != detail.hiddenNodePort))
{
rsPeers->setHiddenNode(ownId, hiddenAddr, hiddenPort);
@@ -1134,7 +1151,7 @@ void ServerPage::updateOutProxyIndicator()
}
}
-void ServerPage::updateTorInProxyIndicator()
+void ServerPage::updateInProxyIndicator()
{
// need to find a proper way to do this
@@ -1147,19 +1164,28 @@ void ServerPage::updateTorInProxyIndicator()
QNetworkProxy proxy ;
proxy.setType(QNetworkProxy::Socks5Proxy);
- proxy.setHostName(ui.hiddenpage_proxyAddress_tor->text());
- proxy.setPort(ui.hiddenpage_proxyPort_tor->text().toInt());
+ switch (mHiddenType) {
+ case RS_HIDDEN_TYPE_I2P:
+ proxy.setHostName(ui.hiddenpage_proxyAddress_i2p->text());
+ proxy.setPort(ui.hiddenpage_proxyPort_i2p->text().toInt());
+ break;
+ case RS_HIDDEN_TYPE_TOR:
+ default:
+ proxy.setHostName(ui.hiddenpage_proxyAddress_tor->text());
+ proxy.setPort(ui.hiddenpage_proxyPort_tor->text().toInt());
+ break;
+ }
proxy.setCapabilities(QNetworkProxy::HostNameLookupCapability | proxy.capabilities()) ;
//ui.iconlabel_tor_incoming->setPixmap(QPixmap(ICON_STATUS_UNKNOWN)) ;
//ui.testIncomingTor_PB->setIcon(QIcon(":/loader/circleball-16.gif")) ;
QMovie *movie = new QMovie(":/images/loader/circleball-16.gif");
- ui.iconlabel_tor_incoming->setMovie(movie);
+ ui.iconlabel_service_incoming->setMovie(movie);
movie->start() ;
QNetworkProxy::setApplicationProxy(proxy) ;
- QUrl url("https://"+ui.torpage_onionAddress->text() + ":" + ui.torpage_onionPort->text()) ;
+ QUrl url("https://"+ui.hiddenpage_serviceAddress->text() + ":" + ui.hiddenpage_servicePort->text()) ;
std::cerr << "Setting proxy hostname+port to " << std::dec << ui.hiddenpage_proxyAddress_tor->text().toStdString() << ":" << ui.hiddenpage_proxyPort_tor->text().toInt() << std::endl;
std::cerr << "Connecting to " << url.toString().toStdString() << std::endl;
@@ -1177,8 +1203,8 @@ void ServerPage::handleNetworkReply(QNetworkReply *reply)
if(reply->isOpen() && error == QNetworkReply::SslHandshakeFailedError)
{
std::cerr <<"Connected!" << std::endl;
- ui.iconlabel_tor_incoming->setPixmap(QPixmap(ICON_STATUS_OK)) ;
- ui.iconlabel_tor_incoming->setToolTip(tr("You are reachable through Tor.")) ;
+ ui.iconlabel_service_incoming->setPixmap(QPixmap(ICON_STATUS_OK)) ;
+ ui.iconlabel_service_incoming->setToolTip(tr("You are reachable through the hidden service.")) ;
//ui.testIncomingTor_PB->setIcon(QIcon(ICON_STATUS_OK)) ;
}
else
@@ -1186,8 +1212,8 @@ void ServerPage::handleNetworkReply(QNetworkReply *reply)
std::cerr <<"Failed!" << std::endl;
//ui.testIncomingTor_PB->setIcon(QIcon(ICON_STATUS_UNKNOWN)) ;
- ui.iconlabel_tor_incoming->setPixmap(QPixmap(ICON_STATUS_UNKNOWN)) ;
- ui.iconlabel_tor_incoming->setToolTip(tr("Tor proxy is not enabled or broken.\nAre you running a Tor hidden service?\nCheck your ports!")) ;
+ ui.iconlabel_service_incoming->setPixmap(QPixmap(ICON_STATUS_UNKNOWN)) ;
+ ui.iconlabel_service_incoming->setToolTip(tr("The proxy is not enabled or broken.\Are all services up and running fine??\nAlso check your ports!")) ;
}
reply->close();
diff --git a/retroshare-gui/src/gui/settings/ServerPage.h b/retroshare-gui/src/gui/settings/ServerPage.h
index c660c2188..521487ac7 100755
--- a/retroshare-gui/src/gui/settings/ServerPage.h
+++ b/retroshare-gui/src/gui/settings/ServerPage.h
@@ -78,7 +78,7 @@ private slots:
void toggleTunnelConnection(bool) ;
void clearKnownAddressList() ;
void handleNetworkReply(QNetworkReply *reply);
- void updateTorInProxyIndicator();
+ void updateInProxyIndicator();
private:
// ban list
@@ -98,6 +98,7 @@ private:
QNetworkAccessManager *manager ;
bool mIsHiddenNode;
+ u_int32_t mHiddenType;
};
#endif // !SERVERPAGE_H
diff --git a/retroshare-gui/src/gui/settings/ServerPage.ui b/retroshare-gui/src/gui/settings/ServerPage.ui
index 4e3119ce1..c15596b49 100755
--- a/retroshare-gui/src/gui/settings/ServerPage.ui
+++ b/retroshare-gui/src/gui/settings/ServerPage.ui
@@ -914,7 +914,7 @@ are running a standard Node, so why not setup Tor and/or I2P?
-
-
+
0
@@ -922,13 +922,13 @@ are running a standard Node, so why not setup Tor and/or I2P?
- Incoming Tor Connections
+ Incoming Service Connections
-
-
-
+
10
@@ -940,7 +940,7 @@ are running a standard Node, so why not setup Tor and/or I2P?
-
-
-
+
<html><head/><body><p>This button simulates a SSL connection to your Tor address using the Tor proxy. If your Tor node is reachable, it should cause a SSL handshake error, which RS will interpret as a valid connection state. This operation might also cause several "security warning" about connections from your local host IP (127.0.0.1) in the News Feed if you enabled it,</p></body></html>
@@ -952,7 +952,7 @@ are running a standard Node, so why not setup Tor and/or I2P?
-
-
+
10
@@ -962,7 +962,7 @@ are running a standard Node, so why not setup Tor and/or I2P?
-
-
+
Onion Address
@@ -976,14 +976,14 @@ are running a standard Node, so why not setup Tor and/or I2P?
-
-
+
<html><head/><body><p>This is your onion address. It should look like <span style=" font-weight:600;">[something].onion. </span>If you configured a hidden service with Tor, the onion address is generated automatically by Tor. You can get it in e.g. <span style=" font-weight:600;">/var/lib/tor/[service name]/hostname</span></p></body></html>
-
-
+
<html><head/><body><p>This is the local address to which the Tor hidden service points at your localhost. Most of the time, <span style=" font-weight:600;">127.0.0.1</span> is the right answer.</p></body></html>
@@ -992,7 +992,7 @@ are running a standard Node, so why not setup Tor and/or I2P?
-
-
-
+
16
@@ -1008,7 +1008,7 @@ are running a standard Node, so why not setup Tor and/or I2P?
-
-
+
Tor incoming ok
@@ -1028,7 +1028,7 @@ are running a standard Node, so why not setup Tor and/or I2P?
-
-
+
0
From e2768e0c87a0e489f7c3db62316ff1954c9b3a8f Mon Sep 17 00:00:00 2001
From: defnax
Date: Mon, 7 Sep 2015 23:34:39 +0200
Subject: [PATCH 033/240] Added last used field to Person Details Window
---
.../src/gui/Identity/IdDetailsDialog.cpp | 24 +++++++++++++++++++
.../src/gui/Identity/IdDetailsDialog.ui | 21 ++++++++++++++--
2 files changed, 43 insertions(+), 2 deletions(-)
diff --git a/retroshare-gui/src/gui/Identity/IdDetailsDialog.cpp b/retroshare-gui/src/gui/Identity/IdDetailsDialog.cpp
index 89f64cf43..910a9408d 100644
--- a/retroshare-gui/src/gui/Identity/IdDetailsDialog.cpp
+++ b/retroshare-gui/src/gui/Identity/IdDetailsDialog.cpp
@@ -51,6 +51,7 @@ IdDetailsDialog::IdDetailsDialog(const RsGxsGroupId& id, QWidget *parent) :
mStateHelper->addWidget(IDDETAILSDIALOG_IDDETAILS, ui->lineEdit_GpgId);
mStateHelper->addWidget(IDDETAILSDIALOG_IDDETAILS, ui->lineEdit_GpgName);
mStateHelper->addWidget(IDDETAILSDIALOG_IDDETAILS, ui->lineEdit_Type);
+ mStateHelper->addWidget(IDDETAILSDIALOG_IDDETAILS, ui->lineEdit_LastUsed);
mStateHelper->addWidget(IDDETAILSDIALOG_IDDETAILS, ui->toolButton_Reputation);
mStateHelper->addWidget(IDDETAILSDIALOG_IDDETAILS, ui->line_RatingOverall);
mStateHelper->addWidget(IDDETAILSDIALOG_IDDETAILS, ui->line_RatingImplicit);
@@ -69,6 +70,7 @@ IdDetailsDialog::IdDetailsDialog(const RsGxsGroupId& id, QWidget *parent) :
mStateHelper->addLoadPlaceholder(IDDETAILSDIALOG_IDDETAILS, ui->lineEdit_KeyId);
mStateHelper->addLoadPlaceholder(IDDETAILSDIALOG_IDDETAILS, ui->lineEdit_GpgId);
mStateHelper->addLoadPlaceholder(IDDETAILSDIALOG_IDDETAILS, ui->lineEdit_Type);
+ mStateHelper->addLoadPlaceholder(IDDETAILSDIALOG_IDDETAILS, ui->lineEdit_LastUsed);
mStateHelper->addLoadPlaceholder(IDDETAILSDIALOG_IDDETAILS, ui->lineEdit_GpgName);
mStateHelper->addLoadPlaceholder(IDDETAILSDIALOG_IDDETAILS, ui->line_RatingOverall);
mStateHelper->addLoadPlaceholder(IDDETAILSDIALOG_IDDETAILS, ui->line_RatingImplicit);
@@ -79,6 +81,7 @@ IdDetailsDialog::IdDetailsDialog(const RsGxsGroupId& id, QWidget *parent) :
mStateHelper->addClear(IDDETAILSDIALOG_IDDETAILS, ui->lineEdit_KeyId);
mStateHelper->addClear(IDDETAILSDIALOG_IDDETAILS, ui->lineEdit_GpgId);
mStateHelper->addClear(IDDETAILSDIALOG_IDDETAILS, ui->lineEdit_Type);
+ mStateHelper->addClear(IDDETAILSDIALOG_IDDETAILS, ui->lineEdit_LastUsed);
mStateHelper->addClear(IDDETAILSDIALOG_IDDETAILS, ui->lineEdit_GpgName);
mStateHelper->addClear(IDDETAILSDIALOG_IDDETAILS, ui->line_RatingOverall);
mStateHelper->addClear(IDDETAILSDIALOG_IDDETAILS, ui->line_RatingImplicit);
@@ -111,6 +114,24 @@ IdDetailsDialog::~IdDetailsDialog()
delete(mIdQueue);
}
+static QString getHumanReadableDuration(uint32_t seconds)
+{
+ if(seconds < 60)
+ return QString(QObject::tr("%1 seconds ago")).arg(seconds) ;
+ else if(seconds < 120)
+ return QString(QObject::tr("%1 minute ago")).arg(seconds/60) ;
+ else if(seconds < 3600)
+ return QString(QObject::tr("%1 minutes ago")).arg(seconds/60) ;
+ else if(seconds < 7200)
+ return QString(QObject::tr("%1 hour ago")).arg(seconds/3600) ;
+ else if(seconds < 24*3600)
+ return QString(QObject::tr("%1 hours ago")).arg(seconds/3600) ;
+ else if(seconds < 2*24*3600)
+ return QString(QObject::tr("%1 day ago")).arg(seconds/86400) ;
+ else
+ return QString(QObject::tr("%1 days ago")).arg(seconds/86400) ;
+}
+
void IdDetailsDialog::insertIdDetails(uint32_t token)
{
mStateHelper->setLoading(IDDETAILSDIALOG_IDDETAILS, false);
@@ -153,6 +174,9 @@ void IdDetailsDialog::insertIdDetails(uint32_t token)
//ui->lineEdit_GpgHash->setText(QString::fromStdString(data.mPgpIdHash.toStdString()));
ui->lineEdit_GpgId->setText(QString::fromStdString(data.mPgpId.toStdString()));
+ time_t now = time(NULL) ;
+ ui->lineEdit_LastUsed->setText(getHumanReadableDuration(now - data.mLastUsageTS)) ;
+
QPixmap pixmap;
if(data.mImage.mSize > 0 && pixmap.loadFromData(data.mImage.mData, data.mImage.mSize, "PNG"))
diff --git a/retroshare-gui/src/gui/Identity/IdDetailsDialog.ui b/retroshare-gui/src/gui/Identity/IdDetailsDialog.ui
index 79d520c78..042922d9c 100644
--- a/retroshare-gui/src/gui/Identity/IdDetailsDialog.ui
+++ b/retroshare-gui/src/gui/Identity/IdDetailsDialog.ui
@@ -7,7 +7,7 @@
0
0
698
- 446
+ 472
@@ -134,7 +134,7 @@
- -
+
-
Qt::Vertical
@@ -147,6 +147,23 @@
+ -
+
+
+ true
+
+
+ true
+
+
+
+ -
+
+
+ Last used:
+
+
+
-
From 4fc6c73dd918d29c81a879f535c3df92d895fed6 Mon Sep 17 00:00:00 2001
From: sehraf
Date: Mon, 7 Sep 2015 23:40:52 +0200
Subject: [PATCH 034/240] replaced some ifs with switch
---
libretroshare/src/pqi/p3linkmgr.cc | 9 +++++++--
libretroshare/src/pqi/p3peermgr.cc | 9 +++++++--
2 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/libretroshare/src/pqi/p3linkmgr.cc b/libretroshare/src/pqi/p3linkmgr.cc
index c10f2472b..38323cbc2 100644
--- a/libretroshare/src/pqi/p3linkmgr.cc
+++ b/libretroshare/src/pqi/p3linkmgr.cc
@@ -2026,11 +2026,16 @@ void p3LinkMgrIMPL::locked_ConnectAttempt_ProxyAddress(peerConnectState *peer,
peerConnectAddress pca;
pca.addr = proxy_addr;
- if (mPeerMgr->hiddenDomainToHiddenType(domain_addr) == RS_HIDDEN_TYPE_I2P)
+ switch (mPeerMgr->hiddenDomainToHiddenType(domain_addr)) {
+ case RS_HIDDEN_TYPE_I2P:
pca.type = RS_NET_CONN_TCP_HIDDEN_I2P;
- else
+ break;
+ case RS_HIDDEN_TYPE_TOR:
+ default:
/* default tor */
pca.type = RS_NET_CONN_TCP_HIDDEN_TOR;
+ break;
+ }
//for the delay, we add a random time and some more time when the friend list is big
pca.delay = P3CONNMGR_TCP_DEFAULT_DELAY;
diff --git a/libretroshare/src/pqi/p3peermgr.cc b/libretroshare/src/pqi/p3peermgr.cc
index 3801355d6..c40582aca 100644
--- a/libretroshare/src/pqi/p3peermgr.cc
+++ b/libretroshare/src/pqi/p3peermgr.cc
@@ -637,11 +637,16 @@ bool p3PeerMgrIMPL::getProxyAddress(const RsPeerId &ssl_id, struct sockaddr_stor
domain_addr = it->second.hiddenDomain;
domain_port = it->second.hiddenPort;
- if(it->second.hiddenType == RS_HIDDEN_TYPE_I2P)
+ switch (it->second.hiddenType) {
+ case RS_HIDDEN_TYPE_I2P:
proxy_addr = mProxyServerAddressI2P;
- else
+ break;
+ case RS_HIDDEN_TYPE_TOR:
+ default:
/* default tor */
proxy_addr = mProxyServerAddressTor;
+ break;
+ }
return true;
}
From 03d99ae4afddc1f4b9ff2be53685176b066bd564 Mon Sep 17 00:00:00 2001
From: sehraf
Date: Mon, 7 Sep 2015 23:55:57 +0200
Subject: [PATCH 035/240] made GenCertDislog more generic
---
retroshare-gui/src/gui/GenCertDialog.ui | 19 ++++++++++---------
1 file changed, 10 insertions(+), 9 deletions(-)
diff --git a/retroshare-gui/src/gui/GenCertDialog.ui b/retroshare-gui/src/gui/GenCertDialog.ui
index 4fe4f46ac..3dfd19786 100644
--- a/retroshare-gui/src/gui/GenCertDialog.ui
+++ b/retroshare-gui/src/gui/GenCertDialog.ui
@@ -7,7 +7,7 @@
0
0
853
- 592
+ 711
@@ -111,7 +111,7 @@
You can create a new profile with this form.
-Alternatively you can use an existing profile. Just uncheck "Create a new profile"
+Alternatively you can use an existing profile. Just uncheck "Create a new profile"
true
@@ -431,7 +431,7 @@ Alternatively you can use an existing profile. Just uncheck "Create a new profil
-
- Tor address
+ hidden address
@@ -593,7 +593,7 @@ anonymous, you can use a fake email.
-
- <html><head/><body><p>This is a Tor Onion address of the form: xa76giaf6ifda7ri63i263.onion </p><p>In order to get one, you must configure Tor to create a new hidden service. If you do not yet have one, you can still go on, and make it right later in Retroshare's Options->Server->Tor configuration panel.</p></body></html>
+ <html><head/><body><p>This can be a Tor Onion address of the form: xa76giaf6ifda7ri63i263.onion <br/>or an I2P address in the form: [52 characters].b32.i2p </p><p>In order to get one, you must configure either Tor or I2P to create a new hidden service / server tunnel. If you do not yet have one, you can still go on, and make it right later in Retroshare's Options->Server->Hidden Service configuration panel.</p></body></html>
true
@@ -761,6 +761,7 @@ anonymous, you can use a fake email.
+ no_node_label
genButton2
header_label
genprofileinfo_label
@@ -772,17 +773,17 @@ anonymous, you can use a fake email.
label_hiddenaddr2
+
+ StyledLabel
+ QLabel
+
+
HeaderFrame
QFrame
1
-
- StyledLabel
- QLabel
-
-
From 0bc77d75ae5004b3d867a9fe3de9f4c30ff418f1 Mon Sep 17 00:00:00 2001
From: sehraf
Date: Tue, 8 Sep 2015 13:48:30 +0200
Subject: [PATCH 036/240] added some error handling
---
libretroshare/src/pqi/p3linkmgr.cc | 8 ++++--
libretroshare/src/pqi/p3peermgr.cc | 35 +++++++++++++++++++++-----
libretroshare/src/retroshare/rspeers.h | 5 ++--
3 files changed, 38 insertions(+), 10 deletions(-)
diff --git a/libretroshare/src/pqi/p3linkmgr.cc b/libretroshare/src/pqi/p3linkmgr.cc
index 38323cbc2..4fb737198 100644
--- a/libretroshare/src/pqi/p3linkmgr.cc
+++ b/libretroshare/src/pqi/p3linkmgr.cc
@@ -2030,9 +2030,13 @@ void p3LinkMgrIMPL::locked_ConnectAttempt_ProxyAddress(peerConnectState *peer,
case RS_HIDDEN_TYPE_I2P:
pca.type = RS_NET_CONN_TCP_HIDDEN_I2P;
break;
- case RS_HIDDEN_TYPE_TOR:
+ case RS_HIDDEN_TYPE_UNKNOWN:
default:
- /* default tor */
+#ifdef LINKMGR_DEBUG
+ std::cerr << "p3LinkMgrIMPL::locked_ConnectAttempt_ProxyAddress() hidden type of addr: " << domain_addr << " is unkown -> fallback to tor" << std::endl;
+#endif
+ /* the type should be set! since this connection involves a proxy -> fallback to tor */
+ case RS_HIDDEN_TYPE_TOR:
pca.type = RS_NET_CONN_TCP_HIDDEN_TOR;
break;
}
diff --git a/libretroshare/src/pqi/p3peermgr.cc b/libretroshare/src/pqi/p3peermgr.cc
index c40582aca..c1a838d3a 100644
--- a/libretroshare/src/pqi/p3peermgr.cc
+++ b/libretroshare/src/pqi/p3peermgr.cc
@@ -483,7 +483,7 @@ uint32_t p3PeerMgrIMPL::hiddenDomainToHiddenType(const std::string &domain)
std::cerr << "p3PeerMgrIMPL::hiddenDomainToHiddenType() unknown hidden type: " << domain;
std::cerr << std::endl;
#endif
- return RS_HIDDEN_TYPE_NONE;
+ return RS_HIDDEN_TYPE_UNKNOWN;
}
bool p3PeerMgrIMPL::setHiddenDomainPort(const RsPeerId &ssl_id, const std::string &domain_addr, const uint16_t domain_port)
@@ -560,13 +560,19 @@ bool p3PeerMgrIMPL::setProxyServerAddress(const uint32_t type, const struct sock
}
break;
case RS_HIDDEN_TYPE_TOR:
- default:
if (!sockaddr_storage_same(mProxyServerAddressTor,proxy_addr))
{
IndicateConfigChanged(); /**** INDICATE MSG CONFIG CHANGED! *****/
mProxyServerAddressTor = proxy_addr;
}
break;
+ case RS_HIDDEN_TYPE_UNKNOWN:
+ default:
+#ifdef PEER_DEBUG
+ std::cerr << "p3PeerMgrIMPL::setProxyServerAddress() unknown hidden type " << type << " -> false";
+ std::cerr << std::endl;
+#endif
+ return false;
}
return true;
@@ -593,9 +599,15 @@ bool p3PeerMgrIMPL::getProxyServerStatus(const uint32_t type, uint32_t& proxy_st
proxy_status = mProxyServerStatusI2P;
break;
case RS_HIDDEN_TYPE_TOR:
- default:
proxy_status = mProxyServerStatusTor;
break;
+ case RS_HIDDEN_TYPE_UNKNOWN:
+ default:
+#ifdef PEER_DEBUG
+ std::cerr << "p3PeerMgrIMPL::getProxyServerStatus() unknown hidden type " << type << " -> false";
+ std::cerr << std::endl;
+#endif
+ return false;
}
return true;
@@ -610,9 +622,15 @@ bool p3PeerMgrIMPL::getProxyServerAddress(const uint32_t type, struct sockaddr_s
proxy_addr = mProxyServerAddressI2P;
break;
case RS_HIDDEN_TYPE_TOR:
- default:
proxy_addr = mProxyServerAddressTor;
break;
+ case RS_HIDDEN_TYPE_UNKNOWN:
+ default:
+#ifdef PEER_DEBUG
+ std::cerr << "p3PeerMgrIMPL::getProxyServerAddress() unknown hidden type " << type << " -> false";
+ std::cerr << std::endl;
+#endif
+ return false;
}
return true;
}
@@ -642,10 +660,15 @@ bool p3PeerMgrIMPL::getProxyAddress(const RsPeerId &ssl_id, struct sockaddr_stor
proxy_addr = mProxyServerAddressI2P;
break;
case RS_HIDDEN_TYPE_TOR:
- default:
- /* default tor */
proxy_addr = mProxyServerAddressTor;
break;
+ case RS_HIDDEN_TYPE_UNKNOWN:
+ default:
+#ifdef PEER_DEBUG
+ std::cerr << "p3PeerMgrIMPL::getProxyAddress() no valid hidden type (" << it->second.hiddenType << ") for peer id " << ssl_id << " -> false";
+ std::cerr << std::endl;
+#endif
+ return false;
}
return true;
}
diff --git a/libretroshare/src/retroshare/rspeers.h b/libretroshare/src/retroshare/rspeers.h
index aa7423ae9..2c0382134 100644
--- a/libretroshare/src/retroshare/rspeers.h
+++ b/libretroshare/src/retroshare/rspeers.h
@@ -65,8 +65,9 @@ const uint32_t RS_NETMODE_UNREACHABLE = 0x0005;
/* Hidden Type */
const uint32_t RS_HIDDEN_TYPE_NONE = 0x0000;
-const uint32_t RS_HIDDEN_TYPE_TOR = 0x0001;
-const uint32_t RS_HIDDEN_TYPE_I2P = 0x0002;
+const uint32_t RS_HIDDEN_TYPE_UNKNOWN = 0x0001;
+const uint32_t RS_HIDDEN_TYPE_TOR = 0x0002;
+const uint32_t RS_HIDDEN_TYPE_I2P = 0x0004;
/* Visibility */
const uint32_t RS_VS_DISC_OFF = 0x0000;
From 29a1fa2ce441b466fcc42a613d004709173a36ad Mon Sep 17 00:00:00 2001
From: thunder2
Date: Mon, 7 Sep 2015 21:48:18 +0200
Subject: [PATCH 037/240] Removed unnecessary copy of results in
RsGxsDataAccess.
---
libretroshare/src/gxs/rsgxsdataaccess.cc | 10 ++--------
1 file changed, 2 insertions(+), 8 deletions(-)
diff --git a/libretroshare/src/gxs/rsgxsdataaccess.cc b/libretroshare/src/gxs/rsgxsdataaccess.cc
index e1c922d61..21d697428 100644
--- a/libretroshare/src/gxs/rsgxsdataaccess.cc
+++ b/libretroshare/src/gxs/rsgxsdataaccess.cc
@@ -1032,31 +1032,25 @@ bool RsGxsDataAccess::getGroupList(const std::list& grpIdsIn, cons
bool RsGxsDataAccess::getMsgData(MsgDataReq* req)
{
- GxsMsgResult result;
-
GxsMsgReq msgIdOut;
// filter based on options
getMsgList(req->mMsgIds, req->Options, msgIdOut);
- mDataStore->retrieveNxsMsgs(msgIdOut, result, true, true);
+ mDataStore->retrieveNxsMsgs(msgIdOut, req->mMsgData, true, true);
- req->mMsgData = result;
return true;
}
bool RsGxsDataAccess::getMsgSummary(MsgMetaReq* req)
{
- GxsMsgMetaResult result;
-
GxsMsgReq msgIdOut;
// filter based on options
getMsgList(req->mMsgIds, req->Options, msgIdOut);
- mDataStore->retrieveGxsMsgMetaData(msgIdOut, result);
- req->mMsgMetaData = result;
+ mDataStore->retrieveGxsMsgMetaData(msgIdOut, req->mMsgMetaData);
return true;
}
From c4061fc6aac1a6ca8e16bb3e85ecbcc70fe2b7ba Mon Sep 17 00:00:00 2001
From: thunder2
Date: Mon, 7 Sep 2015 22:27:04 +0200
Subject: [PATCH 038/240] Removed not used time consuming calculation of row
count from RetroCursor.
---
libretroshare/src/gxs/rsdataservice.cc | 24 +++++++--------------
libretroshare/src/util/retrodb.cc | 29 +-------------------------
libretroshare/src/util/retrodb.h | 22 ++-----------------
3 files changed, 11 insertions(+), 64 deletions(-)
diff --git a/libretroshare/src/gxs/rsdataservice.cc b/libretroshare/src/gxs/rsdataservice.cc
index 50b12dba1..68308d207 100644
--- a/libretroshare/src/gxs/rsdataservice.cc
+++ b/libretroshare/src/gxs/rsdataservice.cc
@@ -1146,10 +1146,6 @@ int RsDataService::retrieveNxsMsgs(const GxsMsgReq &reqIds, GxsMsgResult &msg, b
if(c)
{
locked_retrieveMessages(c, msgSet, withMeta ? mColMsg_WithMetaOffset : 0);
-
-#ifdef RS_DATA_SERVICE_DEBUG_TIME
- resultCount += msgSet.size();
-#endif
}
delete c;
@@ -1169,16 +1165,16 @@ int RsDataService::retrieveNxsMsgs(const GxsMsgReq &reqIds, GxsMsgResult &msg, b
if(c)
{
locked_retrieveMessages(c, msgSet, withMeta ? mColMsg_WithMetaOffset : 0);
-
-#ifdef RS_DATA_SERVICE_DEBUG_TIME
- resultCount += c->getResultCount();
-#endif
}
delete c;
}
}
+#ifdef RS_DATA_SERVICE_DEBUG_TIME
+ resultCount += msgSet.size();
+#endif
+
msg[grpId] = msgSet;
msgSet.clear();
@@ -1235,10 +1231,6 @@ int RsDataService::retrieveGxsMsgMetaData(const GxsMsgReq& reqIds, GxsMsgMetaRes
if (c)
{
locked_retrieveMsgMeta(c, metaSet);
-
-#ifdef RS_DATA_SERVICE_DEBUG_TIME
- resultCount += metaSet.size();
-#endif
}
}else{
@@ -1253,14 +1245,14 @@ int RsDataService::retrieveGxsMsgMetaData(const GxsMsgReq& reqIds, GxsMsgMetaRes
if (c)
{
locked_retrieveMsgMeta(c, metaSet);
-
-#ifdef RS_DATA_SERVICE_DEBUG_TIME
- resultCount += c->getResultCount();
-#endif
}
}
}
+#ifdef RS_DATA_SERVICE_DEBUG_TIME
+ resultCount += metaSet.size();
+#endif
+
msgMeta[grpId] = metaSet;
}
diff --git a/libretroshare/src/util/retrodb.cc b/libretroshare/src/util/retrodb.cc
index b6633c3a5..291287973 100644
--- a/libretroshare/src/util/retrodb.cc
+++ b/libretroshare/src/util/retrodb.cc
@@ -598,7 +598,7 @@ bool RetroDb::tableExists(const std::string &tableName)
/********************** RetroCursor ************************/
RetroCursor::RetroCursor(sqlite3_stmt *stmt)
- : mStmt(NULL), mCount(0), mPosCounter(0) {
+ : mStmt(NULL) {
open(stmt);
}
@@ -635,7 +635,6 @@ bool RetroCursor::moveToFirst(){
rc = sqlite3_step(mStmt);
if(rc == SQLITE_ROW){
- mPosCounter = 0;
return true;
}
@@ -673,17 +672,10 @@ bool RetroCursor::moveToLast(){
return false;
}else{
- mPosCounter = mCount;
return true;
}
}
-int RetroCursor::getResultCount() const {
- if(isOpen())
- return mCount;
- else
- return -1;
-}
int RetroCursor::columnCount() const {
if(isOpen())
@@ -704,8 +696,6 @@ bool RetroCursor::close(){
int rc = sqlite3_finalize(mStmt);
mStmt = NULL;
- mPosCounter = 0;
- mCount = 0;
return (rc == SQLITE_OK);
}
@@ -725,12 +715,6 @@ bool RetroCursor::open(sqlite3_stmt *stm){
int rc = sqlite3_reset(mStmt);
if(rc == SQLITE_OK){
-
- while((rc = sqlite3_step(mStmt)) == SQLITE_ROW)
- mCount++;
-
- sqlite3_reset(mStmt);
-
return true;
}
else{
@@ -753,7 +737,6 @@ bool RetroCursor::moveToNext(){
int rc = sqlite3_step(mStmt);
if(rc == SQLITE_ROW){
- mPosCounter++;
return true;
}else if(rc == SQLITE_DONE){ // no more results
@@ -772,16 +755,6 @@ bool RetroCursor::moveToNext(){
}
}
-
-int32_t RetroCursor::getPosition() const {
-
- if(isOpen())
- return mPosCounter;
- else
- return -1;
-}
-
-
int32_t RetroCursor::getInt32(int columnIndex){
return sqlite3_column_int(mStmt, columnIndex);
}
diff --git a/libretroshare/src/util/retrodb.h b/libretroshare/src/util/retrodb.h
index 8b79c0017..435b6e466 100644
--- a/libretroshare/src/util/retrodb.h
+++ b/libretroshare/src/util/retrodb.h
@@ -239,12 +239,6 @@ public:
*/
bool moveToLast();
- /*!
- * gets current position of cursor
- * @return current position of cursor
- */
- int32_t getPosition() const;
-
/* data retrieval */
/*!
@@ -260,11 +254,10 @@ public:
/*!
*
- * @return -1 if cursor is in error, otherwise number of rows in result
+ * @return -1 if cursor is in error, otherwise number of columns in result
*/
- int32_t getResultCount() const;
-
int32_t columnCount() const ;
+
/*!
* Current statement is closed and discarded (finalised)
* before actual opening occurs
@@ -274,8 +267,6 @@ public:
bool open(sqlite3_stmt* stm);
public:
-
-
/*!
* Returns the value of the requested column as a String.
* @param columnIndex the zero-based index of the target column.
@@ -326,17 +317,8 @@ public:
getString(columnIndex, temp);
str = T(temp);
}
-
-
private:
-
sqlite3_stmt* mStmt;
- int mCount; /// number of results
- int mPosCounter;
};
-
-
-
-
#endif // RSSQLITE_H
From 4f8b098e94b054b558385a9a2afb7c1420c947f3 Mon Sep 17 00:00:00 2001
From: Ivan Lucas
Date: Tue, 8 Sep 2015 16:00:00 +0100
Subject: [PATCH 039/240] Fixing spelling
---
retroshare-gui/src/gui/help/content/en/peerdetails.html | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/retroshare-gui/src/gui/help/content/en/peerdetails.html b/retroshare-gui/src/gui/help/content/en/peerdetails.html
index 2dee340cf..9d8592723 100644
--- a/retroshare-gui/src/gui/help/content/en/peerdetails.html
+++ b/retroshare-gui/src/gui/help/content/en/peerdetails.html
@@ -35,7 +35,7 @@ Trust settings and Signing
Trust Settings
|
-The trust settings refers to the gnupg web of trust mecanism.
+The trust settings refers to the gnupg web of trust mechanism.
This trust means how you trust your friends when he is signing other PGP keys.
If you set your trust to "full", it means that when your friend sign a key, this key will be shown as validated by the web of trust in the network view.
@@ -46,7 +46,7 @@ If you set your trust to "full", it means that when your friend sign a key, this
You should sign a key when you are sure that the person who claims ownership on this key is the real owner of the key.
When you are sure that the name of the key owner is the real name of the emmitter of this key, you may sign it to confirm it.
-Signing the key will be public unless public discovery is not setted. This means you friends can check if you did sign someone's key.
+Signing the key will be public unless public discovery is not set. This means you friends can check if you did sign someone's key.
From a2e7e4de4161f2e3fabb9799bc66e6319ae1996c Mon Sep 17 00:00:00 2001
From: Ivan Lucas
Date: Tue, 8 Sep 2015 16:12:50 +0100
Subject: [PATCH 040/240] Fixed spelling/grammar
---
retroshare-gui/src/gui/help/content/en/peerdetails.html | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/retroshare-gui/src/gui/help/content/en/peerdetails.html b/retroshare-gui/src/gui/help/content/en/peerdetails.html
index 9d8592723..6fe745bca 100644
--- a/retroshare-gui/src/gui/help/content/en/peerdetails.html
+++ b/retroshare-gui/src/gui/help/content/en/peerdetails.html
@@ -35,9 +35,9 @@ Trust settings and Signing
Trust Settings
|
-The trust settings refers to the gnupg web of trust mechanism.
+The trust settings refers to the GnuPG web of trust mechanism.
This trust means how you trust your friends when he is signing other PGP keys.
-If you set your trust to "full", it means that when your friend sign a key, this key will be shown as validated by the web of trust in the network view.
+If you set your trust to "full", it means that when your friend signs a key, this key will be shown as validated by the web of trust in the network view.
@@ -45,8 +45,8 @@ If you set your trust to "full", it means that when your friend sign a key, this
You should sign a key when you are sure that the person who claims ownership on this key is the real owner of the key.
-When you are sure that the name of the key owner is the real name of the emmitter of this key, you may sign it to confirm it.
-Signing the key will be public unless public discovery is not set. This means you friends can check if you did sign someone's key.
+When you are sure that the name of the key owner is the real name of the emitter of this key, you may sign it to confirm it.
+Signing the key will be public unless public discovery is not set. This means your friends can check if you did sign someone's key.
From ebd5da5e8318c6420d59ff04d61322359b3eb417 Mon Sep 17 00:00:00 2001
From: thunder2
Date: Tue, 8 Sep 2015 16:34:22 +0200
Subject: [PATCH 041/240] Optimizations in RsGenExchange, p3GxsForums and
p3GxsChannels. - Removed not used variables - avoid copy constructors - Use
swap instead of operator= to move elements of std containers
---
libretroshare/src/gxs/rsgenexchange.cc | 18 ++++--------------
libretroshare/src/gxs/rsgxsdataaccess.cc | 16 ++++++++--------
libretroshare/src/services/p3gxschannels.cc | 1 -
libretroshare/src/services/p3gxsforums.cc | 4 +---
4 files changed, 13 insertions(+), 26 deletions(-)
diff --git a/libretroshare/src/gxs/rsgenexchange.cc b/libretroshare/src/gxs/rsgenexchange.cc
index e7ae496f9..bdf1e2021 100644
--- a/libretroshare/src/gxs/rsgenexchange.cc
+++ b/libretroshare/src/gxs/rsgenexchange.cc
@@ -1135,7 +1135,6 @@ bool RsGenExchange::getGroupMeta(const uint32_t &token, std::list& metaV = mit->second;
- msgInfo[mit->first] = std::vector();
std::vector& msgInfoV = msgInfo[mit->first];
std::vector::iterator vit = metaV.begin();
@@ -1181,7 +1179,6 @@ bool RsGenExchange::getMsgRelatedMeta(const uint32_t &token, GxsMsgRelatedMetaMa
{
std::vector& metaV = mit->second;
- msgMeta[mit->first] = std::vector();
std::vector& msgInfoV = msgMeta[mit->first];
std::vector::iterator vit = metaV.begin();
@@ -1265,14 +1262,14 @@ bool RsGenExchange::getMsgData(const uint32_t &token, GxsMsgDataMap &msgItems)
RS_STACK_MUTEX(mGenMtx) ;
NxsMsgDataResult msgResult;
bool ok = mDataAccess->getMsgData(token, msgResult);
- NxsMsgDataResult::iterator mit = msgResult.begin();
if(ok)
{
+ NxsMsgDataResult::iterator mit = msgResult.begin();
for(; mit != msgResult.end(); ++mit)
{
- std::vector gxsMsgItems;
const RsGxsGroupId& grpId = mit->first;
+ std::vector& gxsMsgItems = msgItems[grpId];
std::vector& nxsMsgsV = mit->second;
std::vector::iterator vit = nxsMsgsV.begin();
for(; vit != nxsMsgsV.end(); ++vit)
@@ -1305,7 +1302,6 @@ bool RsGenExchange::getMsgData(const uint32_t &token, GxsMsgDataMap &msgItems)
}
delete msg;
}
- msgItems[grpId] = gxsMsgItems;
}
}
return ok;
@@ -1317,17 +1313,15 @@ bool RsGenExchange::getMsgRelatedData(const uint32_t &token, GxsMsgRelatedDataMa
NxsMsgRelatedDataResult msgResult;
bool ok = mDataAccess->getMsgRelatedData(token, msgResult);
-
if(ok)
{
NxsMsgRelatedDataResult::iterator mit = msgResult.begin();
for(; mit != msgResult.end(); ++mit)
{
- std::vector gxsMsgItems;
const RsGxsGrpMsgIdPair& msgId = mit->first;
+ std::vector &gxsMsgItems = msgItems[msgId];
std::vector& nxsMsgsV = mit->second;
- std::vector::iterator vit
- = nxsMsgsV.begin();
+ std::vector::iterator vit = nxsMsgsV.begin();
for(; vit != nxsMsgsV.end(); ++vit)
{
RsNxsMsg*& msg = *vit;
@@ -1360,15 +1354,11 @@ bool RsGenExchange::getMsgRelatedData(const uint32_t &token, GxsMsgRelatedDataMa
delete msg;
}
- msgItems[msgId] = gxsMsgItems;
}
}
return ok;
}
-
-
-
RsTokenService* RsGenExchange::getTokenService()
{
return mDataAccess;
diff --git a/libretroshare/src/gxs/rsgxsdataaccess.cc b/libretroshare/src/gxs/rsgxsdataaccess.cc
index 21d697428..c9033c9c0 100644
--- a/libretroshare/src/gxs/rsgxsdataaccess.cc
+++ b/libretroshare/src/gxs/rsgxsdataaccess.cc
@@ -448,7 +448,7 @@ bool RsGxsDataAccess::getGroupData(const uint32_t& token, std::list&
if(gmreq)
{
- grpData = gmreq->mGroupData;
+ grpData.swap(gmreq->mGroupData);
gmreq->mGroupData.clear();
locked_updateRequestStatus(token, GXS_REQUEST_V2_STATUS_DONE);
}else{
@@ -480,7 +480,7 @@ bool RsGxsDataAccess::getMsgData(const uint32_t& token, NxsMsgDataResult& msgDat
if(mdreq)
{
- msgData = mdreq->mMsgData;
+ msgData.swap(mdreq->mMsgData);
mdreq->mMsgData.clear();
locked_updateRequestStatus(token, GXS_REQUEST_V2_STATUS_DONE);
}
@@ -517,7 +517,7 @@ bool RsGxsDataAccess::getMsgRelatedData(const uint32_t &token, NxsMsgRelatedData
if(mrireq)
{
- msgData = mrireq->mMsgDataResult;
+ msgData.swap(mrireq->mMsgDataResult);
mrireq->mMsgDataResult.clear();
locked_updateRequestStatus(token, GXS_REQUEST_V2_STATUS_DONE);
}
@@ -551,7 +551,7 @@ bool RsGxsDataAccess::getMsgSummary(const uint32_t& token, GxsMsgMetaResult& msg
if(mmreq)
{
- msgInfo = mmreq->mMsgMetaData;
+ msgInfo.swap(mmreq->mMsgMetaData);
mmreq->mMsgMetaData.clear();
locked_updateRequestStatus(token, GXS_REQUEST_V2_STATUS_DONE);
@@ -591,7 +591,7 @@ bool RsGxsDataAccess::getMsgRelatedSummary(const uint32_t &token, MsgRelatedMeta
if(mrireq)
{
- msgMeta = mrireq->mMsgMetaResult;
+ msgMeta.swap(mrireq->mMsgMetaResult);
mrireq->mMsgMetaResult.clear();
locked_updateRequestStatus(token, GXS_REQUEST_V2_STATUS_DONE);
}
@@ -630,7 +630,7 @@ bool RsGxsDataAccess::getMsgRelatedList(const uint32_t &token, MsgRelatedIdResul
if(mrireq)
{
- msgIds = mrireq->mMsgIdResult;
+ msgIds.swap(mrireq->mMsgIdResult);
mrireq->mMsgIdResult.clear();
locked_updateRequestStatus(token, GXS_REQUEST_V2_STATUS_DONE);
}
@@ -664,7 +664,7 @@ bool RsGxsDataAccess::getMsgList(const uint32_t& token, GxsMsgIdResult& msgIds)
if(mireq)
{
- msgIds = mireq->mMsgIdResult;
+ msgIds.swap(mireq->mMsgIdResult);
mireq->mMsgIdResult.clear();
locked_updateRequestStatus(token, GXS_REQUEST_V2_STATUS_DONE);
}
@@ -697,7 +697,7 @@ bool RsGxsDataAccess::getGroupList(const uint32_t& token, std::listmGroupIdResult;
+ groupIds.swap(gireq->mGroupIdResult);
gireq->mGroupIdResult.clear();
locked_updateRequestStatus(token, GXS_REQUEST_V2_STATUS_DONE);
diff --git a/libretroshare/src/services/p3gxschannels.cc b/libretroshare/src/services/p3gxschannels.cc
index afd4c1ef6..bac137bc8 100644
--- a/libretroshare/src/services/p3gxschannels.cc
+++ b/libretroshare/src/services/p3gxschannels.cc
@@ -337,7 +337,6 @@ bool p3GxsChannels::getPostData(const uint32_t &token, std::vectorfirst;
std::vector& msgItems = mit->second;
std::vector::iterator vit = msgItems.begin();
diff --git a/libretroshare/src/services/p3gxsforums.cc b/libretroshare/src/services/p3gxsforums.cc
index 731b968e7..ac9276f15 100644
--- a/libretroshare/src/services/p3gxsforums.cc
+++ b/libretroshare/src/services/p3gxsforums.cc
@@ -199,8 +199,7 @@ bool p3GxsForums::getGroupData(const uint32_t &token, std::vectormGroup;
- item->mGroup.mMeta = item->meta;
- grp.mMeta = item->mGroup.mMeta;
+ grp.mMeta = item->meta;
delete item;
groups.push_back(grp);
}
@@ -230,7 +229,6 @@ bool p3GxsForums::getMsgData(const uint32_t &token, std::vector &
for(; mit != msgData.end(); ++mit)
{
- RsGxsGroupId grpId = mit->first;
std::vector& msgItems = mit->second;
std::vector::iterator vit = msgItems.begin();
From b8c3c89ae01e430e615f08bb36329286a12728fe Mon Sep 17 00:00:00 2001
From: AsamK
Date: Wed, 9 Sep 2015 11:53:01 +0200
Subject: [PATCH 042/240] Extract getPlainText method
---
libresapi/src/api/ChatHandler.cpp | 113 +++++++++++++++---------------
libresapi/src/api/ChatHandler.h | 2 +
2 files changed, 59 insertions(+), 56 deletions(-)
diff --git a/libresapi/src/api/ChatHandler.cpp b/libresapi/src/api/ChatHandler.cpp
index 81e41d8f5..2bee12227 100644
--- a/libresapi/src/api/ChatHandler.cpp
+++ b/libresapi/src/api/ChatHandler.cpp
@@ -294,62 +294,7 @@ void ChatHandler::tick()
// remove html tags from chat message
// extract links form href
- const std::string& in = msg.msg;
- std::string out;
- bool ignore = false;
- bool keep_link = false;
- std::string last_six_chars;
- Triple current_link;
- std::vector links;
- for(unsigned int i = 0; i < in.size(); ++i)
- {
- if(keep_link && in[i] == '"')
- {
- keep_link = false;
- current_link.second = out.size();
- }
- if(last_six_chars == "href=\"")
- {
- keep_link = true;
- current_link.first = out.size();
- }
-
- // "rising edge" sets mode to ignore
- if(in[i] == '<')
- {
- ignore = true;
- }
- if(!ignore || keep_link)
- out += in[i];
- // "falling edge" resets mode to keep
- if(in[i] == '>')
- ignore = false;
-
- last_six_chars += in[i];
- if(last_six_chars.size() > 6)
- last_six_chars = last_six_chars.substr(1);
- std::string a = "";
- if( current_link.first != -1
- && last_six_chars.size() >= a.size()
- && last_six_chars.substr(last_six_chars.size()-a.size()) == a)
- {
- // only allow these protocols
- // we don't want for example javascript:alert(0)
- std::string http = "http://";
- std::string https = "https://";
- std::string retroshare = "retroshare://";
- if( out.substr(current_link.first, http.size()) == http
- || out.substr(current_link.first, https.size()) == https
- || out.substr(current_link.first, retroshare.size()) == retroshare)
- {
- current_link.third = out.size();
- links.push_back(current_link);
- }
- current_link = Triple();
- }
- }
- m.msg = out;
- m.links = links;
+ getPlainText(msg.msg, m.msg, m.links);
m.recv_time = msg.recvTime;
m.send_time = msg.sendTime;
@@ -390,6 +335,62 @@ void ChatHandler::tick()
}
}
+void ChatHandler::getPlainText(const std::string& in, std::string &out, std::vector &links)
+{
+ bool ignore = false;
+
+ bool keep_link = false;
+ std::string last_six_chars;
+ Triple current_link;
+ for(unsigned int i = 0; i < in.size(); ++i)
+ {
+ if(keep_link && in[i] == '"')
+ {
+ keep_link = false;
+ current_link.second = out.size();
+ }
+ if(last_six_chars == "href=\"")
+ {
+ keep_link = true;
+ current_link.first = out.size();
+ }
+
+ // "rising edge" sets mode to ignore
+ if(in[i] == '<')
+ {
+ ignore = true;
+ }
+ if(!ignore || keep_link)
+ out += in[i];
+ // "falling edge" resets mode to keep
+ if(in[i] == '>')
+ ignore = false;
+
+ last_six_chars += in[i];
+ if(last_six_chars.size() > 6)
+ last_six_chars = last_six_chars.substr(1);
+ std::string a = "";
+ if( current_link.first != -1
+ && last_six_chars.size() >= a.size()
+ && last_six_chars.substr(last_six_chars.size()-a.size()) == a)
+ {
+ // only allow these protocols
+ // we don't want for example javascript:alert(0)
+ std::string http = "http://";
+ std::string https = "https://";
+ std::string retroshare = "retroshare://";
+ if( out.substr(current_link.first, http.size()) == http
+ || out.substr(current_link.first, https.size()) == https
+ || out.substr(current_link.first, retroshare.size()) == retroshare)
+ {
+ current_link.third = out.size();
+ links.push_back(current_link);
+ }
+ current_link = Triple();
+ }
+ }
+}
+
void ChatHandler::handleWildcard(Request &req, Response &resp)
{
RS_STACK_MUTEX(mMtx); /********** LOCKED **********/
diff --git a/libresapi/src/api/ChatHandler.h b/libresapi/src/api/ChatHandler.h
index b849c2d98..fd8bda8ae 100644
--- a/libresapi/src/api/ChatHandler.h
+++ b/libresapi/src/api/ChatHandler.h
@@ -102,6 +102,8 @@ private:
void handleSendStatus(Request& req, Response& resp);
void handleUnreadMsgs(Request& req, Response& resp);
+ void getPlainText(const std::string& in, std::string &out, std::vector &links);
+
StateTokenServer* mStateTokenServer;
RsNotify* mNotify;
RsMsgs* mRsMsgs;
From 7aad9c12d02c33bd860699670c51580b6c439021 Mon Sep 17 00:00:00 2001
From: AsamK
Date: Wed, 9 Sep 2015 13:36:00 +0200
Subject: [PATCH 043/240] Improve HTML parsing in libresapi
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- Completely ignore content of