chiark / gitweb /
identpass works
authorijackson <ijackson>
Tue, 5 Sep 2000 22:49:54 +0000 (22:49 +0000)
committerijackson <ijackson>
Tue, 5 Sep 2000 22:49:54 +0000 (22:49 +0000)
bot.tcl
helpinfos

diff --git a/bot.tcl b/bot.tcl
index f3db5c192e4d72643133fa4add1e3ae2f85bff52..42f062757f48a2ba8971bdf8b4429df34eb80dd0 100755 (executable)
--- a/bot.tcl
+++ b/bot.tcl
@@ -517,7 +517,7 @@ proc loadhelp {} {
 
 def_ucmd help {
     upvar #0 help_topics([irctolower [string trim $text]]) info
-    if {![info exists info]} { error "no help on $text, sorry." {} }
+    if {![info exists info]} { ucmdr "No help on $text, sorry." {} }
     ucmdr $info {}
 }
 
@@ -533,14 +533,35 @@ proc manyset {list args} {
     }
 }
 
-def_ucmd summon {
-    set target [ta_word]
-    ta_nomore
+proc check_username {target} {
     if {
        [string length $target] > 8 ||
         [regexp {[^-0-9a-z]} $target] ||
         ![regexp {^[a-z]} $target]
     } { error "invalid username" }
+}
+
+def_ucmd identpass {
+    set username [ta_word]
+    set passmd5 [md5sum [ta_word]]
+    ta_nomore
+    prefix_nick
+    upvar #0 nick_onchans($n) onchans
+    if {![info exists onchans] || ![llength $onchans]} {
+       ucmdr {} "You must be on a channel with me to identify yourself."
+    }
+    check_username $username
+    exec userv --timeout 3 $username << "$passmd5\n" > /dev/null \
+           irc-identpass $n
+    upvar #0 nick_username($n) rec_username
+    set rec_username $username
+    ucmdr {} "Pleased to see you, $username."
+}
+
+def_ucmd summon {
+    set target [ta_word]
+    ta_nomore
+    check_username $target
     prefix_nick
 
     upvar #0 lastsummon($target) ls
index 09587faeafd38904c628bed4e5fb1d5deb890058..d6da2a035fbcc8a9aab2c3bc9200b80120fcc520 100644 (file)
--- a/helpinfos
+++ b/helpinfos
@@ -57,7 +57,7 @@ remain on a channel that I'm on too.  (See also `help invite'.)
 !identpass
 identpass <username> <password>
  Identification, for example with /blight-id, is actually done with
- `identpass', which passes the md5sum of the password to `userv
+ `identpass', which feeds the md5sum of the password to `userv
  <username> irc-identpass <nick>'.  That must exit 0 if all is well.
 
 !invite