[dev] IMP::serverString()

Nuno Loureiro nuno@co.eth.pt
12 Jun 2002 20:29:40 +0100


Hello!

   I'd like to include this little patch in IMP HEAD, since that,
according to PHP Manual the port number and the protocol are optional in
the mailbox name used in imap_open() and other imap functions.

"A mailbox name consists of a server part and a mailbox path on this
server. The special name INBOX stands for the current users personal
mailbox. The server part, which is enclosed in '{' and '}', consists of
the servers name or ip address, an optional port (prefixed by ':'), and
an optional protocol specification (prefixed by '/')"

Index: IMP.php
===================================================================
RCS file: /repository/imp/lib/IMP.php,v
retrieving revision 1.277
diff -u -u -r1.277 IMP.php
--- IMP.php	11 Jun 2002 21:20:30 -0000	1.277
+++ IMP.php	12 Jun 2002 19:23:11 -0000
@@ -425,7 +425,9 @@
         if (!isset($protocol)) {
             $protocol = $imp['protocol'];
         }
-        return '{' . $imp['server'] . ':' . $imp['port'] . '/' . $protocol . '}';
+        (empty($imp['port'])) ? $port_str = '' : $port_str = ':' . $imp['port'];
+        (empty($protocol)) ? $protocol_str = '' : $protocol_str = '/' . $protocol;
+        return '{' . $imp['server'] . $port_str . $protocol_str . '}';
     }
 
     /**

Thank you.

Best Regards,

  Nuno Loureiro


-- 
Nuno Loureiro <nuno@eth.pt>
Ethernet, Soluções Informáticas, LDA
http://www.eth.pt