# HG changeset patch # User Daniel Atallah # Date 1196216069 0 # Node ID bd36fdd36e92ca991c93e7873333ab55c3b4c17c # Parent 8afd3495c4881161bbc075cae8be2b034d3bf300 Fix crashing in the Timestamp plugin. Fixes #4087. diff -r 8afd3495c488 -r bd36fdd36e92 pidgin/plugins/timestamp.c --- a/pidgin/plugins/timestamp.c Wed Nov 28 01:34:48 2007 +0000 +++ b/pidgin/plugins/timestamp.c Wed Nov 28 02:14:29 2007 +0000 @@ -49,11 +49,17 @@ const char *mdate; int y, height; GdkRectangle rect; - + /* display timestamp */ mdate = purple_utf8_strftime(then == 0 ? "%H:%M" : "\n%H:%M", localtime(&now)); gtk_text_buffer_get_end_iter(buffer, &iter); + + if (gtk_text_tag_table_lookup(gtk_text_buffer_get_tag_table(buffer), "TIMESTAMP") == NULL) + gtk_text_buffer_create_tag(buffer, "TIMESTAMP", + "foreground", "#888888", "justification", GTK_JUSTIFY_CENTER, + "weight", PANGO_WEIGHT_BOLD, NULL); + gtk_text_buffer_insert_with_tags_by_name(buffer, &iter, mdate, strlen(mdate), "TIMESTAMP", NULL); @@ -95,17 +101,9 @@ static void timestamp_new_convo(PurpleConversation *conv) { - PidginConversation *gtk_conv = PIDGIN_CONVERSATION(conv); - GtkTextBuffer *buffer; - if (!g_list_find(purple_get_conversations(), conv)) return; - buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtk_conv->imhtml)); - gtk_text_buffer_create_tag(buffer, "TIMESTAMP", - "foreground", "#888888", "justification", GTK_JUSTIFY_CENTER, - "weight", PANGO_WEIGHT_BOLD, NULL); - purple_conversation_set_data(conv, "timestamp-last", GINT_TO_POINTER(0)); }