comparison plugins/history.c @ 11814:fa17fc619f17

[gaim-migrate @ 14105] Fix the display of smilies in text added to the imhtml by the history plugin. Fixes part of SF Bug #1298455. committer: Tailor Script <tailor@pidgin.im>
author Richard Laager <rlaager@wiktel.com>
date Tue, 25 Oct 2005 13:29:28 +0000
parents f36471a3c258
children bc45ab9756b5
comparison
equal deleted inserted replaced
11813:1f7f4f850db5 11814:fa17fc619f17
41 GaimGtkConversation *gtkconv; 41 GaimGtkConversation *gtkconv;
42 GtkIMHtmlOptions options = GTK_IMHTML_NO_COLOURS; 42 GtkIMHtmlOptions options = GTK_IMHTML_NO_COLOURS;
43 time_t tm; 43 time_t tm;
44 char day[64]; 44 char day[64];
45 char *header; 45 char *header;
46 char *protocol;
46 47
47 convtype = gaim_conversation_get_type(c); 48 convtype = gaim_conversation_get_type(c);
48 gtkconv = GAIM_GTK_CONVERSATION(c); 49 gtkconv = GAIM_GTK_CONVERSATION(c);
49 if (convtype == GAIM_CONV_TYPE_IM && g_list_length(gtkconv->convs) < 2) 50 if (convtype == GAIM_CONV_TYPE_IM && g_list_length(gtkconv->convs) < 2)
50 { 51 {
109 history = gaim_log_read((GaimLog*)logs->data, &flags); 110 history = gaim_log_read((GaimLog*)logs->data, &flags);
110 gtkconv = GAIM_GTK_CONVERSATION(c); 111 gtkconv = GAIM_GTK_CONVERSATION(c);
111 if (flags & GAIM_LOG_READ_NO_NEWLINE) 112 if (flags & GAIM_LOG_READ_NO_NEWLINE)
112 options |= GTK_IMHTML_NO_NEWLINE; 113 options |= GTK_IMHTML_NO_NEWLINE;
113 114
115 protocol = g_strdup(gtk_imhtml_get_protocol_name(GTK_IMHTML(gtkconv->imhtml)));
116 gtk_imhtml_set_protocol_name(GTK_IMHTML(gtkconv->imhtml),
117 gaim_account_get_protocol_name(((GaimLog*)logs->data)->account));
118
114 tm = ((GaimLog *)logs->data)->time; 119 tm = ((GaimLog *)logs->data)->time;
115 gaim_strftime(day, sizeof(day), "%c", localtime(&tm)); 120 gaim_strftime(day, sizeof(day), "%c", localtime(&tm));
116 header = g_strdup_printf("<b>Conversation with %s on %s:</b><br>", alias, day); 121 header = g_strdup_printf("<b>Conversation with %s on %s:</b><br>", alias, day);
117 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), header, options); 122 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), header, options);
118 g_free(header); 123 g_free(header);
119 124
120 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), history, options); 125 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), history, options);
121 g_free(history); 126 g_free(history);
122 127
123 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), "<hr>", options); 128 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), "<hr>", options);
129
130 gtk_imhtml_set_protocol_name(GTK_IMHTML(gtkconv->imhtml), protocol);
131 g_free(protocol);
124 132
125 g_object_ref(G_OBJECT(gtkconv->imhtml)); 133 g_object_ref(G_OBJECT(gtkconv->imhtml));
126 g_idle_add(_scroll_imhtml_to_end, gtkconv->imhtml); 134 g_idle_add(_scroll_imhtml_to_end, gtkconv->imhtml);
127 135
128 g_list_foreach(logs, (GFunc)gaim_log_free, NULL); 136 g_list_foreach(logs, (GFunc)gaim_log_free, NULL);