cvs: /php3/functions imap.c
| From: | Hartmut Holzgraefe | Date: | Mon, 14 Feb 2000 13:12:17 +0000 |
| Subject: | cvs: /php3/functions imap.c | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-15518@lists.php.net to get a copy of this message | ||
hholzgra Mon Feb 14 05:12:17 2000 EDT
Modified files:
/php3/functions imap.c
Log:
imap_delet(),imap_undelete() and imap_move() will now optionaly accept UDIs
Index: php3/functions/imap.c
diff -u php3/functions/imap.c:1.81 php3/functions/imap.c:1.82
--- php3/functions/imap.c:1.81 Fri Jan 28 11:51:18 2000
+++ php3/functions/imap.c Mon Feb 14 05:11:46 2000
@@ -33,7 +33,7 @@
| Andrew Skalski <askalski@chek.com> |
+----------------------------------------------------------------------+
*/
-/* $Id: imap.c,v 1.81 2000/01/28 19:51:18 askalski Exp $ */
+/* $Id: imap.c,v 1.82 2000/02/14 13:11:46 hholzgra Exp $ */
#define IMAP41
@@ -1220,18 +1220,19 @@
}
/* }}} */
-/* {{{ proto bool imap_mail_move(int stream_id, int msg_no, string mailbox)
+/* {{{ proto bool imap_mail_move(int stream_id, int msg_no, string mailbox [, int options])
Move specified message to a mailbox */
void php3_imap_mail_move(INTERNAL_FUNCTION_PARAMETERS)
{
- pval *streamind,*seq, *folder;
+ pval *streamind,*seq, *folder , *options;
int ind, ind_type;
pils *imap_le_struct;
+ int myargcount = ARG_COUNT(ht);
- if (ARG_COUNT(ht)!=3
- || getParameters(ht,3,&streamind,&seq,&folder) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
+ if (myargcount > 4 || myargcount < 3
+ || getParameters(ht,myargcount,&streamind,&seq,&folder,&options) == FAILURE) {
+ WRONG_PARAM_COUNT;
+ }
convert_to_long(streamind);
convert_to_string(seq);
@@ -1244,7 +1245,7 @@
php3_error(E_WARNING, "Unable to find stream pointer");
RETURN_FALSE;
}
- if ( mail_move(imap_le_struct->imap_stream,seq->value.str.val,folder->value.str.val)==T )
{
+ if (
mail_copy_full(imap_le_struct->imap_stream,seq->value.str.val,folder->value.str.val,myargcount
== 4 ? ( options->value.lval | CP_MOVE ) : CP_MOVE )==T ) {
RETURN_TRUE;
} else {
RETURN_FALSE;
@@ -1548,16 +1549,17 @@
Mark a message for deletion */
void php3_imap_delete(INTERNAL_FUNCTION_PARAMETERS)
{
- pval *streamind, * msgno;
+ pval *streamind, *sequence, *flags;
int ind, ind_type;
pils *imap_le_struct;
+ int myargc=ARG_COUNT(ht);
- if (ARG_COUNT(ht)!=2 || getParameters(ht,2,&streamind,&msgno) == FAILURE) {
+ if ( myargc < 3 || myargc > 4 ||
getParameters(ht,myargc,&streamind,&sequence,&flags) == FAILURE) {
WRONG_PARAM_COUNT;
}
convert_to_long(streamind);
- convert_to_string(msgno);
+ convert_to_string(sequence);
ind = streamind->value.lval;
@@ -1567,7 +1569,7 @@
RETURN_FALSE;
}
- mail_setflag(imap_le_struct->imap_stream,msgno->value.str.val,"\\DELETED");
+ mail_setflag_full(imap_le_struct->imap_stream,sequence->value.str.val,"\\DELETED",myargc
== 4 ? flags->value.lval : NIL);
RETVAL_TRUE;
}
/* }}} */
@@ -1576,16 +1578,16 @@
Remove the delete flag from a message */
void php3_imap_undelete(INTERNAL_FUNCTION_PARAMETERS)
{
- pval *streamind, * msgno;
+ pval *streamind, * sequence, *flags;
int ind, ind_type;
pils *imap_le_struct;
+ int myargc=ARG_COUNT(ht);
- if (ARG_COUNT(ht)!=2 || getParameters(ht,2,&streamind,&msgno) == FAILURE) {
+ if ( myargc < 3 || myargc > 4 ||
getParameters(ht,myargc,&streamind,&sequence,&flags) == FAILURE) {
WRONG_PARAM_COUNT;
}
-
convert_to_long(streamind);
- convert_to_string(msgno);
+ convert_to_string(sequence);
ind = streamind->value.lval;
@@ -1595,7 +1597,7 @@
RETURN_FALSE;
}
- mail_clearflag (imap_le_struct->imap_stream,msgno->value.str.val,"\\DELETED");
+ mail_clearflag_full(imap_le_struct->imap_stream,sequence->value.str.val,"\\DELETED",myargc
== 4 ? flags->value.lval : NIL);
RETVAL_TRUE;
}
/* }}} */