Hi,

This little patch adds a fifth optional parameter for imap_append()
which allows to set the internal IMAP date of the appended messages.
It seems to work fine here... If anyone would care to commit it, that
would be great.

Thanks.

--

Rudi Benkovic             [EMAIL PROTECTED]
--- php_imap.c.orig     Wed Mar 26 16:35:04 2003
+++ php_imap.c  Wed Mar 26 16:37:10 2003
@@ -761,16 +761,16 @@
 }
 /* }}} */
 
-/* {{{ proto bool imap_append(resource stream_id, string folder, string message [, 
string options])
+/* {{{ proto bool imap_append(resource stream_id, string folder, string message [, 
string options, string date])
    Append a new message to a specified mailbox */
 PHP_FUNCTION(imap_append)
 {
-       zval **streamind, **folder, **message, **flags;
+       zval **streamind, **folder, **message, **flags, **date;
        pils *imap_le_struct; 
        STRING st;
        int myargc=ZEND_NUM_ARGS();
   
-       if (myargc < 3 || myargc > 4 || zend_get_parameters_ex(myargc, &streamind, 
&folder, &message, &flags) == FAILURE) {
+       if (myargc < 3 || myargc > 5 || zend_get_parameters_ex(myargc, &streamind, 
&folder, &message, &flags, &date) == FAILURE) {
                ZEND_WRONG_PARAM_COUNT();
        }
   
@@ -779,13 +779,22 @@
        convert_to_string_ex(folder);
        convert_to_string_ex(message);
 
-       if (myargc == 4) {
+       if (myargc >= 4) {
                convert_to_string_ex(flags);
        }
+       if (myargc == 5) {
+               convert_to_string_ex(date);
+       }
 
        INIT (&st, mail_string, (void *) Z_STRVAL_PP(message), Z_STRLEN_PP(message));
 
-       if (mail_append_full(imap_le_struct->imap_stream, Z_STRVAL_PP(folder), 
myargc==4 ? Z_STRVAL_PP(flags) : NIL, NIL, &st)) {
+       if (mail_append_full(imap_le_struct->imap_stream, 
+                            Z_STRVAL_PP(folder), 
+                            myargc==4 ? Z_STRVAL_PP(flags) : NIL, 
+                            myargc==5 ? Z_STRVAL_PP(date) : NIL, 
+                            &st
+                           )
+          ) {
                RETURN_TRUE;
        } else {
                RETURN_FALSE;
-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to