Make oaccept work for multiple opers on the same target.

This commit is contained in:
B.Greenham 2010-03-05 14:26:40 -05:00
parent a18f1b6ef8
commit 75a9b0c8b0
2 changed files with 21 additions and 12 deletions

View File

@ -28,9 +28,14 @@ mo_oaccept(struct Client *client_p, struct Client *source_p, int parc, const cha
return;
}
/* only allow one OACCEPT entry per user, so if there's an old one clear it */
if(!(md = user_metadata_find(target_p, "OACCEPT")))
user_metadata_delete(target_p, "OACCEPT", 1);
/* Don't allow someone to pointlessly fill up someone's metadata
* with identical OACCEPT entries. */
if((md = user_metadata_find(target_p, "OACCEPT")))
if(!strcmp(source_p->name, md->value))
{
sendto_one_notice(source_p, ":You're already on %s's OACCEPT list", target_p->name);
return;
}
user_metadata_add(target_p, "OACCEPT", source_p->name, 1);

View File

@ -45,6 +45,7 @@
#include "s_stats.h"
#include "tgchange.h"
#include "inline/stringops.h"
#include "irc_dictionary.h"
static int m_message(int, const char *, struct Client *, struct Client *, int, const char **);
static int m_privmsg(struct Client *, struct Client *, int, const char **);
@ -731,6 +732,7 @@ msg_client(int p_or_n, const char *command,
{
int do_floodcount = 0;
struct Metadata *md;
struct DictionaryIter iter;
if(MyClient(source_p))
{
@ -791,7 +793,6 @@ msg_client(int p_or_n, const char *command,
(IsSetSCallerId(target_p) && !has_common_channel(source_p, target_p)) ||
(IsSetRegOnlyMsg(target_p) && !source_p->user->suser[0])))
{
md = user_metadata_find(target_p, "OACCEPT");
/* Here is the anti-flood bot/spambot code -db */
if(accept_message(source_p, target_p))
{
@ -801,8 +802,9 @@ msg_client(int p_or_n, const char *command,
source_p->username,
source_p->host, command, target_p->name, text);
}
/* slightly ugly, meh. if anyone can think of a cleaner way to do this, by all means, do it. */
else if(md)
else if (IsOper(source_p))
{
DICTIONARY_FOREACH(md, &iter, target_p->user->metadata)
{
if(!strcmp(md->value, source_p->name))
{
@ -811,6 +813,8 @@ msg_client(int p_or_n, const char *command,
source_p->name,
source_p->username,
source_p->host, command, target_p->name, text);
break;
}
}
}
else if (IsSetRegOnlyMsg(target_p) && !source_p->user->suser[0])