Created
March 24, 2011 04:06
-
-
Save dakrone/884561 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ;; taken from src/subrosa/commands.clj | |
| (defcommand privmsg [channel args] | |
| (let [[recipient received-msg] (.split args " " 2) | |
| msg (format ":%s PRIVMSG %s %s" | |
| (format-client channel) recipient received-msg)] | |
| (if (not (empty? recipient)) | |
| (if (not (nil? received-msg)) | |
| (if (room-for-name recipient) | |
| (do | |
| (send-to-room-except recipient msg channel) | |
| (run-hook 'privmsg-room-hook | |
| channel recipient (subs received-msg 1))) | |
| (if-let [channel (channel-for-nick recipient)] | |
| (do | |
| (send-to-client* channel msg) | |
| (run-hook 'privmsg-nick-hook | |
| channel recipient (subs received-msg 1))) | |
| (raise {:type :client-error | |
| :code 401 | |
| :msg (format "%s :No such nick/channel" recipient)}))) | |
| (raise {:type :client-error | |
| :code 412 | |
| :msg ":No text to send"})) | |
| (raise {:type :client-error | |
| :code 411 | |
| :msg ":No recipient given (PRIVMSG)"})))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment