| View previous topic :: View next topic |
| Author |
Message |
nANDu Voice
Joined: 22 May 2005 Posts: 15
|
Posted: Fri Dec 30, 2005 5:40 pm Post subject: socket, client compatiblity problem |
|
|
CricInfo.LO.UK.StarLink.Org is a CricInfo's IRC server. Idea is to get the commentry frm #cricinfo channel and relay it to bots original network/channel.
| Code: |
proc cricket {} {
set nick "nANDu[rand 99]"
set sock [socket cricinfo.lo.uk.starlink.org 6667]
puts $sock "NICK $nick"
puts $sock "USER nANDu . . Kishyy"
flush $sock
while {[lindex [split [gets $sock] :] 1] == "End of /MOTD command." } {
puts $sock "JOIN #cricinfo"
flush $sock
}
gets $sock line
set reply [lindex [split $line :] 1]
puts $sock "PONG :$reply"
if {[lindex [split $line] 1] == "PING"} {puts $sock "PONG :$reply"}
set lines "$line\n"
putlog "$lines"
}
|
| Quote: |
:CricInfo.LO.UK.StarLink.Org 513 nANDu37 :Your client may not be compatible with this server.
-
Not able to proceed after that...
|
|
|
| Back to top |
|
 |
demond Revered One

Joined: 12 Jun 2004 Posts: 3073 Location: San Francisco, CA
|
Posted: Fri Dec 30, 2005 11:59 pm Post subject: |
|
|
that must be the dumbest error message ever issued by an IRC server
the IRC server <-> client communication is asynchronous, i.e. you need to handle it with non-blocking, event-driven socket (either use Tcl's mechanism for that - [fconfigure] and [fileevent], or use eggdrop's built-in mechanism via [connect] and [control])
search the forum on the subject, there are plenty of topics elaborating on it; or/and see my script spambuster which, among many other things, does what you need to do - connects a client to IRC server _________________ connection, sharing, dcc problems? click <here>
before asking for scripting help, read <this>
use [code] tag when posting logs, code |
|
| Back to top |
|
 |
nANDu Voice
Joined: 22 May 2005 Posts: 15
|
Posted: Thu Jan 05, 2006 9:02 am Post subject: |
|
|
Hi Demond,
Thanks for the suggestion, I tried the same with [fconfigure] & [fileevent] .. i still get the same error. Nevermind i know i din understand/use them properly :/
Your spambuster was a great help, i succeeded the same with [control] & [connect]. But, i need a lil help checking a proc every minute or 5, to make sure that the socket is connected. Below is what i tried (from ur spambuster's help) :-
| Code: |
bind time - "?0 % % % %" cricinfo
proc cricinfo {min hr mn d yr} {
global chanlinkidx username realname nick
if {![info exists chanlinkidx]} {
if {![valididx $chanlinkidx]} {
control [set chanlinkidx [connect CricInfo.LO.UK.StarLink.Org 6667]] cric:cntrl
putdcc $chanlinkidx USER $username 0 0 :$realname
putdcc $chanlinkidx NICK $nick[rand 1000]
}
}
}
|
Problem:
1) Even if i kill the above $chanlinkidx, it never restarts it.
2) By trial & error i get the proc cricinfo restart. But, i get an error no such variable chanlinkidx |
|
| Back to top |
|
 |
demond Revered One

Joined: 12 Jun 2004 Posts: 3073 Location: San Francisco, CA
|
Posted: Fri Jan 06, 2006 12:16 am Post subject: |
|
|
async comm means you must output to server's socket only in your control proc, responding to server's input
telnet to your server on its IRC port and see what exactly it sends you; my guess is it needs you to reply on PING cookie _________________ connection, sharing, dcc problems? click <here>
before asking for scripting help, read <this>
use [code] tag when posting logs, code |
|
| Back to top |
|
 |
nANDu Voice
Joined: 22 May 2005 Posts: 15
|
Posted: Sun Jan 08, 2006 7:31 am Post subject: |
|
|
hi demond, lil help pls
| Quote: |
[08/01 17:00:03] <Doub> [03:10] Tcl error [cricinfo]: wrong # args: should be "cricinfo"
[08/01 17:01:34] <Doub> [03:30] #nANDu# set errorInfo
[08/01 17:01:34] <Doub> Currently: wrong # args: should be "cricinfo"
[08/01 17:01:34] <Doub> Currently: while executing
[08/01 17:01:34] <Doub> Currently: "cricinfo $_time1 $_time2 $_time3 $_time4 $_time5"
|
| Code: |
bind time - "?0 *" cricinfo
proc cricinfo {} {
global chanlinkidx chanlinknick nick username realname
if {$chanlinkidx == ""} {
set serv "CricInfo.LO.UK.StarLink.Org"
set chanlinkidx [connect $serv 6667]
control $chanlinkidx linkchan
putlc "USER $username 0 0 :$realname"
set chanlinknick $nick[rand 1000]
putlc "NICK $chanlinknick"
}
}
|
.tcl cricinfo frm the dcc works fine |
|
| Back to top |
|
 |
De Kus Revered One

Joined: 15 Dec 2002 Posts: 1361 Location: Germany
|
Posted: Sun Jan 08, 2006 8:59 am Post subject: |
|
|
| nANDu wrote: | | proc cricinfo {} { |
Why did you remove min, h, d, m, and y from the var list? its not optional. A bind to time will always be called with 5 arguments as you do not explicitly change it (like using the special argument "args" or adding addionals arguments to the bind line). _________________ 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... |
|
| Back to top |
|
 |
CuteBangla Halfop
Joined: 27 Feb 2006 Posts: 58 Location: Dhaka, Bangladesh
|
Posted: Sat Apr 15, 2006 2:47 am Post subject: |
|
|
so wht is the final code>?
| De Kus wrote: | | nANDu wrote: | | proc cricinfo {} { |
Why did you remove min, h, d, m, and y from the var list? its not optional. A bind to time will always be called with 5 arguments as you do not explicitly change it (like using the special argument "args" or adding addionals arguments to the bind line). |
_________________ SuMiT
iRC.CuteBangla.Com |
|
| Back to top |
|
 |
r0t3n Owner
Joined: 31 May 2005 Posts: 507 Location: UK
|
Posted: Sat Apr 15, 2006 12:22 pm Post subject: |
|
|
| Code: | | proc cricinfo {minute hour day month year} { |
_________________ r0t3n @ #r0t3n @ Quakenet |
|
| Back to top |
|
 |
|