Merge !tell feature. cvs up -j branchpoint-2001-10-09-tell -j merge-2001-10-09-tell
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Fri, 22 Mar 2002 16:16:51 +0000 (16:16 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Fri, 22 Mar 2002 16:16:51 +0000 (16:16 +0000)
.cvsignore
bot.tcl
helpinfos
irccore.tcl
nctest.tcl [new file with mode: 0644]
parsecmd.tcl
telling.fig [new file with mode: 0644]
test.tcl

index 20abe1f..1aaf75e 100644 (file)
@@ -2,3 +2,4 @@ summon
 users
 chans
 botpass.tcl
+telling.ps
diff --git a/bot.tcl b/bot.tcl
index 0bbc3b7..13f2cdf 100755 (executable)
--- a/bot.tcl
+++ b/bot.tcl
@@ -6,6 +6,9 @@ source irccore.tcl
 source parsecmd.tcl
 source stdhelp.tcl
 
+defset marktime_min 300
+defset marktime_join_startdelay 5000
+
 proc privmsg_unlogged {prefix ischan params} {
     if {!$ischan ||
         [regexp {^![a-z][-a-z]*[a-z]( .*)?$} [lindex $params 1]]} {
@@ -15,7 +18,7 @@ proc privmsg_unlogged {prefix ischan params} {
     set chan [lindex $params 0]
     upvar #0 chan_lastactivity([irctolower $chan]) la
     set la [clock seconds]
-    catch { recordlastseen_p $prefix "talking on $chan" 1 }
+    catch_logged { recordlastseen_p $prefix "talking on $chan" 2 }
     return 1
 }
 
@@ -108,6 +111,26 @@ proc showtime {when} {
     return [showinterval [expr {[clock seconds] - $when}]]
 }
 
+proc parse_interval {specified min} {
+    if {![regexp {^([0-9]+)([a-z]+)$} $specified dummy value unit]} {
+       error "invalid syntax for interval"
+    }
+    switch -exact $unit {
+       s { set u 1 }
+       ks { set u 1000 }
+       m { set u 60 }
+       h { set u 3600 }
+       mb { set u 0.0864 }
+       b { set u 86.4 }
+       kb { set u 86400 }
+       default { error "unknown unit of time $unit" }
+    }
+    if {$value > 86400*21/$u} { error "interval too large" }
+    set result [expr {round($value*$u)}]
+    if {$result < $min} { error "interval too small (<${min}s)" }
+    return $result
+}
+
 proc def_msgproc {name argl body} {
     proc msg_$name "varbase $argl" "\
     upvar #0 msg/\$varbase/dest d\n\
@@ -150,11 +173,249 @@ proc looking_whenwhere {when where} {
     return $str
 }
 
+proc tell_getcstate {} {
+    # uses nl from caller's context
+    # imports telling (as the nick_telling) and u
+    # sets stt, telling_when
+    uplevel 1 {
+       upvar #0 nick_telling($nl) telling
+       upvar #0 nick_unique($nl) u
+
+       if {[info exists telling]} {
+           manyset $telling u_last stt telling_when
+           if {![info exists u] || "$u_last" != "$u"} {
+               set stt undelivered
+           }
+       } else {
+           set stt undelivered
+           set telling_when 0
+       }
+    }
+}
+
+proc tell_event {nl event} {
+    # For `act' we *haven't* yet done the 750ms delay; we implement
+    # that here.  Also, here we turn `talk' into `talk' now and `act'
+    # later.  We also support the psuedo-event `none'.  The del msg
+    # and new msg events are handled by the command procedures, not here.
+    global calling_nick
+    if {[info exists calling_nick]} { set save $calling_nick }
+    set r DELAYED
+    switch -exact $event {
+       none { }
+       talk {
+           tell_event_core $nl talk
+           tell_event $nl act
+       }
+       act {
+           after 750 [list tell_event_core $nl $event]
+       }
+       ident - msgsarrive {
+           tell_event_core $nl $event
+       }
+       tellme {
+           set r [tell_event_core $nl TELLME]
+       }
+       default {
+           error "tell_event $nl $event"
+       }
+    }
+    if {[info exists save]} { set calling_nick $save }
+    return $r
+}
+
+proc tell_event_core {nl event} {
+    global tell_event_teventi errorInfo
+    set tell_event_teventi "*$event* $nl"
+    if {[catch {
+       tell_event_core1 $nl $event
+    } emsg]} {
+       log_intern "tell event error" "$emsg >$errorInfo<"
+       set emsg ERROR
+    } else {
+       if {"$emsg" != "nomsgs"} {
+           log_intern "tell event" "done $tell_event_teventi $emsg"
+       }
+    }
+    return $emsg
+}
+
+proc tell_event_core1 {nl event} {
+    # event is `talk', `act', `ident', `msgsarrive' or `TELLME'
+    # When user talks we actually get talk now and act later
+    global calling_nick
+    set calling_nick $nl
+    set iml [msgsdb_get $nl inbound]
+    if {![llength $iml]} { return nomsgs }
+
+    set now [clock seconds]
+    tell_getcstate
+    set ago [expr {$now - $telling_when}]
+
+    # Now we have the components of a telling state
+    #   u     - nick_unique (unset if not visible)
+    #   stt   - state: undelivered, mentioned, passede
+    #   ago   - how long ago since we did anything
+
+    # We compute an evstate to dispatch on as follows:
+
+    # evstate is string of letters
+    #   current state
+    #      u   UNDELIVERED (MESSAGES)
+    #      m   MENTIONED
+    #      p   PASSED
+    #   event
+    #      t   talk
+    #      a   act
+    #      i   ident
+    #      m   msgsarrive
+    #      T   tellme (user command)
+    #   security level and timing
+    #      ii  Insecure
+    #      ss  Secure and soon (before interval)
+    #      sl  Secure and late (after interval)
+    #   current identification
+    #      i   Identified
+    #      u   Unidentified
+    #   reliability and timing
+    #      uu  Unreliable
+    #      rv  Remind, very soon (before within-interval)
+    #      rs  Remind, soon (between)
+    #      rl  Remind, late (after every-interval)
+    #      ps  Pester, soon (before interval)
+    #      pl  Pester, late (after interval)
+
+    set evstate {}
+
+    append evstate [string range $stt 0 0]
+    append evstate [string range $event 0 0]
+
+    manyset [nickdb_get_sec_effective $nl] sec secwhen
+    switch -exact $sec {
+       insecure { append evstate ii }
+       secure { append evstate [expr {$ago<$secwhen ? "ss" : "sl"}] }
+       default { append evstate "#$sec#" }
+    }
+
+    upvar #0 nick_username($nl) nu
+    if {[info exists nu] && "$nu" == "[nickdb_get_username $nl]"} {
+       append evstate i
+    } else {
+       append evstate u
+    }
+    
+    manyset [nickdb_get $nl tellrel] rel relint relwithin
+    switch -exact $rel {
+       unreliable { append evstate uu }
+       remind { append evstate [expr {
+           $ago<$relwithin ? "rv" : $ago<$relint ? "rs" : "rl"
+       }]}
+       pester { append evstate [expr {$ago<$relint ? "ps" : "pl"}] }
+       default { append evstate "#$rel#" }
+    }
+
+    global tell_event_teventi
+    set tell_event_teventi "$evstate $ago $nl"
+    switch -glob $evstate {
+       pt???rv {
+           # consider delivered:
+           #  (very recently passed, and the user talks)
+           set ndel [tell_delete_msgs {} $nl]
+           sendprivmsg $nl \
+ "I'm assuming you got the $ndel message(s) I just passed on."
+           return delivered
+       }
+       pm????? {
+           # oops, messages passed are now out of date
+           catch_restoreei { unset telling }
+           return reset
+       }
+       ?m????? {
+           # ignore new msgs if we haven't passed yet
+           return ignorenew
+       }
+       ut????? - mt????? -
+       pt???uu - pt???rs - pt???rl - pt???p? {
+           # ignore (any other `talk's) - act handles these
+           return ignoretalk
+       }
+       ui????? -
+       uaii?uu - uaii??l - uas?iuu - uas?i?l -
+       mi????? - pa????l -
+       ?Tii??? - ?Ts?i?? {
+           # pass and then stuff
+           if {[llength $iml] == 3} {
+               manyset $iml sender sentwhen msg
+               sendprivmsg $nl \
+ "$sender asked me, [showinterval [expr {$now-$sentwhen}]],\
+ to tell you: $msg"
+            } else {
+               sendprivmsg $nl \
+ "I have [expr {[llength $iml]/3}] messages for you:"
+               while {[llength $iml] >= 3} {
+                   manyset [lrange $iml 0 2] sender sentwhen msg
+                   set iml [lrange $iml 3 end]
+                   sendprivmsg $nl \
+ " [showintervalsecs [expr {$now-$sentwhen}] 1] <$sender> $msg"
+               }
+           }
+           if {"$rel" == "unreliable"} {
+               tell_delete_msgs {} $nl
+               return toldunreliable
+           }
+           set stt passed
+           set re passed
+       }
+       uaslu?? {
+           sendprivmsg $nl {You have messages (so identify yourself please).}
+           set stt mentioned
+           set re mentioned
+       }
+       ?Ts?u?? {
+           sendprivmsg $nl {You must identify yourself to see your messages.}
+           return ignoreuitm
+       }
+       masl??? {
+           sendprivmsg $nl {Don't forget about your messages.}
+           return remind
+       }
+       pi????? {
+           return ignorepi
+       }
+       mass??? - pa????v - pa????s -
+       uaii??v - uaii??s -
+       uas?i?v - uas?i?s -
+       uassu?? {
+           # too soon
+           return ignoresoon
+       }
+       * {
+           error "tell_event_core nl=$nl evstate=$evstate ?"
+       }
+    }
+    if {![info exists u]} {
+       set telling [list {} undelivered $now]
+    } else {
+       set telling [list $u $stt $now]
+    }
+    return $re
+}
+
 proc recordlastseen_n {n how here} {
+    # here is:
+    #   0 - nick was seen leaving (or changing to another nicks or some such)
+    #   1 - nick was seen doing something else
+    #   2 - nick was seen talking on channel
     global lastseen lookedfor
-    set lastseen([irctolower $n]) [list $n [clock seconds] $how]
+    set nl [irctolower $n]
+    set now [clock seconds]
+    set lastseen($nl) [list $n $now $how]
+
     if {!$here} return
-    upvar #0 lookedfor([irctolower $n]) lf
+
+    tell_event $nl [lindex {none act talk} $here]
+
+    upvar #0 lookedfor($nl) lf
     if {[info exists lf]} {
        switch -exact [llength $lf] {
            0 {
@@ -242,8 +503,8 @@ proc chanmode_o1 {m g p chan} {
        } else {
            set chan_initialop([irctolower $chan]) $u
            sendprivmsg $n \
- "Thanks. You can use `channel manager ...' to register this channel."
-           if {![nickdb_exists $n] || ![string length [nickdb_get $n username]]} {
+ "Thanks.  You can use `channel manager ...' to register this channel."
+           if {![string length [nickdb_get_username $n username]]} {
                sendprivmsg $n \
  "(But to do that you must register your nick securely first.)"
            }
@@ -369,9 +630,10 @@ set nick_counter 0
 set nick_arys {onchans username unique}
 # nick_onchans($luser) -> [list ... $lchan ...]
 # nick_username($luser) -> <securely known local username>
-# nick_unique($luser) -> <counter>
+# nick_unique($luser) -> <includes-counter>
 # nick_case($luser) -> $user  (valid even if no longer visible)
 # nick_markid($luser) -> <after id for marktime>
+# nick_telling($luser) -> <unique> mentioned|passed <when>
 
 # chan_nicks($lchan) -> [list ... $luser ...]
 # chan_lastactivity($lchan) -> [clock seconds]
@@ -422,7 +684,7 @@ proc msg_NICK {p c newnick} {
        set nlist [grep tn {"$tn" != "$luser"} $nlist]
        lappend nlist $lusernew
     }
-    lnick_marktime_start $lusernew "Hi." 500
+    lnick_marktime_start $lusernew "Hi." 500 1
     nick_case $newnick
 }
 
@@ -435,6 +697,7 @@ proc nick_ishere {n} {
 
 proc msg_JOIN {p c chan} {
     prefix_nick
+    nick_ishere $n
     recordlastseen_n $n "joining $chan" 1
     set nl [irctolower $n]
     set lchan [irctolower $chan]
@@ -442,11 +705,10 @@ proc msg_JOIN {p c chan} {
     upvar #0 chan_nicks($lchan) nlist
     if {![info exists oc]} {
        global marktime_join_startdelay
-       lnick_marktime_start $nl "Welcome." $marktime_join_startdelay
+       lnick_marktime_start $nl "Welcome." $marktime_join_startdelay 1
     }
     lappend oc $lchan
     lappend nlist $nl
-    nick_ishere $n
 }
 proc msg_PART {p c chan args} {
     prefix_nick
@@ -556,7 +818,11 @@ proc somedb__head {} {
 }
 
 proc def_somedb {name arglist body} {
-    foreach {nickchan fprefix} {nick users/n chan chans/c} {
+    foreach {nickchan fprefix} {
+       nick users/n
+       chan chans/c
+       msgs users/m
+    } {
        proc ${nickchan}db_$name $arglist \
             "set nickchan $nickchan; set fprefix $fprefix; $body"
     }
@@ -585,7 +851,13 @@ def_somedb_id delete {} {
     file delete $idfn
 }
 
-set default_settings_nick {timeformat ks  marktime off}
+set default_settings_nick {
+    timeformat ks
+    marktime off
+    tellsec {secure 600}
+    tellrel {remind 3600 30}
+}
+
 set default_settings_chan {
     autojoin 1
     mode *
@@ -595,6 +867,15 @@ set default_settings_chan {
     topictell {}
 }
 
+set default_settings_msgs {
+    inbound {}
+    outbound {}
+}
+# inbound -> [<nick> <time_t> <message>] ...
+# outbound -> [<nick> <time_t(earliest)> <count>] ...
+#   neither are sorted particularly; only one entry per recipient in
+#   output; both sender and recipient are cased
+
 def_somedb_id set {args} {
     upvar #0 default_settings_$nickchan def
     if {![info exists iddbe]} { set iddbe $def }
@@ -867,11 +1148,13 @@ proc channelmgr_monoop {} {
 def_ucmd op {
     channelmgr_monoop
     sendout MODE $target +o $n
+    ucmdr {} {}
 }
 
 def_ucmd leave {
     channelmgr_monoop
     doleave $target
+    ucmdr {} {}
 }
 
 def_ucmd invite {
@@ -926,8 +1209,7 @@ def_ucmd invite {
     }
     set invitees {}
     while {[ta_anymore]} {
-       set invitee [ta_word]
-       check_nick $invitee
+       set invitee [ta_nick]
        lappend invitees $invitee
     }
     foreach invitee $invitees {
@@ -988,9 +1270,237 @@ def_ucmd channel {
     channel/$subcmd
 }
 
+proc nickdb_get_username {n} {
+    if {![nickdb_exists $n]} { return "" }
+    return [nickdb_get $n username]
+}
+
+proc nickdb_get_sec_effective {n} {
+    set l [nickdb_get $n tellsec]
+    set u [nickdb_get_username $n]
+    if {"[lindex $l 0]" == "secure" && ![string length $u]} { set l insecure }
+    return $l
+}
+
+proc tell_peernicks {text} {
+    global errorInfo errorCode
+    set text [irctolower [string trim $text]]
+    set senders [split $text " "]
+    foreach sender $senders {
+       if {[catch { check_nick $sender } emsg]} {
+           error "invalid nick `$sender': $emsg" $errorInfo $errorCode
+       }
+    }
+    return $senders
+}
+
+proc msgsdb_set_maydelete {n key l otherkey} {
+    msgsdb_set $n $key $l
+    if {[llength $l]} return
+    if {[llength [msgsdb_get $n $otherkey]]} return
+    msgsdb_delete $n
+}
+
+proc tell_delete_msgs {lsenders lrecip} {
+    set ninbound {}
+    set ndel 0
+    foreach {s t m} [msgsdb_get $lrecip inbound] {
+       if {[llength $lsenders]} {
+           if {[lsearch -exact $lsenders [irctolower $s]] == -1} {
+               lappend ninbound $s $t $m
+               continue
+           }
+       }
+       set rsenders($s) 1
+       incr ndel
+    }
+    msgsdb_set_maydelete $lrecip inbound $ninbound outbound
+    if {![llength $ninbound]} {
+       upvar #0 nick_telling($lrecip) telling
+       catch { unset telling }
+    }
+    foreach s [array names rsenders] {
+       set noutbound {}
+       foreach {r t c} [msgsdb_get $s outbound] {
+           if {"[irctolower $r]" == "$lrecip"} continue
+           lappend noutbound $r $t $c
+       }
+       msgsdb_set_maydelete $s outbound $noutbound inbound
+    }
+    return $ndel
+}
+
+def_ucmd untell {
+    prefix_nick
+    check_notonchan
+    if {[nickdb_exists $n]} { nick_securitycheck 0 }
+    set recipients [tell_peernicks $text]
+    if {![llength $recipients]} {
+       usererror "You must say which recipients' messages from you to forget."
+    }
+    set ndel 0
+    foreach recip $recipients {
+       incr ndel [tell_delete_msgs [irctolower $n] $recip]
+    }
+    ucmdr "Removed $ndel as yet undelivered message(s)." {}
+}
+
+def_ucmd_alias delmsgs delmsg
+def_ucmd delmsg {
+    global errorInfo errorCode
+    prefix_nick
+    set nl [irctolower $n]
+    check_notonchan
+    manyset [nickdb_get_sec_effective $n] sec secwhen
+    switch -exact $sec {
+       insecure { }
+       reject - mailto {
+           usererror \
+ "There are no messages to delete\
+ because your message disposition prevents them from being left."
+       }
+       secure {
+           nick_securitycheck 1
+       }
+       default {
+           error "delmsg sec $sec"
+       }
+    }
+    if {![llength [msgsdb_get $n inbound]]} {
+       ucmdr "No incoming messages to delete." {}
+    }
+    tell_getcstate
+    if {![info exists u]} {
+       usererror \
+ "I can't delete your messages unless I can see you on a channel with me.\
+  Otherwise I might delete a message I hadn't told you about yet."
+    }
+    if {"$stt" != "passed"} {
+       set telling [list $u undelivered 0]
+       usererror \
+ "There are message(s) you may not yet have seen;\
+ I'll deliver them to you now.\
+  If you actually want to delete them, just tell me `delmsg' again."
+    }
+    set senders [tell_peernicks $text]
+    set ndel [tell_delete_msgs [irctolower $senders] [irctolower $n]]
+    if {!$ndel} {
+       if {[llength $senders]} {
+           ucmdr "No relevant incoming messages to delete." {}
+       }
+    }
+    switch -exact [llength $senders] {
+       0 { ucmdr {} {} "deletes your $ndel message(s)." }
+       1 { ucmdr {} {} "deletes your $ndel message(s) from $senders." }
+       default {
+           ucmdr {} {} "deletes your $ndel message(s) from\
+ [lreplace $senders end end] and/or [lindex $senders end]."
+       }
+    }
+}
+
+def_ucmd tellme {
+    prefix_nick
+    ta_nomore
+    check_notonchan
+    manyset [nickdb_get $n tellsec] sec
+    switch -exact $sec {
+       reject { ucmdr "But, you asked me to reject messages for you !" {} }
+       mailto { ucmdr "But, you asked me to mail your messages to you !" {} }
+    }
+    switch -exact [tell_event [irctolower $n] tellme] {
+       ERROR - INVALID { ucmdr {} {is ill.  Help!} }
+       nomsgs { ucmdr {You have no messages.} {} }
+       default { }
+    }
+}
+
+def_ucmd tell {
+    global nick_case ownmailaddr ownfullname
+    
+    prefix_nick
+    set target [ta_nick]
+    if {![string length $text]} { error "tell them what?" }
+    if {[string length $text] > 400} { error "message too long" }
+
+    set ltarget [irctolower $target]
+    set ctarget $target
+    if {[info exists nick_case($ltarget)]} { set ctarget $nick_case($ltarget) }
+
+    manyset [nickdb_get_sec_effective $target] sec mailtoint mailwhy
+    manyset [nickdb_get $target tellrel] rel relint relwithin
+    switch -exact $sec {
+       insecure - secure {
+           set now [clock seconds]
+           set inbound [msgsdb_get $ltarget inbound]
+           lappend inbound $n $now $text
+           msgsdb_set $ltarget inbound $inbound
+
+           set outbound [msgsdb_get $n outbound]
+           set noutbound {}
+           set found 0
+           foreach {recip time count} $outbound {
+               if {"[irctolower $recip]" == "$ltarget"} {
+                   incr count
+                   set recip $ctarget
+                   set found 1
+               }
+               lappend noutbound $recip $time $count
+           }
+           if {!$found} {
+               lappend noutbound $ctarget $now 1
+           }
+           msgsdb_set $n outbound $noutbound
+           set msg "OK, I'll tell $ctarget"
+           if {$found} { append msg " that too" }
+           append msg ", "
+           if {"$sec" != "secure"} {
+               switch -exact $rel {
+                   unreliable { append msg "neither reliably nor securely" }
+                   remind { append msg "pretty reliably, but not securely" }
+                   pester { append msg "reliably but not securely" }
+               }
+           } else {
+               switch -exact $rel {
+                   unreliable { append msg "securely but not reliably" }
+                   remind { append msg "securely and pretty reliably" }
+                   pester { append msg "reliably and securely" }
+               }
+           }
+           append msg .
+           tell_event $ltarget msgsarrive
+           ucmdr $msg {}
+       }
+       mailto {
+           set fmtmsg [exec fmt << " $text"]
+           exec /usr/sbin/sendmail -odb -oi -t -oee -f $mailwhy \
+                   > /dev/null << \
+ "From: $ownmailaddr ($ownfullname)
+To: $mailtoint
+Subject: IRC tell from $n
+
+$n asked me[expr {[ischan $dest] ? " on $dest" : ""}] to tell you:
+[exec fmt << " $text"]
+
+(This message was for your nick $ctarget; your account $mailwhy
+ arranged for it to be forwarded to $mailtoint.)
+"
+            ucmdr \
+ "I've mailed $ctarget, which is what they prefer." \
+                {}
+       }
+       reject {
+           usererror "Sorry, $ctarget does not want me to take messages."
+       }
+       default {
+           error "bad tellsec $sec"
+       }
+    }
+}
+
 def_ucmd who {
     if {[ta_anymore]} {
-       set target [ta_word]; ta_nomore
+       set target [ta_nick]; ta_nomore
        set myself 1
     } else {
        prefix_nick
@@ -1073,7 +1583,10 @@ proc timeformat_desc {tf} {
     }
 }
 
+set settings {}
 proc def_setting {opt show_body set_body} {
+    global settings
+    lappend settings $opt
     proc set_show/$opt {} "
         upvar 1 n n
         set opt $opt
@@ -1086,6 +1599,56 @@ proc def_setting {opt show_body set_body} {
         $set_body"
 }
 
+proc tellme_sec_desc {v n} {
+    manyset $v sec mailtoint
+    switch -exact $sec {
+       insecure {
+           return "I'll tell you your messages whenever I see you."
+       }
+       secure {
+           if {[string length [nickdb_get_username $n]]} {
+               return \
+ "I'll keep the bodies of your messages private until you identify yourself, reminding you every [showintervalsecs $mailtoint 1]."
+           } else {
+               return \
+ "I'll tell you your messages whenever I see you.\
+  (Secure message delivery is enabled, but your nick is not registered\
+ securely.  See `help register'.)"
+           }
+       }
+       reject {
+           return "I shan't accept messages for you."
+       }
+       mailto {
+           return "I'll forward your messages by email to $mailtoint."
+       }
+       default {
+           error "bad tellsec $sec"
+       }
+    }
+}
+
+proc tellme_rel_desc {v n} {
+    manyset $v rel every within
+    switch -exact $rel {
+       unreliable {
+           return "As soon as I've told you message(s), I'll forget them\
+ - note that this means messages can get lost !"
+       }
+       pester {
+           set u {}
+       }
+       remind {
+           set u ", or talk on channel within [showintervalsecs $within 1] of me having told you"
+       }
+       default {
+           error "bad tellrel $rel"
+       }
+    }
+    return "After delivering messages, I'll remind you every\
+ [showintervalsecs $every 1] until you say delmsg$u."
+}
+
 def_setting timeformat {
     set tf [nickdb_get $n timeformat]
     return "$tf: [timeformat_desc $tf]"
@@ -1120,24 +1683,11 @@ def_setting marktime {
     ta_nomore
 
     if {"$mt" == "off" || "$mt" == "once"} {
-    } elseif {[regexp {^([0-9]+)([a-z]+)$} $mt dummy value unit]} {
-       switch -exact $unit {
-           s { set u 1 }
-           ks { set u 1000 }
-           m { set u 60 }
-           mb { set u 0.0864 }
-           b { set u 86.4 }
-           kb { set u 86400 }
-           default { error "unknown unit of time $unit" }
-       }
-       if {$value > 86400*21/$u} { error "marktime interval too large" }
-       set mt [expr {round($value*$u)}]
-       if {$mt < $marktime_min} { error "marktime interval too small" }
     } else {
-       error "invalid syntax for marktime"
+       set mt [parse_interval $mt $marktime_min]
     }
     nickdb_set $n marktime $mt
-    lnick_marktime_start [irctolower $n] "So:" 500
+    lnick_marktime_start [irctolower $n] "So:" 500 0
     ucmdr {} [marktime_desc $mt]
 }
 
@@ -1150,7 +1700,132 @@ def_setting security {
     }
 } {}
 
+proc tellme_setting_sec_simple {} {
+    uplevel 1 {
+       ta_nomore
+       set sr sec
+       set v $setting
+    }
+}
+
+proc tellme_setting_neednomsgs {} {
+    uplevel 1 {
+       if {[llength [msgsdb_get $n inbound]]} {
+           usererror "You must delete the incoming messages you have, first."
+       }
+    }
+}
+
+def_setting tellme {
+    set secv [nickdb_get $n tellsec]
+    set ms [tellme_sec_desc $secv $n]
+    manyset $secv sec
+    switch -exact $sec {
+       insecure - secure {
+           set mr [tellme_rel_desc [nickdb_get $n tellrel] $n]
+           return "$ms  $mr"
+       }
+       reject - mailto {
+           return $ms
+       }
+    }
+} {
+    set setting [string tolower [ta_word]]
+    set nl [irctolower $n]
+    switch -exact $setting {
+       insecure {
+           tellme_setting_sec_simple
+       }
+       secure {
+           set every [ta_interval_optional 60 600]
+           ta_nomore
+           set sr sec
+           set v [list secure $every]
+       }
+       reject {
+           tellme_setting_neednomsgs
+           tellme_setting_sec_simple
+       }
+       mailto {
+           tellme_setting_neednomsgs
+            
+           upvar #0 nick_username($nl) nu
+           if {!([info exists nu] && [string length $nu])} {
+               usererror \
+ "Sorry, you must register securely to have your messages mailed\
+ (to prevent the use of this feature for spamming).  See `help register'."
+           }
+           set sr sec
+           set v [list mailto [ta_word] $nu]
+       }
+       unreliable - pester - remind {
+           manyset [nickdb_get $n tellsec] sec
+           switch -exact $sec {
+               reject - mailto {
+                   usererror \
+ "Sorry, I shan't change when I'll consider a message delivered, because\
+ you've asked me not to keep messages, or to mail them to you.\
+  You should say `set tellme secure' or some such, first."
+               }
+           }
+           set sr rel
+           set v $setting
+           if {"$setting" != "unreliable"} {
+               set every [ta_interval_optional 300 3600]
+               lappend v $every
+           }
+           if {"$setting" == "remind"} {
+               set within [ta_interval_optional 5 30]
+               if {$within > $every} {
+                   error "remind interval must be at least time to respond"
+               }
+               lappend v $within
+           }
+           ta_nomore
+       }
+       default {
+           error "invalid tellme setting $setting"
+       }
+    }
+    nickdb_set $n tell$sr $v
+    upvar #0 nick_telling($nl) telling
+    catch { unset telling }
+    ucmdr [tellme_${sr}_desc $v $n] {}
+}
+
+proc lnick_checktold {luser} {
+    set ml [msgsdb_get $luser outbound]
+    if {![llength $ml]} return
+    set is1 [expr {[llength $ml]==3}]
+    set m1 "FYI, I haven't yet delivered your"
+    set ol {}
+    set now [clock seconds]
+    while {[llength $ml]} {
+       manyset $ml r t n
+       set ml [lreplace $ml 0 2]
+       set td [expr {$now-$t}]
+       if {$n == 1} {
+           set iv [showinterval $td]
+           set ifo "$r, $iv"
+           set if1 "message to $r, $iv."
+       } else {
+           set iv [showintervalsecs $td 0]
+           set ifo "$r, $n messages, oldest $iv"
+           set if1 "$n messages to $r, oldest $iv."
+       }
+       if {$is1} {
+           sendprivmsg $luser "$m1 $if1"
+           return
+       } else {
+           lappend ol " to $ifo[expr {[llength $ml] ? ";" : "."}]"
+       }
+    }
+    sendprivmsg $luser "$m1 messages:"
+    msendprivmsg $luser $ol
+}
+
 def_ucmd set {
+    global settings
     prefix_nick
     check_notonchan
     if {![nickdb_exists $n]} {
@@ -1158,8 +1833,7 @@ def_ucmd set {
     }
     if {![ta_anymore]} {
        set ol {}
-       foreach proc [lsort [info procs]] {
-           if {![regexp {^set_show/(.*)$} $proc dummy opt]} continue
+       foreach opt $settings {
            lappend ol [format "%-10s %s" $opt [set_show/$opt]]
        }
        ucmdr {} [join $ol "\n"]
@@ -1169,7 +1843,7 @@ def_ucmd set {
            error "no setting $opt"
        }
        if {![ta_anymore]} {
-           ucmdr {} "$opt [set_show/$opt]"
+           ucmdr {} "$opt: [set_show/$opt]"
        } else {
            nick_securitycheck 0
            if {[catch { info body set_set/$opt }]} {
@@ -1181,12 +1855,12 @@ def_ucmd set {
 }
 
 def_ucmd identpass {
-    set username [ta_word]
-    set passmd5 [md5sum "[ta_word]\n"]
-    ta_nomore
     prefix_nick
     check_notonchan
     set luser [irctolower $n]
+    set username [ta_word]
+    set passmd5 [md5sum "[ta_word]\n"]
+    ta_nomore
     upvar #0 nick_onchans($luser) onchans
     if {![info exists onchans] || ![llength $onchans]} {
        ucmdr "You must be on a channel with me to identify yourself." {}
@@ -1196,6 +1870,7 @@ def_ucmd identpass {
            irc-identpass $n
     upvar #0 nick_username($luser) rec_username
     set rec_username $username
+    after 50 [list tell_event $luser ident]
     ucmdr "Pleased to see you, $username." {}
 }
 
@@ -1214,6 +1889,7 @@ def_ucmd kill {
     set reason "at request of user $nu"
     if {[ta_anymore]} { append reason "; $text" }
     sendout KILL $target $reason
+    ucmdr {} {}
 }
 
 def_ucmd summon {
@@ -1297,32 +1973,34 @@ proc lnick_marktime_cancel {luser} {
     catch { unset mi }
 }
 
-proc lnick_marktime_doafter {luser why ms} {
+proc lnick_marktime_doafter {luser why ms mentiontold} {
     lnick_marktime_cancel $luser
     upvar #0 nick_markid($luser) mi
-    set mi [after $ms [list lnick_marktime_now $luser $why]]
+    set mi [after $ms [list lnick_marktime_now $luser $why 0]]
 }
 
 proc lnick_marktime_reset {luser} {
     set mt [nickdb_get $luser marktime]
     if {"$mt" == "off" || "$mt" == "once"} return
-    lnick_marktime_doafter $luser "Time passes." [expr {$mt*1000}]
+    lnick_marktime_doafter $luser "Time passes." [expr {$mt*1000}] 0
 }
 
-proc lnick_marktime_start {luser why ms} {
+proc lnick_marktime_start {luser why ms mentiontold} {
     set mt [nickdb_get $luser marktime]
     if {"$mt" == "off"} {
        lnick_marktime_cancel $luser
+       if {$mentiontold} { after $ms [list lnick_checktold $luser] }
     } else {
-       lnick_marktime_doafter $luser $why $ms
+       lnick_marktime_doafter $luser $why $ms $mentiontold
     }
 }
 
-proc lnick_marktime_now {luser why} {
+proc lnick_marktime_now {luser why mentiontold} {
     upvar #0 nick_onchans($luser) oc
     global calling_nick
     set calling_nick $luser
     sendprivmsg $luser [lnick_pingstring $why $oc ""]
+    if {$mentiontold} { after 150 [list lnick_checktold $luser] }
     lnick_marktime_reset $luser
 }    
 
@@ -1359,12 +2037,12 @@ proc lnick_pingstring {why oc apstring} {
 }
 
 def_ucmd ping {
+    prefix_nick
+    set ln [irctolower $n]
     if {[ischan $dest]} {
        set oc [irctolower $dest]
     } else {
        global nick_onchans
-       prefix_nick
-       set ln [irctolower $n]
        if {[info exists nick_onchans($ln)]} {
            set oc $nick_onchans($ln)
        } else {
@@ -1372,6 +2050,7 @@ def_ucmd ping {
        }
        if {[llength $oc]} { lnick_marktime_reset $ln }
     }
+    after 150 [list lnick_checktold $ln]
     ucmdr {} [lnick_pingstring "Pong!" $oc $text]
 }
 
index 2444f93..8a2e2bd 100644 (file)
--- a/helpinfos
+++ b/helpinfos
@@ -10,11 +10,12 @@ General commands:           Registration and user settings:
  !help [<cmd>|<opt>|<topic>]  !register [insecure|delete]
  !seen <nick>                 !set [<opt> [<value>]]      who [<nick>]
  !summon <username>           (See `help !identify', `help !blight-id')
- !invite [<chan>] <nick>...  Channel settings (see `help channel'):
- !op [<chan>]                 !channel [<chan>] <setting> [....]
- !leave [<chan>]             Additional help topics:
- !ping [<stuff ...>]          !identify !identpass !invite !blight-id
- !kill <nick> [<reason>]
+ !invite [<chan>] <nick>...  For channel managers (see `help channel'):
+ !ping [<stuff ...>]          !op [<chan>]
+ !kill <nick> [<reason>]      !leave [<chan>]
+ !tell <nick> <message ...>   !channel [<chan>] <setting> [....]
+Additional help topics:
+ !tutorial (long\!)  !identify !identpass !invite !blight-id
 Send commands to me by /msg, or say them in channel with \! in front.
 To get me on a channel, invite me.  To become channel manager, op me.
 
@@ -24,6 +25,42 @@ help <command>   gives help on a command
 help <opt>       gives help on an option
 help <topic>     gives help on an additional topic
 
+:tell
+tell <nick> <message ...>
+ Leaves a message for someone, which will be delivered according to
+ their `!set !tellme'.  I will tell you about your undelivered tells
+ whenever I see you arriving, or when you say `!ping'.  See also
+ `help !untell' and `help !delmsg'.
+
+:untell
+!untell <nick> ...
+ Forgets about all message(s) you've sent with !tell to particular
+ nick(s).  Use !delmsg to delete messages sent *to* you.  There is no
+ way to untell individual messages to the same nick.  If your nick is
+ secure, you must !identify yourself to use untell.
+
+:tellme
+The !tellme command repeats any messages you have outstanding.
+!set tellme configures how you receive messages sent with !tell:
+ set tellme insecure              When I see you.
+ set tellme secure [<!interval>]   Hide body (reminding) until ident.
+ set tellme reject                Do not accept messages.
+ set tellme mailto <email-addr>   By email.  (Secure nicks only.)
+Default: `secure 600'.  For insecure nicks `secure' == `insecure'.
+To set when to consider messages delivered (see `help !untell'):
+ set tellme unreliable            Tell you once, then forget.
+ set tellme remind [<every-interval> [<within-interval>]]
+    Remind until you talk on channel within <within-interval>
+    of me having told you.  (Default is remind 1h 30s.)
+ set tellme pester <interval>     Remind until you say !delmsg
+
+:delmsg
+delmsg [<nick> ...]
+ Forgets about !tell messages I've passed on: either all of them, or
+ only those from certain nicks.  Necessary if you !set !tellme pester
+ or reliable, and also works with remind, but not with unreliable.
+ Use !untell to delete messages you've sent, rather than received.
+
 :seen
 seen <nick>
  Tells you or the channel when I last saw that nick in
@@ -176,6 +213,7 @@ set <option>         show the current setting of <option>
 set <option> <value> set <option> to <value>
  Options:  !timeformat ks|hms|beat
            !marktime off|once|<n>[k]s|<n>m|<n>h
+           !tellme ...
  See also `help <option>', `help !register' and `help !identify'
 
 :timeformat
@@ -192,14 +230,21 @@ Replies with hopefully-useful information, including:
   actual message traffic counts, and \!-commands don't count either.
 * The specified string, if any.
 I can tell you this automatically if you like - see `help !marktime'.
+If you have undelivered messages sent with !tell by or to you, I'll
+let you know about those too (privately, if you ping on channel).
 
 :marktime
-!set marktime off    Only an explicit `!ping' command sends you info.
-set marktime once   Send ping info shortly after I first see you.
-set marktime <n>s   Also send info every <n> seconds (min 300s).
-set marktime <n>ks  Also send info every <n> kiloseconds (min 1ks).
-set marktime <n>m   Also send info every <n> minutes (min 5m).
-set marktime <n>h   Also send info every <n> hours (min 1h).
+!set marktime off        Only an explicit `!ping' command sends info.
+set marktime once       Send ping info shortly after I first see you.
+set marktime <!interval> Also send info regularly (min. interval 5m).
+
+:interval
+Intervals in commands are <amount><unit>, where the unit is one of
+s for seconds, ks for kiloseconds, m for minutes, h for hours.
+
+:tutorial
+Sorry, there is no tutorial.  If you would like to contribute by
+writing one, please email ijackson@chiark.greenend.org.uk.
 
 # Local variables:
 # fill-column: 69
index 1721cec..069743e 100644 (file)
@@ -18,9 +18,6 @@ defset out_lag_lag 5000
 defset out_lag_very 25000
 defset ownping_every 300000
 
-defset marktime_min 300
-defset marktime_join_startdelay 5000
-
 proc manyset {list args} {
     foreach val $list var $args {
        upvar 1 $var my
@@ -143,6 +140,10 @@ proc sendout {command args} { eval sendout_priority [list 0 $command] $args }
 proc log {data} {
     puts $data
 }
+    
+proc log_intern {what data} {
+    puts "[clock seconds] ++ $what $data"
+}
 
 proc logerror {data} {
     log $data
@@ -215,6 +216,20 @@ proc onread {args} {
     }
 }
 
+proc catch_restoreei {body} {
+    global errorInfo errorCode
+    set l [list $errorInfo $errorCode]
+    catch { uplevel 1 $body }
+    manyset $l errorInfo errorCode
+}
+
+proc catch_logged {body} {
+    global errorInfo
+    if {[catch { uplevel 1 $body } emsg]} {
+       logerror "error (catch_logged): $emsg\n $errorInfo"
+    }
+}
+
 proc sendprivmsg {dest l} {
     foreach v [split $l "\n"] {
        sendout [expr {[ischan $dest] ? "PRIVMSG" : "NOTICE"}] $dest $v
@@ -229,6 +244,7 @@ proc msendprivmsg_delayed {delay dest ll} { after $delay [list msendprivmsg $des
 proc check_nick {n} {
     if {[regexp -nocase {[^][\\`_^{|}a-z0-9-]} $n]} { error "bad char in nick" }
     if {[regexp {^[-0-9]} $n]} { error "bad nick start" }
+    if {[string length $n] > 18} { error "nick too long" }
 }
 
 proc ischan {dest} {
diff --git a/nctest.tcl b/nctest.tcl
new file mode 100644 (file)
index 0000000..503060b
--- /dev/null
@@ -0,0 +1,10 @@
+# Configuration for testbot
+
+set host cam.irc.devel.ncipher.com
+set nick testbot
+set ownfullname confused
+set socketargs {}
+set marktime_min 10
+set ownmailaddr iwj@ncipher.com
+
+source bot.tcl
index a9b06df..925eed3 100644 (file)
@@ -23,6 +23,15 @@ proc ta_nick {} {
     return $v
 }
 
+proc ta_interval_optional {min def} {
+    upvar 1 text text
+    if {[ta_anymore]} {
+       return [parse_interval [ta_word] $min]
+    } else {
+       return $def
+    }
+}
+
 proc usererror {emsg} { error $emsg {} {BLIGHT USER} }
 
 proc go_usercommand {p c n dest text} {
@@ -61,6 +70,10 @@ proc def_ucmd {cmdname body} {
     proc ucmd/$cmdname {p dest} "    upvar 1 text text\n$body"
 }
 
+proc def_ucmd_alias {alias canon} {
+    proc ucmd/$alias {p dest} "    uplevel 1 \[list ucmd/$canon \$p \$dest\]\n"
+}
+
 proc ucmdr {priv pub args} {
     return -code return [concat [list $priv $pub] $args]
 }
diff --git a/telling.fig b/telling.fig
new file mode 100644 (file)
index 0000000..027a66a
--- /dev/null
@@ -0,0 +1,201 @@
+#FIG 3.2
+Portrait
+Center
+Metric
+A4      
+100.00
+Single
+-2
+1200 2
+6 450 11160 3060 13050
+1 2 0 1 0 7 50 0 -1 0.000 1 0.0000 1305 11655 405 225 900 11430 1710 11880
+2 2 0 1 0 7 50 0 -1 0.000 0 0 -1 0 0 5
+        450 11160 3060 11160 3060 13050 450 13050 450 11160
+3 0 0 1 0 7 50 0 -1 0.000 0 1 0 6
+       2 1 1.00 60.00 120.00
+        1260 11880 1260 12510 1350 12780 1890 12780 2430 12600 2610 12240
+        0.000 1.000 1.000 1.000 1.000 0.000
+3 0 0 1 0 7 50 0 -1 0.000 0 1 0 4
+       2 1 1.00 60.00 120.00
+        2610 11970 2520 11610 2160 11520 1710 11610
+        0.000 1.000 1.000 0.000
+3 0 0 1 0 7 50 0 -1 0.000 0 1 0 6
+       2 1 1.00 60.00 120.00
+        1260 12150 1260 12600 990 12780 540 12780 540 12330 990 11790
+        0.000 1.000 1.000 1.000 1.000 0.000
+4 0 0 50 0 0 12 0.0000 4 135 570 990 11700 STATE\001
+4 0 0 50 0 0 12 0.0000 4 135 615 1350 12150 EVENT\001
+4 0 0 50 0 0 12 0.0000 4 135 690 1350 12510 condition\001
+4 0 0 50 0 0 12 0.0000 4 135 510 2430 12150 Action\001
+4 0 0 50 0 0 12 0.0000 4 135 555 630 12510 inverse\001
+4 0 0 50 0 1 12 0.0000 4 180 270 540 11340 key\001
+-6
+1 2 0 1 0 7 50 0 -1 0.000 1 0.0000 2182 1575 922 450 1260 1125 3105 2025
+1 2 0 1 0 7 50 0 -1 0.000 1 0.0000 7200 3240 810 405 6390 2835 8010 3645
+1 2 0 1 0 7 50 0 -1 0.000 1 0.0000 2700 7560 810 405 3510 7155 1890 7965
+1 2 0 1 0 7 50 0 -1 0.000 1 0.0000 5985 10170 765 405 6750 9765 5220 10575
+1 2 0 1 0 7 50 0 -1 0.000 1 0.0000 2182 1575 877 405 1305 1170 3060 1980
+2 1 0 1 0 7 50 0 -1 0.000 0 0 7 1 0 2
+       2 1 1.00 60.00 120.00
+        6570 3555 3600 6345
+2 1 0 1 0 7 50 0 -1 0.000 0 0 7 1 0 2
+       2 1 1.00 60.00 120.00
+        5760 8505 5850 9765
+2 1 0 1 0 7 50 0 -1 0.000 0 0 7 1 0 2
+       2 1 1.00 60.00 120.00
+        2610 6255 2610 7065
+2 1 0 1 0 7 50 0 -1 0.000 0 0 7 1 0 2
+       2 1 1.00 60.00 120.00
+        3420 6615 2880 7155
+2 1 0 1 0 7 50 0 -1 0.000 0 0 7 1 0 2
+       2 1 1.00 60.00 120.00
+        5220 10215 2475 10215
+3 0 0 1 0 7 50 0 -1 0.000 0 1 0 8
+       2 1 1.00 60.00 120.00
+        1035 10215 855 10215 450 10170 450 9630 450 3150 450 2430
+        1035 2070 1350 1800
+        0.000 1.000 1.000 1.000 1.000 1.000 1.000 0.000
+3 0 0 1 0 7 50 0 -1 0.000 0 1 0 5
+       2 1 1.00 60.00 120.00
+        6750 10170 8370 10305 7875 9135 6885 9180 6435 9810
+        0.000 1.000 1.000 1.000 0.000
+3 0 0 1 0 7 50 0 -1 0.000 0 1 0 6
+       2 1 1.00 60.00 120.00
+        8100 9945 8100 7965 7695 7425 6030 7425 5760 7785 5760 7965
+        0.000 1.000 1.000 1.000 1.000 0.000
+3 0 0 1 0 7 50 0 -1 0.000 0 1 0 4
+       2 1 1.00 60.00 120.00
+        7380 3645 7470 4365 5760 6075 5670 6435
+        0.000 1.000 1.000 0.000
+3 0 0 1 0 7 50 0 -1 0.000 0 1 0 4
+       2 1 1.00 60.00 120.00
+        5580 4455 5400 4725 5580 5445 5760 8145
+        0.000 1.000 1.000 0.000
+3 0 0 1 0 7 50 0 -1 0.000 0 1 0 5
+       2 1 1.00 60.00 120.00
+        5040 4995 4680 5355 4770 5805 5310 6345 5670 6885
+        0.000 1.000 1.000 1.000 0.000
+3 0 0 1 0 7 50 0 -1 0.000 0 1 0 5
+       2 1 1.00 60.00 120.00
+        3510 7515 4860 7515 5400 7515 5670 7695 5760 7875
+        0.000 1.000 1.000 1.000 0.000
+3 0 0 1 0 7 50 0 -1 0.000 0 1 0 7
+       2 1 1.00 60.00 120.00
+        5805 11205 5805 12060 6120 13050 6795 13140 7560 12870 7470 12375
+        6885 11340
+        0.000 1.000 1.000 1.000 1.000 1.000 0.000
+3 0 0 1 0 7 50 0 -1 0.000 0 1 0 7
+       2 1 1.00 60.00 120.00
+        5871 10620 5781 11205 6096 11925 6411 12015 6840 11925 6975 11340
+        6435 10530
+        0.000 1.000 1.000 1.000 1.000 1.000 0.000
+3 0 0 1 0 7 50 0 -1 0.000 0 1 0 5
+       2 1 1.00 60.00 120.00
+        1170 6975 1350 5535 2160 5355 2610 5625 2610 5985
+        0.000 1.000 1.000 1.000 0.000
+3 0 0 1 0 7 50 0 -1 0.000 0 1 0 7
+       2 1 1.00 60.00 120.00
+        1800 7515 1260 7425 1170 6975 1260 6525 2070 6345 2340 6705
+        2520 7155
+        0.000 1.000 1.000 1.000 1.000 1.000 0.000
+3 0 0 1 0 7 50 0 -1 0.000 0 1 0 6
+       2 1 1.00 60.00 120.00
+        6660 10395 6930 10575 7650 10575 8235 10575 8910 10530 8910 9990
+        0.000 1.000 1.000 1.000 1.000 0.000
+3 0 0 1 0 7 50 0 -1 0.000 0 1 0 3
+       2 1 1.00 60.00 120.00
+        5400 9405 5580 9405 5715 9765
+        0.000 1.000 0.000
+3 0 0 1 0 7 50 0 -1 0.000 0 1 0 5
+       2 1 1.00 60.00 120.00
+        4140 10215 4005 10215 3690 9990 3690 9540 3915 9405
+        0.000 1.000 1.000 1.000 0.000
+3 0 0 1 0 7 50 0 -1 0.000 0 1 0 6
+       2 1 1.00 60.00 120.00
+        5850 12105 5760 12645 5490 13050 4725 13005 3645 10665 2610 10215
+        0.000 1.000 1.000 1.000 1.000 0.000
+3 0 0 1 0 7 50 0 -1 0.000 0 1 0 8
+       2 1 1.00 60.00 120.00
+        5760 8505 5760 8775 5625 9000 5445 9000 3600 9000 3375 9225
+        3150 10215 2565 10215
+        0.000 1.000 1.000 1.000 1.000 1.000 1.000 0.000
+3 0 0 1 0 7 50 0 -1 0.000 0 1 0 5
+       2 1 1.00 60.00 120.00
+        6300 3825 6030 4050 6345 4410 6885 4050 6930 3645
+        0.000 1.000 1.000 1.000 0.000
+3 0 0 1 0 7 50 0 -1 0.000 0 1 0 5
+       2 1 1.00 60.00 120.00
+        3105 1575 6705 1575 7110 1575 7155 1890 7155 2070
+        0.000 1.000 1.000 1.000 0.000
+3 0 0 1 0 7 50 0 -1 0.000 0 1 0 2
+       2 1 1.00 60.00 120.00
+        7155 2385 7155 2835
+        0.000 0.000
+3 0 0 1 0 7 50 0 -1 0.000 0 1 0 9
+       2 1 1.00 60.00 120.00
+        8910 10035 8910 7335 8910 4455 8910 2250 8910 1575 8370 1575
+        7605 1575 7245 1575 7155 1845
+        0.000 1.000 1.000 1.000 1.000 1.000 1.000 1.000
+        0.000
+3 0 0 1 0 7 50 0 -1 0.000 0 1 0 4
+       2 1 1.00 60.00 120.00
+        8010 3240 8505 3240 8775 3240 8910 2880
+        0.000 1.000 1.000 0.000
+4 0 0 50 0 2 12 0.0000 4 180 3615 990 630 State diagram for !tell and related commands\001
+4 0 0 50 0 0 12 0.0000 4 135 1305 1530 1755 NO MESSAGES\001
+4 0 0 50 0 0 12 0.0000 4 135 1245 3240 1485 MSGS ARRIVE\001
+4 0 0 50 0 0 12 0.0000 4 180 2055 3015 1980 all other events are ignored\001
+4 0 0 50 0 0 12 0.0000 4 135 705 5670 10215 PASSED\001
+4 0 0 50 0 0 12 0.0000 4 135 285 4860 5805 id'd\001
+4 0 0 50 0 0 12 0.0000 4 90 510 4680 4815 secure\001
+4 0 0 50 0 0 12 0.0000 4 135 1110 2160 7605 MENTIONED\001
+4 0 0 50 0 0 12 0.0000 4 135 630 3150 6525 Mention\001
+4 0 0 50 0 0 12 0.0000 4 180 1125 1980 6165 Mention Again\001
+4 0 0 50 0 0 12 0.0000 4 90 360 1530 6615 soon\001
+4 0 0 50 0 0 12 0.0000 4 180 855 5400 8415 Pass Msgs\001
+4 0 0 50 0 0 12 0.0000 4 150 480 5850 9045 pester\001
+4 0 0 50 0 0 12 0.0000 4 135 510 5940 9225 remind\001
+4 0 0 50 0 0 12 0.0000 4 135 555 3690 7695 IDENT\001
+4 0 0 50 0 0 12 0.0000 4 135 645 5580 5085 insecure\001
+4 0 0 50 0 0 12 0.0000 4 135 570 3870 5535 not id'd\001
+4 0 0 50 0 0 12 0.0000 4 150 480 6120 11745 pester\001
+4 0 0 50 0 0 12 0.0000 4 135 510 5265 11745 remind\001
+4 0 0 50 0 0 12 0.0000 4 135 735 4950 12600 very soon\001
+4 0 0 50 0 0 12 0.0000 4 150 1020 6075 12600 not very soon\001
+4 0 0 50 0 0 12 0.0000 4 180 735 4770 10800 is ignored\001
+4 0 0 50 0 0 12 0.0000 4 135 360 1395 7740 ACT\001
+4 0 0 50 0 0 12 0.0000 4 135 555 4815 10620 IDENT\001
+4 0 0 50 0 0 12 0.0000 4 135 285 8145 9495 late\001
+4 0 0 50 0 0 12 0.0000 4 90 360 7515 9585 soon\001
+4 0 0 50 0 0 12 0.0000 4 135 360 6885 10125 ACT\001
+4 0 0 50 0 0 12 0.0000 4 135 480 5895 11025 TALK\001
+4 0 0 50 0 0 12 0.0000 4 135 990 6705 3420 MESSAGES\001
+4 0 0 50 0 0 12 0.0000 4 135 285 1395 6255 late\001
+4 0 0 50 0 0 12 0.0000 4 135 915 4275 10170 DEL MSGS\001
+4 0 0 50 0 0 12 0.0000 4 135 1530 1305 8145 DEL MSGS is Error\001
+4 0 0 50 0 0 12 0.0000 4 180 1260 1350 8595 TALK is ignored\001
+4 0 0 50 0 0 12 0.0000 4 180 1455 3960 9450 Delete Some Msgs\001
+4 0 0 50 0 0 12 0.0000 4 90 405 3735 9900 some\001
+4 0 0 50 0 0 12 0.0000 4 135 180 3510 10395 all\001
+4 0 0 50 0 0 12 0.0000 4 135 735 4770 8910 unreliable\001
+4 0 0 50 0 0 12 0.0000 4 180 1260 1170 10260 Delete All Msgs\001
+4 0 0 50 0 0 12 0.0000 4 135 1245 6975 10755 MSGS ARRIVE\001
+4 0 0 50 0 0 12 0.0000 4 180 2025 1305 8370 MSGS ARRIVE is ignored\001
+4 0 0 50 0 0 12 0.0000 4 135 360 6030 3645 ACT\001
+4 0 0 50 0 0 12 0.0000 4 135 1530 4770 3150 DEL MSGS is Error\001
+4 0 0 50 0 0 12 0.0000 4 135 285 5580 4095 late\001
+4 0 0 50 0 0 12 0.0000 4 90 360 6165 4455 soon\001
+4 0 0 50 0 0 12 0.0000 4 135 690 8055 3645 ARRIVE\001
+4 0 0 50 0 0 12 0.0000 4 135 510 8100 3465 MSGS\001
+4 0 0 50 0 0 12 0.0000 4 135 555 7470 4050 IDENT\001
+4 0 0 50 0 0 12 0.0000 4 180 1260 5220 2925 TALK is ignored\001
+4 0 0 50 0 1 10 0.0000 4 165 3675 5265 585 $Id: telling.fig,v 1.2 2002-03-22 16:16:51 ijackson Exp $\001
+4 0 0 50 0 0 10 0.0000 4 135 3510 810 3915 ACT happens 750ms after user does anything (eg talking)\001
+4 0 0 50 0 0 10 0.0000 4 135 2865 900 3555 (if user is invisible this happens straight away)\001
+4 0 0 50 0 0 10 0.0000 4 135 2790 810 4230 TALK happens immediately, but only applies\001
+4 0 0 50 0 0 10 0.0000 4 135 2880 900 4410 to actual in-channel speech (including emotes)\001
+4 0 0 50 0 0 12 0.0000 4 135 1320 1530 1530 UNDELIVERED\001
+4 0 0 50 0 0 12 0.0000 4 135 1320 6525 3240 UNDELIVERED\001
+4 0 0 50 0 0 10 0.0000 4 135 3075 810 3375 If user goes away, we go back to UNDELIVERED\001
+4 0 0 50 0 0 10 0.0000 4 105 3285 810 4680 Timer records time since we last did Mention or Pass.\001
+4 0 0 50 0 0 12 0.0000 4 180 1710 6300 2295 Reset Timer to Infinity\001
index 269e2be..9ba46a7 100644 (file)
--- a/test.tcl
+++ b/test.tcl
@@ -5,6 +5,7 @@ set nick testbot
 set ownfullname confused
 set socketargs {}
 set marktime_min 10
+set ownmailaddr ijackson@chiark.greenend.org.uk
 
 source bot.tcl
 source botpass.tcl