hallo! I found a problem I already had some times ago, that is some messages are not displayed when in threaded mode. I've found that all the messages have the same problem, they haven't a real subject, and they belong to one of these: -a reply message to an empty subject email (subjects: Re:, Fwd:, ....) (these are good emails, not spam) -spam messages with malformed subject lines
in both cases ilohamail failed to display the message. in non-threaded mode everything was ok I fixed the bug in imap.inc adding an ELSE to the IF if ($has_re&&$new['IN-REPLY-TO']){ that is else { if ($debug) echo "z&c: it's a stray<br>"; if ($debug) echo "z&c added to root\n"; $roots[$sbj] = $id; $root_in_root[$id] = !$has_re; $sub_mids[$new['MESSAGE-ID']] = $id; $result[$id] = array($id); } that adds the message to the root list see the attached diff.txt bye -- Ing. Massimo Citterio Resp. Sistemi Informativi Kaptus s.r.l. via De Amicis 42 20123 Milano tel diretto: (+39) 02 80298405 altro: (+39) 02 86995518 fax (+39) 02 86452360 www.kaptus.com [EMAIL PROTECTED]
--- old_imap.inc 2006-05-10 15:08:39.000000000 +0200 +++ imap.inc 2006-05-10 12:39:27.000000000 +0200 @@ -993,6 +993,7 @@ $mid_to_id = array(); $messages = array(); $headers = iil_C_FetchThreadHeaders($conn, $mailbox, $message_set); + if ($clock) $clock->register('fetched headers'); if ($debug) print_r($headers); @@ -1011,30 +1012,30 @@ /* if no subject, use message-id */ if (empty($new['SUBJECT'])) $new['SUBJECT'] = $new['MESSAGE-ID']; - /* if subject contains 'RE:' or has in-reply-to header, it's a reply */ $sbj_pre =''; $has_re = false; if (eregi($sbj_filter_pat, $new['SUBJECT'])) $has_re = true; if ($has_re||$new['IN-REPLY-TO']) $sbj_pre = 'RE:'; - + /* strip out 're:', 'fw:' etc */ if ($has_re) $sbj = ereg_replace($sbj_filter_pat,'', $new['SUBJECT']); else $sbj = $new['SUBJECT']; $new['SUBJECT'] = $sbj_pre.$sbj; - /* if subject not a known thread-root, add to list */ - if ($debug) echo $id.' '.$new['SUBJECT']."\t".$new['MESSAGE-ID']."\n"; + //if ($debug) echo "debug: ".$id.' '.$new['SUBJECT']."\t".$new['MESSAGE-ID']."\n"; $root_id = $roots[$sbj]; - if ($root_id && ($has_re || !$root_in_root[$root_id])){ if ($debug) echo "\tfound root: $root_id\n"; $sub_mids[$new['MESSAGE-ID']] = $root_id; $result[$root_id][] = $id; }else if (!isset($roots[$sbj])||(!$has_re&&$root_in_root[$root_id])){ + if ($debug) echo "\tin else, try to use In-Reply-To header to find root<br>"; + /* try to use In-Reply-To header to find root unless subject contains 'Re:' */ + if ($debug) echo "has_re? $has_re, in reply to: ".$new['IN-REPLY-TO']; if ($has_re&&$new['IN-REPLY-TO']){ if ($debug) echo "\tlooking: ".$new['IN-REPLY-TO']."\n"; @@ -1047,11 +1048,26 @@ $result[$temp][] = $id; $sub_mids[$new['MESSAGE-ID']] = $temp; $sbj = ''; + if ($debug) echo "subj empty<br>"; }else{ //if we can't find referenced parent, it's a "stray" $strays[$id] = $new['IN-REPLY-TO']; + if ($debug) echo "it's a stray<br>"; } } + //zago & cits, 10/5/06, messages without $has_re, in reply to: + else + { + + if ($debug) echo "z&c: it's a stray<br>"; + if ($debug) echo "z&c added to root\n"; + $roots[$sbj] = $id; + $root_in_root[$id] = !$has_re; + $sub_mids[$new['MESSAGE-ID']] = $id; + $result[$id] = array($id); + + } + //END zago & cits, 10/5/06, messages without $has_re, in reply to: //add subject as root if ($sbj){ @@ -1061,11 +1077,13 @@ $sub_mids[$new['MESSAGE-ID']] = $id; $result[$id] = array($id); } - if ($debug) echo $new['MESSAGE-ID']."\t".$sbj."\n"; + else + if ($debug) echo "NOT added to root --$sbj--<br>"; + + if ($debug) echo "message id: ".$new['MESSAGE-ID']."\t".$sbj."\n"; } } - //now that we've gone through all the messages, //go back and try and link up the stray threads if (count($strays)>0){ @@ -1077,6 +1095,7 @@ } } + if ($clock) $clock->register('data prepped'); if ($debug) print_r($roots); @@ -2032,4 +2051,3 @@ } ?> -