diff program/lib/Roundcube/rcube_imap_generic.php @ 11:aff04b06b685 default tip

various small fixes from upgrades to PHP and/or hangover from fix to apt-get overwrite at beginning of the year somehow
author Charlie Root
date Sun, 26 Jan 2025 13:09:03 -0500
parents 3a5f959af5ae
children
line wrap: on
line diff
--- a/program/lib/Roundcube/rcube_imap_generic.php	Mon May 11 16:56:46 2020 -0400
+++ b/program/lib/Roundcube/rcube_imap_generic.php	Sun Jan 26 13:09:03 2025 -0500
@@ -3899,9 +3899,18 @@
 
         $result = array();
         $start  = $prev = $messages[0];
+	$needStrip = (strpos($start,'_') !== false);	  
 
         foreach ($messages as $id) {
-            $incr = $id - $prev;
+	    #rcube::write_log('mail',"non-num? id: |$id|, prev: |$prev|");
+            #Advanced search calls with pseudo-message-ids?  Non-numeric, anyway, e.g.
+	    # 420__MB__97ce7451bd364b47894f71ba7eb8ceb1
+	    if ($needStrip) {
+	      $incr = substr($id,0,strpos($id,'_')) - substr($prev,0,strpos($prev,'_'));
+	    }
+	    else {
+	      $incr = $id - $prev;
+	    }
             if ($incr > 1) { // found a gap
                 if ($start == $prev) {
                     $result[] = $prev; // push single id