[net-nittin-irc-cvs] CVS update: net-nittin-irc/protocol.lisp

Erik Enge eenge at common-lisp.net
Mon Nov 24 03:16:26 UTC 2003


Update of /project/net-nittin-irc/cvsroot/net-nittin-irc
In directory common-lisp.net:/tmp/cvs-serv2457

Modified Files:
	protocol.lisp 
Log Message:
find-user now respects:

     Because of IRC's Scandinavian origin, the characters {}|^ are
     considered to be the lower case equivalents of the characters
     []\~, respectively. This is a critical issue when determining the
     equivalence of two nicknames or channel names.

Date: Sun Nov 23 22:16:26 2003
Author: eenge

Index: net-nittin-irc/protocol.lisp
diff -u net-nittin-irc/protocol.lisp:1.16 net-nittin-irc/protocol.lisp:1.17
--- net-nittin-irc/protocol.lisp:1.16	Sun Nov 23 19:42:53 2003
+++ net-nittin-irc/protocol.lisp	Sun Nov 23 22:16:26 2003
@@ -1,4 +1,4 @@
-;;;; $Id: protocol.lisp,v 1.16 2003/11/24 00:42:53 eenge Exp $
+;;;; $Id: protocol.lisp,v 1.17 2003/11/24 03:16:26 eenge Exp $
 ;;;; $Source: /project/net-nittin-irc/cvsroot/net-nittin-irc/protocol.lisp,v $
 
 ;;;; See LICENSE for licensing information.
@@ -389,10 +389,24 @@
       (subseq nickname 1)
       nickname))
 
+;; oh, what a terrible operator name
+(defun irc-nick-mangle (string)
+  (let* ((new-string (substitute #\[ #\{ string))
+         (new-string (substitute #\] #\} new-string))
+         (new-string (substitute #\\ #\| new-string))
+         (new-string (substitute #\~ #\^ new-string)))
+    new-string))
+
+;; ditto
+(defun irc-nick-equal (string1 string2)
+  "Return t if `string1' and `string2' are equal as far as nickname
+rules in IRC goes."
+  (string-equal (irc-nick-mangle string1) (irc-nick-mangle string2)))
+
 (defmethod find-user ((connection connection) (nickname string))
   "Return user as designated by `nickname' or nil if no such user is
 known."
-  (find nickname (all-users connection) :key #'nickname :test #'string-equal))
+  (find nickname (all-users connection) :key #'nickname :test #'irc-nick-equal))
 
 (defmethod add-user ((connection connection) (user user))
   "Add `user' to `connection'."





More information about the Net-nittin-irc-cvs mailing list