]> jfr.im git - solanum.git/blobdiff - modules/m_grant.c
Use the m_grant from ircd-seven
[solanum.git] / modules / m_grant.c
index d65db2e17d9c228cf30bc0e87f374cef474f4d93..13dd70e2955a8d72507021f59541abeb0fba8b85 100644 (file)
@@ -16,8 +16,8 @@
 #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);
 
@@ -30,12 +30,14 @@ mapi_clist_av1 grant_clist[] = { &grant_msgtab, NULL };
 
 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;
@@ -63,7 +65,7 @@ mo_grant(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
        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;
 
@@ -96,7 +98,7 @@ static int do_grant(struct Client *source_p, struct Client *target_p, const char
 
        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;
@@ -115,16 +117,16 @@ static int do_grant(struct Client *source_p, struct Client *target_p, const char
                        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);
@@ -135,6 +137,11 @@ static int do_grant(struct Client *source_p, struct Client *target_p, const char
                        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)
@@ -157,7 +164,7 @@ static int do_grant(struct Client *source_p, struct Client *target_p, const char
                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] = "+";