summaryrefslogtreecommitdiff
path: root/src/irc
diff options
context:
space:
mode:
authorSebastian Thorarensen <sebth@naju.se>2014-06-17 18:17:28 +0200
committerSebastian Thorarensen <sebth@naju.se>2014-07-06 23:24:10 +0200
commitbb7bafc93cb78dc185565d5750ac3ca5abff2fc8 (patch)
treee21316d9dcec7a733e034dca2dde1e20532c76fb /src/irc
parent90f3dd612e0d7a6027e60018ca5476e7ddb52f54 (diff)
downloadirssi-bb7bafc93cb78dc185565d5750ac3ca5abff2fc8.zip
Split long IRC `ACTION' messages
Add line splitting logic to commands `/me' and `/action'.
Diffstat (limited to 'src/irc')
-rw-r--r--src/irc/core/irc-servers.c18
-rw-r--r--src/irc/core/irc-servers.h5
2 files changed, 22 insertions, 1 deletions
diff --git a/src/irc/core/irc-servers.c b/src/irc/core/irc-servers.c
index 872dbbfd..dc98e1c1 100644
--- a/src/irc/core/irc-servers.c
+++ b/src/irc/core/irc-servers.c
@@ -450,6 +450,24 @@ void irc_server_send_action(IRC_SERVER_REC *server, const char *target, const ch
g_free(recoded);
}
+char **irc_server_split_action(IRC_SERVER_REC *server, const char *target,
+ const char *data)
+{
+ /* See split_message() on how the maximum length is calculated. */
+ int userhostlen = 63 + 10 + 1;
+
+ g_return_val_if_fail(server != NULL, NULL);
+ g_return_val_if_fail(target != NULL, NULL);
+ g_return_val_if_fail(data != NULL, NULL);
+
+ if (server->userhost != NULL)
+ userhostlen = strlen(server->userhost);
+
+ return split_line(SERVER(server), data, target,
+ 510 - strlen(":! PRIVMSG :\001ACTION \001") -
+ strlen(server->nick) - userhostlen - strlen(target));
+}
+
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 8c9c1cd7..7e4eeabf 100644
--- a/src/irc/core/irc-servers.h
+++ b/src/irc/core/irc-servers.h
@@ -117,7 +117,10 @@ 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_action(IRC_SERVER_REC *server, const char *target,
+ const char *data);
+char **irc_server_split_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);