- Update to 1.8.0 and support emacs22

PR:		ports/126502
Submitted by:	Takayuki Narumiya <naru@nk.rim.or.jp>
This commit is contained in:
Pav Lucistnik 2008-08-25 08:25:54 +00:00
parent f98a70eeca
commit 39e2cc5aca
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=219140
15 changed files with 19 additions and 754 deletions

View file

@ -215,6 +215,7 @@
SUBDIR += mypaedia-fpw-package
SUBDIR += namazu
SUBDIR += namazu2
SUBDIR += navi2ch
SUBDIR += navi2ch-emacs21
SUBDIR += navi2ch-xemacs21-mule
SUBDIR += ne

View file

@ -1,53 +1,17 @@
# New ports collection makefile for: navi2ch for emacs20
# Date created: 13 May 2001
# New ports collection makefile for: navi2ch for emacs21
# Date created: 23 Nov 2001
# Whom: FUJISHIMA Satsuki <sf@FreeBSD.org>
#
# $FreeBSD$
#
PORTNAME= navi2ch
PORTVERSION= 1.7.5
PORTREVISION= 5
PORTEPOCH= 1
CATEGORIES= japanese www elisp
MASTER_SITES= SF
PKGNAMESUFFIX= -${EMACS_PORT_NAME}
MAINTAINER= ports@FreeBSD.org
COMMENT= 2ch.net and 2ch-like BBS navigator for Emacsen
MASTERDIR= ${.CURDIR}/../navi2ch
USE_EMACS= yes
EMACS_PORT_NAME?= emacs21
INFO= navi2ch
EMACS_PORT_NAME= emacs21
GNU_CONFIGURE= yes
CONFIGURE_ARGS= --with-lispdir=${PREFIX}/${LISPDIR}/navi2ch \
--with-emacs=${EMACS_CMD}
DOCDIR= share/doc/ja/navi2ch
PLIST_SUB= LISPDIR=${LISPDIR}
.if ${EMACS_PORT_NAME} == xemacs21-mule
LISPDIR= ${EMACS_SITE_LISPDIR}
PLIST_SUB+= FSF="@comment "
.else
LISPDIR= ${EMACS_VERSION_SITE_LISPDIR}
PLIST_SUB+= FSF=""
.if !defined(WITHOUT_X11)
RUN_DEPENDS= ${LOCALBASE}/lib/X11/fonts/local/monak12.pcf.gz:${PORTSDIR}/japanese/monafonts
.endif
RUN_DEPENDS= ${X11BASE}/lib/X11/fonts/local/monak12.pcf.gz:${PORTSDIR}/japanese/monafonts
.endif
post-install:
@${MKDIR} ${PREFIX}/${DOCDIR}
.if !defined(NOPORTDOCS)
.for i in ChangeLog README TODO
${INSTALL_DATA} ${WRKSRC}/$i ${PREFIX}/${DOCDIR}
.endfor
.endif
@${MKDIR} ${PREFIX}/${DOCDIR}/contrib
.for i in gikope.el navi2ch-logo.el navi2ch-migemo.el
${INSTALL_DATA} ${WRKSRC}/contrib/$i ${PREFIX}/${DOCDIR}/contrib
.endfor
.include <bsd.port.mk>
.include "${MASTERDIR}/Makefile"

View file

@ -1,3 +0,0 @@
MD5 (navi2ch-1.7.5.tar.gz) = 3187132fbb3e79ffb40eef2d70c743c5
SHA256 (navi2ch-1.7.5.tar.gz) = 47c1849b9297d855ca3fd314b1ae6342547970b13367dde699a372620c243b1e
SIZE (navi2ch-1.7.5.tar.gz) = 357379

View file

@ -1,60 +0,0 @@
--- navi2ch-net.el.orig Fri Aug 6 23:02:01 2004
+++ navi2ch-net.el Sun Aug 28 22:55:41 2005
@@ -127,6 +127,33 @@
(list shell-file-name shell-command-switch command)
command))))
+;; (let ((sum 0))
+;; (dotimes (i 400 sum)
+;; (setq sum (+ sum (1- (floor (expt 1.00925 i)))))))
+;; => 3602
+(defvar navi2ch-net-connect-wait-power 1.00925)
+(defvar navi2ch-net-connect-time-list '())
+
+(defun navi2ch-net-connect-wait (host)
+ (let* ((host (intern host))
+ (now (navi2ch-float-time))
+ (limit (- now 3600.0))
+ (list (delq nil (mapcar (lambda (x) (if (> (cdr x) limit) x))
+ navi2ch-net-connect-time-list)))
+ (len (length (delq nil (mapcar (lambda (x)
+ (if (eq host (car x)) x))
+ list))))
+ (wait (floor (- (+ (expt navi2ch-net-connect-wait-power len)
+ (or (cdr (assq host list)) now))
+ 1
+ now))))
+ (when (> wait 0)
+ (message "waiting for %dsec..." wait)
+ (sleep-for wait)
+ (message "waiting for %dsec...done" wait))
+ (setq navi2ch-net-connect-time-list
+ (cons (cons host (navi2ch-float-time)) list))))
+
(defun navi2ch-net-send-request (url method &optional other-header content)
(setq navi2ch-net-last-url url)
(unless navi2ch-net-enable-http11
@@ -141,6 +168,7 @@
file (cdr (assq 'file list))
port (cdr (assq 'port list))
host2ch (cdr (assq 'host2ch list))))
+ (navi2ch-net-connect-wait host)
(when navi2ch-net-http-proxy
(setq credentials (navi2ch-net-http-proxy-basic-credentials
navi2ch-net-http-proxy-userid
--- navi2ch-util.el.orig Sun Oct 10 00:01:11 2004
+++ navi2ch-util.el Sun Aug 28 22:55:41 2005
@@ -1269,5 +1269,13 @@
(setq bol (1+ (navi2ch-line-end-position))))))
(goto-char start))
+(defun navi2ch-float-time (&optional specified-time)
+ "Return the current time, as a float number of seconds since the epoch.
+If an argument is given, it specifies a time to convert to float
+instead of the current time."
+ (apply (lambda (high low &optional usec)
+ (+ (* high 65536.0) low (/ (or usec 0) 1000000.0)))
+ (or specified-time (current-time))))
+
(run-hooks 'navi2ch-util-load-hook)
;;; navi2ch-util.el ends here

View file

@ -1,237 +0,0 @@
--- navi2ch-multibbs.el.orig Sun Sep 12 12:55:25 2004
+++ navi2ch-multibbs.el Sat Jun 10 08:38:54 2006
@@ -242,14 +242,8 @@
(defun navi2ch-multibbs-send-message-retry-confirm (board)
(let ((func (or (navi2ch-fboundp
navi2ch-multibbs-send-message-retry-confirm-function)
- #'yes-or-no-p))
- spid)
- (unwind-protect
- (let ((result (funcall func "Retry? ")))
- (when result
- (setq spid (navi2ch-board-load-spid board)))
- result)
- (navi2ch-board-save-spid board spid))))
+ #'yes-or-no-p)))
+ (funcall func "Retry? ")))
(defun navi2ch-multibbs-send-message
(from mail message subject board article)
@@ -279,10 +273,11 @@
navi2ch-net-http-proxy-password))
(tries 2) ; $BAw?.;n9T$N:GBg2s?t(B
(message-str "send message...")
- (result 'retry))
+ (result 'retry)
+ (additional-params nil))
(dotimes (i tries)
- (let ((proc (funcall send from mail message subject bbs key time
- board article)))
+ (let ((proc (apply send from mail message subject bbs key time
+ board article additional-params)))
(message message-str)
(setq result (funcall success-p proc))
(cond ((eq result 'retry)
@@ -291,6 +286,23 @@
(insert (decode-coding-string
(navi2ch-net-get-content proc)
navi2ch-coding-system))
+ (goto-char (point-min))
+ (setq additional-params nil)
+ (let ((case-fold-search t))
+ (while (re-search-forward "<input\\>[^>]+>" nil t)
+ (let ((str (match-string 0)) name value
+ (re
+ "\\<%s=\\(\"\\([^\"]*\\)\"\\|[^\"> \r\n\t]*\\)"))
+ (and (string-match (format re "name") str)
+ (setq name (or (match-string 2 str)
+ (match-string 1 str)))
+ (string-match (format re "value") str)
+ (setq value (or (match-string 2 str)
+ (match-string 1 str)))
+ (setq name (navi2ch-replace-html-tag name)
+ value (navi2ch-replace-html-tag value))
+ (push (cons name value)
+ additional-params)))))
(navi2ch-replace-html-tag-with-buffer)
(goto-char (point-min))
(while (re-search-forward "[ \t]*\n\\([ \t]*\n\\)*" nil t)
@@ -410,10 +422,9 @@
list))))
(defun navi2ch-2ch-send-message
- (from mail message subject bbs key time board article)
+ (from mail message subject bbs key time board article &rest additional-params)
(let ((url (navi2ch-board-get-bbscgi-url board))
(referer (navi2ch-board-get-uri board))
- (spid (navi2ch-board-load-spid board))
(param-alist (list
(cons "submit" "$B=q$-9~$`(B")
(cons "FROM" (or from ""))
@@ -424,21 +435,20 @@
(if subject
(cons "subject" subject)
(cons "key" key)))))
- (setq spid
- (when (and (consp spid)
- (navi2ch-compare-times (cdr spid) (current-time)))
- (car spid)))
+ (dolist (x additional-params)
+ (unless (assoc (car x) param-alist)
+ (push x param-alist)))
(let ((proc
(navi2ch-net-send-request
url "POST"
(list (cons "Content-Type" "application/x-www-form-urlencoded")
- (cons "Cookie" (concat "NAME=" from "; MAIL=" mail
- (if spid (concat "; SPID=" spid
- "; PON=" spid))))
+ (cons "Cookie"
+ (navi2ch-net-cookie-string
+ (navi2ch-net-match-cookies url)))
(cons "Referer" referer))
(navi2ch-net-get-param-string param-alist))))
- (setq spid (navi2ch-net-send-message-get-spid proc))
- (if spid (navi2ch-board-save-spid board spid))
+ (navi2ch-net-update-cookies url proc)
+ (navi2ch-net-save-cookies)
proc)))
(defun navi2ch-2ch-article-to-url
--- navi2ch-net.el.orig Fri Aug 6 23:02:01 2004
+++ navi2ch-net.el Sun Jun 4 23:07:43 2006
@@ -780,6 +780,134 @@
((string-match "^PON=\\([^;]+\\);" str)
(return (cons (match-string 1 str) date))))))))
+;; Cookie $B$O$3$s$J46$8$N(B alist $B$KF~$l$F$*$/!#(B
+;; ((domain1 (/path1 ("name1" "value1" ...)
+;; ("name2" "value2" ...) ...)
+;; (/path2 ...) ...)
+;; (domain2 ...) ...)
+
+(defvar navi2ch-net-cookies nil)
+
+(defun navi2ch-net-store-cookie (cookie domain path)
+ (let ((domain (if (stringp domain) (intern (downcase domain)) domain))
+ (path (if (stringp path) (intern path) path)))
+ (let ((path-alist (assq domain navi2ch-net-cookies)))
+ (unless path-alist
+ (setq path-alist (list domain))
+ (push path-alist navi2ch-net-cookies))
+ (let ((cookie-list (assq path (cdr path-alist))))
+ (if cookie-list
+ (let ((elt (assoc (car cookie) (cdr cookie-list))))
+ (if elt
+ (setcdr elt (cdr cookie))
+ (setcdr cookie-list (cons cookie (cdr cookie-list)))))
+ (setq cookie-list (list path cookie))
+ (setcdr path-alist (cons cookie-list (cdr path-alist))))))))
+
+(defun navi2ch-net-match-cookies (url)
+ (let* ((alist (navi2ch-net-split-url url))
+ (host (cdr (assq 'host alist)))
+ (file (cdr (assq 'file alist)))
+ (domain-list (list (intern (downcase host))))
+ path-list)
+ (when (string-match "\\..*\\..*\\'" host)
+ (push (intern (downcase (match-string 0 host))) domain-list))
+ (while (string-match "\\`\\(.*\\)/[^/]*" file)
+ (let ((f (match-string 1 file)))
+ (push (intern (if (string= f "") "/" f)) path-list)
+ (setq file f)))
+ (labels ((mapcan (function list) (apply #'nconc (mapcar function list))))
+ (mapcan (lambda (domain)
+ (mapcan (lambda (path)
+ (navi2ch-net-expire-cookies
+ (cdr (assq path
+ (cdr (assq domain
+ navi2ch-net-cookies))))))
+ path-list))
+ domain-list))))
+
+(defvar navi2ch-net-cookie-file "cookie.info")
+
+(defun navi2ch-net-cookie-file ()
+ (expand-file-name navi2ch-net-cookie-file navi2ch-directory))
+
+(defun navi2ch-net-save-cookies ()
+ (let ((now (current-time)))
+ (labels ((strip (f l) (let ((tmp (delq nil (mapcar f (cdr l)))))
+ (and tmp (cons (car l) tmp)))))
+ (navi2ch-save-info
+ (navi2ch-net-cookie-file)
+ (delq nil
+ (mapcar (lambda (path-alist)
+ (strip (lambda (cookie-list)
+ (strip (lambda (cookie)
+ (and (cddr cookie)
+ (navi2ch-compare-times
+ (cddr cookie) now)
+ cookie))
+ cookie-list))
+ path-alist))
+ navi2ch-net-cookies))))))
+
+(defun navi2ch-net-load-cookies ()
+ (setq navi2ch-net-cookies
+ (navi2ch-load-info (navi2ch-net-cookie-file))))
+
+(add-hook 'navi2ch-save-status-hook 'navi2ch-net-save-cookies)
+(add-hook 'navi2ch-load-status-hook 'navi2ch-net-load-cookies)
+
+(defun navi2ch-net-update-cookies (url proc)
+ (let* ((case-fold-search t)
+ (alist (navi2ch-net-split-url url))
+ (host (cdr (assq 'host alist)))
+ (file (cdr (assq 'file alist))))
+ (dolist (pair (navi2ch-net-get-header proc) navi2ch-net-cookies)
+ (when (string= (car pair) "Set-Cookie")
+ (let* ((str (cdr pair))
+ (date (when (string-match "expires=\\([^;]+\\)" str)
+ (navi2ch-http-date-decode (match-string 1 str))))
+ (domain (if (string-match "domain=\\([^;]+\\)" str)
+ (match-string 1 str)
+ host))
+ (path (if (string-match "path=\\([^;]+\\)" str)
+ (match-string 1 str)
+ (if (and (string-match "\\(.*\\)/" file)
+ (> (length (match-string 1 file)) 0))
+ (match-string 1 file)
+ "/"))))
+ (when (string-match "^\\([^=]+\\)=\\([^;]*\\)" str)
+ (let ((name (match-string 1 str))
+ (value (match-string 2 str)))
+ (setq value
+ (decode-coding-string
+ (navi2ch-replace-string "%[0-9A-Za-z][0-9A-Za-z]"
+ (lambda (s)
+ (string (string-to-number
+ (substring s 1) 16)))
+ value t t t)
+ navi2ch-coding-system))
+ (navi2ch-net-store-cookie (cons name
+ (cons value date))
+ domain path))))))))
+
+(defun navi2ch-net-expire-cookies (cookie-list)
+ "COOKIE-LIST $B$+$i4|8B@Z$l$N%/%C%-!<$r=|$$$?%j%9%H$rJV$9!#(B"
+ (let ((now (current-time)))
+ (delq nil
+ (mapcar (lambda (cookie)
+ (when (or (null (cddr cookie))
+ (navi2ch-compare-times (cddr cookie) now))
+ cookie))
+ cookie-list))))
+
+(defun navi2ch-net-cookie-string (cookies)
+ "HTTP $B$N(B Cookie $B%X%C%@$H$7$FEO$9J8;zNs$rJV$9!#(B"
+ (mapconcat (lambda (elt)
+ (concat (navi2ch-net-url-hexify-string (car elt))
+ "="
+ (navi2ch-net-url-hexify-string (cadr elt))))
+ cookies "; "))
+
(defun navi2ch-net-download-logo (board)
(let ((coding-system-for-read 'binary)
(coding-system-for-write 'binary)

View file

@ -1,11 +0,0 @@
--- navi2ch-list.el.orig Sun Aug 8 00:03:09 2004
+++ navi2ch-list.el Wed Sep 7 01:44:31 2005
@@ -85,7 +85,7 @@
(nil " " navi2ch-list-board-name-face)))
(defconst navi2ch-list-bbstable-default-url
- "http://www.ff.iij4u.or.jp/~ch2/bbsmenu.html")
+ "http://menu.2ch.net/bbsmenu.html")
;; add hook
(add-hook 'navi2ch-save-status-hook 'navi2ch-list-save-info)

View file

@ -1,3 +0,0 @@
Navi2ch, a 2ch.net and 2ch-like BBS navigator for Emacsen.
WWW: http://navi2ch.sourceforge.net

View file

@ -1,79 +0,0 @@
%%PORTDOCS%%share/doc/ja/navi2ch/ChangeLog
%%PORTDOCS%%share/doc/ja/navi2ch/README
%%PORTDOCS%%share/doc/ja/navi2ch/TODO
share/doc/ja/navi2ch/contrib/gikope.el
share/doc/ja/navi2ch/contrib/navi2ch-logo.el
share/doc/ja/navi2ch/contrib/navi2ch-migemo.el
@dirrm share/doc/ja/navi2ch/contrib
@dirrm share/doc/ja/navi2ch
%%EMACS_LIBDIR_WITH_VER%%/etc/navi2ch/icons/navi2ch-logo.img
%%EMACS_LIBDIR_WITH_VER%%/etc/navi2ch/icons/navi2ch-logo.xbm
%%EMACS_LIBDIR_WITH_VER%%/etc/navi2ch/icons/navi2ch-logo.xpm
%%EMACS_LIBDIR_WITH_VER%%/etc/navi2ch/icons/plugged.xpm
%%EMACS_LIBDIR_WITH_VER%%/etc/navi2ch/icons/unplugged.xpm
@dirrm %%EMACS_LIBDIR_WITH_VER%%/etc/navi2ch/icons
@dirrm %%EMACS_LIBDIR_WITH_VER%%/etc/navi2ch
%%LISPDIR%%/navi2ch/navi2ch-article.el
%%LISPDIR%%/navi2ch/navi2ch-article.elc
%%LISPDIR%%/navi2ch/navi2ch-articles.el
%%LISPDIR%%/navi2ch/navi2ch-articles.elc
%%LISPDIR%%/navi2ch/navi2ch-auto-modify.el
%%LISPDIR%%/navi2ch/navi2ch-auto-modify.elc
%%LISPDIR%%/navi2ch/navi2ch-board-misc.el
%%LISPDIR%%/navi2ch/navi2ch-board-misc.elc
%%LISPDIR%%/navi2ch/navi2ch-board.el
%%LISPDIR%%/navi2ch/navi2ch-board.elc
%%LISPDIR%%/navi2ch/navi2ch-bookmark.el
%%LISPDIR%%/navi2ch/navi2ch-bookmark.elc
%%LISPDIR%%/navi2ch/navi2ch-directory.el
%%LISPDIR%%/navi2ch/navi2ch-directory.elc
%%LISPDIR%%/navi2ch/navi2ch-e21.el
%%LISPDIR%%/navi2ch/navi2ch-e21.elc
%%LISPDIR%%/navi2ch/navi2ch-face.el
%%LISPDIR%%/navi2ch/navi2ch-face.elc
%%LISPDIR%%/navi2ch/navi2ch-futaba.el
%%LISPDIR%%/navi2ch/navi2ch-futaba.elc
%%LISPDIR%%/navi2ch/navi2ch-head.el
%%LISPDIR%%/navi2ch/navi2ch-head.elc
%%LISPDIR%%/navi2ch/navi2ch-history.el
%%LISPDIR%%/navi2ch/navi2ch-history.elc
%%LISPDIR%%/navi2ch/navi2ch-http-date.el
%%LISPDIR%%/navi2ch/navi2ch-http-date.elc
%%LISPDIR%%/navi2ch/navi2ch-jbbs-net.el
%%LISPDIR%%/navi2ch/navi2ch-jbbs-net.elc
%%LISPDIR%%/navi2ch/navi2ch-jbbs-shitaraba.el
%%LISPDIR%%/navi2ch/navi2ch-jbbs-shitaraba.elc
%%LISPDIR%%/navi2ch/navi2ch-list.el
%%LISPDIR%%/navi2ch/navi2ch-list.elc
%%LISPDIR%%/navi2ch/navi2ch-localfile.el
%%LISPDIR%%/navi2ch/navi2ch-localfile.elc
%%LISPDIR%%/navi2ch/navi2ch-machibbs.el
%%LISPDIR%%/navi2ch/navi2ch-machibbs.elc
%%LISPDIR%%/navi2ch/navi2ch-message.el
%%LISPDIR%%/navi2ch/navi2ch-message.elc
%%LISPDIR%%/navi2ch/navi2ch-mona.el
%%LISPDIR%%/navi2ch/navi2ch-mona.elc
%%LISPDIR%%/navi2ch/navi2ch-multibbs.el
%%LISPDIR%%/navi2ch/navi2ch-multibbs.elc
%%LISPDIR%%/navi2ch/navi2ch-net.el
%%LISPDIR%%/navi2ch/navi2ch-net.elc
%%LISPDIR%%/navi2ch/navi2ch-oyster.el
%%LISPDIR%%/navi2ch/navi2ch-oyster.elc
%%LISPDIR%%/navi2ch/navi2ch-popup-article.el
%%LISPDIR%%/navi2ch/navi2ch-popup-article.elc
%%LISPDIR%%/navi2ch/navi2ch-search.el
%%LISPDIR%%/navi2ch/navi2ch-search.elc
%%LISPDIR%%/navi2ch/navi2ch-splash.el
%%LISPDIR%%/navi2ch/navi2ch-splash.elc
%%LISPDIR%%/navi2ch/navi2ch-util.el
%%LISPDIR%%/navi2ch/navi2ch-util.elc
%%LISPDIR%%/navi2ch/navi2ch-vars.el
%%LISPDIR%%/navi2ch/navi2ch-vars.elc
%%LISPDIR%%/navi2ch/navi2ch-version.el
%%LISPDIR%%/navi2ch/navi2ch-version.elc
%%LISPDIR%%/navi2ch/navi2ch-xmas.el
%%LISPDIR%%/navi2ch/navi2ch-xmas.elc
%%LISPDIR%%/navi2ch/navi2ch.el
%%LISPDIR%%/navi2ch/navi2ch.elc
@dirrm %%LISPDIR%%/navi2ch
%%FSF%%@dirrmtry %%LISPDIR%%

View file

@ -5,7 +5,7 @@
# $FreeBSD$
#
MASTERDIR= ${.CURDIR}/../navi2ch-emacs21
MASTERDIR= ${.CURDIR}/../navi2ch
USE_EMACS= yes
EMACS_PORT_NAME= xemacs21-mule

View file

@ -1,4 +1,4 @@
# New ports collection makefile for: navi2ch for emacs20
# New ports collection makefile for: navi2ch for Emacsen
# Date created: 13 May 2001
# Whom: FUJISHIMA Satsuki <sf@FreeBSD.org>
#
@ -6,8 +6,7 @@
#
PORTNAME= navi2ch
PORTVERSION= 1.7.5
PORTREVISION= 5
PORTVERSION= 1.8.0
PORTEPOCH= 1
CATEGORIES= japanese www elisp
MASTER_SITES= SF
@ -17,7 +16,7 @@ MAINTAINER= ports@FreeBSD.org
COMMENT= 2ch.net and 2ch-like BBS navigator for Emacsen
USE_EMACS= yes
EMACS_PORT_NAME?= emacs21
EMACS_PORT_NAME?= emacs22
INFO= navi2ch
GNU_CONFIGURE= yes

View file

@ -1,3 +1,3 @@
MD5 (navi2ch-1.7.5.tar.gz) = 3187132fbb3e79ffb40eef2d70c743c5
SHA256 (navi2ch-1.7.5.tar.gz) = 47c1849b9297d855ca3fd314b1ae6342547970b13367dde699a372620c243b1e
SIZE (navi2ch-1.7.5.tar.gz) = 357379
MD5 (navi2ch-1.8.0.tar.gz) = 444423ca9add7a855243d3d923f5aadd
SHA256 (navi2ch-1.8.0.tar.gz) = 4d20426d1dda8bd75c8ae87b73209fa4735978ef9bb4a3234118a5b895f6b19b
SIZE (navi2ch-1.8.0.tar.gz) = 476381

View file

@ -1,60 +0,0 @@
--- navi2ch-net.el.orig Fri Aug 6 23:02:01 2004
+++ navi2ch-net.el Sun Aug 28 22:55:41 2005
@@ -127,6 +127,33 @@
(list shell-file-name shell-command-switch command)
command))))
+;; (let ((sum 0))
+;; (dotimes (i 400 sum)
+;; (setq sum (+ sum (1- (floor (expt 1.00925 i)))))))
+;; => 3602
+(defvar navi2ch-net-connect-wait-power 1.00925)
+(defvar navi2ch-net-connect-time-list '())
+
+(defun navi2ch-net-connect-wait (host)
+ (let* ((host (intern host))
+ (now (navi2ch-float-time))
+ (limit (- now 3600.0))
+ (list (delq nil (mapcar (lambda (x) (if (> (cdr x) limit) x))
+ navi2ch-net-connect-time-list)))
+ (len (length (delq nil (mapcar (lambda (x)
+ (if (eq host (car x)) x))
+ list))))
+ (wait (floor (- (+ (expt navi2ch-net-connect-wait-power len)
+ (or (cdr (assq host list)) now))
+ 1
+ now))))
+ (when (> wait 0)
+ (message "waiting for %dsec..." wait)
+ (sleep-for wait)
+ (message "waiting for %dsec...done" wait))
+ (setq navi2ch-net-connect-time-list
+ (cons (cons host (navi2ch-float-time)) list))))
+
(defun navi2ch-net-send-request (url method &optional other-header content)
(setq navi2ch-net-last-url url)
(unless navi2ch-net-enable-http11
@@ -141,6 +168,7 @@
file (cdr (assq 'file list))
port (cdr (assq 'port list))
host2ch (cdr (assq 'host2ch list))))
+ (navi2ch-net-connect-wait host)
(when navi2ch-net-http-proxy
(setq credentials (navi2ch-net-http-proxy-basic-credentials
navi2ch-net-http-proxy-userid
--- navi2ch-util.el.orig Sun Oct 10 00:01:11 2004
+++ navi2ch-util.el Sun Aug 28 22:55:41 2005
@@ -1269,5 +1269,13 @@
(setq bol (1+ (navi2ch-line-end-position))))))
(goto-char start))
+(defun navi2ch-float-time (&optional specified-time)
+ "Return the current time, as a float number of seconds since the epoch.
+If an argument is given, it specifies a time to convert to float
+instead of the current time."
+ (apply (lambda (high low &optional usec)
+ (+ (* high 65536.0) low (/ (or usec 0) 1000000.0)))
+ (or specified-time (current-time))))
+
(run-hooks 'navi2ch-util-load-hook)
;;; navi2ch-util.el ends here

View file

@ -1,237 +0,0 @@
--- navi2ch-multibbs.el.orig Sun Sep 12 12:55:25 2004
+++ navi2ch-multibbs.el Sat Jun 10 08:38:54 2006
@@ -242,14 +242,8 @@
(defun navi2ch-multibbs-send-message-retry-confirm (board)
(let ((func (or (navi2ch-fboundp
navi2ch-multibbs-send-message-retry-confirm-function)
- #'yes-or-no-p))
- spid)
- (unwind-protect
- (let ((result (funcall func "Retry? ")))
- (when result
- (setq spid (navi2ch-board-load-spid board)))
- result)
- (navi2ch-board-save-spid board spid))))
+ #'yes-or-no-p)))
+ (funcall func "Retry? ")))
(defun navi2ch-multibbs-send-message
(from mail message subject board article)
@@ -279,10 +273,11 @@
navi2ch-net-http-proxy-password))
(tries 2) ; $BAw?.;n9T$N:GBg2s?t(B
(message-str "send message...")
- (result 'retry))
+ (result 'retry)
+ (additional-params nil))
(dotimes (i tries)
- (let ((proc (funcall send from mail message subject bbs key time
- board article)))
+ (let ((proc (apply send from mail message subject bbs key time
+ board article additional-params)))
(message message-str)
(setq result (funcall success-p proc))
(cond ((eq result 'retry)
@@ -291,6 +286,23 @@
(insert (decode-coding-string
(navi2ch-net-get-content proc)
navi2ch-coding-system))
+ (goto-char (point-min))
+ (setq additional-params nil)
+ (let ((case-fold-search t))
+ (while (re-search-forward "<input\\>[^>]+>" nil t)
+ (let ((str (match-string 0)) name value
+ (re
+ "\\<%s=\\(\"\\([^\"]*\\)\"\\|[^\"> \r\n\t]*\\)"))
+ (and (string-match (format re "name") str)
+ (setq name (or (match-string 2 str)
+ (match-string 1 str)))
+ (string-match (format re "value") str)
+ (setq value (or (match-string 2 str)
+ (match-string 1 str)))
+ (setq name (navi2ch-replace-html-tag name)
+ value (navi2ch-replace-html-tag value))
+ (push (cons name value)
+ additional-params)))))
(navi2ch-replace-html-tag-with-buffer)
(goto-char (point-min))
(while (re-search-forward "[ \t]*\n\\([ \t]*\n\\)*" nil t)
@@ -410,10 +422,9 @@
list))))
(defun navi2ch-2ch-send-message
- (from mail message subject bbs key time board article)
+ (from mail message subject bbs key time board article &rest additional-params)
(let ((url (navi2ch-board-get-bbscgi-url board))
(referer (navi2ch-board-get-uri board))
- (spid (navi2ch-board-load-spid board))
(param-alist (list
(cons "submit" "$B=q$-9~$`(B")
(cons "FROM" (or from ""))
@@ -424,21 +435,20 @@
(if subject
(cons "subject" subject)
(cons "key" key)))))
- (setq spid
- (when (and (consp spid)
- (navi2ch-compare-times (cdr spid) (current-time)))
- (car spid)))
+ (dolist (x additional-params)
+ (unless (assoc (car x) param-alist)
+ (push x param-alist)))
(let ((proc
(navi2ch-net-send-request
url "POST"
(list (cons "Content-Type" "application/x-www-form-urlencoded")
- (cons "Cookie" (concat "NAME=" from "; MAIL=" mail
- (if spid (concat "; SPID=" spid
- "; PON=" spid))))
+ (cons "Cookie"
+ (navi2ch-net-cookie-string
+ (navi2ch-net-match-cookies url)))
(cons "Referer" referer))
(navi2ch-net-get-param-string param-alist))))
- (setq spid (navi2ch-net-send-message-get-spid proc))
- (if spid (navi2ch-board-save-spid board spid))
+ (navi2ch-net-update-cookies url proc)
+ (navi2ch-net-save-cookies)
proc)))
(defun navi2ch-2ch-article-to-url
--- navi2ch-net.el.orig Fri Aug 6 23:02:01 2004
+++ navi2ch-net.el Sun Jun 4 23:07:43 2006
@@ -780,6 +780,134 @@
((string-match "^PON=\\([^;]+\\);" str)
(return (cons (match-string 1 str) date))))))))
+;; Cookie $B$O$3$s$J46$8$N(B alist $B$KF~$l$F$*$/!#(B
+;; ((domain1 (/path1 ("name1" "value1" ...)
+;; ("name2" "value2" ...) ...)
+;; (/path2 ...) ...)
+;; (domain2 ...) ...)
+
+(defvar navi2ch-net-cookies nil)
+
+(defun navi2ch-net-store-cookie (cookie domain path)
+ (let ((domain (if (stringp domain) (intern (downcase domain)) domain))
+ (path (if (stringp path) (intern path) path)))
+ (let ((path-alist (assq domain navi2ch-net-cookies)))
+ (unless path-alist
+ (setq path-alist (list domain))
+ (push path-alist navi2ch-net-cookies))
+ (let ((cookie-list (assq path (cdr path-alist))))
+ (if cookie-list
+ (let ((elt (assoc (car cookie) (cdr cookie-list))))
+ (if elt
+ (setcdr elt (cdr cookie))
+ (setcdr cookie-list (cons cookie (cdr cookie-list)))))
+ (setq cookie-list (list path cookie))
+ (setcdr path-alist (cons cookie-list (cdr path-alist))))))))
+
+(defun navi2ch-net-match-cookies (url)
+ (let* ((alist (navi2ch-net-split-url url))
+ (host (cdr (assq 'host alist)))
+ (file (cdr (assq 'file alist)))
+ (domain-list (list (intern (downcase host))))
+ path-list)
+ (when (string-match "\\..*\\..*\\'" host)
+ (push (intern (downcase (match-string 0 host))) domain-list))
+ (while (string-match "\\`\\(.*\\)/[^/]*" file)
+ (let ((f (match-string 1 file)))
+ (push (intern (if (string= f "") "/" f)) path-list)
+ (setq file f)))
+ (labels ((mapcan (function list) (apply #'nconc (mapcar function list))))
+ (mapcan (lambda (domain)
+ (mapcan (lambda (path)
+ (navi2ch-net-expire-cookies
+ (cdr (assq path
+ (cdr (assq domain
+ navi2ch-net-cookies))))))
+ path-list))
+ domain-list))))
+
+(defvar navi2ch-net-cookie-file "cookie.info")
+
+(defun navi2ch-net-cookie-file ()
+ (expand-file-name navi2ch-net-cookie-file navi2ch-directory))
+
+(defun navi2ch-net-save-cookies ()
+ (let ((now (current-time)))
+ (labels ((strip (f l) (let ((tmp (delq nil (mapcar f (cdr l)))))
+ (and tmp (cons (car l) tmp)))))
+ (navi2ch-save-info
+ (navi2ch-net-cookie-file)
+ (delq nil
+ (mapcar (lambda (path-alist)
+ (strip (lambda (cookie-list)
+ (strip (lambda (cookie)
+ (and (cddr cookie)
+ (navi2ch-compare-times
+ (cddr cookie) now)
+ cookie))
+ cookie-list))
+ path-alist))
+ navi2ch-net-cookies))))))
+
+(defun navi2ch-net-load-cookies ()
+ (setq navi2ch-net-cookies
+ (navi2ch-load-info (navi2ch-net-cookie-file))))
+
+(add-hook 'navi2ch-save-status-hook 'navi2ch-net-save-cookies)
+(add-hook 'navi2ch-load-status-hook 'navi2ch-net-load-cookies)
+
+(defun navi2ch-net-update-cookies (url proc)
+ (let* ((case-fold-search t)
+ (alist (navi2ch-net-split-url url))
+ (host (cdr (assq 'host alist)))
+ (file (cdr (assq 'file alist))))
+ (dolist (pair (navi2ch-net-get-header proc) navi2ch-net-cookies)
+ (when (string= (car pair) "Set-Cookie")
+ (let* ((str (cdr pair))
+ (date (when (string-match "expires=\\([^;]+\\)" str)
+ (navi2ch-http-date-decode (match-string 1 str))))
+ (domain (if (string-match "domain=\\([^;]+\\)" str)
+ (match-string 1 str)
+ host))
+ (path (if (string-match "path=\\([^;]+\\)" str)
+ (match-string 1 str)
+ (if (and (string-match "\\(.*\\)/" file)
+ (> (length (match-string 1 file)) 0))
+ (match-string 1 file)
+ "/"))))
+ (when (string-match "^\\([^=]+\\)=\\([^;]*\\)" str)
+ (let ((name (match-string 1 str))
+ (value (match-string 2 str)))
+ (setq value
+ (decode-coding-string
+ (navi2ch-replace-string "%[0-9A-Za-z][0-9A-Za-z]"
+ (lambda (s)
+ (string (string-to-number
+ (substring s 1) 16)))
+ value t t t)
+ navi2ch-coding-system))
+ (navi2ch-net-store-cookie (cons name
+ (cons value date))
+ domain path))))))))
+
+(defun navi2ch-net-expire-cookies (cookie-list)
+ "COOKIE-LIST $B$+$i4|8B@Z$l$N%/%C%-!<$r=|$$$?%j%9%H$rJV$9!#(B"
+ (let ((now (current-time)))
+ (delq nil
+ (mapcar (lambda (cookie)
+ (when (or (null (cddr cookie))
+ (navi2ch-compare-times (cddr cookie) now))
+ cookie))
+ cookie-list))))
+
+(defun navi2ch-net-cookie-string (cookies)
+ "HTTP $B$N(B Cookie $B%X%C%@$H$7$FEO$9J8;zNs$rJV$9!#(B"
+ (mapconcat (lambda (elt)
+ (concat (navi2ch-net-url-hexify-string (car elt))
+ "="
+ (navi2ch-net-url-hexify-string (cadr elt))))
+ cookies "; "))
+
(defun navi2ch-net-download-logo (board)
(let ((coding-system-for-read 'binary)
(coding-system-for-write 'binary)

View file

@ -1,11 +0,0 @@
--- navi2ch-list.el.orig Sun Aug 8 00:03:09 2004
+++ navi2ch-list.el Wed Sep 7 01:44:31 2005
@@ -85,7 +85,7 @@
(nil " " navi2ch-list-board-name-face)))
(defconst navi2ch-list-bbstable-default-url
- "http://www.ff.iij4u.or.jp/~ch2/bbsmenu.html")
+ "http://menu.2ch.net/bbsmenu.html")
;; add hook
(add-hook 'navi2ch-save-status-hook 'navi2ch-list-save-info)

View file

@ -6,9 +6,6 @@ share/doc/ja/navi2ch/contrib/navi2ch-logo.el
share/doc/ja/navi2ch/contrib/navi2ch-migemo.el
@dirrm share/doc/ja/navi2ch/contrib
@dirrm share/doc/ja/navi2ch
%%EMACS_LIBDIR_WITH_VER%%/etc/navi2ch/icons/navi2ch-logo.img
%%EMACS_LIBDIR_WITH_VER%%/etc/navi2ch/icons/navi2ch-logo.xbm
%%EMACS_LIBDIR_WITH_VER%%/etc/navi2ch/icons/navi2ch-logo.xpm
%%EMACS_LIBDIR_WITH_VER%%/etc/navi2ch/icons/plugged.xpm
%%EMACS_LIBDIR_WITH_VER%%/etc/navi2ch/icons/unplugged.xpm
@dirrm %%EMACS_LIBDIR_WITH_VER%%/etc/navi2ch/icons
@ -19,12 +16,15 @@ share/doc/ja/navi2ch/contrib/navi2ch-migemo.el
%%LISPDIR%%/navi2ch/navi2ch-articles.elc
%%LISPDIR%%/navi2ch/navi2ch-auto-modify.el
%%LISPDIR%%/navi2ch/navi2ch-auto-modify.elc
%%LISPDIR%%/navi2ch/navi2ch-be2ch.el
%%LISPDIR%%/navi2ch/navi2ch-be2ch.elc
%%LISPDIR%%/navi2ch/navi2ch-board-misc.el
%%LISPDIR%%/navi2ch/navi2ch-board-misc.elc
%%LISPDIR%%/navi2ch/navi2ch-board.el
%%LISPDIR%%/navi2ch/navi2ch-board.elc
%%LISPDIR%%/navi2ch/navi2ch-bookmark.el
%%LISPDIR%%/navi2ch/navi2ch-bookmark.elc
%%LISPDIR%%/navi2ch/navi2ch-config.el
%%LISPDIR%%/navi2ch/navi2ch-directory.el
%%LISPDIR%%/navi2ch/navi2ch-directory.elc
%%LISPDIR%%/navi2ch/navi2ch-e21.el
@ -49,6 +49,8 @@ share/doc/ja/navi2ch/contrib/navi2ch-migemo.el
%%LISPDIR%%/navi2ch/navi2ch-localfile.elc
%%LISPDIR%%/navi2ch/navi2ch-machibbs.el
%%LISPDIR%%/navi2ch/navi2ch-machibbs.elc
%%LISPDIR%%/navi2ch/navi2ch-megabbs.el
%%LISPDIR%%/navi2ch/navi2ch-megabbs.elc
%%LISPDIR%%/navi2ch/navi2ch-message.el
%%LISPDIR%%/navi2ch/navi2ch-message.elc
%%LISPDIR%%/navi2ch/navi2ch-mona.el