Looks like irc_dictionary things cannot support more than one key with the same value. Therefore, a rework of +J and OACCEPT's metadata are required to make them work properly with multiple users.
This commit is contained in:
parent
2ec04d9c3b
commit
bc4764aefd
|
@ -21,7 +21,9 @@ void
|
||||||
mo_oaccept(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
|
mo_oaccept(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
|
||||||
{
|
{
|
||||||
struct Metadata *md;
|
struct Metadata *md;
|
||||||
|
struct DictionaryIter iter;
|
||||||
struct Client *target_p;
|
struct Client *target_p;
|
||||||
|
char *text = rb_strdup("");
|
||||||
|
|
||||||
if(!(target_p = find_client(parv[1])))
|
if(!(target_p = find_client(parv[1])))
|
||||||
{
|
{
|
||||||
|
@ -29,16 +31,20 @@ mo_oaccept(struct Client *client_p, struct Client *source_p, int parc, const cha
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rb_sprintf(text, "O%s", source_p->id);
|
||||||
|
|
||||||
/* Don't allow someone to pointlessly fill up someone's metadata
|
/* Don't allow someone to pointlessly fill up someone's metadata
|
||||||
* with identical OACCEPT entries. */
|
* with identical OACCEPT entries. */
|
||||||
if((md = user_metadata_find(target_p, "OACCEPT")))
|
DICTIONARY_FOREACH(md, &iter, target_p->user->metadata)
|
||||||
if(!strcmp(source_p->id, md->value))
|
{
|
||||||
|
if(!strcmp(md->value, "OACCEPT") && !strcmp(md->name, text))
|
||||||
{
|
{
|
||||||
sendto_one_notice(source_p, ":You're already on %s's OACCEPT list", target_p->name);
|
sendto_one_notice(source_p, ":You're already on %s's OACCEPT list", target_p->name);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
user_metadata_add(target_p, "OACCEPT", source_p->id, 1);
|
user_metadata_add(target_p, text, "OACCEPT", 1);
|
||||||
|
|
||||||
sendto_wallops_flags(UMODE_WALLOP, &me,
|
sendto_wallops_flags(UMODE_WALLOP, &me,
|
||||||
"OACCEPT called for %s by %s!%s@%s",
|
"OACCEPT called for %s by %s!%s@%s",
|
||||||
|
|
|
@ -68,6 +68,7 @@ mo_okick(struct Client *client_p, struct Client *source_p, int parc, const char
|
||||||
char *name;
|
char *name;
|
||||||
char *p = NULL;
|
char *p = NULL;
|
||||||
char *user;
|
char *user;
|
||||||
|
char *text = rb_strdup("");
|
||||||
static char buf[BUFSIZE];
|
static char buf[BUFSIZE];
|
||||||
|
|
||||||
if(*parv[2] == '\0')
|
if(*parv[2] == '\0')
|
||||||
|
@ -137,8 +138,10 @@ mo_okick(struct Client *client_p, struct Client *source_p, int parc, const char
|
||||||
":%s KICK %s %s :%s", me.id, chptr->chname, who->id, comment);
|
":%s KICK %s %s :%s", me.id, chptr->chname, who->id, comment);
|
||||||
remove_user_from_channel(msptr);
|
remove_user_from_channel(msptr);
|
||||||
|
|
||||||
|
rb_sprintf(text, "K%s", who->id);
|
||||||
|
|
||||||
/* we don't need to track NOREJOIN stuff unless it's our client being kicked */
|
/* we don't need to track NOREJOIN stuff unless it's our client being kicked */
|
||||||
if(MyClient(target_p) && chptr->mode.mode & MODE_NOREJOIN)
|
if(MyClient(who) && chptr->mode.mode & MODE_NOREJOIN)
|
||||||
channel_metadata_time_add(chptr, "KICKNOREJOIN", rb_current_time(), target_p->id);
|
channel_metadata_time_add(chptr, text, rb_current_time(), "KICKNOREJOIN");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,6 +68,7 @@ m_kick(struct Client *client_p, struct Client *source_p, int parc, const char *p
|
||||||
char *comment;
|
char *comment;
|
||||||
const char *name;
|
const char *name;
|
||||||
char *p = NULL;
|
char *p = NULL;
|
||||||
|
char *text = rb_strdup("");
|
||||||
const char *user;
|
const char *user;
|
||||||
static char buf[BUFSIZE];
|
static char buf[BUFSIZE];
|
||||||
int is_override = 0;
|
int is_override = 0;
|
||||||
|
@ -229,9 +230,11 @@ 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);
|
use_id(source_p), chptr->chname, use_id(who), comment);
|
||||||
remove_user_from_channel(msptr);
|
remove_user_from_channel(msptr);
|
||||||
|
|
||||||
|
rb_sprintf(text, "K%s", who->id);
|
||||||
|
|
||||||
/* we don't need to track NOREJOIN stuff unless it's our client being kicked */
|
/* we don't need to track NOREJOIN stuff unless it's our client being kicked */
|
||||||
if(MyClient(who) && chptr->mode.mode & MODE_NOREJOIN)
|
if(MyClient(who) && chptr->mode.mode & MODE_NOREJOIN)
|
||||||
channel_metadata_time_add(chptr, "KICKNOREJOIN", rb_current_time(), who->id);
|
channel_metadata_time_add(chptr, text, rb_current_time(), "KICKNOREJOIN");
|
||||||
}
|
}
|
||||||
else if (MyClient(source_p))
|
else if (MyClient(source_p))
|
||||||
sendto_one_numeric(source_p, ERR_USERNOTINCHANNEL,
|
sendto_one_numeric(source_p, ERR_USERNOTINCHANNEL,
|
||||||
|
|
|
@ -736,6 +736,7 @@ msg_client(int p_or_n, const char *command,
|
||||||
struct Metadata *md;
|
struct Metadata *md;
|
||||||
struct DictionaryIter iter;
|
struct DictionaryIter iter;
|
||||||
int oaccept = 0;
|
int oaccept = 0;
|
||||||
|
char *text3 = rb_strdup("");
|
||||||
|
|
||||||
if(MyClient(source_p))
|
if(MyClient(source_p))
|
||||||
{
|
{
|
||||||
|
@ -798,9 +799,10 @@ msg_client(int p_or_n, const char *command,
|
||||||
{
|
{
|
||||||
if (IsOper(source_p))
|
if (IsOper(source_p))
|
||||||
{
|
{
|
||||||
|
rb_sprintf(text3, "O%s", source_p->id);
|
||||||
DICTIONARY_FOREACH(md, &iter, target_p->user->metadata)
|
DICTIONARY_FOREACH(md, &iter, target_p->user->metadata)
|
||||||
{
|
{
|
||||||
if(!strcmp(md->value, source_p->id))
|
if(!strcmp(md->value, "OACCEPT") && !strcmp(md->name, text3))
|
||||||
{
|
{
|
||||||
oaccept = 1;
|
oaccept = 1;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -826,6 +826,7 @@ can_join(struct Client *source_p, struct Channel *chptr, char *key)
|
||||||
char src_host[NICKLEN + USERLEN + HOSTLEN + 6];
|
char src_host[NICKLEN + USERLEN + HOSTLEN + 6];
|
||||||
char src_iphost[NICKLEN + USERLEN + HOSTLEN + 6];
|
char src_iphost[NICKLEN + USERLEN + HOSTLEN + 6];
|
||||||
char src_althost[NICKLEN + USERLEN + HOSTLEN + 6];
|
char src_althost[NICKLEN + USERLEN + HOSTLEN + 6];
|
||||||
|
char *text = rb_strdup("");
|
||||||
int use_althost = 0;
|
int use_althost = 0;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
hook_data_channel moduledata;
|
hook_data_channel moduledata;
|
||||||
|
@ -864,12 +865,14 @@ can_join(struct Client *source_p, struct Channel *chptr, char *key)
|
||||||
if((is_banned(chptr, source_p, NULL, src_host, src_iphost)) == CHFL_BAN)
|
if((is_banned(chptr, source_p, NULL, src_host, src_iphost)) == CHFL_BAN)
|
||||||
return (ERR_BANNEDFROMCHAN);
|
return (ERR_BANNEDFROMCHAN);
|
||||||
|
|
||||||
|
rb_sprintf(text, "K%s", source_p->id);
|
||||||
|
|
||||||
DICTIONARY_FOREACH(md, &iter, chptr->metadata)
|
DICTIONARY_FOREACH(md, &iter, chptr->metadata)
|
||||||
{
|
{
|
||||||
if(!strcmp(md->name, "KICKNOREJOIN") && !strcmp(md->value, source_p->id) && (md->timevalue + ConfigChannel.kick_no_rejoin_time > rb_current_time()))
|
if(!strcmp(md->value, "KICKNOREJOIN") && !strcmp(md->name, text) && (md->timevalue + ConfigChannel.kick_no_rejoin_time > rb_current_time()))
|
||||||
return ERR_KICKNOREJOIN;
|
return ERR_KICKNOREJOIN;
|
||||||
/* cleanup any stale KICKNOREJOIN metadata we find while we're at it */
|
/* 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()))
|
if(!strcmp(md->value, "KICKNOREJOIN") && !(md->timevalue + ConfigChannel.kick_no_rejoin_time > rb_current_time()))
|
||||||
channel_metadata_delete(chptr, md->name, 0);
|
channel_metadata_delete(chptr, md->name, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -548,7 +548,7 @@ chm_simple(struct Client *source_p, struct Channel *chptr,
|
||||||
{
|
{
|
||||||
DICTIONARY_FOREACH(md, &iter, chptr->metadata)
|
DICTIONARY_FOREACH(md, &iter, chptr->metadata)
|
||||||
{
|
{
|
||||||
if(!strcmp(md->name, "KICKNOREJOIN"))
|
if(!strcmp(md->value, "KICKNOREJOIN"))
|
||||||
channel_metadata_delete(chptr, md->name, 0);
|
channel_metadata_delete(chptr, md->name, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue