* mixi.el (mixi-object-owner): New accessor method.
[elisp/mixi.git] / mixi.el
diff --git a/mixi.el b/mixi.el
index b6e3078..b01e5f6 100644 (file)
--- a/mixi.el
+++ b/mixi.el
 ;;  * mixi-get-comments
 ;;  * mixi-get-new-comments
 ;;  * mixi-get-messages
+;;  * mixi-get-introductions
+;; 
+;; Utilities:
+;;
+;;  * mixi-remove-markup
 
 ;; Example:
 ;;
@@ -52,7 +57,7 @@
 ;;             ;; retrieval.
 ;;             (from (mixi-friend-nick (mixi-diary-owner diary)))
 ;;             (date (format-time-string format (mixi-diary-time diary)))
-;;             (body (mixi-diary-content diary)))
+;;             (body (mixi-remove-markup (mixi-diary-content diary))))
 ;;         (insert "From: " from "\n"
 ;;                 "Subject: " subject "\n"
 ;;                 "Date: " date "\n\n"
@@ -75,7 +80,7 @@
 ;;             ;; retrieval.
 ;;             (from (mixi-friend-nick (mixi-diary-owner diary)))
 ;;             (date (format-time-string format (mixi-diary-time diary)))
-;;             (body (mixi-diary-content diary)))
+;;             (body (mixi-remove-markup (mixi-diary-content diary))))
 ;;         (insert "From: " from "\n"
 ;;                 "Subject: " subject "\n"
 ;;                 "Date: " date "\n\n"
@@ -86,7 +91,8 @@
 ;;                       (subject (concat "Re: " subject))
 ;;                       (date (format-time-string
 ;;                              format (mixi-comment-time comment)))
-;;                       (body (mixi-comment-content comment)))
+;;                       (body (mixi-remove-markup
+;;                              (mixi-comment-content comment))))
 ;;                   (insert "From: " from "\n"
 ;;                           "Subject: " subject "\n"
 ;;                           "Date: " date "\n\n"
 
 ;;; Code:
 
-(condition-case nil
-    (require 'url)
-  (error))
-
-(condition-case nil
-    (require 'w3m)
-  (error))
-
 (eval-when-compile (require 'cl))
 
 (defgroup mixi nil
   :type 'coding-system
   :group 'mixi)
 
-(defcustom mixi-retrieve-function
-  (if (fboundp 'url-retrieve-synchronously)
-      'mixi-w3-retrieve 'mixi-w3m-retrieve)
-  "*The function for retrieving."
-  :type '(choice (const :tag "Using w3" mixi-w3-retrieve)
-                (const :tag "Using w3m" mixi-w3m-retrieve)
-                (const :tag "Using curl" mixi-curl-retrieve)
-                (function :format "Other function: %v\n" :size 0))
-  :group 'mixi)
-
 (defcustom mixi-curl-program "curl"
   "*The program name of `curl'."
   :type 'file
   :type 'file
   :group 'mixi)
 
+(defcustom mixi-retrieve-function
+  (or (condition-case nil
+         (progn
+           (require 'url)
+           (if (fboundp 'url-retrieve-synchronously)
+               'mixi-w3-retrieve))
+       (error))
+      (condition-case nil
+         (progn
+           (require 'w3m)
+           'mixi-w3m-retrieve)
+       (error))
+      (if (and (fboundp 'executable-find)
+              (executable-find mixi-curl-program))
+         'mixi-curl-retrieve)
+      (error "Can't set `mixi-retrieve-function'"))
+  "*The function for retrieving."
+  :type '(radio (const :tag "Using w3" mixi-w3-retrieve)
+               (const :tag "Using w3m" mixi-w3m-retrieve)
+               (const :tag "Using curl" mixi-curl-retrieve)
+               (function :format "Other function: %v\n" :size 0))
+  :group 'mixi)
+
 (defcustom mixi-default-email nil
   "*Default E-mail address that is used to login automatically."
-  :type '(choice (string :tag "E-mail address")
-                (const :tag "Asked when it is necessary" nil))
+  :type '(radio (string :tag "E-mail address")
+               (const :tag "Asked when it is necessary" nil))
   :group 'mixi)
 
 (defcustom mixi-default-password nil
   "*Default password that is used to login automatically."
-  :type '(choice (string :tag "Password")
-                (const :tag "Asked when it is necessary" nil))
+  :type '(radio (string :tag "Password")
+               (const :tag "Asked when it is necessary" nil))
   :group 'mixi)
 
 (defcustom mixi-accept-adult-contents t
@@ -168,8 +179,9 @@ Increase this value when unexpected error frequently occurs."
 
 (defcustom mixi-cache-expires 3600
   "*Seconds for expiration of a cached object."
-  :type '(choice (integer :tag "Expired seconds")
-                (const :tag "Don't expire" nil))
+  :type '(radio (integer :tag "Expired seconds")
+               (const :tag "Don't expire" nil)
+               (const :tag "Don't cache" t))
   :group 'mixi)
 
 ;; FIXME: Not implemented.
@@ -214,6 +226,9 @@ Increase this value when unexpected error frequently occurs."
     (sit-for mixi-continuously-access-interval)
     (funcall mixi-retrieve-function url post-data)))
 
+(defmacro mixi-expand-url (url)
+  `(concat mixi-url ,url))
+
 (defun mixi-w3-retrieve (url &optional post-data)
   "Retrieve the URL and return gotten strings."
   (if post-data
@@ -222,7 +237,7 @@ Increase this value when unexpected error frequently occurs."
        (setq url-request-data post-data))
     (setq url-request-method "GET")
     (setq url-request-data nil))
-  (let* ((url (url-expand-file-name url mixi-url))
+  (let* ((url (mixi-expand-url url))
         (buffer (url-retrieve-synchronously url))
         ret)
     (unless (bufferp buffer)
@@ -246,7 +261,7 @@ Increase this value when unexpected error frequently occurs."
 
 (defun mixi-w3m-retrieve (url &optional post-data)
   "Retrieve the URL and return gotten strings."
-  (let ((url (w3m-expand-url url mixi-url)))
+  (let ((url (mixi-expand-url url)))
     (with-temp-buffer
       (if (not (string= (w3m-retrieve url nil nil post-data) "text/html"))
          (error (mixi-message "Cannot retrieve"))
@@ -273,7 +288,7 @@ Increase this value when unexpected error frequently occurs."
                                 (list "-i" "-L" "-s"
                                       "-b" mixi-curl-cookie-file
                                       "-c" mixi-curl-cookie-file
-                                      (concat mixi-url url)))))
+                                      (mixi-expand-url url)))))
            (set-process-sentinel process #'ignore))
        (set-default-file-modes orig-mode))
       (when post-data
@@ -359,7 +374,7 @@ Increase this value when unexpected error frequently occurs."
 (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)
@@ -372,6 +387,7 @@ Increase this value when unexpected error frequently occurs."
       (goto-char (point-min))
       (while (re-search-forward "\r" nil t)
        (replace-match "\n" t t)))
+    ;; FIXME: Decode entities.
     (buffer-string)))
 
 ;; Cache.
@@ -384,7 +400,7 @@ Increase this value when unexpected error frequently occurs."
     (setq t2 (cons (car t2) (car (cdr t2)))))
   (or (< (car t1) (car t2))
       (and (= (car t1) (car t2))
-          (< (nth 1 t1) (nth 1 t2)))))
+          (< (cdr t1) (cdr t2)))))
 
 (defun mixi-time-add (t1 t2)
   "Add two time values.  One should represent a time difference."
@@ -406,9 +422,11 @@ Increase this value when unexpected error frequently occurs."
   (let ((timestamp (mixi-object-timestamp object)))
     (unless (or (null mixi-cache-expires)
                 (null timestamp))
-      (mixi-time-less-p
-       (mixi-time-add timestamp (mixi-seconds-to-time mixi-cache-expires))
-       (current-time)))))
+      (if (numberp mixi-cache-expires)
+         (mixi-time-less-p
+          (mixi-time-add timestamp (mixi-seconds-to-time mixi-cache-expires))
+          (current-time))
+       t))))
 
 (defun mixi-make-cache (key value table)
   "Make a cache object and return it."
@@ -441,6 +459,14 @@ Increase this value when unexpected error frequently occurs."
   (aref (cdr object) 0))
 (defalias 'mixi-object-realize-p 'mixi-object-timestamp)
 
+(defun mixi-object-owner (object)
+  "Return the owner of OBJECT."
+  (unless (mixi-object-p object)
+    (signal 'wrong-type-argument (list 'mixi-object-p object)))
+  (let ((func (intern (concat mixi-object-prefix
+                             (mixi-object-name object) "-owner"))))
+    (funcall func object)))
+
 (defun mixi-object-id (object)
   "Return the id of OBJECT."
   (unless (mixi-object-p object)
@@ -449,6 +475,30 @@ Increase this value when unexpected error frequently occurs."
                              (mixi-object-name object) "-id"))))
     (funcall func object)))
 
+(defun mixi-object-time (object)
+  "Return the time of OBJECT."
+  (unless (mixi-object-p object)
+    (signal 'wrong-type-argument (list 'mixi-object-p object)))
+  (let ((func (intern (concat mixi-object-prefix
+                             (mixi-object-name object) "-time"))))
+    (funcall func object)))
+
+(defun mixi-object-title (object)
+  "Return the title of OBJECT."
+  (unless (mixi-object-p object)
+    (signal 'wrong-type-argument (list 'mixi-object-p object)))
+  (let ((func (intern (concat mixi-object-prefix
+                             (mixi-object-name object) "-title"))))
+    (funcall func object)))
+
+(defun mixi-object-content (object)
+  "Return the content of OBJECT."
+  (unless (mixi-object-p object)
+    (signal 'wrong-type-argument (list 'mixi-object-p object)))
+  (let ((func (intern (concat mixi-object-prefix
+                             (mixi-object-name object) "-content"))))
+    (funcall func object)))
+
 (defun mixi-object-set-timestamp (object timestamp)
   "Set the timestamp of OBJECT."
   (unless (mixi-object-p object)
@@ -458,6 +508,21 @@ Increase this value when unexpected error frequently occurs."
 (defmacro mixi-object-touch (object)
   `(mixi-object-set-timestamp ,object (current-time)))
 
+(defconst mixi-object-url-regexp
+  "/\\(show\\|view\\)_\\([a-z]+\\)\\.pl")
+
+(defun mixi-make-object-from-url (url)
+  "Return a mixi object from URL."
+  (if (string-match mixi-object-url-regexp url)
+      (let ((name (match-string 2 url)))
+       (when (string= name "bbs")
+         (setq name "topic"))
+       (let ((func (intern (concat mixi-object-prefix "make-" name
+                                   "-from-url"))))
+         (funcall func url)))
+    (when (string-match "/home\\.pl" url)
+      (mixi-make-friend-from-url url))))
+
 ;; Friend object.
 (defvar mixi-friend-cache (make-hash-table :test 'equal))
 (defun mixi-make-friend (id &optional nick)
@@ -467,6 +532,7 @@ Increase this value when unexpected error frequently occurs."
                   mixi-friend-cache))
 
 (defun mixi-make-me ()
+  "Return a my object."
   (unless mixi-me
     (with-mixi-retrieve "/home.pl"
       (if (string-match mixi-my-id-regexp buffer)
@@ -474,6 +540,17 @@ Increase this value when unexpected error frequently occurs."
        (signal 'error (list 'who-am-i)))))
   mixi-me)
 
+(defconst mixi-friend-url-regexp
+  "/show_friend\\.pl\\?id=\\([0-9]+\\)")
+
+(defun mixi-make-friend-from-url (url)
+  "Return a friend object from URL."
+  (if (string-match mixi-friend-url-regexp url)
+      (let ((id (match-string 1 url)))
+       (mixi-make-friend id))
+    (when (string-match "/home\\.pl" url)
+      (mixi-make-me))))
+
 (defmacro mixi-friend-p (friend)
   `(eq (mixi-object-class ,friend) 'mixi-friend))
 
@@ -545,8 +622,7 @@ Increase this value when unexpected error frequently occurs."
       (when (string-match mixi-friend-organization-regexp buf)
        (mixi-friend-set-organization friend (match-string 2 buf)))
       (when (string-match mixi-friend-profile-regexp buf)
-       (mixi-friend-set-profile
-        friend (mixi-remove-markup (match-string 1 buf)))))
+       (mixi-friend-set-profile friend (match-string 1 buf))))
     (mixi-object-touch friend)))
 
 (defun mixi-friend-id (friend)
@@ -822,6 +898,16 @@ Increase this value when unexpected error frequently occurs."
                     (cons 'mixi-diary (vector nil owner id nil nil nil))
                     mixi-diary-cache)))
 
+(defconst mixi-diary-url-regexp
+  "/view_diary\\.pl\\?id=\\([0-9]+\\)&owner_id=\\([0-9]+\\)")
+
+(defun mixi-make-diary-from-url (url)
+  "Return a diary object from URL."
+  (when (string-match mixi-diary-url-regexp url)
+    (let ((id (match-string 1 url))
+         (owner-id (match-string 2 url)))
+      (mixi-make-diary (mixi-make-friend owner-id) id))))
+
 (defmacro mixi-diary-p (diary)
   `(eq (mixi-object-class ,diary) 'mixi-diary))
 
@@ -860,8 +946,7 @@ Increase this value when unexpected error frequently occurs."
          (mixi-diary-set-title diary (match-string 1 buffer))
        (signal 'error (list 'cannot-find-title diary)))
       (if (string-match mixi-diary-content-regexp buffer)
-         (mixi-diary-set-content diary (mixi-remove-markup
-                                        (match-string 1 buffer)))
+         (mixi-diary-set-content diary (match-string 1 buffer))
        (signal 'error (list 'cannot-find-content diary))))
     (mixi-object-touch diary)))
 
@@ -926,7 +1011,8 @@ Increase this value when unexpected error frequently occurs."
 (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))
@@ -964,12 +1050,22 @@ Increase this value when unexpected error frequently occurs."
                                                    nil nil nil nil))
                   mixi-community-cache))
 
+(defconst mixi-community-url-regexp
+  "/view_community\\.pl\\?id=\\([0-9]+\\)")
+
+(defun mixi-make-community-from-url (url)
+  "Return a community object from URL."
+  (when (string-match mixi-community-url-regexp url)
+    (let ((id (match-string 1 url)))
+      (mixi-make-community id))))
+
 (defmacro mixi-community-p (community)
   `(eq (mixi-object-class ,community) 'mixi-community))
 
 (defmacro mixi-community-page (community)
   `(concat "/view_community.pl?id=" (mixi-community-id ,community)))
 
+;; FIXME: Not community specific.
 (defconst mixi-community-nodata-regexp
   "^¥Ç¡¼¥¿¤¬¤¢¤ê¤Þ¤»¤ó")
 (defconst mixi-community-name-regexp
@@ -1030,8 +1126,7 @@ Increase this value when unexpected error frequently occurs."
            (mixi-community-set-authority community (match-string 1 buffer))
          (signal 'error (list 'cannot-find-authority community)))
        (if (string-match mixi-community-description-regexp buffer)
-           (mixi-community-set-description
-            community (mixi-remove-markup (match-string 1 buffer)))
+           (mixi-community-set-description community (match-string 1 buffer))
          (signal 'error (list 'cannot-find-description community)))))
     (mixi-object-touch community)))
 
@@ -1160,7 +1255,8 @@ Increase this value when unexpected error frequently occurs."
 (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))
@@ -1190,6 +1286,16 @@ Increase this value when unexpected error frequently occurs."
                   (cons 'mixi-topic (vector nil community id nil nil nil nil))
                   mixi-topic-cache))
 
+(defconst mixi-topic-url-regexp
+  "/view_bbs\\.pl\\?id=\\([0-9]+\\)\\(&comment_count=[0-9]+\\)?&comm_id=\\([0-9]+\\)")
+
+(defun mixi-make-topic-from-url (url)
+  "Return a topic object from URL."
+  (when (string-match mixi-topic-url-regexp url)
+    (let ((id (match-string 1 url))
+         (community-id (match-string 3 url)))
+      (mixi-make-topic (mixi-make-community community-id) id))))
+
 (defmacro mixi-topic-p (topic)
   `(eq (mixi-object-class ,topic) 'mixi-topic))
 
@@ -1229,8 +1335,7 @@ Increase this value when unexpected error frequently occurs."
                                                  (match-string 2 buffer)))
        (signal 'error (list 'cannot-find-owner topic)))
       (if (string-match mixi-topic-content-regexp buffer)
-         (mixi-topic-set-content topic (mixi-remove-markup
-                                        (match-string 2 buffer)))
+         (mixi-topic-set-content topic (match-string 2 buffer))
        (signal 'error (list 'cannot-find-content topic))))
     (mixi-object-touch topic)))
 
@@ -1384,7 +1489,9 @@ Increase this value when unexpected error frequently occurs."
 <td>
 <a href=\"show_friend\\.pl\\?id=\\([0-9]+\\)\">\\(.+\\)</a>
 
-</td>
+\\(<font color=\"#f2ddb7\">|</font> <a href=[^>]+>ºï½ü</a>
+
+\\|\\)</td>
 </tr>
 </table>
 </td>
@@ -1409,15 +1516,15 @@ Increase this value when unexpected error frequently occurs."
 <td rowspan=\"2\" width=\"110\" bgcolor=\"#f2ddb7\" align=\"center\" nowrap>
 \\([0-9]+\\)ǯ\\([0-9]+\\)·î\\([0-9]+\\)Æü<br>
 \\([0-9]+\\):\\([0-9]+\\)<br>
-\\(</td>\\)
+</td>
 <td bgcolor=\"#fdf9f2\">&nbsp;<font color=\"#f8a448\">
-<b>&nbsp;&nbsp;[0-9]+</b>:</font>&nbsp;
-
-<a href=\"show_friend\\.pl\\?id=\\([0-9]+\\)\">\\(.+\\)</a>
+<b>[^<]+</b>:</font>&nbsp;
+\\(
+\\|\\)<a href=\"show_friend\\.pl\\?id=\\([0-9]+\\)\">\\(.+\\)</a>
 
+\\(
 
-
-</td>
+\\|\\)</td>
 </tr>
 <tr>
 <td bgcolor=\"#ffffff\" align=\"center\">
@@ -1453,7 +1560,7 @@ Increase this value when unexpected error frequently occurs."
                                    (string-to-number (nth 2 item))
                                    (string-to-number (nth 1 item))
                                    (string-to-number (nth 0 item)))
-                                  (mixi-remove-markup (nth 8 item))))
+                                  (nth 9 item)))
              items))))
 
 (defmacro mixi-new-comment-list-page ()
@@ -1475,6 +1582,18 @@ Increase this value when unexpected error frequently occurs."
            items)))
 
 ;; Message object.
+(defconst mixi-message-box-list '(inbox outbox savebox thrash)) ; thrash?
+
+(defmacro mixi-message-box-p (box)
+  `(when (memq ,box mixi-message-box-list)
+     t))
+
+(defun mixi-message-box-name (box)
+  "Return the name of BOX."
+  (unless (mixi-message-box-p box)
+    (signal 'wrong-type-argument (list 'mixi-message-box-p box)))
+  (symbol-name box))
+
 (defvar mixi-message-cache (make-hash-table :test 'equal))
 (defun mixi-make-message (id box)
   "Return a message object."
@@ -1482,6 +1601,16 @@ Increase this value when unexpected error frequently occurs."
                   (cons 'mixi-message (vector nil id box nil nil nil nil))
                   mixi-message-cache))
 
+(defconst mixi-message-url-regexp
+  "/view_message\\.pl\\?id=\\([a-z0-9]+\\)&box=\\([a-z]+\\)")
+
+(defun mixi-make-message-from-url (url)
+  "Return a message object from URL."
+  (when (string-match mixi-message-url-regexp url)
+    (let ((id (match-string 1 url))
+         (box (match-string 2 url)))
+      (mixi-make-message id box))))
+
 (defmacro mixi-message-p (message)
   `(eq (mixi-object-class ,message) 'mixi-message))
 
@@ -1520,8 +1649,7 @@ Increase this value when unexpected error frequently occurs."
                                (string-to-number (match-string 1 buffer))))
        (signal 'error (list 'cannot-find-time message)))
       (if (string-match mixi-message-content-regexp buffer)
-         (mixi-message-set-content message (mixi-remove-markup
-                                            (match-string 1 buffer)))
+         (mixi-message-set-content message (match-string 1 buffer))
        (signal 'error (list 'cannot-find-content message))))
     (mixi-object-touch message)))
 
@@ -1599,20 +1727,118 @@ Increase this value when unexpected error frequently occurs."
 (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))
+    (when (or (not (mixi-message-box-p box))
+             (mixi-message-box-p max-numbers))
       (setq box (nth 1 args))
       (setq max-numbers (nth 0 args)))
-    (let ((items (mixi-get-matched-items (mixi-message-list-page box)
-                                        max-numbers
-                                        mixi-message-list-regexp)))
+    (let ((items (mixi-get-matched-items
+                 (mixi-message-list-page
+                  (when box (mixi-message-box-name box)))
+                 max-numbers
+                 mixi-message-list-regexp)))
       (mapcar (lambda (item)
                (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))
+                                       (nth 2 item)))
+             items))))
+
 (provide 'mixi)
 
 ;;; mixi.el ends here