Mercurial > pidgin
diff src/protocols/silc/ops.c @ 9762:3f97624e7753
[gaim-migrate @ 10630]
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.
committer: Tailor Script <tailor@pidgin.im>
author | Tim Ringenbach <marv@pidgin.im> |
---|---|
date | Mon, 16 Aug 2004 01:14:58 +0000 |
parents | 1ba8c6a5ecd9 |
children | 62eb9fe24692 |
line wrap: on
line diff
--- a/src/protocols/silc/ops.c Sun Aug 15 23:28:09 2004 +0000 +++ b/src/protocols/silc/ops.c Mon Aug 16 01:14:58 2004 +0000 @@ -314,52 +314,61 @@ break; case SILC_NOTIFY_TYPE_TOPIC_SET: - idtype = va_arg(va, int); - entry = va_arg(va, void *); - tmp = va_arg(va, char *); - channel = va_arg(va, SilcChannelEntry); + { + char *esc, *tmp2; + idtype = va_arg(va, int); + entry = va_arg(va, void *); + tmp = va_arg(va, char *); + channel = va_arg(va, SilcChannelEntry); + + convo = gaim_find_conversation_with_account(channel->channel_name, + sg->account); + if (!convo) + break; + + if (!tmp) + break; + + esc = gaim_escape_html(tmp); + tmp2 = gaim_markup_linkify(esc); + g_free(esc); - convo = gaim_find_conversation_with_account(channel->channel_name, - sg->account); - if (!convo) - break; + if (idtype == SILC_ID_CLIENT) { + client_entry = (SilcClientEntry)entry; + g_snprintf(buf, sizeof(buf), + _("%s has changed the topic of <I>%s</I> to: %s"), + client_entry->nickname, channel->channel_name, tmp2); + gaim_conv_chat_write(GAIM_CONV_CHAT(convo), client_entry->nickname, + buf, GAIM_MESSAGE_SYSTEM, time(NULL)); + gaim_conv_chat_set_topic(GAIM_CONV_CHAT(convo), + client_entry->nickname, tmp); + } else if (idtype == SILC_ID_SERVER) { + server_entry = (SilcServerEntry)entry; + g_snprintf(buf, sizeof(buf), + _("%s has changed the topic of <I>%s</I> to: %s"), + server_entry->server_name, channel->channel_name, tmp2); + gaim_conv_chat_write(GAIM_CONV_CHAT(convo), server_entry->server_name, + buf, GAIM_MESSAGE_SYSTEM, time(NULL)); + gaim_conv_chat_set_topic(GAIM_CONV_CHAT(convo), + server_entry->server_name, tmp); + } else if (idtype == SILC_ID_CHANNEL) { + channel = (SilcChannelEntry)entry; + g_snprintf(buf, sizeof(buf), + _("%s has changed the topic of <I>%s</I> to: %s"), + channel->channel_name, channel->channel_name, tmp2); + gaim_conv_chat_write(GAIM_CONV_CHAT(convo), channel->channel_name, + buf, GAIM_MESSAGE_SYSTEM, time(NULL)); + gaim_conv_chat_set_topic(GAIM_CONV_CHAT(convo), + channel->channel_name, tmp); + } else { + gaim_conv_chat_set_topic(GAIM_CONV_CHAT(convo), NULL, tmp); + } - if (!tmp) + g_free(tmp2); + break; - if (idtype == SILC_ID_CLIENT) { - client_entry = (SilcClientEntry)entry; - g_snprintf(buf, sizeof(buf), - _("%s has changed the topic of <I>%s</I> to: %s"), - client_entry->nickname, channel->channel_name, tmp); - gaim_conv_chat_write(GAIM_CONV_CHAT(convo), client_entry->nickname, - buf, GAIM_MESSAGE_SYSTEM, time(NULL)); - gaim_conv_chat_set_topic(GAIM_CONV_CHAT(convo), - client_entry->nickname, tmp); - } else if (idtype == SILC_ID_SERVER) { - server_entry = (SilcServerEntry)entry; - g_snprintf(buf, sizeof(buf), - _("%s has changed the topic of <I>%s</I> to: %s"), - server_entry->server_name, channel->channel_name, tmp); - gaim_conv_chat_write(GAIM_CONV_CHAT(convo), server_entry->server_name, - buf, GAIM_MESSAGE_SYSTEM, time(NULL)); - gaim_conv_chat_set_topic(GAIM_CONV_CHAT(convo), - server_entry->server_name, tmp); - } else if (idtype == SILC_ID_CHANNEL) { - channel = (SilcChannelEntry)entry; - g_snprintf(buf, sizeof(buf), - _("%s has changed the topic of <I>%s</I> to: %s"), - channel->channel_name, channel->channel_name, tmp); - gaim_conv_chat_write(GAIM_CONV_CHAT(convo), channel->channel_name, - buf, GAIM_MESSAGE_SYSTEM, time(NULL)); - gaim_conv_chat_set_topic(GAIM_CONV_CHAT(convo), - channel->channel_name, tmp); - } else { - gaim_conv_chat_set_topic(GAIM_CONV_CHAT(convo), NULL, tmp); } - - break; - case SILC_NOTIFY_TYPE_NICK_CHANGE: client_entry = va_arg(va, SilcClientEntry); client_entry2 = va_arg(va, SilcClientEntry);