* liece-compat.el (liece-region-active-p): New function.
(liece-truncate-string-to-width): New function.
* liece-misc.el: Sort macrodefs.
(liece-maybe-poll): Abolish.
* liece-channel.el (liece-channel-last): Simplified.
(liece-channel-switch-to-last): Define as function.
* liece-commands.el (liece-command-ping): Send system-name until
liece-server-name is determined.
* liece-ctcp.el: Load `liece-q-*' even when compiling.
* liece-hilit.el (liece-highlight-turn-on-font-lock): Don't set
font-lock-support-mode if it isn't bound.
"Convert xbm FILE into icon format and return the list of spec and buffers."
(with-temp-buffer
(erase-buffer)
- (let ((case-fold-search t) width height xbytes right margin)
+ (let ((case-fold-search t) width height
+ ;;xbytes right margin
+ )
(insert-file-contents file)
(goto-char (point-min))
(or (re-search-forward "_width[\t ]+\\([0-9]+\\)" nil t)
(error "!! Illegal xbm file format" (current-buffer)))
(setq width (string-to-int (match-string 1))
- xbytes (/ (+ width 7) 8))
+ ;;xbytes (/ (+ width 7) 8)
+ )
(goto-char (point-min))
(or (re-search-forward "_height[\t ]+\\([0-9]+\\)" nil t)
(error "!! Illegal xbm file format" (current-buffer)))
(or (string-equal liece-away-indicator "A")
(return-from liece-handle-305-message))
(setq liece-away-indicator "-")
- (liece-maybe-poll)
+ (liece-command-ping)
(when (string-match "[^:]:\\(.*\\)" rest)
(setq rest (match-string 1 rest))
(liece-insert-info liece-300-buffer
(defun liece-handle-442-message (prefix rest)
"ERR_NOTONCHANNEL \"<channel> :You're not on that channel\"."
(if (string-match "[^ ]+ \\([^ ]+\\) +:\\(.*\\)" rest)
- (let* ((chnl (liece-channel-virtual (match-string 1 rest)))
- (rest (match-string 2 rest)))
+ (let ((chnl (liece-channel-virtual (match-string 1 rest)))
+ ;;(rest (match-string 2 rest))
+ )
(if (liece-channel-member chnl liece-current-channels)
(liece-channel-part chnl)
(liece-message (_ "You're not on channel %s") chnl)))))
"ERR_USERONCHANNEL \"<channel> <nickname> :is already on channel\"."
(if (string-match "[^ ]+ \\([^ ]+\\) \\([^ ]+\\)" rest)
(let ((chnl (match-string 1 rest))
- (rest (match-string 2 rest)))
+ ;;(rest (match-string 2 rest))
+ )
(when (prog1 (liece-channel-p chnl)
(setq chnl (liece-channel-virtual chnl)))
(or (liece-channel-member chnl liece-current-channels)
(y-or-n-p (format "Do you really join %s? " chnl)))
(liece-command-join chnl))))
-;;; Reader conventions
(defun liece-channel-p (chnl)
(string-match
(eval-when-compile
(liece-channel-switch-to-last liece-current-channels)))))
(defun liece-channel-last (chnls)
- (car (last (delq nil (copy-sequence chnls)))))
+ (car (last chnls)))
-(defmacro liece-channel-switch-to-last (chnls)
- `(let ((chnl (liece-channel-last ,chnls)))
- (if chnl
- (liece-switch-to-channel chnl))
- (liece-channel-change)))
+(defun liece-channel-switch-to-last (chnls)
+ (let ((chnl (liece-channel-last chnls)))
+ (if chnl
+ (liece-switch-to-channel chnl))
+ (liece-channel-change)))
(defun liece-channel-change ()
(let ((chnls (if (eq liece-command-buffer-mode 'chat)
"Send MESSAGE to current chat partner of current channel."
(if (string-equal message "")
(progn (liece-message (_ "No text to send")) nil)
- (let ((addr (if (eq liece-command-buffer-mode 'chat)
- liece-current-chat-partner
- liece-current-channel))
- repr method name target)
+ (let (repr method target)
(cond
((eq liece-command-buffer-mode 'chat)
(or liece-current-chat-partner
(setq repr (liece-channel-parse-representation
liece-current-chat-partner)
method (aref repr 0)
- name (aref repr 1)
+ ;; name (aref repr 1)
target (aref repr 2))
(cond ((eq method 'dcc)
(liece-dcc-chat-send target message))
(defun liece-command-nickname (nick)
"Set your nickname to NICK."
(interactive "sEnter your nickname: ")
- (let ((nickname (truncate-string nick liece-nick-max-length)))
+ (let ((nickname (liece-truncate-string-to-width nick liece-nick-max-length)))
(if (zerop (length nickname))
(liece-message (_ "illegal nickname \"%s\"; not changed") nickname)
(liece-send "NICK %s" nick))))
(defun liece-command-ping ()
"Send PING to server."
(interactive)
- (if (stringp liece-server-name)
- (liece-send "PING %s" liece-server-name)))
+ (liece-send "PING %s"
+ (if (stringp liece-server-name)
+ liece-server-name
+ (system-name))))
(defun liece-command-ison (nicks)
"IsON users NICKS."
(defun liece-command-tag-region (start end)
"Move current region between START and END to `kill-ring'."
(interactive
- (if (region-active-p)
+ (if (liece-region-active-p)
(list (region-beginning)(region-end))
(list (line-beginning-position)(line-end-position))))
(static-if (fboundp 'extent-property)
(defalias 'liece-widget-convert-button 'widget-convert-button)
(defalias 'liece-widget-button-click 'widget-button-click)
-(defun-maybe region-active-p ()
- "Return non-nil if the region is active.
+(static-if (fboundp 'region-active-p)
+ (defalias 'liece-region-active-p 'region-active-p)
+ (defun liece-region-active-p ()
+ "Return non-nil if the region is active.
If `zmacs-regions' is true, this is equivalent to `region-exists-p'.
Otherwise, this function always returns false.
\[XEmacs emulating function]"
- (static-if (and (boundp 'transient-mark-mode) (boundp 'mark-active))
- (and transient-mark-mode mark-active)))
+ (and transient-mark-mode mark-active)))
(defun liece-map-overlays (function)
"Map FUNCTION over the extents which overlap the current buffer."
(setq dir-list (cdr dir-list))))
dir))
+(static-if (fboundp 'truncate-string-to-width)
+ (defalias 'liece-truncate-string-to-width 'truncate-string-to-width)
+ (defalias 'liece-truncate-string-to-width 'truncate-string))
+
(defvar-maybe completion-display-completion-list-function
'display-completion-list)
(require 'pccl)
-(or (broken-p 'ccl-usable) (require 'liece-q-ccl nil 'noerror)
- (require 'liece-q-el))
+(eval-and-compile
+ (or (broken-p 'ccl-usable) (require 'liece-q-ccl nil 'noerror)
+ (require 'liece-q-el)))
(require 'liece-x-face)
(defun liece-handle-ping-message (prefix rest)
(liece-send "PONG :%s" rest)
(liece-command-timestamp-if-interval-expired t)
- (liece-maybe-poll))
+ (liece-command-ping))
(defun liece-handle-wall-message (prefix rest)
(liece-insert-broadcast (append liece-D-buffer liece-O-buffer)
(defun liece-handler-unify-argument-list-function (args unifiers)
(let ((index 0)
(unfs (copy-alist unifiers))
- (len (length args))
- type)
+ (len (length args)))
(setq unfs
(remove-if (lambda (unf) (/= (length (cdr unf)) len)) unfs))
(dolist (arg args)
(setq font-lock-defaults '(liece-highlight-font-lock-keywords t))
(make-local-variable 'font-lock-verbose)
(setq font-lock-verbose nil)
- (make-local-variable 'font-lock-support-mode)
- (setq font-lock-support-mode nil)
+ (static-when (boundp 'font-lock-support-mode)
+ (make-local-variable 'font-lock-support-mode)
+ (setq font-lock-support-mode nil))
(make-local-hook 'font-lock-mode-hook)
(setq font-lock-mode-hook nil)
(turn-on-font-lock)
(defun liece-highlight-colorize-quote (st nd len)
(save-excursion
(goto-char st)
- (let (num face faces vender name ovl)
+ (let (num face faces vender ovl)
(while (re-search-forward "\\([\003\013][0-9:;<=]+\\)\\([^\002\026\037\003\013]*\\)" nd t)
(setq ovl (make-overlay (match-beginning 2) (match-end 2))
num (match-string 1)
(or (car-safe y) y))))))))))
(defun liece-minibuffer-complete-channel-modes ()
- (let* ((preceding-char (char-before)) completion candidate all
- (modes (mapconcat
+ (let* ((modes (mapconcat
(function car)
liece-supported-channel-mode-alist ""))
(nicks (liece-channel-get-nicks))
+ completion candidate all
uahs
(context (liece-minibuffer-parse-modes))
(state (car context)) (type (cdr context)))
(eval-when-compile
(autoload '_ "liece-intl" nil nil 'macro))
+(defmacro liece-insert-change (buffer msg)
+ `(liece-insert ,buffer (concat liece-change-prefix ,msg)))
+
+(defmacro liece-insert-notice (buffer msg)
+ `(liece-insert ,buffer (concat liece-notice-prefix ,msg)))
+
+(defmacro liece-insert-broadcast (buffer msg)
+ `(liece-insert ,buffer (concat liece-broadcast-prefix ,msg)))
+
+(defmacro liece-insert-wallops (buffer msg)
+ `(liece-insert ,buffer (concat liece-wallops-prefix ,msg)))
+
+(defmacro liece-insert-error (buffer msg)
+ `(liece-insert ,buffer (concat liece-error-prefix ,msg)))
+
+(defmacro liece-insert-info (buffer msg)
+ `(liece-insert ,buffer (concat liece-info-prefix ,msg)))
+
+(defmacro liece-insert-timestamp (buffer msg)
+ `(liece-insert ,buffer (concat liece-timestamp-prefix ,msg)))
+
+(defmacro liece-insert-dcc (buffer msg)
+ `(liece-insert ,buffer (concat liece-dcc-prefix ,msg)))
+
+(defmacro liece-insert-client (buffer msg)
+ `(liece-insert ,buffer (concat liece-client-prefix ,msg)))
+
+(defmacro liece-current-nickname ()
+ "Our current nickname."
+ 'liece-real-nickname)
+
+(defmacro liece-current-channel ()
+ "Our current channel."
+ 'liece-current-channel)
+
+(defmacro liece-current-channels ()
+ "Our current channels."
+ 'liece-current-channels)
+
+(defmacro liece-current-chat-partner ()
+ "Our current chat partner."
+ 'liece-current-chat-partner)
+
+(defmacro liece-current-chat-partners ()
+ "Our current chat partners."
+ 'liece-current-chat-partners)
+
(defun liece-toggle-command-buffer-mode (&optional mode)
"Toggle command buffer MODE."
(let ((mode
(product-name (product-find 'liece-version))
(format ,@message)))
-(defmacro liece-insert-change (buffer msg)
- `(liece-insert ,buffer (concat liece-change-prefix ,msg)))
-
-(defmacro liece-insert-notice (buffer msg)
- `(liece-insert ,buffer (concat liece-notice-prefix ,msg)))
-
-(defmacro liece-insert-broadcast (buffer msg)
- `(liece-insert ,buffer (concat liece-broadcast-prefix ,msg)))
-
-(defmacro liece-insert-wallops (buffer msg)
- `(liece-insert ,buffer (concat liece-wallops-prefix ,msg)))
-
-(defmacro liece-insert-error (buffer msg)
- `(liece-insert ,buffer (concat liece-error-prefix ,msg)))
-
-(defmacro liece-insert-info (buffer msg)
- `(liece-insert ,buffer (concat liece-info-prefix ,msg)))
-
-(defmacro liece-insert-timestamp (buffer msg)
- `(liece-insert ,buffer (concat liece-timestamp-prefix ,msg)))
-
-(defmacro liece-insert-dcc (buffer msg)
- `(liece-insert ,buffer (concat liece-dcc-prefix ,msg)))
-
-(defmacro liece-insert-client (buffer msg)
- `(liece-insert ,buffer (concat liece-client-prefix ,msg)))
-
-(defmacro liece-own-message (message)
- `(if (eq liece-command-buffer-mode 'channel)
- (liece-own-channel-message ,message)
- (liece-own-channel-message ,message)))
-
(defmacro liece-own-channel-message (message &optional chnl)
`(let* ((chnl (or ,chnl (liece-current-channel)))
(liece-message-target chnl)
(liece-message-direction 'outgoing))
(liece-display-message ,message)))
+(defmacro liece-own-message (message)
+ `(if (eq liece-command-buffer-mode 'channel)
+ (liece-own-channel-message ,message)
+ (liece-own-channel-message ,message)))
+
+(defvar liece-idle-point nil "Timestamp of last idle reset.")
+
+(defmacro liece-reset-idle ()
+ "Reset idle counter and return last idle."
+ '(prog1 (liece-idle) (setq liece-idle-point (current-time))))
+
+(defmacro liece-idle ()
+ "How long has liece been idle."
+ '(if liece-idle-point
+ (liece-time-difference liece-idle-point (current-time))
+ 9999999))
+
+(defmacro liece-ping-if-idle (&optional limit)
+ `(if (<= (liece-idle) (or ,limit 120))
+ nil
+ (liece-command-ping)
+ t))
+
(defmacro liece-convert-received-input (input)
"Convert input before it is processed"
`(let ((conv-list liece-receive-convert-list)
(concat "[" ,hostname "]")
,hostname)))
-(defmacro liece-current-nickname ()
- "Our current nickname."
- 'liece-real-nickname)
-
-(defmacro liece-current-channel ()
- "Out current channel."
- 'liece-current-channel)
-
-(defmacro liece-current-channels ()
- "Out current channels."
- 'liece-current-channels)
-
-(defmacro liece-current-chat-partner ()
- "Out current chat partner."
- 'liece-current-chat-partner)
-
-(defmacro liece-current-chat-partners ()
- "Out current chat partners."
- 'liece-current-chat-partners)
-
(defmacro liece-scroll-if-visible (window)
`(if ,window (set-window-point ,window (point-max))))
(defmacro liece-insert-time-string ()
'(insert (substring (current-time-string) 11 16) " "))
-(defvar liece-idle-point nil "Timestamp of last idle reset.")
-
-(defmacro liece-reset-idle ()
- "Reset idle counter and return last idle."
- '(prog1 (liece-idle) (setq liece-idle-point (current-time))))
-
-(defmacro liece-idle ()
- "How long has liece been idle."
- '(if liece-idle-point
- (liece-time-difference liece-idle-point (current-time))
- 9999999))
-
-(defmacro liece-ping-if-idle (&optional limit)
- `(if (<= (liece-idle) (or ,limit 120))
- nil
- (liece-command-ping)
- t))
-
-(defmacro liece-maybe-poll ()
- '(liece-send "PING %s" (system-name)))
-
(defun liece-get-buffer-create (name)
"Get or create buffer, keep track on its NAME so we can kill it."
(let ((buffer (get-buffer-create name)))
(setq time (current-time)))
(format "%04x%04x" (car time) (cadr time)))
-(defmacro liece-hex-timestamp-valid (timestamp limit)
- "Is TIMESTAMP valid within LIMIT?"
- `(let (t1 t2 diff (timestamp ,timestamp))
- (if (not (and (stringp timestamp)
- (string-match
- "^[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]$" timestamp)))
- nil
- (setq t1 (liece-hex-string-to-integer (substring timestamp 0 4))
- t2 (liece-hex-string-to-integer (substring timestamp 4 8))
- diff (liece-time-difference
- (list t1 t2 0) (current-time)))
- (or (>= ,limit 0)
- (and (< diff ,limit) (> diff (- 0 ,limit)))))))
-
(defmacro liece-hex-char-to-integer (character)
"Convert single hex digit CHARACTER to integer."
`(if (and (>= ,character ?0) (<= ,character ?9))
(setq hex-string (substring hex-string 1)))
hex-num))
+(defmacro liece-hex-timestamp-valid (timestamp limit)
+ "Is TIMESTAMP valid within LIMIT?"
+ `(let (t1 t2 diff (timestamp ,timestamp))
+ (if (not (and (stringp timestamp)
+ (string-match
+ "^[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]$" timestamp)))
+ nil
+ (setq t1 (liece-hex-string-to-integer (substring timestamp 0 4))
+ t2 (liece-hex-string-to-integer (substring timestamp 4 8))
+ diff (liece-time-difference
+ (list t1 t2 0) (current-time)))
+ (or (>= ,limit 0)
+ (and (< diff ,limit) (> diff (- 0 ,limit)))))))
+
(defmacro liece-remove-properties-region (start end)
(unless (fboundp 'make-extent)
`(save-excursion
(cond
((and (eq liece-nick-sort-nicks t)
(liece-functionp liece-nick-sort-predicate))
- (let (nicks found)
+ (let (found)
(goto-char (point-min))
(while (and (not (eobp)) (not found))
(if (condition-case nil
;;;###liece-autoload
(defun liece-nick-change (old new)
(let* ((old (liece-nick-strip old)) (new (liece-nick-strip new))
- (chnls (get (intern old liece-obarray) 'chnl)) chnl nbuf)
+ (chnls (get (intern old liece-obarray) 'chnl)) nbuf)
(liece-change-nick-of old new)
(if new
(put (intern new liece-obarray) 'chnl chnls))
(setq liece-nick-region-nicks nil)
(save-excursion
(let (region nick)
- (if (not (region-active-p))
+ (if (not (liece-region-active-p))
(setq region (cons (line-beginning-position)
(line-beginning-position 2)))
(setq region (cons (region-beginning) (region-end)))
"q" liece-command-quit
"r" liece-command-reconfigure-windows
"x" liece-command-tag-region
+ "\C-s" liece-command-open-server
"t" liece-command-topic
;;"T" liece-command-timestamp
;;"\C-t" liece-command-find-timestamp
(when (or confirm
(null (or liece-server
(setq liece-server (getenv "IRCSERVER")))))
- (setq liece-server (completing-read (_ "IRC server: ") liece-server-alist)))
+ (setq liece-server (completing-read (_ "IRC server: ")
+ liece-server-alist)))
(unless (listp liece-server)
(let ((entry (assoc liece-server liece-server-alist)))
(if entry
(setq liece-server plist)))))
(when (or (and confirm liece-ask-for-nickname)
(null liece-nickname))
- (setq liece-nickname (read-string (_ "Enter your nickname: ") liece-nickname)))
+ (setq liece-nickname (read-string (_ "Enter your nickname: ")
+ liece-nickname)))
(let ((host (liece-server-host)))
(liece-message
(_ "Connecting to IRC server on %s...") host)
(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)
+ (liece-command-ping)
(if (null (liece-wait-for-response "^:[^ ]+ [4P][5O][1N][ G]"))
(progn
;; We have to close connection here, since the function
;; notify the real nickname to the user.
(or liece-real-nickname
(setq liece-real-nickname
- (truncate-string liece-nickname liece-nick-max-length)))
+ (liece-truncate-string-to-width liece-nickname
+ liece-nick-max-length)))
(setq liece-nickname-last liece-real-nickname
liece-nick-accepted 'sent
liece-after-registration t))))