Ticket #18: bot-fixes.patch

File bot-fixes.patch, 4.4 KB (added by Erik Huelsmann, 19 years ago)
  • package.lisp

    ? bot-fixes.patch
    ? current-state.patch
    ? current.patch
    ? dist.sh
    ? msg
    ? tracking.patch
    ? tracking.patch2
    ? tracking.patch3
    ? working-track.lisp
    ? doc/tracking-considerations
    ? test/package.fasl
    ? test/test-parse-message.fasl
    ? test/test-protocol.fasl
    RCS file: /project/cl-irc/cvsroot/cl-irc/package.lisp,v
    retrieving revision 1.10
    diff -u -r1.10 package.lisp
     
    1515             :irc-message-event
    1616             :start-background-message-handler
    1717             :stop-background-message-handler
     18             :destructuring-arguments
    1819             :socket-connect
    1920             :server-name
    2021             :no-such-reply
  • example/cliki.lisp

    RCS file: /project/cl-irc/cvsroot/cl-irc/example/cliki.lisp,v
    retrieving revision 1.38
    diff -u -r1.38 cliki.lisp
     
    723723
    724724
    725725(defun valid-cliki-message (message)
    726   (scan *cliki-attention-prefix* (trailing-argument message)))
     726  (scan *cliki-attention-prefix* (car (last (arguments message)))))
    727727
    728728(defvar *respond-to-general-hellos* nil)
    729729
     
    740740         (format *trace-output* "~A~%"
    741741                 (nthcdr 10 (sb-debug:backtrace-as-list)))
    742742         (return-from msg-hook))))
    743     (progn
    744       (scan-for-more (trailing-argument message))
    745       (let ((respond-to (if (string-equal (first (arguments message)) *cliki-nickname*) (source message) (first (arguments message)))))
     743    (destructuring-arguments
     744        (target &rest unused &last text)
     745        message
     746      (declare (ignore unused))
     747      (scan-for-more text)
     748      (let ((respond-to (if (string-equal target *cliki-nickname*) (source message) target)))
    746749        (if (valid-cliki-message message)
    747             (let ((response (cliki-lookup (regex-replace *cliki-attention-prefix* (trailing-argument message) "") :sender (source message) :channel (first (irc:arguments message)))))
     750            (let ((response (cliki-lookup (regex-replace *cliki-attention-prefix* text "") :sender (source message) :channel target)))
    748751              (and response (privmsg *cliki-connection* respond-to response)))
    749             (if (string-equal (first (arguments message)) *cliki-nickname*)
    750                 (aif (cliki-lookup (trailing-argument message) :sender (source message))
     752            (if (string-equal target *cliki-nickname*)
     753                (aif (cliki-lookup text :sender (source message))
    751754                     (privmsg *cliki-connection* respond-to it))
    752                 (if (anybody-here (trailing-argument message))
    753                     (privmsg *cliki-connection* (first (arguments message)) (format nil "~A: hello." (source message))))))
     755                (if (anybody-here text)
     756                    (privmsg *cliki-connection* target (format nil "~A: hello." (source message))))))
    754757        (take-care-of-memos respond-to (source message))))))
    755758
    756759(defvar *cliki-nickserv-password* "")
    757760
    758761(defun notice-hook (message)
    759762  (if (and (string-equal (source message) "NickServ")
    760            (scan "owned by someone else" (trailing-argument message)))
     763           (scan "owned by someone else" (car (last (arguments message)))))
    761764      (privmsg *cliki-connection* (source message) (format nil "IDENTIFY ~A" *cliki-nickserv-password*))))
    762765
    763766(defun rename-cliki (new-nick)
  • example/specbot.lisp

    RCS file: /project/cl-irc/cvsroot/cl-irc/example/specbot.lisp,v
    retrieving revision 1.14
    diff -u -r1.14 specbot.lisp
     
    102102  (and (not final) string))
    103103
    104104(defun msg-hook (message)
    105   (let ((destination (if (string-equal (first (arguments message)) *nickname*)
    106                          (source message)
    107                          (first (arguments message))))
     105  (let* ((target (first (arguments message))))
     106         (destination (if (string-equal target *nickname*)
     107                          (source message)
     108                        target))
    108109        (to-lookup (strip-address (trailing-argument message))))
    109110    (if (and (or
    110               (string-equal (first (arguments message)) *nickname*)
     111              (string-equal target *nickname*)
    111112              (not (string= to-lookup (trailing-argument message))))
    112113             (member to-lookup '("help" "help?") :test #'string-equal))
    113114        (progn