2003-06-03 Daiki Ueno <ueno@unixuser.org>
+ * riece-rdcc.el: Require 'riece-ctcp.
+ (riece-rdcc-insinuate): Add "DCC" to
+ riece-ctcp-additional-clientinfo.
+
+ * riece-ctcp.el (riece-ctcp-additional-clientinfo): New variable.
+ (riece-command-ctcp-clientinfo): New command.
+ (riece-ctcp-insinuate): Bind it in riece-dialogue-mode-map.
+ (riece-handle-ctcp-clientinfo-request): New handler.
+ (riece-handle-ctcp-clientinfo-response): New handler.
+
+ * riece-server.el (riece-open-server): No need to use
+ get-buffer-create to reuse process buffer.
+
+2003-06-03 Daiki Ueno <ueno@unixuser.org>
+
* riece-rdcc.el (riece-command-dcc-send): Generate new buffer for
DCC process.
(riece-command-dcc-receive): Likewise; don't set buffer-file-name.
(require 'riece-misc)
(defvar riece-ctcp-ping-time nil)
+(defvar riece-ctcp-additional-clientinfo nil)
(defvar riece-dialogue-mode-map)
(add-hook 'riece-notice-hook 'riece-handle-ctcp-response)
(define-key riece-dialogue-mode-map "\C-cv" 'riece-command-ctcp-version)
(define-key riece-dialogue-mode-map "\C-cp" 'riece-command-ctcp-ping)
- (define-key riece-dialogue-mode-map "\C-ca" 'riece-command-ctcp-action))
+ (define-key riece-dialogue-mode-map "\C-ca" 'riece-command-ctcp-action)
+ (define-key riece-dialogue-mode-map "\C-cc" 'riece-command-ctcp-clientinfo))
(defun riece-handle-ctcp-request (prefix string)
(when (and prefix string
target))
"\n"))))
+(defun riece-handle-ctcp-clientinfo-request (prefix target string)
+ (let ((buffer (if (riece-channel-p target)
+ (cdr (riece-identity-assoc-no-server
+ (riece-make-identity target)
+ riece-channel-buffer-alist))))
+ (user (riece-prefix-nickname prefix)))
+ (riece-send-string
+ (format "NOTICE %s :\1CLIENTINFO %s\1\r\n"
+ user
+ (let (messages)
+ (mapatoms
+ (lambda (atom)
+ (let ((case-fold-search t))
+ (if (and (fboundp atom)
+ (string-match
+ "riece-handle-ctcp-\\(.+\\)-request"
+ (symbol-name atom)))
+ (setq messages
+ (cons (match-string 1 (symbol-name atom))
+ messages))))))
+ (mapconcat #'upcase (append messages
+ riece-ctcp-additional-clientinfo)
+ " "))))
+ (riece-insert-change buffer (format "CTCP CLIENTINFO from %s\n" user))
+ (riece-insert-change
+ (if (and riece-channel-buffer-mode
+ (not (eq buffer riece-channel-buffer)))
+ (list riece-dialogue-buffer riece-others-buffer)
+ riece-dialogue-buffer)
+ (concat
+ (riece-concat-server-name
+ (format "CTCP CLIENTINFO from %s (%s) to %s"
+ user
+ (riece-strip-user-at-host (riece-prefix-user-at-host prefix))
+ target))
+ "\n"))))
+
(defun riece-handle-ctcp-action-request (prefix target string)
(let ((buffer (if (riece-channel-p target)
(cdr (riece-identity-assoc-no-server
elapsed))
"\n"))))
+(defun riece-handle-ctcp-clientinfo-response (prefix target string)
+ (riece-insert-change
+ (list riece-dialogue-buffer riece-others-buffer)
+ (concat
+ (riece-concat-server-name
+ (format "CTCP CLIENTINFO for %s (%s) = %s"
+ (riece-prefix-nickname prefix)
+ (riece-strip-user-at-host (riece-prefix-user-at-host prefix))
+ string))
+ "\n")))
+
(defun riece-command-ctcp-version (user)
(interactive
(let ((completion-ignore-case t))
(riece-send-string (format "PRIVMSG %s :\1PING\1\r\n" user))
(setq riece-ctcp-ping-time (current-time)))
+(defun riece-command-ctcp-clientinfo (user)
+ (interactive
+ (let ((completion-ignore-case t))
+ (list (completing-read
+ "Channel/User: "
+ (mapcar #'list (riece-get-users-on-server))))))
+ (riece-send-string (format "PRIVMSG %s :\1CLIENTINFO\1\r\n" user)))
+
(defun riece-command-ctcp-action (channel action)
(interactive
(list (if current-prefix-arg
(require 'riece-misc)
(require 'riece-channel)
(require 'riece-identity)
+(require 'riece-ctcp) ;for riece-ctcp-additional-clientinfo
(defgroup riece-rdcc nil
"DCC implementation using ruby"
(defvar riece-dialogue-mode-map)
(defun riece-rdcc-insinuate ()
+ (add-to-list 'riece-ctcp-additional-clientinfo "DCC" t)
(add-hook 'riece-ctcp-dcc-request-hook 'riece-handle-dcc-request)
(define-key riece-dialogue-mode-map "\C-ds" 'riece-command-dcc-send)
(define-key riece-dialogue-mode-map "\C-dr" 'riece-command-dcc-receive))