From: ueno Date: Mon, 29 Aug 2005 05:59:50 +0000 (+0000) Subject: * riece-server.el (riece-server-keyword-map): Abolished X-Git-Tag: channel-coding-mergepoint~1 X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=0eba7fe9aa4152b8f250a2c9a5cccbb8a46e7738;p=elisp%2Friece.git * riece-server.el (riece-server-keyword-map): Abolished :coding-system-alist keyword. (riece-send-string): Take the target identity as the 2nd argument. * riece-identity.el (riece-channel-coding-system-alist): Renamed from riece-coding-system-alist. * riece-globals.el (riece-coding-system-alist): Abolished. * riece-commands.el (riece-command-topic): Pass the target identity to as the 2nd argument of riece-send-string. (riece-command-kick): Ditto. (riece-command-send-message): Ditto. (riece-command-enter-message-to-user): Ditto. (riece-command-join-channel): Ditto. (riece-command-part-channel): Ditto. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 81f2717..d71d166 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,24 @@ 2005-08-29 Daiki Ueno + * riece-server.el (riece-server-keyword-map): Abolished + :coding-system-alist keyword. + (riece-send-string): Take the target identity as the 2nd argument. + + * riece-identity.el (riece-channel-coding-system-alist): Renamed + from riece-coding-system-alist. + + * riece-globals.el (riece-coding-system-alist): Abolished. + + * riece-commands.el (riece-command-topic): Pass the target + identity to as the 2nd argument of riece-send-string. + (riece-command-kick): Ditto. + (riece-command-send-message): Ditto. + (riece-command-enter-message-to-user): Ditto. + (riece-command-join-channel): Ditto. + (riece-command-part-channel): Ditto. + +2005-08-29 Daiki Ueno + * riece-identity.el (riece-coding-system-for-identity): Moved from riece-coding.el. (riece-decoded-string-for-identity): Ditto. diff --git a/lisp/riece-coding.el b/lisp/riece-coding.el index 3da47a9..3b5f934 100644 --- a/lisp/riece-coding.el +++ b/lisp/riece-coding.el @@ -44,12 +44,6 @@ specifying the coding systems for decoding and encoding respectively." (const nil :tag "No conversion")) :group 'riece-coding) -(defcustom riece-coding-system-alist nil - "An alist mapping from identities to coding-systems." - :type '(repeat (cons (string :tag "Identity") - (symbol :tag "Coding system"))) - :group 'riece-coding) - (defun riece-encode-coding-string (string) (if (and (local-variable-p 'riece-coding-system (current-buffer)) riece-coding-system) ;should be nil on non-Mule environment diff --git a/lisp/riece-commands.el b/lisp/riece-commands.el index bc6fbcb..116d58a 100644 --- a/lisp/riece-commands.el +++ b/lisp/riece-commands.el @@ -194,7 +194,8 @@ the layout to the selected layout-name." 0))))) (riece-send-string (format "TOPIC %s :%s\r\n" (riece-identity-prefix riece-current-channel) - topic))) + topic) + riece-current-channel)) (defun riece-command-invite (user) (interactive @@ -227,7 +228,8 @@ the layout to the selected layout-name." user message) (format "KICK %s %s\r\n" (riece-identity-prefix riece-current-channel) - user)))) + user)) + riece-current-channel)) (defun riece-command-names (pattern) (interactive @@ -386,7 +388,7 @@ the layout to the selected layout-name." (format "NOTICE %s :%s\r\n" (riece-identity-prefix riece-current-channel) message) - (riece-identity-prefix riece-current-channel)) + riece-current-channel) (riece-display-message (riece-make-message (riece-current-nickname) riece-current-channel message 'notice t))) @@ -394,7 +396,7 @@ the layout to the selected layout-name." (format "PRIVMSG %s :%s\r\n" (riece-identity-prefix riece-current-channel) message) - (riece-identity-prefix riece-current-channel)) + riece-current-channel) (riece-display-message (riece-make-message (riece-current-nickname) riece-current-channel message nil t)))) @@ -433,7 +435,8 @@ the layout to the selected layout-name." (riece-line-beginning-position) (riece-line-end-position)))) (riece-send-string - (format "PRIVMSG %s :%s\r\n" (riece-identity-prefix user) text)) + (format "PRIVMSG %s :%s\r\n" (riece-identity-prefix user) text) + user) (riece-display-message (riece-make-message (riece-current-nickname) user text nil t))) (let ((next-line-add-newlines t)) @@ -444,13 +447,13 @@ the layout to the selected layout-name." (unless process (error "%s" (substitute-command-keys "Type \\[riece-command-open-server] to open server."))) - (riece-process-send-string process - (if key - (format "JOIN %s :%s\r\n" - (riece-identity-prefix target) - key) - (format "JOIN %s\r\n" - (riece-identity-prefix target)))))) + (riece-send-string (if key + (format "JOIN %s :%s\r\n" + (riece-identity-prefix target) + key) + (format "JOIN %s\r\n" + (riece-identity-prefix target))) + target))) (defun riece-command-join-partner (target) (let ((pointer (riece-identity-member target riece-current-channels))) @@ -482,13 +485,13 @@ the layout to the selected layout-name." (defun riece-command-part-channel (target message) (let ((process (riece-server-process (riece-identity-server target)))) - (riece-process-send-string process - (if message - (format "PART %s :%s\r\n" - (riece-identity-prefix target) - message) - (format "PART %s\r\n" - (riece-identity-prefix target)))))) + (riece-send-string (if message + (format "PART %s :%s\r\n" + (riece-identity-prefix target) + message) + (format "PART %s\r\n" + (riece-identity-prefix target))) + target))) (defun riece-command-part (target &optional message) (interactive diff --git a/lisp/riece-globals.el b/lisp/riece-globals.el index c36c752..57f97fa 100644 --- a/lisp/riece-globals.el +++ b/lisp/riece-globals.el @@ -131,9 +131,6 @@ Local to the server buffers.") (defvar riece-coding-system nil "Coding system for process I/O. Local to the server buffers.") -(defvar riece-coding-system-alist nil - "An alist mapping prefixes to coding-systems. -Local to the server buffers.") ;;; Variables local to the channel buffers: (defvar riece-freeze nil diff --git a/lisp/riece-identity.el b/lisp/riece-identity.el index 61b9820..deb1398 100644 --- a/lisp/riece-identity.el +++ b/lisp/riece-identity.el @@ -27,6 +27,12 @@ (require 'riece-globals) (require 'riece-coding) +(defcustom riece-channel-coding-system-alist nil + "An alist mapping from channels to coding-systems." + :type '(repeat (cons (string :tag "Channel") + (symbol :tag "Coding system"))) + :group 'riece-coding) + (defvar riece-abbrev-identity-string-function nil) (defvar riece-expand-identity-string-function nil) @@ -185,7 +191,7 @@ The rest of arguments are the same as `completing-read'." identity)) (defun riece-coding-system-for-identity (identity) - (let ((alist riece-coding-system-alist) + (let ((alist riece-channel-coding-system-alist) matcher) (catch 'found (while alist @@ -202,11 +208,22 @@ The rest of arguments are the same as `completing-read'." (let ((coding-system (riece-coding-system-for-identity identity))) (if (and coding-system (not (eq (riece-decoded-coding-system decoded) - coding-system))) + (if (consp coding-system) + (car coding-system) + coding-system)))) (riece-decode-coding-string-1 (riece-decoded-encoded-string decoded) coding-system) decoded))) +(defun riece-encode-coding-string-for-identity (string identity) + (let ((coding-system (riece-coding-system-for-identity identity))) + (if coding-system + (encode-coding-string string + (if (consp coding-system) + (cdr coding-system) + coding-system)) + (riece-encode-coding-string string)))) + (provide 'riece-identity) ;;; riece-identity.el ends here diff --git a/lisp/riece-irc.el b/lisp/riece-irc.el index 050a6e2..d2c5a4d 100644 --- a/lisp/riece-irc.el +++ b/lisp/riece-irc.el @@ -86,8 +86,7 @@ (with-current-buffer (process-buffer process) (setq riece-last-nickname riece-real-nickname riece-nick-accepted 'sent - riece-coding-system coding - riece-coding-system-alist coding-system-alist)) + riece-coding-system coding)) process)))) (defun riece-irc-quit-server-process (process &optional message) diff --git a/lisp/riece-server.el b/lisp/riece-server.el index a333baf..be1c8a7 100644 --- a/lisp/riece-server.el +++ b/lisp/riece-server.el @@ -38,8 +38,7 @@ (:username riece-username) (:password) (:function riece-default-open-connection-function) - (:coding riece-default-coding-system) - (:coding-system-alist)) + (:coding riece-default-coding-system)) "Mapping from keywords to default values. All keywords that can be used must be listed here.")) @@ -193,8 +192,10 @@ the `riece-server-keyword-map' variable." (if (riece-server-opened "") ""))))) -(defun riece-send-string (string &optional prefix) - (let* ((server-name (riece-current-server-name)) +(defun riece-send-string (string &optional identity) + (let* ((server-name (if identity + (riece-identity-server identity) + (riece-current-server-name))) (process (riece-server-process server-name)) coding-system) (unless process @@ -202,14 +203,10 @@ the `riece-server-keyword-map' variable." "Type \\[riece-command-open-server] to open server."))) (riece-process-send-string process - (if (and prefix - (setq coding-system - (cdr (assoc prefix - (plist-get (riece-server-properties - server-name) - :coding-system-alist))))) - (encode-coding-string string coding-system) - (riece-encode-coding-string string))))) + (with-current-buffer (process-buffer process) + (if identity + (riece-encode-coding-string-for-identity string identity) + (riece-encode-coding-string string)))))) (defun riece-open-server (server server-name) (let ((protocol (or (plist-get server :protocol) @@ -274,7 +271,6 @@ the `riece-server-keyword-map' variable." (make-local-variable 'riece-channel-obarray) (setq riece-channel-obarray (make-vector riece-channel-obarray-size 0)) (make-local-variable 'riece-coding-system) - (make-local-variable 'riece-coding-system-alist) (buffer-disable-undo) (erase-buffer)))