mirror of
https://github.com/irssi/irssi.git
synced 2024-11-03 04:27:19 -05:00
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.
This commit is contained in:
parent
28a3dbe164
commit
695a6a7d9b
@ -378,10 +378,22 @@ static void cmd_msg(const char *data, SERVER_REC *server, WI_ITEM_REC *item)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (target != NULL) {
|
if (target != NULL) {
|
||||||
char **splitmsgs = server->split_message(server, target, msg);
|
char **splitmsgs;
|
||||||
|
char **tmp = NULL;
|
||||||
|
char *singlemsg[] = { msg, NULL };
|
||||||
char *m;
|
char *m;
|
||||||
int n = 0;
|
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++])) {
|
while ((m = splitmsgs[n++])) {
|
||||||
signal_emit("server sendmsg", 4, server, target, m,
|
signal_emit("server sendmsg", 4, server, target, m,
|
||||||
GINT_TO_POINTER(target_type));
|
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,
|
"message own_private", 4, server, m,
|
||||||
target, origtarget);
|
target, origtarget);
|
||||||
}
|
}
|
||||||
g_strfreev(splitmsgs);
|
g_strfreev(tmp);
|
||||||
} else {
|
} else {
|
||||||
signal_emit("message own_private", 4, server, msg, target,
|
signal_emit("message own_private", 4, server, msg, target,
|
||||||
origtarget);
|
origtarget);
|
||||||
|
Loading…
Reference in New Issue
Block a user