Skip to content
General IRCd

Sockets help needed

A TG007 community discussion started by Spike1506.

Discussion 7 posts
Page 1 of 1
Open
Topic #3117 · 7 published posts · 1,978 views

Hi i wanna make a socket connection for IRC-D but i have this code now

alias chatnetwerk {
 sockclose chatnetwerk
 sockopen chatnetwerk irc.chatnetwerk.nl 6667
} 
on *:sockopen:chatnetwerk:{ 
 echo -a 4Je bent nu verbonden met de server! =)
 sockwrite -tn $sockname NICK $me
 sockwrite -tn $sockname USER Sockbot "Sockbot" "irc.chatnetwerk.nl" :Sockbot made by Spike1506
}

on *:sockread:chatnetwerk:{ 
 var %data
 sockread %data
 tokenize 32 %data
 echo -a Inkomende data van: $sockname : %data 
 if ($1 == PING) { 
   sockwrite -tn $sockname PONG $2
 }
}

alias join {
 sockwrite -tn chatnetwerk JOIN : $+ $1-
}

 

but it doesnt show me a room window.. etc. etc.

 

could someone help me please?

thats cause you have this alias

 

alias join {

sockwrite -tn chatnetwerk JOIN : $+ $1-

}

 

and its not called

 

also why not just join mirc no need for socks for ircd, as mirc will join without

Edited Mar 15, 2005 10:03 PM by OZZY_10â„¢

My code does NOT have bugs. It just develops random features.

Hi i wanna make a socket connection for IRC-D but i have this code now

 

...

 

but it doesnt show me a room window.. etc. etc.

 

could someone help me please?

alias chatnetwerk {
 var %p = 2000 | while (!$portfree(%p)) inc %p
 if ($status != disconnected) server -n
 scid $scon($scon(0)) server 127.0.0.1 %p
 socklisten chatnetwerk.listen. $+ $scon($scon(0)) %p
 sockopen chatnetwerk.srv. $+ $scon($scon(0)) irc.chatnetwerk.nl 6667
} 
on *:sockopen:chatnetwerk.srv.*:{ 
 echo -a 4Je bent nu verbonden met de server! =)
 sockwrite -tn $sockname NICK $me $lf USER $me "s0ck.b0t" "irc.chatnetwerk.nl" :sockb0t_
}
on *:socklisten:chatnetwerk.listen.*:{
 scid $gettok($sockname,-1,46)
 sockaccept chatnetwerk.loc. $+ $cid
 sockclose $sockname
}
on *:sockread:chatnetwerk.srv.*:{
 scid $gettok($sockname,-1,46)
 var %data
 sockread %data
 echo -a Inkomende data van: $sockname : %data 
 sockwrite -n chatnetwerk.loc. $+ $gettok($sockname,-1,46) %data
}
on *:sockread:chatnetwerk.loc.*:{
 scid $gettok($sockname,-1,46)
 var %d | sockread %d | tokenize 32 %d
 if ($gettok(%d,1,32) isin NICK USER) return
 else sockwrite -n chatnetwerk.srv. $+ $gettok($sockname,-1,46) %d
}
on *:sockclose:chatnetwerk.srv.*:{ sockclose chatnetwerk.loc. $+ $gettok($sockname,-1,46) | if ($scid($gettok($sockname,-1,46))) scid $gettok($sockname,-1,46) | disconnect }

 

that should get you started. the server keeps banning me tho. u should check into that. and there's no need for that join alias because mirc will do it anyway with this code. but ozzy's right. what's the point in this? if you want a sockbot, it's because you want to do something faster than you can do it having mirc process it all. if you want mirc to process it and show you a channel window, etc. you should just use the /server command and let mirc take care of that for you.

Edited Mar 15, 2005 10:18 PM by vexation

bfush.PNG

Thanks a lot, and i just wanna just sockets there because i was thinking it would be a good way to learn sockets

oh, lol. you wanted to LEARN sockets. sorry, here i am doing it all for you...

bfush.PNG

oh, lol. you wanted to LEARN sockets. sorry, here i am doing it all for you...

i know but with reading your code, and trying other stuffs with it it's good enough to learn a little bit, so thanks a lot

hmzzz , need to learn that to sockets o.O

Pomperom