Changeset 14698 in project


Ignore:
Timestamp:
05/18/09 21:11:08 (10 years ago)
Author:
azul
Message:
  1. Fixed a bug with the code that sleeps between sending mails. 2. Now include in the notifications the user that made the commit, unless it was an unauthenticated commit. 3. Remove unrequired verbosity.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • release/3/svnwiki-mail/trunk/svnwiki-mail.scm

    r14671 r14698  
    168168(define (send-mail env to writer)
    169169  (when (> (+ *last-mail-time* *seconds-between-mails*) (current-seconds))
    170     (sleep 1))
     170    (sleep (- *seconds-between-mails* (- (current-seconds) *last-mail-time*))))
    171171  (format (current-error-port) "Sending mail to: ~A~%" to)
    172172  (set! *last-mail-time* (current-seconds))
     
    808808; type is either 'add, 'modify or 'delete.
    809809
    810 (define-record changed-file type path seconds revision description)
     810(define-record changed-file type path seconds revision description author)
    811811
    812812; parse-revision receives a revision and returns a stream with changed-file records.
     
    814814(define (notify-subscribers-generic parse-revision get-gateway-address write-headers write-body)
    815815  (lambda (env id last-revision)
    816     (format (current-error-port) "Start notify-generic~%")
    817816    (let-from-environment env (user password path-in path)
    818       (format (current-error-port) "Notify-generic: got data: path:~A, last-revision:~A~%" path last-revision)
    819817      (let ((history (get-history user password (svnwiki-make-pathname path-in path) 0 (make-svn-opt-revision-number last-revision) svn-opt-revision-head)))
    820         (format (current-error-port) "Notify-generic: got history: ~A~%" (stream->list history))
    821818        (stream-for-each
    822819          (lambda (rev)
    823             (format (current-error-port) "Notify-generic: got rev: ~A~%" (changed-file-path rev))
    824820            (assert (and 'notify-subscribers-generic (changed-file? rev)))
    825821            (stream-for-each
    826822              (lambda (data)
    827                 (format (current-error-port) "Notify-generic: got subs: ~A: ~A~%" rev data)
    828823                (and-let* ((address (first data))
    829824                           ((< (second data) (changed-file-seconds rev)))
     
    831826                           (env-new (environment env ((path path-subscribed))))
    832827                           (gateway-address (get-gateway-address env)))
    833                   (format (current-error-port) "Notify-generic: sending mail: ~A: ~A~%" rev data)
    834828                  (send-mail
    835829                    env-new
     
    848842            stream-null
    849843            (stream-filter (lambda (rev)
    850                              (format (current-error-port) "chec: [rev:~A][last-revision:~A]~%" (second rev) last-revision)
    851844                             (> (second rev) last-revision))
    852                            history)))))
    853     (format (current-error-port) "Notify-generic: returning~%")
    854     ))
     845                           history)))))))
    855846
    856847(define (svn-change->symbol change)
     
    880871                (svnwiki-svn-time->seconds (fourth rev))
    881872                (second rev)
    882                 (fifth rev)))
     873                (fifth rev)
     874                (third rev)))
    883875            stream-null))))
    884876    (cut make-mail-gateway-address <> "xsvnwiki-mail/notifications/")
     
    902894      (format #t "List-Post: NO~%"))
    903895    (lambda (env path-subscribed address rev)
    904       (let-from-environment env (static-url path)
     896      (let-from-environment env (static-url path user)
    905897        (write-stream
    906898          (base64-encode
     
    909901                (format #t "The following page has been modified:~%~%")
    910902                (format #t "  ~A~A~%~%" static-url path)
     903                (unless (string=? (changed-file-author rev) user)
     904                  (format #t "Commit made by authenticated user: ~A~%~%"
     905                          (changed-file-author rev)))
    911906                (format #t "Description of changes:~%~%")
    912907                (stream-for-each
     
    936931              (svnwiki-svn-time->seconds (fourth rev))
    937932              (second rev)
    938               (fifth rev)))
     933              (fifth rev)
     934              (third rev)))
    939935          (stream-filter
    940936            (let ((path-normal (svnwiki-mail-path-canonical (svnwiki-make-pathname base path))))
     
    10091005(define (weblog-about env)
    10101006  (let-from-environment env (path-in path return path-out-real)
    1011     (format (current-error-port) "Mail weblog about~%")
    10121007    (return
    10131008      (html-stream
Note: See TracChangeset for help on using the changeset viewer.