Commit 037145b9 authored by Simon Morlat's avatar Simon Morlat

ported everything to updated liblinphone api.

parent f3737ffb
......@@ -13,7 +13,7 @@ INCLUDES = \
bin_PROGRAMS = linphonec sipomatic linphonecsh
bin_PROGRAMS = linphonec linphonecsh
if BUILD_WIN32
bin_PROGRAMS += linphoned
......
......@@ -1255,7 +1255,7 @@ linphonec_proxy_use(LinphoneCore *lc, int index)
static void
linphonec_friend_display(LinphoneFriend *fr)
{
LinphoneAddress *uri=linphone_address_clone(linphone_friend_get_uri(fr));
LinphoneAddress *uri=linphone_address_clone(linphone_friend_get_address(fr));
char *str;
linphonec_out("name: %s\n", linphone_address_get_display_name(uri));
......@@ -1280,7 +1280,7 @@ linphonec_friend_list(LinphoneCore *lc, char *pat)
{
if ( pat ) {
const char *name = linphone_address_get_display_name(
linphone_friend_get_uri((LinphoneFriend*)friend->data));
linphone_friend_get_address((LinphoneFriend*)friend->data));
if (name && ! strstr(name, pat) ) continue;
}
linphonec_out("****** Friend %i *******\n",n);
......@@ -1302,7 +1302,7 @@ linphonec_friend_call(LinphoneCore *lc, unsigned int num)
if ( n == num )
{
int ret;
addr = linphone_address_as_string(linphone_friend_get_uri((LinphoneFriend*)friend->data));
addr = linphone_address_as_string(linphone_friend_get_address((LinphoneFriend*)friend->data));
ret=lpc_cmd_call(lc, addr);
ms_free(addr);
return ret;
......@@ -1376,16 +1376,15 @@ static int lpc_cmd_register(LinphoneCore *lc, char *args){
return 1;
}
if (passwd[0]!='\0'){
osip_from_t *from;
LinphoneAddress *from;
LinphoneAuthInfo *info;
osip_from_init(&from);
if (osip_from_parse(from,identity)==0){
if ((from=linphone_address_new(identity))!=NULL){
char realm[128];
snprintf(realm,sizeof(realm)-1,"\"%s\"",from->url->host);
info=linphone_auth_info_new(from->url->username,NULL,passwd,NULL,NULL);
snprintf(realm,sizeof(realm)-1,"\"%s\"",linphone_address_get_domain(from));
info=linphone_auth_info_new(linphone_address_get_username(from),NULL,passwd,NULL,NULL);
linphone_core_add_auth_info(lc,info);
linphone_address_destroy(from);
}
osip_from_free(from);
}
elem=linphone_core_get_proxy_config_list(lc);
if (elem) {
......
......@@ -119,8 +119,7 @@ static void linphonec_display_something (LinphoneCore * lc, const char *somethin
static void linphonec_display_url (LinphoneCore * lc, const char *something, const char *url);
static void linphonec_display_warning (LinphoneCore * lc, const char *something);
static void stub () {}
static void linphonec_notify_received(LinphoneCore *lc,LinphoneFriend *fid,
const char *from, const char *status, const char *img);
static void linphonec_notify_received(LinphoneCore *lc,LinphoneFriend *fid);
static void linphonec_new_unknown_subscriber(LinphoneCore *lc,
LinphoneFriend *lf, const char *url);
static void linphonec_bye_received(LinphoneCore *lc, const char *from);
......@@ -283,10 +282,11 @@ linphonec_prompt_for_auth(LinphoneCore *lc, const char *realm, const char *usern
* Linphone core callback
*/
static void
linphonec_notify_received(LinphoneCore *lc,LinphoneFriend *fid,
const char *from, const char *status, const char *img)
linphonec_notify_received(LinphoneCore *lc,LinphoneFriend *fid)
{
printf("Friend %s is %s\n", from, status);
char *tmp=linphone_address_as_string(linphone_friend_get_address(fid));
printf("Friend %s is %s\n", tmp, linphone_online_status_to_string(linphone_friend_get_status(fid)));
ms_free(tmp);
// todo: update Friend list state (unimplemented)
}
......
......@@ -50,6 +50,24 @@ LinphoneAuthInfo *linphone_auth_info_new(const char *username, const char *useri
return obj;
}
/**
* Returns username.
**/
const char *linphone_auth_info_get_username(const LinphoneAuthInfo *i){
return i->username;
}
/**
* Returns password.
**/
const char *linphone_auth_info_get_passwd(const LinphoneAuthInfo *i){
return i->passwd;
}
const char *linphone_auth_info_get_userid(const LinphoneAuthInfo *i){
return i->userid;
}
/**
* Sets the password.
**/
......
......@@ -140,8 +140,9 @@ void __linphone_friend_do_subscribe(LinphoneFriend *fr){
}else from=linphone_core_get_primary_contact(fr->lc);
if (fr->outsub==NULL){
/* people for which we don't have yet an answer should appear as offline */
fr->status=LINPHONE_STATUS_OFFLINE;
if (fr->lc->vtable.notify_recv)
fr->lc->vtable.notify_recv(fr->lc,(LinphoneFriend*)fr,friend,_("Gone"),"sip-closed.png");
fr->lc->vtable.notify_recv(fr->lc,(LinphoneFriend*)fr);
}else{
sal_op_release(fr->outsub);
fr->outsub=NULL;
......@@ -169,6 +170,10 @@ LinphoneFriend *linphone_friend_new_with_addr(const char *addr){
return fr;
}
bool_t linphone_friend_in_list(const LinphoneFriend *lf){
return lf->lc!=NULL;
}
void linphone_core_interpret_friend_uri(LinphoneCore *lc, const char *uri, char **result){
LinphoneAddress *fr=NULL;
*result=NULL;
......@@ -304,7 +309,7 @@ void linphone_friend_destroy(LinphoneFriend *lf){
ms_free(lf);
}
const LinphoneAddress *linphone_friend_get_uri(const LinphoneFriend *lf){
const LinphoneAddress *linphone_friend_get_address(const LinphoneFriend *lf){
return lf->uri;
}
......
......@@ -175,7 +175,7 @@ LinphoneOnlineStatus linphone_friend_get_status(const LinphoneFriend *lf);
BuddyInfo * linphone_friend_get_info(const LinphoneFriend *lf);
void linphone_friend_set_ref_key(LinphoneFriend *lf, const char *key);
const char *linphone_friend_get_ref_key(const LinphoneFriend *lf);
#define linphone_friend_in_list(lf) ((lf)->lc!=NULL)
bool_t linphone_friend_in_list(const LinphoneFriend *lf);
#define linphone_friend_url(lf) ((lf)->url)
......@@ -218,18 +218,15 @@ void linphone_proxy_config_set_dial_prefix(LinphoneProxyConfig *cfg, const char
bool_t linphone_proxy_config_is_registered(const LinphoneProxyConfig *obj);
const char *linphone_proxy_config_get_domain(const LinphoneProxyConfig *cfg);
/** Returns the proxy configured identity as a const char * */
#define linphone_proxy_config_get_route(obj) ((obj)->reg_route)
/** Returns the proxy configured identity as a const char * */
#define linphone_proxy_config_get_identity(obj) ((obj)->reg_identity)
#define linphone_proxy_config_publish_enabled(obj) ((obj)->publish)
/** Returns the proxy sip address as const char * */
#define linphone_proxy_config_get_addr(obj) ((obj)->reg_proxy)
/** Returns the 'expire' time of the registration */
#define linphone_proxy_config_get_expires(obj) ((obj)->expires)
/** Returns TRUE if registration is enabled, FALSE otherwise */
#define linphone_proxy_config_register_enabled(obj) ((obj)->reg_sendregister)
#define linphone_proxy_config_get_core(obj) ((obj)->lc)
const char *linphone_proxy_config_get_route(const LinphoneProxyConfig *obj);
const char *linphone_proxy_config_get_identity(const LinphoneProxyConfig *obj);
bool_t linphone_proxy_config_publish_enabled(const LinphoneProxyConfig *obj);
const char *linphone_proxy_config_get_addr(const LinphoneProxyConfig *obj);
int linphone_proxy_config_get_expires(const LinphoneProxyConfig *obj);
bool_t linphone_proxy_config_register_enabled(const LinphoneProxyConfig *obj);
struct _LinphoneCore * linphone_proxy_config_get_core(const LinphoneProxyConfig *obj);
bool_t linphone_proxy_config_get_dial_escape_plus(const LinphoneProxyConfig *cfg);
const char * linphone_proxy_config_get_dial_prefix(const LinphoneProxyConfig *cfg);
......@@ -295,6 +292,11 @@ LinphoneAuthInfo *linphone_auth_info_new(const char *username, const char *useri
void linphone_auth_info_set_passwd(LinphoneAuthInfo *info, const char *passwd);
void linphone_auth_info_set_username(LinphoneAuthInfo *info, const char *username);
void linphone_auth_info_set_userid(LinphoneAuthInfo *info, const char *userid);
const char *linphone_auth_info_get_username(const LinphoneAuthInfo *i);
const char *linphone_auth_info_get_passwd(const LinphoneAuthInfo *i);
const char *linphone_auth_info_get_userid(const LinphoneAuthInfo *i);
/* you don't need those function*/
void linphone_auth_info_destroy(LinphoneAuthInfo *info);
LinphoneAuthInfo * linphone_auth_info_new_from_config_file(struct _LpConfig *config, int pos);
......@@ -371,7 +373,7 @@ typedef void (*DisplayQuestionCb)(struct _LinphoneCore *lc, const char *message)
/** Callback prototype */
typedef void (*LinphoneCoreCbFunc)(struct _LinphoneCore *lc,void * user_data);
/** Callback prototype */
typedef void (*NotifyReceivedCb)(struct _LinphoneCore *lc, LinphoneFriend * fid, const char *url, const char *status, const char *img);
typedef void (*NotifyReceivedCb)(struct _LinphoneCore *lc, LinphoneFriend * fid);
/** Callback prototype */
typedef void (*NewUnknownSubscriberCb)(struct _LinphoneCore *lc, LinphoneFriend *lf, const char *url);
/** Callback prototype */
......
......@@ -88,8 +88,6 @@ void linphone_subscription_new(LinphoneCore *lc, SalOp *op, const char *from){
}
void linphone_notify_recv(LinphoneCore *lc, SalOp *op, SalSubscribeState ss, SalPresenceStatus sal_status){
const char *status=_("Gone");
const char *img="sip-closed.png";
char *tmp;
LinphoneFriend *lf;
LinphoneAddress *friend=NULL;
......@@ -97,49 +95,31 @@ void linphone_notify_recv(LinphoneCore *lc, SalOp *op, SalSubscribeState ss, Sal
switch(sal_status){
case SalPresenceOffline:
status=_("Gone");
img="sip-closed.png";
estatus=LINPHONE_STATUS_OFFLINE;
break;
case SalPresenceOnline:
status=_("Online");
img="sip-online.png";
estatus=LINPHONE_STATUS_ONLINE;
break;
case SalPresenceBusy:
status=_("Busy");
img="sip-busy.png";
estatus=LINPHONE_STATUS_BUSY;
break;
case SalPresenceBerightback:
status=_("Away");
img="sip-away.png";
estatus=LINPHONE_STATUS_AWAY;
break;
case SalPresenceAway:
status=_("Away");
img="sip-away.png";
estatus=LINPHONE_STATUS_AWAY;
break;
case SalPresenceOnthephone:
status=_("On The Phone");
img="sip-otp.png";
estatus=LINPHONE_STATUS_ONTHEPHONE;
break;
case SalPresenceOuttolunch:
status=_("Out To Lunch");
img="sip-otl.png";
estatus=LINPHONE_STATUS_OUTTOLUNCH;
break;
case SalPresenceDonotdisturb:
status=_("Busy");
img="sip-busy.png";
estatus=LINPHONE_STATUS_BUSY;
break;
case SalPresenceMoved:
case SalPresenceAltService:
status=_("Away");
img="sip-away.png";
estatus=LINPHONE_STATUS_AWAY;
break;
}
......@@ -148,7 +128,7 @@ void linphone_notify_recv(LinphoneCore *lc, SalOp *op, SalSubscribeState ss, Sal
friend=lf->uri;
tmp=linphone_address_as_string(friend);
lf->status=estatus;
lc->vtable.notify_recv(lc,(LinphoneFriend*)lf,tmp,status,img);
lc->vtable.notify_recv(lc,(LinphoneFriend*)lf);
ms_free(tmp);
}else{
ms_message("But this person is not part of our friend list, so we don't care.");
......
......@@ -385,6 +385,53 @@ int linphone_proxy_config_send_publish(LinphoneProxyConfig *proxy,
return err;
}
/**
* Returns the route set for this proxy configuration.
**/
const char *linphone_proxy_config_get_route(const LinphoneProxyConfig *obj){
return obj->reg_route;
}
/**
* Returns the SIP identity that belongs to this proxy configuration.
*
* The SIP identity is a SIP address (Display Name <sip:username@domain> )
**/
const char *linphone_proxy_config_get_identity(const LinphoneProxyConfig *obj){
return obj->reg_identity;
}
/**
* Returns TRUE if PUBLISH request is enabled for this proxy.
**/
bool_t linphone_proxy_config_publish_enabled(const LinphoneProxyConfig *obj){
return obj->publish;
}
/**
* Returns the proxy's SIP address.
**/
const char *linphone_proxy_config_get_addr(const LinphoneProxyConfig *obj){
return obj->reg_proxy;
}
/**
* Returns the duration of registration.
**/
int linphone_proxy_config_get_expires(const LinphoneProxyConfig *obj){
return obj->expires;
}
/**
* Returns TRUE if registration to the proxy is enabled.
**/
bool_t linphone_proxy_config_register_enabled(const LinphoneProxyConfig *obj){
return obj->reg_sendregister;
}
struct _LinphoneCore * linphone_proxy_config_get_core(const LinphoneProxyConfig *obj){
return obj->lc;
}
/**
* Add a proxy configuration.
......
......@@ -39,7 +39,6 @@ typedef struct _status_picture_tab_t{
} status_picture_tab_t;
status_picture_tab_t status_picture_tab[]={
{ LINPHONE_STATUS_UNKNOWN, "sip-closed.png" },
{ LINPHONE_STATUS_ONLINE, "sip-online.png" },
{ LINPHONE_STATUS_BUSY, "sip-busy.png" },
{ LINPHONE_STATUS_BERIGHTBACK, "sip-bifm.png" },
......@@ -51,7 +50,6 @@ status_picture_tab_t status_picture_tab[]={
{ LINPHONE_STATUS_ALT_SERVICE, "sip-closed.png" },
{ LINPHONE_STATUS_OFFLINE, "sip-away.png" },
{ LINPHONE_STATUS_PENDING, "sip-wfa.png" },
{ LINPHONE_STATUS_CLOSED, "sip-closed.png" },
{ LINPHONE_STATUS_END, NULL },
};
......@@ -104,7 +102,7 @@ static void linphone_gtk_set_selection_to_uri_bar(GtkTreeView *treeview){
if (gtk_tree_selection_get_selected (select, &model, &iter))
{
gtk_tree_model_get (model, &iter,FRIEND_ID , &lf, -1);
friend=linphone_address_as_string(linphone_friend_get_uri(lf));
friend=linphone_address_as_string(linphone_friend_get_address(lf));
gtk_entry_set_text(GTK_ENTRY(linphone_gtk_get_widget(linphone_gtk_get_main_window(),"uribar")),friend);
ms_free(friend);
}
......@@ -134,8 +132,7 @@ static GtkWidget * create_presence_menu(){
GdkPixbuf *pbuf;
status_picture_tab_t *t;
for(t=status_picture_tab;t->img!=NULL;++t){
if (t->status==LINPHONE_STATUS_UNKNOWN ||
t->status==LINPHONE_STATUS_PENDING){
if (t->status==LINPHONE_STATUS_PENDING){
continue;
}
menu_item=gtk_image_menu_item_new_with_label(linphone_online_status_to_string(t->status));
......@@ -309,7 +306,7 @@ void linphone_gtk_show_friends(void){
for(itf=linphone_core_get_friend_list(core);itf!=NULL;itf=ms_list_next(itf)){
LinphoneFriend *lf=(LinphoneFriend*)itf->data;
const LinphoneAddress *f_uri=linphone_friend_get_uri(lf);
const LinphoneAddress *f_uri=linphone_friend_get_address(lf);
char *uri=linphone_address_as_string(f_uri);
const char *name=linphone_address_get_display_name(f_uri);
const char *display=name;
......@@ -376,7 +373,7 @@ void linphone_gtk_show_contact(LinphoneFriend *lf){
GtkWidget *w=linphone_gtk_create_window("contact");
char *uri;
const char *name;
const LinphoneAddress *f_uri=linphone_friend_get_uri(lf);
const LinphoneAddress *f_uri=linphone_friend_get_address(lf);
uri=linphone_address_as_string_uri_only(f_uri);
name=linphone_address_get_display_name(f_uri);
if (uri) {
......@@ -419,7 +416,7 @@ void linphone_gtk_chat_selected(GtkWidget *item){
{
char *uri;
gtk_tree_model_get (model, &iter,FRIEND_ID , &lf, -1);
uri=linphone_address_as_string(linphone_friend_get_uri(lf));
uri=linphone_address_as_string(linphone_friend_get_address(lf));
linphone_gtk_create_chatroom(uri);
ms_free(uri);
}
......
......@@ -60,6 +60,7 @@ void linphone_gtk_show_login_frame(LinphoneProxyConfig *cfg){
LinphoneAddress *from;
LinphoneCore *lc=linphone_gtk_get_core();
int nettype;
const char *passwd=NULL;
if (linphone_core_get_download_bandwidth(lc)==512 &&
......@@ -91,8 +92,9 @@ void linphone_gtk_show_login_frame(LinphoneProxyConfig *cfg){
if (linphone_address_get_username(from)[0]!='?')
gtk_entry_set_text(GTK_ENTRY(linphone_gtk_get_widget(mw,"login_username")),
linphone_address_get_username(from));
if (ai) passwd=linphone_auth_info_get_passwd(ai);
gtk_entry_set_text(GTK_ENTRY(linphone_gtk_get_widget(mw,"login_password")),
ai!=NULL ? ai->passwd : "");
passwd!=NULL ? passwd : "");
linphone_address_destroy(from);
}
......
......@@ -42,7 +42,7 @@ static GtkWidget *the_ui=NULL;
static void linphone_gtk_show(LinphoneCore *lc);
static void linphone_gtk_inv_recv(LinphoneCore *lc, const char *from);
static void linphone_gtk_bye_recv(LinphoneCore *lc, const char *from);
static void linphone_gtk_notify_recv(LinphoneCore *lc, LinphoneFriend * fid, const char *url, const char *status, const char *img);
static void linphone_gtk_notify_recv(LinphoneCore *lc, LinphoneFriend * fid);
static void linphone_gtk_new_unknown_subscriber(LinphoneCore *lc, LinphoneFriend *lf, const char *url);
static void linphone_gtk_auth_info_requested(LinphoneCore *lc, const char *realm, const char *username);
static void linphone_gtk_display_status(LinphoneCore *lc, const char *status);
......@@ -711,7 +711,7 @@ static void linphone_gtk_bye_recv(LinphoneCore *lc, const char *from){
}
static void linphone_gtk_notify_recv(LinphoneCore *lc, LinphoneFriend * fid, const char *url, const char *status, const char *img){
static void linphone_gtk_notify_recv(LinphoneCore *lc, LinphoneFriend * fid){
}
static void linphone_gtk_new_subscriber_response(GtkWidget *dialog, guint response_id, LinphoneFriend *lf){
......
oRTP @ 36773054
Subproject commit da176d2f439f990012a1bf47b39fb72070dbd580
Subproject commit 36773054c1e9a47029432a2e8540161dad426293
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment