diff options
44 files changed, 2568 insertions, 1099 deletions
diff --git a/data/example.conf b/data/example.conf index 0954b8d0d..0a018a393 100644 --- a/data/example.conf +++ b/data/example.conf @@ -596,8 +596,10 @@ options * * memoserv/sendall memoserv/staff * - * nickserv/getpass nickserv/sendpass nickserv/getemail nickserv/suspend - * nickserv/resetpass + * nickserv/getpass nickserv/sendpass nickserv/getemail nickserv/suspend + * nickserv/resetpass nickserv/saset/autoop nickserv/saset/email nickserv/saset/greet + * nickserv/saset/icq nickserv/saset/kill nickserv/saset/language nickserv/saset/message + * nickserv/saset/private nickserv/saset/secure nickserv/saset/url nickserv/saset/noexpire * * hostserv/set - Can add/modify/delete any vhost * @@ -648,7 +650,7 @@ opertype inherits = "Services Operator" - commands = "chanserv/access/list chanserv/drop chanserv/forbid chansev/getkey chanserv/getkey chanserv/set/noexpire memoserv/sendall nickserv/getemail operserv/global operserv/news operserv/jupe operserv/svsnick operserv/stats operserv/oline operserv/defcon operserv/noop operserv/umode" + commands = "chanserv/access/list chanserv/drop chanserv/forbid chansev/getkey chanserv/getkey chanserv/set/noexpire memoserv/sendall nickserv/saset/* nickserv/getemail operserv/global operserv/news operserv/jupe operserv/svsnick operserv/stats operserv/oline operserv/defcon operserv/noop operserv/umode" privs = "*" } @@ -782,7 +784,7 @@ nickserv * The core modules to load for NickServ. This is a space separated list that corresponds * to the base names of the modules for NickServ. This directive is optional, but highly recommended. */ - modules = "ns_help ns_register ns_group ns_identify ns_access ns_set ns_saset ns_drop ns_recover ns_release ns_sendpass ns_ghost ns_alist ns_info ns_list ns_logout ns_status ns_update ns_getpass ns_getemail ns_forbid ns_suspend ns_resetpass" + modules = "ns_help ns_register ns_group ns_identify ns_access ns_set ns_saset ns_set_autoop ns_set_email ns_set_greet ns_set_icq ns_set_kill ns_set_language ns_set_message ns_set_private ns_set_secure ns_set_url ns_saset_noexpire ns_drop ns_recover ns_release ns_sendpass ns_ghost ns_alist ns_info ns_list ns_logout ns_status ns_update ns_getpass ns_getemail ns_forbid ns_suspend ns_resetpass" /* * Force users to give an e-mail address when they register a nick. This directive diff --git a/include/commands.h b/include/commands.h index 9e597204e..327d65736 100644 --- a/include/commands.h +++ b/include/commands.h @@ -23,7 +23,7 @@ class Command; typedef std::map<ci::string, Command *> CommandMap; /** The return value from commands. - * */ + */ enum CommandReturn { MOD_CONT, @@ -32,7 +32,8 @@ enum CommandReturn extern CoreExport Command *FindCommand(BotInfo *bi, const ci::string &cmd); extern CoreExport void mod_help_cmd(BotInfo *bi, User *u, const ci::string &cmd); -extern CoreExport void mod_run_cmd(BotInfo *bi, User *u, const ci::string &cmd); +extern CoreExport void mod_run_cmd(BotInfo *bi, User *u, const std::string &message); +extern CoreExport void mod_run_cmd(BotInfo *bi, User *u, Command *c, const ci::string &command, const ci::string &message); enum CommandFlag { @@ -101,6 +102,16 @@ class CoreExport Command : public Flags<CommandFlag> * @param reststr The permission required to successfully execute this command */ void SetPermission(const std::string &reststr); + + /** Add a subcommand to this command + * @param c The command + */ + virtual bool AddSubcommand(Command *c); + + /** Delete a subcommand from this command + * @param cname The subcommand name + */ + virtual bool DelSubcommand(const ci::string &cname); }; #endif diff --git a/include/hashcomp.h b/include/hashcomp.h index a0d456b40..6d4530dc6 100644 --- a/include/hashcomp.h +++ b/include/hashcomp.h @@ -16,7 +16,8 @@ #include <string> #ifndef _WIN32 - #ifdef HASHMAP_DEPRECATED /* If gcc ver > 4.3 */ +// #ifdef HASHMAP_DEPRECATED /* If gcc ver > 4.3 */ + #if 1 /* GCC4.3+ has deprecated hash_map and uses tr1. But of course, uses a different include to MSVC. */ #include <tr1/unordered_map> #define unordered_map_namespace std::tr1 diff --git a/include/services.h b/include/services.h index 9a7356bd2..4994984e0 100644 --- a/include/services.h +++ b/include/services.h @@ -52,7 +52,7 @@ #include <sys/stat.h> /* for umask() on some systems */ #include <sys/types.h> - +#include <assert.h> #include <fcntl.h> #ifndef _WIN32 diff --git a/lang/cat.l b/lang/cat.l index 116d42037..bd2c34d8a 100644 --- a/lang/cat.l +++ b/lang/cat.l @@ -3617,28 +3617,42 @@ NICK_HELP_ACCESS ACCESS LIST Mostra la llista d'accés actual. -NICK_HELP_SET +NICK_HELP_SET_HEAD Sintaxis: SET Opció parametres Estableix varies opcions per a nicknames. Opció pot ser una de: +NICK_HELP_CMD_SET_DISPLAY DISPLAY Estableix el display del teu grup amb serveis +NICK_HELP_CMD_SET_PASSWORD PASSWORD Estableix la clau del teu nickname +NICK_HELP_CMD_SET_LANGUAGE LANGUAGE Estableix el llenguatge amb el que els serveis t'enviaran missatges +NICK_HELP_CMD_SET_URL URL Associa una URL amb el teu nickname +NICK_HELP_CMD_SET_EMAIL EMAIL Associa un E-mail amb el teu nickname +NICK_HELP_CMD_SET_ICQ ICQ Associa un numero ICQ amb el teu nickname +NICK_HELP_CMD_SET_GREET GREET Associa un salutació amb el teu nickname +NICK_HELP_CMD_SET_KILL KILL Activa o desactiva la protecció +NICK_HELP_CMD_SET_SECURE SECURE Activa o desactiva la seguretat de nickname +NICK_HELP_CMD_SET_PRIVATE PRIVATE Preveu el teu nickname d'apareixer en un %R%S LIST +NICK_HELP_CMD_SET_HIDE HIDE Oculta algunes parts de la teva informació +NICK_HELP_CMD_SET_MSG MSG canvia el metode de comunicació amb els serveis +NICK_HELP_CMD_SET_AUTOOP AUTOOP Should services op you automatically. +NICK_HELP_SET_TAIL Per utilitzar aquest comanda, has d'identificar-te primer utilitzant la teva clau (%R%S HELP IDENTIFY @@ -3757,26 +3771,40 @@ NICK_HELP_SET_AUTOOP Sets whether you will be opped automatically. Set to ON to allow ChanServ to op you automatically when entering channels. -NICK_HELP_SASET +NICK_HELP_SASET_HEAD Syntax: SASET nickname option parameters. Sets various nickname options. option can be one of: +NICK_HELP_CMD_SASET_DISPLAY DISPLAY Set the display of the group in Services +NICK_HELP_CMD_SASET_PASSWORD PASSWORD Set the nickname password +NICK_HELP_CMD_SASET_URL URL Associate a URL with the nickname +NICK_HELP_CMD_SASET_EMAIL EMAIL Associate an E-mail address with the nickname +NICK_HELP_CMD_SASET_ICQ ICQ Associate an ICQ number with the nickname +NICK_HELP_CMD_SASET_GREET GREET Associate a greet message with the nickname +NICK_HELP_CMD_SASET_KILL KILL Turn protection on or off +NICK_HELP_CMD_SASET_SECURE SECURE Turn nickname security on or off +NICK_HELP_CMD_SASET_PRIVATE PRIVATE Prevent the nickname from appearing in a %R%S LIST +NICK_HELP_CMD_SASET_HIDE HIDE Hide certain pieces of nickname information +NICK_HELP_CMD_SASET_MSG MSG Change the communication method of Services +NICK_HELP_CMD_SASET_NOEXPIRE NOEXPIRE Prevent the nickname from expiring +NICK_HELP_CMD_SASET_LANGUAGE LANGUAGE Set the language Services will use when sending messages to nickname +NICK_HELP_SASET_TAIL Type %R%S HELP SASET option for more information on a specific option. The options will be set on the given @@ -3594,34 +3594,48 @@ NICK_HELP_ACCESS ACCESS LIST Zeigt die aktuelle Zugriffsliste an. -NICK_HELP_SET +NICK_HELP_SET_HEAD Syntax: SET Option Parameter Stellt verschiedene Optionen zu deinem Nicknamen ein. Option kann eines der folgenden Werte sein: +NICK_HELP_CMD_SET_DISPLAY DISPLAY Ändert den "Ursprung" deiner Gruppe +NICK_HELP_CMD_SET_PASSWORD PASSWORD Setzt das Passwort deines Nicknamens neu +NICK_HELP_CMD_SET_LANGUAGE LANGUAGE Stellt die Sprache ein, in der dir die Services antworten sollen. +NICK_HELP_CMD_SET_URL URL Verbindet eine URL mit deinem Nicknamen +NICK_HELP_CMD_SET_ICQ ICQ Trägt deine ICQ-Nummer unter den Infos zu deinem Nicknamen ein. +NICK_HELP_CMD_SET_MSG MSG Ändert die Methode, wie die Services mit dir kommunizieren +NICK_HELP_CMD_SET_EMAIL EMAIL Verbindet eine öffentliche eMail-Adresse mit deinem Nicknamen +NICK_HELP_CMD_SET_GREET GREET Stellt eine Begrüssungsmeldung für deinen Nicknamen ein. +NICK_HELP_CMD_SET_KILL KILL Stellt Kill-Schutz an oder aus. +NICK_HELP_CMD_SET_SECURE SECURE Aktiviert/Deaktiviert den Sicherheitsmodus für deinen Nicknamen +NICK_HELP_CMD_SET_PRIVATE PRIVATE Verhindert das Erscheinen deines Nicknamens auf der Liste von %R%S LIST +NICK_HELP_CMD_SET_HIDE HIDE Versteckt bestimmte Informationen deines Nicknamens +NICK_HELP_CMD_SET_AUTOOP AUTOOP Sollten Dir die Services automatisch Op-Status geben. +NICK_HELP_SET_TAIL Wenn du eines dieser Optionen nutzen willst, musst du dich vorher identifizeren. @@ -3758,31 +3772,46 @@ NICK_HELP_SET_AUTOOP erlaubt es ChanServ Dir automatisch Op-Status zu geben, wenn Du die Channels betrittst. -NICK_HELP_SASET +NICK_HELP_SASET_HEAD Syntax: SASET nickname option parameters. Setzt verschiedene Einstellungen für den Nicknamen. Gültig für option ist: +NICK_HELP_CMD_SASET_DISPLAY DISPLAY Setzt einen Nicknamen als Ursprung der Nickgruppe +NICK_HELP_CMD_SASET_PASSWORD PASSWORD Setzt das Passwort eines Nicknamens +NICK_HELP_CMD_SASET_URL URL Fügt eine URL dem Nicknamen hinzu +NICK_HELP_CMD_SASET_EMAIL EMAIL Fügt eine Emailadresse dem Nicknamen hinzu +NICK_HELP_CMD_SASET_ICQ ICQ Fügt eine ICQ Nummer dem Nicknamen hinzu +NICK_HELP_CMD_SASET_GREET GREET Fügt eine Begrüssungsnachricht dem Nicknamen hinzu +NICK_HELP_CMD_SASET_KILL KILL Schützt den Nicknamen durch Identifikationszwang +NICK_HELP_CMD_SASET_SECURE SECURE Schaltet die Identifikationssicherheitsfunktion an oder aus +NICK_HELP_CMD_SASET_PRIVATE PRIVATE Verhindert, dass der Nickname im Befehl %R%S LIST auftaucht +NICK_HELP_CMD_SASET_HIDE HIDE Versteckt bestimmte, dem Nicknamen zugeordnete, Informationen +NICK_HELP_CMD_SASET_MSG MSG Bestimmt die Art wie die Services Nachrichten senden +NICK_HELP_CMD_SASET_NOEXPIRE NOEXPIRE Verhindert, dass der Nickname nach einer bestimmten Zeit verfällt +NICK_HELP_CMD_SASET_LANGUAGE LANGUAGE Stellt die Sprache ein, in der die Services dem Nicknamen antworten sollen. +NICK_HELP_CMD_SASET_AUTOOP AUTOOP Sollten die Services dem Nick automatisch seinen Op-Status geben. +NICK_HELP_SASET_TAIL Mit %R%S HELP SASET option können mehr Informationen zu den Einstellungen angefordert werden. Die Einstellungen betreffen den diff --git a/lang/en_us.l b/lang/en_us.l index 3a88e10e5..fca68c14b 100644 --- a/lang/en_us.l +++ b/lang/en_us.l @@ -3483,27 +3483,41 @@ NICK_HELP_ACCESS ACCESS LIST Displays the current access list. -NICK_HELP_SET +NICK_HELP_SET_HEAD Syntax: SET option parameters Sets various nickname options. option can be one of: - + +NICK_HELP_CMD_SET_DISPLAY DISPLAY Set the display of your group in Services +NICK_HELP_CMD_SET_PASSWORD PASSWORD Set your nickname password +NICK_HELP_CMD_SET_LANGUAGE LANGUAGE Set the language Services will use when sending messages to you +NICK_HELP_CMD_SET_URL URL Associate a URL with your nickname +NICK_HELP_CMD_SET_EMAIL EMAIL Associate an E-mail address with your nickname +NICK_HELP_CMD_SET_ICQ ICQ Associate an ICQ number with your nickname +NICK_HELP_CMD_SET_GREET GREET Associate a greet message with your nickname +NICK_HELP_CMD_SET_KILL KILL Turn protection on or off +NICK_HELP_CMD_SET_SECURE SECURE Turn nickname security on or off +NICK_HELP_CMD_SET_PRIVATE PRIVATE Prevent your nickname from appearing in a %R%S LIST +NICK_HELP_CMD_SET_HIDE HIDE Hide certain pieces of nickname information +NICK_HELP_CMD_SET_MSG MSG Change the communication method of Services +NICK_HELP_CMD_SET_AUTOOP AUTOOP Should services op you automatically. - + +NICK_HELP_SET_TAIL In order to use this command, you must first identify with your password (%R%S HELP IDENTIFY for more information). @@ -3621,27 +3635,42 @@ NICK_HELP_SET_AUTOOP Sets whether you will be opped automatically. Set to ON to allow ChanServ to op you automatically when entering channels. -NICK_HELP_SASET +NICK_HELP_SASET_HEAD Syntax: SASET nickname option parameters. Sets various nickname options. option can be one of: - + +NICK_HELP_CMD_SASET_DISPLAY DISPLAY Set the display of the group in Services +NICK_HELP_CMD_SASET_PASSWORD PASSWORD Set the nickname password +NICK_HELP_CMD_SASET_URL URL Associate a URL with the nickname +NICK_HELP_CMD_SASET_EMAIL EMAIL Associate an E-mail address with the nickname +NICK_HELP_CMD_SASET_ICQ ICQ Associate an ICQ number with the nickname +NICK_HELP_CMD_SASET_GREET GREET Associate a greet message with the nickname +NICK_HELP_CMD_SASET_KILL KILL Turn protection on or off +NICK_HELP_CMD_SASET_SECURE SECURE Turn nickname security on or off +NICK_HELP_CMD_SASET_PRIVATE PRIVATE Prevent the nickname from appearing in a %R%S LIST +NICK_HELP_CMD_SASET_HIDE HIDE Hide certain pieces of nickname information +NICK_HELP_CMD_SASET_MSG MSG Change the communication method of Services +NICK_HELP_CMD_SASET_NOEXPIRE NOEXPIRE Prevent the nickname from expiring +NICK_HELP_CMD_SASET_AUTOOP AUTOOP Turn autoop on or off +NICK_HELP_CMD_SASET_LANGUAGE LANGUAGE Set the language Services will use when sending messages to nickname +NICK_HELP_SASET_TAIL Type %R%S HELP SASET option for more information on a specific option. The options will be set on the given @@ -3589,29 +3589,43 @@ NICK_HELP_ACCESS ACCESS LIST Muestra la lista de acceso actual. -NICK_HELP_SET +NICK_HELP_SET_HEAD Sintaxis: SET opcion parametros Setea varias opciones para nicknames. opcion puede ser una de: +NICK_HELP_CMD_SET_DISPLAY DISPLAY Setea el display de tu grupo con Servicios +NICK_HELP_CMD_SET_PASSWORD PASSWORD Setea la clave de tu nickname +NICK_HELP_CMD_SET_LANGUAGE LANGUAGE Setea el lenguaje con el que Servicios te enviara mensajes +NICK_HELP_CMD_SET_URL URL Asocia una URL con tu nickname +NICK_HELP_CMD_SET_EMAIL EMAIL Asocia un E-mail con tu nickname +NICK_HELP_CMD_SET_ICQ ICQ Asocia un numero ICQ con tu nickname +NICK_HELP_CMD_SET_GREET GREET Asocia un saludo con tu nickname +NICK_HELP_CMD_SET_KILL KILL Enciende o apaga la proteccion +NICK_HELP_CMD_SET_SECURE SECURE Enciende o apaga la seguridad de nickname +NICK_HELP_CMD_SET_PRIVATE PRIVATE Previene tu nickname de aparecer en un %R%S LIST +NICK_HELP_CMD_SET_HIDE HIDE Esconde algunas partes de tu informacion +NICK_HELP_CMD_SET_MSG MSG Cambia el metodo de comunicacion con Servicios +NICK_HELP_CMD_SET_AUTOOP AUTOOP Should services op you automatically. - + +NICK_HELP_SET_TAIL Para usar este comando, debes primero identificarte con Servicios usando tu clave (%R%S HELP IDENTIFY para mayor informacion). @@ -3729,26 +3743,40 @@ NICK_HELP_SET_AUTOOP Sets whether you will be opped automatically. Set to ON to allow ChanServ to op you automatically when entering channels. -NICK_HELP_SASET +NICK_HELP_SASET_HEAD Syntax: SASET nickname option parameters. Sets various nickname options. option can be one of: - + +NICK_HELP_CMD_SASET_DISPLAY DISPLAY Set the display of the group in Services +NICK_HELP_CMD_SASET_PASSWORD PASSWORD Set the nickname password +NICK_HELP_CMD_SASET_URL URL Associate a URL with the nickname +NICK_HELP_CMD_SASET_EMAIL EMAIL Associate an E-mail address with the nickname +NICK_HELP_CMD_SASET_ICQ ICQ Associate an ICQ number with the nickname +NICK_HELP_CMD_SASET_GREET GREET Associate a greet message with the nickname +NICK_HELP_CMD_SASET_KILL KILL Turn protection on or off +NICK_HELP_CMD_SASET_SECURE SECURE Turn nickname security on or off +NICK_HELP_CMD_SASET_PRIVATE PRIVATE Prevent the nickname from appearing in a %R%S LIST +NICK_HELP_CMD_SASET_HIDE HIDE Hide certain pieces of nickname information +NICK_HELP_CMD_SASET_MSG MSG Change the communication method of Services +NICK_HELP_CMD_SASET_NOEXPIRE NOEXPIRE Prevent the nickname from expiring +NICK_HELP_CMD_SASET_LANGUAGE LANGUAGE Set the language Services will use when sending messages to nickname +NICK_HELP_SASET_TAIL Type %R%S HELP SASET option for more information on a specific option. The options will be set on the given @@ -3644,27 +3644,41 @@ NICK_HELP_ACCESS ACCESS LIST Affiche votre liste d'accès. -NICK_HELP_SET +NICK_HELP_SET_HEAD Syntaxe: SET option paramètres Configure diverses options du pseudo. option peut être: +NICK_HELP_CMD_SET_DISPLAY DISPLAY Change l'affichage de votre groupe dans les services +NICK_HELP_CMD_SET_PASSWORD PASSWORD Change le mot de passe de votre pseudo +NICK_HELP_CMD_SET_LANGUAGE LANGUAGE Change la langue dans laquelle les Services vous envoient leurs messages +NICK_HELP_CMD_SET_URL URL Associe une adresse de site à votre pseudo +NICK_HELP_CMD_SET_EMAIL EMAIL Associe une e-mail à votre pseudo +NICK_HELP_CMD_SET_ICQ ICQ Associe un numéro ICQ à votre pseudo +NICK_HELP_CMD_SET_GREET GREET Associe un message d'accueil à votre pseudo +NICK_HELP_CMD_SET_KILL KILL Active ou désactive la protection +NICK_HELP_CMD_SET_SECURE SECURE Active ou désactive la sécurité du pseudo +NICK_HELP_CMD_SET_PRIVATE PRIVATE Empêche votre pseudo d'être affiché par %R%S LIST +NICK_HELP_CMD_SET_HIDE HIDE Cache certaines parties des informations du pseudo +NICK_HELP_CMD_SET_MSG MSG Change le mode de communication des Services +NICK_HELP_CMD_SET_AUTOOP AUTOOP Demande à Services de vous rendre automatiquement OP. +NICK_HELP_SET_TAIL Pour utiliser cette commande, vous devez d'abord vous identifier avec votre mot de passe (%R%S HELP @@ -3783,26 +3797,40 @@ NICK_HELP_SET_AUTOOP Positionnez sur ON pour permettre à ChanServ de le faire quand vous entrez dans un canal. -NICK_HELP_SASET +NICK_HELP_SASET_HEAD Syntaxe: SASET pseudo option parametres. Configure plusieurs options sur un pseudo. option doit être l'une ci-dessous: - + +NICK_HELP_CMD_SASET_DISPLAY DISPLAY Affiche les pseudos du groupe du pseudo donné +NICK_HELP_CMD_SASET_PASSWORD PASSWORD Change le mot de passe du pseudo donné +NICK_HELP_CMD_SASET_URL URL Associe une url au pseudo donné +NICK_HELP_CMD_SASET_EMAIL EMAIL Associe une email au pseudo donné +NICK_HELP_CMD_SASET_ICQ ICQ Associe un compte ICQ au pseudo donné +NICK_HELP_CMD_SASET_GREET GREET Associe un message d'accueil au pseudo donné +NICK_HELP_CMD_SASET_KILL KILL Active ou désactive l'option kill du pseudo donné +NICK_HELP_CMD_SASET_SECURE SECURE Active ou désactive la securité du pseudo donné +NICK_HELP_CMD_SASET_PRIVATE PRIVATE Empêche le pseudo d'apparaître dans un %R%S LIST +NICK_HELP_CMD_SASET_HIDE HIDE Cache certaines informations personnelles du pseudo +NICK_HELP_CMD_SASET_MSG MSG Change le mode de communication des Services +NICK_HELP_CMD_SASET_NOEXPIRE NOEXPIRE Empêche le pseudo d'expirer +NICK_HELP_CMD_SASET_LANGUAGE LANGUAGE Défini la langue que Services utilisera dans les messages qu'il vous envoie. +NICK_HELP_SASET_TAIL Taper %R%S HELP SASET option pour plus d'informations sur une option spécifique. L'option devra être mise avec le pseudo @@ -3617,26 +3617,40 @@ NICK_HELP_ACCESS ACCESS LIST Åìöáíßæåé ôçí ôñÝ÷ïõóá ëßóôá ðñüóâáóçò. -NICK_HELP_SET +NICK_HELP_SET_HEAD Óýíôáîç: SET option parameters ÁëëÜæåé äéÜöïñåò åðéëïãÝò ôïõ øåõäùíýìïõ. Ç åðéëïãÞ ìðïñåß íá åßíáé: +NICK_HELP_CMD_SET_DISPLAY DISPLAY ÁëëÜæåé ôçí ëßóôá ôùí ïìÜäùí +NICK_HELP_CMD_SET_PASSWORD PASSWORD ÁëëÜæåé ôïí êùäéêü ôïõ øåõäùíýìïõ óáò +NICK_HELP_CMD_SET_LANGUAGE LANGUAGE ÁëëÜæåé ôç ãëþóóá ðïõ ÷ñçóéìïðïéïýí ïé õðçñåóßåò üôáí ôéò ÷ñçóéìïðïéåßôå +NICK_HELP_CMD_SET_URL URL Óõó÷åôßæåé Ýíá URL ìå ôï øåõäþíõìü óáò +NICK_HELP_CMD_SET_EMAIL EMAIL Óõó÷åôßæåé ìßá äéåýèõíóç e-mail ìå ôï øåõäþíõìü óáò +NICK_HELP_CMD_SET_ICQ ICQ Óõó÷åôßæåé Ýíá íïýìåñï ICQ ìå ôï øåõäþíõìü óáò +NICK_HELP_CMD_SET_GREET GREET Óõó÷åôßæåé Ýíá ìÞíõìá ÷áéñåôéóìïý ìå ôï øåõäþíõìü óáò +NICK_HELP_CMD_SET_KILL KILL Åíåñãïðïéåß/áðåíåñãïðïéåß ôçí ðñïóôáóßá ìå áðïóýíäåóç +NICK_HELP_CMD_SET_SECURE SECURE Åíåñãïðïéåß/áðåíåñãïðïéåß ôç ëåéôïõñãßá áóöÜëåéáò +NICK_HELP_CMD_SET_PRIVATE PRIVATE Åìðïäßæåé ôï øåõäþíõìü óáò íá åìöáíßæåôáé ìå ôçí åíôïëÞ %R%S LIST +NICK_HELP_CMD_SET_HIDE HIDE Áðïêñýðôåé óõãêåêñéìÝíá ôìÞìáôá ðëçñïöïñéþí ôïõ øåõäùíýìïõ +NICK_HELP_CMD_SET_MSG MSG ÁëëÜæåé ôçí ìÝèïäï åðéêïéíùíßáò ìå ôéò õðçñåóßåò +NICK_HELP_CMD_SET_AUTOOP AUTOOP Should services op you automatically. +NICK_HELP_SET_TAIL Ãéá íá ÷ñçóéìïðïéÞóåôå áõôÞ ôçí åíôïëÞ, ðñÝðåé ðñþôá íá áíáãíùñéóôåßôå ìå ôïí êùäéêü óáò (ãéá ðåñéóóüôåñåò ðëçñïöïñßåò, @@ -3760,26 +3774,40 @@ NICK_HELP_SET_AUTOOP Sets whether you will be opped automatically. Set to ON to allow ChanServ to op you automatically when entering channels. -NICK_HELP_SASET +NICK_HELP_SASET_HEAD Syntax: SASET nickname option parameters. Sets various nickname options. option can be one of: +NICK_HELP_CMD_SASET_DISPLAY DISPLAY Set the display of the group in Services +NICK_HELP_CMD_SASET_PASSWORD PASSWORD Set the nickname password +NICK_HELP_CMD_SASET_URL URL Associate a URL with the nickname +NICK_HELP_CMD_SASET_EMAIL EMAIL Associate an E-mail address with the nickname +NICK_HELP_CMD_SASET_ICQ ICQ Associate an ICQ number with the nickname +NICK_HELP_CMD_SASET_GREET GREET Associate a greet message with the nickname +NICK_HELP_CMD_SASET_KILL KILL Turn protection on or off +NICK_HELP_CMD_SASET_SECURE SECURE Turn nickname security on or off +NICK_HELP_CMD_SASET_PRIVATE PRIVATE Prevent the nickname from appearing in a %R%S LIST +NICK_HELP_CMD_SASET_HIDE HIDE Hide certain pieces of nickname information +NICK_HELP_CMD_SASET_MSG MSG Change the communication method of Services +NICK_HELP_CMD_SASET_NOEXPIRE NOEXPIRE Prevent the nickname from expiring +NICK_HELP_CMD_SASET_LANGUAGE LANGUAGE Set the language Services will use when sending messages to nickname +NICK_HELP_SASET_TAIL Type %R%S HELP SASET option for more information on a specific option. The options will be set on the given diff --git a/lang/hun.l b/lang/hun.l index 113b9b94b..3eb1d2785 100644 --- a/lang/hun.l +++ b/lang/hun.l @@ -3542,24 +3542,38 @@ NICK_HELP_ACCESS ACCESS LIST Megmutatja a hozzáférési listát. -NICK_HELP_SET +NICK_HELP_SET_HEAD Syntax: SET opció paraméterek Beállítható nicknév opciók. Az opció ezek egyike lehet: +NICK_HELP_CMD_SET_DISPLAY DISPLAY Set the display of your group in Services +NICK_HELP_CMD_SET_PASSWORD PASSWORD Set your nickname password +NICK_HELP_CMD_SET_LANGUAGE LANGUAGE A szervíz nyelvezetének megválasztása +NICK_HELP_CMD_SET_URL URL Egy URL társítása a nicknevedhez +NICK_HELP_CMD_SET_EMAIL EMAIL Egy E-mail cím társítása a nicknevedhez +NICK_HELP_CMD_SET_ICQ ICQ ICQ szám társítása a nicknevedhez +NICK_HELP_CMD_SET_GREET GREET Köszöntõ üzenet társítása a nicknevedhez +NICK_HELP_CMD_SET_KILL KILL A kill védelem be-,kikapcsolása +NICK_HELP_CMD_SET_SECURE SECURE A nickneved védelmének be-,kikapcsolása +NICK_HELP_CMD_SET_PRIVATE PRIVATE A nickneved %R%S LIST -ból való elrejtése +NICK_HELP_CMD_SET_HIDE HIDE A nicknévhez tartozó információk elrejtése +NICK_HELP_CMD_SET_MSG MSG Megváltoztatja a szervízzel való kommunikációt +NICK_HELP_CMD_SET_AUTOOP AUTOOP Should services op you automatically. +NICK_HELP_SET_TAIL Ezen parancs kiadása elõtt, azonositanod kell magad, mint a nick tulajdonosa az IDENTIFY parancsot használva, írd @@ -3678,26 +3692,40 @@ NICK_HELP_SET_AUTOOP Sets whether you will be opped automatically. Set to ON to allow ChanServ to op you automatically when entering channels. -NICK_HELP_SASET +NICK_HELP_SASET_HEAD Syntax: SASET nickname option parameters. Sets various nickname options. option can be one of: +NICK_HELP_CMD_SASET_DISPLAY DISPLAY Set the display of the group in Services +NICK_HELP_CMD_SASET_PASSWORD PASSWORD Set the nickname password +NICK_HELP_CMD_SASET_URL URL Associate a URL with the nickname +NICK_HELP_CMD_SASET_EMAIL EMAIL Associate an E-mail address with the nickname +NICK_HELP_CMD_SASET_ICQ ICQ Associate an ICQ number with the nickname +NICK_HELP_CMD_SASET_GREET GREET Associate a greet message with the nickname +NICK_HELP_CMD_SASET_KILL KILL Turn protection on or off +NICK_HELP_CMD_SASET_SECURE SECURE Turn nickname security on or off +NICK_HELP_CMD_SASET_PRIVATE PRIVATE Prevent the nickname from appearing in a %R%S LIST +NICK_HELP_CMD_SASET_HIDE HIDE Hide certain pieces of nickname information +NICK_HELP_CMD_SASET_MSG MSG Change the communication method of Services +NICK_HELP_CMD_SASET_NOEXPIRE NOEXPIRE Prevent the nickname from expiring +NICK_HELP_CMD_SASET_LANGUAGE LANGUAGE Set the language Services will use when sending messages to nickname +NICK_HELP_SASET_TAIL Type %R%S HELP SASET option for more information on a specific option. The options will be set on the given @@ -3498,25 +3498,39 @@ NICK_HELP_ACCESS ACCESS LIST Visualizza la lista di accesso attuale. -NICK_HELP_SET +NICK_HELP_SET_HEAD Sintassi: SET opzione parametri Imposta varie opzioni del nick. opzione può essere una delle seguenti: +NICK_HELP_CMD_SET_DISPLAY DISPLAY Imposta il nome del tuo gruppo +NICK_HELP_CMD_SET_EMAIL EMAIL Associa un indirizzo e-mail al tuo nick +NICK_HELP_CMD_SET_GREET GREET Associa un messaggio di saluto al tuo nick +NICK_HELP_CMD_SET_HIDE HIDE Nasconde alcune informazioni sul tuo nick +NICK_HELP_CMD_SET_ICQ ICQ Associa un numero ICQ al tuo nick +NICK_HELP_CMD_SET_KILL KILL Attiva o disattiva la protezione +NICK_HELP_CMD_SET_LANGUAGE LANGUAGE Imposta la lingua utilizzata dai Services +NICK_HELP_CMD_SET_MSG MSG Cambia il metodo di comunicazione usato dai Services +NICK_HELP_CMD_SET_PASSWORD PASSWORD Imposta la password del tuo nick +NICK_HELP_CMD_SET_PRIVATE PRIVATE Nasconde il nick dalla lista (%R%S LIST) +NICK_HELP_CMD_SET_SECURE SECURE Attiva o disattiva la sicurezza +NICK_HELP_CMD_SET_URL URL Associa un URL al tuo nick +NICK_HELP_CMD_SET_AUTOOP AUTOOP Should services op you automatically. +NICK_HELP_SET_TAIL Per usare questo comando, devi prima identificarti con la tua password (digita %R%S HELP IDENTIFY per @@ -3633,26 +3647,40 @@ NICK_HELP_SET_AUTOOP Sets whether you will be opped automatically. Set to ON to allow ChanServ to op you automatically when entering channels. -NICK_HELP_SASET +NICK_HELP_SASET_HEAD Sintassi: SASET nickname opzione parametri. Imposta varie opzioni del nick. opzione può essere una delle seguenti: - + +NICK_HELP_CMD_SASET_DISPLAY DISPLAY Imposta il nome del gruppo +NICK_HELP_CMD_SASET_PASSWORD PASSWORD Imposta la password del nick +NICK_HELP_CMD_SASET_URL URL Associa un URL al nickname +NICK_HELP_CMD_SASET_EMAIL EMAIL Associa un indirizzo e-mail al nickname +NICK_HELP_CMD_SASET_ICQ ICQ Associa un numero ICQ al nickname +NICK_HELP_CMD_SASET_GREET GREET Associa un messaggio di saluto al nickname +NICK_HELP_CMD_SASET_KILL KILL Attiva o disattiva la protezione +NICK_HELP_CMD_SASET_SECURE SECURE Attiva o disattiva la sicurezza +NICK_HELP_CMD_SASET_PRIVATE PRIVATE Nasconde il nick dalla lista (%R%S LIST) +NICK_HELP_CMD_SASET_HIDE HIDE Nsconde alcune informazioni sul nick +NICK_HELP_CMD_SASET_MSG MSG Cambia il metodo di comunicazione usato dai servizi +NICK_HELP_CMD_SASET_NOEXPIRE NOEXPIRE Evita che il nickname scada +NICK_HELP_CMD_SASET_LANGUAGE LANGUAGE Set the language Services will use when sending messages to nickname +NICK_HELP_SASET_TAIL Digita %R%S HELP SASET opzione per maggiori informazioni su un'opzione specifica. Le opzioni verranno impostate sul @@ -3569,26 +3569,40 @@ NICK_HELP_ACCESS ACCESS LIST Geeft de huidige toegangslijst weer. -NICK_HELP_SET +NICK_HELP_SET_HEAD Gebruik: SET optie parameters Stelt verscheidene nick opties in. option kan zijn: +NICK_HELP_CMD_SET_DISPLAY DISPLAY Stel de weergave van je groep in Services in +NICK_HELP_CMD_SET_PASSWORD PASSWORD Verander het wachtwoord voor je nick +NICK_HELP_CMD_SET_LANGUAGE LANGUAGE Selecteer de taal die Services zal gebruiken voor het versturen van berichten naar jou +NICK_HELP_CMD_SET_URL URL Associeer een URL met je nick +NICK_HELP_CMD_SET_EMAIL EMAIL Associeer een E-mail adres met je nick +NICK_HELP_CMD_SET_ICQ ICQ Associeer een ICQ nummer met je nick +NICK_HELP_CMD_SET_GREET GREET Associeer een begroeting met je nick +NICK_HELP_CMD_SET_KILL KILL Zet bescherming aan of uit +NICK_HELP_CMD_SET_SECURE SECURE Zet nickname beveiliging aan of uit +NICK_HELP_CMD_SET_PRIVATE PRIVATE Zorgt ervoor dat je nick niet verschijnt in een %R%S LIST +NICK_HELP_CMD_SET_HIDE HIDE Verberg verschillende soorten nick informatie +NICK_HELP_CMD_SET_MSG MSG Verander de communicatiemanier van Services +NICK_HELP_CMD_SET_AUTOOP AUTOOP Should services op you automatically. +NICK_HELP_SET_TAIL Om dit commando te gebruiken moet je je eerst identificeren met je wachtwoord (%R%S HELP IDENTIFY voor meer @@ -3705,26 +3719,40 @@ NICK_HELP_SET_AUTOOP Sets whether you will be opped automatically. Set to ON to allow ChanServ to op you automatically when entering channels. -NICK_HELP_SASET +NICK_HELP_SASET_HEAD Syntax: SASET nickname option parameters. Sets various nickname options. option can be one of: - + +NICK_HELP_CMD_SASET_DISPLAY DISPLAY Set the display of the group in Services +NICK_HELP_CMD_SASET_PASSWORD PASSWORD Set the nickname password +NICK_HELP_CMD_SASET_URL URL Associate a URL with the nickname +NICK_HELP_CMD_SASET_EMAIL EMAIL Associate an E-mail address with the nickname +NICK_HELP_CMD_SASET_ICQ ICQ Associate an ICQ number with the nickname +NICK_HELP_CMD_SASET_GREET GREET Associate a greet message with the nickname +NICK_HELP_CMD_SASET_KILL KILL Turn protection on or off +NICK_HELP_CMD_SASET_SECURE SECURE Turn nickname security on or off +NICK_HELP_CMD_SASET_PRIVATE PRIVATE Prevent the nickname from appearing in a %R%S LIST +NICK_HELP_CMD_SASET_HIDE HIDE Hide certain pieces of nickname information +NICK_HELP_CMD_SASET_MSG MSG Change the communication method of Services +NICK_HELP_CMD_SASET_NOEXPIRE NOEXPIRE Prevent the nickname from expiring +NICK_HELP_CMD_SASET_LANGUAGE LANGUAGE Set the language Services will use when sending messages to nickname +NICK_HELP_SASET_TAIL Type %R%S HELP SASET option for more information on a specific option. The options will be set on the given @@ -4551,26 +4551,40 @@ NICK_HELP_ACCESS ACCESS LIST Wy¶wietla aktualn± listê dostêpu. -NICK_HELP_SET +NICK_HELP_SET_HEAD Sk³adnia: SET opcja parametry Ustawia ró¿ne opcje nicka. Dostêpne opcje to: +NICK_HELP_CMD_SET_DISPLAY DISPLAY Ustawia nick reprezentuj±cy grupê nicków +NICK_HELP_CMD_SET_PASSWORD PASSWORD Ustawia has³o do nicka +NICK_HELP_CMD_SET_LANGUAGE LANGUAGE Ustawia jêzyk w którym serwisy bêd± wysy³a³y komunikaty +NICK_HELP_CMD_SET_URL URL Przypisuje adres www do nicka +NICK_HELP_CMD_SET_EMAIL EMAIL Przypisuje adres e-mail do nicka +NICK_HELP_CMD_SET_ICQ ICQ Przypisuje numer ICQ do nicka +NICK_HELP_CMD_SET_GREET GREET Przypisuje komunikat powitalny do nicka +NICK_HELP_CMD_SET_KILL KILL W³±cza lub wy³±cza ochronê nicka +NICK_HELP_CMD_SET_SECURE SECURE W³±cza lub wy³±cza bezpieczeñstwo nicka +NICK_HELP_CMD_SET_PRIVATE PRIVATE Zapobiega wy¶wietlaniu nicka po wydaniu polecenia: %R%S LIST +NICK_HELP_CMD_SET_HIDE HIDE Ukrywa poszczególne informacje o nicku +NICK_HELP_CMD_SET_MSG MSG Zmienia sposób komunikacji serwisów +NICK_HELP_CMD_SET_AUTOOP AUTOOP W³±cza lub wy³±cza automatyczne opowanie +NICK_HELP_SET_TAIL Aby u¿yæ tej komendy musisz siê zidentyfikowaæ z u¿yciem Twojego has³a. Aby uzyskaæ wiêcej informacji wpisz: @@ -4691,28 +4705,43 @@ NICK_HELP_SET_AUTOOP W³±cza lub wy³±cza automatyczne nadawanie uprawnieñ przy wchodzeniu na kana³. -NICK_HELP_SASET +NICK_HELP_SASET_HEAD Sk³adnia: SASET nick opcja parametry. Ustawia ró¿ne opcje nicka wskazanemu u¿ytkownikowi. Dostêpne opcje to: +NICK_HELP_CMD_SASET_DISPLAY DISPLAY Ustawia nick reprezentuj±cy grupê nicków +NICK_HELP_CMD_SASET_PASSWORD PASSWORD Ustawia has³o do nicka +NICK_HELP_CMD_SASET_LANGUAGE LANGUAGE Ustawia jêzyk w którym serwisy bêd± wysy³a³y komunikaty +NICK_HELP_CMD_SASET_URL URL Przypisuje adres www do nicka +NICK_HELP_CMD_SASET_EMAIL EMAIL Przypisuje adres e-mail do nicka +NICK_HELP_CMD_SASET_ICQ ICQ Przypisuje numer ICQ do nicka +NICK_HELP_CMD_SASET_GREET GREET Przypisuje komunikat powitalny do nicka +NICK_HELP_CMD_SASET_KILL KILL W³±cza lub wy³±cza ochronê nicka +NICK_HELP_CMD_SASET_SECURE SECURE W³±cza lub wy³±cza bezpieczeñstwo nicka +NICK_HELP_CMD_SASET_PRIVATE PRIVATE Zapobiega wy¶wietlaniu nicka po wydaniu polecenia: %R%S LIST +NICK_HELP_CMD_SASET_HIDE HIDE Ukrywa poszczególne informacje o nicku +NICK_HELP_CMD_SASET_MSG MSG Zmienia sposób komunikacji serwisów +NICK_HELP_CMD_SASET_AUTOOP AUTOOP W³±cza lub wy³±cza automatyczne opowanie +NICK_HELP_CMD_SASET_NOEXPIRE NOEXPIRE Zapobiega wyga¶niêciu nicka +NICK_HELP_SASET_TAIL Aby uzyskaæ wiêcej informacji o danej opcji wpisz: %R%S HELP SASET opcja @@ -3516,25 +3516,39 @@ NICK_HELP_ACCESS ACCESS LIST Mostra a lista de acesso atual. -NICK_HELP_SET +NICK_HELP_SET_HEAD Sintaxe: SET opção parâmetros Ajusta várias opções de nick. A opção pode ser: +NICK_HELP_CMD_SET_DISPLAY DISPLAY Mostra o seu grupo nos Services +NICK_HELP_CMD_SET_PASSWORD PASSWORD Ajusta a senha do seu nick +NICK_HELP_CMD_SET_LANGUAGE LANGUAGE Ajusta a linguagem dos Services quando mensagens são enviadas à você +NICK_HELP_CMD_SET_URL URL Associa um endereço URL com seu nick +NICK_HELP_CMD_SET_EMAIL EMAIL Associa um endereço de e-mail ao seu nick +NICK_HELP_CMD_SET_ICQ ICQ Associa um número de ICQ ao seu nick +NICK_HELP_CMD_SET_GREET GREET Associa uma mensgem de entrada ao seu nick +NICK_HELP_CMD_SET_KILL KILL Ativa/Desativa a proteção de kill para o seu nick +NICK_HELP_CMD_SET_SECURE SECURE Ativa/Desativa os recursos de segurança para o seu nick +NICK_HELP_CMD_SET_PRIVATE PRIVATE Previne seu nick de aparecer em um %R%S LIST +NICK_HELP_CMD_SET_HIDE HIDE Esconde certas informações sobre seu nick +NICK_HELP_CMD_SET_MSG MSG Altera o método de comunicação dos Services +NICK_HELP_CMD_SET_AUTOOP AUTOOP Should services op you automatically. +NICK_HELP_SET_TAIL Para usar este comando, você deve primeiro se identificar com sua senha (%R%S HELP IDENTIFY para maiores @@ -3657,26 +3671,40 @@ NICK_HELP_SET_AUTOOP Sets whether you will be opped automatically. Set to ON to allow ChanServ to op you automatically when entering channels. -NICK_HELP_SASET +NICK_HELP_SASET_HEAD Syntax: SASET nickname option parameters. Sets various nickname options. option can be one of: +NICK_HELP_CMD_SASET_DISPLAY DISPLAY Set the display of the group in Services +NICK_HELP_CMD_SASET_PASSWORD PASSWORD Set the nickname password +NICK_HELP_CMD_SASET_URL URL Associate a URL with the nickname +NICK_HELP_CMD_SASET_EMAIL EMAIL Associate an E-mail address with the nickname +NICK_HELP_CMD_SASET_ICQ ICQ Associate an ICQ number with the nickname +NICK_HELP_CMD_SASET_GREET GREET Associate a greet message with the nickname +NICK_HELP_CMD_SASET_KILL KILL Turn protection on or off +NICK_HELP_CMD_SASET_SECURE SECURE Turn nickname security on or off +NICK_HELP_CMD_SASET_PRIVATE PRIVATE Prevent the nickname from appearing in a %R%S LIST +NICK_HELP_CMD_SASET_HIDE HIDE Hide certain pieces of nickname information +NICK_HELP_CMD_SASET_MSG MSG Change the communication method of Services +NICK_HELP_CMD_SASET_NOEXPIRE NOEXPIRE Prevent the nickname from expiring +NICK_HELP_CMD_SASET_LANGUAGE LANGUAGE Set the language Services will use when sending messages to nickname +NICK_HELP_SASET_TAIL Type %R%S HELP SASET option for more information on a specific option. The options will be set on the given @@ -3511,26 +3511,40 @@ NICK_HELP_ACCESS ACCESS LIST âûâîäèò òåêóùèé ñïèñîê "äîâåðåííûõ" õîñòìàñîê. -NICK_HELP_SET +NICK_HELP_SET_HEAD Ñèíòàêñèñ: SET îïöèÿ ïàðàìåòðû Êîìàíäà SET ïîçâîëÿåò âàì íàñòðîèòü ðàçëè÷íûå îïöèè íèêà. Ñïèñîê îïöèé: +NICK_HELP_CMD_SET_DISPLAY DISPLAY óñòàíîâêà ãëàâíîãî íèêà ãðóïïû +NICK_HELP_CMD_SET_PASSWORD PASSWORD èçìåíåíèå òåêóùåãî ïàðîëÿ íà íèê +NICK_HELP_CMD_SET_LANGUAGE LANGUAGE âûáîð ÿçûêà, ïîñðåäñòâîì êîòîðîãî ñåðâèñû áóäóò ñ âàìè îáùàòüñÿ +NICK_HELP_CMD_SET_URL URL óñòàíîâêà URL-àäðåñà íà íèê +NICK_HELP_CMD_SET_EMAIL EMAIL óñòàíîâêà email-àäðåñà íà íèê +NICK_HELP_CMD_SET_ICQ ICQ óñòàíîâêà ICQ-íîìåðà íà íèê +NICK_HELP_CMD_SET_GREET GREET óñòàíîâêà ïðèâåòñòâåííîãî ñîîáùåíèÿ +NICK_HELP_CMD_SET_KILL KILL àêòèâèðîâàíèå/äåàêòèâèðîâàíèå ðåæèìà çàùèòû +NICK_HELP_CMD_SET_SECURE SECURE àêòèâèðîâàíèå/äåàêòèâèðîâàíèå ðåæèìà áåçîïàñíîñòè +NICK_HELP_CMD_SET_PRIVATE PRIVATE ñêðûòèå âàøåãî íèêà â ñïèñêå íèêîâ ïî %R%S LIST +NICK_HELP_CMD_SET_HIDE HIDE ñêðûòèå ðàçëè÷íîé èíôîðìàöèè î âàøåì íèêå +NICK_HELP_CMD_SET_MSG MSG âûáîð ìåòîäà îáùåíèÿ ñåðâèñîâ ñ âàìè +NICK_HELP_CMD_SET_AUTOOP AUTOOP àêòèâèðîâàíèå/äåàêòèâèðîâàíèå àâòîñòàòóñà +NICK_HELP_SET_TAIL ×òîáû ïîëó÷èòü ñïðàâî÷íóþ èíôîðìàöèþ ïî îòäåëüíî âçÿòîé îïöèè âîñïîëüçóéòåñü êîìàíäîé %R%S HELP SET îïöèÿ @@ -3665,27 +3679,42 @@ NICK_HELP_SET_AUTOOP Óêàæèòå ON, åñëè õîòèòå ÷òî áû ñåðâèñû àâòîìàòè÷åñêè äàâàëè âàì ñòàòóñ ïðè âõîäå íà êàíàë. Ñîîòâåòñòâåííî OFF - äëÿ îòêëþ÷åíèÿ. -NICK_HELP_SASET +NICK_HELP_SASET_HEAD Ñèíòàêñèñ: SASET íèê îïöèÿ ïàðàìåòðû. Ïîçâîëÿåò Àäìèíèñòðàòîðàì ñåðâèñîâ íàñòðàèâàòü êàêèå-ëèáî îïöèè äëÿ óêàçàííîãî íèêà áåç èäåíòèôèêàöèè ê íåìó. Ñïèñîê îïöèè: +NICK_HELP_CMD_SASET_DISPLAY DISPLAY óñòàíîâêà ãëàâíîãî íèêà ãðóïïû +NICK_HELP_CMD_SASET_PASSWORD PASSWORD èçìåíåíèå òåêóùåãî ïàðîëÿ íà íèê +NICK_HELP_CMD_SASET_URL URL óñòàíîâêà URL-àäðåñà íà íèê +NICK_HELP_CMD_SASET_EMAIL EMAIL óñòàíîâêà email-àäðåñà íà íèê +NICK_HELP_CMD_SASET_ICQ ICQ óñòàíîâêà ICQ-íîìåðà íà íèê +NICK_HELP_CMD_SASET_GREET GREET óñòàíîâêà ïðèâåòñòâåííîãî ñîîáùåíèÿ +NICK_HELP_CMD_SASET_KILL KILL àêòèâèðîâàíèå/äåàêòèâèðîâàíèå ðåæèìà çàùèòû +NICK_HELP_CMD_SASET_SECURE SECURE àêòèâèðîâàíèå/äåàêòèâèðîâàíèå ðåæèìà áåçîïàñíîñòè +NICK_HELP_CMD_SASET_PRIVATE PRIVATE ñêðûòèå íèêà â ñïèñêå íèêîâ ïî %R%S LIST +NICK_HELP_CMD_SASET_HIDE HIDE ñêðûòèå ðàçëè÷íîé èíôîðìàöèè î íèêå +NICK_HELP_CMD_SASET_MSG MSG âûáîð ìåòîäà îáùåíèÿ ñåðâèñîâ ñ íèêîì +NICK_HELP_CMD_SASET_NOEXPIRE NOEXPIRE óñòàíîâêà íà íèê ò.í. ðåæèìà 'íå-èñòå÷åíèÿ' +NICK_HELP_CMD_SASET_AUTOOP AUTOOP àêòèâèðîâàíèå/äåàêòèâèðîâàíèå ðåæèìà àâòîñòàòóñà +NICK_HELP_CMD_SASET_LANGUAGE LANGUAGE âûáîð ÿçûêà, ïîñðåäñòâîì êîòîðîãî ñåðâèñû áóäóò ñ óêàçàííûì íèêîì. +NICK_HELP_SASET_TAIL ×òîáû ïîëó÷èòü ñïðàâî÷íóþ èíôîðìàöèþ ïî îòäåëüíî âçÿòîé îïöèè âîñïîëüçóéòåñü êîìàíäîé %R%S HELP SASET îïöèÿ @@ -3614,26 +3614,39 @@ NICK_HELP_ACCESS ACCESS LIST Mevcut access listesini görüntüler. -NICK_HELP_SET +NICK_HELP_SET_HEAD Kullanýmý: SET özellik parametre Çeþitli nick özelliklerini ayarlar. özellik þunlardan biri olabilir: +NICK_HELP_CMD_SET_DISPLAY DISPLAY Grubunuzun servislerde nasýl görüneceðini ayarlar +NICK_HELP_CMD_SET_PASSWORD PASSWORD Nickinize þifre belirtir +NICK_HELP_CMD_SET_LANGUAGE LANGUAGE Servislerin size hitap edeceði dili belirler +NICK_HELP_CMD_SET_URL URL Nickinizle bir URL yi iliþkilendirir +NICK_HELP_CMD_SET_EMAIL EMAIL Nickinizle bir email adresini iliþkilendirir +NICK_HELP_CMD_SET_ICQ ICQ Nickinizle bir ICQ numarasýný iliþikilendirir +NICK_HELP_CMD_SET_GREET GREET Nickiniz için bir karþýlama mesajý belirler +NICK_HELP_CMD_SET_KILL KILL Korumayý açar kapatýr +NICK_HELP_CMD_SET_SECURE SECURE Nick güvenliðini açar kapatýr +NICK_HELP_CMD_SET_PRIVATE PRIVATE Nickinizin %R%S LIST yazýldýðýnda görünmesini engeller +NICK_HELP_CMD_SET_HIDE HIDE Nickinizle ilgili bazý bilgileri saklar +NICK_HELP_CMD_SET_AUTOOP AUTOOP Should services op you automatically. +NICK_HELP_SET_TAIL Bu komutu kullanabilmek için önce, þifrenizle kendinizi tanýtmanýz gerekir (Daha fazla bilgi için @@ -3750,26 +3763,40 @@ NICK_HELP_SET_AUTOOP Sets whether you will be opped automatically. Set to ON to allow ChanServ to op you automatically when entering channels. -NICK_HELP_SASET +NICK_HELP_SASET_HEAD Syntax: SASET nickname option parameters. Sets various nickname options. option can be one of: +NICK_HELP_CMD_SASET_DISPLAY DISPLAY Set the display of the group in Services +NICK_HELP_CMD_SASET_PASSWORD PASSWORD Set the nickname password +NICK_HELP_CMD_SASET_URL URL Associate a URL with the nickname +NICK_HELP_CMD_SASET_EMAIL EMAIL Associate an E-mail address with the nickname +NICK_HELP_CMD_SASET_ICQ ICQ Associate an ICQ number with the nickname +NICK_HELP_CMD_SASET_GREET GREET Associate a greet message with the nickname +NICK_HELP_CMD_SASET_KILL KILL Turn protection on or off +NICK_HELP_CMD_SASET_SECURE SECURE Turn nickname security on or off +NICK_HELP_CMD_SASET_PRIVATE PRIVATE Prevent the nickname from appearing in a %R%S LIST +NICK_HELP_CMD_SASET_HIDE HIDE Hide certain pieces of nickname information +NICK_HELP_CMD_SASET_MSG MSG Change the communication method of Services +NICK_HELP_CMD_SASET_NOEXPIRE NOEXPIRE Prevent the nickname from expiring +NICK_HELP_CMD_SASET_LANGUAGE LANGUAGE Set the language Services will use when sending messages to nickname +NICK_HELP_SASET_TAIL Type %R%S HELP SASET option for more information on a specific option. The options will be set on the given diff --git a/src/botserv.cpp b/src/botserv.cpp index 7f64c0c63..2dd96706d 100644 --- a/src/botserv.cpp +++ b/src/botserv.cpp @@ -85,7 +85,7 @@ void botserv(User *u, BotInfo *bi, const std::string &buf) } else { - mod_run_cmd(bi, u, buf.c_str()); + mod_run_cmd(bi, u, buf); } } diff --git a/src/chanserv.cpp b/src/chanserv.cpp index 256909bb9..10acd3731 100644 --- a/src/chanserv.cpp +++ b/src/chanserv.cpp @@ -273,7 +273,7 @@ void chanserv(User *u, const std::string &buf) } else { - mod_run_cmd(ChanServ, u, buf.c_str()); + mod_run_cmd(ChanServ, u, buf); } } diff --git a/src/command.cpp b/src/command.cpp index 7fd5975ef..922f298c3 100644 --- a/src/command.cpp +++ b/src/command.cpp @@ -20,16 +20,31 @@ Command::~Command() { } -CommandReturn Command::Execute(User *u, const std::vector<ci::string> &) { return MOD_CONT; } +CommandReturn Command::Execute(User *u, const std::vector<ci::string> &) +{ + return MOD_CONT; +} void Command::OnServHelp(User *u) { } bool Command::OnHelp(User *u, const ci::string &subcommand) { return false; } -void Command::OnSyntaxError(User *u, const ci::string &subcommand) { } +void Command::OnSyntaxError(User *u, const ci::string &subcommand) +{ +} void Command::SetPermission(const std::string &reststr) { this->permission = reststr; } +bool Command::AddSubcommand(Command *c) +{ + return false; +} + +bool Command::DelSubcommand(const ci::string &cname) +{ + return false; +} + diff --git a/src/commands.cpp b/src/commands.cpp index 3226bff59..f066b2885 100644 --- a/src/commands.cpp +++ b/src/commands.cpp @@ -29,22 +29,26 @@ Command *FindCommand(BotInfo *bi, const ci::string &name) return NULL; } -void mod_run_cmd(BotInfo *bi, User *u, const ci::string &message) +void mod_run_cmd(BotInfo *bi, User *u, const std::string &message) { - if (!bi || !u || message.empty()) - return; - - spacesepstream sep(message); - ci::string command; + spacesepstream sep(ci::string(message.c_str())); + ci::string cmd; - if (!sep.GetToken(command)) + if (sep.GetToken(cmd)) + { + mod_run_cmd(bi, u, FindCommand(bi, cmd), cmd, sep.GetRemaining().c_str()); + } +} + +void mod_run_cmd(BotInfo *bi, User *u, Command *c, const ci::string &command, const ci::string &message) +{ + if (!bi || !u) return; - Command *c = FindCommand(bi, command); CommandReturn ret = MOD_CONT; EventReturn MOD_RESULT; - FOREACH_RESULT(I_OnPreCommandRun, OnPreCommandRun(u, bi, command, sep.GetRemaining().c_str(), c)); + FOREACH_RESULT(I_OnPreCommandRun, OnPreCommandRun(u, bi, command, message, c)); if (MOD_RESULT == EVENT_STOP) return; @@ -67,6 +71,7 @@ void mod_run_cmd(BotInfo *bi, User *u, const ci::string &message) std::vector<ci::string> params; ci::string curparam, endparam; + spacesepstream sep(message); while (sep.GetToken(curparam)) { // - 1 because params[0] corresponds with a maxparam of 1. diff --git a/src/core/ns_saset.cpp b/src/core/ns_saset.cpp index c2e5831bd..ccc6be928 100644 --- a/src/core/ns_saset.cpp +++ b/src/core/ns_saset.cpp @@ -16,559 +16,223 @@ class CommandNSSASet : public Command { -private: - CommandReturn DoSetDisplay(User *u, const std::vector<ci::string> ¶ms, NickCore *nc) + std::map<ci::string, Command *> subcommands; + public: + CommandNSSASet(const ci::string &cname) : Command(cname, 2, 4) { - ci::string param = params.size() > 2 ? params[2] : ""; - - if (param.empty()) - { - this->OnSyntaxError(u, "DISPLAY"); - return MOD_CONT; - } - - /* First check whether param is a valid nick of the group */ - NickAlias *na = findnick(param); - - if (!na || na->nc != nc) - { - notice_lang(Config.s_NickServ, u, NICK_SASET_DISPLAY_INVALID, nc->display); - return MOD_CONT; - } - - change_core_display(nc, param.c_str()); - notice_lang(Config.s_NickServ, u, NICK_SASET_DISPLAY_CHANGED, nc->display); - return MOD_CONT; } - CommandReturn DoSetPassword(User *u, const std::vector<ci::string> ¶ms, NickCore *nc) + ~CommandNSSASet() { - ci::string param = params.size() > 2 ? params[2] : ""; - std::string buf, tmp_pass; - - if (param.empty()) + for (std::map<ci::string, Command *>::const_iterator it = this->subcommands.begin(); it != this->subcommands.end(); ++it) { - this->OnSyntaxError(u, "PASSWORD"); - return MOD_CONT; + delete it->second; } - - int len = param.size(); - - if (Config.NSSecureAdmins && u->Account() != nc && nc->IsServicesOper()) - { - notice_lang(Config.s_NickServ, u, ACCESS_DENIED); - return MOD_CONT; - } - else if (nc->display == param || (Config.StrictPasswords && len < 5)) - { - notice_lang(Config.s_NickServ, u, MORE_OBSCURE_PASSWORD); - return MOD_CONT; - } - else if (len > Config.PassLen) - { - notice_lang(Config.s_NickServ, u, PASSWORD_TOO_LONG); - return MOD_CONT; - } - buf = param.c_str(); /* conversion from ci::string to std::string */ - if (enc_encrypt(buf, nc->pass)) - { - Alog() << Config.s_NickServ << ": Failed to encrypt password for " << nc->display << " (set)"; - notice_lang(Config.s_NickServ, u, NICK_SASET_PASSWORD_FAILED, nc->display); - return MOD_CONT; - } - - if (enc_decrypt(nc->pass, tmp_pass) == 1) - notice_lang(Config.s_NickServ, u, NICK_SASET_PASSWORD_CHANGED_TO, nc->display, tmp_pass.c_str()); - else - notice_lang(Config.s_NickServ, u, NICK_SASET_PASSWORD_CHANGED, nc->display); - - Alog() << Config.s_NickServ << ": " << u->GetMask() << " used SASET PASSWORD on " << nc->display << " (e-mail: "<< (nc->email ? nc->email : "none") << ")"; - if (Config.WallSetpass) - ircdproto->SendGlobops(NickServ, "\2%s\2 used SASET PASSWORD on \2%s\2", u->nick.c_str(), nc->display); - return MOD_CONT; - } - - CommandReturn DoSetUrl(User *u, const std::vector<ci::string> ¶ms, NickCore *nc) - { - const char *param = params.size() > 2 ? params[2].c_str() : NULL; - - if (nc->url) - delete [] nc->url; - - if (param) - { - nc->url = sstrdup(param); - notice_lang(Config.s_NickServ, u, NICK_SASET_URL_CHANGED, nc->display, param); - } - else - { - nc->url = NULL; - notice_lang(Config.s_NickServ, u, NICK_SASET_URL_UNSET, nc->display); - } - return MOD_CONT; + this->subcommands.clear(); } - CommandReturn DoSetEmail(User *u, const std::vector<ci::string> ¶ms, NickCore *nc) + CommandReturn Execute(User *u, const std::vector<ci::string> ¶ms) { - const char *param = params.size() > 2 ? params[2].c_str() : NULL; + const char *nick = params[0].c_str(); + ci::string cmd = params[1]; - if (!param && Config.NSForceEmail) - { - notice_lang(Config.s_NickServ, u, NICK_SASET_EMAIL_UNSET_IMPOSSIBLE); - return MOD_CONT; - } - else if (Config.NSSecureAdmins && u->Account() != nc && nc->IsServicesOper()) - { - notice_lang(Config.s_NickServ, u, ACCESS_DENIED); - return MOD_CONT; - } - else if (param && !MailValidate(param)) + if (readonly) { - notice_lang(Config.s_NickServ, u, MAIL_X_INVALID, param); + notice_lang(Config.s_NickServ, u, NICK_SASET_DISABLED); return MOD_CONT; } - Alog() << Config.s_NickServ << ": " << u->GetMask() << " used SASET EMAIL on " << nc->display << " (e-mail: " << (nc->email ? nc->email : "none") << ")"; - - if (nc->email) - delete [] nc->email; - - if (param) - { - nc->email = sstrdup(param); - notice_lang(Config.s_NickServ, u, NICK_SASET_EMAIL_CHANGED, nc->display, param); - } + NickAlias *na = findnick(nick); + if (!na) + notice_lang(Config.s_NickServ, u, NICK_SASET_BAD_NICK, nick); + else if (na->HasFlag(NS_FORBIDDEN)) + notice_lang(Config.s_NickServ, u, NICK_X_FORBIDDEN, na->nick); + else if (na->nc->HasFlag(NI_SUSPENDED)) + notice_lang(Config.s_NickServ, u, NICK_X_SUSPENDED, na->nick); else { - nc->email = NULL; - notice_lang(Config.s_NickServ, u, NICK_SASET_EMAIL_UNSET, nc->display); - } - return MOD_CONT; - } + Command *c = this->FindCommand(params[1]); - CommandReturn DoSetICQ(User *u, const std::vector<ci::string> ¶ms, NickCore *nc) - { - const char *param = params.size() > 2 ? params[2].c_str() : NULL; - - if (param) - { - int32 tmp = atol(param); - if (!tmp) - notice_lang(Config.s_NickServ, u, NICK_SASET_ICQ_INVALID, param); + if (c) + { + ci::string cmdparams = na->nc->display; + for (std::vector<ci::string>::const_iterator it = params.begin() + 1; it != params.end(); ++it) + cmdparams += " " + *it; + mod_run_cmd(NickServ, u, c, params[1], cmdparams); + } else { - nc->icq = tmp; - notice_lang(Config.s_NickServ, u, NICK_SASET_ICQ_CHANGED, nc->display, param); + notice_lang(Config.s_NickServ, u, NICK_SASET_UNKNOWN_OPTION, cmd.c_str()); } } - else - { - nc->icq = 0; - notice_lang(Config.s_NickServ, u, NICK_SASET_ICQ_UNSET, nc->display); - } + return MOD_CONT; } - CommandReturn DoSetGreet(User *u, const std::vector<ci::string> ¶ms, NickCore *nc) + bool OnHelp(User *u, const ci::string &subcommand) { - const char *param = params.size() > 2 ? params[2].c_str() : NULL; - - if (nc->greet) - delete [] nc->greet; - - if (param) + if (subcommand.empty()) { - char buf[BUFSIZE]; - const char *rest = params.size() > 3 ? params[3].c_str() : NULL; - - snprintf(buf, sizeof(buf), "%s%s%s", param, rest ? " " : "", rest ? rest : ""); - - nc->greet = sstrdup(buf); - notice_lang(Config.s_NickServ, u, NICK_SASET_GREET_CHANGED, nc->display, buf); + notice_help(Config.s_NickServ, u, NICK_HELP_SASET_HEAD); + for (std::map<ci::string, Command *>::iterator it = this->subcommands.begin(); it != this->subcommands.end(); ++it) + it->second->OnServHelp(u); + notice_help(Config.s_NickServ, u, NICK_HELP_SASET_TAIL); + return true; } else { - nc->greet = NULL; - notice_lang(Config.s_NickServ, u, NICK_SASET_GREET_UNSET, nc->display); - } - return MOD_CONT; - } - - CommandReturn DoSetKill(User *u, const std::vector<ci::string> ¶ms, NickCore *nc) - { - ci::string param = params.size() > 2 ? params[2] : ""; - - if (param.empty()) - { - this->OnSyntaxError(u, "KILL"); - return MOD_CONT; - } + Command *c = this->FindCommand(subcommand); - if (param == "ON") - { - nc->SetFlag(NI_KILLPROTECT); - nc->UnsetFlag(NI_KILL_QUICK); - nc->UnsetFlag(NI_KILL_IMMED); - notice_lang(Config.s_NickServ, u, NICK_SASET_KILL_ON, nc->display); - } - else if (param == "QUICK") - { - nc->SetFlag(NI_KILLPROTECT); - nc->SetFlag(NI_KILL_QUICK); - nc->UnsetFlag(NI_KILL_IMMED); - notice_lang(Config.s_NickServ, u, NICK_SASET_KILL_QUICK, nc->display); - } - else if (param == "IMMED") - { - if (Config.NSAllowKillImmed) + if (c) { - nc->SetFlag(NI_KILLPROTECT); - nc->SetFlag(NI_KILL_IMMED); - nc->UnsetFlag(NI_KILL_QUICK); - notice_lang(Config.s_NickServ, u, NICK_SASET_KILL_IMMED, nc->display); + return c->OnHelp(u, subcommand); } - else - notice_lang(Config.s_NickServ, u, NICK_SASET_KILL_IMMED_DISABLED); - } - else if (param == "OFF") - { - nc->UnsetFlag(NI_KILLPROTECT); - nc->UnsetFlag(NI_KILL_QUICK); - nc->UnsetFlag(NI_KILL_IMMED); - notice_lang(Config.s_NickServ, u, NICK_SASET_KILL_OFF, nc->display); } - else - syntax_error(Config.s_NickServ, u, "SASET KILL", Config.NSAllowKillImmed ? NICK_SASET_KILL_IMMED_SYNTAX : NICK_SASET_KILL_SYNTAX); - return MOD_CONT; + + return false; } - CommandReturn DoSetSecure(User *u, const std::vector<ci::string> ¶ms, NickCore *nc) + void OnSyntaxError(User *u, const ci::string &subcommand) { - ci::string param = params.size() > 2 ? params[2] : ""; - - if (param.empty()) - { - this->OnSyntaxError(u, "SECURE"); - return MOD_CONT; - } - - if (param == "ON") - { - nc->SetFlag(NI_SECURE); - notice_lang(Config.s_NickServ, u, NICK_SASET_SECURE_ON, nc->display); - } - else if (param == "OFF") - { - nc->UnsetFlag(NI_SECURE); - notice_lang(Config.s_NickServ, u, NICK_SASET_SECURE_OFF, nc->display); - } - else - syntax_error(Config.s_NickServ, u, "SASET SECURE", NICK_SASET_SECURE_SYNTAX); - return MOD_CONT; + syntax_error(Config.s_NickServ, u, "SASET", NICK_SASET_SYNTAX); } - CommandReturn DoSetPrivate(User *u, const std::vector<ci::string> ¶ms, NickCore *nc) + void OnServHelp(User *u) { - ci::string param = params.size() > 2 ? params[2] : ""; - - if (param.empty()) - { - this->OnSyntaxError(u, "PRIVATE"); - return MOD_CONT; - } - - if (param == "ON") - { - nc->SetFlag(NI_PRIVATE); - notice_lang(Config.s_NickServ, u, NICK_SASET_PRIVATE_ON, nc->display); - } - else if (param == "OFF") - { - nc->UnsetFlag(NI_PRIVATE); - notice_lang(Config.s_NickServ, u, NICK_SASET_PRIVATE_OFF, nc->display); - } - else - syntax_error(Config.s_NickServ, u, "SASET PRIVATE", NICK_SASET_PRIVATE_SYNTAX); - return MOD_CONT; + notice_lang(Config.s_NickServ, u, NICK_HELP_CMD_SASET); } - CommandReturn DoSetMsg(User *u, const std::vector<ci::string> ¶ms, NickCore *nc) + bool AddSubcommand(Command *c) { - ci::string param = params.size() > 2 ? params[2] : ""; - - if (param.empty()) - { - this->OnSyntaxError(u, "MSG"); - return MOD_CONT; - } - - if (!Config.UsePrivmsg) - { - notice_lang(Config.s_NickServ, u, NICK_SASET_OPTION_DISABLED, "MSG"); - return MOD_CONT; - } + return this->subcommands.insert(std::make_pair(c->name, c)).second; + } - if (param == "ON") - { - nc->SetFlag(NI_MSG); - notice_lang(Config.s_NickServ, u, NICK_SASET_MSG_ON, nc->display); - } - else if (param == "OFF") - { - nc->UnsetFlag(NI_MSG); - notice_lang(Config.s_NickServ, u, NICK_SASET_MSG_OFF, nc->display); - } - else - syntax_error(Config.s_NickServ, u, "SASET MSG", NICK_SASET_MSG_SYNTAX); - return MOD_CONT; + bool DelSubcommand(const ci::string &command) + { + return this->subcommands.erase(command); } - CommandReturn DoSetHide(User *u, const std::vector<ci::string> ¶ms, NickCore *nc) + Command *FindCommand(const ci::string &subcommand) { - ci::string param = params.size() > 2 ? params[2] : ""; + std::map<ci::string, Command *>::const_iterator it = this->subcommands.find(subcommand); - if (param.empty()) + if (it != this->subcommands.end()) { - this->OnSyntaxError(u, "HIDE"); - return MOD_CONT; + return it->second; } - int onmsg, offmsg; - NickCoreFlag flag; - - if (param == "EMAIL") - { - flag = NI_HIDE_EMAIL; - onmsg = NICK_SASET_HIDE_EMAIL_ON; - offmsg = NICK_SASET_HIDE_EMAIL_OFF; - } - else if (param == "USERMASK") - { - flag = NI_HIDE_MASK; - onmsg = NICK_SASET_HIDE_MASK_ON; - offmsg = NICK_SASET_HIDE_MASK_OFF; - } - else if (param == "STATUS") - { - flag = NI_HIDE_STATUS; - onmsg = NICK_SASET_HIDE_STATUS_ON; - offmsg = NICK_SASET_HIDE_STATUS_OFF; - } - else if (param == "QUIT") - { - flag = NI_HIDE_QUIT; - onmsg = NICK_SASET_HIDE_QUIT_ON; - offmsg = NICK_SASET_HIDE_QUIT_OFF; - } - else - { - syntax_error(Config.s_NickServ, u, "SASET HIDE", NICK_SASET_HIDE_SYNTAX); - return MOD_CONT; - } + return NULL; + } +}; - param = params.size() > 3 ? params[3] : ""; - if (param.empty()) - syntax_error(Config.s_NickServ, u, "SASET HIDE", NICK_SASET_HIDE_SYNTAX); - else if (param == "ON") - { - nc->SetFlag(flag); - notice_lang(Config.s_NickServ, u, onmsg, nc->display, Config.s_NickServ); - } - else if (param == "OFF") - { - nc->UnsetFlag(flag); - notice_lang(Config.s_NickServ, u, offmsg, nc->display, Config.s_NickServ); - } - else - syntax_error(Config.s_NickServ, u, "SASET HIDE", NICK_SASET_HIDE_SYNTAX); - return MOD_CONT; +class CommandNSSASetDisplay : public Command +{ + public: + CommandNSSASetDisplay(const ci::string &cname) : Command(cname, 2, 2, "nickserv/saset/display") + { } - CommandReturn DoSetNoExpire(User *u, const std::vector<ci::string> ¶ms, NickAlias *na) + CommandReturn Execute(User *u, const std::vector<ci::string> ¶ms) { - ci::string param = params.size() > 2 ? params[2] : ""; + NickCore *nc = findcore(params[0]); + assert(nc); - if (param.empty()) + NickAlias *na = findnick(params[1]); + if (!na || na->nc != nc) { - syntax_error(Config.s_NickServ, u, "SASET NOEXPIRE", NICK_SASET_NOEXPIRE_SYNTAX); + notice_lang(Config.s_NickServ, u, NICK_SASET_DISPLAY_INVALID, nc->display); return MOD_CONT; } - if (param == "ON") - { - na->SetFlag(NS_NO_EXPIRE); - notice_lang(Config.s_NickServ, u, NICK_SASET_NOEXPIRE_ON, na->nick); - } - else if (param == "OFF") - { - na->UnsetFlag(NS_NO_EXPIRE); - notice_lang(Config.s_NickServ, u, NICK_SASET_NOEXPIRE_OFF, na->nick); - } - else - syntax_error(Config.s_NickServ, u, "SASET NOEXPIRE", NICK_SASET_NOEXPIRE_SYNTAX); + change_core_display(nc, params[1].c_str()); + notice_lang(Config.s_NickServ, u, NICK_SASET_DISPLAY_CHANGED, nc->display); return MOD_CONT; } - CommandReturn DoSetAutoOP(User *u, const std::vector<ci::string> ¶ms, NickCore *nc) + bool OnHelp(User *u, const ci::string &) { - ci::string param = params.size() > 2 ? params[2] : ""; - - if (param.empty()) - { - this->OnSyntaxError(u, "AUTOOP"); - return MOD_CONT; - } + notice_help(Config.s_NickServ, u, NICK_HELP_SASET_DISPLAY); + return true; + } - if (param == "ON") - { - nc->SetFlag(NI_AUTOOP); - notice_lang(Config.s_NickServ, u, NICK_SASET_AUTOOP_ON, nc->display); - } - else if (param == "OFF") - { - nc->UnsetFlag(NI_AUTOOP); - notice_lang(Config.s_NickServ, u, NICK_SASET_AUTOOP_OFF, nc->display); - } - else - syntax_error(Config.s_NickServ, u, "SET AUTOOP", NICK_SASET_AUTOOP_SYNTAX); + void OnSyntaxError(User *u) + { + // XXX + syntax_error(Config.s_NickServ, u, "SASET", NICK_SASET_SYNTAX); + } - return MOD_CONT; + void OnServHelp(User *u) + { + notice_lang(Config.s_NickServ, u, NICK_HELP_CMD_SASET_DISPLAY); } +}; - CommandReturn DoSetLanguage(User *u, const std::vector<ci::string> ¶ms, NickCore *nc) +class CommandNSSASetPassword : public Command +{ + public: + CommandNSSASetPassword(const ci::string &cname) : Command(cname, 2, 2, "nickserv/saset/password") { - const char *param = params.size() > 2 ? params[2].c_str() : NULL; + } - if (!param) - { - this->OnSyntaxError(u, "LANGUAGE"); - return MOD_CONT; - } + CommandReturn Execute(User *u, const std::vector<ci::string> ¶ms) + { + NickCore *nc = findcore(params[0]); + assert(nc); - int langnum; + size_t len = params[1].size(); - if (param[strspn(param, "0123456789")]) /* i.e. not a number */ + if (Config.NSSecureAdmins && u->Account() != nc && nc->IsServicesOper()) { - syntax_error(Config.s_NickServ, u, "SASET LANGUAGE", NICK_SASET_LANGUAGE_SYNTAX); + notice_lang(Config.s_NickServ, u, ACCESS_DENIED); return MOD_CONT; } - langnum = atoi(param) - 1; - if (langnum < 0 || langnum >= NUM_LANGS || langlist[langnum] < 0) + else if (nc->display == params[1] || (Config.StrictPasswords && len < 5)) { - notice_lang(Config.s_NickServ, u, NICK_SASET_LANGUAGE_UNKNOWN, langnum + 1, Config.s_NickServ); + notice_lang(Config.s_NickServ, u, MORE_OBSCURE_PASSWORD); return MOD_CONT; } - nc->language = langlist[langnum]; - notice_lang(Config.s_NickServ, u, NICK_SASET_LANGUAGE_CHANGED); - - return MOD_CONT; - } -public: - CommandNSSASet() : Command("SASET", 2, 4, "nickserv/saset") - { - } - - CommandReturn Execute(User *u, const std::vector<ci::string> ¶ms) - { - const char *nick = params[0].c_str(); - ci::string cmd = params[1]; - - NickAlias *na; - - if (readonly) + else if (len > Config.PassLen) { - notice_lang(Config.s_NickServ, u, NICK_SASET_DISABLED); + notice_lang(Config.s_NickServ, u, PASSWORD_TOO_LONG); return MOD_CONT; } - if (!(na = findnick(nick))) + + std::string buf = params[1].c_str(); + if (enc_encrypt(buf, nc->pass)) { - notice_lang(Config.s_NickServ, u, NICK_SASET_BAD_NICK, nick); + Alog() << Config.s_NickServ << ": Failed to encrypt password for " << nc->display << " (saset)"; + notice_lang(Config.s_NickServ, u, NICK_SASET_PASSWORD_FAILED, nc->display); return MOD_CONT; } - if (na->HasFlag(NS_FORBIDDEN)) - notice_lang(Config.s_NickServ, u, NICK_X_FORBIDDEN, na->nick); - else if (na->nc->HasFlag(NI_SUSPENDED)) - notice_lang(Config.s_NickServ, u, NICK_X_SUSPENDED, na->nick); - else if (cmd == "DISPLAY") - return this->DoSetDisplay(u, params, na->nc); - else if (cmd == "PASSWORD") - return this->DoSetPassword(u, params, na->nc); - else if (cmd == "URL") - return this->DoSetUrl(u, params, na->nc); - else if (cmd == "EMAIL") - return this->DoSetEmail(u, params, na->nc); - else if (cmd == "ICQ") - return this->DoSetICQ(u, params, na->nc); - else if (cmd == "GREET") - return this->DoSetGreet(u, params, na->nc); - else if (cmd == "KILL") - return this->DoSetKill(u, params, na->nc); - else if (cmd == "SECURE") - return this->DoSetSecure(u, params, na->nc); - else if (cmd == "PRIVATE") - return this->DoSetPrivate(u, params, na->nc); - else if (cmd == "MSG") - return this->DoSetMsg(u, params, na->nc); - else if (cmd == "HIDE") - return this->DoSetHide(u, params, na->nc); - else if (cmd == "NOEXPIRE") - return this->DoSetNoExpire(u, params, na); - else if (cmd == "AUTOOP") - return this->DoSetAutoOP(u, params, na->nc); - else if (cmd == "LANGUAGE") - return this->DoSetLanguage(u, params, na->nc); + std::string tmp_pass; + if (enc_decrypt(nc->pass, tmp_pass) == 1) + notice_lang(Config.s_NickServ, u, NICK_SASET_PASSWORD_CHANGED_TO, nc->display, tmp_pass.c_str()); else - notice_lang(Config.s_NickServ, u, NICK_SASET_UNKNOWN_OPTION, cmd.c_str()); + notice_lang(Config.s_NickServ, u, NICK_SASET_PASSWORD_CHANGED, nc->display); + + Alog() << Config.s_NickServ << ": " << u->GetMask() << " used SASET PASSWORD on " << nc->display << " (e-mail: "<< (nc->email ? nc->email : "none") << ")"; + + if (Config.WallSetpass) + ircdproto->SendGlobops(NickServ, "\2%s\2 used SASET PASSWORD on \2%s\2", u->nick.c_str(), nc->display); + return MOD_CONT; } - bool OnHelp(User *u, const ci::string &subcommand) + bool OnHelp(User *u, const ci::string &) { - if (subcommand.empty()) - notice_help(Config.s_NickServ, u, NICK_HELP_SASET); - else if (subcommand == "DISPLAY") - notice_help(Config.s_NickServ, u, NICK_HELP_SASET_DISPLAY); - else if (subcommand == "PASSWORD") - notice_help(Config.s_NickServ, u, NICK_HELP_SASET_PASSWORD); - else if (subcommand == "URL") - notice_help(Config.s_NickServ, u, NICK_HELP_SASET_URL); - else if (subcommand == "EMAIL") - notice_help(Config.s_NickServ, u, NICK_HELP_SASET_EMAIL); - else if (subcommand == "ICQ") - notice_help(Config.s_NickServ, u, NICK_HELP_SASET_ICQ); - else if (subcommand == "GREET") - notice_help(Config.s_NickServ, u, NICK_HELP_SASET_GREET); - else if (subcommand == "KILL") - notice_help(Config.s_NickServ, u, NICK_HELP_SASET_KILL); - else if (subcommand == "SECURE") - notice_help(Config.s_NickServ, u, NICK_HELP_SASET_SECURE); - else if (subcommand == "PRIVATE") - notice_help(Config.s_NickServ, u, NICK_HELP_SASET_PRIVATE); - else if (subcommand == "MSG") - notice_help(Config.s_NickServ, u, NICK_HELP_SASET_MSG); - else if (subcommand == "HIDE") - notice_help(Config.s_NickServ, u, NICK_HELP_SASET_HIDE); - else if (subcommand == "NOEXPIRE") - notice_help(Config.s_NickServ, u, NICK_HELP_SASET_NOEXPIRE); - else if (subcommand == "AUTOOP") - notice_help(Config.s_NickServ, u, NICK_HELP_SASET_AUTOOP); - else if (subcommand == "LANGUAGE") - notice_help(Config.s_NickServ, u, NICK_HELP_SASET_LANGUAGE); - else - return false; - + notice_help(Config.s_NickServ, u, NICK_HELP_SASET_PASSWORD); return true; } - void OnSyntaxError(User *u, const ci::string &subcommand) + void OnSyntaxError(User *u, const ci::string &) { syntax_error(Config.s_NickServ, u, "SASET", NICK_SASET_SYNTAX); } void OnServHelp(User *u) { - notice_lang(Config.s_NickServ, u, NICK_HELP_CMD_SASET); + notice_lang(Config.s_NickServ, u, NICK_HELP_CMD_SASET_PASSWORD); } }; @@ -581,7 +245,10 @@ public: this->SetVersion(VERSION_STRING); this->SetType(CORE); - this->AddCommand(NickServ, new CommandNSSASet()); + Command *c = new CommandNSSASet("SASET"); + this->AddCommand(NickServ, c); + c->AddSubcommand(new CommandNSSASetDisplay("DISPLAY")); + c->AddSubcommand(new CommandNSSASetPassword("PASSWORD")); } }; diff --git a/src/core/ns_saset_noexpire.cpp b/src/core/ns_saset_noexpire.cpp new file mode 100644 index 000000000..a5df0bb19 --- /dev/null +++ b/src/core/ns_saset_noexpire.cpp @@ -0,0 +1,87 @@ +/* NickServ core functions + * + * (C) 2003-2010 Anope Team + * Contact us at team@anope.org + * + * Please read COPYING and README for further details. + * + * Based on the original code of Epona by Lara. + * Based on the original code of Services by Andy Church. + * + * $Id$ + * + */ +/*************************************************************************/ + +#include "module.h" + +class CommandNSSASetNoexpire : public Command +{ + public: + CommandNSSASetNoexpire(const ci::string &cname) : Command(cname, 1, 2, "nickserv/saset/noexpire") + { + } + + CommandReturn Execute(User *u, const std::vector<ci::string> ¶ms) + { + NickAlias *na = findnick(params[0]); + assert(na); + + ci::string param = params.size() > 1 ? params[1] : ""; + + if (param == "ON") + { + na->SetFlag(NS_NO_EXPIRE); + notice_lang(Config.s_NickServ, u, NICK_SASET_NOEXPIRE_ON, na->nick); + } + else if (param == "OFF") + { + na->UnsetFlag(NS_NO_EXPIRE); + notice_lang(Config.s_NickServ, u, NICK_SASET_NOEXPIRE_OFF, na->nick); + } + else + this->OnSyntaxError(u, "NOEXPIRE"); + + return MOD_CONT; + } + + bool OnHelp(User *u, const ci::string &) + { + notice_help(Config.s_NickServ, u, NICK_HELP_SASET_NOEXPIRE); + return true; + } + + void OnSyntaxError(User *u, const ci::string &) + { + syntax_error(Config.s_NickServ, u, "SASET NOEXPIRE", NICK_SASET_NOEXPIRE_SYNTAX); + } + + void OnServHelp(User *u) + { + notice_lang(Config.s_NickServ, u, NICK_HELP_CMD_SASET_NOEXPIRE); + } +}; + +class NSSASetNoexpire : public Module +{ + public: + NSSASetNoexpire(const std::string &modname, const std::string &creator) : Module(modname, creator) + { + this->SetAuthor("Anope"); + this->SetVersion("$Id$"); + this->SetType(CORE); + + Command *c = FindCommand(NickServ, "SASET"); + if (c) + c->AddSubcommand(new CommandNSSASetNoexpire("NOEXPIRE")); + } + + ~NSSASetNoexpire() + { + Command *c = FindCommand(NickServ, "SASET"); + if (c) + c->DelSubcommand("NOEXPRE"); + } +}; + +MODULE_INIT(NSSASetNoexpire) diff --git a/src/core/ns_set.cpp b/src/core/ns_set.cpp index 9cc515700..ecb1355c3 100644 --- a/src/core/ns_set.cpp +++ b/src/core/ns_set.cpp @@ -16,515 +16,207 @@ class CommandNSSet : public Command { - private: - CommandReturn DoSetDisplay(User *u, const std::vector<ci::string> ¶ms, NickCore *nc) + std::map<ci::string, Command *> subcommands; + public: + CommandNSSet(const ci::string &cname) : Command(cname, 1, 3) { - ci::string param = params.size() > 1 ? params[1] : ""; - - if (param.empty()) - { - this->OnSyntaxError(u, "DISPLAY"); - return MOD_CONT; - } - - NickAlias *na = findnick(param); - - if (!na || na->nc != nc) - { - notice_lang(Config.s_NickServ, u, NICK_SET_DISPLAY_INVALID); - return MOD_CONT; - } - - change_core_display(nc, param.c_str()); - notice_lang(Config.s_NickServ, u, NICK_SET_DISPLAY_CHANGED, nc->display); - return MOD_CONT; } - CommandReturn DoSetPassword(User *u, const std::vector<ci::string> ¶ms, NickCore *nc) + ~CommandNSSet() { - ci::string param = params.size() > 1 ? params[1] : ""; - std::string buf, tmp_pass; - - if (param.empty()) + for (std::map<ci::string, Command *>::const_iterator it = this->subcommands.begin(); it != this->subcommands.end(); ++it) { - this->OnSyntaxError(u, "PASSWORD"); - return MOD_CONT; + delete it->second; } - - int len = param.size(); - - if (nc->display == param || (Config.StrictPasswords && len < 5)) - { - notice_lang(Config.s_NickServ, u, MORE_OBSCURE_PASSWORD); - return MOD_CONT; - } - else if (len > Config.PassLen) - { - notice_lang(Config.s_NickServ, u, PASSWORD_TOO_LONG); - return MOD_CONT; - } - - buf = param.c_str(); /* conversion from ci::string to std::string */ - if (enc_encrypt(buf, nc->pass) < 0) - { - Alog() << Config.s_NickServ << ": Failed to encrypt password for " << nc->display << " (set)"; - notice_lang(Config.s_NickServ, u, NICK_SET_PASSWORD_FAILED); - return MOD_CONT; - } - - if (enc_decrypt(nc->pass, tmp_pass) == 1) - notice_lang(Config.s_NickServ, u, NICK_SET_PASSWORD_CHANGED_TO, tmp_pass.c_str()); - else - notice_lang(Config.s_NickServ, u, NICK_SET_PASSWORD_CHANGED); - - Alog() << Config.s_NickServ << ": " << u->GetMask() << " (e-mail: " << (nc->email ? nc->email : "none") << ") changed its password."; - - return MOD_CONT; + this->subcommands.clear(); } - CommandReturn DoSetLanguage(User *u, const std::vector<ci::string> ¶ms, NickCore *nc) + CommandReturn Execute(User *u, const std::vector<ci::string> ¶ms) { - const char *param = params.size() > 1 ? params[1].c_str() : NULL; - - if (!param) + if (readonly) { - this->OnSyntaxError(u, "LANGUAGE"); + notice_lang(Config.s_NickServ, u, NICK_SET_DISABLED); return MOD_CONT; } - int langnum; - - if (param[strspn(param, "0123456789")]) /* i.e. not a number */ - { - syntax_error(Config.s_NickServ, u, "SET LANGUAGE", NICK_SET_LANGUAGE_SYNTAX); - return MOD_CONT; - } - langnum = atoi(param) - 1; - if (langnum < 0 || langnum >= NUM_LANGS || langlist[langnum] < 0) + if (u->Account()->HasFlag(NI_SUSPENDED)) { - notice_lang(Config.s_NickServ, u, NICK_SET_LANGUAGE_UNKNOWN, langnum + 1, Config.s_NickServ); + notice_lang(Config.s_NickServ, u, NICK_X_SUSPENDED, u->Account()->display); return MOD_CONT; } - nc->language = langlist[langnum]; - notice_lang(Config.s_NickServ, u, NICK_SET_LANGUAGE_CHANGED); - return MOD_CONT; - } - CommandReturn DoSetUrl(User *u, const std::vector<ci::string> ¶ms, NickCore *nc) - { - const char *param = params.size() > 1 ? params[1].c_str() : NULL; - - if (nc->url) - delete [] nc->url; + Command *c = this->FindCommand(params[0]); - if (param) + if (c) { - nc->url = sstrdup(param); - notice_lang(Config.s_NickServ, u, NICK_SET_URL_CHANGED, param); + ci::string cmdparams; + for (std::vector<ci::string>::const_iterator it = params.begin() + 1; it != params.end(); ++it) + cmdparams += " " + *it; + if (!cmdparams.empty()) + cmdparams.erase(cmdparams.begin()); + mod_run_cmd(NickServ, u, c, params[0], cmdparams); } else { - nc->url = NULL; - notice_lang(Config.s_NickServ, u, NICK_SET_URL_UNSET); + notice_lang(Config.s_NickServ, u, NICK_SET_UNKNOWN_OPTION, params[0].c_str()); } + return MOD_CONT; } - CommandReturn DoSetEmail(User *u, const std::vector<ci::string> ¶ms, NickCore *nc) + bool OnHelp(User *u, const ci::string &subcommand) { - const char *param = params.size() > 1 ? params[1].c_str() : NULL; - - if (!param && Config.NSForceEmail) - { - notice_lang(Config.s_NickServ, u, NICK_SET_EMAIL_UNSET_IMPOSSIBLE); - return MOD_CONT; - } - else if (param && !MailValidate(param)) - { - notice_lang(Config.s_NickServ, u, MAIL_X_INVALID, param); - return MOD_CONT; - } - - Alog() << Config.s_NickServ << ": " << u->GetMask() << " (e-mail: " << (nc->email ? nc->email : "none") << ") changed its e-mail to " << (param ? param : "none"); - - if (nc->email) - delete [] nc->email; - - if (param) + if (subcommand.empty()) { - nc->email = sstrdup(param); - notice_lang(Config.s_NickServ, u, NICK_SET_EMAIL_CHANGED, param); + notice_help(Config.s_NickServ, u, NICK_HELP_SET_HEAD); + for (std::map<ci::string, Command *>::iterator it = this->subcommands.begin(); it != this->subcommands.end(); ++it) + it->second->OnServHelp(u); + notice_help(Config.s_NickServ, u, NICK_HELP_SET_TAIL); + return true; } else { - nc->email = NULL; - notice_lang(Config.s_NickServ, u, NICK_SET_EMAIL_UNSET); - } - return MOD_CONT; - } - - CommandReturn DoSetICQ(User *u, const std::vector<ci::string> ¶ms, NickCore *nc) - { - const char *param = params.size() > 1 ? params[1].c_str() : NULL; + Command *c = this->FindCommand(subcommand); - if (param) - { - int32 tmp = atol(param); - if (!tmp) - notice_lang(Config.s_NickServ, u, NICK_SET_ICQ_INVALID, param); - else + if (c) { - nc->icq = tmp; - notice_lang(Config.s_NickServ, u, NICK_SET_ICQ_CHANGED, param); + return c->OnHelp(u, subcommand); } } - else - { - nc->icq = 0; - notice_lang(Config.s_NickServ, u, NICK_SET_ICQ_UNSET); - } - return MOD_CONT; + + return false; } - CommandReturn DoSetGreet(User *u, const std::vector<ci::string> ¶ms, NickCore *nc) + void OnSyntaxError(User *u, const ci::string &subcommand) { - const char *param = params.size() > 1 ? params[1].c_str() : NULL; - - if (nc->greet) - delete [] nc->greet; - - if (param) - { - char buf[BUFSIZE]; - const char *rest = params.size() > 2 ? params[2].c_str() : NULL; - - snprintf(buf, sizeof(buf), "%s%s%s", param, rest ? " " : "", rest ? rest : ""); - - nc->greet = sstrdup(buf); - notice_lang(Config.s_NickServ, u, NICK_SET_GREET_CHANGED, buf); - } - else - { - nc->greet = NULL; - notice_lang(Config.s_NickServ, u, NICK_SET_GREET_UNSET); - } - return MOD_CONT; + syntax_error(Config.s_NickServ, u, "SET", NICK_SET_SYNTAX); } - CommandReturn DoSetKill(User *u, const std::vector<ci::string> ¶ms, NickCore *nc) + void OnServHelp(User *u) { - ci::string param = params.size() > 1 ? params[1] : ""; - - if (param.empty()) - { - this->OnSyntaxError(u, "KILL"); - return MOD_CONT; - } - - if (param == "ON") - { - nc->SetFlag(NI_KILLPROTECT); - nc->UnsetFlag(NI_KILL_QUICK); - nc->UnsetFlag(NI_KILL_IMMED); - notice_lang(Config.s_NickServ, u, NICK_SET_KILL_ON); - } - else if (param == "QUICK") - { - nc->SetFlag(NI_KILLPROTECT); - nc->SetFlag(NI_KILL_QUICK); - nc->UnsetFlag(NI_KILL_IMMED); - notice_lang(Config.s_NickServ, u, NICK_SET_KILL_QUICK); - } - else if (param == "IMMED") - { - if (Config.NSAllowKillImmed) - { - nc->SetFlag(NI_KILLPROTECT); - nc->SetFlag(NI_KILL_IMMED); - nc->UnsetFlag(NI_KILL_QUICK); - notice_lang(Config.s_NickServ, u, NICK_SET_KILL_IMMED); - } - else - notice_lang(Config.s_NickServ, u, NICK_SET_KILL_IMMED_DISABLED); - } - else if (param == "OFF") - { - nc->UnsetFlag(NI_KILLPROTECT); - nc->UnsetFlag(NI_KILL_QUICK); - nc->UnsetFlag(NI_KILL_IMMED); - notice_lang(Config.s_NickServ, u, NICK_SET_KILL_OFF); - } - else - syntax_error(Config.s_NickServ, u, "SET KILL", Config.NSAllowKillImmed ? NICK_SET_KILL_IMMED_SYNTAX : NICK_SET_KILL_SYNTAX); - return MOD_CONT; + notice_lang(Config.s_NickServ, u, NICK_HELP_CMD_SET); } - CommandReturn DoSetSecure(User *u, const std::vector<ci::string> ¶ms, NickCore *nc) + bool AddSubcommand(Command *c) { - ci::string param = params.size() > 1 ? params[1] : ""; - - if (param.empty()) - { - this->OnSyntaxError(u, "SECURE"); - return MOD_CONT; - } + return this->subcommands.insert(std::make_pair(c->name, c)).second; + } - if (param == "ON") - { - nc->SetFlag(NI_SECURE); - notice_lang(Config.s_NickServ, u, NICK_SET_SECURE_ON); - } - else if (param == "OFF") - { - nc->UnsetFlag(NI_SECURE); - notice_lang(Config.s_NickServ, u, NICK_SET_SECURE_OFF); - } - else - syntax_error(Config.s_NickServ, u, "SET SECURE", NICK_SET_SECURE_SYNTAX); - return MOD_CONT; + bool DelSubcommand(const ci::string &command) + { + return this->subcommands.erase(command); } - CommandReturn DoSetPrivate(User *u, const std::vector<ci::string> ¶ms, NickCore *nc) + Command *FindCommand(const ci::string &subcommand) { - ci::string param = params.size() > 1 ? params[1] : ""; + std::map<ci::string, Command *>::const_iterator it = this->subcommands.find(subcommand); - if (param.empty()) + if (it != this->subcommands.end()) { - this->OnSyntaxError(u, "PRIVATE"); - return MOD_CONT; + return it->second; } - if (param == "ON") - { - nc->SetFlag(NI_PRIVATE); - notice_lang(Config.s_NickServ, u, NICK_SET_PRIVATE_ON); - } - else if (param == "OFF") - { - nc->UnsetFlag(NI_PRIVATE); - notice_lang(Config.s_NickServ, u, NICK_SET_PRIVATE_OFF); - } - else - syntax_error(Config.s_NickServ, u, "SET PRIVATE", NICK_SET_PRIVATE_SYNTAX); - return MOD_CONT; + return NULL; } +}; - CommandReturn DoSetMsg(User *u, const std::vector<ci::string> ¶ms, NickCore *nc) +class CommandNSSetDisplay : public Command +{ + public: + CommandNSSetDisplay(const ci::string &cname) : Command(cname, 1) { - ci::string param = params.size() > 1 ? params[1] : ""; + } - if (param.empty()) - { - this->OnSyntaxError(u, "MSG"); - return MOD_CONT; - } + CommandReturn Execute(User *u, const std::vector<ci::string> ¶ms) + { + NickAlias *na = findnick(params[0]); - if (!Config.UsePrivmsg) + if (!na || na->nc != u->Account()) { - notice_lang(Config.s_NickServ, u, NICK_SET_OPTION_DISABLED, "MSG"); + notice_lang(Config.s_NickServ, u, NICK_SET_DISPLAY_INVALID); return MOD_CONT; } - if (param == "ON") - { - nc->SetFlag(NI_MSG); - notice_lang(Config.s_NickServ, u, NICK_SET_MSG_ON); - } - else if (param == "OFF") - { - nc->UnsetFlag(NI_MSG); - notice_lang(Config.s_NickServ, u, NICK_SET_MSG_OFF); - } - else - syntax_error(Config.s_NickServ, u, "SET MSG", NICK_SET_MSG_SYNTAX); + change_core_display(u->Account(), params[0].c_str()); + notice_lang(Config.s_NickServ, u, NICK_SET_DISPLAY_CHANGED, u->Account()->display); return MOD_CONT; } - CommandReturn DoSetHide(User *u, const std::vector<ci::string> ¶ms, NickCore *nc) + bool OnHelp(User *u, const ci::string &) { - ci::string param = params.size() > 1 ? params[1] : ""; - - if (param.empty()) - { - this->OnSyntaxError(u, "HIDE"); - return MOD_CONT; - } + notice_help(Config.s_NickServ, u, NICK_HELP_SET_DISPLAY); + return true; + } - int onmsg, offmsg; - NickCoreFlag flag; + void OnSyntaxError(User *u, const ci::string &) + { + // XXX + syntax_error(Config.s_NickServ, u, "SET", NICK_SET_SYNTAX); + } - if (param == "EMAIL") - { - flag = NI_HIDE_EMAIL; - onmsg = NICK_SET_HIDE_EMAIL_ON; - offmsg = NICK_SET_HIDE_EMAIL_OFF; - } - else if (param == "USERMASK") - { - flag = NI_HIDE_MASK; - onmsg = NICK_SET_HIDE_MASK_ON; - offmsg = NICK_SET_HIDE_MASK_OFF; - } - else if (param == "STATUS") - { - flag = NI_HIDE_STATUS; - onmsg = NICK_SET_HIDE_STATUS_ON; - offmsg = NICK_SET_HIDE_STATUS_OFF; - } - else if (param == "QUIT") - { - flag = NI_HIDE_QUIT; - onmsg = NICK_SET_HIDE_QUIT_ON; - offmsg = NICK_SET_HIDE_QUIT_OFF; - } - else - { - syntax_error(Config.s_NickServ, u, "SET HIDE", NICK_SET_HIDE_SYNTAX); - return MOD_CONT; - } + void OnServHelp(User *u) + { + notice_lang(Config.s_NickServ, u, NICK_HELP_CMD_SET_DISPLAY); + } +}; - param = params.size() > 2 ? params[2] : ""; - if (param.empty()) - syntax_error(Config.s_NickServ, u, "SET HIDE", NICK_SET_HIDE_SYNTAX); - else if (param == "ON") - { - nc->SetFlag(flag); - notice_lang(Config.s_NickServ, u, onmsg, Config.s_NickServ); - } - else if (param == "OFF") - { - nc->UnsetFlag(flag); - notice_lang(Config.s_NickServ, u, offmsg, Config.s_NickServ); - } - else - syntax_error(Config.s_NickServ, u, "SET HIDE", NICK_SET_HIDE_SYNTAX); - return MOD_CONT; +class CommandNSSetPassword : public Command +{ + public: + CommandNSSetPassword(const ci::string &cname) : Command(cname, 1) + { } - CommandReturn DoSetAutoOP(User *u, const std::vector<ci::string> ¶ms, NickCore *nc) + CommandReturn Execute(User *u, const std::vector<ci::string> ¶ms) { - ci::string param = params.size() > 1 ? params[1] : ""; + ci::string param = params[0]; - if (param.empty()) - { - this->OnSyntaxError(u, "AUTOOP"); - return MOD_CONT; - } + int len = param.size(); - /** - * This works the other way around, the absence of this flag denotes ON - * This is so when people upgrade, and dont have the flag - * the default is on - **/ - if (param == "ON") + if (u->Account()->display == param || (Config.StrictPasswords && len < 5)) { - nc->SetFlag(NI_AUTOOP); - notice_lang(Config.s_NickServ, u, NICK_SET_AUTOOP_ON); + notice_lang(Config.s_NickServ, u, MORE_OBSCURE_PASSWORD); + return MOD_CONT; } - else if (param == "OFF") + else if (len > Config.PassLen) { - nc->UnsetFlag(NI_AUTOOP); - notice_lang(Config.s_NickServ, u, NICK_SET_AUTOOP_OFF); + notice_lang(Config.s_NickServ, u, PASSWORD_TOO_LONG); + return MOD_CONT; } - else - syntax_error(Config.s_NickServ, u, "SET AUTOOP", NICK_SET_AUTOOP_SYNTAX); - return MOD_CONT; - } - public: - CommandNSSet() : Command("SET", 1, 3) - { - } - - CommandReturn Execute(User *u, const std::vector<ci::string> ¶ms) - { - ci::string cmd = params[0]; - - if (readonly) + std::string buf = param.c_str(); /* conversion from ci::string to std::string */ + if (enc_encrypt(buf, u->Account()->pass) < 0) { - notice_lang(Config.s_NickServ, u, NICK_SET_DISABLED); + Alog() << Config.s_NickServ << ": Failed to encrypt password for " << u->Account()->display << " (set)"; + notice_lang(Config.s_NickServ, u, NICK_SET_PASSWORD_FAILED); return MOD_CONT; } -/* - if (na->HasFlag(NS_FORBIDDEN)) - notice_lang(Config.s_NickServ, u, NICK_X_FORBIDDEN, na->nick); -*/ - if (u->Account()->HasFlag(NI_SUSPENDED)) - notice_lang(Config.s_NickServ, u, NICK_X_SUSPENDED, u->Account()->display); - else if (cmd == "DISPLAY") - return this->DoSetDisplay(u, params, u->Account()); - else if (cmd == "PASSWORD") - return this->DoSetPassword(u, params, u->Account()); - else if (cmd == "LANGUAGE") - return this->DoSetLanguage(u, params, u->Account()); - else if (cmd == "URL") - return this->DoSetUrl(u, params, u->Account()); - else if (cmd == "EMAIL") - return this->DoSetEmail(u, params, u->Account()); - else if (cmd == "ICQ") - return this->DoSetICQ(u, params, u->Account()); - else if (cmd == "GREET") - return this->DoSetGreet(u, params, u->Account()); - else if (cmd == "KILL") - return this->DoSetKill(u, params, u->Account()); - else if (cmd == "SECURE") - return this->DoSetSecure(u, params, u->Account()); - else if (cmd == "PRIVATE") - return this->DoSetPrivate(u, params, u->Account()); - else if (cmd == "MSG") - return this->DoSetMsg(u, params, u->Account()); - else if (cmd == "HIDE") - return this->DoSetHide(u, params, u->Account()); - else if (cmd == "AUTOOP") - return this->DoSetAutoOP(u, params, u->Account()); + std::string tmp_pass; + if (enc_decrypt(u->Account()->pass, tmp_pass) == 1) + notice_lang(Config.s_NickServ, u, NICK_SET_PASSWORD_CHANGED_TO, tmp_pass.c_str()); else - notice_lang(Config.s_NickServ, u, NICK_SET_UNKNOWN_OPTION, cmd.c_str()); + notice_lang(Config.s_NickServ, u, NICK_SET_PASSWORD_CHANGED); + + Alog() << Config.s_NickServ << ": " << u->GetMask() << " (e-mail: " << (u->Account()->email ? u->Account()->email : "none") << ") changed its password."; return MOD_CONT; } - bool OnHelp(User *u, const ci::string &subcommand) + bool OnHelp(User *u, const ci::string &) { - if (subcommand.empty()) - notice_help(Config.s_NickServ, u, NICK_HELP_SET); - else if (subcommand == "DISPLAY") - notice_help(Config.s_NickServ, u, NICK_HELP_SET_DISPLAY); - else if (subcommand == "PASSWORD") - notice_help(Config.s_NickServ, u, NICK_HELP_SET_PASSWORD); - else if (subcommand == "URL") - notice_help(Config.s_NickServ, u, NICK_HELP_SET_URL); - else if (subcommand == "EMAIL") - notice_help(Config.s_NickServ, u, NICK_HELP_SET_EMAIL); - else if (subcommand == "ICQ") - notice_help(Config.s_NickServ, u, NICK_HELP_SET_ICQ); - else if (subcommand == "GREET") - notice_help(Config.s_NickServ, u, NICK_HELP_SET_GREET); - else if (subcommand == "KILL") - notice_help(Config.s_NickServ, u, NICK_HELP_SET_KILL); - else if (subcommand == "SECURE") - notice_help(Config.s_NickServ, u, NICK_HELP_SET_SECURE); - else if (subcommand == "PRIVATE") - notice_help(Config.s_NickServ, u, NICK_HELP_SET_PRIVATE); - else if (subcommand == "MSG") - notice_help(Config.s_NickServ, u, NICK_HELP_SET_MSG); - else if (subcommand == "HIDE") - notice_help(Config.s_NickServ, u, NICK_HELP_SET_HIDE); - else if (subcommand == "AUTOOP") - notice_help(Config.s_NickServ, u, NICK_HELP_SET_AUTOOP); - else - return false; - + notice_help(Config.s_NickServ, u, NICK_HELP_SET_PASSWORD); return true; } - void OnSyntaxError(User *u, const ci::string &subcommand) + void OnSyntaxError(User *u, const ci::string &) { + // XXX syntax_error(Config.s_NickServ, u, "SET", NICK_SET_SYNTAX); } void OnServHelp(User *u) { - notice_lang(Config.s_NickServ, u, NICK_HELP_CMD_SET); + notice_lang(Config.s_NickServ, u, NICK_HELP_CMD_SET_PASSWORD); } }; @@ -537,7 +229,10 @@ class NSSet : public Module this->SetVersion(VERSION_STRING); this->SetType(CORE); - this->AddCommand(NickServ, new CommandNSSet()); + Command *set = new CommandNSSet("SET"); + this->AddCommand(NickServ, set); + set->AddSubcommand(new CommandNSSetDisplay("DISPLAY")); + set->AddSubcommand(new CommandNSSetPassword("PASSWORD")); } }; diff --git a/src/core/ns_set_autoop.cpp b/src/core/ns_set_autoop.cpp new file mode 100644 index 000000000..d1c0d0d81 --- /dev/null +++ b/src/core/ns_set_autoop.cpp @@ -0,0 +1,131 @@ +/* NickServ core functions + * + * (C) 2003-2010 Anope Team + * Contact us at team@anope.org + * + * Please read COPYING and README for further details. + * + * Based on the original code of Epona by Lara. + * Based on the original code of Services by Andy Church. + * + * $Id$ + * + */ +/*************************************************************************/ + +#include "module.h" + +class CommandNSSetAutoOp : public Command +{ + public: + CommandNSSetAutoOp(const ci::string &cname) : Command(cname, 2) + { + } + + CommandReturn Execute(User *u, const std::vector<ci::string> ¶ms) + { + if (params[0] == "ON") + { + u->Account()->SetFlag(NI_AUTOOP); + notice_lang(Config.s_NickServ, u, NICK_SET_AUTOOP_ON); + } + else if (params[0] == "OFF") + { + u->Account()->UnsetFlag(NI_AUTOOP); + notice_lang(Config.s_NickServ, u, NICK_SET_AUTOOP_OFF); + } + else + this->OnSyntaxError(u, "AUTOOP"); + + return MOD_CONT; + } + + bool OnHelp(User *u, const ci::string &) + { + notice_help(Config.s_NickServ, u, NICK_HELP_SET_AUTOOP); + return true; + } + + void OnSyntaxError(User *u, const ci::string &) + { + syntax_error(Config.s_NickServ, u, "SET AUTOOP", NICK_SET_AUTOOP_SYNTAX); + } + + void OnServHelp(User *u) + { + notice_lang(Config.s_NickServ, u, NICK_HELP_CMD_SET_AUTOOP); + } +}; + +class CommandNSSASetAutoOp : public Command +{ + public: + CommandNSSASetAutoOp(const ci::string &cname) : Command(cname, 2, 2, "nickserv/saset/autoop") + { + } + + CommandReturn Execute(User *u, const std::vector<ci::string> ¶ms) + { + NickCore *nc = findcore(params[0]); + assert(nc); + + ci::string param = params[1]; + + if (param == "ON") + { + nc->SetFlag(NI_AUTOOP); + notice_lang(Config.s_NickServ, u, NICK_SASET_AUTOOP_ON, nc->display); + } + else if (param == "OFF") + { + nc->UnsetFlag(NI_AUTOOP); + notice_lang(Config.s_NickServ, u, NICK_SASET_AUTOOP_OFF, nc->display); + } + else + this->OnSyntaxError(u, "AUTOOP"); + + return MOD_CONT; + } + + bool Help(User *u, const ci::string &) + { + notice_help(Config.s_NickServ, u, NICK_HELP_SASET_AUTOOP); + return true; + } + + void OnSyntaxError(User *u, const ci::string &) + { + syntax_error(Config.s_NickServ, u, "SET AUTOOP", NICK_SASET_AUTOOP_SYNTAX); + } + + void OnServHelp(User *u) + { + notice_lang(Config.s_NickServ, u, NICK_HELP_CMD_SASET_AUTOOP); + } +}; + +class NSSetAutoOp : public Module +{ + public: + NSSetAutoOp(const std::string &modname, const std::string &creator) : Module(modname, creator) + { + this->SetAuthor("Anope"); + this->SetVersion("$Id$"); + this->SetType(CORE); + + Command *set = FindCommand(NickServ, "SET"); + + if (set) + set->AddSubcommand(new CommandNSSetAutoOp("AUTOOP")); + } + + ~NSSetAutoOp() + { + Command *set = FindCommand(NickServ, "SET"); + + if (set) + set->DelSubcommand("AUTOOP"); + } +}; + +MODULE_INIT(NSSetAutoOp) diff --git a/src/core/ns_set_email.cpp b/src/core/ns_set_email.cpp new file mode 100644 index 000000000..ec1b78c83 --- /dev/null +++ b/src/core/ns_set_email.cpp @@ -0,0 +1,160 @@ +/* NickServ core functions + * + * (C) 2003-2010 Anope Team + * Contact us at team@anope.org + * + * Please read COPYING and README for further details. + * + * Based on the original code of Epona by Lara. + * Based on the original code of Services by Andy Church. + * + * $Id$ + * + */ +/*************************************************************************/ + +#include "module.h" + +class CommandNSSetEmail : public Command +{ + public: + CommandNSSetEmail(const ci::string &cname) : Command(cname, 0) + { + } + + CommandReturn Execute(User *u, const std::vector<ci::string> ¶ms) + { + if (params.empty() && Config.NSForceEmail) + { + notice_lang(Config.s_NickServ, u, NICK_SET_EMAIL_UNSET_IMPOSSIBLE); + return MOD_CONT; + } + else if (!params.empty() && !MailValidate(params[0].c_str())) + { + notice_lang(Config.s_NickServ, u, MAIL_X_INVALID, params[0].c_str()); + return MOD_CONT; + } + + Alog() << Config.s_NickServ << ": " << u->GetMask() << " (e-mail: " << (u->Account()->email ? u->Account()->email : "none") << ") changed its e-mail to " << (!params.empty() ? params[0] : "none"); + + if (u->Account()->email) + delete [] u->Account()->email; + + if (!params.empty()) + { + u->Account()->email = sstrdup(params[0].c_str()); + notice_lang(Config.s_NickServ, u, NICK_SET_EMAIL_CHANGED, params[0].c_str()); + } + else + { + u->Account()->email = NULL; + notice_lang(Config.s_NickServ, u, NICK_SET_EMAIL_UNSET); + } + + return MOD_CONT; + } + + bool OnHelp(User *u, const ci::string &) + { + notice_help(Config.s_NickServ, u, NICK_HELP_SET_EMAIL); + return true; + } + + void OnServHelp(User *u) + { + notice_lang(Config.s_NickServ, u, NICK_HELP_CMD_SET_EMAIL); + } +}; + +class CommandNSSASetEmail : public Command +{ + public: + CommandNSSASetEmail(const ci::string &cname) : Command(cname, 1, 2, "nickserv/saset/email") + { + } + + CommandReturn Execute(User *u, const std::vector<ci::string> ¶ms) + { + NickCore *nc = findcore(params[0]); + assert(nc); + + const char *param = params.size() > 1 ? params[1].c_str() : NULL; + + if (!param && Config.NSForceEmail) + { + notice_lang(Config.s_NickServ, u, NICK_SASET_EMAIL_UNSET_IMPOSSIBLE); + return MOD_CONT; + } + else if (Config.NSSecureAdmins && u->Account() != nc && nc->IsServicesOper()) + { + notice_lang(Config.s_NickServ, u, ACCESS_DENIED); + return MOD_CONT; + } + else if (param && !MailValidate(param)) + { + notice_lang(Config.s_NickServ, u, MAIL_X_INVALID, param); + return MOD_CONT; + } + + Alog() << Config.s_NickServ << ": " << u->GetMask() << " used SASET EMAIL on " << nc->display << " (e-mail: " << (nc->email ? nc->email : "none") << ")"; + + if (nc->email) + delete [] nc->email; + + if (param) + { + nc->email = sstrdup(param); + notice_lang(Config.s_NickServ, u, NICK_SASET_EMAIL_CHANGED, nc->display, param); + } + else + { + nc->email = NULL; + notice_lang(Config.s_NickServ, u, NICK_SASET_EMAIL_UNSET, nc->display); + } + + return MOD_CONT; + } + + bool OnHelp(User *u) + { + notice_help(Config.s_NickServ, u, NICK_HELP_SASET_EMAIL); + return true; + } + + void OnServHelp(User *u) + { + notice_lang(Config.s_NickServ, u, NICK_HELP_CMD_SASET_EMAIL); + } +}; + +class NSSetEmail : public Module +{ + public: + NSSetEmail(const std::string &modname, const std::string &creator) : Module(modname, creator) + { + this->SetAuthor("Anope"); + this->SetVersion("$Id$"); + this->SetType(CORE); + + Command *c = FindCommand(NickServ, "SET"); + if (c) + c->AddSubcommand(new CommandNSSetEmail("EMAIL")); + + c = FindCommand(NickServ, "SASET"); + if (c) + c->AddSubcommand(new CommandNSSASetEmail("EMAIL")); + } + + ~NSSetEmail() + { + Command *c = FindCommand(NickServ, "SET"); + if (c) + c->DelSubcommand("EMAIL"); + + c = FindCommand(NickServ, "SASET"); + if (c) + c->DelSubcommand("EMAIL"); + } +}; + +MODULE_INIT(NSSetEmail) diff --git a/src/core/ns_set_greet.cpp b/src/core/ns_set_greet.cpp new file mode 100644 index 000000000..0a1e94547 --- /dev/null +++ b/src/core/ns_set_greet.cpp @@ -0,0 +1,129 @@ +/* NickServ core functions + * + * (C) 2003-2010 Anope Team + * Contact us at team@anope.org + * + * Please read COPYING and README for further details. + * + * Based on the original code of Epona by Lara. + * Based on the original code of Services by Andy Church. + * + * $Id$ + * + */ +/*************************************************************************/ + +#include "module.h" + +class CommandNSSetGreet : public Command +{ + public: + CommandNSSetGreet(const ci::string &cname) : Command(cname, 0) + { + } + + CommandReturn Execute(User *u, const std::vector<ci::string> ¶ms) + { + if (u->Account()->greet) + delete [] u->Account()->greet; + + if (!params.empty()) + { + u->Account()->greet = sstrdup(params[0].c_str()); + notice_lang(Config.s_NickServ, u, NICK_SET_GREET_CHANGED, u->Account()->greet); + } + else + { + u->Account()->greet = NULL; + notice_lang(Config.s_NickServ, u, NICK_SET_GREET_UNSET); + } + + return MOD_CONT; + } + + bool OnHelp(User *u, const ci::string &) + { + notice_help(Config.s_NickServ, u, NICK_HELP_SET_GREET); + return true; + } + + void OnServHelp(User *u) + { + notice_lang(Config.s_NickServ, u, NICK_HELP_CMD_SET_GREET); + } +}; + +class CommandNSSASetGreet : public Command +{ + public: + CommandNSSASetGreet(const ci::string &cname) : Command(cname, 1, 2, "nickserv/saset/greet") + { + } + + CommandReturn Execute(User *u, const std::vector<ci::string> ¶ms) + { + NickCore *nc = findcore(params[0]); + assert(nc); + + const char *param = params.size() > 1 ? params[1].c_str() : NULL; + + if (nc->greet) + delete [] nc->greet; + + if (param) + { + nc->greet = sstrdup(param); + notice_lang(Config.s_NickServ, u, NICK_SASET_GREET_CHANGED, nc->display, nc->greet); + } + else + { + nc->greet = NULL; + notice_lang(Config.s_NickServ, u, NICK_SASET_GREET_UNSET, nc->display); + } + + return MOD_CONT; + } + + bool OnHelp(User *u, const ci::string &) + { + notice_help(Config.s_NickServ, u, NICK_HELP_SASET_GREET); + return true; + } + + void OnServHelp(User *u) + { + notice_lang(Config.s_NickServ, u, NICK_HELP_CMD_SASET_GREET); + } +}; + +class NSSetGreet : public Module +{ + public: + NSSetGreet(const std::string &modname, const std::string &creator) : Module(modname, creator) + { + this->SetAuthor("Anope"); + this->SetVersion("$Id$"); + this->SetType(CORE); + + Command *c = FindCommand(NickServ, "SET"); + if (c) + c->AddSubcommand(new CommandNSSetGreet("GREET")); + + c = FindCommand(NickServ, "SASET"); + if (c) + c->AddSubcommand(new CommandNSSASetGreet("GREET")); + } + + ~NSSetGreet() + { + Command *c = FindCommand(NickServ, "SET"); + if (c) + c->DelSubcommand("GREET"); + + c = FindCommand(NickServ, "SASET"); + if (c) + c->DelSubcommand("GREET"); + } +}; + +MODULE_INIT(NSSetGreet) diff --git a/src/core/ns_set_hide.cpp b/src/core/ns_set_hide.cpp new file mode 100644 index 000000000..e17fac21f --- /dev/null +++ b/src/core/ns_set_hide.cpp @@ -0,0 +1,200 @@ +/* NickServ core functions + * + * (C) 2003-2010 Anope Team + * Contact us at team@anope.org + * + * Please read COPYING and README for further details. + * + * Based on the original code of Epona by Lara. + * Based on the original code of Services by Andy Church. + * + * $Id$ + * + */ +/*************************************************************************/ + +#include "module.h" + +class CommandNSSetHide : public Command +{ + public: + CommandNSSetHide(const ci::string &cname) : Command(cname, 2) + { + } + + CommandReturn Execute(User *u, const std::vector<ci::string> ¶ms) + { + int onmsg, offmsg; + NickCoreFlag flag; + + if (params[0] == "EMAIL") + { + flag = NI_HIDE_EMAIL; + onmsg = NICK_SET_HIDE_EMAIL_ON; + offmsg = NICK_SET_HIDE_EMAIL_OFF; + } + else if (params[0] == "USERMASK") + { + flag = NI_HIDE_MASK; + onmsg = NICK_SET_HIDE_MASK_ON; + offmsg = NICK_SET_HIDE_MASK_OFF; + } + else if (params[0] == "STATUS") + { + flag = NI_HIDE_STATUS; + onmsg = NICK_SET_HIDE_STATUS_ON; + offmsg = NICK_SET_HIDE_STATUS_OFF; + } + else if (params[0] == "QUIT") + { + flag = NI_HIDE_QUIT; + onmsg = NICK_SET_HIDE_QUIT_ON; + offmsg = NICK_SET_HIDE_QUIT_OFF; + } + else + { + this->OnSyntaxError(u, "HIDE"); + return MOD_CONT; + } + + if (params[1] == "ON") + { + u->Account()->SetFlag(flag); + notice_lang(Config.s_NickServ, u, onmsg, Config.s_NickServ); + } + else if (params[1] == "OFF") + { + u->Account()->UnsetFlag(flag); + notice_lang(Config.s_NickServ, u, offmsg, Config.s_NickServ); + } + else + this->OnSyntaxError(u, "HIDE"); + + return MOD_CONT; + } + + bool OnHelp(User *u, const ci::string &) + { + notice_help(Config.s_NickServ, u, NICK_HELP_SET_HIDE); + return true; + } + + void OnSyntaxError(User *u, const ci::string &) + { + syntax_error(Config.s_NickServ, u, "SET HIDE", NICK_SET_HIDE_SYNTAX); + } + + void OnServHelp(User *u) + { + notice_lang(Config.s_NickServ, u, NICK_HELP_CMD_SET_HIDE); + } +}; + +class CommandNSSASetHide : public Command +{ + public: + CommandNSSASetHide(const ci::string &cname) : Command(cname, 3, 3, "nickserv/saset/command") + { + } + + CommandReturn Execute(User *u, const std::vector<ci::string> ¶ms) + { + NickCore *nc = findcore(params[0]); + assert(nc); + + ci::string param = params[1]; + + int onmsg, offmsg; + NickCoreFlag flag; + + if (param == "EMAIL") + { + flag = NI_HIDE_EMAIL; + onmsg = NICK_SASET_HIDE_EMAIL_ON; + offmsg = NICK_SASET_HIDE_EMAIL_OFF; + } + else if (param == "USERMASK") + { + flag = NI_HIDE_MASK; + onmsg = NICK_SASET_HIDE_MASK_ON; + offmsg = NICK_SASET_HIDE_MASK_OFF; + } + else if (param == "STATUS") + { + flag = NI_HIDE_STATUS; + onmsg = NICK_SASET_HIDE_STATUS_ON; + offmsg = NICK_SASET_HIDE_STATUS_OFF; + } + else if (param == "QUIT") + { + flag = NI_HIDE_QUIT; + onmsg = NICK_SASET_HIDE_QUIT_ON; + offmsg = NICK_SASET_HIDE_QUIT_OFF; + } + else + { + this->OnSyntaxError(u, "HIDE"); + return MOD_CONT; + } + + param = params[2]; + if (param.empty()) + this->OnSyntaxError(u, "HIDE"); + else if (param == "ON") + { + nc->SetFlag(flag); + notice_lang(Config.s_NickServ, u, onmsg, nc->display, Config.s_NickServ); + } + else if (param == "OFF") + { + nc->UnsetFlag(flag); + notice_lang(Config.s_NickServ, u, offmsg, nc->display, Config.s_NickServ); + } + else + this->OnSyntaxError(u, "HIDE"); + + return MOD_CONT; + } + + bool OnHelp(User *u, const ci::string &) + { + notice_help(Config.s_NickServ, u, NICK_HELP_SASET_HIDE); + return true; + } + + void OnSyntaxError(User *u, const ci::string &) + { + syntax_error(Config.s_NickServ, u, "SASET HIDE", NICK_SASET_HIDE_SYNTAX); + } + + void OnServHelp(User *u) + { + notice_lang(Config.s_NickServ, u, NICK_HELP_CMD_SASET_HIDE); + } +}; + +class NSSetHide : public Module +{ + public: + NSSetHide(const std::string &modname, const std::string &creator) : Module(modname, creator) + { + this->SetAuthor("Anope"); + this->SetVersion("$Id$"); + this->SetType(CORE); + + Command *set = FindCommand(NickServ, "SET"); + + if (set) + set->AddSubcommand(new CommandNSSetHide("HIDE")); + } + + ~NSSetHide() + { + Command *set = FindCommand(NickServ, "SET"); + + if (set) + set->DelSubcommand("HIDE"); + } +}; + +MODULE_INIT(NSSetHide) diff --git a/src/core/ns_set_icq.cpp b/src/core/ns_set_icq.cpp new file mode 100644 index 000000000..a00810bac --- /dev/null +++ b/src/core/ns_set_icq.cpp @@ -0,0 +1,136 @@ +/* NickServ core functions + * + * (C) 2003-2010 Anope Team + * Contact us at team@anope.org + * + * Please read COPYING and README for further details. + * + * Based on the original code of Epona by Lara. + * Based on the original code of Services by Andy Church. + * + * $Id$ + * + */ +/*************************************************************************/ + +#include "module.h" + +class CommandNSSetICQ : public Command +{ + public: + CommandNSSetICQ(const ci::string &cname) : Command(cname, 0) + { + } + + CommandReturn Execute(User *u, const std::vector<ci::string> ¶ms) + { + if (!params.empty()) + { + int32 tmp = atol(params[0].c_str()); + if (!tmp) + notice_lang(Config.s_NickServ, u, NICK_SET_ICQ_INVALID, params[0].c_str()); + else + { + u->Account()->icq = tmp; + notice_lang(Config.s_NickServ, u, NICK_SET_ICQ_CHANGED, params[0].c_str()); + } + } + else + { + u->Account()->icq = 0; + notice_lang(Config.s_NickServ, u, NICK_SET_ICQ_UNSET); + } + + return MOD_CONT; + } + + bool OnHelp(User *u, const ci::string &) + { + notice_help(Config.s_NickServ, u, NICK_HELP_SET_ICQ); + return true; + } + + void OnServHelp(User *u) + { + notice_lang(Config.s_NickServ, u, NICK_HELP_CMD_SET_ICQ); + } +}; + +class CommandNSSASetICQ : public Command +{ + public: + CommandNSSASetICQ(const ci::string &cname) : Command(cname, 1, 2, "nickserv/saset/icq") + { + } + + CommandReturn Execute(User *u, const std::vector<ci::string> ¶ms) + { + NickCore *nc = findcore(params[0]); + assert(nc); + + const char *param = params.size() > 1 ? params[1].c_str() : NULL; + + if (param) + { + int32 tmp = atol(param); + + if (tmp) + notice_lang(Config.s_NickServ, u, NICK_SASET_ICQ_INVALID, param); + else + { + nc->icq = tmp; + notice_lang(Config.s_NickServ, u, NICK_SASET_ICQ_CHANGED, nc->display, param); + } + } + else + { + nc->icq = 0; + notice_lang(Config.s_NickServ, u, NICK_SASET_ICQ_UNSET, nc->display); + } + + return MOD_CONT; + } + + bool OnHelp(User *u, const ci::string &) + { + notice_help(Config.s_NickServ, u, NICK_HELP_SASET_ICQ); + return true; + } + + void OnServHelp(User *u) + { + notice_lang(Config.s_NickServ, u, NICK_HELP_CMD_SASET_ICQ); + } +}; + +class NSSetICQ : public Module +{ + public: + NSSetICQ(const std::string &modname, const std::string &creator) : Module(modname, creator) + { + this->SetAuthor("Anope"); + this->SetVersion("$Id$"); + this->SetType(CORE); + + Command *c = FindCommand(NickServ, "SET"); + if (c) + c->AddSubcommand(new CommandNSSetICQ("ICQ")); + + c = FindCommand(NickServ, "SASET"); + if (c) + c->AddSubcommand(new CommandNSSASetICQ("ICQ")); + } + + ~NSSetICQ() + { + Command *c = FindCommand(NickServ, "SET"); + if (c) + c->DelSubcommand("ICQ"); + + c = FindCommand(NickServ, "SASET"); + if (c) + c->DelSubcommand("ICQ"); + } +}; + +MODULE_INIT(NSSetICQ) diff --git a/src/core/ns_set_kill.cpp b/src/core/ns_set_kill.cpp new file mode 100644 index 000000000..d9d6caa7c --- /dev/null +++ b/src/core/ns_set_kill.cpp @@ -0,0 +1,183 @@ +/* NickServ core functions + * + * (C) 2003-2010 Anope Team + * Contact us at team@anope.org + * + * Please read COPYING and README for further details. + * + * Based on the original code of Epona by Lara. + * Based on the original code of Services by Andy Church. + * + * $Id$ + * + */ +/*************************************************************************/ + +#include "module.h" + +class CommandNSSetKill : public Command +{ + public: + CommandNSSetKill(const ci::string &cname) : Command(cname, 1) + { + } + + CommandReturn Execute(User *u, const std::vector<ci::string> ¶ms) + { + if (params[0] == "ON") + { + u->Account()->SetFlag(NI_KILLPROTECT); + u->Account()->UnsetFlag(NI_KILL_QUICK); + u->Account()->UnsetFlag(NI_KILL_IMMED); + notice_lang(Config.s_NickServ, u, NICK_SET_KILL_ON); + } + else if (params[0] == "QUICK") + { + u->Account()->SetFlag(NI_KILLPROTECT); + u->Account()->SetFlag(NI_KILL_QUICK); + u->Account()->UnsetFlag(NI_KILL_IMMED); + notice_lang(Config.s_NickServ, u, NICK_SET_KILL_QUICK); + } + else if (params[0] == "IMMED") + { + if (Config.NSAllowKillImmed) + { + u->Account()->SetFlag(NI_KILLPROTECT); + u->Account()->SetFlag(NI_KILL_IMMED); + u->Account()->UnsetFlag(NI_KILL_QUICK); + notice_lang(Config.s_NickServ, u, NICK_SET_KILL_IMMED); + } + else + notice_lang(Config.s_NickServ, u, NICK_SET_KILL_IMMED_DISABLED); + } + else if (params[0] == "OFF") + { + u->Account()->UnsetFlag(NI_KILLPROTECT); + u->Account()->UnsetFlag(NI_KILL_QUICK); + u->Account()->UnsetFlag(NI_KILL_IMMED); + notice_lang(Config.s_NickServ, u, NICK_SET_KILL_OFF); + } + else + this->OnSyntaxError(u, "KILL"); + + return MOD_CONT; + } + + bool OnHelp(User *u, const ci::string &) + { + notice_help(Config.s_NickServ, u, NICK_HELP_SET_KILL); + return true; + } + + void OnSyntaxError(User *u, const ci::string &) + { + syntax_error(Config.s_NickServ, u, "SET KILL", Config.NSAllowKillImmed ? NICK_SET_KILL_IMMED_SYNTAX : NICK_SET_KILL_SYNTAX); + } + + void OnServHelp(User *u) + { + notice_lang(Config.s_NickServ, u, NICK_HELP_CMD_SET_KILL); + } +}; + +class CommandNSSASetKill : public Command +{ + public: + CommandNSSASetKill(const ci::string &cname) : Command(cname, 2, 2, "nickserv/saset/kill") + { + } + + CommandReturn Execute(User *u, const std::vector<ci::string> ¶ms) + { + NickCore *nc = findcore(params[0]); + assert(nc); + + ci::string param = params[1]; + + if (param == "ON") + { + nc->SetFlag(NI_KILLPROTECT); + nc->UnsetFlag(NI_KILL_QUICK); + nc->UnsetFlag(NI_KILL_IMMED); + notice_lang(Config.s_NickServ, u, NICK_SASET_KILL_ON, nc->display); + } + else if (param == "QUICK") + { + nc->SetFlag(NI_KILLPROTECT); + nc->SetFlag(NI_KILL_QUICK); + nc->UnsetFlag(NI_KILL_IMMED); + notice_lang(Config.s_NickServ, u, NICK_SASET_KILL_QUICK, nc->display); + } + else if (param == "IMMED") + { + if (Config.NSAllowKillImmed) + { + nc->SetFlag(NI_KILLPROTECT); + nc->SetFlag(NI_KILL_IMMED); + nc->UnsetFlag(NI_KILL_QUICK); + notice_lang(Config.s_NickServ, u, NICK_SASET_KILL_IMMED, nc->display); + } + else + notice_lang(Config.s_NickServ, u, NICK_SASET_KILL_IMMED_DISABLED); + } + else if (param == "OFF") + { + nc->UnsetFlag(NI_KILLPROTECT); + nc->UnsetFlag(NI_KILL_QUICK); + nc->UnsetFlag(NI_KILL_IMMED); + notice_lang(Config.s_NickServ, u, NICK_SASET_KILL_OFF, nc->display); + } + else + this->OnSyntaxError(u, "KILL"); + + return MOD_CONT; + } + + bool OnHelp(User *u, const ci::string &) + { + notice_help(Config.s_NickServ, u, NICK_HELP_SASET_KILL); + return true; + } + + void OnSyntaxError(User *u, const ci::string &) + { + syntax_error(Config.s_NickServ, u, "SASET KILL", Config.NSAllowKillImmed ? NICK_SASET_KILL_IMMED_SYNTAX : NICK_SASET_KILL_SYNTAX); + } + + void OnServHelp(User *u) + { + notice_lang(Config.s_NickServ, u, NICK_HELP_CMD_SASET_KILL); + } +}; + +class NSSetKill : public Module +{ + public: + NSSetKill(const std::string &modname, const std::string &creator) : Module(modname, creator) + { + this->SetAuthor("Anope"); + this->SetVersion("$Id$"); + this->SetType(CORE); + + Command *c = FindCommand(NickServ, "SET"); + if (c) + c->AddSubcommand(new CommandNSSetKill("KILL")); + + c = FindCommand(NickServ, "SASET"); + if (c) + c->AddSubcommand(new CommandNSSASetKill("KILL")); + } + + ~NSSetKill() + { + Command *c = FindCommand(NickServ, "SET"); + if (c) + c->DelSubcommand("KILL"); + + c = FindCommand(NickServ, "SASET"); + if (c) + c->DelSubcommand("KILL"); + } +}; + +MODULE_INIT(NSSetKill) diff --git a/src/core/ns_set_language.cpp b/src/core/ns_set_language.cpp new file mode 100644 index 000000000..a175f91a7 --- /dev/null +++ b/src/core/ns_set_language.cpp @@ -0,0 +1,143 @@ +/* NickServ core functions + * + * (C) 2003-2010 Anope Team + * Contact us at team@anope.org + * + * Please read COPYING and README for further details. + * + * Based on the original code of Epona by Lara. + * Based on the original code of Services by Andy Church. + * + * $Id$ + * + */ +/*************************************************************************/ + +#include "module.h" + +class CommandNSSetLanguage : public Command +{ + public: + CommandNSSetLanguage(const ci::string &cname) : Command(cname, 1) + { + } + + CommandReturn Execute(User *u, const std::vector<ci::string> ¶ms) + { + const char *param = params[0].c_str(); + + if (param[strspn(param, "0123456789")]) /* i.e. not a number */ + { + this->OnSyntaxError(u, ""); + return MOD_CONT; + } + + int langnum = atoi(param) - 1; + if (langnum < 0 || langnum >= NUM_LANGS || langlist[langnum] < 0) + { + notice_lang(Config.s_NickServ, u, NICK_SET_LANGUAGE_UNKNOWN, langnum + 1, Config.s_NickServ); + return MOD_CONT; + } + + u->Account()->language = langlist[langnum]; + notice_lang(Config.s_NickServ, u, NICK_SET_LANGUAGE_CHANGED); + + return MOD_CONT; + } + + bool OnHelp(User *u, const ci::string &) + { + notice_help(Config.s_NickServ, u, NICK_HELP_SET_LANGUAGE); + return true; + } + + void OnSyntaxError(User *u, const ci::string &) + { + syntax_error(Config.s_NickServ, u, "SET LANGUAGE", NICK_SET_LANGUAGE_SYNTAX); + } + + void OnServHelp(User *u) + { + notice_lang(Config.s_NickServ, u, NICK_HELP_CMD_SET_LANGUAGE); + } +}; + +class CommandNSSASetLanguage : public Command +{ + public: + CommandNSSASetLanguage(const ci::string &cname) : Command(cname, 2, 2, "nickserv/saset/language") + { + } + + CommandReturn Execute(User *u, const std::vector<ci::string> ¶ms) + { + NickCore *nc = findcore(params[0]); + assert(nc); + + const char *param = params[1].c_str(); + + if (param[strspn(param, "0123456789")]) /* i.e. not a number */ + { + this->OnSyntaxError(u, "LANGUAGE"); + return MOD_CONT; + } + int langnum = atoi(param) - 1; + if (langnum < 0 || langnum >= NUM_LANGS || langlist[langnum] < 0) + { + notice_lang(Config.s_NickServ, u, NICK_SASET_LANGUAGE_UNKNOWN, langnum + 1, Config.s_NickServ); + return MOD_CONT; + } + nc->language = langlist[langnum]; + notice_lang(Config.s_NickServ, u, NICK_SASET_LANGUAGE_CHANGED); + + return MOD_CONT; + } + + bool OnHelp(User *u, const ci::string &) + { + notice_help(Config.s_NickServ, u, NICK_HELP_SASET_LANGUAGE); + return true; + } + + void OnSyntaxError(User *u, const ci::string &) + { + syntax_error(Config.s_NickServ, u, "SASET LANGUAGE", NICK_SASET_LANGUAGE_SYNTAX); + } + + void OnServHelp(User *u) + { + notice_lang(Config.s_NickServ, u, NICK_HELP_CMD_SASET_LANGUAGE); + } +}; + +class NSSetLanguage : public Module +{ + public: + NSSetLanguage(const std::string &modname, const std::string &creator) : Module(modname, creator) + { + this->SetAuthor("Anope"); + this->SetVersion("$Id$"); + this->SetType(CORE); + + Command *c = FindCommand(NickServ, "SET"); + if (c) + c->AddSubcommand(new CommandNSSetLanguage("LANGUAGE")); + + c = FindCommand(NickServ, "SASET"); + if (c) + c->AddSubcommand(new CommandNSSASetLanguage("LANGUAGE")); + } + + ~NSSetLanguage() + { + Command *c = FindCommand(NickServ, "SET"); + if (c) + c->DelSubcommand("LANGUAGE"); + + c = FindCommand(NickServ, "SASET"); + if (c) + c->DelSubcommand("LANGUAGE"); + } +}; + +MODULE_INIT(NSSetLanguage) diff --git a/src/core/ns_set_message.cpp b/src/core/ns_set_message.cpp new file mode 100644 index 000000000..89f3cca0a --- /dev/null +++ b/src/core/ns_set_message.cpp @@ -0,0 +1,149 @@ +/* NickServ core functions + * + * (C) 2003-2010 Anope Team + * Contact us at team@anope.org + * + * Please read COPYING and README for further details. + * + * Based on the original code of Epona by Lara. + * Based on the original code of Services by Andy Church. + * + * $Id$ + * + */ +/*************************************************************************/ + +#include "module.h" + +class CommandNSSetMessage : public Command +{ + public: + CommandNSSetMessage(const ci::string &cname) : Command(cname, 1) + { + } + + CommandReturn Execute(User *u, const std::vector<ci::string> ¶ms) + { + if (!Config.UsePrivmsg) + { + notice_lang(Config.s_NickServ, u, NICK_SET_OPTION_DISABLED, "MSG"); + return MOD_CONT; + } + + if (params[0] == "ON") + { + u->Account()->SetFlag(NI_MSG); + notice_lang(Config.s_NickServ, u, NICK_SET_MSG_ON); + } + else if (params[0] == "OFF") + { + u->Account()->UnsetFlag(NI_MSG); + notice_lang(Config.s_NickServ, u, NICK_SET_MSG_OFF); + } + else + this->OnSyntaxError(u, "MSG"); + + return MOD_CONT; + } + + bool OnHelp(User *u, const ci::string &) + { + notice_help(Config.s_NickServ, u, NICK_HELP_SET_MSG); + return true; + } + + void OnSyntaxError(User *u, const ci::string &) + { + syntax_error(Config.s_NickServ, u, "SET MSG", NICK_SET_MSG_SYNTAX); + } + + void OnServHelp(User *u) + { + notice_lang(Config.s_NickServ, u, NICK_HELP_CMD_SET_MSG); + } +}; + +class CommandNSSASetMessage : public Command +{ + public: + CommandNSSASetMessage(const ci::string &cname) : Command(cname, 2, 2, "nickserv/saset/message") + { + } + + CommandReturn Execute(User *u, const std::vector<ci::string> ¶ms) + { + NickCore *nc = findcore(params[0]); + assert(nc); + + ci::string param = params[1]; + + if (!Config.UsePrivmsg) + { + notice_lang(Config.s_NickServ, u, NICK_SASET_OPTION_DISABLED, "MSG"); + return MOD_CONT; + } + + if (param == "ON") + { + nc->SetFlag(NI_MSG); + notice_lang(Config.s_NickServ, u, NICK_SASET_MSG_ON, nc->display); + } + else if (param == "OFF") + { + nc->UnsetFlag(NI_MSG); + notice_lang(Config.s_NickServ, u, NICK_SASET_MSG_OFF, nc->display); + } + else + this->OnSyntaxError(u, "MSG"); + + return MOD_CONT; + } + + bool OnHelp(User *u) + { + notice_help(Config.s_NickServ, u, NICK_HELP_SASET_MSG); + return true; + } + + void OnSyntaxError(User *u, const ci::string &) + { + syntax_error(Config.s_NickServ, u, "SASET MSG", NICK_SASET_MSG_SYNTAX); + } + + void OnServHelp(User *u) + { + notice_lang(Config.s_NickServ, u, NICK_HELP_CMD_SASET_MSG); + } +}; + +class NSSetMessage : public Module +{ + public: + NSSetMessage(const std::string &modname, const std::string &creator) : Module(modname, creator) + { + this->SetAuthor("Anope"); + this->SetVersion("$Id$"); + this->SetType(CORE); + + Command *c = FindCommand(NickServ, "SET"); + if (c) + c->AddSubcommand(new CommandNSSetMessage("MSG")); + + c = FindCommand(NickServ, "SASET"); + if (c) + c->AddSubcommand(new CommandNSSASetMessage("MSG")); + } + + ~NSSetMessage() + { + Command *c = FindCommand(NickServ, "SET"); + if (c) + c->DelSubcommand("MSG"); + + c = FindCommand(NickServ, "SASET"); + if (c) + c->DelSubcommand("MSG"); + } +}; + +MODULE_INIT(NSSetMessage) diff --git a/src/core/ns_set_private.cpp b/src/core/ns_set_private.cpp new file mode 100644 index 000000000..661287929 --- /dev/null +++ b/src/core/ns_set_private.cpp @@ -0,0 +1,137 @@ +/* NickServ core functions + * + * (C) 2003-2010 Anope Team + * Contact us at team@anope.org + * + * Please read COPYING and README for further details. + * + * Based on the original code of Epona by Lara. + * Based on the original code of Services by Andy Church. + * + * $Id$ + * + */ +/*************************************************************************/ + +#include "module.h" + +class CommandNSSetPrivate : public Command +{ + public: + CommandNSSetPrivate(const ci::string &cname) : Command(cname, 1) + { + } + + CommandReturn Execute(User *u, const std::vector<ci::string> ¶ms) + { + if (params[0] == "ON") + { + u->Account()->SetFlag(NI_PRIVATE); + notice_lang(Config.s_NickServ, u, NICK_SET_PRIVATE_ON); + } + else if (params[0] == "OFF") + { + u->Account()->UnsetFlag(NI_PRIVATE); + notice_lang(Config.s_NickServ, u, NICK_SET_PRIVATE_OFF); + } + else + this->OnSyntaxError(u, "PRIVATE"); + + return MOD_CONT; + } + + bool OnHelp(User *u, const ci::string &) + { + notice_help(Config.s_NickServ, u, NICK_HELP_SET_PRIVATE); + return true; + } + + void OnSyntaxError(User *u, const ci::string &) + { + syntax_error(Config.s_NickServ, u, "SET PRIVATE", NICK_SET_PRIVATE_SYNTAX); + } + + void OnServHelp(User *u) + { + notice_help(Config.s_NickServ, u, NICK_HELP_CMD_SET_PRIVATE); + } +}; + +class CommandNSSASetPrivate : public Command +{ + public: + CommandNSSASetPrivate(const ci::string &cname) : Command(cname, 2, 2, "nickserv/saset/private") + { + } + + CommandReturn Execute(User *u, const std::vector<ci::string> ¶ms) + { + NickCore *nc = findcore(params[0]); + assert(nc); + + ci::string param = params[1]; + + if (param == "ON") + { + nc->SetFlag(NI_PRIVATE); + notice_lang(Config.s_NickServ, u, NICK_SASET_PRIVATE_ON, nc->display); + } + else if (param == "OFF") + { + nc->UnsetFlag(NI_PRIVATE); + notice_lang(Config.s_NickServ, u, NICK_SASET_PRIVATE_OFF, nc->display); + } + else + this->OnSyntaxError(u, "PRIVATE"); + + return MOD_CONT; + } + + bool OnHelp(User *u, const ci::string &) + { + notice_help(Config.s_NickServ, u, NICK_HELP_SASET_PRIVATE); + return true; + } + + void OnSyntaxError(User *u, const ci::string &) + { + syntax_error(Config.s_NickServ, u, "SASET PRIVATE", NICK_SASET_PRIVATE_SYNTAX); + } + + void OnServHelp(User *u) + { + notice_help(Config.s_NickServ, u, NICK_HELP_CMD_SASET_PRIVATE); + } +}; + +class NSSetPrivate : public Module +{ + public: + NSSetPrivate(const std::string &modname, const std::string &creator) : Module(modname, creator) + { + this->SetAuthor("Anope"); + this->SetVersion("$Id$"); + this->SetType(CORE); + + Command *c = FindCommand(NickServ, "SET"); + if (c) + c->AddSubcommand(new CommandNSSetPrivate("PRIVATE")); + + c = FindCommand(NickServ, "SASET"); + if (c) + c->AddSubcommand(new CommandNSSASetPrivate("PRIVATE")); + } + + ~NSSetPrivate() + { + Command *c = FindCommand(NickServ, "SET"); + if (c) + c->DelSubcommand("PRIVATE"); + + c = FindCommand(NickServ, "SASET"); + if (c) + c->DelSubcommand("PRIVATE"); + } +}; + +MODULE_INIT(NSSetPrivate) diff --git a/src/core/ns_set_secure.cpp b/src/core/ns_set_secure.cpp new file mode 100644 index 000000000..a452a31f3 --- /dev/null +++ b/src/core/ns_set_secure.cpp @@ -0,0 +1,137 @@ +/* NickServ core functions + * + * (C) 2003-2010 Anope Team + * Contact us at team@anope.org + * + * Please read COPYING and README for further details. + * + * Based on the original code of Epona by Lara. + * Based on the original code of Services by Andy Church. + * + * $Id$ + * + */ +/*************************************************************************/ + +#include "module.h" + +class CommandNSSetSecure : public Command +{ + public: + CommandNSSetSecure(const ci::string &cname) : Command(cname, 1) + { + } + + CommandReturn Execute(User *u, const std::vector<ci::string> ¶ms) + { + if (params[0] == "ON") + { + u->Account()->SetFlag(NI_SECURE); + notice_lang(Config.s_NickServ, u, NICK_SET_SECURE_ON); + } + else if (params[0] == "OFF") + { + u->Account()->UnsetFlag(NI_SECURE); + notice_lang(Config.s_NickServ, u, NICK_SET_SECURE_OFF); + } + else + this->OnSyntaxError(u, "SECURE"); + + return MOD_CONT; + } + + bool OnHelp(User *u, const ci::string &) + { + notice_help(Config.s_NickServ, u, NICK_HELP_SET_SECURE); + return true; + } + + void OnSyntaxError(User *u, const ci::string &) + { + syntax_error(Config.s_NickServ, u, "SET SECURE", NICK_SET_SECURE_SYNTAX); + } + + void OnServHelp(User *u) + { + notice_lang(Config.s_NickServ, u, NICK_HELP_CMD_SET_SECURE); + } +}; + +class CommandNSSASetSecure : public Command +{ + public: + CommandNSSASetSecure(const ci::string &cname) : Command(cname, 2, 2, "nickserv/saset/secure") + { + } + + CommandReturn Execute(User *u, const std::vector<ci::string> ¶ms) + { + NickCore *nc = findcore(params[0]); + assert(nc); + + ci::string param = params[1]; + + if (param == "ON") + { + nc->SetFlag(NI_SECURE); + notice_lang(Config.s_NickServ, u, NICK_SASET_SECURE_ON, nc->display); + } + else if (param == "OFF") + { + nc->UnsetFlag(NI_SECURE); + notice_lang(Config.s_NickServ, u, NICK_SASET_SECURE_OFF, nc->display); + } + else + this->OnSyntaxError(u, "SECURE"); + + return MOD_CONT; + } + + bool OnHelp(User *u, const ci::string &) + { + notice_help(Config.s_NickServ, u, NICK_HELP_SASET_SECURE); + return true; + } + + void OnSyntaxError(User *u, const ci::string &) + { + syntax_error(Config.s_NickServ, u, "SASET SECURE", NICK_SASET_SECURE_SYNTAX); + } + + void OnServHelp(User *u) + { + notice_lang(Config.s_NickServ, u, NICK_HELP_CMD_SASET_SECURE); + } +}; + +class NSSetSecure : public Module +{ + public: + NSSetSecure(const std::string &modname, const std::string &creator) : Module(modname, creator) + { + this->SetAuthor("Anope"); + this->SetVersion("$Id$"); + this->SetType(CORE); + + Command *c = FindCommand(NickServ, "SET"); + if (c) + c->AddSubcommand(new CommandNSSetSecure("SECURE")); + + c = FindCommand(NickServ, "SASET"); + if (c) + c->AddSubcommand(new CommandNSSASetSecure("SECURE")); + } + + ~NSSetSecure() + { + Command *c = FindCommand(NickServ, "SET"); + if (c) + c->DelSubcommand("SECURE"); + + c = FindCommand(NickServ, "SASET"); + if (c) + c->DelSubcommand("SECURE"); + } +}; + +MODULE_INIT(NSSetSecure) diff --git a/src/core/ns_set_url.cpp b/src/core/ns_set_url.cpp new file mode 100644 index 000000000..5ef83d32e --- /dev/null +++ b/src/core/ns_set_url.cpp @@ -0,0 +1,128 @@ +/* NickServ core functions + * + * (C) 2003-2010 Anope Team + * Contact us at team@anope.org + * + * Please read COPYING and README for further details. + * + * Based on the original code of Epona by Lara. + * Based on the original code of Services by Andy Church. + * + * $Id$ + * + */ +/*************************************************************************/ + +#include "module.h" + +class CommandNSSetURL : public Command +{ + public: + CommandNSSetURL(const ci::string &cname) : Command(cname, 0) + { + } + + CommandReturn Execute(User *u, const std::vector<ci::string> ¶ms) + { + if (u->Account()->url) + delete [] u->Account()->url; + + if (!params.empty()) + { + u->Account()->url = sstrdup(params[0].c_str()); + notice_lang(Config.s_NickServ, u, NICK_SET_URL_CHANGED, params[0].c_str()); + } + else + { + u->Account()->url = NULL; + notice_lang(Config.s_NickServ, u, NICK_SET_URL_UNSET); + } + + return MOD_CONT; + } + + bool OnHelp(User *u, const ci::string &) + { + notice_help(Config.s_NickServ, u, NICK_HELP_SET_URL); + return true; + } + + void OnServHelp(User *u) + { + notice_lang(Config.s_NickServ, u, NICK_HELP_CMD_SET_URL); + } +}; + +class CommandNSSASetURL : public Command +{ + public: + CommandNSSASetURL(const ci::string &cname) : Command(cname, 1, 2, "nickserv/saset/url") + { + } + + CommandReturn Execute(User *u, const std::vector<ci::string> ¶ms) + { + NickCore *nc = findcore(params[0]); + assert(nc); + + const char *param = params.size() > 1 ? params[1].c_str() : NULL; + + if (nc->url) + delete [] nc->url; + + if (param) + { + nc->url = sstrdup(param); + notice_lang(Config.s_NickServ, u, NICK_SASET_URL_CHANGED, nc->display, param); + } + else + { + nc->url = NULL; + notice_lang(Config.s_NickServ, u, NICK_SASET_URL_UNSET, nc->display); + } + + return MOD_CONT; + } + + bool OnHelp(User *u, const ci::string &) + { + notice_help(Config.s_NickServ, u, NICK_HELP_SASET_URL); + return true; + } + + void OnServHelp(User *u) + { + notice_lang(Config.s_NickServ, u, NICK_HELP_CMD_SASET_URL); + } +}; + +class NSSetURL : public Module +{ + public: + NSSetURL(const std::string &modname, const std::string &creator) : Module(modname, creator) + { + this->SetAuthor("Anope"); + this->SetVersion("$Id$"); + this->SetType(CORE); + + Command *c = FindCommand(NickServ, "SET"); + if (c) + c->AddSubcommand(new CommandNSSetURL("URL")); + + c = FindCommand(NickServ, "SASET"); + if (c) + c->AddSubcommand(new CommandNSSASetURL("URL")); + } + + ~NSSetURL() + { + Command *c = FindCommand(NickServ, "SET"); + if (c) + c->DelSubcommand("URL"); + c = FindCommand(NickServ, "SASET"); + if (c) + c->DelSubcommand("URL"); + } +}; + +MODULE_INIT(NSSetURL) diff --git a/src/hostserv.cpp b/src/hostserv.cpp index 04bb61e4c..8cce7783f 100644 --- a/src/hostserv.cpp +++ b/src/hostserv.cpp @@ -97,7 +97,7 @@ void hostserv(User *u, const std::string &buf) } else { - mod_run_cmd(HostServ, u, buf.c_str()); + mod_run_cmd(HostServ, u, buf); } } diff --git a/src/memoserv.cpp b/src/memoserv.cpp index b4d33fdd0..505b4ed18 100644 --- a/src/memoserv.cpp +++ b/src/memoserv.cpp @@ -65,7 +65,7 @@ void memoserv(User *u, const std::string &buf) } else { - mod_run_cmd(MemoServ, u, buf.c_str()); + mod_run_cmd(MemoServ, u, buf); } } diff --git a/src/nickserv.cpp b/src/nickserv.cpp index ce574b098..c14de6ae6 100644 --- a/src/nickserv.cpp +++ b/src/nickserv.cpp @@ -182,7 +182,7 @@ void nickserv(User *u, const std::string &buf) } else { - mod_run_cmd(NickServ, u, buf.c_str()); + mod_run_cmd(NickServ, u, buf); } } diff --git a/src/operserv.cpp b/src/operserv.cpp index 863fb459e..8e3a3c90f 100644 --- a/src/operserv.cpp +++ b/src/operserv.cpp @@ -55,7 +55,7 @@ void operserv(User *u, const std::string &buf) } else { - mod_run_cmd(OperServ, u, buf.c_str()); + mod_run_cmd(OperServ, u, buf); } } diff --git a/src/protocol/inspircd11.cpp b/src/protocol/inspircd11.cpp index 8fe766824..09c329f0c 100644 --- a/src/protocol/inspircd11.cpp +++ b/src/protocol/inspircd11.cpp @@ -321,7 +321,7 @@ class InspIRCdProto : public IRCDProto u->Account()->Shrink("authenticationtoken"); u->Account()->Extend("authenticationtoken", new ExtensibleItemPointerArray<char>(sstrdup(svidbuf))); - u->SetMode(findbot(Config.s_NickServ), UMODE_REGISTERED); + u->SetMode(NickServ, UMODE_REGISTERED); } } ircd_proto; diff --git a/src/protocol/inspircd12.cpp b/src/protocol/inspircd12.cpp index 3690fcea6..9a9f88fea 100644 --- a/src/protocol/inspircd12.cpp +++ b/src/protocol/inspircd12.cpp @@ -1400,7 +1400,7 @@ class ProtoInspIRCd : public Module /* InspIRCd 1.2 doesn't set -r on nick change, remove -r here. Note that if we have to set +r later * this will cancel out this -r, resulting in no mode changes. */ - u->RemoveMode(findbot(Config.s_NickServ), UMODE_REGISTERED); + u->RemoveMode(NickServ, UMODE_REGISTERED); } }; diff --git a/src/protocol/inspircd20.cpp b/src/protocol/inspircd20.cpp index 4b37e8c1c..4d333658c 100644 --- a/src/protocol/inspircd20.cpp +++ b/src/protocol/inspircd20.cpp @@ -1,4 +1,4 @@ -/* inspircd 1.2 functions +/* Inspircd 2.0 functions * * (C) 2003-2010 Anope Team * Contact us at team@anope.org @@ -14,7 +14,7 @@ /*************************************************************************/ #include "services.h" -#include "pseudo.h" +#include "modules.h" #include "hashcomp.h" #ifndef _WIN32 @@ -40,7 +40,7 @@ IRCDVar myIrcd[] = { "+ao", /* Channel Umode used by Botserv bots */ 1, /* SVSNICK */ 1, /* Vhost */ - 0, /* Supports SGlines */ + 0, /* Supports SNlines */ 1, /* Supports SQlines */ 1, /* Supports SZlines */ 4, /* Number of server args */ @@ -93,11 +93,11 @@ void inspircd_cmd_chghost(const char *nick, const char *vhost) { if (has_chghostmod != 1) { - ircdproto->SendGlobops(findbot(Config.s_OperServ), "CHGHOST not loaded!"); + ircdproto->SendGlobops(OperServ, "CHGHOST not loaded!"); return; } - BotInfo *bi = findbot(Config.s_OperServ); + BotInfo *bi = OperServ; send_cmd(bi->uid, "CHGHOST %s %s", nick, vhost); } @@ -122,10 +122,10 @@ void inspircd_cmd_pass(const char *pass) class InspIRCdProto : public IRCDProto { - void SendAkillDel(Akill *ak) + void SendAkillDel(XLine *x) { - BotInfo *bi = findbot(Config.s_OperServ); - send_cmd(bi->uid, "GLINE %s@%s", ak->user, ak->host); + BotInfo *bi = OperServ; + send_cmd(bi->uid, "GLINE %s", x->Mask.c_str()); } void SendTopic(BotInfo *whosets, Channel *c, const char *whosetit, const char *topic) @@ -146,14 +146,14 @@ class InspIRCdProto : public IRCDProto } } - void SendAkill(Akill *ak) + void SendAkill(XLine *x) { // Calculate the time left before this would expire, capping it at 2 days - time_t timeleft = ak->expires - time(NULL); - if (timeleft > 172800 || !ak->expires) + time_t timeleft = x->Expires - time(NULL); + if (timeleft > 172800 || !x->Expires) timeleft = 172800; - BotInfo *bi = findbot(Config.s_OperServ); - send_cmd(bi->uid, "ADDLINE G %s@%s %s %ld %ld :%s", ak->user, ak->host, ak->by, static_cast<long>(time(NULL)), static_cast<long>(timeleft), ak->reason); + BotInfo *bi = OperServ; + send_cmd(bi->uid, "ADDLINE G %s@%s %s %ld %ld :%s", x->GetUser().c_str(), x->GetHost().c_str(), x->By.c_str(), static_cast<long>(time(NULL)), static_cast<long>(timeleft), x->Reason.c_str()); } void SendSVSKillInternal(BotInfo *source, User *user, const char *buf) @@ -208,7 +208,7 @@ class InspIRCdProto : public IRCDProto /* SERVER services-dev.chatspike.net password 0 :Description here */ void SendServer(Server *server) { - send_cmd(NULL, "SERVER %s %s %d %s :%s", server->name, currentpass, server->hops, server->suid, server->desc); + send_cmd(NULL, "SERVER %s %s %d %s :%s", server->GetName().c_str(), currentpass, server->GetHops(), server->GetSID().c_str(), server->GetDescription().c_str()); } /* JOIN */ @@ -218,19 +218,15 @@ class InspIRCdProto : public IRCDProto } /* UNSQLINE */ - void SendSQLineDel(const std::string &user) + void SendSQLineDel(XLine *x) { - if (user.empty()) - return; - send_cmd(TS6SID, "DELLINE Q %s", user.c_str()); + send_cmd(TS6SID, "DELLINE Q %s", x->Mask.c_str()); } /* SQLINE */ - void SendSQLine(const std::string &mask, const std::string &reason) + void SendSQLine(XLine *x) { - if (mask.empty() || reason.empty()) - return; - send_cmd(TS6SID, "ADDLINE Q %s %s %ld 0 :%s", mask.c_str(), Config.s_OperServ, static_cast<long>(time(NULL)), reason.c_str()); + send_cmd(TS6SID, "ADDLINE Q %s %s %ld 0 :%s", x->Mask.c_str(), Config.s_OperServ, static_cast<long>(time(NULL)), x->Reason.c_str()); } /* SQUIT */ @@ -251,11 +247,11 @@ class InspIRCdProto : public IRCDProto void SendConnect() { + Me = new Server(NULL, Config.ServerName, 0, Config.ServerDesc, TS6SID); inspircd_cmd_pass(uplink_server->password); - me_server = new_server(NULL, Config.ServerName, Config.ServerDesc, SERVER_ISME, TS6SID); - SendServer(me_server); + SendServer(Me); send_cmd(TS6SID, "BURST"); - send_cmd(TS6SID, "VERSION :Anope-%s %s :%s - %s (%s) -- %s", version_number, Config.ServerName, ircd->name, version_flags, Config.EncModuleList.begin()->c_str(), version_build); + send_cmd(TS6SID, "VERSION :Anope-%s %s :%s - (%s) -- %s", version_number, Config.ServerName, ircd->name, Config.EncModuleList.begin()->c_str(), version_build); } /* CHGIDENT */ @@ -263,11 +259,11 @@ class InspIRCdProto : public IRCDProto { if (has_chgidentmod == 0) { - ircdproto->SendGlobops(findbot(Config.s_OperServ), "CHGIDENT not loaded!"); + ircdproto->SendGlobops(OperServ, "CHGIDENT not loaded!"); } else { - BotInfo *bi = findbot(Config.s_OperServ); + BotInfo *bi = OperServ; send_cmd(bi->uid, "CHGIDENT %s %s", nick, vIdent); } } @@ -275,33 +271,33 @@ class InspIRCdProto : public IRCDProto /* SVSHOLD - set */ void SendSVSHold(const char *nick) { - BotInfo *bi = findbot(Config.s_OperServ); + BotInfo *bi = OperServ; send_cmd(bi->uid, "SVSHOLD %s %u :%s", nick, static_cast<unsigned>(Config.NSReleaseTimeout), "Being held for registered user"); } /* SVSHOLD - release */ void SendSVSHoldDel(const char *nick) { - BotInfo *bi = findbot(Config.s_OperServ); + BotInfo *bi = OperServ; send_cmd(bi->uid, "SVSHOLD %s", nick); } /* UNSZLINE */ - void SendSZLineDel(SXLine *sx) + void SendSZLineDel(XLine *x) { - send_cmd(TS6SID, "DELLINE Z %s", sx->mask); + send_cmd(TS6SID, "DELLINE Z %s", x->Mask.c_str()); } /* SZLINE */ - void SendSZLine(SXLine *sx) + void SendSZLine(XLine *x) { - send_cmd(TS6SID, "ADDLINE Z %s %s %ld 0 :%s", sx->mask, sx->by, static_cast<long>(time(NULL)), sx->reason); + send_cmd(TS6SID, "ADDLINE Z %s %s %ld 0 :%s", x->Mask.c_str(), x->By.c_str(), static_cast<long>(time(NULL)), x->Reason.c_str()); } /* SVSMODE -r */ void SendUnregisteredNick(User *u) { - u->RemoveMode(findbot(Config.s_NickServ), UMODE_REGISTERED); + u->RemoveMode(NickServ, UMODE_REGISTERED); } void SendSVSJoin(const char *source, const char *nick, const char *chan, const char *param) @@ -361,7 +357,7 @@ class InspIRCdProto : public IRCDProto if (!u->Account()) return; - u->SetMode(findbot(Config.s_NickServ), UMODE_REGISTERED); + u->SetMode(NickServ, UMODE_REGISTERED); } } ircd_proto; @@ -396,8 +392,8 @@ int anope_event_mode(const char *source, int ac, const char **av) users modes, we have to kludge this as it slightly breaks RFC1459 */ - User *u = find_byuid(source); - User *u2 = find_byuid(av[0]); + User *u = finduser(source); + User *u2 = finduser(av[0]); // This can happen with server-origin modes. if (u == NULL) @@ -553,7 +549,7 @@ int anope_event_fjoin(const char *source, int ac, const char **av) } buf.erase(buf.begin()); - User *u = find_byuid(buf); + User *u = finduser(buf); if (!u) { Alog(LOG_DEBUG) << "FJOIN for nonexistant user " << buf << " on " << c->name; @@ -645,7 +641,7 @@ int anope_event_topic(const char *source, int ac, const char **av) { Channel *c = findchan(av[0]); time_t topic_time = time(NULL); - User *u = find_byuid(source); + User *u = finduser(source); if (!c) { @@ -687,12 +683,10 @@ int anope_event_squit(const char *source, int ac, const char **av) int anope_event_rsquit(const char *source, int ac, const char **av) { /* On InspIRCd we must send a SQUIT when we recieve RSQUIT for a server we have juped */ - Server *s = findserver(servlist, av[0]); - if (!s) - s = findserver_uid(servlist, av[0]); + Server *s = Server::Find(av[0]); if (s && s->HasFlag(SERVER_JUPED)) { - send_cmd(TS6SID, "SQUIT %s :%s", s->suid, ac > 1 ? av[1] : ""); + send_cmd(TS6SID, "SQUIT %s :%s", s->GetSID().c_str(), ac > 1 ? av[1] : ""); } do_squit(source, ac, av); @@ -709,7 +703,7 @@ int anope_event_quit(const char *source, int ac, const char **av) int anope_event_kill(const char *source, int ac, const char **av) { - User *u = find_byuid(av[0]); + User *u = finduser(av[0]); BotInfo *bi = findbot(av[0]); m_kill(u ? u->nick.c_str() : (bi ? bi->nick : av[0]), av[1]); return MOD_CONT; @@ -836,7 +830,7 @@ int anope_event_uid(const char *source, int ac, const char **av) User *user; NickAlias *na; struct in_addr addy; - Server *s = findserver_uid(servlist, source); + Server *s = Server::Find(source ? source : ""); uint32 *ad = reinterpret_cast<uint32 *>(&addy); int ts = strtoul(av[1], NULL, 10); @@ -845,11 +839,11 @@ int anope_event_uid(const char *source, int ac, const char **av) user = prev_u_intro; prev_u_intro = NULL; if (user) na = findnick(user->nick); - if (user && user->server->sync == SSYNC_IN_PROGRESS && (!na || na->nc != user->Account())) + if (user && !user->server->IsSynced() && (!na || na->nc != user->Account())) { validate_user(user); if (user->HasMode(UMODE_REGISTERED)) - user->RemoveMode(findbot(Config.s_NickServ), UMODE_REGISTERED); + user->RemoveMode(NickServ, UMODE_REGISTERED); } user = NULL; @@ -857,14 +851,14 @@ int anope_event_uid(const char *source, int ac, const char **av) user = do_nick("", av[2], /* nick */ av[5], /* username */ av[3], /* realhost */ - s->name, /* server */ + s->GetName().c_str(), /* server */ av[ac - 1], /* realname */ ts, htonl(*ad), av[4], av[0]); if (user) { UserSetInternalModes(user, 1, &av[8]); user->SetCloakedHost(av[4]); - if (user->server->sync == SSYNC_IN_PROGRESS) + if (!user->server->IsSynced()) { prev_u_intro = user; } @@ -902,24 +896,17 @@ int anope_event_chghost(const char *source, int ac, const char **av) */ int anope_event_server(const char *source, int ac, const char **av) { - if (!stricmp(av[2], "0")) - { - uplink = sstrdup(av[0]); - } - do_server(source, av[0], av[2], av[4], av[3]); + do_server(source, av[0], atoi(av[2]), av[4], av[3]); return MOD_CONT; } int anope_event_privmsg(const char *source, int ac, const char **av) { - User *u = find_byuid(source); - BotInfo *bi = findbot(av[0]); - - if (!u) + if (!finduser(source)) return MOD_CONT; // likely a message from a server, which can happen. - m_privmsg(u->nick.c_str(), bi ? bi->nick: av[0], av[1]); + m_privmsg(source, av[0], av[1]); return MOD_CONT; } @@ -943,7 +930,7 @@ int anope_event_metadata(const char *source, int ac, const char **av) return MOD_CONT; else if (!strcmp(av[1], "accountname")) { - if ((u = find_byuid(av[0]))) + if ((u = finduser(av[0]))) { /* Identify the user for this account - Adam */ u->AutoID(av[2]); @@ -1025,14 +1012,14 @@ int anope_event_capab(const char *source, int ac, const char **av) continue; /* InspIRCd sends q and a here if they have no prefixes */ case 'q': - ModeManager::AddChannelMode(new ChannelModeStatus(CMODE_OWNER, 'q', '@')); + ModeManager::AddChannelMode(new ChannelModeStatus(CMODE_OWNER, "CMODE_OWNER", 'q', '@')); continue; case 'a': - ModeManager::AddChannelMode(new ChannelModeStatus(CMODE_PROTECT , 'a', '@')); + ModeManager::AddChannelMode(new ChannelModeStatus(CMODE_PROTECT , "CMODE_PROTECT", 'a', '@')); continue; // XXX list modes needs a bit of a rewrite, we need to be able to support +g here default: - ModeManager::AddChannelMode(new ChannelModeList(CMODE_END, modebuf[t])); + ModeManager::AddChannelMode(new ChannelModeList(CMODE_END, "", modebuf[t])); } } @@ -1045,7 +1032,7 @@ int anope_event_capab(const char *source, int ac, const char **av) ModeManager::AddChannelMode(new ChannelModeKey('k')); continue; default: - ModeManager::AddChannelMode(new ChannelModeParam(CMODE_END, modebuf[t])); + ModeManager::AddChannelMode(new ChannelModeParam(CMODE_END, "", modebuf[t])); } } @@ -1055,25 +1042,25 @@ int anope_event_capab(const char *source, int ac, const char **av) switch (modebuf[t]) { case 'F': - ModeManager::AddChannelMode(new ChannelModeParam(CMODE_NICKFLOOD, 'F', true)); + ModeManager::AddChannelMode(new ChannelModeParam(CMODE_NICKFLOOD, "CMODE_NICKFLOOD", 'F', true)); continue; case 'J': - ModeManager::AddChannelMode(new ChannelModeParam(CMODE_NOREJOIN, 'J', true)); + ModeManager::AddChannelMode(new ChannelModeParam(CMODE_NOREJOIN, "CMODE_NOREJOIN", 'J', true)); continue; case 'L': - ModeManager::AddChannelMode(new ChannelModeParam(CMODE_REDIRECT, 'L', true)); + ModeManager::AddChannelMode(new ChannelModeParam(CMODE_REDIRECT, "CMODE_REDIRECT", 'L', true)); continue; case 'f': ModeManager::AddChannelMode(new ChannelModeFlood('f', true)); continue; case 'j': - ModeManager::AddChannelMode(new ChannelModeParam(CMODE_JOINFLOOD, 'j', true)); + ModeManager::AddChannelMode(new ChannelModeParam(CMODE_JOINFLOOD, "CMODE_JOINFLOOD", 'j', true)); continue; case 'l': - ModeManager::AddChannelMode(new ChannelModeParam(CMODE_LIMIT, 'l', true)); + ModeManager::AddChannelMode(new ChannelModeParam(CMODE_LIMIT, "CMODE_LIMIT", 'l', true)); continue; default: - ModeManager::AddChannelMode(new ChannelModeParam(CMODE_END, modebuf[t], true)); + ModeManager::AddChannelMode(new ChannelModeParam(CMODE_END, "", modebuf[t], true)); } } @@ -1083,79 +1070,79 @@ int anope_event_capab(const char *source, int ac, const char **av) switch (modebuf[t]) { case 'A': - ModeManager::AddChannelMode(new ChannelMode(CMODE_ALLINVITE, 'A')); + ModeManager::AddChannelMode(new ChannelMode(CMODE_ALLINVITE, "CMODE_ALLINVITE", 'A')); continue; case 'B': - ModeManager::AddChannelMode(new ChannelMode(CMODE_BLOCKCAPS, 'B')); + ModeManager::AddChannelMode(new ChannelMode(CMODE_BLOCKCAPS, "CMODE_BLOCKCAPS", 'B')); continue; case 'C': - ModeManager::AddChannelMode(new ChannelMode(CMODE_NOCTCP, 'C')); + ModeManager::AddChannelMode(new ChannelMode(CMODE_NOCTCP, "CMODE_NOCTCP", 'C')); continue; case 'D': - ModeManager::AddChannelMode(new ChannelMode(CMODE_DELAYEDJOIN, 'D')); + ModeManager::AddChannelMode(new ChannelMode(CMODE_DELAYEDJOIN, "CMODE_DELAYEDJOIN", 'D')); continue; case 'G': - ModeManager::AddChannelMode(new ChannelMode(CMODE_FILTER, 'G')); + ModeManager::AddChannelMode(new ChannelMode(CMODE_FILTER, "CMODE_FILTER", 'G')); continue; case 'K': - ModeManager::AddChannelMode(new ChannelMode(CMODE_NOKNOCK, 'K')); + ModeManager::AddChannelMode(new ChannelMode(CMODE_NOKNOCK, "CMODE_NOKNOCK", 'K')); continue; case 'M': - ModeManager::AddChannelMode(new ChannelMode(CMODE_REGMODERATED, 'M')); + ModeManager::AddChannelMode(new ChannelMode(CMODE_REGMODERATED, "CMODE_REGMODERATED", 'M')); continue; case 'N': - ModeManager::AddChannelMode(new ChannelMode(CMODE_NONICK, 'N')); + ModeManager::AddChannelMode(new ChannelMode(CMODE_NONICK, "CMODE_NONICK", 'N')); continue; case 'O': ModeManager::AddChannelMode(new ChannelModeOper('O')); continue; case 'P': - ModeManager::AddChannelMode(new ChannelMode(CMODE_PERM, 'P')); + ModeManager::AddChannelMode(new ChannelMode(CMODE_PERM, "CMODE_PERM", 'P')); continue; case 'Q': - ModeManager::AddChannelMode(new ChannelMode(CMODE_NOKICK, 'Q')); + ModeManager::AddChannelMode(new ChannelMode(CMODE_NOKICK, "CMODE_NOKICK", 'Q')); continue; case 'R': - ModeManager::AddChannelMode(new ChannelMode(CMODE_REGISTEREDONLY, 'R')); + ModeManager::AddChannelMode(new ChannelMode(CMODE_REGISTEREDONLY, "CMODE_REGISTEREDONLY", 'R')); continue; case 'S': - ModeManager::AddChannelMode(new ChannelMode(CMODE_STRIPCOLOR, 'S')); + ModeManager::AddChannelMode(new ChannelMode(CMODE_STRIPCOLOR, "CMODE_STRIPCOLOR", 'S')); continue; case 'T': - ModeManager::AddChannelMode(new ChannelMode(CMODE_NONOTICE, 'T')); + ModeManager::AddChannelMode(new ChannelMode(CMODE_NONOTICE, "CMODE_NONOTICE", 'T')); continue; case 'c': - ModeManager::AddChannelMode(new ChannelMode(CMODE_BLOCKCOLOR, 'c')); + ModeManager::AddChannelMode(new ChannelMode(CMODE_BLOCKCOLOR, "CMODE_BLOCKCOLOR", 'c')); continue; case 'i': - ModeManager::AddChannelMode(new ChannelMode(CMODE_INVITE, 'i')); + ModeManager::AddChannelMode(new ChannelMode(CMODE_INVITE, "CMODE_INVITE", 'i')); continue; case 'm': - ModeManager::AddChannelMode(new ChannelMode(CMODE_MODERATED, 'm')); + ModeManager::AddChannelMode(new ChannelMode(CMODE_MODERATED, "CMODE_MODERATED", 'm')); continue; case 'n': - ModeManager::AddChannelMode(new ChannelMode(CMODE_NOEXTERNAL, 'n')); + ModeManager::AddChannelMode(new ChannelMode(CMODE_NOEXTERNAL, "CMODE_NOEXTERNAL", 'n')); continue; case 'p': - ModeManager::AddChannelMode(new ChannelMode(CMODE_PRIVATE, 'p')); + ModeManager::AddChannelMode(new ChannelMode(CMODE_PRIVATE, "CMODE_PRIVATE", 'p')); continue; case 'r': ModeManager::AddChannelMode(new ChannelModeRegistered('r')); continue; case 's': - ModeManager::AddChannelMode(new ChannelMode(CMODE_SECRET, 's')); + ModeManager::AddChannelMode(new ChannelMode(CMODE_SECRET, "CMODE_SECRET", 's')); continue; case 't': - ModeManager::AddChannelMode(new ChannelMode(CMODE_TOPIC, 't')); + ModeManager::AddChannelMode(new ChannelMode(CMODE_TOPIC, "CMODE_TOPIC", 't')); continue; case 'u': - ModeManager::AddChannelMode(new ChannelMode(CMODE_AUDITORIUM, 'u')); + ModeManager::AddChannelMode(new ChannelMode(CMODE_AUDITORIUM, "CMODE_AUDITORIUM", 'u')); continue; case 'z': - ModeManager::AddChannelMode(new ChannelMode(CMODE_SSL, 'z')); + ModeManager::AddChannelMode(new ChannelMode(CMODE_SSL, "CMODE_SSL", 'z')); continue; default: - ModeManager::AddChannelMode(new ChannelMode(CMODE_END, modebuf[t])); + ModeManager::AddChannelMode(new ChannelMode(CMODE_END, "", modebuf[t])); } } } @@ -1172,64 +1159,64 @@ int anope_event_capab(const char *source, int ac, const char **av) switch (modebuf[t]) { case 'h': - ModeManager::AddUserMode(new UserMode(UMODE_HELPOP, 'h')); + ModeManager::AddUserMode(new UserMode(UMODE_HELPOP, "UMODE_HELPOP", 'h')); continue; case 's': - ModeManager::AddUserMode(new UserMode(UMODE_STRIPCOLOR, 'S')); + ModeManager::AddUserMode(new UserMode(UMODE_STRIPCOLOR, "UMODE_STRIPCOLOR", 'S')); continue; case 'B': - ModeManager::AddUserMode(new UserMode(UMODE_BOT, 'B')); + ModeManager::AddUserMode(new UserMode(UMODE_BOT, "UMODE_BOT", 'B')); continue; case 'G': - ModeManager::AddUserMode(new UserMode(UMODE_FILTER, 'G')); + ModeManager::AddUserMode(new UserMode(UMODE_FILTER, "UMODE_FILTER", 'G')); continue; case 'H': - ModeManager::AddUserMode(new UserMode(UMODE_HIDEOPER, 'H')); + ModeManager::AddUserMode(new UserMode(UMODE_HIDEOPER, "UMODE_HIDEOPER", 'H')); continue; case 'I': - ModeManager::AddUserMode(new UserMode(UMODE_PRIV, 'I')); + ModeManager::AddUserMode(new UserMode(UMODE_PRIV, "UMODE_PRIV", 'I')); continue; case 'Q': - ModeManager::AddUserMode(new UserMode(UMODE_HIDDEN, 'Q')); + ModeManager::AddUserMode(new UserMode(UMODE_HIDDEN, "UMODE_HIDDEN", 'Q')); continue; case 'R': - ModeManager::AddUserMode(new UserMode(UMODE_REGPRIV, 'R')); + ModeManager::AddUserMode(new UserMode(UMODE_REGPRIV, "UMODE_REGPRIV", 'R')); continue; case 'S': - ModeManager::AddUserMode(new UserMode(UMODE_STRIPCOLOR, 'S')); + ModeManager::AddUserMode(new UserMode(UMODE_STRIPCOLOR, "UMODE_STRIPCOLOR", 'S')); continue; case 'W': - ModeManager::AddUserMode(new UserMode(UMODE_WHOIS, 'W')); + ModeManager::AddUserMode(new UserMode(UMODE_WHOIS, "UMODE_WHOIS", 'W')); continue; case 'c': - ModeManager::AddUserMode(new UserMode(UMODE_COMMONCHANS, 'c')); + ModeManager::AddUserMode(new UserMode(UMODE_COMMONCHANS, "UMODE_COMMONCHANS", 'c')); continue; case 'g': - ModeManager::AddUserMode(new UserMode(UMODE_CALLERID, 'g')); + ModeManager::AddUserMode(new UserMode(UMODE_CALLERID, "UMODE_CALLERID", 'g')); continue; case 'i': - ModeManager::AddUserMode(new UserMode(UMODE_INVIS, 'i')); + ModeManager::AddUserMode(new UserMode(UMODE_INVIS, "UMODE_INVIS", 'i')); continue; case 'k': - ModeManager::AddUserMode(new UserMode(UMODE_PROTECTED, 'k')); + ModeManager::AddUserMode(new UserMode(UMODE_PROTECTED, "UMODE_PROTECTED", 'k')); continue; case 'o': - ModeManager::AddUserMode(new UserMode(UMODE_OPER, 'o')); + ModeManager::AddUserMode(new UserMode(UMODE_OPER, "UMODE_OPER", 'o')); continue; case 'r': - ModeManager::AddUserMode(new UserMode(UMODE_REGISTERED, 'r')); + ModeManager::AddUserMode(new UserMode(UMODE_REGISTERED, "UMODE_REGISTERED", 'r')); continue; case 'w': - ModeManager::AddUserMode(new UserMode(UMODE_WALLOPS, 'w')); + ModeManager::AddUserMode(new UserMode(UMODE_WALLOPS, "UMODE_WALLOPS", 'w')); continue; case 'x': - ModeManager::AddUserMode(new UserMode(UMODE_CLOAK, 'x')); + ModeManager::AddUserMode(new UserMode(UMODE_CLOAK, "UMODE_CLOAK", 'x')); continue; case 'd': - ModeManager::AddUserMode(new UserMode(UMODE_DEAF, 'd')); + ModeManager::AddUserMode(new UserMode(UMODE_DEAF, "UMODE_DEAF", 'd')); continue; default: - ModeManager::AddUserMode(new UserMode(UMODE_END, modebuf[t])); + ModeManager::AddUserMode(new UserMode(UMODE_END, "", modebuf[t])); } } } @@ -1244,19 +1231,19 @@ int anope_event_capab(const char *source, int ac, const char **av) switch (modes[t]) { case 'q': - ModeManager::AddChannelMode(new ChannelModeStatus(CMODE_OWNER, 'q', chars[t])); + ModeManager::AddChannelMode(new ChannelModeStatus(CMODE_OWNER, "CMODE_OWNER", 'q', chars[t])); continue; case 'a': - ModeManager::AddChannelMode(new ChannelModeStatus(CMODE_PROTECT, 'a', chars[t])); + ModeManager::AddChannelMode(new ChannelModeStatus(CMODE_PROTECT, "CMODE_PROTECT", 'a', chars[t])); continue; case 'o': - ModeManager::AddChannelMode(new ChannelModeStatus(CMODE_OP, 'o', chars[t])); + ModeManager::AddChannelMode(new ChannelModeStatus(CMODE_OP, "CMODE_OP", 'o', chars[t])); continue; case 'h': - ModeManager::AddChannelMode(new ChannelModeStatus(CMODE_HALFOP, 'h', chars[t])); + ModeManager::AddChannelMode(new ChannelModeStatus(CMODE_HALFOP, "CMODE_HALFOP", 'h', chars[t])); continue; case 'v': - ModeManager::AddChannelMode(new ChannelModeStatus(CMODE_VOICE, 'v', chars[t])); + ModeManager::AddChannelMode(new ChannelModeStatus(CMODE_VOICE, "CMODE_VOICE", 'v', chars[t])); continue; } } @@ -1287,13 +1274,13 @@ int anope_event_capab(const char *source, int ac, const char **av) return MOD_STOP; } if (!has_svsholdmod) { - ircdproto->SendGlobops(findbot(Config.s_OperServ), "SVSHOLD missing, Usage disabled until module is loaded."); + ircdproto->SendGlobops(OperServ, "SVSHOLD missing, Usage disabled until module is loaded."); } if (!has_chghostmod) { - ircdproto->SendGlobops(findbot(Config.s_OperServ), "CHGHOST missing, Usage disabled until module is loaded."); + ircdproto->SendGlobops(OperServ, "CHGHOST missing, Usage disabled until module is loaded."); } if (!has_chgidentmod) { - ircdproto->SendGlobops(findbot(Config.s_OperServ), "CHGIDENT missing, Usage disabled until module is loaded."); + ircdproto->SendGlobops(OperServ, "CHGIDENT missing, Usage disabled until module is loaded."); } ircd->svshold = has_svsholdmod; } @@ -1307,7 +1294,8 @@ int anope_event_endburst(const char *source, int ac, const char **av) { NickAlias *na; User *u = prev_u_intro; - Server *s = findserver_uid(servlist, source); + Server *s = Server::Find(source ? source : ""); + if (!s) { throw new CoreException("Got ENDBURST without a source"); @@ -1317,56 +1305,55 @@ int anope_event_endburst(const char *source, int ac, const char **av) * If not, validate the user. ~ Viper*/ prev_u_intro = NULL; if (u) na = findnick(u->nick); - if (u && u->server->sync == SSYNC_IN_PROGRESS && (!na || na->nc != u->Account())) + if (u && !u->server->IsSynced() && (!na || na->nc != u->Account())) { validate_user(u); if (u->HasMode(UMODE_REGISTERED)) - u->RemoveMode(findbot(Config.s_NickServ), UMODE_REGISTERED); + u->RemoveMode(NickServ, UMODE_REGISTERED); } - Alog() << "Processed ENDBURST for " << s->name; + Alog() << "Processed ENDBURST for " << s->GetName(); - finish_sync(s, 1); + s->Sync(true); return MOD_CONT; } -void moduleAddIRCDMsgs() { - Message *m; - - m = createMessage("ENDBURST", anope_event_endburst); addCoreMessage(IRCD, m); - m = createMessage("436", anope_event_436); addCoreMessage(IRCD,m); - m = createMessage("AWAY", anope_event_away); addCoreMessage(IRCD,m); - m = createMessage("JOIN", anope_event_join); addCoreMessage(IRCD,m); - m = createMessage("KICK", anope_event_kick); addCoreMessage(IRCD,m); - m = createMessage("KILL", anope_event_kill); addCoreMessage(IRCD,m); - m = createMessage("MODE", anope_event_mode); addCoreMessage(IRCD,m); - m = createMessage("MOTD", anope_event_motd); addCoreMessage(IRCD,m); - m = createMessage("NICK", anope_event_nick); addCoreMessage(IRCD,m); - m = createMessage("UID", anope_event_uid); addCoreMessage(IRCD,m); - m = createMessage("CAPAB", anope_event_capab); addCoreMessage(IRCD,m); - m = createMessage("PART", anope_event_part); addCoreMessage(IRCD,m); - m = createMessage("PING", anope_event_ping); addCoreMessage(IRCD,m); - m = createMessage("TIME", anope_event_time); addCoreMessage(IRCD,m); - m = createMessage("PRIVMSG", anope_event_privmsg); addCoreMessage(IRCD,m); - m = createMessage("QUIT", anope_event_quit); addCoreMessage(IRCD,m); - m = createMessage("SERVER", anope_event_server); addCoreMessage(IRCD,m); - m = createMessage("SQUIT", anope_event_squit); addCoreMessage(IRCD,m); - m = createMessage("RSQUIT", anope_event_rsquit); addCoreMessage(IRCD,m); - m = createMessage("TOPIC", anope_event_topic); addCoreMessage(IRCD,m); - m = createMessage("WHOIS", anope_event_whois); addCoreMessage(IRCD,m); - m = createMessage("SVSMODE", anope_event_mode) ;addCoreMessage(IRCD,m); - m = createMessage("FHOST", anope_event_chghost); addCoreMessage(IRCD,m); - m = createMessage("CHGIDENT", anope_event_chgident); addCoreMessage(IRCD,m); - m = createMessage("FNAME", anope_event_chgname); addCoreMessage(IRCD,m); - m = createMessage("SETHOST", anope_event_sethost); addCoreMessage(IRCD,m); - m = createMessage("SETIDENT", anope_event_setident); addCoreMessage(IRCD,m); - m = createMessage("SETNAME", anope_event_setname); addCoreMessage(IRCD,m); - m = createMessage("FJOIN", anope_event_fjoin); addCoreMessage(IRCD,m); - m = createMessage("FMODE", anope_event_fmode); addCoreMessage(IRCD,m); - m = createMessage("FTOPIC", anope_event_ftopic); addCoreMessage(IRCD,m); - m = createMessage("OPERTYPE", anope_event_opertype); addCoreMessage(IRCD,m); - m = createMessage("IDLE", anope_event_idle); addCoreMessage(IRCD,m); - m = createMessage("METADATA", anope_event_metadata); addCoreMessage(IRCD,m); +void moduleAddIRCDMsgs() +{ + Anope::AddMessage("ENDBURST", anope_event_endburst); + Anope::AddMessage("436", anope_event_436); + Anope::AddMessage("AWAY", anope_event_away); + Anope::AddMessage("JOIN", anope_event_join); + Anope::AddMessage("KICK", anope_event_kick); + Anope::AddMessage("KILL", anope_event_kill); + Anope::AddMessage("MODE", anope_event_mode); + Anope::AddMessage("MOTD", anope_event_motd); + Anope::AddMessage("NICK", anope_event_nick); + Anope::AddMessage("UID", anope_event_uid); + Anope::AddMessage("CAPAB", anope_event_capab); + Anope::AddMessage("PART", anope_event_part); + Anope::AddMessage("PING", anope_event_ping); + Anope::AddMessage("TIME", anope_event_time); + Anope::AddMessage("PRIVMSG", anope_event_privmsg); + Anope::AddMessage("QUIT", anope_event_quit); + Anope::AddMessage("SERVER", anope_event_server); + Anope::AddMessage("SQUIT", anope_event_squit); + Anope::AddMessage("RSQUIT", anope_event_rsquit); + Anope::AddMessage("TOPIC", anope_event_topic); + Anope::AddMessage("WHOIS", anope_event_whois); + Anope::AddMessage("SVSMODE", anope_event_mode); + Anope::AddMessage("FHOST", anope_event_chghost); + Anope::AddMessage("CHGIDENT", anope_event_chgident); + Anope::AddMessage("FNAME", anope_event_chgname); + Anope::AddMessage("SETHOST", anope_event_sethost); + Anope::AddMessage("SETIDENT", anope_event_setident); + Anope::AddMessage("SETNAME", anope_event_setname); + Anope::AddMessage("FJOIN", anope_event_fjoin); + Anope::AddMessage("FMODE", anope_event_fmode); + Anope::AddMessage("FTOPIC", anope_event_ftopic); + Anope::AddMessage("OPERTYPE", anope_event_opertype); + Anope::AddMessage("IDLE", anope_event_idle); + Anope::AddMessage("METADATA", anope_event_metadata); } bool ChannelModeFlood::IsValid(const std::string &value) @@ -1409,7 +1396,6 @@ class ProtoInspIRCd : public Module void OnUserNickChange(User *u, const std::string &) { - /* InspIRCd 2.0 removes r on nick change and doesn't tell services, even though it tells the user */ u->RemoveModeInternal(ModeManager::FindUserModeByName(UMODE_REGISTERED)); } }; diff --git a/src/protocol/unreal32.cpp b/src/protocol/unreal32.cpp index 4d90e6bcf..65ee9d3e2 100644 --- a/src/protocol/unreal32.cpp +++ b/src/protocol/unreal32.cpp @@ -594,9 +594,9 @@ int anope_event_ping(const char *source, int ac, const char **av) */ int anope_event_pong(const char *source, int ac, const char **av) { - Server *s = findserver(servlist, source); - if (s && !is_sync(s)) - finish_sync(s, 0); + Server *s = Server::Find(source); + if (s && !s->IsSynced()) + s->Sync(false); return MOD_CONT; } diff --git a/src/users.cpp b/src/users.cpp index 5c88f9666..a1890f6c5 100644 --- a/src/users.cpp +++ b/src/users.cpp @@ -412,7 +412,7 @@ void User::AutoID(const std::string &account) delete [] na->last_realname; na->last_realname = sstrdup(this->realname); na->last_seen = time(NULL); - this->SetMode(findbot(Config.s_NickServ), UMODE_REGISTERED); + this->SetMode(NickServ, UMODE_REGISTERED); this->UpdateHost(); check_memos(this); |