mirror of
https://github.com/irssi/irssi.git
synced 2024-12-04 14:46:39 -05:00
properly format listmodes and their timestamps
This commit is contained in:
parent
6671fec9a9
commit
2db9dfbb46
@ -143,15 +143,13 @@ static void event_ban_list(IRC_SERVER_REC *server, const char *data)
|
||||
IRC_CHANNEL_REC *chanrec;
|
||||
BAN_REC *banrec;
|
||||
const char *channel;
|
||||
char *params, *ban, *setby, *tims;
|
||||
long secs;
|
||||
char *params, *ban, *setby, *tims, *timestr;
|
||||
|
||||
g_return_if_fail(data != NULL);
|
||||
|
||||
params = event_get_params(data, 5, NULL, &channel,
|
||||
&ban, &setby, &tims);
|
||||
secs = *tims == '\0' ? 0 :
|
||||
(long) (time(NULL) - atol(tims));
|
||||
timestr = my_asctime((time_t) atol(tims));
|
||||
|
||||
chanrec = irc_channel_find(server, channel);
|
||||
banrec = chanrec == NULL ? NULL : banlist_find(chanrec->banlist, ban);
|
||||
@ -160,29 +158,49 @@ static void event_ban_list(IRC_SERVER_REC *server, const char *data)
|
||||
printformat(server, channel, MSGLEVEL_CRAP,
|
||||
*setby == '\0' ? IRCTXT_BANLIST : IRCTXT_BANLIST_LONG,
|
||||
banrec == NULL ? 0 : g_slist_index(chanrec->banlist, banrec)+1,
|
||||
channel, ban, setby, secs);
|
||||
channel, ban, setby, timestr);
|
||||
|
||||
g_free(timestr);
|
||||
g_free(params);
|
||||
}
|
||||
|
||||
static void event_eban_list(IRC_SERVER_REC *server, const char *data)
|
||||
{
|
||||
const char *channel;
|
||||
char *params, *ban, *setby, *tims;
|
||||
long secs;
|
||||
char *params, *ban, *setby, *tims, *timestr;
|
||||
|
||||
g_return_if_fail(data != NULL);
|
||||
|
||||
params = event_get_params(data, 5, NULL, &channel,
|
||||
&ban, &setby, &tims);
|
||||
secs = *tims == '\0' ? 0 :
|
||||
(long) (time(NULL) - atol(tims));
|
||||
timestr = my_asctime((time_t) atol(tims));
|
||||
|
||||
channel = get_visible_target(server, channel);
|
||||
printformat(server, channel, MSGLEVEL_CRAP,
|
||||
*setby == '\0' ? IRCTXT_EBANLIST : IRCTXT_EBANLIST_LONG,
|
||||
channel, ban, setby, secs);
|
||||
channel, ban, setby, timestr);
|
||||
|
||||
g_free(timestr);
|
||||
g_free(params);
|
||||
}
|
||||
|
||||
static void event_quiet_list(IRC_SERVER_REC *server, const char *data)
|
||||
{
|
||||
const char *channel;
|
||||
char *params, *ban, *setby, *tims, *timestr;
|
||||
|
||||
g_return_if_fail(data != NULL);
|
||||
|
||||
params = event_get_params(data, 6, NULL, &channel,
|
||||
NULL, &ban, &setby, &tims);
|
||||
timestr = my_asctime((time_t) atol(tims));
|
||||
|
||||
channel = get_visible_target(server, channel);
|
||||
printformat(server, channel, MSGLEVEL_CRAP,
|
||||
*setby == '\0' ? IRCTXT_QUIETLIST : IRCTXT_QUIETLIST_LONG,
|
||||
channel, ban, setby, timestr);
|
||||
|
||||
g_free(timestr);
|
||||
g_free(params);
|
||||
}
|
||||
|
||||
@ -214,20 +232,20 @@ static void event_accept_list(IRC_SERVER_REC *server, const char *data)
|
||||
static void event_invite_list(IRC_SERVER_REC *server, const char *data)
|
||||
{
|
||||
const char *channel;
|
||||
char *params, *invite, *setby, *tims;
|
||||
long secs;
|
||||
char *params, *invite, *setby, *tims, *timestr;
|
||||
|
||||
g_return_if_fail(data != NULL);
|
||||
|
||||
params = event_get_params(data, 5, NULL, &channel, &invite,
|
||||
&setby, &tims);
|
||||
secs = *tims == '\0' ? 0 :
|
||||
(long) (time(NULL) - atol(tims));
|
||||
timestr = my_asctime((time_t) atol(tims));
|
||||
|
||||
channel = get_visible_target(server, channel);
|
||||
printformat(server, channel, MSGLEVEL_CRAP,
|
||||
*setby == '\0' ? IRCTXT_INVITELIST : IRCTXT_INVITELIST_LONG,
|
||||
channel, invite, setby, secs);
|
||||
channel, invite, setby, timestr);
|
||||
|
||||
g_free(timestr);
|
||||
g_free(params);
|
||||
}
|
||||
|
||||
@ -727,6 +745,7 @@ void fe_events_numeric_init(void)
|
||||
signal_add("event 281", (SIGNAL_FUNC) event_accept_list);
|
||||
signal_add("event 367", (SIGNAL_FUNC) event_ban_list);
|
||||
signal_add("event 348", (SIGNAL_FUNC) event_eban_list);
|
||||
signal_add("event 728", (SIGNAL_FUNC) event_quiet_list);
|
||||
signal_add("event 346", (SIGNAL_FUNC) event_invite_list);
|
||||
signal_add("event 433", (SIGNAL_FUNC) event_nick_in_use);
|
||||
signal_add("event 332", (SIGNAL_FUNC) event_topic_get);
|
||||
@ -804,7 +823,6 @@ void fe_events_numeric_init(void)
|
||||
signal_add("event 506", (SIGNAL_FUNC) event_target_received); /* cannot send (+R) */
|
||||
signal_add("event 716", (SIGNAL_FUNC) event_target_received); /* cannot /msg (+g) */
|
||||
signal_add("event 717", (SIGNAL_FUNC) event_target_received); /* +g notified */
|
||||
signal_add("event 728", (SIGNAL_FUNC) event_target_received); /* quiet (or other) list */
|
||||
signal_add("event 729", (SIGNAL_FUNC) event_target_received); /* end of quiet (or other) list */
|
||||
/* clang-format on */
|
||||
}
|
||||
@ -825,6 +843,7 @@ void fe_events_numeric_deinit(void)
|
||||
signal_remove("event 281", (SIGNAL_FUNC) event_accept_list);
|
||||
signal_remove("event 367", (SIGNAL_FUNC) event_ban_list);
|
||||
signal_remove("event 348", (SIGNAL_FUNC) event_eban_list);
|
||||
signal_remove("event 728", (SIGNAL_FUNC) event_quiet_list);
|
||||
signal_remove("event 346", (SIGNAL_FUNC) event_invite_list);
|
||||
signal_remove("event 433", (SIGNAL_FUNC) event_nick_in_use);
|
||||
signal_remove("event 332", (SIGNAL_FUNC) event_topic_get);
|
||||
@ -898,6 +917,5 @@ void fe_events_numeric_deinit(void)
|
||||
signal_remove("event 506", (SIGNAL_FUNC) event_target_received);
|
||||
signal_remove("event 716", (SIGNAL_FUNC) event_target_received);
|
||||
signal_remove("event 717", (SIGNAL_FUNC) event_target_received);
|
||||
signal_remove("event 728", (SIGNAL_FUNC) event_target_received);
|
||||
signal_remove("event 729", (SIGNAL_FUNC) event_target_received);
|
||||
}
|
||||
|
@ -81,12 +81,14 @@ FORMAT_REC fecommon_irc_formats[] = {
|
||||
{ "bantype", "Ban type changed to {channel $0}", 1, { 0 } },
|
||||
{ "no_bans", "No bans in channel {channel $0}", 1, { 0 } },
|
||||
{ "banlist", "$0 - {channel $1}: ban {ban $2}", 3, { 1, 0, 0 } },
|
||||
{ "banlist_long", "$0 - {channel $1}: ban {ban $2} {comment by {nick $3}, $4 secs ago}", 5, { 1, 0, 0, 0, 1 } },
|
||||
{ "banlist_long", "$0 - {channel $1}: ban {ban $2} {comment by {nick $3}, on $4}", 5, { 1, 0, 0, 0, 0 } },
|
||||
{ "quietlist", "{channel $0}: quiet {ban $1}", 2, { 0, 0 } },
|
||||
{ "quietlist_long", "{channel $0}: quiet {ban $1} {comment by {nick $2}, on $3}", 4, { 0, 0, 0, 0 } },
|
||||
{ "ebanlist", "{channel $0}: ban exception {ban $1}", 2, { 0, 0 } },
|
||||
{ "ebanlist_long", "{channel $0}: ban exception {ban $1} {comment by {nick $2}, $3 secs ago}", 4, { 0, 0, 0, 1 } },
|
||||
{ "ebanlist_long", "{channel $0}: ban exception {ban $1} {comment by {nick $2}, on $3}", 4, { 0, 0, 0, 0 } },
|
||||
{ "no_invitelist", "Invite list is empty in channel {channel $0}", 1, { 0 } },
|
||||
{ "invitelist", "{channel $0}: invite {ban $1}", 2, { 0, 0 } },
|
||||
{ "invitelist_long", "{channel $0}: invite {ban $1} {comment by {nick $2}, $3 secs ago}", 4, { 0, 0, 0, 1 } },
|
||||
{ "invitelist_long", "{channel $0}: invite {ban $1} {comment by {nick $2}, on $3}", 4, { 0, 0, 0, 0 } },
|
||||
{ "no_such_channel", "{channel $0}: No such channel", 1, { 0 } },
|
||||
{ "channel_synced", "Join to {channel $0} was synced in {hilight $1} secs", 2, { 0, 2 } },
|
||||
{ "server_help_start", "$1", 2, { 0, 0 } },
|
||||
|
@ -59,6 +59,8 @@ enum {
|
||||
IRCTXT_NO_BANS,
|
||||
IRCTXT_BANLIST,
|
||||
IRCTXT_BANLIST_LONG,
|
||||
IRCTXT_QUIETLIST,
|
||||
IRCTXT_QUIETLIST_LONG,
|
||||
IRCTXT_EBANLIST,
|
||||
IRCTXT_EBANLIST_LONG,
|
||||
IRCTXT_NO_INVITELIST,
|
||||
|
Loading…
Reference in New Issue
Block a user