]> sjero.net Git - linphone/blobdiff - gtk/chat.c
change unread messages picture
[linphone] / gtk / chat.c
index 9c0f64bbbe9cfab1e09d23cb98efbb4986e464a5..9bcf0bb8b98b20bc368e8b2a12dbb692aa89310f 100644 (file)
@@ -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 {
@@ -410,18 +410,11 @@ void linphone_gtk_load_chatroom(LinphoneChatRoom *cr,const LinphoneAddress *uri,
                GtkTextIter start;
                GtkTextIter end;
                GtkTextBuffer *text_buffer;
-               GtkWidget *cb;
                
                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);
                udpate_tab_chat_header(chat_view,uri,cr);
-               cb=linphone_gtk_get_widget(chat_view,"contact_bar");
-               if(!linphone_gtk_friend_list_is_contact(uri)){
-                       gtk_widget_show(cb);
-               } else {
-                       gtk_widget_hide(cb);
-               }
                g_object_set_data(G_OBJECT(chat_view),"cr",cr);
                g_object_set_data(G_OBJECT(linphone_gtk_get_widget(main_window,"contact_list")),"chatview",(gpointer)chat_view);
                messages=linphone_chat_room_get_history(cr,NB_MSG_HIST);
@@ -457,10 +450,10 @@ void linphone_gtk_text_received(LinphoneCore *lc, LinphoneChatRoom *room,
     if(w!=NULL){
                char *from_chatview=(char *)g_object_get_data(G_OBJECT(friendlist),"from");
                if(g_strcmp0(from,from_chatview)==0){
+                       linphone_chat_room_mark_as_read(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;
@@ -468,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));
@@ -476,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);
@@ -498,5 +491,4 @@ void linphone_gtk_text_received(LinphoneCore *lc, LinphoneChatRoom *room,
        } else {
                linphone_gtk_show_friends();
        }
-       //linphone_gtk_update_chat_picture();
 }