phpgroupware-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Phpgroupware-cvs] CVS: email/inc class.bofilters.inc.php,1.6,1.7 class.


From: Angelo Tony Puglisi <address@hidden>
Subject: [Phpgroupware-cvs] CVS: email/inc class.bofilters.inc.php,1.6,1.7 class.mail_msg_wrappers.inc.php,1.29,1.30
Date: Fri, 25 Jan 2002 16:41:05 -0500

Update of /cvsroot/phpgroupware//email/inc
In directory subversions:/tmp/cvs-serv20951/email/inc

Modified Files:
        class.bofilters.inc.php class.mail_msg_wrappers.inc.php 
Log Message:
fixed OR searching, optimize move for same vs different account moves

Index: class.bofilters.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware//email/inc/class.bofilters.inc.php,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -r1.6 -r1.7
*** class.bofilters.inc.php     25 Jan 2002 13:28:25 -0000      1.6
--- class.bofilters.inc.php     25 Jan 2002 21:41:02 -0000      1.7
***************
*** 545,549 ****
                                        {
                                                $andor = 
$this_filter['matches'][$matches_row]['andor'];
!                                               if ($andor = 'and')
                                                {
                                                        // "AND" - only items 
in this list AND also in the previous list make it to the next round
--- 545,549 ----
                                        {
                                                $andor = 
$this_filter['matches'][$matches_row]['andor'];
!                                               if ($andor == 'and')
                                                {
                                                        // "AND" - only items 
in this list AND also in the previous list make it to the next round
***************
*** 599,604 ****
                                                        {
                                                                
$existing_msgnum = 
$this->each_row_result_mball_list[$matches_row-1][$x]['msgnum'];
!                                                               if 
($this->debug > 1) { echo ' * bofilters.run_single_filter: $existing_msgnum = 
$this->each_row_result_mball_list[$matches_row-1]['.$x.'][msgnum] = 
['.$existing_msgnum.'] <br>'."\r\n"; }
!                                                               
$this_row_serialized = str_replace('s:6:"msgnum";i:'.$existing_msgnum.';', 
's:6:"msgnum";s:1:" ";', $this_row_serialized);
                                                        }
                                                        if ($this->debug > 1) { 
echo 'bofilters.run_single_filter: POST replace $this_row_serialized  
<p>'.$this_row_serialized.'</p> <br>'."\r\n"; }
--- 599,609 ----
                                                        {
                                                                
$existing_msgnum = 
$this->each_row_result_mball_list[$matches_row-1][$x]['msgnum'];
!                                                               if 
($this->debug > 1) { echo ' * bofilters.run_single_filter: 
$this->each_row_result_mball_list[$matches_row-1]['.$x.'][msgnum] : 
$existing_msgnum ['.$existing_msgnum.'] <br>'."\r\n"; }
!                                                               if 
(stristr($this_row_serialized, 's:6:"msgnum";i:'.$existing_msgnum.';'))
!                                                               {
!                                                                       if 
($this->debug > 1) { echo ' * bofilters.run_single_filter: DUPLICATE 
$existing_msgnum ['.$existing_msgnum.'] <br>'."\r\n"; }
!                                                                       
$modified_serialized = 
str_replace('s:6:"msgnum";i:'.(string)$existing_msgnum.';', 's:6:"msgnum";s:1:" 
";', $this_row_serialized);
!                                                                       
$this_row_serialized = $modified_serialized;
!                                                               }
                                                        }
                                                        if ($this->debug > 1) { 
echo 'bofilters.run_single_filter: POST replace $this_row_serialized  
<p>'.$this_row_serialized.'</p> <br>'."\r\n"; }
***************
*** 671,677 ****
                                echo 
'<html><table>'.$html_list.'</table></html>';
                        }
!                       elseif ((count($all_accounts_result_set > 0))
                        && (isset($all_accounts_result_set[0]))
!                       && ((string)$all_accounts_result_set[0] != ''))
                        {                               
                                // NOT A TEST - APPLY THE ACTION(S)
--- 676,682 ----
                                echo 
'<html><table>'.$html_list.'</table></html>';
                        }
!                       elseif ((count($all_accounts_result_set) > 0)
                        && (isset($all_accounts_result_set[0]))
!                       && ((string)$all_accounts_result_set[0]['folder'] != 
''))
                        {                               
                                // NOT A TEST - APPLY THE ACTION(S)
***************
*** 686,698 ****
                                        $to_fldball['acctnum'] = 
(int)$target_folder['acctnum'];
                                        if ($this->debug > 2) { echo 
'bofilters.run_single_filter: $to_fldball DUMP:<pre>'; print_r($to_fldball); 
echo "</pre>\r\n"; }
!                                       $tm = count($msgball_list);
!                                       for ($i = 0; $i < count($msgball_list); 
$i++)
                                        {
                                                if ($this->debug > 2) { echo 
'bofilters.run_single_filter: in mail move loop ['.(string)($i+1).'] of 
['.$tm.']<br>'; }
!                                               $mov_msgball = 
$msgball_list[$i];
                                                if ($this->debug > 1) { echo 
'bofilters.run_single_filter: pre-move info: $mov_msgball 
[<code>'.serialize($mov_msgball).'</code>]<br>'; }
                                                
!                                               echo 'EXIT NOT READY TO APPLY 
THE FILTER YET';
!                                               //$good_to_go = 
$GLOBALS['phpgw']->msg->industrial_interacct_mail_move($mov_msgball, 
$to_fldball);
                                                
                                                if (!$good_to_go)
--- 691,703 ----
                                        $to_fldball['acctnum'] = 
(int)$target_folder['acctnum'];
                                        if ($this->debug > 2) { echo 
'bofilters.run_single_filter: $to_fldball DUMP:<pre>'; print_r($to_fldball); 
echo "</pre>\r\n"; }
!                                       $tm = count($all_accounts_result_set);
!                                       for ($i = 0; $i < 
count($all_accounts_result_set); $i++)
                                        {
                                                if ($this->debug > 2) { echo 
'bofilters.run_single_filter: in mail move loop ['.(string)($i+1).'] of 
['.$tm.']<br>'; }
!                                               $mov_msgball = 
$all_accounts_result_set[$i];
                                                if ($this->debug > 1) { echo 
'bofilters.run_single_filter: pre-move info: $mov_msgball 
[<code>'.serialize($mov_msgball).'</code>]<br>'; }
                                                
!                                               //echo 'EXIT NOT READY TO APPLY 
THE FILTER YET<br>';
!                                               $good_to_go = 
$GLOBALS['phpgw']->msg->industrial_interacct_mail_move($mov_msgball, 
$to_fldball);
                                                
                                                if (!$good_to_go)

Index: class.mail_msg_wrappers.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware//email/inc/class.mail_msg_wrappers.inc.php,v
retrieving revision 1.29
retrieving revision 1.30
diff -C2 -r1.29 -r1.30
*** class.mail_msg_wrappers.inc.php     25 Jan 2002 13:28:25 -0000      1.29
--- class.mail_msg_wrappers.inc.php     25 Jan 2002 21:41:02 -0000      1.30
***************
*** 140,144 ****
                }
                
-               //FIXME: msgball
        // ====  Functions For Getting A Message Or A Part (MIME Part) Of A 
Message  ====
                function phpgw_body($msgball='')
--- 140,143 ----
***************
*** 184,218 ****
                        return 
$GLOBALS['phpgw_dcom_'.$acctnum]->dcom->fetchbody($mailsvr_stream, $msgnum, 
$part_no, $flags);
                }
-               /*
-               function phpgw_fetchbody($msgball='', $part_num_mime='', 
$flags='')
-               {
-                       $mailsvr_stream = 
$this->get_arg_value('mailsvr_stream');
-                       $msgnum = $msgball['msgnum'];
-                       $part_no = $msgball['part_no'];
-                       return 
$this->a[$this->acctnum]['dcom']->fetchbody($mailsvr_stream, $msgnum, $part_no, 
$flags);
-               }
-               */
-               /*
-               function phpgw_fetchbody($msgball='', $part_num_mime='', 
$flags='')
-               {
-                       if (!(isset($msgball))
-                       || ((string)$msgball == ''))
-                       {
-                               $msgball = $this->get_arg_value('msgball');
-                       }
-                       $acctnum = $msgball['acctnum'];
-                       if (!(isset($acctnum))
-                       || ((string)$acctnum == ''))
-                       {
-                               $acctnum = $this->get_acctnum();
-                       }
-                       $mailsvr_stream = 
$this->get_arg_value('mailsvr_stream', $acctnum);
-                       
-                       //return 
$this->a[$acctnum]['dcom']->fetchbody($mailsvr_stream, $msgball['msgnum'], 
$part_num_mime, $flags);
-                       //return 
$this->a[$this->acctnum]['dcom']->fetchbody($this->get_arg_value('mailsvr_stream'),
 $this->get_arg_value('msgnum'), $part_num_mime, $flags);
-                       //return $this->a[$acctnum      
]['dcom']->fetchbody($mailsvr_stream, $msgball['msgnum'], $part_num_mime, 
$flags);
-                       return 
$this->a[$this->acctnum]['dcom']->fetchbody($mailsvr_stream, 
$msgball['msgnum'], $part_num_mime, $flags);
-               }
-               */
                
                
--- 183,186 ----
***************
*** 458,463 ****
                        }
                        $mailsvr_stream = 
$this->get_arg_value('mailsvr_stream', $acctnum);
!                       $retval = 
$GLOBALS['phpgw_dcom_'.$acctnum]->dcom->noop_ping_test($mailsvr_stream);
!                       return $retval;
                }
                
--- 426,430 ----
                        }
                        $mailsvr_stream = 
$this->get_arg_value('mailsvr_stream', $acctnum);
!                       return 
$GLOBALS['phpgw_dcom_'.$acctnum]->dcom->noop_ping_test($mailsvr_stream);
                }
                
***************
*** 636,645 ****
                function industrial_interacct_mail_move($mov_msgball='', 
$to_fldball='')
                {
-                       // this needs A LOT of work!!! do not rely on this yet
-                       $good_to_go = False;
-                       // delete session msg array data thAt is now stale
-                       $this->expire_session_cache_item('msgball_list');
-                       
                        // Note: Only call this function with ONE msgball at a 
time, i.e. NOT a list of msgballs
                        $mov_msgball['acctnum'] = (int)$mov_msgball['acctnum'];
                        if (!(isset($mov_msgball['acctnum']))
--- 603,610 ----
                function industrial_interacct_mail_move($mov_msgball='', 
$to_fldball='')
                {
                        // Note: Only call this function with ONE msgball at a 
time, i.e. NOT a list of msgballs
+                       // INTERACCOUNT -OR- SAME ACCOUNT ?
+                       $debug_move = 0;
+                       // --- Establist account numbers ----
                        $mov_msgball['acctnum'] = (int)$mov_msgball['acctnum'];
                        if (!(isset($mov_msgball['acctnum']))
***************
*** 648,674 ****
                                $mov_msgball['acctnum'] = $this->get_acctnum();
                        }
-                       //$from_folder = 
$this->prep_folder_in($mov_msgball['folder'], $from_acctnum);
-                       $mov_msgball['folder'] = 
urldecode($mov_msgball['folder']);
-                       // Make Sure Stream Exists
-                       // multiple accounts means one stream may be open but 
another may not
-                       // "ensure_stream_and_folder" will verify for us, 
-                       $this->ensure_stream_and_folder($mov_msgball, 
'industrial_interacct_mail_move');
-                       // GET MESSAGE FLAGS (before you get the mgs, so 
unseen/seen is not tainted by our grab)
-                       $hdr_envelope = $this->phpgw_header($mov_msgball);
-                       $mov_msgball['flags'] = 
$this->make_flags_str($hdr_envelope);
-                       // GET THE MESSAGE
-                       // part_no 0 only used to get the headers
-                       $mov_msgball['part_no'] = 0;
-                       // (a)  the headers, specify part_no 0
-                       $moving_message = 
$GLOBALS['phpgw']->msg->phpgw_fetchbody($mov_msgball);
-                       // (b) the body, plus a CRLF, reuse headers_msgball b/c 
"phpgw_body" cares not about part_no
-                       $moving_message .= 
$GLOBALS['phpgw']->msg->phpgw_body($mov_msgball)."\r\n";
-                       $good_to_go = (strlen($moving_message) > 3);
-                       if (!$good_to_go)
-                       {
-                               return False;
-                       }
-                       
-                       // APPEND TO TARGET FOLDER
                        $to_fldball['acctnum'] = (int)$to_fldball['acctnum'];
                        if (!(isset($to_fldball['acctnum']))
--- 613,616 ----
***************
*** 676,708 ****
                        {
                                $to_fldball['acctnum'] = $this->get_acctnum();
-                       }                       
-                       $to_fldball['folder'] = 
urldecode($to_fldball['folder']);
-                       // TEMP (MUST add this back!!!) append does NOT require 
we open the target folder, only requires a stream
-                       $remember_to_fldball = $to_fldball['folder'];
-                       $to_fldball['folder'] = '';
-                       $this->ensure_stream_and_folder($to_fldball, 
'industrial_interacct_mail_move');
-                       $mailsvr_callstr = 
$this->get_arg_value('mailsvr_callstr', $to_fldball['acctnum']);
-                       $to_mailsvr_stream = 
$this->get_arg_value('mailsvr_stream', $to_fldball['acctnum']);
-                       $to_fldball['folder'] = $remember_to_fldball;
-                       $good_to_go = 
$GLOBALS['phpgw_dcom_'.$to_fldball['acctnum']]->dcom->append($to_mailsvr_stream,
 $mailsvr_callstr.$to_fldball['folder'], $moving_message, 
$mov_msgball['flags']);
-                       if (!$good_to_go)
-                       {
-                               return False;
                        }
!                       // DELETE and EXPUNGE from FROM FOLDER
!                       $from_mailsvr_stream = 
$this->get_arg_value('mailsvr_stream', $mov_msgball['acctnum']);
!                       $good_to_go = 
$GLOBALS['phpgw_dcom_'.$mov_msgball['acctnum']]->dcom->delete($from_mailsvr_stream,
 $mov_msgball['msgnum']);
!                       if (!$good_to_go)
                        {
!                               return False;
                        }
!                       $good_to_go = 
$GLOBALS['phpgw']->msg->phpgw_expunge($mov_msgball['acctnum']);
!                       if (!$good_to_go)
                        {
!                               return False;
                        }
-                       return True;
                }
! 
                function phpgw_expunge($acctnum='')
                {
--- 618,698 ----
                        {
                                $to_fldball['acctnum'] = $this->get_acctnum();
                        }
!                       
!                       // Are the acctnums the same?
!                       if ((string)$mov_msgball['acctnum'] == 
(string)$to_fldball['acctnum'])
                        {
!                               // SAME ACCOUNT MAIL MOVE
!                               
!                               $common_acctnum = $mov_msgball['acctnum'];
!                               //if ($debug_move > 1) { echo 
'mail_msg(_wrappers): interacct_mail_move: SAME ACCOUNT MOVE $common_acctnum: 
'.$common_acctnum.' $mailsvr_stream: '.$mailsvr_stream.' $msgnum: '.$msgnum.' 
$mailsvr_callstr: '.$mailsvr_callstr.' $mailbox: '.$mailbox.'<br>'; }
!                               
$this->expire_session_cache_item('msgball_list', $common_acctnum);
!                               // we need to SELECT the folder the message is 
being moved FROM
!                               $this->ensure_stream_and_folder($mov_msgball, 
'industrial_interacct_mail_move');
!                               $to_fldball['folder'] = 
urldecode($to_fldball['folder']);
!                               $mailsvr_stream = 
$this->get_arg_value('mailsvr_stream', $common_acctnum);
!                               if ($debug_move > 1) { echo 
'mail_msg(_wrappers): interacct_mail_move: SAME ACCOUNT MOVE $common_acctnum: 
'.$common_acctnum.' $mailsvr_stream: '.$mailsvr_stream.' $mov_msgball[msgnum]: 
'.$mov_msgball['msgnum'].'  $to_fldball[folder]: '. 
$to_fldball['folder'].'<br>'; }
!                               return 
$GLOBALS['phpgw_dcom_'.$common_acctnum]->dcom->mail_move($mailsvr_stream 
,$mov_msgball['msgnum'], $to_fldball['folder']);
                        }
!                       else
                        {
!                               // DIFFERENT ACCOUNT MAIL MOVE
!                               
!                               $good_to_go = False;
!                               // delete session msg array data thAt is now 
stale
!                               
$this->expire_session_cache_item('msgball_list', $mov_msgball['acctnum']);
!                               $mov_msgball['folder'] = 
urldecode($mov_msgball['folder']);
!                               // Make Sure Stream Exists
!                               // multiple accounts means one stream may be 
open but another may not
!                               // "ensure_stream_and_folder" will verify for 
us, 
!                               $this->ensure_stream_and_folder($mov_msgball, 
'industrial_interacct_mail_move');
!                               // GET MESSAGE FLAGS (before you get the mgs, 
so unseen/seen is not tainted by our grab)
!                               $hdr_envelope = 
$this->phpgw_header($mov_msgball);
!                               $mov_msgball['flags'] = 
$this->make_flags_str($hdr_envelope);
!                               // GET THE MESSAGE
!                               // part_no 0 only used to get the headers
!                               $mov_msgball['part_no'] = 0;
!                               // (a)  the headers, specify part_no 0
!                               $moving_message = 
$GLOBALS['phpgw']->msg->phpgw_fetchbody($mov_msgball);
!                               // (b) the body, plus a CRLF, reuse 
headers_msgball b/c "phpgw_body" cares not about part_no
!                               $moving_message .= 
$GLOBALS['phpgw']->msg->phpgw_body($mov_msgball)."\r\n";
!                               $good_to_go = (strlen($moving_message) > 3);
!                               if (!$good_to_go)
!                               {
!                                       return False;
!                               }
!                               
!                               // APPEND TO TARGET FOLDER
!                               // delete session msg array data thAt is now 
stale
!                               
$this->expire_session_cache_item('msgball_list', $to_fldball['acctnum']);
!                               $to_fldball['folder'] = 
urldecode($to_fldball['folder']);
!                               // TEMP (MUST add this back!!!) append does NOT 
require we open the target folder, only requires a stream
!                               $remember_to_fldball = $to_fldball['folder'];
!                               $to_fldball['folder'] = '';
!                               $this->ensure_stream_and_folder($to_fldball, 
'industrial_interacct_mail_move');
!                               $mailsvr_callstr = 
$this->get_arg_value('mailsvr_callstr', $to_fldball['acctnum']);
!                               $to_mailsvr_stream = 
$this->get_arg_value('mailsvr_stream', $to_fldball['acctnum']);
!                               $to_fldball['folder'] = $remember_to_fldball;
!                               $good_to_go = 
$GLOBALS['phpgw_dcom_'.$to_fldball['acctnum']]->dcom->append($to_mailsvr_stream,
 $mailsvr_callstr.$to_fldball['folder'], $moving_message, 
$mov_msgball['flags']);
!                               if (!$good_to_go)
!                               {
!                                       return False;
!                               }
!                               // DELETE and EXPUNGE from FROM FOLDER
!                               $from_mailsvr_stream = 
$this->get_arg_value('mailsvr_stream', $mov_msgball['acctnum']);
!                               $good_to_go = 
$GLOBALS['phpgw_dcom_'.$mov_msgball['acctnum']]->dcom->delete($from_mailsvr_stream,
 $mov_msgball['msgnum']);
!                               if (!$good_to_go)
!                               {
!                                       return False;
!                               }
!                               $good_to_go = 
$GLOBALS['phpgw']->msg->phpgw_expunge($mov_msgball['acctnum']);
!                               if (!$good_to_go)
!                               {
!                                       return False;
!                               }
!                               return True;
                        }
                }
!       
                function phpgw_expunge($acctnum='')
                {




reply via email to

[Prev in Thread] Current Thread [Next in Thread]