summaryrefslogtreecommitdiff
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
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
-rw-r--r--src/fe-common/core/fe-messages.c18
-rw-r--r--src/fe-common/core/fe-recode.c44
-rw-r--r--src/fe-common/irc/dcc/fe-dcc-chat-messages.c20
-rw-r--r--src/fe-common/irc/fe-irc-messages.c25
-rw-r--r--src/irc/dcc/dcc-chat.c12
-rw-r--r--src/irc/dcc/dcc-get.c3
6 files changed, 51 insertions, 71 deletions
diff --git a/src/fe-common/core/fe-messages.c b/src/fe-common/core/fe-messages.c
index aa1ead32..b91f2cf4 100644
--- a/src/fe-common/core/fe-messages.c
+++ b/src/fe-common/core/fe-messages.c
@@ -257,9 +257,10 @@ static void sig_message_own_public(SERVER_REC *server, const char *msg,
WINDOW_REC *window;
CHANNEL_REC *channel;
const char *nickmode;
- char *freemsg = NULL;
+ char *freemsg = NULL, *recoded;
int print_channel;
-
+ /* ugly: recode the sent message back for printing */
+ recoded = recode_in(server, msg, target);
channel = channel_find(server, target);
if (channel != NULL)
target = channel->visible_name;
@@ -281,12 +282,13 @@ static void sig_message_own_public(SERVER_REC *server, const char *msg,
if (!print_channel) {
printformat(server, target, MSGLEVEL_PUBLIC | MSGLEVEL_NOHILIGHT | MSGLEVEL_NO_ACT,
- TXT_OWN_MSG, server->nick, msg, nickmode);
+ TXT_OWN_MSG, server->nick, recoded, nickmode);
} else {
printformat(server, target, MSGLEVEL_PUBLIC | MSGLEVEL_NOHILIGHT | MSGLEVEL_NO_ACT,
- TXT_OWN_MSG_CHANNEL, server->nick, target, msg, nickmode);
+ TXT_OWN_MSG_CHANNEL, server->nick, target, recoded, nickmode);
}
+ g_free(recoded);
g_free_not_null(freemsg);
}
@@ -294,11 +296,10 @@ static void sig_message_own_private(SERVER_REC *server, const char *msg,
const char *target, const char *origtarget)
{
QUERY_REC *query;
- char *freemsg = NULL;
+ char *freemsg = NULL, *recoded;
g_return_if_fail(server != NULL);
g_return_if_fail(msg != NULL);
-
if (target == NULL) {
/* this should only happen if some special target failed and
we should display some error message. currently the special
@@ -315,14 +316,17 @@ static void sig_message_own_private(SERVER_REC *server, const char *msg,
query = privmsg_get_query(server, target, TRUE, MSGLEVEL_MSGS);
+ /* ugly: recode the sent message back for printing */
+ recoded = recode_in(server, msg, target);
if (settings_get_bool("emphasis"))
- msg = freemsg = expand_emphasis((WI_ITEM_REC *) query, msg);
+ msg = freemsg = expand_emphasis((WI_ITEM_REC *) query, recoded);
printformat(server, target,
MSGLEVEL_MSGS | MSGLEVEL_NOHILIGHT | MSGLEVEL_NO_ACT,
query == NULL ? TXT_OWN_MSG_PRIVATE :
TXT_OWN_MSG_PRIVATE_QUERY, target, msg, server->nick);
+ g_free(recoded);
g_free_not_null(freemsg);
}
diff --git a/src/fe-common/core/fe-recode.c b/src/fe-common/core/fe-recode.c
index 57f2066a..b6d89e96 100644
--- a/src/fe-common/core/fe-recode.c
+++ b/src/fe-common/core/fe-recode.c
@@ -201,42 +201,6 @@ static void read_settings(void)
g_free(old_recode_fallback);
g_free(old_recode_out_default);
}
-
-static void message_own_public(const SERVER_REC *server, const char *msg,
- const char *target)
-{
- char *recoded;
- recoded = recode_in(server, msg, target);
- signal_continue(3, server, recoded, target);
- g_free(recoded);
-}
-
-static void message_own_private(const SERVER_REC *server, const char *msg,
- const char *target, const char *orig_target)
-{
- char *recoded;
- recoded = recode_in(server, msg, target);
- signal_continue(4, server, recoded, target, orig_target);
- g_free(recoded);
-}
-
-static void message_irc_own_action(const SERVER_REC *server, const char *msg,
- const char *target)
-{
- char *recoded;
- recoded = recode_in(server, msg, target);
- signal_continue(3, server, recoded, target);
- g_free(recoded);
-}
-
-static void message_irc_own_notice(const SERVER_REC *server, const char *msg,
- const char *channel)
-{
- char *recoded;
- recoded = recode_in(server, msg, channel);
- signal_continue(3, server, recoded, channel);
- g_free(recoded);
-}
#endif
void fe_recode_init (void)
@@ -247,10 +211,6 @@ void fe_recode_init (void)
command_bind("recode add", NULL, (SIGNAL_FUNC) fe_recode_add_cmd);
command_bind("recode remove", NULL, (SIGNAL_FUNC) fe_recode_remove_cmd);
signal_add("setup changed", (SIGNAL_FUNC) read_settings);
- signal_add("message own_public", (SIGNAL_FUNC) message_own_public);
- signal_add("message own_private", (SIGNAL_FUNC) message_own_private);
- signal_add("message irc own_action", (SIGNAL_FUNC) message_irc_own_action);
- signal_add("message irc own_notice", (SIGNAL_FUNC) message_irc_own_notice);
read_settings();
#endif
}
@@ -263,9 +223,5 @@ void fe_recode_deinit (void)
command_unbind("recode add", (SIGNAL_FUNC) fe_recode_add_cmd);
command_unbind("recode remove", (SIGNAL_FUNC) fe_recode_remove_cmd);
signal_remove("setup changed", (SIGNAL_FUNC) read_settings);
- signal_remove("message own_public", (SIGNAL_FUNC) message_own_public);
- signal_remove("message own_private", (SIGNAL_FUNC) message_own_private);
- signal_remove("message irc own_action", (SIGNAL_FUNC) message_irc_own_action);
- signal_remove("message irc own_notice", (SIGNAL_FUNC) message_irc_own_notice);
#endif
}
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,
diff --git a/src/irc/dcc/dcc-chat.c b/src/irc/dcc/dcc-chat.c
index 25658a39..58272d8a 100644
--- a/src/irc/dcc/dcc-chat.c
+++ b/src/irc/dcc/dcc-chat.c
@@ -215,7 +215,7 @@ static void cmd_msg(const char *data, SERVER_REC *server, WI_ITEM_REC *item)
cmd_params_free(free_arg);
}
-static void cmd_me(const char *data, SERVER_REC *server, WI_ITEM_REC *item)
+static void cmd_me(const char *data, IRC_SERVER_REC *server, WI_ITEM_REC *item)
{
CHAT_DCC_REC *dcc;
char *str;
@@ -226,13 +226,13 @@ static void cmd_me(const char *data, SERVER_REC *server, WI_ITEM_REC *item)
if (dcc == NULL) return;
str = g_strconcat("ACTION ", data, NULL);
- dcc_ctcp_message(NULL, dcc->nick, dcc, FALSE, str);
+ dcc_ctcp_message(server, dcc->nick, dcc, FALSE, str);
g_free(str);
signal_stop();
}
-static void cmd_action(const char *data, SERVER_REC *server)
+static void cmd_action(const char *data, IRC_SERVER_REC *server)
{
CHAT_DCC_REC *dcc;
char *target, *text, *str;
@@ -254,7 +254,7 @@ static void cmd_action(const char *data, SERVER_REC *server)
dcc = dcc_chat_find_id(target+1);
if (dcc != NULL) {
str = g_strconcat("ACTION ", text, NULL);
- dcc_ctcp_message(NULL, dcc->nick, dcc, FALSE, str);
+ dcc_ctcp_message(server, dcc->nick, dcc, FALSE, str);
g_free(str);
}
@@ -262,7 +262,7 @@ static void cmd_action(const char *data, SERVER_REC *server)
signal_stop();
}
-static void cmd_ctcp(const char *data, SERVER_REC *server)
+static void cmd_ctcp(const char *data, IRC_SERVER_REC *server)
{
CHAT_DCC_REC *dcc;
char *target, *ctcpcmd, *ctcpdata, *str;
@@ -287,7 +287,7 @@ static void cmd_ctcp(const char *data, SERVER_REC *server)
g_strup(ctcpcmd);
str = g_strconcat(ctcpcmd, " ", ctcpdata, NULL);
- dcc_ctcp_message(NULL, dcc->nick, dcc, FALSE, str);
+ dcc_ctcp_message(server, dcc->nick, dcc, FALSE, str);
g_free(str);
}
diff --git a/src/irc/dcc/dcc-get.c b/src/irc/dcc/dcc-get.c
index eb871149..fde094f4 100644
--- a/src/irc/dcc/dcc-get.c
+++ b/src/irc/dcc/dcc-get.c
@@ -399,8 +399,7 @@ static void ctcp_msg_dcc_send(IRC_SERVER_REC *server, const char *data,
GET_DCC_REC *dcc;
SEND_DCC_REC *temp_dcc;
IPADDR ip;
- const char *address;
- char **params, *fname;
+ char *address, **params, *fname;
int paramcount, fileparams;
int port, len, quoted = FALSE;
uoff_t size;