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
|
|
|
|
2010-03-18 16:32:42 +00:00
|
|
|
static int mo_oaccept(struct Client *client_p, struct Client *source_p, int parc, const char *parv[]);
|
2010-03-04 06:40:13 +00:00
|
|
|
|
|
|
|
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
|
|
|
|
2010-03-18 16:32:42 +00:00
|
|
|
static int
|
2010-03-04 06:40:13 +00:00
|
|
|
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-05-27 22:03:51 +00:00
|
|
|
char text[10];
|
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]);
|
2010-03-18 16:32:42 +00:00
|
|
|
return 0;
|
2010-03-04 06:40:13 +00:00
|
|
|
}
|
|
|
|
|
2010-05-27 22:03:51 +00:00
|
|
|
rb_snprintf(text, sizeof(text), "O%s", source_p->id);
|
2010-03-07 00:22:59 +00:00
|
|
|
|
2010-05-27 22:03:51 +00:00
|
|
|
/* Provide a nice error message if you try to OACCEPT someone
|
|
|
|
* who you've already OACCEPTed. */
|
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);
|
2010-03-18 16:32:42 +00:00
|
|
|
return 0;
|
2010-03-05 19:26:40 +00:00
|
|
|
}
|
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);
|
2010-03-10 19:00:02 +00:00
|
|
|
sendto_server(NULL, NULL, NOCAPS, NOCAPS,
|
|
|
|
":%s WALLOPS :OACCEPT called for %s by %s!%s@%s",
|
|
|
|
me.name, target_p->name, source_p->name, source_p->username,
|
|
|
|
source_p->host);
|
2010-03-18 16:32:42 +00:00
|
|
|
return 0;
|
2010-03-04 06:40:13 +00:00
|
|
|
}
|