From ef1248a1b7fc85aca3391c4b927faa034ed04001 Mon Sep 17 00:00:00 2001 From: Chris Hanson Date: Fri, 21 Jan 2000 20:22:06 +0000 Subject: [PATCH] Implement simple string search. --- v7/src/imail/imail-file.scm | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/v7/src/imail/imail-file.scm b/v7/src/imail/imail-file.scm index 0ba9eb244..2b8febde7 100644 --- a/v7/src/imail/imail-file.scm +++ b/v7/src/imail/imail-file.scm @@ -1,6 +1,6 @@ ;;; -*-Scheme-*- ;;; -;;; $Id: imail-file.scm,v 1.4 2000/01/19 05:54:55 cph Exp $ +;;; $Id: imail-file.scm,v 1.5 2000/01/21 20:22:06 cph Exp $ ;;; ;;; Copyright (c) 1999-2000 Massachusetts Institute of Technology ;;; @@ -138,8 +138,21 @@ (cons (car messages) messages*)))))))) (define-method search-folder ((folder ) criteria) - folder criteria - (error "Unimplemented operation:" 'SEARCH-FOLDER)) + (cond ((string? criteria) + (let ((n (count-messages folder))) + (let loop ((index 0) (winners '())) + (if (< index n) + (loop (+ index 1) + (if (string-search-forward + criteria + (message->string (get-message folder index))) + (cons index winners) + winners)) + (reverse! winners))))) + (else + (error:wrong-type-argument criteria + "search criteria" + 'SEARCH-FOLDER)))) (define-method synchronize-folder ((folder )) folder -- 2.25.1