]> code.citadel.org Git - citadel.git/blobdiff - citadel/modules/managesieve/serv_managesieve.c
* move policy.c into modules/expire/expire_policy.c, since it just controls this.
[citadel.git] / citadel / modules / managesieve / serv_managesieve.c
index 614eff97a6d49dd08bb49bf9b6196e31f4da1520..5c0e02030a29fbc58c4ac177709d21b06cb0d1cf 100644 (file)
@@ -1,4 +1,4 @@
-/**
+/*
  * $Id$
  *
  * This module is an managesieve implementation for the Citadel system.
@@ -7,6 +7,22 @@
  * http://tools.ietf.org/html/draft-martin-managesieve-06
  * as this draft expires with this writing, you might need to search for
  * the new one.
+ *
+ * Copyright (c) 2007-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 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
  */
 
 #include "sysdep.h"
@@ -45,9 +61,7 @@
 #include "support.h"
 #include "config.h"
 #include "control.h"
-#include "room_ops.h"
 #include "user_ops.h"
-#include "policy.h"
 #include "database.h"
 #include "msgbase.h"
 #include "internet_addressing.h"
 
 
 #include "ctdl_module.h"
-
-
-
-#ifdef HAVE_LIBSIEVE
-
 #include "serv_sieve.h"
 
 
@@ -216,7 +225,6 @@ void cmd_mgsve_auth(int num_parms, char **parms, struct sdm_userdata *u)
                int retval;
                char *message;
                char *username;
-               char *password;
 
                message = NULL;
                memset (auth, 0, SIZ);
@@ -270,7 +278,7 @@ void cmd_mgsve_starttls(void)
 void cmd_mgsve_logout(struct sdm_userdata *u)
 {
        cprintf("OK\r\n");
-       lprintf(CTDL_NOTICE, "MgSve bye.");
+       CtdlLogPrintf(CTDL_NOTICE, "MgSve bye.");
        CC->kill_me = 1;
 }
 
@@ -514,16 +522,16 @@ void managesieve_command_loop(void) {
        memset(cmdbuf, 0, sizeof cmdbuf); /* Clear it, just in case */
        length = client_getln(cmdbuf, sizeof cmdbuf);
        if (length >= 1) {
-               num_parms = imap_parameterize(parms, cmdbuf);
+               num_parms = old_imap_parameterize(parms, cmdbuf);
                if (num_parms == 0) return;
                length = strlen(parms[0]);
        }
        if (length < 1) {
-               lprintf(CTDL_CRIT, "Client disconnected: ending session.\n");
+               CtdlLogPrintf(CTDL_CRIT, "Client disconnected: ending session.\n");
                CC->kill_me = 1;
                return;
        }
-       lprintf(CTDL_INFO, "MANAGESIEVE: %s\n", cmdbuf);
+       CtdlLogPrintf(CTDL_INFO, "MANAGESIEVE: %s\n", cmdbuf);
        if ((length>= 12) && (!strncasecmp(parms[0], "AUTHENTICATE", 12))){
                cmd_mgsve_auth(num_parms, parms, &u);
        }
@@ -568,7 +576,7 @@ void managesieve_command_loop(void) {
        }
        else {
                cprintf("No Invalid access or command.\r\n");
-               lprintf(CTDL_INFO, "illegal Managesieve command: %s", parms[0]);
+               CtdlLogPrintf(CTDL_INFO, "illegal Managesieve command: %s", parms[0]);
                CC->kill_me = 1;
        }
 
@@ -584,19 +592,17 @@ void managesieve_cleanup_function(void) {
        /* Don't do this stuff if this is not a managesieve session! */
        if (CC->h_command_function != managesieve_command_loop) return;
 
-       lprintf(CTDL_DEBUG, "Performing managesieve cleanup hook\n");
+       CtdlLogPrintf(CTDL_DEBUG, "Performing managesieve cleanup hook\n");
        free(MGSVE);
 }
 
 
 
-#endif /* HAVE_LIBSIEVE */
 const char* CitadelServiceManageSieve = "ManageSieve";
 CTDL_MODULE_INIT(managesieve)
 {
        if (!threading)
        {
-#ifdef HAVE_LIBSIEVE
                CtdlRegisterServiceHook(config.c_managesieve_port,
                                        NULL,
                                        managesieve_greeting,
@@ -604,12 +610,6 @@ CTDL_MODULE_INIT(managesieve)
                                        NULL, 
                                        CitadelServiceManageSieve);
                CtdlRegisterSessionHook(managesieve_cleanup_function, EVT_STOP);
-
-#else  /* HAVE_LIBSIEVE */
-
-               lprintf(CTDL_INFO, "This server is missing libsieve.  Managesieve protocol is disabled..\n");
-
-#endif /* HAVE_LIBSIEVE */
        }
        
        /* return our Subversion id for the Log */