From: ueno Date: Sat, 24 May 2003 01:00:29 +0000 (+0000) Subject: Cleanup. X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=b46e3814df46a8c1cd368be86e3be57c7eb529c8;p=elisp%2Fliece.git Cleanup. * liece-000.el (liece-handle-000-messages): Don't set liece-nickname. * liece-400.el (liece-iterate-nick): Abolish. (liece-handle-433-message): Don't use liece-iterate-nick. * liece-channel.el: Abolish channel representation format. (liece-default-channel-representation-format): Abolish. (liece-dcc-channel-representation-format): Abolish. (liece-channel-prepare-representation): Abolish. (liece-channel-parse-representation): Abolish. * liece-commands.el (liece-command-save-variables): Rename from liece-command-save-vars; simplify using with-temp-file. * liece-ctcp.el: Require liece-version. * liece-globals.el: Rearrange variables by usage; don't require liece-version. (liece-last-nickname): Rename from liece-nickname-last. (liece-last-who-expression): Rename from liece-who-expression. (liece-real-userhost): Rename from liece-my-userhost. (liece-last-chat-partner): Rename from liece-privmsg-partner. (liece-last-friends): Rename from liece-friends-last. (liece-real-server-name): New variable. (liece-server-process-alist): New variable. (liece-command-buffer-mode-indicator): Rename from liece-private-indicator. (liece-server-buffer): Abolish. * liece-inlines.el (liece-next-line): Abolish. * liece-misc.el (liece-send-pong): Abolish. (liece-increment-long-reply-count): Define as function. (liece-reset-long-reply-count): Ditto. (liece-check-long-reply-count): Ditto. * liece-q-el.el (liece-quote-el-decode-string): Fix typo. * liece-vars.el (liece-saved-forms): Don't purecopy. (liece-want-traditional): Abolish. (liece-command-window-on-top): Abolish. (liece-one-buffer-mode): Abolish. (liece-saved-variables-file): New variable. (liece-server-alist): Default to nil. (liece-my-userhost): Remove. (liece-nick-max-length): Abolish. (liece-real-nickname): Remove. (liece-grow-tail): Abolish. (liece-retry-with-new-nickname): Rename from liece-auto-iterate-nick. (liece-after-registration): Abolish. (liece-status-message-string): Abolish. (liece-channel-unread-list): Moved to liece-globals.el. * liece-version.el: Bind utf-2000-version, and mule-version. * liece-xemacs.el: Require liece-version. * liece.el (liece-tmp-server-name): Abolish. (liece-read-variables-files): Remove migration logic. (liece): Don't add liece-nickname to liece-nick-alist. (liece-accept-response): Don't retry with the new nickname. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 822ff5d..8aeb381 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,55 @@ +2003-05-24 Daiki Ueno + + * liece-000.el (liece-handle-000-messages): Don't set liece-nickname. + * liece-400.el (liece-iterate-nick): Abolish. + (liece-handle-433-message): Don't use liece-iterate-nick. + * liece-channel.el: Abolish channel representation format. + (liece-default-channel-representation-format): Abolish. + (liece-dcc-channel-representation-format): Abolish. + (liece-channel-prepare-representation): Abolish. + (liece-channel-parse-representation): Abolish. + * liece-commands.el (liece-command-save-variables): Rename from + liece-command-save-vars; simplify using with-temp-file. + * liece-ctcp.el: Require liece-version. + * liece-globals.el: Rearrange variables by usage; don't require + liece-version. + (liece-last-nickname): Rename from liece-nickname-last. + (liece-last-who-expression): Rename from liece-who-expression. + (liece-real-userhost): Rename from liece-my-userhost. + (liece-last-chat-partner): Rename from liece-privmsg-partner. + (liece-last-friends): Rename from liece-friends-last. + (liece-real-server-name): New variable. + (liece-server-process-alist): New variable. + (liece-command-buffer-mode-indicator): Rename from + liece-private-indicator. + (liece-server-buffer): Abolish. + * liece-inlines.el (liece-next-line): Abolish. + * liece-misc.el (liece-send-pong): Abolish. + (liece-increment-long-reply-count): Define as function. + (liece-reset-long-reply-count): Ditto. + (liece-check-long-reply-count): Ditto. + * liece-q-el.el (liece-quote-el-decode-string): Fix typo. + * liece-vars.el (liece-saved-forms): Don't purecopy. + (liece-want-traditional): Abolish. + (liece-command-window-on-top): Abolish. + (liece-one-buffer-mode): Abolish. + (liece-saved-variables-file): New variable. + (liece-server-alist): Default to nil. + (liece-my-userhost): Remove. + (liece-nick-max-length): Abolish. + (liece-real-nickname): Remove. + (liece-grow-tail): Abolish. + (liece-retry-with-new-nickname): Rename from liece-auto-iterate-nick. + (liece-after-registration): Abolish. + (liece-status-message-string): Abolish. + (liece-channel-unread-list): Moved to liece-globals.el. + * liece-version.el: Bind utf-2000-version, and mule-version. + * liece-xemacs.el: Require liece-version. + * liece.el (liece-tmp-server-name): Abolish. + (liece-read-variables-files): Remove migration logic. + (liece): Don't add liece-nickname to liece-nick-alist. + (liece-accept-response): Don't retry with the new nickname. + 2003-05-23 Daiki Ueno * liece-message.el: Overhaul; don't depend on dynamic binding. diff --git a/lisp/liece-000.el b/lisp/liece-000.el index 528e545..4cee39e 100644 --- a/lisp/liece-000.el +++ b/lisp/liece-000.el @@ -36,7 +36,7 @@ (require 'liece-intl) (require 'liece-misc)) -(defvar liece-tmp-server-name) +(require 'liece-version) (defun* liece-handle-000-messages (number prefix rest) (setq liece-nick-accepted 'ok) @@ -61,11 +61,11 @@ (or (< 0 (length (setq rest (liece-split-line rest)))) (return-from liece-handle-001-message)) (let ((nick (car rest))) - (setq liece-tmp-server-name prefix - liece-nickname nick + (setq liece-real-server-name prefix liece-real-nickname nick - liece-my-userhost nil) - (liece-send "USERHOST %s" liece-nickname) + liece-real-userhost nil) + (push (list liece-real-nickname) liece-nick-alist) + (liece-send "USERHOST %s" liece-real-nickname) (liece-insert-info liece-000-buffer (format @@ -78,7 +78,7 @@ ((string-match "running version \\(.*\\)" rest) (liece-insert-info liece-000-buffer (format (_ "Your server is %s (version %s).\n") - liece-tmp-server-name (match-string 1 rest)))) + liece-real-server-name (match-string 1 rest)))) (t (liece-insert-info liece-000-buffer (format (_ "Your client version is %s.\n") diff --git a/lisp/liece-300.el b/lisp/liece-300.el index 88bc79a..0536b22 100644 --- a/lisp/liece-300.el +++ b/lisp/liece-300.el @@ -75,7 +75,7 @@ (away (match-string 3 rest)) (who (match-string 4 rest)) (end (match-end 4))) (if (liece-nick-equal nick liece-real-nickname) - (setq liece-my-userhost who)) + (setq liece-real-userhost who)) (liece-insert-info liece-300-buffer (format "Nick %s is %s [%s%s, %s%s]\n" nick who @@ -85,10 +85,10 @@ (defun liece-303-display-friends (nicks) (let ((on (filter-elements nick nicks - (not (string-list-member-ignore-case nick liece-friends-last)))) - (off (filter-elements nick liece-friends-last + (not (string-list-member-ignore-case nick liece-last-friends)))) + (off (filter-elements nick liece-last-friends (not (string-list-member-ignore-case nick nicks))))) - (setq liece-friends-last nicks) + (setq liece-last-friends nicks) (if on (liece-insert-info liece-300-buffer (format (_ "Following people are now on: %s\n") @@ -239,11 +239,11 @@ (if (zerop liece-long-reply-count) (liece-insert-info liece-300-buffer (concat "No matches found" - (if liece-who-expression - (concat ": " liece-who-expression) + (if liece-last-who-expression + (concat ": " liece-last-who-expression) "") "\n"))) - (setq liece-who-expression nil) + (setq liece-last-who-expression nil) (liece-reset-long-reply-count)) (defun liece-handle-317-message (prefix rest) diff --git a/lisp/liece-400.el b/lisp/liece-400.el index 9cfac01..3ef0f2c 100644 --- a/lisp/liece-400.el +++ b/lisp/liece-400.el @@ -70,13 +70,6 @@ "ERR_NOTEXTTOSEND \":No text to send\"." (liece-message (_ "No text to send"))) -(defun liece-iterate-nick (nick) - (let* ((fmt (format "%s_" nick)) - (new (substring fmt 0 (min 9 (length fmt))))) - (if (string= nick new) - (liece-iterate-nick (format "_%s" nick)) - new))) - (defun liece-handle-432-message (prefix rest) "ERR_ERRONEUSNICKNAME \" :Erroneous nickname\"." (let ((nick (cond ((string-match "^[^ ]+ +\\([^ ]+\\)" rest) @@ -85,7 +78,7 @@ (match-string 1 rest))))) (with-current-buffer liece-command-buffer (if (eq liece-nick-accepted 'ok) - (setq liece-real-nickname liece-nickname-last)) + (setq liece-real-nickname liece-last-nickname)) (liece-message (_ "Erroneous nickname %s. Choose a new one with %s.") nick (substitute-command-keys "\\[liece-command-nickname]")) @@ -99,12 +92,12 @@ (match-string 1 rest))))) (cond ((and (not (eq liece-nick-accepted 'ok)) - liece-auto-iterate-nick) - (liece-send "NICK %s" (liece-iterate-nick nick)) + liece-retry-with-new-nickname) + (liece-send "NICK %s" (concat nick "_")) (setq liece-nick-accepted 'sent)) (t (if (eq liece-nick-accepted 'ok) - (setq liece-real-nickname liece-nickname-last)) + (setq liece-real-nickname liece-last-nickname)) (with-current-buffer liece-command-buffer (liece-message (_ "Nickname %s already in use. Choose a new one with %s.") diff --git a/lisp/liece-channel.el b/lisp/liece-channel.el index 40f1a25..23afec1 100644 --- a/lisp/liece-channel.el +++ b/lisp/liece-channel.el @@ -37,10 +37,6 @@ (defconst liece-channel-regexp "[+&#!]") (defconst liece-channel-modeless-regexp "[+!]") -(defvar liece-default-channel-representation-format "%s+%s") - -(defconst liece-dcc-channel-representation-format "=%s") - (define-widget 'liece-channel-push-button 'push-button "A channel button." :action 'liece-channel-push-button-action) @@ -463,30 +459,6 @@ If NOSW is non-nil do not switch to newly created channel." (string-equal-ignore-case chnl liece-current-channel)))))) -(defun liece-channel-prepare-representation (chnl &optional method name) - (cond - ((eq method 'dcc) - (format liece-dcc-channel-representation-format chnl)) - (name - (format liece-default-channel-representation-format name chnl)) - (t chnl))) - -(defun liece-channel-parse-representation (str) - (cond - ((string-match - (format - (regexp-quote liece-dcc-channel-representation-format) - "\\([^ ]+\\)") - str) - (vector 'dcc nil (match-string 1 str))) - ((string-match - (format - (regexp-quote liece-default-channel-representation-format) - "\\([^ ]+\\)" "\\([^ ]+\\)") - str) - (vector 'irc (match-string 1 str) (match-string 2 str))) - (t (vector 'irc nil str)))) - (defun liece-channel-list-add-button (n chnl) (insert (format "%2d: " n)) (if liece-highlight-mode diff --git a/lisp/liece-commands.el b/lisp/liece-commands.el index 1650a4b..01f4913 100644 --- a/lisp/liece-commands.el +++ b/lisp/liece-commands.el @@ -109,7 +109,7 @@ Optional argument NO-CONS specifies timestamp format is cons cell." (current-time)) liece-timestamp-interval))) (if liece-save-variables-are-dirty - (liece-command-save-vars)) + (liece-command-save-variables)) (liece-command-timestamp) (setq liece-last-timestamp-no-cons-p no-cons))) @@ -129,50 +129,44 @@ Optional argument NO-CONS specifies timestamp format is cons cell." (if win (select-window win)))) (defun liece-command-send-message (message) - "Send MESSAGE to current chat partner of current channel." + "Send MESSAGE to the partner or the channel." (if (string-equal message "") (progn (liece-message (_ "No text to send")) nil) - (let (repr method target) - (cond - ((eq liece-command-buffer-mode 'chat) - (or liece-current-chat-partner - (error - (substitute-command-keys - "Type \\[liece-command-join] to start private conversation"))) - (setq repr (liece-channel-parse-representation - liece-current-chat-partner) - method (aref repr 0) - ;; name (aref repr 1) - target (aref repr 2)) - (cond ((eq method 'dcc) - (liece-dcc-chat-send target message)) - ((eq method 'irc) - (liece-send "PRIVMSG %s :%s" - liece-current-chat-partner message))) - (liece-own-private-message message)) - (t - (or liece-current-channel - (error - (substitute-command-keys - "Type \\[liece-command-join] to join a channel"))) - (liece-send - "PRIVMSG %s :%s" - (liece-channel-real liece-current-channel) message) - (liece-own-channel-message message)))))) + (cond + ((eq liece-command-buffer-mode 'chat) + (or liece-current-chat-partner + (error + (substitute-command-keys + "Type \\[liece-command-join] to start private conversation"))) + (if (eq '= (string-to-char liece-current-chat-partner)) + (liece-dcc-chat-send (substring liece-current-chat-partner 1) + message) + (liece-send "PRIVMSG %s :%s" + liece-current-chat-partner message)) + (liece-own-private-message message)) + (t + (or liece-current-channel + (error + (substitute-command-keys + "Type \\[liece-command-join] to join a channel"))) + (liece-send + "PRIVMSG %s :%s" + (liece-channel-real liece-current-channel) message) + (liece-own-channel-message message))))) (defun liece-command-enter-message () "Enter the current line as an entry in the IRC dialogue." (interactive) (beginning-of-line) - (liece-command-send-message - (buffer-substring (point)(progn (end-of-line) (point)))) - (liece-next-line 1)) + (liece-command-send-message (buffer-substring (point) (line-end-position))) + (let ((next-line-add-newlines t)) + (next-line 1))) (defun liece-dialogue-enter-message () "Ask for a line as an entry in the IRC dialogue on the current channel." (interactive) (let (message) - (while (not (string-equal (setq message (read-string "> ")) "")) + (while (not (equal (setq message (read-string "> ")) "")) (liece-command-send-message message)))) (defun liece-command-join-channel (join-channel-var key) @@ -218,7 +212,7 @@ with specified user." (if (eq liece-command-buffer-mode 'chat) (liece-minibuffer-completing-read (_ "Start private conversation with: ") - liece-nick-alist nil nil nil nil liece-privmsg-partner) + liece-nick-alist nil nil nil nil liece-last-chat-partner) (liece-minibuffer-completing-read (_ "Join channel: ") (append liece-channel-alist liece-nick-alist) @@ -535,7 +529,7 @@ Argument CHANGE ." (liece-minibuffer-completing-read (_ "Private message to: ") (append liece-nick-alist liece-channel-alist) - nil nil nil nil liece-privmsg-partner))) + nil nil nil nil liece-last-chat-partner))) (list address (read-string (format @@ -554,19 +548,20 @@ Argument CHANGE ." "Send a private message (current line) to PARTNER." (interactive (let ((completion-ignore-case t)) - (setq liece-privmsg-partner + (setq liece-last-chat-partner (liece-channel-virtual (liece-minibuffer-completing-read (_ "To whom: ") (append liece-nick-alist liece-channel-alist) - nil nil nil nil liece-privmsg-partner))) - (list liece-privmsg-partner))) + nil nil nil nil liece-last-chat-partner))) + (list liece-last-chat-partner))) (let ((message (buffer-substring (progn (beginning-of-line) (point)) (progn (end-of-line) (point))))) (if (> (length message) 0) (progn - (liece-command-message liece-privmsg-partner message) - (liece-next-line 1)) + (liece-command-message liece-last-chat-partner message) + (let ((next-line-add-newlines t)) + (next-line 1))) (liece-message (_ "No text to send"))))) (defun liece-command-names (&optional expr) @@ -597,10 +592,9 @@ With - as argument, list all channels." (defun liece-command-nickname (nick) "Set your nickname to NICK." (interactive "sEnter your nickname: ") - (let ((nickname (truncate-string-to-width nick liece-nick-max-length))) - (if (zerop (length nickname)) - (liece-message (_ "illegal nickname \"%s\"; not changed") nickname) - (liece-send "NICK %s" nick)))) + (if (equal nick "") + (liece-message (_ "illegal nickname \"%s\"; not changed") nick) + (liece-send "NICK %s" nick))) (defun liece-command-who (&optional expr) "Lists tue users that match the given expression EXPR. @@ -626,7 +620,7 @@ With - as argument, list all users." (setq expr "")) (when expr (liece-send "WHO %s" expr) - (setq liece-who-expression expr))) + (setq liece-last-who-expression expr))) (defun liece-command-finger (finger-nick-var &optional server) "Get information about a specific user FINGER-NICK-VAR. @@ -760,12 +754,10 @@ If prefix argument ARG is non-nil, toggle frozen status." (liece-toggle-command-buffer-mode)) (chat (if liece-current-channel - (liece-switch-to-channel liece-current-channel)) - (setq liece-command-buffer-mode-indicator "Channels")) + (liece-switch-to-channel liece-current-channel))) (channel (if liece-current-chat-partner - (liece-switch-to-channel liece-current-chat-partner)) - (setq liece-command-buffer-mode-indicator "Partners"))) + (liece-switch-to-channel liece-current-chat-partner)))) (liece-channel-change)) (defun liece-command-quit (&optional arg) @@ -833,55 +825,25 @@ Prefix argument ARG is regarded as distance from yank pointer." all (all-completions candidate alist)) (liece-minibuffer-finalize-completion completion candidate all))) -(defun liece-command-save-vars () +(defvar print-quoted) +(defvar print-escape-multibyte) +(defun liece-command-save-variables () "Save current settings to `liece-variables-file'." (interactive) - (let* ((output-buffer - (find-file-noselect - (expand-file-name liece-variables-file))) - output-marker p) - (save-excursion - (set-buffer output-buffer) - (goto-char (point-min)) - (cond ((re-search-forward "^;; Saved Settings *\n" nil 'move) - (setq p (match-beginning 0)) - (goto-char p) - (or (re-search-forward - "^;; End of Saved Settings *\\(\n\\|\\'\\)" nil t) - (error - (concat "can't find END of saved state in " - liece-variables-file))) - (delete-region p (match-end 0))) - (t - (goto-char (point-max)) - (insert "\n"))) - (setq output-marker (point-marker)) - (let ((print-readably t) - (print-escape-newlines t) - (standard-output output-marker)) - (princ ";; Saved Settings\n") - (dolist (var liece-saved-forms) - (if (symbolp var) - (prin1 (list 'setq var - (let ((val (symbol-value var))) - (if (memq val '(t nil)) - val - (list 'quote val))))) - (setq var (eval var)) - (cond ((eq (car-safe var) 'progn) - (while (setq var (cdr var)) - (prin1 (car var)) - (princ "\n") - (if (cdr var) (princ " ")))) - (var - (prin1 "xx")(prin1 var)))) - (if var (princ "\n"))) - (princ "\n") - (princ ";; End of Saved Settings\n"))) - (set-marker output-marker nil) - (save-excursion - (set-buffer output-buffer) - (save-buffer))) + (with-temp-file liece-saved-variables-file + (let ((print-quoted t) + (print-readably t) + print-escape-multibyte + print-level + print-length) + (dolist (variable liece-saved-forms) + (prin1 `(setq ,variable + ',(let ((value (symbol-value variable))) + (if (memq value '(t nil)) + value + (list 'quote value)))) + (current-buffer)) + (insert "\n")))) (setq liece-save-variables-are-dirty nil)) (defun liece-command-reconfigure-windows () @@ -889,7 +851,7 @@ Prefix argument ARG is regarded as distance from yank pointer." (interactive) (let ((command-window (liece-get-buffer-window liece-command-buffer)) (dialogue-window (liece-get-buffer-window liece-dialogue-buffer)) - (obuffer (current-buffer))) + (buffer (current-buffer))) (if (and command-window dialogue-window) (let ((ch (window-height command-window)) (dh (window-height dialogue-window))) @@ -898,9 +860,7 @@ Prefix argument ARG is regarded as distance from yank pointer." (enlarge-window (+ ch dh (- dh)))) (pop-to-buffer liece-dialogue-buffer)) (liece-configure-windows) - (if liece-one-buffer-mode - (pop-to-buffer liece-dialogue-buffer) - (pop-to-buffer obuffer)))) + (pop-to-buffer buffer))) (defun liece-command-end-of-buffer () "Get end of the dialogue buffer." @@ -1109,7 +1069,7 @@ Argument ARG is prefix argument of toggle status." (set-buffer standard-output) (insert "Friends status: \n\n") (dolist (friend liece-friends) - (if (string-list-member-ignore-case friend liece-friends-last) + (if (string-list-member-ignore-case friend liece-last-friends) (insert "+ " friend "\n") (insert "- " friend "\n"))))) diff --git a/lisp/liece-ctcp.el b/lisp/liece-ctcp.el index 7972e3f..98eaeec 100644 --- a/lisp/liece-ctcp.el +++ b/lisp/liece-ctcp.el @@ -29,9 +29,11 @@ ;;; Code: -(eval-when-compile (require 'liece-inlines)) -(eval-when-compile (require 'liece-misc)) +(eval-when-compile + (require 'liece-inlines) + (require 'liece-misc)) +(require 'liece-version) (require 'liece-handler) ;; (require 'pccl) @@ -520,20 +522,21 @@ (let ((completion-ignore-case t) message) (if arg - (setq liece-privmsg-partner + (setq liece-last-chat-partner (liece-channel-virtual (liece-minibuffer-completing-read (_ "To whom: ") (append liece-nick-alist liece-channel-alist) - nil nil nil nil liece-privmsg-partner)))) + nil nil nil nil liece-last-chat-partner)))) (beginning-of-line) (setq message (buffer-substring (point)(progn (end-of-line)(point)))) (if (string= message "") (setq message (read-string "Action: ")) - (liece-next-line 1)) + (let ((next-line-add-newlines t)) + (next-line 1))) (liece-send "PRIVMSG %s :\001ACTION %s\001" (if arg - liece-privmsg-partner + liece-last-chat-partner (liece-channel-real liece-current-channel)) message) (if arg diff --git a/lisp/liece-dcc.el b/lisp/liece-dcc.el index 6845ed5..fabf932 100644 --- a/lisp/liece-dcc.el +++ b/lisp/liece-dcc.el @@ -114,9 +114,9 @@ (liece-minibuffer-completing-read (_ "To whom: ") (append liece-nick-alist liece-channel-alist) - nil nil nil nil liece-privmsg-partner))) + nil nil nil nil liece-last-chat-partner))) - (setq liece-privmsg-partner towhom) + (setq liece-last-chat-partner towhom) (let ((process (liece-dcc-start-process (list "send" (int-to-string liece-dcc-port) filename)))) @@ -162,17 +162,17 @@ (split-string (substring output (match-end 0))) (setq filename (file-name-nondirectory filename)) (liece-send "PRIVMSG %s :\001DCC SEND %s %s %s %s\001" - liece-privmsg-partner filename host port size) + liece-last-chat-partner filename host port size) (liece-dcc-message (_ "Sending file to %s: %s (%s bytes)") - liece-privmsg-partner filename size) + liece-last-chat-partner filename size) (liece-dcc-add-to-process-alist process 'send :host host :port port - :from liece-privmsg-partner + :from liece-last-chat-partner :file filename :size size)) (liece-dcc-message (_ "send error to %s: %s") - liece-privmsg-partner + liece-last-chat-partner (substring output 0 (1- (length output)))))) (defmacro liece-dcc-prepare-directory () @@ -222,8 +222,8 @@ (list (liece-minibuffer-completing-read (_ "With whom: ") (append liece-nick-alist liece-channel-alist) - nil nil nil nil liece-privmsg-partner))) - (setq liece-privmsg-partner towhom) + nil nil nil nil liece-last-chat-partner))) + (setq liece-last-chat-partner towhom) (let ((process (as-binary-process (liece-dcc-start-process @@ -242,23 +242,22 @@ (multiple-value-bind (host port) (split-string (substring output (match-end 0))) (liece-send "PRIVMSG %s :\001DCC CHAT chat %s %s\001" - liece-privmsg-partner host port) + liece-last-chat-partner host port) (liece-dcc-message (_ "Ringing user %s") - liece-privmsg-partner) + liece-last-chat-partner) (liece-dcc-add-to-process-alist - process 'chat :from liece-privmsg-partner))) + process 'chat :from liece-last-chat-partner))) ((string-match "^DCC chat established" output) (set-process-filter process 'liece-dcc-chat-filter) (let* ((object (liece-dcc-get-process-object process)) - (nick (liece-dcc-object-from object))) - (setq nick (liece-channel-prepare-representation nick 'dcc)) - (liece-channel-prepare-partner nick) + (target (concat "=" (liece-dcc-object-from object)))) + (liece-channel-prepare-partner target) (liece-dcc-message (_ "Chat connection established with: %s") - nick)) - (message "")) + target) + (message ""))) (t (liece-dcc-message (_ "listen error to %s: %s") - liece-privmsg-partner + liece-last-chat-partner (substring output 0 (1- (length output))))))) (defun liece-command-dcc-chat-connect (&optional number) @@ -266,10 +265,10 @@ (if (queue-empty liece-dcc-requests) (liece-message (_ "DCC No chat request has been arrived.")) (let* ((object (liece-dcc-dequeue-request 'chat)) - (nick (liece-dcc-object-from object)) + (target (liece-dcc-object-from object)) process) - (liece-dcc-message (_ "Connecting to: %s") nick) - (setq liece-privmsg-partner nick) + (liece-dcc-message (_ "Connecting to: %s") target) + (setq liece-last-chat-partner target) (setq process (as-binary-process (liece-dcc-start-process @@ -283,29 +282,27 @@ (set-process-filter process #'liece-dcc-chat-connect-filter) (set-process-sentinel process #'liece-dcc-sentinel) (liece-dcc-add-to-process-alist - process 'chat :from liece-privmsg-partner)))) + process 'chat :from liece-last-chat-partner)))) (defun liece-dcc-chat-connect-filter (process output) (if (string-match "^DCC chat established" output) (let* ((object (liece-dcc-get-process-object process)) - (nick (liece-dcc-object-from object))) + (target (concat "=" (liece-dcc-object-from object)))) (set-process-filter process #'liece-dcc-chat-filter) - (setq nick (liece-channel-prepare-representation nick 'dcc)) - (liece-channel-prepare-partner nick) + (liece-channel-prepare-partner target) (liece-dcc-message (_ "Chat connection established with: %s") - nick) + target) (message "")) (liece-dcc-message (_ "connect error to %s: %s") - liece-privmsg-partner + liece-last-chat-partner (substring output 0 (1- (length output)))))) (defun liece-dcc-chat-filter (process output) (save-match-data (with-current-buffer (process-buffer process) (let* ((object (liece-dcc-get-process-object process)) - (nick (liece-channel-prepare-representation - (liece-dcc-object-from object) 'dcc))) + (target (concat "=" (liece-dcc-object-from object)))) (goto-char (point-max)) (insert output) (goto-char (point-min)) @@ -320,7 +317,8 @@ (buffer-substring st (1- nd)))) (delete-region st nd) (liece-display-message - (liece-make-message nick (liece-current-nickname) line))))))))) + (liece-make-message target (liece-current-nickname) + line))))))))) (defun liece-dcc-chat-nick-to-process (nick) "Convert NICK to process symbol." diff --git a/lisp/liece-globals.el b/lisp/liece-globals.el index 21299cb..c2b086f 100644 --- a/lisp/liece-globals.el +++ b/lisp/liece-globals.el @@ -29,140 +29,148 @@ ;;; Code: -(require 'liece-version) - -(defvar liece-server-name nil) -(defvar liece-server-process nil) -(defvar liece-status-message-string nil) -(defvar liece-polling 0 - "Wheter we are automatically polling the server.") - -(defvar liece-real-nickname nil) -(defvar liece-nick-accepted nil) +;;; Miscellaneous global variables: +(defvar liece-server-name nil + "Primary server name.") +(defvar liece-server-process nil + "Primary server process.") +(defvar liece-server-process-alist nil + "An alist mapping secondary server name to opened processes.") (defvar liece-current-channel nil "The channel you currently have joined.") - (defvar liece-current-channels nil "The channels you have currently joined.") - (defvar liece-current-chat-partner nil "The person you are in a private conversation with.") - (defvar liece-current-chat-partners nil - "An list containing nics user is chatting with.") - -(defvar liece-privmsg-partner nil - "The person who got your last private message.") + "A list of nicknames you are chatting with.") +(defvar liece-channel-unread-list nil + "A list of channels which has new messages.") (defvar liece-nick-alist nil "An alist containing the nicknames of users known to be on IRC. -Each element in the list is a list containing a nickname.") - +Each element is a list whose car is a nickname.") (defvar liece-channel-alist nil "An alist containing the channels on IRC. -Each element in the list is a list containing a channel name.") - +Each element is a list whose car is a channel name.") (defvar liece-operator-alist nil "An alist of operators on channel. -Each element in the list is a list containing a nickname.") - -(defvar liece-supported-user-mode-alist nil - "User modes supported by server.") +Each element is a list whose car is a nickname.") -(defvar liece-supported-channel-mode-alist nil - "Channel modes supported by server.") - -;; Caches (defvar liece-save-variables-are-dirty nil - "Non nil if liece_vars.el is changed but not saved.") + "Non nil if the variables in `liece-saved-forms' are changed.") -(defvar liece-user-at-host "" - "The user@host for the current line.") +(defvar liece-long-reply-max 38 + "Threshold of long response from the server.") +(defvar liece-polling 0 + "Interval for polling the server.") + +;;; Variables local to the server buffers: +(defvar liece-real-nickname nil + "Your nickname the server offers. +Local to the server buffers.") +(defvar liece-last-nickname nil + "The last nickname you requested. +Local to the server buffers.") +(defvar liece-nick-accepted nil + "The flag your nickname is accepted by the server. +Possible values are nil, `ok', and `sent'. +Local to the server buffers.") +(defvar liece-real-server-name nil + "The server name offered by the server. +Local to the server buffers.") +(defvar liece-real-userhost nil + "Your hostname the server offers. +Local to the server buffers.") +(defvar liece-user-at-host "" + "The user@host for the current input. +Local to the server buffers.") (defvar liece-user-at-host-type nil - "The authentication of uerathost. 'ok 'not-verified 'fake or 'invalid.") - + "The authentication type of `liece-user-at-host'. +Possible values are 'ok 'not-verified 'fake or 'invalid. +Local to the server buffers.") +(defvar liece-supported-user-mode-alist nil + "User modes supported by server. +Local to the server buffers.") +(defvar liece-supported-channel-mode-alist nil + "Channel modes supported by server. +Local to the server buffers.") (defvar liece-channel-filter "" - "Enables use of \\[universal-argument] with NAMES and TOPIC.") - -(defvar liece-default-channel-candidate nil) - -(defvar liece-nickname-last nil - "Place to keep old nickname.") - -(defvar liece-friends-last nil) -(defvar liece-who-expression nil) - -(defconst liece-long-reply-max 38) -(defvar liece-long-reply-count 0) + "Filter of the result of NAMES or LIST. +This enables us to use \\[universal-argument] with NAMES and TOPIC. +Local to the server buffers.") +(defvar liece-long-reply-count 0 + "Count of long inputs from the server. +Local to the server buffers.") +(defvar liece-obarray nil + "Namespace of the IRC world. +Local to the server buffers.") + +;;; Variables local to the command buffer: +(defvar liece-default-channel-candidate nil + "A channel name used as completion candidate. +Local to the command buffer.") +(defvar liece-last-friends nil) +(defvar liece-last-who-expression nil) +(defvar liece-last-chat-partner nil) +(defvar liece-command-buffer-mode 'channel + "Command buffer mode. +Possible values are `chat' and `channel'. +Local to the command buffer.") + +;;; Variables local to the channel buffers: +(defvar liece-beep nil + "If non-nil, change `liece-beep-indicator' when messages containing +a bell character arrived. +Local to the channel buffers.") +(defvar liece-freeze nil + "If non-nil, channel window is not scrolled. +Local to the channel buffers.") +(defvar liece-own-freeze nil + "If non-nil, channel window is not scrolled until you input. +Local to the channel buffers.") -(defvar liece-obarray nil) +;;; Modeline indicators: +(defvar liece-channel-status-indicator "") - -;; Modeline indicators (defvar liece-channel-indicator "No channel" - "The current channel, \"pretty-printed.\".") - -(defvar liece-private-indicator nil - "String displayed in the modeline indicating private conversation.") - + "A modeline indicator of the current channel.") (defvar liece-channels-indicator "No channel" "The current joined channels, \"pretty-printed.\".") +(defvar liece-command-buffer-mode-indicator nil + "A modeline indicator for private conversation.") (defvar liece-away-indicator "-") -(defvar liece-command-buffer-mode-indicator "Channels") -(defvar liece-channel-status-indicator "") - (defvar liece-beep-indicator nil) (defvar liece-freeze-indicator nil) (defvar liece-own-freeze-indicator nil) -(defvar liece-beep nil) -(defvar liece-freeze nil) -(defvar liece-own-freeze nil) - -(defvar liece-own-freeze nil - "If non-nil, dialogue window will not be scrolled automatically.") - -(defvar liece-command-buffer-mode 'channel - "Current command buffer mode. -Which value is 'chat or 'channel.") -;; Buffers +;;; Buffers: (defvar liece-command-buffer "*Commands*" "Name of command input buffer.") - (defvar liece-dialogue-buffer "*Dialogue*" "Name of dialogue output buffer.") - (defvar liece-private-buffer "*Private*" "Name of private message buffer.") - (defvar liece-others-buffer "*Others*" "Name of others message buffer.") - (defvar liece-channel-buffer "*Channel*" "Name of Channel message buffer.") - (defvar liece-channel-buffer-format " *Channel:%s*" "Format of Channel message buffer.") - (defvar liece-channel-list-buffer "*Channels*" "Name of Channel list buffer.") - (defvar liece-nick-buffer " *Nicks*" "Name of nick list message buffer.") - (defvar liece-nick-buffer-format " *Nicks:%s*" "Format of nick list buffer.") - (defvar liece-KILLS-buffer " *KILLS*") (defvar liece-IGNORED-buffer " *IGNORED*") (defvar liece-WALLOPS-buffer " *WALLOPS*") -(defvar liece-server-buffer nil) - -;; Buffer display variables +;;; Buffer lists: (defvar liece-channel-buffer-alist nil) (defvar liece-nick-buffer-alist nil) @@ -171,39 +179,29 @@ Which value is 'chat or 'channel.") (defvar liece-D-buffer (list liece-dialogue-buffer) "A list of buffer where normal dialogue is sent.") - (defvar liece-O-buffer (list liece-others-buffer) "A list of buffer where other messages are sent.") - (defvar liece-P-buffer (list liece-dialogue-buffer liece-private-buffer liece-others-buffer) "A list of buffers where private messages to me are sent.") - (defvar liece-I-buffer (list liece-IGNORED-buffer) "A list of buffers where private messages to me are sent.") - (defvar liece-W-buffer (list liece-WALLOPS-buffer) "A list of buffers where WALLOPS messages to me are sent.") - (defvar liece-K-buffer (list liece-KILLS-buffer) "A list of buffers where KILL messages to me are sent.") - (defvar liece-000-buffer (list liece-dialogue-buffer liece-others-buffer) "A list of buffers where 000 messages to me are sent.") - (defvar liece-200-buffer (list liece-dialogue-buffer liece-others-buffer) "A list of buffers where 200 messages to me are sent.") - (defvar liece-300-buffer (list liece-dialogue-buffer liece-others-buffer) "A list of buffers where 300 messages to me are sent.") - (defvar liece-400-buffer (list liece-dialogue-buffer liece-others-buffer) "A list of buffers where 400 messages to me are sent.") - (defvar liece-500-buffer (list liece-dialogue-buffer liece-others-buffer) "A list of buffers where 500 messages to me are sent.") diff --git a/lisp/liece-handle.el b/lisp/liece-handle.el index 2358e0c..bdf5093 100644 --- a/lisp/liece-handle.el +++ b/lisp/liece-handle.el @@ -83,7 +83,7 @@ (liece-nick-change prefix rest) (cond ((liece-nick-equal prefix liece-real-nickname) - (setq liece-nickname-last liece-real-nickname + (setq liece-last-nickname liece-real-nickname liece-real-nickname rest)) ((liece-nick-member prefix liece-current-chat-partners) (setq liece-current-chat-partners diff --git a/lisp/liece-inlines.el b/lisp/liece-inlines.el index 416d24c..1c83845 100644 --- a/lisp/liece-inlines.el +++ b/lisp/liece-inlines.el @@ -168,12 +168,6 @@ (setq liece-icon-directory (liece-locate-path "icons"))) (expand-file-name filename liece-icon-directory)) -(defmacro liece-next-line (arg) - `(let ((i 0)) - (while (< i ,arg) - (if (eobp) (newline)(next-line 1)) - (setq i (1+ i))))) - ;; Borrowed from `edebug.el'. (defvar liece-gensym-index 0 "Integer used by `liece-gensym' to produce new names.") diff --git a/lisp/liece-menu.el b/lisp/liece-menu.el index 99a6128..82601bc 100644 --- a/lisp/liece-menu.el +++ b/lisp/liece-menu.el @@ -158,7 +158,7 @@ (defvar liece-menu-IRC-menu '("IRC" - ["Save variables file" liece-command-save-vars t] + ["Save variables file" liece-command-save-variables t] "----" ["Change window style" liece-command-set-window-style t] ["Reload style file" liece-command-reload-window-style t] diff --git a/lisp/liece-message.el b/lisp/liece-message.el index bd4a339..99dea80 100644 --- a/lisp/liece-message.el +++ b/lisp/liece-message.el @@ -156,9 +156,9 @@ Normally they are *Dialogue* and/or *Others*." "Makes an instance of message object. Arguments are apropriate to the sender, the receiver, and text content, respectively. -Optional 4th argument TYPE specifies the type of message. +Optional 4th argument TYPE specifies the type of the message. Currently possible values are `action' and `notice'. -Optional 5th argument is a flag to indicate that this message is not +Optional 5th argument is the flag to indicate that this message is not from the network." (vector speaker target text type own-p)) diff --git a/lisp/liece-misc.el b/lisp/liece-misc.el index e6526cd..1b67260 100644 --- a/lisp/liece-misc.el +++ b/lisp/liece-misc.el @@ -92,10 +92,10 @@ (cond ((eq mode 'chat) (put 'liece-nick-buffer-mode 'hide t) - (setq liece-private-indicator "P")) + (setq liece-command-buffer-mode-indicator "P")) (t (put 'liece-nick-buffer-mode 'hide nil) - (setq liece-private-indicator "-"))) + (setq liece-command-buffer-mode-indicator "-"))) (and (not (eq liece-command-buffer-mode mode)) (not (eq hide (get 'liece-nick-buffer-mode 'hide))) liece-nick-window-auto-hide @@ -274,19 +274,16 @@ (if (string-match "^list\\s-*" (setq string (downcase string))) (setq liece-channel-filter (substring string (match-end 0)))))) -(defmacro liece-send-pong () - '(liece-send "PONG :%s" liece-tmp-server-name)) +(defun liece-increment-long-reply-count () + (setq liece-long-reply-count (1+ liece-long-reply-count))) -(defmacro liece-increment-long-reply-count () - '(incf liece-long-reply-count)) +(defun liece-reset-long-reply-count () + (setq liece-long-reply-count 0)) -(defmacro liece-reset-long-reply-count () - '(setq liece-long-reply-count 0)) - -(defmacro liece-check-long-reply-count () - '(when (> liece-long-reply-count liece-long-reply-max) - (liece-reset-long-reply-count) - (liece-send-pong))) +(defun liece-check-long-reply-count () + (when (> liece-long-reply-count liece-long-reply-max) + (liece-reset-long-reply-count) + (liece-send "PONG :%s" (or liece-real-server-name (system-name))))) (defmacro liece-server-host () '(if (listp liece-server) diff --git a/lisp/liece-q-el.el b/lisp/liece-q-el.el index dce861e..e2882d1 100644 --- a/lisp/liece-q-el.el +++ b/lisp/liece-q-el.el @@ -46,7 +46,7 @@ (save-excursion (with-temp-buffer (insert string) - (liece-quote-el-decode-string (point-min) (point-max)) + (liece-quote-el-decode-region (point-min) (point-max)) (buffer-substring (point-min) (point-max))))) (defun liece-quote-el-encode-region (start end) diff --git a/lisp/liece-vars.el b/lisp/liece-vars.el index ad7ef50..a7e1f65 100644 --- a/lisp/liece-vars.el +++ b/lisp/liece-vars.el @@ -44,13 +44,12 @@ :group 'liece) (defcustom liece-saved-forms - (purecopy - '(liece-kill-nickname - liece-server-alist - liece-channel-buffer-mode - liece-nick-buffer-mode - liece-friends)) - "Variables whose values are saved via command liece-command-save-vars." + '(liece-kill-nickname + liece-server-alist + liece-channel-buffer-mode + liece-nick-buffer-mode + liece-friends) + "Variables whose values are saved via command liece-command-save-variables." :type 'string :group 'liece-vars) @@ -117,22 +116,6 @@ be set in `.emacs' instead." :group 'liece-look :type 'boolean) -(defcustom liece-want-traditional nil - "Do we want /commands." - :type 'boolean - :group 'liece-vars) - -(defcustom liece-command-window-on-top nil - "If non-nil, the command window will be put at the top of the screen." - :type 'boolean - :group 'liece-look) - -(defcustom liece-one-buffer-mode nil - "When non-nil, liece will put up only a dialogue buffer. -Useful for those (perverts) who use 24 line terminals." - :type 'boolean - :group 'liece-look) - (defcustom liece-display-status-on-channel-indicator nil "When non-nil, liece will display channel topic on modeline." :type 'boolean @@ -143,15 +126,21 @@ Useful for those (perverts) who use 24 line terminals." :type 'directory :group 'liece-vars) -(defcustom liece-variables-file (expand-file-name "init.el" liece-directory) - "Where to look for variables. Helps to remove clutter from your .emacs. -This feature is most likely to dissappear in near future. The preferred -way is to put liece variables on .emacs or file loaded from there." +(defcustom liece-variables-file + (expand-file-name "init" liece-directory) + "Where to look for variables." + :type 'file + :group 'liece-vars) + +(defcustom liece-saved-variables-file + (expand-file-name "save" liece-directory) + "Where to look for variables. +This file was saved the last session." :type 'file :group 'liece-vars) (defcustom liece-variables-files - (list liece-variables-file) + (list liece-variables-file liece-saved-variables-file) "Where to look for variables. Helps to remove clutter from your .emacs. This feature is most likely to dissappear in near future. The preferred way is to put liece variables on .emacs or file loaded from there." @@ -208,20 +197,13 @@ way is to put liece variables on .emacs or file loaded from there." (widget-put widget :args args) widget)) -(defcustom liece-server-alist - '(("WIDE Project Kyoto NOC, Japan" . "irc.kyoto.wide.ad.jp") - ("WIDE Project Tokyo NOC, Japan" . "irc.tokyo.wide.ad.jp") - ("Hokkaido University, Sapporo, Japan" . "irc.huie.hokudai.ac.jp") - ("DTI, Akasaka Tokyo, Japan" . "irc.dti.ne.jp") - ("WIDE Project Fujisawa NOC, Japan" . "irc.fujisawa.wide.ad.jp") - ("WIDE Project Kyoto NOC, Japan (IPv6)" . "irc6.kyoto.wide.ad.jp")) +(defcustom liece-server-alist nil "IRC server assoc-list which is used for input IRC server." :type 'liece-server-spec :group 'liece-server) (defcustom liece-server (or (getenv "IRCSERVER") nil) - "Name of the host running the IRC server. -Value initialized from the IRCSERVER environment variable if one is set" + "IRC server host we are connecting to." :type 'string :group 'liece-server) @@ -236,12 +218,6 @@ Value initialized from the IRCSERVER environment variable if one is set" :type 'liece-service-spec :group 'liece-server) -(defcustom liece-my-userhost nil - "You can explicitly indicate own hostname here." - :type '(radio (string :tag "Hostname") - (const :tag "Autodetect" nil)) - :group 'liece-server) - (defcustom liece-password (or (getenv "IRCPASSWORD") nil) "Your password when connecting to server." :type '(radio (string :tag "Password") @@ -249,24 +225,15 @@ Value initialized from the IRCSERVER environment variable if one is set" :group 'liece-server) (defcustom liece-name (or (getenv "IRCNAME") (user-real-login-name)) - "The nickname you want to use in IRC. -Default is the environment variable IRCNICK, or your login name." + "The username you want to use in IRC." :type 'string :group 'liece-server) (defcustom liece-nickname (or (getenv "IRCNICK") (user-real-login-name)) - "The nickname you want to use in IRC. -Default is the environment variable IRCNICK, or your login name." + "The nickname you want to use in IRC." :type 'string :group 'liece-server) -(defcustom liece-nick-max-length 9 - "Maximum length of the nickname." - :type 'integer - :group 'liece-server) - -(defvar liece-real-nickname nil) - (defcustom liece-startup-channel nil "The channel to join automatically at startup. If nil, do not join any channel." @@ -310,24 +277,11 @@ If nil, do not join any channel." :type 'boolean :group 'liece-server) -(defcustom liece-grow-tail "_" - "Add liece-grow-tail to nick when reconnecting. -Otherwise you might get killed again if automagic reconnect is too fast." - :type 'string - :group 'liece-server) - -(defcustom liece-auto-iterate-nick nil +(defcustom liece-retry-with-new-nickname nil "When nickname has already been in use, grow-tail automagically." :type 'boolean :group 'liece-server) -(defvar liece-after-registration nil - "After my registration.") - -(defvar liece-status-message-string nil) - -(defvar liece-channel-unread-list nil) - ;; Hooks. (defgroup liece-hook nil "Hooks" diff --git a/lisp/liece-version.el b/lisp/liece-version.el index 6fb5f9d..19b74aa 100644 --- a/lisp/liece-version.el +++ b/lisp/liece-version.el @@ -38,6 +38,9 @@ (product-provide 'liece-version (product-define "Liece" nil '(2 0 0))) +(defvar utf-2000-version) +(defvar mule-version) + (defconst liece-environment-version (concat (if (fboundp 'apel-version) diff --git a/lisp/liece-xemacs.el b/lisp/liece-xemacs.el index 8e840d3..4dac538 100644 --- a/lisp/liece-xemacs.el +++ b/lisp/liece-xemacs.el @@ -34,6 +34,8 @@ (require 'liece-misc) (require 'liece-commands)) +(require 'liece-version) + (autoload 'liece-command-dcc-send "liece-dcc") (defvar liece-nick-popup-menu) diff --git a/lisp/liece.el b/lisp/liece.el index bf481bd..94716c9 100644 --- a/lisp/liece.el +++ b/lisp/liece.el @@ -67,7 +67,6 @@ All keywords that can be used must be listed here.")) (add-hook 'kill-emacs-hook 'liece-command-quit) -(defvar liece-tmp-server-name nil "Temporaly server name.") (defvar liece-buffer-last-check-time nil) (defvar liece-timers-list-initialized-p nil "Are liece internal timers in place?") @@ -209,7 +208,7 @@ If optional argument SAFE is nil, overwrite previous definitions." "k" liece-command-kill "\C-k" liece-command-kick "l" liece-command-list - "S" liece-command-save-vars + "S" liece-command-save-variables "m" liece-dialogue-enter-message "M" liece-command-modec "n" liece-command-nickname @@ -279,7 +278,7 @@ If optional argument SAFE is nil, overwrite previous definitions." "r" liece-command-reconfigure-windows "\C-r" mule-caesar-region "s" liece-command-set-window-style - "S" liece-command-save-vars + "S" liece-command-save-variables "v" liece-command-set-voices "\C-v" liece-command-browse-url "\C-y" liece-command-yank-send) @@ -344,12 +343,10 @@ is running on." (defun liece-close-server-internal () "Close connection to chat server." - (if (liece-server-opened) - (delete-process liece-server-process)) - (if liece-server-buffer - (kill-buffer liece-server-buffer)) - (setq liece-server-buffer nil - liece-server-process nil + (when (liece-server-opened) + (kill-buffer (process-buffer liece-server-process)) + (delete-process liece-server-process)) + (setq liece-server-process nil liece-server nil)) ;;;###liece-autoload @@ -369,7 +366,7 @@ is running on." (liece-close-server-internal) ;; Save settings to the `~/.liece/init.el' file. (if liece-save-variables-are-dirty - (liece-command-save-vars)) + (liece-command-save-variables)) ;; Reset everything. (liece-clear-system) (liece-window-configuration-pop) @@ -431,9 +428,7 @@ If optional argument SERVICE is non-nil, open by the service name." liece-password password)) (if (and (memq type '(rlogin telnet)) relay) (setq liece-tcp-relay-host relay)) - (setq liece-tmp-server-name host) (setq liece-server-process (liece-open-server-internal host service type)) - (setq liece-after-registration nil) (liece-command-ping) (if (null (liece-wait-for-response "^:[^ ]+ [4P][5O][1N][ G]")) (progn @@ -457,14 +452,8 @@ If optional argument SERVICE is non-nil, open by the service name." liece-name "No Name")) (liece-send "NICK %s" liece-nickname) - ;; We have to set `liece-real-nickname' here because IRC server doesn't - ;; notify the real nickname to the user. - (or liece-real-nickname - (setq liece-real-nickname - (truncate-string-to-width liece-nickname liece-nick-max-length))) - (setq liece-nickname-last liece-real-nickname - liece-nick-accepted 'sent - liece-after-registration t)))) + (setq liece-last-nickname liece-real-nickname + liece-nick-accepted 'sent)))) (defun liece-open-server-internal (host &optional service type) "Open connection to chat server on HOST by SERVICE (default is irc). @@ -475,9 +464,8 @@ Optional argument TYPE specifies connection types such as `program'." (setq process (liece-open-network-stream "IRC" " *IRC*" host (or service "irc")))) - (setq liece-server-buffer (process-buffer process)) (save-excursion - (set-buffer liece-server-buffer) + (set-buffer (process-buffer process)) (set-buffer-multibyte nil) (kill-all-local-variables) (buffer-disable-undo) @@ -499,30 +487,16 @@ Optional argument TYPE specifies connection types such as `program'." (defun liece-read-variables-files (&optional file) "Read variables FILEs." - (and (not (file-directory-p liece-directory)) - (file-exists-p liece-directory) - (yes-or-no-p "Upgrade the location of the data files? ") - (let ((file - (expand-file-name - (make-temp-name "liece") temporary-file-directory))) - (unwind-protect - (progn - (rename-file liece-directory file 'ok-if-exists) - (make-directory liece-directory) - (copy-file file (expand-file-name - (file-name-nondirectory liece-variables-file) - liece-directory))) - (ignore-errors (delete-file file))))) (or (file-directory-p liece-directory) (make-directory liece-directory)) (let ((files (if file - (progn - (setq liece-variables-file file - liece-variables-files (list file))) + (setq liece-variables-file file + liece-variables-files (list file)) liece-variables-files))) (dolist (file files) - (if (file-readable-p (expand-file-name file)) - (load (expand-file-name file) t))))) + (condition-case nil + (load (expand-file-name file)) + (file-error nil))))) ;;;###autoload (defun liece (&optional confirm) @@ -580,11 +554,10 @@ For a list of the generic commands type \\[liece-command-generic] ? RET. (interactive) (kill-all-local-variables) - (setq liece-nick-alist (list (list liece-nickname)) - major-mode 'liece-command-mode + (setq major-mode 'liece-command-mode mode-name "Commands" - liece-privmsg-partner nil - liece-private-indicator nil + liece-last-chat-partner nil + liece-command-buffer-mode-indicator nil liece-away-indicator "-" liece-beep-indicator "-" liece-freeze-indicator "-" @@ -593,7 +566,7 @@ For a list of the generic commands type \\[liece-command-generic] ? RET. (liece-mode-line-buffer-identification '("Liece: " mode-line-modified - liece-private-indicator + liece-command-buffer-mode-indicator liece-away-indicator "-- " liece-current-channel " " liece-real-nickname))) (liece-suppress-mode-line-format) @@ -696,8 +669,7 @@ All normal editing commands are turned off." (setq major-mode 'liece-channel-list-mode mode-name "Channels" mode-line-buffer-identification - (liece-mode-line-buffer-identification - '("Liece: " liece-command-buffer-mode-indicator " ")) + (liece-mode-line-buffer-identification '("Liece: ")) truncate-lines t buffer-read-only t) (use-local-map liece-channel-list-mode-map) @@ -757,7 +729,7 @@ Instead, these commands are available: liece-current-chat-partners nil liece-current-chat-partner nil liece-timers-list-initialized-p nil - liece-friends-last nil + liece-last-friends nil liece-polling 0 liece-channel-indicator "No channel")) @@ -766,17 +738,13 @@ Instead, these commands are available: Optional argument TIMEOUT specifies connection timeout." (save-excursion (let ((status t) (wait t) (timeout (or timeout liece-connection-timeout))) - (set-buffer liece-server-buffer) + (set-buffer (process-buffer liece-server-process)) (with-timeout (timeout nil) (while wait (liece-accept-response) (goto-char (point-min)) (cond ((looking-at "ERROR") (setq status nil wait nil)) ((looking-at ".") (setq wait nil)))) - ;; Save status message. - (end-of-line) - (setq liece-status-message-string - (buffer-substring (point-min) (point))) (when status (while wait (goto-char (point-max)) @@ -792,19 +760,15 @@ Optional argument TIMEOUT specifies connection timeout." "Wait for output from PROCESS and message some dots. Optional argument TIMEOUT specifies connection timeout." (save-excursion - (set-buffer liece-server-buffer) + (set-buffer (process-buffer liece-server-process)) (accept-process-output process (or timeout 1)))) (defun liece-accept-response () "Read response of server. Only used at startup time." (unless (liece-server-opened) - (cond - ((not liece-reconnect-automagic) - (error "Liece: Connection closed")) - (liece-grow-tail - (let ((liece-nickname (concat liece-nickname liece-grow-tail))) - (liece))) - (t (liece)))) + (if liece-reconnect-automagic + (liece) + (error "Liece: Connection closed"))) (condition-case code (liece-accept-process-output liece-server-process) (error (signal (car code) (cdr code))))) @@ -898,9 +862,7 @@ Only used from `liece-before-insert-functions'." liece-command-timestamp-if-interval-expired)) (defun liece-insert-internal (buffer string) - "Helper function only used from `liece-insert'. - -Insert before point of BUFFER STRING with decorating." + "Insert before point of BUFFER STRING with decorating." (run-hooks 'liece-before-insert-functions) (with-current-buffer (liece-get-buffer-create buffer) (or (eq (derived-mode-class major-mode) 'liece-dialogue-mode)