From: ueno Date: Mon, 11 Sep 2000 03:01:03 +0000 (+0000) Subject: (liece-open-server-internal): Simplify; Don't use X-Git-Tag: liece-1_4_4-1~25 X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=17872ebc3ec538522b523987765204e7d92733ce;p=elisp%2Fliece.git (liece-open-server-internal): Simplify; Don't use `liece-get-buffer-create' to prepare process-buffer. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 957dd20..3925b7d 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -2,6 +2,8 @@ * liece.el (liece-clear-system): Call `liece-buffer-dispose-function' instead of burying buffer. + (liece-open-server-internal): Simplify; Don't use + `liece-get-buffer-create' to prepare process-buffer. * liece-vars.el (liece-buffer-dispose-function): New variable. diff --git a/lisp/liece.el b/lisp/liece.el index dfc57fa..7604c75 100644 --- a/lisp/liece.el +++ b/lisp/liece.el @@ -510,39 +510,29 @@ If optional argument SERVICE is non-nil, open by the service name." (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'." - (condition-case err + ;; canonicalize host representation + (unless (string-match "^[^\\[]" host) + (setq host (substring host 1 (1- (length host))))) + (condition-case error (save-excursion - ;; Initialize communication buffer. - (setq liece-server-buffer (liece-get-buffer-create " *IRC*")) - (set-buffer liece-server-buffer) - (set-buffer-multibyte nil) - (kill-all-local-variables) - (buffer-disable-undo) - (erase-buffer) - (cond - ((string-match "^[^\\[]" host) - (let ((liece-tcp-connection-type type)) - (as-binary-process - (setq liece-server-process - (liece-open-network-stream - "IRC" (current-buffer) host (or service "irc")))))) - ((not - (or - (string-match - "^\\[\\([0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+\\)\\]$" host) - (string-match - "^\\[\\([0-9A-Za-z]*:[0-9A-Za-z:]*\\)\\]$" host) - (string-match - "^\\[\\([0-9]+\\)\\]$" host))) - (setq liece-status-message-string - (_ "Use [nnn.nnn.nnn.nnn]") - liece-server-process nil))) - (setq liece-server-name host) - (run-hooks 'liece-server-hook) - ;; Return the server process. - liece-server-process) + (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 err)) nil))) + (setq liece-status-message-string (cadr err) + liece-server-process nil))))) (defun liece-initialize-timers () "Initialise internal timers."