From: bg66 Date: Thu, 28 Dec 2006 06:37:03 +0000 (+0000) Subject: * sb-mixi.el (shimbun-mixi-message-id-suffix): New constant. X-Git-Tag: mixi-el-1_0_0~134 X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=da7f69afa5a2c12c5e263cff461600690d90ca0f;p=elisp%2Fmixi.git * sb-mixi.el (shimbun-mixi-message-id-suffix): New constant. (shimbun-mixi-make-message-id): Use it and change return value. (shimbun-mixi-make-object-from-message-id): New function. --- diff --git a/ChangeLog b/ChangeLog index 456fe0e..59187f7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2006-12-28 OHASHI Akira + * sb-mixi.el (shimbun-mixi-message-id-suffix): New constant. + (shimbun-mixi-make-message-id): Use it and change return value. + (shimbun-mixi-make-object-from-message-id): New function. + +2006-12-28 OHASHI Akira + * sb-mixi.el (shimbun-mixi-logout-p): Abolish. (shimbun-close): Follow the change above. diff --git a/sb-mixi.el b/sb-mixi.el index 3a1195d..3f9a945 100644 --- a/sb-mixi.el +++ b/sb-mixi.el @@ -115,19 +115,52 @@ of mixi object." month " " (format-time-string "%Y %H:%M:%S %z" time)))) +(defconst shimbun-mixi-message-id-suffix "@mixi.jp") + (defun shimbun-mixi-make-message-id (object) + "Make message-id for OBJECT. +If OBJECT is comment, message-id is like follow: + + + +If OBJECT is diary or BBS or message: + + + +If OBJECT is log: + + + +The others: + + " (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" - ">"))) + (unless (or (eq class 'mixi-friend) (eq class 'mixi-community)) + (format-time-string "%Y%m%d%H%M." (mixi-object-time object))) + (mapconcat (lambda (object) + (concat (mixi-object-id object) + "." (mixi-object-name object))) + (cond ((eq class 'mixi-comment) + (let ((parent (mixi-comment-parent object))) + (list (mixi-comment-owner object) + parent + (if (eq (mixi-object-class parent) + 'mixi-diary) + (mixi-object-owner parent) + (mixi-bbs-community parent))))) + ((or (eq class 'mixi-diary) + (eq class 'mixi-message)) + (list object (mixi-object-owner object))) + ((mixi-bbs-p object) + (list object (mixi-bbs-community object))) + ((eq class 'mixi-log) + (list (mixi-log-friend object))) + (t + (list object))) + "$") + shimbun-mixi-message-id-suffix ">"))) (defun shimbun-mixi-make-xref (object) (let ((class (mixi-object-class object))) @@ -254,6 +287,32 @@ of mixi object." (shimbun-message shimbun "shimbun: Make contents...done"))) ""))))) +(defun shimbun-mixi-make-object-from-message-id (message-id) + (when (string-match (concat "^<\\(.+\\)" + (regexp-quote shimbun-mixi-message-id-suffix) + ">$") message-id) + (let ((parts (reverse (split-string (match-string 1 message-id) "\\$"))) + object parent comment) + (catch 'stop + (mapc (lambda (part) + (if (string-match "\\([a-z0-9]+\\)\\.\\([a-z]+\\)$" part) + (let ((id (match-string 1 part)) + (func (intern (concat + mixi-object-prefix + "make-" (match-string 2 part))))) + (cond ((null object) + (setq object (funcall func id))) + ((null parent) + (setq parent (funcall func object id))) + ((null comment) + (setq comment + (mixi-make-comment parent + (mixi-make-friend id) + nil "dummy"))))) + (throw 'stop nil))) + parts)) + (or comment parent object)))) + (provide 'sb-mixi) ;;; sb-mixi.el ends here