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.4,1.5 class.


From: Angelo Tony Puglisi <address@hidden>
Subject: [Phpgroupware-cvs] CVS: email/inc class.bofilters.inc.php,1.4,1.5 class.mail_msg_base.inc.php,1.68,1.69 class.mail_msg_display.inc.php,1.35,1.36 class.mail_msg_wrappers.inc.php,1.27,1.28
Date: Thu, 24 Jan 2002 09:51:36 -0500

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

Modified Files:
        class.bofilters.inc.php class.mail_msg_base.inc.php 
        class.mail_msg_display.inc.php class.mail_msg_wrappers.inc.php 
Log Message:
preserve msg flags during interacct mail move

Index: class.bofilters.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware//email/inc/class.bofilters.inc.php,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** class.bofilters.inc.php     23 Jan 2002 13:22:23 -0000      1.4
--- class.bofilters.inc.php     24 Jan 2002 14:51:33 -0000      1.5
***************
*** 555,559 ****
                        if ($this->debug > 2) { echo 
'bofilters.make_imap_search_str: $feed_filter DUMP:<pre>'; 
print_r($feed_filter); echo "</pre>\r\n"; }
                        /*
!                       examples of how to construct IMAP search strings
                        From a google search in a "turnpike" newsgroup:
                        
--- 555,582 ----
                        if ($this->debug > 2) { echo 
'bofilters.make_imap_search_str: $feed_filter DUMP:<pre>'; 
print_r($feed_filter); echo "</pre>\r\n"; }
                        /*
!                       RFC2060:
!                       search  =  "SEARCH" [SP "CHARSET" SP astring] 1*(SP 
search-key)
!                       search-key = 
!                               "ALL" / "ANSWERED" / "BCC" SP astring /
!                               "BEFORE" SP date / "BODY" SP astring /
!                               "CC" SP astring / "DELETED" / "FLAGGED" /
!                               "FROM" SP astring / "KEYWORD" SP flag-keyword / 
"NEW" /
!                               "OLD" / "ON" SP date / "RECENT" / "SEEN" /
!                               "SINCE" SP date / "SUBJECT" SP astring /
!                               "TEXT" SP astring / "TO" SP astring /
!                               "UNANSWERED" / "UNDELETED" / "UNFLAGGED" /
!                               "UNKEYWORD" SP flag-keyword / "UNSEEN" /
!                       ; Above this line were in [IMAP2]
!                               "DRAFT" / "HEADER" SP header-fld-name SP 
astring /
!                               "LARGER" SP number / "NOT" SP search-key /
!                               "OR" SP search-key SP search-key /
!                               "SENTBEFORE" SP date / "SENTON" SP date /
!                               "SENTSINCE" SP date / "SMALLER" SP number /
!                               "UID" SP set / "UNDRAFT" / set /
!                               "(" search-key *(SP search-key) ")"
!                       */
!                       /*
!                       examples of how to construct IMAPrev4 search strings
!                       Prior to IMAPrev4, 
                        From a google search in a "turnpike" newsgroup:
                        
***************
*** 561,565 ****
                        precedence or hierarchy (I put the [AND] in brackets as 
it is implied, 
                        there is no AND keyword).
! 
                        [AND] and OR operate on the next two search-keys.
                        NOT operates on the next search-key.
--- 584,588 ----
                        precedence or hierarchy (I put the [AND] in brackets as 
it is implied, 
                        there is no AND keyword).
!                       
                        [AND] and OR operate on the next two search-keys.
                        NOT operates on the next search-key.
***************
*** 580,584 ****
                        NOT k1 NOT k2           means (not k1) and (not k2)
                        */
!                       
                        if ($this->debug > 2) { echo 'bofilters: 
make_imap_search_str: mappings are:<pre>'; 
print_r($this->sieve_to_imap_fields); echo "</pre>\r\n"; }
                        
--- 603,607 ----
                        NOT k1 NOT k2           means (not k1) and (not k2)
                        */
!               
                        if ($this->debug > 2) { echo 'bofilters: 
make_imap_search_str: mappings are:<pre>'; 
print_r($this->sieve_to_imap_fields); echo "</pre>\r\n"; }
                        
***************
*** 596,599 ****
--- 619,626 ----
                        // DOES NOT CONTAIN - BROKEN - FIXME
                        $search_str_1_criteria = $search_key_imap.' 
"'.$search_for.'"';
+                       if ($comparator == 'notcontains')
+                       {
+                               $search_str_1_criteria = " NOT 
$search_str_1_criteria";
+                       }
                        
                        // 2nd Line 
***************
*** 614,617 ****
--- 641,648 ----
                                // DOES NOT CONTAIN - BROKEN - FIXME
                                $search_str_2_criteria = $search_key_imap.' 
"'.$search_for.'"';
+                               //if ($comparator == 'notcontains')
+                               //{
+                               //      $search_str_2_criteria = "( NOT 
$search_str_2_criteria)";
+                               //}
                                // preliminary  compound search string
                                $final_search_str = $search_str_1_criteria .' 
'.$search_str_2_criteria;

Index: class.mail_msg_base.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware//email/inc/class.mail_msg_base.inc.php,v
retrieving revision 1.68
retrieving revision 1.69
diff -C2 -r1.68 -r1.69
*** class.mail_msg_base.inc.php 23 Jan 2002 13:22:23 -0000      1.68
--- class.mail_msg_base.inc.php 24 Jan 2002 14:51:33 -0000      1.69
***************
*** 2842,2845 ****
--- 2842,2901 ----
                return $mess_id;
        }
+       
+       function make_flags_str($hdr_envelope='')
+       {
+               /*
+               // --- Message Flags ---
+               var $Recent = '';               //  'R' if recent and seen, 'N' 
if recent and not seen, ' ' if not recent
+               var $Unseen = '';               //  'U' if not seen AND not 
recent, ' ' if seen OR not seen and recent
+               var $Answered = '';     //  'A' if answered, ' ' if unanswered
+               var $Deleted = '';              //  'D' if deleted, ' ' if not 
deleted
+               var $Draft = '';                //  'X' if draft, ' ' if not 
draft
+               var $Flagged = '';              //  'F' if flagged, ' ' if not 
flagged
+               */
+               /*  == RFC2060: ==
+               \Seen                           Message has been read
+               \Answered               Message has been answered
+               \Flagged                        Message is "flagged" for 
urgent/special attention
+               \Deleted                        Message is "deleted" for 
removal by later EXPUNGE
+               \Draft                          Message has not completed 
composition (marked as a draft).
+               \Recent                 Message is "recently" arrived in this 
mailbox. (long story...
+               Note: The \Recent system flag is a special case of a 
+               session flag.  \Recent can not be used as an argument in a
+               STORE command, and thus can not be changed at all.      
+               */
+               if ($hdr_envelope == '')
+               {
+                       return 'ERROR';
+               }
+               $flags_str = '';
+               $flags_array = array();
+               if (($hdr_envelope->Recent != 'N') && ($hdr_envelope->Unseen != 
'U'))
+               {
+                       $flags_str .= "\\Seen ";
+               }
+               if ((isset($hdr_envelope->Answered))
+               && ($hdr_envelope->Answered == 'A'))
+               {
+                       $flags_str .= "\\Answered ";
+               }
+               if ((isset($hdr_envelope->Flagged))
+               && ($hdr_envelope->Flagged == 'F'))
+               {
+                       $flags_str .= "\\Flagged ";
+               }
+               if ((isset($hdr_envelope->Deleted))
+               && ($hdr_envelope->Deleted == 'D'))
+               {
+                       $flags_str .= "\\Deleted ";
+               }
+               if ((isset($hdr_envelope->Draft))
+               && ($hdr_envelope->Draft != ''))
+               {
+                       $flags_str .= "\\Draft ";
+               }
+               // Recent is not settable in an append, so forge about it
+               return trim($flags_str);
+       }
  
    // ----  HTML - Related Utility Functions   -----

Index: class.mail_msg_display.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware//email/inc/class.mail_msg_display.inc.php,v
retrieving revision 1.35
retrieving revision 1.36
diff -C2 -r1.35 -r1.36
*** class.mail_msg_display.inc.php      23 Jan 2002 13:22:23 -0000      1.35
--- class.mail_msg_display.inc.php      24 Jan 2002 14:51:33 -0000      1.36
***************
*** 2070,2076 ****
                        // so PHP can build the fetchstructure data (IMAP 
server does this internally)
                        
-                       //$tmp_a = $this->a[$this->acctnum];
-                       //if ((isset($tmp_a['dcom']->imap_builtin))
-                       //&& ($tmp_a['dcom']->imap_builtin == False)
                        if 
((isset($GLOBALS['phpgw_dcom_'.$this->acctnum]->dcom->imap_builtin))
                        && 
($GLOBALS['phpgw_dcom_'.$this->acctnum]->dcom->imap_builtin == False)
--- 2070,2073 ----
***************
*** 2083,2095 ****
                        {
                                // need Message Information: STRUCTURAL for this
-                               //$msg_structure = 
$this->phpgw_fetchstructure($msgball_list[$i]['msgnum']);
                                $msg_structure = 
$this->phpgw_fetchstructure($msgball_list[$i]);
                                // now examine that msg_struct for signs of an 
attachment
                                $msg_list_display[$x]['has_attachment'] = 
$this->has_real_attachment($msg_structure);
                        }
!                       //$this->a[$this->acctnum] = $tmp_a;
! 
                        // Message Information: THE MESSAGE'S HEADERS ENVELOPE 
DATA
-                       //$hdr_envelope = 
$this->phpgw_header($msgball_list[$i]['msgnum']);
                        $hdr_envelope = $this->phpgw_header($msgball_list[$i]);
                        
--- 2080,2089 ----
                        {
                                // need Message Information: STRUCTURAL for this
                                $msg_structure = 
$this->phpgw_fetchstructure($msgball_list[$i]);
                                // now examine that msg_struct for signs of an 
attachment
                                $msg_list_display[$x]['has_attachment'] = 
$this->has_real_attachment($msg_structure);
                        }
!                       
                        // Message Information: THE MESSAGE'S HEADERS ENVELOPE 
DATA
                        $hdr_envelope = $this->phpgw_header($msgball_list[$i]);
                        
***************
*** 2104,2114 ****
                        $msg_list_display[$x]['subject'] = 
$this->get_subject($hdr_envelope,'');
                        $msg_list_display[$x]['subject_link'] = 
$GLOBALS['phpgw']->link(
!                               
//'/'.$GLOBALS['phpgw_info']['flags']['currentapp'].'/message.php',
!                               '/index.php',
!                                'menuaction=email.uimessage.message'
!                               .'&'.$msgball_list[$i]['uri']
!                               .'&sort='.$this->get_arg_value('sort')
!                               .'&order='.$this->get_arg_value('order')
!                               .'&start='.$this->get_arg_value('start'));
                        
                        // SIZE
--- 2098,2107 ----
                        $msg_list_display[$x]['subject'] = 
$this->get_subject($hdr_envelope,'');
                        $msg_list_display[$x]['subject_link'] = 
$GLOBALS['phpgw']->link(
!                                                       '/index.php',
!                                                        
'menuaction=email.uimessage.message'
!                                                       
.'&'.$msgball_list[$i]['uri']
!                                                       
.'&sort='.$this->get_arg_value('sort')
!                                                       
.'&order='.$this->get_arg_value('order')
!                                                       
.'&start='.$this->get_arg_value('start'));
                        
                        // SIZE
***************
*** 2133,2136 ****
--- 2126,2132 ----
                                $msg_list_display[$x]['is_unseen'] = False;
                        }
+                       
+                       // FLAGS array with all IMAP flags, for utility 
purposes, such as appending and preserving these flags
+                       $msg_list_display[$x]['flags'] = 
$this->make_flags_str($hdr_envelope);
  
                        // FROM and REPLY TO  HANDLING
***************
*** 2247,2251 ****
                        $msg_list_display[$x]['from_link'] = 
$GLOBALS['phpgw']->link(
                                                                
'/'.$GLOBALS['phpgw_info']['flags']['currentapp'].'/compose.php',
-                                                               // 
'folder='.$this->prep_folder_out('')
                                                                 
$msgball_list[$i]['uri']
                                                                
.'&sort='.$this->get_arg_value('sort')
--- 2243,2246 ----
***************
*** 2279,2282 ****
--- 2274,2280 ----
                                $msg_list_display[$x]['msg_date'] = 
ereg_replace("^.* -", '', $msg_date_time);
                        }
+                       // *raw* date for utility purposes, such as appending 
and specifying a date
+                       // php built in append does not let you specify the 
data during an append
+                       //$msg_list_display[$x]['msg_date_raw'] = 
$hdr_envelope->udate;
                }
                if ($debug_msg_list_display > 2) { echo 'mail_msg: 
get_msg_list_display: exiting $msg_list_display[] dump:<pre>'; 
print_r($msg_list_display); echo '</pre>'; }

Index: class.mail_msg_wrappers.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware//email/inc/class.mail_msg_wrappers.inc.php,v
retrieving revision 1.27
retrieving revision 1.28
diff -C2 -r1.27 -r1.28
*** class.mail_msg_wrappers.inc.php     23 Jan 2002 13:22:23 -0000      1.27
--- class.mail_msg_wrappers.inc.php     24 Jan 2002 14:51:33 -0000      1.28
***************
*** 97,105 ****
                        
                        // Message Information: THE MESSAGE'S HEADERS RETURNED 
AS A STRUCTURE
!                       //$tmp_a = $this->a[$this->acctnum];
!                       //$retval = $tmp_a['dcom']->header($mailsvr_stream, 
$msgball['msgnum']);
!                       $retval = 
$GLOBALS['phpgw_dcom_'.$acctnum]->dcom->header($mailsvr_stream, 
$msgball['msgnum']);
!                       //$this->a[$this->acctnum] = $tmp_a;
!                       return $retval;
                }
                
--- 97,101 ----
                        
                        // Message Information: THE MESSAGE'S HEADERS RETURNED 
AS A STRUCTURE
!                       return 
$GLOBALS['phpgw_dcom_'.$acctnum]->dcom->header($mailsvr_stream, 
$msgball['msgnum']);
                }
                
***************
*** 639,642 ****
--- 635,641 ----
                        // "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
***************
*** 667,671 ****
                        $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, '');
                        if (!$good_to_go)
                        {
--- 666,670 ----
                        $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)
                        {




reply via email to

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