* Gratuitous style cleanup of some of the imap code
authorArt Cancro <ajc@citadel.org>
Wed, 18 Nov 2009 15:35:41 +0000 (15:35 +0000)
committerArt Cancro <ajc@citadel.org>
Wed, 18 Nov 2009 15:35:41 +0000 (15:35 +0000)
citadel/modules/imap/imap_acl.c
citadel/modules/imap/imap_fetch.c
citadel/modules/imap/imap_store.c
citadel/modules/imap/imap_tools.c
citadel/modules/imap/serv_imap.c

index be563b7b5ba34776bc0ab765d3d6bbdb96ae254d..3aff977122cad4a5fcd54e5bed883530816d43df 100644 (file)
@@ -21,7 +21,6 @@
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
-
 #include "sysdep.h"
 #include <stdlib.h>
 #include <unistd.h>
 #include "imap_fetch.h"
 #include "imap_misc.h"
 #include "genstamp.h"
-
-
 #include "ctdl_module.h"
 
+
 /*
  * Implements the SETACL command.
  */
@@ -102,7 +100,7 @@ void imap_acl_flags(char *rights, int ra)
         */
        if (    (ra & UA_KNOWN)                                 /* known rooms */
           ||   ((ra & UA_GOTOALLOWED) && (ra & UA_ZAPPED))     /* zapped rooms */
-          ) {
+       ) {
                strcat(rights, "l");
                strcat(rights, "r");
                strcat(rights, "s");
@@ -134,8 +132,9 @@ void imap_acl_flags(char *rights, int ra)
                         * commands are not yet implemented, omitting the flag should
                         * theoretically prevent compliant clients from attempting to
                         * perform them.
+                        *
+                        * strcat(rights, "a");
                         */
-                       /* strcat(rights, "a"); * commented out */
                }
        }
 }
@@ -164,8 +163,7 @@ void imap_getacl(int num_parms, char *parms[]) {
         */
        ret = imap_grabroom(roomname, parms[2], 1);
        if (ret != 0) {
-               cprintf("%s NO Invalid mailbox name or access denied\r\n",
-                       parms[0]);
+               cprintf("%s NO Invalid mailbox name or access denied\r\n", parms[0]);
                return;
        }
 
@@ -237,8 +235,7 @@ void imap_listrights(int num_parms, char *parms[]) {
         */
        ret = imap_grabroom(roomname, parms[2], 1);
        if (ret != 0) {
-               cprintf("%s NO Invalid mailbox name or access denied\r\n",
-                       parms[0]);
+               cprintf("%s NO Invalid mailbox name or access denied\r\n", parms[0]);
                return;
        }
 
@@ -254,8 +251,7 @@ void imap_listrights(int num_parms, char *parms[]) {
                free_recipients(valid);
        }
        if (ret != 0) {
-               cprintf("%s NO Invalid user name or access denied\r\n",
-                       parms[0]);
+               cprintf("%s NO Invalid user name or access denied\r\n", parms[0]);
                return;
        }
 
@@ -268,7 +264,6 @@ void imap_listrights(int num_parms, char *parms[]) {
        }
        CtdlUserGoto(roomname, 0, 0, &msgs, &new);
 
-
        /*
         * Now output the list of rights
         */
@@ -280,7 +275,6 @@ void imap_listrights(int num_parms, char *parms[]) {
        imap_strout("");                /* FIXME ... do something here */
        cprintf("\r\n");
 
-
        /*
         * If another folder is selected, go back to that room so we can resume
         * our happy day without violent explosions.
@@ -312,8 +306,7 @@ void imap_myrights(int num_parms, char *parms[]) {
 
        ret = imap_grabroom(roomname, parms[2], 1);
        if (ret != 0) {
-               cprintf("%s NO Invalid mailbox name or access denied\r\n",
-                       parms[0]);
+               cprintf("%s NO Invalid mailbox name or access denied\r\n", parms[0]);
                return;
        }
 
@@ -343,5 +336,3 @@ void imap_myrights(int num_parms, char *parms[]) {
        cprintf("%s OK MYRIGHTS completed\r\n", parms[0]);
        return;
 }
-
-
index 2d6363103be68a64af8dabab53c625adf89bb198..df317780fd118e00075d5c29c723b94b60a3739d 100644 (file)
@@ -101,6 +101,7 @@ void imap_fetch_flags(int seq) {
        cprintf(")");
 }
 
+
 void imap_fetch_internaldate(struct CtdlMessage *msg) {
        char buf[SIZ];
        time_t msgdate;
@@ -606,7 +607,8 @@ void imap_fetch_body(long msgnum, char *item, int is_peek) {
        }
        CtdlLogPrintf(CTDL_DEBUG, "Section is: %s%s\n", 
                section, 
-               IsEmptyStr(section) ? "(empty)" : "");
+               IsEmptyStr(section) ? "(empty)" : ""
+       );
 
        /* Burn the cache if we don't have the same section of the 
         * same message again.
@@ -1283,7 +1285,6 @@ void imap_pick_range(char *supplied_range, int is_uid) {
                        }
                }
        }
-
 }
 
 
index a906d60ea334d92d394efe95dbe36acadcb99cbb..40f1a5c50d1300c4c2f6db4c1ef34f7b9d0e71f3 100644 (file)
@@ -3,27 +3,25 @@
  *
  * Implements the STORE command in IMAP.
  *
- *
  * Copyright (c) 2001-2009 by the citadel.org team
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 3 of the License, or
- *  (at your option) any later version.
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
 #include "ctdl_module.h"
 
-
 #include <stdlib.h>
 #include <unistd.h>
 #include <stdio.h>
 #include "genstamp.h"
 
 
-
-
-
-
 /*
  * imap_do_store() calls imap_do_store_msg() to tweak the settings of
  * an individual message.
@@ -93,7 +87,6 @@ void imap_do_store_msg(int seq, char *oper, unsigned int bits_to_twiddle) {
 }
 
 
-
 /*
  * imap_store() calls imap_do_store() to perform the actual bit twiddling
  * on the flags.
index 52844462a89aec49e869584ad33d85f9c8f9369f..5d1e68ea110b1a825d87f197f3805245c38d05e7 100644 (file)
@@ -6,19 +6,19 @@
  * Copyright (c) 2001-2009 by the citadel.org team and others, except for
  * most of the UTF7 and UTF8 handling code which was lifted from Evolution.
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 3 of the License, or
- *  (at your option) any later version.
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
 #include <stdlib.h>
index 9cd1452f690abe65dab011021eef0c20bb6152de..9bd44105a40b9682f39c2eecedd2692b91d7c766 100644 (file)
@@ -9,19 +9,19 @@
  * is perfect.  Indeed, with so much gratuitous complexity, *all* IMAP
  * implementations have bugs.
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 3 of the License, or
- *  (at your option) any later version.
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
  *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
  *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
 #include "sysdep.h"
@@ -70,7 +70,6 @@
 #include "imap_metadata.h"
 #include "imap_misc.h"
 
-
 #include "ctdl_module.h"
 
 
@@ -398,11 +397,6 @@ void imap_rescan_msgids(void)
 }
 
 
-
-
-
-
-
 /*
  * This cleanup function blows away the temporary memory and files used by
  * the IMAP server.
@@ -475,6 +469,7 @@ void imap_output_capability_string(void) {
         */
 }
 
+
 /*
  * implements the CAPABILITY command
  */
@@ -487,7 +482,6 @@ void imap_capability(int num_parms, char *parms[])
 }
 
 
-
 /*
  * Implements the ID command (specified by RFC2971)
  *
@@ -504,7 +498,6 @@ void imap_id(int num_parms, char *parms[])
 }
 
 
-
 /*
  * Here's where our IMAP session begins its happy day.
  */
@@ -530,6 +523,7 @@ void imap_greeting(void)
        cprintf("] %s IMAP4rev1 %s ready\r\n", config.c_fqdn, CITADEL);
 }
 
+
 /*
  * IMAPS is just like IMAP, except it goes crypto right away.
  */
@@ -606,6 +600,7 @@ void imap_authenticate(int num_parms, char *parms[])
        }
 }
 
+
 void imap_auth_plain(char *cmd)
 {
        char decoded_authstring[1024];
@@ -638,6 +633,7 @@ void imap_auth_plain(char *cmd)
        cprintf("%s NO authentication failed\r\n", IMAP->authseq);
 }
 
+
 void imap_auth_login_user(char *cmd)
 {
        char buf[SIZ];
@@ -650,6 +646,7 @@ void imap_auth_login_user(char *cmd)
        return;
 }
 
+
 void imap_auth_login_pass(char *cmd)
 {
        char buf[SIZ];
@@ -675,15 +672,9 @@ void imap_starttls(int num_parms, char *parms[])
        char nosup_response[SIZ];
        char error_response[SIZ];
 
-       sprintf(ok_response,
-               "%s OK begin TLS negotiation now\r\n",
-               parms[0]);
-       sprintf(nosup_response,
-               "%s NO TLS not supported here\r\n",
-               parms[0]);
-       sprintf(error_response,
-               "%s BAD Internal error\r\n",
-               parms[0]);
+       sprintf(ok_response,    "%s OK begin TLS negotiation now\r\n",  parms[0]);
+       sprintf(nosup_response, "%s NO TLS not supported here\r\n",     parms[0]);
+       sprintf(error_response, "%s BAD Internal error\r\n",            parms[0]);
        CtdlModuleStartCryptoMsgs(ok_response, nosup_response, error_response);
 }
 
@@ -719,11 +710,11 @@ void imap_select(int num_parms, char *parms[])
 
        /* Then try a mailbox name match */
        if (c != 0) {
-               CtdlMailboxName(augmented_roomname, sizeof augmented_roomname,
-                           &CC->user, towhere);
+               CtdlMailboxName(augmented_roomname, sizeof augmented_roomname, &CC->user, towhere);
                c = CtdlGetRoom(&QRscratch, augmented_roomname);
-               if (c == 0)
+               if (c == 0) {
                        strcpy(towhere, augmented_roomname);
+               }
        }
 
        /* If the room exists, check security/access */
@@ -739,8 +730,7 @@ void imap_select(int num_parms, char *parms[])
 
        /* Fail here if no such room */
        if (!ok) {
-               cprintf("%s NO ... no such room, or access denied\r\n",
-                       parms[0]);
+               cprintf("%s NO ... no such room, or access denied\r\n", parms[0]);
                return;
        }
 
@@ -784,11 +774,11 @@ void imap_select(int num_parms, char *parms[])
 
        cprintf("%s OK [%s] %s completed\r\n",
                parms[0],
-               (IMAP->readonly ? "READ-ONLY" : "READ-WRITE"), parms[1]);
+               (IMAP->readonly ? "READ-ONLY" : "READ-WRITE"), parms[1]
+       );
 }
 
 
-
 /*
  * Does the real work for expunge.
  */
@@ -822,8 +812,7 @@ int imap_do_expunge(void)
                imap_rescan_msgids();
        }
 
-       CtdlLogPrintf(CTDL_DEBUG, "Expunged %d messages from <%s>\n",
-               num_expunged, CC->room.QRname);
+       CtdlLogPrintf(CTDL_DEBUG, "Expunged %d messages from <%s>\n", num_expunged, CC->room.QRname);
        return (num_expunged);
 }
 
@@ -897,7 +886,6 @@ void imap_namespace(int num_parms, char *parms[])
 }
 
 
-
 /*
  * Implements the CREATE command
  *
@@ -1090,7 +1078,6 @@ void imap_status(int num_parms, char *parms[])
 }
 
 
-
 /*
  * Implements the SUBSCRIBE command
  *
@@ -1182,7 +1169,6 @@ void imap_unsubscribe(int num_parms, char *parms[])
 }
 
 
-
 /*
  * Implements the DELETE command
  *
@@ -1367,8 +1353,6 @@ void imap_rename(int num_parms, char *parms[])
 }
 
 
-
-
 /* 
  * Main command loop for IMAP sessions.
  */
@@ -1428,7 +1412,6 @@ void imap_command_loop(void)
                return;
        }
 
-
        /* Ok, at this point we're in normal command mode.
         * If the command just submitted does not contain a literal, we
         * might think about delivering some untagged stuff...