static int me_grant(struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) { struct Client *target_p; target_p = find_person(parv[1]); if (target_p == NULL) { sendto_one_numeric(source_p, ERR_NOSUCHNICK, form_str(ERR_NOSUCHNICK), "grant"); return 0; } if (!find_shared_conf(source_p->username, source_p->host, source_p->servptr->name, SHARED_GRANT)) { sendto_one(source_p, ":%s NOTICE %s :You don't have an appropriate shared" "block to grant privilege on this server.", me.name, source_p->name); return 0; } if (MyClient(target_p)) send_oper_motd(target_p); do_grant(source_p, target_p, parv[2], 0); return 0; }
static int me_locops(struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) { if(!IsClient(source_p)) return 0; if(find_shared_conf("*", "*", source_p->servptr->name, SHARED_LOCOPS)) sendto_wallops_flags(UMODE_LOCOPS, source_p, "SLOCOPS - %s", parv[1]); return 0; }
static void me_modrestart(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char **parv) { if(!find_shared_conf(source_p->username, source_p->host, source_p->servptr->name, SHARED_MODULE)) { sendto_one_notice(source_p, ":*** You do not have an appropriate shared block " "to load modules on this server."); return; } do_modrestart(source_p); }
static int ms_locops(struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) { /* source_p parv[1] parv[2] * oper target serv message */ propagate_generic(source_p, "LOCOPS", parv[1], CAP_CLUSTER, ":%s", parv[2]); if(!match(parv[1], me.name)) return 0; if(find_shared_conf("*", "*", source_p->servptr->name, SHARED_LOCOPS)) sendto_wallops_flags(UMODE_LOCOPS, source_p, "SLOCOPS - %s", parv[2]); return 0; }
static int me_grant(struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) { struct Client *target_p; int addflags = 0, removeflags = 0, dooper = 0, dodeoper = 0, add_snomask = 0, remove_snomask = 0; int i = 0; const char *p; target_p = find_person(parv[1]); if (target_p == NULL) { sendto_one_numeric(source_p, ERR_NOSUCHNICK, form_str(ERR_NOSUCHNICK), parv[1]); return 0; } if(!find_shared_conf(source_p->username, source_p->host, source_p->user->server, SHARED_GRANT)) return 0; p = parv[2]; for (i = 0; oper_flagtable[i].flag; ++i) { if (*p == oper_flagtable[i].has) addflags |= oper_flagtable[i].flag; else if (*p == oper_flagtable[i].hasnt) removeflags |= oper_flagtable[i].flag; else if (*p == '\0' || *p == '.') break; else continue; ++p; } dooper = atoi(parv[3]); dodeoper = atoi(parv[4]); add_snomask = parse_snobuf_to_mask(0, parv[5]); remove_snomask = ~parse_snobuf_to_mask(~0, parv[5]); do_grant(source_p, target_p, addflags, removeflags, dooper, dodeoper, add_snomask, remove_snomask); return 0; }