diff options
author | Sebastian Thorarensen <sebth@naju.se> | 2014-07-05 03:58:16 +0200 |
---|---|---|
committer | Sebastian Thorarensen <sebth@naju.se> | 2014-07-06 23:24:10 +0200 |
commit | 695a6a7d9bf8ffbe9378c6aff7c69aa259f2c8c7 (patch) | |
tree | 41df6aca886b4ae3b6624834921fd4dbd698fb57 /src/core/chat-commands.c | |
parent | 28a3dbe1641876b71a4805ada9aa25b17e43b1ac (diff) | |
download | irssi-695a6a7d9bf8ffbe9378c6aff7c69aa259f2c8c7.zip |
Allow `server.split_message' being NULL
Now a module can set `server.split_message = NULL' to disable message
splitting, instead of having to implement the function.
Diffstat (limited to 'src/core/chat-commands.c')
-rw-r--r-- | src/core/chat-commands.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/core/chat-commands.c b/src/core/chat-commands.c index e8c7e90f..235a9fc4 100644 --- a/src/core/chat-commands.c +++ b/src/core/chat-commands.c @@ -378,10 +378,22 @@ static void cmd_msg(const char *data, SERVER_REC *server, WI_ITEM_REC *item) } } if (target != NULL) { - char **splitmsgs = server->split_message(server, target, msg); + char **splitmsgs; + char **tmp = NULL; + char *singlemsg[] = { msg, NULL }; char *m; int n = 0; + /* + * If split_message is NULL, the server doesn't need to split + * long messages. + */ + if (server->split_message != NULL) + splitmsgs = tmp = server->split_message(server, target, + msg); + else + splitmsgs = singlemsg; + while ((m = splitmsgs[n++])) { signal_emit("server sendmsg", 4, server, target, m, GINT_TO_POINTER(target_type)); @@ -390,7 +402,7 @@ static void cmd_msg(const char *data, SERVER_REC *server, WI_ITEM_REC *item) "message own_private", 4, server, m, target, origtarget); } - g_strfreev(splitmsgs); + g_strfreev(tmp); } else { signal_emit("message own_private", 4, server, msg, target, origtarget); |