(liece-open-server-internal): Simplify; Don't use
authorueno <ueno>
Mon, 11 Sep 2000 03:01:03 +0000 (03:01 +0000)
committerueno <ueno>
Mon, 11 Sep 2000 03:01:03 +0000 (03:01 +0000)
`liece-get-buffer-create' to prepare process-buffer.

lisp/ChangeLog
lisp/liece.el

index 957dd20..3925b7d 100644 (file)
@@ -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.
 
index dfc57fa..7604c75 100644 (file)
@@ -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."