diff --git a/libretroshare/src/retroshare/rsgxsforums.h b/libretroshare/src/retroshare/rsgxsforums.h index 6084214ff..3b130fa52 100644 --- a/libretroshare/src/retroshare/rsgxsforums.h +++ b/libretroshare/src/retroshare/rsgxsforums.h @@ -143,40 +143,28 @@ public: const std::list& forumIds, std::vector& forumsInfo ) = 0; - /** - * @brief Get content of specified forums. Blocking API + * @brief Get message metadatas for a specific forum. Blocking API * @jsonapi{development} - * @param[in] forumIds id of the forum of which the content is requested - * @param[out] messages storage for the forum messages - * @return false if something failed, true otherwhise - */ - virtual bool getForumsContent( - const std::list& forumIds, - std::vector& messages ) = 0; - - /** - * @brief Get message metadatas for some messages of a specific forum. Blocking API - * @jsonapi{development} - * @param[in] forumIds id of the forum of which the content is requested - * @param[out] msg_metas storage for the forum messages meta data + * @param[in] forumId id of the forum of which the content is requested + * @param[out] msgMetas storage for the forum messages meta data * @return false if something failed, true otherwhise */ virtual bool getForumMsgMetaData( const RsGxsGroupId& forumId, - std::vector& msg_metas) =0; + std::vector& msgMetas) = 0; /** * @brief Get specific list of messages from a single forums. Blocking API * @jsonapi{development} * @param[in] forumId id of the forum of which the content is requested - * @param[in] msgs_to_request list of message ids to request + * @param[in] msgsIds list of message ids to request * @param[out] msgs storage for the forum messages * @return false if something failed, true otherwhise */ - virtual bool getForumsContent( - const RsGxsGroupId& forumId, - std::set& msgs_to_request, - std::vector& msgs) =0; + virtual bool getForumContent( + const RsGxsGroupId& forumId, + std::set& msgsIds, + std::vector& msgs) = 0; /** * @brief Toggle message read status. Blocking API. @@ -200,7 +188,7 @@ public: /* Specific Service Data */ RS_DEPRECATED_FOR("getForumsSummaries, getForumsInfo") virtual bool getGroupData(const uint32_t &token, std::vector &groups) = 0; - RS_DEPRECATED_FOR(getForumsContent) + RS_DEPRECATED_FOR(getForumContent) virtual bool getMsgData(const uint32_t &token, std::vector &msgs) = 0; RS_DEPRECATED_FOR(markRead) virtual void setMessageReadStatus(uint32_t& token, const RsGxsGrpMsgIdPair& msgId, bool read) = 0; diff --git a/libretroshare/src/retroshare/rsversion.in b/libretroshare/src/retroshare/rsversion.in deleted file mode 100644 index 4449dbe12..000000000 --- a/libretroshare/src/retroshare/rsversion.in +++ /dev/null @@ -1,12 +0,0 @@ -#define RS_MAJOR_VERSION 0 -#define RS_MINOR_VERSION 6 -#define RS_BUILD_NUMBER 4 -#define RS_BUILD_NUMBER_ADD "" - -// The revision number should be the 4 first bytes of the git revision hash, which is obtained using: -// git log --pretty="%H" | head -1 | cut -c1-8 -// -// Do not forget the 0x, since the RS_REVISION_NUMBER should be an integer. -// -#define RS_REVISION_STRING "$REV$" -#define RS_REVISION_NUMBER 0x$REV$ diff --git a/libretroshare/src/services/p3gxsforums.cc b/libretroshare/src/services/p3gxsforums.cc index 590596b7e..07f91e33f 100644 --- a/libretroshare/src/services/p3gxsforums.cc +++ b/libretroshare/src/services/p3gxsforums.cc @@ -460,7 +460,9 @@ bool p3GxsForums::getForumsInfo( return getGroupData(token, forumsInfo); } -bool p3GxsForums::getForumsContent( const RsGxsGroupId& forumId, std::set& msgs_to_request,std::vector& msgs) +bool p3GxsForums::getForumContent( + const RsGxsGroupId& forumId, std::set& msgs_to_request, + std::vector& msgs ) { uint32_t token; RsTokReqOptions opts; @@ -469,21 +471,11 @@ bool p3GxsForums::getForumsContent( const RsGxsGroupId& forumId, std::set& forumIds, - std::vector& messages ) -{ - uint32_t token; - RsTokReqOptions opts; - opts.mReqType = GXS_REQUEST_TYPE_MSG_DATA; - if( !requestMsgInfo(token, opts, forumIds) - || waitToken(token,std::chrono::milliseconds(5000)) != RsTokenService::COMPLETE ) return false; - return getMsgData(token, messages); + return getMsgData(token, msgs); } diff --git a/libretroshare/src/services/p3gxsforums.h b/libretroshare/src/services/p3gxsforums.h index 8836958a7..5b08efd6b 100644 --- a/libretroshare/src/services/p3gxsforums.h +++ b/libretroshare/src/services/p3gxsforums.h @@ -72,16 +72,14 @@ public: const std::list& forumIds, std::vector& forumsInfo ); - /// @see RsGxsForums::getForumsContent - virtual bool getForumsContent( - const std::list& forumIds, - std::vector& messages ); - /// @see RsGxsForums::getForumMsgMetaData virtual bool getForumMsgMetaData(const RsGxsGroupId& forumId, std::vector& msg_metas) ; - /// @see RsGxsForums::getForumsContent - virtual bool getForumsContent( const RsGxsGroupId& forumId, std::set& msgs_to_request,std::vector& msgs) ; + /// @see RsGxsForums::getForumContent + virtual bool getForumContent( + const RsGxsGroupId& forumId, + std::set& msgs_to_request, + std::vector& msgs ); /// @see RsGxsForums::markRead virtual bool markRead(const RsGxsGrpMsgIdPair& messageId, bool read); diff --git a/retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.cpp b/retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.cpp index f2627ca54..5b017a6a1 100644 --- a/retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.cpp +++ b/retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.cpp @@ -1653,7 +1653,7 @@ void GxsForumThreadWidget::async_msg_action(const MsgMethod &action) msgs_to_request.insert(mThreadId); - if(!rsGxsForums->getForumsContent(groupId(),msgs_to_request,msgs)) + if(!rsGxsForums->getForumContent(groupId(),msgs_to_request,msgs)) { std::cerr << __PRETTY_FUNCTION__ << " failed to retrieve forum group info for forum " << groupId() << std::endl; return; @@ -1675,9 +1675,7 @@ void GxsForumThreadWidget::async_msg_action(const MsgMethod &action) { /* Here it goes any code you want to be executed on the Qt Gui * thread, for example to update the data model with new information - * after a blocking call to RetroShare API complete, note that - * Qt::QueuedConnection is important! - */ + * after a blocking call to RetroShare API complete */ (this->*action)(msg); @@ -1927,9 +1925,7 @@ void GxsForumThreadWidget::updateGroupData() { /* Here it goes any code you want to be executed on the Qt Gui * thread, for example to update the data model with new information - * after a blocking call to RetroShare API complete, note that - * Qt::QueuedConnection is important! - */ + * after a blocking call to RetroShare API complete */ mForumGroup = *group; delete group; @@ -1957,7 +1953,7 @@ void GxsForumThreadWidget::updateMessageData(const RsGxsMessageId& msgId) msgs_to_request.insert(msgId); - if(!rsGxsForums->getForumsContent(groupId(),msgs_to_request,msgs)) + if(!rsGxsForums->getForumContent(groupId(),msgs_to_request,msgs)) { std::cerr << __PRETTY_FUNCTION__ << " failed to retrieve forum group info for forum " << groupId() << std::endl; return; @@ -1986,9 +1982,7 @@ void GxsForumThreadWidget::updateMessageData(const RsGxsMessageId& msgId) { /* Here it goes any code you want to be executed on the Qt Gui * thread, for example to update the data model with new information - * after a blocking call to RetroShare API complete, note that - * Qt::QueuedConnection is important! - */ + * after a blocking call to RetroShare API complete */ insertMessageData(*msg); diff --git a/retroshare-service/src/android/src/org/retroshare/service/RetroShareServiceControlActivity.java b/retroshare-service/src/android/src/org/retroshare/service/RetroShareServiceControlActivity.java index 538a23eac..2c1dab22b 100644 --- a/retroshare-service/src/android/src/org/retroshare/service/RetroShareServiceControlActivity.java +++ b/retroshare-service/src/android/src/org/retroshare/service/RetroShareServiceControlActivity.java @@ -1,6 +1,6 @@ /* * RetroShare - * Copyright (C) 2016-2018 Gioacchino Mazzurco + * Copyright (C) 2016-2018 Gioacchino Mazzurco * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as @@ -20,9 +20,9 @@ package org.retroshare.service; import android.app.Activity; import android.os.Bundle; +import android.os.Handler; import android.view.View; import android.widget.Button; -import org.retroshare.service.R; public class RetroShareServiceControlActivity extends Activity @@ -30,35 +30,79 @@ public class RetroShareServiceControlActivity extends Activity @Override public void onCreate(Bundle savedInstanceState) { - setContentView(R.layout.retroshare_service_control_layout); + setContentView(R.layout.retroshare_service_control_layout); - final Button button = (Button) findViewById(R.id.startStopButton); - button.setOnClickListener(new View.OnClickListener() - { - public void onClick(View v) - { - if (RetroShareServiceAndroid.isRunning(RetroShareServiceControlActivity.this)) - { - RetroShareServiceAndroid.stop(RetroShareServiceControlActivity.this); - button.setText("Start"); - } - else - { - RetroShareServiceAndroid.start(RetroShareServiceControlActivity.this); - button.setText("Stop"); - } - } - }); + final Button button = (Button) findViewById(R.id.startStopButton); + button.setOnClickListener(new View.OnClickListener() + { + public void onClick(View v) + { + if (RetroShareServiceAndroid.isRunning(RetroShareServiceControlActivity.this)) + { + serviceStarting = false; + serviceStopping = true; + button.setText("Stopping..."); + RetroShareServiceAndroid.stop(RetroShareServiceControlActivity.this); + } + else + { + button.setText("Starting..."); + RetroShareServiceAndroid.start(RetroShareServiceControlActivity.this); + serviceStarting = true; + serviceStopping = false; + } + mStatusUpdateHandler.postDelayed(mUpdateStatusTask, 500); + } + }); super.onCreate(savedInstanceState); } - @Override - public void onResume() - { - super.onResume(); + @Override + public void onResume() + { + super.onResume(); - final Button button = (Button) findViewById(R.id.startStopButton); - button.setText(RetroShareServiceAndroid.isRunning(this) ? "Stop" : "Start"); - } + final Button button = (Button) findViewById(R.id.startStopButton); + button.setText(RetroShareServiceAndroid.isRunning(this) ? "Stop" : "Start"); + + mStatusUpdateHandler.removeCallbacks(mUpdateStatusTask); + mStatusUpdateHandler.postDelayed(mUpdateStatusTask, 500); + } + + @Override + public void onPause() + { + super.onPause(); + mStatusUpdateHandler.removeCallbacks(mUpdateStatusTask); + } + + public void updateServiceStatus() + { + final Button button = (Button) findViewById(R.id.startStopButton); + + if(serviceStarting && RetroShareServiceAndroid.isRunning(this)) + { + mStatusUpdateHandler.removeCallbacks(mUpdateStatusTask); + serviceStarting = false; + serviceStopping = false; + button.setText("Stop"); + } + else if (serviceStopping && !RetroShareServiceAndroid.isRunning(this)) + { + mStatusUpdateHandler.removeCallbacks(mUpdateStatusTask); + serviceStarting = false; + serviceStopping = false; + button.setText("Start"); + } + else if(serviceStarting || serviceStopping) + mStatusUpdateHandler.postDelayed(mUpdateStatusTask, 500); + } + + private Runnable mUpdateStatusTask = new Runnable() + { public void run() { updateServiceStatus(); } }; + + private boolean serviceStarting = false; + private boolean serviceStopping = false; + private Handler mStatusUpdateHandler = new Handler(); } diff --git a/retroshare.pri b/retroshare.pri index 5fa79bcb0..676d24f55 100644 --- a/retroshare.pri +++ b/retroshare.pri @@ -165,20 +165,20 @@ rs_deep_search:CONFIG -= no_rs_deep_search # cross-compiling #JSONAPI_GENERATOR_EXE=/myBuildDir/jsonapi-generator -# Specify RetroShare major version appending the following assignation to qmake -# command line 'RS_MAJOR_VERSION=0' +# Specify RetroShare major version (must be a number) appending the following +# assignation to qmake command line 'RS_MAJOR_VERSION=0' #RS_MAJOR_VERSION=0 -# Specify RetroShare major version appending the following assignation to qmake -# command line 'RS_MINOR_VERSION=6' +# Specify RetroShare minor version (must be a number) appending the following +# assignation to qmake command line 'RS_MINOR_VERSION=6' #RS_MINOR_VERSION=6 -# Specify RetroShare major version appending the following assignation to qmake -# command line 'RS_MINI_VERSION=4' +# Specify RetroShare mini version (must be a number) appending the following +# assignation to qmake command line 'RS_MINI_VERSION=4' #RS_MINI_VERSION=4 -# Specify RetroShare major version appending the following assignation to qmake -# command line 'RS_EXTRA_VERSION=""' +# Specify RetroShare extra version (must be a string) appending the following +# assignation to qmake command line 'RS_EXTRA_VERSION=""' #RS_EXTRA_VERSION=git