#include "s_conf.h"
#include "s_newconf.h"
-static int mo_grant(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]);
-static int me_grant(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]);
+static int mo_grant(struct Client *client_p, struct Client *source_p, int parc, const char *parv[]);
+static int me_grant(struct Client *client_p, struct Client *source_p, int parc, const char *parv[]);
static int do_grant(struct Client *source_p, struct Client *target_p, const char *new_privset);
DECLARE_MODULE_AV1(grant, NULL, NULL, grant_clist, NULL, NULL, "$Revision$");
+extern struct mode_table oper_table[];
+
static int
-mo_grant(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
+mo_grant(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
struct Client *target_p;
- if(!HasPrivilege(source_p, "oper:grant"))
+ if(!IsOperGrant(source_p))
{
sendto_one(source_p, form_str(ERR_NOPRIVS), me.name, source_p->name, "grant");
return 0;
return 0;
}
-static int me_grant(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
+static int me_grant(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
struct Client *target_p;
if (!strcmp(new_privset, "deoper"))
{
- if (!IsOper(target_p))
+ if (!IsAnyOper(target_p))
{
sendto_one_notice(source_p, ":You can't deoper someone who isn't an oper.");
return 0;
return 0;
}
- if (privset == target_p->localClient->privset)
+ if (privset == target_p->user->privset)
{
- sendto_one_notice(source_p, ":%s already has privilege set %s.", target_p->name, target_p->localClient->privset->name);
+ sendto_one_notice(source_p, ":%s already has privilege set %s.", target_p->name, target_p->user->privset->name);
return 0;
}
}
if (!dodeoper)
{
- if (!IsOper(target_p))
+ if (!IsAnyOper(target_p))
{
sendto_one_notice(target_p, ":%s is opering you with privilege set %s", source_p->name, privset->name);
sendto_realops_snomask(SNO_GENERAL, L_NETWIDE, "%s is opering %s with privilege set %s", get_oper_name(source_p), target_p->name, privset->name);
sendto_one_notice(target_p, ":%s is changing your privilege set to %s", source_p->name, privset->name);
sendto_realops_snomask(SNO_GENERAL, L_NETWIDE, "%s is changing the privilege set of %s to %s", get_oper_name(source_p), target_p->name, privset->name);
}
+
+ if (!IsOper(target_p))
+ {
+ dooper = 1;
+ }
}
if (dodeoper)
oper_up(target_p, &oper);
}
- target_p->localClient->privset = privset;
+ target_p->user->privset = privset;
const char *modeparv[4];
modeparv[0] = modeparv[1] = target_p->name;
modeparv[2] = "+";