Commit 4da21ea4 authored by Yann Diorcet's avatar Yann Diorcet
Browse files

Merge branch 'master' into belle-sip

Conflicts:
	coreapi/linphonecore.h
parents f0a62d53 aad536f0
......@@ -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)
......@@ -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
......@@ -40,6 +40,7 @@ LOCAL_C_INCLUDES = \
LOCAL_SHARED_LIBRARIES = \
libxml2 \
liblinphonenoneon \
liblinphone \
LOCAL_MODULE := liblpc2xml
......
......@@ -40,6 +40,7 @@ LOCAL_C_INCLUDES = \
LOCAL_SHARED_LIBRARIES = \
libxml2 \
liblinphonenoneon \
liblinphone \
LOCAL_MODULE := libxml2lpc
......
......@@ -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);
......
......@@ -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)
......
......@@ -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.");
......
......@@ -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(_("<b>Recent calls (%i)</b>"),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){
......
......@@ -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();
}
......@@ -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;