summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEmanuele Giaquinta <exg@irssi.org>2008-12-01 18:35:10 +0000
committerexg <exg@dbcabf3a-b0e7-0310-adc4-f8d773084564>2008-12-01 18:35:10 +0000
commit997a25c52224671d8dba6ca0f14a21a8b5d2ce44 (patch)
tree6a58f06bd990165775a1046be700fcdf5fd8afc7 /src
parent3f9148d0e3d0dbbfaa9de9d9b9cb727beeda7ce0 (diff)
downloadirssi-997a25c52224671d8dba6ca0f14a21a8b5d2ce44.zip
Factor the code to send an irc action into a function.
git-svn-id: file:///var/www/svn.irssi.org/SVN/irssi/trunk@4937 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src')
-rw-r--r--src/fe-common/irc/fe-irc-commands.c14
-rw-r--r--src/irc/core/irc-servers.c9
-rw-r--r--src/irc/core/irc-servers.h1
3 files changed, 12 insertions, 12 deletions
diff --git a/src/fe-common/irc/fe-irc-commands.c b/src/fe-common/irc/fe-irc-commands.c
index c9a9016e..4696aba6 100644
--- a/src/fe-common/irc/fe-irc-commands.c
+++ b/src/fe-common/irc/fe-irc-commands.c
@@ -22,7 +22,6 @@
#include "module-formats.h"
#include "signals.h"
#include "misc.h"
-#include "recode.h"
#include "special-vars.h"
#include "settings.h"
@@ -45,7 +44,6 @@
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))
@@ -55,15 +53,10 @@ 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);
+ irc_server_send_action(server, target, data);
signal_emit("message irc own_action", 3, server, data,
item->visible_name);
-
- irc_send_cmdv(server, "PRIVMSG %s :\001ACTION %s\001",
- target, recoded);
-
- g_free(recoded);
}
/* SYNTAX: ACTION [-<server tag>] <target> <message> */
@@ -71,7 +64,6 @@ 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);
@@ -87,12 +79,10 @@ static void cmd_action(const char *data, IRC_SERVER_REC *server)
if (server == NULL || !server->connected)
cmd_param_error(CMDERR_NOT_CONNECTED);
- recoded = recode_out(SERVER(server), text, target);
- irc_send_cmdv(server, "PRIVMSG %s :\001ACTION %s\001", target, recoded);
+ irc_server_send_action(server, target, text);
signal_emit("message irc own_action", 3, server, text, target);
- g_free(recoded);
cmd_params_free(free_arg);
}
diff --git a/src/irc/core/irc-servers.c b/src/irc/core/irc-servers.c
index 1c3f2208..c1b74274 100644
--- a/src/irc/core/irc-servers.c
+++ b/src/irc/core/irc-servers.c
@@ -346,6 +346,15 @@ static void sig_server_quit(IRC_SERVER_REC *server, const char *msg)
g_free(str);
}
+void irc_server_send_action(IRC_SERVER_REC *server, const char *target, const char *data)
+{
+ char *recoded;
+
+ recoded = recode_out(SERVER(server), data, target);
+ irc_send_cmdv(server, "PRIVMSG %s :\001ACTION %s\001", target, recoded);
+ g_free(recoded);
+}
+
void irc_server_send_away(IRC_SERVER_REC *server, const char *reason)
{
char *recoded = NULL;
diff --git a/src/irc/core/irc-servers.h b/src/irc/core/irc-servers.h
index fc3480a7..67ee76c1 100644
--- a/src/irc/core/irc-servers.h
+++ b/src/irc/core/irc-servers.h
@@ -117,6 +117,7 @@ void irc_server_purge_output(IRC_SERVER_REC *server, const char *target);
char *irc_server_get_channels(IRC_SERVER_REC *server);
/* INTERNAL: */
+void irc_server_send_action(IRC_SERVER_REC *server, const char *target, const char *data);
void irc_server_send_away(IRC_SERVER_REC *server, const char *reason);
void irc_server_send_data(IRC_SERVER_REC *server, const char *data, int len);
void irc_server_init_isupport(IRC_SERVER_REC *server);