mirror of
https://git.jami.net/savoirfairelinux/jami-daemon.git
synced 2025-08-12 22:09:25 +08:00
conversation: add new loadConversationUntil and SwarmMessageVect type
GitLab: #831 Change-Id: I8e2aa205629735df043618a87e54ae6a43e6ca3f
This commit is contained in:

committed by
Sébastien Blin

parent
8a7a5729d3
commit
ba09b11b42
@ -1,7 +1,7 @@
|
|||||||
cmake_minimum_required(VERSION 3.16)
|
cmake_minimum_required(VERSION 3.16)
|
||||||
|
|
||||||
project(jami-core
|
project(jami-core
|
||||||
VERSION 14.0.0
|
VERSION 15.1.0
|
||||||
LANGUAGES C CXX)
|
LANGUAGES C CXX)
|
||||||
set(PACKAGE_NAME "Jami Daemon")
|
set(PACKAGE_NAME "Jami Daemon")
|
||||||
set (CMAKE_CXX_STANDARD 17)
|
set (CMAKE_CXX_STANDARD 17)
|
||||||
|
@ -1884,6 +1884,18 @@
|
|||||||
<arg type="u" name="id" direction="out"/>
|
<arg type="u" name="id" direction="out"/>
|
||||||
</method>
|
</method>
|
||||||
|
|
||||||
|
<method name="loadSwarmUntil" tp:name-for-bindings="loadSwarmUntil">
|
||||||
|
<tp:added version="15.1.0"/>
|
||||||
|
<tp:docstring>
|
||||||
|
Load messages from a conversation
|
||||||
|
</tp:docstring>
|
||||||
|
<arg type="s" name="accountId" direction="in"/>
|
||||||
|
<arg type="s" name="conversationId" direction="in"/>
|
||||||
|
<arg type="s" name="fromMessage" direction="in"/>
|
||||||
|
<arg type="s" name="toMessage" direction="in"/>
|
||||||
|
<arg type="u" name="id" direction="out"/>
|
||||||
|
</method>
|
||||||
|
|
||||||
<method name="countInteractions" tp:name-for-bindings="countInteractions">
|
<method name="countInteractions" tp:name-for-bindings="countInteractions">
|
||||||
<tp:added version="10.0.0"/>
|
<tp:added version="10.0.0"/>
|
||||||
<tp:docstring>
|
<tp:docstring>
|
||||||
|
@ -953,6 +953,15 @@ public:
|
|||||||
return libjami::loadConversationUntil(accountId, conversationId, fromMessage, to);
|
return libjami::loadConversationUntil(accountId, conversationId, fromMessage, to);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint32_t
|
||||||
|
loadSwarmUntil(const std::string& accountId,
|
||||||
|
const std::string& conversationId,
|
||||||
|
const std::string& fromMessage,
|
||||||
|
const std::string& toMessage)
|
||||||
|
{
|
||||||
|
return libjami::loadSwarmUntil(accountId, conversationId, fromMessage, toMessage);
|
||||||
|
}
|
||||||
|
|
||||||
uint32_t
|
uint32_t
|
||||||
countInteractions(const std::string& accountId,
|
countInteractions(const std::string& accountId,
|
||||||
const std::string& conversationId,
|
const std::string& conversationId,
|
||||||
|
@ -45,6 +45,7 @@ public:
|
|||||||
%}
|
%}
|
||||||
|
|
||||||
%feature("director") ConversationCallback;
|
%feature("director") ConversationCallback;
|
||||||
|
%template(SwarmMessageVect) std::vector<libjami::SwarmMessage>;
|
||||||
|
|
||||||
namespace libjami {
|
namespace libjami {
|
||||||
|
|
||||||
@ -81,6 +82,7 @@ struct SwarmMessage
|
|||||||
uint32_t loadConversationMessages(const std::string& accountId, const std::string& conversationId, const std::string& fromMessage, size_t n);
|
uint32_t loadConversationMessages(const std::string& accountId, const std::string& conversationId, const std::string& fromMessage, size_t n);
|
||||||
uint32_t loadConversation(const std::string& accountId, const std::string& conversationId, const std::string& fromMessage, size_t n);
|
uint32_t loadConversation(const std::string& accountId, const std::string& conversationId, const std::string& fromMessage, size_t n);
|
||||||
uint32_t loadConversationUntil(const std::string& accountId, const std::string& conversationId, const std::string& fromMessage, const std::string& toMessage);
|
uint32_t loadConversationUntil(const std::string& accountId, const std::string& conversationId, const std::string& fromMessage, const std::string& toMessage);
|
||||||
|
uint32_t loadSwarmUntil(const std::string& accountId, const std::string& conversationId, const std::string& fromMessage, const std::string& toMessage);
|
||||||
uint32_t countInteractions(const std::string& accountId, const std::string& conversationId, const std::string& toId, const std::string& fromId, const std::string& authorUri);
|
uint32_t countInteractions(const std::string& accountId, const std::string& conversationId, const std::string& toId, const std::string& fromId, const std::string& authorUri);
|
||||||
void clearCache(const std::string& accountId, const std::string& conversationId);
|
void clearCache(const std::string& accountId, const std::string& conversationId);
|
||||||
uint32_t searchConversation(const std::string& accountId,
|
uint32_t searchConversation(const std::string& accountId,
|
||||||
|
@ -81,6 +81,7 @@ struct SwarmMessage
|
|||||||
uint32_t loadConversationMessages(const std::string& accountId, const std::string& conversationId, const std::string& fromMessage, size_t n);
|
uint32_t loadConversationMessages(const std::string& accountId, const std::string& conversationId, const std::string& fromMessage, size_t n);
|
||||||
uint32_t loadConversation(const std::string& accountId, const std::string& conversationId, const std::string& fromMessage, size_t n);
|
uint32_t loadConversation(const std::string& accountId, const std::string& conversationId, const std::string& fromMessage, size_t n);
|
||||||
uint32_t loadConversationUntil(const std::string& accountId, const std::string& conversationId, const std::string& fromMessage, const std::string& toMessage);
|
uint32_t loadConversationUntil(const std::string& accountId, const std::string& conversationId, const std::string& fromMessage, const std::string& toMessage);
|
||||||
|
uint32_t loadSwarmUntil(const std::string& accountId, const std::string& conversationId, const std::string& fromMessage, const std::string& toMessage);
|
||||||
void clearCache(const std::string& accountId, const std::string& conversationId);
|
void clearCache(const std::string& accountId, const std::string& conversationId);
|
||||||
uint32_t countInteractions(const std::string& accountId, const std::string& conversationId, const std::string& toId, const std::string& fromId, const std::string& authorUri);
|
uint32_t countInteractions(const std::string& accountId, const std::string& conversationId, const std::string& toId, const std::string& fromId, const std::string& authorUri);
|
||||||
uint32_t searchConversation(const std::string& accountId,
|
uint32_t searchConversation(const std::string& accountId,
|
||||||
|
@ -2,7 +2,7 @@ dnl Jami - configure.ac
|
|||||||
|
|
||||||
dnl Process this file with autoconf to produce a configure script.
|
dnl Process this file with autoconf to produce a configure script.
|
||||||
AC_PREREQ([2.69])
|
AC_PREREQ([2.69])
|
||||||
AC_INIT([Jami Daemon],[15.0.0],[jami@gnu.org],[jami])
|
AC_INIT([Jami Daemon],[15.1.0],[jami@gnu.org],[jami])
|
||||||
|
|
||||||
dnl Clear the implicit flags that default to '-g -O2', otherwise they
|
dnl Clear the implicit flags that default to '-g -O2', otherwise they
|
||||||
dnl take precedence over the values we set via the
|
dnl take precedence over the values we set via the
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
project('jami-daemon', ['c', 'cpp'],
|
project('jami-daemon', ['c', 'cpp'],
|
||||||
version: '14.0.0',
|
version: '15.1.0',
|
||||||
license: 'GPL3+',
|
license: 'GPL3+',
|
||||||
default_options: ['cpp_std=gnu++17', 'buildtype=debugoptimized'],
|
default_options: ['cpp_std=gnu++17', 'buildtype=debugoptimized'],
|
||||||
meson_version:'>= 0.56'
|
meson_version:'>= 0.56'
|
||||||
|
@ -219,6 +219,18 @@ loadConversationUntil(const std::string& accountId,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint32_t
|
||||||
|
loadSwarmUntil(const std::string& accountId,
|
||||||
|
const std::string& conversationId,
|
||||||
|
const std::string& fromMessage,
|
||||||
|
const std::string& toMessage)
|
||||||
|
{
|
||||||
|
if (auto acc = jami::Manager::instance().getAccount<jami::JamiAccount>(accountId))
|
||||||
|
if (auto convModule = acc->convModule())
|
||||||
|
return convModule->loadSwarmUntil(conversationId, fromMessage, toMessage);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
uint32_t
|
uint32_t
|
||||||
countInteractions(const std::string& accountId,
|
countInteractions(const std::string& accountId,
|
||||||
const std::string& conversationId,
|
const std::string& conversationId,
|
||||||
|
@ -104,6 +104,10 @@ LIBJAMI_PUBLIC uint32_t loadConversationUntil(const std::string& accountId,
|
|||||||
const std::string& conversationId,
|
const std::string& conversationId,
|
||||||
const std::string& fromMessage,
|
const std::string& fromMessage,
|
||||||
const std::string& toMessage);
|
const std::string& toMessage);
|
||||||
|
LIBJAMI_PUBLIC uint32_t loadSwarmUntil(const std::string& accountId,
|
||||||
|
const std::string& conversationId,
|
||||||
|
const std::string& fromMessage,
|
||||||
|
const std::string& toMessage);
|
||||||
LIBJAMI_PUBLIC uint32_t countInteractions(const std::string& accountId,
|
LIBJAMI_PUBLIC uint32_t countInteractions(const std::string& accountId,
|
||||||
const std::string& conversationId,
|
const std::string& conversationId,
|
||||||
const std::string& toId,
|
const std::string& toId,
|
||||||
|
@ -2082,6 +2082,34 @@ ConversationModule::loadConversationUntil(const std::string& conversationId,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint32_t
|
||||||
|
ConversationModule::loadSwarmUntil(const std::string& conversationId,
|
||||||
|
const std::string& fromMessage,
|
||||||
|
const std::string& toMessage)
|
||||||
|
{
|
||||||
|
auto acc = pimpl_->account_.lock();
|
||||||
|
if (auto conv = pimpl_->getConversation(conversationId)) {
|
||||||
|
std::lock_guard lk(conv->mtx);
|
||||||
|
if (conv->conversation) {
|
||||||
|
const uint32_t id = std::uniform_int_distribution<uint32_t> {}(acc->rand);
|
||||||
|
LogOptions options;
|
||||||
|
options.from = fromMessage;
|
||||||
|
options.to = toMessage;
|
||||||
|
options.includeTo = true;
|
||||||
|
conv->conversation->loadMessages2(
|
||||||
|
[accountId = pimpl_->accountId_, conversationId, id](auto&& messages) {
|
||||||
|
emitSignal<libjami::ConversationSignal::SwarmLoaded>(id,
|
||||||
|
accountId,
|
||||||
|
conversationId,
|
||||||
|
messages);
|
||||||
|
},
|
||||||
|
options);
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
std::shared_ptr<TransferManager>
|
std::shared_ptr<TransferManager>
|
||||||
ConversationModule::dataTransfer(const std::string& conversationId) const
|
ConversationModule::dataTransfer(const std::string& conversationId) const
|
||||||
{
|
{
|
||||||
|
@ -232,6 +232,9 @@ public:
|
|||||||
uint32_t loadConversationUntil(const std::string& conversationId,
|
uint32_t loadConversationUntil(const std::string& conversationId,
|
||||||
const std::string& fromMessage,
|
const std::string& fromMessage,
|
||||||
const std::string& to);
|
const std::string& to);
|
||||||
|
uint32_t loadSwarmUntil(const std::string& conversationId,
|
||||||
|
const std::string& fromMessage,
|
||||||
|
const std::string& toMessage);
|
||||||
/**
|
/**
|
||||||
* Clear loaded interactions
|
* Clear loaded interactions
|
||||||
* @param conversationId
|
* @param conversationId
|
||||||
|
Reference in New Issue
Block a user