Ticket #815: dict.patch

File dict.patch, 3.5 KB (added by dsp, 12 years ago)
  • dict.meta

     
    55 (category net)
    66 (license "MIT")
    77 (doc-from-wiki)
    8  (depends defstruct md5 utf8)
     8 (depends defstruct (md5 3.0.0) (message-digest 3.0.0) utf8)
    99 (test-depends test)
    1010 (files "dict.release-info" "dict.meta" "dict.scm" "tests/example.scm" "tests/run.scm" "dict.setup"))
  • tests/run.scm

     
    3030;;
    3131;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    3232
    33 (use test utf8 dict md5)
     33(use test utf8 dict md5 message-digest)
    3434
    3535;;some helpers
    3636(define (with-stubbed-io input proc)
     
    224224                            (receive (s r) (!status con)
    225225                              (list s r)))))
    226226   ;;enable this once md5 has been ported to chicken 4
    227     (define test-password (md5-digest (string-append "<test@example.org>" "test")))
     227    (define test-password (message-digest-string (md5-primitive) (string-append "<test@example.org>" "test")))
    228228
    229229    (test "authenticate success"
    230230          `((output . ,(conc "AUTH test " test-password "\r\n"))
  • dict.scm

     
    4343    !help !status !quit !announce-client !authenticate)
    4444 
    4545  (import scheme chicken)
    46   (require-library tcp defstruct srfi-13 srfi-14 md5)
    4746
    4847  (cond-expand
    4948   (total-irregex
    5049    (use irregex))
    5150   (else
    52     (require-library regex)
    53     (import (rename irregex
    54                     (irregex-match-start irregex-match-start-index)
    55                     (irregex-match-end irregex-match-end-index)))
     51    (use (rename irregex
     52                 (irregex-match-start irregex-match-start-index)
     53                 (irregex-match-end irregex-match-end-index)))
    5654    (define irregex-num-submatches irregex-submatches)
    5755    (define irregex-match-num-submatches irregex-submatches)
    5856    (define (irregex-match-valid-index? m i)
     
    7876    (define (maybe-string->sre obj)
    7977      (if (string? obj) (string->sre obj) obj))))
    8078 
    81   (import tcp defstruct
    82           (only md5 md5-digest)
    83           (only srfi-14 char-set:digit)
    84           (only srfi-13 string-join string-index string-trim-right string-trim-both string-trim string-skip string-take string-drop)
    85 ;          (only regex string-split-fields)
    86           (only extras fprintf read-line)
    87           (only data-structures alist-ref alist-update!))
     79  (use tcp defstruct
     80       (only md5 md5-primitive)
     81       (only message-digest message-digest-string)
     82       (only srfi-14 char-set:digit)
     83       (only srfi-13 string-join string-index string-trim-right string-trim-both string-trim string-skip string-take string-drop)
     84;      (only regex string-split-fields)
     85       (only extras fprintf read-line)
     86       (only data-structures alist-ref alist-update!))
    8887         
    8988
    9089  ;;add support for parsing mime-headers
     
    454453       (status:authentication-successful? status)))
    455454
    456455   (define (compute-password con password)
    457      (md5-digest (string-append (connection-msg-id con) password)))
     456     (message-digest-string (md5-primitive) (string-append (connection-msg-id con) password)))
    458457
    459458
    460459  (define (connect server #!key (port (*default-port*)) (client "dict.egg for chicken scheme") (timeout #f))