mirror of
https://git.jami.net/savoirfairelinux/jami-daemon.git
synced 2025-08-12 22:09:25 +08:00
agent: Add Jami's account bindings
Change-Id: I42fe3a4682bb9468ecf5417d6d9823e151e10bec
This commit is contained in:

committed by
Adrien Béraud

parent
aa3299b36b
commit
904f74de22
@ -9,6 +9,7 @@ agent_SOURCES = \
|
||||
src/main.cpp \
|
||||
src/utils.h \
|
||||
src/bindings/bindings.cpp \
|
||||
src/bindings/bindings.h
|
||||
src/bindings/bindings.h \
|
||||
src/bindings/account.h
|
||||
|
||||
agent_LDADD = $(top_builddir)/src/libring.la
|
||||
|
80
test/agent/src/bindings/account.h
Normal file
80
test/agent/src/bindings/account.h
Normal file
@ -0,0 +1,80 @@
|
||||
/*
|
||||
* 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/callmanager_interface.h"
|
||||
#include "jami/configurationmanager_interface.h"
|
||||
|
||||
/* Agent */
|
||||
#include "utils.h"
|
||||
|
||||
static SCM set_details_binding(SCM accountID_str, SCM details_alist)
|
||||
{
|
||||
DRing::setAccountDetails(from_guile(accountID_str),
|
||||
from_guile(details_alist));
|
||||
return SCM_UNDEFINED;
|
||||
}
|
||||
|
||||
static SCM get_details_binding(SCM accountID_str)
|
||||
{
|
||||
return to_guile(DRing::getAccountDetails(from_guile(accountID_str)));
|
||||
}
|
||||
|
||||
static SCM send_register_binding(SCM accountID_str, SCM enable_boolean)
|
||||
{
|
||||
DRing::sendRegister(from_guile(accountID_str),
|
||||
from_guile(enable_boolean));
|
||||
|
||||
return SCM_UNDEFINED;
|
||||
}
|
||||
|
||||
static SCM export_to_file_binding(SCM accountID_str, SCM path_str, SCM passwd_str_optional)
|
||||
{
|
||||
if (SCM_UNBNDP(passwd_str_optional)) {
|
||||
return to_guile(DRing::exportToFile(from_guile(accountID_str),
|
||||
from_guile(path_str)));
|
||||
}
|
||||
|
||||
return to_guile(DRing::exportToFile(from_guile(accountID_str),
|
||||
from_guile(path_str),
|
||||
from_guile(passwd_str_optional)));
|
||||
}
|
||||
|
||||
static SCM add_account_binding(SCM details_alist, SCM accountID_str_optional)
|
||||
{
|
||||
if (SCM_UNBNDP(accountID_str_optional)) {
|
||||
return to_guile(DRing::addAccount(from_guile(details_alist)));
|
||||
}
|
||||
|
||||
return to_guile(DRing::addAccount(from_guile(details_alist),
|
||||
from_guile(accountID_str_optional)));
|
||||
}
|
||||
|
||||
static void
|
||||
install_account_primitives(void *)
|
||||
{
|
||||
define_primitive("set-details", 2, 0, 0, (void*) set_details_binding);
|
||||
define_primitive("get-details", 1, 0, 0, (void*) get_details_binding);
|
||||
define_primitive("send-register", 2, 0, 0, (void*) send_register_binding);
|
||||
define_primitive("account->archive", 2, 1, 0, (void*) export_to_file_binding);
|
||||
define_primitive("add", 1, 1, 0, (void*) add_account_binding);
|
||||
}
|
@ -22,11 +22,13 @@
|
||||
#include "bindings/bindings.h"
|
||||
|
||||
/* Include module's bindings here */
|
||||
#include "bindings/account.h"
|
||||
|
||||
void
|
||||
install_scheme_primitives()
|
||||
{
|
||||
/* Define modules here */
|
||||
scm_c_define_module("jami account", install_account_primitives, NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
|
Reference in New Issue
Block a user