X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;f=sb-mixi.el;h=22c9e4c28100da17801ccf7b7d0c0919f1a4dd6f;hb=c48ca02706cf597ba8c7992d1be0fa584cdbadc7;hp=340450da075a99b8268f6b2c249bbbed13155140;hpb=096e7deafcf305bb6fc4b726581819136536543f;p=elisp%2Fmixi.git diff --git a/sb-mixi.el b/sb-mixi.el index 340450d..22c9e4c 100644 --- a/sb-mixi.el +++ b/sb-mixi.el @@ -30,23 +30,81 @@ ;;; Code: (require 'mixi) +(require 'mixi-utils) (require 'shimbun) (eval-and-compile (luna-define-class shimbun-mixi (shimbun) (comment-cache)) (luna-define-internal-accessors 'shimbun-mixi)) -(defcustom shimbun-mixi-group-alist '(("new-diaries" . mixi-get-new-diaries) - ("new-comments" . mixi-get-new-comments) - ("new-bbses" . mixi-get-new-bbses) - ("messages" . mixi-get-messages) - ("my-diaries" . "/home.pl")) +(defconst shimbun-mixi-default-group-alist + '(("new-diaries" . mixi-get-new-diaries) + ("new-comments" . mixi-get-new-comments) + ("new-bbses" . mixi-get-new-bbses) + ("messages" . mixi-get-messages) + ("messages.sent" . + (lambda (range) + (mixi-get-messages 'outbox range))) + ("logs" . mixi-get-logs) + ("my-diaries" . "/home.pl") + ("mixi-el" . "/view_community.pl?id=1596390") + ("news.newest.domestic" . + (lambda (range) + (mixi-get-news 'domestic 'newest range))) + ("news.newest.politics" . + (lambda (range) + (mixi-get-news 'politics 'newest range))) + ("news.newest.economy" . + (lambda (range) + (mixi-get-news 'economy 'newest range))) + ("news.newest.area" . + (lambda (range) + (mixi-get-news 'area 'newest range))) + ("news.newest.abroad" . + (lambda (range) + (mixi-get-news 'abroad 'newest range))) + ("news.newest.sports" . + (lambda (range) + (mixi-get-news 'sports 'newest range))) + ("news.newest.entertainment" . + (lambda (range) + (mixi-get-news 'entertainment 'newest range))) + ("news.newest.it" . + (lambda (range) + (mixi-get-news 'IT 'newest range))) + ("news.pickup.domestic" . + (lambda (range) + (mixi-get-news 'domestic 'pickup range))) + ("news.pickup.politics" . + (lambda (range) + (mixi-get-news 'politics 'pickup range))) + ("news.pickup.economy" . + (lambda (range) + (mixi-get-news 'economy 'pickup range))) + ("news.pickup.area" . + (lambda (range) + (mixi-get-news 'area 'pickup range))) + ("news.pickup.abroad" . + (lambda (range) + (mixi-get-news 'abroad 'pickup range))) + ("news.pickup.sports" . + (lambda (range) + (mixi-get-news 'sports 'pickup range))) + ("news.pickup.entertainment" . + (lambda (range) + (mixi-get-news 'entertainment 'pickup range))) + ("news.pickup.it" . + (lambda (range) + (mixi-get-news 'IT 'pickup range)))) + "An alist of mixi shimbun group default definition.") + +(defcustom shimbun-mixi-group-alist nil "*An alist of mixi shimbun group definition. Each element looks like (NAME . URL) or (NAME . FUNCTION). NAME is a shimbun group name. -URL is the URL for mixi access point of the group. When URL is friend's, get -his/her diaries as article. When community's, get its BBSes. When diary's -or BBS's, get its comments. +URL is the URL for mixi access point of the group. If URL is friend's, get +his/her diaries as article. If community's, get its BBSes. If diary's or +BBS's, get its comments. FUNCTION is the function which has one `range' argument and returns the list of mixi object." :group 'shimbun @@ -57,6 +115,7 @@ of mixi object." (const :tag "New comments" mixi-get-new-comments) (const :tag "New BBSes" mixi-get-new-bbses) (const :tag "Messages" mixi-get-messages) + (const :tag "Logs" mixi-get-logs) (function :tag "Other function"))))) ;; FIXME: Don't use this user option. @@ -65,21 +124,15 @@ of mixi object." :group 'shimbun :type 'integer) -(defcustom shimbun-mixi-get-comment-p t - "*If non-nil, get diaries or BBSes together with its comments." - :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?==|oBE'5GGH\\#z[muyQ"))) +(defun shimbun-mixi-group-alist () + (append shimbun-mixi-default-group-alist + shimbun-mixi-group-alist)) + (luna-define-method initialize-instance :after ((shimbun shimbun-mixi) &rest init-args) (shimbun-mixi-set-comment-cache-internal shimbun @@ -88,165 +141,77 @@ of mixi object." (luna-define-method shimbun-close :after ((shimbun shimbun-mixi)) (shimbun-mixi-set-comment-cache-internal shimbun nil) - (when shimbun-mixi-logout-p - (mixi-logout))) + (mixi-logout)) (luna-define-method shimbun-groups ((shimbun shimbun-mixi)) - (mapcar 'car shimbun-mixi-group-alist)) - -(defun shimbun-mixi-make-subject (shimbun object) - (let ((class (mixi-object-class object))) - (if (eq class 'mixi-comment) - (concat "Re: " (shimbun-mixi-make-subject - shimbun (mixi-comment-parent object))) - (let ((prefix (when (eq class 'mixi-event) "[¥¤¥Ù¥ó¥È]")) - (subject (mixi-object-title object)) - (suffix (when (string-match - "^new-" (shimbun-current-group-internal shimbun)) - (concat " (" - (if (eq class 'mixi-diary) - (mixi-friend-nick - (mixi-diary-friend object)) - (mixi-community-name - (mixi-bbs-community object))) - ")")))) - (concat prefix subject suffix))))) + (mapcar 'car (shimbun-mixi-group-alist))) -(defun shimbun-mixi-make-from (object) - (let ((owner (mixi-object-owner object))) - (mixi-friend-nick owner))) - -(defun shimbun-mixi-make-date (object) - (let* ((time (mixi-object-time object)) - (cts (current-time-string time)) - (day-of-week (substring cts 0 3)) - (month (substring cts 4 7))) - (concat day-of-week ", " - (format-time-string "%d" time) " " - month " " - (format-time-string "%Y %H:%M:%S %z" time)))) - -(defun shimbun-mixi-make-message-id (object) - (let ((class (mixi-object-class object))) - (concat "<" - (format-time-string "%Y%m%d%H%M" (mixi-object-time object)) "." - (if (eq class 'mixi-comment) - (concat (mixi-friend-id (mixi-comment-owner object)) "@" - (mixi-object-id (mixi-comment-parent object)) "." - (mixi-friend-id (mixi-object-owner - (mixi-comment-parent object))) ".") - (concat (mixi-object-id object) "@" - (mixi-object-id (mixi-object-owner object)) ".")) - (mixi-object-name object) ".mixi.jp" - ">"))) - -(defun shimbun-mixi-make-xref (object) - (let ((class (mixi-object-class object))) - (cond ((eq class 'mixi-diary) - (mixi-expand-url (mixi-diary-page object))) - ((eq class 'mixi-topic) - (mixi-expand-url (mixi-topic-page object))) - ((eq class 'mixi-event) - (mixi-expand-url (mixi-event-page object))) - ((eq class 'mixi-comment) - (concat (shimbun-mixi-make-xref (mixi-comment-parent object)) - "#comment")) - ((eq class 'mixi-message) - (mixi-expand-url (mixi-message-page object)))))) - -(defun shimbun-mixi-make-body (object) - (let ((class (mixi-object-class object))) - (cond ((eq class 'mixi-event) - (let ((limit (mixi-event-limit object))) - (setq limit (if limit - (format-time-string "%Yǯ%m·î%dÆü" limit) - "»ØÄê¤Ê¤·")) - (concat "