This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

Public trigger

Old posts that have not been replied to for several years.
Locked
M
MORA
Voice
Posts: 10
Joined: Mon Apr 15, 2002 8:00 pm

Public trigger

Post by MORA »

Does anyone have a exsample module that resonds to a public trigger in a channel (Or some URLs to help with module programming) ?
I tryied looking at the seen module and got my own compiled, but it dont react on the public command.
- its 115lines so pm me if you want to see it.
MORA @ EFNET #egghelp =)
User avatar
stdragon
Owner
Posts: 959
Joined: Sun Sep 23, 2001 8:00 pm
Contact:

Post by stdragon »

Here, I wrote you a little sample:

http://stdarg.techmonkeys.org/egg/modules/sheep.c

It creates a pub bind that responds to things said in the channel.

I haven't tried compiling it. Just look through the code and hopefully it will give you an idea of how to do it.
W
Wcc
Master
Posts: 278
Joined: Sun Oct 28, 2001 8:00 pm
Location: USA
Contact:

Post by Wcc »

Might be a good idea to depend on the irc module as well :)

Wcc
s
serra
Voice
Posts: 17
Joined: Sat Feb 22, 2003 10:24 pm

public trigger

Post by serra »

hi!

First i want to thank stdragon for his module-example. It wasn't me who ask for it but it was just what i was looking for, long time ago! I really do apreciate very much this code.

However I couldn't get it working, even after correcting some minor erros like... a funcion called pub_baa being called by pub_sheep.
And also after included module irc.

The problem is that the bot goes well to irc but when I type !baa on the chan it crashes with a segment violation.

Can you take a look in it and help me to get this to work? I really need to have this example working to start understanding eggdrop module programming

thank you very much for your time and atention!

Pedro
U
UmbraSG
Voice
Posts: 22
Joined: Sun Oct 20, 2002 3:21 am
Location: USA
Contact:

Re: public trigger

Post by UmbraSG »

Yeah, I couldn't get it to work either when I first started. I ended up just having to work off of woobie's code and using sheep.c as a reference, then graduating to gseen and such thrid-party modules.

As for public triggers, it's pretty straight forward.

Code: Select all


static void pub_triggerme(char* nick, char* host, char* handle, char* chan, char* text)
{
   /* implement me! */
}
static char* MYMODULE_close()
{
  /* some code goes here */
  del_builtin(H_pub, pub_trig);
}

cmd_t pub_trig [] = {
{"!triggerme", "", pub_triggerme, NULL},
{0, 0, 0, 0}
};

/* in MYMODULE_start function */
char* MYMODULE_start()
{
  /* -----------------------------------------------------------------------------
      Be sure to get a pointer to irc_funcs or server_funcs, before calling 
      H_pub.  I can't remember which it is right now. 
  --------------------------------------------------------------------------------*/
  add_builtin(H_pub, pub_trig);
}
NOTE: I am trying to remember this the best that I can away from my sources, so there may be some incorrect namings and such.

Umby.
serra wrote:hi!

First i want to thank stdragon for his module-example. It wasn't me who ask for it but it was just what i was looking for, long time ago! I really do apreciate very much this code.

However I couldn't get it working, even after correcting some minor erros like... a funcion called pub_baa being called by pub_sheep.
And also after included module irc.

The problem is that the bot goes well to irc but when I type !baa on the chan it crashes with a segment violation.

Can you take a look in it and help me to get this to work? I really need to have this example working to start understanding eggdrop module programming

thank you very much for your time and atention!

Pedro
User avatar
stdragon
Owner
Posts: 959
Joined: Sun Sep 23, 2001 8:00 pm
Contact:

Post by stdragon »

Wow, that's cool that some people got some use out of good old sheep.c! I think I'm going to clean it up and add a little bit. Any ideas for what should go into a sample module?
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

Woobie should include a few more examples, including doing password checks, and even sending botnet messages. As it is, it's not much help.

The docs state to look at the exported function table, for more things you can do. Jesus, you have to do more than that, you have to then look in the code, to see what they do with half of them. zapf_broad (wtihout looking), what sort of name is that (catch the drift).

Maybe a small pack of C files/mini modules, designed to give examples, would go a long way.

IE
1: Take a PRIVMSG from a user, to request only a whois on themselves. Show password checking and so on.

2: The same, but one designed to send and receive the info to a remote bot.

Yada

The function table could do with a tiny description next to each too.
s
serra
Voice
Posts: 17
Joined: Sat Feb 22, 2003 10:24 pm

Post by serra »

ppslim, yes. I think you're right!

The hard think about module programming is to get started, and woobie doesn't help much.
User avatar
arcane
Master
Posts: 280
Joined: Thu Jan 30, 2003 9:18 am
Location: Germany
Contact:

Post by arcane »

yes, all i'd need are examples... MASSES of examples :D well, should be at least one example to show how a function works and to see the syntax :)
i'm waiting for your new woobie :D
Locked