mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-21 13:08:08 +00:00
buddylookup works pretty well.
git-svn-id: svn+ssh://svn.savannah.nongnu.org/linphone/trunk@321 3f6dc0c8-ddfe-455d-9043-3cd528dc4637
This commit is contained in:
parent
51a59d4b9d
commit
76794acc02
9 changed files with 236 additions and 148 deletions
|
|
@ -29,8 +29,6 @@
|
|||
#include "lpconfig.h"
|
||||
|
||||
extern LinphoneProxyConfig *linphone_core_get_proxy_config_from_rid(LinphoneCore *lc, int rid);
|
||||
extern void linphone_proxy_config_set_realm(LinphoneProxyConfig *cfg, const char *realm);
|
||||
extern void linphone_core_retry_proxy_register(LinphoneCore *lc, const char *realm);
|
||||
|
||||
LinphoneAuthInfo *linphone_auth_info_new(const char *username, const char *userid,
|
||||
const char *passwd, const char *ha1,const char *realm)
|
||||
|
|
@ -122,17 +120,43 @@ static bool_t key_match(const char *tmp1, const char *tmp2){
|
|||
|
||||
}
|
||||
|
||||
static char * remove_quotes(char * input){
|
||||
char *tmp;
|
||||
if (*input=='"') input++;
|
||||
tmp=strchr(input,'"');
|
||||
if (tmp) *tmp='\0';
|
||||
return input;
|
||||
}
|
||||
|
||||
static int realm_match(const char *realm1, const char *realm2){
|
||||
if (realm1==NULL && realm2==NULL) return TRUE;
|
||||
if (realm1!=NULL && realm2!=NULL){
|
||||
if (strcmp(realm1,realm2)==0) return TRUE;
|
||||
else{
|
||||
char tmp1[128];
|
||||
char tmp2[128];
|
||||
char *p1,*p2;
|
||||
strncpy(tmp1,realm1,sizeof(tmp1)-1);
|
||||
strncpy(tmp2,realm2,sizeof(tmp1)-1);
|
||||
p1=remove_quotes(tmp1);
|
||||
p2=remove_quotes(tmp2);
|
||||
return strcmp(p1,p2)==0;
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static int auth_info_compare(const void *pinfo,const void *pref){
|
||||
LinphoneAuthInfo *info=(LinphoneAuthInfo*)pinfo;
|
||||
LinphoneAuthInfo *ref=(LinphoneAuthInfo*)pref;
|
||||
if (key_match(info->realm,ref->realm) && key_match(info->username,ref->username)) return 0;
|
||||
if (realm_match(info->realm,ref->realm) && key_match(info->username,ref->username)) return 0;
|
||||
return -1;
|
||||
}
|
||||
|
||||
static int auth_info_compare_only_realm(const void *pinfo,const void *pref){
|
||||
LinphoneAuthInfo *info=(LinphoneAuthInfo*)pinfo;
|
||||
LinphoneAuthInfo *ref=(LinphoneAuthInfo*)pref;
|
||||
if (key_match(info->realm,ref->realm) ) return 0;
|
||||
if (realm_match(info->realm,ref->realm) ) return 0;
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -910,11 +910,29 @@ int linphone_core_get_sip_port(LinphoneCore *lc)
|
|||
}
|
||||
|
||||
static bool_t exosip_running=FALSE;
|
||||
static char _ua_name[64]="Linphone";
|
||||
static char _ua_version[64]=LINPHONE_VERSION;
|
||||
|
||||
static void set_user_agent(){
|
||||
char ua_string[256];
|
||||
snprintf(ua_string,sizeof(ua_string),"%s/%s (eXosip2/%s)",_ua_name,_ua_version,
|
||||
#ifdef HAVE_EXOSIP_GET_VERSION
|
||||
eXosip_get_version()
|
||||
#else
|
||||
"unknown"
|
||||
#endif
|
||||
);
|
||||
eXosip_set_user_agent(ua_string);
|
||||
}
|
||||
|
||||
void linphone_core_set_user_agent(const char *name, const char *ver){
|
||||
strncpy(_ua_name,name,sizeof(_ua_name)-1);
|
||||
strncpy(_ua_version,ver,sizeof(_ua_version));
|
||||
}
|
||||
|
||||
void linphone_core_set_sip_port(LinphoneCore *lc,int port)
|
||||
{
|
||||
const char *anyaddr;
|
||||
char ua_string[256];
|
||||
int err=0;
|
||||
if (port==lc->sip_conf.sip_port) return;
|
||||
lc->sip_conf.sip_port=port;
|
||||
|
|
@ -942,14 +960,7 @@ void linphone_core_set_sip_port(LinphoneCore *lc,int port)
|
|||
eXosip_set_rsvp_mode (lc->rsvp_enable);
|
||||
eXosip_set_rpc_mode (lc->rpc_enable);
|
||||
#endif
|
||||
snprintf(ua_string,sizeof(ua_string),"Linphone/%s (eXosip2/%s)",LINPHONE_VERSION,
|
||||
#ifdef HAVE_EXOSIP_GET_VERSION
|
||||
eXosip_get_version()
|
||||
#else
|
||||
"unknown"
|
||||
#endif
|
||||
);
|
||||
eXosip_set_user_agent(ua_string);
|
||||
set_user_agent("Linphone",LINPHONE_VERSION);
|
||||
exosip_running=TRUE;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -275,6 +275,7 @@ char *linphone_friend_get_url(LinphoneFriend *lf); /* name <sip address> */
|
|||
bool_t linphone_friend_get_send_subscribe(const LinphoneFriend *lf);
|
||||
LinphoneSubscribePolicy linphone_friend_get_inc_subscribe_policy(const LinphoneFriend *lf);
|
||||
LinphoneOnlineStatus linphone_friend_get_status(const LinphoneFriend *lf);
|
||||
#define linphone_friend_in_list(lf) ((lf)->lc!=NULL)
|
||||
|
||||
#define linphone_friend_url(lf) ((lf)->url)
|
||||
|
||||
|
|
@ -311,6 +312,7 @@ void linphone_proxy_config_edit(LinphoneProxyConfig *obj);
|
|||
int linphone_proxy_config_done(LinphoneProxyConfig *obj);
|
||||
void linphone_proxy_config_enable_publish(LinphoneProxyConfig *obj, bool_t val);
|
||||
bool_t linphone_proxy_config_is_registered(const LinphoneProxyConfig *obj);
|
||||
const char *linphone_proxy_config_get_domain(const LinphoneProxyConfig *cfg);
|
||||
#define linphone_proxy_config_get_route(obj) ((obj)->reg_route)
|
||||
#define linphone_proxy_config_get_identity(obj) ((obj)->reg_identity)
|
||||
#define linphone_proxy_config_publish_enabled(obj) ((obj)->publish)
|
||||
|
|
@ -519,7 +521,8 @@ typedef struct _LinphoneCore
|
|||
void linphone_core_enable_logs(FILE *file);
|
||||
void linphone_core_enable_logs_with_cb(OrtpLogFunc logfunc);
|
||||
void linphone_core_disable_logs(void);
|
||||
|
||||
/*sets the user-agent string in sip messages, must be set before linphone_core_new() or linphone_core_init() */
|
||||
void linphone_core_set_user_agent(const char *ua_name, const char *version);
|
||||
const char *linphone_core_get_version(void);
|
||||
|
||||
LinphoneCore *linphone_core_new(const LinphoneCoreVTable *vtable,
|
||||
|
|
|
|||
|
|
@ -44,6 +44,7 @@ void linphone_proxy_config_destroy(LinphoneProxyConfig *obj){
|
|||
if (obj->reg_identity!=NULL) ms_free(obj->reg_identity);
|
||||
if (obj->reg_route!=NULL) ms_free(obj->reg_route);
|
||||
if (obj->ssctx!=NULL) sip_setup_context_free(obj->ssctx);
|
||||
if (obj->realm!=NULL) ms_free(obj->realm);
|
||||
if (obj->type!=NULL) ms_free(obj->type);
|
||||
}
|
||||
|
||||
|
|
@ -51,6 +52,7 @@ bool_t linphone_proxy_config_is_registered(const LinphoneProxyConfig *obj){
|
|||
return obj->registered;
|
||||
}
|
||||
|
||||
#if 0
|
||||
static void linphone_proxy_config_register(LinphoneProxyConfig *obj){
|
||||
osip_message_t *msg;
|
||||
eXosip_lock();
|
||||
|
|
@ -58,6 +60,7 @@ static void linphone_proxy_config_register(LinphoneProxyConfig *obj){
|
|||
eXosip_register_send_register(obj->rid,msg);
|
||||
eXosip_unlock();
|
||||
}
|
||||
#endif
|
||||
|
||||
void linphone_proxy_config_register_again_with_updated_contact(LinphoneProxyConfig *obj, osip_message_t *orig_request, osip_message_t *last_answer){
|
||||
osip_message_t *msg;
|
||||
|
|
@ -116,7 +119,7 @@ int linphone_proxy_config_set_server_addr(LinphoneProxyConfig *obj, const char *
|
|||
|
||||
void linphone_proxy_config_set_identity(LinphoneProxyConfig *obj, const char *identity){
|
||||
int err=0;
|
||||
osip_from_t *url;
|
||||
osip_from_t *url=NULL;
|
||||
if (identity!=NULL && strlen(identity)>0){
|
||||
osip_from_init(&url);
|
||||
err=osip_from_parse(url,identity);
|
||||
|
|
@ -125,14 +128,23 @@ void linphone_proxy_config_set_identity(LinphoneProxyConfig *obj, const char *id
|
|||
osip_from_free(url);
|
||||
return;
|
||||
}
|
||||
osip_from_free(url);
|
||||
} else err=-2;
|
||||
if (obj->reg_identity!=NULL) {
|
||||
ms_free(obj->reg_identity);
|
||||
obj->reg_identity=NULL;
|
||||
}
|
||||
if (err==-2) obj->reg_identity=NULL;
|
||||
else obj->reg_identity=ms_strdup(identity);
|
||||
else {
|
||||
obj->reg_identity=ms_strdup(identity);
|
||||
if (obj->realm)
|
||||
ms_free(obj->realm);
|
||||
obj->realm=ms_strdup(url->url->host);
|
||||
}
|
||||
if (url) osip_from_free(url);
|
||||
}
|
||||
|
||||
const char *linphone_proxy_config_get_domain(const LinphoneProxyConfig *cfg){
|
||||
return cfg->realm;
|
||||
}
|
||||
|
||||
void linphone_proxy_config_set_route(LinphoneProxyConfig *obj, const char *route)
|
||||
|
|
@ -448,8 +460,7 @@ void linphone_core_set_default_proxy(LinphoneCore *lc, LinphoneProxyConfig *conf
|
|||
}
|
||||
lc->default_proxy=config;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void linphone_core_set_default_proxy_index(LinphoneCore *lc, int index){
|
||||
if (index<0) linphone_core_set_default_proxy(lc,NULL);
|
||||
|
|
@ -482,20 +493,6 @@ LinphoneProxyConfig *linphone_core_get_proxy_config_from_rid(LinphoneCore *lc, i
|
|||
else return (LinphoneProxyConfig*)elem->data;
|
||||
}
|
||||
|
||||
void linphone_core_retry_proxy_register(LinphoneCore *lc, const char *realm)
|
||||
{
|
||||
MSList *elem;
|
||||
for (elem=lc->sip_conf.proxies;elem!=NULL;elem=ms_list_next(elem)){
|
||||
LinphoneProxyConfig *cfg=(LinphoneProxyConfig*)elem->data;
|
||||
/*ms_message("linphone_core_retry_proxy_register: cfg->auth_pending=%i, cfg->realm=%s, realm=%s",
|
||||
cfg->auth_pending,cfg->realm,realm);*/
|
||||
if (cfg->auth_pending && cfg->realm!=NULL && strcmp(cfg->realm,realm)==0){
|
||||
ms_message("Restarting REGISTER request for %s.",cfg->reg_proxy);
|
||||
linphone_proxy_config_register(cfg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const MSList *linphone_core_get_proxy_config_list(const LinphoneCore *lc){
|
||||
return lc->sip_conf.proxies;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -65,6 +65,7 @@ typedef struct _BuddyInfo{
|
|||
char lastname[64];
|
||||
char displayname[64];
|
||||
char sip_uri[128];
|
||||
char email[128];
|
||||
BuddyAddress address;
|
||||
}BuddyInfo;
|
||||
|
||||
|
|
|
|||
|
|
@ -30,7 +30,6 @@ enum {
|
|||
};
|
||||
|
||||
void linphone_gtk_buddy_lookup_window_destroyed(GtkWidget *w){
|
||||
g_message("BuddyLookup window is destroyed !");
|
||||
guint tid=GPOINTER_TO_INT(g_object_get_data(G_OBJECT(w),"typing_timeout"));
|
||||
if (tid!=0){
|
||||
g_source_remove(tid);
|
||||
|
|
@ -39,7 +38,6 @@ void linphone_gtk_buddy_lookup_window_destroyed(GtkWidget *w){
|
|||
if (tid!=0){
|
||||
g_source_remove(tid);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void linphone_gtk_show_buddy_lookup_window(SipSetupContext *ctx){
|
||||
|
|
@ -76,50 +74,65 @@ void linphone_gtk_show_buddy_lookup_window(SipSetupContext *ctx){
|
|||
|
||||
gtk_tree_view_set_tooltip_column(GTK_TREE_VIEW(results),LOOKUP_RESULT_ADDRESS);
|
||||
g_object_set_data(G_OBJECT(w),"SipSetupContext",ctx);
|
||||
//g_object_weak_ref(G_OBJECT(w),(GWeakNotify)linphone_gtk_buddy_lookup_window_destroyed,w);
|
||||
g_signal_connect_swapped(G_OBJECT(results),"destroy",(GCallback)linphone_gtk_buddy_lookup_window_destroyed,w);
|
||||
g_object_weak_ref(G_OBJECT(w),(GWeakNotify)linphone_gtk_buddy_lookup_window_destroyed,w);
|
||||
//g_signal_connect_swapped(G_OBJECT(w),"destroy",(GCallback)linphone_gtk_buddy_lookup_window_destroyed,w);
|
||||
gtk_progress_bar_set_fraction(pb,0);
|
||||
gtk_progress_bar_set_text(pb,NULL);
|
||||
gtk_dialog_add_button(GTK_DIALOG(w),GTK_STOCK_CLOSE,GTK_RESPONSE_CLOSE);
|
||||
g_object_set_data(G_OBJECT(w),"last_state",GINT_TO_POINTER(-1));
|
||||
gtk_widget_show(w);
|
||||
}
|
||||
|
||||
static void enable_add_buddy_button(GtkWidget *w, gboolean val){
|
||||
gtk_widget_set_sensitive(linphone_gtk_get_widget(w,"add_buddy"),val);
|
||||
}
|
||||
|
||||
static gboolean linphone_gtk_process_buddy_lookup(GtkWidget *w){
|
||||
BuddyLookupStatus bls;
|
||||
SipSetupContext *ctx;
|
||||
int last_state;
|
||||
gchar *tmp;
|
||||
MSList *results=NULL;
|
||||
GtkProgressBar *pb=GTK_PROGRESS_BAR(linphone_gtk_get_widget(w,"progressbar"));
|
||||
ctx=(SipSetupContext*)g_object_get_data(G_OBJECT(w),"SipSetupContext");
|
||||
last_state=GPOINTER_TO_INT(g_object_get_data(G_OBJECT(w),"last_state"));
|
||||
bls=sip_setup_context_get_buddy_lookup_status(ctx);
|
||||
MSList *results=NULL;
|
||||
if (last_state==bls) return TRUE;
|
||||
switch(bls){
|
||||
case BuddyLookupNone:
|
||||
case BuddyLookupFailure:
|
||||
gtk_progress_bar_set_fraction(pb,0);
|
||||
gtk_progress_bar_set_text(pb,NULL);
|
||||
break;
|
||||
case BuddyLookupFailure:
|
||||
gtk_progress_bar_set_fraction(pb,0);
|
||||
gtk_progress_bar_set_text(pb,_("Error communicating with server."));
|
||||
break;
|
||||
case BuddyLookupConnecting:
|
||||
gtk_progress_bar_set_fraction(pb,20);
|
||||
gtk_progress_bar_set_fraction(pb,0.2);
|
||||
gtk_progress_bar_set_text(pb,_("Connecting..."));
|
||||
break;
|
||||
case BuddyLookupConnected:
|
||||
gtk_progress_bar_set_fraction(pb,40);
|
||||
gtk_progress_bar_set_fraction(pb,0.4);
|
||||
gtk_progress_bar_set_text(pb,_("Connected"));
|
||||
break;
|
||||
case BuddyLookupReceivingResponse:
|
||||
gtk_progress_bar_set_fraction(pb,80);
|
||||
gtk_progress_bar_set_fraction(pb,0.8);
|
||||
gtk_progress_bar_set_text(pb,_("Receiving data..."));
|
||||
break;
|
||||
case BuddyLookupDone:
|
||||
gtk_progress_bar_set_fraction(pb,100);
|
||||
gtk_progress_bar_set_text(pb,_("Done !"));
|
||||
sip_setup_context_get_buddy_lookup_results(ctx,&results);
|
||||
if (results){
|
||||
linphone_gtk_display_lookup_results(
|
||||
linphone_gtk_display_lookup_results(
|
||||
linphone_gtk_get_widget(w,"search_results"),
|
||||
results);
|
||||
sip_setup_context_free_results(results);
|
||||
}
|
||||
gtk_progress_bar_set_fraction(pb,1);
|
||||
tmp=g_strdup_printf(_("Found %i contact(s)"),ms_list_size(results));
|
||||
gtk_progress_bar_set_text(pb,tmp);
|
||||
g_free(tmp);
|
||||
if (results) sip_setup_context_free_results(results);
|
||||
break;
|
||||
}
|
||||
enable_add_buddy_button(w,bls==BuddyLookupDone);
|
||||
g_object_set_data(G_OBJECT(w),"last_state",GINT_TO_POINTER(bls));
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
@ -135,8 +148,10 @@ static gboolean keyword_typing_finished(GtkWidget *w){
|
|||
guint tid2;
|
||||
ctx=(SipSetupContext*)g_object_get_data(G_OBJECT(w),"SipSetupContext");
|
||||
sip_setup_context_lookup_buddy(ctx,keyword);
|
||||
tid2=g_timeout_add(250,(GSourceFunc)linphone_gtk_process_buddy_lookup,w);
|
||||
g_object_set_data(G_OBJECT(w),"buddylookup_processing",GINT_TO_POINTER(tid2));
|
||||
if (g_object_get_data(G_OBJECT(w),"buddylookup_processing")==NULL){
|
||||
tid2=g_timeout_add(20,(GSourceFunc)linphone_gtk_process_buddy_lookup,w);
|
||||
g_object_set_data(G_OBJECT(w),"buddylookup_processing",GINT_TO_POINTER(tid2));
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
|
@ -183,7 +198,7 @@ void linphone_gtk_add_buddy_from_database(GtkWidget *button){
|
|||
char *name;
|
||||
char *addr;
|
||||
LinphoneFriend *lf;
|
||||
gtk_tree_model_get (model, &iter,LOOKUP_RESULT_SIP_URI , &uri,LOOKUP_RESULT_NAME, &name -1);
|
||||
gtk_tree_model_get (model, &iter,LOOKUP_RESULT_SIP_URI , &uri,LOOKUP_RESULT_NAME, &name, -1);
|
||||
addr=g_strdup_printf("%s <%s>",name,uri);
|
||||
lf=linphone_friend_new_with_addr(addr);
|
||||
g_free(addr);
|
||||
|
|
|
|||
|
|
@ -1,115 +1,155 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
|
||||
<!--Generated with glade3 3.4.5 on Sun Mar 8 22:38:04 2009 -->
|
||||
<!--Generated with glade3 3.4.5 on Mon Mar 9 15:48:11 2009 -->
|
||||
<glade-interface>
|
||||
<widget class="GtkWindow" id="buddylookup">
|
||||
<property name="title" translatable="yes">Search people...</property>
|
||||
<child>
|
||||
<widget class="GtkFrame" id="frame1">
|
||||
<widget class="GtkDialog" id="buddylookup">
|
||||
<property name="border_width">5</property>
|
||||
<property name="title" translatable="yes">Search contacts in directory</property>
|
||||
<property name="window_position">GTK_WIN_POS_CENTER_ON_PARENT</property>
|
||||
<property name="icon">linphone2.png</property>
|
||||
<property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
|
||||
<property name="has_separator">False</property>
|
||||
<signal name="response" handler="gtk_widget_destroy"/>
|
||||
<child internal-child="vbox">
|
||||
<widget class="GtkVBox" id="dialog-vbox1">
|
||||
<property name="visible">True</property>
|
||||
<property name="border_width">5</property>
|
||||
<property name="label_xalign">0</property>
|
||||
<property name="spacing">2</property>
|
||||
<child>
|
||||
<widget class="GtkAlignment" id="alignment1">
|
||||
<widget class="GtkFrame" id="frame1">
|
||||
<property name="visible">True</property>
|
||||
<property name="left_padding">12</property>
|
||||
<property name="border_width">5</property>
|
||||
<property name="label_xalign">0</property>
|
||||
<child>
|
||||
<widget class="GtkVBox" id="vbox2">
|
||||
<widget class="GtkAlignment" id="alignment1">
|
||||
<property name="visible">True</property>
|
||||
<property name="left_padding">12</property>
|
||||
<child>
|
||||
<widget class="GtkEntry" id="keyword">
|
||||
<widget class="GtkVBox" id="vbox2">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="has_focus">True</property>
|
||||
<signal name="changed" handler="linphone_gtk_keyword_changed"/>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkScrolledWindow" id="scrolledwindow1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
|
||||
<property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
|
||||
<property name="shadow_type">GTK_SHADOW_ETCHED_IN</property>
|
||||
<child>
|
||||
<widget class="GtkTreeView" id="search_results">
|
||||
<property name="width_request">300</property>
|
||||
<property name="height_request">140</property>
|
||||
<widget class="GtkEntry" id="keyword">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="has_focus">True</property>
|
||||
<signal name="changed" handler="linphone_gtk_keyword_changed"/>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">6</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkButton" id="add_buddy">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="response_id">0</property>
|
||||
<signal name="clicked" handler="linphone_gtk_add_buddy_from_database"/>
|
||||
<child>
|
||||
<widget class="GtkHBox" id="hbox1">
|
||||
<widget class="GtkScrolledWindow" id="scrolledwindow1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
|
||||
<property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
|
||||
<property name="shadow_type">GTK_SHADOW_ETCHED_IN</property>
|
||||
<child>
|
||||
<widget class="GtkTreeView" id="search_results">
|
||||
<property name="width_request">512</property>
|
||||
<property name="height_request">140</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">6</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkProgressBar" id="progressbar">
|
||||
<property name="visible">True</property>
|
||||
<property name="activity_mode">True</property>
|
||||
<property name="show_text">True</property>
|
||||
<property name="text" translatable="yes"></property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkHButtonBox" id="hbuttonbox1">
|
||||
<property name="visible">True</property>
|
||||
<child>
|
||||
<widget class="GtkImage" id="image1">
|
||||
<widget class="GtkButton" id="add_buddy">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-add</property>
|
||||
<property name="sensitive">False</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="response_id">0</property>
|
||||
<signal name="clicked" handler="linphone_gtk_add_buddy_from_database"/>
|
||||
<child>
|
||||
<widget class="GtkHBox" id="hbox1">
|
||||
<property name="visible">True</property>
|
||||
<child>
|
||||
<widget class="GtkImage" id="image1">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-add</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label2">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Add to my list</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label2">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Add to my list</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="position">1</property>
|
||||
<property name="padding">5</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="position">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="padding">5</property>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkProgressBar" id="progressbar">
|
||||
<property name="visible">True</property>
|
||||
<property name="activity_mode">True</property>
|
||||
<property name="show_text">True</property>
|
||||
<property name="text" translatable="yes"></property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="position">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label1">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes"><b>Search somebody</b></property>
|
||||
<property name="use_markup">True</property>
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label1">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes"><b>Search somebody</b></property>
|
||||
<property name="use_markup">True</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="type">label_item</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="type">label_item</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child internal-child="action_area">
|
||||
<widget class="GtkHButtonBox" id="dialog-action_area1">
|
||||
<property name="visible">True</property>
|
||||
<property name="layout_style">GTK_BUTTONBOX_END</property>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="pack_type">GTK_PACK_END</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
|
|
|
|||
|
|
@ -364,12 +364,10 @@ void linphone_gtk_contact_ok(GtkWidget *button){
|
|||
GtkWidget *w=gtk_widget_get_toplevel(button);
|
||||
LinphoneFriend *lf=(LinphoneFriend*)g_object_get_data(G_OBJECT(w),"friend_ref");
|
||||
char *fixed_uri=NULL;
|
||||
gboolean editing=FALSE,show_presence,allow_presence;
|
||||
gboolean show_presence,allow_presence;
|
||||
const gchar *name,*uri;
|
||||
if (lf==NULL){
|
||||
lf=linphone_friend_new();
|
||||
}else{
|
||||
editing=TRUE;
|
||||
}
|
||||
name=gtk_entry_get_text(GTK_ENTRY(linphone_gtk_get_widget(w,"name")));
|
||||
uri=gtk_entry_get_text(GTK_ENTRY(linphone_gtk_get_widget(w,"sip_address")));
|
||||
|
|
@ -385,7 +383,7 @@ void linphone_gtk_contact_ok(GtkWidget *button){
|
|||
linphone_friend_set_name(lf,name);
|
||||
linphone_friend_send_subscribe(lf,show_presence);
|
||||
linphone_friend_set_inc_subscribe_policy(lf,allow_presence==TRUE ? LinphoneSPAccept : LinphoneSPDeny);
|
||||
if (editing){
|
||||
if (linphone_friend_in_list(lf)) {
|
||||
linphone_friend_done(lf);
|
||||
}else{
|
||||
linphone_core_add_friend(linphone_gtk_get_core(),lf);
|
||||
|
|
@ -394,16 +392,6 @@ void linphone_gtk_contact_ok(GtkWidget *button){
|
|||
gtk_widget_destroy(w);
|
||||
}
|
||||
|
||||
SipSetupContext* linphone_gtk_get_default_sip_setup_context(void){
|
||||
LinphoneCore *lc=linphone_gtk_get_core();
|
||||
LinphoneProxyConfig *cfg=NULL;
|
||||
linphone_core_get_default_proxy(lc,&cfg);
|
||||
if (cfg){
|
||||
return linphone_proxy_config_get_sip_setup_context(cfg);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static GtkWidget *linphone_gtk_create_contact_menu(GtkWidget *contact_list){
|
||||
GtkWidget *menu=gtk_menu_new();
|
||||
GtkWidget *menu_item;
|
||||
|
|
@ -414,7 +402,14 @@ static GtkWidget *linphone_gtk_create_contact_menu(GtkWidget *contact_list){
|
|||
GtkTreeIter iter;
|
||||
GtkTreeModel *model;
|
||||
GtkWidget *image;
|
||||
SipSetupContext* ssc=linphone_gtk_get_default_sip_setup_context();
|
||||
LinphoneCore *lc=linphone_gtk_get_core();
|
||||
LinphoneProxyConfig *cfg=NULL;
|
||||
SipSetupContext * ssc=NULL;
|
||||
|
||||
linphone_core_get_default_proxy(lc,&cfg);
|
||||
if (cfg){
|
||||
ssc=linphone_proxy_config_get_sip_setup_context(cfg);
|
||||
}
|
||||
|
||||
g_signal_connect(G_OBJECT(menu), "selection-done", G_CALLBACK (gtk_widget_destroy), NULL);
|
||||
select = gtk_tree_view_get_selection(GTK_TREE_VIEW(contact_list));
|
||||
|
|
@ -451,10 +446,11 @@ static GtkWidget *linphone_gtk_create_contact_menu(GtkWidget *contact_list){
|
|||
gtk_menu_shell_append(GTK_MENU_SHELL(menu),menu_item);
|
||||
g_signal_connect_swapped(G_OBJECT(menu_item),"activate",(GCallback)linphone_gtk_remove_contact,contact_list);
|
||||
|
||||
g_message("ssc=%p",ssc);
|
||||
if (ssc && (sip_setup_context_get_capabilities(ssc) & SIP_SETUP_CAP_BUDDY_LOOKUP)) {
|
||||
menu_item=gtk_image_menu_item_new_with_label(_("Search contact"));
|
||||
image=gtk_image_new_from_stock(GTK_STOCK_FIND,GTK_ICON_SIZE_MENU);
|
||||
gchar *tmp=g_strdup_printf(_("Add new contact from %s directory"),linphone_proxy_config_get_domain(cfg));
|
||||
menu_item=gtk_image_menu_item_new_with_label(tmp);
|
||||
g_free(tmp);
|
||||
image=gtk_image_new_from_stock(GTK_STOCK_ADD,GTK_ICON_SIZE_MENU);
|
||||
gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(menu_item),image);
|
||||
gtk_widget_show(image);
|
||||
gtk_widget_show(menu_item);
|
||||
|
|
|
|||
|
|
@ -117,6 +117,7 @@ const char *linphone_gtk_get_config_file(){
|
|||
}
|
||||
|
||||
static void linphone_gtk_init_liblinphone(const char *file){
|
||||
linphone_core_set_user_agent("Linphone", LINPHONE_VERSION);
|
||||
the_core=linphone_core_new(&vtable,file,NULL);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue