3 (defun navi2ch-new-thread-check (new old)
4 (let* ((article (navi2ch-article-url-to-article new))
5 (board (navi2ch-board-url-to-board new))
6 (file (navi2ch-article-get-file-name board article))
7 (regex (regexp-quote (navi2ch-replace-string
8 ;; »ª°Üž¤â¤¢¤ë¤Î¤Ç¡¢»ªÌ¾¤Þ¤Çºï¤ë
11 (unless (file-exists-p file)
12 (when (navi2ch-article-fetch-article board article)
13 (navi2ch-bm-remember-fetched-article board article)))
14 (when (file-exists-p file)
16 (navi2ch-insert-file-contents file)
17 ;; µì¥¹¥ì¥Ã¥É¤ÎURL¤¬½ñ¤¤¤Æ¤¢¤ë¤«¥Á¥§¥Ã¥¯
18 (if (re-search-forward regex
20 (navi2ch-line-beginning-position 6)
23 ;; (navi2ch-bm-remove-article-subr board article)
26 (defun navi2ch-subject-seriese-format (subject)
27 ;; Á´³Ñ/Ⱦ³Ñ¤ò¶èÊ̤·¤Ê¤¤
28 (setq subject (japanese-zenkaku subject))
29 (setq subject (japanese-hankaku subject 'ascii-only))
30 ;; Âçʸ»ú/¾®Ê¸»ú¤ò¶èÊ̤·¤Ê¤¤
31 (setq subject (upcase subject))
32 ;; ¤Ò¤é¤¬¤Ê/¥«¥¿¥«¥Ê¤ò¶èÊ̤·¤Ê¤¤
33 (setq subject (japanese-hiragana subject))
35 (setq subject (navi2ch-replace-string "[ \t0-9]" "" subject 'all)))
37 (defun navi2ch-subject-seriese-p (subject1 subject2)
38 ;; ¥¹¥ì¥¿¥¤¤ÎÈæ³Ó¤Ã¤Æ¤É¤¦¤ä¤ì¤Ð¤¤¤¤¤Î¤«Ê¬¤«¤é¤ó¡£
39 ;; ¤È¤ê¤¢¤¨¤º¡¢Á´³Ñ/Ⱦ³Ñ¡¦¤Ò¤é¤¬¤Ê/¥«¥¿¥«¥Ê¤ò·¤¨¤¿¸å¤Ç
40 ;; û¤¤¤Û¤¦¤ÎÁ°¸å10%¤Å¤Ä¤òÀÚ¤ê¼Î¤Æ¤Æ
41 ;; (string-match "û¤¤Êý" "Ť¤Êý") ¤È¤·¤Æ¤ë¡£
42 (unless (string= subject1 subject2)
43 (let* ((subj1 (navi2ch-subject-seriese-format subject1))
44 (subj2 (navi2ch-subject-seriese-format subject2))
47 (when (> (length subj1) (length subj2))
51 (setq from (round (* (length subj1) ratio)))
54 (string-match (regexp-quote (substring subj1 from to))
57 (defun navi2ch-article-search-new-thread-with-subject ()
58 ;; Îà»÷¥µ¥Ö¥¸¥§¥¯¥È¤Î¥¹¥ì¤ò¥Á¥§¥Ã¥¯
59 (let* ((article navi2ch-article-current-article)
60 (board navi2ch-article-current-board)
61 (subject (cdr (assoc 'subject article)))
62 (curl (navi2ch-article-to-url board article))
63 (file (navi2ch-board-get-file-name board))
65 (unless navi2ch-offline
66 (navi2ch-board-save-old-subject-file board)
67 (navi2ch-board-update-file board))
68 (setq list (navi2ch-board-get-subject-list file))
71 (let* ((atcl (car list))
72 (sbj (cdr (assoc 'subject atcl))))
73 (setq nurl (navi2ch-article-to-url board atcl)
75 (when (and (navi2ch-subject-seriese-p subject sbj)
76 (navi2ch-new-thread-check nurl curl))
77 (throw 'find (setq found t))))))
80 (defun navi2ch-article-search-new-thread-with-lead ()
81 ;; ¿·¥¹¥ì¤Ø¤ÎͶƳ¤ò¥Á¥§¥Ã¥¯
82 (let ((cboard (cdr (assoc 'name navi2ch-article-current-board)))
83 (curl (navi2ch-article-to-url navi2ch-article-current-board
84 navi2ch-article-current-article))
85 (msg-list (reverse navi2ch-article-message-list))
86 (num 850) ;¿·¥¹¥ì°Ü¹Ô¤Ï850°Ê¹ß¤«¤Ê¡£
87 nboard url body start found)
89 (while (> (length msg-list) num)
90 (setq body (if (listp (cdar msg-list))
91 (cdr (assoc 'data (cdar msg-list)))
93 msg-list (cdr msg-list))
95 (while (string-match navi2ch-article-url-regexp body start)
96 (setq url (match-string 0 body)
98 (setq nboard (cdr (assoc 'name (navi2ch-board-url-to-board url))))
99 ;; Ʊ¤¸ÈĤÀ¤Ã¤¿¤é¥Á¥§¥Ã¥¯
101 ;; °Üž¤·¤Æ¤Æ¤âÇ°¤Î¤¿¤á¥Á¥§¥Ã¥¯
102 (or (string= nboard "No Name") (string= nboard cboard))
103 (navi2ch-new-thread-check url curl))
104 (throw 'find (setq found t))))
105 (setq num (1+ num))))
108 (defun navi2ch-article-new-thread ()
111 (let ((url (or (navi2ch-article-search-new-thread-with-lead)
112 (navi2ch-article-search-new-thread-with-subject))))
114 (let* ((article (navi2ch-article-url-to-article url))
115 (board (navi2ch-board-url-to-board url))
116 (subj (navi2ch-article-cached-subject board article)))
117 (when (navi2ch-y-or-n-p (concat "¡Ö" subj "¡×¤Ë°ÜÆ°¤¹¤ë¡©"))
118 (navi2ch-goto-url url)))
119 (message (concat "¿·¥¹¥ì¤òȯ¸«¤Ç¤¤Þ¤»¤ó¤Ç¤·¤¿¡£"
120 (substitute-command-keys
121 "`\\[navi2ch-article-goto-current-board]'")
122 " ¤·¤Æ¼êÆ°¤Çõ¤·¤Æ¤Í¡£")))))
124 (define-key navi2ch-article-mode-map "\C-c\C-n" 'navi2ch-article-new-thread)