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

Comparing:
ircd-hybrid/src/modules.c (file contents), Revision 32 by knight, Sun Oct 2 20:41:23 2005 UTC vs.
ircd-hybrid-7.2/src/modules.c (file contents), Revision 912 by michael, Wed Nov 7 22:47:44 2007 UTC

# Line 49 | Line 49
49   * 27/02/2002
50   */
51  
52 #ifndef STATIC_MODULES
53
52   dlink_list mod_list = { NULL, NULL, 0 };
53  
54   static const char *core_module_table[] =
55   {
56 <  "m_die",
57 <  "m_join",
58 <  "m_kick",
59 <  "m_kill",
60 <  "m_message",
61 <  "m_mode",
62 <  "m_nick",
63 <  "m_part",
64 <  "m_quit",
65 <  "m_server",
66 <  "m_sjoin",
67 <  "m_squit",
56 >  "m_die.la",
57 >  "m_join.la",
58 >  "m_kick.la",
59 >  "m_kill.la",
60 >  "m_message.la",
61 >  "m_mode.la",
62 >  "m_nick.la",
63 >  "m_part.la",
64 >  "m_quit.la",
65 >  "m_server.la",
66 >  "m_sjoin.la",
67 >  "m_squit.la",
68    NULL
69   };
70  
# Line 117 | Line 115 | extern struct Message error_msgtab;
115   void
116   modules_init(void)
117   {
118 +  dynlink_init();
119 +
120    mod_add_cmd(&modload_msgtab);
121    mod_add_cmd(&modunload_msgtab);
122    mod_add_cmd(&modreload_msgtab);
# Line 231 | Line 231 | findmodule_byname(const char *name)
231    {
232      modp = ptr->data;
233  
234 <    if (!irccmp(modp->name, name))
234 >    if (strcmp(modp->name, name) == 0)
235        return ptr;
236    }
237  
# Line 262 | Line 262 | load_all_modules(int warn)
262  
263    while ((ldirent = readdir(system_module_dir)) != NULL)
264    {
265 <    const char *offset = strrchr(ldirent->d_name, '.');
266 <
267 <    if (offset && !strcmp(offset, SHARED_SUFFIX))
265 >    if (modules_valid_suffix(ldirent->d_name))
266      {
267         snprintf(module_fq_name, sizeof(module_fq_name), "%s/%s",
268                  AUTOMODPATH, ldirent->d_name);
# Line 310 | Line 308 | load_core_modules(int warn)
308  
309    for (; core_module_table[i]; ++i)
310    {
311 <    snprintf(module_name, sizeof(module_name), "%s%s%s", MODPATH,
312 <             core_module_table[i], SHARED_SUFFIX);
311 >    snprintf(module_name, sizeof(module_name), "%s%s",
312 >             MODPATH, core_module_table[i]);
313  
314      if (load_a_module(module_name, warn, 1) == -1)
315      {
316 <      ilog(L_CRIT, "Error loading core module %s%s: terminating ircd",
317 <           core_module_table[i], SHARED_SUFFIX);
316 >      ilog(L_CRIT, "Error loading core module %s: terminating ircd",
317 >           core_module_table[i]);
318        exit(EXIT_FAILURE);
319      }
320    }
# Line 342 | Line 340 | load_one_module(char *path, int coremodu
340  
341      snprintf(modpath, sizeof(modpath), "%s/%s", mpath->path, path);
342  
343 +    if (!modules_valid_suffix(path))
344 +      continue;
345 +
346      if (strstr(modpath, "../") == NULL &&
347          strstr(modpath, "/..") == NULL)
348      {
# Line 482 | Line 483 | static void
483   mo_modlist(struct Client *client_p, struct Client *source_p,
484             int parc, char *parv[])
485   {
486 <  dlink_node *ptr;
486 <  struct module *modp;
486 >  const dlink_node *ptr = NULL;
487  
488    if (!IsAdmin(source_p))
489    {
# Line 494 | Line 494 | mo_modlist(struct Client *client_p, stru
494  
495    DLINK_FOREACH(ptr, mod_list.head)
496    {
497 <    modp = ptr->data;
497 >    const struct module *modp = ptr->data;
498  
499 <    if (parc > 1)
500 <    {
501 <      if (match(parv[1], modp->name))
502 <      {
503 <        sendto_one(source_p, form_str(RPL_MODLIST), me.name, parv[0],
504 <                   modp->name, modp->address,
505 <                   modp->version, modp->core?"(core)":"");
506 <      }
507 <    }
508 <    else
509 <    {
510 <      sendto_one(source_p, form_str(RPL_MODLIST), me.name, parv[0],
511 <                 modp->name, modp->address,
512 <                 modp->version, modp->core?"(core)":"");
513 <    }
499 >    if (parc > 1 && !match(parv[1], modp->name))
500 >      continue;
501 >
502 >    sendto_one(source_p, form_str(RPL_MODLIST), me.name, parv[0],
503 >               modp->name, modp->handle,
504 >               modp->version, modp->core?"(core)":"");
505    }
506  
507    sendto_one(source_p, form_str(RPL_ENDOFMODLIST),
# Line 523 | Line 514 | mo_modrestart(struct Client *client_p, s
514                int parc, char *parv[])
515   {
516    unsigned int modnum = 0;
517 <  dlink_node *ptr;
518 <  dlink_node *tptr;
528 <  struct module *modp;
529 <  
517 >  dlink_node *ptr = NULL, *ptr_next = NULL;
518 >
519    if (!IsAdmin(source_p))
520    {
521      sendto_one(source_p, form_str(ERR_NOPRIVILEGES),
# Line 539 | Line 528 | mo_modrestart(struct Client *client_p, s
528  
529    modnum = dlink_list_length(&mod_list);
530  
531 <  DLINK_FOREACH_SAFE(ptr, tptr, mod_list.head)
531 >  DLINK_FOREACH_SAFE(ptr, ptr_next, mod_list.head)
532    {
533 <    modp = ptr->data;
533 >    struct module *modp = ptr->data;
534      unload_one_module(modp->name, 0);
535    }
536  
# Line 555 | Line 544 | mo_modrestart(struct Client *client_p, s
544    ilog(L_WARN, "Module Restart: %u modules unloaded, %lu modules loaded",
545         modnum, dlink_list_length(&mod_list));
546   }
558
559 #else /* STATIC_MODULES */
560 #include "s_serv.h"
561
562 /* load_all_modules()
563 *
564 * input        - warn flag
565 * output       - NONE
566 * side effects - all the msgtabs are added for static modules
567 */
568 void
569 load_all_modules(int warn)
570 {
571  mod_add_cmd(&error_msgtab);
572  mod_add_cmd(&accept_msgtab);
573  mod_add_cmd(&admin_msgtab);
574  mod_add_cmd(&away_msgtab);
575  mod_add_cmd(&capab_msgtab);
576  mod_add_cmd(&cburst_msgtab);
577  mod_add_cmd(&close_msgtab);
578  mod_add_cmd(&connect_msgtab);
579 #ifdef HAVE_LIBCRYPTO
580  mod_add_cmd(&challenge_msgtab);
581  mod_add_cmd(&cryptlink_msgtab);
582 #endif
583  mod_add_cmd(&die_msgtab);
584  mod_add_cmd(&drop_msgtab);
585  mod_add_cmd(&eob_msgtab);
586  mod_add_cmd(&etrace_msgtab);
587  mod_add_cmd(&gline_msgtab);
588  add_capability("GLN", CAP_GLN, 1);
589  mod_add_cmd(&hash_msgtab);
590  mod_add_cmd(&ungline_msgtab);
591  mod_add_cmd(&info_msgtab);
592  mod_add_cmd(&invite_msgtab);
593  mod_add_cmd(&ison_msgtab);
594  mod_add_cmd(&join_msgtab);
595  mod_add_cmd(&kick_msgtab);
596  mod_add_cmd(&kill_msgtab);
597  mod_add_cmd(&kline_msgtab);
598  add_capability("KLN", CAP_KLN, 1);
599  mod_add_cmd(&dline_msgtab);
600  mod_add_cmd(&unkline_msgtab);
601  mod_add_cmd(&undline_msgtab);
602  mod_add_cmd(&knock_msgtab);
603  add_capability("KNOCK", CAP_KNOCK, 1);
604  mod_add_cmd(&knockll_msgtab);
605  mod_add_cmd(&links_msgtab);
606  mod_add_cmd(&list_msgtab);
607  mod_add_cmd(&lljoin_msgtab);
608  mod_add_cmd(&llnick_msgtab);
609  mod_add_cmd(&locops_msgtab);
610  mod_add_cmd(&lusers_msgtab);
611  mod_add_cmd(&privmsg_msgtab);
612  mod_add_cmd(&notice_msgtab);
613  mod_add_cmd(&map_msgtab);
614  mod_add_cmd(&mode_msgtab);
615  mod_add_cmd(&motd_msgtab);
616  mod_add_cmd(&names_msgtab);
617  mod_add_cmd(&nburst_msgtab);
618  mod_add_cmd(&nick_msgtab);
619  mod_add_cmd(&omotd_msgtab);
620  mod_add_cmd(&oper_msgtab);
621  mod_add_cmd(&operwall_msgtab);
622  mod_add_cmd(&part_msgtab);
623  mod_add_cmd(&pass_msgtab);
624  mod_add_cmd(&ping_msgtab);
625  mod_add_cmd(&pong_msgtab);
626  mod_add_cmd(&post_msgtab);
627  mod_add_cmd(&get_msgtab);
628  mod_add_cmd(&put_msgtab);
629  mod_add_cmd(&quit_msgtab);
630  mod_add_cmd(&rehash_msgtab);
631  mod_add_cmd(&restart_msgtab);
632  mod_add_cmd(&resv_msgtab);
633  mod_add_cmd(&rkline_msgtab);
634  mod_add_cmd(&rxline_msgtab);
635  mod_add_cmd(&server_msgtab);
636  mod_add_cmd(&set_msgtab);
637  mod_add_cmd(&sid_msgtab);
638  mod_add_cmd(&sjoin_msgtab);
639  mod_add_cmd(&squit_msgtab);
640  mod_add_cmd(&stats_msgtab);
641  mod_add_cmd(&svinfo_msgtab);
642  mod_add_cmd(&tb_msgtab);
643  add_capability("TB", CAP_TB, 1);
644  mod_add_cmd(&testline_msgtab);
645  mod_add_cmd(&testgecos_msgtab);
646  mod_add_cmd(&testmask_msgtab);
647  mod_add_cmd(&time_msgtab);
648  mod_add_cmd(&topic_msgtab);
649  mod_add_cmd(&trace_msgtab);
650  add_capability("UNKLN", CAP_UNKLN, 1);
651  mod_add_cmd(&uid_msgtab);
652  mod_add_cmd(&unresv_msgtab);
653  mod_add_cmd(&unxline_msgtab);
654  mod_add_cmd(&user_msgtab);
655  mod_add_cmd(&userhost_msgtab);
656  mod_add_cmd(&users_msgtab);
657  mod_add_cmd(&version_msgtab);
658  mod_add_cmd(&wallops_msgtab);
659  mod_add_cmd(&who_msgtab);
660  mod_add_cmd(&whois_msgtab);
661  mod_add_cmd(&whowas_msgtab);
662  mod_add_cmd(&xline_msgtab);
663  mod_add_cmd(&help_msgtab);
664  mod_add_cmd(&uhelp_msgtab);
665 #ifdef BUILD_CONTRIB
666  mod_add_cmd(&botserv_msgtab);
667  mod_add_cmd(&capture_msgtab);
668  mod_add_cmd(&chanserv_msgtab);
669  mod_add_cmd(&chghost_msgtab);
670  mod_add_cmd(&chgident_msgtab);
671  mod_add_cmd(&chgname_msgtab);
672  mod_add_cmd(&classlist_msgtab);
673  mod_add_cmd(&clearchan_msgtab);
674  mod_add_cmd(&cs_msgtab);
675  mod_add_cmd(&ctrace_msgtab);
676  mod_add_cmd(&delspoof_msgtab);
677  mod_add_cmd(&flags_msgtab);
678  mod_add_cmd(&forcejoin_msgtab);
679  mod_add_cmd(&forcepart_msgtab);
680  mod_add_cmd(&global_msgtab);
681  mod_add_cmd(&help_msgtab);
682  mod_add_cmd(&uhelp_msgtab);
683  mod_add_cmd(&helpserv_msgtab);
684  mod_add_cmd(&hostserv_msgtab);
685  mod_add_cmd(&identify_msgtab);
686  mod_add_cmd(&jupe_msgtab);
687  mod_add_cmd(&killhost_msgtab);
688  mod_add_cmd(&ltrace_msgtab);
689  mod_add_cmd(&memoserv_msgtab);
690  mod_add_cmd(&mkpasswd_msgtab);
691  mod_add_cmd(&ms_msgtab);
692  mod_add_cmd(&nickserv_msgtab);
693  mod_add_cmd(&ns_msgtab);
694  mod_add_cmd(&ojoin_msgtab);
695  mod_add_cmd(&operserv_msgtab);
696  mod_add_cmd(&operspy_msgtab);
697  mod_add_cmd(&opme_msgtab);
698  mod_add_cmd(&os_msgtab);
699  mod_add_cmd(&seenserv_msgtab);
700  mod_add_cmd(&spoof_msgtab);
701  mod_add_cmd(&statserv_msgtab);
702  mod_add_cmd(&svsnick_msgtab);
703  mod_add_cmd(&uncapture_msgtab);
704  /* FIXME: what about spy*? */
705 #endif
706 }
707 #endif /* STATIC_MODULES */

Comparing:
ircd-hybrid/src/modules.c (property svn:keywords), Revision 32 by knight, Sun Oct 2 20:41:23 2005 UTC vs.
ircd-hybrid-7.2/src/modules.c (property svn:keywords), Revision 912 by michael, Wed Nov 7 22:47:44 2007 UTC

# Line 1 | Line 1
1 < Revision
1 > Id Revision

Diff Legend

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