Commit 42d5c77d authored by smorlat's avatar smorlat

work in progress.



git-svn-id: svn+ssh://svn.savannah.nongnu.org/linphone/trunk@312 3f6dc0c8-ddfe-455d-9043-3cd528dc4637
parent 38b376d8
...@@ -137,7 +137,7 @@ static int auth_info_compare_only_realm(const void *pinfo,const void *pref){ ...@@ -137,7 +137,7 @@ static int auth_info_compare_only_realm(const void *pinfo,const void *pref){
} }
LinphoneAuthInfo *linphone_core_auth_info_find(LinphoneCore *lc, const char *realm, const char *username) LinphoneAuthInfo *linphone_core_find_auth_info(LinphoneCore *lc, const char *realm, const char *username)
{ {
LinphoneAuthInfo ref; LinphoneAuthInfo ref;
MSList *elem; MSList *elem;
...@@ -198,6 +198,10 @@ void linphone_core_remove_auth_info(LinphoneCore *lc, LinphoneAuthInfo *info){ ...@@ -198,6 +198,10 @@ void linphone_core_remove_auth_info(LinphoneCore *lc, LinphoneAuthInfo *info){
} }
const MSList *linphone_core_get_auth_info_list(const LinphoneCore *lc){
return lc->auth_info;
}
void linphone_core_clear_all_auth_info(LinphoneCore *lc){ void linphone_core_clear_all_auth_info(LinphoneCore *lc){
MSList *elem; MSList *elem;
int i; int i;
...@@ -235,9 +239,9 @@ void linphone_authentication_ok(LinphoneCore *lc, eXosip_event_t *ev){ ...@@ -235,9 +239,9 @@ void linphone_authentication_ok(LinphoneCore *lc, eXosip_event_t *ev){
} }
/* see if we already have this auth information , not to ask it everytime to the user */ /* see if we already have this auth information , not to ask it everytime to the user */
if (prx_realm!=NULL) if (prx_realm!=NULL)
as=linphone_core_auth_info_find(lc,prx_realm,username); as=linphone_core_find_auth_info(lc,prx_realm,username);
if (www_realm!=NULL) if (www_realm!=NULL)
as=linphone_core_auth_info_find(lc,www_realm,username); as=linphone_core_find_auth_info(lc,www_realm,username);
if (as){ if (as){
ms_message("Authentication for user=%s realm=%s is working.",username,prx_realm ? prx_realm : www_realm); ms_message("Authentication for user=%s realm=%s is working.",username,prx_realm ? prx_realm : www_realm);
as->works=TRUE; as->works=TRUE;
...@@ -247,7 +251,7 @@ void linphone_authentication_ok(LinphoneCore *lc, eXosip_event_t *ev){ ...@@ -247,7 +251,7 @@ void linphone_authentication_ok(LinphoneCore *lc, eXosip_event_t *ev){
void linphone_core_find_or_ask_for_auth_info(LinphoneCore *lc,const char *username,const char* realm, int tid) void linphone_core_find_or_ask_for_auth_info(LinphoneCore *lc,const char *username,const char* realm, int tid)
{ {
LinphoneAuthInfo *as=linphone_core_auth_info_find(lc,realm,username); LinphoneAuthInfo *as=linphone_core_find_auth_info(lc,realm,username);
if ( as==NULL || (as!=NULL && as->works==FALSE && as->first_time==FALSE)){ if ( as==NULL || (as!=NULL && as->works==FALSE && as->first_time==FALSE)){
if (lc->vtable.auth_info_requested!=NULL){ if (lc->vtable.auth_info_requested!=NULL){
lc->vtable.auth_info_requested(lc,realm,username); lc->vtable.auth_info_requested(lc,realm,username);
......
...@@ -599,6 +599,10 @@ void linphone_core_add_auth_info(LinphoneCore *lc, LinphoneAuthInfo *info); ...@@ -599,6 +599,10 @@ void linphone_core_add_auth_info(LinphoneCore *lc, LinphoneAuthInfo *info);
void linphone_core_remove_auth_info(LinphoneCore *lc, LinphoneAuthInfo *info); void linphone_core_remove_auth_info(LinphoneCore *lc, LinphoneAuthInfo *info);
const MSList *linphone_core_get_auth_info_list(const LinphoneCore *lc);
LinphoneAuthInfo *linphone_core_find_auth_info(LinphoneCore *lc, const char *realm, const char *username);
void linphone_core_abort_authentication(LinphoneCore *lc, LinphoneAuthInfo *info); void linphone_core_abort_authentication(LinphoneCore *lc, LinphoneAuthInfo *info);
void linphone_core_clear_all_auth_info(LinphoneCore *lc); void linphone_core_clear_all_auth_info(LinphoneCore *lc);
......
...@@ -44,6 +44,7 @@ void linphone_proxy_config_destroy(LinphoneProxyConfig *obj){ ...@@ -44,6 +44,7 @@ void linphone_proxy_config_destroy(LinphoneProxyConfig *obj){
if (obj->reg_identity!=NULL) ms_free(obj->reg_identity); if (obj->reg_identity!=NULL) ms_free(obj->reg_identity);
if (obj->reg_route!=NULL) ms_free(obj->reg_route); if (obj->reg_route!=NULL) ms_free(obj->reg_route);
if (obj->ssctx!=NULL) sip_setup_context_free(obj->ssctx); if (obj->ssctx!=NULL) sip_setup_context_free(obj->ssctx);
if (obj->type!=NULL) ms_free(obj->type);
} }
bool_t linphone_proxy_config_is_registered(const LinphoneProxyConfig *obj){ bool_t linphone_proxy_config_is_registered(const LinphoneProxyConfig *obj){
...@@ -563,9 +564,13 @@ LinphoneProxyConfig *linphone_proxy_config_new_from_config_file(LpConfig *config ...@@ -563,9 +564,13 @@ LinphoneProxyConfig *linphone_proxy_config_new_from_config_file(LpConfig *config
return cfg; return cfg;
} }
void linphone_proxy_config_set_sip_setup(LinphoneProxyConfig *cfg, const char *type){ void linphone_proxy_config_set_sip_setup(LinphoneProxyConfig *cfg, const char *type){
SipSetup *ss=sip_setup_lookup(type); SipSetup *ss=sip_setup_lookup(type);
SipSetupContext *ssc; SipSetupContext *ssc;
if (cfg->type)
ms_free(cfg->type);
cfg->type=ms_strdup(type);
if (!ss) return ; if (!ss) return ;
ssc=sip_setup_context_new(ss,cfg); ssc=sip_setup_context_new(ss,cfg);
if (sip_setup_context_login_account(ssc,cfg->reg_identity,NULL)==0){ if (sip_setup_context_login_account(ssc,cfg->reg_identity,NULL)==0){
......
...@@ -61,7 +61,7 @@ SipSetup *sip_setup_lookup(const char *type_name){ ...@@ -61,7 +61,7 @@ SipSetup *sip_setup_lookup(const char *type_name){
MSList *elem; MSList *elem;
for(elem=registered_sip_setups;elem!=NULL;elem=elem->next){ for(elem=registered_sip_setups;elem!=NULL;elem=elem->next){
SipSetup *ss=(SipSetup*)elem->data; SipSetup *ss=(SipSetup*)elem->data;
if ( strcmp(ss->name,type_name)==0){ if ( strcasecmp(ss->name,type_name)==0){
if (!ss->initialized){ if (!ss->initialized){
ss->init(); ss->init();
ss->initialized=TRUE; ss->initialized=TRUE;
...@@ -166,5 +166,8 @@ void sip_setup_context_free_results(MSList *results){ ...@@ -166,5 +166,8 @@ void sip_setup_context_free_results(MSList *results){
} }
void sip_setup_context_free(SipSetupContext *ctx){ void sip_setup_context_free(SipSetupContext *ctx){
if (ctx->funcs->uninit_instance){
ctx->funcs->uninit_instance(ctx);
}
ms_free(ctx); ms_free(ctx);
} }
...@@ -73,7 +73,7 @@ struct _SipSetup{ ...@@ -73,7 +73,7 @@ struct _SipSetup{
char *name; char *name;
unsigned int capabilities; unsigned int capabilities;
bool_t (*init)(void); bool_t (*init)(void);
int (*init_instance)(SipSetupContext *ctx); void (*init_instance)(SipSetupContext *ctx);
int (*create_account)( const char *uri, const char *passwd); int (*create_account)( const char *uri, const char *passwd);
int (*login_account)(SipSetupContext *ctx, const char *uri, const char *passwd); int (*login_account)(SipSetupContext *ctx, const char *uri, const char *passwd);
int (*get_proxy)(SipSetupContext *ctx, const char *domain, char *proxy, size_t sz); int (*get_proxy)(SipSetupContext *ctx, const char *domain, char *proxy, size_t sz);
...@@ -82,6 +82,7 @@ struct _SipSetup{ ...@@ -82,6 +82,7 @@ struct _SipSetup{
int (*lookup_buddy)(SipSetupContext *ctx, const char *key); int (*lookup_buddy)(SipSetupContext *ctx, const char *key);
BuddyLookupStatus (*get_buddy_lookup_status)(SipSetupContext *ctx); BuddyLookupStatus (*get_buddy_lookup_status)(SipSetupContext *ctx);
int (*get_buddy_lookup_results)(SipSetupContext *ctx, MSList **results); int (*get_buddy_lookup_results)(SipSetupContext *ctx, MSList **results);
void (*uninit_instance)(SipSetupContext *ctx);
void (*exit)(void); void (*exit)(void);
bool_t initialized; bool_t initialized;
}; };
......
...@@ -30,6 +30,7 @@ enum { ...@@ -30,6 +30,7 @@ enum {
}; };
void linphone_gtk_buddy_lookup_window_destroyed(GtkWidget *w){ 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")); guint tid=GPOINTER_TO_INT(g_object_get_data(G_OBJECT(w),"typing_timeout"));
if (tid!=0){ if (tid!=0){
g_source_remove(tid); g_source_remove(tid);
...@@ -48,7 +49,7 @@ void linphone_gtk_show_buddy_lookup_window(SipSetupContext *ctx){ ...@@ -48,7 +49,7 @@ void linphone_gtk_show_buddy_lookup_window(SipSetupContext *ctx){
GtkTreeSelection *select; GtkTreeSelection *select;
GtkWidget *w=linphone_gtk_create_window("buddylookup"); GtkWidget *w=linphone_gtk_create_window("buddylookup");
GtkWidget *results=linphone_gtk_get_widget(w,"search_results"); GtkWidget *results=linphone_gtk_get_widget(w,"search_results");
GtkProgressBar *pb=GTK_PROGRESS_BAR(linphone_gtk_get_widget(w,"progressbar"));
store = gtk_list_store_new(LOOKUP_RESULT_NCOL, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING); store = gtk_list_store_new(LOOKUP_RESULT_NCOL, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING);
...@@ -75,7 +76,10 @@ void linphone_gtk_show_buddy_lookup_window(SipSetupContext *ctx){ ...@@ -75,7 +76,10 @@ void linphone_gtk_show_buddy_lookup_window(SipSetupContext *ctx){
gtk_tree_view_set_tooltip_column(GTK_TREE_VIEW(results),LOOKUP_RESULT_ADDRESS); gtk_tree_view_set_tooltip_column(GTK_TREE_VIEW(results),LOOKUP_RESULT_ADDRESS);
g_object_set_data(G_OBJECT(w),"SipSetupContext",ctx); 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_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);
gtk_progress_bar_set_fraction(pb,0);
gtk_progress_bar_set_text(pb,NULL);
gtk_widget_show(w); gtk_widget_show(w);
} }
...@@ -126,7 +130,7 @@ static gboolean keyword_typing_finished(GtkWidget *w){ ...@@ -126,7 +130,7 @@ static gboolean keyword_typing_finished(GtkWidget *w){
if (tid!=0){ if (tid!=0){
g_source_remove(tid); g_source_remove(tid);
} }
keyword=gtk_entry_get_text(GTK_ENTRY(w)); keyword=gtk_entry_get_text(GTK_ENTRY(linphone_gtk_get_widget(w,"keyword")));
if (strlen(keyword)>=4){ if (strlen(keyword)>=4){
guint tid2; guint tid2;
ctx=(SipSetupContext*)g_object_get_data(G_OBJECT(w),"SipSetupContext"); ctx=(SipSetupContext*)g_object_get_data(G_OBJECT(w),"SipSetupContext");
...@@ -167,3 +171,26 @@ static void linphone_gtk_display_lookup_results(GtkWidget *w, const MSList *resu ...@@ -167,3 +171,26 @@ static void linphone_gtk_display_lookup_results(GtkWidget *w, const MSList *resu
} }
} }
void linphone_gtk_add_buddy_from_database(GtkWidget *button){
GtkWidget *w=gtk_widget_get_toplevel(button);
GtkTreeSelection *select;
GtkTreeIter iter;
GtkTreeModel *model;
select = gtk_tree_view_get_selection(GTK_TREE_VIEW(linphone_gtk_get_widget(w,"search_results")));
if (gtk_tree_selection_get_selected (select, &model, &iter))
{
char *uri;
char *name;
char *addr;
LinphoneFriend *lf;
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);
g_free(uri);
g_free(name);
linphone_gtk_show_contact(lf);
}
}
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd"> <!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
<!--Generated with glade3 3.4.5 on Thu Feb 19 22:19:01 2009 --> <!--Generated with glade3 3.4.5 on Sun Mar 8 22:38:04 2009 -->
<glade-interface> <glade-interface>
<widget class="GtkWindow" id="buddylookup"> <widget class="GtkWindow" id="buddylookup">
<property name="title" translatable="yes">Search people...</property> <property name="title" translatable="yes">Search people...</property>
...@@ -36,6 +36,8 @@ ...@@ -36,6 +36,8 @@
<property name="shadow_type">GTK_SHADOW_ETCHED_IN</property> <property name="shadow_type">GTK_SHADOW_ETCHED_IN</property>
<child> <child>
<widget class="GtkTreeView" id="search_results"> <widget class="GtkTreeView" id="search_results">
<property name="width_request">300</property>
<property name="height_request">140</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
</widget> </widget>
......
...@@ -451,7 +451,8 @@ static GtkWidget *linphone_gtk_create_contact_menu(GtkWidget *contact_list){ ...@@ -451,7 +451,8 @@ static GtkWidget *linphone_gtk_create_contact_menu(GtkWidget *contact_list){
gtk_menu_shell_append(GTK_MENU_SHELL(menu),menu_item); 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_signal_connect_swapped(G_OBJECT(menu_item),"activate",(GCallback)linphone_gtk_remove_contact,contact_list);
if (ssc && sip_setup_context_get_capabilities(ssc) & SIP_SETUP_CAP_BUDDY_LOOKUP){ 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")); menu_item=gtk_image_menu_item_new_with_label(_("Search contact"));
image=gtk_image_new_from_stock(GTK_STOCK_FIND,GTK_ICON_SIZE_MENU); image=gtk_image_new_from_stock(GTK_STOCK_FIND,GTK_ICON_SIZE_MENU);
gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(menu_item),image); gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(menu_item),image);
......
...@@ -3,6 +3,6 @@ HELPLANG=C ...@@ -3,6 +3,6 @@ HELPLANG=C
include ../Makefile.inc include ../Makefile.inc
man_MANS = linphone.1 linphonec.1 sipomatic.1 man_MANS = linphone.1 linphonec.1 sipomatic.1 linphonecsh.1
EXTRA_DIST+=$(man_MANS) EXTRA_DIST+=$(man_MANS)
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