1 ;; 16-riece-sy.el --- Riece (IRC) Settings -*- Emacs-Lisp -*-
3 ;; Copyright (C) 2007 - 2013 Steve Youngs
5 ;; Author: Steve Youngs <steve@sxemacs.org>
6 ;; Maintainer: Steve Youngs <steve@sxemacs.org>
7 ;; Created: <2007-12-02>
8 ;; Time-stamp: <Monday Jun 22, 2015 17:24:21 steve>
9 ;; Download: <http://bastard.steveyoungs.com/~steve/SXEmacs/inits/>
10 ;; HTMLised: <http://bastard.steveyoungs.com/~steve/SXEmacs/htmlinits/16-riece-sy.html>
11 ;; Git Repo: git clone http://git.sxemacs.org/syinit
12 ;; Keywords: init, compile
14 ;; This file is part of SYinit
16 ;; Redistribution and use in source and binary forms, with or without
17 ;; modification, are permitted provided that the following conditions
20 ;; 1. Redistributions of source code must retain the above copyright
21 ;; notice, this list of conditions and the following disclaimer.
23 ;; 2. Redistributions in binary form must reproduce the above copyright
24 ;; notice, this list of conditions and the following disclaimer in the
25 ;; documentation and/or other materials provided with the distribution.
27 ;; 3. Neither the name of the author nor the names of any contributors
28 ;; may be used to endorse or promote products derived from this
29 ;; software without specific prior written permission.
31 ;; THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR
32 ;; IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
33 ;; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
34 ;; DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
35 ;; FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
36 ;; CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
37 ;; SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
38 ;; BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
39 ;; WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
40 ;; OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
41 ;; IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
47 ;; Riece is a very nice IRC client for emacs. Unlike ERC which
48 ;; tries to be like "traditional" IRC clients, Riece is much more
54 ;; The HTML version of this file was created with Hrvoje Niksic's
55 ;; htmlize.el which is part of the XEmacs "text-modes" package.
63 (require 'riece-options)
69 (setq riece-alias-percent-hack-mask "*.net"
70 riece-biff-check-channels '("#sxemacs"
73 riece-channel-buffer-mode t
75 '("white" "black" "blue" "green" "red" "brown"
76 "purple" "orange" "yellow" "lightgreen" "darkcyan"
77 "cyan" "lightblue" "HotPink" "grey35" "grey")
78 riece-default-channel-binding nil
79 riece-default-coding-system 'binary
80 riece-desktop-notify-always t
81 riece-gather-channel-modes t
82 riece-hide-list '(joins parts quits)
83 riece-ignore-discard-message nil
85 '("Bastard" "EMchat" "eMoney" "Gnus" "LFS" "LinuxFromScratch"
86 "Linux From Scratch" "PgSQL" "PostgreSQL" "postgres" "Riece"
87 "SteveYoungs" "SXEmacs" "XEmacs" "systemd" "xwem")
88 riece-layout '"bottom-right"
89 riece-retry-with-new-nickname t
91 '(("irc.sxemacs.org" :host "irc.sxemacs.org")
92 ("irc.freenode.net" :host "irc.freenode.net")
93 ("irc.au.freenode.net" :host "irc.au.freenode.net")
94 ("irc.nac.net" :host "irc.nac.net")
95 ("irc.efnet.org" :host "irc.efnet.org")
96 ("irc.efnet.net" :host "irc.efnet.net"))
97 riece-user-agent 'emacs-riece-config
98 riece-user-list-buffer-mode t)
101 (riece-command-insinuate-addon 'riece-yank)
102 (riece-command-insinuate-addon 'riece-hangman)
103 (riece-command-insinuate-addon 'riece-keepalive)
104 (riece-command-insinuate-addon 'riece-shrink-buffer)
105 (riece-command-insinuate-addon 'riece-xfaceb)
106 (riece-command-insinuate-addon 'riece-button)
107 (riece-command-insinuate-addon 'riece-epg)
109 (riece-command-enable-addon 'riece-hangman)
111 ;; Leave this OFF it is too annoying. Fun, but annoying.
112 ;; (riece-command-insinuate-addon 'riece-doctor)
113 ;; (riece-command-enable-addon 'riece-doctor)
115 ;; A few handy functions that extend Riece's features a bit.
116 (defvar riece-unread-channels)
117 (defun sy-riece-clear-unread-chans ()
118 "Get rid of the unread mark on all channels."
120 (let ((current riece-current-channel))
121 (setq riece-unread-channels nil)
122 (riece-switch-to-channel current)))
124 (defun sy-riece-relist-chans-clear-blanks ()
125 "Relist the channel buffer removing any blanks in the sequence.
127 When you part from a channel/user you are left with a gap in the
128 sequence of channel numbers in the channels buffer. This removes
131 (let ((current riece-current-channel))
132 (setq riece-current-channels
133 (remove-if #'null riece-current-channels))
134 (riece-switch-to-channel current)))
136 (defun sy-riece-command-memoserv (command)
137 "Send COMMAND, a string, to MEMOSERV.
139 With prefix arg, also /join."
140 (interactive "sMemoserv: ")
141 (when current-prefix-arg
142 (riece-command-join (list ["MemoServ" ""])))
143 (riece-send-string (format "MEMOSERV %s\r\n" command)))
145 (defun sy-riece-command-chanserv (command)
146 "Send COMMAND, a string, to CHANSERV.
148 With prefix arg, also /join."
149 (interactive "sChanserv: ")
150 (when current-prefix-arg
151 (riece-command-join (list ["ChanServ" ""])))
152 (riece-send-string (format "CHANSERV %s\r\n" command)))
154 (defun sy-riece-command-nickserv (command)
155 "Send COMMAND, a string, to NICKSERV.
157 With prefix arg, also /join."
158 (interactive "sNickserv: ")
159 (when current-prefix-arg
160 (riece-command-join (list ["NickServ" ""])))
161 (riece-send-string (format "NICKSERV %s\r\n" command)))
163 ;; Seems to not exist anymore. :-(
164 (defun sy-riece-command-seenserv (command)
165 "Send COMMAND, a string, to SEENSERV.
167 SeenServ doesn't actually exist anymore, so this sends `info nick' to
168 NickServ which gives us the same info.
170 With prefix arg, also /join."
171 (interactive "sLast saw who (nick): ")
172 (when current-prefix-arg
173 (riece-command-join (list ["NickServ" ""])))
174 (riece-send-string (format "NICKSERV info %s\r\n" command)))
176 (defun sy-riece-command-quick-op ()
177 "Request Ops from ChanServ in the current channel."
179 (let ((chan (riece-identity-prefix riece-current-channel)))
180 (sy-riece-command-chanserv (format "OP %s" chan))))
182 (defun sy-riece-command-mute-user (&optional user unmute)
183 "Set mode +q on USER, effectively muting them.
185 Optional prefix arg, UNMUTE to let them speak again."
190 (riece-with-server-buffer
191 (riece-identity-server riece-current-channel)
192 (riece-channel-get-users (riece-identity-prefix
193 riece-current-channel)))))))
195 (format "MODE %s %sq %s\r\n"
196 (riece-identity-prefix riece-current-channel)
203 (defun sy-riece-list-banned (channel)
204 "List the banned users on CHANNEL, current if omitted."
206 (let ((channel (if current-prefix-arg
207 (vector (read-string "Channel: ") "")
208 riece-current-channel)))
210 (format "MODE %s b\r\n" (riece-identity-prefix channel)))))
212 (defun sy-riece-command-ban-user (&optional user unban)
213 "Ban USER from current channel.
215 Optional prefix arg, UNBAN removes the ban."
220 (riece-with-server-buffer
221 (riece-identity-server riece-current-channel)
222 (riece-channel-get-users (riece-identity-prefix
223 riece-current-channel))))))
228 (format "MODE %s -b %s\r\n"
229 (riece-identity-prefix riece-current-channel)
231 (setq reason (read-string "Reason: " nil nil
232 "Need a reason? Look in a mirror!"))
234 (format "MODE %s +b %s\r\n"
235 (riece-identity-prefix riece-current-channel)
237 (riece-command-kick user reason))))
240 (defun sy-riece-say-now-playing (&optional notice)
241 "Say into the current channel what mp3 is playing.
243 With non-nil optional prefix arg, NOTICE, send it as a notice."
245 (riece-command-send-message
246 (format "NP: %s" (mpd-now-playing))
247 (and current-prefix-arg
250 (defun sy-riece-say-all-purpose (&optional notice)
251 "Send the all-purpose answer to everything."
253 (riece-command-send-message "Adolf Hitler in fishnets"
254 (if current-prefix-arg
259 ;; Tell the world what we're using.
260 (defun sy-riece-say-version (&optional notice)
261 "Say the version of Riece we are running.
263 With non-nil prefix arg, NOTICE, send as a notice."
265 (riece-command-send-message
266 (format "I'm using: %s" (riece-extended-version))
267 (if current-prefix-arg
272 (defun sy-riece-send-form ()
273 "Sends a form and it's eval"
275 (let* ((form (read-string "sexp: "))
276 (value (eval (read form))))
277 (riece-command-send-message (format "%s => %s" form value)
278 (if current-prefix-arg
282 (defun sy-make-rot13-translation-table ()
283 "Create a rot13 table."
285 (table (make-string 256 0))
287 (A (char-to-int ?A)))
288 (while (< (incf i) 256)
291 (substring table 0 A)
292 (substring table (+ A 13) (+ A 13 (- 26 13)))
293 (substring table A (+ A 13))
294 (substring table (+ A 26) a)
295 (substring table (+ a 13) (+ a 13 (- 26 13)))
296 (substring table a (+ a 13))
297 (substring table (+ a 26) 255))))
299 (defun sy-rot13-string (string)
300 "Convert TEXT to rot13-ese."
301 (let ((table (sy-make-rot13-translation-table)))
304 (translate-region (point-min) (point-max) table)
307 (defun sy-riece-send-rot13 (text)
309 (interactive "srot13: ")
310 (riece-command-send-message
311 (sy-rot13-string text)
312 (if current-prefix-arg
316 (defun sy-morse-string (string)
317 "Return STRING in morse code."
320 (morse-region (point-min) (point-max))
321 (goto-char (point-min))
322 (while (re-search-forward "/" nil t)
326 (defun sy-riece-send-morse (text)
327 "Talk in morse code."
328 (interactive "sMorse: ")
329 (riece-command-send-message
330 (sy-morse-string text)
331 (if current-prefix-arg
336 (autoload 'riece-command-ctcp-action "riece-ctcp" nil t)
337 (defun sy-riece-show-off ()
338 "Brag about how many channels/people we're talking to."
340 (sy-riece-relist-chans-clear-blanks)
341 (let* ((channels riece-current-channels)
342 (numchans (length channels))
346 (setq currchan (car channels))
347 (setq numppl (+ numppl
348 (length (riece-with-server-buffer
349 (riece-identity-server currchan)
350 (riece-channel-get-users
351 (riece-identity-prefix currchan))))))
352 (setq channels (cdr channels)))
353 (riece-command-ctcp-action
354 riece-current-channel
356 "is in %d channels, talking to %d people :-P"
359 ;; Brag about how long SXEmacs has been up
360 (defun sy-riece-sxe-uptime ()
361 "Display as action SXEmacs uptime."
367 (seconds (cadddr ut)))
368 (riece-command-ctcp-action
369 riece-current-channel
370 (concat "-=[ SXEmacs Uptime: "
374 (concat (number-to-string days) " days, ")))
375 (unless (zerop hours)
378 (concat (number-to-string hours) " hours, ")))
379 (unless (zerop minutes)
382 (concat (number-to-string minutes) " minutes, ")))
388 (number-to-string seconds)
393 ;; segassem desrever eikeeg ylbirreT
394 (defun sy-riece-reverse ()
397 (let ((str (read-string "Say backwards: ")))
398 (riece-command-send-message
399 (concat (nreverse (string-to-list str))) nil)))
401 ;; .oO0{ what's he thinking? }
402 (defun sy-riece-think ()
403 "Send a .oO0{ think balloon action }."
405 (let ((think (read-string "What are you thinking? ")))
406 (riece-command-ctcp-action
407 riece-current-channel
408 (format ".oO0{ %s }" think))))
410 ;; When pictures speak louder than words...
411 (defun sy-riece-fuck-you (&optional upyours)
412 "For those occasions where... you know what I mean."
418 _| |_ (| \"o\" |) _| |_
419 _| | | | _ (_---_) _ | | | |_
420 | | | | |' | _| |_ | `| | | | |
422 \\ / / /(. .)\\ \\ \\ /
423 \\ / / / | . | \\ \\ \\ /
424 \\ \\/ / ||Y|| \\ \\/ /
442 (riece-yank-tick 0.1))
444 (if current-prefix-arg
447 (kill-region (point-min) (point-max)))
448 (riece-command-yank nil nil)))
450 ;; Nick completion. Lets face it, compared to other IRC clients like
451 ;; BitchX or even ERC, Riece's nick completion is pretty sucky. :-(
452 ;; This is my vain attempt to improve it.
453 (defun sy-riece-command-complete-user ()
454 "Like `riece-command-complete-user' but restrict to current chan.
456 This version of nick completion maintains the original case of the
457 nick being completed. The version in Riece downcases the completion
460 If the completion is being inserted at column zero, `: ' is appended,
461 otherwise ` ' is added.
463 The following is not yet implemented, but I'd also like to be able to
464 complete from the middle of a nick...
466 Nickname User Types Expands To
467 -------- ---------- ----------
468 MyNick nic<TAB> MyNick:<SPC>"
470 (let* ((completion-ignore-case t)
471 (table (riece-with-server-buffer
472 (riece-identity-server riece-current-channel)
473 (riece-channel-get-users (riece-identity-prefix
474 riece-current-channel))))
475 (current (or (current-word) ""))
476 (completion (try-completion current table))
477 (all (all-completions current table)))
478 (if (eq completion t)
480 (if (null completion)
481 (message "Can't find completion for \"%s\"" current)
482 (if (equal current completion)
483 (with-output-to-temp-buffer "*Help*"
484 (display-completion-list all))
485 (re-search-forward "\\>" nil t)
486 (delete-region (point) (- (point) (length current)))
487 (if (eq (point) (point-at-bol))
488 (insert completion ": ")
489 (insert completion " ")))))))
491 ;(defalias 'riece-command-complete-user 'sy-riece-command-complete-user)
493 ;; "schme" <marcus@sxemacs.org> funky cycling completion
494 ;; Reworked to support cycling in both directions using dllists, plus
495 ;; other misc improvements by me. --SY.
496 (defvar riece-me:completion-time 3
497 "Time in seconds before completion list is reset.")
498 (defvar riece-me:*completion-timer* (make-itimer)
500 (defvar riece-me:*completion-list* nil
503 (defvar sy-riece-nick-syntax-table
504 (let ((table (copy-syntax-table text-mode-syntax-table)))
505 (modify-syntax-entry ?~ "w " table)
506 (modify-syntax-entry ?` "w " table)
507 (modify-syntax-entry ?- "w " table)
508 (modify-syntax-entry ?_ "w " table)
509 (modify-syntax-entry ?+ "w " table)
510 (modify-syntax-entry ?{ "w " table)
511 (modify-syntax-entry ?[ "w " table)
512 (modify-syntax-entry ?} "w " table)
513 (modify-syntax-entry ?] "w " table)
514 (modify-syntax-entry ?\\ "w " table)
515 (modify-syntax-entry ?| "w " table)
516 (modify-syntax-entry ?: "w " table)
517 (modify-syntax-entry ?\; "w " table)
518 (modify-syntax-entry ?' "w " table)
519 (modify-syntax-entry ?< "w " table)
520 (modify-syntax-entry ?, "w " table)
521 (modify-syntax-entry ?> "w " table)
523 "Syntax table used in funky nick cycling completion.")
525 (defun sy-riece-init-completion-timer ()
526 "Initialise the completion timer."
527 (let ((timer riece-me:*completion-timer*))
528 (set-itimer-function timer #'(lambda ()
529 (setq riece-me:*completion-list* nil)))
530 (set-itimer-value timer riece-me:completion-time)))
531 (add-hook 'riece-after-login-hook #'sy-riece-init-completion-timer)
533 (defsubst sy-riece-cycle-list (list &optional reverse)
534 "Return a list of head of LIST, and LIST rotated 1 place forward.
536 If optional argument, REVERSE is non-nil, rotate the list in the other
538 (let ((list (apply #'dllist list))
541 (dllist-rrotate list)
542 (dllist-lrotate list))
543 (setq name (dllist-car list))
544 (list name (dllist-to-list list))))
546 (defsubst sy-riece-set-completion-timer ()
547 "(Re)set completion timer's value."
548 (let ((timer riece-me:*completion-timer*))
550 (set-itimer-value timer riece-me:completion-time))))
552 (defun sy-riece-complete-user-backwards ()
553 "Complete nick, cycling backwards.
554 See `riece-me:command-complete-user'."
556 (riece-me:command-complete-user 'reverse))
558 (add-hook 'riece-command-mode-hook
560 ;; Define a few keys here so they don't have the `C-c' prefix
561 (local-set-key [iso-left-tab] #'sy-riece-complete-user-backwards)
562 (local-set-key [(super next)] #'riece-command-user-list-scroll-up)
563 (local-set-key [(super prior)] #'riece-command-user-list-scroll-down)
564 (local-set-key [(hyper next)] #'riece-command-scroll-up)
565 (local-set-key [(hyper prior)] #'riece-command-scroll-down)))
567 (defun riece-me:command-complete-user (&optional reverse)
568 "Like `riece-command-complete-user' but restrict to current chan.
570 This completion does not pop up any completion buffers, instead it
571 cycles through the user names \"in-place\" with each successive TAB.
573 With non-nil optional argument, REVERSE, the cycling goes in the other
576 If the completion is being inserted at column zero, \": \" is appended,
577 otherwise \" \" is added. "
579 (unless riece-me:*completion-list*
580 (unless (itimer-live-p riece-me:*completion-timer*)
581 (sy-riece-set-completion-timer)
582 (activate-itimer riece-me:*completion-timer*))
583 (let* ((completion-ignore-case t)
584 (table (riece-with-server-buffer
585 (riece-identity-server riece-current-channel)
586 (riece-channel-get-users (riece-identity-prefix
587 riece-current-channel))))
588 (current (current-word))
589 (completion (try-completion current table))
590 (all (all-completions current table)))
591 (if (null completion)
592 (message "Can't find completion for \"%s\"" current)
593 (setq riece-me:*completion-list* all))))
594 (when riece-me:*completion-list*
595 (multiple-value-bind (completion newlist)
596 (sy-riece-cycle-list riece-me:*completion-list* reverse)
597 (setq riece-me:*completion-list* newlist)
598 (with-syntax-table sy-riece-nick-syntax-table
599 (unless (string= "" (current-word))
600 (backward-delete-word))
602 (let ((nicksuffix " "))
606 (setq nicksuffix ": ")))
607 (insert nicksuffix)))
608 (sy-riece-set-completion-timer))))
610 (defalias 'riece-command-complete-user 'riece-me:command-complete-user)
613 (defun sy-riece-add-rem-biff-channel (&optional remove)
614 "Add the current channel to the list of channels for riece-biff.
616 With optional prefix arg, REMOVE, remove the current channel from the
619 (if (or current-prefix-arg
623 (setq riece-biff-check-channels
624 (remove (riece-identity-prefix riece-current-channel)
625 riece-biff-check-channels))
626 (message "Channel: %s removed from riece-biff channel list."
627 (riece-identity-prefix riece-current-channel)))
629 (add-to-list 'riece-biff-check-channels
630 (riece-identity-prefix riece-current-channel))
631 (message "Channel: %s added to riece-biff channel list."
632 (riece-identity-prefix riece-current-channel))))
634 (defun sy-riece-get-sxemacs-topic-version ()
635 "Return the \"version\" section of #sxemacs topic."
636 (let* ((topic (riece-with-server-buffer
637 (riece-identity-server riece-current-channel)
638 (riece-channel-get-topic "#sxemacs")))
639 (ver (third (split-string-by-char topic ?\ ))))
642 (defun sy-riece-sxemacs-topic-version-update (&optional newver)
643 "*Updates the \"version\" section of #sxemacs topic with NEWVER.
644 With a prefix arg, prompt for the new version string."
646 (let* ((oldver (sy-riece-get-sxemacs-topic-version))
647 (gitver (substring (shell-command-to-string
648 "( cd ${SXEWD}; git describe master )")
650 (newver (or (and current-prefix-arg
651 (read-string "New Version: "
652 sxemacs-git-version nil
653 sxemacs-git-version))
655 (chan (riece-identity-prefix riece-current-channel)))
656 (unless (string= chan "#sxemacs")
657 (error 'invalid-argument "Wrong channel" chan))
658 (riece-command-send-message
659 (format ",topic change 1 s/%s/%s/" oldver newver) nil)))
661 ;; Define keys for those functions.
662 (define-key riece-command-map (kbd "C-c C") #'sy-riece-clear-unread-chans)
663 (define-key riece-command-map (kbd "C-c r")
664 #'sy-riece-relist-chans-clear-blanks)
665 (define-key riece-command-map (kbd "C-c m") #'sy-riece-command-mute-user)
666 (define-key riece-command-map (kbd "C-b") #'sy-riece-command-ban-user)
667 (define-key riece-command-map (kbd "C-o") #'sy-riece-command-quick-op)
668 (define-key riece-command-map (kbd "C-c n") #'sy-riece-say-now-playing)
669 (define-key riece-command-map (kbd "C-c V") #'sy-riece-say-version)
670 (define-key riece-command-map (kbd "C-c s") #'sy-riece-show-off)
671 (define-key riece-command-map (kbd "C-c f") #'sy-riece-fuck-you)
672 (define-key riece-command-map (kbd "C-c b") #'sy-riece-add-rem-biff-channel)
673 (define-key riece-command-map (kbd "C-c ?") #'sy-riece-think)
674 (define-key riece-command-map (kbd "C-c R") #'sy-riece-reverse)
675 (define-key riece-command-map (kbd "C-c T") #'sy-riece-sxemacs-topic-version-update)
676 (define-key riece-command-map (kbd "C-c U") #'sy-riece-sxe-uptime)
677 (define-key riece-command-map [a] #'sy-riece-say-all-purpose)
679 ;; So I can start Riece in a new frame
680 (defvar riece-frame nil
683 (defun sy-riece (&optional ask)
684 "Run Riece in a new frame.
686 With non-nil optional prefix ASK Riece will prompt for a server to
689 (let ((riece-server (if current-prefix-arg
692 (setq riece-frame (new-frame '((name . "RieceFrame")
694 (select-frame riece-frame)
695 (call-interactively 'riece)
696 (focus-frame riece-frame)))
698 (defun sy-riece-exit-hook ()
699 (when (frame-live-p riece-frame)
700 (delete-frame riece-frame))
701 (setq riece-frame nil))
703 (add-hook 'riece-exit-hook #'sy-riece-exit-hook)
705 ;; riece-startup-channel-list doesn't fit in with the way I do things
706 ;; and the way freenode functions. It gets called too damned early.
707 ;; What follows is my attempt to make Riece behave better with logging
708 ;; into freenode, registering to nickserv, joining initial channels,
709 ;; and getting ops with chanserv.
710 (defvar sy-riece-startup-channel-list
721 "List of channels to join after logging in and identifying to nickserv.")
723 ;; Set up channel coding systems
725 ;; This is a PITA... turn on utf and can't read iso-8859-1 special
726 ;; chars, turn it off and can't read utf. Have I mentioned how much I
727 ;; hate this crap? --SY.
730 (if (string-match #r"#\(sxemacs\|emchat\)" chan)
731 (push (cons chan 'iso-8859-1) riece-channel-coding-system-alist)
732 (push (cons chan 'utf-8) riece-channel-coding-system-alist)))
733 sy-riece-startup-channel-list)
735 (defun sy-riece-login ()
736 (riece-send-string (format "PRIVMSG NickServ :identify %s\r\n"
737 (getenv "IRCPASSWD")))
739 (let ((channel-list sy-riece-startup-channel-list)
742 (unless (listp (setq entry (car channel-list)))
743 (setq entry (list (car channel-list))))
744 (if (equal (riece-identity-server
745 (setq identity (riece-parse-identity (car entry))))
747 (riece-command-join-channel identity (nth 1 entry)))
748 (setq channel-list (cdr channel-list))))
749 (riece-send-string "PRIVMSG ChanServ :op #sxemacs\r\n")
750 (riece-send-string "PRIVMSG ChanServ :op #emchat\r\n")
751 (riece-send-string "PRIVMSG ChanServ :op #xemacs\r\n")
753 (format "PRIVMSG SXEbot :identify SteveYoungs %s\r\n"
754 (getenv "BOTPASSWD"))))
756 (add-hook 'riece-after-login-hook #'sy-riece-login)
758 ;; Until I can find a solution to my hook problem (login hook not
759 ;; running to completion) I use this to finish the job
760 (defun sy-riece-cleanup-login ()
763 #r".*\.freenode\.net\|\(Chan\|Nick\|Memo\|Seen\)Serv\|SXEbot"))
765 #'(lambda (chan-vect)
768 (and (string-match metachans chan)
769 (riece-part-channel chan-vect)))
771 riece-current-channels)
772 (sy-riece-relist-chans-clear-blanks)
773 (riece-command-switch-to-channel-by-number 1)))
775 ;; CANNOT get this to work from the hook. I suspect it is a
776 ;; networking/async/timing thing. I have it bound to a key
777 ;; seq... `C-c C-c l', a PITA though.
778 ;(add-hook 'riece-after-login-hook #'sy-riece-cleanup-login 'append)
779 (define-key riece-command-map (kbd "C-c l") 'sy-riece-cleanup-login)
781 ;; Automatically clear Riece Biff indicator by switching to the right
783 (defun sy-riece-check-command-buffer ()
784 (and (get-buffer-window (or riece-command-buffer "*Command*"))
787 (defadvice switch-to-buffer (after riece-update (&rest args) activate)
788 "After switching buffers, check to see if riece-biff should be cleared.
789 The riece-biff modeline indicator will only be cleared if
790 `riece-command-buffer' is visible in the selected frame."
791 (sy-riece-check-command-buffer))
793 (add-hook 'select-frame-hook #'sy-riece-check-command-buffer)
795 ;; Easier switch to Riece when running on TTY.
796 (defun sy-switch-to-riece ()
797 "I use this to switch to Riece when I'm on a tty."
799 (when (buffer-live-p riece-command-buffer)
800 (pop-to-buffer riece-command-buffer)
801 (riece-command-configure-windows)))
803 (define-key global-tty-map [(control ?c) ?r] #'sy-switch-to-riece)
805 ;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
806 (message "Riece settings loaded successfully")