Commit 2b538300 authored by David Kågedal's avatar David Kågedal
Browse files

No commit message

No commit message
parent 7479f02e
No preview for this file type
...@@ -55,9 +55,9 @@ See lyskom-mode for details." ...@@ -55,9 +55,9 @@ See lyskom-mode for details."
(run-hooks 'lyskom-init-hook) (run-hooks 'lyskom-init-hook)
(setq username (setq username
(if username username (getenv "KOMNAME"))) (or username (getenv "KOMNAME")))
(setq password (setq password
(if password password (getenv "KOMPASSWORD"))) (or password (getenv "KOMPASSWORD")))
(if (zerop (length host)) (if (zerop (length host))
(setq host (or (getenv "KOMSERVER") (setq host (or (getenv "KOMSERVER")
lyskom-default-server))) lyskom-default-server)))
...@@ -72,62 +72,64 @@ See lyskom-mode for details." ...@@ -72,62 +72,64 @@ See lyskom-mode for details."
(t (t
(setq host (substring host 0 (match-beginning 0))))))) (setq host (substring host 0 (match-beginning 0)))))))
(unwind-protect (let* ((buffer (generate-new-buffer host))
(let* ((buffer (generate-new-buffer host)) (name (buffer-name buffer))
(name (buffer-name buffer)) (proc nil))
(proc (open-network-stream name buffer host port))) (unwind-protect
(switch-to-buffer buffer) (progn
(lyskom-mode) ;Clearing lyskom-default... (setq proc (open-network-stream name buffer host port))
(setq kom-buffer buffer) (switch-to-buffer buffer)
(setq lyskom-default-user-name username) (lyskom-mode) ;Clearing lyskom-default...
(setq lyskom-default-password password) (setq kom-buffer buffer)
(setq lyskom-server-name host) (setq lyskom-default-user-name username)
(setq lyskom-proc proc) (setq lyskom-default-password password)
(lyskom-insert (setq lyskom-server-name host)
(lyskom-format 'try-connect lyskom-clientversion host)) (setq lyskom-proc proc)
(set-process-filter proc 'lyskom-connect-filter) (lyskom-insert
(lyskom-process-send-string proc (lyskom-format 'try-connect lyskom-clientversion host))
(concat "A" (set-process-filter proc 'lyskom-connect-filter)
(lyskom-format-objects (lyskom-process-send-string proc
(concat (user-login-name) (concat "A"
"%" (system-name))))) (lyskom-format-objects
(while (eq 'lyskom-connect-filter (process-filter proc)) (concat (user-login-name)
(accept-process-output proc)) "%" (system-name)))))
; Now we have gotten the correct response. (while (eq 'lyskom-connect-filter (process-filter proc))
(accept-process-output proc))
(set-process-sentinel proc 'lyskom-sentinel) ;; Now we have got the correct response.
(set-process-sentinel proc 'lyskom-sentinel)
(save-excursion
(lyskom-init-parse)) (save-excursion
(lyskom-init-parse))
(setq lyskom-server-info (blocking-do 'get-server-info))
(lyskom-format-insert (setq lyskom-server-info (blocking-do 'get-server-info))
'connection-done (lyskom-format-insert
(if (zerop (% (server-info->version lyskom-server-info) 100)) 'connection-done
(format "%d.%d" (if (zerop (% (server-info->version lyskom-server-info) 100))
(format "%d.%d"
(/ (server-info->version lyskom-server-info) 10000)
(/ (% (server-info->version lyskom-server-info) 10000)
100))
(format "%d.%d.%d"
(/ (server-info->version lyskom-server-info) 10000) (/ (server-info->version lyskom-server-info) 10000)
(/ (% (server-info->version lyskom-server-info) 10000) (/ (% (server-info->version lyskom-server-info) 10000)
100)) 100)
(format "%d.%d.%d" (% (server-info->version lyskom-server-info) 100))))
(/ (server-info->version lyskom-server-info) 10000) (if (not (zerop (server-info->motd-of-lyskom lyskom-server-info)))
(/ (% (server-info->version lyskom-server-info) 10000) (lyskom-insert
100) (text->text-mass
(% (server-info->version lyskom-server-info) 100)))) (blocking-do 'get-text
(if (not (zerop (server-info->motd-of-lyskom lyskom-server-info))) (server-info->motd-of-lyskom
(lyskom-insert lyskom-server-info)))))
(text->text-mass ;; Can't use lyskom-end-of-command here.
(blocking-do 'get-text (setq lyskom-executing-command nil)
(server-info->motd-of-lyskom lyskom-server-info)))))
;; Can't use lyskom-end-of-command here.
(setq lyskom-executing-command nil)
;;; B|rja ;;; B|rja
(kom-start-anew t) (kom-start-anew t)
(setq init-done t)) (setq init-done t))
;; Something went wrong. Lets cleanup everything. :-> ;; Something went wrong. Lets cleanup everything. :->
(if init-done (if init-done
nil nil
(delete-process (get-buffer-process (current-buffer))) (if proc (delete-process proc))
(kill-buffer (current-buffer)))))) (kill-buffer buffer))))))
(defun lyskom-connect-filter (proc output) (defun lyskom-connect-filter (proc output)
...@@ -201,6 +203,7 @@ See lyskom-mode for details." ...@@ -201,6 +203,7 @@ See lyskom-mode for details."
(lyskom-refetch) (lyskom-refetch)
;; (cache-initiate-who-info-buffer (blocking-do 'who-is-on)) ;; (cache-initiate-who-info-buffer (blocking-do 'who-is-on))
(cache-set-marked-texts (blocking-do 'get-marks)) (cache-set-marked-texts (blocking-do 'get-marks))
;; What is this variable? It is never used. It is ust to fill the cache?
(setq lyskom-who-am-i (blocking-do 'who-am-i)) (setq lyskom-who-am-i (blocking-do 'who-am-i))
(lyskom-end-of-command)) (lyskom-end-of-command))
......
...@@ -329,7 +329,7 @@ Args: TEXT-STAT TEXT MARK-AS-READ TEXT-NO." ...@@ -329,7 +329,7 @@ Args: TEXT-STAT TEXT MARK-AS-READ TEXT-NO."
(setq t2 (point-max))) (setq t2 (point-max)))
(t ;No \n found. Don't print header. (t ;No \n found. Don't print header.
(setq s1 (point-max)) (setq s1 (point-max))
(lyskom-format-insert "%#1t" body) (lyskom-format-insert "%#1t" str)
(setq s2 (point-max)) (setq s2 (point-max))
(setq t1 (point-max) (setq t1 (point-max)
t2 (point-max)) t2 (point-max))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment