Commit 0f9f315c authored by Yann Diorcet's avatar Yann Diorcet
Browse files

Merge branch 'master' into belle-sip

parents 3da68349 02ce5265
GITVERSION_FILE=liblinphone_gitversion.h
GITVERSION_FILE_TMP=liblinphone_gitversion.h.tmp
GITDESCRIBE=`git describe`
GITDESCRIBE=`git describe --always`
GITREVISION=`git rev-parse HEAD`
ECHO=/bin/echo
......
......@@ -132,6 +132,13 @@ void linphone_friend_destroy(LinphoneFriend *lf);
*/
int linphone_friend_set_addr(LinphoneFriend *fr, const LinphoneAddress* address);
/**
* set the display name for this friend
* @param lf #LinphoneFriend object
* @param name
*/
int linphone_friend_set_name(LinphoneFriend *lf, const char *name);
/**
* get address of this friend
* @param lf #LinphoneFriend object
......
......@@ -31,7 +31,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define UPNP_CORE_READY_CHECK 1
#define UPNP_CORE_RETRY_DELAY 4
#define UPNP_CALL_RETRY_DELAY 1
#define UPNP_UUID_LEN 32
#define UPNP_UUID_LEN 128
#define UPNP_UUID_LEN_STR UPNP_TOSTRING(UPNP_UUID_LEN)
/*
* uPnP Definitions
......@@ -1241,7 +1241,7 @@ static void linphone_upnp_config_list_port_bindings_cb(const char *entry, struct
bool_t valid = TRUE;
UpnpPortBinding *port;
ret = sscanf(entry, "%"UPNP_UUID_LEN_STR"s-%3s-%i-%i", device_id, protocol_str, &external_port, &local_port);
ret = sscanf(entry, "%"UPNP_UUID_LEN_STR"[^-]-%3s-%i-%i", device_id, protocol_str, &external_port, &local_port);
if(ret == 4) {
// Handle only wanted device bindings
if(device_id != NULL && strcmp(cookie->device_id, device_id) != 0) {
......
......@@ -82,7 +82,9 @@
<object class="GtkTreeView" id="logs_view">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="headers_visible">False</property>
<signal name="button-press-event" handler="linphone_gtk_call_log_button_pressed" swapped="no"/>
<signal name="row-activated" handler="linphone_gtk_history_row_activated" swapped="no"/>
</object>
</child>
......
......@@ -47,6 +47,145 @@ void call_log_selection_changed(GtkTreeView *v){
}
}
void linphone_gtk_call_log_chat_selected(GtkWidget *w){
GtkTreeSelection *select;
GtkTreeIter iter;
select=gtk_tree_view_get_selection(GTK_TREE_VIEW(w));
if (select!=NULL){
GtkTreeModel *model=NULL;
if (gtk_tree_selection_get_selected (select,&model,&iter)){
gpointer pla;
LinphoneAddress *la;
gtk_tree_model_get(model,&iter,2,&pla,-1);
la=(LinphoneAddress*)pla;
if (la!=NULL){
linphone_gtk_tree_view_set_chat_conversation(la);
}
}
}
}
void linphone_gtk_call_log_add_contact(GtkWidget *w){
GtkTreeSelection *select;
GtkTreeIter iter;
select=gtk_tree_view_get_selection(GTK_TREE_VIEW(w));
if (select!=NULL){
GtkTreeModel *model=NULL;
if (gtk_tree_selection_get_selected (select,&model,&iter)){
gpointer pla;
LinphoneAddress *la;
LinphoneFriend *lf;
gtk_tree_model_get(model,&iter,2,&pla,-1);
la=(LinphoneAddress*)pla;
if (la!=NULL){
char *uri=linphone_address_as_string(la);
lf=linphone_friend_new_with_addr(uri);
linphone_gtk_show_contact(lf);
ms_free(uri);
}
}
}
}
static bool_t put_selection_to_uribar(GtkWidget *treeview){
GtkTreeSelection *sel;
sel=gtk_tree_view_get_selection(GTK_TREE_VIEW(treeview));
if (sel!=NULL){
GtkTreeModel *model=NULL;
GtkTreeIter iter;
if (gtk_tree_selection_get_selected (sel,&model,&iter)){
gpointer pla;
LinphoneAddress *la;
char *tmp;
gtk_tree_model_get(model,&iter,2,&pla,-1);
la=(LinphoneAddress*)pla;
tmp=linphone_address_as_string (la);
gtk_entry_set_text(GTK_ENTRY(linphone_gtk_get_widget(linphone_gtk_get_main_window(),"uribar")),tmp);
ms_free(tmp);
return TRUE;
}
}
return FALSE;
}
static void linphone_gtk_call_selected(GtkTreeView *treeview){
put_selection_to_uribar(GTK_WIDGET(treeview));
linphone_gtk_start_call(linphone_gtk_get_widget(gtk_widget_get_toplevel(GTK_WIDGET(treeview)),
"start_call"));
}
static GtkWidget *linphone_gtk_create_call_log_menu(GtkWidget *call_log){
GtkWidget *menu=gtk_menu_new();
GtkWidget *menu_item;
gchar *call_label=NULL;
gchar *text_label=NULL;
gchar *name=NULL;
GtkWidget *image;
GtkTreeSelection *select;
GtkTreeIter iter;
select=gtk_tree_view_get_selection(GTK_TREE_VIEW(call_log));
if (select!=NULL){
GtkTreeModel *model=NULL;
if (gtk_tree_selection_get_selected (select,&model,&iter)){
gpointer pla;
LinphoneAddress *la;
gtk_tree_model_get(model,&iter,2,&pla,-1);
la=(LinphoneAddress*)pla;
name=linphone_address_as_string(la);
call_label=g_strdup_printf(_("Call %s"),name);
text_label=g_strdup_printf(_("Send text to %s"),name);
g_free(name);
}
}
if (call_label){
menu_item=gtk_image_menu_item_new_with_label(call_label);
image=gtk_image_new_from_stock(GTK_STOCK_NETWORK,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);
gtk_menu_shell_append(GTK_MENU_SHELL(menu),menu_item);
g_signal_connect_swapped(G_OBJECT(menu_item),"activate",(GCallback)linphone_gtk_call_selected,call_log);
}
if (text_label){
menu_item=gtk_image_menu_item_new_with_label(text_label);
image=gtk_image_new_from_stock(GTK_STOCK_NETWORK,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);
gtk_menu_shell_append(GTK_MENU_SHELL(menu),menu_item);
g_signal_connect_swapped(G_OBJECT(menu_item),"activate",(GCallback)linphone_gtk_call_log_chat_selected,call_log);
}
menu_item=gtk_image_menu_item_new_from_stock(GTK_STOCK_ADD,NULL);
gtk_widget_show(menu_item);
gtk_menu_shell_append(GTK_MENU_SHELL(menu),menu_item);
g_signal_connect_swapped(G_OBJECT(menu_item),"activate",(GCallback)linphone_gtk_call_log_add_contact,call_log);
gtk_widget_show(menu);
gtk_menu_attach_to_widget(GTK_MENU(menu),call_log, NULL);
if (call_label) g_free(call_label);
if (text_label) g_free(text_label);
return menu;
}
gboolean linphone_gtk_call_log_popup_contact(GtkWidget *list, GdkEventButton *event){
GtkWidget *m=linphone_gtk_create_call_log_menu(list);
gtk_menu_popup (GTK_MENU (m), NULL, NULL, NULL, NULL,
event ? event->button : 0, event ? event->time : gtk_get_current_event_time());
return TRUE;
}
gboolean linphone_gtk_call_log_button_pressed(GtkWidget *widget, GdkEventButton *event){
if (event->button == 3 && event->type == GDK_BUTTON_PRESS){
return linphone_gtk_call_log_popup_contact(widget, event);
}
return FALSE;
}
void linphone_gtk_call_log_update(GtkWidget *w){
GtkTreeView *v=GTK_TREE_VIEW(linphone_gtk_get_widget(w,"logs_view"));
GtkTreeStore *store;
......@@ -62,6 +201,7 @@ void linphone_gtk_call_log_update(GtkWidget *w){
select=gtk_tree_view_get_selection(v);
gtk_tree_selection_set_mode(select, GTK_SELECTION_SINGLE);
g_signal_connect_swapped(G_OBJECT(select),"changed",(GCallback)call_log_selection_changed,v);
g_signal_connect(G_OBJECT(v),"button-press-event",(GCallback)linphone_gtk_call_log_button_pressed,NULL);
// gtk_button_set_image(GTK_BUTTON(linphone_gtk_get_widget(w,"call_back_button")),
// create_pixmap (linphone_gtk_get_ui_config("callback_button","status-green.png")));
}
......@@ -70,13 +210,14 @@ void linphone_gtk_call_log_update(GtkWidget *w){
for (logs=linphone_core_get_call_logs(linphone_gtk_get_core());logs!=NULL;logs=logs->next){
LinphoneCallLog *cl=(LinphoneCallLog*)logs->data;
GtkTreeIter iter, iter2;
LinphoneAddress *la=linphone_call_log_get_dir(cl)==LinphoneCallIncoming ? linphone_call_log_get_from(cl) : linphone_call_log_get_to(cl);
char *addr= linphone_address_as_string_uri_only (la);
const LinphoneAddress *la=linphone_call_log_get_dir(cl)==LinphoneCallIncoming ? linphone_call_log_get_from(cl) : linphone_call_log_get_to(cl);
char *addr= linphone_address_as_string(la);
const char *display;
gchar *logtxt, *headtxt, *minutes, *seconds;
gchar quality[20];
const char *status=NULL;
gchar *start_date=NULL;
LinphoneFriend *lf=NULL;
int duration=linphone_call_log_get_duration(cl);
time_t start_date_time=linphone_call_log_get_start_date(cl);
......@@ -89,12 +230,19 @@ void linphone_gtk_call_log_update(GtkWidget *w){
#else
start_date=g_strdup(ctime(&start_date_time));
#endif
lf=linphone_core_get_friend_by_address(linphone_gtk_get_core(),addr);
if(lf != NULL){
la=linphone_friend_get_address(lf);
display=linphone_address_get_display_name(la);
} else {
display=linphone_address_get_display_name(la);
}
display=linphone_address_get_display_name (la);
if (display==NULL){
display=linphone_address_get_username (la);
if (display==NULL)
if (display==NULL){
display=linphone_address_get_domain (la);
}
}
if (linphone_call_log_get_quality(cl)!=-1){
snprintf(quality,sizeof(quality),"%.1f",linphone_call_log_get_quality(cl));
......@@ -149,28 +297,6 @@ void linphone_gtk_call_log_update(GtkWidget *w){
}
static bool_t put_selection_to_uribar(GtkWidget *treeview){
GtkTreeSelection *sel;
sel=gtk_tree_view_get_selection(GTK_TREE_VIEW(treeview));
if (sel!=NULL){
GtkTreeModel *model=NULL;
GtkTreeIter iter;
if (gtk_tree_selection_get_selected (sel,&model,&iter)){
gpointer pla;
LinphoneAddress *la;
char *tmp;
gtk_tree_model_get(model,&iter,2,&pla,-1);
la=(LinphoneAddress*)pla;
tmp=linphone_address_as_string (la);
gtk_entry_set_text(GTK_ENTRY(linphone_gtk_get_widget(linphone_gtk_get_main_window(),"uribar")),tmp);
ms_free(tmp);
return TRUE;
}
}
return FALSE;
}
void linphone_gtk_history_row_activated(GtkWidget *treeview){
if (put_selection_to_uribar(treeview)){
GtkWidget *mw=linphone_gtk_get_main_window();
......@@ -207,8 +333,6 @@ void linphone_gtk_call_log_response(GtkWidget *w, guint response_id){
gtk_widget_destroy(w);
}
GtkWidget * linphone_gtk_show_call_logs(void){
GtkWidget *mw=linphone_gtk_get_main_window();
......@@ -223,5 +347,4 @@ GtkWidget * linphone_gtk_show_call_logs(void){
linphone_gtk_call_log_update(w);
}else gtk_window_present(GTK_WINDOW(w));
return w;
}
}
\ No newline at end of file
......@@ -195,16 +195,21 @@ void linphone_gtk_create_chat_picture(gboolean active){
GtkTreeModel *model=gtk_tree_view_get_model(GTK_TREE_VIEW(friendlist));
if (gtk_tree_model_get_iter_first(model,&iter)) {
do{
if(!active){
//if(!active){
gtk_list_store_set(GTK_LIST_STORE(model),&iter,FRIEND_CHAT,create_chat_picture(),-1);
} else {
gtk_list_store_set(GTK_LIST_STORE(model),&iter,FRIEND_CHAT,create_active_chat_picture(),-1);
}
//} else {
// gtk_list_store_set(GTK_LIST_STORE(model),&iter,FRIEND_CHAT,create_active_chat_picture(),-1);
//}
}while(gtk_tree_model_iter_next(model,&iter));
}
}
void linphone_gtk_update_chat_picture(){
static gboolean grab_focus(GtkWidget *w){
gtk_widget_grab_focus(w);
return FALSE;
}
void linphone_gtk_tree_view_set_chat_conversation(LinphoneAddress *la){
GtkTreeIter iter;
GtkListStore *store=NULL;
GtkWidget *w = linphone_gtk_get_main_window();
......@@ -212,28 +217,56 @@ void linphone_gtk_update_chat_picture(){
GtkTreeModel *model=gtk_tree_view_get_model(GTK_TREE_VIEW(friendlist));
GtkWidget *chat_view=(GtkWidget*)g_object_get_data(G_OBJECT(friendlist),"chatview");
LinphoneFriend *lf=NULL;
char *uri=(char *)g_object_get_data(G_OBJECT(friendlist),"from");
store=GTK_LIST_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(friendlist)));
if (gtk_tree_model_get_iter_first(model,&iter)) {
do{
gtk_tree_model_get (model, &iter,FRIEND_ID , &lf, -1);
if(chat_view!=NULL){
if(uri !=NULL) {
if(g_strcmp0(linphone_address_as_string(linphone_friend_get_address(lf)),
uri)==0){
gtk_list_store_set(store,&iter,FRIEND_CHAT,create_active_chat_picture(),-1);
LinphoneChatRoom *cr=NULL;
GtkNotebook *notebook=(GtkNotebook *)linphone_gtk_get_widget(w,"viewswitch");
char *la_str=linphone_address_as_string(la);
lf=linphone_core_get_friend_by_address(linphone_gtk_get_core(),la_str);
if(lf==NULL){
cr=linphone_gtk_create_chatroom(la);
g_object_set_data(G_OBJECT(friendlist),"from",la_str);
if(chat_view==NULL){
chat_view=linphone_gtk_init_chatroom(cr,la);
g_object_set_data(G_OBJECT(friendlist),"chatview",(gpointer)chat_view);
} else {
linphone_gtk_load_chatroom(cr,la,chat_view);
}
gtk_notebook_set_current_page(notebook,gtk_notebook_page_num(notebook,chat_view));
linphone_gtk_create_chat_picture(FALSE);
g_idle_add((GSourceFunc)grab_focus,linphone_gtk_get_widget(chat_view,"text_entry"));
} else {
store=GTK_LIST_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(friendlist)));
if (gtk_tree_model_get_iter_first(model,&iter)) {
do{
const LinphoneAddress *uri;
char *lf_str;
gtk_tree_model_get (model, &iter,FRIEND_ID , &lf, -1);
uri=linphone_friend_get_address(lf);
lf_str=linphone_address_as_string(uri);
if( g_strcmp0(lf_str,la_str)==0){
gtk_tree_model_get (model, &iter,FRIEND_CHATROOM , &cr, -1);
if(cr==NULL){
cr=linphone_gtk_create_chatroom(uri);
gtk_list_store_set(store,&iter,FRIEND_CHATROOM,cr,-1);
}
g_object_set_data(G_OBJECT(friendlist),"from",linphone_address_as_string(uri));
if(chat_view==NULL){
chat_view=linphone_gtk_init_chatroom(cr,uri);
g_object_set_data(G_OBJECT(friendlist),"chatview",(gpointer)chat_view);
} else {
gtk_list_store_set(store,&iter,FRIEND_CHAT,create_chat_picture(),-1);
linphone_gtk_load_chatroom(cr,uri,chat_view);
}
gtk_notebook_set_current_page(notebook,gtk_notebook_page_num(notebook,chat_view));
linphone_gtk_create_chat_picture(FALSE);
g_idle_add((GSourceFunc)grab_focus,linphone_gtk_get_widget(chat_view,"text_entry"));
gtk_list_store_set(store,&iter,FRIEND_CHAT,create_active_chat_picture(),-1);
gtk_list_store_set(store,&iter,FRIEND_NB_UNREAD_MSG,"",-1);
break;
}
}
}while(gtk_tree_model_iter_next(model,&iter));
}while(gtk_tree_model_iter_next(model,&iter));
}
}
}
static gboolean grab_focus(GtkWidget *w){
gtk_widget_grab_focus(w);
return FALSE;
}
void linphone_gtk_chat_selected(GtkWidget *item){
......@@ -734,7 +767,6 @@ void linphone_gtk_show_friends(void){
if(nbmsg != 0){
sprintf(buf,"%i",nbmsg);
}
}
gtk_list_store_set(store,&iter,FRIEND_CALL,create_call_picture(),-1);
......@@ -743,7 +775,7 @@ void linphone_gtk_show_friends(void){
escaped=g_markup_escape_text(uri,-1);
gtk_list_store_set(store,&iter,FRIEND_SIP_ADDRESS,escaped,-1);
g_free(escaped);
linphone_gtk_update_chat_picture();
//linphone_gtk_update_chat_picture();
//bi=linphone_friend_get_info(lf);
/*if (bi!=NULL && bi->image_data!=NULL){
GdkPixbuf *pbuf=
......@@ -787,6 +819,7 @@ void linphone_gtk_contact_cancel(GtkWidget *button){
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");
LinphoneFriend *lf2;
char *fixed_uri=NULL;
gboolean show_presence=FALSE,allow_presence=FALSE;
const gchar *name,*uri;
......@@ -811,16 +844,20 @@ void linphone_gtk_contact_ok(GtkWidget *button){
LinphoneAddress* friend_address = linphone_address_new(fixed_uri);
linphone_address_set_display_name(friend_address,name);
linphone_friend_set_addr(lf,friend_address);
ms_free(fixed_uri);
linphone_address_destroy(friend_address);
linphone_friend_send_subscribe(lf,show_presence);
linphone_friend_set_inc_subscribe_policy(lf,allow_presence==TRUE ? LinphoneSPAccept : LinphoneSPDeny);
if (linphone_friend_in_list(lf)) {
linphone_friend_done(lf);
}else{
linphone_core_add_friend(linphone_gtk_get_core(),lf);
} else {
lf2=linphone_core_get_friend_by_address(linphone_gtk_get_core(),fixed_uri);
if(lf2==NULL){
linphone_friend_set_name(lf,name);
linphone_core_add_friend(linphone_gtk_get_core(),lf);
}
}
ms_free(fixed_uri);
linphone_gtk_show_friends();
gtk_widget_destroy(w);
}
......@@ -997,6 +1034,4 @@ gboolean linphone_gtk_contact_list_button_pressed(GtkWidget *widget, GdkEventBut
void linphone_gtk_buddy_info_updated(LinphoneCore *lc, LinphoneFriend *lf){
/*refresh the entire list*/
linphone_gtk_show_friends();
}
}
\ No newline at end of file
......@@ -153,3 +153,4 @@ void linphone_gtk_unmonitor_usb(void);
gchar *linphone_gtk_get_record_path(const LinphoneAddress *address, gboolean is_conference);
void linphone_gtk_friend_list_update_message(LinphoneChatMessage *msg);
void linphone_gtk_tree_view_set_chat_conversation(LinphoneAddress *la);
......@@ -63,12 +63,16 @@ static void linphone_gtk_call_log_updated(LinphoneCore *lc, LinphoneCallLog *cl)
static void linphone_gtk_call_state_changed(LinphoneCore *lc, LinphoneCall *call, LinphoneCallState cs, const char *msg);
static void linphone_gtk_call_encryption_changed(LinphoneCore *lc, LinphoneCall *call, bool_t enabled, const char *token);
static void linphone_gtk_transfer_state_changed(LinphoneCore *lc, LinphoneCall *call, LinphoneCallState cstate);
void linphone_gtk_save_main_window_position(GtkWindow* mw, GdkEvent *event, gpointer data);
static gboolean linphone_gtk_auto_answer(LinphoneCall *call);
void linphone_gtk_status_icon_set_blinking(gboolean val);
void _linphone_gtk_enable_video(gboolean val);
#ifndef HAVE_GTK_OSX
static gint main_window_x=0;
static gint main_window_y=0;
#endif
static gboolean verbose=0;
static gboolean auto_answer = 0;
static gchar * addr_to_call = NULL;
......@@ -1371,11 +1375,20 @@ static GtkWidget *create_icon_menu(){
return menu;
}
void linphone_gtk_save_main_window_position(GtkWindow* mw, GdkEvent *event, gpointer data){
gtk_window_get_position(GTK_WINDOW(mw), &main_window_x, &main_window_y);
}
static void handle_icon_click() {
GtkWidget *mw=linphone_gtk_get_main_window();
if (!gtk_window_is_active((GtkWindow*)mw)) {
if(!gtk_widget_is_drawable(mw)){
//we only move if window was hidden. If it was simply behind the window stack, ie, drawable, we keep it as it was
gtk_window_move (GTK_WINDOW(mw), main_window_x, main_window_y);
}
linphone_gtk_show_main_window();
} else {
linphone_gtk_save_main_window_position((GtkWindow*)mw, NULL, NULL);
gtk_widget_hide(mw);
}
}
......
......@@ -313,7 +313,6 @@
<object class="GtkLabel" id="in_call_uri">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">label</property>
<property name="justify">center</property>
</object>
<packing>
......@@ -368,7 +367,6 @@
<object class="GtkLabel" id="encryption_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">label</property>
</object>
<packing>
<property name="expand">True</property>
......
......@@ -5,7 +5,7 @@ To add a translation file in linphone project you should first :
- then add the file .po in the directory /po
- run ./autogen.sh
Update the tranlation files
Update the translation files
***************************
To update all the translation files, in the directory /po run the following command
$ make update-po
......
This diff is collapsed.
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