Anope IRC Services

Please login or register.

Login with username, password and session length
Advanced search  

News:

Pages: [1]   Go Down

Author Topic: Help with a module  (Read 6321 times)

0 Members and 1 Guest are viewing this topic.

kevin0

  • Anope User
  • Offline Offline
  • Posts: 6
Help with a module
« on: May 24, 2008, 12:30:41 AM »

Hey guys, I'm having trouble with a module, I did modify it but I wanted to know if any of you spotted anything wrong.. This is a modified version of Viper's cs_register_operonly and pretty much it checks a DB for information before allowing registering for non-IRCOPS. Anyway, here is a pastebin of the module:

http://pastebin.org/38083

The error returned is:
Code: [Select]
[19:03] -irc.datablab.com- *** Global -- from services.datablab.com: PANIC! buffer = :Kevin0 PRIVMSG cs@services.datablab.com :register #test test test



That's all the error message I get for that module.



The second module giving me trouble (which started giving me trouble randomly) is a modified ircd_init (source here). This one will not work when loaded. Giving me the error:

Code: [Select]
[May 23 19:15:04 2008] Backtrace: not available on Windows [May 23 19:15:04 2008] Running
(Then anope crashes out, same output with -debug)

When I use /os modload ircd_init (which used to work and no edits have been made to the file) I get this error:


Code: [Select]
[May 23 19:17:50 2008] PANIC! buffer = :Kevin PRIVMSG os@services.datablab.com :modload ircd_init


Any help is much appreciated :)
Logged

Jan Milants

  • Team
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 1372
(No subject)
« Reply #1 on: May 24, 2008, 01:43:52 AM »

to answer your first question, you are using strtok which for starters is not threadsafe and shouldn't be used by modules, especialy not if the core also hooks to the same command since it s destructive. Use the non destructive token functions also found in the wiki (http://anope.info/wiki/Modules:QuickList:Tokens)

the second  and third aren't really my domain :)
Logged
If you like me donate coins to 1FBmZVT4J8WAUMHKqpWhgNVj3XXnRN1cCk :)

kevin0

  • Anope User
  • Offline Offline
  • Posts: 6
(No subject)
« Reply #2 on: May 24, 2008, 02:11:17 AM »

Quote
Originally posted by Viper
to answer your first question, you are using strtok which for starters is not threadsafe and shouldn't be used by modules, especialy not if the core also hooks to the same command since it s destructive. Use the non destructive token functions also found in the wiki (http://anope.info/wiki/Modules:QuickList:Tokens)

the second  and third aren't really my domain :)


Thanks for the tip! Even with that in place though it still seems to be getting the same error every time.

Edit: To test this I pretty much took out most of the function so now it looks like this:

Code: [Select]
char cur_buffer = moduleGetLastBuffer();
char chan = myStrGetOnlyToken(cur_buffer, ' ', 1);
char pass = myStrGetOnlyToken(cur_buffer, ' ', 2);
char desc = myStrGetOnlyToken(cur_buffer, ' ', 3);
alog("chan: %s  -- pass: %s -- desc: %s", chan,pass,desc);
moduleNoticeLang(s_ChanServ, u, LANG_REGISTER_RESTRICTED);
return MOD_STOP;


But it works as

Code: [Select]
LANG_REGISTER_RESTRICTED);
return MOD_STOP;




[Edited on 23-5-2008 by kevin0]

[Edited on 23-5-2008 by kevin0]
Logged

katsklaw

  • Guest
(No subject)
« Reply #3 on: May 24, 2008, 02:30:35 AM »

try using anope_cmd_svsjoin
Logged

kevin0

  • Anope User
  • Offline Offline
  • Posts: 6
(No subject)
« Reply #4 on: May 24, 2008, 02:37:43 AM »

Quote
Originally posted by katsklaw
try using anope_cmd_svsjoin


Not exactly sure what you mean, If you're talking about the ircd_init script, that is what I'm using.
Logged

katsklaw

  • Guest
(No subject)
« Reply #5 on: May 24, 2008, 03:02:04 AM »

Quote
Originally posted by kevin0
Quote
Originally posted by katsklaw
try using anope_cmd_svsjoin


Not exactly sure what you mean, If you're talking about the ircd_init script, that is what I'm using.


You missed a few functions. I wouldn't have suggested it if you was using svsjoin everywhere ;)
Logged

kevin0

  • Anope User
  • Offline Offline
  • Posts: 6
(No subject)
« Reply #6 on: May 24, 2008, 03:24:44 AM »

Quote
Originally posted by katsklaw
Quote
Originally posted by kevin0
Quote
Originally posted by katsklaw
try using anope_cmd_svsjoin


Not exactly sure what you mean, If you're talking about the ircd_init script, that is what I'm using.


You missed a few functions. I wouldn't have suggested it if you was using svsjoin everywhere ;)

Call me blind but I don't see where you are referring to. The real service bots use the join command because I can do that. Help-bot is an mIRC bot and thus needs the svsjoin. He has svsjoin everywhere he joins... unless I missed one. But all the rest work find with just join.
Logged

kevin0

  • Anope User
  • Offline Offline
  • Posts: 6
(No subject)
« Reply #7 on: May 24, 2008, 06:33:42 AM »

As for the first problem I posted, I'm SOO close now. Everything is being formatted correctly and I'm up till after I run the SQL query... Here's the updated code to look at... http://pastebin.org/38136


Only look in oper_only_chan_reg and I get to the point where it logs "into the ret" I get the same error as listed in the first post so it's a problem with that first line after the alog that says "into the ret"... Anyone have an idea of what's wrong with it?
Logged

Jan Milants

  • Team
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 1372
(No subject)
« Reply #8 on: May 24, 2008, 11:16:49 AM »

you are passing it mysql, but that variable is never initialised and as far as i know it s not in extern.h either... :S
Logged
If you like me donate coins to 1FBmZVT4J8WAUMHKqpWhgNVj3XXnRN1cCk :)

kevin0

  • Anope User
  • Offline Offline
  • Posts: 6
(No subject)
« Reply #9 on: May 24, 2008, 06:24:15 PM »

Okay, so I've fixed my first issue, the mysql now works correctly and the module is fine. The issue I'm not having with ircd_init seems to be when I load the mod and it joins every channel, channels with weird names cause the error. Examples are: #k3v, #test895, #xXEx3cuti0n3rXx, #test911. There's nothing special about these channels except for their names... Any ideas?
Logged
Pages: [1]   Go Up