ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/src/modules.c
(Generate patch)

Comparing:
ircd-hybrid-7.2/src/modules.c (file contents), Revision 912 by michael, Wed Nov 7 22:47:44 2007 UTC vs.
ircd-hybrid-8/src/modules.c (file contents), Revision 1228 by michael, Mon Sep 19 09:38:38 2011 UTC

# Line 23 | Line 23
23   */
24  
25   #include "stdinc.h"
26 < #include "tools.h"
26 > #include "list.h"
27   #include "modules.h"
28   #include "s_log.h"
29   #include "ircd.h"
# Line 36 | Line 36
36   #include "ircd_defs.h"
37   #include "irc_string.h"
38   #include "memory.h"
39 #include "list.h"
39  
41 /* -TimeMr14C:
42 * I have moved the dl* function definitions and
43 * the two functions (load_a_module / unload_a_module) to the
44 * file dynlink.c
45 * And also made the necessary changes to those functions
46 * to comply with shl_load and friends.
47 * In this file, to keep consistency with the makefile,
48 * I added the ability to load *.sl files, too.
49 * 27/02/2002
50 */
40  
41   dlink_list mod_list = { NULL, NULL, 0 };
42  
43   static const char *core_module_table[] =
44   {
45    "m_die.la",
46 +  "m_error.la",
47    "m_join.la",
48    "m_kick.la",
49    "m_kill.la",
# Line 103 | Line 93 | struct Message modrestart_msgtab = {
93   };
94  
95  
106 extern struct Message error_msgtab;
107
96   /*
97   * modules_init
98   *
# Line 122 | Line 110 | modules_init(void)
110    mod_add_cmd(&modreload_msgtab);
111    mod_add_cmd(&modlist_msgtab);
112    mod_add_cmd(&modrestart_msgtab);
125  mod_add_cmd(&error_msgtab);
113   }
114  
115   /* mod_find_path()
# Line 328 | Line 315 | load_core_modules(int warn)
315   * side effects - module is loaded if found.
316   */
317   int
318 < load_one_module(char *path, int coremodule)
318 > load_one_module(const char *path, int coremodule)
319   {
320    dlink_node *ptr = NULL;
321    char modpath[PATH_MAX + 1];
# Line 368 | Line 355 | static void
355   mo_modload(struct Client *client_p, struct Client *source_p,
356             int parc, char *parv[])
357   {
358 <  char *m_bn;
358 >  const char *m_bn = NULL;
359  
360 <  if (!IsAdmin(source_p))
360 >  if (!HasOFlag(source_p, OPER_FLAG_MODULE))
361    {
362      sendto_one(source_p, form_str(ERR_NOPRIVILEGES),
363                 me.name, source_p->name);
364      return;
365    }
366  
367 <  m_bn = basename(parv[1]);
367 >  m_bn = libio_basename(parv[1]);
368  
369    if (findmodule_byname(m_bn) != NULL)
370    {
# Line 394 | Line 381 | static void
381   mo_modunload(struct Client *client_p, struct Client *source_p,
382               int parc, char *parv[])
383   {
384 <  char *m_bn;
384 >  const char *m_bn = NULL;
385    dlink_node *ptr;
386    struct module *modp;
387  
388 <  if (!IsAdmin(source_p))
388 >  if (!HasOFlag(source_p, OPER_FLAG_MODULE))
389    {
390      sendto_one(source_p, form_str(ERR_NOPRIVILEGES),
391                 me.name, source_p->name);
392      return;
393    }
394  
395 <  m_bn = basename(parv[1]);
395 >  m_bn = libio_basename(parv[1]);
396  
397    if ((ptr = findmodule_byname(m_bn)) == NULL)
398    {
# Line 438 | Line 425 | static void
425   mo_modreload(struct Client *client_p, struct Client *source_p,
426               int parc, char *parv[])
427   {
428 <  char *m_bn;
428 >  const char *m_bn = NULL;
429    dlink_node *ptr;
430    struct module *modp;
431    int check_core;
432  
433 <  if (!IsAdmin(source_p))
433 >  if (!HasOFlag(source_p, OPER_FLAG_MODULE))
434    {
435      sendto_one(source_p, form_str(ERR_NOPRIVILEGES),
436                 me.name, source_p->name);
437      return;
438    }
439  
440 <  m_bn = basename(parv[1]);
440 >  m_bn = libio_basename(parv[1]);
441  
442    if ((ptr = findmodule_byname(m_bn)) == NULL)
443    {
# Line 485 | Line 472 | mo_modlist(struct Client *client_p, stru
472   {
473    const dlink_node *ptr = NULL;
474  
475 <  if (!IsAdmin(source_p))
475 >  if (!HasOFlag(source_p, OPER_FLAG_MODULE))
476    {
477      sendto_one(source_p, form_str(ERR_NOPRIVILEGES),
478                 me.name, source_p->name);
# Line 516 | Line 503 | mo_modrestart(struct Client *client_p, s
503    unsigned int modnum = 0;
504    dlink_node *ptr = NULL, *ptr_next = NULL;
505  
506 <  if (!IsAdmin(source_p))
506 >  if (!HasOFlag(source_p, OPER_FLAG_MODULE))
507    {
508      sendto_one(source_p, form_str(ERR_NOPRIVILEGES),
509                 me.name, source_p->name);
# Line 539 | Line 526 | mo_modrestart(struct Client *client_p, s
526    load_core_modules(0);
527  
528    sendto_realops_flags(UMODE_ALL, L_ALL,
529 <              "Module Restart: %u modules unloaded, %lu modules loaded",
529 >              "Module Restart: %u modules unloaded, %u modules loaded",
530                          modnum, dlink_list_length(&mod_list));
531 <  ilog(L_WARN, "Module Restart: %u modules unloaded, %lu modules loaded",
531 >  ilog(L_WARN, "Module Restart: %u modules unloaded, %u modules loaded",
532         modnum, dlink_list_length(&mod_list));
533   }

Diff Legend

Removed lines
+ Added lines
< Changed lines (old)
> Changed lines (new)