From f10cc887183b261f0e22aa2d34abe3e20186e97b Mon Sep 17 00:00:00 2001 From: adam Date: Wed, 16 Jun 2004 12:23:32 +0000 Subject: [PATCH] added modes parameter to srvx.conf to control user modes * each service now has a 'modes' parameter in srvx.conf to specify their individual modes.. if left blank, will default to whatever 'services' modes work for your ircd. git-archimport-id: srvx@srvx.net--2004-srvx/srvx--devo--1.3--patch-69 --- ChangeLog | 16 ++++++++++++++++ src/chanserv.c | 3 ++- src/global.c | 3 ++- src/mod-helpserv.c | 2 +- src/modcmd.c | 4 ++-- src/nickserv.c | 3 ++- src/opserv.c | 6 ++++-- src/proto-bahamut.c | 4 ++-- src/proto-p10.c | 4 ++-- src/proto.h | 2 +- srvx.conf.example | 16 ++++++++++++++++ 11 files changed, 50 insertions(+), 13 deletions(-) diff --git a/ChangeLog b/ChangeLog index b3bda78..fc973e8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,22 @@ # arch-tag: automatic-ChangeLog--srvx@srvx.net--2004-srvx/srvx--devo--1.3 # +2004-06-16 12:23:32 GMT adam patch-69 + + Summary: + added modes parameter to srvx.conf to control user modes + Revision: + srvx--devo--1.3--patch-69 + + * each service now has a 'modes' parameter in srvx.conf to specify their individual modes.. if left blank, will default to whatever 'services' modes work for your ircd. + + + modified files: + ChangeLog src/chanserv.c src/global.c src/mod-helpserv.c + src/modcmd.c src/nickserv.c src/opserv.c src/proto-bahamut.c + src/proto-p10.c src/proto.h srvx.conf.example + + 2004-06-08 09:24:49 GMT adam patch-68 Summary: diff --git a/src/chanserv.c b/src/chanserv.c index 7c629f6..f93a75f 100644 --- a/src/chanserv.c +++ b/src/chanserv.c @@ -7249,7 +7249,8 @@ init_chanserv(const char *nick) dict_set_free_data(note_types, chanserv_deref_note_type); if(nick) { - chanserv = AddService(nick, "Channel Services", NULL); + const char *modes = conf_get_data("services/chanserv/modes", RECDB_QSTRING); + chanserv = AddService(nick, modes ? modes : NULL, "Channel Services", NULL); service_register(chanserv)->trigger = '!'; reg_chanmsg_func('\001', chanserv, chanserv_ctcp_check); } diff --git a/src/global.c b/src/global.c index dc7dc4f..75e8245 100644 --- a/src/global.c +++ b/src/global.c @@ -674,7 +674,8 @@ init_global(const char *nick) if(nick) { - global = AddService(nick, "Global Services", NULL); + const char *modes = conf_get_data("services/global/modes", RECDB_QSTRING); + global = AddService(nick, modes ? modes : NULL, "Global Services", NULL); global_service = service_register(global); } saxdb_register("Global", global_saxdb_read, global_saxdb_write); diff --git a/src/mod-helpserv.c b/src/mod-helpserv.c index 1a8efc5..5b75c1e 100644 --- a/src/mod-helpserv.c +++ b/src/mod-helpserv.c @@ -2603,7 +2603,7 @@ static struct helpserv_bot *register_helpserv(const char *nick, const char *help * it's a harmless default */ hs = calloc(1, sizeof(struct helpserv_bot)); - if (!(hs->helpserv = AddService(nick, helpserv_conf.description, NULL))) { + if (!(hs->helpserv = AddService(nick, "+iok", helpserv_conf.description, NULL))) { free(hs); return NULL; } diff --git a/src/modcmd.c b/src/modcmd.c index ba5f40e..933c791 100644 --- a/src/modcmd.c +++ b/src/modcmd.c @@ -1730,7 +1730,7 @@ static MODCMD_FUNC(cmd_service_add) { reply("MCMSG_ALREADY_SERVICE", bot->nick); return 0; } - bot = AddService(nick, desc, hostname); + bot = AddService(nick, NULL, desc, hostname); service_register(bot); reply("MCMSG_NEW_SERVICE", bot->nick); return 1; @@ -2049,7 +2049,7 @@ modcmd_load_bots(struct dict *db, int default_nick) { hostname = database_get_data(rd->d.object, "hostname", RECDB_QSTRING); if (desc) { if (!svc) - svc = service_register(AddService(nick, desc, hostname)); + svc = service_register(AddService(nick, NULL, desc, hostname)); else if (hostname) strcpy(svc->bot->hostname, hostname); desc = database_get_data(rd->d.object, "trigger", RECDB_QSTRING); diff --git a/src/nickserv.c b/src/nickserv.c index 4d7b374..b2f5afd 100644 --- a/src/nickserv.c +++ b/src/nickserv.c @@ -3826,7 +3826,8 @@ init_nickserv(const char *nick) userList_init(&curr_helpers); if (nick) { - nickserv = AddService(nick, "Nick Services", NULL); + const char *modes = conf_get_data("services/nickserv/modes", RECDB_QSTRING); + nickserv = AddService(nick, modes ? modes : NULL, "Nick Services", NULL); nickserv_service = service_register(nickserv); } saxdb_register("NickServ", nickserv_saxdb_read, nickserv_saxdb_write); diff --git a/src/opserv.c b/src/opserv.c index a63c0e1..0a3ac77 100644 --- a/src/opserv.c +++ b/src/opserv.c @@ -4022,8 +4022,10 @@ void init_opserv(const char *nick) { OS_LOG = log_register_type("OpServ", "file:opserv.log"); - if (nick) - opserv = AddService(nick, "Oper Services", NULL); + if (nick) { + const char *modes = conf_get_data("services/opserv/modes", RECDB_QSTRING); + opserv = AddService(nick, modes ? modes : NULL, "Oper Services", NULL); + } conf_register_reload(opserv_conf_read); memset(level_strings, 0, sizeof(level_strings)); diff --git a/src/proto-bahamut.c b/src/proto-bahamut.c index ee649b1..689e26c 100644 --- a/src/proto-bahamut.c +++ b/src/proto-bahamut.c @@ -171,7 +171,7 @@ AddUser(struct server* uplink, const char *nick, const char *ident, const char * } struct userNode * -AddService(const char *nick, const char *desc, const char *hostname) { +AddService(const char *nick, const char *modes, const char *desc, const char *hostname) { time_t timestamp = now; struct userNode *old_user = GetUserH(nick); struct in_addr ipaddr = { INADDR_LOOPBACK }; @@ -182,7 +182,7 @@ AddService(const char *nick, const char *desc, const char *hostname) { } if (!hostname) hostname = self->name; - return AddUser(self, nick, nick, hostname, "+oikr", desc, timestamp, ipaddr, 0); + return AddUser(self, nick, nick, hostname, modes ? modes : "+oikr", desc, timestamp, ipaddr, 0); } struct userNode * diff --git a/src/proto-p10.c b/src/proto-p10.c index b2aa696..8e5bc3e 100644 --- a/src/proto-p10.c +++ b/src/proto-p10.c @@ -1801,7 +1801,7 @@ void DelServer(struct server* serv, int announce, const char *message) } struct userNode * -AddService(const char *nick, const char *desc, const char *hostname) +AddService(const char *nick, const char *modes, const char *desc, const char *hostname) { char numeric[COMBO_NUMERIC_LEN+1]; int local_num = get_local_numeric(); @@ -1820,7 +1820,7 @@ AddService(const char *nick, const char *desc, const char *hostname) if (!hostname) hostname = self->name; make_numeric(self, local_num, numeric); - return AddUser(self, nick, nick, hostname, "+oik", numeric, desc, now, "AAAAAA"); + return AddUser(self, nick, nick, hostname, modes ? modes : "+oik", numeric, desc, now, "AAAAAA"); } struct userNode * diff --git a/src/proto.h b/src/proto.h index 3b60c72..3f4143b 100644 --- a/src/proto.h +++ b/src/proto.h @@ -169,7 +169,7 @@ void irc_numeric(struct userNode *user, unsigned int num, const char *format, .. /* stuff originally from other headers that is really protocol-specific */ int IsChannelName(const char *name); int is_valid_nick(const char *nick); -struct userNode *AddService(const char *nick, const char *desc, const char *hostname); +struct userNode *AddService(const char *nick, const char *modes, const char *desc, const char *hostname); struct userNode *AddClone(const char *nick, const char *ident, const char *hostname, const char *desc); struct server* AddServer(struct server* uplink, const char *name, int hops, time_t boot, time_t link, const char *numeric, const char *description); void DelServer(struct server* serv, int announce, const char *message); diff --git a/srvx.conf.example b/srvx.conf.example index 3bd2d60..bab5e6a 100644 --- a/srvx.conf.example +++ b/srvx.conf.example @@ -43,6 +43,10 @@ "services" { "nickserv" { "nick" "NickServ"; + // What user modes do you want this service to have? Please keep in + // mind which ircd software you are using here, and that all of the + // services need to be at least +o. + // "modes" "+iok"; // If you want to by have *@* as the default hostmask, set // default_hostmask. This is discouraged for security reasons. // "default_hostmask" "1"; @@ -131,6 +135,10 @@ "opserv" { "nick" "OpServ"; + // What user modes do you want this service to have? Please keep in + // mind which ircd software you are using here, and that all of the + // services need to be at least +o. + // "modes" "+iok"; // should use of this service be limited to global opers? "privileged" "1"; // fullname for service @@ -178,6 +186,10 @@ // (This is changed relative srvx-1.0.x, which would use default // unless you specified ".disabled".) "nick" "ChanServ"; + // What user modes do you want this service to have? Please keep in + // mind which ircd software you are using here, and that all of the + // services need to be at least +o. + // "modes" "+iok"; // Does your ircd have off-channel services support? // Bahamut does; ircu2.10.11 does not. "off_channel" "no"; @@ -230,6 +242,10 @@ "global" { "nick" "Global"; + // What user modes do you want this service to have? Please keep in + // mind which ircd software you are using here, and that all of the + // services need to be at least +o. + // "modes" "+iok"; // should users get community announcements by default or not? "announcements_default" "on"; }; -- 2.20.1