mirror of
https://git.jami.net/savoirfairelinux/jami-daemon.git
synced 2025-08-07 22:02:12 +08:00
agent/bindings/conversation: Add swarm bindings
Change-Id: I8a02ae82cb2cf1494a13b263aca0555ab84ed98f
This commit is contained in:

committed by
Sébastien Blin

parent
b65146fed3
commit
a5aed459a0
@ -5,14 +5,15 @@ AM_LDFLAGS += $(GUILE_LIBS)
|
||||
|
||||
noinst_PROGRAMS = agent.exe
|
||||
|
||||
agent_exe_SOURCES = \
|
||||
src/main.cpp \
|
||||
src/utils.h \
|
||||
src/bindings/bindings.cpp \
|
||||
src/bindings/bindings.h \
|
||||
src/bindings/account.h \
|
||||
src/bindings/call.h \
|
||||
src/bindings/signal.cpp \
|
||||
agent_exe_SOURCES = \
|
||||
src/main.cpp \
|
||||
src/utils.h \
|
||||
src/bindings/bindings.cpp \
|
||||
src/bindings/bindings.h \
|
||||
src/bindings/account.h \
|
||||
src/bindings/call.h \
|
||||
src/bindings/conversation.h \
|
||||
src/bindings/signal.cpp \
|
||||
src/bindings/signal.h
|
||||
|
||||
agent_exe_LDADD = $(top_builddir)/src/libring.la
|
||||
|
@ -24,6 +24,7 @@
|
||||
/* Include module's bindings here */
|
||||
#include "bindings/account.h"
|
||||
#include "bindings/call.h"
|
||||
#include "bindings/conversation.h"
|
||||
#include "bindings/logger.h"
|
||||
#include "bindings/signal.h"
|
||||
|
||||
@ -37,6 +38,7 @@ install_scheme_primitives()
|
||||
|
||||
load_module("jami account", install_account_primitives);
|
||||
load_module("jami call", install_call_primitives);
|
||||
load_module("jami conversation", install_conversation_primitives);
|
||||
load_module("jami logger bindings", install_logger_primitives);
|
||||
load_module("jami signal", install_signal_primitives);
|
||||
}
|
||||
|
94
test/agent/src/bindings/conversation.h
Normal file
94
test/agent/src/bindings/conversation.h
Normal file
@ -0,0 +1,94 @@
|
||||
/*
|
||||
* Copyright (C) 2021 Savoir-faire Linux Inc.
|
||||
*
|
||||
* Author: Olivier Dion <olivier.dion@savoirfairelinux.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
/* Jami */
|
||||
#include "jami/conversation_interface.h"
|
||||
|
||||
/* Agent */
|
||||
#include "utils.h"
|
||||
|
||||
static SCM
|
||||
get_conversations_binding(SCM accountID_str)
|
||||
{
|
||||
LOG_BINDING();
|
||||
|
||||
return to_guile(DRing::getConversations(from_guile(accountID_str)));
|
||||
}
|
||||
|
||||
static SCM
|
||||
get_conversation_members_binding(SCM accountID_str, SCM conversationID_str)
|
||||
{
|
||||
LOG_BINDING();
|
||||
|
||||
return to_guile(DRing::getConversationMembers(from_guile(accountID_str),
|
||||
from_guile(conversationID_str)));
|
||||
}
|
||||
|
||||
static SCM
|
||||
accept_conversation_binding(SCM accountID_str, SCM conversationID_str)
|
||||
{
|
||||
LOG_BINDING();
|
||||
|
||||
DRing::acceptConversationRequest(from_guile(accountID_str),
|
||||
from_guile(conversationID_str));
|
||||
|
||||
return SCM_UNDEFINED;
|
||||
}
|
||||
|
||||
static SCM
|
||||
send_message_binding(SCM accountID_str, SCM conversationID_str, SCM message_str,
|
||||
SCM parent_str_optional)
|
||||
{
|
||||
LOG_BINDING();
|
||||
|
||||
if (SCM_UNBNDP(parent_str_optional)) {
|
||||
DRing::sendMessage(from_guile(accountID_str),
|
||||
from_guile(conversationID_str),
|
||||
from_guile(message_str),
|
||||
"");
|
||||
|
||||
} else {
|
||||
DRing::sendMessage(from_guile(accountID_str),
|
||||
from_guile(conversationID_str),
|
||||
from_guile(message_str),
|
||||
from_guile(parent_str_optional));
|
||||
}
|
||||
|
||||
|
||||
return SCM_UNDEFINED;
|
||||
}
|
||||
|
||||
static void
|
||||
install_conversation_primitives(void *)
|
||||
{
|
||||
define_primitive("get-conversations", 1, 0, 0,
|
||||
(void*) get_conversations_binding);
|
||||
|
||||
define_primitive("get-conversation-members", 2, 0, 0,
|
||||
(void*) get_conversation_members_binding);
|
||||
|
||||
define_primitive("accept-conversation", 2, 0, 0,
|
||||
(void*) accept_conversation_binding);
|
||||
|
||||
define_primitive("send-message", 3, 1, 0,
|
||||
(void*) send_message_binding);
|
||||
}
|
Reference in New Issue
Block a user