Merge branch 'v0.6.5'

This commit is contained in:
Gioacchino Mazzurco 2018-12-23 11:48:35 +01:00
commit 5e4006b7e6
No known key found for this signature in database
GPG Key ID: A1FBCA3872E87051
7 changed files with 106 additions and 102 deletions

View File

@ -143,40 +143,28 @@ public:
const std::list<RsGxsGroupId>& forumIds, const std::list<RsGxsGroupId>& forumIds,
std::vector<RsGxsForumGroup>& forumsInfo ) = 0; std::vector<RsGxsForumGroup>& forumsInfo ) = 0;
/** /**
* @brief Get content of specified forums. Blocking API * @brief Get message metadatas for a specific forum. Blocking API
* @jsonapi{development} * @jsonapi{development}
* @param[in] forumIds id of the forum of which the content is requested * @param[in] forumId id of the forum of which the content is requested
* @param[out] messages storage for the forum messages * @param[out] msgMetas storage for the forum messages meta data
* @return false if something failed, true otherwhise
*/
virtual bool getForumsContent(
const std::list<RsGxsGroupId>& forumIds,
std::vector<RsGxsForumMsg>& 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
* @return false if something failed, true otherwhise * @return false if something failed, true otherwhise
*/ */
virtual bool getForumMsgMetaData( const RsGxsGroupId& forumId, virtual bool getForumMsgMetaData( const RsGxsGroupId& forumId,
std::vector<RsMsgMetaData>& msg_metas) =0; std::vector<RsMsgMetaData>& msgMetas) = 0;
/** /**
* @brief Get specific list of messages from a single forums. Blocking API * @brief Get specific list of messages from a single forums. Blocking API
* @jsonapi{development} * @jsonapi{development}
* @param[in] forumId id of the forum of which the content is requested * @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 * @param[out] msgs storage for the forum messages
* @return false if something failed, true otherwhise * @return false if something failed, true otherwhise
*/ */
virtual bool getForumsContent( virtual bool getForumContent(
const RsGxsGroupId& forumId, const RsGxsGroupId& forumId,
std::set<RsGxsMessageId>& msgs_to_request, std::set<RsGxsMessageId>& msgsIds,
std::vector<RsGxsForumMsg>& msgs) =0; std::vector<RsGxsForumMsg>& msgs) = 0;
/** /**
* @brief Toggle message read status. Blocking API. * @brief Toggle message read status. Blocking API.
@ -200,7 +188,7 @@ public:
/* Specific Service Data */ /* Specific Service Data */
RS_DEPRECATED_FOR("getForumsSummaries, getForumsInfo") RS_DEPRECATED_FOR("getForumsSummaries, getForumsInfo")
virtual bool getGroupData(const uint32_t &token, std::vector<RsGxsForumGroup> &groups) = 0; virtual bool getGroupData(const uint32_t &token, std::vector<RsGxsForumGroup> &groups) = 0;
RS_DEPRECATED_FOR(getForumsContent) RS_DEPRECATED_FOR(getForumContent)
virtual bool getMsgData(const uint32_t &token, std::vector<RsGxsForumMsg> &msgs) = 0; virtual bool getMsgData(const uint32_t &token, std::vector<RsGxsForumMsg> &msgs) = 0;
RS_DEPRECATED_FOR(markRead) RS_DEPRECATED_FOR(markRead)
virtual void setMessageReadStatus(uint32_t& token, const RsGxsGrpMsgIdPair& msgId, bool read) = 0; virtual void setMessageReadStatus(uint32_t& token, const RsGxsGrpMsgIdPair& msgId, bool read) = 0;

View File

@ -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$

View File

@ -460,7 +460,9 @@ bool p3GxsForums::getForumsInfo(
return getGroupData(token, forumsInfo); return getGroupData(token, forumsInfo);
} }
bool p3GxsForums::getForumsContent( const RsGxsGroupId& forumId, std::set<RsGxsMessageId>& msgs_to_request,std::vector<RsGxsForumMsg>& msgs) bool p3GxsForums::getForumContent(
const RsGxsGroupId& forumId, std::set<RsGxsMessageId>& msgs_to_request,
std::vector<RsGxsForumMsg>& msgs )
{ {
uint32_t token; uint32_t token;
RsTokReqOptions opts; RsTokReqOptions opts;
@ -469,21 +471,11 @@ bool p3GxsForums::getForumsContent( const RsGxsGroupId& forumId, std::set<RsGxsM
GxsMsgReq msgIds; GxsMsgReq msgIds;
msgIds[forumId] = msgs_to_request; msgIds[forumId] = msgs_to_request;
if( !requestMsgInfo(token, opts, msgIds) || waitToken(token,std::chrono::milliseconds(5000)) != RsTokenService::COMPLETE ) return false; if( !requestMsgInfo(token, opts, msgIds) ||
waitToken(token,std::chrono::seconds(5)) != RsTokenService::COMPLETE )
return false;
return getMsgData(token, msgs) ; return getMsgData(token, msgs);
}
bool p3GxsForums::getForumsContent(
const std::list<RsGxsGroupId>& forumIds,
std::vector<RsGxsForumMsg>& 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);
} }

View File

@ -72,16 +72,14 @@ public:
const std::list<RsGxsGroupId>& forumIds, const std::list<RsGxsGroupId>& forumIds,
std::vector<RsGxsForumGroup>& forumsInfo ); std::vector<RsGxsForumGroup>& forumsInfo );
/// @see RsGxsForums::getForumsContent
virtual bool getForumsContent(
const std::list<RsGxsGroupId>& forumIds,
std::vector<RsGxsForumMsg>& messages );
/// @see RsGxsForums::getForumMsgMetaData /// @see RsGxsForums::getForumMsgMetaData
virtual bool getForumMsgMetaData(const RsGxsGroupId& forumId, std::vector<RsMsgMetaData>& msg_metas) ; virtual bool getForumMsgMetaData(const RsGxsGroupId& forumId, std::vector<RsMsgMetaData>& msg_metas) ;
/// @see RsGxsForums::getForumsContent /// @see RsGxsForums::getForumContent
virtual bool getForumsContent( const RsGxsGroupId& forumId, std::set<RsGxsMessageId>& msgs_to_request,std::vector<RsGxsForumMsg>& msgs) ; virtual bool getForumContent(
const RsGxsGroupId& forumId,
std::set<RsGxsMessageId>& msgs_to_request,
std::vector<RsGxsForumMsg>& msgs );
/// @see RsGxsForums::markRead /// @see RsGxsForums::markRead
virtual bool markRead(const RsGxsGrpMsgIdPair& messageId, bool read); virtual bool markRead(const RsGxsGrpMsgIdPair& messageId, bool read);

View File

@ -1653,7 +1653,7 @@ void GxsForumThreadWidget::async_msg_action(const MsgMethod &action)
msgs_to_request.insert(mThreadId); 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; std::cerr << __PRETTY_FUNCTION__ << " failed to retrieve forum group info for forum " << groupId() << std::endl;
return; 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 /* 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 * thread, for example to update the data model with new information
* after a blocking call to RetroShare API complete, note that * after a blocking call to RetroShare API complete */
* Qt::QueuedConnection is important!
*/
(this->*action)(msg); (this->*action)(msg);
@ -1927,9 +1925,7 @@ void GxsForumThreadWidget::updateGroupData()
{ {
/* Here it goes any code you want to be executed on the Qt Gui /* 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 * thread, for example to update the data model with new information
* after a blocking call to RetroShare API complete, note that * after a blocking call to RetroShare API complete */
* Qt::QueuedConnection is important!
*/
mForumGroup = *group; mForumGroup = *group;
delete group; delete group;
@ -1957,7 +1953,7 @@ void GxsForumThreadWidget::updateMessageData(const RsGxsMessageId& msgId)
msgs_to_request.insert(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; std::cerr << __PRETTY_FUNCTION__ << " failed to retrieve forum group info for forum " << groupId() << std::endl;
return; 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 /* 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 * thread, for example to update the data model with new information
* after a blocking call to RetroShare API complete, note that * after a blocking call to RetroShare API complete */
* Qt::QueuedConnection is important!
*/
insertMessageData(*msg); insertMessageData(*msg);

View File

@ -1,6 +1,6 @@
/* /*
* RetroShare * RetroShare
* Copyright (C) 2016-2018 Gioacchino Mazzurco <gio@eigenlab.org> * Copyright (C) 2016-2018 Gioacchino Mazzurco <gio@altermundi.net>
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as * 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.app.Activity;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler;
import android.view.View; import android.view.View;
import android.widget.Button; import android.widget.Button;
import org.retroshare.service.R;
public class RetroShareServiceControlActivity extends Activity public class RetroShareServiceControlActivity extends Activity
@ -39,14 +39,19 @@ public class RetroShareServiceControlActivity extends Activity
{ {
if (RetroShareServiceAndroid.isRunning(RetroShareServiceControlActivity.this)) if (RetroShareServiceAndroid.isRunning(RetroShareServiceControlActivity.this))
{ {
serviceStarting = false;
serviceStopping = true;
button.setText("Stopping...");
RetroShareServiceAndroid.stop(RetroShareServiceControlActivity.this); RetroShareServiceAndroid.stop(RetroShareServiceControlActivity.this);
button.setText("Start");
} }
else else
{ {
button.setText("Starting...");
RetroShareServiceAndroid.start(RetroShareServiceControlActivity.this); RetroShareServiceAndroid.start(RetroShareServiceControlActivity.this);
button.setText("Stop"); serviceStarting = true;
serviceStopping = false;
} }
mStatusUpdateHandler.postDelayed(mUpdateStatusTask, 500);
} }
}); });
@ -60,5 +65,44 @@ public class RetroShareServiceControlActivity extends Activity
final Button button = (Button) findViewById(R.id.startStopButton); final Button button = (Button) findViewById(R.id.startStopButton);
button.setText(RetroShareServiceAndroid.isRunning(this) ? "Stop" : "Start"); 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();
} }

View File

@ -165,20 +165,20 @@ rs_deep_search:CONFIG -= no_rs_deep_search
# cross-compiling # cross-compiling
#JSONAPI_GENERATOR_EXE=/myBuildDir/jsonapi-generator #JSONAPI_GENERATOR_EXE=/myBuildDir/jsonapi-generator
# Specify RetroShare major version appending the following assignation to qmake # Specify RetroShare major version (must be a number) appending the following
# command line 'RS_MAJOR_VERSION=0' # assignation to qmake command line 'RS_MAJOR_VERSION=0'
#RS_MAJOR_VERSION=0 #RS_MAJOR_VERSION=0
# Specify RetroShare major version appending the following assignation to qmake # Specify RetroShare minor version (must be a number) appending the following
# command line 'RS_MINOR_VERSION=6' # assignation to qmake command line 'RS_MINOR_VERSION=6'
#RS_MINOR_VERSION=6 #RS_MINOR_VERSION=6
# Specify RetroShare major version appending the following assignation to qmake # Specify RetroShare mini version (must be a number) appending the following
# command line 'RS_MINI_VERSION=4' # assignation to qmake command line 'RS_MINI_VERSION=4'
#RS_MINI_VERSION=4 #RS_MINI_VERSION=4
# Specify RetroShare major version appending the following assignation to qmake # Specify RetroShare extra version (must be a string) appending the following
# command line 'RS_EXTRA_VERSION=""' # assignation to qmake command line 'RS_EXTRA_VERSION=""'
#RS_EXTRA_VERSION=git #RS_EXTRA_VERSION=git