ZEND_ARG_INFO(0, buf)
ZEND_END_ARG_INFO()
+ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_utf8_to_mutf7, 0, 0, 1)
+ ZEND_ARG_INFO(0, in)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_mutf7_to_utf8, 0, 0, 1)
+ ZEND_ARG_INFO(0, in)
+ZEND_END_ARG_INFO()
+
ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_setflag_full, 0, 0, 3)
ZEND_ARG_INFO(0, stream_id)
ZEND_ARG_INFO(0, sequence)
PHP_FE(imap_search, arginfo_imap_search)
PHP_FE(imap_utf7_decode, arginfo_imap_utf7_decode)
PHP_FE(imap_utf7_encode, arginfo_imap_utf7_encode)
+ PHP_FE(imap_utf8_to_mutf7, arginfo_imap_utf8_to_mutf7)
+ PHP_FE(imap_mutf7_to_utf8, arginfo_imap_mutf7_to_utf8)
PHP_FE(imap_mime_header_decode, arginfo_imap_mime_header_decode)
PHP_FE(imap_thread, arginfo_imap_thread)
PHP_FE(imap_timeout, arginfo_imap_timeout)
#undef B64
#undef UNB64
+static void php_imap_mutf7(INTERNAL_FUNCTION_PARAMETERS, int mode)
+{
+ char *in;
+ int in_len;
+ unsigned char *out;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &in, &in_len) == FAILURE) {
+ return;
+ }
+
+ if (in_len < 1) {
+ RETURN_EMPTY_STRING();
+ }
+
+ if (mode == 0) {
+ out = utf8_to_mutf7((unsigned char *) in);
+ } else {
+ out = utf8_from_mutf7((unsigned char *) in);
+ }
+
+ if (out == NIL) {
+ RETURN_FALSE;
+ } else {
+ RETURN_STRING((char *)out, 1);
+ }
+}
+
+/* {{{ proto string imap_utf8_to_mutf7(string in)
+ Encode a UTF-8 string to modified UTF-7 */
+PHP_FUNCTION(imap_utf8_to_mutf7)
+{
+ php_imap_mutf7(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
+}
+
+/* {{{ proto string imap_mutf7_to_utf8(string in)
+ Decode a modified UTF-7 string to UTF-8 */
+PHP_FUNCTION(imap_mutf7_to_utf8)
+{
+ php_imap_mutf7(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
+}
+
/* {{{ proto bool imap_setflag_full(resource stream_id, string sequence, string flag [, int options])
Sets flags on messages */
PHP_FUNCTION(imap_setflag_full)