ispman/lib mailbox_actions_cyrus.lib,1.1,1.2

Joerg Delker <[email protected]>
Newsgroups gmane.comp.isp.ispman.cvs
Message-ID <[email protected]>
Update of /cvsroot/ispman/ispman/lib
In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv4160/lib

Modified Files:
	mailbox_actions_cyrus.lib 
Log Message:
added sub create_folder
added error reporting

Index: mailbox_actions_cyrus.lib
===================================================================
RCS file: /cvsroot/ispman/ispman/lib/mailbox_actions_cyrus.lib,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- mailbox_actions_cyrus.lib	7 Sep 2006 21:24:56 -0000	1.1
+++ mailbox_actions_cyrus.lib	12 Sep 2006 13:04:34 -0000	1.2
@@ -24,7 +24,11 @@
 
     $imap_conn or _connect($server);
 
-    return $imap_conn->create($mailbox);
+    if ( $imap_conn->create($mailbox) ) {
+        print $imap_conn->error."\n";
+        return 1;
+    }
+    return 0;
 }
 
 sub delete_mailbox {
@@ -34,7 +38,24 @@
     $imap_conn or _connect($server);
     $imap_conn->set_acl( $mailbox, $ispman->getConf("imapAdminUsername"),
         "lrswipcda" );
-    return $imap_conn->delete($mailbox);
+    if ( $imap_conn->delete($mailbox) ) {
+        print $imap_conn->error."\n";
+        return 1;
+    }
+    return 0;
+}
+
+sub create_folder {
+    my $server  = shift;
+    my $mailbox = $imap_mailbox_prefix . shift;
+    my $folder  = shift;
+
+    $imap_conn or _connect($server);
+    if ( $imap_conn->create( join ".", ( $mailbox, $folder ) ) ) {
+        print $imap_conn->error."\n";
+        return 1;
+    }
+    return 0;
 }
 
 sub get_quota {
@@ -42,7 +63,11 @@
     my $mailbox = $imap_mailbox_prefix . shift;
 
     $imap_conn or _connect($server);
-    return $imap_conn->get_quota($mailbox);
+    if ( $imap_conn->get_quota($mailbox) ) {
+        print $imap_conn->error."\n";
+        return 1;
+    }
+    return 0;
 }
 
 sub set_quota {
@@ -51,7 +76,11 @@
     my $quota   = shift;
 
     $imap_conn or _connect($server);
-    return $imap_conn->set_quota( $mailbox, $quota );
+    if ( $imap_conn->set_quota( $mailbox, $quota ) ) {
+        print $imap_conn->error."\n";
+        return 1;
+    }
+    return 0;
 }
 
 sub list_mailboxes {


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.