Subject: A couple simple questions

From: Adam Treister <[email-masked]>
Date: Mon, 30 May 1994 13:45:27 -0700

I have a couple of questions:

1)  I'm doing something wrong with searches.
I send off the search string to the server, and then collect my results
by going:

	for (i = 1; i <= NMSGS(stream); i ++)
	{
		MESSAGECACHE *element = GetElement(i);
		if (element->searched)
			numFound ++;
	}

This works okay, except forces the loading of the cache, and on a big 
mailbox (my current test box is about 900 msgs) ties up the program for a 
minute or two.

Does a hit from a search guarentee the element will be in memory?  
Can I change this to 

	for (i = 1; i <= NMSGS(stream); i ++)
	{
		MESSAGECACHE *element = mail_elt(stream,i);
		if (element)
        if (element->searched)
		        	numFound ++;
	}

or is there a better way?

2)        Quoted-printable is not terribly attractive to non-MIME compliant 
readers.
I notice that Pine does not seem to send encode messages if you just type in 
simple text, but Mailstrom is currently encoding everything.  Is there any 
code someone can point me to which scans the body of the message, and 
formats accordingly.

Tx for the help,

Adam

---

From: Mark Crispin <[email-masked]>
Date: Mon, 30 May 1994 13:52:09 -0700 (PDT)

> or is there a better way?

This guess is correct.  You do not have to do any cache loading after a
mail_search() call since the elt->searched flag is set up in the in-memory
cache.

Sniffing at elt->searched is one of the few instances where it is correct to
use mail_elt() without any mail_fetchstructure() or mail_fetchflags() call
first.

> code someone can point me to which scans the body of the message, and

I think that Pine checks for 8-bit characters and an ``excessive'' number of
non-printing control characters (delete, and all characters with ASCII values
less than 0x20 except for ESC and CTRL/H - CTRL/O).  The control characters
that should not trigger quoted-printable are:
	CTRL/H	backspace
	CTRL/I	tab
	CTRL/J	linefeed
	CTRL/K	vertical tab
	CTRL/L	formfeed
	CTRL/M	return
	CTRL/N	shift-in (used in East Asian encodings)
	CTRL/O	shift-out (used in East Asian encodings)
	ESC	escape (used in East Asian encodings)