Changeset 12411 in project


Ignore:
Timestamp:
11/08/08 16:40:38 (11 years ago)
Author:
azul
Message:

yet more fixes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • release/3/stream-wiki/trunk/extensions/mail.scm

    r12410 r12411  
    4242(define (mail-request-handle env)
    4343  (let-from-environment env (user-input)
    44     (let ((result (assoc (stream->symbol (user-input 'request stream-null)) 
     44    (let ((result (assoc (stream->symbol (user-input 'request stream-null))
    4545                         *mail-request-handlers*)))
    4646      (if result
     
    691691    (test "01234567890" "0123456...")))
    692692
     693
     694(define (notify-subscribers-generic get-history-wrapper filter-revisions get-from get-gateway-address write-headers write-body)
     695  (lambda (env last-revision)
     696    (let-from-environment env (user password path-in path)
     697      (let ((history (get-history-wrapper env user password (svnwiki-make-pathname path-in path))))
     698        (unless (and history (not (stream-null? history)))
     699          (error "Unable to load history for path" (svnwiki-make-pathname path-in path)))
     700        (stream-for-each
     701          (lambda (rev)
     702            (stream-for-each
     703              (lambda (data)
     704                (let* ((address (first data))
     705                       (path-subscribed (second data))
     706                       (env-new (enviroment env (path path-subscribed)))
     707                       (gateway-address (get-gateway-address env)))
     708                  (send-mail
     709                    env-new
     710                    (get-from env)
     711                    address
     712                    (lambda (from)
     713                      (format #t "From: ~A~%" from)
     714                      (write-headers rev address)
     715                      (format #t "MIME-Version: 1.0 (svnwiki mail extension $Rev$)~%")
     716                      (format #t "Content-type: text/plain; charset=~A~%" (svnwiki-encoding-for-file env))
     717                      ; TODO: quoted-printable would be nicer
     718                      (format #t "Content-Transfer-Encoding: base64~%~%")
     719                      (write-body env address rev)))))
     720              (list-subscribers-with-parents path)))
     721          (stream-filter (lambda (rev) (> (second rev) last-revision))
     722                         (filter-revisions last-revision history)))))))
     723
    693724; TODO: "A diff for the commit will be included in an attachment."
    694725
     
    742773      (let-from-environment env (path-in path)
    743774        (get-props-parents-first
    744           "svnwiki:mail:headers:from" 
     775          "svnwiki:mail:headers:from"
    745776          path-in
    746777          path
     
    761792                (stream-append (port->stream) (with-output-to-stream (cut mail-footnote env address)))))))))))
    762793
    763 (define (notify-subscribers-generic get-history-wrapper filter-revisions get-from get-gateway-address write-headers write-body)
    764   (lambda (env last-revision)
    765     (let-from-environment env (user password path-in path)
    766       (let ((history (get-history-wrapper env user password (svnwiki-make-pathname path-in path))))
    767         (unless (and history (not (stream-null? history)))
    768           (error "Unable to load history for path" (svnwiki-make-pathname path-in path)))
    769         (stream-for-each
    770           (lambda (rev)
    771             (stream-for-each
    772               (lambda (data)
    773                 (let* ((address (first data))
    774                        (path-subscribed (second data))
    775                        (env-new (enviroment env (path path-subscribed)))
    776                        (gateway-address (get-gateway-address env)))
    777                   (send-mail
    778                     env-new
    779                     (get-from env)
    780                     address
    781                     (lambda (from)
    782                       (format #t "From: ~A~%" from)
    783                       (write-headers rev address)
    784                       (format #t "MIME-Version: 1.0 (svnwiki mail extension $Rev$)~%")
    785                       (format #t "Content-type: text/plain; charset=~A~%" (svnwiki-encoding-for-file env))
    786                       ; TODO: quoted-printable would be nicer
    787                       (format #t "Content-Transfer-Encoding: base64~%~%")
    788                       (write-body env address rev)))))
    789               (list-subscribers-with-parents path)))
    790           (stream-filter (lambda (rev) (> (second rev) last-revision))
    791                          (filter-revisions last-revision history)))))))
    792  
    793794(define (mail-footnote env address)
    794795  (format #t "--~%")
Note: See TracChangeset for help on using the changeset viewer.