From: ueno Date: Mon, 18 Sep 2000 03:13:59 +0000 (+0000) Subject: Synch up with `liece-1_4_4-2'. X-Git-Tag: liece-2_0_0-pre1~25 X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cf551b9bae6cd424f9dc902e94e67b4178f60a4c;p=elisp%2Fliece.git Synch up with `liece-1_4_4-2'. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index a1eb7e5..7814beb 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,20 @@ +2000-09-18 Daiki Ueno + + * liece-vars.el (liece-channel-buffer-mode): Set default to t. + (liece-nick-buffer-mode): Ditto. + (liece-channel-list-buffer-mode): Ditto. + + * liece.el (liece-open-server-internal): Simplify. + (liece-open-server): Strip bracketed server name here. + (liece-start-server): Fix last change. + +2000-09-17 Daiki Ueno + + * liece-vars.el (liece-highlight-mode): Set default to t. + + * liece.el (liece-open-server): Simplify. + (liece-start-server): Canonicalize `liece-server' here. + 2000-09-17 Akira Ohashi * liece-menu.el (liece-menu-channel-menu): Move `liece-command-freeze' diff --git a/lisp/liece-vars.el b/lisp/liece-vars.el index 0f15e44..43a1442 100644 --- a/lisp/liece-vars.el +++ b/lisp/liece-vars.el @@ -381,7 +381,7 @@ Otherwise you might get killed again if automagic reconnect is too fast." :group 'liece-hook) ;; Channel buffers. -(defcustom liece-channel-buffer-mode nil +(defcustom liece-channel-buffer-mode t "When non-nil, liece will display a channel buffer." :type 'boolean :group 'liece-look) @@ -419,7 +419,7 @@ Otherwise you might get killed again if automagic reconnect is too fast." :group 'liece-partner) ;; Nick buffers. -(defcustom liece-nick-buffer-mode nil +(defcustom liece-nick-buffer-mode t "When non-nil, liece will display a nick list buffer." :type 'boolean :group 'liece-look) @@ -435,7 +435,7 @@ Otherwise you might get killed again if automagic reconnect is too fast." :group 'liece-look) ;; Channel list buffer. -(defcustom liece-channel-list-buffer-mode nil +(defcustom liece-channel-list-buffer-mode t "When non-nil, liece will display a channel list buffer." :type 'boolean :group 'liece-look) @@ -446,7 +446,7 @@ Otherwise you might get killed again if automagic reconnect is too fast." :group 'liece-look) ;; Highlight. -(defcustom liece-highlight-mode nil +(defcustom liece-highlight-mode t "If non nil, IRC buffer is highlighted by specific rule." :type 'boolean :group 'liece-highlight) diff --git a/lisp/liece.el b/lisp/liece.el index 81bbe9e..a9c3e05 100644 --- a/lisp/liece.el +++ b/lisp/liece.el @@ -339,32 +339,27 @@ Return non-nil if stream is opened." "Open network stream to remote irc server. If optional argument CONFIRM is non-nil, ask the host that the server is running on." - (if (liece-server-opened) - ;; Stream is already opened. - nil - ;; Open IRC server. - (when (or confirm (null liece-server)) - (setq liece-server - (completing-read (_ "IRC server: ") liece-server-alist))) - (and confirm - liece-ask-for-nickname - (setq liece-nickname - (read-string (_ "Enter your nickname: ") liece-nickname))) - ;; If no server name is given, local host is assumed. - (and - (stringp liece-server) - (string-equal liece-server "") - (setq liece-server (system-name))) - (let ((host (liece-server-host))) - (liece-message - (_ "Connecting to IRC server on %s...") host) - (cond - ((liece-open-server liece-server liece-service)) - ((and (stringp liece-status-message-string) - (> (length liece-status-message-string) 0)) - ;; Show valuable message if available. - (error liece-status-message-string)) - (t (error (_ "Cannot open IRC server on %s") host)))))) + (when (or confirm + (null (or liece-server + (setq liece-server (getenv "IRCSERVER"))))) + (setq liece-server (completing-read (_ "IRC server: ") liece-server-alist))) + (unless (listp liece-server) + (let ((entry (assoc liece-server liece-server-alist))) + (if entry + (if (listp (cdr entry)) + (setq liece-server (cdr entry)) + (setq liece-server (liece-server-parse-string (cdr entry)))) + (let ((plist (liece-server-parse-string liece-server))) + (set-alist 'liece-server-alist liece-server plist) + (setq liece-save-variables-are-dirty t) + (setq liece-server plist))))) + (when (or (and confirm liece-ask-for-nickname) + (null liece-nickname)) + (setq liece-nickname (read-string (_ "Enter your nickname: ") liece-nickname))) + (let ((host (liece-server-host))) + (liece-message + (_ "Connecting to IRC server on %s...") host) + (liece-open-server liece-server liece-service))) (defun liece-close-server-internal () "Close connection to chat server." @@ -404,9 +399,9 @@ the `liece-server-keyword-map' variable." (lambda (keyword) (list (intern (substring (symbol-name (car keyword)) 1)) (if (cadr keyword) - `(or (plist-get plist ',(car keyword)) + `(or (plist-get ,plist ',(car keyword)) ,(cadr keyword)) - `(plist-get plist ',(car keyword))))) + `(plist-get ,plist ',(car keyword))))) liece-server-keyword-map) ,@body)) @@ -435,103 +430,71 @@ the `liece-server-keyword-map' variable." "Open chat server on HOST. If HOST is nil, use value of environment variable \"IRCSERVER\". If optional argument SERVICE is non-nil, open by the service name." - (let* ((host (or host (getenv "IRCSERVER"))) - (plist - (if (listp host) - host - (or (cdr (string-assoc-ignore-case host liece-server-alist)) - (liece-server-parse-string host)))) - status) - (setq liece-status-message-string "") - (when (stringp plist) ;; Old style server entry... - (setq plist (liece-server-parse-string host))) - (when (and (stringp host) - (null (string-assoc-ignore-case host liece-server-alist))) - (push (cons host plist) liece-server-alist) - (setq liece-save-variables-are-dirty t)) - (liece-server-keyword-bind plist - ;; Execute preconnecting script - (when prescript - (if (fboundp prescript) - (funcall prescript) - (call-process shell-file-name nil nil nil - shell-command-switch prescript)) - (when prescript-delay - (sleep-for prescript-delay))) - (if password - (setq liece-ask-for-password nil - liece-password password)) - (if (and (memq type '(rlogin telnet)) relay) - (setq liece-tcp-relay-host relay)) - (setq liece-tmp-server-name host);; temporary - (liece-message (_ "Connecting to IRC server %s...") host) - (cond - ((null host) - (setq liece-status-message-string - (_ "IRC server is not specified."))) - ((liece-open-server-internal host service type) - (setq liece-after-registration nil) - (liece-maybe-poll) - (setq status (liece-wait-for-response "^:[^ ]+ [4P][5O][1N][ G]")) - (if (null status) - (progn - (setq liece-status-message-string - (format (_ "Connection to %s timed out") host)) - ;; We have to close connection here, since the function - ;; `liece-server-opened' may return incorrect status. - (liece-close-server-internal)) - (setq liece-after-registration t) - (set-process-sentinel liece-server-process 'liece-sentinel) - (set-process-filter liece-server-process 'liece-filter) - (if (or liece-ask-for-password liece-reconnect-with-password) - (let ((passwd-echo ?*) password) - (setq password (read-passwd (_ "Server Password: "))) - (or (string= password "") - (setq liece-password password)))) - (if liece-password - (liece-send "PASS %s" liece-password)) - (setq liece-reconnect-with-password nil) - (liece-send "USER %s * * :%s" - (or (user-real-login-name) "Nobody") - (if (and liece-name (not (string= liece-name ""))) - liece-name - "No Name")) - (or liece-real-nickname - (setq liece-real-nickname liece-nickname)) + (liece-server-keyword-bind host + (when prescript + (if (fboundp prescript) + (funcall prescript) + (call-process shell-file-name nil nil nil + shell-command-switch prescript)) + (when prescript-delay + (sleep-for prescript-delay))) + (if password + (setq liece-ask-for-password nil + 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-maybe-poll) + (if (null (liece-wait-for-response "^:[^ ]+ [4P][5O][1N][ G]")) + (progn + ;; We have to close connection here, since the function + ;; `liece-server-opened' may return incorrect status. + (liece-close-server-internal) + (error (_ "Connection to %s timed out") host)) + (set-process-sentinel liece-server-process 'liece-sentinel) + (set-process-filter liece-server-process 'liece-filter) + (if (or liece-ask-for-password liece-reconnect-with-password) + (let ((passwd-echo ?*) password) + (setq password (read-passwd (_ "Server Password: "))) + (or (string= password "") + (setq liece-password password)))) + (if liece-password + (liece-send "PASS %s" liece-password)) + (setq liece-reconnect-with-password nil) + (liece-send "USER %s * * :%s" + (or (user-real-login-name) "Nobody") + (if (and liece-name (not (string= liece-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 liece-real-nickname liece-nick-max-length) - liece-nickname-last liece-real-nickname - liece-nick-accepted 'sent - liece-after-registration t) - (liece-send "NICK %s" liece-real-nickname))))) - status)) + (truncate-string liece-nickname liece-nick-max-length))) + (setq liece-nickname-last liece-real-nickname + liece-nick-accepted 'sent + liece-after-registration t)))) (defun liece-open-server-internal (host &optional service type) "Open connection to chat server on HOST by SERVICE (default is irc). Optional argument TYPE specifies connection types such as `program'." - ;; canonicalize host representation - (unless (string-match "^[^\\[]" host) - (setq host (substring host 1 (1- (length host))))) - (condition-case error - (save-excursion - (let ((liece-tcp-connection-type type)) - (as-binary-process - (setq liece-server-process - (liece-open-network-stream - "IRC" " *IRC*" host (or service "irc")))) - (setq liece-server-buffer (process-buffer liece-server-process)) - (set-buffer liece-server-buffer) - (set-buffer-multibyte nil) - (kill-all-local-variables) - (buffer-disable-undo) - (erase-buffer) - (setq liece-server-name host) - (run-hooks 'liece-server-hook) - ;; return the server process - liece-server-process)) - (error - (setq liece-status-message-string (cadr error) - liece-server-process nil)))) + (let ((liece-tcp-connection-type type) + process) + (as-binary-process + (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-multibyte nil) + (kill-all-local-variables) + (buffer-disable-undo) + (erase-buffer)) + process)) (defun liece-initialize-timers () "Initialise internal timers." @@ -596,7 +559,8 @@ If already connected, just pop up the windows." (liece-get-buffer-create liece-command-buffer)) (unless (eq major-mode 'liece-command-mode) (liece-command-mode)) - (liece-start-server confirm)) + (unless (liece-server-opened) + (liece-start-server confirm))) (if (not (liece-server-opened)) (liece-command-quit) ;; IRC server is successfully open.