Boolean FindDialog::compareMessage(DtMailMessageHandle handle) { Boolean found = False; register unsigned int offset; // // Check for something to do. // for (offset = 0; offset < _num_text_fields; offset++) { if (_text_values[offset] != NULL) { break; } } // If all fields are empty then we match anything if (offset >= _num_text_fields) { return TRUE; } if (offset < _num_text_fields && handle != NULL) { // TODO - CHECK ERROR!!! DtMailEnv error; // // Get the mail box. // DtMail::MailBox * mbox = _roamWindow->mailbox(); // // Get the DtMail::Message and Envelope for this handle. // DtMail::Message * message = mbox->getMessage(error, handle); DtMail::Envelope * envelope = message->getEnvelope(error); // // Get the meassage header. // DtMailValueSeq header; for (offset = 0; offset < _num_text_fields; offset++) { if (_text_values[offset] != NULL) { if (_text_abstract_name[offset] != NULL) { envelope->getHeader(error, _text_abstract_name[offset], DTM_TRUE, header); found = TRUE; } else { envelope->getHeader(error, _text_names[offset], DTM_FALSE, header); found = TRUE; } if (!compareHeader(error, header, _text_values[offset])) { found = False; break; } else { // Problem: if we have multiple search fields ... and use // the same "header" array ... "compareHeader" looks for // each "find" field in each (available) header field. // So, make sure only one is available for searching. // Really "offset" should be passed to "compareHeader" ... // That way, correct comparison can be done and the // memory for this array can be released correctly via the // destructor .... since "remove" fails to do so. header.remove(0); } } } if (offset > _num_text_fields) { found = TRUE; } } return(found); }