| View previous topic :: View next topic |
| Author |
Message |
r00terr0r Voice
Joined: 22 Aug 2012 Posts: 3
|
Posted: Thu Aug 23, 2012 6:01 am Post subject: Bind RAW Lusers |
|
|
| Code: |
bind time - "*" save:lusers
bind raw - "250" lusers0
bind raw - "251" lusers1
bind raw - "255" lusers5
bind raw - "265" lusers65
bind raw - "266" lusers66
set lusersfile "/var/www/portal/lusers.html"
set lusers0 ""; set lusers1 ""; set lusers5 ""; set lusers65 ""; set lusers66 "";
proc lusers0 {from cmd text} {
global lusers0
set lusers0 "$text"
}
proc lusers1 {from cmd text} {
global lusers1
set lusers1 "$text"
}
proc lusers5 {from cmd text} {
global lusers5
set lusers65 "$text"
}
proc lusers65 {from cmd text} {
global lusers65
set lusers65 "$text"
}
proc lusers66 {from cmd text} {
global lusers66
set lusers65 "$text"
}
proc save:lusers {min hour day mon year} {
putserv "LUSERS"
global lusersfile lusers0 lusers1 lusers5 lusers65 lusers66
set lusers [open $lusersfile w]
puts $lusers "$lusers0 <br> $lusers1 <br> $lusers5 <br> $lusers65 <br> $lusers66"
close $lusers
}
|
I made some script to save IRC Lusers, but doesnot work Can anyone help me?
If anyone have some idea why dont work  |
|
| Back to top |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Thu Aug 23, 2012 7:24 am Post subject: |
|
|
The problem here, is that save:lusers complete before the raw255 (or other) bindings have a chance to trigger (due to the single-threaded nature of eggdrop/tcl).
What you need to do, is first send the "LUSERS" command, and then wait for the server responses (bind raw). Once the binding triggers, extract the data, and then open and save the file.
| Code: | bind time - "*" requestLusers
bind raw - "250" rawLusers250
bind raw - "251" rawLusers251
bind raw - "255" rawLusers255
bind raw - "265" rawLusers265
bind raw - "266" rawLusers266
set lusersfile "/var/www/portal/lusers.html"
proc requestLusers {min hour day month year} {
puthelp "LUSERS"
}
proc rawLusers250 {from cmd text} {
set ::lusers250 $text
}
proc rawLusers251 {from cmd text} {
set ::lusers251 $text
}
proc rawLusers255 {from cmd text} {
set ::lusers255 $text
}
proc rawLusers265 {from cmd text} {
set ::lusers265 $text
}
proc rawLusers266 {from cmd text} {
set fileId [open $::lusersfile w]
if {[info exists ::lusers250]} {
puts $fileId "$::lusers250 <br>"
unset ::lusers250
}
if {[info exists ::lusers251]} {
puts $fileId "$::lusers251 <br>"
unset ::lusers251
}
if {[info exists ::lusers255]} {
puts $fileId "$::lusers255 <br>"
unset ::lusers255
}
if {[info exists ::lusers265]} {
puts $fileId "$::lusers265 <br>"
unset ::lusers265
}
puts $fileId $text
close $fileId
} |
This code will intercept all the listed raw messages, and store their values, up until when 266 is sent. As 266 is received, the previous messages are recalled, and everything is written to file.
Thus, this script expects that the server sends the 266 numeric after any of the other ones. _________________ NML_375, idling at #eggdrop@IrcNET |
|
| Back to top |
|
 |
r00terr0r Voice
Joined: 22 Aug 2012 Posts: 3
|
Posted: Thu Aug 23, 2012 7:35 am Post subject: |
|
|
TNX BROOO!!!
I need it for stats for my web page.
You are clever guy!
Tnx again
And if i dont wrong, i think i need to global string at rawLusers266 proc?
Here is final code:
| Code: |
bind time - "*" save:lusers
bind raw - "250" rawLusers250
bind raw - "251" rawLusers251
bind raw - "255" rawLusers255
bind raw - "265" rawLusers265
bind raw - "266" rawLusers266
set lusersfile "/var/www/portal/lusers.html"
proc rawLusers250 {from cmd text} {
regexp {H.*} $text ::lusers250
}
proc rawLusers251 {from cmd text} {
regexp {T.*} $text ::lusers251
}
proc rawLusers255 {from cmd text} {
regexp {I.*} $text ::lusers255
}
proc rawLusers265 {from cmd text} {
regexp {C.*} $text ::lusers265
}
proc rawLusers266 {from cmd text} {
global ::lusers250 ::lusers251 ::lusers255 ::lusers265 lusersfile
set fileId [open $::lusersfile w]
if {[info exists ::lusers250]} {
puts $fileId "$::lusers250 <br>"
unset ::lusers250
}
if {[info exists ::lusers251]} {
puts $fileId "$::lusers251 <br>"
unset ::lusers251
}
if {[info exists ::lusers255]} {
puts $fileId "$::lusers255 <br>"
unset ::lusers255
}
if {[info exists ::lusers265]} {
puts $fileId "$::lusers265 <br>"
unset ::lusers265
}
regexp {C.*} $text ::lusers266
puts $fileId $::lusers266
close $fileId
}
proc save:lusers {min hour day mon year} {
putserv "LUSERS"
}
|
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|