Page 1 of 1

module trouble oO

Posted: Mon Apr 05, 2004 8:27 pm
by daniel
hey all,

not long ago I started to code a litle unreal module to link my community website (webchat) to an irc server. I chose unreal because the plugin system is great.

everything worked fine untill I tried to add configuration file support to my module. I added hooktypes CONFIGRUN, CONFIGTEST and REHASH to my module but RUN, and TEST are not called when unreal starts up. I am using a CVS snapshot which is just a few days old. both hooks are successfully called when I simply /rehash unreal. I had a look at other modules which are using configuration files...but I can't get is to work :/

I notices this behaviour months before when I tried to install some snomask plugin using an older non-cvs unreal release.

on /unreal start I get
* unrealircd.conf:78: unknown directive testcommand
when I add some directive globaly and I start unreal.

if it's inside the set { } block unreal does not start at all.

adding an own block just lets CONFIGRUN stop after the blocks "name" line when I type /rehash (but it does not do anything but display a warning on /unreal start).

does anybody have an idea what I am doing wrong? =)

regards

Posted: Mon Apr 05, 2004 9:17 pm
by codemastr
My guess is you created the HOOKTYPE_CONFIGTEST inside Mod_Init?

If so, that's a problem. You need to add that hook in the "testing" phase. Try adding a new function, Mod_Test (syntax is the same as Mod_Init) and create the hook in there. (You only need to do this for the CONFIGTEST, not the CONFIGRUN.

Posted: Mon Apr 05, 2004 9:38 pm
by daniel
thank you, that's exactly what I did wrong =). I'll try adding the Mod_Test function...will be back later ;)

Posted: Mon Apr 05, 2004 10:09 pm
by daniel
ok it works for me now =)

now I am trying to add an own block of config variables like

test {
somekey "somevalue";
};

on config_test there is no more than the (empty? == NULL?) "test" key for this block executed. my config_test function returns always 2 (just for testing so that there are no errors) and my config_run function returns always 1 for the same reason. I had a look at the module system's sources and found out, that this values do not cause any breaks or errors.

so what do I have to do if I want to add such a new block? =)

Posted: Mon Apr 05, 2004 10:11 pm
by codemastr
I'm not quite sure I understand the question...

Posted: Mon Apr 05, 2004 10:15 pm
by daniel
I think I've found it...

I had a look at struct.h and the ConfigEntry struct. Seems to me that all sub items are listed in it.

mmh I'm going to test it now ;)
thx

mmh

Posted: Wed Apr 07, 2004 10:27 pm
by daniel
Hello again...

I am troubled again :/

I am trying to make it work that new users are renamed to something like "Guest-1", "Guest-2" etc. I created a new array indexed with users' slot ids (in global user table) where I add additional information for each user. I delete this information, when a user quits irc.

When a user uses a custom /LOGIN command, he will be authed and renamed to his/her username. I change nickname, username (sptr->user->username, sptr->username) and userinfo to what a socket connection returns for this user.

This worked fine until I added the /LOGIN command. Before this command, users where authed by their username:password on login....but this is insecure because mIRC stores plain text password so I added /LOGIN.

So my problem is, that unreal dies with no error sometimes when users connect or do a /LOGIN etc. It seems to be completly random.

I tried resetting nick, username and userinfo by simply changing the corresponding variables and I tried to use m_nick() to do the same thing for their nicknames. I have absolutely no idea what I am doing wrong...

Is there anything I have to keep track of when altering users' information? Or is there a way to get more detailed debug information on why unreal dies?

regards

Posted: Thu Apr 08, 2004 7:58 am
by AngryWolf
Yes, there is, I described the most important things at http://www.angrywolf.org/bugs.php?lang=en (section 1.4). It's time for you to learn how gdb works. :-) By the way, I'm not sure whether I can help without seeing the source code of your module.

Oh, and one suggestion: I think you shouldn't touch sptr->username, because that one is used only by the auth stuff. I suggest you to change only sptr->user->username.