I've downloaded a rss.tcl script. I wanted to edit it. For exemple, before the bot start posting rss, it set mode -S (it's easy) and it set mode +S after posting all rss
pushmode <channel> <mode> [arg]
Description: sends out a channel mode change (ex: pushmode #lame +o goober) through the bot's queuing system. All the mode changes will be sent out at once (combined into one line as much as possible) after the script finishes, or when 'flushmode' is called.
Conc wrote:if there is just 1 rss feed, it works fine, but if there is more than 2... we have a problem (the same)]
Look at my post above, use that code. It does it just fine. Put the mode changes outside the foreach. Use the same queue that the messages inside the foreach are using. This works.
Upon putting thought into this it dawned on me why this happens. The order in which rss-synd does the foreaching on it's lists doesn't occur in the order required to do this as easily as I thought.
proc ::rss-synd::feed_msg {type msgs targets {nick ""}} {
# check if our target is a nick
if {(($nick != "") && \
($targets == "")) || \
([regexp -- {[23]} $type])} {
set targets $nick
}
foreach msg $msgs {
foreach chan $targets {
if {([catch {botonchan $chan}] == 0) || \
([regexp -- {^[#&]} $chan] == 0)} {
# is this the first time we set the chan +S ?
if {![info exists did_we_s($chan)]} {
# yes, make note so we don't do it again
# and we can undo it later.
set did_we_s($chan) 0
# set the mode
putserv "MODE $chan +S"
}
foreach line [split $msg "\n"] {
if {($type == 1) || ($type == 3)} {
putserv "NOTICE $chan :$line"
} else {
putserv "PRIVMSG $chan :$line"
}
}
}
}
}
# did we make a list of chans to undo +S in?
if {[array exists did_we_s]} {
# yes, iterate them all
foreach c [array names did_we_s] {
# set the mode
putserv "MODE $c -S"
}
}
}
This will do it, and I've commented the sections I've added to explain why they are there. This uses a simple array to keep track of which channels have been set +S. After sending all messages, this array is run through setting all channels -S. Have a fun.