Clean up +J to work nicely and properly.
This commit is contained in:
parent
6a97cac667
commit
d3b90aaad3
|
@ -68,7 +68,6 @@ m_kick(struct Client *client_p, struct Client *source_p, int parc, const char *p
|
|||
char *comment;
|
||||
const char *name;
|
||||
char *p = NULL;
|
||||
char *text = rb_strdup("");
|
||||
const char *user;
|
||||
static char buf[BUFSIZE];
|
||||
int is_override = 0;
|
||||
|
@ -230,11 +229,9 @@ m_kick(struct Client *client_p, struct Client *source_p, int parc, const char *p
|
|||
use_id(source_p), chptr->chname, use_id(who), comment);
|
||||
remove_user_from_channel(msptr);
|
||||
|
||||
rb_sprintf(text, "K%s",who->name);
|
||||
|
||||
/* we don't need to track NOREJOIN stuff unless it's our client being kicked */
|
||||
if(MyClient(source_p) && chptr->mode.mode & MODE_NOREJOIN)
|
||||
channel_metadata_time_add(chptr, text, rb_current_time());
|
||||
channel_metadata_time_add(chptr, "KICKNOREJOIN", rb_current_time(), who->id);
|
||||
}
|
||||
else if (MyClient(source_p))
|
||||
sendto_one_numeric(source_p, ERR_USERNOTINCHANNEL,
|
||||
|
|
|
@ -831,7 +831,6 @@ can_join(struct Client *source_p, struct Channel *chptr, char *key)
|
|||
hook_data_channel moduledata;
|
||||
struct Metadata *md;
|
||||
struct DictionaryIter iter;
|
||||
char *text = rb_strdup("");
|
||||
|
||||
s_assert(source_p->localClient != NULL);
|
||||
|
||||
|
@ -860,22 +859,13 @@ can_join(struct Client *source_p, struct Channel *chptr, char *key)
|
|||
if((is_banned(chptr, source_p, NULL, src_host, src_iphost)) == CHFL_BAN)
|
||||
return (ERR_BANNEDFROMCHAN);
|
||||
|
||||
rb_sprintf(text, "K%s",source_p->name);
|
||||
|
||||
if(md = channel_metadata_find(chptr, text))
|
||||
{
|
||||
if(md->timevalue + ConfigChannel.kick_no_rejoin_time > rb_current_time())
|
||||
{
|
||||
return ERR_KICKNOREJOIN;
|
||||
}
|
||||
/* cleanup the channel's kicknorejoin metadata. */
|
||||
DICTIONARY_FOREACH(md, &iter, chptr->metadata)
|
||||
{
|
||||
text = rb_strdup(md->name);
|
||||
if((text[0] == 'K') && (md->timevalue + ConfigChannel.kick_no_rejoin_time > rb_current_time()))
|
||||
channel_metadata_delete(chptr, md->name, 1);
|
||||
}
|
||||
|
||||
if(!strcmp(md->name, "KICKNOREJOIN") && !strcmp(md->value, source_p->id) && (md->timevalue + ConfigChannel.kick_no_rejoin_time > rb_current_time()))
|
||||
return ERR_KICKNOREJOIN;
|
||||
/* cleanup any stale KICKNOREJOIN metadata we find while we're at it */
|
||||
if(!strcmp(md->name, "KICKNOREJOIN") && !(md->timevalue + ConfigChannel.kick_no_rejoin_time > rb_current_time()))
|
||||
channel_metadata_delete(chptr, md->name, 0);
|
||||
}
|
||||
|
||||
if(chptr->mode.mode & MODE_INVITEONLY)
|
||||
|
|
13
src/chmode.c
13
src/chmode.c
|
@ -42,6 +42,7 @@
|
|||
#include "s_newconf.h"
|
||||
#include "logger.h"
|
||||
#include "chmode.h"
|
||||
#include "irc_dictionary.h";
|
||||
|
||||
/* bitmasks for error returns, so we send once per call */
|
||||
#define SM_ERR_NOTS 0x00000001 /* No TS on channel */
|
||||
|
@ -501,6 +502,8 @@ chm_simple(struct Client *source_p, struct Channel *chptr,
|
|||
{
|
||||
|
||||
int override = 0;
|
||||
struct Metadata *md;
|
||||
struct DictionaryIter iter;
|
||||
|
||||
if(alevel != CHFL_CHANOP && alevel != CHFL_OWNER && alevel != CHFL_HALFOP)
|
||||
{
|
||||
|
@ -540,6 +543,16 @@ chm_simple(struct Client *source_p, struct Channel *chptr,
|
|||
}
|
||||
else if((dir == MODE_DEL) && (chptr->mode.mode & mode_type))
|
||||
{
|
||||
/* cleanup KICKNOREJOIN metadata on -J */
|
||||
if(c == 'J')
|
||||
{
|
||||
DICTIONARY_FOREACH(md, &iter, chptr->metadata)
|
||||
{
|
||||
if(!strcmp(md->name, "KICKNOREJOIN"))
|
||||
channel_metadata_delete(chptr, md->name, 0);
|
||||
}
|
||||
}
|
||||
|
||||
chptr->mode.mode &= ~mode_type;
|
||||
|
||||
mode_changes[mode_count].letter = c;
|
||||
|
|
Loading…
Reference in New Issue