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);
#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 **);
{
int do_floodcount = 0;
struct Metadata *md;
+ struct DictionaryIter iter;
if(MyClient(source_p))
{
(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))
{
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))
{
- if(!strcmp(md->value, source_p->name))
+ DICTIONARY_FOREACH(md, &iter, target_p->user->metadata)
{
- add_reply_target(target_p, source_p);
- sendto_one(target_p, ":%s!%s@%s %s %s :%s",
- source_p->name,
- source_p->username,
- source_p->host, command, target_p->name, text);
+ if(!strcmp(md->value, source_p->name))
+ {
+ add_reply_target(target_p, source_p);
+ sendto_one(target_p, ":%s!%s@%s %s %s :%s",
+ 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])