Anope IRC Services

Please login or register.

Login with username, password and session length
Advanced search  

News:

Pages: [1]   Go Down

Author Topic: reading the config file  (Read 3582 times)

0 Members and 1 Guest are viewing this topic.

Darth Panda

  • Anope User
  • Offline Offline
  • Posts: 33
    • Cheap Software
reading the config file
« on: July 28, 2009, 12:37:17 AM »

I've found a few older modules that read from the config file in 1.8 and earlier and I've noticed that they have to read the file in the exact same fashion as the conf parser already does. Why would this need to be done? Can't 3rd party modules gain access to memory space that contains config file directive values already? If not, why would you want to block a module from gaining global access to such data? Perhaps the author needlessly retrieved the values?

I'm wanting to use this module HERE I'm thinking surely that can be trimmed down by removing some redundant code.

Any help would be appreciated.  ;)
« Last Edit: July 28, 2009, 01:52:35 AM by Darth Panda »
Logged
Some things just don't need to be fixed.
Less is usually more.
One meets his destiny often on the road he takes to avoid it.

Trystan Scott Lee

  • Contributor
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 343
Re: reading the config file
« Reply #1 on: July 28, 2009, 01:40:21 PM »

This is a case where the module author could have saved time and read from shared variables instead of running the config again into memory. Exactly why he did this you would need to talk to him.

Now when Anope starts up it reads the config file for lines that it wants. It then ignores all other lines that it does not need to care about. So only core variables are set that time.

Anope provides moduleGetConfigDirective() which will parse the standard config file and look for lines that the module wants. This dates back to 1.7.9 release build, before that you had to port the config parser or write your own.

Logged
my God my tourniquet, return to me salvation

Darth Panda

  • Anope User
  • Offline Offline
  • Posts: 33
    • Cheap Software
Re: reading the config file
« Reply #2 on: July 28, 2009, 09:10:11 PM »

That's what I was thinking. Thank you :)
Logged
Some things just don't need to be fixed.
Less is usually more.
One meets his destiny often on the road he takes to avoid it.
Pages: [1]   Go Up