+2006-10-25 OHASHI Akira <bg66@koka-in.org>
+
+ * mixi.el (mixi-remove-markup): When STRING is nil, insert a null
+ string.
+ (mixi-make-introduction): New function.
+ (mixi-introduction-p): New macro.
+ (mixi-introduction-parent): New accessor method.
+ (mixi-introduction-owner): Ditto.
+ (mixi-introduction-content): Ditto.
+ (mixi-introduction-list-page): New macro.
+ (mixi-introduction-list-regexp): New regexp.
+ (mixi-my-introduction-list-regexp): Ditto.
+ (mixi-get-introductions): New function.
+
2006-10-25 Daiki Ueno <ueno@unixuser.org>
* mixi.el (mixi-retrieve-function): Try to select
(mixi-make-message): New function.
(mixi-message-p): New macro.
(mixi-message-page): Ditto.
- (mixi-message-owner-regexp): New constant.
+ (mixi-message-owner-regexp): New regexp.
(mixi-message-title-regexp): Ditto.
(mixi-message-time-regexp): Ditto.
(mixi-message-content-regexp): Ditto.
(mixi-message-set-time): Ditto.
(mixi-message-set-content): Ditto.
(mixi-message-list-page): New macro.
- (mixi-message-list-regexp): New constant.
+ (mixi-message-list-regexp): New regexp.
(mixi-get-messages): New function.
2006-10-24 Daiki Ueno <ueno@unixuser.org>
* mixi.el (mixi-make-community): New slot `members'.
(mixi-community-members): New accessor method.
(mixi-community-set-members): Ditto.
- (mixi-community-members-regexp): New constant.
+ (mixi-community-members-regexp): New regexp.
(mixi-community-realize): Use them.
* mixi.el (mixi-make-community): New slot `open level'.
(mixi-community-open-level): New accessor method.
(mixi-community-set-open-level): Ditto.
- (mixi-community-open-level-regexp): New constant.
+ (mixi-community-open-level-regexp): New regexp.
(mixi-community-realize): Use them.
* mixi.el (mixi-make-community): New slot `authority'.
(mixi-community-authority): New accessor method.
(mixi-community-set-authority): Ditto.
- (mixi-community-authority-regexp): New constant.
+ (mixi-community-authority-regexp): New regexp.
(mixi-community-realize): Use them.
2006-10-22 OHASHI Akira <bg66@koka-in.org>
* mixi.el (mixi-make-friend): New slot `address'.
(mixi-friend-address): New accessor method.
(mixi-friend-set-address): Ditto.
- (mixi-friend-address-regexp): New constant.
+ (mixi-friend-address-regexp): New regexp.
(mixi-friend-realize): Use them.
* mixi.el (mixi-make-friend): New slot `age'.
(mixi-friend-age): New accessor method.
(mixi-friend-set-age): Ditto.
- (mixi-friend-age-regexp): New constant.
+ (mixi-friend-age-regexp): New regexp.
(mixi-friend-realize): Use them.
* mixi.el (mixi-make-friend): New slot `birthday'.
(mixi-friend-birthday): New accessor method.
(mixi-friend-set-birthday): Ditto.
- (mixi-friend-birthday-regexp): New constant.
+ (mixi-friend-birthday-regexp): New regexp.
(mixi-friend-realize): Use them.
* mixi.el (mixi-make-friend): New slot `blood type'.
(mixi-friend-blood-type): New accessor method.
(mixi-friend-set-blood-type): Ditto.
- (mixi-friend-blood-type-regexp): New constant.
+ (mixi-friend-blood-type-regexp): New regexp.
(mixi-friend-realize): Use them.
* mixi.el (mixi-make-friend): New slot `birthplace'.
(mixi-friend-birthplace): New accessor method.
(mixi-friend-set-birthplace): Ditto.
- (mixi-friend-birthplace-regexp): New constant.
+ (mixi-friend-birthplace-regexp): New regexp.
(mixi-friend-realize): Use them.
* mixi.el (mixi-make-friend): New slot `hobby'.
(mixi-friend-hobby): New accessor method.
(mixi-friend-set-hobby): Ditto.
- (mixi-friend-hobby-regexp): New constant.
+ (mixi-friend-hobby-regexp): New regexp.
(mixi-friend-realize): Use them.
* mixi.el (mixi-make-friend): New slot `job'.
(mixi-friend-job): New accessor method.
(mixi-friend-set-job): Ditto.
- (mixi-friend-job-regexp): New constant.
+ (mixi-friend-job-regexp): New regexp.
(mixi-friend-realize): Use them.
* mixi.el (mixi-make-friend): New slot `organization'.
(mixi-friend-organization): New accessor method.
(mixi-friend-set-organization): Ditto.
- (mixi-friend-organization-regexp): New constant.
+ (mixi-friend-organization-regexp): New regexp.
(mixi-friend-realize): Use them.
* mixi.el (mixi-make-friend): New slot `profile'.
(mixi-friend-profile): New accessor method.
(mixi-friend-set-profile): Ditto.
- (mixi-friend-profile-regexp): New constant.
+ (mixi-friend-profile-regexp): New regexp.
(mixi-friend-realize): Use them.
2006-10-21 OHASHI Akira <bg66@koka-in.org>
;; * mixi-get-comments
;; * mixi-get-new-comments
;; * mixi-get-messages
+;; * mixi-get-introductions
;; Example:
;;
(defun mixi-remove-markup (string)
"Remove markups from STRING."
(with-temp-buffer
- (insert string)
+ (insert (or string ""))
(save-excursion
(goto-char (point-min))
(while (search-forward "<!--" nil t)
(defun mixi-get-diaries (&rest args)
"Get diaries of FRIEND."
(when (> (length args) 2)
- (signal 'wrong-number-of-arguments (list 'mixi-get-friends (length args))))
+ (signal 'wrong-number-of-arguments
+ (list 'mixi-get-diaries (length args))))
(let ((friend (nth 0 args))
(max-numbers (nth 1 args)))
(when (or (not (mixi-friend-p friend)) (mixi-friend-p max-numbers))
(defun mixi-get-communities (&rest args)
"Get communities of FRIEND."
(when (> (length args) 2)
- (signal 'wrong-number-of-arguments (list 'mixi-get-friends (length args))))
+ (signal 'wrong-number-of-arguments
+ (list 'mixi-get-communities (length args))))
(let ((friend (nth 0 args))
(max-numbers (nth 1 args)))
(when (or (not (mixi-friend-p friend)) (mixi-friend-p max-numbers))
(defun mixi-get-messages (&rest args)
"Get messages."
(when (> (length args) 2)
- (signal 'wrong-number-of-arguments (list 'mixi-get-messages
- (length args))))
+ (signal 'wrong-number-of-arguments
+ (list 'mixi-get-messages (length args))))
(let ((box (nth 0 args))
(max-numbers (nth 1 args)))
(when (or (not (stringp box)) (stringp max-numbers))
(mixi-make-message (nth 0 item) (nth 1 item)))
items))))
+;; Introduction object.
+(defun mixi-make-introduction (parent owner content)
+ "Return a introduction object."
+ (cons 'mixi-introduction (vector parent owner content)))
+
+(defmacro mixi-introduction-p (introduction)
+ `(eq (mixi-object-class ,introduction) 'mixi-introduction))
+
+(defun mixi-introduction-parent (introduction)
+ "Return the parent of INTRODUCTION."
+ (unless (mixi-introduction-p introduction)
+ (signal 'wrong-type-argument (list 'mixi-introduction-p introduction)))
+ (aref (cdr introduction) 0))
+
+(defun mixi-introduction-owner (introduction)
+ "Return the owner of INTRODUCTION."
+ (unless (mixi-introduction-p introduction)
+ (signal 'wrong-type-argument (list 'mixi-introduction-p introduction)))
+ (aref (cdr introduction) 1))
+
+(defun mixi-introduction-content (introduction)
+ "Return the content of INTRODUCTION."
+ (unless (mixi-introduction-p introduction)
+ (signal 'wrong-type-argument (list 'mixi-introduction-p introduction)))
+ (aref (cdr introduction) 3))
+
+(defmacro mixi-introduction-list-page (&optional friend)
+ `(concat "/show_intro.pl?page=%d"
+ (when ,friend (concat "&id=" (mixi-friend-id ,friend)))))
+
+(defconst mixi-introduction-list-regexp
+ "<tr bgcolor=#FFFFFF>
+<td WIDTH=150 background=http://img\\.mixi\\.jp/img/bg_line\\.gif align=\"center\"><a href=\"show_friend\\.pl\\?id=\\([0-9]+\\)\"><img src=\".+\" border=0><br>
+\\(.+\\)</td></a>
+
+<td WIDTH=480>
+\\(´Ø·¸¡§.+<br>
+
+
+\\(\\(.\\|\n<br>\\)+\\)\\|
+\\(\\(.\\|\n<br>\\)+\\)\\)
+
+
+
+
+</td>
+</tr>")
+(defconst mixi-my-introduction-list-regexp
+ "<tr bgcolor=#FFFFFF>
+<td WIDTH=150 background=http://img\\.mixi\\.jp/img/bg_line\\.gif align=\"center\"><a href=\"show_friend\\.pl\\?id=\\([0-9]+\\)\"><img src=\".+\" border=0><br>
+\\(.+\\)</td></a>
+
+
+<td WIDTH=480>
+\\(´Ø·¸¡§.+<br>
+
+
+\\(\\(.\\|\n<br>\\)+\\)\\|
+\\(\\(.\\|\n<br>\\)+\\)\\)
+
+
+<br>
+<a href=\"edit_intro\\.pl\\?id=\\1&type=edit\">¤³¤Îͧ¿Í¤ò¾Ò²ð¤¹¤ë</a>
+
+
+<BR>
+<a href=\"delete_intro\\.pl\\?id=\\1\">ºï½ü</a>
+
+</td>
+</tr>")
+
+(defun mixi-get-introductions (&rest args)
+ "Get introductions."
+ (when (> (length args) 2)
+ (signal 'wrong-number-of-arguments
+ (list 'mixi-get-introduction (length args))))
+ (let ((friend (nth 0 args))
+ (max-numbers (nth 1 args)))
+ (when (or (not (mixi-friend-p friend)) (mixi-friend-p max-numbers))
+ (setq friend (nth 1 args))
+ (setq max-numbers (nth 0 args)))
+ (unless (or (null friend) (mixi-friend-p friend))
+ (signal 'wrong-type-argument (list 'mixi-friend-p friend)))
+ (let* ((regexp (if friend mixi-introduction-list-regexp
+ mixi-my-introduction-list-regexp))
+ (items (mixi-get-matched-items (mixi-introduction-list-page friend)
+ max-numbers
+ regexp)))
+ (mapcar (lambda (item)
+ (mixi-make-introduction (or friend (mixi-make-me))
+ (mixi-make-friend (nth 0 item)
+ (nth 1 item))
+ (mixi-remove-markup (nth 2 item))))
+ items))))
+
(provide 'mixi)
;;; mixi.el ends here