Mark outgoing encrypted message.
[riece] / lisp / riece-display.el
index 5a16cdf..fbead8b 100644 (file)
@@ -19,8 +19,8 @@
 
 ;; You should have received a copy of the GNU General Public License
 ;; along with GNU Emacs; see the file COPYING.  If not, write to the
-;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-;; Boston, MA 02111-1307, USA.
+;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+;; Boston, MA 02110-1301, USA.
 
 ;;; Code:
 
@@ -404,7 +404,8 @@ Local to the buffer in `riece-buffer-list'.")
     (if channels
        (setq identity (car channels))
       (if riece-debug
-         (message "%S is not a member of riece-current-channels" identity)))
+         (riece-debug (format "%S is not a member of riece-current-channels"
+                              identity))))
     (format riece-channel-buffer-format (riece-format-identity identity))))
 
 (eval-when-compile
@@ -428,7 +429,14 @@ Local to the buffer in `riece-buffer-list'.")
     (current-buffer)))
 
 (defun riece-channel-buffer (identity)
-  (cdr (riece-identity-assoc identity riece-channel-buffer-alist)))
+  (let ((entry (riece-identity-assoc identity riece-channel-buffer-alist)))
+    (if entry
+       (if (buffer-live-p (cdr entry))
+           (cdr entry)
+         (if riece-debug
+             (riece-debug
+              (format "riece-channel-buffer: nonexistent buffer: %s"
+                      (riece-format-identity identity))))))))
 
 (defun riece-switch-to-channel (identity)
   (let ((last riece-current-channel)
@@ -475,10 +483,12 @@ Local to the buffer in `riece-buffer-list'.")
 
 (defun riece-part-channel (identity)
   (let ((pointer (riece-identity-member identity riece-current-channels)))
-    (if pointer
-       (setcar pointer nil))
+    (unless pointer
+      (error "No such channel!"))
+    (setcar pointer nil)
     (if (riece-identity-equal identity riece-current-channel)
-       (riece-switch-to-nearest-channel pointer))
+       (riece-switch-to-nearest-channel pointer)
+      (riece-emit-signal 'channel-list-changed))
     (funcall riece-buffer-dispose-function (riece-channel-buffer identity))))
 
 (defun riece-redisplay-buffers (&optional force)