1
0
mirror of https://github.com/unrealircd/unrealircd.git synced 2026-07-06 08:13:12 +02:00

Add exit_client_fmt() which accepts formatting characters.

This commit is contained in:
Bram Matthys
2021-08-08 10:14:48 +02:00
parent f843fc6d23
commit a339efad2a
2 changed files with 18 additions and 0 deletions
+1
View File
@@ -285,6 +285,7 @@ extern char *myctime(time_t);
extern char *short_date(time_t, char *buf);
extern char *long_date(time_t);
extern void exit_client(Client *client, MessageTag *recv_mtags, char *comment);
extern void exit_client_fmt(Client *client, MessageTag *recv_mtags, FORMAT_STRING(const char *pattern), ...) __attribute__((format(printf, 3, 4)));
extern void exit_client_ex(Client *client, Client *origin, MessageTag *recv_mtags, char *comment);
extern void initstats(), tstats(Client *, char *);
extern char *check_string(char *);
+17
View File
@@ -558,6 +558,23 @@ void exit_client(Client *client, MessageTag *recv_mtags, char *comment)
exit_client_ex(client, client->direction, recv_mtags, comment);
}
/** Exit this IRC client, and all the dependents (users, servers) if this is a server.
* @param client The client to exit.
* @param recv_mtags Message tags to use as a base (if any).
* @param comment The (s)quit message
*/
void exit_client_fmt(Client *client, MessageTag *recv_mtags, FORMAT_STRING(const char *pattern), ...)
{
char comment[512];
va_list vl;
va_start(vl, pattern);
vsnprintf(comment, sizeof(comment), pattern, vl);
va_end(vl);
exit_client_ex(client, client->direction, recv_mtags, comment);
}
/** Exit this IRC client, and all the dependents (users, servers) if this is a server.
* @param client The client to exit.
* @param recv_mtags Message tags to use as a base (if any).