Commit 3e2acf3b authored by David Kågedal's avatar David Kågedal
Browse files

JySKom enhanced och buggfixar

parent 57dad81c
No preview for this file type
......@@ -475,7 +475,9 @@ of the person."
(conf-stat->name
(blocking-do 'get-conf-stat
lyskom-current-conf)))))
(or ccn ""))))
(if ccn
(cons ccn 0)
""))))
(lyskom-end-of-command)))
(defun lyskom-sub-member (pers conf)
......
......@@ -93,19 +93,23 @@
(props nil))
(while blist
(setq el (car blist))
(setq start 0)
(while (string-match (elt el 0) text start)
(if (elt el 1)
(setq props
(lyskom-default-button
(elt el 1)
(substring text
(match-beginning 0)
(match-end 0))))
(match-beginning 1)
(match-end 1))))
(setq props
(append (list 'mouse-2-action
(elt el 2)
'mouse-2-arg
(elt el 3))
(elt el 3)
;; Experiment /davidk
'lyskom-button-match-data
(match-data))
(elt el 4))))
(add-text-properties (match-beginning 0)
(match-end 0)
......@@ -167,7 +171,7 @@
(t 'kom-active-face))
'mouse-2-action 'lyskom-button-view-pres
'mouse-2-arg
(cons arg
(cons (if (stringp arg) (string-to-int arg) arg)
(if (and (boundp 'lyskom-buffer)
lyskom-buffer)
lyskom-buffer
......@@ -217,6 +221,8 @@
(kom-status-conf arg))))
(defun lyskom-button-view-pres (pos args)
"View the presentation to a conference.
The conferens is in the car of ARGS as either a conf-stat or an integer."
(let ((arg (car args))
(buf (cdr args)))
(if (not (buffer-name buf))
......@@ -224,13 +230,10 @@
(pop-to-buffer buf)
(unwind-protect
(lyskom-start-of-command 'kom-button-view-pres)
(let ((pres-no (cond ((integerp arg) arg)
((lyskom-conf-stat-p arg) (conf-stat->presentation arg))
(t -1)))
(conf-name (cond ((integerp arg)
(lyskom-format "%#1:M" arg))
((lyskom-conf-stat-p arg) (conf-stat->name arg))
(t (lyskom-get-string 'the-conf)))))
(let* ((conf-stat (if (lyskom-conf-stat-p arg) arg
(blocking-do 'get-conf-stat arg)))
(pres-no (conf-stat->presentation conf-stat))
(conf-name (conf-stat->name conf-stat)))
(cond ((= 0 pres-no) (lyskom-format-insert
'has-no-presentation conf-name))
((= -1 pres-no) (signal 'lyskom-internal-error
......@@ -531,5 +534,9 @@ ACTION and argument ARG added."
(lyskom-url-manager-starting manager)))))
;;;
;;; email buttons
;;;
(defun lyskom-button-send-mail (to)
(mail nil to))
No preview for this file type
......@@ -668,7 +668,7 @@ Args: TEXT-NO. Value: text-stat."
(lyskom-parse-vector (lyskom-parse-num) 'lyskom-parse-who-info))
(defun lyskom-init-parse ()
(defun lyskom-init-parse (buffer)
"Does all initialization of the parsing routines.
i.e creates the buffer, sets all markers and pointers."
(setq lyskom-is-parsing nil)
......@@ -681,9 +681,11 @@ i.e creates the buffer, sets all markers and pointers."
(lyskom-save-excursion
(let ((proc lyskom-proc))
(set-buffer lyskom-unparsed-buffer)
(make-local-variable 'lyskom-proc)
(make-local-variable 'lyskom-proc)
(make-local-variable 'lyskom-string-bytes-missing)
(setq lyskom-proc proc)
(make-local-variable 'lyskom-buffer)
(setq lyskom-buffer buffer)
(goto-char (point-max))
(point-marker)))))
......
......@@ -106,10 +106,10 @@ The defaults for this command is the conference that you are in."
; Since we fetch everything anyway we don't need to do this.
; If we later choose to fetch all in small chunks we will have
; to do this then.
; (if (not (zerop to))
; (cache-del-conf-stat to))
; (if (not (zerop by))
; (cache-del-pers-stat by))
(if (not (zerop to))
(cache-del-conf-stat to))
(if (not (zerop by))
(cache-del-pers-stat by))
(let* ((info-by (if (zerop by)
(lyskom-get-string 'anybody)
(blocking-do 'get-conf-stat by)))
......
......@@ -100,7 +100,7 @@ See lyskom-mode for details."
(set-process-sentinel proc 'lyskom-sentinel)
(save-excursion
(lyskom-init-parse))
(lyskom-init-parse buffer))
(setq lyskom-server-info (blocking-do 'get-server-info))
(lyskom-format-insert
......@@ -157,56 +157,65 @@ See lyskom-mode for details."
"Start as a new person."
(interactive)
(lyskom-start-of-command 'kom-start-anew)
(if first-time-around
nil
(lyskom-tell-internat 'kom-tell-login))
(setq lyskom-pers-no nil)
(while (not lyskom-pers-no)
(if (and first-time-around
lyskom-default-user-name)
(setq lyskom-pers-no ;; This is nil if we can't find a unique match.
(lyskom-read-conf-name-internal lyskom-default-user-name
'pers 'conf-no)))
(if lyskom-pers-no
nil
(setq lyskom-pers-no
(lyskom-read-conf-no (lyskom-get-string 'what-is-your-name)
'pers nil "")))
;; Now lyskom-pers-no contains a number of a person.
;; Lets log him in.
(let ((conf-stat (blocking-do 'get-conf-stat lyskom-pers-no)))
(lyskom-insert (concat (conf-stat->name conf-stat) "\n"))
(setq first-time-around nil)
(if (blocking-do 'login lyskom-pers-no
(if lyskom-default-password
(prog1
lyskom-default-password
(setq lyskom-default-password nil)
(set-default 'lyskom-default-password nil))
(silent-read (lyskom-get-string 'password))))
nil
(lyskom-insert-string 'wrong-password)
(setq lyskom-pers-no nil))))
;; Now we are logged in.
(lyskom-insert-string 'are-logged-in)
(let ((conf-stat (blocking-do 'get-conf-stat lyskom-pers-no)))
(if (and conf-stat
(/= (conf-stat->msg-of-day conf-stat) 0))
(let ((old-me lyskom-pers-no))
(unwind-protect
(progn
(lyskom-insert-string 'you-have-motd)
(lyskom-view-text (conf-stat->msg-of-day conf-stat))))
(if (and conf-stat
(zerop (conf-stat->presentation conf-stat))
(not (zerop (conf-stat->no-of-texts conf-stat))))
(lyskom-insert-string 'presentation-encouragement)))
(lyskom-read-options)
(lyskom-refetch)
;; (cache-initiate-who-info-buffer (blocking-do 'who-is-on))
(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))
(lyskom-end-of-command))
(if first-time-around
nil
(lyskom-tell-internat 'kom-tell-login))
(setq lyskom-pers-no nil)
(while (not lyskom-pers-no)
(if (and first-time-around
lyskom-default-user-name)
;; This is nil if we can't find a unique match.
(setq lyskom-pers-no
(lyskom-read-conf-name-internal lyskom-default-user-name
'pers 'conf-no)))
(if lyskom-pers-no
nil
(setq lyskom-pers-no
(lyskom-read-conf-no (lyskom-get-string 'what-is-your-name)
'pers nil "")))
;; Now lyskom-pers-no contains a number of a person.
;; Lets log him in.
(let ((conf-stat (blocking-do 'get-conf-stat lyskom-pers-no)))
(lyskom-insert (concat (conf-stat->name conf-stat) "\n"))
(setq first-time-around nil)
(if (blocking-do 'login lyskom-pers-no
(if lyskom-default-password
(prog1
lyskom-default-password
(setq lyskom-default-password nil)
(set-default 'lyskom-default-password
nil))
(silent-read (lyskom-get-string 'password))))
nil
(lyskom-insert-string 'wrong-password)
(setq lyskom-pers-no nil))))
;; Now we are logged in.
(lyskom-insert-string 'are-logged-in)
(let ((conf-stat (blocking-do 'get-conf-stat lyskom-pers-no)))
(if (and conf-stat
(/= (conf-stat->msg-of-day conf-stat) 0))
(progn
(lyskom-insert-string 'you-have-motd)
(lyskom-view-text (conf-stat->msg-of-day conf-stat))))
(if (and conf-stat
(zerop (conf-stat->presentation conf-stat))
(not (zerop (conf-stat->no-of-texts conf-stat))))
(lyskom-insert-string 'presentation-encouragement)))
(lyskom-read-options)
(lyskom-refetch)
;; (cache-initiate-who-info-buffer (blocking-do 'who-is-on))
(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)))
;; If something failed, make sure we are someone
(if (null lyskom-pers-no) (setq lyskom-pers-no old-me))
(lyskom-end-of-command))))
(defun lyskom-refetch ()
......@@ -460,6 +469,7 @@ to see, set of call."
(server-name lyskom-server-name)
)
(kill-all-local-variables)
(make-local-variable 'lyskom-buffer)
(make-local-variable 'lyskom-blocking-return)
(make-local-variable 'lyskom-unparsed-buffer)
(make-local-variable 'lyskom-unparsed-marker)
......
......@@ -187,22 +187,33 @@ the last message received. Nil means default is everybody.")
various LysKOM elements.")
(defvar kom-text-buttons
'(("\\(file\\|ftp\\|gopher\\|http\\|https\\|news\\|wais\\|www\\|mailto\\|telnet\\):\\(//\\)?[^\t \012 \"<>|\\]*[^\t \012 \"<>|.,!(){}?'`]"
'(;; Ugly text number buttons. Has to come first.
("\\([0-9][0-9][0-9][0-9][0-9]*\\)"
text
nil
nil
nil)
;; URL
("\\(file\\|ftp\\|gopher\\|http\\|https\\|news\\|wais\\|www\\|mailto\\|telnet\\):\\(//\\)?[^\t \012 \"<>|\\]*[^\t \012 \"<>|.,!(){}?'`]"
nil
lyskom-button-follow-url
nil
(face kom-url-face mouse-face kom-highlight-face))
("[0-9][0-9][0-9][0-9][0-9]*"
text
nil
nil
nil))
;; Let's be JySKom enhanced
("<(m[|ö]te *\\([0-9]+\\)[^0-9]*)>"
conf nil nil nil)
("<(text *\\([0-9]+\\)[^0-9]*)>"
text nil nil nil)
("<(person *\\([0-9]+\\)[^0-9]*)>"
pers nil nil nil)
)
"*List of buttons to look for in texts.
Each element is a list of (REGEXP TYPE FUNCTION PROPS) where REGEXP is the
regular expression to look for, TYPE is the type of button or nil, FUNCTION
is the function to call (or nil for typed buttons) and PROPS is a list of
"*List of buttons to look for in texts. Each element is a list of
(REGEXP TYPE FUNCTION ARGS PROPS) where REGEXP is the regular
expression to look for, TYPE is the type of button or nil, FUNCTION is
the function to call (or nil for typed buttons) and PROPS is a list of
text properties to add (or nil for typed buttons).
Button types may be conf, text or pers.")
......
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