diff options
Diffstat (limited to 'src/modules')
-rw-r--r-- | src/modules/bs_fantasy_unban.c | 40 | ||||
-rw-r--r-- | src/modules/cs_enforce.c | 358 | ||||
-rw-r--r-- | src/modules/cs_tban.c | 180 | ||||
-rw-r--r-- | src/modules/demos/catserv/catserv_messages.c | 10 | ||||
-rw-r--r-- | src/modules/demos/catserv/ircd_catserv.c | 112 | ||||
-rw-r--r-- | src/modules/demos/catserv/purr.c | 4 | ||||
-rw-r--r-- | src/modules/demos/events.c | 46 | ||||
-rw-r--r-- | src/modules/demos/hs_conf.c | 52 | ||||
-rw-r--r-- | src/modules/demos/hs_moo.c | 54 | ||||
-rw-r--r-- | src/modules/hs_request.c | 1000 | ||||
-rw-r--r-- | src/modules/ns_maxemail.c | 110 | ||||
-rw-r--r-- | src/modules/ns_noop_convert.c | 110 | ||||
-rw-r--r-- | src/modules/os_ignore_db.c | 62 | ||||
-rw-r--r-- | src/modules/os_info.c | 624 |
14 files changed, 1381 insertions, 1381 deletions
diff --git a/src/modules/bs_fantasy_unban.c b/src/modules/bs_fantasy_unban.c index b7ce00ebf..88920176a 100644 --- a/src/modules/bs_fantasy_unban.c +++ b/src/modules/bs_fantasy_unban.c @@ -41,31 +41,31 @@ class BSFantasyUnban : public Module **/ int do_fantasy(int argc, char **argv) { - User *u; - ChannelInfo *ci; - char *target = NULL; + User *u; + ChannelInfo *ci; + char *target = NULL; - if (argc < 3) - return MOD_CONT; + if (argc < 3) + return MOD_CONT; - if (stricmp(argv[0], "unban") == 0) { - u = finduser(argv[1]); - ci = cs_findchan(argv[2]); - if (!u || !ci || !check_access(u, ci, CA_UNBAN)) - return MOD_CONT; + if (stricmp(argv[0], "unban") == 0) { + u = finduser(argv[1]); + ci = cs_findchan(argv[2]); + if (!u || !ci || !check_access(u, ci, CA_UNBAN)) + return MOD_CONT; - if (argc >= 4) - target = myStrGetToken(argv[3], ' ', 0); - if (!target) - common_unban(ci, u->nick); - else - common_unban(ci, target); + if (argc >= 4) + target = myStrGetToken(argv[3], ' ', 0); + if (!target) + common_unban(ci, u->nick); + else + common_unban(ci, target); - /* free target if needed (#852) */ - Anope_Free(target); - } + /* free target if needed (#852) */ + Anope_Free(target); + } - return MOD_CONT; + return MOD_CONT; } MODULE_INIT("bs_fantasy_unban", BSFantasyUnban) diff --git a/src/modules/cs_enforce.c b/src/modules/cs_enforce.c index 31dd089d0..7d66bcb1a 100644 --- a/src/modules/cs_enforce.c +++ b/src/modules/cs_enforce.c @@ -1,5 +1,5 @@ /* cs_enforce - Add a /cs ENFORCE command to enforce various set - * options and channelmodes on a channel. + * options and channelmodes on a channel. * * (C) 2003-2008 Anope Team * Contact us at info@anope.org @@ -23,14 +23,14 @@ void my_cs_help(User * u); int my_cs_help_enforce(User * u); void my_add_languages(void); -#define LNG_NUM_STRINGS 6 +#define LNG_NUM_STRINGS 6 -#define LNG_CHAN_HELP 0 -#define LNG_ENFORCE_SYNTAX 1 -#define LNG_CHAN_HELP_ENFORCE 2 -#define LNG_CHAN_HELP_ENFORCE_R_ENABLED 3 -#define LNG_CHAN_HELP_ENFORCE_R_DISABLED 4 -#define LNG_CHAN_RESPONSE 5 +#define LNG_CHAN_HELP 0 +#define LNG_ENFORCE_SYNTAX 1 +#define LNG_CHAN_HELP_ENFORCE 2 +#define LNG_CHAN_HELP_ENFORCE_R_ENABLED 3 +#define LNG_CHAN_HELP_ENFORCE_R_DISABLED 4 +#define LNG_CHAN_RESPONSE 5 class CSEnforce : public Module { @@ -52,7 +52,7 @@ class CSEnforce : public Module /* English (US) */ const char* langtable_en_us[] = { /* LNG_CHAN_HELP */ - " ENFORCE Enforce various channel modes and set options", + " ENFORCE Enforce various channel modes and set options", /* LNG_ENFORCE_SYNTAX */ "Syntax: \002ENFORCE \037channel\037 [\037what\037]\002", /* LNG_CHAN_HELP_ENFORCE */ @@ -86,7 +86,7 @@ class CSEnforce : public Module /* Dutch (NL) */ const char* langtable_nl[] = { /* LNG_CHAN_HELP */ - " ENFORCE Forceer enkele kanaalmodes en set-opties", + " ENFORCE Forceer enkele kanaalmodes en set-opties", /* LNG_ENFORCE_SYNTAX */ "Syntax: \002ENFORCE \037kanaal\037 [\037wat\037]\002", /* LNG_CHAN_HELP_ENFORCE */ @@ -122,7 +122,7 @@ class CSEnforce : public Module /* German (DE) */ const char* langtable_de[] = { /* LNG_CHAN_HELP */ - " ENFORCE Erzwingt verschieden Modes und SET Optionen", + " ENFORCE Erzwingt verschieden Modes und SET Optionen", /* LNG_ENFORCE_SYNTAX */ "Syntax: \002ENFORCE \037Channel\037 [\037was\037]\002", /* LNG_CHAN_HELP_ENFORCE */ @@ -155,7 +155,7 @@ class CSEnforce : public Module /* Portuguese (PT) */ const char* langtable_pt[] = { /* LNG_CHAN_HELP */ - " ENFORCE Verifica o cumprimento de vбrios modos de canal e opзхes ajustadas", + " ENFORCE Verifica o cumprimento de vбrios modos de canal e opзхes ajustadas", /* LNG_ENFORCE_SYNTAX */ "Sintaxe: \002ENFORCE \037canal\037 [\037opзгo\037]\002", /* LNG_CHAN_HELP_ENFORCE */ @@ -188,7 +188,7 @@ class CSEnforce : public Module /* Russian (RU) */ const char* langtable_ru[] = { /* LNG_CHAN_HELP */ - " ENFORCE Перепроверка и установка различных режимов и опций канала", + " ENFORCE Перепроверка и установка различных режимов и опций канала", /* LNG_ENFORCE_SYNTAX */ "Синтаксис: \002ENFORCE \037#канал\037 \037параметр\037\002", /* LNG_CHAN_HELP_ENFORCE */ @@ -220,7 +220,7 @@ class CSEnforce : public Module /* Italian (IT) */ const char* langtable_it[] = { /* LNG_CHAN_HELP */ - " ENFORCE Forza diversi modi di canale ed opzioni SET", + " ENFORCE Forza diversi modi di canale ed opzioni SET", /* LNG_ENFORCE_SYNTAX */ "Sintassi: \002ENFORCE \037canale\037 [\037cosa\037]\002", /* LNG_CHAN_HELP_ENFORCE */ @@ -264,206 +264,206 @@ class CSEnforce : public Module /* Enforcing functions */ void do_enforce_secureops(Channel * c) { - struct c_userlist *user; - struct c_userlist *next; - ChannelInfo *ci; - uint32 flags; - - if (!(ci = c->ci)) - return; - - if (debug) - alog("debug: cs_enforce: Enforcing SECUREOPS on %s", c->name); - - /* Dirty hack to allow chan_set_correct_modes to work ok. - * We pretend like SECUREOPS is on so it doesn't ignore that - * part of the code. This way we can enforce SECUREOPS even - * if it's off. - */ - flags = ci->flags; - ci->flags |= CI_SECUREOPS; - - user = c->users; - do { - next = user->next; - chan_set_correct_modes(user->user, c, 0); - user = next; - } while (user); - - ci->flags = flags; + struct c_userlist *user; + struct c_userlist *next; + ChannelInfo *ci; + uint32 flags; + + if (!(ci = c->ci)) + return; + + if (debug) + alog("debug: cs_enforce: Enforcing SECUREOPS on %s", c->name); + + /* Dirty hack to allow chan_set_correct_modes to work ok. + * We pretend like SECUREOPS is on so it doesn't ignore that + * part of the code. This way we can enforce SECUREOPS even + * if it's off. + */ + flags = ci->flags; + ci->flags |= CI_SECUREOPS; + + user = c->users; + do { + next = user->next; + chan_set_correct_modes(user->user, c, 0); + user = next; + } while (user); + + ci->flags = flags; } void do_enforce_restricted(Channel * c) { - struct c_userlist *user; - struct c_userlist *next; - ChannelInfo *ci; - int16 old_nojoin_level; - char mask[BUFSIZE]; - char *reason; - const char *av[3]; - User *u; - - if (!(ci = c->ci)) - return; - - if (debug) - alog("debug: cs_enforce: Enforcing RESTRICTED on %s", c->name); - - old_nojoin_level = ci->levels[CA_NOJOIN]; - if (ci->levels[CA_NOJOIN] < 0) - ci->levels[CA_NOJOIN] = 0; - - user = c->users; - do { - next = user->next; - u = user->user; - if (check_access(u, c->ci, CA_NOJOIN)) { - get_idealban(ci, u, mask, sizeof(mask)); - reason = getstring(u->na, CHAN_NOT_ALLOWED_TO_JOIN); - ircdproto->SendMode(whosends(ci), ci->name, "+b %s %lu", mask, - time(NULL)); - ircdproto->SendKick(whosends(ci), ci->name, u->nick, "%s", reason); - av[0] = ci->name; - av[1] = u->nick; - av[2] = reason; - do_kick(s_ChanServ, 3, av); - } - user = next; - } while (user); - - ci->levels[CA_NOJOIN] = old_nojoin_level; + struct c_userlist *user; + struct c_userlist *next; + ChannelInfo *ci; + int16 old_nojoin_level; + char mask[BUFSIZE]; + char *reason; + const char *av[3]; + User *u; + + if (!(ci = c->ci)) + return; + + if (debug) + alog("debug: cs_enforce: Enforcing RESTRICTED on %s", c->name); + + old_nojoin_level = ci->levels[CA_NOJOIN]; + if (ci->levels[CA_NOJOIN] < 0) + ci->levels[CA_NOJOIN] = 0; + + user = c->users; + do { + next = user->next; + u = user->user; + if (check_access(u, c->ci, CA_NOJOIN)) { + get_idealban(ci, u, mask, sizeof(mask)); + reason = getstring(u->na, CHAN_NOT_ALLOWED_TO_JOIN); + ircdproto->SendMode(whosends(ci), ci->name, "+b %s %lu", mask, + time(NULL)); + ircdproto->SendKick(whosends(ci), ci->name, u->nick, "%s", reason); + av[0] = ci->name; + av[1] = u->nick; + av[2] = reason; + do_kick(s_ChanServ, 3, av); + } + user = next; + } while (user); + + ci->levels[CA_NOJOIN] = old_nojoin_level; } void do_enforce_cmode_R(Channel * c) { - struct c_userlist *user; - struct c_userlist *next; - ChannelInfo *ci; - char mask[BUFSIZE]; - char *reason; - const char *av[3]; - User *u; - CBMode *cbm; - - if (!(ci = c->ci)) - return; - - if (debug) - alog("debug: cs_enforce: Enforcing mode +R on %s", c->name); - - user = c->users; - do { - next = user->next; - u = user->user; - if (!nick_identified(u)) { - get_idealban(ci, u, mask, sizeof(mask)); - reason = getstring(u->na, CHAN_NOT_ALLOWED_TO_JOIN); - if (((cbm = &cbmodes['R'])->flag == 0) - || !(c->mode & cbm->flag)) - ircdproto->SendMode(whosends(ci), ci->name, "+b %s %lu", mask, - time(NULL)); - ircdproto->SendKick(whosends(ci), ci->name, u->nick, "%s", reason); - av[0] = ci->name; - av[1] = u->nick; - av[2] = reason; - do_kick(s_ChanServ, 3, av); - } - user = next; - } while (user); + struct c_userlist *user; + struct c_userlist *next; + ChannelInfo *ci; + char mask[BUFSIZE]; + char *reason; + const char *av[3]; + User *u; + CBMode *cbm; + + if (!(ci = c->ci)) + return; + + if (debug) + alog("debug: cs_enforce: Enforcing mode +R on %s", c->name); + + user = c->users; + do { + next = user->next; + u = user->user; + if (!nick_identified(u)) { + get_idealban(ci, u, mask, sizeof(mask)); + reason = getstring(u->na, CHAN_NOT_ALLOWED_TO_JOIN); + if (((cbm = &cbmodes['R'])->flag == 0) + || !(c->mode & cbm->flag)) + ircdproto->SendMode(whosends(ci), ci->name, "+b %s %lu", mask, + time(NULL)); + ircdproto->SendKick(whosends(ci), ci->name, u->nick, "%s", reason); + av[0] = ci->name; + av[1] = u->nick; + av[2] = reason; + do_kick(s_ChanServ, 3, av); + } + user = next; + } while (user); } /* Enforcing Group Functions */ void do_enforce_set(Channel * c) { - ChannelInfo *ci; + ChannelInfo *ci; - if (!(ci = c->ci)) - return; + if (!(ci = c->ci)) + return; - if (ci->flags & CI_SECUREOPS) - do_enforce_secureops(c); - if (ci->flags & CI_RESTRICTED) - do_enforce_restricted(c); + if (ci->flags & CI_SECUREOPS) + do_enforce_secureops(c); + if (ci->flags & CI_RESTRICTED) + do_enforce_restricted(c); } void do_enforce_modes(Channel * c) { - CBMode *cbm; + CBMode *cbm; - if (((cbm = &cbmodes['R'])->flag != 0) && (c->mode & cbm->flag)) - do_enforce_cmode_R(c); + if (((cbm = &cbmodes['R'])->flag != 0) && (c->mode & cbm->flag)) + do_enforce_cmode_R(c); } /* End of enforcing functions */ int my_cs_enforce(User * u) { - char *cur_buffer; - char *chan=NULL; - char *what=NULL; - Channel *c; - ChannelInfo *ci; - - cur_buffer = moduleGetLastBuffer(); - chan = myStrGetToken(cur_buffer, ' ', 0); - - if (!chan) { - moduleNoticeLang(s_ChanServ, u, LNG_ENFORCE_SYNTAX); - } else if (!(c = findchan(chan))) { - notice_lang(s_ChanServ, u, CHAN_X_NOT_IN_USE, chan); - } else if (!(ci = c->ci)) { - notice_lang(s_ChanServ, u, CHAN_X_NOT_REGISTERED, chan); - } else if (ci->flags & CI_VERBOTEN) { - notice_lang(s_ChanServ, u, CHAN_X_FORBIDDEN, ci->name); - } else if (!is_services_admin(u) && !check_access(u, ci, CA_AKICK)) { - notice_lang(s_ChanServ, u, PERMISSION_DENIED); - } else { - what = myStrGetToken(cur_buffer, ' ', 1); - if (!what || (stricmp(what, "SET") == 0)) { - do_enforce_set(c); - moduleNoticeLang(s_ChanServ,u,LNG_CHAN_RESPONSE,what); - } else if (stricmp(what, "MODES") == 0) { - do_enforce_modes(c); - moduleNoticeLang(s_ChanServ,u,LNG_CHAN_RESPONSE,what); - } else if (stricmp(what, "SECUREOPS") == 0) { - do_enforce_secureops(c); - moduleNoticeLang(s_ChanServ,u,LNG_CHAN_RESPONSE,what); - } else if (stricmp(what, "RESTRICTED") == 0) { - do_enforce_restricted(c); - moduleNoticeLang(s_ChanServ,u,LNG_CHAN_RESPONSE,what); - } else if (stricmp(what, "+R") == 0) { - do_enforce_cmode_R(c); - moduleNoticeLang(s_ChanServ,u,LNG_CHAN_RESPONSE,what); - } else { - moduleNoticeLang(s_ChanServ, u, LNG_ENFORCE_SYNTAX); - } - } - - if(chan) free(chan); - if(what) free(what); - - return MOD_CONT; + char *cur_buffer; + char *chan=NULL; + char *what=NULL; + Channel *c; + ChannelInfo *ci; + + cur_buffer = moduleGetLastBuffer(); + chan = myStrGetToken(cur_buffer, ' ', 0); + + if (!chan) { + moduleNoticeLang(s_ChanServ, u, LNG_ENFORCE_SYNTAX); + } else if (!(c = findchan(chan))) { + notice_lang(s_ChanServ, u, CHAN_X_NOT_IN_USE, chan); + } else if (!(ci = c->ci)) { + notice_lang(s_ChanServ, u, CHAN_X_NOT_REGISTERED, chan); + } else if (ci->flags & CI_VERBOTEN) { + notice_lang(s_ChanServ, u, CHAN_X_FORBIDDEN, ci->name); + } else if (!is_services_admin(u) && !check_access(u, ci, CA_AKICK)) { + notice_lang(s_ChanServ, u, PERMISSION_DENIED); + } else { + what = myStrGetToken(cur_buffer, ' ', 1); + if (!what || (stricmp(what, "SET") == 0)) { + do_enforce_set(c); + moduleNoticeLang(s_ChanServ,u,LNG_CHAN_RESPONSE,what); + } else if (stricmp(what, "MODES") == 0) { + do_enforce_modes(c); + moduleNoticeLang(s_ChanServ,u,LNG_CHAN_RESPONSE,what); + } else if (stricmp(what, "SECUREOPS") == 0) { + do_enforce_secureops(c); + moduleNoticeLang(s_ChanServ,u,LNG_CHAN_RESPONSE,what); + } else if (stricmp(what, "RESTRICTED") == 0) { + do_enforce_restricted(c); + moduleNoticeLang(s_ChanServ,u,LNG_CHAN_RESPONSE,what); + } else if (stricmp(what, "+R") == 0) { + do_enforce_cmode_R(c); + moduleNoticeLang(s_ChanServ,u,LNG_CHAN_RESPONSE,what); + } else { + moduleNoticeLang(s_ChanServ, u, LNG_ENFORCE_SYNTAX); + } + } + + if(chan) free(chan); + if(what) free(what); + + return MOD_CONT; } /* Language and response stuff */ void my_cs_help(User * u) { - moduleNoticeLang(s_ChanServ, u, LNG_CHAN_HELP); + moduleNoticeLang(s_ChanServ, u, LNG_CHAN_HELP); } int my_cs_help_enforce(User * u) { - moduleNoticeLang(s_ChanServ, u, LNG_ENFORCE_SYNTAX); - ircdproto->SendMessage(findbot(s_ChanServ), u->nick, " "); - moduleNoticeLang(s_ChanServ, u, LNG_CHAN_HELP_ENFORCE); - ircdproto->SendMessage(findbot(s_ChanServ), u->nick, " "); - if (cbmodes['R'].flag != 0) - moduleNoticeLang(s_ChanServ, u, LNG_CHAN_HELP_ENFORCE_R_ENABLED); - else - moduleNoticeLang(s_ChanServ, u, LNG_CHAN_HELP_ENFORCE_R_DISABLED); - - return MOD_STOP; + moduleNoticeLang(s_ChanServ, u, LNG_ENFORCE_SYNTAX); + ircdproto->SendMessage(findbot(s_ChanServ), u->nick, " "); + moduleNoticeLang(s_ChanServ, u, LNG_CHAN_HELP_ENFORCE); + ircdproto->SendMessage(findbot(s_ChanServ), u->nick, " "); + if (cbmodes['R'].flag != 0) + moduleNoticeLang(s_ChanServ, u, LNG_CHAN_HELP_ENFORCE_R_ENABLED); + else + moduleNoticeLang(s_ChanServ, u, LNG_CHAN_HELP_ENFORCE_R_DISABLED); + + return MOD_STOP; } MODULE_INIT("cs_enforce", CSEnforce) diff --git a/src/modules/cs_tban.c b/src/modules/cs_tban.c index 327ec43e6..6045c7a98 100644 --- a/src/modules/cs_tban.c +++ b/src/modules/cs_tban.c @@ -33,11 +33,11 @@ int canBanUser(Channel * c, User * u, User * u2); void mAddLanguages(void); -#define LANG_NUM_STRINGS 4 -#define TBAN_HELP 0 -#define TBAN_SYNTAX 1 -#define TBAN_HELP_DETAIL 2 -#define TBAN_RESPONSE 3 +#define LANG_NUM_STRINGS 4 +#define TBAN_HELP 0 +#define TBAN_SYNTAX 1 +#define TBAN_HELP_DETAIL 2 +#define TBAN_RESPONSE 3 class CSTBan : public Module { @@ -56,7 +56,7 @@ class CSTBan : public Module this->SetType(SUPPORTED); const char* langtable_en_us[] = { - " TBAN Bans the user for a given length of time", + " TBAN Bans the user for a given length of time", "Syntax: TBAN channel nick time", "Bans the given user from a channel for a specified length of\n" "time. If the ban is removed before by hand, it will NOT be replaced.", @@ -64,7 +64,7 @@ class CSTBan : public Module }; const char* langtable_nl[] = { - " TBAN Verban een gebruiker voor een bepaalde tijd", + " TBAN Verban een gebruiker voor een bepaalde tijd", "Syntax: TBAN kanaal nick tijd", "Verbant de gegeven gebruiken van het gegeven kanaal voor de\n" "gegeven tijdsduur. Als de verbanning eerder wordt verwijderd,\n" @@ -73,7 +73,7 @@ class CSTBan : public Module }; const char* langtable_de[] = { - " TBAN Bant ein User fьr eine bestimmte Zeit aus ein Channel", + " TBAN Bant ein User fьr eine bestimmte Zeit aus ein Channel", "Syntax: TBAN Channel Nickname Zeit", "Bant ein User fьr eine bestimmte Zeit aus ein Channel\n" "Wenn der Ban manuell entfernt wird, wird es NICHT ersetzt.", @@ -81,7 +81,7 @@ class CSTBan : public Module }; const char* langtable_pt[] = { - " TBAN Bane o usuбrio por um determinado perнodo de tempo", + " TBAN Bane o usuбrio por um determinado perнodo de tempo", "Sintaxe: TBAN canal nick tempo", "Bane de um canal o usuбrio especificado por um determinado perнodo de\n" "tempo. Se o ban for removido manualmente antes do tempo, ele nгo serб recolocado.", @@ -89,7 +89,7 @@ class CSTBan : public Module }; const char* langtable_ru[] = { - " TBAN Банит пользователя на указанный промежуток времени", + " TBAN Банит пользователя на указанный промежуток времени", "Синтаксис: TBAN #канал ник время", "Банит пользователя на указанный промежуток времени в секундах\n" "Примечание: удаленный вручную (до своего истечения) бан НЕ БУДЕТ\n" @@ -98,7 +98,7 @@ class CSTBan : public Module }; const char* langtable_it[] = { - " TBAN Banna l'utente per un periodo di tempo specificato", + " TBAN Banna l'utente per un periodo di tempo specificato", "Sintassi: TBAN canale nick tempo", "Banna l'utente specificato da un canale per un periodo di tempo\n" "specificato. Se il ban viene rimosso a mano prima della scadenza, NON verrа rimpiazzato.", @@ -118,120 +118,120 @@ class CSTBan : public Module void myHelp(User * u) { - moduleNoticeLang(s_ChanServ, u, TBAN_HELP); + moduleNoticeLang(s_ChanServ, u, TBAN_HELP); } void myFullHelpSyntax(User * u) { - moduleNoticeLang(s_ChanServ, u, TBAN_SYNTAX); + moduleNoticeLang(s_ChanServ, u, TBAN_SYNTAX); } int myFullHelp(User * u) { - myFullHelpSyntax(u); - ircdproto->SendMessage(findbot(s_ChanServ), u->nick, " "); - moduleNoticeLang(s_ChanServ, u, TBAN_HELP_DETAIL); - return MOD_CONT; + myFullHelpSyntax(u); + ircdproto->SendMessage(findbot(s_ChanServ), u->nick, " "); + moduleNoticeLang(s_ChanServ, u, TBAN_HELP_DETAIL); + return MOD_CONT; } void mySendResponse(User * u, char *channel, char *mask, char *time) { - moduleNoticeLang(s_ChanServ, u, TBAN_RESPONSE, mask, channel, time); + moduleNoticeLang(s_ChanServ, u, TBAN_RESPONSE, mask, channel, time); } int do_tban(User * u) { - char mask[BUFSIZE]; - Channel *c; - User *u2 = NULL; - - char *buffer = moduleGetLastBuffer(); - char *chan; - char *nick; - char *time; - - chan = myStrGetToken(buffer, ' ', 0); - nick = myStrGetToken(buffer, ' ', 1); - time = myStrGetToken(buffer, ' ', 2); - - if (time && chan && nick) { - - if (!(c = findchan(chan))) { - notice_lang(s_ChanServ, u, CHAN_X_NOT_IN_USE, chan); - } else if (!(u2 = finduser(nick))) { - notice_lang(s_ChanServ, u, NICK_X_NOT_IN_USE, nick); - } else { - if (canBanUser(c, u, u2)) { - get_idealban(c->ci, u2, mask, sizeof(mask)); - addBan(c, dotime(time), mask); - mySendResponse(u, chan, mask, time); - } - } - } else { - myFullHelpSyntax(u); - } - if (time) - free(time); - if (nick) - free(nick); - if (chan) - free(chan); - - return MOD_CONT; + char mask[BUFSIZE]; + Channel *c; + User *u2 = NULL; + + char *buffer = moduleGetLastBuffer(); + char *chan; + char *nick; + char *time; + + chan = myStrGetToken(buffer, ' ', 0); + nick = myStrGetToken(buffer, ' ', 1); + time = myStrGetToken(buffer, ' ', 2); + + if (time && chan && nick) { + + if (!(c = findchan(chan))) { + notice_lang(s_ChanServ, u, CHAN_X_NOT_IN_USE, chan); + } else if (!(u2 = finduser(nick))) { + notice_lang(s_ChanServ, u, NICK_X_NOT_IN_USE, nick); + } else { + if (canBanUser(c, u, u2)) { + get_idealban(c->ci, u2, mask, sizeof(mask)); + addBan(c, dotime(time), mask); + mySendResponse(u, chan, mask, time); + } + } + } else { + myFullHelpSyntax(u); + } + if (time) + free(time); + if (nick) + free(nick); + if (chan) + free(chan); + + return MOD_CONT; } void addBan(Channel * c, time_t timeout, char *banmask) { - const char *av[3]; - char *cb[2]; + const char *av[3]; + char *cb[2]; - cb[0] = c->name; - cb[1] = banmask; + cb[0] = c->name; + cb[1] = banmask; - av[0] = "+b"; - av[1] = banmask; + av[0] = "+b"; + av[1] = banmask; - ircdproto->SendMode(whosends(c->ci), c->name, "+b %s", av[1]); - chan_set_modes(s_ChanServ, c, 2, av, 1); + ircdproto->SendMode(whosends(c->ci), c->name, "+b %s", av[1]); + chan_set_modes(s_ChanServ, c, 2, av, 1); - moduleAddCallback("tban", time(NULL) + timeout, delBan, 2, cb); + moduleAddCallback("tban", time(NULL) + timeout, delBan, 2, cb); } int delBan(int argc, char **argv) { - const char *av[3]; - Channel *c; + const char *av[3]; + Channel *c; - av[0] = "-b"; - av[1] = argv[1]; + av[0] = "-b"; + av[1] = argv[1]; - if ((c = findchan(argv[0])) && c->ci) { - ircdproto->SendMode(whosends(c->ci), c->name, "-b %s", av[1]); - chan_set_modes(s_ChanServ, c, 2, av, 1); - } + if ((c = findchan(argv[0])) && c->ci) { + ircdproto->SendMode(whosends(c->ci), c->name, "-b %s", av[1]); + chan_set_modes(s_ChanServ, c, 2, av, 1); + } - return MOD_CONT; + return MOD_CONT; } int canBanUser(Channel * c, User * u, User * u2) { - ChannelInfo *ci; - int ok = 0; - if (!(ci = c->ci)) { - notice_lang(s_ChanServ, u, CHAN_X_NOT_REGISTERED, c->name); - } else if (ci->flags & CI_VERBOTEN) { - notice_lang(s_ChanServ, u, CHAN_X_FORBIDDEN, c->name); - } else if (!check_access(u, ci, CA_BAN)) { - notice_lang(s_ChanServ, u, ACCESS_DENIED); - } else if (ircd->except && is_excepted(ci, u2)) { - notice_lang(s_ChanServ, u, CHAN_EXCEPTED, u2->nick, ci->name); - } else if (ircd->protectedumode && is_protected(u2)) { - notice_lang(s_ChanServ, u, PERMISSION_DENIED); - } else { - ok = 1; - } - - return ok; + ChannelInfo *ci; + int ok = 0; + if (!(ci = c->ci)) { + notice_lang(s_ChanServ, u, CHAN_X_NOT_REGISTERED, c->name); + } else if (ci->flags & CI_VERBOTEN) { + notice_lang(s_ChanServ, u, CHAN_X_FORBIDDEN, c->name); + } else if (!check_access(u, ci, CA_BAN)) { + notice_lang(s_ChanServ, u, ACCESS_DENIED); + } else if (ircd->except && is_excepted(ci, u2)) { + notice_lang(s_ChanServ, u, CHAN_EXCEPTED, u2->nick, ci->name); + } else if (ircd->protectedumode && is_protected(u2)) { + notice_lang(s_ChanServ, u, PERMISSION_DENIED); + } else { + ok = 1; + } + + return ok; } diff --git a/src/modules/demos/catserv/catserv_messages.c b/src/modules/demos/catserv/catserv_messages.c index 23c1b4ec1..667b336b5 100644 --- a/src/modules/demos/catserv/catserv_messages.c +++ b/src/modules/demos/catserv/catserv_messages.c @@ -5,10 +5,10 @@ void addMessageList(void) { - Command *c; - c = createCommand("meow", do_meow, NULL, -1, -1, -1, -1, -1); - this->AddCommand(Catserv_cmdTable, c, MOD_UNIQUE); - c = createCommand("purr", do_purr, NULL, -1, -1, -1, -1, -1); - this->AddCommand(Catserv_cmdTable, c, MOD_UNIQUE); + Command *c; + c = createCommand("meow", do_meow, NULL, -1, -1, -1, -1, -1); + this->AddCommand(Catserv_cmdTable, c, MOD_UNIQUE); + c = createCommand("purr", do_purr, NULL, -1, -1, -1, -1, -1); + this->AddCommand(Catserv_cmdTable, c, MOD_UNIQUE); } diff --git a/src/modules/demos/catserv/ircd_catserv.c b/src/modules/demos/catserv/ircd_catserv.c index 763ae9cec..0f98df58a 100644 --- a/src/modules/demos/catserv/ircd_catserv.c +++ b/src/modules/demos/catserv/ircd_catserv.c @@ -22,89 +22,89 @@ char *s_CatServ = "CatServ"; int AnopeInit(int argc, char **argv) { - Message *msg = NULL; - int status; + Message *msg = NULL; + int status; #ifdef IRC_UNREAL32 - if (UseTokens) { - msg = createMessage("!", my_privmsg); - } else { - msg = createMessage("PRIVMSG", my_privmsg); - } + if (UseTokens) { + msg = createMessage("!", my_privmsg); + } else { + msg = createMessage("PRIVMSG", my_privmsg); + } #else - msg = createMessage("PRIVMSG", my_privmsg); + msg = createMessage("PRIVMSG", my_privmsg); #endif - status = moduleAddMessage(msg, MOD_HEAD); - if (status == MOD_ERR_OK) { - addClient(s_CatServ, "meow!"); - addMessageList(); - } - this->SetAuthor(AUTHOR); - this->SetVersion(VERSION); - alog("ircd_catserv.so: loaded, message status [%d]", status); - return MOD_CONT; + status = moduleAddMessage(msg, MOD_HEAD); + if (status == MOD_ERR_OK) { + addClient(s_CatServ, "meow!"); + addMessageList(); + } + this->SetAuthor(AUTHOR); + this->SetVersion(VERSION); + alog("ircd_catserv.so: loaded, message status [%d]", status); + return MOD_CONT; } void AnopeFini(void) { - delClient(); + delClient(); } int my_privmsg(char *source, int ac, char **av) { - User *u; - char *s; + User *u; + char *s; - /* First, some basic checks */ - if (ac != 2) - return MOD_CONT; /* bleh */ - if (!(u = finduser(source))) { - return MOD_CONT; - } /* non-user source */ - if (*av[0] == '#') { - return MOD_CONT; - } - /* Channel message */ - /* we should prolly honour the ignore list here, but i cba for this... */ - s = strchr(av[0], '@'); - if (s) { - *s++ = 0; - if (stricmp(s, ServerName) != 0) - return MOD_CONT; - } - if ((stricmp(av[0], s_CatServ)) == 0) { /* its for US! */ - catserv(u, av[1]); - return MOD_STOP; - } else { /* ok it isnt us, let the old code have it */ - return MOD_CONT; - } + /* First, some basic checks */ + if (ac != 2) + return MOD_CONT; /* bleh */ + if (!(u = finduser(source))) { + return MOD_CONT; + } /* non-user source */ + if (*av[0] == '#') { + return MOD_CONT; + } + /* Channel message */ + /* we should prolly honour the ignore list here, but i cba for this... */ + s = strchr(av[0], '@'); + if (s) { + *s++ = 0; + if (stricmp(s, ServerName) != 0) + return MOD_CONT; + } + if ((stricmp(av[0], s_CatServ)) == 0) { /* its for US! */ + catserv(u, av[1]); + return MOD_STOP; + } else { /* ok it isnt us, let the old code have it */ + return MOD_CONT; + } } void addClient(char *nick, char *realname) { - anope_SendClientIntroduction(nick, "catserv", "meow.meow.land", realname, "+"); + anope_SendClientIntroduction(nick, "catserv", "meow.meow.land", realname, "+"); } void delClient(void) { - anope_SendQuit(s_CatServ, "QUIT :Module Unloaded!"); + anope_SendQuit(s_CatServ, "QUIT :Module Unloaded!"); } /*****************************************************************************/ /* Main CatServ routine. */ void catserv(User * u, char *buf) { - char *cmd, *s; + char *cmd, *s; - cmd = strtok(buf, " "); + cmd = strtok(buf, " "); - if (!cmd) { - return; - } else if (stricmp(cmd, "\1PING") == 0) { - if (!(s = strtok(NULL, ""))) - s = "\1"; - notice(s_CatServ, u->nick, "\1PING %s", s); - } else { - mod_run_cmd(s_CatServ, u, Catserv_cmdTable, cmd); - } + if (!cmd) { + return; + } else if (stricmp(cmd, "\1PING") == 0) { + if (!(s = strtok(NULL, ""))) + s = "\1"; + notice(s_CatServ, u->nick, "\1PING %s", s); + } else { + mod_run_cmd(s_CatServ, u, Catserv_cmdTable, cmd); + } } diff --git a/src/modules/demos/catserv/purr.c b/src/modules/demos/catserv/purr.c index 5a39dc26e..e7c1e9c8d 100644 --- a/src/modules/demos/catserv/purr.c +++ b/src/modules/demos/catserv/purr.c @@ -3,6 +3,6 @@ int do_purr(User * u) { - notice(s_CatServ, u->nick, "PURR!"); - return MOD_STOP; + notice(s_CatServ, u->nick, "PURR!"); + return MOD_STOP; } diff --git a/src/modules/demos/events.c b/src/modules/demos/events.c index 25dd79fb9..bea3ccd6d 100644 --- a/src/modules/demos/events.c +++ b/src/modules/demos/events.c @@ -17,22 +17,22 @@ int do_moo(int argc, char **argv); int AnopeInit(int argc, char **argv) { - EvtMessage *msg = NULL; - EvtHook *hook = NULL; - int status; - msg = createEventHandler("NICK", my_nick); - status = moduleAddEventHandler(msg); + EvtMessage *msg = NULL; + EvtHook *hook = NULL; + int status; + msg = createEventHandler("NICK", my_nick); + status = moduleAddEventHandler(msg); - hook = createEventHook(EVENT_DB_SAVING, my_save); - status = this->AddEventHook(hook); + hook = createEventHook(EVENT_DB_SAVING, my_save); + status = this->AddEventHook(hook); - hook = createEventHook(EVENT_BOT_FANTASY, do_moo); - status = this->AddEventHook(hook); - - this->SetAuthor(AUTHOR); - this->SetVersion(VERSION); - return MOD_CONT; + hook = createEventHook(EVENT_BOT_FANTASY, do_moo); + status = this->AddEventHook(hook); + + this->SetAuthor(AUTHOR); + this->SetVersion(VERSION); + return MOD_CONT; } void AnopeFini(void) @@ -50,9 +50,9 @@ int my_save(int argc, char **argv) { if(argc>=1) { if (!stricmp(argv[0], EVENT_START)) { - alog("Saving the databases! has started"); + alog("Saving the databases! has started"); } else { - alog("Saving the databases is complete"); + alog("Saving the databases is complete"); } } return MOD_CONT; @@ -68,15 +68,15 @@ int my_save(int argc, char **argv) * @return MOD_CONT or MOD_STOP **/ int do_moo(int argc, char **argv) { - ChannelInfo *ci; - if(argc>=3) { /* We need at least 3 arguments */ + ChannelInfo *ci; + if(argc>=3) { /* We need at least 3 arguments */ if(stricmp(argv[0],"moo")==0) { /* is it meant for us? */ - if((ci = cs_findchan(argv[2]))) { /* channel should always exist */ - anope_cmd_privmsg(ci->bi->nick, ci->name, "%cACTION moo's at %s %c",1,argv[1],1); - return MOD_STOP; /* We've dealt with it, dont let others */ - } + if((ci = cs_findchan(argv[2]))) { /* channel should always exist */ + anope_cmd_privmsg(ci->bi->nick, ci->name, "%cACTION moo's at %s %c",1,argv[1],1); + return MOD_STOP; /* We've dealt with it, dont let others */ + } } - } - return MOD_CONT; /* guess it wasnt for us, pass it on */ + } + return MOD_CONT; /* guess it wasnt for us, pass it on */ } diff --git a/src/modules/demos/hs_conf.c b/src/modules/demos/hs_conf.c index 233aa2ff1..755b1bae4 100644 --- a/src/modules/demos/hs_conf.c +++ b/src/modules/demos/hs_conf.c @@ -14,24 +14,24 @@ int mReadConfig(int argc, char **argv); char *setting; int AnopeInit(int argc, char **argv) { - Command *c; - EvtHook *hook; - int status = 0; + Command *c; + EvtHook *hook; + int status = 0; - setting = NULL; + setting = NULL; - mReadConfig(0,NULL); - - c = createCommand("SHOW",mShowSetting,NULL,-1,-1,-1,-1,-1); - status = this->AddCommand(HOSTSERV, c, MOD_HEAD); + mReadConfig(0,NULL); + + c = createCommand("SHOW",mShowSetting,NULL,-1,-1,-1,-1,-1); + status = this->AddCommand(HOSTSERV, c, MOD_HEAD); - hook = createEventHook(EVENT_RELOAD, mReadConfig); - status = this->AddEventHook(hook); - - if(status!=MOD_ERR_OK) { + hook = createEventHook(EVENT_RELOAD, mReadConfig); + status = this->AddEventHook(hook); + + if(status!=MOD_ERR_OK) { return MOD_STOP; - } - return MOD_CONT; + } + return MOD_CONT; } /** @@ -46,8 +46,8 @@ void AnopeFini(void) { * Simple function to show the user the current config setting **/ int mShowSetting(User *u) { - notice(s_HostServ,u->nick,"Setting in use is [%s]",setting); - return MOD_CONT; + notice(s_HostServ,u->nick,"Setting in use is [%s]",setting); + return MOD_CONT; } /** @@ -55,19 +55,19 @@ int mShowSetting(User *u) { * the EVENT_RELOAD event is recived. **/ int mReadConfig(int argc, char **argv) { - char *tmp=NULL; - Directive d[] = {{"HSConfigSetting", {{PARAM_STRING, PARAM_RELOAD, &tmp}}}}; - moduleGetConfigDirective(d); + char *tmp=NULL; + Directive d[] = {{"HSConfigSetting", {{PARAM_STRING, PARAM_RELOAD, &tmp}}}}; + moduleGetConfigDirective(d); - if(setting) { - free(setting); - } - if(tmp) { + if(setting) { + free(setting); + } + if(tmp) { setting = tmp; - } else { + } else { setting = sstrdup(DEFAULT_SETTING); - } - return MOD_CONT; + } + return MOD_CONT; } diff --git a/src/modules/demos/hs_moo.c b/src/modules/demos/hs_moo.c index 61210271b..ab677527c 100644 --- a/src/modules/demos/hs_moo.c +++ b/src/modules/demos/hs_moo.c @@ -22,22 +22,22 @@ int myHostServMooRootHelp(User *u); /* Function to display extra help t int AnopeInit(int argc, char **argv) /* This will be executed when the module is loaded */ { - Command *c; /* Pointer to a Command */ - int status = 0; /* the status of our new command */ - c = createCommand("moo", hs_moo_show, NULL, -1, -1, -1, -1, -1); /* Create a new command "moo" pointing to hs_moo */ + Command *c; /* Pointer to a Command */ + int status = 0; /* the status of our new command */ + c = createCommand("moo", hs_moo_show, NULL, -1, -1, -1, -1, -1); /* Create a new command "moo" pointing to hs_moo */ - moduleAddHelp(c,myHostServMooHelp); /* add help for all users to this command */ - moduleAddRegHelp(c,myHostServMooRegHelp); /* add extra regular-user only help to this command */ - moduleAddOperHelp(c,myHostServMooOperHelp); /* add extra oper only help to this command */ - moduleAddAdminHelp(c,myHostServMooAdminHelp); /* add extra admin only help to this command */ - moduleAddRootHelp(c,myHostServMooRootHelp); /* add extra root only help to this command */ + moduleAddHelp(c,myHostServMooHelp); /* add help for all users to this command */ + moduleAddRegHelp(c,myHostServMooRegHelp); /* add extra regular-user only help to this command */ + moduleAddOperHelp(c,myHostServMooOperHelp); /* add extra oper only help to this command */ + moduleAddAdminHelp(c,myHostServMooAdminHelp); /* add extra admin only help to this command */ + moduleAddRootHelp(c,myHostServMooRootHelp); /* add extra root only help to this command */ - moduleSetHostHelp(myHostServHelp); /* add us to the .hs help list */ + moduleSetHostHelp(myHostServHelp); /* add us to the .hs help list */ - status = this->AddCommand(HOSTSERV, c, MOD_HEAD); /* Add the command to the HOSTSERV cmd table */ + status = this->AddCommand(HOSTSERV, c, MOD_HEAD); /* Add the command to the HOSTSERV cmd table */ - /* Check if we have any argv's */ - if(argc>0) { + /* Check if we have any argv's */ + if(argc>0) { /* we do, the first will be the nick of the person modload'ing us */ /* or NULL if we were auto-loaded */ if(argv[0]) { @@ -45,24 +45,24 @@ int AnopeInit(int argc, char **argv) /* This will be executed when the mod } else { alog("hs_moo was automatically loaded by anope"); } - } - alog("hs_moo.so: Add Command 'moo' Status: %d",status); /* Log the command being added */ - - moduleAddCallback("test",time(NULL)+dotime("15s"),test,0,NULL); /* set a call-back function to exec in 3 mins time */ - moduleDelCallback("test"); - this->SetAuthor(AUTHOR); /* tell Anope about the author */ - this->SetVersion(VERSION); /* Tell Anope about the verison */ - - if(status!=MOD_ERR_OK) { + } + alog("hs_moo.so: Add Command 'moo' Status: %d",status); /* Log the command being added */ + + moduleAddCallback("test",time(NULL)+dotime("15s"),test,0,NULL); /* set a call-back function to exec in 3 mins time */ + moduleDelCallback("test"); + this->SetAuthor(AUTHOR); /* tell Anope about the author */ + this->SetVersion(VERSION); /* Tell Anope about the verison */ + + if(status!=MOD_ERR_OK) { return MOD_STOP; - } - return MOD_CONT; + } + return MOD_CONT; } int hs_moo_show(User * u) { - notice(s_HostServ, u->nick, "MOO! - This command was loaded via a module!"); /* Just notice the user */ - return MOD_STOP; /* MOD_STOP means we will NOT pass control back to other */ + notice(s_HostServ, u->nick, "MOO! - This command was loaded via a module!"); /* Just notice the user */ + return MOD_STOP; /* MOD_STOP means we will NOT pass control back to other */ } /* modules waiting to handle the /hs moo command! */ int test(int argc, char **argv) { @@ -76,11 +76,11 @@ void AnopeFini(void) } /***************************************************************************************************************************************/ -/* The code below here shows various ways of dealing with the module help system */ +/* The code below here shows various ways of dealing with the module help system */ /***************************************************************************************************************************************/ void myHostServHelp(User *u) { - notice(s_HostServ,u->nick, " MOO Moo's at the user!"); /* this will appear in the help list */ + notice(s_HostServ,u->nick, " MOO Moo's at the user!"); /* this will appear in the help list */ } int myHostServMooHelp(User *u) { diff --git a/src/modules/hs_request.c b/src/modules/hs_request.c index cd9939e96..e9ad605a8 100644 --- a/src/modules/hs_request.c +++ b/src/modules/hs_request.c @@ -1,5 +1,5 @@ /* hs_request.c - Add request and activate functionality to HostServ, - * along with adding +req as optional param to HostServ list. + * along with adding +req as optional param to HostServ list. * * (C) 2003-2008 Anope Team * Contact us at info@anope.org @@ -65,7 +65,7 @@ int hs_help_waiting(User * u); void hs_help(User * u); void my_add_host_request(char *nick, char *vIdent, char *vhost, - char *creator, int32 tmp_time); + char *creator, int32 tmp_time); int my_isvalidchar(const char c); void my_memo_lang(User * u, char *name, int z, int number, ...); void req_send_memos(User * u, char *vHost); @@ -155,11 +155,11 @@ class HSRequest : public Module /* LNG_NO_REQUEST */ "No request for nick %s found.", /* LNG_HELP */ - " REQUEST Request a vHost for your nick", + " REQUEST Request a vHost for your nick", /* LNG_HELP_SETTER */ - " ACTIVATE Approve the requested vHost of a user\n" - " REJECT Reject the requested vHost of a user\n" - " WAITING Convenience command for LIST +req", + " ACTIVATE Approve the requested vHost of a user\n" + " REJECT Reject the requested vHost of a user\n" + " WAITING Convenience command for LIST +req", /* LNG_HELP_REQUEST */ "Request the given vHost to be actived for your nick by the\n" "network administrators. Please be patient while your request\n" @@ -205,11 +205,11 @@ class HSRequest : public Module /* LNG_NO_REQUEST */ "Geen aanvraag voor nick %s gevonden.", /* LNG_HELP */ - " REQUEST Vraag een vHost aan voor je nick", + " REQUEST Vraag een vHost aan voor je nick", /* LNG_HELP_SETTER */ - " ACTIVATE Activeer de aangevraagde vHost voor een gebruiker\n" - " REJECT Keur de aangevraagde vHost voor een gebruiker af\n" - " WAITING Snelkoppeling naar LIST +req", + " ACTIVATE Activeer de aangevraagde vHost voor een gebruiker\n" + " REJECT Keur de aangevraagde vHost voor een gebruiker af\n" + " WAITING Snelkoppeling naar LIST +req", /* LNG_HELP_REQUEST */ "Verzoek de gegeven vHost te activeren voor jouw nick bij de\n" "netwerk beheerders. Het kan even duren voordat je aanvraag\n" @@ -255,11 +255,11 @@ class HSRequest : public Module /* LNG_NO_REQUEST */ "Nenhum pedido encontrado para o nick %s.", /* LNG_HELP */ - " REQUEST Request a vHost for your nick", + " REQUEST Request a vHost for your nick", /* LNG_HELP_SETTER */ - " ACTIVATE Aprova o pedido de vHost de um usuбrio\n" - " REJECT Recusa o pedido de vHost de um usuбrio\n" - " WAITING Comando para LISTAR +req", + " ACTIVATE Aprova o pedido de vHost de um usuбrio\n" + " REJECT Recusa o pedido de vHost de um usuбrio\n" + " WAITING Comando para LISTAR +req", /* LNG_HELP_REQUEST */ "Solicita a ativaзгo do vHost fornecido em seu nick pelos\n" "administradores da rede. Por favor, tenha paciкncia\n" @@ -305,11 +305,11 @@ class HSRequest : public Module /* LNG_NO_REQUEST */ "Запрос на vHost для ника %s не найден.", /* LNG_HELP */ - " REQUEST Запрос на vHost для вашего текущего ника", + " REQUEST Запрос на vHost для вашего текущего ника", /* LNG_HELP_SETTER */ - " ACTIVATE Утвердить запрашиваемый пользователем vHost\n" - " REJECT Отклонить запрашиваемый пользователем vHost\n" - " WAITING Список запросов ожидающих обработки (аналог LIST +req)", + " ACTIVATE Утвердить запрашиваемый пользователем vHost\n" + " REJECT Отклонить запрашиваемый пользователем vHost\n" + " WAITING Список запросов ожидающих обработки (аналог LIST +req)", /* LNG_HELP_REQUEST */ "Отправляет запрос на активацию vHost, который будет рассмотрен одним из\n" "администраторов сети. Просьба проявить терпение, пока запрос\n" @@ -355,11 +355,11 @@ class HSRequest : public Module /* LNG_NO_REQUEST */ "Nessuna richiesta trovata per il nick %s.", /* LNG_HELP */ - " REQUEST Richiede un vHost per il tuo nick", + " REQUEST Richiede un vHost per il tuo nick", /* LNG_HELP_SETTER */ - " ACTIVATE Approva il vHost richiesto di un utente\n" - " REJECT Rifiuta il vHost richiesto di un utente\n" - " WAITING Comando per LIST +req", + " ACTIVATE Approva il vHost richiesto di un utente\n" + " REJECT Rifiuta il vHost richiesto di un utente\n" + " WAITING Comando per LIST +req", /* LNG_HELP_REQUEST */ "Richiede l'attivazione del vHost specificato per il tuo nick da parte\n" "degli amministratori di rete. Sei pregato di pazientare finchи la tua\n" @@ -400,577 +400,577 @@ class HSRequest : public Module int hs_do_request(User * u) { - char *cur_buffer; - char *nick; - char *rawhostmask; - char hostmask[HOSTMAX]; - NickAlias *na; - int32 tmp_time; - char *s; - char *vIdent = NULL; - time_t now = time(NULL); - - cur_buffer = moduleGetLastBuffer(); - nick = u->nick; - rawhostmask = myStrGetToken(cur_buffer, ' ', 0); - - if (!nick || !rawhostmask) { - if (rawhostmask) - free(rawhostmask); - moduleNoticeLang(s_HostServ, u, LNG_REQUEST_SYNTAX); - return MOD_CONT; - } - - vIdent = myStrGetOnlyToken(rawhostmask, '@', 0); /* Get the first substring, @ as delimiter */ - if (vIdent) { - rawhostmask = myStrGetTokenRemainder(rawhostmask, '@', 1); /* get the remaining string */ - if (!rawhostmask) { - moduleNoticeLang(s_HostServ, u, LNG_REQUEST_SYNTAX); - free(vIdent); - return MOD_CONT; - } - if (strlen(vIdent) > USERMAX - 1) { - notice_lang(s_HostServ, u, HOST_SET_IDENTTOOLONG, USERMAX); - free(vIdent); - free(rawhostmask); - return MOD_CONT; - } else { - for (s = vIdent; *s; s++) { - if (!my_isvalidchar(*s)) { - notice_lang(s_HostServ, u, HOST_SET_IDENT_ERROR); - free(vIdent); - free(rawhostmask); - return MOD_CONT; - } - } - } - if (!ircd->vident) { - notice_lang(s_HostServ, u, HOST_NO_VIDENT); - free(vIdent); - free(rawhostmask); - return MOD_CONT; - } - } - if (strlen(rawhostmask) < HOSTMAX - 1) { - snprintf(hostmask, HOSTMAX, "%s", rawhostmask); - } else { - notice_lang(s_HostServ, u, HOST_SET_TOOLONG, HOSTMAX); - if (vIdent) - free(vIdent); - free(rawhostmask); - return MOD_CONT; - } - - if (!isValidHost(hostmask, 3)) { - notice_lang(s_HostServ, u, HOST_SET_ERROR); - if (vIdent) - free(vIdent); - free(rawhostmask); - return MOD_CONT; - } - - tmp_time = time(NULL); - if ((na = findnick(nick))) { - if (HSRequestMemoOper || HSRequestMemoSetters) { - if (MSSendDelay > 0 && u - && u->lastmemosend + MSSendDelay > now) { - moduleNoticeLang(s_HostServ, u, LNG_REQUEST_WAIT, - MSSendDelay); - u->lastmemosend = now; - if (vIdent) - free(vIdent); - free(rawhostmask); - return MOD_CONT; - } - } - my_add_host_request(nick, vIdent, hostmask, u->nick, tmp_time); - - moduleNoticeLang(s_HostServ, u, LNG_REQUESTED); - req_send_memos(u, hostmask); - alog("New vHost Requested by %s", nick); - } else { - notice_lang(s_HostServ, u, HOST_NOREG, nick); - } - - if (vIdent) - free(vIdent); - free(rawhostmask); - - return MOD_CONT; + char *cur_buffer; + char *nick; + char *rawhostmask; + char hostmask[HOSTMAX]; + NickAlias *na; + int32 tmp_time; + char *s; + char *vIdent = NULL; + time_t now = time(NULL); + + cur_buffer = moduleGetLastBuffer(); + nick = u->nick; + rawhostmask = myStrGetToken(cur_buffer, ' ', 0); + + if (!nick || !rawhostmask) { + if (rawhostmask) + free(rawhostmask); + moduleNoticeLang(s_HostServ, u, LNG_REQUEST_SYNTAX); + return MOD_CONT; + } + + vIdent = myStrGetOnlyToken(rawhostmask, '@', 0); /* Get the first substring, @ as delimiter */ + if (vIdent) { + rawhostmask = myStrGetTokenRemainder(rawhostmask, '@', 1); /* get the remaining string */ + if (!rawhostmask) { + moduleNoticeLang(s_HostServ, u, LNG_REQUEST_SYNTAX); + free(vIdent); + return MOD_CONT; + } + if (strlen(vIdent) > USERMAX - 1) { + notice_lang(s_HostServ, u, HOST_SET_IDENTTOOLONG, USERMAX); + free(vIdent); + free(rawhostmask); + return MOD_CONT; + } else { + for (s = vIdent; *s; s++) { + if (!my_isvalidchar(*s)) { + notice_lang(s_HostServ, u, HOST_SET_IDENT_ERROR); + free(vIdent); + free(rawhostmask); + return MOD_CONT; + } + } + } + if (!ircd->vident) { + notice_lang(s_HostServ, u, HOST_NO_VIDENT); + free(vIdent); + free(rawhostmask); + return MOD_CONT; + } + } + if (strlen(rawhostmask) < HOSTMAX - 1) { + snprintf(hostmask, HOSTMAX, "%s", rawhostmask); + } else { + notice_lang(s_HostServ, u, HOST_SET_TOOLONG, HOSTMAX); + if (vIdent) + free(vIdent); + free(rawhostmask); + return MOD_CONT; + } + + if (!isValidHost(hostmask, 3)) { + notice_lang(s_HostServ, u, HOST_SET_ERROR); + if (vIdent) + free(vIdent); + free(rawhostmask); + return MOD_CONT; + } + + tmp_time = time(NULL); + if ((na = findnick(nick))) { + if (HSRequestMemoOper || HSRequestMemoSetters) { + if (MSSendDelay > 0 && u + && u->lastmemosend + MSSendDelay > now) { + moduleNoticeLang(s_HostServ, u, LNG_REQUEST_WAIT, + MSSendDelay); + u->lastmemosend = now; + if (vIdent) + free(vIdent); + free(rawhostmask); + return MOD_CONT; + } + } + my_add_host_request(nick, vIdent, hostmask, u->nick, tmp_time); + + moduleNoticeLang(s_HostServ, u, LNG_REQUESTED); + req_send_memos(u, hostmask); + alog("New vHost Requested by %s", nick); + } else { + notice_lang(s_HostServ, u, HOST_NOREG, nick); + } + + if (vIdent) + free(vIdent); + free(rawhostmask); + + return MOD_CONT; } void my_memo_lang(User * u, char *name, int z, int number, ...) { - va_list va; - char buffer[4096], outbuf[4096]; - char *fmt = NULL; - int lang = LANG_EN_US; - char *s, *t, *buf; - User *u2; - - if ((mod_current_module_name) - && (!mod_current_module - || mod_current_module_name != mod_current_module->name)) - mod_current_module = findModule(mod_current_module_name); - - u2 = finduser(name); - /* Find the users lang, and use it if we cant */ - if (u2 && u2->na && u2->na->nc) - lang = u2->na->nc->language; - - /* If the users lang isnt supported, drop back to enlgish */ - if (mod_current_module->lang[lang].argc == 0) - lang = LANG_EN_US; - - /* If the requested lang string exists for the language */ - if (mod_current_module->lang[lang].argc > number) { - fmt = mod_current_module->lang[lang].argv[number]; - - buf = sstrdup(fmt); - s = buf; - while (*s) { - t = s; - s += strcspn(s, "\n"); - if (*s) - *s++ = '\0'; - strscpy(outbuf, t, sizeof(outbuf)); - - va_start(va, number); - vsnprintf(buffer, 4095, outbuf, va); - va_end(va); - memo_send(u, name, buffer, z); - } - free(buf); - } else { - alog("%s: INVALID language string call, language: [%d], String [%d]", mod_current_module->name.c_str(), lang, number); - } + va_list va; + char buffer[4096], outbuf[4096]; + char *fmt = NULL; + int lang = LANG_EN_US; + char *s, *t, *buf; + User *u2; + + if ((mod_current_module_name) + && (!mod_current_module + || mod_current_module_name != mod_current_module->name)) + mod_current_module = findModule(mod_current_module_name); + + u2 = finduser(name); + /* Find the users lang, and use it if we cant */ + if (u2 && u2->na && u2->na->nc) + lang = u2->na->nc->language; + + /* If the users lang isnt supported, drop back to enlgish */ + if (mod_current_module->lang[lang].argc == 0) + lang = LANG_EN_US; + + /* If the requested lang string exists for the language */ + if (mod_current_module->lang[lang].argc > number) { + fmt = mod_current_module->lang[lang].argv[number]; + + buf = sstrdup(fmt); + s = buf; + while (*s) { + t = s; + s += strcspn(s, "\n"); + if (*s) + *s++ = '\0'; + strscpy(outbuf, t, sizeof(outbuf)); + + va_start(va, number); + vsnprintf(buffer, 4095, outbuf, va); + va_end(va); + memo_send(u, name, buffer, z); + } + free(buf); + } else { + alog("%s: INVALID language string call, language: [%d], String [%d]", mod_current_module->name.c_str(), lang, number); + } } void req_send_memos(User * u, char *vHost) { - int i; - int z = 2; - - if (checkDefCon(DEFCON_NO_NEW_MEMOS)) - return; - - if (HSRequestMemoOper == 1) { - for (i = 0; i < servopers.count; i++) { - my_memo_lang(u, (((NickCore *) servopers.list[i])->display), z, - LNG_REQUEST_MEMO, vHost); - } - for (i = 0; i < servadmins.count; i++) { - my_memo_lang(u, (((NickCore *) servadmins.list[i])->display), - z, LNG_REQUEST_MEMO, vHost); - } - for (i = 0; i < RootNumber; i++) { - my_memo_lang(u, ServicesRoots[i], z, LNG_REQUEST_MEMO, vHost); - } - } - if (HSRequestMemoSetters == 1) { - for (i = 0; i < HostNumber; i++) { - my_memo_lang(u, HostSetters[i], z, LNG_REQUEST_MEMO, vHost); - } - } + int i; + int z = 2; + + if (checkDefCon(DEFCON_NO_NEW_MEMOS)) + return; + + if (HSRequestMemoOper == 1) { + for (i = 0; i < servopers.count; i++) { + my_memo_lang(u, (((NickCore *) servopers.list[i])->display), z, + LNG_REQUEST_MEMO, vHost); + } + for (i = 0; i < servadmins.count; i++) { + my_memo_lang(u, (((NickCore *) servadmins.list[i])->display), + z, LNG_REQUEST_MEMO, vHost); + } + for (i = 0; i < RootNumber; i++) { + my_memo_lang(u, ServicesRoots[i], z, LNG_REQUEST_MEMO, vHost); + } + } + if (HSRequestMemoSetters == 1) { + for (i = 0; i < HostNumber; i++) { + my_memo_lang(u, HostSetters[i], z, LNG_REQUEST_MEMO, vHost); + } + } } int ns_do_drop(User * u) { - HostCore *tmp; - bool found = false; - NickAlias *na; + HostCore *tmp; + bool found = false; + NickAlias *na; - na = findnick(u->nick); - tmp = findHostCore(hs_request_head, u->nick, &found); + na = findnick(u->nick); + tmp = findHostCore(hs_request_head, u->nick, &found); - if (found && na) - hs_request_head = deleteHostCore(hs_request_head, tmp); + if (found && na) + hs_request_head = deleteHostCore(hs_request_head, tmp); - return MOD_CONT; + return MOD_CONT; } int hs_do_reject(User * u) { - char *cur_buffer; - char *nick; - char *reason; - HostCore *tmp, *hc; - bool found = false; - - cur_buffer = moduleGetLastBuffer(); - nick = myStrGetToken(cur_buffer, ' ', 0); - reason = myStrGetTokenRemainder(cur_buffer, ' ', 1); - - if (!nick) { - moduleNoticeLang(s_HostServ, u, LNG_REJECT_SYNTAX); - if (reason) - free(reason); - return MOD_CONT; - } - - tmp = findHostCore(hs_request_head, nick, &found); - if (found) { - if (!tmp) - hc = hs_request_head; - else - hc = tmp->next; - - if (HSRequestMemoUser) { - if (reason) - my_memo_lang(u, hc->nick, 2, LNG_REJECT_MEMO_REASON, - reason); - else - my_memo_lang(u, hc->nick, 2, LNG_REJECT_MEMO); - } - - hs_request_head = deleteHostCore(hs_request_head, tmp); - moduleNoticeLang(s_HostServ, u, LNG_REJECTED, nick); - alog("Host Request for %s rejected by %s (%s)", nick, u->nick, - reason ? reason : ""); - } else { - moduleNoticeLang(s_HostServ, u, LNG_NO_REQUEST, nick); - } - - free(nick); - if (reason) - free(reason); - - return MOD_CONT; + char *cur_buffer; + char *nick; + char *reason; + HostCore *tmp, *hc; + bool found = false; + + cur_buffer = moduleGetLastBuffer(); + nick = myStrGetToken(cur_buffer, ' ', 0); + reason = myStrGetTokenRemainder(cur_buffer, ' ', 1); + + if (!nick) { + moduleNoticeLang(s_HostServ, u, LNG_REJECT_SYNTAX); + if (reason) + free(reason); + return MOD_CONT; + } + + tmp = findHostCore(hs_request_head, nick, &found); + if (found) { + if (!tmp) + hc = hs_request_head; + else + hc = tmp->next; + + if (HSRequestMemoUser) { + if (reason) + my_memo_lang(u, hc->nick, 2, LNG_REJECT_MEMO_REASON, + reason); + else + my_memo_lang(u, hc->nick, 2, LNG_REJECT_MEMO); + } + + hs_request_head = deleteHostCore(hs_request_head, tmp); + moduleNoticeLang(s_HostServ, u, LNG_REJECTED, nick); + alog("Host Request for %s rejected by %s (%s)", nick, u->nick, + reason ? reason : ""); + } else { + moduleNoticeLang(s_HostServ, u, LNG_NO_REQUEST, nick); + } + + free(nick); + if (reason) + free(reason); + + return MOD_CONT; } int hs_do_activate(User * u) { - char *cur_buffer; - char *nick; - NickAlias *na; - HostCore *tmp, *hc; - bool found = false; - - cur_buffer = moduleGetLastBuffer(); - nick = myStrGetToken(cur_buffer, ' ', 0); - - if (!nick) { - moduleNoticeLang(s_HostServ, u, LNG_ACTIVATE_SYNTAX); - return MOD_CONT; - } - - if ((na = findnick(nick))) { - tmp = findHostCore(hs_request_head, nick, &found); - if (found) { - if (!tmp) - hc = hs_request_head; - else - hc = tmp->next; - - addHostCore(hc->nick, hc->vIdent, hc->vHost, u->nick, - time(NULL)); - - if (HSRequestMemoUser) - my_memo_lang(u, hc->nick, 2, LNG_ACTIVATE_MEMO); - - hs_request_head = deleteHostCore(hs_request_head, tmp); - moduleNoticeLang(s_HostServ, u, LNG_ACTIVATED, nick); - alog("Host Request for %s activated by %s", nick, u->nick); - } else { - moduleNoticeLang(s_HostServ, u, LNG_NO_REQUEST, nick); - } - } else { - /* Should be "User Not Found" instead */ - moduleNoticeLang(s_HostServ, u, LNG_ACTIVATE_SYNTAX); - } - - free(nick); - return MOD_CONT; + char *cur_buffer; + char *nick; + NickAlias *na; + HostCore *tmp, *hc; + bool found = false; + + cur_buffer = moduleGetLastBuffer(); + nick = myStrGetToken(cur_buffer, ' ', 0); + + if (!nick) { + moduleNoticeLang(s_HostServ, u, LNG_ACTIVATE_SYNTAX); + return MOD_CONT; + } + + if ((na = findnick(nick))) { + tmp = findHostCore(hs_request_head, nick, &found); + if (found) { + if (!tmp) + hc = hs_request_head; + else + hc = tmp->next; + + addHostCore(hc->nick, hc->vIdent, hc->vHost, u->nick, + time(NULL)); + + if (HSRequestMemoUser) + my_memo_lang(u, hc->nick, 2, LNG_ACTIVATE_MEMO); + + hs_request_head = deleteHostCore(hs_request_head, tmp); + moduleNoticeLang(s_HostServ, u, LNG_ACTIVATED, nick); + alog("Host Request for %s activated by %s", nick, u->nick); + } else { + moduleNoticeLang(s_HostServ, u, LNG_NO_REQUEST, nick); + } + } else { + /* Should be "User Not Found" instead */ + moduleNoticeLang(s_HostServ, u, LNG_ACTIVATE_SYNTAX); + } + + free(nick); + return MOD_CONT; } void my_add_host_request(char *nick, char *vIdent, char *vhost, - char *creator, int32 tmp_time) + char *creator, int32 tmp_time) { - HostCore *tmp; - bool found = false; - - if (!hs_request_head) { - hs_request_head = - createHostCorelist(hs_request_head, nick, vIdent, vhost, - creator, tmp_time); - } else { - tmp = findHostCore(hs_request_head, nick, &found); - if (!found) { - hs_request_head = - insertHostCore(hs_request_head, tmp, nick, vIdent, vhost, - creator, tmp_time); - } else { - hs_request_head = deleteHostCore(hs_request_head, tmp); /* delete the old entry */ - my_add_host_request(nick, vIdent, vhost, creator, tmp_time); /* recursive call to add new entry */ - } - } + HostCore *tmp; + bool found = false; + + if (!hs_request_head) { + hs_request_head = + createHostCorelist(hs_request_head, nick, vIdent, vhost, + creator, tmp_time); + } else { + tmp = findHostCore(hs_request_head, nick, &found); + if (!found) { + hs_request_head = + insertHostCore(hs_request_head, tmp, nick, vIdent, vhost, + creator, tmp_time); + } else { + hs_request_head = deleteHostCore(hs_request_head, tmp); /* delete the old entry */ + my_add_host_request(nick, vIdent, vhost, creator, tmp_time); /* recursive call to add new entry */ + } + } } int my_isvalidchar(const char c) { - if (((c >= 'A') && (c <= 'Z')) || ((c >= 'a') && (c <= 'z')) - || ((c >= '0') && (c <= '9')) || (c == '.') || (c == '-')) - return 1; - else - return 0; + if (((c >= 'A') && (c <= 'Z')) || ((c >= 'a') && (c <= 'z')) + || ((c >= '0') && (c <= '9')) || (c == '.') || (c == '-')) + return 1; + else + return 0; } int hs_do_list_out(User * u) { - char *key; + char *key; - key = moduleGetLastBuffer(); - if (!key) - return MOD_CONT; + key = moduleGetLastBuffer(); + if (!key) + return MOD_CONT; - if (stricmp(key, "+req") != 0) - return MOD_CONT; + if (stricmp(key, "+req") != 0) + return MOD_CONT; - show_list(u); + show_list(u); - return MOD_CONT; + return MOD_CONT; } int hs_do_waiting(User * u) { - show_list(u); + show_list(u); - return MOD_CONT; + return MOD_CONT; } void show_list(User * u) { - struct tm *tm; - char buf[BUFSIZE]; - int counter = 1; - int from = 0, to = 0; - int display_counter = 0; - HostCore *current; - - current = hs_request_head; - while (current) { - if ((((counter >= from) && (counter <= to)) - || ((from == 0) && (to == 0))) - && (display_counter < NSListMax)) { - display_counter++; - tm = localtime(¤t->time); - strftime(buf, sizeof(buf), - getstring(NULL, STRFTIME_DATE_TIME_FORMAT), tm); - if (current->vIdent) - notice_lang(s_HostServ, u, HOST_IDENT_ENTRY, counter, - current->nick, current->vIdent, current->vHost, - current->creator, buf); - else - notice_lang(s_HostServ, u, HOST_ENTRY, counter, - current->nick, current->vHost, - current->creator, buf); - } - counter++; - current = current->next; - } - notice_lang(s_HostServ, u, HOST_LIST_FOOTER, display_counter); + struct tm *tm; + char buf[BUFSIZE]; + int counter = 1; + int from = 0, to = 0; + int display_counter = 0; + HostCore *current; + + current = hs_request_head; + while (current) { + if ((((counter >= from) && (counter <= to)) + || ((from == 0) && (to == 0))) + && (display_counter < NSListMax)) { + display_counter++; + tm = localtime(¤t->time); + strftime(buf, sizeof(buf), + getstring(NULL, STRFTIME_DATE_TIME_FORMAT), tm); + if (current->vIdent) + notice_lang(s_HostServ, u, HOST_IDENT_ENTRY, counter, + current->nick, current->vIdent, current->vHost, + current->creator, buf); + else + notice_lang(s_HostServ, u, HOST_ENTRY, counter, + current->nick, current->vHost, + current->creator, buf); + } + counter++; + current = current->next; + } + notice_lang(s_HostServ, u, HOST_LIST_FOOTER, display_counter); } int hs_help_request(User * u) { - moduleNoticeLang(s_HostServ, u, LNG_REQUEST_SYNTAX); - ircdproto->SendMessage(findbot(s_HostServ), u->nick, " "); - moduleNoticeLang(s_HostServ, u, LNG_HELP_REQUEST); + moduleNoticeLang(s_HostServ, u, LNG_REQUEST_SYNTAX); + ircdproto->SendMessage(findbot(s_HostServ), u->nick, " "); + moduleNoticeLang(s_HostServ, u, LNG_HELP_REQUEST); - return MOD_CONT; + return MOD_CONT; } int hs_help_activate(User * u) { - if (is_host_setter(u)) { - moduleNoticeLang(s_HostServ, u, LNG_ACTIVATE_SYNTAX); - ircdproto->SendMessage(findbot(s_HostServ), u->nick, " "); - moduleNoticeLang(s_HostServ, u, LNG_HELP_ACTIVATE); - if (HSRequestMemoUser) - moduleNoticeLang(s_HostServ, u, LNG_HELP_ACTIVATE_MEMO); - } else { - notice_lang(s_HostServ, u, NO_HELP_AVAILABLE, "ACTIVATE"); - } - - return MOD_CONT; + if (is_host_setter(u)) { + moduleNoticeLang(s_HostServ, u, LNG_ACTIVATE_SYNTAX); + ircdproto->SendMessage(findbot(s_HostServ), u->nick, " "); + moduleNoticeLang(s_HostServ, u, LNG_HELP_ACTIVATE); + if (HSRequestMemoUser) + moduleNoticeLang(s_HostServ, u, LNG_HELP_ACTIVATE_MEMO); + } else { + notice_lang(s_HostServ, u, NO_HELP_AVAILABLE, "ACTIVATE"); + } + + return MOD_CONT; } int hs_help_reject(User * u) { - if (is_host_setter(u)) { - moduleNoticeLang(s_HostServ, u, LNG_REJECT_SYNTAX); - ircdproto->SendMessage(findbot(s_HostServ), u->nick, " "); - moduleNoticeLang(s_HostServ, u, LNG_HELP_REJECT); - if (HSRequestMemoUser) - moduleNoticeLang(s_HostServ, u, LNG_HELP_REJECT_MEMO); - } else { - notice_lang(s_HostServ, u, NO_HELP_AVAILABLE, "REJECT"); - } - - return MOD_CONT; + if (is_host_setter(u)) { + moduleNoticeLang(s_HostServ, u, LNG_REJECT_SYNTAX); + ircdproto->SendMessage(findbot(s_HostServ), u->nick, " "); + moduleNoticeLang(s_HostServ, u, LNG_HELP_REJECT); + if (HSRequestMemoUser) + moduleNoticeLang(s_HostServ, u, LNG_HELP_REJECT_MEMO); + } else { + notice_lang(s_HostServ, u, NO_HELP_AVAILABLE, "REJECT"); + } + + return MOD_CONT; } int hs_help_waiting(User * u) { - if (is_host_setter(u)) { - moduleNoticeLang(s_HostServ, u, LNG_WAITING_SYNTAX); - ircdproto->SendMessage(findbot(s_HostServ), u->nick, " "); - moduleNoticeLang(s_HostServ, u, LNG_HELP_WAITING); - } else { - notice_lang(s_HostServ, u, NO_HELP_AVAILABLE, "WAITING"); - } - - return MOD_CONT; + if (is_host_setter(u)) { + moduleNoticeLang(s_HostServ, u, LNG_WAITING_SYNTAX); + ircdproto->SendMessage(findbot(s_HostServ), u->nick, " "); + moduleNoticeLang(s_HostServ, u, LNG_HELP_WAITING); + } else { + notice_lang(s_HostServ, u, NO_HELP_AVAILABLE, "WAITING"); + } + + return MOD_CONT; } void hs_help(User * u) { - moduleNoticeLang(s_HostServ, u, LNG_HELP); - if (is_host_setter(u)) - moduleNoticeLang(s_HostServ, u, LNG_HELP_SETTER); + moduleNoticeLang(s_HostServ, u, LNG_HELP); + if (is_host_setter(u)) + moduleNoticeLang(s_HostServ, u, LNG_HELP_SETTER); } void hsreq_load_db(void) { - FILE *fp; - const char *filename; - char readbuf[1024]; - char *nick, *vident, *vhost, *creator, *tmp; - int32 tmp_time; - char *buf; - - if (HSRequestDBName) - filename = HSRequestDBName; - else - filename = HSREQ_DEFAULT_DBNAME; - - fp = fopen(filename, "r"); - if (!fp) { - alog("[hs_request] Unable to open database ('%s') for reading", - filename); - return; - } - - while (fgets(readbuf, 1024, fp)) { - buf = normalizeBuffer(readbuf); - if (buf || *buf) { - nick = myStrGetToken(buf, ':', 0); - vident = myStrGetToken(buf, ':', 1); - vhost = myStrGetToken(buf, ':', 2); - tmp = myStrGetToken(buf, ':', 3); - if (tmp) { - tmp_time = strtol(tmp, (char **) NULL, 16); - free(tmp); - } else { - tmp_time = 0; - } - creator = myStrGetToken(buf, ':', 4); - if (!nick || !vident || !vhost || !creator) { - alog("[hs_request] Error while reading database, skipping record"); - continue; - } - if (stricmp(vident, "(null)") == 0) { - free(vident); - vident = NULL; - } - my_add_host_request(nick, vident, vhost, creator, tmp_time); - free(nick); - free(vhost); - free(creator); - if (vident) - free(vident); - } - free(buf); - } - - fclose(fp); - - if (debug) - alog("[hs_request] Succesfully loaded database"); + FILE *fp; + const char *filename; + char readbuf[1024]; + char *nick, *vident, *vhost, *creator, *tmp; + int32 tmp_time; + char *buf; + + if (HSRequestDBName) + filename = HSRequestDBName; + else + filename = HSREQ_DEFAULT_DBNAME; + + fp = fopen(filename, "r"); + if (!fp) { + alog("[hs_request] Unable to open database ('%s') for reading", + filename); + return; + } + + while (fgets(readbuf, 1024, fp)) { + buf = normalizeBuffer(readbuf); + if (buf || *buf) { + nick = myStrGetToken(buf, ':', 0); + vident = myStrGetToken(buf, ':', 1); + vhost = myStrGetToken(buf, ':', 2); + tmp = myStrGetToken(buf, ':', 3); + if (tmp) { + tmp_time = strtol(tmp, (char **) NULL, 16); + free(tmp); + } else { + tmp_time = 0; + } + creator = myStrGetToken(buf, ':', 4); + if (!nick || !vident || !vhost || !creator) { + alog("[hs_request] Error while reading database, skipping record"); + continue; + } + if (stricmp(vident, "(null)") == 0) { + free(vident); + vident = NULL; + } + my_add_host_request(nick, vident, vhost, creator, tmp_time); + free(nick); + free(vhost); + free(creator); + if (vident) + free(vident); + } + free(buf); + } + + fclose(fp); + + if (debug) + alog("[hs_request] Succesfully loaded database"); } void hsreq_save_db(void) { - FILE *fp; - const char *filename; - const char *vident; - HostCore *current; - - if (HSRequestDBName) - filename = HSRequestDBName; - else - filename = HSREQ_DEFAULT_DBNAME; - - fp = fopen(filename, "w"); - if (!fp) { - alog("[hs_request] Unable to open database ('%s') for writing", - filename); - return; - } - - current = hs_request_head; - while (current) { - vident = (current->vIdent ? current->vIdent : "(null)"); - fprintf(fp, "%s:%s:%s:%X:%s\n", current->nick, vident, - current->vHost, (uint32) current->time, current->creator); - current = current->next; - } - - fclose(fp); - - if (debug) - alog("[hs_request] Succesfully saved database"); + FILE *fp; + const char *filename; + const char *vident; + HostCore *current; + + if (HSRequestDBName) + filename = HSRequestDBName; + else + filename = HSREQ_DEFAULT_DBNAME; + + fp = fopen(filename, "w"); + if (!fp) { + alog("[hs_request] Unable to open database ('%s') for writing", + filename); + return; + } + + current = hs_request_head; + while (current) { + vident = (current->vIdent ? current->vIdent : "(null)"); + fprintf(fp, "%s:%s:%s:%X:%s\n", current->nick, vident, + current->vHost, (uint32) current->time, current->creator); + current = current->next; + } + + fclose(fp); + + if (debug) + alog("[hs_request] Succesfully saved database"); } int hsreqevt_db_saving(int argc, char **argv) { - if ((argc >= 1) && (stricmp(argv[0], EVENT_START) == 0)) - hsreq_save_db(); + if ((argc >= 1) && (stricmp(argv[0], EVENT_START) == 0)) + hsreq_save_db(); - return MOD_CONT; + return MOD_CONT; } int hsreqevt_db_backup(int argc, char **argv) { - if ((argc >= 1) && (stricmp(argv[0], EVENT_START) == 0)) { - if (HSRequestDBName) - ModuleDatabaseBackup(HSRequestDBName); - else - ModuleDatabaseBackup(HSREQ_DEFAULT_DBNAME); + if ((argc >= 1) && (stricmp(argv[0], EVENT_START) == 0)) { + if (HSRequestDBName) + ModuleDatabaseBackup(HSRequestDBName); + else + ModuleDatabaseBackup(HSREQ_DEFAULT_DBNAME); } - return MOD_CONT; + return MOD_CONT; } void my_load_config(void) { - int i; - char *tmp = NULL; - - Directive confvalues[][1] = { - {{"HSRequestMemoUser", - {{PARAM_SET, PARAM_RELOAD, &HSRequestMemoUser}}}}, - {{"HSRequestMemoOper", - {{PARAM_SET, PARAM_RELOAD, &HSRequestMemoOper}}}}, - {{"HSRequestMemoSetters", - {{PARAM_SET, PARAM_RELOAD, &HSRequestMemoSetters}}}}, - {{"HSRequestDBName", {{PARAM_STRING, PARAM_RELOAD, &tmp}}}} - }; - - for (i = 0; i < 4; i++) - moduleGetConfigDirective(confvalues[i]); - - if (tmp) { - if (HSRequestDBName) - free(HSRequestDBName); - HSRequestDBName = sstrdup(tmp); - } else { - HSRequestDBName = sstrdup(HSREQ_DEFAULT_DBNAME); - } - - if (debug) - alog("debug: [hs_request] Set config vars: MemoUser=%d MemoOper=%d MemoSetters=%d DBName='%s'", HSRequestMemoUser, HSRequestMemoOper, HSRequestMemoSetters, HSRequestDBName); + int i; + char *tmp = NULL; + + Directive confvalues[][1] = { + {{"HSRequestMemoUser", + {{PARAM_SET, PARAM_RELOAD, &HSRequestMemoUser}}}}, + {{"HSRequestMemoOper", + {{PARAM_SET, PARAM_RELOAD, &HSRequestMemoOper}}}}, + {{"HSRequestMemoSetters", + {{PARAM_SET, PARAM_RELOAD, &HSRequestMemoSetters}}}}, + {{"HSRequestDBName", {{PARAM_STRING, PARAM_RELOAD, &tmp}}}} + }; + + for (i = 0; i < 4; i++) + moduleGetConfigDirective(confvalues[i]); + + if (tmp) { + if (HSRequestDBName) + free(HSRequestDBName); + HSRequestDBName = sstrdup(tmp); + } else { + HSRequestDBName = sstrdup(HSREQ_DEFAULT_DBNAME); + } + + if (debug) + alog("debug: [hs_request] Set config vars: MemoUser=%d MemoOper=%d MemoSetters=%d DBName='%s'", HSRequestMemoUser, HSRequestMemoOper, HSRequestMemoSetters, HSRequestDBName); } MODULE_INIT("hs_request", HSRequest) diff --git a/src/modules/ns_maxemail.c b/src/modules/ns_maxemail.c index ef5b8b167..b2f82eb41 100644 --- a/src/modules/ns_maxemail.c +++ b/src/modules/ns_maxemail.c @@ -1,5 +1,5 @@ /* ns_maxemail.c - Limit the amount of times an email address - * can be used for a NickServ account. + * can be used for a NickServ account. * * (C) 2003-2008 Anope Team * Contact us at info@anope.org @@ -108,104 +108,104 @@ class NSMaxEmail : public Module int count_email_in_use(char *email, User * u) { - NickCore *nc; - int i; - int count = 0; + NickCore *nc; + int i; + int count = 0; - if (!email) - return 0; + if (!email) + return 0; - for (i = 0; i < 1024; i++) { - for (nc = nclists[i]; nc; nc = nc->next) { - if (!(u->na && u->na->nc && (u->na->nc == nc)) && nc->email && (stricmp(nc->email, email) == 0)) - count++; - } - } + for (i = 0; i < 1024; i++) { + for (nc = nclists[i]; nc; nc = nc->next) { + if (!(u->na && u->na->nc && (u->na->nc == nc)) && nc->email && (stricmp(nc->email, email) == 0)) + count++; + } + } - return count; + return count; } int check_email_limit_reached(char *email, User * u) { - if ((NSEmailMax < 1) || !email || is_services_admin(u)) - return MOD_CONT; + if ((NSEmailMax < 1) || !email || is_services_admin(u)) + return MOD_CONT; - if (count_email_in_use(email, u) < NSEmailMax) - return MOD_CONT; + if (count_email_in_use(email, u) < NSEmailMax) + return MOD_CONT; - if (NSEmailMax == 1) - moduleNoticeLang(s_NickServ, u, LNG_NSEMAILMAX_REACHED_ONE); - else - moduleNoticeLang(s_NickServ, u, LNG_NSEMAILMAX_REACHED, - NSEmailMax); + if (NSEmailMax == 1) + moduleNoticeLang(s_NickServ, u, LNG_NSEMAILMAX_REACHED_ONE); + else + moduleNoticeLang(s_NickServ, u, LNG_NSEMAILMAX_REACHED, + NSEmailMax); - return MOD_STOP; + return MOD_STOP; } int my_ns_register(User * u) { - char *cur_buffer; - char *email; - int ret; + char *cur_buffer; + char *email; + int ret; - cur_buffer = moduleGetLastBuffer(); - email = myStrGetToken(cur_buffer, ' ', 1); + cur_buffer = moduleGetLastBuffer(); + email = myStrGetToken(cur_buffer, ' ', 1); if (!email) return MOD_CONT; - ret = check_email_limit_reached(email, u); - free(email); + ret = check_email_limit_reached(email, u); + free(email); - return ret; + return ret; } int my_ns_set(User * u) { - char *cur_buffer; - char *set; - char *email; - int ret; + char *cur_buffer; + char *set; + char *email; + int ret; - cur_buffer = moduleGetLastBuffer(); - set = myStrGetToken(cur_buffer, ' ', 0); + cur_buffer = moduleGetLastBuffer(); + set = myStrGetToken(cur_buffer, ' ', 0); if (!set) return MOD_CONT; - if (stricmp(set, "email") != 0) { - free(set); - return MOD_CONT; - } + if (stricmp(set, "email") != 0) { + free(set); + return MOD_CONT; + } - free(set); - email = myStrGetToken(cur_buffer, ' ', 1); + free(set); + email = myStrGetToken(cur_buffer, ' ', 1); if (!email) return MOD_CONT; - ret = check_email_limit_reached(email, u); - free(email); + ret = check_email_limit_reached(email, u); + free(email); - return ret; + return ret; } int my_event_reload(int argc, char **argv) { - if ((argc > 0) && (stricmp(argv[0], EVENT_START) == 0)) - my_load_config(); + if ((argc > 0) && (stricmp(argv[0], EVENT_START) == 0)) + my_load_config(); - return MOD_CONT; + return MOD_CONT; } void my_load_config(void) { - Directive confvalues[] = { - {"NSEmailMax", {{PARAM_INT, PARAM_RELOAD, &NSEmailMax}}} - }; + Directive confvalues[] = { + {"NSEmailMax", {{PARAM_INT, PARAM_RELOAD, &NSEmailMax}}} + }; - moduleGetConfigDirective(confvalues); + moduleGetConfigDirective(confvalues); - if (debug) - alog("debug: [ns_maxemail] NSEmailMax set to %d", NSEmailMax); + if (debug) + alog("debug: [ns_maxemail] NSEmailMax set to %d", NSEmailMax); } diff --git a/src/modules/ns_noop_convert.c b/src/modules/ns_noop_convert.c index a4ccea7d0..6a2a29b09 100644 --- a/src/modules/ns_noop_convert.c +++ b/src/modules/ns_noop_convert.c @@ -27,14 +27,14 @@ /* Multi-language stuff */ #define LANG_NUM_STRINGS 8 -#define AUTOOP_SYNTAX 0 +#define AUTOOP_SYNTAX 0 #define AUTOOP_STATUS_ON 1 #define AUTOOP_STATUS_OFF 2 -#define AUTOOP_NO_NICK 3 -#define AUTOOP_ON 4 -#define AUTOOP_OFF 5 -#define AUTOOP_DESC 6 -#define AUTOOP_HELP 7 +#define AUTOOP_NO_NICK 3 +#define AUTOOP_ON 4 +#define AUTOOP_OFF 5 +#define AUTOOP_DESC 6 +#define AUTOOP_HELP 7 /*************************************************************************/ @@ -94,34 +94,34 @@ class NSNOOPConvert : public Module **/ int mLoadData(void) { - int ret = 0; - int len = 0; - - char *name = NULL; - - NickAlias *na = NULL; - FILE *in; - - /* will _never_ be this big thanks to the 512 limit of a message */ - char buffer[2000]; - if ((in = fopen(NSAutoOPDBName, "r")) == NULL) { - alog("ns_noop: WARNING: Can not open database file! (it might not exist, this is not fatal)"); - ret = 1; - } else { - while (fgets(buffer, 1500, in)) { - name = myStrGetToken(buffer, ' ', 0); - if (name) { - len = strlen(name); - /* Take the \n from the end of the line */ - name[len - 1] = '\0'; - if ((na = findnick(name))) { - na->nc->flags |= NI_AUTOOP; - } - free(name); - } - } - } - return ret; + int ret = 0; + int len = 0; + + char *name = NULL; + + NickAlias *na = NULL; + FILE *in; + + /* will _never_ be this big thanks to the 512 limit of a message */ + char buffer[2000]; + if ((in = fopen(NSAutoOPDBName, "r")) == NULL) { + alog("ns_noop: WARNING: Can not open database file! (it might not exist, this is not fatal)"); + ret = 1; + } else { + while (fgets(buffer, 1500, in)) { + name = myStrGetToken(buffer, ' ', 0); + if (name) { + len = strlen(name); + /* Take the \n from the end of the line */ + name[len - 1] = '\0'; + if ((na = findnick(name))) { + na->nc->flags |= NI_AUTOOP; + } + free(name); + } + } + } + return ret; } /*************************************************************************/ @@ -132,33 +132,33 @@ int mLoadData(void) **/ int mLoadConfig(int argc, char **argv) { - char *tmp = NULL; + char *tmp = NULL; - Directive d[] = { - {"NSAutoOPDBName", {{PARAM_STRING, PARAM_RELOAD, &tmp}}}, - }; + Directive d[] = { + {"NSAutoOPDBName", {{PARAM_STRING, PARAM_RELOAD, &tmp}}}, + }; - moduleGetConfigDirective(d); + moduleGetConfigDirective(d); - if (NSAutoOPDBName) - free(NSAutoOPDBName); + if (NSAutoOPDBName) + free(NSAutoOPDBName); - if (tmp) { - NSAutoOPDBName = tmp; - } else { - NSAutoOPDBName = sstrdup(DEFAULT_DB_NAME); - alog("ns_noop: NSAutoOPDBName is not defined in Services configuration file, using default %s", NSAutoOPDBName); - } + if (tmp) { + NSAutoOPDBName = tmp; + } else { + NSAutoOPDBName = sstrdup(DEFAULT_DB_NAME); + alog("ns_noop: NSAutoOPDBName is not defined in Services configuration file, using default %s", NSAutoOPDBName); + } - if (!NSAutoOPDBName) { - alog("ns_noop: FATAL: Can't read required configuration directives!"); - return MOD_STOP; - } else { - alog("ns_noop: Directive NSAutoOPDBName loaded (%s)...", - NSAutoOPDBName); - } + if (!NSAutoOPDBName) { + alog("ns_noop: FATAL: Can't read required configuration directives!"); + return MOD_STOP; + } else { + alog("ns_noop: Directive NSAutoOPDBName loaded (%s)...", + NSAutoOPDBName); + } - return MOD_CONT; + return MOD_CONT; } /*************************************************************************/ diff --git a/src/modules/os_ignore_db.c b/src/modules/os_ignore_db.c index 1d6d11ece..064dfa380 100644 --- a/src/modules/os_ignore_db.c +++ b/src/modules/os_ignore_db.c @@ -21,22 +21,22 @@ #define IGNOREDBVERSION 1
/* Database seperators */
-#define SEPARATOR '^' /* End of a key, seperates keys from values */
-#define BLOCKEND '\n' /* End of a block, e.g. a whole ignore */
-#define VALUEEND '\000' /* End of a value */
-#define SUBSTART '\010' /* Beginning of a new subblock, closed by a BLOCKEND */
+#define SEPARATOR '^' /* End of a key, seperates keys from values */
+#define BLOCKEND '\n' /* End of a block, e.g. a whole ignore */
+#define VALUEEND '\000' /* End of a value */
+#define SUBSTART '\010' /* Beginning of a new subblock, closed by a BLOCKEND */
/* Database reading return values */
#define DB_READ_SUCCESS 0
-#define DB_READ_ERROR 1
-#define DB_EOF_ERROR 2
+#define DB_READ_ERROR 1
+#define DB_EOF_ERROR 2
#define DB_VERSION_ERROR 3
#define DB_READ_BLOCKEND 4
#define DB_READ_SUBSTART 5
#define DB_WRITE_SUCCESS 0
-#define DB_WRITE_ERROR 1
-#define DB_WRITE_NOVAL 2
+#define DB_WRITE_ERROR 1
+#define DB_WRITE_NOVAL 2
/* Database Key, Value max length */
#define MAXKEYLEN 128
@@ -46,12 +46,12 @@ typedef struct db_file_ DBFile;
struct db_file_ {
- FILE *fptr; /* Pointer to the opened file */
- int db_version; /* The db version of the datafiles (only needed for reading) */
- int core_db_version; /* The current db version of this anope source */
- char service[256]; /* StatServ/etc. */
- char filename[256]; /* Filename of the database */
- char temp_name[262]; /* Temp filename of the database */
+ FILE *fptr; /* Pointer to the opened file */
+ int db_version; /* The db version of the datafiles (only needed for reading) */
+ int core_db_version; /* The current db version of this anope source */
+ char service[256]; /* StatServ/etc. */
+ char filename[256]; /* Filename of the database */
+ char temp_name[262]; /* Temp filename of the database */
};
@@ -179,7 +179,7 @@ int backup_ignoredb(int argc, char **argv) { /* ------------------------------------------------------------------------------- */
/**************************************************************************
- * DataBase Handling
+ * DataBase Handling
**************************************************************************/
void load_ignore_db(void) {
@@ -198,7 +198,7 @@ void load_ignore_db(void) { /* Open the db, fill the rest of dbptr and allocate memory for key and value */
if (new_open_db_read(dbptr, &key, &value)) {
free(dbptr);
- return; /* Bang, an error occurred */
+ return; /* Bang, an error occurred */
}
while (1) {
@@ -214,7 +214,7 @@ void load_ignore_db(void) { new_close_db(dbptr->fptr, &key, &value);
free(dbptr);
return;
- } else if (retval == DB_READ_BLOCKEND) { /* DB_READ_BLOCKEND */
+ } else if (retval == DB_READ_BLOCKEND) { /* DB_READ_BLOCKEND */
/* Check if we have everything to add the ignore..
* We shouldn't bother with already expired ignores either.. */
if (mask && (expiry_time > time(NULL) || expiry_time == 0)) {
@@ -248,7 +248,7 @@ void load_ignore_db(void) { if (mask) free(mask);
mask = NULL;
expiry_time = time(NULL);
- } else { /* DB_READ_SUCCESS */
+ } else { /* DB_READ_SUCCESS */
if (!*key || !*value)
continue;
@@ -290,7 +290,7 @@ void save_ignore_db(void) { if (new_open_db_write(dbptr)) {
rename(dbptr->temp_name, IgnoreDB);
free(dbptr);
- return; /* Bang, an error occurred */
+ return; /* Bang, an error occurred */
}
/* Store the version of the DB in the DB as well...
@@ -324,8 +324,8 @@ void save_ignore_db(void) { if (dbptr) {
new_close_db(dbptr->fptr, NULL, NULL); /* close file */
- remove(dbptr->temp_name); /* saved successfully, no need to keep the old one */
- free(dbptr); /* free the db struct */
+ remove(dbptr->temp_name); /* saved successfully, no need to keep the old one */
+ free(dbptr); /* free the db struct */
}
}
@@ -333,7 +333,7 @@ void save_ignore_db(void) { /* ------------------------------------------------------------------------------- */
/**************************************************************************
- * Generic DataBase Functions (Borrowed this from Trystan :-) )
+ * Generic DataBase Functions (Borrowed this from Trystan :-) )
**************************************************************************/
@@ -438,21 +438,21 @@ int new_read_db_entry(char **key, char **value, FILE *fptr) { if (ferror(fptr)) {
return DB_READ_ERROR; /* error! */
}
- return DB_EOF_ERROR; /* end of file */
- } else if (character == BLOCKEND) { /* END OF BLOCK */
+ return DB_EOF_ERROR; /* end of file */
+ } else if (character == BLOCKEND) { /* END OF BLOCK */
return DB_READ_BLOCKEND;
- } else if (character == VALUEEND) { /* END OF VALUE */
+ } else if (character == VALUEEND) { /* END OF VALUE */
string[i] = '\0'; /* end of value */
return DB_READ_SUCCESS;
- } else if (character == SEPARATOR) { /* END OF KEY */
+ } else if (character == SEPARATOR) { /* END OF KEY */
string[i] = '\0'; /* end of key */
- string = *value; /* beginning of value */
- i = 0; /* start with the first character of our value */
+ string = *value; /* beginning of value */
+ i = 0; /* start with the first character of our value */
} else {
if ((i == (MAXKEYLEN - 1)) && (string == *key)) { /* max key length reached, continuing with value */
- string[i] = '\0'; /* end of key */
- string = *value; /* beginning of value */
- i = 0; /* start with the first character of our value */
+ string[i] = '\0'; /* end of key */
+ string = *value; /* beginning of value */
+ i = 0; /* start with the first character of our value */
} else if ((i == (MAXVALLEN - 1)) && (string == *value)) { /* max value length reached, returning */
string[i] = '\0';
return DB_READ_SUCCESS;
diff --git a/src/modules/os_info.c b/src/modules/os_info.c index 2d69267ae..6a123ae2d 100644 --- a/src/modules/os_info.c +++ b/src/modules/os_info.c @@ -27,16 +27,16 @@ /* Multi-language stuff */ #define LANG_NUM_STRINGS 10 -#define OINFO_SYNTAX 0 +#define OINFO_SYNTAX 0 #define OINFO_ADD_SUCCESS 1 #define OINFO_DEL_SUCCESS 2 -#define OCINFO_SYNTAX 3 +#define OCINFO_SYNTAX 3 #define OCINFO_ADD_SUCCESS 4 #define OCINFO_DEL_SUCCESS 5 -#define OINFO_HELP 6 -#define OCINFO_HELP 7 -#define OINFO_HELP_CMD 8 -#define OCINFO_HELP_CMD 9 +#define OINFO_HELP 6 +#define OCINFO_HELP 7 +#define OINFO_HELP_CMD 8 +#define OCINFO_HELP_CMD 9 /*************************************************************************/ @@ -130,9 +130,9 @@ class OSInfo : public Module "This will show up when any oper /cs info's the channel.\n" "and can be used for 'tagging' channels etc....", /* OINFO_HELP_CMD */ - " OINFO Add / Del an OperInfo line to a nick", + " OINFO Add / Del an OperInfo line to a nick", /* OCINFO_HELP_CMD */ - " OINFO Add / Del an OperInfo line to a channel" + " OINFO Add / Del an OperInfo line to a channel" }; const char* langtable_es[] = { @@ -159,9 +159,9 @@ class OSInfo : public Module "Esto se mostrara cuando cualquier operador haga /cs info canal\n" "y puede ser usado para 'marcado' de canales, etc....", /* OINFO_HELP_CMD */ - " OINFO Agrega / Elimina una linea OperInfo al nick", + " OINFO Agrega / Elimina una linea OperInfo al nick", /* OCINFO_HELP_CMD */ - " OINFO Agrega / Elimina una linea OperInfo al canal" + " OINFO Agrega / Elimina una linea OperInfo al canal" }; const char* langtable_nl[] = { @@ -190,9 +190,9 @@ class OSInfo : public Module "een oper /cs info kanaal doet voor dit kanaal, en kan worden\n" "gebruikt om een kanaal te 'markeren' etc...", /* OINFO_HELP_CMD */ - " OINFO Voeg een OperInfo regel toe aan een nick of verwijder deze", + " OINFO Voeg een OperInfo regel toe aan een nick of verwijder deze", /* OCINFO_HELP_CMD */ - " OINFO Voeg een OperInfo regel toe aan een kanaal of verwijder deze" + " OINFO Voeg een OperInfo regel toe aan een kanaal of verwijder deze" }; const char* langtable_de[] = { @@ -219,9 +219,9 @@ class OSInfo : public Module "Channel.Sie wird angezeigt wenn ein Oper mit /cs info sich\n" "ьber den Channel informiert.", /* OINFO_HELP_CMD */ - " OINFO Addiert / Lцscht eine OperInfo Linie zu / von einen Nicknamen", + " OINFO Addiert / Lцscht eine OperInfo Linie zu / von einen Nicknamen", /* OCINFO_HELP_CMD */ - " OINFO Addiert / Lцscht eine OperInfo Linie zu / von einen Channel" + " OINFO Addiert / Lцscht eine OperInfo Linie zu / von einen Channel" }; const char* langtable_pt[] = { @@ -248,9 +248,9 @@ class OSInfo : public Module "Isto serб mostrado quando qualquer Operador usar /cs info canal\n" "e pode ser usado para 'etiquetar' canais etc...", /* OINFO_HELP_CMD */ - " OINFO Adiciona ou Apaga a linha OperInfo para um nick", + " OINFO Adiciona ou Apaga a linha OperInfo para um nick", /* OCINFO_HELP_CMD */ - " OINFO Adiciona ou Apaga a linha OperInfo para um canal" + " OINFO Adiciona ou Apaga a linha OperInfo para um canal" }; const char* langtable_ru[] = { @@ -277,9 +277,9 @@ class OSInfo : public Module "которая будет показана любому оператору, запрашивающему INFO канала.\n" "Может быть использована для 'пометки' каналов и т. д...", /* OINFO_HELP_CMD */ - " OINFO Добавляет/Удаляет опер-инфо для ника", + " OINFO Добавляет/Удаляет опер-инфо для ника", /* OCINFO_HELP_CMD */ - " OINFO Добавляет/Удаляет опер-инфо для канала" + " OINFO Добавляет/Удаляет опер-инфо для канала" }; const char* langtable_it[] = { @@ -306,9 +306,9 @@ class OSInfo : public Module "Queste vengono mostrate quando un oper esegue il comando /cs info <canale>\n" "e possono essere utilizzate per 'marchiare' i canali ecc...", /* OINFO_HELP_CMD */ - " OINFO Aggiunge/Rimuove una linea OperInfo ad/da un nick", + " OINFO Aggiunge/Rimuove una linea OperInfo ad/da un nick", /* OCINFO_HELP_CMD */ - " OINFO Aggiunge/Rimuove una linea OperInfo ad/da un canale" + " OINFO Aggiunge/Rimuove una linea OperInfo ad/da un canale" }; this->InsertLanguage(LANG_EN_US, LANG_NUM_STRINGS, langtable_en_us); @@ -350,62 +350,62 @@ class OSInfo : public Module **/ int myAddNickInfo(User * u) { - char *text = NULL; - char *cmd = NULL; - char *nick = NULL; - char *info = NULL; - NickAlias *na = NULL; - - /* Get the last buffer anope recived */ - text = moduleGetLastBuffer(); - if (text) { - cmd = myStrGetToken(text, ' ', 0); - nick = myStrGetToken(text, ' ', 1); - info = myStrGetTokenRemainder(text, ' ', 2); - if (cmd && nick) { - if (strcasecmp(cmd, "ADD") == 0) { - /* Syntax error, again! */ - if (info) { - /* ok we've found the user */ - if ((na = findnick(nick))) { - /* Add the module data to the user */ - moduleAddData(&na->nc->moduleData, "info", info); - moduleNoticeLang(s_NickServ, u, - OINFO_ADD_SUCCESS, nick); - /* NickCore not found! */ - } else { - notice_lang(s_NickServ, u, NICK_X_NOT_REGISTERED, - nick); - } - free(info); - } - } else if (strcasecmp(cmd, "DEL") == 0) { - /* ok we've found the user */ - if ((na = findnick(nick))) { - moduleDelData(&na->nc->moduleData, "info"); - moduleNoticeLang(s_NickServ, u, - OINFO_DEL_SUCCESS, nick); - /* NickCore not found! */ - } else { - notice_lang(s_NickServ, u, NICK_X_NOT_REGISTERED, - nick); - } - /* another syntax error! */ - } else { - moduleNoticeLang(s_NickServ, u, OINFO_SYNTAX); - } - free(cmd); - free(nick); - /* Syntax error */ - } else if (cmd) { - moduleNoticeLang(s_NickServ, u, OINFO_SYNTAX); - free(cmd); - /* Syntax error */ - } else { - moduleNoticeLang(s_NickServ, u, OINFO_SYNTAX); - } - } - return MOD_CONT; + char *text = NULL; + char *cmd = NULL; + char *nick = NULL; + char *info = NULL; + NickAlias *na = NULL; + + /* Get the last buffer anope recived */ + text = moduleGetLastBuffer(); + if (text) { + cmd = myStrGetToken(text, ' ', 0); + nick = myStrGetToken(text, ' ', 1); + info = myStrGetTokenRemainder(text, ' ', 2); + if (cmd && nick) { + if (strcasecmp(cmd, "ADD") == 0) { + /* Syntax error, again! */ + if (info) { + /* ok we've found the user */ + if ((na = findnick(nick))) { + /* Add the module data to the user */ + moduleAddData(&na->nc->moduleData, "info", info); + moduleNoticeLang(s_NickServ, u, + OINFO_ADD_SUCCESS, nick); + /* NickCore not found! */ + } else { + notice_lang(s_NickServ, u, NICK_X_NOT_REGISTERED, + nick); + } + free(info); + } + } else if (strcasecmp(cmd, "DEL") == 0) { + /* ok we've found the user */ + if ((na = findnick(nick))) { + moduleDelData(&na->nc->moduleData, "info"); + moduleNoticeLang(s_NickServ, u, + OINFO_DEL_SUCCESS, nick); + /* NickCore not found! */ + } else { + notice_lang(s_NickServ, u, NICK_X_NOT_REGISTERED, + nick); + } + /* another syntax error! */ + } else { + moduleNoticeLang(s_NickServ, u, OINFO_SYNTAX); + } + free(cmd); + free(nick); + /* Syntax error */ + } else if (cmd) { + moduleNoticeLang(s_NickServ, u, OINFO_SYNTAX); + free(cmd); + /* Syntax error */ + } else { + moduleNoticeLang(s_NickServ, u, OINFO_SYNTAX); + } + } + return MOD_CONT; } /** @@ -420,60 +420,60 @@ int myAddNickInfo(User * u) **/ int myAddChanInfo(User * u) { - char *text = NULL; - char *cmd = NULL; - char *chan = NULL; - char *info = NULL; - ChannelInfo *ci = NULL; - - /* Get the last buffer anope recived */ - text = moduleGetLastBuffer(); - if (text) { - cmd = myStrGetToken(text, ' ', 0); - chan = myStrGetToken(text, ' ', 1); - info = myStrGetTokenRemainder(text, ' ', 2); - if (cmd && chan) { - if (strcasecmp(cmd, "ADD") == 0) { - if (info) { - if ((ci = cs_findchan(chan))) { - /* Add the module data to the channel */ - moduleAddData(&ci->moduleData, "info", info); - moduleNoticeLang(s_ChanServ, u, - OCINFO_ADD_SUCCESS, chan); - /* ChanInfo */ - } else { - notice_lang(s_ChanServ, u, CHAN_X_NOT_REGISTERED, - chan); - } - free(info); - } - } else if (strcasecmp(cmd, "DEL") == 0) { - if ((ci = cs_findchan(chan))) { - /* Del the module data from the channel */ - moduleDelData(&ci->moduleData, "info"); - moduleNoticeLang(s_ChanServ, u, - OCINFO_DEL_SUCCESS, chan); - /* ChanInfo */ - } else { - notice_lang(s_ChanServ, u, CHAN_X_NOT_REGISTERED, - chan); - } - /* another syntax error! */ - } else { - moduleNoticeLang(s_ChanServ, u, OCINFO_SYNTAX); - } - free(cmd); - free(chan); - /* Syntax error */ - } else if (cmd) { - moduleNoticeLang(s_ChanServ, u, OCINFO_SYNTAX); - free(cmd); - /* Syntax error */ - } else { - moduleNoticeLang(s_ChanServ, u, OCINFO_SYNTAX); - } - } - return MOD_CONT; + char *text = NULL; + char *cmd = NULL; + char *chan = NULL; + char *info = NULL; + ChannelInfo *ci = NULL; + + /* Get the last buffer anope recived */ + text = moduleGetLastBuffer(); + if (text) { + cmd = myStrGetToken(text, ' ', 0); + chan = myStrGetToken(text, ' ', 1); + info = myStrGetTokenRemainder(text, ' ', 2); + if (cmd && chan) { + if (strcasecmp(cmd, "ADD") == 0) { + if (info) { + if ((ci = cs_findchan(chan))) { + /* Add the module data to the channel */ + moduleAddData(&ci->moduleData, "info", info); + moduleNoticeLang(s_ChanServ, u, + OCINFO_ADD_SUCCESS, chan); + /* ChanInfo */ + } else { + notice_lang(s_ChanServ, u, CHAN_X_NOT_REGISTERED, + chan); + } + free(info); + } + } else if (strcasecmp(cmd, "DEL") == 0) { + if ((ci = cs_findchan(chan))) { + /* Del the module data from the channel */ + moduleDelData(&ci->moduleData, "info"); + moduleNoticeLang(s_ChanServ, u, + OCINFO_DEL_SUCCESS, chan); + /* ChanInfo */ + } else { + notice_lang(s_ChanServ, u, CHAN_X_NOT_REGISTERED, + chan); + } + /* another syntax error! */ + } else { + moduleNoticeLang(s_ChanServ, u, OCINFO_SYNTAX); + } + free(cmd); + free(chan); + /* Syntax error */ + } else if (cmd) { + moduleNoticeLang(s_ChanServ, u, OCINFO_SYNTAX); + free(cmd); + /* Syntax error */ + } else { + moduleNoticeLang(s_ChanServ, u, OCINFO_SYNTAX); + } + } + return MOD_CONT; } /*************************************************************************/ @@ -485,34 +485,34 @@ int myAddChanInfo(User * u) **/ int myNickInfo(User * u) { - char *text = NULL; - char *nick = NULL; + char *text = NULL; + char *nick = NULL; char *info = NULL; - NickAlias *na = NULL; - - /* Only show our goodies to opers */ - if (is_oper(u)) { - /* Get the last buffer anope recived */ - text = moduleGetLastBuffer(); - if (text) { - nick = myStrGetToken(text, ' ', 0); - if (nick) { - /* ok we've found the user */ - if ((na = findnick(nick))) { - /* If we have any info on this user */ - if ((info = moduleGetData(&na->nc->moduleData, "info"))) { - notice_user(s_NickServ, u, " OperInfo: %s", info); + NickAlias *na = NULL; + + /* Only show our goodies to opers */ + if (is_oper(u)) { + /* Get the last buffer anope recived */ + text = moduleGetLastBuffer(); + if (text) { + nick = myStrGetToken(text, ' ', 0); + if (nick) { + /* ok we've found the user */ + if ((na = findnick(nick))) { + /* If we have any info on this user */ + if ((info = moduleGetData(&na->nc->moduleData, "info"))) { + notice_user(s_NickServ, u, " OperInfo: %s", info); free(info); - } - /* NickCore not found! */ - } else { - /* we dont care! */ - } - free(nick); - } - } - } - return MOD_CONT; + } + /* NickCore not found! */ + } else { + /* we dont care! */ + } + free(nick); + } + } + } + return MOD_CONT; } /** @@ -522,30 +522,30 @@ int myNickInfo(User * u) **/ int myChanInfo(User * u) { - char *text = NULL; - char *chan = NULL; + char *text = NULL; + char *chan = NULL; char *info = NULL; - ChannelInfo *ci = NULL; - - /* Only show our goodies to opers */ - if (is_oper(u)) { - /* Get the last buffer anope recived */ - text = moduleGetLastBuffer(); - if (text) { - chan = myStrGetToken(text, ' ', 0); - if (chan) { - if ((ci = cs_findchan(chan))) { - /* If we have any info on this channel */ - if ((info = moduleGetData(&ci->moduleData, "info"))) { - notice_user(s_ChanServ, u, " OperInfo: %s", info); + ChannelInfo *ci = NULL; + + /* Only show our goodies to opers */ + if (is_oper(u)) { + /* Get the last buffer anope recived */ + text = moduleGetLastBuffer(); + if (text) { + chan = myStrGetToken(text, ' ', 0); + if (chan) { + if ((ci = cs_findchan(chan))) { + /* If we have any info on this channel */ + if ((info = moduleGetData(&ci->moduleData, "info"))) { + notice_user(s_ChanServ, u, " OperInfo: %s", info); free(info); - } - } - free(chan); - } - } - } - return MOD_CONT; + } + } + free(chan); + } + } + } + return MOD_CONT; } /*************************************************************************/ @@ -556,53 +556,53 @@ int myChanInfo(User * u) **/ int mLoadData(void) { - int ret = 0; - FILE *in; - - char *type = NULL; - char *name = NULL; - char *info = NULL; - int len = 0; - - ChannelInfo *ci = NULL; - NickAlias *na = NULL; - - /* will _never_ be this big thanks to the 512 limit of a message */ - char buffer[2000]; - if ((in = fopen(OSInfoDBName, "r")) == NULL) { - alog("os_info: WARNING: can not open the database file! (it might not exist, this is not fatal)"); - ret = 1; - } else { - while (fgets(buffer, 1500, in)) { - type = myStrGetToken(buffer, ' ', 0); - name = myStrGetToken(buffer, ' ', 1); - info = myStrGetTokenRemainder(buffer, ' ', 2); - if (type) { - if (name) { - if (info) { - len = strlen(info); - /* Take the \n from the end of the line */ - info[len - 1] = '\0'; - if (stricmp(type, "C") == 0) { - if ((ci = cs_findchan(name))) { - moduleAddData(&ci->moduleData, "info", - info); - } - } else if (stricmp(type, "N") == 0) { - if ((na = findnick(name))) { - moduleAddData(&na->nc->moduleData, "info", - info); - } - } - free(info); - } - free(name); - } - free(type); - } - } - } - return ret; + int ret = 0; + FILE *in; + + char *type = NULL; + char *name = NULL; + char *info = NULL; + int len = 0; + + ChannelInfo *ci = NULL; + NickAlias *na = NULL; + + /* will _never_ be this big thanks to the 512 limit of a message */ + char buffer[2000]; + if ((in = fopen(OSInfoDBName, "r")) == NULL) { + alog("os_info: WARNING: can not open the database file! (it might not exist, this is not fatal)"); + ret = 1; + } else { + while (fgets(buffer, 1500, in)) { + type = myStrGetToken(buffer, ' ', 0); + name = myStrGetToken(buffer, ' ', 1); + info = myStrGetTokenRemainder(buffer, ' ', 2); + if (type) { + if (name) { + if (info) { + len = strlen(info); + /* Take the \n from the end of the line */ + info[len - 1] = '\0'; + if (stricmp(type, "C") == 0) { + if ((ci = cs_findchan(name))) { + moduleAddData(&ci->moduleData, "info", + info); + } + } else if (stricmp(type, "N") == 0) { + if ((na = findnick(name))) { + moduleAddData(&na->nc->moduleData, "info", + info); + } + } + free(info); + } + free(name); + } + free(type); + } + } + } + return ret; } /** @@ -614,49 +614,49 @@ int mLoadData(void) **/ int mSaveData(int argc, char **argv) { - ChannelInfo *ci = NULL; - NickCore *nc = NULL; - int i = 0; - int ret = 0; - FILE *out; - char *info = NULL; - - if (argc >= 1) { - if (!stricmp(argv[0], EVENT_START)) { - if ((out = fopen(OSInfoDBName, "w")) == NULL) { - alog("os_info: ERROR: can not open the database file!"); - ircdproto->SendGlobops(s_OperServ, - "os_info: ERROR: can not open the database file!"); - ret = 1; - } else { - for (i = 0; i < 1024; i++) { - for (nc = nclists[i]; nc; nc = nc->next) { - /* If we have any info on this user */ - if ((info = moduleGetData(&nc->moduleData, "info"))) { - fprintf(out, "N %s %s\n", nc->display, info); + ChannelInfo *ci = NULL; + NickCore *nc = NULL; + int i = 0; + int ret = 0; + FILE *out; + char *info = NULL; + + if (argc >= 1) { + if (!stricmp(argv[0], EVENT_START)) { + if ((out = fopen(OSInfoDBName, "w")) == NULL) { + alog("os_info: ERROR: can not open the database file!"); + ircdproto->SendGlobops(s_OperServ, + "os_info: ERROR: can not open the database file!"); + ret = 1; + } else { + for (i = 0; i < 1024; i++) { + for (nc = nclists[i]; nc; nc = nc->next) { + /* If we have any info on this user */ + if ((info = moduleGetData(&nc->moduleData, "info"))) { + fprintf(out, "N %s %s\n", nc->display, info); free(info); - } - } - } + } + } + } - for (i = 0; i < 256; i++) { - for (ci = chanlists[i]; ci; ci = ci->next) { - /* If we have any info on this channel */ - if ((info = moduleGetData(&ci->moduleData, "info"))) { - fprintf(out, "C %s %s\n", ci->name, info); + for (i = 0; i < 256; i++) { + for (ci = chanlists[i]; ci; ci = ci->next) { + /* If we have any info on this channel */ + if ((info = moduleGetData(&ci->moduleData, "info"))) { + fprintf(out, "C %s %s\n", ci->name, info); free(info); - } - } - } - fclose(out); - } - } else { - ret = 0; - } - } - - return ret; + } + } + } + fclose(out); + } + } else { + ret = 0; + } + } + + return ret; } /** @@ -676,28 +676,28 @@ int mBackupData(int argc, char **argv) **/ int mLoadConfig(void) { - char *tmp = NULL; + char *tmp = NULL; - Directive directivas[] = { - {"OSInfoDBName", {{PARAM_STRING, PARAM_RELOAD, &tmp}}}, - }; + Directive directivas[] = { + {"OSInfoDBName", {{PARAM_STRING, PARAM_RELOAD, &tmp}}}, + }; - Directive *d = &directivas[0]; - moduleGetConfigDirective(d); + Directive *d = &directivas[0]; + moduleGetConfigDirective(d); - if (OSInfoDBName) - free(OSInfoDBName); + if (OSInfoDBName) + free(OSInfoDBName); - if (tmp) { - OSInfoDBName = tmp; - } else { - OSInfoDBName = sstrdup(DEFAULT_DB_NAME); - alog("os_info: OSInfoDBName is not defined in Services configuration file, using default %s", OSInfoDBName); - } + if (tmp) { + OSInfoDBName = tmp; + } else { + OSInfoDBName = sstrdup(DEFAULT_DB_NAME); + alog("os_info: OSInfoDBName is not defined in Services configuration file, using default %s", OSInfoDBName); + } - alog("os_info: Directive OSInfoDBName loaded (%s)...", OSInfoDBName); + alog("os_info: Directive OSInfoDBName loaded (%s)...", OSInfoDBName); - return 0; + return 0; } /** @@ -706,58 +706,58 @@ int mLoadConfig(void) **/ int mEventReload(int argc, char **argv) { - int ret = 0; - if (argc >= 1) { - if (!stricmp(argv[0], EVENT_START)) { - alog("os_info: Reloading configuration directives..."); - ret = mLoadConfig(); - } else { - /* Nothing for now */ - } - } - - if (ret) - alog("os_info.c: ERROR: An error has occured while reloading the configuration file"); - - return MOD_CONT; + int ret = 0; + if (argc >= 1) { + if (!stricmp(argv[0], EVENT_START)) { + alog("os_info: Reloading configuration directives..."); + ret = mLoadConfig(); + } else { + /* Nothing for now */ + } + } + + if (ret) + alog("os_info.c: ERROR: An error has occured while reloading the configuration file"); + + return MOD_CONT; } /*************************************************************************/ int mNickHelp(User * u) { - if (is_oper(u)) { - moduleNoticeLang(s_NickServ, u, OINFO_HELP); - } else { - notice_lang(s_NickServ, u, NO_HELP_AVAILABLE, "OINFO"); - } - return MOD_CONT; + if (is_oper(u)) { + moduleNoticeLang(s_NickServ, u, OINFO_HELP); + } else { + notice_lang(s_NickServ, u, NO_HELP_AVAILABLE, "OINFO"); + } + return MOD_CONT; } int mChanHelp(User * u) { - if (is_oper(u)) { - moduleNoticeLang(s_ChanServ, u, OCINFO_HELP); - } else { - notice_lang(s_ChanServ, u, NO_HELP_AVAILABLE, "OINFO"); - } - return MOD_CONT; + if (is_oper(u)) { + moduleNoticeLang(s_ChanServ, u, OCINFO_HELP); + } else { + notice_lang(s_ChanServ, u, NO_HELP_AVAILABLE, "OINFO"); + } + return MOD_CONT; } /* This help will be added to the main NickServ list */ void mMainNickHelp(User * u) { - if (is_oper(u)) { - moduleNoticeLang(s_NickServ, u, OINFO_HELP_CMD); - } + if (is_oper(u)) { + moduleNoticeLang(s_NickServ, u, OINFO_HELP_CMD); + } } /* This help will be added to the main NickServ list */ void mMainChanHelp(User * u) { - if (is_oper(u)) { - moduleNoticeLang(s_ChanServ, u, OCINFO_HELP_CMD); - } + if (is_oper(u)) { + moduleNoticeLang(s_ChanServ, u, OCINFO_HELP_CMD); + } } /*************************************************************************/ |