diff --git a/build/android/Android-no-neon.mk b/build/android/Android-no-neon.mk
index d0c87b4f8..d8e75ca0b 100644
--- a/build/android/Android-no-neon.mk
+++ b/build/android/Android-no-neon.mk
@@ -21,7 +21,6 @@
LOCAL_PATH:= $(call my-dir)/../../coreapi
-
include $(CLEAR_VARS)
include $(linphone-root-dir)/submodules/linphone/build/android/common.mk
@@ -43,4 +42,3 @@ include $(BUILD_SHARED_LIBRARY)
$(call import-module,android/cpufeatures)
-
diff --git a/build/android/Android.mk b/build/android/Android.mk
index 7fb75d0a4..10fba32dd 100755
--- a/build/android/Android.mk
+++ b/build/android/Android.mk
@@ -39,10 +39,3 @@ include $(BUILD_SHARED_LIBRARY)
$(call import-module,android/cpufeatures)
-
-ifeq ($(BUILD_REMOTE_PROVISIONING),1)
-
-include $(linphone-root-dir)/submodules/linphone/build/android/xml2lpc.mk
-include $(linphone-root-dir)/submodules/linphone/build/android/lpc2xml.mk
-
-endif
diff --git a/build/android/lpc2xml.mk b/build/android/lpc2xml.mk
index f7858f94d..b5757ad99 100644
--- a/build/android/lpc2xml.mk
+++ b/build/android/lpc2xml.mk
@@ -40,6 +40,7 @@ LOCAL_C_INCLUDES = \
LOCAL_SHARED_LIBRARIES = \
libxml2 \
+ liblinphonenoneon \
liblinphone \
LOCAL_MODULE := liblpc2xml
diff --git a/build/android/xml2lpc.mk b/build/android/xml2lpc.mk
index 32bfb38c3..449251cc8 100644
--- a/build/android/xml2lpc.mk
+++ b/build/android/xml2lpc.mk
@@ -40,6 +40,7 @@ LOCAL_C_INCLUDES = \
LOCAL_SHARED_LIBRARIES = \
libxml2 \
+ liblinphonenoneon \
liblinphone \
LOCAL_MODULE := libxml2lpc
diff --git a/coreapi/linphonecore.h b/coreapi/linphonecore.h
index f2e331c78..9865a6894 100644
--- a/coreapi/linphonecore.h
+++ b/coreapi/linphonecore.h
@@ -51,15 +51,31 @@ typedef struct _LinphoneCore LinphoneCore;
struct _LpConfig;
+/**
+ * Linphone core SIP transport ports.
+ * Use with #linphone_core_set_sip_transports
+ * @ingroup initializing
+ */
typedef struct _LCSipTransports{
+ /**
+ * udp port to listening on, negative value if not set
+ * */
int udp_port;
+ /**
+ * tcp port to listening on, negative value if not set
+ * */
int tcp_port;
+ /**
+ * dtls port to listening on, negative value if not set
+ * */
int dtls_port;
+ /**
+ * tls port to listening on, negative value if not set
+ * */
int tls_port;
} LCSipTransports;
-
/**
* Object that represents a SIP address.
*
@@ -945,7 +961,12 @@ LINPHONE_PUBLIC int linphone_core_update_call(LinphoneCore *lc, LinphoneCall *ca
int linphone_core_defer_call_update(LinphoneCore *lc, LinphoneCall *call);
int linphone_core_accept_call_update(LinphoneCore *lc, LinphoneCall *call, const LinphoneCallParams *params);
-
+/**
+ * @ingroup media_parameters
+ * Get default call parameters reflecting current linphone core configuration
+ * @param LinphoneCore object
+ * @return LinphoneCallParams
+ */
LinphoneCallParams *linphone_core_create_default_call_parameters(LinphoneCore *lc);
LinphoneCall *linphone_core_get_call_by_remote_address(LinphoneCore *lc, const char *remote_address);
@@ -993,16 +1014,23 @@ const MSList *linphone_core_get_video_codecs(const LinphoneCore *lc);
int linphone_core_set_video_codecs(LinphoneCore *lc, MSList *codecs);
LINPHONE_PUBLIC bool_t linphone_core_payload_type_enabled(LinphoneCore *lc, const PayloadType *pt);
-
+/**
+ * Enable payload type
+ * @param linphone core
+ * @param pt payload type to enable, can be retrieve from #linphone_core_find_payload_type
+ * @param TRUE if enabled
+ * @return 0 if succed
+ *
+ */
LINPHONE_PUBLIC int linphone_core_enable_payload_type(LinphoneCore *lc, PayloadType *pt, bool_t enable);
/**
- * Wildcard value used by #linphone_core_find_payload_type to ignore rate in search algirithm
+ * Wildcard value used by #linphone_core_find_payload_type to ignore rate in search algorithm
* @ingroup media_parameters
*/
#define LINPHONE_FIND_PAYLOAD_IGNORE_RATE -1
/**
- * Wildcard value used by #linphone_core_find_payload_type to ignore channel in search algirithm
+ * Wildcard value used by #linphone_core_find_payload_type to ignore channel in search algorithm
* @ingroup media_parameters
*/
#define LINPHONE_FIND_PAYLOAD_IGNORE_CHANNELS -1
@@ -1381,7 +1409,13 @@ LINPHONE_PUBLIC void linphone_core_refresh_registers(LinphoneCore* lc);
/* Path to the file storing secrets cache */
void linphone_core_set_zrtp_secrets_file(LinphoneCore *lc, const char* file);
const char *linphone_core_get_zrtp_secrets_file(LinphoneCore *lc);
-
+/**
+ * Search from the list of current calls if a remote address match uri
+ * @ingroup call_control
+ * @param lc
+ * @param uri which should match call remote uri
+ * @return LinphoneCall or NULL is no match is found
+ */
const LinphoneCall* linphone_core_find_call_from_uri(LinphoneCore *lc, const char *uri);
LINPHONE_PUBLIC int linphone_core_add_to_conference(LinphoneCore *lc, LinphoneCall *call);
@@ -1396,8 +1430,19 @@ LINPHONE_PUBLIC int linphone_core_terminate_conference(LinphoneCore *lc);
LINPHONE_PUBLIC int linphone_core_get_conference_size(LinphoneCore *lc);
int linphone_core_start_conference_recording(LinphoneCore *lc, const char *path);
int linphone_core_stop_conference_recording(LinphoneCore *lc);
-
+/**
+ * Get the maximum number of simultaneous calls Linphone core can manage at a time. All new call above this limit are declined with a busy answer
+ * @ingroup initializing
+ * @param lc core
+ * @return max number of simultaneous calls
+ */
int linphone_core_get_max_calls(LinphoneCore *lc);
+/**
+ * Set the maximum number of simultaneous calls Linphone core can manage at a time. All new call above this limit are declined with a busy answer
+ * @ingroup initializing
+ * @param lc core
+ * @param max number of simultaneous calls
+ */
void linphone_core_set_max_calls(LinphoneCore *lc, int max);
bool_t linphone_core_sound_resources_locked(LinphoneCore *lc);
diff --git a/coreapi/proxy.c b/coreapi/proxy.c
index ab638ee05..8995fd069 100644
--- a/coreapi/proxy.c
+++ b/coreapi/proxy.c
@@ -846,6 +846,7 @@ int linphone_proxy_config_send_publish(LinphoneProxyConfig *proxy,
LinphoneOnlineStatus presence_mode){
int err;
SalOp *op=sal_op_new(proxy->lc->sal);
+ sal_op_set_route(op,proxy->reg_proxy);
err=sal_publish(op,linphone_proxy_config_get_identity(proxy),
linphone_proxy_config_get_identity(proxy),linphone_online_status_to_sal(presence_mode));
if (proxy->publish_op!=NULL)
diff --git a/coreapi/sal_eXosip2_presence.c b/coreapi/sal_eXosip2_presence.c
index 356d2a9fb..ffa7ed920 100644
--- a/coreapi/sal_eXosip2_presence.c
+++ b/coreapi/sal_eXosip2_presence.c
@@ -635,7 +635,7 @@ int sal_publish(SalOp *op, const char *from, const char *to, SalPresenceStatus p
mk_presence_body (presence_mode, from, buf, sizeof (buf), presence_style);
- i = eXosip_build_publish(&pub,from, to, NULL, "presence", "300",
+ i = eXosip_build_publish(&pub,from, to, sal_op_get_route(op), "presence", "300",
presence_style ? "application/xpidf+xml" : "application/pidf+xml", buf);
if (i<0){
ms_warning("Failed to build publish request.");
diff --git a/gtk/calllogs.c b/gtk/calllogs.c
index 9d2714153..7daa1b011 100644
--- a/gtk/calllogs.c
+++ b/gtk/calllogs.c
@@ -19,7 +19,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "linphone.h"
-
static void fill_renderers(GtkTreeView *v){
GtkTreeViewColumn *c;
GtkCellRenderer *r;
@@ -36,14 +35,16 @@ static void fill_renderers(GtkTreeView *v){
void call_log_selection_changed(GtkTreeView *v){
GtkTreeSelection *select;
GtkTreeIter iter;
- GtkTreeModel *model;
+ GtkTreeModel *model=NULL;
select = gtk_tree_view_get_selection(v);
- if (gtk_tree_selection_get_selected (select, &model, &iter)){
- GtkTreePath *path=gtk_tree_model_get_path(model,&iter);
- gtk_tree_view_collapse_all(v);
- gtk_tree_view_expand_row(v,path,TRUE);
- gtk_tree_path_free(path);
+ if (select!=NULL){
+ if (gtk_tree_selection_get_selected (select, &model, &iter)){
+ GtkTreePath *path=gtk_tree_model_get_path(model,&iter);
+ gtk_tree_view_collapse_all(v);
+ gtk_tree_view_expand_row(v,path,TRUE);
+ gtk_tree_path_free(path);
+ }
}
}
@@ -91,19 +92,18 @@ void linphone_gtk_call_log_add_contact(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);
+ LinphoneAddress *la;
+ gtk_tree_model_get(model,&iter,2,&la,-1);
+ tmp=linphone_address_as_string(la);
+ if(tmp!=NULL)
+ gtk_entry_set_text(GTK_ENTRY(linphone_gtk_get_widget(linphone_gtk_get_main_window(),"uribar")),tmp);
ms_free(tmp);
return TRUE;
}
@@ -159,7 +159,6 @@ static GtkWidget *linphone_gtk_create_call_log_menu(GtkWidget *call_log){
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);
@@ -186,25 +185,77 @@ gboolean linphone_gtk_call_log_button_pressed(GtkWidget *widget, GdkEventButton
return FALSE;
}
+void linphone_gtk_call_log_clear_missed_call(){
+ GtkWidget *mw=linphone_gtk_get_main_window();
+ GtkNotebook *notebook=GTK_NOTEBOOK(linphone_gtk_get_widget(mw,"viewswitch"));
+ GtkWidget *page=gtk_notebook_get_nth_page(notebook,0);
+ GtkWidget *box=gtk_hbox_new(FALSE,0);
+ GtkWidget *image=gtk_image_new_from_stock(GTK_STOCK_REFRESH,GTK_ICON_SIZE_MENU);
+ GtkWidget *l;
+
+ l=gtk_label_new("Recent calls");
+ gtk_box_pack_start(GTK_BOX(box),image,FALSE,FALSE,0);
+ gtk_box_pack_start(GTK_BOX(box),l,FALSE,FALSE,0);
+ gtk_notebook_set_tab_label(notebook,page,box);
+ gtk_widget_show_all(box);
+}
+
+gboolean linphone_gtk_call_log_reset_missed_call(GtkWidget *w, GdkEvent *event,gpointer user_data){
+ GtkWidget *mw=linphone_gtk_get_main_window();
+ GtkNotebook *notebook=GTK_NOTEBOOK(linphone_gtk_get_widget(mw,"viewswitch"));
+ gtk_notebook_set_current_page(notebook,0);
+ linphone_core_reset_missed_calls_count(linphone_gtk_get_core());
+ linphone_gtk_call_log_clear_missed_call();
+ return TRUE;
+}
+
+void linphone_gtk_call_log_display_missed_call(int nb){
+ GtkWidget *mw=linphone_gtk_get_main_window();
+ GtkNotebook *notebook=GTK_NOTEBOOK(linphone_gtk_get_widget(mw,"viewswitch"));
+ GtkWidget *page=gtk_notebook_get_nth_page(notebook,0);
+ GtkWidget *ebox=gtk_event_box_new();
+ GtkWidget *box=gtk_hbox_new(FALSE,0);
+ GtkWidget *image=gtk_image_new_from_stock(GTK_STOCK_REFRESH,GTK_ICON_SIZE_MENU);
+ GtkWidget *l;
+ gchar *buf;
+
+ buf=g_markup_printf_escaped(_("Recent calls (%i)"),nb);
+ l=gtk_label_new(NULL);
+ gtk_label_set_markup(GTK_LABEL(l),buf);
+ gtk_box_pack_start(GTK_BOX(box),image,FALSE,FALSE,0);
+ gtk_box_pack_start(GTK_BOX(box),l,FALSE,FALSE,0);
+ gtk_container_add(GTK_CONTAINER(ebox),box);
+ gtk_notebook_set_tab_label(notebook,page,ebox);
+ gtk_widget_add_events(ebox,GDK_BUTTON_PRESS_MASK);
+ g_signal_connect(G_OBJECT(ebox),"button_press_event",(GCallback)linphone_gtk_call_log_reset_missed_call,NULL);
+ gtk_widget_show_all(ebox);
+}
+
void linphone_gtk_call_log_update(GtkWidget *w){
GtkTreeView *v=GTK_TREE_VIEW(linphone_gtk_get_widget(w,"logs_view"));
GtkTreeStore *store;
const MSList *logs;
GtkTreeSelection *select;
+ GtkWidget *notebook=linphone_gtk_get_widget(w,"viewswitch");
+ gint nb;
store=(GtkTreeStore*)gtk_tree_view_get_model(v);
if (store==NULL){
- store=gtk_tree_store_new(3,GDK_TYPE_PIXBUF,G_TYPE_STRING,G_TYPE_POINTER);
+ store=gtk_tree_store_new(3,GDK_TYPE_PIXBUF,G_TYPE_STRING,G_TYPE_POINTER,G_TYPE_STRING);
gtk_tree_view_set_model(v,GTK_TREE_MODEL(store));
g_object_unref(G_OBJECT(store));
fill_renderers(GTK_TREE_VIEW(linphone_gtk_get_widget(w,"logs_view")));
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(notebook),"focus-tab",(GCallback)linphone_gtk_call_log_reset_missed_call,NULL);
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")));
}
+ nb=linphone_core_get_missed_calls_count(linphone_gtk_get_core());
+ if(nb > 0)
+ linphone_gtk_call_log_display_missed_call(nb);
gtk_tree_store_clear (store);
for (logs=linphone_core_get_call_logs(linphone_gtk_get_core());logs!=NULL;logs=logs->next){
@@ -237,7 +288,6 @@ void linphone_gtk_call_log_update(GtkWidget *w){
} else {
display=linphone_address_get_display_name(la);
}
-
if (display==NULL){
display=linphone_address_get_username (la);
if (display==NULL){
@@ -294,7 +344,6 @@ void linphone_gtk_call_log_update(GtkWidget *w){
g_free(logtxt);
g_free(headtxt);
}
-
}
void linphone_gtk_history_row_activated(GtkWidget *treeview){
diff --git a/gtk/chat.c b/gtk/chat.c
index 69c4e832f..cf6d61c98 100644
--- a/gtk/chat.c
+++ b/gtk/chat.c
@@ -61,10 +61,9 @@ void linphone_gtk_quit_chatroom(LinphoneChatRoom *cr) {
GtkWidget *nb=linphone_gtk_get_widget(main_window,"viewswitch");
GtkWidget *friendlist=linphone_gtk_get_widget(main_window,"contact_list");
GtkWidget *w=g_object_get_data(G_OBJECT(friendlist),"chatview");
- int idx = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(w),"idx"));
g_return_if_fail(w!=NULL);
- gtk_notebook_remove_page(GTK_NOTEBOOK(nb),idx);
+ gtk_notebook_remove_page(GTK_NOTEBOOK(nb),gtk_notebook_page_num(GTK_NOTEBOOK(nb),w));
linphone_gtk_create_chat_picture(FALSE);
g_object_set_data(G_OBJECT(friendlist),"chatview",NULL);
g_object_set_data(G_OBJECT(w),"from_message",NULL);
@@ -74,7 +73,8 @@ void linphone_gtk_quit_chatroom(LinphoneChatRoom *cr) {
}
const char* get_display_name(const LinphoneAddress *from){
- const char *display=linphone_address_get_display_name(from);
+ const char *display;
+ display=linphone_address_get_display_name(from);
if (display==NULL || display[0]=='\0') {
display=linphone_address_get_username(from);
}
@@ -92,7 +92,7 @@ GtkWidget *create_tab_chat_header(LinphoneChatRoom *cr,const LinphoneAddress *ur
gtk_button_set_relief(GTK_BUTTON(b),GTK_RELIEF_NONE);
gtk_widget_set_size_request(b,25,20);
g_signal_connect_swapped(G_OBJECT(b),"clicked",G_CALLBACK(linphone_gtk_quit_chatroom),cr);
- l=gtk_label_new (get_display_name(uri));
+ l=gtk_label_new(get_display_name(uri));
gtk_box_pack_start (GTK_BOX(w),i,FALSE,FALSE,0);
gtk_box_pack_start (GTK_BOX(w),l,FALSE,FALSE,0);
gtk_box_pack_end(GTK_BOX(w),b,TRUE,TRUE,0);
@@ -131,7 +131,12 @@ void linphone_gtk_push_text(GtkWidget *w, const LinphoneAddress *from,
char *from_message=(char *)g_object_get_data(G_OBJECT(w),"from_message");
GList *list=g_object_get_data(G_OBJECT(w),"list");
time_t t;
-
+ char buf[80];
+ time_t tnow;
+ struct tm *tm;
+ int tnow_day;
+ int tnow_year;
+
gtk_text_buffer_get_start_iter(buffer,&begin);
gtk_text_buffer_get_end_iter(buffer,&iter);
off=gtk_text_iter_get_offset(&iter);
@@ -162,15 +167,22 @@ void linphone_gtk_push_text(GtkWidget *w, const LinphoneAddress *from,
}
case LinphoneChatMessageStateDelivered:
{
- struct tm *tm=localtime(&t);
- char buf[80];
+ tnow=time(NULL);
+ tm=gmtime(&tnow);
+ tnow_day=tm->tm_yday;
+ tnow_year=tm->tm_year;
+ tm=gmtime(&t);
+ if(tnow_day != tm->tm_yday || (tnow_day == tm->tm_yday && tnow_year != tm->tm_year)) {
+ strftime(buf,80,"%a %x, %H:%M",tm);
+ } else {
strftime(buf,80,"%H:%M",tm);
- gtk_text_buffer_insert_with_tags_by_name(buffer,&iter,buf,-1,
- "right","small","italic","font_grey",me ? "bg":NULL,NULL);
- break;
+ }
+ gtk_text_buffer_insert_with_tags_by_name(buffer,&iter,buf,-1,
+ "right","small","italic","font_grey",me ? "bg":NULL,NULL);
+ break;
}
case LinphoneChatMessageStateNotDelivered:
- gtk_text_buffer_insert_with_tags_by_name(buffer,&iter,"Error",-1,
+ gtk_text_buffer_insert_with_tags_by_name(buffer,&iter,"Message not sent",-1,
"right","small","italic","font_grey",me ? "bg":NULL,NULL);
break;
default : gtk_text_buffer_insert_with_tags_by_name(buffer,&iter,"Sending ..",-1,
@@ -202,6 +214,7 @@ void update_chat_state_message(LinphoneChatMessageState state,LinphoneChatMessag
GtkTextIter iter;
GtkTextIter end;
GtkTextIter start;
+ gchar *result;
gtk_text_buffer_get_iter_at_line(b,&iter,
GPOINTER_TO_INT(g_list_nth_data(list,0)));
@@ -217,7 +230,6 @@ void update_chat_state_message(LinphoneChatMessageState state,LinphoneChatMessag
GPOINTER_TO_INT(g_list_nth_data(list,0)),0);
gtk_text_buffer_delete(b,&start,&end);
gtk_text_buffer_get_iter_at_line(b,&iter,GPOINTER_TO_INT(g_list_nth_data(list,0)));
- gchar *result;
switch (state) {
case LinphoneChatMessageStateInProgress:
result="Sending ";
@@ -225,7 +237,7 @@ void update_chat_state_message(LinphoneChatMessageState state,LinphoneChatMessag
case LinphoneChatMessageStateDelivered:
{
time_t t=time(NULL);
- struct tm *tm=localtime(&t);
+ struct tm *tm=gmtime(&t);
char buf[80];
strftime(buf,80,"%H:%M",tm);
result=buf;
@@ -295,6 +307,29 @@ void display_history_message(GtkWidget *chat_view,MSList *messages,const Linphon
}
}
+void linphone_gtk_chat_add_contact(const LinphoneAddress *addr){
+ //LinphoneAddress *addr=(LinphoneAddress *)data;
+ LinphoneFriend *lf=NULL;
+ char *uri=linphone_address_as_string(addr);
+ lf=linphone_friend_new_with_addr(uri);
+ ms_free(uri);
+ char *fixed_uri=NULL;
+ gboolean show_presence=FALSE;
+
+ linphone_friend_set_inc_subscribe_policy(lf,LinphoneSPDeny);
+ linphone_friend_send_subscribe(lf,show_presence);
+
+ linphone_core_interpret_friend_uri(linphone_gtk_get_core(),uri,&fixed_uri);
+ if (fixed_uri==NULL){
+ linphone_gtk_display_something(GTK_MESSAGE_WARNING,_("Invalid sip contact !"));
+ return ;
+ }
+ linphone_friend_set_addr(lf,addr);
+ linphone_core_add_friend(linphone_gtk_get_core(),lf);
+ ms_free(fixed_uri);
+ linphone_gtk_show_friends();
+}
+
GtkWidget* linphone_gtk_init_chatroom(LinphoneChatRoom *cr, const LinphoneAddress *with){
GtkWidget *chat_view=linphone_gtk_create_widget("main","chatroom_frame");
GtkWidget *main_window=linphone_gtk_get_main_window ();
@@ -312,7 +347,6 @@ GtkWidget* linphone_gtk_init_chatroom(LinphoneChatRoom *cr, const LinphoneAddres
color.red = 32512;
color.green = 32512;
color.blue = 32512;
-
colorb.red = 56832;
colorb.green = 60928;
colorb.blue = 61952;
@@ -321,12 +355,12 @@ GtkWidget* linphone_gtk_init_chatroom(LinphoneChatRoom *cr, const LinphoneAddres
linphone_chat_room_mark_as_read(cr);
gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(text),GTK_WRAP_WORD_CHAR);
gtk_text_view_set_editable(GTK_TEXT_VIEW(text),FALSE);
+ gtk_text_view_set_cursor_visible(GTK_TEXT_VIEW(text),FALSE);
gtk_notebook_append_page(notebook,chat_view,create_tab_chat_header(cr,with));
idx = gtk_notebook_page_num(notebook, chat_view);
gtk_notebook_set_current_page(notebook, idx);
gtk_widget_show(chat_view);
g_object_set_data(G_OBJECT(chat_view),"cr",cr);
- g_object_set_data(G_OBJECT(chat_view),"idx",GINT_TO_POINTER(idx));
g_object_set_data(G_OBJECT(chat_view),"from_message",NULL);
g_object_set_data(G_OBJECT(chat_view),"list",list);
gtk_text_buffer_create_tag(gtk_text_view_get_buffer(GTK_TEXT_VIEW(text)),
@@ -369,7 +403,7 @@ void linphone_gtk_load_chatroom(LinphoneChatRoom *cr,const LinphoneAddress *uri,
char *uri_str=linphone_address_as_string(uri);
char *uri_only=linphone_address_as_string_uri_only(uri);
MSList *messages=NULL;
-
+
linphone_chat_room_mark_as_read(cr);
if(g_strcmp0(from_str,uri_only)!=0){
GtkTextView *text_view=GTK_TEXT_VIEW(linphone_gtk_get_widget(chat_view,"textview"));
@@ -389,6 +423,7 @@ void linphone_gtk_load_chatroom(LinphoneChatRoom *cr,const LinphoneAddress *uri,
}
ms_free(from_str);
ms_free(uri_str);
+ ms_free(uri_only);
}
void linphone_gtk_chat_destroyed(GtkWidget *w){
@@ -408,18 +443,27 @@ void linphone_gtk_text_received(LinphoneCore *lc, LinphoneChatRoom *room,
GtkWidget *friendlist=linphone_gtk_get_widget(main_window,"contact_list");
GtkWidget *w;
gboolean send=TRUE;
-
+ GtkNotebook *notebook=(GtkNotebook *)linphone_gtk_get_widget(main_window,"viewswitch");
char *from=linphone_address_as_string(linphone_chat_message_get_from(msg));
+
w=(GtkWidget*)g_object_get_data(G_OBJECT(friendlist),"chatview");
if(w!=NULL){
char *from_chatview=(char *)g_object_get_data(G_OBJECT(friendlist),"from");
if(g_strcmp0(from,from_chatview)==0){
send=TRUE;
} else {
+ if(!linphone_gtk_friend_list_is_contact(linphone_chat_message_get_from(msg))){
+ //linphone_gtk_load_chatroom(room,linphone_chat_message_get_from(msg),w);
+ linphone_gtk_chat_add_contact(linphone_chat_message_get_from(msg));
+ }
send=FALSE;
}
} else {
send=FALSE;
+ if(!linphone_gtk_friend_list_is_contact(linphone_chat_message_get_from(msg))){
+ //linphone_gtk_load_chatroom(room,linphone_chat_message_get_from(msg),w);
+ linphone_gtk_chat_add_contact(linphone_chat_message_get_from(msg));
+ }
w=linphone_gtk_init_chatroom(room,linphone_chat_message_get_from(msg));
g_object_set_data(G_OBJECT(friendlist),"chatview",(gpointer)w);
g_object_set_data(G_OBJECT(friendlist),"from",from);
@@ -439,14 +483,13 @@ void linphone_gtk_text_received(LinphoneCore *lc, LinphoneChatRoom *room,
}
#endif
if(send){
- linphone_chat_room_mark_as_read(room);
+ if(gtk_notebook_get_current_page(notebook)!=gtk_notebook_page_num(notebook,w)){
+ linphone_gtk_show_friends();
+ }
linphone_gtk_push_text(w,linphone_chat_message_get_from(msg),
FALSE,room,msg,FALSE);
} else {
linphone_gtk_show_friends();
- //linphone_gtk_friend_list_update_message(msg);
}
- //linphone_gtk_update_chat_picture();
- //gtk_window_present(GTK_WINDOW(w));
- /*gtk_window_set_urgency_hint(GTK_WINDOW(w),TRUE);*/
+ //linphone_gtk_update_chat_picture();
}
diff --git a/gtk/friendlist.c b/gtk/friendlist.c
index 9f5a935b8..3997e29f3 100644
--- a/gtk/friendlist.c
+++ b/gtk/friendlist.c
@@ -32,7 +32,6 @@ enum{
FRIEND_ICON,
FRIEND_CALL,
FRIEND_CHAT,
- FRIEND_NB_UNREAD_MSG,
FRIEND_LIST_NCOL
};
@@ -76,17 +75,23 @@ static GdkPixbuf *create_call_picture(){
return pixbuf;
}
+static GdkPixbuf *create_unread_msg(){
+ GdkPixbuf *pixbuf;
+ pixbuf = create_pixbuf("active_chat.png");
+ return pixbuf;
+}
+
static GdkPixbuf *create_chat_picture(){
GdkPixbuf *pixbuf;
pixbuf = create_pixbuf("chat.png");
return pixbuf;
}
-static GdkPixbuf *create_active_chat_picture(){
+/*static GdkPixbuf *create_active_chat_picture(){
GdkPixbuf *pixbuf;
pixbuf = create_pixbuf("active_chat.png");
return pixbuf;
-}
+}*/
/*
void linphone_gtk_set_friend_status(GtkWidget *friendlist , LinphoneFriend * fid, const gchar *url, const gchar *status, const gchar *img){
GtkTreeIter iter;
@@ -110,6 +115,16 @@ void linphone_gtk_set_friend_status(GtkWidget *friendlist , LinphoneFriend * fid
}
}
*/
+
+gboolean linphone_gtk_friend_list_is_contact(const LinphoneAddress *addr){
+ LinphoneFriend *lf;
+ char *addr_str=linphone_address_as_string(addr);
+ lf=linphone_core_get_friend_by_address(linphone_gtk_get_core(),addr_str);
+ if(lf == NULL){
+ return FALSE;
+ } return TRUE;
+}
+
static void linphone_gtk_set_selection_to_uri_bar(GtkTreeView *treeview){
GtkTreeSelection *select;
GtkTreeIter iter;
@@ -156,28 +171,51 @@ void linphone_gtk_remove_contact(GtkWidget *button){
GtkTreeIter iter;
GtkTreeModel *model;
LinphoneFriend *lf=NULL;
+ LinphoneChatRoom *cr=NULL;
select = gtk_tree_view_get_selection(GTK_TREE_VIEW(linphone_gtk_get_widget(w,"contact_list")));
if (gtk_tree_selection_get_selected (select, &model, &iter))
{
gtk_tree_model_get (model, &iter,FRIEND_ID , &lf, -1);
linphone_core_remove_friend(linphone_gtk_get_core(),lf);
+ gtk_tree_model_get (model, &iter,FRIEND_CHATROOM , &cr, -1);
+ linphone_chat_room_delete_history(cr);
linphone_gtk_show_friends();
}
}
void linphone_gtk_delete_history(GtkWidget *button){
- GtkWidget *w=gtk_widget_get_toplevel(button);
+ GtkWidget *w=linphone_gtk_get_main_window();
GtkTreeSelection *select;
GtkTreeIter iter;
GtkTreeModel *model;
+ GtkWidget *chat_view;
LinphoneFriend *lf=NULL;
- select = gtk_tree_view_get_selection(GTK_TREE_VIEW(linphone_gtk_get_widget(w,"contact_list")));
+ GtkWidget *friendlist;
+
+ friendlist=linphone_gtk_get_widget(w,"contact_list");
+ chat_view=(GtkWidget *)g_object_get_data(G_OBJECT(friendlist),"chatview");
+ select = gtk_tree_view_get_selection(GTK_TREE_VIEW(friendlist));
if (gtk_tree_selection_get_selected (select, &model, &iter))
{
LinphoneChatRoom *cr;
gtk_tree_model_get (model, &iter,FRIEND_ID , &lf, -1);
- cr=linphone_core_get_chat_room(linphone_gtk_get_core(),linphone_friend_get_address(lf));
+ gtk_tree_model_get (model, &iter,FRIEND_CHATROOM , &cr, -1);
linphone_chat_room_delete_history(cr);
+ if(chat_view!=NULL){
+ char *from=g_object_get_data(G_OBJECT(friendlist),"from");
+ char *addr=linphone_address_as_string(linphone_friend_get_address(lf));
+ if(g_strcmp0(from,addr)==0){
+ GtkTextView *text_view=GTK_TEXT_VIEW(linphone_gtk_get_widget(chat_view,"textview"));
+ GtkTextIter start;
+ GtkTextIter end;
+ GtkTextBuffer *text_buffer;
+
+ text_buffer=gtk_text_view_get_buffer(text_view);
+ gtk_text_buffer_get_bounds(text_buffer, &start, &end);
+ gtk_text_buffer_delete (text_buffer, &start, &end);
+ g_object_set_data(G_OBJECT(chat_view),"from_message",NULL);
+ }
+ }
linphone_gtk_show_friends();
}
}
@@ -209,7 +247,7 @@ static gboolean grab_focus(GtkWidget *w){
return FALSE;
}
-void linphone_gtk_tree_view_set_chat_conversation(LinphoneAddress *la){
+void linphone_gtk_tree_view_set_chat_conversation(const LinphoneAddress *la){
GtkTreeIter iter;
GtkListStore *store=NULL;
GtkWidget *w = linphone_gtk_get_main_window();
@@ -240,7 +278,7 @@ void linphone_gtk_tree_view_set_chat_conversation(LinphoneAddress *la){
do{
const LinphoneAddress *uri;
char *lf_str;
- gtk_tree_model_get (model, &iter,FRIEND_ID , &lf, -1);
+ 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){
@@ -259,14 +297,30 @@ void linphone_gtk_tree_view_set_chat_conversation(LinphoneAddress *la){
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));
}
+ }
+}
+
+void linphone_gtk_notebook_tab_select(GtkNotebook *notebook,GtkWidget *page,guint page_num, gpointer data){
+ GtkWidget *w=linphone_gtk_get_main_window();
+ GtkWidget *friendlist=linphone_gtk_get_widget(w,"contact_list");
+ GtkWidget *chat_view;
+ LinphoneChatRoom *cr=NULL;
+ const LinphoneAddress *addr=(const LinphoneAddress *)data;
+ chat_view=(GtkWidget*)g_object_get_data(G_OBJECT(friendlist),"chatview");
+ if(page != NULL){
+ notebook=(GtkNotebook *)linphone_gtk_get_widget(w,"viewswitch");
+ if(gtk_notebook_page_num(notebook,page)==gtk_notebook_page_num(notebook,chat_view)){
+ cr=linphone_core_get_chat_room(linphone_gtk_get_core(),addr);
+ if(cr!=NULL){
+ linphone_chat_room_mark_as_read(cr);
+ linphone_gtk_show_friends();
+ }
+ }
}
-
}
void linphone_gtk_chat_selected(GtkWidget *item){
@@ -303,8 +357,7 @@ void linphone_gtk_chat_selected(GtkWidget *item){
gtk_notebook_set_current_page(notebook,gtk_notebook_page_num(notebook,page));
linphone_gtk_create_chat_picture(FALSE);
g_idle_add((GSourceFunc)grab_focus,linphone_gtk_get_widget(page,"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);
+ g_signal_connect(G_OBJECT(notebook),"switch_page",(GCallback)linphone_gtk_notebook_tab_select,(gpointer)uri);
}
}
@@ -577,8 +630,7 @@ static void linphone_gtk_friend_list_init(GtkWidget *friendlist){
linphone_gtk_init_bookmark_icon();
store = gtk_list_store_new(FRIEND_LIST_NCOL,GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_POINTER,
- G_TYPE_POINTER, G_TYPE_STRING, GDK_TYPE_PIXBUF, GDK_TYPE_PIXBUF, GDK_TYPE_PIXBUF,
- G_TYPE_STRING, G_TYPE_STRING);
+ G_TYPE_POINTER, G_TYPE_STRING, GDK_TYPE_PIXBUF, GDK_TYPE_PIXBUF, GDK_TYPE_PIXBUF);
gtk_tree_view_set_model(GTK_TREE_VIEW(friendlist),GTK_TREE_MODEL(store));
g_object_unref(G_OBJECT(store));
@@ -588,7 +640,7 @@ static void linphone_gtk_friend_list_init(GtkWidget *friendlist){
gtk_tree_view_set_search_equal_func(GTK_TREE_VIEW(friendlist),friend_search_func,NULL,NULL);
gtk_tree_view_set_search_column(GTK_TREE_VIEW(friendlist),FRIEND_NAME);
gtk_tree_sortable_set_sort_func(GTK_TREE_SORTABLE(store),FRIEND_NAME,friend_sort,NULL,NULL);
-
+
/*Name and presence column*/
renderer = gtk_cell_renderer_text_new ();
column = gtk_tree_view_column_new_with_attributes (_("Presence status"),
@@ -599,6 +651,7 @@ static void linphone_gtk_friend_list_init(GtkWidget *friendlist){
g_signal_connect_swapped(G_OBJECT(column),"clicked",(GCallback)on_presence_column_clicked,GTK_TREE_MODEL(store));
gtk_tree_view_column_set_clickable(column,TRUE);
gtk_tree_view_column_set_visible(column,linphone_gtk_get_ui_config_int("friendlist_status",1));
+ gtk_tree_view_column_set_min_width(column,50);
renderer = gtk_cell_renderer_pixbuf_new();
gtk_tree_view_column_pack_start(column,renderer,TRUE);
@@ -616,11 +669,6 @@ static void linphone_gtk_friend_list_init(GtkWidget *friendlist){
gtk_tree_view_column_set_clickable(column,TRUE);
gtk_tree_view_column_set_expand(column,TRUE);
gtk_tree_view_column_set_max_width(column,60);
-
- renderer = gtk_cell_renderer_text_new ();
- gtk_tree_view_column_pack_start(column,renderer,TRUE);
- gtk_tree_view_column_add_attribute (column,renderer,"text",FRIEND_NB_UNREAD_MSG);
-
gtk_tree_view_append_column (GTK_TREE_VIEW (friendlist), column);
/* Call column*/
@@ -641,7 +689,7 @@ static void linphone_gtk_friend_list_init(GtkWidget *friendlist){
gtk_tree_view_set_tooltip_column(GTK_TREE_VIEW(friendlist),FRIEND_SIP_ADDRESS);
#endif
- gtk_widget_set_size_request(friendlist,200,100);
+ gtk_widget_set_size_request(friendlist,200,120);
/*gtk_combo_box_set_active(GTK_COMBO_BOX(linphone_gtk_get_widget(
gtk_widget_get_toplevel(friendlist),"show_category")),0);*/
}
@@ -713,7 +761,6 @@ void linphone_gtk_show_friends(void){
LinphoneChatRoom *cr=NULL;
linphone_gtk_show_directory_search();
-
if (gtk_tree_view_get_model(GTK_TREE_VIEW(friendlist))==NULL){
linphone_gtk_friend_list_init(friendlist);
}
@@ -735,7 +782,7 @@ void linphone_gtk_show_friends(void){
const char *name=linphone_address_get_display_name(f_uri);
const char *display=name;
char *escaped=NULL;
- char buf[26]={0};
+ //char buf[26]={0};
int nbmsg=0;
/*if (lookup){
@@ -752,26 +799,13 @@ void linphone_gtk_show_friends(void){
gtk_list_store_append(store,&iter);
gtk_list_store_set(store,&iter,FRIEND_NAME, display,FRIEND_ID,lf,
FRIEND_PRESENCE_IMG, send_subscribe ? create_status_picture(linphone_friend_get_status(lf)) : NULL,
- -1);
-
- gtk_tree_model_get(gtk_tree_view_get_model(GTK_TREE_VIEW(friendlist)),&iter,FRIEND_CHATROOM,&cr,-1);
- if(cr!=NULL){
- nbmsg=linphone_chat_room_get_unread_messages_count(cr);
- if(nbmsg != 0){
- sprintf(buf,"%i",nbmsg);
- }
- } else {
- cr=linphone_gtk_create_chatroom(f_uri);
- gtk_list_store_set(store,&iter,FRIEND_CHATROOM,cr,-1);
- nbmsg=linphone_chat_room_get_unread_messages_count(cr);
- if(nbmsg != 0){
- sprintf(buf,"%i",nbmsg);
- }
+ FRIEND_CHAT,create_chat_picture(),FRIEND_CALL,create_call_picture(),-1);
+ cr=linphone_gtk_create_chatroom(f_uri);
+ gtk_list_store_set(store,&iter,FRIEND_CHATROOM,cr,-1);
+ nbmsg=linphone_chat_room_get_unread_messages_count(cr);
+ if(nbmsg != 0){
+ gtk_list_store_set(store,&iter,FRIEND_CHAT,create_unread_msg(),-1);
}
-
- gtk_list_store_set(store,&iter,FRIEND_CALL,create_call_picture(),-1);
- gtk_list_store_set(store,&iter,FRIEND_CHAT,create_chat_picture(),-1);
- gtk_list_store_set(store,&iter,FRIEND_NB_UNREAD_MSG,buf,-1);
escaped=g_markup_escape_text(uri,-1);
gtk_list_store_set(store,&iter,FRIEND_SIP_ADDRESS,escaped,-1);
g_free(escaped);
@@ -823,6 +857,7 @@ void linphone_gtk_contact_ok(GtkWidget *button){
char *fixed_uri=NULL;
gboolean show_presence=FALSE,allow_presence=FALSE;
const gchar *name,*uri;
+ LinphoneAddress* friend_address;
if (lf==NULL){
lf=linphone_friend_new();
if (linphone_gtk_get_ui_config_int("use_subscribe_notify",1)==1){
@@ -841,7 +876,7 @@ void linphone_gtk_contact_ok(GtkWidget *button){
linphone_gtk_display_something(GTK_MESSAGE_WARNING,_("Invalid sip contact !"));
return ;
}
- LinphoneAddress* friend_address = linphone_address_new(fixed_uri);
+ friend_address = linphone_address_new(fixed_uri);
linphone_address_set_display_name(friend_address,name);
linphone_friend_set_addr(lf,friend_address);
linphone_address_destroy(friend_address);
diff --git a/gtk/incall_view.c b/gtk/incall_view.c
index 0a64a1041..4ab0bd72e 100644
--- a/gtk/incall_view.c
+++ b/gtk/incall_view.c
@@ -431,8 +431,6 @@ void linphone_gtk_remove_in_call_view(LinphoneCall *call){
int idx;
g_return_if_fail(w!=NULL);
idx=gtk_notebook_page_num(GTK_NOTEBOOK(nb),w);
- gtk_notebook_remove_page (GTK_NOTEBOOK(nb),idx);
- gtk_widget_destroy(w);
if (in_conf){
linphone_gtk_unset_from_conference(call);
}
@@ -444,12 +442,13 @@ void linphone_gtk_remove_in_call_view(LinphoneCall *call){
/*show the conference*/
gtk_notebook_set_current_page(GTK_NOTEBOOK(nb),gtk_notebook_page_num(GTK_NOTEBOOK(nb),
g_object_get_data(G_OBJECT(main_window),"conf_frame")));
- }else gtk_notebook_set_current_page(GTK_NOTEBOOK(nb), 0);
+ }else gtk_notebook_prev_page(GTK_NOTEBOOK(nb));
}else{
/*show the active call*/
- gtk_notebook_set_current_page(GTK_NOTEBOOK(nb),gtk_notebook_page_num(GTK_NOTEBOOK(nb),
- linphone_call_get_user_pointer(call)));
+ gtk_notebook_set_current_page(GTK_NOTEBOOK(nb),gtk_notebook_page_num(GTK_NOTEBOOK(nb), linphone_call_get_user_pointer(call)));
}
+ gtk_notebook_remove_page (GTK_NOTEBOOK(nb),idx);
+ gtk_widget_destroy(w);
}
static void display_peer_name_in_label(GtkWidget *label, const LinphoneAddress *from){
diff --git a/gtk/linphone.h b/gtk/linphone.h
index ccdebea69..00484a04f 100644
--- a/gtk/linphone.h
+++ b/gtk/linphone.h
@@ -152,5 +152,5 @@ void linphone_gtk_monitor_usb(void);
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);
+void linphone_gtk_tree_view_set_chat_conversation(const LinphoneAddress *la);
+gboolean linphone_gtk_friend_list_is_contact(const LinphoneAddress *addr);
\ No newline at end of file
diff --git a/gtk/main.c b/gtk/main.c
index b188782ab..e3699757f 100644
--- a/gtk/main.c
+++ b/gtk/main.c
@@ -1726,6 +1726,7 @@ static void linphone_gtk_init_main_window(){
linphone_gtk_load_identities();
linphone_gtk_set_my_presence(linphone_core_get_presence_info(linphone_gtk_get_core()));
linphone_gtk_show_friends();
+ linphone_core_reset_missed_calls_count(linphone_gtk_get_core());
main_window=linphone_gtk_get_main_window();
linphone_gtk_call_log_update(main_window);
@@ -1748,7 +1749,6 @@ static void linphone_gtk_init_main_window(){
linphone_gtk_check_menu_items();
}
-
void linphone_gtk_log_handler(OrtpLogLevel lev, const char *fmt, va_list args){
if (verbose){
const char *lname="undef";
diff --git a/gtk/main.ui b/gtk/main.ui
index 0b27240e7..347a402ea 100644
--- a/gtk/main.ui
+++ b/gtk/main.ui
@@ -794,6 +794,8 @@