mirror of
https://github.com/irssi/irssi.git
synced 2024-12-04 14:46:39 -05:00
Handle event "407 duplicate channel" correctly - happens when trying to
create !channel (/join !!channel) while it already exists. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@741 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
parent
ad97695841
commit
d398247f76
@ -587,6 +587,26 @@ static void event_too_many_channels(const char *data, IRC_SERVER_REC *server)
|
|||||||
cannot_join(data, server, IRCTXT_JOINERROR_TOOMANY);
|
cannot_join(data, server, IRCTXT_JOINERROR_TOOMANY);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void event_duplicate_channel(const char *data, IRC_SERVER_REC *server)
|
||||||
|
{
|
||||||
|
char *params, *channel, *p;
|
||||||
|
|
||||||
|
g_return_if_fail(data != NULL);
|
||||||
|
|
||||||
|
/* this new addition to ircd breaks completely with older
|
||||||
|
"standards", "nick Duplicate ::!!channel ...." */
|
||||||
|
params = event_get_params(data, 3, NULL, NULL, &channel);
|
||||||
|
p = strchr(channel, ' ');
|
||||||
|
if (p != NULL) *p = '\0';
|
||||||
|
|
||||||
|
if (channel[0] == '!' && channel[1] == '!') {
|
||||||
|
printformat(server, NULL, MSGLEVEL_CRAP,
|
||||||
|
IRCTXT_JOINERROR_DUPLICATE, channel+1);
|
||||||
|
}
|
||||||
|
|
||||||
|
g_free(params);
|
||||||
|
}
|
||||||
|
|
||||||
static void event_channel_is_full(const char *data, IRC_SERVER_REC *server)
|
static void event_channel_is_full(const char *data, IRC_SERVER_REC *server)
|
||||||
{
|
{
|
||||||
cannot_join(data, server, IRCTXT_JOINERROR_FULL);
|
cannot_join(data, server, IRCTXT_JOINERROR_FULL);
|
||||||
@ -710,6 +730,7 @@ void fe_events_numeric_init(void)
|
|||||||
signal_add("event 401", (SIGNAL_FUNC) event_no_such_nick);
|
signal_add("event 401", (SIGNAL_FUNC) event_no_such_nick);
|
||||||
signal_add("event 403", (SIGNAL_FUNC) event_no_such_channel);
|
signal_add("event 403", (SIGNAL_FUNC) event_no_such_channel);
|
||||||
signal_add("event 405", (SIGNAL_FUNC) event_too_many_channels);
|
signal_add("event 405", (SIGNAL_FUNC) event_too_many_channels);
|
||||||
|
signal_add("event 407", (SIGNAL_FUNC) event_duplicate_channel);
|
||||||
signal_add("event 471", (SIGNAL_FUNC) event_channel_is_full);
|
signal_add("event 471", (SIGNAL_FUNC) event_channel_is_full);
|
||||||
signal_add("event 472", (SIGNAL_FUNC) event_unknown_mode);
|
signal_add("event 472", (SIGNAL_FUNC) event_unknown_mode);
|
||||||
signal_add("event 473", (SIGNAL_FUNC) event_invite_only);
|
signal_add("event 473", (SIGNAL_FUNC) event_invite_only);
|
||||||
@ -768,6 +789,7 @@ void fe_events_numeric_deinit(void)
|
|||||||
signal_remove("event 401", (SIGNAL_FUNC) event_no_such_nick);
|
signal_remove("event 401", (SIGNAL_FUNC) event_no_such_nick);
|
||||||
signal_remove("event 403", (SIGNAL_FUNC) event_no_such_channel);
|
signal_remove("event 403", (SIGNAL_FUNC) event_no_such_channel);
|
||||||
signal_remove("event 405", (SIGNAL_FUNC) event_too_many_channels);
|
signal_remove("event 405", (SIGNAL_FUNC) event_too_many_channels);
|
||||||
|
signal_remove("event 407", (SIGNAL_FUNC) event_duplicate_channel);
|
||||||
signal_remove("event 471", (SIGNAL_FUNC) event_channel_is_full);
|
signal_remove("event 471", (SIGNAL_FUNC) event_channel_is_full);
|
||||||
signal_remove("event 472", (SIGNAL_FUNC) event_unknown_mode);
|
signal_remove("event 472", (SIGNAL_FUNC) event_unknown_mode);
|
||||||
signal_remove("event 473", (SIGNAL_FUNC) event_invite_only);
|
signal_remove("event 473", (SIGNAL_FUNC) event_invite_only);
|
||||||
|
@ -55,6 +55,7 @@ FORMAT_REC fecommon_irc_formats[] = {
|
|||||||
{ "joinerror_bad_key", "Cannot join to channel %_$0%_ %K(%nBad channel key%K)", 1, { 0 } },
|
{ "joinerror_bad_key", "Cannot join to channel %_$0%_ %K(%nBad channel key%K)", 1, { 0 } },
|
||||||
{ "joinerror_bad_mask", "Cannot join to channel %_$0%_ %K(%nBad channel mask%K)", 1, { 0 } },
|
{ "joinerror_bad_mask", "Cannot join to channel %_$0%_ %K(%nBad channel mask%K)", 1, { 0 } },
|
||||||
{ "joinerror_unavail", "Cannot join to channel %_$0%_ %K(%nChannel is temporarily unavailable%K)", 1, { 0 } },
|
{ "joinerror_unavail", "Cannot join to channel %_$0%_ %K(%nChannel is temporarily unavailable%K)", 1, { 0 } },
|
||||||
|
{ "joinerror_duplicate", "Channel %_$0%_ already exists - cannot create it", 1, { 0 } },
|
||||||
{ "channel_rejoin", "Channel %_$0%_ is temporarily unavailable, this is normally because of netsplits. Irssi will now automatically try to rejoin to this channel until the join is successfull. Use /RMREJOINS command if you wish to abort this.", 1, { 0 } },
|
{ "channel_rejoin", "Channel %_$0%_ is temporarily unavailable, this is normally because of netsplits. Irssi will now automatically try to rejoin to this channel until the join is successfull. Use /RMREJOINS command if you wish to abort this.", 1, { 0 } },
|
||||||
{ "inviting", "Inviting $0 to %_$1", 2, { 0, 0 } },
|
{ "inviting", "Inviting $0 to %_$1", 2, { 0, 0 } },
|
||||||
{ "not_invited", "You have not been invited to a channel!", 0 },
|
{ "not_invited", "You have not been invited to a channel!", 0 },
|
||||||
|
@ -32,6 +32,7 @@ enum {
|
|||||||
IRCTXT_JOINERROR_BAD_KEY,
|
IRCTXT_JOINERROR_BAD_KEY,
|
||||||
IRCTXT_JOINERROR_BAD_MASK,
|
IRCTXT_JOINERROR_BAD_MASK,
|
||||||
IRCTXT_JOINERROR_UNAVAIL,
|
IRCTXT_JOINERROR_UNAVAIL,
|
||||||
|
IRCTXT_JOINERROR_DUPLICATE,
|
||||||
IRCTXT_CHANNEL_REJOIN,
|
IRCTXT_CHANNEL_REJOIN,
|
||||||
IRCTXT_INVITING,
|
IRCTXT_INVITING,
|
||||||
IRCTXT_NOT_INVITED,
|
IRCTXT_NOT_INVITED,
|
||||||
|
@ -54,6 +54,30 @@ static void event_cannot_join(const char *data, IRC_SERVER_REC *server)
|
|||||||
g_free(params);
|
g_free(params);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void event_duplicate_channel(const char *data, IRC_SERVER_REC *server)
|
||||||
|
{
|
||||||
|
CHANNEL_REC *chanrec;
|
||||||
|
char *params, *channel, *p;
|
||||||
|
|
||||||
|
g_return_if_fail(data != NULL);
|
||||||
|
|
||||||
|
/* this new addition to ircd breaks completely with older
|
||||||
|
"standards", "nick Duplicate ::!!channel ...." */
|
||||||
|
params = event_get_params(data, 3, NULL, NULL, &channel);
|
||||||
|
p = strchr(channel, ' ');
|
||||||
|
if (p != NULL) *p = '\0';
|
||||||
|
|
||||||
|
if (channel[0] == '!' && channel[1] == '!') {
|
||||||
|
chanrec = channel_find(SERVER(server), channel+1);
|
||||||
|
if (chanrec != NULL && !chanrec->names_got) {
|
||||||
|
chanrec->left = TRUE;
|
||||||
|
channel_destroy(chanrec);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
g_free(params);
|
||||||
|
}
|
||||||
|
|
||||||
static void event_target_unavailable(const char *data, IRC_SERVER_REC *server)
|
static void event_target_unavailable(const char *data, IRC_SERVER_REC *server)
|
||||||
{
|
{
|
||||||
char *params, *channel;
|
char *params, *channel;
|
||||||
@ -246,7 +270,7 @@ void channel_events_init(void)
|
|||||||
{
|
{
|
||||||
signal_add_first("event 403", (SIGNAL_FUNC) event_cannot_join); /* no such channel */
|
signal_add_first("event 403", (SIGNAL_FUNC) event_cannot_join); /* no such channel */
|
||||||
signal_add_first("event 405", (SIGNAL_FUNC) event_cannot_join); /* too many channels */
|
signal_add_first("event 405", (SIGNAL_FUNC) event_cannot_join); /* too many channels */
|
||||||
signal_add_first("event 407", (SIGNAL_FUNC) event_cannot_join); /* duplicate channel */
|
signal_add_first("event 407", (SIGNAL_FUNC) event_duplicate_channel); /* duplicate channel */
|
||||||
signal_add_first("event 471", (SIGNAL_FUNC) event_cannot_join); /* channel is full */
|
signal_add_first("event 471", (SIGNAL_FUNC) event_cannot_join); /* channel is full */
|
||||||
signal_add_first("event 473", (SIGNAL_FUNC) event_cannot_join); /* invite only */
|
signal_add_first("event 473", (SIGNAL_FUNC) event_cannot_join); /* invite only */
|
||||||
signal_add_first("event 474", (SIGNAL_FUNC) event_cannot_join); /* banned */
|
signal_add_first("event 474", (SIGNAL_FUNC) event_cannot_join); /* banned */
|
||||||
@ -266,7 +290,7 @@ void channel_events_deinit(void)
|
|||||||
{
|
{
|
||||||
signal_remove("event 403", (SIGNAL_FUNC) event_cannot_join); /* no such channel */
|
signal_remove("event 403", (SIGNAL_FUNC) event_cannot_join); /* no such channel */
|
||||||
signal_remove("event 405", (SIGNAL_FUNC) event_cannot_join); /* too many channels */
|
signal_remove("event 405", (SIGNAL_FUNC) event_cannot_join); /* too many channels */
|
||||||
signal_remove("event 407", (SIGNAL_FUNC) event_cannot_join); /* duplicate channel */
|
signal_remove("event 407", (SIGNAL_FUNC) event_duplicate_channel); /* duplicate channel */
|
||||||
signal_remove("event 471", (SIGNAL_FUNC) event_cannot_join); /* channel is full */
|
signal_remove("event 471", (SIGNAL_FUNC) event_cannot_join); /* channel is full */
|
||||||
signal_remove("event 473", (SIGNAL_FUNC) event_cannot_join); /* invite only */
|
signal_remove("event 473", (SIGNAL_FUNC) event_cannot_join); /* invite only */
|
||||||
signal_remove("event 474", (SIGNAL_FUNC) event_cannot_join); /* banned */
|
signal_remove("event 474", (SIGNAL_FUNC) event_cannot_join); /* banned */
|
||||||
|
Loading…
Reference in New Issue
Block a user