Anope IRC Services

Anope Development => Modules => Topic started by: tazmania on October 16, 2007, 01:32:27 PM

Title: looking for way to bind !cmd on chan
Post by: tazmania on October 16, 2007, 01:32:27 PM
hello,

i'm new to anope module coding, so trying to study it.

i'm trying to add my service with some command that i would like it to be triggered from within channel by users, using !cmd. (now i know some of you may reply, use eggdrop for it, i might just do that eventually, but i would still like to understand the anope service module coding "internals")

i went over the 2 tutorials on wiki, read them, and tried to "study" from other modules written by other posted on site. i was looking @ vhostserv module code, that had support for !vhost command trigger in his code.

what i fail to understand is what is exactly the porpuse of the createMessage() function & the moduleAddMessage() function.
as in his code for example i see:
under AnopeInit() ,placed a call to createMessage, where inside that createMessage function placed name of a "mid function" that from there calling to another function that check for command using myStrGetToken() function.
(that i assume split for " " & the 0 gets the first bit after split.)

would appreciate any help, sorry if it's being n00b question. i tried to search for answer, & browse forum, and couldn't find my answer...

[Edited on 16-10-2007 by tazmania]
Title:
Post by: Jan Milants on October 16, 2007, 03:47:43 PM
I m sorry to say this, but imho ircd_vhostserv has a rather ugly  and needlessly complicated implementation of fantasy commands.
You would be better off looking at the bs_fantasy_kick.c module that ships in the anope core (anope/src/core/bs_fantasy_kick.c) or the bs_fantasytemplate (http://modules.anope.org/viewmod.php?id=18) module which was created for this purpose.
Also read the anope wiki part regarding internal events (http://anope.info/wiki/Modules:QuickList:InternalEvents).

And you have assumed correctly what myStrGetToken() does :)
This function is also in the wiki (http://anope.info/wiki/Modules:QuickList:Tokens) btw.

[Edited on 16-10-2007 by Viper]
Title:
Post by: tazmania on October 16, 2007, 05:57:47 PM
thanks for your reply viper.
i'll check the reference modules you given & will study them.
:)