;; ;; ãã®ãã¡ã¤ã«ã¯ããã©ã«ãã§èªã¿è¾¼ã¾ããç©ã¨ã»ã¼åä¸ã ;; UTF-8ã¨ã³ã³ã¼ãã£ã³ã°ã§ãªããã°ãªããªãã ;; ;; ã¦ã¼ã¶ã~/.ochusha/ochusha-init.scmã¨ãããã¡ã¤ã«ãæã£ã¦ããå ´åã ;; ãã®å 容ã®ä»£ããã«ãããèªã¿è¾¼ã¾ããã ;; ;; $Id: ochusha-init.scm.ja,v 1.1 2009/01/05 12:18:03 fuyu Exp $ ;; ;; ãã¡ã ãããã¯è²ã表ç¾ããããã«ä»¥ä¸ã®å®æ°ããããããå®ç¾©ãã¦ããã ;; ã¹ã¬ä¸è¦§ã®è²ä»ãã«ä½¿ãããããããã¯ããã¡ã ãããã®è¨å®ããã¤ã¢ãã°ã® ;; ãä¸è¦§è¡¨ç¤ºãã¿ãã§é¸æãããè²ãåç §ããå®æ°ã§ããã ;; âç¾å¨å®ç¾©ããã¦ããå¤ ;; `list-entry-fg-normal', `list-entry-bg-normal' GTK+/GNOMEãã¼ãã®ããã©ã«ã ;; `list-entry-fg-emph', `list-entry-bg-emph' ãã¼ãã®ããã©ã«ããlavender ;; `list-entry-fg-strong', `list-entry-bg-strong' redããã¼ãã®ããã©ã«ã ;; `list-entry-fg-hidden', `list-entry-bg-hidden' gray75ããã¼ãã®ããã©ã«ã ;; ;; ãã¡ã ãããã®ããã©ã«ãç¶æ ã§ã¯ãããã®å®æ°ã使ããã¹ã¬ä¸è¦§ã以ä¸ã® ;; ããã«è²ä»ãããã ;; é ãããã¹ã¬ ;; => (list-entry-fg-hidden . list-entry-bg-hidden) ;; DATè½ã¡ã¹ã¬ ;; => (list-entry-fg-normal . list-entry-bg-strong) ;; æ°ã¹ã¬ ;; => (list-entry-fg-emph . list-entry-bg-emph) ;; æ¢èªãã¤æªèªã¬ã¹ãã ;; => (list-entry-fg-strong . list-entry-bg-strong) ;; ä»ã®ã¹ã¬ ;; => (list-entry-fg-normal . list-entry-bg-normal) ããã¯'()ã§ä»£ç¨å¯ ;; è²ãªãã¸ã§ã¯ãã¯gdk-color-parseé¢æ°ã«ããschemeã¬ãã«ã§å®ç¾©ãããã¨ã ;; ã§ãããå é¨çã«ã¯Cã®gdk_color_parse()é¢æ°ãå¼ãã§ããã®ã§ã ;; /usr/X11R6/lib/X11/rgb.txtãããã«æ¸ããã¦ããè²åã"#RRGGBB"ã¿ãã㪠;; æååã§è²ãæå®ã§ãããã¨ã©ã¼æã¯é»ã£ã¦ããã©ã«ãã®è²ã«ãªãã ;(define test-fg (gdk-color-parse "yellow")) ;; 以ä¸ãããã©ã«ãã®ã¹ã¬ä¸è¦§ç¨è²é¸æé¢æ°ã®å®ç¾© (define (decorate-list-entry-default thread) (let ((new-responses (thread-get-number-of-new-responses thread)) (n-got (thread-get-number-of-responses-got thread))) (cond ((thread-hidden? thread) (cons list-entry-fg-hidden list-entry-bg-hidden)) ((not (thread-alive? thread)) (cons list-entry-fg-normal list-entry-bg-strong)) ((> n-got 0) (if (> (thread-get-number-of-responses-on-server thread) n-got) (cons list-entry-fg-strong list-entry-bg-strong) '())) ((thread-new? thread) (cons list-entry-fg-normal list-entry-bg-emph)) (else '())))) ;; ãã¡ã ãããã¯ã¹ã¬ä¸è¦§ã飾ãä»ããããã«decorate-list-entryã¨ãã ;; ååã®é¢æ°ãå¼ã³åºãã ;; ãã®é¢æ°ãè¿ããè²ãªãã¸ã§ã¯ãã®ãã¢ã«ãããã¹ã¬ä¸è¦§ã®åã ã®è¦ç´ ã® ;; è²ã決ã¾ãã ;; (car (decorate-list-entry thread)) ãåæ¯è² ;; (cdr (decorate-list-entry thread)) ãèæ¯è² ;; ã«ãªããããã'()ãè¿ããå ´åãGTK+/GNOMEã®ãã¼ãã§æ±ºã¾ãããã©ã«ã ;; ã®è²ã«ãªãã (define decorate-list-entry decorate-list-entry-default) ;; ã¹ã¬ä¸è¦§ã§ã®ã«ã¼ã½ã«ç§»åæã«ç¨ããããã ;; ãã®é¢æ°ãçãè¿ããã¹ã¬ã¯èªãã¹ããã®ã®åå¨ããã¹ã¬ã¨ãã¦åãæ±ãããã (define (interest-thread? thread) (and (> (thread-get-number-of-responses-got thread) 0) (> (thread-get-number-of-responses-to-read thread) 0))) ;; ã¹ã¬ä¸è¦§ã®è¡¨ç¤ºè¦åã追å ããã ;; (register-threadlist-rule NAME LABEL DESCRIPTION PROCEDURE) ;; ;; NAMEã¯å é¨çã«è¦åãèå¥ããããã«ç¨ããããæååãåãååã®è¦åã ;; åå¨ãã¦ããå ´åãä¸æ¸ããããã ;; LABELã¯GUIã®ã¡ãã¥ã¼ãªã©ã«è¡¨ç¤ºãããæååã ;; DESCRIPTIONã¯è¦åã®èª¬æã ;; PROCEDUREã¯è¦åãå®ç¾ããé¢æ°ãã¹ã¬ä¸è¦§ã¯ããã®é¢æ°ã®è¿ããæ°å¤ ;; ã«ã¤ãã¦æé ã«ã½ã¼ããããããã®é¢æ°ã#fãè¿ããã¹ã¬ã¯ä¸è¦§ã«è¡¨ç¤ºãããªãã ;; PROCEDUREã¯å¼æ°ã¨ãã¦threadãªãã¸ã§ã¯ããä¸ã¤ã ãåãé¢æ°ã§ãªããã°ãªããªãã (register-threadlist-rule "ochusha-default-plain-all" "å ¨é¨" "ç¾åã¹ã¬âDATè½ã¡ã¹ã¬" (lambda (thread) (if (thread-alive? thread) 0 10000))) (register-threadlist-rule "ochusha-default-plain-live-only" "ç¾åã¹ã¬" "ç¾åã¹ã¬å ¨é¨" (lambda (thread) (if (thread-alive? thread) 0 #f))) (register-threadlist-rule "ochusha-default-plain-dead-only" "DATè½ã¡ã¹ã¬" "DATè½ã¡ã¹ã¬å ¨é¨" (lambda (thread) (if (thread-alive? thread) #f 0))) (register-threadlist-rule "ochusha-default-plain-all-newer-to-older" "å ¨é¨æ°ããé " "ã¹ã¬å ¨é¨æ°ããé " (lambda (thread) (- #x7fffffff (thread-get-birthtime thread)))) (register-threadlist-rule "ochusha-default-plain-all-older-to-newer" "å ¨é¨å¤ãé " "ã¹ã¬å ¨é¨å¤ãé " (lambda (thread) (thread-get-birthtime thread))) (register-threadlist-rule "ochusha-default-importance-order" "å ¨é¨éè¦åº¦é " "æ¢èª(æªèªæ)âæ°ã¹ã¬âæ¢èª(æªèªç¡)âé常ã¹ã¬âDATè½ã¹ã¬" (lambda (thread) (let ((n-res (thread-get-number-of-responses-on-server thread)) (n-got (thread-get-number-of-responses-read thread))) (+ (if (thread-hidden? thread) 10000 0) (if (thread-marked? thread) 0 5000) (if (> n-got 0) (if (> n-res n-got) 0 2000) (if (thread-new? thread) 1000 3000)) (if (thread-alive? thread) 0 5000))))) (register-threadlist-rule "ochusha-default-important-only" "注ç®ã¹ã¬" "æ¢èª(æªèªæ)âæ°ã¹ã¬âæ¢èª(æªèªç¡)âæ¢èª(DATè½ã¡)" (lambda (thread) (let ((n-res (thread-get-number-of-responses-on-server thread)) (n-got (thread-get-number-of-responses-read thread))) (if (and (= n-got 0) (not (thread-marked? thread))) #f (+ (if (thread-marked? thread) 0 5000) (if (> n-got 0) (if (> n-res n-got) 0 2000) (if (thread-new? thread) 1000 3000)) (if (thread-alive? thread) 0 5000)))))) (register-threadlist-rule "ochusha-default-important-unread-only" "æªèªæ注ç®ã¹ã¬" "æ¢èª(æªèªæ)" (lambda (thread) (let ((n-res (thread-get-number-of-responses-on-server thread)) (n-got (thread-get-number-of-responses-read thread))) (if (or (= n-got 0) (<= n-res n-got)) #f (+ (if (thread-marked? thread) 0 5000) (if (thread-alive? thread) 0 5000)))))) (register-threadlist-rule "ochusha-default-important-live-only" "ç¾å注ç®ã¹ã¬" "æ¢èª(æªèªæ)âæ¢èª(æªèªç¡)" (lambda (thread) (let ((n-res (thread-get-number-of-responses-on-server thread)) (n-got (thread-get-number-of-responses-read thread))) (if (or (and (= n-got 0) (not (thread-marked? thread))) (not (thread-alive? thread))) #f (+ (if (thread-marked? thread) 0 5000) (if (> n-got 0) (if (> n-res n-got) 0 2000))))))) (register-threadlist-rule "ochusha-default-importance-order-live-only" "ç¾åéè¦åº¦é " "æ¢èª(æªèªæ)âæ°ã¹ã¬âæ¢èª(æªèªç¡)âé常ã¹ã¬" (lambda (thread) (let ((n-res (thread-get-number-of-responses-on-server thread)) (n-got (thread-get-number-of-responses-read thread))) (if (thread-alive? thread) (+ (if (thread-hidden? thread) 10000 0) (if (thread-marked? thread) 0 5000) (if (> n-got 0) (if (> n-res n-got) 0 2000) (if (thread-new? thread) 1000 3000))) #f)))) (register-threadlist-rule "ochusha-default-live-only-newer-to-older" "ç¾åæ°ããé " "ç¾åã¹ã¬å ¨é¨æ°ããé " (lambda (thread) (if (thread-alive? thread) (- #x7fffffff (thread-get-birthtime thread)) #f))) (register-threadlist-rule "ochusha-default-live-only-older-to-newer" "ç¾åå¤ãé " "ç¾åã¹ã¬å ¨é¨å¤ãé " (lambda (thread) (if (thread-alive? thread) (thread-get-birthtime thread) #f))) (register-threadlist-rule "ochusha-default-mark-only" "å°ä»" "å°ä»ã¹ã¬ã®ã¿" (lambda (thread) (if (thread-marked? thread) 0 #f))) (register-threadlist-rule "ochusha-default-only-mark-is-important" "å°éè¦" "å°ä»ã¹ã¬âå°ç¡ã¹ã¬" (lambda (thread) (if (thread-marked? thread) 0 1000))) (register-threadlist-rule "ochusha-default-marked-unread-is-important" "å°æªèªéè¦" "å°ä»(æªèªæ)âå°ä»(æªèªç¡)âé常ã¹ã¬âDATè½ã¹ã¬" (lambda (thread) (if (thread-marked? thread) (if (> (thread-get-number-of-responses-on-server thread) (thread-get-number-of-responses-read thread)) 0 1000) 2000))) (register-threadlist-rule "ochusha-default-importance-order-mark-first" "å°æå¼·éè¦åº¦é " "å°ä»âæ¢èª(æªèªæ)âæ°ã¹ã¬âæ¢èª(æªèªç¡)âé常ã¹ã¬âDATè½ã¹ã¬" (lambda (thread) (let ((n-res (thread-get-number-of-responses-on-server thread)) (n-got (thread-get-number-of-responses-read thread))) (+ (if (thread-hidden? thread) 10000 0) (if (thread-marked? thread) 0 20000) (if (> n-got 0) (if (> n-res n-got) 0 2000) (if (thread-new? thread) 1000 3000)) (if (thread-alive? thread) 0 5000))))) ;; (register-external-tool NAME LABEL DESCRIPTION TOOL-TYPE TEMPLorPROC) ;; ;; NAMEã¯å é¨çã«è¦åãèå¥ããããã«ç¨ããããæååãåãååã®ãã¼ã«ã ;; ç»é²ããã¦ããå ´åãä¸æ¸ããããã ;; ;; LABELã¯GUIã®ã¡ãã¥ã¼ãªã©ã«è¡¨ç¤ºãããæååã ;; ;; DESCRIPTIONã¯ãã¼ã«ã®èª¬æã ;; ;; TOOL-TYPEã¯ãã¼ã«ã®ç¨®å¥ã示ããå ·ä½çã«ã¯ãã©ã®ã¡ãã¥ã¼ã«ç¾ããã¹ããã ;; 決ããã·ã³ãã«ãç¾å¨å é¨çã«ã¯ã'link-toolã'image-toolã'text-tool ;; ãäºç´ããã¦ããããããããªã³ã¯ã«å¯¾ãããããã¢ããã¡ãã¥ã¼ãç»åãªã³ã¯ ;; ã«å¯¾ãããããã¢ããã¡ãã¥ã¼ãé¸ææååã«å¯¾ãããããã¢ããã¡ãã¥ã¼ã® ;; ãã¼ã«ã«å¯¾å¿ããã ;; ;; TEMPLorPROCã¯ã³ãã³ãã©ã¤ã³ã®ãã³ãã¬ã¼ããä¸ããæååãæååãå¼æ°ã¨ ;; ãã¦ååãããã³ãã¬ã¼ãæååãè¿ãprocedureã¨ãªãäºå®ã ;; ãã³ãã¬ã¼ãã®"%ARG%"ãURLãç»åãã¡ã¤ã«ã®ãã¹åãé¸æä¸ã®æååãªã©ã§ ;; ç½®ãæããããã ;; ãã³ãã¬ã¼ãã«"%FILENAME_FROM_ARG%"ãããã¯"%FILENAME%"ãç¾ããå ´åã ;; ã³ãã³ãã©ã¤ã³å®è¡ã®åã«ãã¡ã¤ã«é¸æç¨ã®ãã¤ã¢ãã°ãç¾ããããã§é¸æ ;; ããããã¡ã¤ã«åã§ç½®ãæããããã"%FILENAME_FROM_ARG%"ã®å ´åã«ã¯ã ;; "%ARG%"ããã¡ã¤ã«åã®åæå¤ã¨ãã¦ç¨ãããã%FILENAME%ã®å ´åã¯ã ;; localizeããã"untitled"ç¸å½ã®æååããã¡ã¤ã«åã®åæå¤ã¨ãã¦ç¨ããããã (register-external-tool "save-image" "ååãä»ãã¦ç»åãä¿å" "ååãä»ãã¦ç»åãä¿å" 'image-tool "cp %ARG% %FILENAME_FROM_ARG%") ;; eogã®ä¾ã§ã¯ãå¼æ°ã¨ãã¦ä¸ãããããã¹åãèªåã§ã³ãã³ãã©ã¤ã³ã« ;; å±éããprocedureãTEMPLorPROCã¨ãã¦ç»é²ãã¦ããã (register-external-tool "browse-image-with-eog" "Eye of GNOME" "eogã§ç»åãéã" 'image-tool (lambda (filename) (format "eog ~a" filename))) (register-external-tool "browse-image-with-gimp" "Gimp" "gimpã§ç»åãéã" 'image-tool "gimp-remote %ARG%") ;; wgetã®ä¾ã§ã¯ããã¡ã ãããã%ARG%ãURLã«ç½®ãæããã³ãã³ãã©ã¤ã³ ;; ã®ãã³ãã¬ã¼ããTEMPLorPROCã¨ãã¦ç»é²ãã¦ããã (register-external-tool "download-url-with-wget" "Wget" "Wgetã§URLãéã" 'link-tool "xterm -e wget %ARG%") (register-external-tool "open-url-with-d4x" "d4x" "d4xã§URLãéã" 'link-tool (lambda (url) (format "d4x ~a" url))) ;; Internet Archiveã®ä¾ã§ã¯ã¦ã§ããã©ã¦ã¶ã§éãã¹ãURLãè¿ãprocedureã ;; TEMPLorPROCã¨ãã¦ç»é²ãã¦ããã (register-external-tool "search-archive-with-web-browser" "Internet Archive Wayback Machine" "Internet Archive Wayback Machineã§URLãæ¤ç´¢ãã" 'link-tool (lambda (url) (format "%WEBBROWSER% http://web.archive.org/*/~a" url))) ;; Googleã®ä¾ã§ã¯ã¦ã§ããã©ã¦ã¶ã§éãã¹ãURLãè¿ãprocedureã ;; TEMPLorPROCã¨ãã¦ç»é²ãã¦ããã ;; %E6%A4%9C%E7%B4%A2ã¯UTF-8ãª"æ¤ç´¢"ãURIã¨ã³ã³ã¼ããããã®ã (register-external-tool "google-text-in-japanese" "Google Search(æ¥æ¬èªã®ãã¼ã¸)" "æ¥æ¬èªã®ãã¼ã¸ã§ã°ã°ã" 'text-tool (lambda (text) (format "%WEBBROWSER% http://www.google.co.jp/search?hl=ja&q=~a&btnG=Google+%E6%A4%9C%E7%B4%A2&lr=lang_ja" (url-encode-string text)))) (register-external-tool "google-text-in-all" "Google Search(ã¦ã§ãå ¨ä½)" "ã¦ã§ãå ¨ä½ã§ã°ã°ã" 'text-tool (lambda (text) (format "%WEBBROWSER% http://www.google.co.jp/search?hl=ja&q=~a&btnG=Google+%E6%A4%9C%E7%B4%A2&lr=" (url-encode-string text)))) (register-external-tool "google-image" "Google Search(ã¤ã¡ã¼ã¸)" "ã¤ã¡ã¼ã¸ã§ã°ã°ã" 'text-tool (lambda (text) (format "%WEBBROWSER% http://www.google.co.jp/images?hl=ja&q=~a&btnG=Google+%E3%82%A4%E3%83%A1%E3%83%BC%E3%82%B8%E6%A4%9C%E7%B4%A2&lr=" (url-encode-string text)))) (register-external-tool "excite-english-japanese-dictionary" "exciteè¾æ¸(æ°è±åä¸è¾å ¸)" "exciteè¾æ¸ã§æ°è±åä¸è¾å ¸ãå¼ã" 'text-tool (lambda (text) (format "%WEBBROWSER% http://www.excite.co.jp/dictionary/english_japanese/?search=~a&submit=+%E6%A4%9C+%E7%B4%A2+&match=beginswith&dictionary=NEW_EJJE" (url-encode-string text)))) (register-external-tool "excite-japanese-english-dictionary" "exciteè¾æ¸(æ°åè±ä¸è¾å ¸)" "exciteè¾æ¸ã§æ°åè±ä¸è¾å ¸ãå¼ã" 'text-tool (lambda (text) (format "%WEBBROWSER% http://www.excite.co.jp/dictionary/japanese_english/?search=~a&submit=+%E6%A4%9C+%E7%B4%A2+&match=beginswith" (url-encode-string text)))) (register-external-tool "wikipedia-ja-search" "ã¦ã£ãããã£ã¢ï¼æ¥æ¬èªçï¼ã§æ¤ç´¢" "ã¦ã£ãããã£ã¢ãæ¤ç´¢ãã" 'text-tool (lambda (text) (format "%WEBBROWSER% http://ja.wikipedia.org/wiki/%E7%89%B9%E5%88%A5:Search?search=~a&fulltext=%E6%A4%9C%E7%B4%A2" (url-encode-string text)))) (register-external-tool "wikipedia-en-search" "Wikipedia(è±èªç)ã§æ¤ç´¢" "Wikipediaãæ¤ç´¢ãã" 'text-tool (lambda (text) (format "%WEBBROWSER% http://en.wikipedia.org/wiki/Special:Search?search=~a&fulltext=Search" (url-encode-string text)))) ;; ããããã¦ã¼ã¶ã®å¥½ã¿ã§ime.nuã®é¡ãæãå»ããªã©ã®ãªã³ã¯ã®æ¸ãæãã ;; schemeé¢æ°ã§åºæ¥ãããã«ãªãäºå®ã (define (rewrite-link-default link) link) ;; ãã¡ã ãããã¯ãªã³ã¯ã®æ¸ãæããªã©ãè¡ãããã«ãrewrite-linkã¨ãã ;; ååã®é¢æ°ãå¼ã³åºãããã«ãªãäºå®ãç¾æç¹ã§ã¯æªä½¿ç¨ã (define rewrite-link rewrite-link-default) ;; output-string-portã®æååãåãåºããportãéããã (define (close-string-port string-port) (let ((result (get-output-string string-port))) (close-output-port string-port) result)) ;; GtkToolbarã®ä»æ§ãããGtkComboBoxããã¼ã«ãã¼ã«è¡¨ç¤ºããããªãå ´å ;; å®å ¨ã«é表示ã«ãªã£ã¦ãã¾ãã®ãæ°ã«ãããªãã®ã§ã ;; ã¹ã¬ã¿ã¤ç¨ã®GtkComboBoxã«è¡¨ç¤ºããã¹ã¬ã¿ã¤ã®é·ããå¶éããã ;; âãã¡ã ãããã®ã¦ã£ã³ãã¦å¹ ãåºãã«åã£ã¦ãã人ã«ã¯ç¡æå³ã ;; ããããGUIè¨å®ã§å¶éæåæ°ã®è¨å®ãã¹ã¬ã¿ã¤ã®ç縮ã¢ã«ã´ãªãºã ã® ;; é¸æãªã©ãå¯è½ã«ãããããåãæ¢ããç¾ç¶ã§ã¯æåæ°ãã¢ã«ã´ãªãºã ã ;; åºå®ã ;; ããããåè§æåæç®ã§ãåç´ã«å é ããnæåã§æã¡åãã¢ã«ã´ãªãºã (define (abbreviate-thread-title-by-heading n thread-title) (letrec ((char-width (lambda (char-string) (if (eq? (string-length char-string) 1) 1 2))) (append-chars (lambda (string-port rest-len splitted-title) (if (null? splitted-title) string-port (let* ((next-char (car splitted-title)) (next-char-width (char-width next-char))) (if (< rest-len next-char-width) string-port (begin (display next-char string-port) (append-chars string-port (- rest-len next-char-width) (cdr splitted-title))))))))) (close-string-port (append-chars (open-output-string) n (regexp-split #// thread-title))))) ;; ãããã¼ã·ã§ãã«ãã©ã³ãã ã¨å 容ã«ããå¹ ã®å¤åã®æ¹ã大ããã®ã¯æãã ;; ã ããpixelæ°ãªãã¦ã®ãè¨ç®ã§åºãã®ã¯ã»ã¨ãã©ä¸å¯è½ã ãããã©ã³ãã ;; ãã¼ãè¨å®ãªã©å¤çè¦å ã§å¤åããã®ã§ç¾å®çã«ã¯GTK+ã«ãæç»ããã¦ã¿ãã ;; 以å¤ã®åç´ãªæ¹æ³ã¯ãªããã ;; âå é ãã44æåã§æã¡åã ;(define (abbreviate-thread-title thread-title) ; (abbreviate-thread-title-by-heading 44 thread-title)) ;; â縮ããªãå ´å (define (abbreviate-thread-title thread-title) thread-title) ;; ããã©ã«ãã®æ¬ææ¸ãæãé¢æ°ã§ä½¿ãã (define (caadddr x) (car (cadddr x))) (define (cdadddr x) (cdr (cadddr x))) ;; ãããããã©ã«ãã®æ¬ææ¸ãæãé¢æ°ã ;; - httpãftpãªURLã£ã½ãæååãHTMLã®aè¦ç´ 風㫠;; - ã¬ã¹ã¢ã³ã«ã¼ã«ãªã£ã¦ããªã>æ°åã¿ãããªã®ãã¬ã¹ã¢ã³ã«ã¼ã« ;; - ã¬ã¹ã¢ã³ã«ã¼ã«ç¶ã,æ°åã¿ãããªã®ãã¬ã¹ã¢ã³ã«ã¼ã« ;; ããããæ¸ãæããã (define (rewrite-message-default message) (letrec ((rewrite-additional-response-number (lambda (message output) (let* ((match-pos (regexp-match-positions #/^(?:[ ,、ãï¼=ï¼]+)([0-9ï¼-ï¼]+)/ message)) (match-beg (if match-pos (caar match-pos) 0)) (match-end (if match-pos (cdar match-pos) 0)) (number-beg (if match-pos (caadr match-pos) 0)) (number-end (if match-pos (cdadr match-pos) 0))) (if match-pos (begin (output "<a href=\"") (output (substring message number-beg number-end)) (output "\">") (output (substring message match-beg match-end)) (output "</a>") (rewrite-additional-response-number (substring message match-end) output)) (rewrite-message message output))))) (rewrite-non-link-response-number (lambda (message output) (let* ((match-pos (regexp-match-positions #/(?:>|[ï¼â«ãã])+([0-9ï¼-ï¼]+[-âã¼âï¼ã]?[0-9ï¼-ï¼]*)/ message)) (match-beg (if match-pos (caar match-pos) 0)) (match-end (if match-pos (cdar match-pos) 0)) (numbers-beg (if match-pos (caadr match-pos) 0)) (numbers-end (if match-pos (cdadr match-pos) 0))) (if match-pos (begin (output (substring message 0 match-beg)) (output "<a href=\"") (output (substring message numbers-beg numbers-end)) (output "\">") (output (substring message match-beg match-end)) (output "</a>") (rewrite-additional-response-number (substring message match-end) output)) (output message))))) (rewrite-non-link-url (lambda (message output) (let* ((match-pos (regexp-match-positions #/(h?[ft]?)tp(s?):\/\/([0-9a-zA-Z\/#?;:@&%=+\-!*$,._~'()]+)/ message)) (match-beg0 (if match-pos (caar match-pos) 0)) (match-end0 (if match-pos (cdar match-pos) 0)) (match-beg1 (if match-pos (caadr match-pos) 0)) (match-end1 (if match-pos (cdadr match-pos) 0)) (match-beg2 (if match-pos (caaddr match-pos) 0)) (match-end2 (if match-pos (cdaddr match-pos) 0)) (match-beg3 (if match-pos (caadddr match-pos) 0)) (match-end3 (if match-pos (cdadddr match-pos) 0))) (if match-pos (begin (rewrite-non-link-response-number (substring message 0 match-beg0) output) (output "<a href=\"") (if (eqv? (substring message match-beg1 match-end1) "f") (output "f") (output "ht")) (output "tp") (output (substring message match-beg2 match-end2)) (output "://") (output (substring message match-beg3 match-end3)) (output "\">") (output (substring message match-beg0 match-end0)) (output "</a>") (rewrite-non-link-url (substring message match-end0) output)) (rewrite-non-link-response-number message output))))) (rewrite-message (lambda (message output) (let ((match-pos (regexp-match-positions #/<[aA][[:space:]][^>]+>[^<]*<\/a>/ message))) (if match-pos (begin (rewrite-non-link-url (substring message 0 (caar match-pos)) output) (output (substring message (caar match-pos) (cdar match-pos))) (rewrite-additional-response-number (substring message (cdar match-pos)) output)) (rewrite-non-link-url message output)))))) (let ((result-port (open-output-string))) (rewrite-message message (lambda (text) (display text result-port))) (close-string-port result-port)))) ;; ãã¡ã ãããã¯ã¹ã¬è¡¨ç¤ºã®ç´åã«åã¬ã¹ã®ã¡ãã»ã¼ã¸æ¬æãå¼æ°ã¨ã㦠;; rewrite-messageã¨ããååã®é¢æ°ãå¼ã³åºããæ¬æãæ¸ãæããã (define rewrite-message rewrite-message-default) ;; ãã¡ã ãããã¯ãªã³ã¯ãç»åã®ãã®ãã©ãããå¤æããããã« ;; image-link?ã¨ããååã®é¢æ°ãå¼ã³åºãã (define (image-link? url) #f) ;; ãã¡ã ãããã¯ç»åã®ãã®ã¨å¤æããããªã³ã¯ã«å¯¾ããå®éã«ã¢ã¯ã»ã¹ãã ;; URLã«ç´°å·¥ãå ãããã¨ã許ãããã«rewrite-image-linkã¨ããååã®é¢æ°ã ;; å¼ã³åºãã ;; ãã®é¢æ°ã®è¿ãå¤ã¯URLãã®ãã®ã表ãæååããã㯠;; (URL . REFERER)ã¨ãããã¢ãæå¾ ããããã以å¤ã®å¤ã®å ´åã«ã¯URLã¸ã® ;; ç´°å·¥ãå¿ è¦ãªããã®ã¨å¤æãããã ;; (URL . REFERER)ã¨ãããã¢ãè¿ãããå ´åããã¡ã ããã㯠;; rewrite-image-linkã®å¼æ°ã¨ãã¦ä¸ããurlã®ä»£ããã«URLã«ã¢ã¯ã»ã¹ãã ;; ãã®æã«HTTPã®ãªã¯ã¨ã¹ããããã®Refererã¨ãã¦REFERERãè¨å®ããã (define (rewrite-image-link url) #f) ;; ãã¡ã ãããã¯ç»åãªã³ã¯ã¨æã£ã¦ã¢ã¯ã»ã¹ããçµæãHTMLã ã£ãæã« ;; ãããç®çã®ç»åã表示ããããã®ãã¼ã¸ã§ããå¯è½æ§ã確èªããããã« ;; redirect-image-linkã¨ããååã®é¢æ°ãå¼ã³åºãã ;; ããã¯urlã¸ã®ã¢ã¯ã»ã¹ã®çµæpage-sourceãªHTMLã½ã¼ã¹ãè¿ãããã¨ãã ;; ãã¨ãæå³ããé¢æ°redirect-image-linkã¯urlã¨page-sourceãå ã«ç»å ;; ãã¡ã¤ã«ã¸ã®URLæååãè¿ããã¨ãæå¾ ãããã (define (redirect-image-link url page-source) #f)