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.

Translate TCL to C++ Please!!

Discussion of Eggdrop's code and module programming in C.
Post Reply
S
Shahid

Translate TCL to C++ Please!!

Post by Shahid »

Hello, I really wanted to learn how to code eggdrop modules using C/C++ language. I just wanted to see how it work really..

Below is my TCL code I wrote, I wanted you to translate that Language in to C++ eggdrop modules if you can please (including header file if necessary,etc) :)

Once you have coded that in to eggdrop module – please attachment the file.


Code: Select all

# Channel
set channel "#Channe1"

# Trigger command
set trigger !stats

# URL of pisg stats
set url "http://www.google.com/bsd"


proc stats_trigger {nick uhost handle chan test} {
global channel url

foreach x $channel {
if {[string match -nocase $chan $x]} {
    putserv "PRIVMSG $chan :\002Stats\002: $chan stats at \00304$url\00304"
  }
 }
}

bind pub - $trigger stats_trigger
S
Shahid

Post by Shahid »

anyone please?
G
Galadhrim
Op
Posts: 123
Joined: Fri Apr 11, 2003 8:38 am
Location: Netherlands, Enschede

Post by Galadhrim »

You cant expect people to do the work for you. I'll have to translate it yourself :-?
G
Galadhrim
Op
Posts: 123
Joined: Fri Apr 11, 2003 8:38 am
Location: Netherlands, Enschede

Post by Galadhrim »

and btw modules are written in C not C++. C++ is for object oriented program which eggdrop isnt.
m
makam
Voice
Posts: 15
Joined: Thu Jul 08, 2004 1:16 am
Location: Montevideo, Uruguay
Contact:

Post by makam »

Well, here u have...
Remember u can read the eggdrop core source code (and modules),
and learn from there.....

Code: Select all


static char *stats_channel = "#Channe1";
static char *stats_url = "http://www.google.com/bsd";


static cmd_t stats_pub[] = {
 {"!stats",   	NULL, 	stats_trigger,    NULL},
 {NULL,   	NULL, 	NULL,      		 NULL}
};


static int stats_trigger(char *nick, char *host, char *hand, char *channel, char *text) {
                    
	if (!egg_strcasecmp(hannel,stats_channel)) {
		dprintf(DP_SERVER, "PRIVMSG %s :\002Stats\002: %s stats at \00304%s\00304",channel,
			channel, stats_url);
	}
	return 0;
}

--
Web: http://www.makam.org/
Chans: #Uruguay,#Hattricklatino@UnderNet
User avatar
De Kus
Revered One
Posts: 1361
Joined: Sun Dec 15, 2002 11:41 am
Location: Germany

Post by De Kus »

I have started something similar, but it isn't as easy as it might look in the first place. So my "project rewrite your tcl scripts to C modules" is currently delayed till... well.. till I get down to business again :D.

There is a module called "woobie.mod" which shows you how to init a module.
De Kus
StarZ|De_Kus, De_Kus or DeKus on IRC
Copyright © 2005-2009 by De Kus - published under The MIT License
Love hurts, love strengthens...
G
Galadhrim
Op
Posts: 123
Joined: Fri Apr 11, 2003 8:38 am
Location: Netherlands, Enschede

Post by Galadhrim »

the woobie.mod is a joke, there is a mod out called something like sheep.mod. its a bit more advanced. Ask questions here about certains things and we can help you...
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

it is a joke yet it provides all you need to know to start programming eggdrop modules
Post Reply