forked from mirrors/linphone-iphone
Started vcard interface for belcard
This commit is contained in:
parent
895a1572b7
commit
528fc0a026
8 changed files with 112 additions and 4 deletions
36
configure.ac
36
configure.ac
|
|
@ -877,6 +877,39 @@ if test x$enable_tunnel = xtrue; then
|
|||
AC_DEFINE(TUNNEL_ENABLED,1,[Tells tunnel extension is built-in])
|
||||
fi
|
||||
|
||||
AC_ARG_ENABLE(vcard,
|
||||
[AS_HELP_STRING([--enable-vcard=[yes/no]], [Turn on compilation of vcard (default=auto)])],
|
||||
[case "${enableval}" in
|
||||
yes) enable_vcard=true ;;
|
||||
no) enable_vcard=false ;;
|
||||
*) AC_MSG_ERROR(bad value ${enableval} for --enable-vcard) ;;
|
||||
esac],
|
||||
[enable_vcard=auto]
|
||||
)
|
||||
|
||||
if test x$enable_vcard != xfalse; then
|
||||
PKG_CHECK_MODULES(BELCARD, belcard, [found_vcard=yes],[found_vcard=no])
|
||||
if test "$found_vcard" = "no"; then
|
||||
dnl Check the lib presence in case the PKG-CONFIG version is not found
|
||||
AC_LANG_CPLUSPLUS
|
||||
AC_CHECK_LIB(belcard, main, [BELCARD_LIBS+=" -lbelr -lbelcard"; found_vcard=yes], [foo=bar])
|
||||
AC_LANG_C
|
||||
fi
|
||||
if test "$found_vcard" = "yes"; then
|
||||
enable_vcard=true
|
||||
else
|
||||
if test x$enable_vcard = xtrue; then
|
||||
AC_MSG_ERROR([belcard, required for vcard support, not found])
|
||||
fi
|
||||
enable_vcard=false
|
||||
fi
|
||||
|
||||
AC_SUBST(BELCARD_CFLAGS)
|
||||
AC_SUBST(BELCARD_LIBS)
|
||||
fi
|
||||
|
||||
AM_CONDITIONAL(BUILD_VCARD, test x$enable_vcard = xtrue)
|
||||
|
||||
AC_ARG_ENABLE(msg-storage,
|
||||
[AS_HELP_STRING([--enable-msg-storage=[yes/no]], [Turn on compilation of message storage (default=auto)])],
|
||||
[case "${enableval}" in
|
||||
|
|
@ -1105,7 +1138,8 @@ 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
|
||||
printf "* %-30s %s\n" "Call logs storage" $enable_call_logs_storage
|
||||
printf "* %-30s %s\n" "Call logs storage" $enable_call_logs_storage
|
||||
printf "* %-30s %s\n" "VCard support" $enable_vcard
|
||||
printf "* %-30s %s\n" "IM encryption" $lime
|
||||
printf "* %-30s %s\n" "uPnP support" $build_upnp
|
||||
printf "* %-30s %s\n" "LDAP support" $enable_ldap
|
||||
|
|
|
|||
|
|
@ -114,7 +114,8 @@ else
|
|||
liblinphone_la_SOURCES+=linphone_tunnel_stubs.c linphone_tunnel.h
|
||||
endif
|
||||
|
||||
|
||||
liblinphone_la_SOURCES+=vcard.cc vcard.h
|
||||
liblinphone_la_CXXFLAGS=-std=c++11
|
||||
|
||||
liblinphone_la_LDFLAGS= -version-info $(LIBLINPHONE_SO_VERSION) -no-undefined
|
||||
|
||||
|
|
@ -142,6 +143,7 @@ liblinphone_la_LIBADD= \
|
|||
$(LIBXML2_LIBS) \
|
||||
$(LDAP_LIBS) \
|
||||
$(SASL_LIBS) \
|
||||
$(BELCARD_LIBS) \
|
||||
$(ZLIB_LIBS)
|
||||
|
||||
|
||||
|
|
@ -164,6 +166,7 @@ COMMON_CFLAGS=\
|
|||
$(LIBXML2_CFLAGS) \
|
||||
$(LDAP_CFLAGS) \
|
||||
$(SASL_CFLAGS) \
|
||||
$(BELCARD_CFLAGS) \
|
||||
$(ZLIB_CFLAGS)
|
||||
|
||||
if BUILD_WIZARD
|
||||
|
|
|
|||
|
|
@ -132,6 +132,7 @@ LinphoneFriend * linphone_friend_new(){
|
|||
obj->pol=LinphoneSPAccept;
|
||||
obj->presence=NULL;
|
||||
obj->subscribe=TRUE;
|
||||
obj->vcard = NULL;
|
||||
return obj;
|
||||
}
|
||||
|
||||
|
|
@ -290,6 +291,7 @@ static void _linphone_friend_destroy(LinphoneFriend *lf){
|
|||
if (lf->presence != NULL) linphone_presence_model_unref(lf->presence);
|
||||
if (lf->uri!=NULL) linphone_address_destroy(lf->uri);
|
||||
if (lf->info!=NULL) buddy_info_free(lf->info);
|
||||
if (lf->vcard != NULL) linphone_vcard_free(lf->vcard);
|
||||
}
|
||||
|
||||
static belle_sip_error_code _linphone_friend_marshall(belle_sip_object_t *obj, char* buff, size_t buff_size, size_t *offset) {
|
||||
|
|
@ -726,6 +728,17 @@ void linphone_friend_destroy(LinphoneFriend *lf) {
|
|||
linphone_friend_unref(lf);
|
||||
}
|
||||
|
||||
LinphoneVCard* linphone_friend_get_vcard(LinphoneFriend *fr) {
|
||||
return fr->vcard;
|
||||
}
|
||||
|
||||
void linphone_friend_set_vcard(LinphoneFriend *fr, LinphoneVCard *vcard) {
|
||||
if (fr->vcard) {
|
||||
linphone_vcard_free(fr->vcard);
|
||||
}
|
||||
fr->vcard = vcard;
|
||||
}
|
||||
|
||||
BELLE_SIP_DECLARE_NO_IMPLEMENTED_INTERFACES(LinphoneFriend);
|
||||
|
||||
BELLE_SIP_INSTANCIATE_VPTR(LinphoneFriend, belle_sip_object_t,
|
||||
|
|
|
|||
|
|
@ -4232,7 +4232,6 @@ LINPHONE_PUBLIC const char* linphone_transport_to_string(LinphoneTransportType t
|
|||
**/
|
||||
LINPHONE_PUBLIC LinphoneTransportType linphone_transport_parse(const char* transport);
|
||||
|
||||
|
||||
/**
|
||||
* @ingroup media_parameters
|
||||
* Get default call parameters reflecting current linphone core configuration
|
||||
|
|
@ -4242,7 +4241,6 @@ LINPHONE_PUBLIC LinphoneTransportType linphone_transport_parse(const char* trans
|
|||
*/
|
||||
LINPHONE_PUBLIC LINPHONE_DEPRECATED LinphoneCallParams *linphone_core_create_default_call_parameters(LinphoneCore *lc);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#define LINPHONEFRIEND_H_
|
||||
|
||||
#include "linphonepresence.h"
|
||||
#include "vcard.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
|
@ -411,6 +412,16 @@ LINPHONE_PUBLIC void linphone_friend_unref(LinphoneFriend *lf);
|
|||
* Returns the LinphoneCore object managing this friend, if any.
|
||||
*/
|
||||
LINPHONE_PUBLIC LinphoneCore *linphone_friend_get_core(const LinphoneFriend *fr);
|
||||
|
||||
/**
|
||||
* Returns the VCard object associated to this friend, if any
|
||||
*/
|
||||
LINPHONE_PUBLIC LinphoneVCard* linphone_friend_get_vcard(LinphoneFriend *fr);
|
||||
|
||||
/**
|
||||
* Returns the VCard object associated to this friend, if any
|
||||
*/
|
||||
LINPHONE_PUBLIC void linphone_friend_set_vcard(LinphoneFriend *fr, LinphoneVCard *vcard);
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -653,6 +653,7 @@ struct _LinphoneFriend{
|
|||
bool_t inc_subscribe_pending;
|
||||
bool_t commit;
|
||||
bool_t initial_subscribes_sent; /*used to know if initial subscribe message was sent or not*/
|
||||
LinphoneVCard *vcard;
|
||||
};
|
||||
|
||||
BELLE_SIP_DECLARE_VPTR(LinphoneFriend);
|
||||
|
|
|
|||
27
coreapi/vcard.cc
Normal file
27
coreapi/vcard.cc
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
#include "vcard.h"
|
||||
#include "belcard/belcard.hpp"
|
||||
|
||||
struct _LinphoneVCard {
|
||||
shared_ptr<belcard::BelCard> belcard;
|
||||
};
|
||||
|
||||
extern "C" LinphoneVCard* linphone_vcard_new(void) {
|
||||
LinphoneVCard* vcard = (LinphoneVCard*) malloc(sizeof(LinphoneVCard));
|
||||
vcard->belcard = belcard::BelCardGeneric::create<belcard::BelCard>();
|
||||
return vcard;
|
||||
}
|
||||
|
||||
extern "C" void linphone_vcard_free(LinphoneVCard *vcard) {
|
||||
vcard->belcard.reset();
|
||||
free(vcard);
|
||||
}
|
||||
|
||||
extern "C" void linphone_vcard_set_full_name(LinphoneVCard *vcard, const char *name) {
|
||||
shared_ptr<belcard::BelCardFullName> fn = belcard::BelCardGeneric::create<belcard::BelCardFullName>();
|
||||
fn->setValue(name);
|
||||
vcard->belcard->setFullName(fn);
|
||||
}
|
||||
|
||||
extern "C" const char* linphone_vcard_get_full_name(LinphoneVCard *vcard) {
|
||||
return vcard->belcard->getFullName() ? vcard->belcard->getFullName()->getValue().c_str() : NULL;
|
||||
}
|
||||
21
coreapi/vcard.h
Normal file
21
coreapi/vcard.h
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
#ifndef LINPHONE_VCARD_H
|
||||
#define LINPHONE_VCARD_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
typedef struct _LinphoneVCard LinphoneVCard;
|
||||
|
||||
LinphoneVCard* linphone_vcard_new(void);
|
||||
void linphone_vcard_free(LinphoneVCard *vcard);
|
||||
|
||||
void linphone_vcard_set_full_name(LinphoneVCard *vcard, const char *name);
|
||||
const char* linphone_vcard_get_full_name(LinphoneVCard *vcard);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
Loading…
Add table
Reference in a new issue