- (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