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,
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}
* @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<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
* @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<RsMsgMetaData>& msg_metas) =0;
std::vector<RsMsgMetaData>& 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<RsGxsMessageId>& msgs_to_request,
std::vector<RsGxsForumMsg>& msgs) =0;
virtual bool getForumContent(
const RsGxsGroupId& forumId,
std::set<RsGxsMessageId>& msgsIds,
std::vector<RsGxsForumMsg>& 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<RsGxsForumGroup> &groups) = 0;
RS_DEPRECATED_FOR(getForumsContent)
RS_DEPRECATED_FOR(getForumContent)
virtual bool getMsgData(const uint32_t &token, std::vector<RsGxsForumMsg> &msgs) = 0;
RS_DEPRECATED_FOR(markRead)
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);
}
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;
RsTokReqOptions opts;
@ -469,21 +471,11 @@ bool p3GxsForums::getForumsContent( const RsGxsGroupId& forumId, std::set<RsGxsM
GxsMsgReq msgIds;
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) ;
}
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);
return getMsgData(token, msgs);
}

View File

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

View File

@ -1,6 +1,6 @@
/*
* 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
* 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();
}

View File

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