diff options
author | Sebastian Thorarensen <sebth@naju.se> | 2014-06-17 18:17:28 +0200 |
---|---|---|
committer | Sebastian Thorarensen <sebth@naju.se> | 2014-07-06 23:24:10 +0200 |
commit | bb7bafc93cb78dc185565d5750ac3ca5abff2fc8 (patch) | |
tree | e21316d9dcec7a733e034dca2dde1e20532c76fb /src/fe-common | |
parent | 90f3dd612e0d7a6027e60018ca5476e7ddb52f54 (diff) | |
download | irssi-bb7bafc93cb78dc185565d5750ac3ca5abff2fc8.zip |
Split long IRC `ACTION' messages
Add line splitting logic to commands `/me' and `/action'.
Diffstat (limited to 'src/fe-common')
-rw-r--r-- | src/fe-common/irc/fe-irc-commands.c | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/src/fe-common/irc/fe-irc-commands.c b/src/fe-common/irc/fe-irc-commands.c index f2b00590..765b5340 100644 --- a/src/fe-common/irc/fe-irc-commands.c +++ b/src/fe-common/irc/fe-irc-commands.c @@ -44,6 +44,9 @@ static void cmd_me(const char *data, IRC_SERVER_REC *server, WI_ITEM_REC *item) { const char *target; + char *subdata; + char **splitdata; + int n = 0; CMD_IRC_SERVER(server); if (!IS_IRC_ITEM(item)) @@ -53,10 +56,13 @@ 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); - irc_server_send_action(server, target, data); - - signal_emit("message irc own_action", 3, server, data, - item->visible_name); + splitdata = irc_server_split_action(server, target, data); + while ((subdata = splitdata[n++])) { + irc_server_send_action(server, target, subdata); + signal_emit("message irc own_action", 3, server, subdata, + item->visible_name); + } + g_strfreev(splitdata); } /* SYNTAX: ACTION [-<server tag>] <target> <message> */ @@ -64,6 +70,9 @@ static void cmd_action(const char *data, IRC_SERVER_REC *server) { GHashTable *optlist; const char *target, *text; + char *subtext; + char **splittexts; + int n = 0; void *free_arg; CMD_IRC_SERVER(server); @@ -79,10 +88,14 @@ static void cmd_action(const char *data, IRC_SERVER_REC *server) if (server == NULL || !server->connected) cmd_param_error(CMDERR_NOT_CONNECTED); - irc_server_send_action(server, target, text); - - signal_emit("message irc own_action", 3, server, text, target); + splittexts = irc_server_split_action(server, target, text); + while ((subtext = splittexts[n++])) { + irc_server_send_action(server, target, subtext); + signal_emit("message irc own_action", 3, server, subtext, + target); + } + g_strfreev(splittexts); cmd_params_free(free_arg); } |