Change send_msg_to_channels() to remove 'channels' argument and always use PRIVMSG
The 'channels' argument was unnecessary because the channel list passed to it would always be from get_server_channels(server) anyway. Changing the message argument from a protocol message format string to a plain payload string for PRIVMSG means printf-escaping of the argument is avoided in the caller. This simplifies the callers and means we can remove the last use of quote_it(). This change also switches set_server_away() to use send_msg_to_channels() instead of open-coding the equivalent, which simplifies that function a lot. We are changing the signature of a function exported to modules here; however none of the in-tree modules use this function so it should be OK.
This commit is contained in:
@@ -3159,21 +3159,18 @@ int silent = 0;
|
||||
bitchsay("You were /away for %i hours %i minutes and %i seconds. [\002BX\002-MsgLog %s]",
|
||||
hours, minutes, seconds,
|
||||
on_off(get_int_var(MSGLOG_VAR)));
|
||||
if (fget_string_var(FORMAT_BACK_FSET))
|
||||
{
|
||||
char str[BIG_BUFFER_SIZE+1];
|
||||
char reason[BIG_BUFFER_SIZE+1];
|
||||
char fset[BIG_BUFFER_SIZE+1];
|
||||
*reason = 0;
|
||||
quote_it(args ? args : get_server_away(from_server), NULL, reason);
|
||||
if(fget_string_var(FORMAT_BACK_FSET))
|
||||
{
|
||||
quote_it(stripansicodes(convert_output_format(fget_string_var(FORMAT_BACK_FSET), "%s %d %d %d %d %s",
|
||||
update_clock(GET_TIME), hours, minutes, seconds,
|
||||
get_int_var(MSGCOUNT_VAR), reason)), NULL, fset);
|
||||
snprintf(str, BIG_BUFFER_SIZE,
|
||||
"PRIVMSG %%s :ACTION %s", fset);
|
||||
send_msg_to_channels(get_server_channels(from_server), from_server, str);
|
||||
}
|
||||
char *fset;
|
||||
char *reason = args ? args : get_server_away(from_server);
|
||||
|
||||
fset = stripansicodes(convert_output_format(
|
||||
fget_string_var(FORMAT_BACK_FSET), "%s %d %d %d %d %s",
|
||||
update_clock(GET_TIME), hours, minutes, seconds,
|
||||
get_int_var(MSGCOUNT_VAR), reason));
|
||||
snprintf(str, BIG_BUFFER_SIZE, "ACTION %s", fset);
|
||||
send_msg_to_channels(from_server, str);
|
||||
}
|
||||
}
|
||||
set_server_away(from_server, NULL, silent);
|
||||
|
||||
Reference in New Issue
Block a user