# 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 }
switch -exact $event {
none { }
talk {
error "tell_event $nl $event"
}
}
+ if {[info exists save]} { set calling_nick $save }
}
proc tell_event_core {nl event} {
# event is `talk', `act' or `ident'
# When user talks we actually get talk now and act later
FIXME - implement all cmds
-FIXME - implement pass stuff set stt [list $u passed $now]
FIXME - implement tells_delete_msgs catch { unset stt } ?
FIXME - document the extra param to recordlastseen
+ global calling_nick
+ set calling_nick $nl
set iml [msgdb_get $nl inbound]
if {![llength $iml]} return
}
ni????? - naii??? - nas?i?? - mi????? - pa????l {
# pass and then stuff
-
-
- return
+ if {[length $iml] == 3} {
+ manyset $iml sender sentwhen msg
+ sendprivmsg $nl \
+ "$sender asked me [showintervalsecs [expr {$now-$sentwhen}] 0]\
+ to tell you: $msg"
+ } else {
+ sendprivmsg $nl \
+ "Here are the [expr {[llength $iml]/3}] messages there are 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
+ }
+ set stt passed
}
nas?u?? {
sendprivmsg $nl {You have messages (so identify yourself please).}]
tellsec insecure
tellrel {remind 3600 30}
}
-# also:
-# inbound: concatenation of many sender time_t text
-# outbound: concatenation of many recipient time_t count
-# neither are sorted particularly; only one entry per recipient in
-# output; both sender and recipient are cased
set default_settings_chan {
autojoin 1
}
# 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
channel/$subcmd
}
+def_ucmd delmsg {
+ prefix_nick
+ check_notonchan
+ manyset [nickdb_get $n tellsec] sec
+ switch -exact $sec {
+ insecure { }
+ refuse - mailto { error "you cannot
+ if {"$sec" == "
+}
+
def_ucmd tell {
global nick_case ownmailaddr ownfullname
prefix_nick
set target [ta_word]
if {![string length $text]} { error "tell them what?" }
+ if {[string length $text] > 400} { error "message too long" }
set ltarget [irctolower $target]
set ctarget $target
}
} {}
+proc tellme_setting_needsecure {n ue} {
+ set u [nickdb_get $n username]
+ if {[string length $u]} { usererror $ue }
+ return $u
+}
+
+proc telling_setting_sec_simple {} {
+ uplevel 1 {
+ ta_nomore
+ set sr sec
+ set v $setting
+ }
+}
+
+proc telling_setting_neednomsgs {} {
+ uplevel 1 {
+ if {[llength [msgsdb_get $n inbound]]} {
+ usererror "You must delete the messages you have, first."
+ }
+ }
+
def_setting tellme {
set secv [nickdb_get $n tellsec]
set ms [tellme_sec_desc $secv]
} {
set setting [string tolower [ta_word]]
switch -exact $setting {
- insecure - secure - refuse {
- ta_nomore
- if {"$setting" == "refuse" && [llength [msgsdb_get $n inbound]]} {
- usererror "You must delete the messages you have, first."
- }
- set sr sec
- set v $setting
+ insecure {
+ telling_setting_sec_simple
+ }
+ secure {
+ telling_setting_sec_simple
+ }
+ refuse {
+ telling_setting_neednomsgs
+ telling_setting_sec_simple
}
mailto {
- set u [nickdb_get $n username]
- if {![string length $u]} {
- usererror "Sorry, you must register secure to have your messages mailed (to prevent the use of this feature for spamming)."
- }
+FIXME - working here, check needsecure for secure
+FIXME - what if user makes themselves insecure or deletes themselves while they have msgs ?
+ telling_setting_neednomsgs
+ set u [tellme_setting_needsecure $n \
+ "Sorry, you must register secure to have your messages mailed\
+ (to prevent the use of this feature for spamming)."]
set sr sec
set v [list mailto [ta_word] $u]
}