[srvx-commits] CVS: services/src modcmd.c,1.39,1.40
Brought to you by:
entrope
|
From: Entrope <en...@us...> - 2002-11-22 04:08:00
|
Update of /cvsroot/srvx/services/src
In directory sc8-pr-cvs1:/tmp/cvs-serv664/src
Modified Files:
modcmd.c
Log Message:
automatically bind commands on a per-service basis (if there are no
commands for the service, give it the defaults)
Index: modcmd.c
===================================================================
RCS file: /cvsroot/srvx/services/src/modcmd.c,v
retrieving revision 1.39
retrieving revision 1.40
diff -C2 -r1.39 -r1.40
*** modcmd.c 22 Nov 2002 02:39:52 -0000 1.39
--- modcmd.c 22 Nov 2002 04:07:57 -0000 1.40
***************
*** 1875,1878 ****
--- 1875,1879 ----
if (!(nick = conf_get_data(buf, RECDB_QSTRING))) continue;
if (!(service = service_find(nick))) continue;
+ if (dict_size(service->commands) > 0) continue;
/* Bind the default modules for this service to it */
for (jj = 0; def_binds[ii].modnames[jj]; ++jj) {
***************
*** 1882,1909 ****
/* Bind the help command to this service */
service_bind_modcmd(service, help_command, help_command->name);
! }
!
! /* Now some silly hax.. */
! if ((nick = conf_get_data("services/ChanServ/nick", RECDB_QSTRING))
! && (service = service_find(nick))) {
! service_make_alias(service, "addowner", "*chanserv.adduser", "owner", "$1", NULL);
! service_make_alias(service, "addcoowner", "*chanserv.adduser", "coowner", "$1", NULL);
! service_make_alias(service, "addmaster", "*chanserv.adduser", "master", "$1", NULL);
! service_make_alias(service, "addop", "*chanserv.adduser", "op", "$1", NULL);
! service_make_alias(service, "addpeon", "*chanserv.adduser", "peon", "$1", NULL);
! service_make_alias(service, "delowner", "*chanserv.deluser", "owner", "$1", NULL);
! service_make_alias(service, "delcoowner", "*chanserv.deluser", "coowner", "$1", NULL);
! service_make_alias(service, "delmaster", "*chanserv.deluser", "master", "$1", NULL);
! service_make_alias(service, "delop", "*chanserv.deluser", "op", "$1", NULL);
! service_make_alias(service, "delpeon", "*chanserv.deluser", "peon", "$1", NULL);
! service_make_alias(service, "command", "*modcmd.command", NULL);
! service_make_alias(service, "god", "*modcmd.god", NULL);
! }
! if ((nick = conf_get_data("services/OpServ/nick", RECDB_QSTRING))
! && (service = service_find(nick))) {
! struct svccmd *svccmd;
! svccmd = service_make_alias(service, "stats", "*modcmd.joiner", NULL);
! svccmd->min_opserv_level = 101;
! svccmd = service_make_alias(service, "helpserv", "*helpserv.helpserv", NULL);
}
}
--- 1883,1906 ----
/* Bind the help command to this service */
service_bind_modcmd(service, help_command, help_command->name);
! /* Now some silly hax.. (aliases that most people want) */
! if (!irccasecmp(def_binds[ii].svcname, "ChanServ")) {
! service_make_alias(service, "addowner", "*chanserv.adduser", "owner", "$1", NULL);
! service_make_alias(service, "addcoowner", "*chanserv.adduser", "coowner", "$1", NULL);
! service_make_alias(service, "addmaster", "*chanserv.adduser", "master", "$1", NULL);
! service_make_alias(service, "addop", "*chanserv.adduser", "op", "$1", NULL);
! service_make_alias(service, "addpeon", "*chanserv.adduser", "peon", "$1", NULL);
! service_make_alias(service, "delowner", "*chanserv.deluser", "owner", "$1", NULL);
! service_make_alias(service, "delcoowner", "*chanserv.deluser", "coowner", "$1", NULL);
! service_make_alias(service, "delmaster", "*chanserv.deluser", "master", "$1", NULL);
! service_make_alias(service, "delop", "*chanserv.deluser", "op", "$1", NULL);
! service_make_alias(service, "delpeon", "*chanserv.deluser", "peon", "$1", NULL);
! service_make_alias(service, "command", "*modcmd.command", NULL);
! service_make_alias(service, "god", "*modcmd.god", NULL);
! } else if (!irccasecmp(def_binds[ii].svcname, "OpServ")) {
! struct svccmd *svccmd;
! svccmd = service_make_alias(service, "stats", "*modcmd.joiner", NULL);
! svccmd->min_opserv_level = 101;
! service_make_alias(service, "helpserv", "*helpserv.helpserv", NULL);
! }
}
}
***************
*** 1939,1946 ****
/* Check databases. */
saxdb_register("modcmd", modcmd_saxdb_read, modcmd_saxdb_write);
! if (!saxdb_present) {
! create_default_binds();
! import_aliases_db();
! }
/* Resolve command rule-templates. */
--- 1936,1941 ----
/* Check databases. */
saxdb_register("modcmd", modcmd_saxdb_read, modcmd_saxdb_write);
! create_default_binds();
! if (!saxdb_present) import_aliases_db();
/* Resolve command rule-templates. */
|