mirror of
https://github.com/irssi/irssi.git
synced 2024-12-04 14:46:39 -05:00
Add better support for numeric 489 ERR_SECUREONLYCHAN along with a print format
modified: src/fe-common/irc/fe-events-numeric.c modified: src/fe-common/irc/module-formats.c modified: src/fe-common/irc/module-formats.h
This commit is contained in:
parent
3ba8eeba4b
commit
ae6c8a1bd5
@ -531,6 +531,31 @@ static void event_477(IRC_SERVER_REC *server, const char *data,
|
||||
g_free(params);
|
||||
}
|
||||
|
||||
static void event_489(IRC_SERVER_REC *server, const char *data,
|
||||
const char *nick)
|
||||
{
|
||||
/* Numeric 489 can mean one of two things things:
|
||||
* cannot join to channel (secure only), or not chanop or voice.
|
||||
* If we tried to join this channel, display the joinerror.
|
||||
* Otherwise depending on the channel being joined or not
|
||||
* display the error in the channel or status window.
|
||||
*/
|
||||
IRC_CHANNEL_REC *chanrec;
|
||||
char *params, *channel;
|
||||
|
||||
g_return_if_fail(data != NULL);
|
||||
|
||||
params = event_get_params(data, 2, NULL, &channel);
|
||||
|
||||
chanrec = irc_channel_find(server, channel);
|
||||
if (chanrec != NULL && !chanrec->joined) {
|
||||
cannot_join(server, data, IRCTXT_JOINERROR_SECURE_ONLY);
|
||||
} else {
|
||||
print_event_received(server, data, nick, chanrec == NULL || chanrec->joined);
|
||||
}
|
||||
g_free(params);
|
||||
}
|
||||
|
||||
static void event_target_too_fast(IRC_SERVER_REC *server, const char *data,
|
||||
const char *nick)
|
||||
{
|
||||
@ -683,6 +708,7 @@ void fe_events_numeric_init(void)
|
||||
signal_add("event 475", (SIGNAL_FUNC) event_bad_channel_key);
|
||||
signal_add("event 476", (SIGNAL_FUNC) event_bad_channel_mask);
|
||||
signal_add("event 477", (SIGNAL_FUNC) event_477);
|
||||
signal_add("event 489", (SIGNAL_FUNC) event_489); /* cannot join to channel (secure only), or not chanop or voice. */
|
||||
signal_add("event 375", (SIGNAL_FUNC) event_motd);
|
||||
signal_add("event 376", (SIGNAL_FUNC) event_motd);
|
||||
signal_add("event 372", (SIGNAL_FUNC) event_motd);
|
||||
@ -726,7 +752,6 @@ void fe_events_numeric_init(void)
|
||||
signal_add("event 478", (SIGNAL_FUNC) event_target_received); /* ban list is full */
|
||||
signal_add("event 482", (SIGNAL_FUNC) event_target_received); /* not chanop */
|
||||
signal_add("event 486", (SIGNAL_FUNC) event_target_received); /* cannot /msg (+R) */
|
||||
signal_add("event 489", (SIGNAL_FUNC) event_target_received); /* not chanop or voice */
|
||||
signal_add("event 494", (SIGNAL_FUNC) event_target_received); /* cannot /msg (own +R) */
|
||||
signal_add("event 506", (SIGNAL_FUNC) event_target_received); /* cannot send (+R) */
|
||||
signal_add("event 716", (SIGNAL_FUNC) event_target_received); /* cannot /msg (+g) */
|
||||
@ -776,6 +801,7 @@ void fe_events_numeric_deinit(void)
|
||||
signal_remove("event 475", (SIGNAL_FUNC) event_bad_channel_key);
|
||||
signal_remove("event 476", (SIGNAL_FUNC) event_bad_channel_mask);
|
||||
signal_remove("event 477", (SIGNAL_FUNC) event_477);
|
||||
signal_remove("event 489", (SIGNAL_FUNC) event_489);
|
||||
signal_remove("event 375", (SIGNAL_FUNC) event_motd);
|
||||
signal_remove("event 376", (SIGNAL_FUNC) event_motd);
|
||||
signal_remove("event 372", (SIGNAL_FUNC) event_motd);
|
||||
@ -815,7 +841,6 @@ void fe_events_numeric_deinit(void)
|
||||
signal_remove("event 478", (SIGNAL_FUNC) event_target_received);
|
||||
signal_remove("event 482", (SIGNAL_FUNC) event_target_received);
|
||||
signal_remove("event 486", (SIGNAL_FUNC) event_target_received);
|
||||
signal_remove("event 489", (SIGNAL_FUNC) event_target_received);
|
||||
signal_remove("event 494", (SIGNAL_FUNC) event_target_received);
|
||||
signal_remove("event 506", (SIGNAL_FUNC) event_target_received);
|
||||
signal_remove("event 716", (SIGNAL_FUNC) event_target_received);
|
||||
|
@ -63,6 +63,7 @@ FORMAT_REC fecommon_irc_formats[] = {
|
||||
{ "joinerror_banned", "Cannot join to channel {channel $0} (You are banned)", 1, { 0 } },
|
||||
{ "joinerror_bad_key", "Cannot join to channel {channel $0} (Bad channel key)", 1, { 0 } },
|
||||
{ "joinerror_bad_mask", "Cannot join to channel {channel $0} (Bad channel mask)", 1, { 0 } },
|
||||
{ "joinerror_secure_only", "Cannot join to channel {channel $0} (Secure clients only)", 1, { 0 } },
|
||||
{ "joinerror_unavail", "Cannot join to channel {channel $0} (Channel is temporarily unavailable)", 1, { 0 } },
|
||||
{ "joinerror_duplicate", "Channel {channel $0} already exists - cannot create it", 1, { 0 } },
|
||||
{ "channel_rejoin", "Channel {channel $0} is temporarily unavailable, this is normally because of netsplits. Irssi will now automatically try to rejoin back to this channel until the join is successful. Use /RMREJOINS command if you wish to abort this.", 1, { 0 } },
|
||||
|
@ -40,6 +40,7 @@ enum {
|
||||
IRCTXT_JOINERROR_BANNED,
|
||||
IRCTXT_JOINERROR_BAD_KEY,
|
||||
IRCTXT_JOINERROR_BAD_MASK,
|
||||
IRCTXT_JOINERROR_SECURE_ONLY,
|
||||
IRCTXT_JOINERROR_UNAVAIL,
|
||||
IRCTXT_JOINERROR_DUPLICATE,
|
||||
IRCTXT_CHANNEL_REJOIN,
|
||||
|
Loading…
Reference in New Issue
Block a user