cvs: pecl /pop3 php_pop3.h pop3.c

From: Date: Fri, 09 Jan 2004 23:48:41 +0000
Subject: cvs: pecl /pop3 php_pop3.h pop3.c
Groups: php.pecl.cvs 
Request: Send a blank email to pecl-cvs+get-728@lists.php.net to get a copy of this message
iliaa Fri Jan 9 18:48:41 2004 EDT Modified files: /pecl/pop3 php_pop3.h pop3.c Log: Added pop3_undelete(). Added support for partial message retrieval to pop3_get_message(). Fixed param parsing bug in _pop3_fetch_message_part(). (Thanks Andrey) Index: pecl/pop3/php_pop3.h diff -u pecl/pop3/php_pop3.h:1.2 pecl/pop3/php_pop3.h:1.3 --- pecl/pop3/php_pop3.h:1.2 Fri Jan 9 18:05:29 2004 +++ pecl/pop3/php_pop3.h Fri Jan 9 18:48:41 2004 @@ -15,7 +15,7 @@ | Author: | +----------------------------------------------------------------------+ - $Id: php_pop3.h,v 1.2 2004/01/09 23:05:29 iliaa Exp $ + $Id: php_pop3.h,v 1.3 2004/01/09 23:48:41 iliaa Exp $ */ #ifndef PHP_POP3_H @@ -59,6 +59,7 @@ PHP_FUNCTION(pop3_get_message_header); PHP_FUNCTION(pop3_get_message); PHP_FUNCTION(pop3_delete_message); +PHP_FUNCTION(pop3_undelete); /* Declare any global variables you may need between the BEGIN Index: pecl/pop3/pop3.c diff -u pecl/pop3/pop3.c:1.4 pecl/pop3/pop3.c:1.5 --- pecl/pop3/pop3.c:1.4 Fri Jan 9 18:05:29 2004 +++ pecl/pop3/pop3.c Fri Jan 9 18:48:41 2004 @@ -15,7 +15,7 @@ | Author: | +----------------------------------------------------------------------+ - $Id: pop3.c,v 1.4 2004/01/09 23:05:29 iliaa Exp $ + $Id: pop3.c,v 1.5 2004/01/09 23:48:41 iliaa Exp $ */ #ifdef HAVE_CONFIG_H @@ -183,6 +183,7 @@ PHP_FE(pop3_get_message_header, NULL) PHP_FE(pop3_get_message, NULL) PHP_FE(pop3_delete_message, NULL) + PHP_FE(pop3_undelete, NULL) {NULL, NULL, NULL} }; /* }}} */ @@ -200,6 +201,7 @@ POP3_ME_MAPPING(get_message_header, pop3_get_message_header, NULL) POP3_ME_MAPPING(get_message, pop3_get_message, NULL) POP3_ME_MAPPING(delete_message, pop3_delete_message, NULL) + POP3_ME_MAPPING(undelete, pop3_undelete, NULL) {NULL, NULL, NULL} }; /* }}} */ @@ -502,16 +504,16 @@ char *pop3_return_val; int *socket_id; char *message; - long message_id; + long message_id, n_lines = 0; /* Retrieve session data and other parameters */ if (object) { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &session_container, &message_id) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l|l", &message_id, &n_lines) == FAILURE) { RETURN_FALSE; } POP3_FROM_OBJECT(socket_id, object); } else { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &session_container, &message_id) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl|l", &session_container, &message_id, &n_lines) == FAILURE) { RETURN_FALSE; } POP3_FETCH_SESSION(socket_id, session_container); @@ -523,8 +525,11 @@ POP3_CALL(pop3_top(*socket_id, message_id, 0)) break; case PHP_POP3_MESSAGE: - /* Retrieve message */ - POP3_CALL(pop3_retr(*socket_id, message_id)) + if (!n_lines) { /* Retrieve message */ + POP3_CALL(pop3_retr(*socket_id, message_id)) + } else { /* Retrieve n_lines from the message */ + POP3_CALL(pop3_top(*socket_id, message_id, n_lines)) + } break; case PHP_POP3_DELETE: /* Delete message */ @@ -569,6 +574,33 @@ } /* }}} */ +/* {{{ proto bool pop3_undelete (resource session) + */ +PHP_FUNCTION (pop3_undelete) +{ + zval *object = getThis(); + zval *session_container; + int *socket_id; + char *pop3_return_val; + + if (object) { + if (ZEND_NUM_ARGS()) { + WRONG_PARAM_COUNT; + } + POP3_FROM_OBJECT(socket_id, object); + } else { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &session_container) == FAILURE) { + RETURN_FALSE; + } + POP3_FETCH_SESSION(socket_id, session_container); + } + + POP3_CALL(pop3_rset(*socket_id)) + + RETURN_TRUE; +} +/* }}} */ + /* * Local variables: * tab-width: 4

« previous php.pecl.cvs (#728) next »