* sb-mixi.el (shimbun-mixi-logout-p): New user option.
authorbg66 <bg66>
Tue, 5 Dec 2006 01:38:57 +0000 (01:38 +0000)
committerbg66 <bg66>
Tue, 5 Dec 2006 01:38:57 +0000 (01:38 +0000)
(shimbun-mixi-initialize-comment-cache): New macro.
(initialize-instance): Use it.
(shimbun-close): New method.

ChangeLog
sb-mixi.el

index e4a8126..87ed83c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2006-12-05  OHASHI Akira  <bg66@koka-in.org>
+
+       * sb-mixi.el (shimbun-mixi-logout-p): New user option.
+       (shimbun-mixi-initialize-comment-cache): New macro.
+       (initialize-instance): Use it.
+       (shimbun-close): New method.
+
 2006-12-04  OHASHI Akira  <bg66@koka-in.org>
 
        * mixi.el (mixi-url-encode-and-quote-percent-string): New function.
index 645868d..c50fb52 100644 (file)
@@ -70,17 +70,30 @@ of mixi object."
   :group 'shimbun
   :type 'boolean)
 
+(defcustom shimbun-mixi-logout-p nil
+  "*If non-ni, Logout from mixi when shimbun server was closed."
+  :group 'shimbun
+  :type 'boolean)
+
 (defvar shimbun-mixi-x-face-alist
   '(("default" . "X-Face: CY;j#FoBnpK^37`-IoJvN!J^u;GciiPmMQ@T)~RP1]t8iv?v)/bVI:I\"F!JfWJvhM5{zY!=
  h.d+'g\\I{D>Ocy?Rc4uYUyOZj2%2Kl>,x-!MCSsyi3!L}psrrC1jlF,O?Ui>qf)X;sBz`/}\\066X%$
  siG'|4K!2?==|oB&#E'5GGH\\#z[muyQ")))
 
+(defmacro shimbun-mixi-initialize-comment-cache (shimbun)
+  `(shimbun-mixi-set-comment-cache-internal ,shimbun
+                                           (make-hash-table :test 'equal)))
+
 (luna-define-method initialize-instance :after ((shimbun shimbun-mixi)
                                                &rest init-args)
-  (shimbun-mixi-set-comment-cache-internal shimbun
-                                          (make-hash-table :test 'equal))
+  (shimbun-mixi-initialize-comment-cache shimbun)
   shimbun)
 
+(luna-define-method shimbun-close :after ((shimbun shimbun-mixi))
+  (shimbun-mixi-initialize-comment-cache shimbun)
+  (when shimbun-mixi-logout-p
+    (mixi-logout)))
+
 (luna-define-method shimbun-groups ((shimbun shimbun-mixi))
   (mapcar 'car shimbun-mixi-group-alist))