Mon, 07 Jun 2021 22:26:23 -0500
Replace newlines in topics with spaces.
Testing Done:
Set an xmpp conference topic to "this\r\nis\r\na\r\nstupid\r\ntopic" and verified it didn't expand the infopane.
Bugs closed: PIDGIN-16704
Reviewed at https://reviews.imfreedom.org/r/730/
| pidgin/gtkconv.c | file | annotate | diff | comparison | revisions |
--- a/pidgin/gtkconv.c Mon Jun 07 22:21:56 2021 -0500 +++ b/pidgin/gtkconv.c Mon Jun 07 22:26:23 2021 -0500 @@ -6748,11 +6748,22 @@ if (gtkchat->topic_text != NULL) { + gchar *tmp1 = NULL, *tmp2 = NULL; + topic = purple_conv_chat_get_topic(chat); - gtk_entry_set_text(GTK_ENTRY(gtkchat->topic_text), topic ? topic : ""); + /* replace \r\n with a space */ + tmp1 = purple_strreplace(topic, "\r\n", " "); + + /* replace \n with a space */ + tmp2 = purple_strreplace(tmp1, "\n", " "); + g_free(tmp1); + + gtk_entry_set_text(GTK_ENTRY(gtkchat->topic_text), tmp2 ? tmp2 : ""); gtk_tooltips_set_tip(gtkconv->tooltips, gtkchat->topic_text, - topic ? topic : "", NULL); + tmp2 ? tmp2 : "", NULL); + + g_free(tmp2); } }