1
0
mirror of https://github.com/irssi/irssi.git synced 2024-11-03 04:27:19 -05:00

Emit message irc own_{action,notice,wall} and message dcc own{,_action} with

message in client encoding.


git-svn-id: file:///var/www/svn.irssi.org/SVN/irssi/trunk@4891 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
Emanuele Giaquinta 2008-11-09 23:53:40 +00:00 committed by exg
parent 9003a61629
commit 1b27be4abc
3 changed files with 12 additions and 33 deletions

View File

@ -21,7 +21,6 @@
#include "module.h" #include "module.h"
#include "signals.h" #include "signals.h"
#include "levels.h" #include "levels.h"
#include "recode.h"
#include "irc-servers.h" #include "irc-servers.h"
#include "irc-queries.h" #include "irc-queries.h"
@ -34,7 +33,7 @@ static void sig_message_dcc_own(CHAT_DCC_REC *dcc, const char *msg)
{ {
TEXT_DEST_REC dest; TEXT_DEST_REC dest;
QUERY_REC *query; QUERY_REC *query;
char *tag, *recoded; char *tag;
tag = g_strconcat("=", dcc->id, NULL); tag = g_strconcat("=", dcc->id, NULL);
query = query_find(NULL, tag); query = query_find(NULL, tag);
@ -43,11 +42,8 @@ static void sig_message_dcc_own(CHAT_DCC_REC *dcc, const char *msg)
MSGLEVEL_DCCMSGS | MSGLEVEL_NOHILIGHT | MSGLEVEL_DCCMSGS | MSGLEVEL_NOHILIGHT |
MSGLEVEL_NO_ACT, NULL); MSGLEVEL_NO_ACT, NULL);
/* ugly: recode the sent message back for printing */
recoded = recode_in(SERVER(dcc->server), msg, dcc->target == NULL ? dcc->mynick : dcc->target);
printformat_dest(&dest, query != NULL ? IRCTXT_OWN_DCC_QUERY : printformat_dest(&dest, query != NULL ? IRCTXT_OWN_DCC_QUERY :
IRCTXT_OWN_DCC, dcc->mynick, dcc->id, recoded); IRCTXT_OWN_DCC, dcc->mynick, dcc->id, msg);
g_free(recoded);
g_free(tag); g_free(tag);
} }
@ -55,7 +51,7 @@ static void sig_message_dcc_own_action(CHAT_DCC_REC *dcc, const char *msg)
{ {
TEXT_DEST_REC dest; TEXT_DEST_REC dest;
QUERY_REC *query; QUERY_REC *query;
char *tag, *recoded; char *tag;
tag = g_strconcat("=", dcc->id, NULL); tag = g_strconcat("=", dcc->id, NULL);
query = query_find(NULL, tag); query = query_find(NULL, tag);
@ -64,11 +60,8 @@ static void sig_message_dcc_own_action(CHAT_DCC_REC *dcc, const char *msg)
MSGLEVEL_DCCMSGS | MSGLEVEL_ACTIONS | MSGLEVEL_DCCMSGS | MSGLEVEL_ACTIONS |
MSGLEVEL_NOHILIGHT | MSGLEVEL_NO_ACT, NULL); MSGLEVEL_NOHILIGHT | MSGLEVEL_NO_ACT, NULL);
/* ugly: recode the sent message back for printing */
recoded = recode_in(SERVER(dcc->server), msg, dcc->target == NULL ? dcc->mynick : dcc->target);
printformat_dest(&dest, query != NULL ? IRCTXT_OWN_DCC_ACTION_QUERY : printformat_dest(&dest, query != NULL ? IRCTXT_OWN_DCC_ACTION_QUERY :
IRCTXT_OWN_DCC_ACTION, dcc->mynick, dcc->id, recoded); IRCTXT_OWN_DCC_ACTION, dcc->mynick, dcc->id, msg);
g_free(recoded);
g_free(tag); g_free(tag);
} }

View File

@ -57,7 +57,7 @@ static void cmd_me(const char *data, IRC_SERVER_REC *server, WI_ITEM_REC *item)
target = window_item_get_target(item); target = window_item_get_target(item);
recoded = recode_out(SERVER(server), data, target); recoded = recode_out(SERVER(server), data, target);
signal_emit("message irc own_action", 3, server, recoded, signal_emit("message irc own_action", 3, server, data,
item->visible_name); item->visible_name);
irc_send_cmdv(server, "PRIVMSG %s :\001ACTION %s\001", irc_send_cmdv(server, "PRIVMSG %s :\001ACTION %s\001",
@ -90,7 +90,7 @@ static void cmd_action(const char *data, IRC_SERVER_REC *server)
recoded = recode_out(SERVER(server), text, target); recoded = recode_out(SERVER(server), text, target);
irc_send_cmdv(server, "PRIVMSG %s :\001ACTION %s\001", target, recoded); irc_send_cmdv(server, "PRIVMSG %s :\001ACTION %s\001", target, recoded);
signal_emit("message irc own_action", 3, server, recoded, target); signal_emit("message irc own_action", 3, server, text, target);
g_free(recoded); g_free(recoded);
cmd_params_free(free_arg); cmd_params_free(free_arg);
@ -100,7 +100,6 @@ static void cmd_notice(const char *data, IRC_SERVER_REC *server,
WI_ITEM_REC *item) WI_ITEM_REC *item)
{ {
const char *target, *msg; const char *target, *msg;
char *recoded;
void *free_arg; void *free_arg;
CMD_IRC_SERVER(server); CMD_IRC_SERVER(server);
@ -114,10 +113,8 @@ static void cmd_notice(const char *data, IRC_SERVER_REC *server,
if (*target == '\0' || *msg == '\0') if (*target == '\0' || *msg == '\0')
cmd_param_error(CMDERR_NOT_ENOUGH_PARAMS); cmd_param_error(CMDERR_NOT_ENOUGH_PARAMS);
recoded = recode_out(SERVER(server), msg, target); signal_emit("message irc own_notice", 3, server, msg, target);
signal_emit("message irc own_notice", 3, server, recoded, target);
g_free(recoded);
cmd_params_free(free_arg); cmd_params_free(free_arg);
} }

View File

@ -24,7 +24,6 @@
#include "channels.h" #include "channels.h"
#include "ignore.h" #include "ignore.h"
#include "settings.h" #include "settings.h"
#include "recode.h"
#include "irc-servers.h" #include "irc-servers.h"
#include "irc-channels.h" #include "irc-channels.h"
@ -111,21 +110,18 @@ 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, static void sig_message_own_wall(SERVER_REC *server, const char *msg,
const char *target) const char *target)
{ {
char *nickmode, *optarget, *recoded; char *nickmode, *optarget;
nickmode = channel_get_nickmode(channel_find(server, target), nickmode = channel_get_nickmode(channel_find(server, target),
server->nick); server->nick);
optarget = g_strconcat("@", target, NULL); 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, printformat_module("fe-common/core", server, target,
MSGLEVEL_PUBLIC | MSGLEVEL_NOHILIGHT | MSGLEVEL_PUBLIC | MSGLEVEL_NOHILIGHT |
MSGLEVEL_NO_ACT, MSGLEVEL_NO_ACT,
TXT_OWN_MSG_CHANNEL, TXT_OWN_MSG_CHANNEL,
server->nick, optarget, recoded, nickmode); server->nick, optarget, msg, nickmode);
g_free(nickmode); g_free(nickmode);
g_free(recoded);
g_free(optarget); g_free(optarget);
} }
@ -134,7 +130,7 @@ static void sig_message_own_action(IRC_SERVER_REC *server, const char *msg,
{ {
void *item; void *item;
const char *oldtarget; const char *oldtarget;
char *freemsg = NULL, *recoded; char *freemsg = NULL;
oldtarget = target; oldtarget = target;
target = skip_target(IRC_SERVER(server), target); target = skip_target(IRC_SERVER(server), target);
@ -146,15 +142,11 @@ static void sig_message_own_action(IRC_SERVER_REC *server, const char *msg,
if (settings_get_bool("emphasis")) if (settings_get_bool("emphasis"))
msg = freemsg = expand_emphasis(item, msg); msg = freemsg = expand_emphasis(item, msg);
/* ugly: recode the sent message back for printing */
recoded = recode_in(SERVER(server), msg, target);
printformat(server, target, printformat(server, target,
MSGLEVEL_ACTIONS | MSGLEVEL_NOHILIGHT | MSGLEVEL_NO_ACT | MSGLEVEL_ACTIONS | MSGLEVEL_NOHILIGHT | MSGLEVEL_NO_ACT |
(ischannel(*target) ? MSGLEVEL_PUBLIC : MSGLEVEL_MSGS), (ischannel(*target) ? MSGLEVEL_PUBLIC : MSGLEVEL_MSGS),
item != NULL && oldtarget == target ? IRCTXT_OWN_ACTION : IRCTXT_OWN_ACTION_TARGET, item != NULL && oldtarget == target ? IRCTXT_OWN_ACTION : IRCTXT_OWN_ACTION_TARGET,
server->nick, recoded, oldtarget); server->nick, msg, oldtarget);
g_free(recoded);
g_free_not_null(freemsg); g_free_not_null(freemsg);
} }
@ -210,12 +202,9 @@ static void sig_message_irc_action(IRC_SERVER_REC *server, const char *msg,
static void sig_message_own_notice(IRC_SERVER_REC *server, const char *msg, static void sig_message_own_notice(IRC_SERVER_REC *server, const char *msg,
const char *target) 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 | printformat(server, skip_target(server, target), MSGLEVEL_NOTICES |
MSGLEVEL_NOHILIGHT | MSGLEVEL_NO_ACT, MSGLEVEL_NOHILIGHT | MSGLEVEL_NO_ACT,
IRCTXT_OWN_NOTICE, target, recoded); IRCTXT_OWN_NOTICE, target, msg);
g_free(recoded);
} }
static void sig_message_irc_notice(SERVER_REC *server, const char *msg, static void sig_message_irc_notice(SERVER_REC *server, const char *msg,