]> sjero.net Git - linphone/blobdiff - gtk/chat.c
Updated translation file
[linphone] / gtk / chat.c
index cf6d61c98f7ec8e6f6c578fb92c2717591222b4e..4fa1c917c440d32458dbd22d3a001e3bafcf560b 100644 (file)
@@ -64,7 +64,7 @@ void linphone_gtk_quit_chatroom(LinphoneChatRoom *cr) {
        
        g_return_if_fail(w!=NULL);
        gtk_notebook_remove_page(GTK_NOTEBOOK(nb),gtk_notebook_page_num(GTK_NOTEBOOK(nb),w));
-       linphone_gtk_create_chat_picture(FALSE);
+       linphone_gtk_friend_list_update_chat_picture();
        g_object_set_data(G_OBJECT(friendlist),"chatview",NULL);
        g_object_set_data(G_OBJECT(w),"from_message",NULL);     
        g_object_set_data(G_OBJECT(w),"cr",NULL);
@@ -168,10 +168,10 @@ void linphone_gtk_push_text(GtkWidget *w, const LinphoneAddress *from,
                case LinphoneChatMessageStateDelivered:
                {
                        tnow=time(NULL);
-                       tm=gmtime(&tnow);
+                       tm=localtime(&tnow);
                        tnow_day=tm->tm_yday;
                        tnow_year=tm->tm_year;
-                       tm=gmtime(&t);
+                       tm=localtime(&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 {
@@ -237,7 +237,7 @@ void update_chat_state_message(LinphoneChatMessageState state,LinphoneChatMessag
                        case LinphoneChatMessageStateDelivered:
                        {
                                time_t t=time(NULL);
-                               struct tm *tm=gmtime(&t);
+                               struct tm *tm=localtime(&t);
                                char buf[80];
                                strftime(buf,80,"%H:%M",tm);
                                result=buf;
@@ -385,6 +385,7 @@ GtkWidget* linphone_gtk_init_chatroom(LinphoneChatRoom *cr, const LinphoneAddres
        g_signal_connect_swapped(G_OBJECT(button),"clicked",(GCallback)linphone_gtk_send_text,NULL);
        entry = linphone_gtk_get_widget(chat_view,"text_entry");
        g_signal_connect_swapped(G_OBJECT(entry),"activate",(GCallback)linphone_gtk_send_text,NULL);
+       g_signal_connect(G_OBJECT(notebook),"switch_page",(GCallback)linphone_gtk_notebook_tab_select,NULL);
        ms_free(with_str);
        return chat_view;
 }
@@ -404,13 +405,13 @@ void linphone_gtk_load_chatroom(LinphoneChatRoom *cr,const LinphoneAddress *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"));
                GtkTextIter start;
                GtkTextIter end;
                GtkTextBuffer *text_buffer;
-               
+
+               linphone_chat_room_mark_as_read(cr);
                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);
@@ -453,7 +454,6 @@ void linphone_gtk_text_received(LinphoneCore *lc, LinphoneChatRoom *room,
                        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;
@@ -461,7 +461,6 @@ void linphone_gtk_text_received(LinphoneCore *lc, LinphoneChatRoom *room,
     } 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));
@@ -469,6 +468,7 @@ void linphone_gtk_text_received(LinphoneCore *lc, LinphoneChatRoom *room,
                g_object_set_data(G_OBJECT(friendlist),"from",from);
     }
        get_display_name(linphone_chat_message_get_from(msg));
+       
        #ifdef HAVE_GTK_OSXs
        /* Notified when a new message is sent */
        linphone_gtk_status_icon_set_blinking(TRUE);
@@ -485,11 +485,12 @@ void linphone_gtk_text_received(LinphoneCore *lc, LinphoneChatRoom *room,
        if(send){
                if(gtk_notebook_get_current_page(notebook)!=gtk_notebook_page_num(notebook,w)){
                        linphone_gtk_show_friends();
+               } else {
+                       linphone_chat_room_mark_as_read(room);
                }
                linphone_gtk_push_text(w,linphone_chat_message_get_from(msg),
                              FALSE,room,msg,FALSE);
        } else {
                linphone_gtk_show_friends();
        }
-       //linphone_gtk_update_chat_picture();
 }