Merge branch 'dev_xmlrpc'

This commit is contained in:
Ghislain MARY 2015-06-08 13:55:50 +02:00
commit 6565d85b1d
26 changed files with 1593 additions and 1077 deletions

View file

@ -51,7 +51,6 @@ option(ENABLE_TUTORIALS "Enable compilation of tutorials." YES)
option(ENABLE_UNIT_TESTS "Enable compilation of unit tests." YES)
option(ENABLE_UPNP "Build with uPnP support." YES)
option(ENABLE_VIDEO "Build with video support." YES)
cmake_dependent_option(ENABLE_ASSISTANT "Turn on assistant compiling." YES "ENABLE_GTK_UI" NO)
option(ENABLE_DEBUG_LOGS "Turn on or off debug level logs." NO)
@ -82,16 +81,6 @@ if(MSVC)
)
endif()
endif()
if(ENABLE_ASSISTANT)
if(NOT EXISTS "${CMAKE_CURRENT_BINARY_DIR}/libsoup.zip")
message(STATUS "Installing libsoup")
file(DOWNLOAD http://www.linphone.org/files/libsoup_2.24.0-1_win32.zip "${CMAKE_CURRENT_BINARY_DIR}/libsoup.zip" SHOW_PROGRESS)
execute_process(
COMMAND "${CMAKE_COMMAND}" "-E" "tar" "x" "${CMAKE_CURRENT_BINARY_DIR}/libsoup.zip"
WORKING_DIRECTORY "${CMAKE_INSTALL_PREFIX}"
)
endif()
endif()
endif()
find_package(BelleSIP REQUIRED)
@ -131,15 +120,6 @@ if(ENABLE_NOTIFY)
set(ENABLE_NOTIFY OFF CACHE BOOL "Enable libnotify support." FORCE)
endif()
endif()
if(ENABLE_ASSISTANT)
find_package(Soup)
if(SOUP_FOUND)
set(BUILD_WIZARD 1)
else()
message(WARNING "Could not find the soup library!")
set(ENABLE_ASSISTANT OFF CACHE BOOL "Turn on assistant compiling." FORCE)
endif()
endif()
find_package(Gettext)
@ -163,9 +143,6 @@ endif()
if(ENABLE_TUNNEL)
include_directories(${TUNNEL_INCLUDE_DIRS})
endif()
if(ENABLE_ASSISTANT)
include_directories(${SOUP_INCLUDE_DIRS})
endif()
if(ENABLE_DEBUG_LOGS)
add_definitions("-DDEBUG")
endif()

3
README
View file

@ -26,7 +26,6 @@ This is Linphone, a free (GPL) video softphone based on the SIP protocol.
- theora (optional)
+ gsm codec (gsm source package or libgsm-dev or gsm-devel) (optional)
+ libreadline (optional: for convenient command line in linphonec)
+ libsoup (optional: for wizard - account creation assistant)
+ libsqlite3 (optional : for a local history of chat messages)
+ if you want uPnP support (optional):
- libupnp (version 1.6 branch (not patched with 18-url-upnpstrings.patch))
@ -39,7 +38,7 @@ libglew1.6-dev libv4l-dev libxml2-dev
+ for optional library
$ sudo apt-get install libreadline-dev libgsm1-dev libtheora-dev \
libsoup2.4-dev libsqlite3-dev libupnp4-dev libsrtp-dev
libsqlite3-dev libupnp4-dev libsrtp-dev
+ Install zrtp (optional), for unbreakable call encryption
$ git clone git://git.linphone.org:bzrtp

View file

@ -31,7 +31,7 @@ In order to enable generation of bundle for older MacOS version, it is recommend
Install `GTK`. It is recommended to use the `quartz` backend for better integration.
sudo port install gtk2 +quartz +no_x11 libsoup
sudo port install gtk2 +quartz +no_x11
sudo port install gtk-osx-application +no_python
sudo port install hicolor-icon-theme
@ -51,7 +51,7 @@ Install `GTK`. It is recommended to use the `quartz` backend for better integrat
brew install cairo --without-x11
brew install gtk+ --without-x11
brew install gtk-mac-integration libsoup hicolor-icon-theme
brew install gtk-mac-integration hicolor-icon-theme
### Building Linphone

View file

@ -7,9 +7,6 @@
/* Define if tools enabled */
/* #undef BUILD_TOOLS */
/* Define if wizard enabled */
/* #undef BUILD_WIZARD */
/* Tells whether localisation is possible */
/* #undef ENABLE_NLS */

View file

@ -1,65 +0,0 @@
############################################################################
# FindSoup.cmake
# Copyright (C) 2014 Belledonne Communications, Grenoble France
#
############################################################################
#
# 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 2
# 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
############################################################################
#
# - Find the soup include file and library
#
# SOUP_FOUND - system has libsoup
# SOUP_INCLUDE_DIRS - the libsoup include directory
# SOUP_LIBRARIES - The libraries needed to use libsoup
if(WIN32)
set(GTK2_ADDITIONAL_SUFFIXES "../lib/glib-2.0/include" "../lib/gtk-2.0/include")
endif()
find_package(GTK2 2.18 REQUIRED gtk)
set(_SOUP_ROOT_PATHS
${CMAKE_INSTALL_PREFIX}
)
find_path(SOUP_INCLUDE_DIRS
NAMES libsoup/soup.h
HINTS _SOUP_ROOT_PATHS
PATH_SUFFIXES include/libsoup-2.4
)
if(SOUP_INCLUDE_DIRS)
set(HAVE_LIBSOUP_SOUP_H 1)
list(APPEND SOUP_INCLUDE_DIRS ${GTK2_INCLUDE_DIRS})
endif()
find_library(SOUP_LIBRARIES
NAMES soup-2.4
HINTS ${_SOUP_ROOT_PATHS}
PATH_SUFFIXES bin lib
)
if(SOUP_LIBRARIES)
list(APPEND SOUP_LIBRARIES ${GTK2_LIBRARIES})
endif()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Soup
DEFAULT_MSG
SOUP_INCLUDE_DIRS SOUP_LIBRARIES HAVE_LIBSOUP_SOUP_H
)
mark_as_advanced(SOUP_INCLUDE_DIRS SOUP_LIBRARIES HAVE_LIBSOUP_SOUP_H)

View file

@ -37,7 +37,6 @@
#define PACKAGE_DATA_DIR "${PACKAGE_DATA_DIR}"
#define PACKAGE_SOUND_DIR "${PACKAGE_SOUND_DIR}"
#cmakedefine BUILD_WIZARD
#cmakedefine HAVE_NOTIFY4
#cmakedefine HAVE_ZLIB 1
#cmakedefine HAVE_CU_GET_SUITE 1

View file

@ -729,43 +729,6 @@ if test "$has_sighandler_t" = "yes" ; then
AC_DEFINE( HAVE_SIGHANDLER_T, 1, [Define if sighandler_t available] )
fi
AC_ARG_ENABLE(assistant,
[AS_HELP_STRING([--enable-assistant], [Turn on assistant compiling])],
[case "${enableval}" in
yes) build_wizard=true ;;
no) build_wizard=false ;;
*) AC_MSG_ERROR(bad value ${enableval} for --enable-assistant) ;;
esac],
[build_wizard=check]
)
dnl check libsoup (needed for wizard)
if test "$build_wizard" != "false" ; then
PKG_CHECK_MODULES(LIBSOUP, [libsoup-2.4 >= 2.26],[],
[if test "$build_wizard" = "true" ; then
AC_MSG_ERROR([Could not found libsoup, assistant cannot be compiled.])
else
build_wizard=false
fi]
)
fi
if test "$build_wizard" != "false" ; then
PKG_CHECK_MODULES(LIBGTKWIZARD, [gtk+-2.0 >= 2.22.0],[],
[if test "$build_wizard" = "true" ; then
AC_MSG_ERROR([gtk+-2.0 < 2.22.0, assistant cannot be compiled.])
else
build_wizard=false
fi]
)
fi
AC_SUBST(LIBSOUP_CFLAGS)
AC_SUBST(LIBSOUP_LIBS)
AM_CONDITIONAL(BUILD_WIZARD, test x$build_wizard != xfalse)
if test "$build_wizard" != "false" ; then
build_wizard=true
AC_DEFINE(BUILD_WIZARD, 1, [Define if wizard enabled] )
fi
AC_CHECK_HEADERS(libudev.h)
AC_CHECK_LIB(udev,udev_new)
@ -1074,7 +1037,6 @@ echo "Linphone build configuration ended."
echo "Summary of build options:"
printf "* %-30s %s\n" "Video support" $video
printf "* %-30s %s\n" "GTK interface" $gtk_ui
printf "* %-30s %s\n" "Account assistant" $build_wizard
printf "* %-30s %s\n" "Console interface" $console_ui
printf "* %-30s %s\n" "Tools" $build_tools
printf "* %-30s %s\n" "Message storage" $enable_msg_storage

View file

@ -31,6 +31,8 @@ endif()
set(SOURCE_FILES
account_creator.c
account_creator.h
address.c
authentication.c
bellesip_sal/sal_address_impl.c
@ -92,6 +94,8 @@ set(SOURCE_FILES
xml2lpc.c
xml2lpc.h
xml.c
xmlrpc.c
xmlrpc.h
vtables.c
)
if(ENABLE_TUNNEL)
@ -103,9 +107,6 @@ if(ENABLE_TUNNEL)
else()
list(APPEND SOURCE_FILES linphone_tunnel_stubs.c)
endif()
if(ENABLE_ASSISTANT)
list(APPEND SOURCE_FILES sipwizard.c)
endif()
set(GENERATED_SOURCE_FILES
${CMAKE_CURRENT_BINARY_DIR}/liblinphone_gitversion.h
@ -137,9 +138,6 @@ endif()
if(ENABLE_TUNNEL)
list(APPEND LIBS ${TUNNEL_LIBRARIES})
endif()
if(ENABLE_ASSISTANT)
list(APPEND LIBS ${SOUP_LIBRARIES})
endif()
if(MSVC AND NOT "${CMAKE_SYSTEM_NAME}" STREQUAL "WindowsPhone")
list(APPEND LIBS ${LIBGCC} ${LIBMINGWEX})
endif()

View file

@ -25,6 +25,7 @@ CLEANFILES=$(GITVERSION_FILE)
linphone_includedir=$(includedir)/linphone
linphone_include_HEADERS=\
account_creator.h \
buffer.h \
call_log.h \
call_params.h \
@ -38,11 +39,13 @@ linphone_include_HEADERS=\
lpc2xml.h \
lpconfig.h \
sipsetup.h \
xml2lpc.h
xml2lpc.h \
xmlrpc.h
lib_LTLIBRARIES=liblinphone.la
liblinphone_la_SOURCES=\
account_creator.c \
address.c \
authentication.c \
buffer.c \
@ -82,6 +85,7 @@ liblinphone_la_SOURCES=\
sipsetup.c sipsetup.h \
xml2lpc.c \
xml.c \
xmlrpc.c \
vtables.c \
$(GITVERSION_FILE)
@ -102,10 +106,6 @@ liblinphone_la_SOURCES+= bellesip_sal/sal_address_impl.c \
bellesip_sal/sal_op_info.c \
bellesip_sal/sal_op_events.c
if BUILD_WIZARD
liblinphone_la_SOURCES+=sipwizard.c
endif
liblinphone_la_SOURCES+=linphone_tunnel_config.c
if BUILD_TUNNEL
liblinphone_la_SOURCES+=linphone_tunnel.cc TunnelManager.cc TunnelManager.hh linphone_tunnel.h
@ -137,7 +137,6 @@ liblinphone_la_LIBADD= \
$(ORTP_LIBS) \
$(SIPSTACK_LIBS) \
$(TUNNEL_LIBS) \
$(LIBSOUP_LIBS) \
$(SQLITE3_LIBS) \
$(LIBXML2_LIBS) \
$(LDAP_LIBS) \
@ -170,7 +169,6 @@ COMMON_CFLAGS=\
$(STRICT_OPTIONS) \
-DIN_LINPHONE \
$(SIPSTACK_CFLAGS) \
$(LIBSOUP_CFLAGS) \
-DENABLE_TRACE \
-DLOG_DOMAIN=\"LinphoneCore\" \
$(IPV6_CFLAGS) \
@ -183,10 +181,6 @@ COMMON_CFLAGS=\
$(SASL_CFLAGS) \
$(ZLIB_CFLAGS)
if BUILD_WIZARD
COMMON_CFLAGS+= -DBUILD_WIZARD
endif
COMMON_CFLAGS+= -DUSE_BELLESIP
AM_CFLAGS=$(COMMON_CFLAGS) $(STRICT_OPTIONS_CC)

256
coreapi/account_creator.c Normal file
View file

@ -0,0 +1,256 @@
/*
linphone
Copyright (C) 2010-2015 Belledonne Communications SARL
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 2
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "linphonecore.h"
#include "private.h"
struct _LinphoneAccountCreator {
LinphoneXmlRpcSession *xmlrpc_session;
LinphoneAccountCreatorCb existence_test_cb;
LinphoneAccountCreatorCb validation_test_cb;
LinphoneAccountCreatorCb validate_cb;
LinphoneCore *core;
void *existence_test_cb_ud;
void *validation_test_cb_ud;
void *validate_cb_ud;
char *xmlrpc_url;
char *username;
char *password;
char *domain;
char *route;
char *email;
bool_t subscribe_to_newsletter;
};
LinphoneAccountCreator * linphone_account_creator_new(LinphoneCore *core, const char *xmlrpc_url) {
LinphoneAccountCreator *creator;
creator = ms_new0(LinphoneAccountCreator, 1);
creator->core = core;
creator->xmlrpc_session = linphone_xml_rpc_session_new(core, xmlrpc_url);
return creator;
}
void linphone_account_creator_set_username(LinphoneAccountCreator *creator, const char *username) {
set_string(&creator->username, username);
}
const char * linphone_account_creator_get_username(const LinphoneAccountCreator *creator) {
return creator->username;
}
void linphone_account_creator_set_password(LinphoneAccountCreator *creator, const char *password){
set_string(&creator->password, password);
}
const char * linphone_account_creator_get_password(const LinphoneAccountCreator *creator) {
return creator->password;
}
void linphone_account_creator_set_domain(LinphoneAccountCreator *creator, const char *domain){
set_string(&creator->domain, domain);
}
const char * linphone_account_creator_get_domain(const LinphoneAccountCreator *creator) {
return creator->domain;
}
void linphone_account_creator_set_route(LinphoneAccountCreator *creator, const char *route) {
set_string(&creator->route, route);
}
const char * linphone_account_creator_get_route(const LinphoneAccountCreator *creator) {
return creator->route;
}
void linphone_account_creator_set_email(LinphoneAccountCreator *creator, const char *email) {
set_string(&creator->email, email);
}
const char * linphone_account_creator_get_email(const LinphoneAccountCreator *creator) {
return creator->email;
}
void linphone_account_creator_enable_newsletter_subscription(LinphoneAccountCreator *creator, bool_t subscribe) {
creator->subscribe_to_newsletter = subscribe;
}
bool_t linphone_account_creator_newsletter_subscription_enabled(const LinphoneAccountCreator *creator) {
return creator->subscribe_to_newsletter;
}
void linphone_account_creator_set_test_existence_cb(LinphoneAccountCreator *creator, LinphoneAccountCreatorCb cb, void *user_data) {
creator->existence_test_cb = cb;
creator->existence_test_cb_ud = user_data;
}
void linphone_account_creator_set_test_validation_cb(LinphoneAccountCreator *creator, LinphoneAccountCreatorCb cb, void *user_data) {
creator->validation_test_cb = cb;
creator->validation_test_cb_ud = user_data;
}
void linphone_account_creator_set_validate_cb(LinphoneAccountCreator *creator, LinphoneAccountCreatorCb cb, void *user_data) {
creator->validate_cb = cb;
creator->validate_cb_ud = user_data;
}
static void _test_existence_cb(LinphoneXmlRpcRequest *request, void *user_data) {
LinphoneAccountCreator *creator = (LinphoneAccountCreator *)user_data;
if (creator->existence_test_cb != NULL) {
LinphoneAccountCreatorStatus status = LinphoneAccountCreatorFailed;
if ((linphone_xml_rpc_request_get_status(request) == LinphoneXmlRpcStatusOk)
&& (linphone_xml_rpc_request_get_int_response(request) == 0)) {
status = LinphoneAccountCreatorOk;
}
creator->existence_test_cb(creator, status, creator->existence_test_cb_ud);
}
}
LinphoneAccountCreatorStatus linphone_account_creator_test_existence(LinphoneAccountCreator *creator) {
LinphoneXmlRpcRequest *request;
char *identity;
if (!creator->username || !creator->domain) return LinphoneAccountCreatorFailed;
identity = ms_strdup_printf("%s@%s", creator->username, creator->domain);
request = linphone_xml_rpc_request_new_with_args("check_account", LinphoneXmlRpcArgInt,
_test_existence_cb, creator,
LinphoneXmlRpcArgString, identity,
LinphoneXmlRpcArgNone);
linphone_xml_rpc_session_send_request(creator->xmlrpc_session, request);
linphone_xml_rpc_request_unref(request);
ms_free(identity);
return LinphoneAccountCreatorOk;
}
static void _test_validation_cb(LinphoneXmlRpcRequest *request, void *user_data) {
LinphoneAccountCreator *creator = (LinphoneAccountCreator *)user_data;
if (creator->validation_test_cb != NULL) {
LinphoneAccountCreatorStatus status = LinphoneAccountCreatorFailed;
if ((linphone_xml_rpc_request_get_status(request) == LinphoneXmlRpcStatusOk)
&& (linphone_xml_rpc_request_get_int_response(request) == 1)) {
status = LinphoneAccountCreatorOk;
}
creator->validation_test_cb(creator, status, creator->validation_test_cb_ud);
}
}
LinphoneAccountCreatorStatus linphone_account_creator_test_validation(LinphoneAccountCreator *creator) {
LinphoneXmlRpcRequest *request;
char *identity;
if (!creator->username || !creator->domain) return LinphoneAccountCreatorFailed;
identity = ms_strdup_printf("%s@%s", creator->username, creator->domain);
request = linphone_xml_rpc_request_new_with_args("check_account_validated", LinphoneXmlRpcArgInt,
_test_validation_cb, creator,
LinphoneXmlRpcArgString, identity,
LinphoneXmlRpcArgNone);
linphone_xml_rpc_session_send_request(creator->xmlrpc_session, request);
linphone_xml_rpc_request_unref(request);
ms_free(identity);
return LinphoneAccountCreatorOk;
}
static void _validate_cb(LinphoneXmlRpcRequest *request, void *user_data) {
LinphoneAccountCreator *creator = (LinphoneAccountCreator *)user_data;
if (creator->validate_cb != NULL) {
LinphoneAccountCreatorStatus status = LinphoneAccountCreatorFailed;
if ((linphone_xml_rpc_request_get_status(request) == LinphoneXmlRpcStatusOk)
&& (linphone_xml_rpc_request_get_int_response(request) == 0)) {
status = LinphoneAccountCreatorOk;
}
creator->validate_cb(creator, status, creator->validate_cb_ud);
}
}
LinphoneAccountCreatorStatus linphone_account_creator_validate(LinphoneAccountCreator *creator) {
LinphoneXmlRpcRequest *request;
char *identity;
if (!creator->username || !creator->domain) return LinphoneAccountCreatorFailed;
identity = ms_strdup_printf("%s@%s", creator->username, creator->domain);
request = linphone_xml_rpc_request_new_with_args("create_account", LinphoneXmlRpcArgInt,
_validate_cb, creator,
LinphoneXmlRpcArgString, identity,
LinphoneXmlRpcArgString, creator->password,
LinphoneXmlRpcArgString, creator->email,
LinphoneXmlRpcArgInt, (creator->subscribe_to_newsletter == TRUE) ? 1 : 0,
LinphoneXmlRpcArgNone);
linphone_xml_rpc_session_send_request(creator->xmlrpc_session, request);
linphone_xml_rpc_request_unref(request);
ms_free(identity);
return LinphoneAccountCreatorOk;
}
LinphoneProxyConfig * linphone_account_creator_configure(const LinphoneAccountCreator *creator) {
LinphoneAddress *identity;
LinphoneAuthInfo *info;
LinphoneProxyConfig *cfg = linphone_core_create_proxy_config(creator->core);
char *identity_str = ms_strdup_printf("sip:%s@%s", creator->username, creator->domain);
linphone_proxy_config_set_identity(cfg, identity_str);
linphone_proxy_config_set_server_addr(cfg, creator->domain);
linphone_proxy_config_set_route(cfg, creator->route);
linphone_proxy_config_enable_publish(cfg, FALSE);
linphone_proxy_config_enable_register(cfg, TRUE);
ms_free(identity_str);
if (strcmp(creator->domain, "sip.linphone.org") == 0) {
linphone_proxy_config_enable_avpf(cfg, TRUE);
// If account created on sip.linphone.org, we configure linphone to use TLS by default
if (linphone_core_sip_transport_supported(creator->core, LinphoneTransportTls)) {
LinphoneAddress *addr = linphone_address_new(linphone_proxy_config_get_server_addr(cfg));
char *tmp;
linphone_address_set_transport(addr, LinphoneTransportTls);
tmp = linphone_address_as_string(addr);
linphone_proxy_config_set_server_addr(cfg, tmp);
linphone_proxy_config_set_route(cfg, tmp);
ms_free(tmp);
linphone_address_destroy(addr);
}
linphone_core_set_stun_server(creator->core, "stun.linphone.org");
linphone_core_set_firewall_policy(creator->core, LinphonePolicyUseIce);
}
identity = linphone_address_new(linphone_proxy_config_get_identity(cfg));
info = linphone_auth_info_new(linphone_address_get_username(identity), NULL, creator->password, NULL, NULL, linphone_address_get_domain(identity));
linphone_core_add_auth_info(creator->core, info);
linphone_address_destroy(identity);
if (linphone_core_add_proxy_config(creator->core, cfg) != -1) {
linphone_core_set_default_proxy(creator->core, cfg);
return cfg;
}
linphone_core_remove_auth_info(creator->core, info);
linphone_proxy_config_unref(cfg);
return NULL;
}
void linphone_account_creator_destroy(LinphoneAccountCreator *creator){
linphone_xml_rpc_session_unref(creator->xmlrpc_session);
if (creator->username) ms_free(creator->username);
if (creator->password) ms_free(creator->password);
if (creator->domain) ms_free(creator->domain);
if (creator->route) ms_free(creator->route);
if (creator->email) ms_free(creator->email);
ms_free(creator);
}

215
coreapi/account_creator.h Normal file
View file

@ -0,0 +1,215 @@
/*
account_creator.h
Copyright (C) 2010-2015 Belledonne Communications SARL
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 2
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef LINPHONE_ACCOUNT_CREATOR_H_
#define LINPHONE_ACCOUNT_CREATOR_H_
#ifdef __cplusplus
extern "C" {
#endif
/**
* @addtogroup misc
* @{
*/
/**
* Enum describing the status of a LinphoneAccountCreator operation.
**/
typedef enum _LinphoneAccountCreatorStatus {
LinphoneAccountCreatorOk,
LinphoneAccountCreatorFailed
} LinphoneAccountCreatorStatus;
/**
* The LinphoneAccountCreator object used to create an account on a server via XML-RPC.
**/
typedef struct _LinphoneAccountCreator LinphoneAccountCreator;
/**
* Callback used to notify the end of a LinphoneAccountCreator operation.
* @param[in] creator LinphoneAccountCreator object
* @param[in] status The status of the LinphoneAccountCreator operation that has just finished
* @param user_data A user data given when setting the callback.
**/
typedef void (*LinphoneAccountCreatorCb)(LinphoneAccountCreator *creator, LinphoneAccountCreatorStatus status, void *user_data);
/**
* Create a LinphoneAccountCreator.
* @param[in] core The LinphoneCore used for the XML-RPC communication
* @param[in] xmlrpc_url The URL to the XML-RPC server
* @return The new LinphoneAccountCreator object
**/
LINPHONE_PUBLIC LinphoneAccountCreator * linphone_account_creator_new(LinphoneCore *core, const char *xmlrpc_url);
/**
* Destroy a LinphoneAccountCreator.
* @param[in] creator LinphoneAccountCreator object
* @param
**/
LINPHONE_PUBLIC void linphone_account_creator_destroy(LinphoneAccountCreator *creator);
/**
* Set the username.
* @param[in] creator LinphoneAccountCreator object
* @param[in] username The username to set
**/
LINPHONE_PUBLIC void linphone_account_creator_set_username(LinphoneAccountCreator *creator, const char *username);
/**
* Get the username.
* @param[in] creator LinphoneAccountCreator object
* @return The username of the LinphoneAccountCreator
**/
LINPHONE_PUBLIC const char * linphone_account_creator_get_username(const LinphoneAccountCreator *creator);
/**
* Set the password.
* @param[in] creator LinphoneAccountCreator object
* @param[in] password The password to set
**/
LINPHONE_PUBLIC void linphone_account_creator_set_password(LinphoneAccountCreator *creator, const char *password);
/**
* Get the password.
* @param[in] creator LinphoneAccountCreator object
* @return The password of the LinphoneAccountCreator
**/
LINPHONE_PUBLIC const char * linphone_account_creator_get_password(const LinphoneAccountCreator *creator);
/**
* Set the domain.
* @param[in] creator LinphoneAccountCreator object
* @param[in] domain The domain to set
**/
LINPHONE_PUBLIC void linphone_account_creator_set_domain(LinphoneAccountCreator *creator, const char *domain);
/**
* Get the domain.
* @param[in] creator LinphoneAccountCreator object
* @return The domain of the LinphoneAccountCreator
**/
LINPHONE_PUBLIC const char * linphone_account_creator_get_domain(const LinphoneAccountCreator *creator);
/**
* Set the route.
* @param[in] creator LinphoneAccountCreator object
* @param[in] route The route to set
**/
LINPHONE_PUBLIC void linphone_account_creator_set_route(LinphoneAccountCreator *creator, const char *route);
/**
* Get the route.
* @param[in] creator LinphoneAccountCreator object
* @return The route of the LinphoneAccountCreator
**/
LINPHONE_PUBLIC const char * linphone_account_creator_get_route(const LinphoneAccountCreator *creator);
/**
* Set the email.
* @param[in] creator LinphoneAccountCreator object
* @param[in] email The email to set
**/
LINPHONE_PUBLIC void linphone_account_creator_set_email(LinphoneAccountCreator *creator, const char *email);
/**
* Get the email.
* @param[in] creator LinphoneAccountCreator object
* @return The email of the LinphoneAccountCreator
**/
LINPHONE_PUBLIC const char * linphone_account_creator_get_email(const LinphoneAccountCreator *creator);
/**
* Enable the newsletter subscription.
* @param[in] creator LinphoneAccountCreator object
* @param[in] subscribe A boolean telling whether to subscribe to the newsletter or not.
**/
LINPHONE_PUBLIC void linphone_account_creator_enable_newsletter_subscription(LinphoneAccountCreator *creator, bool_t subscribe);
/**
* Tell whether to subscribe to the newsletter or not.
* @param[in] creator LinphoneAccountCreator object
* @return A boolean telling whether to subscribe to the newsletter or not.
**/
LINPHONE_PUBLIC bool_t linphone_account_creator_newsletter_subscription_enabled(const LinphoneAccountCreator *creator);
/**
* Set the callback called when the account existence test is finished.
* @param[in] creator LinphoneAccountCreator object
* @param[in] cb The callback called when the account existence test is finished
* @param[in] user_data The user data passed to the callback
**/
LINPHONE_PUBLIC void linphone_account_creator_set_test_existence_cb(LinphoneAccountCreator *creator, LinphoneAccountCreatorCb cb, void *user_data);
/**
* Set the callback called when the account validation test is finished.
* @param[in] creator LinphoneAccountCreator object
* @param[in] cb The callback called when the account validation test is finished
* @param[in] user_data The user data passed to the callback
**/
LINPHONE_PUBLIC void linphone_account_creator_set_test_validation_cb(LinphoneAccountCreator *creator, LinphoneAccountCreatorCb cb, void *user_data);
/**
* Set the callback called when the account creation is finished.
* @param[in] creator LinphoneAccountCreator object
* @param[in] cb The callback called when the account creation is finished
* @param[in] user_data The user data passed to the callback
**/
LINPHONE_PUBLIC void linphone_account_creator_set_validate_cb(LinphoneAccountCreator *creator, LinphoneAccountCreatorCb cb, void *user_data);
/**
* Send an XML-RPC request to test the existence of a Linphone account.
* @param[in] creator LinphoneAccountCreator object
* @return LinphoneAccountCreatorOk if the request has been sent, LinphoneAccountCreatorFailed otherwise
**/
LINPHONE_PUBLIC LinphoneAccountCreatorStatus linphone_account_creator_test_existence(LinphoneAccountCreator *creator);
/**
* Send an XML-RPC request to test the validation of a Linphone account.
* @param[in] creator LinphoneAccountCreator object
* @return LinphoneAccountCreatorOk if the request has been sent, LinphoneAccountCreatorFailed otherwise
**/
LINPHONE_PUBLIC LinphoneAccountCreatorStatus linphone_account_creator_test_validation(LinphoneAccountCreator *creator);
/**
* Send an XML-RPC request to create a Linphone account.
* @param[in] creator LinphoneAccountCreator object
* @return LinphoneAccountCreatorOk if the request has been sent, LinphoneAccountCreatorFailed otherwise
**/
LINPHONE_PUBLIC LinphoneAccountCreatorStatus linphone_account_creator_validate(LinphoneAccountCreator *creator);
/**
* Configure an account (create a proxy config and authentication info for it).
* @param[in] creator LinphoneAccountCreator object
* @return A LinphoneProxyConfig object if successful, NULL otherwise
**/
LINPHONE_PUBLIC LinphoneProxyConfig * linphone_account_creator_configure(const LinphoneAccountCreator *creator);
/**
* @}
*/
#ifdef __cplusplus
}
#endif
#endif /* LINPHONE_ACCOUNT_CREATOR_H_ */

View file

@ -373,6 +373,7 @@ LINPHONE_PUBLIC const char* linphone_privacy_to_string(LinphonePrivacy privacy);
#include "content.h"
#include "event.h"
#include "linphonefriend.h"
#include "xmlrpc.h"
#else
#include "linphone/buffer.h"
#include "linphone/call_log.h"
@ -380,6 +381,7 @@ LINPHONE_PUBLIC const char* linphone_privacy_to_string(LinphonePrivacy privacy);
#include "linphone/content.h"
#include "linphone/event.h"
#include "linphone/linphonefriend.h"
#include "linphone/xmlrpc.h"
#endif
LINPHONE_PUBLIC LinphoneAddress * linphone_address_new(const char *addr);
@ -1177,32 +1179,6 @@ LINPHONE_PUBLIC void linphone_proxy_config_set_custom_header(LinphoneProxyConfig
* @}
**/
typedef struct _LinphoneAccountCreator{
LinphoneCore *lc;
struct _SipSetupContext *ssctx;
char *username;
char *password;
char *domain;
char *route;
char *email;
int suscribe;
bool_t succeeded;
}LinphoneAccountCreator;
LINPHONE_PUBLIC LinphoneAccountCreator *linphone_account_creator_new(LinphoneCore *core, const char *type);
LINPHONE_PUBLIC void linphone_account_creator_set_username(LinphoneAccountCreator *obj, const char *username);
LINPHONE_PUBLIC void linphone_account_creator_set_password(LinphoneAccountCreator *obj, const char *password);
LINPHONE_PUBLIC void linphone_account_creator_set_domain(LinphoneAccountCreator *obj, const char *domain);
LINPHONE_PUBLIC void linphone_account_creator_set_route(LinphoneAccountCreator *obj, const char *route);
LINPHONE_PUBLIC void linphone_account_creator_set_email(LinphoneAccountCreator *obj, const char *email);
LINPHONE_PUBLIC void linphone_account_creator_set_suscribe(LinphoneAccountCreator *obj, int suscribre);
LINPHONE_PUBLIC const char * linphone_account_creator_get_username(LinphoneAccountCreator *obj);
LINPHONE_PUBLIC const char * linphone_account_creator_get_domain(LinphoneAccountCreator *obj);
LINPHONE_PUBLIC int linphone_account_creator_test_existence(LinphoneAccountCreator *obj);
LINPHONE_PUBLIC int linphone_account_creator_test_validation(LinphoneAccountCreator *obj);
LINPHONE_PUBLIC LinphoneProxyConfig * linphone_account_creator_validate(LinphoneAccountCreator *obj);
LINPHONE_PUBLIC void linphone_account_creator_destroy(LinphoneAccountCreator *obj);
struct _LinphoneAuthInfo;
/**
@ -1358,6 +1334,13 @@ LINPHONE_PUBLIC LinphoneAuthInfo * linphone_auth_info_new_from_config_file(LpCon
*/
#ifdef IN_LINPHONE
#include "account_creator.h"
#else
#include "linphone/account_creator.h"
#endif
struct _LinphoneChatRoom;
/**
* @addtogroup chatroom

View file

@ -979,6 +979,42 @@ struct _LinphoneBuffer {
BELLE_SIP_DECLARE_VPTR(LinphoneBuffer);
/*****************************************************************************
* XML-RPC interface *
****************************************************************************/
typedef struct _LinphoneXmlRpcArg {
LinphoneXmlRpcArgType type;
union {
int i;
char *s;
} data;
} LinphoneXmlRpcArg;
struct _LinphoneXmlRpcRequest {
belle_sip_object_t base;
void *user_data;
belle_sip_list_t *arg_list;
char *content; /**< The string representation of the XML-RPC request */
char *method;
LinphoneXmlRpcResponseCb cb;
void *cb_ud;
LinphoneXmlRpcStatus status;
LinphoneXmlRpcArg response;
};
BELLE_SIP_DECLARE_VPTR(LinphoneXmlRpcRequest);
struct _LinphoneXmlRpcSession {
belle_sip_object_t base;
void *user_data;
LinphoneCore *core;
char *url;
};
BELLE_SIP_DECLARE_VPTR(LinphoneXmlRpcSession);
/*****************************************************************************
* REMOTE PROVISIONING FUNCTIONS *
****************************************************************************/
@ -1083,7 +1119,9 @@ BELLE_SIP_TYPE_ID(LinphoneContent),
BELLE_SIP_TYPE_ID(LinphoneLDAPContactProvider),
BELLE_SIP_TYPE_ID(LinphoneLDAPContactSearch),
BELLE_SIP_TYPE_ID(LinphoneProxyConfig),
BELLE_SIP_TYPE_ID(LinphoneFriend)
BELLE_SIP_TYPE_ID(LinphoneFriend),
BELLE_SIP_TYPE_ID(LinphoneXmlRpcRequest),
BELLE_SIP_TYPE_ID(LinphoneXmlRpcSession)
BELLE_SIP_DECLARE_TYPES_END

View file

@ -1504,98 +1504,6 @@ SipSetupContext *linphone_proxy_config_get_sip_setup_context(LinphoneProxyConfig
* @}
**/
LinphoneAccountCreator *linphone_account_creator_new(struct _LinphoneCore *core, const char *type){
LinphoneAccountCreator *obj;
LinphoneProxyConfig *cfg;
SipSetup *ss=sip_setup_lookup(type);
SipSetupContext *ssctx;
if (!ss){
return NULL;
}
if (!(sip_setup_get_capabilities(ss) & SIP_SETUP_CAP_ACCOUNT_MANAGER)){
ms_error("%s cannot manage accounts.",type);
return NULL;
}
obj=ms_new0(LinphoneAccountCreator,1);
cfg=linphone_proxy_config_new();
ssctx=sip_setup_context_new(ss,cfg);
obj->lc=core;
obj->ssctx=ssctx;
set_string(&obj->domain,sip_setup_context_get_domains(ssctx)[0]);
cfg->lc=core;
return obj;
}
void linphone_account_creator_set_username(LinphoneAccountCreator *obj, const char *username){
set_string(&obj->username,username);
}
void linphone_account_creator_set_password(LinphoneAccountCreator *obj, const char *password){
set_string(&obj->password,password);
}
void linphone_account_creator_set_domain(LinphoneAccountCreator *obj, const char *domain){
set_string(&obj->domain,domain);
}
void linphone_account_creator_set_route(LinphoneAccountCreator *obj, const char *route) {
set_string(&obj->route,route);
}
void linphone_account_creator_set_email(LinphoneAccountCreator *obj, const char *email) {
set_string(&obj->email,email);
}
void linphone_account_creator_set_suscribe(LinphoneAccountCreator *obj, int suscribe) {
obj->suscribe = suscribe;
}
const char * linphone_account_creator_get_username(LinphoneAccountCreator *obj){
return obj->username;
}
const char * linphone_account_creator_get_domain(LinphoneAccountCreator *obj){
return obj->domain;
}
int linphone_account_creator_test_existence(LinphoneAccountCreator *obj){
SipSetupContext *ssctx=obj->ssctx;
char *uri=ms_strdup_printf("%s@%s",obj->username,obj->domain);
int err=sip_setup_context_account_exists(ssctx,uri);
ms_free(uri);
return err;
}
int linphone_account_creator_test_validation(LinphoneAccountCreator *obj) {
SipSetupContext *ssctx=obj->ssctx;
int err=sip_setup_context_account_validated(ssctx,obj->username);
return err;
}
LinphoneProxyConfig * linphone_account_creator_validate(LinphoneAccountCreator *obj){
SipSetupContext *ssctx=obj->ssctx;
char *uri=ms_strdup_printf("%s@%s",obj->username,obj->domain);
int err=sip_setup_context_create_account(ssctx, uri, obj->password, obj->email, obj->suscribe);
ms_free(uri);
if (err==0) {
obj->succeeded=TRUE;
return sip_setup_context_get_proxy_config(ssctx);
}
return NULL;
}
void linphone_account_creator_destroy(LinphoneAccountCreator *obj){
if (obj->username)
ms_free(obj->username);
if (obj->password)
ms_free(obj->password);
if (obj->domain)
ms_free(obj->domain);
if (!obj->succeeded){
linphone_proxy_config_destroy(sip_setup_context_get_proxy_config(obj->ssctx));
}
}
void linphone_proxy_config_set_user_data(LinphoneProxyConfig *cfg, void *ud) {
cfg->user_data = ud;
}

View file

@ -24,14 +24,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "linphonecore.h"
extern SipSetup linphone_sip_login;
#ifdef BUILD_WIZARD
extern SipSetup linphone_sip_wizard;
#endif
static SipSetup *all_sip_setups[]={
&linphone_sip_login,
#ifdef BUILD_WIZARD
&linphone_sip_wizard,
#endif
NULL
};

View file

@ -31,10 +31,13 @@ struct _SipSetup;
struct _BuddyInfo;
struct _LinphoneXmlRpcSession;
struct _SipSetupContext{
struct _SipSetup *funcs;
struct _LinphoneProxyConfig *cfg;
struct _LinphoneXmlRpcSession *xmlrpc_session;
char domain[128];
char username[128];
void *data;

View file

@ -1,266 +0,0 @@
/*
sipwizard.c
Copyright (C) 2011 Belledonne Communication, Grenoble, France
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 2
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "linphonecore.h"
#include "private.h"
#include <ctype.h>
#include <libsoup/soup.h>
typedef struct _BLReq{
int status;
int result;
SoupMessage *msg;
SoupSession *session;
ortp_thread_t th;
}BLReq;
static const int XMLRPC_FAILED = -1;
static const int XMLRPC_OK = 0;
static const char *XMLRPC_URL = "https://www.linphone.org/wizard.php";
static void sip_wizard_init_instance(SipSetupContext *ctx){
LinphoneProxyConfig *cfg=sip_setup_context_get_proxy_config(ctx);
/*disable registration until the user logs in*/
linphone_proxy_config_enable_register(cfg,FALSE);
}
static const char ** sip_wizard_get_domains(SipSetupContext *ctx) {
LinphoneProxyConfig *cfg=sip_setup_context_get_proxy_config(ctx);
const char **domains = (const char**) &cfg->reg_proxy;
return domains;
}
static int xml_rpc_parse_response(BLReq *blreq, SoupMessage *sm){
SoupBuffer *sb;
GValue retval;
GError *error=NULL;
sb=soup_message_body_flatten(sm->response_body);
ms_message("This the xml-rpc response:\n%s\n",sb->data);
if (soup_xmlrpc_parse_method_response(sb->data,sb->length,&retval,&error)==FALSE){
if (error!=NULL){
ms_error("xmlrpc fault: %s",error->message);
g_error_free(error);
}else{
ms_error("Could not parse xml-rpc response !");
}
blreq->status=XMLRPC_FAILED;
}else{
ms_message("Extracting values from return type...");
blreq->result = g_value_get_int(&retval);
g_value_unset(&retval);
blreq->status=XMLRPC_OK;
}
soup_buffer_free(sb);
return blreq->status;
}
static void got_headers(BLReq *blreq, SoupMessage*msg){
ms_message("Got headers !");
blreq->status=XMLRPC_OK;
}
#if SERIALIZE_HTTPS
/*on windows libsoup support for threads with gnutls is not yet functionnal (only in git)
This will come in next release of libsoup, probably.
In the meantime, we are forced to serialize all soup https processing with a big
ugly global mutex...*/
static GStaticMutex big_mutex = G_STATIC_MUTEX_INIT;
#endif
static void * process_xml_rpc_request(void *up){
BLReq *blreq=(BLReq*)up;
SoupMessage *sm=blreq->msg;
int code;
g_signal_connect_swapped(G_OBJECT(sm),"got-headers",(GCallback)got_headers,blreq);
blreq->status=XMLRPC_OK;
#if SERIALIZE_HTTPS
g_static_mutex_lock(&big_mutex);
#endif
code=soup_session_send_message(blreq->session,sm);
if (code==200){
xml_rpc_parse_response(blreq,sm);
}else{
ms_error("request failed, error-code=%i (%s)",code,soup_status_get_phrase(code));
blreq->status=XMLRPC_FAILED;
}
#if SERIALIZE_HTTPS
g_static_mutex_unlock(&big_mutex);
#endif
return NULL;
}
static int do_simple_xmlrpc_request(SoupMessage *msg) {
int ret=-1;
BLReq *req;
if (!msg){
ms_error("Fail to create SoupMessage !");
return -1;
}else{
SoupBuffer *sb=soup_message_body_flatten(msg->request_body);
ms_message("This is the XML-RPC request we are going to send:\n%s\n",sb->data);
soup_buffer_free(sb);
}
req=ms_new0(BLReq, 1);
req->session=soup_session_sync_new();
req->msg=msg;
process_xml_rpc_request(req);
if (req->status == XMLRPC_OK) {
ret=req->result;
}
// Freeing allocated structures lead to a crash (why?)
//g_free(req->session);
//g_free(msg);
ms_free(req);
return ret;
}
/*
* Return 1 if account already exists
* 0 if account doesn't exists
* -1 if information isn't available
*/
static int sip_wizard_account_exists(SipSetupContext *ctx, const char *identity) {
SoupMessage *msg=soup_xmlrpc_request_new(XMLRPC_URL,
"check_account",
G_TYPE_STRING, identity,
G_TYPE_INVALID);
return do_simple_xmlrpc_request(msg);
}
static int sip_wizard_account_validated(SipSetupContext *ctx, const char *identity) {
SoupMessage *msg=soup_xmlrpc_request_new(XMLRPC_URL,
"check_account_validated",
G_TYPE_STRING, identity,
G_TYPE_INVALID);
return do_simple_xmlrpc_request(msg);
}
static int sip_wizard_create_account(SipSetupContext *ctx, const char *identity, const char *passwd, const char *email, int suscribe) {
SoupMessage *msg=soup_xmlrpc_request_new(XMLRPC_URL,
"create_account",
G_TYPE_STRING, identity,
G_TYPE_STRING, passwd,
G_TYPE_STRING, email,
G_TYPE_INT, suscribe,
G_TYPE_INVALID);
return do_simple_xmlrpc_request(msg);
}
static void guess_display_name(LinphoneAddress *from){
const char *username=linphone_address_get_username(from);
char *dn=(char*)ms_malloc(strlen(username)+1);
const char *it;
char *wptr=dn;
bool_t begin=TRUE;
bool_t surname=FALSE;
for(it=username;*it!='\0';++it){
if (begin){
*wptr=toupper(*it);
begin=FALSE;
}else if (*it=='.'){
if (surname) break;
*wptr=' ';
begin=TRUE;
surname=TRUE;
}else {
*wptr=*it;
}
wptr++;
}
*wptr='\0';
linphone_address_set_display_name(from,dn);
ms_free(dn);
}
static int sip_wizard_do_login(SipSetupContext * ctx, const char *uri, const char *passwd, const char *userid){
LinphoneProxyConfig *cfg=sip_setup_context_get_proxy_config(ctx);
LinphoneCore *lc=linphone_proxy_config_get_core(cfg);
LinphoneAuthInfo *auth;
LinphoneAddress *parsed_uri;
char *tmp;
parsed_uri=linphone_address_new(uri);
if (parsed_uri==NULL){
return -1;
}
if (linphone_address_get_display_name(parsed_uri)!=NULL){
guess_display_name(parsed_uri);
}
tmp=linphone_address_as_string(parsed_uri);
linphone_proxy_config_set_identity(cfg,tmp);
if (passwd) {
auth=linphone_auth_info_new(linphone_address_get_username(parsed_uri),NULL,passwd,NULL,NULL,NULL);
linphone_core_add_auth_info(lc,auth);
}
linphone_proxy_config_enable_register(cfg,TRUE);
linphone_proxy_config_done(cfg);
ms_free(tmp);
linphone_address_destroy(parsed_uri);
return 0;
}
/* a simple SipSetup built-in plugin to allow creating accounts at runtime*/
#ifndef _MSC_VER
SipSetup linphone_sip_wizard={
.name="SipWizard",
.capabilities=SIP_SETUP_CAP_ACCOUNT_MANAGER,
.init_instance=sip_wizard_init_instance,
.account_exists=sip_wizard_account_exists,
.create_account=sip_wizard_create_account,
.login_account=sip_wizard_do_login,
.get_domains=sip_wizard_get_domains,
.account_validated=sip_wizard_account_validated
};
#else
SipSetup linphone_sip_wizard={
"SipWizard",
SIP_SETUP_CAP_ACCOUNT_MANAGER,
0,
NULL,
NULL,
sip_wizard_init_instance,
NULL,
sip_wizard_account_exists,
sip_wizard_create_account,
sip_wizard_do_login,
NULL,
NULL,
NULL,
NULL,
sip_wizard_get_domains,
NULL,
NULL,
sip_wizard_account_validated
};
#endif

379
coreapi/xmlrpc.c Normal file
View file

@ -0,0 +1,379 @@
/*
linphone
Copyright (C) 2010-2015 Belledonne Communications SARL
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 2
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "linphonecore.h"
#include "private.h"
#include <string.h>
#include <libxml/tree.h>
#include <libxml/xmlwriter.h>
static void format_request(LinphoneXmlRpcRequest *request) {
char si[64];
belle_sip_list_t *arg_ptr = request->arg_list;
xmlBufferPtr buf;
xmlTextWriterPtr writer;
int err;
if (request->content != NULL) {
belle_sip_free(request->content);
request->content = NULL;
}
buf = xmlBufferCreate();
if (buf == NULL) {
ms_error("Error creating the XML buffer");
return;
}
writer = xmlNewTextWriterMemory(buf, 0);
if (writer == NULL) {
ms_error("Error creating the XML writer");
return;
}
err = xmlTextWriterStartDocument(writer, "1.0", "UTF-8", NULL);
if (err >= 0) {
err = xmlTextWriterStartElement(writer, (const xmlChar *)"methodCall");
}
if (err >= 0) {
err = xmlTextWriterWriteElement(writer, (const xmlChar *)"methodName", (const xmlChar *)request->method);
}
if (err >= 0) {
err = xmlTextWriterStartElement(writer, (const xmlChar *)"params");
}
while (arg_ptr != NULL) {
LinphoneXmlRpcArg *arg = (LinphoneXmlRpcArg *)arg_ptr->data;
if (err >= 0) {
err = xmlTextWriterStartElement(writer, (const xmlChar *)"param");
}
if (err >= 0) {
err = xmlTextWriterStartElement(writer, (const xmlChar *)"value");
}
switch (arg->type) {
case LinphoneXmlRpcArgNone:
break;
case LinphoneXmlRpcArgInt:
memset(si, 0, sizeof(si));
snprintf(si, sizeof(si), "%i", arg->data.i);
err = xmlTextWriterWriteElement(writer, (const xmlChar *)"int", (const xmlChar *)si);
break;
case LinphoneXmlRpcArgString:
err = xmlTextWriterWriteElement(writer, (const xmlChar *)"string", (const xmlChar *)arg->data.s);
break;
}
if (err >= 0) {
/* Close the "value" element. */
err = xmlTextWriterEndElement(writer);
}
if (err >= 0) {
/* Close the "param" element. */
err = xmlTextWriterEndElement(writer);
}
arg_ptr = arg_ptr->next;
}
if (err >= 0) {
/* Close the "params" element. */
err = xmlTextWriterEndElement(writer);
}
if (err >= 0) {
/* Close the "methodCall" element. */
err = xmlTextWriterEndElement(writer);
}
if (err >= 0) {
err = xmlTextWriterEndDocument(writer);
}
if (err > 0) {
/* xmlTextWriterEndDocument returns the size of the content. */
request->content = belle_sip_strdup((const char *)buf->content);
}
xmlFreeTextWriter(writer);
xmlBufferFree(buf);
}
static void free_arg(LinphoneXmlRpcArg *arg) {
if ((arg->type == LinphoneXmlRpcArgString) && (arg->data.s != NULL)) {
belle_sip_free(arg->data.s);
}
belle_sip_free(arg);
}
static void process_io_error_from_post_xml_rpc_request(void *data, const belle_sip_io_error_event_t *event) {
LinphoneXmlRpcRequest *request = (LinphoneXmlRpcRequest *)data;
ms_error("I/O Error during XML-RPC request sending");
request->status = LinphoneXmlRpcStatusFailed;
if (request->cb != NULL) {
request->cb(request, request->cb_ud);
}
linphone_xml_rpc_request_unref(request);
}
static void process_auth_requested_from_post_xml_rpc_request(void *data, belle_sip_auth_event_t *event) {
LinphoneXmlRpcRequest *request = (LinphoneXmlRpcRequest *)data;
ms_error("Authentication error during XML-RPC request sending");
request->status = LinphoneXmlRpcStatusFailed;
if (request->cb != NULL) {
request->cb(request, request->cb_ud);
}
linphone_xml_rpc_request_unref(request);
}
static void parse_valid_xml_rpc_response(LinphoneXmlRpcRequest *request, const char *response_body) {
xmlparsing_context_t *xml_ctx = linphone_xmlparsing_context_new();
xmlSetGenericErrorFunc(xml_ctx, linphone_xmlparsing_genericxml_error);
request->status = LinphoneXmlRpcStatusFailed;
xml_ctx->doc = xmlReadDoc((const unsigned char*)response_body, 0, NULL, 0);
if (xml_ctx->doc != NULL) {
const char *response_str;
if (linphone_create_xml_xpath_context(xml_ctx) < 0) goto end;
switch (request->response.type) {
case LinphoneXmlRpcArgInt:
response_str = linphone_get_xml_text_content(xml_ctx, "/methodResponse/params/param/value/int");
if (response_str != NULL) {
request->response.data.i = atoi(response_str);
request->status = LinphoneXmlRpcStatusOk;
}
break;
case LinphoneXmlRpcArgString:
response_str = linphone_get_xml_text_content(xml_ctx, "/methodResponse/params/param/value/string");
if (response_str != NULL) {
request->response.data.s = belle_sip_strdup(response_str);
request->status = LinphoneXmlRpcStatusOk;
}
break;
default:
break;
}
linphone_free_xml_text_content(response_str);
} else {
ms_warning("Wrongly formatted XML-RPC response: %s", xml_ctx->errorBuffer);
}
end:
linphone_xmlparsing_context_destroy(xml_ctx);
if (request->cb != NULL) {
request->cb(request, request->cb_ud);
}
}
static void notify_xml_rpc_error(LinphoneXmlRpcRequest *request) {
request->status = LinphoneXmlRpcStatusOk;
if (request->cb != NULL) {
request->cb(request, request->cb_ud);
}
}
static void process_response_from_post_xml_rpc_request(void *data, const belle_http_response_event_t *event) {
LinphoneXmlRpcRequest *request = (LinphoneXmlRpcRequest *)data;
/* Check the answer code */
if (event->response) {
int code = belle_http_response_get_status_code(event->response);
if (code == 200) { /* Valid response from the server. */
parse_valid_xml_rpc_response(request, belle_sip_message_get_body((belle_sip_message_t *)event->response));
} else {
notify_xml_rpc_error(request);
}
}
linphone_xml_rpc_request_unref(request);
}
static LinphoneXmlRpcRequest * _linphone_xml_rpc_request_new(const char *method, LinphoneXmlRpcArgType return_type, LinphoneXmlRpcResponseCb cb, void *user_data) {
LinphoneXmlRpcRequest *request = belle_sip_object_new(LinphoneXmlRpcRequest);
belle_sip_object_ref(request);
request->status = LinphoneXmlRpcStatusPending;
request->response.type = return_type;
request->method = belle_sip_strdup(method);
request->cb = cb;
request->cb_ud = user_data;
return request;
}
static void _linphone_xml_rpc_request_add_int_arg(LinphoneXmlRpcRequest *request, int value) {
LinphoneXmlRpcArg *arg = belle_sip_malloc0(sizeof(LinphoneXmlRpcArg));
arg->type = LinphoneXmlRpcArgInt;
arg->data.i = value;
request->arg_list = belle_sip_list_append(request->arg_list, arg);
}
static void _linphone_xml_rpc_request_add_string_arg(LinphoneXmlRpcRequest *request, const char *value) {
LinphoneXmlRpcArg *arg = belle_sip_malloc0(sizeof(LinphoneXmlRpcArg));
arg->type = LinphoneXmlRpcArgString;
arg->data.s = belle_sip_strdup(value);
request->arg_list = belle_sip_list_append(request->arg_list, arg);
}
static void _linphone_xml_rpc_request_destroy(LinphoneXmlRpcRequest *request) {
belle_sip_list_free_with_data(request->arg_list, (void (*)(void*))free_arg);
if ((request->response.type == LinphoneXmlRpcArgString) && (request->response.data.s != NULL)) {
belle_sip_free(request->response.data.s);
}
if (request->content) belle_sip_free(request->content);
belle_sip_free(request->method);
}
static void _linphone_xml_rpc_session_destroy(LinphoneXmlRpcSession *session) {
belle_sip_free(session->url);
}
BELLE_SIP_DECLARE_NO_IMPLEMENTED_INTERFACES(LinphoneXmlRpcRequest);
BELLE_SIP_DECLARE_NO_IMPLEMENTED_INTERFACES(LinphoneXmlRpcSession);
BELLE_SIP_INSTANCIATE_VPTR(LinphoneXmlRpcRequest, belle_sip_object_t,
(belle_sip_object_destroy_t)_linphone_xml_rpc_request_destroy,
NULL, // clone
NULL, // marshal
TRUE
);
BELLE_SIP_INSTANCIATE_VPTR(LinphoneXmlRpcSession, belle_sip_object_t,
(belle_sip_object_destroy_t)_linphone_xml_rpc_session_destroy,
NULL, // clone
NULL, // marshal
TRUE
);
LinphoneXmlRpcRequest * linphone_xml_rpc_request_new(const char *method, LinphoneXmlRpcArgType return_type, LinphoneXmlRpcResponseCb cb, void *user_data) {
LinphoneXmlRpcRequest *request = _linphone_xml_rpc_request_new(method, return_type, cb, user_data);
format_request(request);
return request;
}
LinphoneXmlRpcRequest * linphone_xml_rpc_request_new_with_args(const char *method, LinphoneXmlRpcArgType return_type, LinphoneXmlRpcResponseCb cb, void *user_data, ...) {
bool_t cont = TRUE;
va_list args;
LinphoneXmlRpcArgType arg_type;
LinphoneXmlRpcRequest *request = _linphone_xml_rpc_request_new(method, return_type, cb, user_data);
va_start(args, cb);
while (cont) {
arg_type = va_arg(args, LinphoneXmlRpcArgType);
switch (arg_type) {
case LinphoneXmlRpcArgNone:
cont = FALSE;
break;
case LinphoneXmlRpcArgInt:
_linphone_xml_rpc_request_add_int_arg(request, va_arg(args, int));
break;
case LinphoneXmlRpcArgString:
_linphone_xml_rpc_request_add_string_arg(request, va_arg(args, char *));
break;
}
}
va_end(args);
format_request(request);
return request;
}
LinphoneXmlRpcRequest * linphone_xml_rpc_request_ref(LinphoneXmlRpcRequest *request) {
belle_sip_object_ref(request);
return request;
}
void linphone_xml_rpc_request_unref(LinphoneXmlRpcRequest *request) {
belle_sip_object_unref(request);
}
void *linphone_xml_rpc_request_get_user_data(const LinphoneXmlRpcRequest *request) {
return request->user_data;
}
void linphone_xml_rpc_request_set_user_data(LinphoneXmlRpcRequest *request, void *ud) {
request->user_data = ud;
}
void linphone_xml_rpc_request_add_int_arg(LinphoneXmlRpcRequest *request, int value) {
_linphone_xml_rpc_request_add_int_arg(request, value);
format_request(request);
}
void linphone_xml_rpc_request_add_string_arg(LinphoneXmlRpcRequest *request, const char *value) {
_linphone_xml_rpc_request_add_string_arg(request, value);
format_request(request);
}
const char * linphone_xml_rpc_request_get_content(const LinphoneXmlRpcRequest *request) {
return request->content;
}
LinphoneXmlRpcStatus linphone_xml_rpc_request_get_status(const LinphoneXmlRpcRequest *request) {
return request->status;
}
int linphone_xml_rpc_request_get_int_response(const LinphoneXmlRpcRequest *request) {
return request->response.data.i;
}
const char * linphone_xml_rpc_request_get_string_response(const LinphoneXmlRpcRequest *request) {
return request->response.data.s;
}
LinphoneXmlRpcSession * linphone_xml_rpc_session_new(LinphoneCore *core, const char *url) {
LinphoneXmlRpcSession *session = belle_sip_object_new(LinphoneXmlRpcSession);
belle_sip_object_ref(session);
session->core = core;
session->url = belle_sip_strdup(url);
return session;
}
LinphoneXmlRpcSession * linphone_xml_rpc_session_ref(LinphoneXmlRpcSession *session) {
belle_sip_object_ref(session);
return session;
}
void linphone_xml_rpc_session_unref(LinphoneXmlRpcSession *session) {
belle_sip_object_unref(session);
}
void *linphone_xml_rpc_session_get_user_data(const LinphoneXmlRpcSession *session) {
return session->user_data;
}
void linphone_xml_rpc_session_set_user_data(LinphoneXmlRpcSession *session, void *ud) {
session->user_data = ud;
}
void linphone_xml_rpc_session_send_request(LinphoneXmlRpcSession *session, LinphoneXmlRpcRequest *request) {
belle_http_request_listener_callbacks_t cbs = { 0 };
belle_http_request_listener_t *l;
belle_generic_uri_t *uri;
belle_http_request_t *req;
belle_sip_memory_body_handler_t *bh;
const char *data;
LinphoneContent *content;
linphone_xml_rpc_request_ref(request);
content = linphone_content_new();
linphone_content_set_type(content, "text");
linphone_content_set_subtype(content, "xml");
linphone_content_set_string_buffer(content, linphone_xml_rpc_request_get_content(request));
uri = belle_generic_uri_parse(session->url);
req = belle_http_request_create("POST", uri, belle_sip_header_content_type_create("text", "xml"), NULL);
data = linphone_xml_rpc_request_get_content(request);
bh = belle_sip_memory_body_handler_new_copy_from_buffer(data, strlen(data), NULL, NULL);
belle_sip_message_set_body_handler(BELLE_SIP_MESSAGE(req), BELLE_SIP_BODY_HANDLER(bh));
cbs.process_response = process_response_from_post_xml_rpc_request;
cbs.process_io_error = process_io_error_from_post_xml_rpc_request;
cbs.process_auth_requested = process_auth_requested_from_post_xml_rpc_request;
l = belle_http_request_listener_create_from_callbacks(&cbs, request);
belle_http_provider_send_request(session->core->http_provider, req, l);
linphone_content_unref(content);
}

212
coreapi/xmlrpc.h Normal file
View file

@ -0,0 +1,212 @@
/*
xmlrpc.h
Copyright (C) 2010-2015 Belledonne Communications SARL
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 2
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef LINPHONE_XMLRPC_H_
#define LINPHONE_XMLRPC_H_
#ifdef __cplusplus
extern "C" {
#endif
/**
* @addtogroup misc
* @{
*/
/**
* Enum describing the types of argument for LinphoneXmlRpcRequest.
**/
typedef enum _LinphoneXmlRpcArgType {
LinphoneXmlRpcArgNone,
LinphoneXmlRpcArgInt,
LinphoneXmlRpcArgString
} LinphoneXmlRpcArgType;
/**
* Enum describing the status of a LinphoneXmlRpcRequest.
**/
typedef enum _LinphoneXmlRpcStatus {
LinphoneXmlRpcStatusPending,
LinphoneXmlRpcStatusOk,
LinphoneXmlRpcStatusFailed
} LinphoneXmlRpcStatus;
/**
* The LinphoneXmlRpcRequest object representing a XML-RPC request to be sent.
**/
typedef struct _LinphoneXmlRpcRequest LinphoneXmlRpcRequest;
/**
* The LinphoneXmlRpcSession object used to send XML-RPC requests and handle their responses.
**/
typedef struct _LinphoneXmlRpcSession LinphoneXmlRpcSession;
/**
* Callback used to notify the response to an XML-RPC request.
* @param[in] request LinphoneXmlRpcRequest object
* @param[in] user_data A user data given when setting the callback upon creation of the XML-RPC request.
**/
typedef void (*LinphoneXmlRpcResponseCb)(LinphoneXmlRpcRequest *request, void *user_data);
/**
* Create a new LinphoneXmlRpcRequest object.
* @param[in] method The XML-RPC method to call.
* @param[in] return_type The expected XML-RPC response type.
* @param[in] cb The callback that will be called when the XML-RPC response is received or if an error occurs.
* @param[in] user_data A user data that will be passed as a parameter to the callback.
* @return A new LinphoneXmlRpcRequest object.
**/
LINPHONE_PUBLIC LinphoneXmlRpcRequest * linphone_xml_rpc_request_new(const char *method, LinphoneXmlRpcArgType return_type,
LinphoneXmlRpcResponseCb cb, void *user_data);
/**
* Create a new LinphoneXmlRpcRequest object giving the arguments to the method call.
* @param[in] method The XML-RPC method to call.
* @param[in] return_type The expected XML-RPC response type.
* @param[in] cb The callback that will be called when the XML-RPC response is received or if an error occurs.
* @param[in] user_data A user data that will be passed as a parameter to the callback.
* @return A new LinphoneXmlRpcRequest object.
**/
LINPHONE_PUBLIC LinphoneXmlRpcRequest * linphone_xml_rpc_request_new_with_args(const char *method, LinphoneXmlRpcArgType return_type,
LinphoneXmlRpcResponseCb cb, void *user_data, ...);
/**
* Acquire a reference to the XML-RPC request.
* @param[in] request LinphoneXmlRpcRequest object.
* @return The same LinphoneXmlRpcRequest object.
**/
LINPHONE_PUBLIC LinphoneXmlRpcRequest * linphone_xml_rpc_request_ref(LinphoneXmlRpcRequest *request);
/**
* Release reference to the XML-RPC request.
* @param[in] request LinphoneXmlRpcRequest object.
**/
LINPHONE_PUBLIC void linphone_xml_rpc_request_unref(LinphoneXmlRpcRequest *request);
/**
* Retrieve the user pointer associated with the XML-RPC request.
* @param[in] request LinphoneXmlRpcRequest object.
* @return The user pointer associated with the XML-RPC request.
**/
LINPHONE_PUBLIC void *linphone_xml_rpc_request_get_user_data(const LinphoneXmlRpcRequest *request);
/**
* Assign a user pointer to the XML-RPC request.
* @param[in] request LinphoneXmlRpcRequest object.
* @param[in] ud The user pointer to associate with the XML-RPC request.
**/
LINPHONE_PUBLIC void linphone_xml_rpc_request_set_user_data(LinphoneXmlRpcRequest *request, void *ud);
/**
* Add an integer argument to an XML-RPC request.
* @param[in] request LinphoneXmlRpcRequest object.
* @param[in] value The integer value of the added argument.
**/
LINPHONE_PUBLIC void linphone_xml_rpc_request_add_int_arg(LinphoneXmlRpcRequest *request, int value);
/**
* Add a string argument to an XML-RPC request.
* @param[in] request LinphoneXmlRpcRequest object.
* @param[in] value The string value of the added argument.
**/
LINPHONE_PUBLIC void linphone_xml_rpc_request_add_string_arg(LinphoneXmlRpcRequest *request, const char *value);
/**
* Get the content of the XML-RPC request.
* @param[in] request LinphoneXmlRpcRequest object.
* @return The string representation of the content of the XML-RPC request.
*/
LINPHONE_PUBLIC const char * linphone_xml_rpc_request_get_content(const LinphoneXmlRpcRequest *request);
/**
* Get the status of the XML-RPC request.
* @param[in] request LinphoneXmlRpcRequest object.
* @return The status of the XML-RPC request.
**/
LINPHONE_PUBLIC LinphoneXmlRpcStatus linphone_xml_rpc_request_get_status(const LinphoneXmlRpcRequest *request);
/**
* Get the response to an XML-RPC request sent with linphone_xml_rpc_session_send_request() and returning an integer response.
* @param[in] request LinphoneXmlRpcRequest object.
* @return The integer response to the XML-RPC request.
**/
LINPHONE_PUBLIC int linphone_xml_rpc_request_get_int_response(const LinphoneXmlRpcRequest *request);
/**
* Get the response to an XML-RPC request sent with linphone_xml_rpc_session_send_request() and returning a string response.
* @param[in] request LinphoneXmlRpcRequest object.
* @return The string response to the XML-RPC request.
**/
LINPHONE_PUBLIC const char * linphone_xml_rpc_request_get_string_response(const LinphoneXmlRpcRequest *request);
/**
* Create a new LinphoneXmlRpcSession object.
* @param[in] core The LinphoneCore object used to send the XML-RPC requests.
* @param[in] url The URL of the XML-RPC server to send the XML-RPC requests to.
* @return A new LinphoneXmlRpcSession object.
*/
LINPHONE_PUBLIC LinphoneXmlRpcSession * linphone_xml_rpc_session_new(LinphoneCore *core, const char *url);
/**
* Acquire a reference to the XML-RPC session.
* @param[in] session LinphoneXmlRpcSession object.
* @return The same LinphoneXmlRpcSession object.
**/
LINPHONE_PUBLIC LinphoneXmlRpcSession * linphone_xml_rpc_session_ref(LinphoneXmlRpcSession *session);
/**
* Release reference to the XML-RPC session.
* @param[in] session LinphoneXmlRpcSession object.
**/
LINPHONE_PUBLIC void linphone_xml_rpc_session_unref(LinphoneXmlRpcSession *session);
/**
* Retrieve the user pointer associated with the XML-RPC session.
* @param[in] session LinphoneXmlRpcSession object.
* @return The user pointer associated with the XML-RPC session.
**/
LINPHONE_PUBLIC void *linphone_xml_rpc_session_get_user_data(const LinphoneXmlRpcSession *session);
/**
* Assign a user pointer to the XML-RPC session.
* @param[in] session LinphoneXmlRpcSession object.
* @param[in] ud The user pointer to associate with the XML-RPC session.
**/
LINPHONE_PUBLIC void linphone_xml_rpc_session_set_user_data(LinphoneXmlRpcSession *session, void *ud);
/**
* Send an XML-RPC request.
* @param[in] session LinphoneXmlRpcSession object.
* @param[in] request The LinphoneXmlRpcRequest to be sent.
**/
LINPHONE_PUBLIC void linphone_xml_rpc_session_send_request(LinphoneXmlRpcSession *session, LinphoneXmlRpcRequest *request);
/**
* @}
*/
#ifdef __cplusplus
}
#endif
#endif /* LINPHONE_XMLRPC_H_ */

View file

@ -63,6 +63,7 @@ set(SOURCE_FILES
loginframe.c
main.c
propertybox.c
setupwizard.c
singleinstance.c
status_icon.c
status_notifier.c
@ -75,10 +76,6 @@ if(WIN32)
list(APPEND SOURCE_FILES linphone.rc)
endif()
if(ENABLE_ASSISTANT)
list(APPEND SOURCE_FILES setupwizard.c)
endif()
if(GETTEXT_FOUND)
add_definitions("-DENABLE_NLS")
endif()
@ -101,9 +98,6 @@ if(ENABLE_NOTIFY)
target_include_directories(linphone-gtk PUBLIC ${NOTIFY_INCLUDE_DIRS})
target_link_libraries(linphone-gtk ${NOTIFY_LIBRARIES})
endif()
if(ENABLE_ASSISTANT)
target_link_libraries(linphone-gtk ${SOUP_LIBRARIES})
endif()
install(TARGETS linphone-gtk
RUNTIME DESTINATION bin

View file

@ -53,6 +53,7 @@ linphone_SOURCES= \
singleinstance.c \
conference.c \
config-fetching.c \
setupwizard.c \
audio_assistant.c \
videowindow.c \
status_icon.c status_icon.h \
@ -64,11 +65,6 @@ linphone_SOURCES+= \
status_notifier.h
endif
if BUILD_WIZARD
linphone_SOURCES+= \
setupwizard.c
endif
linphone_LDADD= $(top_builddir)/coreapi/liblinphone.la \
$(LIBGTK_LIBS) $(NOTIFY1_LIBS) $(NOTIFY4_LIBS) $(LIBGTKMAC_LIBS) $(INTLLIBS) $(SQLITE3_LIBS) $(BELLESIP_LIBS)

View file

@ -1979,9 +1979,7 @@ static void linphone_gtk_check_soundcards(){
static void linphone_gtk_quit_core(void){
linphone_gtk_unmonitor_usb();
g_source_remove_by_user_data(linphone_gtk_get_core());
#ifdef BUILD_WIZARD
linphone_gtk_close_assistant();
#endif
linphone_gtk_set_ldap(NULL);
linphone_gtk_destroy_log_window();
linphone_core_destroy(the_core);
@ -2021,12 +2019,10 @@ static gboolean on_block_termination(void){
static void linphone_gtk_init_ui(void){
linphone_gtk_init_main_window();
#ifdef BUILD_WIZARD
// Veryfing if at least one sip account is configured. If not, show wizard
if (linphone_core_get_proxy_config_list(linphone_gtk_get_core()) == NULL) {
linphone_gtk_show_assistant(the_ui);
}
#endif
if(run_audio_assistant){
linphone_gtk_show_audio_assistant();

View file

@ -923,6 +923,7 @@
<child>
<object class="GtkImageMenuItem" id="assistant_item">
<property name="label" translatable="yes">Account assistant</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="image">connect_image</property>
<property name="use_stock">False</property>

View file

@ -9,7 +9,6 @@
<property name="modal">True</property>
<property name="window_position">center-on-parent</property>
<property name="type_hint">dialog</property>
<property name="has_separator">False</property>
<child internal-child="vbox">
<object class="GtkVBox" id="dialog-vbox9">
<property name="visible">True</property>

View file

@ -1584,11 +1584,6 @@ void linphone_gtk_show_parameters(void){
gtk_entry_set_text(GTK_ENTRY(linphone_gtk_get_widget(pb,"username")),linphone_address_get_username(contact));
linphone_address_destroy(contact);
}
#ifdef BUILD_WIZARD
gtk_widget_show(linphone_gtk_get_widget(pb,"wizard"));
#else
gtk_widget_hide(linphone_gtk_get_widget(pb,"wizard"));
#endif
linphone_gtk_show_sip_accounts(pb);
/* CODECS CONFIG */
linphone_gtk_init_codec_list(GTK_TREE_VIEW(codec_list));

File diff suppressed because it is too large Load diff