1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-12-24 10:38:38 +00:00

* lisp/net/rcirc.el: Add PRIVMSG and CTCP functions.

(rcirc-send-privmsg, rcirc-send-ctcp): New functions.
(rcirc-keepalive, rcirc-cmd-ctcp, rcirc-ctcp-sender-PING)
(rcirc-cmd-me, rcirc-authenticate): Use them.
This commit is contained in:
Deniz Dogan 2011-02-10 16:41:40 +01:00
parent 67f02b82f4
commit 1be1d1e98e
2 changed files with 34 additions and 23 deletions

View File

@ -1,3 +1,10 @@
2011-02-10 Deniz Dogan <deniz.a.m.dogan@gmail.com>
* net/rcirc.el: Add PRIVMSG and CTCP functions.
(rcirc-send-privmsg, rcirc-send-ctcp): New functions.
(rcirc-keepalive, rcirc-cmd-ctcp, rcirc-ctcp-sender-PING)
(rcirc-cmd-me, rcirc-authenticate): Use them.
2011-02-10 Ken Manheimer <ken.manheimer@gmail.com>
* allout.el: Synopsis: Change allout user configuration so

View File

@ -564,13 +564,13 @@ last ping."
(mapc (lambda (process)
(with-rcirc-process-buffer process
(when (not rcirc-connecting)
(rcirc-send-string process
(format "PRIVMSG %s :\C-aKEEPALIVE %f\C-a"
rcirc-nick
(if (featurep 'xemacs)
(time-to-seconds
(current-time))
(float-time)))))))
(rcirc-send-ctcp process
rcirc-nick
(format "KEEPALIVE %f"
(if (featurep 'xemacs)
(time-to-seconds
(current-time))
(float-time)))))))
(rcirc-process-list))
;; no processes, clean up timer
(cancel-timer rcirc-keepalive-timer)
@ -714,6 +714,14 @@ Function is called with PROCESS, COMMAND, SENDER, ARGS and LINE.")
(rcirc-debug process string)
(process-send-string process string)))
(defun rcirc-send-privmsg (process target string)
(rcirc-send-string process (format "PRIVMSG %s :%s" target string)))
(defun rcirc-send-ctcp (process target request &optional args)
(let ((args (if args (concat " " args) "")))
(rcirc-send-privmsg process target
(format "\C-a%s%s\C-a" request args ""))))
(defun rcirc-buffer-process (&optional buffer)
"Return the process associated with channel BUFFER.
With no argument or nil as argument, use the current buffer."
@ -2190,21 +2198,17 @@ With a prefix arg, prompt for new topic."
(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-send-ctcp process 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 (format "%.0f" (float-time))))
(rcirc-send-string process
(format "PRIVMSG %s :\C-aPING %s\C-a" target timestamp))))
(rcirc-send-ctcp process target "PING" timestamp)))
(defun rcirc-cmd-me (args &optional process target)
(rcirc-send-string process (format "PRIVMSG %s :\C-aACTION %s\C-a"
target args)))
(rcirc-send-ctcp process target "ACTION" args))
(defun rcirc-add-or-remove (set &rest elements)
(dolist (elt elements)
@ -2699,20 +2703,20 @@ Passwords are stored in `rcirc-authinfo' (which see)."
(when (and (string-match server rcirc-server)
(string-match nick rcirc-nick))
(cond ((equal method 'nickserv)
(rcirc-send-string
(rcirc-send-privmsg
process
(concat "PRIVMSG " (or (cadr args) "nickserv")
" :identify " (car args))))
(or (cadr args) "NickServ")
(concat "identify " (car args))))
((equal method 'chanserv)
(rcirc-send-string
(rcirc-send-privmsg
process
(concat
"PRIVMSG chanserv :identify "
(car args) " " (cadr args))))
"ChanServ"
(format "identify %s %s" (car args) (cadr args))))
((equal method 'bitlbee)
(rcirc-send-string
(rcirc-send-privmsg
process
(concat "PRIVMSG &bitlbee :identify " (car args))))
"&bitlbee"
(concat "identify " (car args))))
(t
(message "No %S authentication method defined"
method))))))))