1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-05 19:31:02 -08:00

* lisp/net/rcirc.el (rcirc-cmd-ctcp): Use dedicated function when

available.
(rcirc-ctcp-sender-PING): New function.
This commit is contained in:
Deniz Dogan 2011-02-09 01:22:01 +01:00
parent 00b3c7ac85
commit ee6a57ab20
2 changed files with 20 additions and 5 deletions

View file

@ -2185,14 +2185,23 @@ With a prefix arg, prompt for new topic."
(defun rcirc-cmd-ctcp (args &optional process target)
(if (string-match "^\\([^ ]+\\)\\s-+\\(.+\\)$" args)
(let ((target (match-string 1 args))
(request (match-string 2 args)))
(rcirc-send-string process
(format "PRIVMSG %s \C-a%s\C-a"
target (upcase request))))
(let* ((target (match-string 1 args))
(request (upcase (match-string 2 args)))
(function (intern-soft (concat "rcirc-ctcp-sender-" request))))
(if (fboundp function) ;; use special function if available
(funcall function process target request)
(rcirc-send-string process
(format "PRIVMSG %s :\C-a%s\C-a"
target request))))
(rcirc-print process (rcirc-nick process) "ERROR" nil
"usage: /ctcp NICK REQUEST")))
(defun rcirc-ctcp-sender-PING (process target request)
"Send a CTCP PING message to TARGET."
(let ((timestamp (car (split-string (number-to-string (float-time)) "\\."))))
(rcirc-send-string process
(format "PRIVMSG %s :\C-aPING %s\C-a" target timestamp))))
(defun rcirc-cmd-me (args &optional process target)
(rcirc-send-string process (format "PRIVMSG %s :\C-aACTION %s\C-a"
target args)))