comparison gtk/gtkconv.c @ 15359:7c41ecf41614

[gaim-migrate @ 18151] Revert GtkIMHtml hacks that tried to fix gtkimhtml bugs, replace it with heuristic workaround. If you receive a message with more than 100 HTML tags strip all formatting before displaying it. Hopefully nobody has any legitimate uses for 100 HTML tags in a message. I guess we'll see in beta6... which I think we're good for now. I think that post-2.0.0 we'll wind up replacing GtkIMHtml with a legitimate HTML widget and do the Adium/Kopete "chat theme" thing. An HTML widget should be able to handle formatting more efficiently than GtkTextView. committer: Tailor Script <tailor@pidgin.im>
author Sean Egan <seanegan@gmail.com>
date Thu, 18 Jan 2007 02:35:14 +0000
parents db11d9e416ac
children
comparison
equal deleted inserted replaced
15358:b49e2327088a 15359:7c41ecf41614
4808 char *sml_attrib = NULL; 4808 char *sml_attrib = NULL;
4809 size_t length; 4809 size_t length;
4810 GaimConversationType type; 4810 GaimConversationType type;
4811 char *displaying; 4811 char *displaying;
4812 gboolean plugin_return; 4812 gboolean plugin_return;
4813 4813 char *bracket;
4814 int tag_count = 0;
4815
4814 g_return_if_fail(conv != NULL); 4816 g_return_if_fail(conv != NULL);
4815 gtkconv = GAIM_GTK_CONVERSATION(conv); 4817 gtkconv = GAIM_GTK_CONVERSATION(conv);
4816 g_return_if_fail(gtkconv != NULL); 4818 g_return_if_fail(gtkconv != NULL);
4817 4819
4818 if (conv != gtkconv->active_conv) 4820 if (conv != gtkconv->active_conv)
4851 return; 4853 return;
4852 } 4854 }
4853 message = displaying; 4855 message = displaying;
4854 length = strlen(message) + 1; 4856 length = strlen(message) + 1;
4855 4857
4858 /* Awful hack to work around GtkIMHtml's inefficient rendering of messages with lots of formatting changes.
4859 * If a message has over 100 '<' characters, strip formatting before appending it. Hopefully nobody actually
4860 * needs that much formatting, anyway.
4861 */
4862 for (bracket = strchr(message, '<'); bracket && *(bracket + 1); bracket = strchr(bracket + 1, '<'))
4863 tag_count++;
4864
4865 if (tag_count > 100) {
4866 char *tmp = message;
4867 message = displaying = gaim_markup_strip_html(message);
4868 g_free(tmp);
4869 }
4870
4856 win = gtkconv->win; 4871 win = gtkconv->win;
4857 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); 4872 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl);
4858 4873
4859 line_count = gtk_text_buffer_get_line_count( 4874 line_count = gtk_text_buffer_get_line_count(
4860 gtk_text_view_get_buffer(GTK_TEXT_VIEW( 4875 gtk_text_view_get_buffer(GTK_TEXT_VIEW(