From: Tim R. <ma...@us...> - 2004-08-16 01:15:07
|
Update of /cvsroot/gaim/gaim/src/protocols/jabber In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31211/src/protocols/jabber Modified Files: chat.c message.c Log Message: nosnilmot writes: This patch auto-linkifies the topic in chats in IRC, Jabber & SILC, so you can now do /topic and get clickable links. Much more fun than copy & paste. This looks a little ugly to me. Too much code seems duplicated. But it was already duplicated, stu just made it do a little more. Index: chat.c =================================================================== RCS file: /cvsroot/gaim/gaim/src/protocols/jabber/chat.c,v retrieving revision 1.36 retrieving revision 1.37 diff -u -d -p -r1.36 -r1.37 --- chat.c 15 Aug 2004 23:24:14 -0000 1.36 +++ chat.c 16 Aug 2004 01:14:57 -0000 1.37 @@ -549,11 +549,15 @@ void jabber_chat_change_topic(JabberChat jabber_message_free(jm); } else { const char *cur = gaim_conv_chat_get_topic(GAIM_CONV_CHAT(chat->conv)); - char *buf; + char *buf, *tmp, *tmp2; - if(cur) - buf = g_strdup_printf(_("current topic is: %s"), cur); - else + if(cur) { + tmp = gaim_escape_html(cur); + tmp2 = gaim_markup_linkify(tmp); + buf = g_strdup_printf(_("current topic is: %s"), tmp2); + g_free(tmp); + g_free(tmp2); + } else buf = g_strdup(_("No topic is set")); gaim_conv_chat_write(GAIM_CONV_CHAT(chat->conv), "", buf, GAIM_MESSAGE_SYSTEM | GAIM_MESSAGE_NO_LOG, time(NULL)); Index: message.c =================================================================== RCS file: /cvsroot/gaim/gaim/src/protocols/jabber/message.c,v retrieving revision 1.38 retrieving revision 1.39 diff -u -d -p -r1.38 -r1.39 --- message.c 24 Jul 2004 15:18:32 -0000 1.38 +++ message.c 16 Aug 2004 01:14:57 -0000 1.39 @@ -168,12 +168,16 @@ static void handle_groupchat(JabberMessa gaim_conv_chat_set_topic(GAIM_CONV_CHAT(chat->conv), jid->resource, jm->subject); if(!jm->xhtml && !jm->body) { - char *msg; + char *msg, *tmp, *tmp2; + tmp = gaim_escape_html(jm->subject); + tmp2 = gaim_markup_linkify(tmp); if(jid->resource) - msg = g_strdup_printf(_("%s has set the topic to: %s"), jid->resource, jm->subject); + msg = g_strdup_printf(_("%s has set the topic to: %s"), jid->resource, tmp2); else - msg = g_strdup_printf(_("The topic is: %s"), jm->subject); + msg = g_strdup_printf(_("The topic is: %s"), tmp2); gaim_conv_chat_write(GAIM_CONV_CHAT(chat->conv), "", msg, GAIM_MESSAGE_SYSTEM, jm->sent); + g_free(tmp); + g_free(tmp2); g_free(msg); } } |