diff options
author | Emanuele Giaquinta <exg@irssi.org> | 2008-08-02 13:15:38 +0000 |
---|---|---|
committer | exg <exg@dbcabf3a-b0e7-0310-adc4-f8d773084564> | 2008-08-02 13:15:38 +0000 |
commit | 9fa8cbe7a2ac1c17fa4494389b199319ec966aae (patch) | |
tree | d87ae801571f4a7dc7ad05f7f80df4286bc2ed7d /src/fe-common/irc | |
parent | d788673eb92d68d796f69e70ab2dddeb01778585 (diff) | |
download | irssi-9fa8cbe7a2ac1c17fa4494389b199319ec966aae.zip |
Revert recode changes r4483 and r4715.
git-svn-id: file:///var/www/svn.irssi.org/SVN/irssi/trunk@4867 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src/fe-common/irc')
-rw-r--r-- | src/fe-common/irc/fe-events-numeric.c | 25 | ||||
-rw-r--r-- | src/fe-common/irc/fe-events.c | 40 | ||||
-rw-r--r-- | src/fe-common/irc/fe-irc-commands.c | 21 | ||||
-rw-r--r-- | src/fe-common/irc/fe-irc-messages.c | 49 | ||||
-rw-r--r-- | src/fe-common/irc/fe-whois.c | 25 |
5 files changed, 113 insertions, 47 deletions
diff --git a/src/fe-common/irc/fe-events-numeric.c b/src/fe-common/irc/fe-events-numeric.c index 0510c4ff..1de8e5dd 100644 --- a/src/fe-common/irc/fe-events-numeric.c +++ b/src/fe-common/irc/fe-events-numeric.c @@ -24,6 +24,7 @@ #include "misc.h" #include "settings.h" #include "levels.h" +#include "recode.h" #include "irc-servers.h" #include "irc-channels.h" @@ -105,7 +106,7 @@ static void event_end_of_names(IRC_SERVER_REC *server, const char *data, static void event_who(IRC_SERVER_REC *server, const char *data) { char *params, *nick, *channel, *user, *host, *stat, *realname, *hops; - char *serv; + char *serv, *recoded; g_return_if_fail(data != NULL); @@ -118,10 +119,12 @@ static void event_who(IRC_SERVER_REC *server, const char *data) if (*realname == ' ') *realname++ = '\0'; + recoded = recode_in(SERVER(server), realname, nick); printformat(server, NULL, MSGLEVEL_CRAP, IRCTXT_WHO, - channel, nick, stat, hops, user, host, realname, serv); + channel, nick, stat, hops, user, host, recoded, serv); g_free(params); + g_free(recoded); } static void event_end_of_who(IRC_SERVER_REC *server, const char *data) @@ -245,15 +248,17 @@ static void event_nick_in_use(IRC_SERVER_REC *server, const char *data) static void event_topic_get(IRC_SERVER_REC *server, const char *data) { const char *channel; - char *params, *topic; + char *params, *topic, *recoded; g_return_if_fail(data != NULL); params = event_get_params(data, 3, NULL, &channel, &topic); + recoded = recode_in(SERVER(server), topic, channel); channel = get_visible_target(server, channel); printformat(server, channel, MSGLEVEL_CRAP, - IRCTXT_TOPIC, channel, topic); + IRCTXT_TOPIC, channel, recoded); g_free(params); + g_free(recoded); } static void event_topic_info(IRC_SERVER_REC *server, const char *data) @@ -323,11 +328,12 @@ static void event_unaway(IRC_SERVER_REC *server, const char *data) static void event_away(IRC_SERVER_REC *server, const char *data) { - char *params, *nick, *awaymsg; + char *params, *nick, *awaymsg, *recoded; g_return_if_fail(data != NULL); params = event_get_params(data, 3, NULL, &nick, &awaymsg); + recoded = recode_in(SERVER(server), awaymsg, nick); if (!settings_get_bool("show_away_once") || last_away_nick == NULL || g_strcasecmp(last_away_nick, nick) != 0 || last_away_msg == NULL || g_strcasecmp(last_away_msg, awaymsg) != 0) { @@ -339,9 +345,10 @@ static void event_away(IRC_SERVER_REC *server, const char *data) last_away_msg = g_strdup(awaymsg); printformat(server, nick, MSGLEVEL_CRAP, - IRCTXT_NICK_AWAY, nick, awaymsg); + IRCTXT_NICK_AWAY, nick, recoded); } g_free(params); + g_free(recoded); } static void event_userhost(IRC_SERVER_REC *server, const char *data) @@ -541,7 +548,7 @@ static void event_numeric(IRC_SERVER_REC *server, const char *data, static void print_event_received(IRC_SERVER_REC *server, const char *data, const char *nick, int target_param) { - char *target, *args, *ptr, *ptr2; + char *target, *args, *ptr, *ptr2, *recoded; int format; g_return_if_fail(data != NULL); @@ -570,12 +577,14 @@ static void print_event_received(IRC_SERVER_REC *server, const char *data, g_memmove(ptr+1, ptr+2, strlen(ptr+1)); } + recoded = recode_in(SERVER(server), args, NULL); format = nick == NULL || server->real_address == NULL || strcmp(nick, server->real_address) == 0 ? IRCTXT_DEFAULT_EVENT : IRCTXT_DEFAULT_EVENT_SERVER; printformat(server, target, MSGLEVEL_CRAP, format, - nick, args, current_server_event); + nick, recoded, current_server_event); + g_free(recoded); g_free(args); g_free(target); } diff --git a/src/fe-common/irc/fe-events.c b/src/fe-common/irc/fe-events.c index dc952a66..f5d03cf5 100644 --- a/src/fe-common/irc/fe-events.c +++ b/src/fe-common/irc/fe-events.c @@ -30,6 +30,7 @@ #include "servers-reconnect.h" #include "queries.h" #include "ignore.h" +#include "recode.h" #include "irc-servers.h" #include "irc-channels.h" @@ -44,7 +45,7 @@ static void event_privmsg(IRC_SERVER_REC *server, const char *data, const char *nick, const char *addr) { - char *params, *target, *msg; + char *params, *target, *msg, *recoded; g_return_if_fail(data != NULL); @@ -53,46 +54,55 @@ static void event_privmsg(IRC_SERVER_REC *server, const char *data, if (addr == NULL) addr = ""; if (*target == '@' && ischannel(target[1])) { /* Hybrid 6 feature, send msg to all ops in channel */ + recoded = recode_in(SERVER(server), msg, target+1); signal_emit("message irc op_public", 5, - server, msg, nick, addr, + server, recoded, nick, addr, get_visible_target(server, target+1)); } else { + recoded = recode_in(SERVER(server), msg, ischannel(*target) ? target : nick); signal_emit(ischannel(*target) ? "message public" : "message private", 5, - server, msg, nick, addr, + server, recoded, nick, addr, get_visible_target(server, target)); } g_free(params); + g_free(recoded); } static void ctcp_action(IRC_SERVER_REC *server, const char *data, const char *nick, const char *addr, const char *target) { + char *recoded; + g_return_if_fail(data != NULL); + recoded = recode_in(SERVER(server), data, target); signal_emit("message irc action", 5, - server, data, nick, addr, + server, recoded, nick, addr, get_visible_target(server, target)); + g_free(recoded); } static void event_notice(IRC_SERVER_REC *server, const char *data, const char *nick, const char *addr) { - char *params, *target, *msg; + char *params, *target, *msg, *recoded; g_return_if_fail(data != NULL); params = event_get_params(data, 2 | PARAM_FLAG_GETREST, &target, &msg); + recoded = recode_in(SERVER(server), msg, target); if (nick == NULL) { nick = server->real_address == NULL ? server->connrec->address : server->real_address; } - signal_emit("message irc notice", 5, server, msg, nick, addr, + signal_emit("message irc notice", 5, server, recoded, nick, addr, get_visible_target(server, target)); g_free(params); + g_free(recoded); } static void event_join(IRC_SERVER_REC *server, const char *data, @@ -114,15 +124,17 @@ static void event_join(IRC_SERVER_REC *server, const char *data, static void event_part(IRC_SERVER_REC *server, const char *data, const char *nick, const char *addr) { - char *params, *channel, *reason; + char *params, *channel, *reason, *recoded; g_return_if_fail(data != NULL); params = event_get_params(data, 2 | PARAM_FLAG_GETREST, &channel, &reason); + recoded = recode_in(SERVER(server), reason, channel); signal_emit("message part", 5, server, - get_visible_target(server, channel), nick, addr, reason); + get_visible_target(server, channel), nick, addr, recoded); g_free(params); + g_free(recoded); } static void event_quit(IRC_SERVER_REC *server, const char *data, @@ -137,16 +149,18 @@ static void event_quit(IRC_SERVER_REC *server, const char *data, static void event_kick(IRC_SERVER_REC *server, const char *data, const char *kicker, const char *addr) { - char *params, *channel, *nick, *reason; + char *params, *channel, *nick, *reason, *recoded; g_return_if_fail(data != NULL); params = event_get_params(data, 3 | PARAM_FLAG_GETREST, &channel, &nick, &reason); + recoded = recode_in(SERVER(server), reason, channel); signal_emit("message kick", 6, server, get_visible_target(server, channel), - nick, kicker, addr, reason); + nick, kicker, addr, recoded); g_free(params); + g_free(recoded); } static void event_kill(IRC_SERVER_REC *server, const char *data, @@ -242,15 +256,17 @@ static void event_invite(IRC_SERVER_REC *server, const char *data, static void event_topic(IRC_SERVER_REC *server, const char *data, const char *nick, const char *addr) { - char *params, *channel, *topic; + char *params, *channel, *topic, *recoded; g_return_if_fail(data != NULL); params = event_get_params(data, 2 | PARAM_FLAG_GETREST, &channel, &topic); + recoded = recode_in(SERVER(server), topic, channel); signal_emit("message topic", 5, server, - get_visible_target(server, channel), topic, nick, addr); + get_visible_target(server, channel), recoded, nick, addr); g_free(params); + g_free(recoded); } static void event_error(IRC_SERVER_REC *server, const char *data) diff --git a/src/fe-common/irc/fe-irc-commands.c b/src/fe-common/irc/fe-irc-commands.c index 54c5263f..37f8b9ab 100644 --- a/src/fe-common/irc/fe-irc-commands.c +++ b/src/fe-common/irc/fe-irc-commands.c @@ -22,6 +22,7 @@ #include "module-formats.h" #include "signals.h" #include "misc.h" +#include "recode.h" #include "special-vars.h" #include "settings.h" @@ -44,6 +45,7 @@ static void cmd_me(const char *data, IRC_SERVER_REC *server, WI_ITEM_REC *item) { const char *target; + char *recoded; CMD_IRC_SERVER(server); if (!IS_IRC_ITEM(item)) @@ -53,12 +55,15 @@ static void cmd_me(const char *data, IRC_SERVER_REC *server, WI_ITEM_REC *item) cmd_return_error(CMDERR_NOT_CONNECTED); target = window_item_get_target(item); + recoded = recode_out(SERVER(server), data, target); - signal_emit("message irc own_action", 3, server, data, + signal_emit("message irc own_action", 3, server, recoded, item->visible_name); irc_send_cmdv(server, "PRIVMSG %s :\001ACTION %s\001", - target, data); + target, recoded); + + g_free(recoded); } /* SYNTAX: ACTION [-<server tag>] <target> <message> */ @@ -66,6 +71,7 @@ static void cmd_action(const char *data, IRC_SERVER_REC *server) { GHashTable *optlist; const char *target, *text; + char *recoded; void *free_arg; CMD_IRC_SERVER(server); @@ -81,10 +87,12 @@ static void cmd_action(const char *data, IRC_SERVER_REC *server) if (server == NULL || !server->connected) cmd_param_error(CMDERR_NOT_CONNECTED); - irc_send_cmdv(server, "PRIVMSG %s :\001ACTION %s\001", target, text); + recoded = recode_out(SERVER(server), text, target); + irc_send_cmdv(server, "PRIVMSG %s :\001ACTION %s\001", target, recoded); - signal_emit("message irc own_action", 3, server, text, target); + signal_emit("message irc own_action", 3, server, recoded, target); + g_free(recoded); cmd_params_free(free_arg); } @@ -92,6 +100,7 @@ static void cmd_notice(const char *data, IRC_SERVER_REC *server, WI_ITEM_REC *item) { const char *target, *msg; + char *recoded; void *free_arg; CMD_IRC_SERVER(server); @@ -105,8 +114,10 @@ static void cmd_notice(const char *data, IRC_SERVER_REC *server, if (*target == '\0' || *msg == '\0') cmd_param_error(CMDERR_NOT_ENOUGH_PARAMS); - signal_emit("message irc own_notice", 3, server, msg, target); + recoded = recode_out(SERVER(server), msg, target); + signal_emit("message irc own_notice", 3, server, recoded, target); + g_free(recoded); cmd_params_free(free_arg); } diff --git a/src/fe-common/irc/fe-irc-messages.c b/src/fe-common/irc/fe-irc-messages.c index 36194a9b..06159582 100644 --- a/src/fe-common/irc/fe-irc-messages.c +++ b/src/fe-common/irc/fe-irc-messages.c @@ -24,6 +24,7 @@ #include "channels.h" #include "ignore.h" #include "settings.h" +#include "recode.h" #include "irc-servers.h" #include "irc-channels.h" @@ -67,7 +68,7 @@ static void sig_message_own_public(SERVER_REC *server, const char *msg, const char *target, const char *origtarget) { const char *oldtarget; - char *nickmode; + char *nickmode, *recoded; oldtarget = target; target = skip_target(IRC_SERVER(server), target); @@ -77,12 +78,15 @@ static void sig_message_own_public(SERVER_REC *server, const char *msg, nickmode = channel_get_nickmode(channel_find(server, target), server->nick); + /* ugly: recode the sent message back for printing */ + recoded = recode_in(SERVER(server), msg, target); printformat_module("fe-common/core", server, target, MSGLEVEL_PUBLIC | MSGLEVEL_NOHILIGHT | MSGLEVEL_NO_ACT, TXT_OWN_MSG_CHANNEL, - server->nick, oldtarget, msg, nickmode); + server->nick, oldtarget, recoded, nickmode); g_free(nickmode); + g_free(recoded); signal_stop(); } @@ -110,18 +114,21 @@ static void sig_message_irc_op_public(SERVER_REC *server, const char *msg, static void sig_message_own_wall(SERVER_REC *server, const char *msg, const char *target) { - char *nickmode, *optarget; + char *nickmode, *optarget, *recoded; nickmode = channel_get_nickmode(channel_find(server, target), server->nick); optarget = g_strconcat("@", target, NULL); + /* ugly: recode the sent message back for printing */ + recoded = recode_in(SERVER(server), msg, target); printformat_module("fe-common/core", server, target, MSGLEVEL_PUBLIC | MSGLEVEL_NOHILIGHT | MSGLEVEL_NO_ACT, TXT_OWN_MSG_CHANNEL, - server->nick, optarget, msg, nickmode); + server->nick, optarget, recoded, nickmode); g_free(nickmode); + g_free(recoded); g_free(optarget); } @@ -130,7 +137,7 @@ static void sig_message_own_action(IRC_SERVER_REC *server, const char *msg, { void *item; const char *oldtarget; - char *freemsg = NULL; + char *freemsg = NULL, *recoded; oldtarget = target; target = skip_target(IRC_SERVER(server), target); @@ -142,11 +149,15 @@ static void sig_message_own_action(IRC_SERVER_REC *server, const char *msg, if (settings_get_bool("emphasis")) msg = freemsg = expand_emphasis(item, msg); + /* ugly: recode the sent message back for printing */ + recoded = recode_in(SERVER(server), msg, target); + printformat(server, target, MSGLEVEL_ACTIONS | MSGLEVEL_NOHILIGHT | MSGLEVEL_NO_ACT | (ischannel(*target) ? MSGLEVEL_PUBLIC : MSGLEVEL_MSGS), item != NULL && oldtarget == target ? IRCTXT_OWN_ACTION : IRCTXT_OWN_ACTION_TARGET, - server->nick, msg, oldtarget); + server->nick, recoded, oldtarget); + g_free(recoded); g_free_not_null(freemsg); } @@ -156,7 +167,7 @@ static void sig_message_irc_action(IRC_SERVER_REC *server, const char *msg, { void *item; const char *oldtarget; - char *freemsg = NULL; + char *freemsg = NULL, *recoded; int level; oldtarget = target; @@ -176,35 +187,40 @@ static void sig_message_irc_action(IRC_SERVER_REC *server, const char *msg, if (settings_get_bool("emphasis")) msg = freemsg = expand_emphasis(item, msg); + recoded = recode_in(SERVER(server), msg, target); if (ischannel(*target)) { /* channel action */ if (window_item_is_active(item) && target == oldtarget) { /* message to active channel in window */ printformat(server, target, level, - IRCTXT_ACTION_PUBLIC, nick, msg); + IRCTXT_ACTION_PUBLIC, nick, recoded); } else { /* message to not existing/active channel, or to @/+ */ printformat(server, target, level, IRCTXT_ACTION_PUBLIC_CHANNEL, - nick, oldtarget, msg); + nick, oldtarget, recoded); } } else { /* private action */ printformat(server, nick, MSGLEVEL_ACTIONS | MSGLEVEL_MSGS, item == NULL ? IRCTXT_ACTION_PRIVATE : IRCTXT_ACTION_PRIVATE_QUERY, - nick, address == NULL ? "" : address, msg); + nick, address == NULL ? "" : address, recoded); } + g_free(recoded); g_free_not_null(freemsg); } static void sig_message_own_notice(IRC_SERVER_REC *server, const char *msg, const char *target) { + /* ugly: recode the sent message back for printing */ + char *recoded = recode_in(SERVER(server), msg, target); printformat(server, skip_target(server, target), MSGLEVEL_NOTICES | MSGLEVEL_NOHILIGHT | MSGLEVEL_NO_ACT, - IRCTXT_OWN_NOTICE, target, msg); + IRCTXT_OWN_NOTICE, target, recoded); + g_free(recoded); } static void sig_message_irc_notice(SERVER_REC *server, const char *msg, @@ -212,17 +228,20 @@ static void sig_message_irc_notice(SERVER_REC *server, const char *msg, const char *target) { const char *oldtarget; + char *recoded; oldtarget = target; target = skip_target(IRC_SERVER(server), target); if (address == NULL || *address == '\0') { /* notice from server */ + recoded = recode_in(SERVER(server), msg, NULL); if (!ignore_check(server, nick, "", target, msg, MSGLEVEL_SNOTES)) { printformat(server, target, MSGLEVEL_SNOTES, - IRCTXT_NOTICE_SERVER, nick, msg); + IRCTXT_NOTICE_SERVER, nick, recoded); } + g_free(recoded); return; } @@ -231,17 +250,19 @@ static void sig_message_irc_notice(SERVER_REC *server, const char *msg, msg, MSGLEVEL_NOTICES)) return; + recoded = recode_in(SERVER(server), msg, target); if (ischannel(*target)) { /* notice in some channel */ printformat(server, target, MSGLEVEL_NOTICES, - IRCTXT_NOTICE_PUBLIC, nick, oldtarget, msg); + IRCTXT_NOTICE_PUBLIC, nick, oldtarget, recoded); } else { /* private notice */ privmsg_get_query(SERVER(server), nick, FALSE, MSGLEVEL_NOTICES); printformat(server, nick, MSGLEVEL_NOTICES, - IRCTXT_NOTICE_PRIVATE, nick, address, msg); + IRCTXT_NOTICE_PRIVATE, nick, address, recoded); } + g_free(recoded); } static void sig_message_own_ctcp(IRC_SERVER_REC *server, const char *cmd, diff --git a/src/fe-common/irc/fe-whois.c b/src/fe-common/irc/fe-whois.c index 3505ade0..e48c99c6 100644 --- a/src/fe-common/irc/fe-whois.c +++ b/src/fe-common/irc/fe-whois.c @@ -6,6 +6,7 @@ #include "levels.h" #include "misc.h" #include "settings.h" +#include "recode.h" #include "irc-servers.h" @@ -13,15 +14,17 @@ static void event_whois(IRC_SERVER_REC *server, const char *data) { - char *params, *nick, *user, *host, *realname; + char *params, *nick, *user, *host, *realname, *recoded; g_return_if_fail(data != NULL); params = event_get_params(data, 6, NULL, &nick, &user, &host, NULL, &realname); + recoded = recode_in(SERVER(server), realname, nick); printformat(server, nick, MSGLEVEL_CRAP, - IRCTXT_WHOIS, nick, user, host, realname); + IRCTXT_WHOIS, nick, user, host, recoded); g_free(params); + g_free(recoded); } static void event_whois_special(IRC_SERVER_REC *server, const char *data) @@ -275,7 +278,7 @@ static void hide_safe_channel_id(IRC_SERVER_REC *server, char *chans) static void event_whois_channels(IRC_SERVER_REC *server, const char *data) { - char *params, *nick, *chans; + char *params, *nick, *chans, *recoded; g_return_if_fail(data != NULL); @@ -288,23 +291,27 @@ static void event_whois_channels(IRC_SERVER_REC *server, const char *data) chans = show_lowascii(chans); if (settings_get_bool("whois_hide_safe_channel_id")) hide_safe_channel_id(server, chans); + recoded = recode_in(SERVER(server), chans, nick); printformat(server, nick, MSGLEVEL_CRAP, - IRCTXT_WHOIS_CHANNELS, nick, chans); + IRCTXT_WHOIS_CHANNELS, nick, recoded); g_free(chans); g_free(params); + g_free(recoded); } static void event_whois_away(IRC_SERVER_REC *server, const char *data) { - char *params, *nick, *awaymsg; + char *params, *nick, *awaymsg, *recoded; g_return_if_fail(data != NULL); params = event_get_params(data, 3, NULL, &nick, &awaymsg); + recoded = recode_in(SERVER(server), awaymsg, nick); printformat(server, nick, MSGLEVEL_CRAP, - IRCTXT_WHOIS_AWAY, nick, awaymsg); + IRCTXT_WHOIS_AWAY, nick, recoded); g_free(params); + g_free(recoded); } static void event_end_of_whois(IRC_SERVER_REC *server, const char *data) @@ -335,15 +342,17 @@ static void event_whois_auth(IRC_SERVER_REC *server, const char *data) static void event_whowas(IRC_SERVER_REC *server, const char *data) { - char *params, *nick, *user, *host, *realname; + char *params, *nick, *user, *host, *realname, *recoded; g_return_if_fail(data != NULL); params = event_get_params(data, 6, NULL, &nick, &user, &host, NULL, &realname); + recoded = recode_in(SERVER(server), realname, nick); printformat(server, nick, MSGLEVEL_CRAP, - IRCTXT_WHOWAS, nick, user, host, realname); + IRCTXT_WHOWAS, nick, user, host, recoded); g_free(params); + g_free(recoded); } static void event_end_of_whowas(IRC_SERVER_REC *server, const char *data) |