[beirc-cvs] CVS update: beirc/application.lisp beirc/variables.lisp

Andreas Fuchs afuchs at common-lisp.net
Sun Oct 2 08:59:24 UTC 2005


Update of /project/beirc/cvsroot/beirc
In directory common-lisp.net:/tmp/cvs-serv4986

Modified Files:
	application.lisp variables.lisp 
Log Message:
add variable *auto-join-channels*. On /connect or /reload, joins the
channels corresponding to the server name.

Date: Sun Oct  2 10:59:24 2005
Author: afuchs

Index: beirc/application.lisp
diff -u beirc/application.lisp:1.22 beirc/application.lisp:1.23
--- beirc/application.lisp:1.22	Sun Oct  2 10:42:20 2005
+++ beirc/application.lisp	Sun Oct  2 10:59:23 2005
@@ -190,7 +190,8 @@
     (redisplay-frame-pane *application-frame* pane)))
 
 (defun redraw-all-receivers ()
-  (when (boundp '*application-frame*)
+  (when (and (boundp '*application-frame*)
+             (not (null *application-frame*)))
    (maphash (lambda (name receiver)
               (declare (ignore name))
               (redraw-receiver receiver))
@@ -264,9 +265,19 @@
                                          (make-instance 'bar-event :sheet frame))
     (sleep 1)))
 
+(defun join-missing-channels (frame)
+  (let* ((connection (current-connection frame))
+         (server (irc:server-name connection)))
+   (loop for join-channel in (cdr (assoc server *auto-join-alist* :test #'equal))
+         do (unless (gethash join-channel (receivers frame))
+              (irc:join connection join-channel)))))
+
 (defun load-user-init-file (&optional (pathname *beirc-user-init-file*))
-  (load pathname)
-  (redraw-all-receivers))
+  (when (probe-file *beirc-user-init-file*)
+    (let ((*package* #.*package*))
+     (load pathname))
+    (join-missing-channels *application-frame*)
+    (redraw-all-receivers)))
 
 (define-beirc-command (com-reload :name t) ()
   (load-user-init-file))
@@ -545,6 +556,7 @@
                          (loop for receiver being the hash-values of (receivers frame)
                                if (channelp (channel receiver))
                                  do (irc:join connection (channel receiver)))
+                         (join-missing-channels frame)
                          (initialize-receiver-with-pane (server-receiver frame) frame
                                                         (find-pane-named frame 'server)
                                                         :add-pane-p nil)


Index: beirc/variables.lisp
diff -u beirc/variables.lisp:1.5 beirc/variables.lisp:1.6
--- beirc/variables.lisp:1.5	Sun Oct  2 10:42:20 2005
+++ beirc/variables.lisp	Sun Oct  2 10:59:23 2005
@@ -7,6 +7,9 @@
 (defvar *default-web-browser* #+darwin "/usr/bin/open"
                               ;; assuming a debian system running X:
                               #+linux  "/usr/bin/x-www-browser")
+(defvar *auto-join-alist* (("irc.freenode.net" . ("#beirc")))
+  "An alist mapping irc server name to a list of channels to
+  automatically join on connect.")
 
 (defvar *beirc-user-init-file* (merge-pathnames (make-pathname :name ".beirc.lisp")
                                                 (user-homedir-pathname)))




More information about the Beirc-cvs mailing list