2010-03-04 06:40:13 +00:00
|
|
|
#include "stdinc.h"
|
|
|
|
#include "ircd.h"
|
|
|
|
#include "client.h"
|
|
|
|
#include "modules.h"
|
|
|
|
#include "send.h"
|
|
|
|
#include "numeric.h"
|
2010-03-06 01:49:30 +00:00
|
|
|
#include "hash.h"
|
2010-03-04 06:40:13 +00:00
|
|
|
|
|
|
|
void mo_oaccept(struct Client *client_p, struct Client *source_p, int parc, const char *parv[]);
|
|
|
|
|
|
|
|
struct Message oaccept_msgtab = {
|
|
|
|
"OACCEPT", 0, 0, 0, MFLG_SLOW,
|
|
|
|
{mg_unreg, mg_not_oper, mg_ignore, mg_ignore, mg_ignore, {mo_oaccept, 2}}
|
|
|
|
};
|
|
|
|
|
|
|
|
mapi_clist_av1 oaccept_clist[] = { &oaccept_msgtab, NULL };
|
|
|
|
|
2010-03-09 06:30:42 +00:00
|
|
|
DECLARE_MODULE_AV1(oaccept, NULL, NULL, oaccept_clist, NULL, NULL, "$Id $");
|
2010-03-04 06:40:13 +00:00
|
|
|
|
|
|
|
void
|
|
|
|
mo_oaccept(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
|
|
|
|
{
|
|
|
|
struct Metadata *md;
|
2010-03-07 00:22:59 +00:00
|
|
|
struct DictionaryIter iter;
|
2010-03-04 06:40:13 +00:00
|
|
|
struct Client *target_p;
|
2010-03-07 00:22:59 +00:00
|
|
|
char *text = rb_strdup("");
|
2010-03-04 06:40:13 +00:00
|
|
|
|
|
|
|
if(!(target_p = find_client(parv[1])))
|
|
|
|
{
|
|
|
|
sendto_one(source_p, form_str(ERR_NOSUCHNICK), parv[1]);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2010-03-07 00:22:59 +00:00
|
|
|
rb_sprintf(text, "O%s", source_p->id);
|
|
|
|
|
2010-03-05 19:26:40 +00:00
|
|
|
/* Don't allow someone to pointlessly fill up someone's metadata
|
|
|
|
* with identical OACCEPT entries. */
|
2010-03-07 00:22:59 +00:00
|
|
|
DICTIONARY_FOREACH(md, &iter, target_p->user->metadata)
|
|
|
|
{
|
|
|
|
if(!strcmp(md->value, "OACCEPT") && !strcmp(md->name, text))
|
2010-03-05 19:26:40 +00:00
|
|
|
{
|
|
|
|
sendto_one_notice(source_p, ":You're already on %s's OACCEPT list", target_p->name);
|
|
|
|
return;
|
|
|
|
}
|
2010-03-07 00:22:59 +00:00
|
|
|
}
|
2010-03-04 06:40:13 +00:00
|
|
|
|
2010-03-07 00:22:59 +00:00
|
|
|
user_metadata_add(target_p, text, "OACCEPT", 1);
|
2010-03-04 06:40:13 +00:00
|
|
|
|
|
|
|
sendto_wallops_flags(UMODE_WALLOP, &me,
|
|
|
|
"OACCEPT called for %s by %s!%s@%s",
|
|
|
|
target_p->name,
|
|
|
|
source_p->name, source_p->username, source_p->host);
|
|
|
|
}
|