}
if {"$command" == "PRIVMSG" &&
[regexp {^[&#+!]} [lindex $params 0]] &&
- ![regexp {^!} [lindex $params 1]]} {
+ ![regexp {^![a-z][-a-z]*[a-z]( .*)?$} [lindex $params 1]]} {
# on-channel message, ignore
catch {
recordlastseen_p $prefix "talking on [lindex $params 0]" 1
unset nlist
}
+proc doleave {lchan} {
+ sendout PART $lchan
+ leaving $lchan
+}
+
proc dojoin {lchan} {
global chan_nicks
sendout JOIN $lchan
sendout TOPIC $lchan $topic
}
} else {
- sendout PART $lchan
- leaving $lchan
+ doleave $lchan
}
}
proc msg_JOIN {p c chan} {
prefix_nick
recordlastseen_n $n "joining $chan" 1
- upvar #0 nick_onchans([irctolower $n]) oc
- lappend oc [irctolower $chan]
+ set nl [irctolower $n]
+ set lchan [irctolower $chan]
+ upvar #0 nick_onchans($nl) oc
+ upvar #0 chan_nicks($lchan) nlist
+ lappend oc $lchan
+ lappend nlist $nl
nick_ishere $n
}
proc msg_PART {p c chan} {
}
def_ucmd help {
+ upvar 1 n n
+
+ set topic [irctolower [string trim $text]]
+ if {[string length $topic]} {
+ set ontopic " on `$topic'"
+ } else {
+ set ontopic ""
+ }
if {[set lag [out_lagged]]} {
if {[ischan $dest]} { set replyto $dest } else { set replyto $n }
if {$lag > 1} {
sendaction_priority 1 $replyto \
- "is very lagged. Please ask for help again later."
+ "is very lagged. Please ask for help$ontopic again later."
ucmdr {} {}
} else {
sendaction_priority 1 $replyto \
- "is lagged. Your help will arrive shortly ..."
+ "is lagged. Your help$ontopic will arrive shortly ..."
}
}
- upvar #0 help_topics([irctolower [string trim $text]]) info
- if {![info exists info]} { ucmdr "No help on $text, sorry." {} }
+ upvar #0 help_topics($topic) info
+ if {![info exists info]} { ucmdr "No help on $topic, sorry." {} }
ucmdr $info {}
}
}
}
-def_ucmd op {
+proc channelmgr_monoop {} {
+ upvar 1 dest dest
+ upvar 1 text text
+ upvar 1 n n
+ upvar 1 p p
+ upvar 1 target target
+ global chan_nicks
+
if {[ischan $dest]} { set target $dest }
if {[ta_anymore]} { set target [ta_word] }
ta_nomore
- if {![info exists target]} { error "you must specify, or !... on, the channel" }
+ if {![info exists target]} {
+ error "you must specify, or invoke me on, the relevant channel"
+ }
+ if {![info exists chan_nicks([irctolower $target])]} {
+ error "I am not on $target."
+ }
if {![ischan $target]} { error "not a valid channel" }
if {![chandb_exists $target]} { error "$target is not a managed channel." }
prefix_nick
nick_securitycheck 1
channel_securitycheck $target $n
+}
+
+def_ucmd op {
+ channelmgr_monoop
sendout MODE $target +o $n
}
+def_ucmd leave {
+ channelmgr_monoop
+ doleave $target
+}
+
def_ucmd invite {
global chan_nicks
!summon <username> (See `help !identify', `help !blight-id')
!invite [<chan>] <nick>... Channel settings (see `help channel'):
!op [<chan>] !channel [<chan>] <setting> [....]
+ !leave [<chan>]
Options: Additional help topics:
!timeformat ks|hms !identify !identpass !invite !blight-id
Send commands to me by /msg, or say them in channel with \! in front.
I'll give you channel operator privilege, if you're a manager.
See `help !manager'.
+:leave
+leave [<channel>] on channel
+leave <channel> (privately)
+ I'll leave the channel, if you're a manager. For an unmanaged
+ channel, I'll leave when I'm the last one on the channel.
+
:channel
channel [<chan>] [show] show settings
channel [<chan>] !manager +|-|= <nick> ... set manager list