| View previous topic :: View next topic |
| Author |
Message |
bierbong Voice
Joined: 21 May 2009 Posts: 7
|
Posted: Mon Jun 29, 2009 2:07 am Post subject: how to cache a text-file and write it out to a channel? |
|
|
hello,
i have a *.txt with some lines of text. i want to parse it to a certain channel. i realized it with:
| Code: | set fs [open "$file2" r]
while {![eof $fs]} {
gets $fs line
if {$line == "" } {
} else {
putserv "PRIVMSG #xxx :$line";
}
}
close $fs |
but it is very slow... is there a way to cache the lines or something? |
|
| Back to top |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
Posted: Mon Jun 29, 2009 3:13 am Post subject: |
|
|
| Code: | # read file once into a list
set fslines [split [read [set fs [open $file2]]][close $fs] \n]
# elements of the list contain lines from file
foreach line $fslines {
putserv "privmsg #channel :$line"
} |
Edit: Fixed "putserver" to "putserv" _________________ Follow me on GitHub
- Opposing
Public Tcl scripts
Last edited by Sir_Fz on Mon Jul 06, 2009 4:09 pm; edited 1 time in total |
|
| Back to top |
|
 |
bierbong Voice
Joined: 21 May 2009 Posts: 7
|
Posted: Thu Jul 02, 2009 10:43 am Post subject: |
|
|
| thx!!! |
|
| Back to top |
|
 |
bierbong Voice
Joined: 21 May 2009 Posts: 7
|
Posted: Mon Jul 06, 2009 12:54 pm Post subject: |
|
|
| it is still very slow ( every 2 seconds -> 1 line ). anybody knows why? |
|
| Back to top |
|
 |
raider2k Op
Joined: 01 Jan 2008 Posts: 140
|
Posted: Mon Jul 06, 2009 1:40 pm Post subject: |
|
|
most probably because of the ircds built-in flood protection,
refer to your live operators and/or check out the ircds webpage (if there is one)
you might also want to try replacing (testing purpose only!):
| Code: |
putserv "privmsg #channel :$line"
|
with
| Code: |
putlog "privmsg #channel :$line"
|
and then watch your partyline after rehashing if it comes fast or not.
if it does - its the ircds floodprotection, if it doesnt - code error (which i highly doubt) |
|
| Back to top |
|
 |
arfer Master

Joined: 26 Nov 2004 Posts: 436 Location: Manchester, UK
|
Posted: Tue Jul 07, 2009 9:47 am Post subject: |
|
|
Try putquick instead of putserv, otherwise using same syntax. _________________ I must have had nothing to do |
|
| Back to top |
|
 |
bierbong Voice
Joined: 21 May 2009 Posts: 7
|
Posted: Tue Jul 07, 2009 1:39 pm Post subject: |
|
|
thx, now its a touch faster.
the first 4 lines are posted very fast, but than the same as above- every 2 seconds one line
//edit: i think, it is my eggdrop  |
|
| Back to top |
|
 |
arfer Master

Joined: 26 Nov 2004 Posts: 436 Location: Manchester, UK
|
Posted: Tue Jul 07, 2009 3:31 pm Post subject: |
|
|
Did you try the suggestion by raider2k ie. using putlog to output to the bot's partyline instead of to IRC. This tells you if it is server lag or server flood protection (if it now outputs to the partyline quickly) or a possible code error (if it still outputs to the partyline slowly). _________________ I must have had nothing to do |
|
| Back to top |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Tue Jul 07, 2009 3:48 pm Post subject: |
|
|
puthelp, putserv, and putquick all use eggdrop's server-queue's with different priorities. All are, however, affected by eggdrop's penalty point estimation - which is used to prevent your eggdrop from flooding off.
Even if you would bypass this queue (using the putdccraw command), the irc server would still throttle your output, and in addition, possibly boot you off the network for flooding.
There are some server-software that might allow trusted clients to circumvent such flood protection. You would probably only find such features in reality in private networks. _________________ NML_375, idling at #eggdrop@IrcNET |
|
| Back to top |
|
 |
arfer Master

Joined: 26 Nov 2004 Posts: 436 Location: Manchester, UK
|
Posted: Tue Jul 07, 2009 4:15 pm Post subject: |
|
|
I just ran a test to confirm what has been said previously
| Code: |
bind PUB - .flood pFlood
proc pFlood {nick uhost hand chan text} {
set id [open flood.txt r]
set data [split [read -nonewline $id] \n]
close $id
foreach line $data {
putquick "PRIVMSG $chan :$line"
}
return 0
}
|
The content of the text file is as follows :-
this is line one
this is line two
this is line three
this is line four
this is line five
this is line six
this is line seven
this is line eight
this is line nine
this is line ten
The first 4 lines are output to the IRC channel pretty much immediately and the remainder every second or two.
As nml375 suggested, this may well improve using putdccraw but I would not wish to try. DALnet is fairly relaxed up to a point, then pretty draconian. I am using my Windrop (same host as my connection) for the testing.
It does beg the question, why would you wish to deliberately output many lines at once? Unless it is your intention to flood. Knowing the likely outcome, this is something that most people would wish to avoid. _________________ I must have had nothing to do |
|
| Back to top |
|
 |
Ofloo Owner
Joined: 13 May 2003 Posts: 953 Location: Belguim
|
Posted: Thu Jul 23, 2009 6:32 am Post subject: |
|
|
You should be able to bypass flood protection using:
| Code: | | putdccraw 0 <size_of_msg> <msg>\n |
| Code: | proc putflood {arg} {
putdccraw 0 [expr [string bytelength $arg] + 1] $arg\n
} |
or using the above
_________________ XplaiN but think of me as stupid |
|
| Back to top |
|
 |
|