#include "module.h" #define AUTHOR "SGR" #define VERSION "1.10" /* ----------------------------------------------------------- * Name: he_operlist * Author: SGR * Date: 25/07/2003 * ----------------------------------------------------------- * Functions: list_global_opers * Limitations: None known * Tested: Ultimate(2.8.x), Unreal(3.2), Viagra, Bahamut * ----------------------------------------------------------- * This version has been tested on Ultimate2.8.6, viagra * Unreal and Bahamut. PTLINK has NOT been tested so is not * officially supported. * * Please set the config options below. * * For futher help consult the in-IRC help system accessed * by /msg HelpServ HELP OPERLIST after this module has been * loaded. * * ----------------------------------------------------------- * * ChangeLog: * * 1: Works * 2: Added 'EXEMPTION' System. * * ----------------------------------------------------------- */ /* ---------------------------------------------------------------------- */ /* START OF CONFIGURATION BLOCK - please read the comments :) */ /* ---------------------------------------------------------------------- */ /* The following 4 lines are MANDATORY. */ #define OPER_ONLY "Oper" #define OPER_AND_SO "Oper + Services Oper" #define OPER_AND_SA "Oper + Services Administrator" #define OPER_AND_SRA "Oper + Services Root Administrator" /* Set the below headers and footers to your networks preferance. */ #define OPER_LIST_HEADER1 "-----------------------------------------------------------------------" //#define OPER_LIST_HEADER2 " " //#define OPER_LIST_HEADER3 " " #define OPER_LIST_HEADER4 "The following global IRC Operators are online:" #define OPER_LIST_HEADER5 "-----------------------------------------------------------------------" // Oper List Appears Here. #define OPER_LIST_FOOTER1 "-----------------------------------------------------------------------" #define OPER_LIST_FOOTER2 " -> Please /whois an IRCop before trying to comminucate with them." #define OPER_LIST_FOOTER3 " -> Read (and respect) any away line information. " #define OPER_LIST_FOOTER4 " -> Do not join all channels an IRCop is in without valid cause. " #define OPER_LIST_FOOTER5 "-----------------------------------------------------------------------" // Up to 10 EXEPTION NICKS can be used. #define NUM_OF_EXEMPTION_NICKS 5 #define EXEMPTIONNICK1 "SomeServ" #define EXEMPTIONNICK2 "LoveServ" #define EXEMPTIONNICK3 "PornServ" #define EXEMPTIONNICK4 "MoraleServ" #define EXEMPTIONNICK5 "SecureServ" /* the following are unused, set NUM_OF_EXEMPTION_NICKS higer * if you decided to uncomment these and use more */ // #define EXEMPTIONNICK6 "PornServ" // #define EXEMPTIONNICK7 "PornServ" // #define EXEMPTIONNICK8 "PornServ" // #define EXEMPTIONNIC9 "PornServ" // #define EXEMPTIONNIC10 "PornServ" /* ---------------------------------------------------------------------- */ /* DO NOT EDIT BELOW THIS LINE UNLESS YOU KNOW WHAT YOU ARE DOING */ /* ---------------------------------------------------------------------- */ int list_global_opers(User * u); void populate_exemption_oper_list(void); //void SGR_Module_Help_HELPSERV_OPERLIST(User *u); //int SGR_Module_Help_HELPSERV_OPERLIST_FULL(User *u); char *exemption_oper_nicks[NUM_OF_EXEMPTION_NICKS]; int AnopeInit(int argc, char **argv) { Command *c; c = createCommand("OPERLIST", list_global_opers, NULL, -1,-1,-1,-1,-1); alog("Loading module he_operlist.so [Status: %d]",moduleAddCommand(HELPSERV, c, MOD_HEAD)); alog("[he_operlist] New command: /msg %s OPERLIST", s_HelpServ); alog("[he_operlist] For information see: /msg %s HELP OPERLIST", s_HelpServ); alog("[he_operlist] Yayness!(tm) - MODULE LOADED AND ACTIVE"); // moduleAddHelp(c,SGR_Module_Help_HELPSERV_OPERLIST_FULL); // moduleSetOperHelp(SGR_Module_Help_HELPSERV_OPERLIST); moduleAddAuthor(AUTHOR); moduleAddVersion(VERSION); populate_exemption_oper_list(); return MOD_CONT; } void AnopeFini(void) { alog("Unloading os_notidlist.so"); } int list_global_opers(User * u) { int j=0, i=0, carryon=0; User *next; User *u2; char *access; #ifdef OPER_LIST_HEADER1 notice(s_HelpServ, u->nick, OPER_LIST_HEADER1); #endif #ifdef OPER_LIST_HEADER2 notice(s_HelpServ, u->nick, OPER_LIST_HEADER2); #endif #ifdef OPER_LIST_HEADER3 notice(s_HelpServ, u->nick, OPER_LIST_HEADER3); #endif #ifdef OPER_LIST_HEADER4 notice(s_HelpServ, u->nick, OPER_LIST_HEADER4); #endif #ifdef OPER_LIST_HEADER5 notice(s_HelpServ, u->nick, OPER_LIST_HEADER5); #endif for (j = 0; j < 1024; j++) { for (u2 = userlist[j]; u2; u2 = next) { next = u2->next; carryon=0; if (finduser((u2->nick))) { #ifdef EXEMPTIONNICK1 i = 0; while (i != NUM_OF_EXEMPTION_NICKS) { i++; if (!exemption_oper_nicks[i] || !u2->nick) { break; } //alog("%s and %s", exemption_oper_nicks[i], u2->nick); if (!stricmp(u2->nick,exemption_oper_nicks[i])) { carryon = 1; } } #endif if (carryon) { continue; } if (is_oper(u2)) { access = OPER_ONLY; if (is_services_oper(u2)) { access = OPER_AND_SO; } if (is_services_admin(u2)) { access = OPER_AND_SA; } if (is_services_root(u2)) { access = OPER_AND_SRA; } //notice( s_HelpServ, u->nick, "%s!%s@%s", u2->nick, u2->username, u2->vhost); notice(s_HelpServ, u->nick, "%-15s %s", u2->nick, access); } } } } #ifdef OPER_LIST_FOOTER1 notice(s_HelpServ, u->nick, OPER_LIST_FOOTER1); #endif #ifdef OPER_LIST_FOOTER2 notice(s_HelpServ, u->nick, OPER_LIST_FOOTER2); #endif #ifdef OPER_LIST_FOOTER3 notice(s_HelpServ, u->nick, OPER_LIST_FOOTER3); #endif #ifdef OPER_LIST_FOOTER4 notice(s_HelpServ, u->nick, OPER_LIST_FOOTER4); #endif #ifdef OPER_LIST_FOOTER5 notice(s_HelpServ, u->nick, OPER_LIST_FOOTER5); #endif return MOD_CONT; } /*void SGR_Module_Help_HELPSERV_OPERLIST(User *u) { if (is_services_admin(u)) { notice(s_OperServ,u->nick, " OPERLIST See all online global opers"); } return; } int SGR_Module_Help_HELPSERV_OPERLIST_FULL(User *u) { if (is_services_admin(u)) { notice(s_OperServ, u->nick, "-----------------------------------------------------------------------"); notice(s_OperServ, u->nick, " Syntax: OPERLIST"); notice(s_OperServ, u->nick, " "); notice(s_OperServ, u->nick, " This command allows users to see a list of online IRC Operators. "); notice(s_OperServ, u->nick, " Please whois an IRCop before trying to comminucate with them and"); notice(s_OperServ, u->nick, " read (and respect) any away line information. "); notice(s_OperServ, u->nick, " clients are exempt from the scanning."); notice(s_OperServ, u->nick, " "); notice(s_OperServ, u->nick, "-----------------------------------------------------------------------"); return MOD_CONT; } return MOD_CONT; } */ void populate_exemption_oper_list(void) { int i=0; while (i != NUM_OF_EXEMPTION_NICKS) { i++; #ifdef EXEMPTIONNICK1 if (i == 1) { exemption_oper_nicks[i] = EXEMPTIONNICK1; continue; } #endif #ifdef EXEMPTIONNICK2 if (i == 2) { exemption_oper_nicks[i] = EXEMPTIONNICK2; continue; } #endif #ifdef EXEMPTIONNICK3 if (i == 3) { exemption_oper_nicks[i] = EXEMPTIONNICK3; continue; } #endif #ifdef EXEMPTIONNICK4 if (i == 4) { exemption_oper_nicks[i] = EXEMPTIONNICK4; continue; } #endif #ifdef EXEMPTIONNICK5 if (i == 5) { exemption_oper_nicks[i] = EXEMPTIONNICK5; continue; } #endif #ifdef EXEMPTIONNICK6 if (i == 6) { exemption_oper_nicks[i] = EXEMPTIONNICK6; continue; } #endif #ifdef EXEMPTIONNICK7 if (i == 7) { exemption_oper_nicks[i] = EXEMPTIONNICK7; continue; } #endif #ifdef EXEMPTIONNICK8 if (i == 8) { exemption_oper_nicks[i] = EXEMPTIONNICK8; continue; } #endif #ifdef EXEMPTIONMODES9 if (i == 9) { exemption_oper_nicks[i] = EXEMPTIONNICK9; continue; } #endif #ifdef EXEMPTIONMODES10 if (i == 10) { exemption_oper_nicks[i] = EXEMPTIONNICK10; continue; } #endif } }