cvs: php4 /ext/standard basic_functions.c mail.c php_mail.h
| From: | Kristian K�hntopp | Date: | Thu, 29 Jun 2000 14:07:11 +0000 |
| Subject: | cvs: php4 /ext/standard basic_functions.c mail.c php_mail.h | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-548@lists.php.net to get a copy of this message | ||
kk Thu Jun 29 07:07:11 2000 EDT
Modified files:
/php4/ext/standard basic_functions.c mail.c php_mail.h
Log:
ezmlm_hash() function also available for php4.
Index: php4/ext/standard/basic_functions.c
diff -u php4/ext/standard/basic_functions.c:1.223 php4/ext/standard/basic_functions.c:1.224
--- php4/ext/standard/basic_functions.c:1.223 Mon Jun 26 07:43:36 2000
+++ php4/ext/standard/basic_functions.c Thu Jun 29 07:07:10 2000
@@ -455,6 +455,7 @@
/* functions from mail.c */
PHP_FE(mail, NULL)
+ PHP_FE(ezmlm_hash, NULL)
/* functions from syslog.c */
PHP_FE(openlog, NULL)
Index: php4/ext/standard/mail.c
diff -u php4/ext/standard/mail.c:1.26 php4/ext/standard/mail.c:1.27
--- php4/ext/standard/mail.c:1.26 Mon Jun 5 12:47:44 2000
+++ php4/ext/standard/mail.c Thu Jun 29 07:07:10 2000
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: mail.c,v 1.26 2000/06/05 19:47:44 andi Exp $ */
+/* $Id: mail.c,v 1.27 2000/06/29 14:07:10 kk Exp $ */
#include <stdlib.h>
#include <ctype.h>
@@ -37,6 +37,37 @@
#ifdef COMPILE_DL_STANDARD
ZEND_GET_MODULE(odbc)
#endif
+
+/* {{{ proto int ezmlm_hash(string addr)
+ Calculate EZMLM list hash value. */
+PHP_FUNCTION(ezmlm_hash)
+{
+ pval **pstr = NULL;
+ char *str=NULL;
+ unsigned long h = 5381L;
+ int j, l;
+
+ if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &pstr) == FAILURE) {
+ WRONG_PARAM_COUNT;
+ }
+
+ convert_to_string_ex(pstr);
+ if ((*pstr)->value.str.val) {
+ str = (*pstr)->value.str.val;
+ } else {
+ php_error(E_WARNING, "Must give string parameter to ezmlm_hash()");
+ RETURN_FALSE;
+ }
+
+ l = strlen(str);
+ for (j=0; j<l; j++) {
+ h = (h + (h<<5)) ^ (unsigned long) (unsigned char) tolower(str[j]);
+ }
+
+ h = (h%53);
+
+ RETURN_LONG((int) h);
+}
/* {{{ proto int mail(string to, string subject, string message [, string additional_headers])
Send an email message */
Index: php4/ext/standard/php_mail.h
diff -u php4/ext/standard/php_mail.h:1.4 php4/ext/standard/php_mail.h:1.5
--- php4/ext/standard/php_mail.h:1.4 Mon Mar 6 12:37:11 2000
+++ php4/ext/standard/php_mail.h Thu Jun 29 07:07:10 2000
@@ -28,7 +28,7 @@
*/
-/* $Id: php_mail.h,v 1.4 2000/03/06 20:37:11 ssb Exp $ */
+/* $Id: php_mail.h,v 1.5 2000/06/29 14:07:10 kk Exp $ */
#ifndef _MAIL_H
#define _MAIL_H
@@ -36,6 +36,7 @@
#if HAVE_SENDMAIL
PHP_FUNCTION(mail);
+PHP_FUNCTION(ezmlm_hash);
PHP_MINFO_FUNCTION(mail);
extern int php_mail(char *to, char *subject, char *message, char *headers);