summaryrefslogtreecommitdiff
path: root/src/fe-common/irc
diff options
context:
space:
mode:
authorValentin Batz <senneth@irssi.org>2005-10-10 18:32:32 +0000
committervb <vb@dbcabf3a-b0e7-0310-adc4-f8d773084564>2005-10-10 18:32:32 +0000
commitfd476e8b319dc7a1d4271ec339df9deb752dc055 (patch)
tree8109bfada50669eec00874a832eaf21e5e2637e3 /src/fe-common/irc
parentc701330433d9c85dbf7f2078d56a8529c904e1b5 (diff)
downloadirssi-fd476e8b319dc7a1d4271ec339df9deb752dc055.zip
Make the compiler happy by replacing 'const char *' by 'char *'.
Pass the pointer to the SERVER_REC to dcc_ctcp_message. Recode 'own' messages back for printing just before they actually get printed. (ugly but more effective than adding all the signals in fe-recode and doing it there) Replaced SERVER_REC by IRC_SERVER_REC in dcc-chat.c since it's belongs to IRC(makes the compiler happy again). git-svn-id: http://svn.irssi.org/repos/irssi/trunk@4034 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src/fe-common/irc')
-rw-r--r--src/fe-common/irc/dcc/fe-dcc-chat-messages.c20
-rw-r--r--src/fe-common/irc/fe-irc-messages.c25
2 files changed, 33 insertions, 12 deletions
diff --git a/src/fe-common/irc/dcc/fe-dcc-chat-messages.c b/src/fe-common/irc/dcc/fe-dcc-chat-messages.c
index 65ab9a56..d1eaa642 100644
--- a/src/fe-common/irc/dcc/fe-dcc-chat-messages.c
+++ b/src/fe-common/irc/dcc/fe-dcc-chat-messages.c
@@ -21,7 +21,9 @@
#include "module.h"
#include "signals.h"
#include "levels.h"
+#include "recode.h"
+#include "irc-servers.h"
#include "irc-queries.h"
#include "dcc-chat.h"
@@ -32,7 +34,7 @@ static void sig_message_dcc_own(CHAT_DCC_REC *dcc, const char *msg)
{
TEXT_DEST_REC dest;
QUERY_REC *query;
- char *tag;
+ char *tag, *recoded;
tag = g_strconcat("=", dcc->id, NULL);
query = query_find(NULL, tag);
@@ -41,8 +43,11 @@ static void sig_message_dcc_own(CHAT_DCC_REC *dcc, const char *msg)
MSGLEVEL_DCCMSGS | MSGLEVEL_NOHILIGHT |
MSGLEVEL_NO_ACT, NULL);
+ /* ugly: recode the sent message back for printin */
+ recoded = recode_in(SERVER(dcc->server), msg, dcc->target == NULL ? dcc->mynick : dcc->target);
printformat_dest(&dest, query != NULL ? IRCTXT_OWN_DCC_QUERY :
- IRCTXT_OWN_DCC, dcc->mynick, dcc->id, msg);
+ IRCTXT_OWN_DCC, dcc->mynick, dcc->id, recoded);
+ g_free(recoded);
g_free(tag);
}
@@ -50,7 +55,7 @@ static void sig_message_dcc_own_action(CHAT_DCC_REC *dcc, const char *msg)
{
TEXT_DEST_REC dest;
QUERY_REC *query;
- char *tag;
+ char *tag, *recoded;
tag = g_strconcat("=", dcc->id, NULL);
query = query_find(NULL, tag);
@@ -58,9 +63,12 @@ static void sig_message_dcc_own_action(CHAT_DCC_REC *dcc, const char *msg)
format_create_dest_tag(&dest, dcc->server, dcc->servertag, tag,
MSGLEVEL_DCCMSGS | MSGLEVEL_ACTIONS |
MSGLEVEL_NOHILIGHT | MSGLEVEL_NO_ACT, NULL);
-
- printformat_dest(&dest, query != NULL ? IRCTXT_OWN_DCC_ACTION_QUERY :
- IRCTXT_OWN_DCC_ACTION, dcc->mynick, dcc->id, msg);
+
+ /* 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 :
+ IRCTXT_OWN_DCC_ACTION, dcc->mynick, dcc->id, recoded);
+ g_free(recoded);
g_free(tag);
}
diff --git a/src/fe-common/irc/fe-irc-messages.c b/src/fe-common/irc/fe-irc-messages.c
index 6d8bb3d2..253975da 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"
@@ -54,7 +55,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(target);
@@ -64,13 +65,17 @@ 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(recoded);
signal_stop();
}
+
}
/* received msg to all ops in channel */
@@ -94,17 +99,20 @@ 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);
+ g_free(recoded);
g_free(optarget);
}
@@ -112,22 +120,24 @@ static void sig_message_own_action(IRC_SERVER_REC *server, const char *msg,
const char *target)
{
void *item;
- char *freemsg = NULL;
+ char *freemsg = NULL, *recoded;
if (ischannel(*target))
item = irc_channel_find(server, target);
else
item = irc_query_find(server, target);
+ /* ugly: recode the sent message back for printing */
+ recoded = recode_in(SERVER(server), msg, target);
if (settings_get_bool("emphasis"))
- msg = freemsg = expand_emphasis(item, msg);
+ msg = freemsg = expand_emphasis(item, recoded);
printformat(server, target,
MSGLEVEL_ACTIONS | MSGLEVEL_NOHILIGHT | MSGLEVEL_NO_ACT |
(ischannel(*target) ? MSGLEVEL_PUBLIC : MSGLEVEL_MSGS),
item != NULL ? IRCTXT_OWN_ACTION : IRCTXT_OWN_ACTION_TARGET,
server->nick, msg, target);
-
+ g_free(recoded);
g_free_not_null(freemsg);
}
@@ -179,9 +189,12 @@ 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,
const char *target)
{
+ /* ugly: recode the sent message back for printing */
+ char *recoded = recode_in(SERVER(server), msg, target);
printformat(server, skip_target(target), MSGLEVEL_NOTICES |
MSGLEVEL_NOHILIGHT | MSGLEVEL_NO_ACT,
IRCTXT_OWN_NOTICE, target, msg);
+ g_free(recoded);
}
static void sig_message_irc_notice(SERVER_REC *server, const char *msg,