Commit 03a47898 authored by Linus Tolke Y's avatar Linus Tolke Y

Login-procedure, messages (invalid %) and debug-communications.

parent b870ea84
No preview for this file type
......@@ -130,7 +130,7 @@ this function shall be with current-buffer the BUFFER."
(set-buffer buffer)
(if (and (not (lyskom-is-in-minibuffer))
kom-presence-messages)
(lyskom-message (lyskom-get-string 'database-sync)))
(lyskom-message "%s" (lyskom-get-string 'database-sync)))
(setq mode-line-process ": saving")
(set-buffer-modified-p (buffer-modified-p))
(sit-for 0)
......@@ -205,8 +205,8 @@ this function shall be with current-buffer the BUFFER."
(cond
((lyskom-is-in-minibuffer))
(kom-presence-messages
(lyskom-message (lyskom-format 'has-entered
(conf-stat->name conf-stat)))))
(lyskom-message "%s" (lyskom-format 'has-entered
(conf-stat->name conf-stat)))))
(cond
(kom-presence-messages-in-buffer
(lyskom-insert-before-prompt
......@@ -219,7 +219,8 @@ this function shall be with current-buffer the BUFFER."
(cond
((lyskom-is-in-minibuffer))
(kom-presence-messages
(lyskom-message (lyskom-format 'has-left (conf-stat->name conf-stat)))))
(lyskom-message "%s" (lyskom-format 'has-left
(conf-stat->name conf-stat)))))
(cond
(kom-presence-messages-in-buffer
(lyskom-insert-before-prompt
......@@ -346,8 +347,8 @@ The text is converted, before insertion."
(if (and (not no-message)
lyskom-is-waiting
(not (lyskom-is-in-minibuffer)))
(lyskom-message (lyskom-format 'text-is-created
(text-stat->text-no text-stat))))))
(lyskom-message "%s" (lyskom-format 'text-is-created
(text-stat->text-no text-stat))))))
(defun lyskom-async-new-text (text-stat)
......
......@@ -1463,7 +1463,7 @@ MARK: A number that is used as the mark."
(if (= mark 0)
(cache-del-marked-text text-no)
(cache-add-marked-text text-no mark)))
(lyskom-insert-string 'nope))
(lyskom-insert-string 'nope)) ;+++ lyskom-errno?
(lyskom-end-of-command))
......
......@@ -505,7 +505,7 @@ means send the message to everybody."
(lyskom-format 'message-sent-to-all string))
lyskom-pers-no)
(lyskom-insert-before-prompt
(lyskom-get-string 'message-nope)))
(lyskom-get-string 'message-nope))) ;+++ lyskom-errno
(lyskom-end-of-command))
......@@ -939,7 +939,7 @@ Format is 23:29 if the text is written today. Otherwise 04-01."
debugger-old-buffer
(void-variable (current-buffer))))
(repname "*lyskom-bugreport*"))
(lyskom-message (lyskom-get-string 'buggreport-compilestart))
(lyskom-message "%s" (lyskom-get-string 'buggreport-compilestart))
(set-buffer old-buf)
(cond
((eq old-buf (process-buffer lyskom-proc)))
......@@ -1008,7 +1008,7 @@ Format is 23:29 if the text is written today. Otherwise 04-01."
(goto-char (point-min))
(replace-regexp "byte-code(\".*\""
(lyskom-get-string 'buggreport-instead-of-byte-comp)))
(lyskom-message (lyskom-get-string 'buggreport-compileend))))
(lyskom-message "%s" (lyskom-get-string 'buggreport-compileend))))
; ;;; ================================================================
......@@ -1088,7 +1088,7 @@ Format is 23:29 if the text is written today. Otherwise 04-01."
(defun lyskom-set-garb-nice-2 (answer conf-stat)
"Get the answer from lyskom-set-garb-nice and report the result."
(if (not answer)
(lyskom-insert-string 'nope)
(lyskom-insert-string 'nope) ;+++lyskom-errno
(lyskom-insert-string 'done)
(cache-del-conf-stat (conf-stat->conf-no conf-stat)))
(lyskom-end-of-command))
......@@ -1172,7 +1172,7 @@ Args: SUPER-CONF CONF_STAT TYPE"
(defun lyskom-set-conf-for-conf-3 (answer conf-stat type)
"Get the answer from lyskom-set-conf-for-conf and report the result."
(if (not answer)
(lyskom-insert-string 'nope)
(lyskom-insert-string 'nope) ;+++ lyskom-errno
(lyskom-insert-string 'done)
(cache-del-conf-stat (conf-stat->conf-no conf-stat)))
(lyskom-end-of-command))
......@@ -1224,7 +1224,7 @@ Args: SUPER-CONF CONF_STAT TYPE"
(progn
(lyskom-format-insert 'you-are-now string)
(setq lyskom-is-administrator is-administrator))
(lyskom-insert-string 'nope))
(lyskom-insert-string 'nope)) ;+++ lyskom-errno
(lyskom-end-of-command))
......
......@@ -143,7 +143,7 @@ When C-G is pressed then lyskom-end-of-command is evaled."
((and (string= result "")
(eq control ?X))
(lyskom-message (concat prompt " " result " [Not sole completion]"))
(lyskom-message "%s" (concat prompt " " result " [Not sole completion]"))
(sit-for 2)
(lyskom-completing-read-2 kom-queue handler prompt type new empty result
data curwin))
......@@ -227,11 +227,11 @@ When C-G is pressed then lyskom-end-of-command is evaled."
what kom-queue handler prompt type new empty initial
data curwin))
(t
(lyskom-message (concat prompt initial
(if (= (length choice)
0)
" [No match]"
" [Next char not unique]")))
(lyskom-message "%s" (concat prompt initial
(if (= (length choice)
0)
" [No match]"
" [Next char not unique]")))
(sit-for 2)
(lyskom-completing-read-2 kom-queue handler prompt type new empty
initial data curwin)))))
......@@ -314,7 +314,7 @@ then completing and trying to read again."
((null (cdr conf-stats)) ;Sole completion.
(if (string= initial (conf-stat->name (car conf-stats)))
(progn
(lyskom-message (concat prompt initial " [Sole completion]"))
(lyskom-message "%s" (concat prompt initial " [Sole completion]"))
(sit-for 2)))
(lyskom-completing-read-2 kom-queue handler prompt type new empty
(conf-stat->name (car conf-stats))
......
......@@ -84,7 +84,7 @@ Does lyskom-end-of-command."
(setq lyskom-edit-handler-data data)
(setq lyskom-edit-return-to-configuration config)
(lyskom-edit-insert-miscs misc-list subject body)
(lyskom-message (lyskom-get-string 'press-C-c-C-c)))
(lyskom-message "%s" (lyskom-get-string 'press-C-c-C-c)))
(set-buffer (process-buffer lyskom-proc)))
......@@ -399,7 +399,7 @@ Entry to this mode runs lyskom-edit-mode-hook."
(set-buffer buffer)
(sit-for 0))
(t
(lyskom-message (lyskom-get-string 'no-such-text-m))))))))
(lyskom-message "%s" (lyskom-get-string 'no-such-text-m))))))))
;;; ================================================================
......@@ -637,7 +637,7 @@ Point must be located on the line where the subject is."
(lyskom-format 'could-not-create-text lyskom-errno
(lyskom-get-error-text lyskom-errno)))
(beep)
(lyskom-message (lyskom-format 'could-not-create-text lyskom-errno
(lyskom-message "%s" (lyskom-format 'could-not-create-text lyskom-errno
(lyskom-get-error-text lyskom-errno)))
(set-buffer edit-buffer)
(setq mode-name lyskom-edit-mode-name)
......@@ -717,7 +717,7 @@ The text is inserted in the buffer with '>' first on each line."
(beginning-of-line)
(insert 62)
(backward-char 2))))
(lyskom-message (lyskom-get-string 'no-get-text))))
(lyskom-message "%s" (lyskom-get-string 'no-get-text))))
;;; ================================================================
......
......@@ -362,7 +362,9 @@ with big strings."
lyskom-debug-communications-to-buffer-buffer))
(save-excursion
(goto-char (point-max))
(insert (concat "Error: " (format "%s" err) "\n")))
(insert "\n"
(format "%s" process)
(concat "Error: " (format "%s" err))))
(set-buffer (process-buffer process))))
(cond
((and (string= "writing to process" (car (cdr err)))
......@@ -378,10 +380,10 @@ with big strings."
((and (string= "writing to process" (car (cdr err)))
(string= "host is unreachable" (car (cdr (cdr err)))))
;; The net is currently shaky. We try again in a while.
(lyskom-message (lyskom-format 'shaky-tcp
(make-string (++ tries) ?.)))
(lyskom-message "%s" (lyskom-format 'shaky-tcp
(make-string (++ tries) ?.)))
(sit-for 4)
(lyskom-message (lyskom-get-string 'retrying-tcp))
(lyskom-message "%s" (lyskom-get-string 'retrying-tcp))
t)
(t
......@@ -404,7 +406,9 @@ is sent with each packet. If STRING is longer it is splitted."
lyskom-debug-communications-to-buffer-buffer))
(save-excursion
(goto-char (point-max))
(insert (concat ">>>>>> " string "\n")))
(insert "\n"
(format "%s" process)
(concat ">>>>>> " string)))
(set-buffer (process-buffer process))))
string)))
(t
......@@ -422,7 +426,9 @@ is sent with each packet. If STRING is longer it is splitted."
lyskom-debug-communications-to-buffer-buffer))
(save-excursion
(goto-char (point-max))
(insert (concat ">>>>>> " string "\n")))
(insert "\n"
(format "%s" process)
(concat ">>>>>> " string)))
(set-buffer (process-buffer process))))
string))
(setq i (+ i lyskom-max-packet-size)))))))
......
No preview for this file type
......@@ -701,10 +701,11 @@ Args: TEXT-NO. Value: text-stat."
(defun lyskom-init-parse ()
"Does all initialization of the parsing routines.
i.e creates the buffer, sets all markers and pointers."
(setq lyskom-unparsed-buffer (generate-new-buffer
(concat " "
(buffer-name)
"-replies")))
(setq lyskom-unparsed-buffer
(generate-new-buffer
(concat (if lyskom-debug-communications-to-buffer "" " ")
(buffer-name)
"-replies")))
(setq lyskom-unparsed-marker
(lyskom-save-excursion
(let ((proc lyskom-proc))
......
......@@ -178,9 +178,9 @@ column, and can be inserted at another line with \\[kom-prioritize-yank]."
(beginning-of-line)
(cond
((< (count-lines (point-min) (point)) 2) ;In header?
(lyskom-error (lyskom-get-string 'too-high-goto-2)))
(lyskom-error "%s" (lyskom-get-string 'too-high-goto-2)))
((< (count-lines (point) (point-max)) 2)
(lyskom-error (lyskom-get-string 'too-low-go-up)))
(lyskom-error "%s" (lyskom-get-string 'too-low-go-up)))
((null count) ;Take care of interactive argument.
(setq count 1))
((numberp count))
......@@ -213,9 +213,9 @@ conferences (or as many as is on the stack, whichever is less)."
(interactive "P")
(cond
((null lyskom-prioritize-stack)
(lyskom-error (lyskom-get-string 'all-confs-popped)))
(lyskom-error "%s" (lyskom-get-string 'all-confs-popped)))
((< (count-lines (point-min) (point)) 2)
(lyskom-error (lyskom-get-string 'too-high-goto-2)))
(lyskom-error "%s" (lyskom-get-string 'too-high-goto-2)))
((null count) ;Interactive...
(setq count 1))
((numberp count))
......@@ -279,7 +279,7 @@ on the lines. Leaves point at the beginning of the moved line."
(defun lyskom-prioritize-handler (res)
"Arg: RES. Barf if RES is nil."
(or res (lyskom-error (lyskom-get-string 'prio-died))))
(or res (lyskom-error "%s" (lyskom-get-string 'prio-died))))
(defun kom-prioritize-quit ()
......@@ -302,9 +302,9 @@ on the lines. Leaves point at the beginning of the moved line."
(beginning-of-line)
(cond
((< (count-lines (point-min) (point)) 2)
(lyskom-error (lyskom-get-string 'too-high-goto-2)))
(lyskom-error "%s" (lyskom-get-string 'too-high-goto-2)))
((zerop (count-lines (point) (point-max)))
(lyskom-error (lyskom-get-string 'too-low-go-up)))
(lyskom-error "%s" (lyskom-get-string 'too-low-go-up)))
(t
(save-excursion
(let
......@@ -337,9 +337,9 @@ If optional argument REVERSE is non-nil move line down instead."
(beginning-of-line)
(cond
((< (count-lines (point-min) (point)) 2)
(lyskom-error (lyskom-get-string 'too-high-goto-2)))
(lyskom-error "%s" (lyskom-get-string 'too-high-goto-2)))
((zerop (count-lines (point) (point-max)))
(lyskom-error (lyskom-get-string 'too-low-go-up)))
(lyskom-error "%s" (lyskom-get-string 'too-low-go-up)))
((null count)
(setq count 1))
((numberp count))
......
......@@ -51,9 +51,9 @@ Optional arguments: HOST, USERNAME and PASSWORD."
nil
nil))
(setq lyskom-default-user-name
(setq username
(if username username (getenv "KOMNAME")))
(setq lyskom-default-password
(setq password
(if password password (getenv "KOMPASSWORD")))
(if (zerop (length host))
(setq host (or (getenv "KOMSERVER")
......@@ -68,19 +68,19 @@ Optional arguments: HOST, USERNAME and PASSWORD."
(t
(setq host (substring host 0 (match-beginning 0)))))))
(let* ((name (buffer-name
(generate-new-buffer
(concat "*"
(substring
host
(string-match "^[^.]*" host)
(match-end 0))
"*"))))
(proc (open-network-stream name name host port)))
(setq lyskom-debug-communications-to-buffer-buffer
(concat name "-debugs"))
(switch-to-buffer (process-buffer proc))
(lyskom-mode)
(let* ((buffer (generate-new-buffer
(concat "*"
(substring
host
(string-match "^[^.]*" host)
(match-end 0))
"*")))
(name (buffer-name buffer))
(proc (open-network-stream name buffer host port)))
(switch-to-buffer buffer)
(lyskom-mode) ;Clearing lyskom-default...
(setq lyskom-default-user-name username)
(setq lyskom-default-password password)
(setq lyskom-proc proc)
(lyskom-insert
(lyskom-format 'try-connect lyskom-clientversion host))
......@@ -96,28 +96,28 @@ Optional arguments: HOST, USERNAME and PASSWORD."
"Receive connection acknowledgement from server."
(sit-for 0)
(let ((cur (current-buffer)))
(set-buffer (process-buffer proc))
(cond
(lyskom-debug-communications-to-buffer
(set-buffer
(get-buffer-create lyskom-debug-communications-to-buffer-buffer))
(save-excursion
(goto-char (point-max))
(insert "-----> " output " <-----\n"))
(set-buffer (process-buffer proc))))
(cond
((string= output "LysKOM\n")
(lyskom-init-parse)
(set-process-filter proc 'lyskom-filter)
(set-process-sentinel proc 'lyskom-sentinel)
(setq lyskom-executing-command nil)
(setq lyskom-is-parsing nil)
(initiate-get-server-info 'main 'lyskom-store-server-info))
((string-match "\\`%%" output)
(lyskom-format-insert 'protocoll-error output)
(error "Protocol error. Servers says: %s" output))
(t))
(set-buffer cur)))
(unwind-protect
(progn
(set-buffer (process-buffer proc))
(if lyskom-debug-communications-to-buffer
(save-excursion
(set-buffer
(get-buffer-create lyskom-debug-communications-to-buffer-buffer))
(goto-char (point-max))
(insert "\n" (format "%s" proc) "-----> " output)))
(cond
((string= output "LysKOM\n")
(lyskom-init-parse)
(set-process-filter proc 'lyskom-filter)
(set-process-sentinel proc 'lyskom-sentinel)
(setq lyskom-executing-command nil)
(setq lyskom-is-parsing nil)
(initiate-get-server-info 'main 'lyskom-store-server-info))
((string-match "\\`%%" output)
(lyskom-format-insert 'protocoll-error output)
(error "Protocol error. Servers says: %s" output))
(t)))
(set-buffer cur))))
(defun lyskom-store-server-info (server-info)
......@@ -502,7 +502,6 @@ Entry to this mode runs lyskom-mode-hook."
(defun lyskom-clear-vars ()
"Set up buffer-local vars."
(let ((proc lyskom-proc)
(ref-no lyskom-ref-no)
(pers-no lyskom-pers-no)
(membership lyskom-membership)
(membership-is-read lyskom-membership-is-read)
......@@ -517,7 +516,6 @@ Entry to this mode runs lyskom-mode-hook."
(make-local-variable 'lyskom-is-writing)
(make-local-variable 'lyskom-pending-calls)
(make-local-variable 'lyskom-number-of-pending-calls)
(make-local-variable 'lyskom-ref-no)
(make-local-variable 'lyskom-errno)
(make-local-variable 'lyskom-pers-no)
(make-local-variable 'lyskom-session-no)
......@@ -527,6 +525,8 @@ Entry to this mode runs lyskom-mode-hook."
(make-local-variable 'lyskom-text-cache)
(make-local-variable 'lyskom-text-mass-cache)
(make-local-variable 'lyskom-server-info)
(make-local-variable 'lyskom-default-user-name)
(make-local-variable 'lyskom-default-password)
(make-local-variable 'lyskom-who-info-cache)
(make-local-variable 'lyskom-who-info-buffer)
(make-local-variable 'lyskom-who-info-buffer-is-on)
......@@ -562,10 +562,9 @@ Entry to this mode runs lyskom-mode-hook."
(make-local-variable 'lyskom-do-when-starting)
(make-local-variable 'lyskom-do-when-done)
(make-local-variable 'mode-line-conf-name)
(make-local-variable 'lyskom-debug-communications-to-buffer)
(make-local-variable 'lyskom-debug-communications-to-buffer-buffer)
(make-local-variable 'lyskom-output-queue)
(make-local-variable 'lyskom-options-done)
(setq lyskom-proc proc)
(setq lyskom-ref-no ref-no)
(setq lyskom-pers-no pers-no)
(setq lyskom-membership membership)
(setq lyskom-last-viewed last-viewed)
......
......@@ -486,7 +486,7 @@ kom-go-to-next-conf might go to the same conference again.)")
"Non-nil means all communications with the server is stored in a buffer.
The name is stored in lyskom-debug-communications-to-buffer-buffer.")
(defvar lyskom-debug-communications-to-buffer-buffer nil
(defvar lyskom-debug-communications-to-buffer-buffer "*kom*-debugs"
"Name of the buffer to insert the communications with the server into if
lyskom-debug-communications-to-buffer is non-nil.")
......
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