--- pollen.el.orig	2003-02-01 06:36:35.389504000 +0900
+++ pollen.el	2004-02-03 22:12:28.651390400 +0900
@@ -1,4 +1,4 @@
-;;; pollen.el --- Pollen Report -*- coding: iso-2022-jp -*- 
+;;; pollen.el --- Pollen Report -*- coding: iso-2022-jp -*-
 
 ;; Copyright (C) 1999-2002 Junichiro KITA <kita@a1.mbn.or.jp>
 
@@ -39,7 +39,8 @@
 
 (defvar pollen-message "%s$B$N(B%s$B$N?y2VJ4$O(B%s$B$G$9(B"
   "* Message format.
-First `%s' is replaced with DATE, second `%s' with WHERE, third `%s' with QUANTITY.")
+First `%s' is replaced with DATE, second `%s' with WHERE,
+third `%s' with QUANTITY.")
 (defvar pollen-message-off-season "$B$b$&(B%s$B$K$O?y2VJ4$OHt$s$G$$$^$;$s(B"
   "* Message format for off season.
 First %s is replaced with WHERE")
@@ -48,7 +49,8 @@
 (defvar pollen-season-end 4)
 (defvar pollen-url-template "http://www.wni.co.jp/cww/docs/kafun/%s.html")
 (defvar pollen-get-func 'pollen-get)
-(defvar pollen-coding-system (static-if (boundp 'MULE) '*euc-japan* 'euc-japan))
+(defvar pollen-coding-system
+  (static-if (boundp 'MULE) '*euc-japan* 'euc-japan))
 (defvar pollen-fetch-interval (* 60 60 3)
   "* Default life time for cached data.")
 (defvar pollen-cache nil
@@ -58,7 +60,7 @@
 (defvar pollen-region-alist
   '(
     ;; $BElKLF|K\3$B&(B
-    ("$B@D?98)DE7Z(B" . "yoho3110") ("$B@D?98)DE7Z(B" . "yoho3120")
+    ("$B@D?98)DE7Z(B" . "yoho3110") ("$B@D?98)2<KL(B" . "yoho3120")
     ("$B@D?98);0H,>eKL(B" . "yoho3130")
     ("$B=)ED8)1h4_(B" . "yoho3210") ("$B=)ED8)FbN&(B" . "yoho3220")
     ("$B;37A8)B<;3(B" . "yoho3510") ("$B;37A8)CV;r(B" . "yoho3520")
@@ -66,7 +68,7 @@
     ;; $BElKLB@J?MNB&(B
     ("$B4d<j8)FbN&(B" . "yoho3310") ("$B4d<j8)1h4_KLIt(B" . "yoho3320")
     ("$B4d<j8)1h4_FnIt(B" . "yoho3330")
-    ("$B5\>k8)J?Ln(B" . "yoho3410") ("$B5\>k8);31h$$(B" . "yoho3420")
+    ("$B5\>k8)ElIt(B" . "yoho3410") ("$B5\>k8)@>It(B" . "yoho3420")
     ("$BJ!Eg8)CfDL$j(B" . "yoho3610") ("$BJ!Eg8)IMDL$j(B" . "yoho3620")
     ("$BJ!Eg8)2qDE(B" . "yoho3630")
     ;; $BKLN&(B
@@ -98,11 +100,11 @@
     ("$B<"2l8)FnIt(B" . "yoho6010") ("$B<"2l8)KLIt(B" . "yoho6010")
     ("$B5~ETI\KLIt(B" . "yoho400") ("$B5~ETI\FnIt(B" . "yoho6100")
     ("$BF`NI8)KLIt(B" . "yoho6410") ("$BF`NI8)FnIt(B" . "yoho6420")
-    ("$BBg:eI\A48)(B" . "yoho6200")
+    ("$BBg:eI\A40h(B" . "yoho6200") ("$BBg:eI\(B" . "yoho6200")
     ("$BOB2N;38)KLIt(B" . "yoho6510") ("$BOB2N;38)FnIt(B" . "yoho6520")
     ("$BJ<8K8)KLIt(B" . "yoho500") ("$BJ<8K8)FnIt(B" . "yoho6300")
     ;; $B;31"(B
-    ("$BD;<h8)ElIt(B" . "yoho6910") ("$BD;<h8)@>It(B" . "yoho6920")
+    ("$BD;<h8)ElIt(B" . "yoho6910") ("$BD;<h8)Cf!&@>It(B" . "yoho6920")
     ("$BEg:,8)1#4t(B" . "yoho600") ("$BEg:,8)ElIt(B" . "yoho6810")
     ("$BEg:,8)@>It(B" . "yoho6820")
     ;; $B;3M[(B
@@ -111,7 +113,7 @@
     ("$B;38}8)@>It(B" . "yoho8110") ("$B;38}8)CfIt(B" . "yoho8120")
     ("$B;38}8)ElIt(B" . "yoho8130") ("$B;38}8)KLIt(B" . "yoho8140")
     ;; $B;M9q(B
-    ("$B9a@n8)A48)(B" . "yoho7200")
+    ("$B9a@n8)A40h(B" . "yoho7200") ("$B9a@n8)(B" . "yoho7200")
     ("$BFAEg8)KLIt(B" . "yoho7110") ("$BFAEg8)FnIt(B" . "yoho7120")
     ("$B0&I28)CfM=(B" . "yoho7310") ("$B0&I28)ElM=(B" . "yoho7320")
     ("$B0&I28)FnM=(B" . "yoho7330")
@@ -130,62 +132,43 @@
     ;; $B6e=#FnIt(B
     ("$B5\:j8)FnItJ?LnIt(B" . "yoho8710") ("$B5\:j8)KLItJ?LnIt(B" . "yoho8720")
     ("$B5\:j8)FnIt;31h$$(B" . "yoho8730") ("$B5\:j8)KLIt;31h$$(B" . "yoho8740")
-    ("$B</;yEg8);'K`(B" . "yoho8810")
-    ("$B</;yEg8)Bg7((B" . "yoho8820")
-    ("$B</;yEg8)205WEg<o;REg(B" . "yoho900")
-    ("$B</;yEg8)1bH~(B" . "yoho1000")
+    ("$B</;yEg8);'K`(B" . "yoho8810") ("$B</;yEg8)Bg7((B" . "yoho8820")
+    ("$B</;yEg8)<o;REg205WEg(B" . "yoho900") ("$B</;yEg8)1bH~(B" . "yoho1000")
     ))
 
 
-(defsubst pollen-today-p ()
-  (> 11 (string-to-int (format-time-string "%k" (current-time)))))
-
 (defun pollen-get (buf &optional args)
   (let (date quantity from to)
     (save-excursion
       (set-buffer buf)
-      ;; $BM=Js>pJs$@$1$r@Z$j=P$7(B
+      ;; $BM=Js>pJs$@$1$r@Z$j=P$7(B ($B%7!<%:%sKh$K=q$-49$($k(B)
       (goto-char (point-min))
-      (search-forward "yoho_hisan.gif")
-      (forward-line 1)
-      (setq from (point))
-      (search-forward "$B;~H/I=(B")
-      (forward-line -1)
-      (setq to (point))
-      (narrow-to-region from to)
+      (when (search-forward "ctitle_scattering.gif" nil t)
+	(forward-line 1)
+	(setq from (point))
+	(when (search-forward "<b>$BK^Nc(B</b>" nil t)
+	  (forward-line -1)
+	  (setq to (point))))
+      (if to
+	  (narrow-to-region from to)
+	(error "Pollen: $BM=Js>pJs$r@Z$j=P$;$^$;$s!%(B"))
+      ;; $BF|IU!&2VJ4>pJs$N<hF@(B ($B%7!<%:%sKh$K=q$-49$($k(B)
       (goto-char (point-min))
-
-      ;; $BF|IU$rC5$9(B
-      (re-search-forward "\\([0-9]+/[0-9]+\\)" nil t)
-      (if (re-search-forward "\\([0-9]+/[0-9]+\\)" nil t)
-	  ;; $B$3$&$$$&7A<0$@$C$?$i(B
-	  ;; +-----+--------+
-	  ;; |mm/dd| mm/dd  |
-	  ;; +-----+--------+
-	  ;; |today|tommorow|
-	  ;; +-----+--------+
-	  (progn
-	    (setq date (match-string 1))
-	    (re-search-forward "alt=\"\\(.*\\)\"")
-	    (or (pollen-today-p)
-		(re-search-forward "alt=\"\\(.*\\)\""))) ; $B:#F|$NJ,$OMW$i$s$N$h(B
-	;; $B$G$J$1$l$P$3$&$$$&7A<0$N$O$:$J$N$h(B
-	;; +-----+
-	;; |mm/dd|
-	;; +-----+
-	;; |today|
-	;; +-----+
-	(setq date (match-string 1))
-	(re-search-forward "alt=\"\\(.*\\)\""))
-      (setq quantity (match-string 1))
-      (list date quantity))))
+      (while (re-search-forward "\\([1-6]/[1-3]?[0-9]\\)" nil t)
+	(setq date (match-string 1)))
+      (if (re-search-forward "alt=\"\\(.*\\)\"" nil t)
+	  (setq quantity (match-string 1)))
+      (if (and date quantity)
+	  (list date quantity)
+	(error "Pollen: $BF|IU!&2VJ4>pJs$r8+IU$1$i$l$^$;$s!%(B")))))
 
 (defsubst pollen-current-second ()
   (string-to-int (format-time-string "%s" (current-time))))
 
 (defun pollen-set-cache (where date quantity)
   (setq pollen-cache
-	(put-alist where (list (pollen-current-second) date quantity) pollen-cache)))
+	(put-alist where
+		   (list (pollen-current-second) date quantity) pollen-cache)))
 
 (defun pollen-get-cache (where)
   (let (current cache ret)
@@ -197,8 +180,10 @@
 	  (setq ret (cddr cache))))
     ret))
 
-(defsubst pollen-compose (where date quantity)
-  (format pollen-message date where quantity))
+(if (fboundp 'pollen-compose)
+    nil
+  (defun pollen-compose (where date quantity)
+    (format pollen-message date where quantity)))
 
 (defsubst pollen-off-season-p ()
   (let ((month (string-to-int (format-time-string "%m" (current-time)))))
@@ -246,24 +231,29 @@
     (narrow-to-region
      (goto-char (point-min))
      (goto-char (if (re-search-forward
-                     (format "^$\\|^%s$"
-                             (regexp-quote mail-header-separator))
-                     nil t)
-                    (match-beginning 0)
-                  (point-max))))))
+		     (format "^$\\|^%s$"
+			     (regexp-quote mail-header-separator))
+		     nil t)
+		    (match-beginning 0)
+		  (point-max))))))
 
 (defun pollen-insert-header (&optional where offline)
   "Insert X-Pollen: header.
 If WHERE is nil, the default value `pollen-where' is used instead.
 If OFFLINE is nil, don't fetch pollen report from WEB, only use cache."
-  (interactive)
-  (let ((pollen (pollen-from-http where offline)))
-    (if pollen
-	(save-excursion
-	  (save-restriction
-	    (pollen-narrow-to-header)
-	    (goto-char (point-max))
-	    (insert "X-Pollen: " pollen "\n"))))))
+  (interactive (if (or current-prefix-arg
+		       (null pollen-where))
+		   (list (read-from-minibuffer "Where: "
+					       pollen-where))))
+  (setq where (or where pollen-where))
+  (let (current-prefix-arg)
+    (let ((pollen (pollen-from-http where offline)))
+      (if pollen
+	  (save-excursion
+	    (save-restriction
+	      (pollen-narrow-to-header)
+	      (goto-char (point-max))
+	      (insert "X-Pollen: " pollen "\n")))))))
 
 
 
@@ -286,7 +276,7 @@
 	    (setq buf (generate-new-buffer "*HTTP Fetch*")))
 	    (setq connection
 		  (as-binary-process
-		   (open-network-stream "*Fetch from HTTP*" 
+		   (open-network-stream "*Fetch from HTTP*"
 					buf
 					server
 					port)))
@@ -322,7 +312,7 @@
   (interactive)
   (let ((product-info (product-string-1 "Pollen" t)))
     (if (interactive-p)
-        (message "%s" product-info)
+	(message "%s" product-info)
       product-info)))
 
 (provide 'pollen)
