Did away with lprintf all together now its called CtdlLogPrintf()
authorDave West <davew@uncensored.citadel.org>
Fri, 21 Mar 2008 21:42:54 +0000 (21:42 +0000)
committerDave West <davew@uncensored.citadel.org>
Fri, 21 Mar 2008 21:42:54 +0000 (21:42 +0000)
This is a step towards the coding convention listed on the web site.

53 files changed:
citadel/citadel.c
citadel/citadel.h
citadel/citserver.c
citadel/clientsocket.c
citadel/control.c
citadel/database_sleepycat.c
citadel/domain.c
citadel/ecrash.c
citadel/euidindex.c
citadel/file_ops.c
citadel/ical_dezonify.c
citadel/internet_addressing.c
citadel/locate_host.c
citadel/mk_module_init.sh
citadel/modules/calendar/serv_calendar.c
citadel/modules/crypto/serv_crypto.c
citadel/modules/dspam/serv_dspam.c
citadel/modules/expire/serv_expire.c
citadel/modules/extnotify/extnotify_main.c
citadel/modules/extnotify/funambol65.c
citadel/modules/fulltext/ft_wordbreaker.c
citadel/modules/fulltext/serv_fulltext.c
citadel/modules/imap/imap_fetch.c
citadel/modules/imap/imap_list.c
citadel/modules/imap/imap_misc.c
citadel/modules/imap/imap_tools.c
citadel/modules/imap/serv_imap.c
citadel/modules/jabber/serv_xmpp.c
citadel/modules/jabber/xmpp_presence.c
citadel/modules/jabber/xmpp_query_namespace.c
citadel/modules/jabber/xmpp_queue.c
citadel/modules/listsub/serv_listsub.c
citadel/modules/managesieve/serv_managesieve.c
citadel/modules/network/serv_network.c
citadel/modules/notes/serv_notes.c
citadel/modules/pop3/serv_pop3.c
citadel/modules/pop3client/serv_pop3client.c
citadel/modules/rssclient/serv_rssclient.c
citadel/modules/rwho/serv_rwho.c
citadel/modules/sieve/serv_sieve.c
citadel/modules/smtp/serv_smtp.c
citadel/modules/spam/serv_spam.c
citadel/modules/test/serv_test.c
citadel/modules/upgrade/serv_upgrade.c
citadel/modules/vandelay/serv_vandelay.c
citadel/modules/vcard/serv_vcard.c
citadel/msgbase.c
citadel/room_ops.c
citadel/serv_extensions.c
citadel/sysdep.c
citadel/sysdep_decls.h
citadel/threads.c
citadel/user_ops.c

index 8b643e28b1b02f76f0f22b6c7bc638d0fe9a9ebd..ef8ca61f44498ac6d658b6f4875bfc551681f11f 100644 (file)
@@ -113,13 +113,13 @@ int enable_syslog = 0;
 
 
 /*
- * lprintf()  ...   Write logging information; 
+ * CtdlLogPrintf()  ...   Write logging information; 
  *                  simple here to have the same 
  *                  symbols in the client.
  */
 enum LogLevel {CTDL_EMERG};
 
-void lprintf(enum LogLevel loglevel, const char *format, ...) {   
+void CtdlLogPrintf(enum LogLevel loglevel, const char *format, ...) {   
        va_list arg_ptr;
 
        va_start(arg_ptr, format);
index d8d3270192d535e0489e63b70955f4b62f20ef98..c74bef1a6f9d9ca319c3656be3d26911ecc9279a 100644 (file)
@@ -267,7 +267,7 @@ enum {
 #define FILTERLIST     "application/x-citadel-filter-list"
 #define SIEVECONFIG    "application/x-citadel-sieve-config"
 
-#define TRACE  lprintf(CTDL_DEBUG, "Checkpoint: %s, %d\n", __FILE__, __LINE__)
+#define TRACE  CtdlLogPrintf(CTDL_DEBUG, "Checkpoint: %s, %d\n", __FILE__, __LINE__)
 
 #ifndef LONG_MAX
 #define LONG_MAX 2147483647L
index b959d04f9db533f999e15236befff29849446728..f334f5cfd8d94f26426431794251aa848bf2a34a 100644 (file)
@@ -89,9 +89,9 @@ void cit_backtrace(void)
        strings = backtrace_symbols(stack_frames, size);
        for (i = 0; i < size; i++) {
                if (strings != NULL)
-                       lprintf(1, "%s\n", strings[i]);
+                       CtdlLogPrintf(1, "%s\n", strings[i]);
                else
-                       lprintf(1, "%p\n", stack_frames[i]);
+                       CtdlLogPrintf(1, "%p\n", stack_frames[i]);
        }
        free(strings);
 #endif
@@ -112,9 +112,9 @@ void cit_panic_backtrace(int SigNum)
        strings = backtrace_symbols(stack_frames, size);
        for (i = 0; i < size; i++) {
                if (strings != NULL)
-                       lprintf(1, "%s\n", strings[i]);
+                       CtdlLogPrintf(1, "%s\n", strings[i]);
                else
-                       lprintf(1, "%p\n", stack_frames[i]);
+                       CtdlLogPrintf(1, "%p\n", stack_frames[i]);
        }
        free(strings);
 #endif
@@ -130,10 +130,10 @@ void master_startup(void) {
        FILE *urandom;
        struct ctdlroom qrbuf;
        
-       lprintf(CTDL_DEBUG, "master_startup() started\n");
+       CtdlLogPrintf(CTDL_DEBUG, "master_startup() started\n");
        time(&server_startup_time);
 
-       lprintf(CTDL_INFO, "Opening databases\n");
+       CtdlLogPrintf(CTDL_INFO, "Opening databases\n");
        open_databases();
 
        ctdl_thread_internal_init_tsd();
@@ -142,7 +142,7 @@ void master_startup(void) {
        
        check_ref_counts();
 
-       lprintf(CTDL_INFO, "Creating base rooms (if necessary)\n");
+       CtdlLogPrintf(CTDL_INFO, "Creating base rooms (if necessary)\n");
        create_room(config.c_baseroom,  0, "", 0, 1, 0, VIEW_BBS);
        create_room(AIDEROOM,           3, "", 0, 1, 0, VIEW_BBS);
        create_room(SYSCONFIGROOM,      3, "", 0, 1, 0, VIEW_BBS);
@@ -160,7 +160,7 @@ void master_startup(void) {
                 lputroom(&qrbuf);
         }
 
-       lprintf(CTDL_INFO, "Seeding the pseudo-random number generator...\n");
+       CtdlLogPrintf(CTDL_INFO, "Seeding the pseudo-random number generator...\n");
        urandom = fopen("/dev/urandom", "r");
        if (urandom != NULL) {
                fread(&seed, sizeof seed, 1, urandom);
@@ -172,12 +172,12 @@ void master_startup(void) {
        }
        srandom(seed);
 
-       lprintf(CTDL_INFO, "Initializing ipgm secret\n");
+       CtdlLogPrintf(CTDL_INFO, "Initializing ipgm secret\n");
        get_config();
        config.c_ipgm_secret = rand();
        put_config();
 
-       lprintf(CTDL_DEBUG, "master_startup() finished\n");
+       CtdlLogPrintf(CTDL_DEBUG, "master_startup() finished\n");
 }
 
 
@@ -203,7 +203,7 @@ void master_cleanup(int exitcode) {
        sysdep_master_cleanup();
        
        /* Close databases */
-       lprintf(CTDL_INFO, "Closing databases\n");
+       CtdlLogPrintf(CTDL_INFO, "Closing databases\n");
        close_databases();
 
 #ifdef DEBUG_MEMORY_LEAKS
@@ -212,7 +212,7 @@ void master_cleanup(int exitcode) {
 
        /* If the operator requested a halt but not an exit, halt here. */
        if (shutdown_and_halt) {
-               lprintf(CTDL_NOTICE, "citserver: Halting server without exiting.\n");
+               CtdlLogPrintf(CTDL_NOTICE, "citserver: Halting server without exiting.\n");
                fflush(stdout); fflush(stderr);
                while(1) {
                        sleep(32767);
@@ -222,7 +222,7 @@ void master_cleanup(int exitcode) {
        release_control();
 
        /* Now go away. */
-       lprintf(CTDL_NOTICE, "citserver: Exiting with status %d\n", exitcode);
+       CtdlLogPrintf(CTDL_NOTICE, "citserver: Exiting with status %d\n", exitcode);
        fflush(stdout); fflush(stderr);
        
        if (restart_server != 0)
@@ -238,11 +238,11 @@ void master_cleanup(int exitcode) {
 void RemoveContext (struct CitContext *con)
 {
        if (con==NULL) {
-               lprintf(CTDL_ERR,
+               CtdlLogPrintf(CTDL_ERR,
                        "WARNING: RemoveContext() called with NULL!\n");
                return;
        }
-       lprintf(CTDL_DEBUG, "RemoveContext() session %d\n", con->cs_pid);
+       CtdlLogPrintf(CTDL_DEBUG, "RemoveContext() session %d\n", con->cs_pid);
 
        /* Run any cleanup routines registered by loadable modules.
         * Note: We have to "become_session()" because the cleanup functions
@@ -253,13 +253,13 @@ void RemoveContext (struct CitContext *con)
        PerformSessionHooks(EVT_STOP);
        become_session(NULL);
 
-       lprintf(CTDL_NOTICE, "[%3d] Session ended.\n", con->cs_pid);
+       CtdlLogPrintf(CTDL_NOTICE, "[%3d] Session ended.\n", con->cs_pid);
 
        /* If the client is still connected, blow 'em away. */
-       lprintf(CTDL_DEBUG, "Closing socket %d\n", con->client_socket);
+       CtdlLogPrintf(CTDL_DEBUG, "Closing socket %d\n", con->client_socket);
        close(con->client_socket);
 
-       lprintf(CTDL_DEBUG, "Done with RemoveContext()\n");
+       CtdlLogPrintf(CTDL_DEBUG, "Done with RemoveContext()\n");
 }
 
 
@@ -379,14 +379,14 @@ int is_public_client(void)
         */
        if (stat(public_clients_file, &statbuf) != 0) {
                /* No public_clients file exists, so bail out */
-               lprintf(CTDL_WARNING, "Warning: '%s' does not exist\n", 
+               CtdlLogPrintf(CTDL_WARNING, "Warning: '%s' does not exist\n", 
                                public_clients_file);
                return(0);
        }
 
        if (statbuf.st_mtime > pc_timestamp) {
                begin_critical_section(S_PUBLIC_CLIENTS);
-               lprintf(CTDL_INFO, "Loading %s\n", public_clients_file);
+               CtdlLogPrintf(CTDL_INFO, "Loading %s\n", public_clients_file);
 
                public_clientspos = &public_clients[0];
                public_clientsend = public_clientspos + SIZ;
@@ -432,18 +432,18 @@ int is_public_client(void)
                end_critical_section(S_PUBLIC_CLIENTS);
        }
 
-       lprintf(CTDL_DEBUG, "Checking whether %s is a local or public client\n",
+       CtdlLogPrintf(CTDL_DEBUG, "Checking whether %s is a local or public client\n",
                CC->cs_addr);
        for (i=0; i<num_parms(public_clients); ++i) {
                extract_token(addrbuf, public_clients, i, '|', sizeof addrbuf);
                if (!strcasecmp(CC->cs_addr, addrbuf)) {
-                       lprintf(CTDL_DEBUG, "... yes it is.\n");
+                       CtdlLogPrintf(CTDL_DEBUG, "... yes it is.\n");
                        return(1);
                }
        }
 
        /* No hits.  This is not a public client. */
-       lprintf(CTDL_DEBUG, "... no it isn't.\n");
+       CtdlLogPrintf(CTDL_DEBUG, "... no it isn't.\n");
        return(0);
 }
 
@@ -487,7 +487,7 @@ void cmd_iden(char *argbuf)
        }
 
        if (do_lookup) {
-               lprintf(CTDL_DEBUG, "Looking up hostname '%s'\n", from_host);
+               CtdlLogPrintf(CTDL_DEBUG, "Looking up hostname '%s'\n", from_host);
                if ((addr.s_addr = inet_addr(from_host)) != -1) {
                        locate_host(CC->cs_host, sizeof CC->cs_host,
                                CC->cs_addr, sizeof CC->cs_addr,
@@ -499,7 +499,7 @@ void cmd_iden(char *argbuf)
                }
        }
 
-       lprintf(CTDL_NOTICE, "Client %d/%d/%01d.%02d (%s) from %s\n",
+       CtdlLogPrintf(CTDL_NOTICE, "Client %d/%d/%01d.%02d (%s) from %s\n",
                dev_code,
                cli_code,
                (rev_level / 100),
@@ -727,7 +727,7 @@ void cmd_term(char *cmdbuf)
                return;
        }
 
-       lprintf(CTDL_DEBUG, "Locating session to kill\n");
+       CtdlLogPrintf(CTDL_DEBUG, "Locating session to kill\n");
        begin_critical_section(S_SESSION_TABLE);
        for (ccptr = ContextList; ccptr != NULL; ccptr = ccptr->next) {
                if (session_num == ccptr->cs_pid) {
@@ -806,7 +806,7 @@ void cmd_ipgm(char *argbuf)
                sleep(5);
                cprintf("%d Authentication failed.\n",
                        ERROR + PASSWORD_REQUIRED);
-               lprintf(CTDL_ERR, "Warning: ipgm authentication failed.\n");
+               CtdlLogPrintf(CTDL_ERR, "Warning: ipgm authentication failed.\n");
                CC->kill_me = 1;
        }
 
@@ -839,7 +839,7 @@ void cmd_down(char *argbuf) {
                        Reply = "%d Restarting server.  See you soon.\n";
                if ((restart_server > 0) && !running_as_daemon)
                {
-                       lprintf(CTDL_ERR, "The user requested restart, but not running as deamon! Geronimooooooo!\n");
+                       CtdlLogPrintf(CTDL_ERR, "The user requested restart, but not running as deamon! Geronimooooooo!\n");
                        Reply = "%d Warning, not running in deamon mode. maybe we will come up again, but don't lean on it.\n";
                        state = ERROR;
                }
@@ -881,7 +881,7 @@ void cmd_scdn(char *argbuf)
                restart_server = 1;
                if (!running_as_daemon)
                {
-                       lprintf(CTDL_ERR, "The user requested restart, but not running as deamon! Geronimooooooo!\n");
+                       CtdlLogPrintf(CTDL_ERR, "The user requested restart, but not running as deamon! Geronimooooooo!\n");
                        Reply = "%d %d Warning, not running in deamon mode. maybe we will come up again, but don't lean on it.\n";
                        state = ERROR;
                }
@@ -981,10 +981,10 @@ void begin_session(struct CitContext *con)
        }
 
        if (!CC->is_local_socket) {
-               lprintf(CTDL_NOTICE, "Session started from %s [%s].\n", con->cs_host, con->cs_addr);
+               CtdlLogPrintf(CTDL_NOTICE, "Session started from %s [%s].\n", con->cs_host, con->cs_addr);
        }
        else {
-               lprintf(CTDL_NOTICE, "Session started via local socket.\n");
+               CtdlLogPrintf(CTDL_NOTICE, "Session started via local socket.\n");
        }
 
        /* Run any session startup routines registered by loadable modules */
@@ -1021,7 +1021,7 @@ void do_command_loop(void) {
        time(&CC->lastcmd);
        memset(cmdbuf, 0, sizeof cmdbuf); /* Clear it, just in case */
        if (client_getln(cmdbuf, sizeof cmdbuf) < 1) {
-               lprintf(CTDL_ERR, "Client disconnected: ending session.\n");
+               CtdlLogPrintf(CTDL_ERR, "Client disconnected: ending session.\n");
                CC->kill_me = 1;
                CtdlThreadName(old_name);
                return;
@@ -1030,10 +1030,10 @@ void do_command_loop(void) {
        /* Log the server command, but don't show passwords... */
        if ( (strncasecmp(cmdbuf, "PASS", 4))
           && (strncasecmp(cmdbuf, "SETP", 4)) ) {
-               lprintf(CTDL_INFO, "%s\n", cmdbuf);
+               CtdlLogPrintf(CTDL_INFO, "%s\n", cmdbuf);
        }
        else {
-               lprintf(CTDL_INFO, "<password command sent>\n");
+               CtdlLogPrintf(CTDL_INFO, "<password command sent>\n");
        }
 
        buffer_output();
index 1d65e2ca8bf58084b23d3d03a8c5cb2b167a8c95..08e72a20ff9964ab24ee150059c2a6d22dc6cbab 100644 (file)
@@ -60,7 +60,7 @@ int sock_connect(char *host, char *service, char *protocol)
        if (pse) {
                sin.sin_port = pse->s_port;
        } else if ((sin.sin_port = htons((u_short) atoi(service))) == 0) {
-               lprintf(CTDL_CRIT, "Can't get %s service entry: %s\n",
+               CtdlLogPrintf(CTDL_CRIT, "Can't get %s service entry: %s\n",
                        service, strerror(errno));
                return(-1);
        }
@@ -68,12 +68,12 @@ int sock_connect(char *host, char *service, char *protocol)
        if (phe) {
                memcpy(&sin.sin_addr, phe->h_addr, phe->h_length);
        } else if ((sin.sin_addr.s_addr = inet_addr(host)) == INADDR_NONE) {
-               lprintf(CTDL_ERR, "Can't get %s host entry: %s\n",
+               CtdlLogPrintf(CTDL_ERR, "Can't get %s host entry: %s\n",
                        host, strerror(errno));
                return(-1);
        }
        if ((ppe = getprotobyname(protocol)) == 0) {
-               lprintf(CTDL_CRIT, "Can't get %s protocol entry: %s\n",
+               CtdlLogPrintf(CTDL_CRIT, "Can't get %s protocol entry: %s\n",
                        protocol, strerror(errno));
                return(-1);
        }
@@ -85,7 +85,7 @@ int sock_connect(char *host, char *service, char *protocol)
 
        s = socket(PF_INET, type, ppe->p_proto);
        if (s < 0) {
-               lprintf(CTDL_CRIT, "Can't create socket: %s\n", strerror(errno));
+               CtdlLogPrintf(CTDL_CRIT, "Can't create socket: %s\n", strerror(errno));
                return(-1);
        }
 
@@ -106,7 +106,7 @@ int sock_connect(char *host, char *service, char *protocol)
 
        /* Now try to connect to the remote host. */
        if (connect(s, (struct sockaddr *) &sin, sizeof(sin)) < 0) {
-               lprintf(CTDL_ERR, "Can't connect to %s:%s: %s\n",
+               CtdlLogPrintf(CTDL_ERR, "Can't connect to %s:%s: %s\n",
                        host, service, strerror(errno));
                close(s);
                return(-1);
@@ -139,13 +139,13 @@ int sock_read_to(int sock, char *buf, int bytes, int timeout, int keep_reading_u
                retval = select(sock+1, &rfds, NULL, NULL, &tv);
 
                if (FD_ISSET(sock, &rfds) == 0) {       /* timed out */
-                       lprintf(CTDL_ERR, "sock_read() timed out.\n");
+                       CtdlLogPrintf(CTDL_ERR, "sock_read() timed out.\n");
                        return(-1);
                }
 
                rlen = read(sock, &buf[len], bytes-len);
                if (rlen<1) {
-                       lprintf(CTDL_ERR, "sock_read() failed: %s\n",
+                       CtdlLogPrintf(CTDL_ERR, "sock_read() failed: %s\n",
                                strerror(errno));
                        return(-1);
                }
index d33db78dedd4dd1860cb65115d3d9d25a3ced3c6..2522c7f3acd8a3a1d29c359da2efbdffa8431220 100644 (file)
@@ -66,8 +66,8 @@ void lock_control(void)
  */
 
        if (flock(fileno(control_fp), (LOCK_EX | LOCK_NB))) {
-               lprintf(CTDL_EMERG, "citserver: unable to lock %s.\n", file_citadel_control);
-               lprintf(CTDL_EMERG, "Is another citserver already running?\n");
+               CtdlLogPrintf(CTDL_EMERG, "citserver: unable to lock %s.\n", file_citadel_control);
+               CtdlLogPrintf(CTDL_EMERG, "Is another citserver already running?\n");
                exit(CTDLEXIT_CONTROL);
        }
 #endif
@@ -163,7 +163,7 @@ void get_control(void)
                }
        }
        if (control_fp == NULL) {
-               lprintf(CTDL_ALERT, "ERROR opening %s: %s\n",
+               CtdlLogPrintf(CTDL_ALERT, "ERROR opening %s: %s\n",
                                file_citadel_control,
                                strerror(errno));
                return;
index 01cfb31628e9e3642f7e1303788876673c54e2d7..7197009ea7e3b94db31e2ff4a9f1156b9ad55f1b 100644 (file)
@@ -67,14 +67,14 @@ static DB_ENV *dbenv;               /* The DB environment (global) */
 /* Verbose logging callback */
 void cdb_verbose_log(const DB_ENV *dbenv, const char *msg)
 {
-       lprintf(CTDL_DEBUG, "BDB: %s\n", msg);
+       CtdlLogPrintf(CTDL_DEBUG, "BDB: %s\n", msg);
 }
 
 
 /* Verbose logging callback */
 void cdb_verbose_err(const DB_ENV *dbenv, const char *errpfx, const char *msg)
 {
-       lprintf(CTDL_ALERT, "BDB: %s\n", msg);
+       CtdlLogPrintf(CTDL_ALERT, "BDB: %s\n", msg);
 }
 
 
@@ -86,7 +86,7 @@ static void txabort(DB_TXN * tid)
        ret = tid->abort(tid);
 
        if (ret) {
-               lprintf(CTDL_EMERG, "cdb_*: txn_abort: %s\n",
+               CtdlLogPrintf(CTDL_EMERG, "cdb_*: txn_abort: %s\n",
                        db_strerror(ret));
                abort();
        }
@@ -100,7 +100,7 @@ static void txcommit(DB_TXN * tid)
        ret = tid->commit(tid, 0);
 
        if (ret) {
-               lprintf(CTDL_EMERG, "cdb_*: txn_commit: %s\n",
+               CtdlLogPrintf(CTDL_EMERG, "cdb_*: txn_commit: %s\n",
                        db_strerror(ret));
                abort();
        }
@@ -114,7 +114,7 @@ static void txbegin(DB_TXN ** tid)
        ret = dbenv->txn_begin(dbenv, NULL, tid, 0);
 
        if (ret) {
-               lprintf(CTDL_EMERG, "cdb_*: txn_begin: %s\n",
+               CtdlLogPrintf(CTDL_EMERG, "cdb_*: txn_begin: %s\n",
                        db_strerror(ret));
                abort();
        }
@@ -122,7 +122,7 @@ static void txbegin(DB_TXN ** tid)
 
 static void dbpanic(DB_ENV * env, int errval)
 {
-       lprintf(CTDL_EMERG, "cdb_*: Berkeley DB panic: %d\n", errval);
+       CtdlLogPrintf(CTDL_EMERG, "cdb_*: Berkeley DB panic: %d\n", errval);
 }
 
 static void cclose(DBC * cursor)
@@ -130,7 +130,7 @@ static void cclose(DBC * cursor)
        int ret;
 
        if ((ret = cursor->c_close(cursor))) {
-               lprintf(CTDL_EMERG, "cdb_*: c_close: %s\n",
+               CtdlLogPrintf(CTDL_EMERG, "cdb_*: c_close: %s\n",
                        db_strerror(ret));
                abort();
        }
@@ -142,7 +142,7 @@ static void bailIfCursor(DBC ** cursors, const char *msg)
 
        for (i = 0; i < MAXCDB; i++)
                if (cursors[i] != NULL) {
-                       lprintf(CTDL_EMERG,
+                       CtdlLogPrintf(CTDL_EMERG,
                                "cdb_*: cursor still in progress on cdb %d: %s\n",
                                i, msg);
                        abort();
@@ -157,7 +157,7 @@ void check_handles(void *arg)
                bailIfCursor(tsd->cursors, "in check_handles");
 
                if (tsd->tid != NULL) {
-                       lprintf(CTDL_EMERG,
+                       CtdlLogPrintf(CTDL_EMERG,
                                "cdb_*: transaction still in progress!");
                        abort();
                }
@@ -184,14 +184,14 @@ static void cdb_cull_logs(void)
 
        /* Get the list of names. */
        if ((ret = dbenv->log_archive(dbenv, &list, flags)) != 0) {
-               lprintf(CTDL_ERR, "cdb_cull_logs: %s\n", db_strerror(ret));
+               CtdlLogPrintf(CTDL_ERR, "cdb_cull_logs: %s\n", db_strerror(ret));
                return;
        }
 
        /* Print the list of names. */
        if (list != NULL) {
                for (file = list; *file != NULL; ++file) {
-                       lprintf(CTDL_DEBUG, "Deleting log: %s\n", *file);
+                       CtdlLogPrintf(CTDL_DEBUG, "Deleting log: %s\n", *file);
                        ret = unlink(*file);
                        if (ret != 0) {
                                snprintf(errmsg, sizeof(errmsg),
@@ -237,13 +237,13 @@ void cdb_checkpoint(void)
        last_run = time(NULL);
 */
 
-       lprintf(CTDL_DEBUG, "-- db checkpoint --\n");
+       CtdlLogPrintf(CTDL_DEBUG, "-- db checkpoint --\n");
        ret = dbenv->txn_checkpoint(dbenv,
                                    MAX_CHECKPOINT_KBYTES,
                                    MAX_CHECKPOINT_MINUTES, 0);
 
        if (ret != 0) {
-               lprintf(CTDL_EMERG, "cdb_checkpoint: txn_checkpoint: %s\n",
+               CtdlLogPrintf(CTDL_EMERG, "cdb_checkpoint: txn_checkpoint: %s\n",
                        db_strerror(ret));
                abort();
        }
@@ -269,12 +269,12 @@ void open_databases(void)
        char dbfilename[SIZ];
        u_int32_t flags = 0;
 
-       lprintf(CTDL_DEBUG, "cdb_*: open_databases() starting\n");
-       lprintf(CTDL_DEBUG, "Compiled db: %s\n", DB_VERSION_STRING);
-       lprintf(CTDL_INFO, "  Linked db: %s\n",
+       CtdlLogPrintf(CTDL_DEBUG, "cdb_*: open_databases() starting\n");
+       CtdlLogPrintf(CTDL_DEBUG, "Compiled db: %s\n", DB_VERSION_STRING);
+       CtdlLogPrintf(CTDL_INFO, "  Linked db: %s\n",
                db_version(NULL, NULL, NULL));
 #ifdef HAVE_ZLIB
-       lprintf(CTDL_INFO, "Linked zlib: %s\n", zlibVersion());
+       CtdlLogPrintf(CTDL_INFO, "Linked zlib: %s\n", zlibVersion());
 #endif
 
        /*
@@ -285,11 +285,11 @@ void open_databases(void)
        chmod(ctdl_data_dir, 0700);
        chown(ctdl_data_dir, CTDLUID, (-1));
 
-       lprintf(CTDL_DEBUG, "cdb_*: Setting up DB environment\n");
+       CtdlLogPrintf(CTDL_DEBUG, "cdb_*: Setting up DB environment\n");
        db_env_set_func_yield(sched_yield);
        ret = db_env_create(&dbenv, 0);
        if (ret) {
-               lprintf(CTDL_EMERG, "cdb_*: db_env_create: %s\n",
+               CtdlLogPrintf(CTDL_EMERG, "cdb_*: db_env_create: %s\n",
                        db_strerror(ret));
                exit(CTDLEXIT_DB);
        }
@@ -309,49 +309,49 @@ void open_databases(void)
         */
        ret = dbenv->set_cachesize(dbenv, 0, 64 * 1024, 0);
        if (ret) {
-               lprintf(CTDL_EMERG, "cdb_*: set_cachesize: %s\n",
+               CtdlLogPrintf(CTDL_EMERG, "cdb_*: set_cachesize: %s\n",
                        db_strerror(ret));
                dbenv->close(dbenv, 0);
                exit(CTDLEXIT_DB);
        }
 
        if ((ret = dbenv->set_lk_detect(dbenv, DB_LOCK_DEFAULT))) {
-               lprintf(CTDL_EMERG, "cdb_*: set_lk_detect: %s\n",
+               CtdlLogPrintf(CTDL_EMERG, "cdb_*: set_lk_detect: %s\n",
                        db_strerror(ret));
                dbenv->close(dbenv, 0);
                exit(CTDLEXIT_DB);
        }
 
        flags = DB_CREATE | DB_INIT_MPOOL | DB_PRIVATE | DB_INIT_TXN | DB_INIT_LOCK | DB_THREAD | DB_RECOVER;
-       lprintf(CTDL_DEBUG, "dbenv->open(dbenv, %s, %d, 0)\n", ctdl_data_dir, flags);
+       CtdlLogPrintf(CTDL_DEBUG, "dbenv->open(dbenv, %s, %d, 0)\n", ctdl_data_dir, flags);
        ret = dbenv->open(dbenv, ctdl_data_dir, flags, 0);
        if (ret == DB_RUNRECOVERY) {
-               lprintf(CTDL_ALERT, "dbenv->open: %s\n", db_strerror(ret));
-               lprintf(CTDL_ALERT, "Attempting recovery...\n");
+               CtdlLogPrintf(CTDL_ALERT, "dbenv->open: %s\n", db_strerror(ret));
+               CtdlLogPrintf(CTDL_ALERT, "Attempting recovery...\n");
                flags |= DB_RECOVER;
                ret = dbenv->open(dbenv, ctdl_data_dir, flags, 0);
        }
        if (ret == DB_RUNRECOVERY) {
-               lprintf(CTDL_ALERT, "dbenv->open: %s\n", db_strerror(ret));
-               lprintf(CTDL_ALERT, "Attempting catastrophic recovery...\n");
+               CtdlLogPrintf(CTDL_ALERT, "dbenv->open: %s\n", db_strerror(ret));
+               CtdlLogPrintf(CTDL_ALERT, "Attempting catastrophic recovery...\n");
                flags &= ~DB_RECOVER;
                flags |= DB_RECOVER_FATAL;
                ret = dbenv->open(dbenv, ctdl_data_dir, flags, 0);
        }
        if (ret) {
-               lprintf(CTDL_DEBUG, "dbenv->open: %s\n", db_strerror(ret));
+               CtdlLogPrintf(CTDL_DEBUG, "dbenv->open: %s\n", db_strerror(ret));
                dbenv->close(dbenv, 0);
                exit(CTDLEXIT_DB);
        }
 
-       lprintf(CTDL_INFO, "Starting up DB\n");
+       CtdlLogPrintf(CTDL_INFO, "Starting up DB\n");
 
        for (i = 0; i < MAXCDB; ++i) {
 
                /* Create a database handle */
                ret = db_create(&dbp[i], dbenv, 0);
                if (ret) {
-                       lprintf(CTDL_DEBUG, "db_create: %s\n",
+                       CtdlLogPrintf(CTDL_DEBUG, "db_create: %s\n",
                                db_strerror(ret));
                        exit(CTDLEXIT_DB);
                }
@@ -370,7 +370,7 @@ void open_databases(void)
                                   DB_CREATE | DB_AUTO_COMMIT | DB_THREAD,
                                   0600);
                if (ret) {
-                       lprintf(CTDL_EMERG, "db_open[%d]: %s\n", i,
+                       CtdlLogPrintf(CTDL_EMERG, "db_open[%d]: %s\n", i,
                                db_strerror(ret));
                        exit(CTDLEXIT_DB);
                }
@@ -393,10 +393,10 @@ void cdb_chmod_data(void) {
                        if (d->d_name[0] != '.') {
                                snprintf(filename, sizeof filename,
                                         "%s/%s", ctdl_data_dir, d->d_name);
-                               lprintf(9, "chmod(%s, 0600) returned %d\n",
+                               CtdlLogPrintf(9, "chmod(%s, 0600) returned %d\n",
                                        filename, chmod(filename, 0600)
                                );
-                               lprintf(9, "chown(%s, CTDLUID, -1) returned %d\n",
+                               CtdlLogPrintf(9, "chown(%s, CTDLUID, -1) returned %d\n",
                                        filename, chown(filename, CTDLUID, (-1))
                                );
                        }
@@ -404,7 +404,7 @@ void cdb_chmod_data(void) {
                closedir(dp);
        }
 
-       lprintf(CTDL_DEBUG, "open_databases() finished\n");
+       CtdlLogPrintf(CTDL_DEBUG, "open_databases() finished\n");
 
        CtdlRegisterProtoHook(cmd_cull, "CULL", "Cull database logs");
 }
@@ -422,7 +422,7 @@ void close_databases(void)
        ctdl_thread_internal_free_tsd();
        
        if ((ret = dbenv->txn_checkpoint(dbenv, 0, 0, 0))) {
-               lprintf(CTDL_EMERG,
+               CtdlLogPrintf(CTDL_EMERG,
                        "txn_checkpoint: %s\n", db_strerror(ret));
        }
 
@@ -433,10 +433,10 @@ void close_databases(void)
 
        /* close the tables */
        for (a = 0; a < MAXCDB; ++a) {
-               lprintf(CTDL_INFO, "Closing database %d\n", a);
+               CtdlLogPrintf(CTDL_INFO, "Closing database %d\n", a);
                ret = dbp[a]->close(dbp[a], 0);
                if (ret) {
-                       lprintf(CTDL_EMERG,
+                       CtdlLogPrintf(CTDL_EMERG,
                                "db_close: %s\n", db_strerror(ret));
                }
 
@@ -445,7 +445,7 @@ void close_databases(void)
        /* Close the handle. */
        ret = dbenv->close(dbenv, 0);
        if (ret) {
-               lprintf(CTDL_EMERG,
+               CtdlLogPrintf(CTDL_EMERG,
                        "DBENV->close: %s\n", db_strerror(ret));
        }
 }
@@ -485,7 +485,7 @@ void cdb_decompress_if_necessary(struct cdbdata *cdb)
                       (uLongf *) & destLen,
                       (const Bytef *) compressed_data,
                       (uLong) sourceLen) != Z_OK) {
-               lprintf(CTDL_EMERG, "uncompress() error\n");
+               CtdlLogPrintf(CTDL_EMERG, "uncompress() error\n");
                abort();
        }
 
@@ -538,7 +538,7 @@ int cdb_store(int cdb, void *ckey, int ckeylen, void *cdata, int cdatalen)
                                                CtdlCompressHeader)),
                              &destLen, (Bytef *) cdata, (uLongf) cdatalen,
                              1) != Z_OK) {
-                       lprintf(CTDL_EMERG, "compress2() error\n");
+                       CtdlLogPrintf(CTDL_EMERG, "compress2() error\n");
                        abort();
                }
                zheader.compressed_len = (size_t) destLen;
@@ -557,7 +557,7 @@ int cdb_store(int cdb, void *ckey, int ckeylen, void *cdata, int cdatalen)
                                    &ddata,     /* data */
                                    0); /* flags */
                if (ret) {
-                       lprintf(CTDL_EMERG, "cdb_store(%d): %s\n", cdb,
+                       CtdlLogPrintf(CTDL_EMERG, "cdb_store(%d): %s\n", cdb,
                                db_strerror(ret));
                        abort();
                }
@@ -583,7 +583,7 @@ int cdb_store(int cdb, void *ckey, int ckeylen, void *cdata, int cdatalen)
                                txabort(tid);
                                goto retry;
                        } else {
-                               lprintf(CTDL_EMERG, "cdb_store(%d): %s\n",
+                               CtdlLogPrintf(CTDL_EMERG, "cdb_store(%d): %s\n",
                                        cdb, db_strerror(ret));
                                abort();
                        }
@@ -616,7 +616,7 @@ int cdb_delete(int cdb, void *key, int keylen)
        if (MYTID != NULL) {
                ret = dbp[cdb]->del(dbp[cdb], MYTID, &dkey, 0);
                if (ret) {
-                       lprintf(CTDL_EMERG, "cdb_delete(%d): %s\n", cdb,
+                       CtdlLogPrintf(CTDL_EMERG, "cdb_delete(%d): %s\n", cdb,
                                db_strerror(ret));
                        if (ret != DB_NOTFOUND)
                                abort();
@@ -634,7 +634,7 @@ int cdb_delete(int cdb, void *key, int keylen)
                                txabort(tid);
                                goto retry;
                        } else {
-                               lprintf(CTDL_EMERG, "cdb_delete(%d): %s\n",
+                               CtdlLogPrintf(CTDL_EMERG, "cdb_delete(%d): %s\n",
                                        cdb, db_strerror(ret));
                                abort();
                        }
@@ -658,7 +658,7 @@ static DBC *localcursor(int cdb)
                                          DB_POSITION);
 
        if (ret) {
-               lprintf(CTDL_EMERG, "localcursor: %s\n", db_strerror(ret));
+               CtdlLogPrintf(CTDL_EMERG, "localcursor: %s\n", db_strerror(ret));
                abort();
        }
 
@@ -703,7 +703,7 @@ struct cdbdata *cdb_fetch(int cdb, void *key, int keylen)
        }
 
        if ((ret != 0) && (ret != DB_NOTFOUND)) {
-               lprintf(CTDL_EMERG, "cdb_fetch(%d): %s\n", cdb,
+               CtdlLogPrintf(CTDL_EMERG, "cdb_fetch(%d): %s\n", cdb,
                        db_strerror(ret));
                abort();
        }
@@ -713,7 +713,7 @@ struct cdbdata *cdb_fetch(int cdb, void *key, int keylen)
        tempcdb = (struct cdbdata *) malloc(sizeof(struct cdbdata));
 
        if (tempcdb == NULL) {
-               lprintf(CTDL_EMERG,
+               CtdlLogPrintf(CTDL_EMERG,
                        "cdb_fetch: Cannot allocate memory for tempcdb\n");
                abort();
        }
@@ -761,7 +761,7 @@ void cdb_rewind(int cdb)
        int ret = 0;
 
        if (MYCURSORS[cdb] != NULL) {
-               lprintf(CTDL_EMERG,
+               CtdlLogPrintf(CTDL_EMERG,
                        "cdb_rewind: must close cursor on database %d before reopening.\n",
                        cdb);
                abort();
@@ -773,7 +773,7 @@ void cdb_rewind(int cdb)
         */
        ret = dbp[cdb]->cursor(dbp[cdb], MYTID, &MYCURSORS[cdb], 0);
        if (ret) {
-               lprintf(CTDL_EMERG, "cdb_rewind: db_cursor: %s\n",
+               CtdlLogPrintf(CTDL_EMERG, "cdb_rewind: db_cursor: %s\n",
                        db_strerror(ret));
                abort();
        }
@@ -799,7 +799,7 @@ struct cdbdata *cdb_next_item(int cdb)
 
        if (ret) {
                if (ret != DB_NOTFOUND) {
-                       lprintf(CTDL_EMERG, "cdb_next_item(%d): %s\n",
+                       CtdlLogPrintf(CTDL_EMERG, "cdb_next_item(%d): %s\n",
                                cdb, db_strerror(ret));
                        abort();
                }
@@ -831,7 +831,7 @@ void cdb_begin_transaction(void)
                     "can't begin transaction during r/o cursor");
 
        if (MYTID != NULL) {
-               lprintf(CTDL_EMERG,
+               CtdlLogPrintf(CTDL_EMERG,
                        "cdb_begin_transaction: ERROR: nested transaction\n");
                abort();
        }
@@ -845,7 +845,7 @@ void cdb_end_transaction(void)
 
        for (i = 0; i < MAXCDB; i++)
                if (MYCURSORS[i] != NULL) {
-                       lprintf(CTDL_WARNING,
+                       CtdlLogPrintf(CTDL_WARNING,
                                "cdb_end_transaction: WARNING: cursor %d still open at transaction end\n",
                                i);
                        cclose(MYCURSORS[i]);
@@ -853,7 +853,7 @@ void cdb_end_transaction(void)
                }
 
        if (MYTID == NULL) {
-               lprintf(CTDL_EMERG,
+               CtdlLogPrintf(CTDL_EMERG,
                        "cdb_end_transaction: ERROR: txcommit(NULL) !!\n");
                abort();
        } else
@@ -872,7 +872,7 @@ void cdb_trunc(int cdb)
        u_int32_t count;
 
        if (MYTID != NULL) {
-               lprintf(CTDL_EMERG,
+               CtdlLogPrintf(CTDL_EMERG,
                        "cdb_trunc must not be called in a transaction.\n");
                abort();
        } else {
@@ -890,7 +890,7 @@ void cdb_trunc(int cdb)
                                /* txabort(tid); */
                                goto retry;
                        } else {
-                               lprintf(CTDL_EMERG,
+                               CtdlLogPrintf(CTDL_EMERG,
                                        "cdb_truncate(%d): %s\n", cdb,
                                        db_strerror(ret));
                                abort();
index fda55e86e2f98d0dd0066d63412e96460b97cb7d..ac9d24c2a1e85fb537e6dd9a1d847161d8716345 100644 (file)
@@ -147,7 +147,7 @@ int getmx(char *mxbuf, char *dest) {
        
                for (qdcount = ntohs(answer.header.qdcount); qdcount--; ptr += ret + QFIXEDSZ) {
                        if ((ret = dn_skipname(ptr, endptr)) < 0) {
-                               lprintf(CTDL_DEBUG, "dn_skipname error\n");
+                               CtdlLogPrintf(CTDL_DEBUG, "dn_skipname error\n");
                                return(0);
                        }
                }
index a030842cdda96451683abef5946aa0b4a359d240..4663046522e2f3eb80f283d843a0cf1fd659f3ff 100644 (file)
@@ -172,7 +172,7 @@ static void outputPrintf(char *format, ...)
                syslog( LOG_CRIT|LOG_NDELAY|LOG_MAIL, StrBuf);
        }
        else
-               lprintf(CTDL_EMERG, format, ap);
+               CtdlLogPrintf(CTDL_EMERG, format, ap);
 
 } // outputPrintf
 
@@ -197,7 +197,7 @@ static void createGlobalBacktrace( void )
                }
        else 
                for (NThread = 0; NThread < size; NThread++) 
-                       lprintf(1, "RAW: %p\n", stack_frames[NThread]);
+                       CtdlLogPrintf(1, "RAW: %p\n", stack_frames[NThread]);
        strings = backtrace_symbols(stack_frames, size);
        for (NThread = 0; NThread < size; NThread++) {
                if (strings != NULL) {
@@ -207,7 +207,7 @@ static void createGlobalBacktrace( void )
                                syslog( LOG_CRIT|LOG_NDELAY|LOG_MAIL, StrBuf);
                        }
                        else
-                               lprintf(1, "%s\n", strings[NThread]);
+                               CtdlLogPrintf(1, "%s\n", strings[NThread]);
                }
        }
 } /* createGlobalBacktrace */
@@ -223,7 +223,7 @@ static void outputRawtrace( void )
                }
        else 
                for (NThread = 0; NThread < size; NThread++) 
-                       lprintf(1, "RAW: %p\n", stack_frames[NThread]);
+                       CtdlLogPrintf(1, "RAW: %p\n", stack_frames[NThread]);
 } /* createGlobalBacktrace */
 
 /*!
index 1e87e25d226cf9134d6a141afa7dd80b4ca7c390..ce9ebd350d1f22ae4b14772c7570b675d0b704e0 100644 (file)
@@ -94,7 +94,7 @@ long locate_message_by_euid(char *euid, struct ctdlroom *qrbuf) {
        struct cdbdata *cdb_euid;
        long msgnum = (-1L);
 
-       lprintf(CTDL_DEBUG, "Searching for EUID <%s> in <%s>\n", euid, qrbuf->QRname);
+       CtdlLogPrintf(CTDL_DEBUG, "Searching for EUID <%s> in <%s>\n", euid, qrbuf->QRname);
 
        key_len = strlen(euid) + sizeof(long) + 1;
        key = malloc(key_len);
@@ -114,7 +114,7 @@ long locate_message_by_euid(char *euid, struct ctdlroom *qrbuf) {
                memcpy(&msgnum, cdb_euid->ptr, sizeof(long));
                cdb_free(cdb_euid);
        }
-       lprintf(CTDL_DEBUG, "returning msgnum = %ld\n", msgnum);
+       CtdlLogPrintf(CTDL_DEBUG, "returning msgnum = %ld\n", msgnum);
        return(msgnum);
 }
 
@@ -129,7 +129,7 @@ void index_message_by_euid(char *euid, struct ctdlroom *qrbuf, long msgnum) {
        char *data;
        int data_len;
 
-       lprintf(CTDL_DEBUG, "Indexing message #%ld <%s> in <%s>\n", msgnum, euid, qrbuf->QRname);
+       CtdlLogPrintf(CTDL_DEBUG, "Indexing message #%ld <%s> in <%s>\n", msgnum, euid, qrbuf->QRname);
 
        key_len = strlen(euid) + sizeof(long) + 1;
        key = malloc(key_len);
@@ -187,7 +187,7 @@ void rebuild_euid_index_for_room(struct ctdlroom *qrbuf, void *data) {
        while (rplist != NULL) {
                if (getroom(&qr, rplist->name) == 0) {
                        if (DoesThisRoomNeedEuidIndexing(&qr)) {
-                               lprintf(CTDL_DEBUG,
+                               CtdlLogPrintf(CTDL_DEBUG,
                                        "Rebuilding EUID index for <%s>\n",
                                        rplist->name);
                                usergoto(rplist->name, 0, 0, NULL, NULL);
index daceb3be24792b70c3f1d5bc6cca6825145a7d8b..35b09a121147668fa63754db59bc3c8cef6776da 100644 (file)
@@ -97,7 +97,7 @@ int network_talking_to(char *nodename, int operation) {
                        break;
        }
 
-       if (nttlist != NULL) lprintf(CTDL_DEBUG, "nttlist=<%s>\n", nttlist);
+       if (nttlist != NULL) CtdlLogPrintf(CTDL_DEBUG, "nttlist=<%s>\n", nttlist);
        end_critical_section(S_NTTLIST);
        return(retval);
 }
index d3c7ed5d893e5282b34eb3d6b6086bda77f02683..463af2f0cc2985280b37fbcb9173ab26e49ed98d 100644 (file)
@@ -40,13 +40,13 @@ icaltimezone *get_default_icaltimezone(void) {
                 zone = icaltimezone_get_builtin_timezone(default_zone_name);
         }
         if (!zone) {
-               lprintf(CTDL_ALERT,
+               CtdlLogPrintf(CTDL_ALERT,
                        "Unable to load '%s' time zone.  Defaulting to UTC.\n",
                        default_zone_name);
                 zone = icaltimezone_get_utc_timezone();
        }
        if (!zone) {
-               lprintf(1, "Unable to load UTC time zone!\n");
+               CtdlLogPrintf(1, "Unable to load UTC time zone!\n");
        }
         return zone;
 }
@@ -81,14 +81,14 @@ void ical_dezonify_backend(icalcomponent *cal,
 
                /* Convert it to an icaltimezone type. */
                if (tzid != NULL) {
-                       /* lprintf(9, "                * Stringy supplied timezone is: '%s'\n", tzid); */
+                       /* CtdlLogPrintf(9, "                * Stringy supplied timezone is: '%s'\n", tzid); */
                        if ( (!strcasecmp(tzid, "UTC")) || (!strcasecmp(tzid, "GMT")) ) {
                                utc_declared_as_tzid = 1;
-                               /* lprintf(9, "                * ...and we handle that internally.\n"); */
+                               /* CtdlLogPrintf(9, "                * ...and we handle that internally.\n"); */
                        }
                        else {
                                t = icalcomponent_get_timezone(cal, tzid);
-                               /* lprintf(9, "                * ...and I %s have tzdata for that zone.\n",
+                               /* CtdlLogPrintf(9, "                * ...and I %s have tzdata for that zone.\n",
                                        (t ? "DO" : "DO NOT")
                                ); */
                        }
@@ -114,24 +114,24 @@ void ical_dezonify_backend(icalcomponent *cal,
                return;
        }
 
-       /* lprintf(9, "                * Was: %s\n", icaltime_as_ical_string(TheTime)); */
+       /* CtdlLogPrintf(9, "                * Was: %s\n", icaltime_as_ical_string(TheTime)); */
 
        if (TheTime.is_utc) {
-               /* lprintf(9, "                * This property is ALREADY UTC.\n"); */
+               /* CtdlLogPrintf(9, "                * This property is ALREADY UTC.\n"); */
        }
 
        else if (utc_declared_as_tzid) {
-               /* lprintf(9, "                * Replacing '%s' TZID with 'Z' suffix.\n", tzid); */
+               /* CtdlLogPrintf(9, "                * Replacing '%s' TZID with 'Z' suffix.\n", tzid); */
                TheTime.is_utc = 1;
        }
 
        else {
                /* Do the conversion. */
                if (t != NULL) {
-                       /* lprintf(9, "                * Timezone prop found.  Converting to UTC.\n"); */
+                       /* CtdlLogPrintf(9, "                * Timezone prop found.  Converting to UTC.\n"); */
                }
                else {
-                       /* lprintf(9, "                * Converting default timezone to UTC.\n"); */
+                       /* CtdlLogPrintf(9, "                * Converting default timezone to UTC.\n"); */
                }
 
                if (t == NULL) {
@@ -146,7 +146,7 @@ void ical_dezonify_backend(icalcomponent *cal,
        }
 
        icalproperty_remove_parameter_by_kind(prop, ICAL_TZID_PARAMETER);
-       /* lprintf(9, "                * Now: %s\n", icaltime_as_ical_string(TheTime)); */
+       /* CtdlLogPrintf(9, "                * Now: %s\n", icaltime_as_ical_string(TheTime)); */
 
        /* Now add the converted property back in. */
        if (icalproperty_isa(prop) == ICAL_DTSTART_PROPERTY) {
@@ -212,7 +212,7 @@ void ical_dezonify_recurse(icalcomponent *cal, icalcomponent *rcal) {
 void ical_dezonify(icalcomponent *cal) {
        icalcomponent *vt = NULL;
 
-       /* lprintf(9, "ical_dezonify() started\n"); */
+       /* CtdlLogPrintf(9, "ical_dezonify() started\n"); */
 
        /* Convert all times to UTC */
        ical_dezonify_recurse(cal, cal);
@@ -224,5 +224,5 @@ void ical_dezonify(icalcomponent *cal) {
                icalcomponent_free(vt);
        }
 
-       /* lprintf(9, "ical_dezonify() completed\n"); */
+       /* CtdlLogPrintf(9, "ical_dezonify() completed\n"); */
 }
index 1b414be7de8e8d19f6cb6b820a19b59825175db0..ebc419f6abfbc60444615a81e9b28435cfcaf94c 100644 (file)
@@ -336,7 +336,7 @@ int convert_field(struct CtdlMessage *msg, int beg, int end) {
 
        else if (!strcasecmp(key, "From")) {
                process_rfc822_addr(value, user, node, name);
-               lprintf(CTDL_DEBUG, "Converted to <%s@%s> (%s)\n", user, node, name);
+               CtdlLogPrintf(CTDL_DEBUG, "Converted to <%s@%s> (%s)\n", user, node, name);
                snprintf(addr, sizeof addr, "%s@%s", user, node);
                if (msg->cm_fields['A'] == NULL)
                        msg->cm_fields['A'] = strdup(name);
@@ -366,7 +366,7 @@ int convert_field(struct CtdlMessage *msg, int beg, int end) {
 
        else if (!strcasecmp(key, "Message-ID")) {
                if (msg->cm_fields['I'] != NULL) {
-                       lprintf(CTDL_WARNING, "duplicate message id\n");
+                       CtdlLogPrintf(CTDL_WARNING, "duplicate message id\n");
                }
 
                if (msg->cm_fields['I'] == NULL) {
@@ -560,7 +560,7 @@ void directory_key(char *key, char *addr) {
        }
        key[keylen++] = 0;
 
-       lprintf(CTDL_DEBUG, "Directory key is <%s>\n", key);
+       CtdlLogPrintf(CTDL_DEBUG, "Directory key is <%s>\n", key);
 }
 
 
@@ -603,7 +603,7 @@ void CtdlDirectoryInit(void) {
 void CtdlDirectoryAddUser(char *internet_addr, char *citadel_addr) {
        char key[SIZ];
 
-       lprintf(CTDL_DEBUG, "Dir: %s --> %s\n",
+       CtdlLogPrintf(CTDL_DEBUG, "Dir: %s --> %s\n",
                internet_addr, citadel_addr);
        if (IsDirectory(internet_addr, 0) == 0) return;
 
index 4df8e19e72b29c8aae6d1aec44ef75e301c9860d..f4d45f47fa4147798ff995d9f8e15f4d6558875f 100644 (file)
@@ -278,7 +278,7 @@ int rbl_check_addr(struct in_addr *addr, char *message_to_spammer)
 
                if (rblcheck_backend(tbuf, txt_answer, sizeof txt_answer)) {
                        sprintf(message_to_spammer, "5.7.1 %s", txt_answer);
-                       lprintf(CTDL_INFO, "RBL: %s\n", txt_answer);
+                       CtdlLogPrintf(CTDL_INFO, "RBL: %s\n", txt_answer);
                        return(1);
                }
        }
index 63a23fddc81f3fcd67891f787d6789ca163c498a..96f3ee74baafc4a121c886fc519c3f439e359725 100755 (executable)
@@ -144,7 +144,7 @@ do
                RES_OUT=`echo $RES | cut -b2-`
                /usr/bin/printf "Found entry point in file $i\n"
 cat <<EOF  >> $C_FILE
-       lprintf (CTDL_INFO, "%s\n", CTDL_INIT_CALL($RES_OUT));
+       CtdlLogPrintf (CTDL_INFO, "%s\n", CTDL_INIT_CALL($RES_OUT));
 
 EOF
 cat <<EOF >>$H_FILE
@@ -156,7 +156,7 @@ EOF
                RES_OUT=`echo $RES | cut -b2-`
                /usr/bin/printf "Found upgrade point in file $i\n"
 cat <<EOF  >> $U_FILE
-       lprintf (CTDL_INFO, "%s\n", CTDL_UPGRADE_CALL($RES_OUT));
+       CtdlLogPrintf (CTDL_INFO, "%s\n", CTDL_UPGRADE_CALL($RES_OUT));
 
 EOF
 cat <<EOF >>$H_FILE
@@ -194,7 +194,7 @@ EOF
                                                /usr/bin/printf "Found entry point in file modules/$j/$k\n"
 # Add this entry point to the .c file
 cat <<EOF >> $C_FILE
-       lprintf (CTDL_INFO, "%s\n", CTDL_INIT_CALL($RES_OUT));
+       CtdlLogPrintf (CTDL_INFO, "%s\n", CTDL_INIT_CALL($RES_OUT));
 EOF
 # Add this entry point to the .h file
 cat <<EOF >> $H_FILE
@@ -207,7 +207,7 @@ EOF
                                                /usr/bin/printf "Found upgrade point in file modules/$j/$k\n"
 # Add this entry point to the .c file
 cat <<EOF >> $U_FILE
-       lprintf (CTDL_INFO, "%s\n", CTDL_UPGRADE_CALL($RES_OUT));
+       CtdlLogPrintf (CTDL_INFO, "%s\n", CTDL_UPGRADE_CALL($RES_OUT));
 EOF
 # Add this entry point to the .h file
 cat <<EOF >> $H_FILE
@@ -250,7 +250,7 @@ EOF
                                                RES_OUT=`echo $RES | cut -b2-`
                                                /usr/bin/printf "Found entry point in file user_modules/$j/$k\n"
 cat <<EOF >> $C_FILE
-       lprintf (CTDL_INFO, "%s\n", CTDL_INIT_CALL($RES_OUT));
+       CtdlLogPrintf (CTDL_INFO, "%s\n", CTDL_INIT_CALL($RES_OUT));
 EOF
 cat <<EOF >> $H_FILE
 CTDL_MODULE_INIT($RES_OUT);
@@ -261,7 +261,7 @@ EOF
                                                RES_OUT=`echo $RES | cut -b2-`
                                                /usr/bin/printf "Found upgrade point in file user_modules/$j/$k\n"
 cat <<EOF >> $U_FILE
-       lprintf (CTDL_INFO, "%s\n", CTDL_UPGRADE_CALL($RES_OUT));
+       CtdlLogPrintf (CTDL_INFO, "%s\n", CTDL_UPGRADE_CALL($RES_OUT));
 EOF
 cat <<EOF >> $H_FILE
 CTDL_MODULE_UPGRADE($RES_OUT);
index 7e0ed46ab22734533ed81baa9837ab9254833d86..21d2e3d0451d21c96f7329514946323b4b1ffb67 100644 (file)
@@ -52,7 +52,7 @@ icalcomponent *icalcomponent_new_citadel_vcalendar(void) {
 
        encaps = icalcomponent_new_vcalendar();
        if (encaps == NULL) {
-               lprintf(CTDL_CRIT, "Error at %s:%d - could not allocate component!\n",
+               CtdlLogPrintf(CTDL_CRIT, "Error at %s:%d - could not allocate component!\n",
                        __FILE__, __LINE__);
                return NULL;
        }
@@ -233,13 +233,13 @@ void ical_send_a_reply(icalcomponent *request, char *action) {
        strcpy(summary_string, "Calendar item");
 
        if (request == NULL) {
-               lprintf(CTDL_ERR, "ERROR: trying to reply to NULL event?\n");
+               CtdlLogPrintf(CTDL_ERR, "ERROR: trying to reply to NULL event?\n");
                return;
        }
 
        the_reply = icalcomponent_new_clone(request);
        if (the_reply == NULL) {
-               lprintf(CTDL_ERR, "ERROR: cannot clone request\n");
+               CtdlLogPrintf(CTDL_ERR, "ERROR: cannot clone request\n");
                return;
        }
 
@@ -642,13 +642,13 @@ int ical_update_my_calendar_with_reply(icalcomponent *cal) {
        /* Figure out just what event it is we're dealing with */
        strcpy(uid, "--==<< InVaLiD uId >>==--");
        ical_learn_uid_of_reply(uid, cal);
-       lprintf(CTDL_DEBUG, "UID of event being replied to is <%s>\n", uid);
+       CtdlLogPrintf(CTDL_DEBUG, "UID of event being replied to is <%s>\n", uid);
 
        strcpy(hold_rm, CC->room.QRname);       /* save current room */
 
        if (getroom(&CC->room, USERCALENDARROOM) != 0) {
                getroom(&CC->room, hold_rm);
-               lprintf(CTDL_CRIT, "cannot get user calendar room\n");
+               CtdlLogPrintf(CTDL_CRIT, "cannot get user calendar room\n");
                return(2);
        }
 
@@ -662,7 +662,7 @@ int ical_update_my_calendar_with_reply(icalcomponent *cal) {
 
        getroom(&CC->room, hold_rm);    /* return to saved room */
 
-       lprintf(CTDL_DEBUG, "msgnum_being_replaced == %ld\n", msgnum_being_replaced);
+       CtdlLogPrintf(CTDL_DEBUG, "msgnum_being_replaced == %ld\n", msgnum_being_replaced);
        if (msgnum_being_replaced == 0) {
                return(1);                      /* no calendar event found */
        }
@@ -689,7 +689,7 @@ int ical_update_my_calendar_with_reply(icalcomponent *cal) {
 
        original_event = oec.c;
        if (original_event == NULL) {
-               lprintf(CTDL_ERR, "ERROR: Original_component is NULL.\n");
+               CtdlLogPrintf(CTDL_ERR, "ERROR: Original_component is NULL.\n");
                return(2);
        }
 
@@ -1214,7 +1214,7 @@ void ical_freebusy(char *who) {
        if (found_user != 0) {
                strcpy(buf, who);
                recp = validate_recipients(buf, NULL, 0);
-               lprintf(CTDL_DEBUG, "Trying <%s>\n", buf);
+               CtdlLogPrintf(CTDL_DEBUG, "Trying <%s>\n", buf);
                if (recp != NULL) {
                        if (recp->num_local == 1) {
                                found_user = getuser(&usbuf, recp->recp_local);
@@ -1228,7 +1228,7 @@ void ical_freebusy(char *who) {
         */
        if (found_user != 0) {
                snprintf(buf, sizeof buf, "%s@%s", who, config.c_fqdn);
-               lprintf(CTDL_DEBUG, "Trying <%s>\n", buf);
+               CtdlLogPrintf(CTDL_DEBUG, "Trying <%s>\n", buf);
                recp = validate_recipients(buf, NULL, 0);
                if (recp != NULL) {
                        if (recp->num_local == 1) {
@@ -1251,7 +1251,7 @@ void ical_freebusy(char *who) {
                        if ( (!strcasecmp(type, "localhost"))
                           || (!strcasecmp(type, "directory")) ) {
                                snprintf(buf, sizeof buf, "%s@%s", who, host);
-                               lprintf(CTDL_DEBUG, "Trying <%s>\n", buf);
+                               CtdlLogPrintf(CTDL_DEBUG, "Trying <%s>\n", buf);
                                recp = validate_recipients(buf, NULL, 0);
                                if (recp != NULL) {
                                        if (recp->num_local == 1) {
@@ -1280,7 +1280,7 @@ void ical_freebusy(char *who) {
        }
 
        /* Create a VFREEBUSY subcomponent */
-       lprintf(CTDL_DEBUG, "Creating VFREEBUSY component\n");
+       CtdlLogPrintf(CTDL_DEBUG, "Creating VFREEBUSY component\n");
        fb = icalcomponent_new_vfreebusy();
        if (fb == NULL) {
                cprintf("%d Internal error: cannot allocate memory.\n",
@@ -1307,7 +1307,7 @@ void ical_freebusy(char *who) {
        icalcomponent_add_property(fb, icalproperty_new_organizer(buf));
 
        /* Add busy time from events */
-       lprintf(CTDL_DEBUG, "Adding busy time from events\n");
+       CtdlLogPrintf(CTDL_DEBUG, "Adding busy time from events\n");
        CtdlForEachMessage(MSGS_ALL, 0, NULL, NULL, NULL, ical_freebusy_backend, (void *)fb );
 
        /* If values for DTSTART and DTEND are still not present, set them
@@ -1321,7 +1321,7 @@ void ical_freebusy(char *who) {
        }
 
        /* Put the freebusy component into the calendar component */
-       lprintf(CTDL_DEBUG, "Encapsulating\n");
+       CtdlLogPrintf(CTDL_DEBUG, "Encapsulating\n");
        encaps = ical_encapsulate_subcomponent(fb);
        if (encaps == NULL) {
                icalcomponent_free(fb);
@@ -1332,11 +1332,11 @@ void ical_freebusy(char *who) {
        }
 
        /* Set the method to PUBLISH */
-       lprintf(CTDL_DEBUG, "Setting method\n");
+       CtdlLogPrintf(CTDL_DEBUG, "Setting method\n");
        icalcomponent_set_method(encaps, ICAL_METHOD_PUBLISH);
 
        /* Serialize it */
-       lprintf(CTDL_DEBUG, "Serializing\n");
+       CtdlLogPrintf(CTDL_DEBUG, "Serializing\n");
        serialized_request = strdup(icalcomponent_as_ical_string(encaps));
        icalcomponent_free(encaps);     /* Don't need this anymore. */
 
@@ -1428,7 +1428,7 @@ void ical_getics(void)
 
        encaps = icalcomponent_new_vcalendar();
        if (encaps == NULL) {
-               lprintf(CTDL_DEBUG, "Error at %s:%d - could not allocate component!\n",
+               CtdlLogPrintf(CTDL_DEBUG, "Error at %s:%d - could not allocate component!\n",
                        __FILE__, __LINE__);
                cprintf("%d Could not allocate memory\n", ERROR+INTERNAL_ERROR);
                return;
@@ -1610,7 +1610,7 @@ void ical_create_room(void)
 
        /* Set expiration policy to manual; otherwise objects will be lost! */
        if (lgetroom(&qr, USERCALENDARROOM)) {
-               lprintf(CTDL_CRIT, "Couldn't get the user calendar room!\n");
+               CtdlLogPrintf(CTDL_CRIT, "Couldn't get the user calendar room!\n");
                return;
        }
        qr.QRep.expire_mode = EXPIRE_MANUAL;
@@ -1627,7 +1627,7 @@ void ical_create_room(void)
 
        /* Set expiration policy to manual; otherwise objects will be lost! */
        if (lgetroom(&qr, USERTASKSROOM)) {
-               lprintf(CTDL_CRIT, "Couldn't get the user calendar room!\n");
+               CtdlLogPrintf(CTDL_CRIT, "Couldn't get the user calendar room!\n");
                return;
        }
        qr.QRep.expire_mode = EXPIRE_MANUAL;
@@ -1644,7 +1644,7 @@ void ical_create_room(void)
 
        /* Set expiration policy to manual; otherwise objects will be lost! */
        if (lgetroom(&qr, USERNOTESROOM)) {
-               lprintf(CTDL_CRIT, "Couldn't get the user calendar room!\n");
+               CtdlLogPrintf(CTDL_CRIT, "Couldn't get the user calendar room!\n");
                return;
        }
        qr.QRep.expire_mode = EXPIRE_MANUAL;
@@ -1680,7 +1680,7 @@ void ical_send_out_invitations(icalcomponent *cal) {
        size_t reqsize;
 
        if (cal == NULL) {
-               lprintf(CTDL_ERR, "ERROR: trying to reply to NULL event?\n");
+               CtdlLogPrintf(CTDL_ERR, "ERROR: trying to reply to NULL event?\n");
                return;
        }
 
@@ -1698,7 +1698,7 @@ void ical_send_out_invitations(icalcomponent *cal) {
        /* Clone the event */
        the_request = icalcomponent_new_clone(cal);
        if (the_request == NULL) {
-               lprintf(CTDL_ERR, "ERROR: cannot clone calendar object\n");
+               CtdlLogPrintf(CTDL_ERR, "ERROR: cannot clone calendar object\n");
                return;
        }
 
@@ -1734,7 +1734,7 @@ void ical_send_out_invitations(icalcomponent *cal) {
                }
        }
 
-       lprintf(CTDL_DEBUG, "<%d> attendees: <%s>\n", num_attendees, attendees_string);
+       CtdlLogPrintf(CTDL_DEBUG, "<%d> attendees: <%s>\n", num_attendees, attendees_string);
 
        /* If there are no attendees, there are no invitations to send, so...
         * don't bother putting one together!  Punch out, Maverick!
@@ -1747,7 +1747,7 @@ void ical_send_out_invitations(icalcomponent *cal) {
        /* Encapsulate the VEVENT component into a complete VCALENDAR */
        encaps = icalcomponent_new_vcalendar();
        if (encaps == NULL) {
-               lprintf(CTDL_DEBUG, "Error at %s:%d - could not allocate component!\n",
+               CtdlLogPrintf(CTDL_DEBUG, "Error at %s:%d - could not allocate component!\n",
                        __FILE__, __LINE__);
                icalcomponent_free(the_request);
                return;
@@ -1816,7 +1816,7 @@ void ical_saving_vevent(icalcomponent *cal) {
        icalproperty *organizer = NULL;
        char organizer_string[SIZ];
 
-       lprintf(CTDL_DEBUG, "ical_saving_vevent() has been called!\n");
+       CtdlLogPrintf(CTDL_DEBUG, "ical_saving_vevent() has been called!\n");
 
        /* Don't send out invitations unless the client wants us to. */
        if (CIT_ICAL->server_generated_invitations == 0) {
@@ -1966,7 +1966,7 @@ int ical_obj_beforesave(struct CtdlMessage *msg)
 
        /* It must be an RFC822 message! */
        if (msg->cm_format_type != 4) {
-               lprintf(CTDL_DEBUG, "Rejecting non-RFC822 message\n");
+               CtdlLogPrintf(CTDL_DEBUG, "Rejecting non-RFC822 message\n");
                return(1);              /* You tried to save a non-RFC822 message! */
        }
 
@@ -1990,7 +1990,7 @@ int ical_obj_beforesave(struct CtdlMessage *msg)
                        free(msg->cm_fields['E']);
                }
                msg->cm_fields['E'] = strdup(imm.uid);
-               lprintf(CTDL_DEBUG, "Saving calendar UID <%s>\n", msg->cm_fields['E']);
+               CtdlLogPrintf(CTDL_DEBUG, "Saving calendar UID <%s>\n", msg->cm_fields['E']);
        }
        if (!IsEmptyStr(imm.subject)) {
                if (msg->cm_fields['U'] != NULL) {
index 820153126fceef45b3d7170b58e28f6631ff95f6..4aae87270db84386203a34a875556b3686426a72 100644 (file)
@@ -78,14 +78,14 @@ void init_ssl(void)
                RAND_egd(EGD_POOL);
 
        if (!RAND_status()) {
-               lprintf(CTDL_CRIT,
+               CtdlLogPrintf(CTDL_CRIT,
                        "PRNG not adequately seeded, won't do SSL/TLS\n");
                return;
        }
        SSLCritters =
            malloc(CRYPTO_num_locks() * sizeof(pthread_mutex_t *));
        if (!SSLCritters) {
-               lprintf(CTDL_EMERG, "citserver: can't allocate memory!!\n");
+               CtdlLogPrintf(CTDL_EMERG, "citserver: can't allocate memory!!\n");
                /* Nothing's been initialized, just die */
                exit(1);
        } else {
@@ -94,7 +94,7 @@ void init_ssl(void)
                for (a = 0; a < CRYPTO_num_locks(); a++) {
                        SSLCritters[a] = malloc(sizeof(pthread_mutex_t));
                        if (!SSLCritters[a]) {
-                               lprintf(CTDL_EMERG,
+                               CtdlLogPrintf(CTDL_EMERG,
                                        "citserver: can't allocate memory!!\n");
                                /* Nothing's been initialized, just die */
                                exit(1);
@@ -110,12 +110,12 @@ void init_ssl(void)
        SSL_load_error_strings();
        ssl_method = SSLv23_server_method();
        if (!(ssl_ctx = SSL_CTX_new(ssl_method))) {
-               lprintf(CTDL_CRIT, "SSL_CTX_new failed: %s\n",
+               CtdlLogPrintf(CTDL_CRIT, "SSL_CTX_new failed: %s\n",
                        ERR_reason_error_string(ERR_get_error()));
                return;
        }
        if (!(SSL_CTX_set_cipher_list(ssl_ctx, CIT_CIPHERS))) {
-               lprintf(CTDL_CRIT, "SSL: No ciphers available\n");
+               CtdlLogPrintf(CTDL_CRIT, "SSL: No ciphers available\n");
                SSL_CTX_free(ssl_ctx);
                ssl_ctx = NULL;
                return;
@@ -133,21 +133,21 @@ void init_ssl(void)
        /* Load DH parameters into the context */
        dh = DH_new();
        if (!dh) {
-               lprintf(CTDL_CRIT, "init_ssl() can't allocate a DH object: %s\n",
+               CtdlLogPrintf(CTDL_CRIT, "init_ssl() can't allocate a DH object: %s\n",
                        ERR_reason_error_string(ERR_get_error()));
                SSL_CTX_free(ssl_ctx);
                ssl_ctx = NULL;
                return;
        }
        if (!(BN_hex2bn(&(dh->p), DH_P))) {
-               lprintf(CTDL_CRIT, "init_ssl() can't assign DH_P: %s\n",
+               CtdlLogPrintf(CTDL_CRIT, "init_ssl() can't assign DH_P: %s\n",
                        ERR_reason_error_string(ERR_get_error()));
                SSL_CTX_free(ssl_ctx);
                ssl_ctx = NULL;
                return;
        }
        if (!(BN_hex2bn(&(dh->g), DH_G))) {
-               lprintf(CTDL_CRIT, "init_ssl() can't assign DH_G: %s\n",
+               CtdlLogPrintf(CTDL_CRIT, "init_ssl() can't assign DH_G: %s\n",
                        ERR_reason_error_string(ERR_get_error()));
                SSL_CTX_free(ssl_ctx);
                ssl_ctx = NULL;
@@ -166,13 +166,13 @@ void init_ssl(void)
         * Generate a key pair if we don't have one.
         */
        if (access(file_crpt_file_key, R_OK) != 0) {
-               lprintf(CTDL_INFO, "Generating RSA key pair.\n");
+               CtdlLogPrintf(CTDL_INFO, "Generating RSA key pair.\n");
                rsa = RSA_generate_key(1024,    /* modulus size */
                                        65537,  /* exponent */
                                        NULL,   /* no callback */
                                        NULL);  /* no callback */
                if (rsa == NULL) {
-                       lprintf(CTDL_CRIT, "Key generation failed: %s\n",
+                       CtdlLogPrintf(CTDL_CRIT, "Key generation failed: %s\n",
                                ERR_reason_error_string(ERR_get_error()));
                }
                if (rsa != NULL) {
@@ -187,7 +187,7 @@ void init_ssl(void)
                                                        NULL,   /* no callbk */
                                                        NULL    /* no callbk */
                                ) != 1) {
-                                       lprintf(CTDL_CRIT, "Cannot write key: %s\n",
+                                       CtdlLogPrintf(CTDL_CRIT, "Cannot write key: %s\n",
                                                ERR_reason_error_string(ERR_get_error()));
                                        unlink(file_crpt_file_key);
                                }
@@ -203,7 +203,7 @@ void init_ssl(void)
         * the CSR in this step so that the next step may commence.
         */
        if ( (access(file_crpt_file_cer, R_OK) != 0) && (access(file_crpt_file_csr, R_OK) != 0) ) {
-               lprintf(CTDL_INFO, "Generating a certificate signing request.\n");
+               CtdlLogPrintf(CTDL_INFO, "Generating a certificate signing request.\n");
 
                /*
                 * Read our key from the file.  No, we don't just keep this
@@ -260,7 +260,7 @@ void init_ssl(void)
 
                                        /* Sign the CSR */
                                        if (!X509_REQ_sign(req, pk, EVP_md5())) {
-                                               lprintf(CTDL_CRIT, "X509_REQ_sign(): error\n");
+                                               CtdlLogPrintf(CTDL_CRIT, "X509_REQ_sign(): error\n");
                                        }
                                        else {
                                                /* Write it to disk. */ 
@@ -280,7 +280,7 @@ void init_ssl(void)
                }
 
                else {
-                       lprintf(CTDL_CRIT, "Unable to read private key.\n");
+                       CtdlLogPrintf(CTDL_CRIT, "Unable to read private key.\n");
                }
        }
 
@@ -290,7 +290,7 @@ void init_ssl(void)
         * Generate a self-signed certificate if we don't have one.
         */
        if (access(file_crpt_file_cer, R_OK) != 0) {
-               lprintf(CTDL_INFO, "Generating a self-signed certificate.\n");
+               CtdlLogPrintf(CTDL_INFO, "Generating a self-signed certificate.\n");
 
                /* Same deal as before: always read the key from disk because
                 * it may or may not have just been generated.
@@ -330,7 +330,7 @@ void init_ssl(void)
                                        
                                        /* Sign the cert */
                                        if (!X509_sign(cer, pk, EVP_md5())) {
-                                               lprintf(CTDL_CRIT, "X509_sign(): error\n");
+                                               CtdlLogPrintf(CTDL_CRIT, "X509_sign(): error\n");
                                        }
                                        else {
                                                /* Write it to disk. */ 
@@ -356,7 +356,7 @@ void init_ssl(void)
         SSL_CTX_use_certificate_chain_file(ssl_ctx, file_crpt_file_cer);
         SSL_CTX_use_PrivateKey_file(ssl_ctx, file_crpt_file_key, SSL_FILETYPE_PEM);
         if ( !SSL_CTX_check_private_key(ssl_ctx) ) {
-               lprintf(CTDL_CRIT, "Cannot install certificate: %s\n",
+               CtdlLogPrintf(CTDL_CRIT, "Cannot install certificate: %s\n",
                                ERR_reason_error_string(ERR_get_error()));
         }
 
@@ -382,7 +382,7 @@ void client_write_ssl(char *buf, int nbytes)
        while (nremain > 0) {
                if (SSL_want_write(CC->ssl)) {
                        if ((SSL_read(CC->ssl, junk, 0)) < 1) {
-                               lprintf(CTDL_DEBUG, "SSL_read in client_write: %s\n", ERR_reason_error_string(ERR_get_error()));
+                               CtdlLogPrintf(CTDL_DEBUG, "SSL_read in client_write: %s\n", ERR_reason_error_string(ERR_get_error()));
                        }
                }
                retval =
@@ -396,9 +396,9 @@ void client_write_ssl(char *buf, int nbytes)
                                sleep(1);
                                continue;
                        }
-                       lprintf(CTDL_DEBUG, "SSL_write got error %ld, ret %d\n", errval, retval);
+                       CtdlLogPrintf(CTDL_DEBUG, "SSL_write got error %ld, ret %d\n", errval, retval);
                        if (retval == -1)
-                               lprintf(CTDL_DEBUG, "errno is %d\n", errno);
+                               CtdlLogPrintf(CTDL_DEBUG, "errno is %d\n", errno);
                        endtls();
                        client_write(&buf[nbytes - nremain], nremain);
                        return;
@@ -444,7 +444,7 @@ int client_read_ssl(char *buf, int bytes, int timeout)
 #endif
                if (SSL_want_read(CC->ssl)) {
                        if ((SSL_write(CC->ssl, junk, 0)) < 1) {
-                               lprintf(CTDL_DEBUG, "SSL_write in client_read: %s\n", ERR_reason_error_string(ERR_get_error()));
+                               CtdlLogPrintf(CTDL_DEBUG, "SSL_write in client_read: %s\n", ERR_reason_error_string(ERR_get_error()));
                        }
                }
                rlen = SSL_read(CC->ssl, &buf[len], bytes - len);
@@ -457,7 +457,7 @@ int client_read_ssl(char *buf, int bytes, int timeout)
                                sleep(1);
                                continue;
                        }
-                       lprintf(CTDL_DEBUG, "SSL_read got error %ld\n", errval);
+                       CtdlLogPrintf(CTDL_DEBUG, "SSL_read got error %ld\n", errval);
                        endtls();
                        return (client_read_to
                                (&buf[len], bytes - len, timeout));
@@ -479,18 +479,18 @@ void CtdlStartTLS(char *ok_response, char *nosup_response,
        int retval, bits, alg_bits;
 
        if (!ssl_ctx) {
-               lprintf(CTDL_CRIT, "SSL failed: no ssl_ctx exists?\n");
+               CtdlLogPrintf(CTDL_CRIT, "SSL failed: no ssl_ctx exists?\n");
                if (nosup_response != NULL) cprintf("%s", nosup_response);
                return;
        }
        if (!(CC->ssl = SSL_new(ssl_ctx))) {
-               lprintf(CTDL_CRIT, "SSL_new failed: %s\n",
+               CtdlLogPrintf(CTDL_CRIT, "SSL_new failed: %s\n",
                                ERR_reason_error_string(ERR_get_error()));
                if (error_response != NULL) cprintf("%s", error_response);
                return;
        }
        if (!(SSL_set_fd(CC->ssl, CC->client_socket))) {
-               lprintf(CTDL_CRIT, "SSL_set_fd failed: %s\n",
+               CtdlLogPrintf(CTDL_CRIT, "SSL_set_fd failed: %s\n",
                        ERR_reason_error_string(ERR_get_error()));
                SSL_free(CC->ssl);
                CC->ssl = NULL;
@@ -509,7 +509,7 @@ void CtdlStartTLS(char *ok_response, char *nosup_response,
                char error_string[128];
 
                errval = SSL_get_error(CC->ssl, retval);
-               lprintf(CTDL_CRIT, "SSL_accept failed: retval=%d, errval=%ld, err=%s\n",
+               CtdlLogPrintf(CTDL_CRIT, "SSL_accept failed: retval=%d, errval=%ld, err=%s\n",
                        retval,
                        errval,
                        ERR_error_string(errval, error_string)
@@ -520,7 +520,7 @@ void CtdlStartTLS(char *ok_response, char *nosup_response,
        }
        BIO_set_close(CC->ssl->rbio, BIO_NOCLOSE);
        bits = SSL_CIPHER_get_bits(SSL_get_current_cipher(CC->ssl), &alg_bits);
-       lprintf(CTDL_INFO, "SSL/TLS using %s on %s (%d of %d bits)\n",
+       CtdlLogPrintf(CTDL_INFO, "SSL/TLS using %s on %s (%d of %d bits)\n",
                SSL_CIPHER_get_name(SSL_get_current_cipher(CC->ssl)),
                SSL_CIPHER_get_version(SSL_get_current_cipher(CC->ssl)),
                bits, alg_bits);
@@ -587,7 +587,7 @@ void endtls(void)
                return;
        }
 
-       lprintf(CTDL_INFO, "Ending SSL/TLS\n");
+       CtdlLogPrintf(CTDL_INFO, "Ending SSL/TLS\n");
        SSL_shutdown(CC->ssl);
        SSL_free(CC->ssl);
        CC->ssl = NULL;
index a48a52260d62536e8f14a68efb69ab770e5e32be..0c3cefee5400ead4153f5b7084b5c04b67fc9716 100644 (file)
@@ -144,12 +144,12 @@ void dspam_do_msg(long msgnum, void *userdata)
        if (dspam_process (CTX, msgtext) != 0)
        {
                free(msgtext);
-               lprintf(CTDL_CRIT, "ERROR: dspam_process failed");
+               CtdlLogPrintf(CTDL_CRIT, "ERROR: dspam_process failed");
                return;
        }
        if (CTX->signature == NULL)
        {
-               lprintf(CTDL_CRIT,"No signature provided\n");
+               CtdlLogPrintf(CTDL_CRIT,"No signature provided\n");
        }
        else
        {
@@ -163,7 +163,7 @@ void dspam_do_msg(long msgnum, void *userdata)
 
        SIG.length = CTX->signature->length;
        /* Print processing results */
-       lprintf (CTDL_DEBUG, "Probability: %2.4f Confidence: %2.4f, Result: %s\n",
+       CtdlLogPrintf (CTDL_DEBUG, "Probability: %2.4f Confidence: %2.4f, Result: %s\n",
                CTX->probability,
                CTX->confidence,
                (CTX->result == DSR_ISSPAM) ? "Spam" : "Innocent");
@@ -199,7 +199,7 @@ int serv_dspam_room(struct ctdlroom *room)
        /// else -> todo: global user for public rooms etc.
        if (CTX == NULL)
        {
-               lprintf(CTDL_CRIT, "ERROR: dspam_init failed!\n");
+               CtdlLogPrintf(CTDL_CRIT, "ERROR: dspam_init failed!\n");
                return ERROR + INTERNAL_ERROR;
        }
        /* Use graham and robinson algorithms, graham's p-values */
@@ -238,7 +238,7 @@ CTDL_MODULE_INIT(dspam)
 
 #else  /* HAVE_LIBDSPAM */
 
-               lprintf(CTDL_INFO, "This server is missing libdspam Spam filtering will be disabled.\n");
+               CtdlLogPrintf(CTDL_INFO, "This server is missing libdspam Spam filtering will be disabled.\n");
 
 #endif /* HAVE_LIBDSPAM */
        }
index 41fb78866f4292428bcb2fc903b730b43db2eed1..b494d9755495cd513c6ca5856464cd9f2a0a6047 100644 (file)
@@ -225,12 +225,12 @@ void DoPurgeMessages(FILE *purgelist) {
 void PurgeMessages(void) {
        FILE *purgelist;
 
-       lprintf(CTDL_DEBUG, "PurgeMessages() called\n");
+       CtdlLogPrintf(CTDL_DEBUG, "PurgeMessages() called\n");
        messages_purged = 0;
 
        purgelist = tmpfile();
        if (purgelist == NULL) {
-               lprintf(CTDL_CRIT, "Can't create purgelist temp file: %s\n",
+               CtdlLogPrintf(CTDL_CRIT, "Can't create purgelist temp file: %s\n",
                        strerror(errno));
                return;
        }
@@ -297,7 +297,7 @@ void DoPurgeRooms(struct ctdlroom *qrbuf, void *data) {
                age = time(NULL) - (qrbuf->QRmtime);
                purge_secs = (time_t)config.c_roompurge * (time_t)86400;
                if (purge_secs <= (time_t)0) return;
-               lprintf(CTDL_DEBUG, "<%s> is <%ld> seconds old\n", qrbuf->QRname, (long)age);
+               CtdlLogPrintf(CTDL_DEBUG, "<%s> is <%ld> seconds old\n", qrbuf->QRname, (long)age);
                if (age > purge_secs) do_purge = 1;
        } /* !QR_MAILBOX */
 
@@ -319,7 +319,7 @@ int PurgeRooms(void) {
        struct ValidUser *vuptr;
        char *transcript = NULL;
 
-       lprintf(CTDL_DEBUG, "PurgeRooms() called\n");
+       CtdlLogPrintf(CTDL_DEBUG, "PurgeRooms() called\n");
 
 
        /* Load up a table full of valid user numbers so we can delete
@@ -356,7 +356,7 @@ int PurgeRooms(void) {
        if (num_rooms_purged > 0) aide_message(transcript, "Room Autopurger Message");
        free(transcript);
 
-       lprintf(CTDL_DEBUG, "Purged %d rooms.\n", num_rooms_purged);
+       CtdlLogPrintf(CTDL_DEBUG, "Purged %d rooms.\n", num_rooms_purged);
        return(num_rooms_purged);
 }
 
@@ -486,7 +486,7 @@ int PurgeUsers(void) {
        int num_users_purged = 0;
        char *transcript = NULL;
 
-       lprintf(CTDL_DEBUG, "PurgeUsers() called\n");
+       CtdlLogPrintf(CTDL_DEBUG, "PurgeUsers() called\n");
        users_not_purged = 0;
 
        switch(config.c_auth_mode) {
@@ -497,7 +497,7 @@ int PurgeUsers(void) {
                        ForEachUser(do_uid_user_purge, NULL);
                        break;
                default:
-                       lprintf(CTDL_DEBUG, "Unknown authentication mode!\n");
+                       CtdlLogPrintf(CTDL_DEBUG, "Unknown authentication mode!\n");
                        break;
        }
 
@@ -541,7 +541,7 @@ int PurgeUsers(void) {
        }
        
                
-       lprintf(CTDL_DEBUG, "Purged %d users.\n", num_users_purged);
+       CtdlLogPrintf(CTDL_DEBUG, "Purged %d users.\n", num_users_purged);
        return(num_users_purged);
 }
 
@@ -656,7 +656,7 @@ int PurgeUseTable(void) {
        struct UPurgeList *uptr; 
 
        /* Phase 1: traverse through the table, discovering old records... */
-       lprintf(CTDL_DEBUG, "Purge use table: phase 1\n");
+       CtdlLogPrintf(CTDL_DEBUG, "Purge use table: phase 1\n");
        cdb_rewind(CDB_USETABLE);
        while(cdbut = cdb_next_item(CDB_USETABLE), cdbut != NULL) {
 
@@ -683,7 +683,7 @@ int PurgeUseTable(void) {
        }
 
        /* Phase 2: delete the records */
-       lprintf(CTDL_DEBUG, "Purge use table: phase 2\n");
+       CtdlLogPrintf(CTDL_DEBUG, "Purge use table: phase 2\n");
        while (ul != NULL) {
                cdb_delete(CDB_USETABLE, ul->up_key, strlen(ul->up_key));
                uptr = ul->next;
@@ -691,7 +691,7 @@ int PurgeUseTable(void) {
                ul = uptr;
        }
 
-       lprintf(CTDL_DEBUG, "Purge use table: finished (purged %d records)\n", purged);
+       CtdlLogPrintf(CTDL_DEBUG, "Purge use table: finished (purged %d records)\n", purged);
        return(purged);
 }
 
@@ -710,7 +710,7 @@ int PurgeEuidIndexTable(void) {
        struct CtdlMessage *msg = NULL;
 
        /* Phase 1: traverse through the table, discovering old records... */
-       lprintf(CTDL_DEBUG, "Purge EUID index: phase 1\n");
+       CtdlLogPrintf(CTDL_DEBUG, "Purge EUID index: phase 1\n");
        cdb_rewind(CDB_EUIDINDEX);
        while(cdbei = cdb_next_item(CDB_EUIDINDEX), cdbei != NULL) {
 
@@ -737,7 +737,7 @@ int PurgeEuidIndexTable(void) {
        }
 
        /* Phase 2: delete the records */
-       lprintf(CTDL_DEBUG, "Purge euid index: phase 2\n");
+       CtdlLogPrintf(CTDL_DEBUG, "Purge euid index: phase 2\n");
        while (el != NULL) {
                cdb_delete(CDB_EUIDINDEX, el->ep_key, el->ep_keylen);
                free(el->ep_key);
@@ -746,7 +746,7 @@ int PurgeEuidIndexTable(void) {
                el = eptr;
        }
 
-       lprintf(CTDL_DEBUG, "Purge euid index: finished (purged %d records)\n", purged);
+       CtdlLogPrintf(CTDL_DEBUG, "Purge euid index: finished (purged %d records)\n", purged);
        return(purged);
 }
 
@@ -759,7 +759,7 @@ void *purge_databases(void *args)
         struct tm tm;
        struct CitContext purgerCC;
 
-       lprintf(CTDL_DEBUG, "Auto-purger_thread() initializing\n");
+       CtdlLogPrintf(CTDL_DEBUG, "Auto-purger_thread() initializing\n");
 
        memset(&purgerCC, 0, sizeof(struct CitContext));
        purgerCC.internal_pgm = 1;
@@ -779,57 +779,57 @@ void *purge_databases(void *args)
                 }
 
 
-                lprintf(CTDL_INFO, "Auto-purger: starting.\n");
+                CtdlLogPrintf(CTDL_INFO, "Auto-purger: starting.\n");
 
                if (!CtdlThreadCheckStop())
                {
                        retval = PurgeUsers();
-                       lprintf(CTDL_NOTICE, "Purged %d users.\n", retval);
+                       CtdlLogPrintf(CTDL_NOTICE, "Purged %d users.\n", retval);
                }
                
                if (!CtdlThreadCheckStop())
                {
                        PurgeMessages();
-                       lprintf(CTDL_NOTICE, "Expired %d messages.\n", messages_purged);
+                       CtdlLogPrintf(CTDL_NOTICE, "Expired %d messages.\n", messages_purged);
                }
 
                if (!CtdlThreadCheckStop())
                {
                        retval = PurgeRooms();
-                       lprintf(CTDL_NOTICE, "Expired %d rooms.\n", retval);
+                       CtdlLogPrintf(CTDL_NOTICE, "Expired %d rooms.\n", retval);
                }
 
                if (!CtdlThreadCheckStop())
                {
                        retval = PurgeVisits();
-                       lprintf(CTDL_NOTICE, "Purged %d visits.\n", retval);
+                       CtdlLogPrintf(CTDL_NOTICE, "Purged %d visits.\n", retval);
                }
 
                if (!CtdlThreadCheckStop())
                {
                        retval = PurgeUseTable();
-                       lprintf(CTDL_NOTICE, "Purged %d entries from the use table.\n", retval);
+                       CtdlLogPrintf(CTDL_NOTICE, "Purged %d entries from the use table.\n", retval);
                }
 
                if (!CtdlThreadCheckStop())
                {
                        retval = PurgeEuidIndexTable();
-                       lprintf(CTDL_NOTICE, "Purged %d entries from the EUID index.\n", retval);
+                       CtdlLogPrintf(CTDL_NOTICE, "Purged %d entries from the EUID index.\n", retval);
                }
 
                if (!CtdlThreadCheckStop())
                {
                        retval = TDAP_ProcessAdjRefCountQueue();
-                       lprintf(CTDL_NOTICE, "Processed %d message reference count adjustments.\n", retval);
+                       CtdlLogPrintf(CTDL_NOTICE, "Processed %d message reference count adjustments.\n", retval);
                }
 
                if (!CtdlThreadCheckStop())
                {
-                       lprintf(CTDL_INFO, "Auto-purger: finished.\n");
+                       CtdlLogPrintf(CTDL_INFO, "Auto-purger: finished.\n");
                        last_purge = now;       /* So we don't do it again soon */
                }
                else
-                       lprintf(CTDL_INFO, "Auto-purger: STOPPED.\n");
+                       CtdlLogPrintf(CTDL_INFO, "Auto-purger: STOPPED.\n");
 
         }
         return NULL;
index 20d40a04ef57fe1a82b92baa73af83a316a0edea..fb6823da416543403b21dc2662656c18fc76a091 100644 (file)
@@ -90,16 +90,16 @@ void do_extnotify_queue(void) {
     /*
      * Go ahead and run the queue
      */
-    lprintf(CTDL_DEBUG, "serv_extnotify: processing notify queue\n");
+    CtdlLogPrintf(CTDL_DEBUG, "serv_extnotify: processing notify queue\n");
     
     if (getroom(&CC->room, FNBL_QUEUE_ROOM) != 0) {
-        lprintf(CTDL_ERR, "Cannot find room <%s>\n", FNBL_QUEUE_ROOM);
+        CtdlLogPrintf(CTDL_ERR, "Cannot find room <%s>\n", FNBL_QUEUE_ROOM);
         return;
     }
     CtdlForEachMessage(MSGS_ALL, 0L, NULL,
             SPOOLMIME, NULL, process_notify, NULL);
     
-    lprintf(CTDL_DEBUG, "serv_extnotify: queue run completed\n");
+    CtdlLogPrintf(CTDL_DEBUG, "serv_extnotify: queue run completed\n");
     doing_queue = 0;
 }
 /*!
@@ -125,7 +125,7 @@ void process_notify(long msgnum, void *usrdata) {
      */
     if ((configMsgNum == -1) || (strncasecmp(configMsg, "none", 4) == 0) &&
     IsEmptyStr(config.c_pager_program) && IsEmptyStr(config.c_funambol_host)) {
-        lprintf(CTDL_DEBUG, "No external notifiers configured on system/user");
+        CtdlLogPrintf(CTDL_DEBUG, "No external notifiers configured on system/user");
         goto nuke;
     }
     // Can Funambol take the message?
@@ -156,7 +156,7 @@ char *extNotify_getPrefs(long configMsgNum, char *configMsg) {
     // Do a simple string search to see if 'funambol' is selected as the
     // type. This string would be at the very top of the message contents.
     if (configMsgNum == -1) {
-        lprintf(CTDL_ERR, "extNotify_isAllowedByPrefs was passed a non-existant config message id\n");
+        CtdlLogPrintf(CTDL_ERR, "extNotify_isAllowedByPrefs was passed a non-existant config message id\n");
         return "none";
     }
     struct CtdlMessage *prefMsg;
@@ -194,7 +194,7 @@ long extNotify_getConfigMessage(char *username) {
         num_msgs = cdbfr->len / sizeof(long);
         cdb_free(cdbfr);
     } else {
-        lprintf(CTDL_DEBUG, "extNotify_getConfigMessage: No config messages found\n");
+        CtdlLogPrintf(CTDL_DEBUG, "extNotify_getConfigMessage: No config messages found\n");
         return -1;     /* No messages at all?  No further action. */
     }
     int a;
index b323d8b1791dab5532db6d9526fa7350034a0600..96b9008db241d5bbb54096d4bc11e4ab1f4edc7e 100644 (file)
@@ -24,6 +24,7 @@
 #include "config.h"
 #include "sysdep_decls.h"
 #include "msgbase.h"
+#include "ctdl_module.h"
 
 /*
 * \brief Sends a message to the Funambol server notifying 
@@ -42,7 +43,7 @@ int notify_funambol_server(char *user) {
        sprintf(port, "%d", config.c_funambol_port);
        sock = sock_connect(config.c_funambol_host, port, "tcp");
        if (sock >= 0) 
-               lprintf(CTDL_DEBUG, "Connected to Funambol!\n");
+               CtdlLogPrintf(CTDL_DEBUG, "Connected to Funambol!\n");
        else 
                goto bail;
        // Load the template SOAP message. Get mallocs done too
@@ -103,16 +104,16 @@ int notify_funambol_server(char *user) {
        sock_shutdown(sock, SHUT_WR);
        
        /* Response */
-       lprintf(CTDL_DEBUG, "Awaiting response\n");
+       CtdlLogPrintf(CTDL_DEBUG, "Awaiting response\n");
         if (sock_getln(sock, buf, SIZ) < 0) {
                 goto free;
         }
-        lprintf(CTDL_DEBUG, "<%s\n", buf);
+        CtdlLogPrintf(CTDL_DEBUG, "<%s\n", buf);
        if (strncasecmp(buf, "HTTP/1.1 200 OK", strlen("HTTP/1.1 200 OK"))) {
                
                goto free;
        }
-       lprintf(CTDL_DEBUG, "Funambol notified\n");
+       CtdlLogPrintf(CTDL_DEBUG, "Funambol notified\n");
 free:
        if (funambolCreds != NULL) free(funambolCreds);
        if (SOAPMessage != NULL) free(SOAPMessage);
index 4a03e1b77c6289877ba42815a439bd0e925d4b11..aaa92a208052925c017fb0da64063c570a40bd4e 100644 (file)
@@ -43,6 +43,7 @@
 #include "control.h"
 #include "ft_wordbreaker.h"
 #include "crc16.h"
+#include "ctdl_module.h"
 
 /*
  * Noise words are not included in search indices.
@@ -173,7 +174,7 @@ void wordbreaker(char *text, int *num_tokens, int **tokens) {
                        /* extract the word */
                        word_len = word_end - word_start;
                        if (word_len >= sizeof word) {
-                               lprintf(CTDL_DEBUG, "Invalid word length: %d\n", word_len);
+                               CtdlLogPrintf(CTDL_DEBUG, "Invalid word length: %d\n", word_len);
                                safestrncpy(word, word_start, sizeof word);
                                word[(sizeof word) - 1] = 0;
                        }
index 4e8ea9b6b77550bd7803bc6c137ba5aa75db6167..131c5225622c173ed0d749adfd80bd630bf531f2 100644 (file)
@@ -81,7 +81,7 @@ void ft_flush_cache(void) {
 
        for (i=0; i<65536; ++i) {
                if ((time(NULL) - last_update) >= 10) {
-                       lprintf(CTDL_INFO,
+                       CtdlLogPrintf(CTDL_INFO,
                                "Flushing index cache to disk (%d%% complete)\n",
                                (i * 100 / 65536)
                        );
@@ -95,7 +95,7 @@ void ft_flush_cache(void) {
                        ftc_msgs[i] = NULL;
                }
        }
-       lprintf(CTDL_INFO, "Flushed index cache to disk (100%% complete)\n");
+       CtdlLogPrintf(CTDL_INFO, "Flushed index cache to disk (100%% complete)\n");
 }
 
 
@@ -110,7 +110,7 @@ void ft_index_message(long msgnum, int op) {
        char *msgtext;
        int tok;
 
-       lprintf(CTDL_DEBUG, "ft_index_message() %s msg %ld\n",
+       CtdlLogPrintf(CTDL_DEBUG, "ft_index_message() %s msg %ld\n",
                (op ? "adding" : "removing") , msgnum
        );
 
@@ -125,11 +125,11 @@ void ft_index_message(long msgnum, int op) {
        CC->redirect_buffer = NULL;
        CC->redirect_len = 0;
        CC->redirect_alloc = 0;
-       lprintf(CTDL_DEBUG, "Wordbreaking message %ld...\n", msgnum);
+       CtdlLogPrintf(CTDL_DEBUG, "Wordbreaking message %ld...\n", msgnum);
        wordbreaker(msgtext, &num_tokens, &tokens);
        free(msgtext);
 
-       lprintf(CTDL_DEBUG, "Indexing message %ld [%d tokens]\n", msgnum, num_tokens);
+       CtdlLogPrintf(CTDL_DEBUG, "Indexing message %ld [%d tokens]\n", msgnum, num_tokens);
        if (num_tokens > 0) {
                for (i=0; i<num_tokens; ++i) {
 
@@ -175,7 +175,7 @@ void ft_index_message(long msgnum, int op) {
                                }
                        }
                        else {
-                               lprintf(CTDL_ALERT, "Invalid token %d !!\n", tok);
+                               CtdlLogPrintf(CTDL_ALERT, "Invalid token %d !!\n", tok);
                        }
                }
 
@@ -253,7 +253,7 @@ void do_fulltext_indexing(void) {
        }
        
        run_time = time(NULL);
-       lprintf(CTDL_DEBUG, "do_fulltext_indexing() started (%ld)\n", run_time);
+       CtdlLogPrintf(CTDL_DEBUG, "do_fulltext_indexing() started (%ld)\n", run_time);
        
        /*
         * If we've switched wordbreaker modules, burn the index and start
@@ -261,9 +261,9 @@ void do_fulltext_indexing(void) {
         */
        begin_critical_section(S_CONTROL);
        if (CitControl.fulltext_wordbreaker != FT_WORDBREAKER_ID) {
-               lprintf(CTDL_DEBUG, "wb ver on disk = %d, code ver = %d\n",
+               CtdlLogPrintf(CTDL_DEBUG, "wb ver on disk = %d, code ver = %d\n",
                        CitControl.fulltext_wordbreaker, FT_WORDBREAKER_ID);
-               lprintf(CTDL_INFO, "(re)initializing full text index\n");
+               CtdlLogPrintf(CTDL_INFO, "(re)initializing full text index\n");
                cdb_trunc(CDB_FULLTEXT);
                CitControl.MMfulltext = 0L;
                put_control();
@@ -290,7 +290,7 @@ void do_fulltext_indexing(void) {
                /* Here it is ... do each message! */
                for (i=0; i<ft_num_msgs; ++i) {
                        if (time(NULL) != last_progress) {
-                               lprintf(CTDL_DEBUG,
+                               CtdlLogPrintf(CTDL_DEBUG,
                                        "Indexed %d of %d messages (%d%%)\n",
                                                i, ft_num_msgs,
                                                ((i*100) / ft_num_msgs)
@@ -301,14 +301,14 @@ void do_fulltext_indexing(void) {
 
                        /* Check to see if we need to quit early */
                        if (CtdlThreadCheckStop()) {
-                               lprintf(CTDL_DEBUG, "Indexer quitting early\n");
+                               CtdlLogPrintf(CTDL_DEBUG, "Indexer quitting early\n");
                                ft_newhighest = ft_newmsgs[i];
                                break;
                        }
 
                        /* Check to see if we have to maybe flush to disk */
                        if (i >= FT_MAX_CACHE) {
-                               lprintf(CTDL_DEBUG, "Time to flush.\n");
+                               CtdlLogPrintf(CTDL_DEBUG, "Time to flush.\n");
                                ft_newhighest = ft_newmsgs[i];
                                break;
                        }
@@ -325,7 +325,7 @@ void do_fulltext_indexing(void) {
        if (CtdlThreadCheckStop())
                return;
        
-       lprintf(CTDL_DEBUG, "do_fulltext_indexing() duration (%ld)\n", end_time - run_time);
+       CtdlLogPrintf(CTDL_DEBUG, "do_fulltext_indexing() duration (%ld)\n", end_time - run_time);
                
        /* Save our place so we don't have to do this again */
        ft_flush_cache();
@@ -336,7 +336,7 @@ void do_fulltext_indexing(void) {
        end_critical_section(S_CONTROL);
        last_index = time(NULL);
 
-       lprintf(CTDL_DEBUG, "do_fulltext_indexing() finished\n");
+       CtdlLogPrintf(CTDL_DEBUG, "do_fulltext_indexing() finished\n");
        return;
 }
 
@@ -346,7 +346,7 @@ void do_fulltext_indexing(void) {
 void *indexer_thread(void *arg) {
        struct CitContext indexerCC;
 
-       lprintf(CTDL_DEBUG, "indexer_thread() initializing\n");
+       CtdlLogPrintf(CTDL_DEBUG, "indexer_thread() initializing\n");
 
        memset(&indexerCC, 0, sizeof(struct CitContext));
        indexerCC.internal_pgm = 1;
@@ -358,7 +358,7 @@ void *indexer_thread(void *arg) {
                CtdlThreadSleep(300);
        }
 
-       lprintf(CTDL_DEBUG, "indexer_thread() exiting\n");
+       CtdlLogPrintf(CTDL_DEBUG, "indexer_thread() exiting\n");
        return NULL;
 }
 
index 3cd92cb32717722bd7f9e0ca19fad11d651a7137..bff79381e14cc6283a77c013ae0a3756a474f29c 100644 (file)
@@ -49,6 +49,7 @@
 #include "imap_tools.h"
 #include "imap_fetch.h"
 #include "genstamp.h"
+#include "ctdl_module.h"
 
 
 
@@ -218,7 +219,7 @@ void imap_fetch_rfc822(long msgnum, char *whichfmt) {
                text_size = 0;
        }
 
-       lprintf(CTDL_DEBUG, 
+       CtdlLogPrintf(CTDL_DEBUG, 
                "RFC822: headers=" SIZE_T_FMT 
                ", text=" SIZE_T_FMT
                ", total=" SIZE_T_FMT "\n",
@@ -586,7 +587,7 @@ void imap_fetch_body(long msgnum, char *item, int is_peek) {
        if (strchr(section, '[') != NULL) {
                stripallbut(section, '[', ']');
        }
-       lprintf(CTDL_DEBUG, "Section is: %s%s\n", 
+       CtdlLogPrintf(CTDL_DEBUG, "Section is: %s%s\n", 
                section, 
                IsEmptyStr(section) ? "(empty)" : "");
 
@@ -633,7 +634,7 @@ void imap_fetch_body(long msgnum, char *item, int is_peek) {
                is_partial = 1;
        }
        if (is_partial == 0) strcpy(partial, "");
-       /* if (!IsEmptyStr(partial)) lprintf(CTDL_DEBUG, "Partial is %s\n", partial); */
+       /* if (!IsEmptyStr(partial)) CtdlLogPrintf(CTDL_DEBUG, "Partial is %s\n", partial); */
 
        if (IMAP->cached_body == NULL) {
                CC->redirect_buffer = malloc(SIZ);
index 023a0dca9f61c92f87629fcbb264a0d94c055707..373196ece38d655003b39e58cb696f480ab5eb6a 100644 (file)
@@ -54,6 +54,7 @@
 #include "imap_acl.h"
 #include "imap_misc.h"
 #include "imap_list.h"
+#include "ctdl_module.h"
 
 
 /*
@@ -301,7 +302,7 @@ void imap_list(int num_parms, char *parms[])
 
        }
 
-       lprintf(CTDL_DEBUG, "select metadata: %d to %d\n", select_metadata_left, select_metadata_right);
+       CtdlLogPrintf(CTDL_DEBUG, "select metadata: %d to %d\n", select_metadata_left, select_metadata_right);
        /* FIXME blah, we have to do something with this */
 
        /* The folder root appears immediately after the selection options,
@@ -359,7 +360,7 @@ void imap_list(int num_parms, char *parms[])
                        /* Might as well look for these while we're in here... */
                        if (parms[i][0] == '(') strcpy(parms[i], &parms[i][1]);
                        if (parms[i][strlen(parms[i])-1] == ')') parms[i][strlen(parms[i])-1] = 0;
-                       lprintf(9, "evaluating <%s>\n", parms[i]);
+                       CtdlLogPrintf(9, "evaluating <%s>\n", parms[i]);
 
                        if (!strcasecmp(parms[i], "SUBSCRIBED")) {
                                return_subscribed = 1;
index 6f9069820d3e17a2ba6f8acc8e3e5215a45d59f2..9b15e4208af09f8f4f80752149fc6ff5919073c5 100644 (file)
@@ -414,7 +414,7 @@ void imap_append(int num_parms, char *parms[]) {
        client_getln(buf, sizeof buf);
 
        /* Convert RFC822 newlines (CRLF) to Unix newlines (LF) */
-       lprintf(CTDL_DEBUG, "Converting CRLF to LF\n");
+       CtdlLogPrintf(CTDL_DEBUG, "Converting CRLF to LF\n");
        stripped_length = 0;
        for (i=0; i<literal_length; ++i) {
                if (strncmp(&Imap->transmitted_message[i], "\r\n", 2)) {
@@ -425,7 +425,7 @@ void imap_append(int num_parms, char *parms[]) {
        literal_length = stripped_length;
        Imap->transmitted_message[literal_length] = 0;  /* reterminate it */
 
-       lprintf(CTDL_DEBUG, "Converting message format\n");
+       CtdlLogPrintf(CTDL_DEBUG, "Converting message format\n");
        msg = convert_internet_message(Imap->transmitted_message);
        Imap->transmitted_message = NULL;
        Imap->transmitted_length = 0;
index f0eeef926fc1d497b307379fa1edf2bbe937c573..77d091c6d655cd46b36927351fe6417b683b0ab4 100644 (file)
@@ -18,7 +18,7 @@
 #include "room_ops.h"
 #include "internet_addressing.h"
 #include "imap_tools.h"
-
+#include "ctdl_module.h"
 
 #ifndef HAVE_SNPRINTF
 #include "snprintf.h"
@@ -211,7 +211,7 @@ static char* toimap(char* destp, char* destend, char* src)
 
        *destp = 0;
        string_init(&dest, destp, destend-destp);
-       /* lprintf(CTDL_DEBUG, "toimap %s\r\n", src); */
+       /* CtdlLogPrintf(CTDL_DEBUG, "toimap %s\r\n", src); */
 
        for (;;)
        {
@@ -277,7 +277,7 @@ static char* toimap(char* destp, char* destend, char* src)
 
        if (state == 1)
                utf7_closeb64(&dest, v, i);
-       /* lprintf(CTDL_DEBUG, "    -> %s\r\n", destp); */
+       /* CtdlLogPrintf(CTDL_DEBUG, "    -> %s\r\n", destp); */
        return string_end(&dest);
 }
 
@@ -295,7 +295,7 @@ static char* fromimap(char* destp, char* destend, char* src)
 
        *destp = 0;
        string_init(&dest, destp, destend-destp);
-       /* lprintf(CTDL_DEBUG, "fromimap %s\r\n", src); */
+       /* CtdlLogPrintf(CTDL_DEBUG, "fromimap %s\r\n", src); */
 
        do {
                c = *p++;
@@ -353,7 +353,7 @@ static char* fromimap(char* destp, char* destend, char* src)
                        }
        } while (c != '\0');
 
-       /* lprintf(CTDL_DEBUG, "      -> %s\r\n", destp); */
+       /* CtdlLogPrintf(CTDL_DEBUG, "      -> %s\r\n", destp); */
        return string_end(&dest);
 }
 
@@ -582,7 +582,7 @@ int imap_roomname(char *rbuf, int bufsize, char *foldername)
        ret = (0 | IR_MAILBOX);
 
 exit:
-       lprintf(CTDL_DEBUG, "(That translates to \"%s\")\n", rbuf);
+       CtdlLogPrintf(CTDL_DEBUG, "(That translates to \"%s\")\n", rbuf);
        return(ret);
 }
 
index d931ca144920ec7cbb1d248a3e26145e4a0d6bad..b37324da554d1fd716e161863f625310debac764 100644 (file)
@@ -227,7 +227,7 @@ void imap_load_msgids(void)
        struct cdbdata *cdbfr;
 
        if (IMAP->selected == 0) {
-               lprintf(CTDL_ERR,
+               CtdlLogPrintf(CTDL_ERR,
                        "imap_load_msgids() can't run; no room selected\n");
                return;
        }
@@ -269,7 +269,7 @@ void imap_rescan_msgids(void)
        int num_recent = 0;
 
        if (IMAP->selected == 0) {
-               lprintf(CTDL_ERR,
+               CtdlLogPrintf(CTDL_ERR,
                        "imap_load_msgids() can't run; no room selected\n");
                return;
        }
@@ -290,7 +290,7 @@ void imap_rescan_msgids(void)
        if (cdbfr != NULL) {
                msglist = malloc(cdbfr->len);
                if (msglist == NULL) {
-                       lprintf(CTDL_CRIT, "malloc() failed\n");
+                       CtdlLogPrintf(CTDL_CRIT, "malloc() failed\n");
                        abort();
                }
                memcpy(msglist, cdbfr->ptr, (size_t)cdbfr->len);
@@ -407,7 +407,7 @@ void imap_cleanup_function(void)
                imap_do_expunge();
        }
 
-       lprintf(CTDL_DEBUG, "Performing IMAP cleanup hook\n");
+       CtdlLogPrintf(CTDL_DEBUG, "Performing IMAP cleanup hook\n");
        imap_free_msgids();
        imap_free_transmitted_message();
 
@@ -426,7 +426,7 @@ void imap_cleanup_function(void)
        }
 
        free(IMAP);
-       lprintf(CTDL_DEBUG, "Finished IMAP cleanup hook\n");
+       CtdlLogPrintf(CTDL_DEBUG, "Finished IMAP cleanup hook\n");
 }
 
 
@@ -766,7 +766,7 @@ int imap_do_expunge(void)
        long *delmsgs = NULL;
        int num_delmsgs = 0;
 
-       lprintf(CTDL_DEBUG, "imap_do_expunge() called\n");
+       CtdlLogPrintf(CTDL_DEBUG, "imap_do_expunge() called\n");
        if (IMAP->selected == 0) {
                return (0);
        }
@@ -789,7 +789,7 @@ int imap_do_expunge(void)
                imap_rescan_msgids();
        }
 
-       lprintf(CTDL_DEBUG, "Expunged %d messages from <%s>\n",
+       CtdlLogPrintf(CTDL_DEBUG, "Expunged %d messages from <%s>\n",
                num_expunged, CC->room.QRname);
        return (num_expunged);
 }
@@ -881,7 +881,7 @@ void imap_create(int num_parms, char *parms[])
        if (strchr(parms[2], '\\') != NULL) {
                cprintf("%s NO Invalid character in folder name\r\n",
                        parms[0]);
-               lprintf(CTDL_DEBUG, "invalid character in folder name\n");
+               CtdlLogPrintf(CTDL_DEBUG, "invalid character in folder name\n");
                return;
        }
 
@@ -889,7 +889,7 @@ void imap_create(int num_parms, char *parms[])
        if (ret < 0) {
                cprintf("%s NO Invalid mailbox name or location\r\n",
                        parms[0]);
-               lprintf(CTDL_DEBUG, "invalid mailbox name or location\n");
+               CtdlLogPrintf(CTDL_DEBUG, "invalid mailbox name or location\n");
                return;
        }
        floornum = (ret & 0x00ff);      /* lower 8 bits = floor number */
@@ -898,7 +898,7 @@ void imap_create(int num_parms, char *parms[])
        if (flags & IR_MAILBOX) {
                if (strncasecmp(parms[2], "INBOX/", 6)) {
                        cprintf("%s NO Personal folders must be created under INBOX\r\n", parms[0]);
-                       lprintf(CTDL_DEBUG, "not subordinate to inbox\n");
+                       CtdlLogPrintf(CTDL_DEBUG, "not subordinate to inbox\n");
                        return;
                }
        }
@@ -911,7 +911,7 @@ void imap_create(int num_parms, char *parms[])
                newroomview = VIEW_BBS;
        }
 
-       lprintf(CTDL_INFO, "Create new room <%s> on floor <%d> with type <%d>\n",
+       CtdlLogPrintf(CTDL_INFO, "Create new room <%s> on floor <%d> with type <%d>\n",
                roomname, floornum, newroomtype);
 
        ret = create_room(roomname, newroomtype, "", floornum, 1, 0, newroomview);
@@ -921,7 +921,7 @@ void imap_create(int num_parms, char *parms[])
        } else {
                cprintf("%s OK CREATE completed\r\n", parms[0]);
        }
-       lprintf(CTDL_DEBUG, "imap_create() completed\n");
+       CtdlLogPrintf(CTDL_DEBUG, "imap_create() completed\n");
 }
 
 
@@ -1298,7 +1298,7 @@ void imap_rename(int num_parms, char *parms[])
                                           irl->irl_newfloor);
                        if (r != crr_ok) {
                                /* FIXME handle error returns better */
-                               lprintf(CTDL_ERR, "CtdlRenameRoom() error %d\n", r);
+                               CtdlLogPrintf(CTDL_ERR, "CtdlRenameRoom() error %d\n", r);
                        }
                        irlp = irl;
                        irl = irl->next;
@@ -1335,22 +1335,22 @@ void imap_command_loop(void)
        memset(cmdbuf, 0, sizeof cmdbuf);       /* Clear it, just in case */
        flush_output();
        if (client_getln(cmdbuf, sizeof cmdbuf) < 1) {
-               lprintf(CTDL_ERR, "Client disconnected: ending session.\r\n");
+               CtdlLogPrintf(CTDL_ERR, "Client disconnected: ending session.\r\n");
                CC->kill_me = 1;
                return;
        }
 
        if (IMAP->authstate == imap_as_expecting_password) {
-               lprintf(CTDL_INFO, "IMAP: <password>\n");
+               CtdlLogPrintf(CTDL_INFO, "IMAP: <password>\n");
        }
        else if (IMAP->authstate == imap_as_expecting_plainauth) {
-               lprintf(CTDL_INFO, "IMAP: <plain_auth>\n");
+               CtdlLogPrintf(CTDL_INFO, "IMAP: <plain_auth>\n");
        }
        else if (bmstrcasestr(cmdbuf, " LOGIN ")) {
-               lprintf(CTDL_INFO, "IMAP: LOGIN...\n");
+               CtdlLogPrintf(CTDL_INFO, "IMAP: LOGIN...\n");
        }
        else {
-               lprintf(CTDL_INFO, "IMAP: %s\n", cmdbuf);
+               CtdlLogPrintf(CTDL_INFO, "IMAP: %s\n", cmdbuf);
        }
 
        while (strlen(cmdbuf) < 5)
@@ -1593,7 +1593,7 @@ void imap_command_loop(void)
 
        gettimeofday(&tv2, NULL);
        total_time = (tv2.tv_usec + (tv2.tv_sec * 1000000)) - (tv1.tv_usec + (tv1.tv_sec * 1000000));
-       lprintf(CTDL_DEBUG, "IMAP command completed in %ld.%ld seconds\n",
+       CtdlLogPrintf(CTDL_DEBUG, "IMAP command completed in %ld.%ld seconds\n",
                (total_time / 1000000),
                (total_time % 1000000)
        );
index 3b448fbf491eec93ea7b9e8755ef9ca6a664ddcb..314ecbaa166ae4eb503e913c1d4d8a45e6da1f0b 100644 (file)
@@ -55,7 +55,7 @@ struct xmpp_event *xmpp_queue = NULL;
 
 void xmpp_stream_start(void *data, const char *supplied_el, const char **attr)
 {
-       lprintf(CTDL_DEBUG, "New XMPP stream.\n");
+       CtdlLogPrintf(CTDL_DEBUG, "New XMPP stream.\n");
 
        while (*attr) {
                if (!strcasecmp(attr[0], "to")) {
@@ -112,10 +112,10 @@ void xmpp_xml_start(void *data, const char *supplied_el, const char **attr) {
                strcpy(el, ++sep);
        }
 
-       lprintf(CTDL_DEBUG, "XMPP ELEMENT START: <%s>\n", el);
+       CtdlLogPrintf(CTDL_DEBUG, "XMPP ELEMENT START: <%s>\n", el);
 
        for (i=0; attr[i] != NULL; i+=2) {
-               lprintf(CTDL_DEBUG, "                    Attribute '%s' = '%s'\n", attr[i], attr[i+1]);
+               CtdlLogPrintf(CTDL_DEBUG, "                    Attribute '%s' = '%s'\n", attr[i], attr[i+1]);
        }
 
        if (!strcasecmp(el, "stream")) {
@@ -182,9 +182,9 @@ void xmpp_xml_end(void *data, const char *supplied_el) {
                strcpy(el, ++sep);
        }
 
-       lprintf(CTDL_DEBUG, "XMPP ELEMENT END  : <%s>\n", el);
+       CtdlLogPrintf(CTDL_DEBUG, "XMPP ELEMENT END  : <%s>\n", el);
        if (XMPP->chardata_len > 0) {
-               lprintf(CTDL_DEBUG, "          chardata: %s\n", XMPP->chardata);
+               CtdlLogPrintf(CTDL_DEBUG, "          chardata: %s\n", XMPP->chardata);
        }
 
        if (!strcasecmp(el, "resource")) {
@@ -384,7 +384,7 @@ void xmpp_cleanup_function(void) {
        /* Don't do this stuff if this is not a XMPP session! */
        if (CC->h_command_function != xmpp_command_loop) return;
 
-       lprintf(CTDL_DEBUG, "Performing XMPP cleanup hook\n");
+       CtdlLogPrintf(CTDL_DEBUG, "Performing XMPP cleanup hook\n");
        if (XMPP->chardata != NULL) {
                free(XMPP->chardata);
                XMPP->chardata = NULL;
@@ -413,7 +413,7 @@ void xmpp_greeting(void) {
 
        XMPP->xp = XML_ParserCreateNS("UTF-8", ':');
        if (XMPP->xp == NULL) {
-               lprintf(CTDL_ALERT, "Cannot create XML parser!\n");
+               CtdlLogPrintf(CTDL_ALERT, "Cannot create XML parser!\n");
                CC->kill_me = 1;
                return;
        }
@@ -435,7 +435,7 @@ void xmpp_command_loop(void) {
        memset(cmdbuf, 0, sizeof cmdbuf); /* Clear it, just in case */
        retval = client_read(cmdbuf, 1);
        if (retval != 1) {
-               lprintf(CTDL_ERR, "Client disconnected: ending session.\r\n");
+               CtdlLogPrintf(CTDL_ERR, "Client disconnected: ending session.\r\n");
                CC->kill_me = 1;
                return;
        }
index e3d9cc4665d09b789c9cb89f8a94e9b8481036a6..f7f454bb609fd97adc0d63f678a024b8aea03ec5 100644 (file)
@@ -104,12 +104,12 @@ void xmpp_presence_notify(char *presence_jid, int event_type) {
                }
        }
 
-       lprintf(CTDL_DEBUG, "%d sessions for <%s> are now visible to session %d\n",
+       CtdlLogPrintf(CTDL_DEBUG, "%d sessions for <%s> are now visible to session %d\n",
                visible_sessions, presence_jid, CC->cs_pid);
 
        if ( (event_type == XMPP_EVT_LOGIN) && (visible_sessions == 1) ) {
 
-               lprintf(CTDL_DEBUG, "Telling session %d that <%s> logged in\n", CC->cs_pid, presence_jid);
+               CtdlLogPrintf(CTDL_DEBUG, "Telling session %d that <%s> logged in\n", CC->cs_pid, presence_jid);
 
                /* Do an unsolicited roster update that adds a new contact. */
                for (i=0; i<nContexts; i++) {
@@ -130,7 +130,7 @@ void xmpp_presence_notify(char *presence_jid, int event_type) {
        }
 
        if (visible_sessions == 0) {
-               lprintf(CTDL_DEBUG, "Telling session %d that <%s> logged out\n", CC->cs_pid, presence_jid);
+               CtdlLogPrintf(CTDL_DEBUG, "Telling session %d that <%s> logged out\n", CC->cs_pid, presence_jid);
 
                /* Transmit non-presence information */
                cprintf("<presence type=\"unavailable\" from=\"%s\"></presence>", presence_jid);
index afd80ee71bfb835b2707b07be2daf8646395b2d1..84f49be10e321393aa5ecf2ee5a5b005965d5167 100644 (file)
@@ -103,7 +103,7 @@ xmpp_query_namespace(purple5b5c1e5a, , vcard-temp:query)
 
 void xmpp_query_namespace(char *iq_id, char *iq_from, char *iq_to, char *query_xmlns) {
 
-       lprintf(CTDL_DEBUG, "xmpp_query_namespace(%s, %s, %s, %s)\n", iq_id, iq_from, iq_to, query_xmlns);
+       CtdlLogPrintf(CTDL_DEBUG, "xmpp_query_namespace(%s, %s, %s, %s)\n", iq_id, iq_from, iq_to, query_xmlns);
 
        /*
         * Beginning of query result.
index f11d101e710f38faf0d33985e79996c3833b8159..b97f5333b742eef0543ccd824c618426ed8eb686 100644 (file)
@@ -55,7 +55,7 @@ void xmpp_queue_event(int event_type, char *email_addr) {
        int purged_something = 0;
        struct CitContext *cptr;
 
-       lprintf(CTDL_DEBUG, "xmpp_queue_event(%d, %s)\n", event_type, email_addr);
+       CtdlLogPrintf(CTDL_DEBUG, "xmpp_queue_event(%d, %s)\n", event_type, email_addr);
 
        /* Purge events more than a minute old */
        begin_critical_section(S_XMPP_QUEUE);
index 331868d237260036bb06f582066e7cc3200ccca2..82c6774dd70c971aee0ac115f40487d64219eb8a 100644 (file)
@@ -506,7 +506,7 @@ void do_confirm(char *room, char *token) {
         */
        if (success) {
                cprintf("%d %d operation(s) confirmed.\n", CIT_OK, success);
-               lprintf(CTDL_NOTICE, 
+               CtdlLogPrintf(CTDL_NOTICE, 
                        "Mailing list: %s %ssubscribed to %s with token %s\n", 
                        email, 
                        (!IsEmptyStr(address_to_unsubscribe)) ? "un" : "", 
index 1662048d3edffe57b4f64432b43ea14c06cfcda2..954c47984e6794a39c46c4835d314e8a6209279b 100644 (file)
@@ -264,7 +264,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;
 }
 
@@ -513,11 +513,11 @@ void managesieve_command_loop(void) {
                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);
        }
@@ -562,7 +562,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;
        }
 
@@ -578,7 +578,7 @@ 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);
 }
 
index 2b20ea7011122b7c0ceb3ed2c65fff71a773a28d..deb9f8cbb9bc488f09184ae48c032df2d9ea2fa4 100644 (file)
@@ -306,7 +306,7 @@ int is_valid_node(char *nexthop, char *secret, char *node) {
         * First try the neighbor nodes
         */
        if (working_ignetcfg == NULL) {
-               lprintf(CTDL_ERR, "working_ignetcfg is NULL!\n");
+               CtdlLogPrintf(CTDL_ERR, "working_ignetcfg is NULL!\n");
                if (nexthop != NULL) {
                        strcpy(nexthop, "");
                }
@@ -354,7 +354,7 @@ int is_valid_node(char *nexthop, char *secret, char *node) {
        /*
         * If we get to this point, the supplied node name is bogus.
         */
-       lprintf(CTDL_ERR, "Invalid node name <%s>\n", node);
+       CtdlLogPrintf(CTDL_ERR, "Invalid node name <%s>\n", node);
        return(-1);
 }
 
@@ -504,7 +504,7 @@ void network_deliver_digest(SpoolControl *sc) {
        recps = malloc(recps_len);
 
        if (recps == NULL) {
-               lprintf(CTDL_EMERG, "Cannot allocate %ld bytes for recps...\n", (long)recps_len);
+               CtdlLogPrintf(CTDL_EMERG, "Cannot allocate %ld bytes for recps...\n", (long)recps_len);
                abort();
        }
 
@@ -551,7 +551,7 @@ void network_deliver_list(struct CtdlMessage *msg, SpoolControl *sc) {
        recps = malloc(recps_len);
 
        if (recps == NULL) {
-               lprintf(CTDL_EMERG, "Cannot allocate %ld bytes for recps...\n", (long)recps_len);
+               CtdlLogPrintf(CTDL_EMERG, "Cannot allocate %ld bytes for recps...\n", (long)recps_len);
                abort();
        }
 
@@ -785,12 +785,12 @@ void network_spool_msg(long msgnum, void *userdata) {
 
                        /* Check for valid node name */
                        if (is_valid_node(NULL, NULL, mptr->remote_nodename) != 0) {
-                               lprintf(CTDL_ERR, "Invalid node <%s>\n", mptr->remote_nodename);
+                               CtdlLogPrintf(CTDL_ERR, "Invalid node <%s>\n", mptr->remote_nodename);
                                send = 0;
                        }
 
                        /* Check for split horizon */
-                       lprintf(CTDL_DEBUG, "Path is %s\n", msg->cm_fields['P']);
+                       CtdlLogPrintf(CTDL_DEBUG, "Path is %s\n", msg->cm_fields['P']);
                        bang = num_tokens(msg->cm_fields['P'], '!');
                        if (bang > 1) for (i=0; i<(bang-1); ++i) {
                                extract_token(buf, msg->cm_fields['P'],
@@ -825,7 +825,7 @@ void network_spool_msg(long msgnum, void *userdata) {
                                        snprintf(filename, sizeof filename,"%s/%s",
                                                        ctdl_netout_dir,
                                                        mptr->remote_nodename);
-                                       lprintf(CTDL_DEBUG, "Appending to %s\n", filename);
+                                       CtdlLogPrintf(CTDL_DEBUG, "Appending to %s\n", filename);
                                        fp = fopen(filename, "ab");
                                        if (fp != NULL) {
                                                fwrite(sermsg.ser,
@@ -833,7 +833,7 @@ void network_spool_msg(long msgnum, void *userdata) {
                                                fclose(fp);
                                        }
                                        else {
-                                               lprintf(CTDL_ERR, "%s: %s\n", filename, strerror(errno));
+                                               CtdlLogPrintf(CTDL_ERR, "%s: %s\n", filename, strerror(errno));
                                        }
        
                                        /* free the serialized version */
@@ -991,7 +991,7 @@ int writenfree_spoolcontrol_file(SpoolControl **scc, char *filename)
        sc = *scc;
        fp = fopen(filename, "w");
        if (fp == NULL) {
-               lprintf(CTDL_CRIT, "ERROR: cannot open %s: %s\n",
+               CtdlLogPrintf(CTDL_CRIT, "ERROR: cannot open %s: %s\n",
                        filename, strerror(errno));
                free_spoolcontrol_struct(scc);
        }
@@ -1087,13 +1087,13 @@ void network_spoolout_room(char *room_to_spool) {
         * queued for networking and then deleted before it can happen.
         */
        if (getroom(&CC->room, room_to_spool) != 0) {
-               lprintf(CTDL_CRIT, "ERROR: cannot load <%s>\n", room_to_spool);
+               CtdlLogPrintf(CTDL_CRIT, "ERROR: cannot load <%s>\n", room_to_spool);
                return;
        }
 
        assoc_file_name(filename, sizeof filename, &CC->room, ctdl_netcfg_dir);
 
-       lprintf(CTDL_INFO, "Networking started for <%s>\n", CC->room.QRname);
+       CtdlLogPrintf(CTDL_INFO, "Networking started for <%s>\n", CC->room.QRname);
        begin_critical_section(S_NETCONFIGS);
 
        /* Only do net processing for rooms that have netconfigs */
@@ -1198,7 +1198,7 @@ int network_sync_to(char *target_node) {
        /* Concise cleanup because we know there's only one node in the sc */
        free(sc.ignet_push_shares);
 
-       lprintf(CTDL_NOTICE, "Synchronized %d messages to <%s>\n",
+       CtdlLogPrintf(CTDL_NOTICE, "Synchronized %d messages to <%s>\n",
                num_spooled, target_node);
        return(num_spooled);
 }
@@ -1317,7 +1317,7 @@ void network_bounce(struct CtdlMessage *msg, char *reason) {
        static int serialnum = 0;
        size_t size;
 
-       lprintf(CTDL_DEBUG, "entering network_bounce()\n");
+       CtdlLogPrintf(CTDL_DEBUG, "entering network_bounce()\n");
 
        if (msg == NULL) return;
 
@@ -1406,7 +1406,7 @@ void network_bounce(struct CtdlMessage *msg, char *reason) {
        /* Clean up */
        if (valid != NULL) free_recipients(valid);
        CtdlFreeMessage(msg);
-       lprintf(CTDL_DEBUG, "leaving network_bounce()\n");
+       CtdlLogPrintf(CTDL_DEBUG, "leaving network_bounce()\n");
 }
 
 
@@ -1434,7 +1434,7 @@ void network_process_buffer(char *buffer, long size) {
        firstbyte = buffer[0];
        lastbyte = buffer[size-1];
        if ( (firstbyte != 255) || (lastbyte != 0) ) {
-               lprintf(CTDL_ERR, "Corrupt message ignored.  Length=%ld, firstbyte = %d, lastbyte = %d\n",
+               CtdlLogPrintf(CTDL_ERR, "Corrupt message ignored.  Length=%ld, firstbyte = %d, lastbyte = %d\n",
                        size, firstbyte, lastbyte);
                return;
        }
@@ -1488,7 +1488,7 @@ void network_process_buffer(char *buffer, long size) {
                                                 "%s/%s",
                                                 ctdl_netout_dir,
                                                 nexthop);
-                               lprintf(CTDL_DEBUG, "Appending to %s\n", filename);
+                               CtdlLogPrintf(CTDL_DEBUG, "Appending to %s\n", filename);
                                fp = fopen(filename, "ab");
                                if (fp != NULL) {
                                        fwrite(sermsg.ser,
@@ -1496,7 +1496,7 @@ void network_process_buffer(char *buffer, long size) {
                                        fclose(fp);
                                }
                                else {
-                                       lprintf(CTDL_ERR, "%s: %s\n", filename, strerror(errno));
+                                       CtdlLogPrintf(CTDL_ERR, "%s: %s\n", filename, strerror(errno));
                                }
                                free(sermsg.ser);
                                CtdlFreeMessage(msg);
@@ -1619,12 +1619,12 @@ void network_process_file(char *filename) {
 
        fp = fopen(filename, "rb");
        if (fp == NULL) {
-               lprintf(CTDL_CRIT, "Error opening %s: %s\n", filename, strerror(errno));
+               CtdlLogPrintf(CTDL_CRIT, "Error opening %s: %s\n", filename, strerror(errno));
                return;
        }
 
        fseek(fp, 0L, SEEK_END);
-       lprintf(CTDL_INFO, "network: processing %ld bytes from %s\n", ftell(fp), filename);
+       CtdlLogPrintf(CTDL_INFO, "network: processing %ld bytes from %s\n", ftell(fp), filename);
        rewind(fp);
 
        /* Look for messages in the data stream and break them out */
@@ -1667,11 +1667,11 @@ void network_do_spoolin(void) {
         */
        if (stat(ctdl_netin_dir, &statbuf)) return;
        if (statbuf.st_mtime == last_spoolin_mtime) {
-               lprintf(CTDL_DEBUG, "network: nothing in inbound queue\n");
+               CtdlLogPrintf(CTDL_DEBUG, "network: nothing in inbound queue\n");
                return;
        }
        last_spoolin_mtime = statbuf.st_mtime;
-       lprintf(CTDL_DEBUG, "network: processing inbound queue\n");
+       CtdlLogPrintf(CTDL_DEBUG, "network: processing inbound queue\n");
 
        /*
         * Ok, there's something interesting in there, so scan it.
@@ -1746,7 +1746,7 @@ void receive_spool(int sock, char *remote_nodename) {
        CtdlMakeTempFileName(tempfilename, sizeof tempfilename);
        if (sock_puts(sock, "NDOP") < 0) return;
        if (sock_getln(sock, buf, sizeof buf) < 0) return;
-       lprintf(CTDL_DEBUG, "<%s\n", buf);
+       CtdlLogPrintf(CTDL_DEBUG, "<%s\n", buf);
        if (buf[0] != '2') {
                return;
        }
@@ -1755,7 +1755,7 @@ void receive_spool(int sock, char *remote_nodename) {
        bytes_received = 0L;
        fp = fopen(tempfilename, "w");
        if (fp == NULL) {
-               lprintf(CTDL_CRIT, "cannot open download file locally: %s\n",
+               CtdlLogPrintf(CTDL_CRIT, "cannot open download file locally: %s\n",
                        strerror(errno));
                return;
        }
@@ -1816,9 +1816,9 @@ void receive_spool(int sock, char *remote_nodename) {
                return;
        }
        if (download_len > 0) {
-               lprintf(CTDL_NOTICE, "Received %ld octets from <%s>\n", download_len, remote_nodename);
+               CtdlLogPrintf(CTDL_NOTICE, "Received %ld octets from <%s>\n", download_len, remote_nodename);
        }
-       lprintf(CTDL_DEBUG, "%s\n", buf);
+       CtdlLogPrintf(CTDL_DEBUG, "%s\n", buf);
        
        /* Now copy the temp file to its permanent location.
         * (We copy instead of link because they may be on different filesystems)
@@ -1869,7 +1869,7 @@ void transmit_spool(int sock, char *remote_nodename)
 
        if (sock_puts(sock, "NUOP") < 0) return;
        if (sock_getln(sock, buf, sizeof buf) < 0) return;
-       lprintf(CTDL_DEBUG, "<%s\n", buf);
+       CtdlLogPrintf(CTDL_DEBUG, "<%s\n", buf);
        if (buf[0] != '2') {
                return;
        }
@@ -1881,7 +1881,7 @@ void transmit_spool(int sock, char *remote_nodename)
        fd = open(sfname, O_RDONLY);
        if (fd < 0) {
                if (errno != ENOENT) {
-                       lprintf(CTDL_CRIT, "cannot open upload file locally: %s\n",
+                       CtdlLogPrintf(CTDL_CRIT, "cannot open upload file locally: %s\n",
                                strerror(errno));
                }
                return;
@@ -1965,7 +1965,7 @@ void network_poll_node(char *node, char *secret, char *host, char *port) {
 
        /* Read the server greeting */
        if (sock_getln(sock, buf, sizeof buf) < 0) goto bail;
-       lprintf(CTDL_DEBUG, ">%s\n", buf);
+       CtdlLogPrintf(CTDL_DEBUG, ">%s\n", buf);
 
        /* Identify ourselves */
        snprintf(buf, sizeof buf, "NETP %s|%s", config.c_nodename, secret);
@@ -2188,7 +2188,7 @@ void cmd_netp(char *cmdbuf)
        extract_token(pass, cmdbuf, 1, '|', sizeof pass);
 
        if (doing_queue) {
-               lprintf(CTDL_WARNING, "Network node <%s> refused - spooling", node);
+               CtdlLogPrintf(CTDL_WARNING, "Network node <%s> refused - spooling", node);
                cprintf("%d spooling - try again in a few minutes\n",
                        ERROR + RESOURCE_BUSY);
                return;
@@ -2199,27 +2199,27 @@ void cmd_netp(char *cmdbuf)
        v = is_valid_node(nexthop, secret, node);
 
        if (v != 0) {
-               lprintf(CTDL_WARNING, "Unknown node <%s>\n", node);
+               CtdlLogPrintf(CTDL_WARNING, "Unknown node <%s>\n", node);
                cprintf("%d authentication failed\n",
                        ERROR + PASSWORD_REQUIRED);
                return;
        }
 
        if (strcasecmp(pass, secret)) {
-               lprintf(CTDL_WARNING, "Bad password for network node <%s>", node);
+               CtdlLogPrintf(CTDL_WARNING, "Bad password for network node <%s>", node);
                cprintf("%d authentication failed\n", ERROR + PASSWORD_REQUIRED);
                return;
        }
 
        if (network_talking_to(node, NTT_CHECK)) {
-               lprintf(CTDL_WARNING, "Duplicate session for network node <%s>", node);
+               CtdlLogPrintf(CTDL_WARNING, "Duplicate session for network node <%s>", node);
                cprintf("%d Already talking to %s right now\n", ERROR + RESOURCE_BUSY, node);
                return;
        }
 
        safestrncpy(CC->net_node, node, sizeof CC->net_node);
        network_talking_to(node, NTT_ADD);
-       lprintf(CTDL_NOTICE, "Network node <%s> logged in\n", CC->net_node);
+       CtdlLogPrintf(CTDL_NOTICE, "Network node <%s> logged in\n", CC->net_node);
        cprintf("%d authenticated as network node '%s'\n", CIT_OK,
                CC->net_node);
 }
index c7a613c044ab3a1a704b2c8d21d83404c28a88c7..18ba3ad1ae4a510fc70da8bc0796aecadf5d4c44 100644 (file)
@@ -83,7 +83,7 @@ int serv_notes_beforesave(struct CtdlMessage *msg)
                                }
                        }
 
-                       lprintf(9, "UUID of note is: %s\n", uuid);
+                       CtdlLogPrintf(9, "UUID of note is: %s\n", uuid);
                        if (!IsEmptyStr(uuid)) {
 
                                if (msg->cm_fields['E'] != NULL) {
index 336926c5868c473a2e8e97672630813ec9293bb0..c8bcb2fc93f425c902c60b17c90bc7c10be8ca31 100644 (file)
@@ -71,7 +71,7 @@ void pop3_cleanup_function(void) {
        /* Don't do this stuff if this is not a POP3 session! */
        if (CC->h_command_function != pop3_command_loop) return;
 
-       lprintf(CTDL_DEBUG, "Performing POP3 cleanup hook\n");
+       CtdlLogPrintf(CTDL_DEBUG, "Performing POP3 cleanup hook\n");
        if (POP3->msgs != NULL) free(POP3->msgs);
 
        free(POP3);
@@ -125,7 +125,7 @@ void pop3_user(char *argbuf) {
        strcpy(username, argbuf);
        striplt(username);
 
-       /* lprintf(CTDL_DEBUG, "Trying <%s>\n", username); */
+       /* CtdlLogPrintf(CTDL_DEBUG, "Trying <%s>\n", username); */
        if (CtdlLoginExistingUser(NULL, username) == login_ok) {
                cprintf("+OK Password required for %s\r\n", username);
        }
@@ -208,7 +208,7 @@ void pop3_login(void)
        if (msgs >= 0) {
                cprintf("+OK %s is logged in (%d messages)\r\n",
                        CC->user.fullname, msgs);
-               lprintf(CTDL_NOTICE, "POP3 authenticated %s\n", CC->user.fullname);
+               CtdlLogPrintf(CTDL_NOTICE, "POP3 authenticated %s\n", CC->user.fullname);
        }
        else {
                cprintf("-ERR Can't open your mailbox\r\n");
@@ -280,7 +280,7 @@ void pop3_pass(char *argbuf) {
        strcpy(password, argbuf);
        striplt(password);
 
-       /* lprintf(CTDL_DEBUG, "Trying <%s>\n", password); */
+       /* CtdlLogPrintf(CTDL_DEBUG, "Trying <%s>\n", password); */
        if (CtdlTryPassword(password) == pass_ok) {
                pop3_login();
        }
@@ -622,15 +622,15 @@ void pop3_command_loop(void) {
        time(&CC->lastcmd);
        memset(cmdbuf, 0, sizeof cmdbuf); /* Clear it, just in case */
        if (client_getln(cmdbuf, sizeof cmdbuf) < 1) {
-               lprintf(CTDL_ERR, "Client disconnected: ending session.\r\n");
+               CtdlLogPrintf(CTDL_ERR, "Client disconnected: ending session.\r\n");
                CC->kill_me = 1;
                return;
        }
        if (!strncasecmp(cmdbuf, "PASS", 4)) {
-               lprintf(CTDL_INFO, "POP3: PASS...\r\n");
+               CtdlLogPrintf(CTDL_INFO, "POP3: PASS...\r\n");
        }
        else {
-               lprintf(CTDL_INFO, "POP3: %s\r\n", cmdbuf);
+               CtdlLogPrintf(CTDL_INFO, "POP3: %s\r\n", cmdbuf);
        }
        while (strlen(cmdbuf) < 5) strcat(cmdbuf, " ");
 
index 7afe545337e69683ce5c729c0533cd321324b0ec..8015bd758b552d8c92ec527e95aade4b57587054 100644 (file)
@@ -69,26 +69,26 @@ void pop3_do_fetching(char *roomname, char *pop3host, char *pop3user, char *pop3
        struct cdbdata *cdbut;
        struct UseTable ut;
 
-       lprintf(CTDL_DEBUG, "POP3: %s %s %s <password>\n", roomname, pop3host, pop3user);
-       lprintf(CTDL_NOTICE, "Connecting to <%s>\n", pop3host);
+       CtdlLogPrintf(CTDL_DEBUG, "POP3: %s %s %s <password>\n", roomname, pop3host, pop3user);
+       CtdlLogPrintf(CTDL_NOTICE, "Connecting to <%s>\n", pop3host);
        
        if (CtdlThreadCheckStop())
                return;
                
        sock = sock_connect(pop3host, "110", "tcp");
        if (sock < 0) {
-               lprintf(CTDL_ERR, "Could not connect: %s\n", strerror(errno));
+               CtdlLogPrintf(CTDL_ERR, "Could not connect: %s\n", strerror(errno));
                return;
        }
        
        if (CtdlThreadCheckStop())
                goto bail;
 
-       lprintf(CTDL_DEBUG, "Connected!\n");
+       CtdlLogPrintf(CTDL_DEBUG, "Connected!\n");
 
        /* Read the server greeting */
        if (sock_getln(sock, buf, sizeof buf) < 0) goto bail;
-       lprintf(CTDL_DEBUG, ">%s\n", buf);
+       CtdlLogPrintf(CTDL_DEBUG, ">%s\n", buf);
        if (strncasecmp(buf, "+OK", 3)) goto bail;
 
        if (CtdlThreadCheckStop())
@@ -100,10 +100,10 @@ void pop3_do_fetching(char *roomname, char *pop3host, char *pop3user, char *pop3
         * actually barfs on LF-terminated newlines.
         */
        snprintf(buf, sizeof buf, "USER %s\r", pop3user);
-       lprintf(CTDL_DEBUG, "<%s\n", buf);
+       CtdlLogPrintf(CTDL_DEBUG, "<%s\n", buf);
        if (sock_puts(sock, buf) <0) goto bail;
        if (sock_getln(sock, buf, sizeof buf) < 0) goto bail;
-       lprintf(CTDL_DEBUG, ">%s\n", buf);
+       CtdlLogPrintf(CTDL_DEBUG, ">%s\n", buf);
        if (strncasecmp(buf, "+OK", 3)) goto bail;
 
        if (CtdlThreadCheckStop())
@@ -111,10 +111,10 @@ void pop3_do_fetching(char *roomname, char *pop3host, char *pop3user, char *pop3
 
        /* Password */
        snprintf(buf, sizeof buf, "PASS %s\r", pop3pass);
-       lprintf(CTDL_DEBUG, "<PASS <password>\n");
+       CtdlLogPrintf(CTDL_DEBUG, "<PASS <password>\n");
        if (sock_puts(sock, buf) <0) goto bail;
        if (sock_getln(sock, buf, sizeof buf) < 0) goto bail;
-       lprintf(CTDL_DEBUG, ">%s\n", buf);
+       CtdlLogPrintf(CTDL_DEBUG, ">%s\n", buf);
        if (strncasecmp(buf, "+OK", 3)) goto bail;
 
        if (CtdlThreadCheckStop())
@@ -122,10 +122,10 @@ void pop3_do_fetching(char *roomname, char *pop3host, char *pop3user, char *pop3
 
        /* Get the list of messages */
        snprintf(buf, sizeof buf, "LIST\r");
-       lprintf(CTDL_DEBUG, "<%s\n", buf);
+       CtdlLogPrintf(CTDL_DEBUG, "<%s\n", buf);
        if (sock_puts(sock, buf) <0) goto bail;
        if (sock_getln(sock, buf, sizeof buf) < 0) goto bail;
-       lprintf(CTDL_DEBUG, ">%s\n", buf);
+       CtdlLogPrintf(CTDL_DEBUG, ">%s\n", buf);
        if (strncasecmp(buf, "+OK", 3)) goto bail;
 
        if (CtdlThreadCheckStop())
@@ -136,7 +136,7 @@ void pop3_do_fetching(char *roomname, char *pop3host, char *pop3user, char *pop3
                        goto bail;
 
                if (sock_getln(sock, buf, sizeof buf) < 0) goto bail;
-               lprintf(CTDL_DEBUG, ">%s\n", buf);
+               CtdlLogPrintf(CTDL_DEBUG, ">%s\n", buf);
                msg_to_fetch = atoi(buf);
                if (msg_to_fetch > 0) {
                        if (alloc_msgs == 0) {
@@ -156,10 +156,10 @@ void pop3_do_fetching(char *roomname, char *pop3host, char *pop3user, char *pop3
 
                /* Find out the UIDL of the message, to determine whether we've already downloaded it */
                snprintf(buf, sizeof buf, "UIDL %d\r", msglist[i]);
-               lprintf(CTDL_DEBUG, "<%s\n", buf);
+               CtdlLogPrintf(CTDL_DEBUG, "<%s\n", buf);
                if (sock_puts(sock, buf) <0) goto bail;
                if (sock_getln(sock, buf, sizeof buf) < 0) goto bail;
-               lprintf(CTDL_DEBUG, ">%s\n", buf);
+               CtdlLogPrintf(CTDL_DEBUG, ">%s\n", buf);
                if (strncasecmp(buf, "+OK", 3)) goto bail;
                extract_token(this_uidl, buf, 2, ' ', sizeof this_uidl);
 
@@ -171,7 +171,7 @@ void pop3_do_fetching(char *roomname, char *pop3host, char *pop3user, char *pop3
                cdbut = cdb_fetch(CDB_USETABLE, utmsgid, strlen(utmsgid));
                if (cdbut != NULL) {
                        /* message has already been seen */
-                       lprintf(CTDL_DEBUG, "%s has already been seen\n", utmsgid);
+                       CtdlLogPrintf(CTDL_DEBUG, "%s has already been seen\n", utmsgid);
                        cdb_free(cdbut);
 
                        /* rewrite the record anyway, to update the timestamp */
@@ -182,10 +182,10 @@ void pop3_do_fetching(char *roomname, char *pop3host, char *pop3user, char *pop3
                else {
                        /* Message has not been seen. Tell the server to fetch the message... */
                        snprintf(buf, sizeof buf, "RETR %d\r", msglist[i]);
-                       lprintf(CTDL_DEBUG, "<%s\n", buf);
+                       CtdlLogPrintf(CTDL_DEBUG, "<%s\n", buf);
                        if (sock_puts(sock, buf) <0) goto bail;
                        if (sock_getln(sock, buf, sizeof buf) < 0) goto bail;
-                       lprintf(CTDL_DEBUG, ">%s\n", buf);
+                       CtdlLogPrintf(CTDL_DEBUG, ">%s\n", buf);
                        if (strncasecmp(buf, "+OK", 3)) goto bail;
        
                        if (CtdlThreadCheckStop())
@@ -195,7 +195,7 @@ void pop3_do_fetching(char *roomname, char *pop3host, char *pop3user, char *pop3
                        body = CtdlReadMessageBody(".", config.c_maxmsglen, NULL, 1, sock);
                        if (body == NULL) goto bail;
        
-                       lprintf(CTDL_DEBUG, "Converting message...\n");
+                       CtdlLogPrintf(CTDL_DEBUG, "Converting message...\n");
                        msg = convert_internet_message(body);
                        body = NULL;    /* yes, this should be dereferenced, NOT freed */
        
@@ -206,10 +206,10 @@ void pop3_do_fetching(char *roomname, char *pop3host, char *pop3user, char *pop3
        
                                if (!keep) {
                                        snprintf(buf, sizeof buf, "DELE %d\r", msglist[i]);
-                                       lprintf(CTDL_DEBUG, "<%s\n", buf);
+                                       CtdlLogPrintf(CTDL_DEBUG, "<%s\n", buf);
                                        if (sock_puts(sock, buf) <0) goto bail;
                                        if (sock_getln(sock, buf, sizeof buf) < 0) goto bail;
-                                       lprintf(CTDL_DEBUG, ">%s\n", buf); /* errors here are non-fatal */
+                                       CtdlLogPrintf(CTDL_DEBUG, ">%s\n", buf); /* errors here are non-fatal */
                                }
 
                                /* write the uidl to the use table so we don't fetch this message again */
@@ -224,10 +224,10 @@ void pop3_do_fetching(char *roomname, char *pop3host, char *pop3user, char *pop3
 
        /* Log out */
        snprintf(buf, sizeof buf, "QUIT\r");
-       lprintf(CTDL_DEBUG, "<%s\n", buf);
+       CtdlLogPrintf(CTDL_DEBUG, "<%s\n", buf);
        if (sock_puts(sock, buf) <0) goto bail;
        if (sock_getln(sock, buf, sizeof buf) < 0) goto bail;
-       lprintf(CTDL_DEBUG, ">%s\n", buf);
+       CtdlLogPrintf(CTDL_DEBUG, ">%s\n", buf);
 bail:  sock_close(sock);
        if (msglist) free(msglist);
 }
@@ -307,7 +307,7 @@ void pop3client_scan(void) {
        if (doing_pop3client) return;
        doing_pop3client = 1;
 
-       lprintf(CTDL_DEBUG, "pop3client started\n");
+       CtdlLogPrintf(CTDL_DEBUG, "pop3client started\n");
        ForEachRoom(pop3client_scan_room, NULL);
 
        while (palist != NULL && !CtdlThreadCheckStop()) {
@@ -320,7 +320,7 @@ void pop3client_scan(void) {
                free(pptr);
        }
 
-       lprintf(CTDL_DEBUG, "pop3client ended\n");
+       CtdlLogPrintf(CTDL_DEBUG, "pop3client ended\n");
        last_run = time(NULL);
        doing_pop3client = 0;
 }
index 65f6d5b95a58a1845da2a8b613a8538fbbcc8dd1..605b0772d70524977cae7784f783954ecf8784ea 100644 (file)
@@ -115,7 +115,7 @@ void rss_save_item(struct rss_item *ri) {
        cdbut = cdb_fetch(CDB_USETABLE, utmsgid, strlen(utmsgid));
        if (cdbut != NULL) {
                /* Item has already been seen */
-               lprintf(CTDL_DEBUG, "%s has already been seen\n", utmsgid);
+               CtdlLogPrintf(CTDL_DEBUG, "%s has already been seen\n", utmsgid);
                cdb_free(cdbut);
 
                /* rewrite the record anyway, to update the timestamp */
@@ -296,7 +296,7 @@ void rss_xml_end(void *data, const char *supplied_el) {
        }
 
        if ( (!strcasecmp(el, "rss")) || (!strcasecmp(el, "rdf")) ) {
-               lprintf(CTDL_DEBUG, "End of feed detected.  Closing parser.\n");
+               CtdlLogPrintf(CTDL_DEBUG, "End of feed detected.  Closing parser.\n");
                ri->done_parsing = 1;
        }
 
@@ -402,7 +402,7 @@ void rss_do_fetching(char *url, char *rooms) {
 
        /* Parse the URL */
        if (parse_url(url, rsshost, &rssport, rssurl) != 0) {
-               lprintf(CTDL_ALERT, "Invalid URL: %s\n", url);
+               CtdlLogPrintf(CTDL_ALERT, "Invalid URL: %s\n", url);
        }
        
        if (CtdlThreadCheckStop())
@@ -410,7 +410,7 @@ void rss_do_fetching(char *url, char *rooms) {
 
        xp = XML_ParserCreateNS("UTF-8", ':');
        if (!xp) {
-               lprintf(CTDL_ALERT, "Cannot create XML parser!\n");
+               CtdlLogPrintf(CTDL_ALERT, "Cannot create XML parser!\n");
                return;
        }
 
@@ -426,38 +426,38 @@ void rss_do_fetching(char *url, char *rooms) {
                return;
        }
        
-retry: lprintf(CTDL_NOTICE, "Connecting to <%s>\n", rsshost);
+retry: CtdlLogPrintf(CTDL_NOTICE, "Connecting to <%s>\n", rsshost);
        sprintf(buf, "%d", rssport);
        sock = sock_connect(rsshost, buf, "tcp");
        if (sock >= 0) {
-               lprintf(CTDL_DEBUG, "Connected!\n");
+               CtdlLogPrintf(CTDL_DEBUG, "Connected!\n");
 
                if (CtdlThreadCheckStop())
                        goto shutdown ;
                        
                snprintf(buf, sizeof buf, "GET %s HTTP/1.0", rssurl);
-               lprintf(CTDL_DEBUG, "<%s\n", buf);
+               CtdlLogPrintf(CTDL_DEBUG, "<%s\n", buf);
                sock_puts(sock, buf);
 
                if (CtdlThreadCheckStop())
                        goto shutdown ;
                        
                snprintf(buf, sizeof buf, "Host: %s", rsshost);
-               lprintf(CTDL_DEBUG, "<%s\n", buf);
+               CtdlLogPrintf(CTDL_DEBUG, "<%s\n", buf);
                sock_puts(sock, buf);
 
                if (CtdlThreadCheckStop())
                        goto shutdown ;
                        
                snprintf(buf, sizeof buf, "User-Agent: %s", CITADEL);
-               lprintf(CTDL_DEBUG, "<%s\n", buf);
+               CtdlLogPrintf(CTDL_DEBUG, "<%s\n", buf);
                sock_puts(sock, buf);
 
                if (CtdlThreadCheckStop())
                        goto shutdown ;
                        
                snprintf(buf, sizeof buf, "Accept: */*");
-               lprintf(CTDL_DEBUG, "<%s\n", buf);
+               CtdlLogPrintf(CTDL_DEBUG, "<%s\n", buf);
                sock_puts(sock, buf);
 
                if (CtdlThreadCheckStop())
@@ -469,7 +469,7 @@ retry:      lprintf(CTDL_NOTICE, "Connecting to <%s>\n", rsshost);
                        goto shutdown ;
                        
                if (sock_getln(sock, buf, sizeof buf) >= 0) {
-                       lprintf(CTDL_DEBUG, ">%s\n", buf);
+                       CtdlLogPrintf(CTDL_DEBUG, ">%s\n", buf);
                        remove_token(buf, 0, ' ');
 
                        /* 200 OK */
@@ -506,7 +506,7 @@ retry:      lprintf(CTDL_NOTICE, "Connecting to <%s>\n", rsshost);
                                                        goto retry;
                                                }
                                                else {
-                                                       lprintf(CTDL_ALERT, "Invalid URL: %s\n", buf);
+                                                       CtdlLogPrintf(CTDL_ALERT, "Invalid URL: %s\n", buf);
                                                }
                                        }
                                }
@@ -517,7 +517,7 @@ shutdown:
                sock_close(sock);
        }
        else {
-               lprintf(CTDL_ERR, "Could not connect: %s\n", strerror(errno));
+               CtdlLogPrintf(CTDL_ERR, "Could not connect: %s\n", strerror(errno));
        }
 
        XML_ParserFree(xp);
@@ -645,7 +645,7 @@ void *rssclient_scan(void *args) {
        if (doing_rssclient) return NULL;
        doing_rssclient = 1;
 
-       lprintf(CTDL_DEBUG, "rssclient started\n");
+       CtdlLogPrintf(CTDL_DEBUG, "rssclient started\n");
        ForEachRoom(rssclient_scan_room, NULL);
 
        while (rnclist != NULL && !CtdlThreadCheckStop()) {
@@ -656,7 +656,7 @@ void *rssclient_scan(void *args) {
                free(rptr);
        }
 
-       lprintf(CTDL_DEBUG, "rssclient ended\n");
+       CtdlLogPrintf(CTDL_DEBUG, "rssclient ended\n");
        last_run = time(NULL);
        doing_rssclient = 0;
        if (!CtdlThreadCheckStop())
index 515c5f6afa7f14e79480fbeed05c139346b3ceb1..be0e4865a91c73560149ce58feb96d5d39e66179 100644 (file)
@@ -51,7 +51,6 @@
  * display who's online
  */
 void cmd_rwho(char *argbuf) {
-       struct CitContext *cptr;
        struct CitContext *nptr;
        int nContexts, i;
        int spoofed = 0;
index 726d58d504fafd552fbee56178e427a91782993e..46957b5971740a6f02ee7c06962eef7cc9b53841 100644 (file)
@@ -54,7 +54,7 @@ char *msiv_extensions = NULL;
  */
 int ctdl_debug(sieve2_context_t *s, void *my)
 {
-       lprintf(CTDL_DEBUG, "Sieve: %s\n", sieve2_getvalue_string(s, "message"));
+       CtdlLogPrintf(CTDL_DEBUG, "Sieve: %s\n", sieve2_getvalue_string(s, "message"));
        return SIEVE2_OK;
 }
 
@@ -64,7 +64,7 @@ int ctdl_debug(sieve2_context_t *s, void *my)
  */
 int ctdl_errparse(sieve2_context_t *s, void *my)
 {
-       lprintf(CTDL_WARNING, "Error in script, line %d: %s\n",
+       CtdlLogPrintf(CTDL_WARNING, "Error in script, line %d: %s\n",
                sieve2_getvalue_int(s, "lineno"),
                sieve2_getvalue_string(s, "message")
        );
@@ -77,7 +77,7 @@ int ctdl_errparse(sieve2_context_t *s, void *my)
  */
 int ctdl_errexec(sieve2_context_t *s, void *my)
 {
-       lprintf(CTDL_WARNING, "Error executing script: %s\n",
+       CtdlLogPrintf(CTDL_WARNING, "Error executing script: %s\n",
                sieve2_getvalue_string(s, "message")
        );
        return SIEVE2_OK;
@@ -96,22 +96,22 @@ int ctdl_redirect(sieve2_context_t *s, void *my)
 
        safestrncpy(recp, sieve2_getvalue_string(s, "address"), sizeof recp);
 
-       lprintf(CTDL_DEBUG, "Action is REDIRECT, recipient <%s>\n", recp);
+       CtdlLogPrintf(CTDL_DEBUG, "Action is REDIRECT, recipient <%s>\n", recp);
 
        valid = validate_recipients(recp, NULL, 0);
        if (valid == NULL) {
-               lprintf(CTDL_WARNING, "REDIRECT failed: bad recipient <%s>\n", recp);
+               CtdlLogPrintf(CTDL_WARNING, "REDIRECT failed: bad recipient <%s>\n", recp);
                return SIEVE2_ERROR_BADARGS;
        }
        if (valid->num_error > 0) {
-               lprintf(CTDL_WARNING, "REDIRECT failed: bad recipient <%s>\n", recp);
+               CtdlLogPrintf(CTDL_WARNING, "REDIRECT failed: bad recipient <%s>\n", recp);
                free_recipients(valid);
                return SIEVE2_ERROR_BADARGS;
        }
 
        msg = CtdlFetchMessage(cs->msgnum, 1);
        if (msg == NULL) {
-               lprintf(CTDL_WARNING, "REDIRECT failed: unable to fetch msg %ld\n", cs->msgnum);
+               CtdlLogPrintf(CTDL_WARNING, "REDIRECT failed: unable to fetch msg %ld\n", cs->msgnum);
                free_recipients(valid);
                return SIEVE2_ERROR_BADARGS;
        }
@@ -131,7 +131,7 @@ int ctdl_keep(sieve2_context_t *s, void *my)
 {
        struct ctdl_sieve *cs = (struct ctdl_sieve *)my;
        
-       lprintf(CTDL_DEBUG, "Action is KEEP\n");
+       CtdlLogPrintf(CTDL_DEBUG, "Action is KEEP\n");
 
        cs->keep = 1;
        cs->cancel_implicit_keep = 1;
@@ -150,7 +150,7 @@ int ctdl_fileinto(sieve2_context_t *s, void *my)
        char foldername[256];
        char original_room_name[ROOMNAMELEN];
 
-       lprintf(CTDL_DEBUG, "Action is FILEINTO, destination is <%s>\n", dest_folder);
+       CtdlLogPrintf(CTDL_DEBUG, "Action is FILEINTO, destination is <%s>\n", dest_folder);
 
        /* FILEINTO 'INBOX' is the same thing as KEEP */
        if ( (!strcasecmp(dest_folder, "INBOX")) || (!strcasecmp(dest_folder, MAILROOM)) ) {
@@ -173,7 +173,7 @@ int ctdl_fileinto(sieve2_context_t *s, void *my)
        }
 
        if (c != 0) {
-               lprintf(CTDL_WARNING, "FILEINTO failed: target <%s> does not exist\n", dest_folder);
+               CtdlLogPrintf(CTDL_WARNING, "FILEINTO failed: target <%s> does not exist\n", dest_folder);
                return SIEVE2_ERROR_BADARGS;
        }
 
@@ -204,7 +204,7 @@ int ctdl_discard(sieve2_context_t *s, void *my)
 {
        struct ctdl_sieve *cs = (struct ctdl_sieve *)my;
 
-       lprintf(CTDL_DEBUG, "Action is DISCARD\n");
+       CtdlLogPrintf(CTDL_DEBUG, "Action is DISCARD\n");
 
        /* Cancel the implicit keep.  That's all there is to it. */
        cs->cancel_implicit_keep = 1;
@@ -221,11 +221,11 @@ int ctdl_reject(sieve2_context_t *s, void *my)
        struct ctdl_sieve *cs = (struct ctdl_sieve *)my;
        char *reject_text = NULL;
 
-       lprintf(CTDL_DEBUG, "Action is REJECT\n");
+       CtdlLogPrintf(CTDL_DEBUG, "Action is REJECT\n");
 
        /* If we don't know who sent the message, do a DISCARD instead. */
        if (IsEmptyStr(cs->sender)) {
-               lprintf(CTDL_INFO, "Unknown sender.  Doing DISCARD instead of REJECT.\n");
+               CtdlLogPrintf(CTDL_INFO, "Unknown sender.  Doing DISCARD instead of REJECT.\n");
                return ctdl_discard(s, my);
        }
 
@@ -276,7 +276,7 @@ int ctdl_vacation(sieve2_context_t *s, void *my)
        char *vacamsg_text = NULL;
        char vacamsg_subject[1024];
 
-       lprintf(CTDL_DEBUG, "Action is VACATION\n");
+       CtdlLogPrintf(CTDL_DEBUG, "Action is VACATION\n");
 
        message = sieve2_getvalue_string(s, "message");
        if (message == NULL) return SIEVE2_ERROR_BADARGS;
@@ -296,7 +296,7 @@ int ctdl_vacation(sieve2_context_t *s, void *my)
        for (vptr = cs->u->first_vacation; vptr != NULL; vptr = vptr->next) {
                if (!strcasecmp(vptr->fromaddr, cs->sender)) {
                        if ( (time(NULL) - vptr->timestamp) < (days * 86400) ) {
-                               lprintf(CTDL_DEBUG, "Already alerted <%s> recently.\n", cs->sender);
+                               CtdlLogPrintf(CTDL_DEBUG, "Already alerted <%s> recently.\n", cs->sender);
                                return SIEVE2_OK;
                        }
                }
@@ -380,7 +380,7 @@ int ctdl_getenvelope(sieve2_context_t *s, void *my)
 {
        struct ctdl_sieve *cs = (struct ctdl_sieve *)my;
 
-       lprintf(CTDL_DEBUG, "Action is GETENVELOPE\nEnvFrom: %s\n  EnvTo: %s\n",
+       CtdlLogPrintf(CTDL_DEBUG, "Action is GETENVELOPE\nEnvFrom: %s\n  EnvTo: %s\n",
                cs->envelope_from, cs->envelope_to);
 
        if (cs->envelope_from != NULL) {
@@ -452,13 +452,13 @@ int ctdl_getscript(sieve2_context_t *s, void *my) {
 
        for (sptr=cs->u->first_script; sptr!=NULL; sptr=sptr->next) {
                if (sptr->script_active > 0) {
-                       lprintf(CTDL_DEBUG, "ctdl_getscript() is using script '%s'\n", sptr->script_name);
+                       CtdlLogPrintf(CTDL_DEBUG, "ctdl_getscript() is using script '%s'\n", sptr->script_name);
                        sieve2_setvalue_string(s, "script", sptr->script_content);
                        return SIEVE2_OK;
                }
        }
                
-       lprintf(CTDL_DEBUG, "ctdl_getscript() found no active script\n");
+       CtdlLogPrintf(CTDL_DEBUG, "ctdl_getscript() found no active script\n");
        return SIEVE2_ERROR_GETSCRIPT;
 }
 
@@ -469,7 +469,7 @@ int ctdl_getheaders(sieve2_context_t *s, void *my) {
 
        struct ctdl_sieve *cs = (struct ctdl_sieve *)my;
 
-       lprintf(CTDL_DEBUG, "ctdl_getheaders() was called\n");
+       CtdlLogPrintf(CTDL_DEBUG, "ctdl_getheaders() was called\n");
        sieve2_setvalue_string(s, "allheaders", cs->rfc822headers);
        return SIEVE2_OK;
 }
@@ -490,7 +490,7 @@ void sieve_queue_room(struct ctdlroom *which_room) {
        ptr->next = sieve_list;
        sieve_list = ptr;
        end_critical_section(S_SIEVELIST);
-       lprintf(CTDL_DEBUG, "<%s> queued for Sieve processing\n", which_room->QRname);
+       CtdlLogPrintf(CTDL_DEBUG, "<%s> queued for Sieve processing\n", which_room->QRname);
 }
 
 
@@ -510,13 +510,13 @@ void sieve_do_msg(long msgnum, void *userdata) {
 
        if (userdata == NULL)
        {
-               lprintf(CTDL_EMERG, "Cant process Message <%ld>without Userdata!\n", msgnum);
+               CtdlLogPrintf(CTDL_EMERG, "Cant process Message <%ld>without Userdata!\n", msgnum);
                return;
        }
 
        sieve2_context = u->sieve2_context;
 
-       lprintf(CTDL_DEBUG, "Performing sieve processing on msg <%ld>\n", msgnum);
+       CtdlLogPrintf(CTDL_DEBUG, "Performing sieve processing on msg <%ld>\n", msgnum);
 
        msg = CtdlFetchMessage(msgnum, 0);
        if (msg == NULL) return;
@@ -628,10 +628,10 @@ void sieve_do_msg(long msgnum, void *userdata) {
 
        sieve2_setvalue_string(sieve2_context, "allheaders", my.rfc822headers);
        
-       lprintf(CTDL_DEBUG, "Calling sieve2_execute()\n");
+       CtdlLogPrintf(CTDL_DEBUG, "Calling sieve2_execute()\n");
        res = sieve2_execute(sieve2_context, &my);
        if (res != SIEVE2_OK) {
-               lprintf(CTDL_CRIT, "sieve2_execute() returned %d: %s\n", res, sieve2_errstr(res));
+               CtdlLogPrintf(CTDL_CRIT, "sieve2_execute() returned %d: %s\n", res, sieve2_errstr(res));
        }
 
        free(my.rfc822headers);
@@ -642,11 +642,11 @@ void sieve_do_msg(long msgnum, void *userdata) {
         * if no other action was successfully taken.
         */
        if ( (!my.keep) && (my.cancel_implicit_keep) ) {
-               lprintf(CTDL_DEBUG, "keep is 0 -- deleting message from inbox\n");
+               CtdlLogPrintf(CTDL_DEBUG, "keep is 0 -- deleting message from inbox\n");
                CtdlDeleteMessages(CC->room.QRname, &msgnum, 1, "");
        }
 
-       lprintf(CTDL_DEBUG, "Completed sieve processing on msg <%ld>\n", msgnum);
+       CtdlLogPrintf(CTDL_DEBUG, "Completed sieve processing on msg <%ld>\n", msgnum);
        u->lastproc = msgnum;
 
        return;
@@ -866,7 +866,7 @@ void sieve_do_room(char *roomname) {
         */
        snprintf(u.config_roomname, sizeof u.config_roomname, "%010ld.%s", atol(roomname), USERCONFIGROOM);
        if (getroom(&CC->room, u.config_roomname) != 0) {
-               lprintf(CTDL_DEBUG, "<%s> does not exist.  No processing is required.\n", u.config_roomname);
+               CtdlLogPrintf(CTDL_DEBUG, "<%s> does not exist.  No processing is required.\n", u.config_roomname);
                return;
        }
 
@@ -878,14 +878,14 @@ void sieve_do_room(char *roomname) {
                get_sieve_config_backend, (void *)&u );
 
        if (u.config_msgnum < 0) {
-               lprintf(CTDL_DEBUG, "No Sieve rules exist.  No processing is required.\n");
+               CtdlLogPrintf(CTDL_DEBUG, "No Sieve rules exist.  No processing is required.\n");
                return;
        }
 
-       lprintf(CTDL_DEBUG, "Rules found.  Performing Sieve processing for <%s>\n", roomname);
+       CtdlLogPrintf(CTDL_DEBUG, "Rules found.  Performing Sieve processing for <%s>\n", roomname);
 
        if (getroom(&CC->room, roomname) != 0) {
-               lprintf(CTDL_CRIT, "ERROR: cannot load <%s>\n", roomname);
+               CtdlLogPrintf(CTDL_CRIT, "ERROR: cannot load <%s>\n", roomname);
                return;
        }
 
@@ -893,13 +893,13 @@ void sieve_do_room(char *roomname) {
        
        res = sieve2_alloc(&sieve2_context);
        if (res != SIEVE2_OK) {
-               lprintf(CTDL_CRIT, "sieve2_alloc() returned %d: %s\n", res, sieve2_errstr(res));
+               CtdlLogPrintf(CTDL_CRIT, "sieve2_alloc() returned %d: %s\n", res, sieve2_errstr(res));
                return;
        }
 
        res = sieve2_callbacks(sieve2_context, ctdl_sieve_callbacks);
        if (res != SIEVE2_OK) {
-               lprintf(CTDL_CRIT, "sieve2_callbacks() returned %d: %s\n", res, sieve2_errstr(res));
+               CtdlLogPrintf(CTDL_CRIT, "sieve2_callbacks() returned %d: %s\n", res, sieve2_errstr(res));
                goto BAIL;
        }
 
@@ -910,7 +910,7 @@ void sieve_do_room(char *roomname) {
        my.u = &u;
        res = sieve2_validate(sieve2_context, &my);
        if (res != SIEVE2_OK) {
-               lprintf(CTDL_CRIT, "sieve2_validate() returned %d: %s\n", res, sieve2_errstr(res));
+               CtdlLogPrintf(CTDL_CRIT, "sieve2_validate() returned %d: %s\n", res, sieve2_errstr(res));
                goto BAIL;
        }
 
@@ -925,7 +925,7 @@ void sieve_do_room(char *roomname) {
 BAIL:
        res = sieve2_free(&sieve2_context);
        if (res != SIEVE2_OK) {
-               lprintf(CTDL_CRIT, "sieve2_free() returned %d: %s\n", res, sieve2_errstr(res));
+               CtdlLogPrintf(CTDL_CRIT, "sieve2_free() returned %d: %s\n", res, sieve2_errstr(res));
        }
 
        /* Rewrite the config if we have to */
@@ -940,7 +940,7 @@ void perform_sieve_processing(void) {
        struct RoomProcList *ptr = NULL;
 
        if (sieve_list != NULL) {
-               lprintf(CTDL_DEBUG, "Begin Sieve processing\n");
+               CtdlLogPrintf(CTDL_DEBUG, "Begin Sieve processing\n");
                while (sieve_list != NULL) {
                        char spoolroomname[ROOMNAMELEN];
                        safestrncpy(spoolroomname, sieve_list->name, sizeof spoolroomname);
@@ -1248,7 +1248,7 @@ void ctdl_sieve_init(void) {
                strcpy(&cred[55], "...");
        }
 
-       lprintf(CTDL_INFO, "%s\n",cred);
+       CtdlLogPrintf(CTDL_INFO, "%s\n",cred);
        free(cred);
 
        /* Briefly initialize a Sieve parser instance just so we can list the
@@ -1256,22 +1256,22 @@ void ctdl_sieve_init(void) {
         */
        res = sieve2_alloc(&sieve2_context);
        if (res != SIEVE2_OK) {
-               lprintf(CTDL_CRIT, "sieve2_alloc() returned %d: %s\n", res, sieve2_errstr(res));
+               CtdlLogPrintf(CTDL_CRIT, "sieve2_alloc() returned %d: %s\n", res, sieve2_errstr(res));
                return;
        }
 
        res = sieve2_callbacks(sieve2_context, ctdl_sieve_callbacks);
        if (res != SIEVE2_OK) {
-               lprintf(CTDL_CRIT, "sieve2_callbacks() returned %d: %s\n", res, sieve2_errstr(res));
+               CtdlLogPrintf(CTDL_CRIT, "sieve2_callbacks() returned %d: %s\n", res, sieve2_errstr(res));
                goto BAIL;
        }
 
        msiv_extensions = strdup(sieve2_listextensions(sieve2_context));
-       lprintf(CTDL_INFO, "Extensions: %s\n", msiv_extensions);
+       CtdlLogPrintf(CTDL_INFO, "Extensions: %s\n", msiv_extensions);
 
 BAIL:  res = sieve2_free(&sieve2_context);
        if (res != SIEVE2_OK) {
-               lprintf(CTDL_CRIT, "sieve2_free() returned %d: %s\n", res, sieve2_errstr(res));
+               CtdlLogPrintf(CTDL_CRIT, "sieve2_free() returned %d: %s\n", res, sieve2_errstr(res));
        }
 
 }
index a79bd0df4383ee5e227aacfdc65af9b05cdbc672..6326168d7908f8a2a0f7e1757b5bff4c4ffa09d6 100644 (file)
@@ -211,7 +211,7 @@ void lmtp_unfiltered_greeting(void) {
  */
 void smtp_auth_greeting(void) {
                cprintf("235 Hello, %s\r\n", CC->user.fullname);
-               lprintf(CTDL_NOTICE, "SMTP authenticated %s\n", CC->user.fullname);
+               CtdlLogPrintf(CTDL_NOTICE, "SMTP authenticated %s\n", CC->user.fullname);
                CC->internal_pgm = 0;
                CC->cs_flags &= ~CS_STEALTH;
 }
@@ -304,7 +304,7 @@ void smtp_get_user(char *argbuf) {
        char username[SIZ];
 
        CtdlDecodeBase64(username, argbuf, SIZ);
-       /* lprintf(CTDL_DEBUG, "Trying <%s>\n", username); */
+       /* CtdlLogPrintf(CTDL_DEBUG, "Trying <%s>\n", username); */
        if (CtdlLoginExistingUser(NULL, username) == login_ok) {
                CtdlEncodeBase64(buf, "Password:", 9, 0);
                cprintf("334 %s\r\n", buf);
@@ -324,7 +324,7 @@ void smtp_get_pass(char *argbuf) {
        char password[SIZ];
 
        CtdlDecodeBase64(password, argbuf, SIZ);
-       /* lprintf(CTDL_DEBUG, "Trying <%s>\n", password); */
+       /* CtdlLogPrintf(CTDL_DEBUG, "Trying <%s>\n", password); */
        if (CtdlTryPassword(password) == pass_ok) {
                smtp_auth_greeting();
        }
@@ -678,7 +678,7 @@ void smtp_data(void) {
                return;
        }
 
-       lprintf(CTDL_DEBUG, "Converting message...\n");
+       CtdlLogPrintf(CTDL_DEBUG, "Converting message...\n");
        msg = convert_internet_message(body);
 
        /* If the user is locally authenticated, FORCE the From: header to
@@ -820,11 +820,11 @@ void smtp_command_loop(void) {
        time(&CC->lastcmd);
        memset(cmdbuf, 0, sizeof cmdbuf); /* Clear it, just in case */
        if (client_getln(cmdbuf, sizeof cmdbuf) < 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, "SMTP: %s\n", cmdbuf);
+       CtdlLogPrintf(CTDL_INFO, "SMTP: %s\n", cmdbuf);
        while (strlen(cmdbuf) < 5) strcat(cmdbuf, " ");
 
        if (SMTP->command_state == smtp_user) {
@@ -935,7 +935,7 @@ void smtp_try(const char *key, const char *addr, int *status,
        /* Parse out the host portion of the recipient address */
        process_rfc822_addr(addr, user, node, name);
 
-       lprintf(CTDL_DEBUG, "Attempting SMTP delivery to <%s> @ <%s> (%s)\n",
+       CtdlLogPrintf(CTDL_DEBUG, "Attempting SMTP delivery to <%s> @ <%s> (%s)\n",
                user, node, name);
 
        /* Load the message out of the database */
@@ -998,7 +998,7 @@ void smtp_try(const char *key, const char *addr, int *status,
 
        /* Figure out what mail exchanger host we have to connect to */
        num_mxhosts = getmx(mxhosts, node);
-       lprintf(CTDL_DEBUG, "Number of MX hosts for <%s> is %d\n", node, num_mxhosts);
+       CtdlLogPrintf(CTDL_DEBUG, "Number of MX hosts for <%s> is %d\n", node, num_mxhosts);
        if (num_mxhosts < 1) {
                *status = 5;
                snprintf(dsn, SIZ, "No MX hosts found for <%s>", node);
@@ -1032,10 +1032,10 @@ void smtp_try(const char *key, const char *addr, int *status,
                else {
                        strcpy(mx_port, "25");
                }
-               lprintf(CTDL_DEBUG, "Trying %s : %s ...\n", mx_host, mx_port);
+               CtdlLogPrintf(CTDL_DEBUG, "Trying %s : %s ...\n", mx_host, mx_port);
                sock = sock_connect(mx_host, mx_port, "tcp");
                snprintf(dsn, SIZ, "Could not connect: %s", strerror(errno));
-               if (sock >= 0) lprintf(CTDL_DEBUG, "Connected!\n");
+               if (sock >= 0) CtdlLogPrintf(CTDL_DEBUG, "Connected!\n");
                if (sock < 0) {
                        if (errno > 0) {
                                snprintf(dsn, SIZ, "%s", strerror(errno));
@@ -1057,7 +1057,7 @@ void smtp_try(const char *key, const char *addr, int *status,
                strcpy(dsn, "Connection broken during SMTP conversation");
                goto bail;
        }
-       lprintf(CTDL_DEBUG, "<%s\n", buf);
+       CtdlLogPrintf(CTDL_DEBUG, "<%s\n", buf);
        if (buf[0] != '2') {
                if (buf[0] == '4') {
                        *status = 4;
@@ -1075,17 +1075,17 @@ void smtp_try(const char *key, const char *addr, int *status,
 
        /* Do a EHLO command.  If it fails, try the HELO command. */
        snprintf(buf, sizeof buf, "EHLO %s\r\n", config.c_fqdn);
-       lprintf(CTDL_DEBUG, ">%s", buf);
+       CtdlLogPrintf(CTDL_DEBUG, ">%s", buf);
        sock_write(sock, buf, strlen(buf));
        if (ml_sock_gets(sock, buf) < 0) {
                *status = 4;
                strcpy(dsn, "Connection broken during SMTP HELO");
                goto bail;
        }
-       lprintf(CTDL_DEBUG, "<%s\n", buf);
+       CtdlLogPrintf(CTDL_DEBUG, "<%s\n", buf);
        if (buf[0] != '2') {
                snprintf(buf, sizeof buf, "HELO %s\r\n", config.c_fqdn);
-               lprintf(CTDL_DEBUG, ">%s", buf);
+               CtdlLogPrintf(CTDL_DEBUG, ">%s", buf);
                sock_write(sock, buf, strlen(buf));
                if (ml_sock_gets(sock, buf) < 0) {
                        *status = 4;
@@ -1112,14 +1112,14 @@ void smtp_try(const char *key, const char *addr, int *status,
                sprintf(buf, "%s%c%s%c%s", mx_user, '\0', mx_user, '\0', mx_pass);
                CtdlEncodeBase64(encoded, buf, strlen(mx_user) + strlen(mx_user) + strlen(mx_pass) + 2, 0);
                snprintf(buf, sizeof buf, "AUTH PLAIN %s\r\n", encoded);
-               lprintf(CTDL_DEBUG, ">%s", buf);
+               CtdlLogPrintf(CTDL_DEBUG, ">%s", buf);
                sock_write(sock, buf, strlen(buf));
                if (ml_sock_gets(sock, buf) < 0) {
                        *status = 4;
                        strcpy(dsn, "Connection broken during SMTP AUTH");
                        goto bail;
                }
-               lprintf(CTDL_DEBUG, "<%s\n", buf);
+               CtdlLogPrintf(CTDL_DEBUG, "<%s\n", buf);
                if (buf[0] != '2') {
                        if (buf[0] == '4') {
                                *status = 4;
@@ -1136,14 +1136,14 @@ void smtp_try(const char *key, const char *addr, int *status,
 
        /* previous command succeeded, now try the MAIL From: command */
        snprintf(buf, sizeof buf, "MAIL From: <%s>\r\n", mailfrom);
-       lprintf(CTDL_DEBUG, ">%s", buf);
+       CtdlLogPrintf(CTDL_DEBUG, ">%s", buf);
        sock_write(sock, buf, strlen(buf));
        if (ml_sock_gets(sock, buf) < 0) {
                *status = 4;
                strcpy(dsn, "Connection broken during SMTP MAIL");
                goto bail;
        }
-       lprintf(CTDL_DEBUG, "<%s\n", buf);
+       CtdlLogPrintf(CTDL_DEBUG, "<%s\n", buf);
        if (buf[0] != '2') {
                if (buf[0] == '4') {
                        *status = 4;
@@ -1159,14 +1159,14 @@ void smtp_try(const char *key, const char *addr, int *status,
 
        /* MAIL succeeded, now try the RCPT To: command */
        snprintf(buf, sizeof buf, "RCPT To: <%s@%s>\r\n", user, node);
-       lprintf(CTDL_DEBUG, ">%s", buf);
+       CtdlLogPrintf(CTDL_DEBUG, ">%s", buf);
        sock_write(sock, buf, strlen(buf));
        if (ml_sock_gets(sock, buf) < 0) {
                *status = 4;
                strcpy(dsn, "Connection broken during SMTP RCPT");
                goto bail;
        }
-       lprintf(CTDL_DEBUG, "<%s\n", buf);
+       CtdlLogPrintf(CTDL_DEBUG, "<%s\n", buf);
        if (buf[0] != '2') {
                if (buf[0] == '4') {
                        *status = 4;
@@ -1181,14 +1181,14 @@ void smtp_try(const char *key, const char *addr, int *status,
        }
 
        /* RCPT succeeded, now try the DATA command */
-       lprintf(CTDL_DEBUG, ">DATA\n");
+       CtdlLogPrintf(CTDL_DEBUG, ">DATA\n");
        sock_write(sock, "DATA\r\n", 6);
        if (ml_sock_gets(sock, buf) < 0) {
                *status = 4;
                strcpy(dsn, "Connection broken during SMTP DATA");
                goto bail;
        }
-       lprintf(CTDL_DEBUG, "<%s\n", buf);
+       CtdlLogPrintf(CTDL_DEBUG, "<%s\n", buf);
        if (buf[0] != '3') {
                if (buf[0] == '4') {
                        *status = 3;
@@ -1205,7 +1205,7 @@ void smtp_try(const char *key, const char *addr, int *status,
        /* If we reach this point, the server is expecting data */
        sock_write(sock, msgtext, msg_size);
        if (msgtext[msg_size-1] != 10) {
-               lprintf(CTDL_WARNING, "Possible problem: message did not "
+               CtdlLogPrintf(CTDL_WARNING, "Possible problem: message did not "
                        "correctly terminate. (expecting 0x10, got 0x%02x)\n",
                                buf[msg_size-1]);
        }
@@ -1216,7 +1216,7 @@ void smtp_try(const char *key, const char *addr, int *status,
                strcpy(dsn, "Connection broken during SMTP message transmit");
                goto bail;
        }
-       lprintf(CTDL_DEBUG, "%s\n", buf);
+       CtdlLogPrintf(CTDL_DEBUG, "%s\n", buf);
        if (buf[0] != '2') {
                if (buf[0] == '4') {
                        *status = 4;
@@ -1234,11 +1234,11 @@ void smtp_try(const char *key, const char *addr, int *status,
        safestrncpy(dsn, &buf[4], 1023);
        *status = 2;
 
-       lprintf(CTDL_DEBUG, ">QUIT\n");
+       CtdlLogPrintf(CTDL_DEBUG, ">QUIT\n");
        sock_write(sock, "QUIT\r\n", 6);
        ml_sock_gets(sock, buf);
-       lprintf(CTDL_DEBUG, "<%s\n", buf);
-       lprintf(CTDL_INFO, "SMTP delivery to <%s> @ <%s> (%s) succeeded\n",
+       CtdlLogPrintf(CTDL_DEBUG, "<%s\n", buf);
+       CtdlLogPrintf(CTDL_INFO, "SMTP delivery to <%s> @ <%s> (%s) succeeded\n",
                user, node, name);
 
 bail:  free(msgtext);
@@ -1290,7 +1290,7 @@ void smtp_do_bounce(char *instr) {
        size_t omsgsize;
        long omsgid = (-1);
 
-       lprintf(CTDL_DEBUG, "smtp_do_bounce() called\n");
+       CtdlLogPrintf(CTDL_DEBUG, "smtp_do_bounce() called\n");
        strcpy(bounceto, "");
        sprintf(boundary, "=_Citadel_Multipart_%s_%04x%04x", config.c_fqdn, getpid(), ++seq);
        lines = num_tokens(instr, '\n');
@@ -1357,7 +1357,7 @@ void smtp_do_bounce(char *instr) {
                extract_token(dsn, buf, 3, '|', sizeof dsn);
                bounce_this = 0;
 
-               lprintf(CTDL_DEBUG, "key=<%s> addr=<%s> status=%d dsn=<%s>\n",
+               CtdlLogPrintf(CTDL_DEBUG, "key=<%s> addr=<%s> status=%d dsn=<%s>\n",
                        key, addr, status, dsn);
 
                if (!strcasecmp(key, "bounceto")) {
@@ -1377,7 +1377,7 @@ void smtp_do_bounce(char *instr) {
                        ++num_bounces;
 
                        if (bmsg->cm_fields['M'] == NULL) {
-                               lprintf(CTDL_ERR, "ERROR ... M field is null "
+                               CtdlLogPrintf(CTDL_ERR, "ERROR ... M field is null "
                                        "(%s:%d)\n", __FILE__, __LINE__);
                        }
 
@@ -1425,13 +1425,13 @@ void smtp_do_bounce(char *instr) {
         strcat(bmsg->cm_fields['M'], "--\r\n");
 
        /* Deliver the bounce if there's anything worth mentioning */
-       lprintf(CTDL_DEBUG, "num_bounces = %d\n", num_bounces);
+       CtdlLogPrintf(CTDL_DEBUG, "num_bounces = %d\n", num_bounces);
        if (num_bounces > 0) {
 
                /* First try the user who sent the message */
-               lprintf(CTDL_DEBUG, "bounce to user? <%s>\n", bounceto);
+               CtdlLogPrintf(CTDL_DEBUG, "bounce to user? <%s>\n", bounceto);
                if (IsEmptyStr(bounceto)) {
-                       lprintf(CTDL_ERR, "No bounce address specified\n");
+                       CtdlLogPrintf(CTDL_ERR, "No bounce address specified\n");
                        bounce_msgid = (-1L);
                }
 
@@ -1456,7 +1456,7 @@ void smtp_do_bounce(char *instr) {
        }
 
        CtdlFreeMessage(bmsg);
-       lprintf(CTDL_DEBUG, "Done processing bounces\n");
+       CtdlLogPrintf(CTDL_DEBUG, "Done processing bounces\n");
 }
 
 
@@ -1525,11 +1525,11 @@ void smtp_do_procmsg(long msgnum, void *userdata) {
        time_t last_attempted = 0L;
        time_t retry = SMTP_RETRY_INTERVAL;
 
-       lprintf(CTDL_DEBUG, "smtp_do_procmsg(%ld)\n", msgnum);
+       CtdlLogPrintf(CTDL_DEBUG, "smtp_do_procmsg(%ld)\n", msgnum);
 
        msg = CtdlFetchMessage(msgnum, 1);
        if (msg == NULL) {
-               lprintf(CTDL_ERR, "SMTP: tried %ld but no such message!\n", msgnum);
+               CtdlLogPrintf(CTDL_ERR, "SMTP: tried %ld but no such message!\n", msgnum);
                return;
        }
 
@@ -1574,7 +1574,7 @@ void smtp_do_procmsg(long msgnum, void *userdata) {
         * Postpone delivery if we've already tried recently.
         */
        if (((time(NULL) - last_attempted) < retry) && (run_queue_now == 0)) {
-               lprintf(CTDL_DEBUG, "Retry time not yet reached.\n");
+               CtdlLogPrintf(CTDL_DEBUG, "Retry time not yet reached.\n");
                free(instr);
                return;
        }
@@ -1584,7 +1584,7 @@ void smtp_do_procmsg(long msgnum, void *userdata) {
         * Bail out if there's no actual message associated with this
         */
        if (text_msgid < 0L) {
-               lprintf(CTDL_ERR, "SMTP: no 'msgid' directive found!\n");
+               CtdlLogPrintf(CTDL_ERR, "SMTP: no 'msgid' directive found!\n");
                free(instr);
                return;
        }
@@ -1614,7 +1614,7 @@ void smtp_do_procmsg(long msgnum, void *userdata) {
 
                        --i;
                        --lines;
-                       lprintf(CTDL_DEBUG, "SMTP: Trying <%s>\n", addr);
+                       CtdlLogPrintf(CTDL_DEBUG, "SMTP: Trying <%s>\n", addr);
                        smtp_try(key, addr, &status, dsn, sizeof dsn, text_msgid);
                        if (status != 2) {
                                if (results == NULL) {
@@ -1705,16 +1705,16 @@ void smtp_do_queue(void) {
        /* 
         * Go ahead and run the queue
         */
-       lprintf(CTDL_INFO, "SMTP: processing outbound queue\n");
+       CtdlLogPrintf(CTDL_INFO, "SMTP: processing outbound queue\n");
 
        if (getroom(&CC->room, SMTP_SPOOLOUT_ROOM) != 0) {
-               lprintf(CTDL_ERR, "Cannot find room <%s>\n", SMTP_SPOOLOUT_ROOM);
+               CtdlLogPrintf(CTDL_ERR, "Cannot find room <%s>\n", SMTP_SPOOLOUT_ROOM);
                return;
        }
        CtdlForEachMessage(MSGS_ALL, 0L, NULL,
                SPOOLMIME, NULL, smtp_do_procmsg, NULL);
 
-       lprintf(CTDL_INFO, "SMTP: queue run completed\n");
+       CtdlLogPrintf(CTDL_INFO, "SMTP: queue run completed\n");
        run_queue_now = 0;
        doing_queue = 0;
 }
@@ -1799,7 +1799,7 @@ void smtp_cleanup_function(void) {
        /* Don't do this stuff if this is not an SMTP session! */
        if (CC->h_command_function != smtp_command_loop) return;
 
-       lprintf(CTDL_DEBUG, "Performing SMTP cleanup hook\n");
+       CtdlLogPrintf(CTDL_DEBUG, "Performing SMTP cleanup hook\n");
        free(SMTP);
 }
 
index b8611f6444e75a8a3b1a024287559bd69db048d9..e8549ee4a8575698724b23bf76134ea9f998b652 100644 (file)
@@ -80,9 +80,9 @@ int spam_assassin(struct CtdlMessage *msg) {
        /* Try them one by one until we get a working one */
         for (sa=0; sa<num_sahosts; ++sa) {
                 extract_token(buf, sahosts, sa, '|', sizeof buf);
-                lprintf(CTDL_INFO, "Connecting to SpamAssassin at <%s>\n", buf);
+                CtdlLogPrintf(CTDL_INFO, "Connecting to SpamAssassin at <%s>\n", buf);
                 sock = sock_connect(buf, SPAMASSASSIN_PORT, "tcp");
-                if (sock >= 0) lprintf(CTDL_DEBUG, "Connected!\n");
+                if (sock >= 0) CtdlLogPrintf(CTDL_DEBUG, "Connected!\n");
         }
 
        if (sock < 0) {
@@ -93,7 +93,7 @@ int spam_assassin(struct CtdlMessage *msg) {
        }
 
        /* Command */
-       lprintf(CTDL_DEBUG, "Transmitting command\n");
+       CtdlLogPrintf(CTDL_DEBUG, "Transmitting command\n");
        sprintf(buf, "CHECK SPAMC/1.2\r\n\r\n");
        sock_write(sock, buf, strlen(buf));
 
@@ -117,18 +117,18 @@ int spam_assassin(struct CtdlMessage *msg) {
        sock_shutdown(sock, SHUT_WR);
        
        /* Response */
-       lprintf(CTDL_DEBUG, "Awaiting response\n");
+       CtdlLogPrintf(CTDL_DEBUG, "Awaiting response\n");
         if (sock_getln(sock, buf, sizeof buf) < 0) {
                 goto bail;
         }
-        lprintf(CTDL_DEBUG, "<%s\n", buf);
+        CtdlLogPrintf(CTDL_DEBUG, "<%s\n", buf);
        if (strncasecmp(buf, "SPAMD", 5)) {
                goto bail;
        }
         if (sock_getln(sock, buf, sizeof buf) < 0) {
                 goto bail;
         }
-        lprintf(CTDL_DEBUG, "<%s\n", buf);
+        CtdlLogPrintf(CTDL_DEBUG, "<%s\n", buf);
        if (!strncasecmp(buf, "Spam: True", 10)) {
                is_spam = 1;
        }
index af49e8d322e6fbf0d0711fb38a4f3ad196253882..f97911da5f9e0586757acfb6f947e23217af4c75 100644 (file)
 extern struct CitContext *ContextList;
 
 void CleanupTest(void) {
-       lprintf(CTDL_DEBUG, "--- test of adding an unload hook --- \n");
+       CtdlLogPrintf(CTDL_DEBUG, "--- test of adding an unload hook --- \n");
        }
 
 void NewRoomTest(void) {
-       lprintf(CTDL_DEBUG, "--- test module was told we're now in a new room ---\n");
+       CtdlLogPrintf(CTDL_DEBUG, "--- test module was told we're now in a new room ---\n");
        }
 
 void SessionStartTest(void) {
-       lprintf(CTDL_DEBUG, "--- starting up session %d ---\n",
+       CtdlLogPrintf(CTDL_DEBUG, "--- starting up session %d ---\n",
                CC->cs_pid);
        }
 
 void SessionStopTest(void) {
-       lprintf(CTDL_DEBUG, "--- ending session %d ---\n", 
+       CtdlLogPrintf(CTDL_DEBUG, "--- ending session %d ---\n", 
                CC->cs_pid);
        }
 
 void LoginTest(void) {
-       lprintf(CTDL_DEBUG, "--- Hello, %s ---\n", CC->curr_user);
+       CtdlLogPrintf(CTDL_DEBUG, "--- Hello, %s ---\n", CC->curr_user);
        }
 
 /* To insert this module into the server activate the next block by changing the #if 0 to #if 1 */
index 2646009c3dcefe0da675005529f15cdf54ae39c5..dfdad1b727bf2e0e8fe40642b476ce067d073661 100644 (file)
@@ -73,14 +73,14 @@ void cmd_bmbx_backend(struct ctdlroom *qrbuf, void *data) {
        while (rplist != NULL) {
 
                if (lgetroom(&qr, rplist->name) == 0) {
-                       lprintf(CTDL_DEBUG, "Processing <%s>...\n", rplist->name);
+                       CtdlLogPrintf(CTDL_DEBUG, "Processing <%s>...\n", rplist->name);
                        if ( (qr.QRflags & QR_MAILBOX) == 0) {
-                               lprintf(CTDL_DEBUG, "  -- not a mailbox\n");
+                               CtdlLogPrintf(CTDL_DEBUG, "  -- not a mailbox\n");
                        }
                        else {
 
                                qr.QRgen = time(NULL);
-                               lprintf(CTDL_DEBUG, "  -- fixed!\n");
+                               CtdlLogPrintf(CTDL_DEBUG, "  -- fixed!\n");
                        }
                        lputroom(&qr);
                }
@@ -95,7 +95,7 @@ void cmd_bmbx_backend(struct ctdlroom *qrbuf, void *data) {
  * quick fix to bump mailbox generation numbers
  */
 void bump_mailbox_generation_numbers(void) {
-       lprintf(CTDL_WARNING, "Applying security fix to mailbox rooms\n");
+       CtdlLogPrintf(CTDL_WARNING, "Applying security fix to mailbox rooms\n");
        ForEachRoom(cmd_bmbx_backend, NULL);
        cmd_bmbx_backend(NULL, NULL);
        return;
@@ -128,7 +128,7 @@ void cbtm_backend(struct ctdluser *usbuf, void *data) {
        while (uplist != NULL) {
 
                if (lgetuser(&us, uplist->user) == 0) {
-                       lprintf(CTDL_DEBUG, "Processing <%s>...\n", uplist->user);
+                       CtdlLogPrintf(CTDL_DEBUG, "Processing <%s>...\n", uplist->user);
                        if (us.uid == CTDLUID) {
                                us.uid = (-1);
                        }
@@ -145,7 +145,7 @@ void cbtm_backend(struct ctdluser *usbuf, void *data) {
  * quick fix to change all CTDLUID users to (-1)
  */
 void convert_ctdluid_to_minusone(void) {
-       lprintf(CTDL_WARNING, "Applying uid changes\n");
+       CtdlLogPrintf(CTDL_WARNING, "Applying uid changes\n");
        ForEachUser(cbtm_backend, NULL);
        cbtm_backend(NULL, NULL);
        return;
@@ -195,12 +195,12 @@ void update_config(void) {
 void check_server_upgrades(void) {
 
        get_control();
-       lprintf(CTDL_INFO, "Server-hosted upgrade level is %d.%02d\n",
+       CtdlLogPrintf(CTDL_INFO, "Server-hosted upgrade level is %d.%02d\n",
                (CitControl.version / 100),
                (CitControl.version % 100) );
 
        if (CitControl.version < REV_LEVEL) {
-               lprintf(CTDL_WARNING,
+               CtdlLogPrintf(CTDL_WARNING,
                        "Server hosted updates need to be processed at "
                        "this time.  Please wait...\n");
        }
@@ -211,7 +211,7 @@ void check_server_upgrades(void) {
        update_config();
 
        if ((CitControl.version > 000) && (CitControl.version < 555)) {
-               lprintf(CTDL_EMERG,
+               CtdlLogPrintf(CTDL_EMERG,
                        "Your data files are from a version of Citadel\n"
                        "that is too old to be upgraded.  Sorry.\n");
                exit(EXIT_FAILURE);
index bef0a772765901526db0974f6f1fc15757204e69..be96cffa98680afd6ca52d0ef8f5898c713aec8f 100644 (file)
@@ -395,7 +395,7 @@ void artv_export_messages(void) {
        Ctx = CC;
        artv_global_message_list = fopen(artv_tempfilename1, "r");
        if (artv_global_message_list != NULL) {
-               lprintf(CTDL_INFO, "Opened %s\n", artv_tempfilename1);
+               CtdlLogPrintf(CTDL_INFO, "Opened %s\n", artv_tempfilename1);
                while ((Ctx->kill_me != 1) && 
                       (fgets(buf, sizeof(buf), artv_global_message_list) != NULL)) {
                        msgnum = atol(buf);
@@ -407,9 +407,9 @@ void artv_export_messages(void) {
                fclose(artv_global_message_list);
        }
        if (Ctx->kill_me != 1)
-               lprintf(CTDL_INFO, "Exported %d messages.\n", count);
+               CtdlLogPrintf(CTDL_INFO, "Exported %d messages.\n", count);
        else
-               lprintf(CTDL_ERR, "Export aborted due to client disconnect! \n");
+               CtdlLogPrintf(CTDL_ERR, "Export aborted due to client disconnect! \n");
 }
 
 void artv_dump_messages(void) {
@@ -421,7 +421,7 @@ void artv_dump_messages(void) {
        Ctx = CC;
        artv_global_message_list = fopen(artv_tempfilename1, "r");
        if (artv_global_message_list != NULL) {
-               lprintf(CTDL_INFO, "Opened %s\n", artv_tempfilename1);
+               CtdlLogPrintf(CTDL_INFO, "Opened %s\n", artv_tempfilename1);
                while ((Ctx->kill_me != 1) && 
                       (fgets(buf, sizeof(buf), artv_global_message_list) != NULL)) {
                        msgnum = atol(buf);
@@ -433,9 +433,9 @@ void artv_dump_messages(void) {
                fclose(artv_global_message_list);
        }
        if (Ctx->kill_me != 1)
-               lprintf(CTDL_INFO, "Exported %d messages.\n", count);
+               CtdlLogPrintf(CTDL_INFO, "Exported %d messages.\n", count);
        else
-               lprintf(CTDL_ERR, "Export aborted due to client disconnect! \n");
+               CtdlLogPrintf(CTDL_ERR, "Export aborted due to client disconnect! \n");
 }
 
 
@@ -527,7 +527,7 @@ void artv_import_config(void) {
        struct config *buf;
        buf = &config;
 
-       lprintf(CTDL_DEBUG, "Importing config file\n");
+       CtdlLogPrintf(CTDL_DEBUG, "Importing config file\n");
 
 #include "artv_deserialize.h"
 #include "dtds/config-defs.h"
@@ -535,14 +535,14 @@ void artv_import_config(void) {
 
        config.c_enable_fulltext = 0;   /* always disable */
        put_config();
-       lprintf(CTDL_INFO, "Imported config file\n");
+       CtdlLogPrintf(CTDL_INFO, "Imported config file\n");
 }
 
 
 void artv_import_control(void) {
        char buf[SIZ];
 
-       lprintf(CTDL_DEBUG, "Importing control file\n");
+       CtdlLogPrintf(CTDL_DEBUG, "Importing control file\n");
        client_getln(buf, sizeof buf);  CitControl.MMhighest = atol(buf);
        client_getln(buf, sizeof buf);  CitControl.MMflags = atoi(buf);
        client_getln(buf, sizeof buf);  CitControl.MMnextuser = atol(buf);
@@ -550,7 +550,7 @@ void artv_import_control(void) {
        client_getln(buf, sizeof buf);  CitControl.version = atoi(buf);
        CitControl.MMfulltext = (-1L);  /* always flush */
        put_control();
-       lprintf(CTDL_INFO, "Imported control file\n");
+       CtdlLogPrintf(CTDL_INFO, "Imported control file\n");
 }
 
 
@@ -613,7 +613,7 @@ void artv_import_room(void) {
        client_getln(cbuf, sizeof cbuf);        buf->QRdefaultview = atoi(cbuf);
 //*/
        putroom(buf);
-       lprintf(CTDL_INFO, "Imported room <%s>\n", qrbuf.QRname);
+       CtdlLogPrintf(CTDL_INFO, "Imported room <%s>\n", qrbuf.QRname);
        /* format of message list export is all message numbers output
         * one per line terminated by a 0.
         */
@@ -621,7 +621,7 @@ void artv_import_room(void) {
                CtdlSaveMsgPointerInRoom(qrbuf.QRname, msgnum, 0, NULL);
                ++msgcount;
        }
-       lprintf(CTDL_INFO, "(%d messages)\n", msgcount);
+       CtdlLogPrintf(CTDL_INFO, "(%d messages)\n", msgcount);
 }
 
 
@@ -645,7 +645,7 @@ void artv_import_floor(void) {
        client_getln(cbuf, sizeof cbuf);        buf->f_ep.expire_value = atoi(cbuf);
 //*/
        putfloor(buf, i);
-       lprintf(CTDL_INFO, "Imported floor #%d (%s)\n", i, flbuf.f_name);
+       CtdlLogPrintf(CTDL_INFO, "Imported floor #%d (%s)\n", i, flbuf.f_name);
 }
 
 
@@ -670,7 +670,7 @@ void artv_import_visit(void) {
        client_getln(buf, sizeof buf);  vbuf.v_flags = atoi(buf);
        client_getln(buf, sizeof buf);  vbuf.v_view = atoi(buf);
        put_visit(&vbuf);
-       lprintf(CTDL_INFO, "Imported visit %ld/%ld/%ld\n",
+       CtdlLogPrintf(CTDL_INFO, "Imported visit %ld/%ld/%ld\n",
                vbuf.v_roomnum, vbuf.v_roomgen, vbuf.v_usernum);
 }
 
@@ -691,7 +691,7 @@ void artv_import_message(void) {
        client_getln(buf, sizeof buf);  smi.meta_refcount = atoi(buf);
        client_getln(smi.meta_content_type, sizeof smi.meta_content_type);
 
-       lprintf(CTDL_INFO, "message #%ld\n", msgnum);
+       CtdlLogPrintf(CTDL_INFO, "message #%ld\n", msgnum);
 
        /* decode base64 message text */
        CtdlMakeTempFileName(tempfile, sizeof tempfile);
@@ -705,7 +705,7 @@ void artv_import_message(void) {
        fseek(fp, 0L, SEEK_END);
        msglen = ftell(fp);
        fclose(fp);
-       lprintf(CTDL_DEBUG, "msglen = %ld\n", msglen);
+       CtdlLogPrintf(CTDL_DEBUG, "msglen = %ld\n", msglen);
 
        mbuf = malloc(msglen);
        fp = fopen(tempfile, "rb");
@@ -718,7 +718,7 @@ void artv_import_message(void) {
        unlink(tempfile);
 
        PutMetaData(&smi);
-       lprintf(CTDL_INFO, "Imported message %ld\n", msgnum);
+       CtdlLogPrintf(CTDL_INFO, "Imported message %ld\n", msgnum);
 }
 
 
@@ -739,7 +739,7 @@ void artv_do_import(void) {
        iterations = 0;
        while (client_getln(buf, sizeof buf), strcmp(buf, "000")) {
 
-               lprintf(CTDL_DEBUG, "import keyword: <%s>\n", buf);
+               CtdlLogPrintf(CTDL_DEBUG, "import keyword: <%s>\n", buf);
                if ((abuf[0] == '\0') || (strcasecmp(buf, abuf))) {
                        cprintf ("\n\nImporting datatype %s\n", buf);
                        strncpy (abuf, buf, SIZ);       
@@ -756,7 +756,7 @@ void artv_do_import(void) {
                        client_getln(s_version, sizeof s_version);
                        version = atoi(s_version);
                        if ((version<EXPORT_REV_MIN) || (version>REV_LEVEL)) {
-                               lprintf(CTDL_ERR, "Version mismatch in ARTV import; aborting\n");
+                               CtdlLogPrintf(CTDL_ERR, "Version mismatch in ARTV import; aborting\n");
                                break;
                        }
                }
@@ -770,7 +770,7 @@ void artv_do_import(void) {
                else break;
                iterations ++;
        }
-       lprintf(CTDL_INFO, "Invalid keyword <%s>.  Flushing input.\n", buf);
+       CtdlLogPrintf(CTDL_INFO, "Invalid keyword <%s>.  Flushing input.\n", buf);
        while (client_getln(buf, sizeof buf), strcmp(buf, "000"))  ;;
        rebuild_euid_index();
 }
index bfa4be31789d2a98953c1c993c4fdde98040d23b..d7f3c8af681b13e082e8c20ffc5758747eafa4b2 100644 (file)
@@ -310,7 +310,7 @@ void ctdl_vcard_to_directory(struct CtdlMessage *msg, int op) {
        (void) CtdlDoDirectoryServiceFunc(ldap_dn, NULL, &objectlist, "ldap", DIRECTORY_SAVE_OBJECT);
        
        (void) CtdlDoDirectoryServiceFunc(NULL, NULL, &objectlist, "ldap", DIRECTORY_FREE_OBJECT);
-       lprintf(CTDL_DEBUG, "Directory Services write operation complete.\n");
+       CtdlLogPrintf(CTDL_DEBUG, "Directory Services write operation complete.\n");
 }
 
 
@@ -327,18 +327,18 @@ void vcard_directory_add_user(char *internet_addr, char *citadel_addr) {
         * probably just the networker or something.
         */
        if (CC->logged_in) {
-               lprintf(CTDL_DEBUG, "Checking for <%s>...\n", internet_addr);
+               CtdlLogPrintf(CTDL_DEBUG, "Checking for <%s>...\n", internet_addr);
                if (CtdlDirectoryLookup(buf, internet_addr, sizeof buf) == 0) {
                        if (strcasecmp(buf, citadel_addr)) {
                                /* This address belongs to someone else.
                                 * Bail out silently without saving.
                                 */
-                               lprintf(CTDL_DEBUG, "DOOP!\n");
+                               CtdlLogPrintf(CTDL_DEBUG, "DOOP!\n");
                                return;
                        }
                }
        }
-       lprintf(CTDL_INFO, "Adding %s (%s) to directory\n",
+       CtdlLogPrintf(CTDL_INFO, "Adding %s (%s) to directory\n",
                        citadel_addr, internet_addr);
        CtdlDirectoryAddUser(internet_addr, citadel_addr);
 }
@@ -465,7 +465,7 @@ void vcard_extract_vcard(char *name, char *filename, char *partnum, char *disp,
        if (  (!strcasecmp(cbtype, "text/x-vcard"))
           || (!strcasecmp(cbtype, "text/vcard")) ) {
 
-               lprintf(CTDL_DEBUG, "Part %s contains a vCard!  Loading...\n", partnum);
+               CtdlLogPrintf(CTDL_DEBUG, "Part %s contains a vCard!  Loading...\n", partnum);
                if (*v != NULL) {
                        vcard_free(*v);
                }
@@ -543,7 +543,7 @@ int vcard_upload_beforesave(struct CtdlMessage *msg) {
        }
 
        s = vcard_get_prop(v, "FN", 0, 0, 0);
-       if (s) lprintf(CTDL_DEBUG, "vCard beforesave hook running for <%s>\n", s);
+       if (s) CtdlLogPrintf(CTDL_DEBUG, "vCard beforesave hook running for <%s>\n", s);
 
        if (yes_my_citadel_config) {
                /* Bingo!  The user is uploading a new vCard, so
@@ -978,7 +978,7 @@ void vcard_newuser(struct ctdluser *usbuf) {
        struct vCard *v;
 
        vcard_fn_to_n(vname, usbuf->fullname, sizeof vname);
-       lprintf(CTDL_DEBUG, "Converted <%s> to <%s>\n", usbuf->fullname, vname);
+       CtdlLogPrintf(CTDL_DEBUG, "Converted <%s> to <%s>\n", usbuf->fullname, vname);
 
        /* Create and save the vCard */
        v = vcard_new();
@@ -1280,11 +1280,11 @@ void check_get(void) {
        time(&CC->lastcmd);
        memset(cmdbuf, 0, sizeof cmdbuf); /* Clear it, just in case */
        if (client_getln(cmdbuf, sizeof cmdbuf) < 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, ": %s\n", cmdbuf);
+       CtdlLogPrintf(CTDL_INFO, ": %s\n", cmdbuf);
        while (strlen(cmdbuf) < 3) strcat(cmdbuf, " ");
 
        if (strcasecmp(cmdbuf, "GET "));
@@ -1302,13 +1302,13 @@ void check_get(void) {
                {
 
                        cprintf("200 OK %s\n", internet_addr);
-                       lprintf(CTDL_INFO, "sending 200 OK for the room %s\n", rcpt->display_recp);
+                       CtdlLogPrintf(CTDL_INFO, "sending 200 OK for the room %s\n", rcpt->display_recp);
                }
                else 
                {
                        cprintf("500 REJECT noone here by that name.\n");
                        
-                       lprintf(CTDL_INFO, "sending 500 REJECT noone here by that name: %s\n", internet_addr);
+                       CtdlLogPrintf(CTDL_INFO, "sending 500 REJECT noone here by that name: %s\n", internet_addr);
                }
                if (rcpt != NULL) free_recipients(rcpt);
        }
@@ -1332,7 +1332,7 @@ void vcard_create_room(void)
 
        /* Set expiration policy to manual; otherwise objects will be lost! */
        if (lgetroom(&qr, USERCONTACTSROOM)) {
-               lprintf(CTDL_ERR, "Couldn't get the user CONTACTS room!\n");
+               CtdlLogPrintf(CTDL_ERR, "Couldn't get the user CONTACTS room!\n");
                return;
        }
        qr.QRep.expire_mode = EXPIRE_MANUAL;
@@ -1481,7 +1481,7 @@ void store_this_ha(struct addresses_to_be_filed *aptr) {
                        }
                        vcard_free(v);
 
-                       lprintf(CTDL_DEBUG, "Adding contact: %s\n", recipient);
+                       CtdlLogPrintf(CTDL_DEBUG, "Adding contact: %s\n", recipient);
                        vmsgnum = CtdlSubmitMsg(vmsg, NULL, aptr->roomname);
                        CtdlFreeMessage(vmsg);
                }
index 678bec452093031174487b213e99712a15c0dff1..74bec403afb8848b716bcc4dfc9d01f210737f10 100644 (file)
@@ -182,7 +182,7 @@ int alias(char *name)
        }
 
        if (strcasecmp(original_name, name)) {
-               lprintf(CTDL_INFO, "%s is being forwarded to %s\n", original_name, name);
+               CtdlLogPrintf(CTDL_INFO, "%s is being forwarded to %s\n", original_name, name);
        }
 
        /* Change "user @ xxx" to "user" if xxx is an alias for this host */
@@ -190,7 +190,7 @@ int alias(char *name)
                if (name[a] == '@') {
                        if (CtdlHostAlias(&name[a+1]) == hostalias_localhost) {
                                name[a] = 0;
-                               lprintf(CTDL_INFO, "Changed to <%s>\n", name);
+                               CtdlLogPrintf(CTDL_INFO, "Changed to <%s>\n", name);
                        }
                }
        }
@@ -356,7 +356,7 @@ void CtdlSetSeen(long *target_msgnums, int num_target_msgnums,
                return;
        }
 
-       lprintf(CTDL_DEBUG, "CtdlSetSeen(%d msgs starting with %ld, %d, %d)\n",
+       CtdlLogPrintf(CTDL_DEBUG, "CtdlSetSeen(%d msgs starting with %ld, %d, %d)\n",
                num_target_msgnums, target_msgnums[0],
                target_setting, which_set);
 
@@ -390,7 +390,7 @@ void CtdlSetSeen(long *target_msgnums, int num_target_msgnums,
                        break;
        }
 
-       /* lprintf(CTDL_DEBUG, "before optimize: %s\n", vset); */
+       /* CtdlLogPrintf(CTDL_DEBUG, "before optimize: %s\n", vset); */
 
        /* Translate the existing sequence set into an array of booleans */
        num_sets = num_tokens(vset, ',');
@@ -489,7 +489,7 @@ void CtdlSetSeen(long *target_msgnums, int num_target_msgnums,
        }
        free(is_set);
 
-       /* lprintf(CTDL_DEBUG, " after optimize: %s\n", vset); */
+       /* CtdlLogPrintf(CTDL_DEBUG, " after optimize: %s\n", vset); */
        free(msglist);
        CtdlSetRelationship(&vbuf,
                ((which_user != NULL) ? which_user : &CC->user),
@@ -1016,7 +1016,7 @@ struct CtdlMessage *CtdlFetchMessage(long msgnum, int with_body)
        cit_uint8_t ch;
        cit_uint8_t field_header;
 
-       lprintf(CTDL_DEBUG, "CtdlFetchMessage(%ld, %d)\n", msgnum, with_body);
+       CtdlLogPrintf(CTDL_DEBUG, "CtdlFetchMessage(%ld, %d)\n", msgnum, with_body);
 
        dmsgtext = cdb_fetch(CDB_MSGMAIN, &msgnum, sizeof(long));
        if (dmsgtext == NULL) {
@@ -1032,7 +1032,7 @@ struct CtdlMessage *CtdlFetchMessage(long msgnum, int with_body)
         */
        ch = *mptr++;
        if (ch != 255) {
-               lprintf(CTDL_ERR, "Message %ld appears to be corrupted.\n", msgnum);
+               CtdlLogPrintf(CTDL_ERR, "Message %ld appears to be corrupted.\n", msgnum);
                cdb_free(dmsgtext);
                return NULL;
        }
@@ -1095,7 +1095,7 @@ int is_valid_message(struct CtdlMessage *msg) {
        if (msg == NULL)
                return 0;
        if ((msg->cm_magic) != CTDLMESSAGE_MAGIC) {
-               lprintf(CTDL_WARNING, "is_valid_message() -- self-check failed\n");
+               CtdlLogPrintf(CTDL_WARNING, "is_valid_message() -- self-check failed\n");
                return 0;
        }
        return 1;
@@ -1142,7 +1142,7 @@ void fixed_output_pre(char *name, char *filename, char *partnum, char *disp,
        struct ma_info *ma;
        
        ma = (struct ma_info *)cbuserdata;
-       lprintf(CTDL_DEBUG, "fixed_output_pre() type=<%s>\n", cbtype);  
+       CtdlLogPrintf(CTDL_DEBUG, "fixed_output_pre() type=<%s>\n", cbtype);    
        if (!strcasecmp(cbtype, "multipart/alternative")) {
                ++ma->is_ma;
                ma->did_print = 0;
@@ -1162,7 +1162,7 @@ void fixed_output_post(char *name, char *filename, char *partnum, char *disp,
        struct ma_info *ma;
        
        ma = (struct ma_info *)cbuserdata;
-       lprintf(CTDL_DEBUG, "fixed_output_post() type=<%s>\n", cbtype); 
+       CtdlLogPrintf(CTDL_DEBUG, "fixed_output_post() type=<%s>\n", cbtype);   
        if (!strcasecmp(cbtype, "multipart/alternative")) {
                --ma->is_ma;
                ma->did_print = 0;
@@ -1186,7 +1186,7 @@ void fixed_output(char *name, char *filename, char *partnum, char *disp,
 
        ma = (struct ma_info *)cbuserdata;
 
-       lprintf(CTDL_DEBUG,
+       CtdlLogPrintf(CTDL_DEBUG,
                "fixed_output() part %s: %s (%s) (%ld bytes)\n",
                partnum, filename, cbtype, (long)length);
 
@@ -1195,7 +1195,7 @@ void fixed_output(char *name, char *filename, char *partnum, char *disp,
         * we've already printed another section, skip this one.
         */     
        if ( (ma->is_ma) && (ma->did_print) ) {
-               lprintf(CTDL_DEBUG, "Skipping part %s (%s)\n", partnum, cbtype);
+               CtdlLogPrintf(CTDL_DEBUG, "Skipping part %s (%s)\n", partnum, cbtype);
                return;
        }
        ma->did_print = 1;
@@ -1267,7 +1267,7 @@ void choose_preferred(char *name, char *filename, char *partnum, char *disp,
                extract_token(buf, CC->preferred_formats, i, '|', sizeof buf);
                if ( (!strcasecmp(buf, cbtype)) && (!ma->freeze) ) {
                        if (i < ma->chosen_pref) {
-                               lprintf(CTDL_DEBUG, "Setting chosen part: <%s>\n", partnum);
+                               CtdlLogPrintf(CTDL_DEBUG, "Setting chosen part: <%s>\n", partnum);
                                safestrncpy(ma->chosen_part, partnum, sizeof ma->chosen_part);
                                ma->chosen_pref = i;
                        }
@@ -1378,7 +1378,7 @@ int CtdlOutputMsg(long msg_num,           /* message number (local) to fetch */
        int retcode = om_no_such_msg;
        struct encapmsg encap;
 
-       lprintf(CTDL_DEBUG, "CtdlOutputMsg() msgnum=%ld, mode=%d, section=%s\n", 
+       CtdlLogPrintf(CTDL_DEBUG, "CtdlOutputMsg() msgnum=%ld, mode=%d, section=%s\n", 
                msg_num, mode,
                (section ? section : "<>")
        );
@@ -1484,7 +1484,7 @@ int CtdlOutputPreLoadedMsg(
        char mid[100];
        char datestamp[100];
 
-       lprintf(CTDL_DEBUG, "CtdlOutputPreLoadedMsg(TheMessage=%s, %d, %d, %d, %d\n",
+       CtdlLogPrintf(CTDL_DEBUG, "CtdlOutputPreLoadedMsg(TheMessage=%s, %d, %d, %d, %d\n",
                ((TheMessage == NULL) ? "NULL" : "not null"),
                mode, headers_only, do_proto, crlf);
 
@@ -1492,7 +1492,7 @@ int CtdlOutputPreLoadedMsg(
        nl = (crlf ? "\r\n" : "\n");
 
        if (!is_valid_message(TheMessage)) {
-               lprintf(CTDL_ERR,
+               CtdlLogPrintf(CTDL_ERR,
                        "ERROR: invalid preloaded message for output\n");
                return(om_no_such_msg);
        }
@@ -2042,7 +2042,7 @@ int CtdlSaveMsgPointersInRoom(char *roomname, long newmsgidlist[], int num_newms
        long *msgs_to_be_merged = NULL;
        int num_msgs_to_be_merged = 0;
 
-       lprintf(CTDL_DEBUG,
+       CtdlLogPrintf(CTDL_DEBUG,
                "CtdlSaveMsgPointersInRoom(room=%s, num_msgs=%d, repl=%d)\n",
                roomname, num_newmsgs, do_repl_check);
 
@@ -2057,7 +2057,7 @@ int CtdlSaveMsgPointersInRoom(char *roomname, long newmsgidlist[], int num_newms
        if (lgetroom(&CC->room,
           ((roomname != NULL) ? roomname : CC->room.QRname) )
           != 0) {
-               lprintf(CTDL_ERR, "No such room <%s>\n", roomname);
+               CtdlLogPrintf(CTDL_ERR, "No such room <%s>\n", roomname);
                return(ERROR + ROOM_NOT_FOUND);
        }
 
@@ -2094,14 +2094,14 @@ int CtdlSaveMsgPointersInRoom(char *roomname, long newmsgidlist[], int num_newms
                }
        }
 
-       lprintf(9, "%d unique messages to be merged\n", num_msgs_to_be_merged);
+       CtdlLogPrintf(9, "%d unique messages to be merged\n", num_msgs_to_be_merged);
 
        /*
         * Now merge the new messages
         */
        msglist = realloc(msglist, (sizeof(long) * (num_msgs + num_msgs_to_be_merged)) );
        if (msglist == NULL) {
-               lprintf(CTDL_ALERT, "ERROR: can't realloc message list!\n");
+               CtdlLogPrintf(CTDL_ALERT, "ERROR: can't realloc message list!\n");
        }
        memcpy(&msglist[num_msgs], msgs_to_be_merged, (sizeof(long) * num_msgs_to_be_merged) );
        num_msgs += num_msgs_to_be_merged;
@@ -2125,7 +2125,7 @@ int CtdlSaveMsgPointersInRoom(char *roomname, long newmsgidlist[], int num_newms
 
        /* Perform replication checks if necessary */
        if ( (DoesThisRoomNeedEuidIndexing(&CC->room)) && (do_repl_check) ) {
-               lprintf(CTDL_DEBUG, "CtdlSaveMsgPointerInRoom() doing repl checks\n");
+               CtdlLogPrintf(CTDL_DEBUG, "CtdlSaveMsgPointerInRoom() doing repl checks\n");
 
                for (i=0; i<num_msgs_to_be_merged; ++i) {
                        msgid = msgs_to_be_merged[i];
@@ -2155,7 +2155,7 @@ int CtdlSaveMsgPointersInRoom(char *roomname, long newmsgidlist[], int num_newms
        }
 
        else {
-               lprintf(CTDL_DEBUG, "CtdlSaveMsgPointerInRoom() skips repl checks\n");
+               CtdlLogPrintf(CTDL_DEBUG, "CtdlSaveMsgPointerInRoom() skips repl checks\n");
        }
 
        /* Submit this room for processing by hooks */
@@ -2242,7 +2242,7 @@ long send_message(struct CtdlMessage *msg) {
        /* Write our little bundle of joy into the message base */
        if (cdb_store(CDB_MSGMAIN, &newmsgid, (int)sizeof(long),
                      smr.ser, smr.len) < 0) {
-               lprintf(CTDL_ERR, "Can't store message\n");
+               CtdlLogPrintf(CTDL_ERR, "Can't store message\n");
                retval = 0L;
        } else {
                if (is_bigmsg) {
@@ -2285,7 +2285,7 @@ void serialize_message(struct ser_ret *ret,               /* return values */
         * Check for valid message format
         */
        if (is_valid_message(msg) == 0) {
-               lprintf(CTDL_ERR, "serialize_message() aborting due to invalid message\n");
+               CtdlLogPrintf(CTDL_ERR, "serialize_message() aborting due to invalid message\n");
                ret->len = 0;
                ret->ser = NULL;
                return;
@@ -2298,7 +2298,7 @@ void serialize_message(struct ser_ret *ret,               /* return values */
 
        ret->ser = malloc(ret->len);
        if (ret->ser == NULL) {
-               lprintf(CTDL_ERR, "serialize_message() malloc(%ld) failed: %s\n",
+               CtdlLogPrintf(CTDL_ERR, "serialize_message() malloc(%ld) failed: %s\n",
                        (long)ret->len, strerror(errno));
                ret->len = 0;
                ret->ser = NULL;
@@ -2316,7 +2316,7 @@ void serialize_message(struct ser_ret *ret,               /* return values */
                safestrncpy((char *)&ret->ser[wlen], msg->cm_fields[(int)forder[i]], fieldlen+1);
                wlen = wlen + fieldlen + 1;
        }
-       if (ret->len != wlen) lprintf(CTDL_ERR, "ERROR: len=%ld wlen=%ld\n",
+       if (ret->len != wlen) CtdlLogPrintf(CTDL_ERR, "ERROR: len=%ld wlen=%ld\n",
                (long)ret->len, (long)wlen);
 
        return;
@@ -2342,7 +2342,7 @@ void dump_message(struct CtdlMessage *msg,        /* unserialized msg */
         * Check for valid message format
         */
        if (is_valid_message(msg) == 0) {
-               lprintf(CTDL_ERR, "dump_message() aborting due to invalid message\n");
+               CtdlLogPrintf(CTDL_ERR, "dump_message() aborting due to invalid message\n");
                return;
        }
 
@@ -2370,19 +2370,19 @@ void ReplicationChecks(struct CtdlMessage *msg) {
 
        if (DoesThisRoomNeedEuidIndexing(&CC->room) == 0) return;
 
-       lprintf(CTDL_DEBUG, "Performing replication checks in <%s>\n",
+       CtdlLogPrintf(CTDL_DEBUG, "Performing replication checks in <%s>\n",
                CC->room.QRname);
 
        /* No exclusive id?  Don't do anything. */
        if (msg == NULL) return;
        if (msg->cm_fields['E'] == NULL) return;
        if (IsEmptyStr(msg->cm_fields['E'])) return;
-       /*lprintf(CTDL_DEBUG, "Exclusive ID: <%s> for room <%s>\n",
+       /*CtdlLogPrintf(CTDL_DEBUG, "Exclusive ID: <%s> for room <%s>\n",
                msg->cm_fields['E'], CC->room.QRname);*/
 
        old_msgnum = locate_message_by_euid(msg->cm_fields['E'], &CC->room);
        if (old_msgnum > 0L) {
-               lprintf(CTDL_DEBUG, "ReplicationChecks() replacing message %ld\n", old_msgnum);
+               CtdlLogPrintf(CTDL_DEBUG, "ReplicationChecks() replacing message %ld\n", old_msgnum);
                CtdlDeleteMessages(CC->room.QRname, &old_msgnum, 1, "");
        }
 }
@@ -2421,7 +2421,7 @@ long CtdlSubmitMsg(struct CtdlMessage *msg,       /* message to save */
        int qualified_for_journaling = 0;
        struct CitContext *CCC = CC;            /* CachedCitContext - performance boost */
 
-       lprintf(CTDL_DEBUG, "CtdlSubmitMsg() called\n");
+       CtdlLogPrintf(CTDL_DEBUG, "CtdlSubmitMsg() called\n");
        if (is_valid_message(msg) == 0) return(-1);     /* self check */
 
        /* If this message has no timestamp, we take the liberty of
@@ -2457,7 +2457,7 @@ long CtdlSubmitMsg(struct CtdlMessage *msg,       /* message to save */
 
        /* Learn about what's inside, because it's what's inside that counts */
        if (msg->cm_fields['M'] == NULL) {
-               lprintf(CTDL_ERR, "ERROR: attempt to save message with NULL body\n");
+               CtdlLogPrintf(CTDL_ERR, "ERROR: attempt to save message with NULL body\n");
                return(-2);
        }
 
@@ -2489,7 +2489,7 @@ long CtdlSubmitMsg(struct CtdlMessage *msg,       /* message to save */
        }
 
        /* Goto the correct room */
-       lprintf(CTDL_DEBUG, "Selected room %s\n", (recps) ? CCC->room.QRname : SENTITEMS);
+       CtdlLogPrintf(CTDL_DEBUG, "Selected room %s\n", (recps) ? CCC->room.QRname : SENTITEMS);
        strcpy(hold_rm, CCC->room.QRname);
        strcpy(actual_rm, CCC->room.QRname);
        if (recps != NULL) {
@@ -2501,7 +2501,7 @@ long CtdlSubmitMsg(struct CtdlMessage *msg,       /* message to save */
                if (CCC->user.axlevel == 2) {
                        strcpy(hold_rm, actual_rm);
                        strcpy(actual_rm, config.c_twitroom);
-                       lprintf(CTDL_DEBUG, "Diverting to twit room\n");
+                       CtdlLogPrintf(CTDL_DEBUG, "Diverting to twit room\n");
                }
        }
 
@@ -2510,7 +2510,7 @@ long CtdlSubmitMsg(struct CtdlMessage *msg,       /* message to save */
                strcpy(actual_rm, force_room);
        }
 
-       lprintf(CTDL_DEBUG, "Final selection: %s\n", actual_rm);
+       CtdlLogPrintf(CTDL_DEBUG, "Final selection: %s\n", actual_rm);
        if (strcasecmp(actual_rm, CCC->room.QRname)) {
                /* getroom(&CCC->room, actual_rm); */
                usergoto(actual_rm, 0, 1, NULL, NULL);
@@ -2524,7 +2524,7 @@ long CtdlSubmitMsg(struct CtdlMessage *msg,       /* message to save */
        }
 
        /* Perform "before save" hooks (aborting if any return nonzero) */
-       lprintf(CTDL_DEBUG, "Performing before-save hooks\n");
+       CtdlLogPrintf(CTDL_DEBUG, "Performing before-save hooks\n");
        if (PerformMessageHooks(msg, EVT_BEFORESAVE) > 0) return(-3);
 
        /*
@@ -2536,7 +2536,7 @@ long CtdlSubmitMsg(struct CtdlMessage *msg,       /* message to save */
        }
 
        /* Save it to disk */
-       lprintf(CTDL_DEBUG, "Saving to disk\n");
+       CtdlLogPrintf(CTDL_DEBUG, "Saving to disk\n");
        newmsgid = send_message(msg);
        if (newmsgid <= 0L) return(-5);
 
@@ -2544,7 +2544,7 @@ long CtdlSubmitMsg(struct CtdlMessage *msg,       /* message to save */
         * be a critical section because nobody else knows about this message
         * yet.
         */
-       lprintf(CTDL_DEBUG, "Creating MetaData record\n");
+       CtdlLogPrintf(CTDL_DEBUG, "Creating MetaData record\n");
        memset(&smi, 0, sizeof(struct MetaData));
        smi.meta_msgnum = newmsgid;
        smi.meta_refcount = 0;
@@ -2562,7 +2562,7 @@ long CtdlSubmitMsg(struct CtdlMessage *msg,       /* message to save */
         *    message to attach to the journalized copy.
         */
        if (CCC->redirect_buffer != NULL) {
-               lprintf(CTDL_ALERT, "CCC->redirect_buffer is not NULL during message submission!\n");
+               CtdlLogPrintf(CTDL_ALERT, "CCC->redirect_buffer is not NULL during message submission!\n");
                abort();
        }
        CCC->redirect_buffer = malloc(SIZ);
@@ -2578,7 +2578,7 @@ long CtdlSubmitMsg(struct CtdlMessage *msg,       /* message to save */
        PutMetaData(&smi);
 
        /* Now figure out where to store the pointers */
-       lprintf(CTDL_DEBUG, "Storing pointers\n");
+       CtdlLogPrintf(CTDL_DEBUG, "Storing pointers\n");
 
        /* If this is being done by the networker delivering a private
         * message, we want to BYPASS saving the sender's copy (because there
@@ -2586,7 +2586,7 @@ long CtdlSubmitMsg(struct CtdlMessage *msg,       /* message to save */
         */
        if ((!CCC->internal_pgm) || (recps == NULL)) {
                if (CtdlSaveMsgPointerInRoom(actual_rm, newmsgid, 1, msg) != 0) {
-                       lprintf(CTDL_ERR, "ERROR saving message pointer!\n");
+                       CtdlLogPrintf(CTDL_ERR, "ERROR saving message pointer!\n");
                        CtdlSaveMsgPointerInRoom(config.c_aideroom, newmsgid, 0, msg);
                }
        }
@@ -2603,12 +2603,12 @@ long CtdlSubmitMsg(struct CtdlMessage *msg,     /* message to save */
          for (i=0; i<num_tokens(recps->recp_room, '|'); ++i) {
                extract_token(recipient, recps->recp_room, i,
                                        '|', sizeof recipient);
-               lprintf(CTDL_DEBUG, "Delivering to room <%s>\n", recipient);
+               CtdlLogPrintf(CTDL_DEBUG, "Delivering to room <%s>\n", recipient);
                CtdlSaveMsgPointerInRoom(recipient, newmsgid, 0, msg);
        }
 
        /* Bump this user's messages posted counter. */
-       lprintf(CTDL_DEBUG, "Updating user\n");
+       CtdlLogPrintf(CTDL_DEBUG, "Updating user\n");
        lgetuser(&CCC->user, CCC->curr_user);
        CCC->user.posted = CCC->user.posted + 1;
        lputuser(&CCC->user);
@@ -2621,7 +2621,7 @@ long CtdlSubmitMsg(struct CtdlMessage *msg,       /* message to save */
          for (i=0; i<num_tokens(recps->recp_local, '|'); ++i) {
                extract_token(recipient, recps->recp_local, i,
                                        '|', sizeof recipient);
-               lprintf(CTDL_DEBUG, "Delivering private local mail to <%s>\n",
+               CtdlLogPrintf(CTDL_DEBUG, "Delivering private local mail to <%s>\n",
                        recipient);
                if (getuser(&userbuf, recipient) == 0) {
                        // Add a flag so the Funambol module knows its mail
@@ -2656,14 +2656,14 @@ long CtdlSubmitMsg(struct CtdlMessage *msg,     /* message to save */
                        }
                }
                else {
-                       lprintf(CTDL_DEBUG, "No user <%s>\n", recipient);
+                       CtdlLogPrintf(CTDL_DEBUG, "No user <%s>\n", recipient);
                        CtdlSaveMsgPointerInRoom(config.c_aideroom,
                                newmsgid, 0, msg);
                }
        }
 
        /* Perform "after save" hooks */
-       lprintf(CTDL_DEBUG, "Performing after-save hooks\n");
+       CtdlLogPrintf(CTDL_DEBUG, "Performing after-save hooks\n");
        PerformMessageHooks(msg, EVT_AFTERSAVE);
 
        /* For IGnet mail, we have to save a new copy into the spooler for
@@ -2708,7 +2708,7 @@ long CtdlSubmitMsg(struct CtdlMessage *msg,       /* message to save */
        }
 
        /* Go back to the room we started from */
-       lprintf(CTDL_DEBUG, "Returning to original room %s\n", hold_rm);
+       CtdlLogPrintf(CTDL_DEBUG, "Returning to original room %s\n", hold_rm);
        if (strcasecmp(hold_rm, CCC->room.QRname))
                usergoto(hold_rm, 0, 1, NULL, NULL);
 
@@ -2719,7 +2719,7 @@ long CtdlSubmitMsg(struct CtdlMessage *msg,       /* message to save */
         */
        if (recps != NULL)
         if (recps->num_internet > 0) {
-               lprintf(CTDL_DEBUG, "Generating delivery instructions\n");
+               CtdlLogPrintf(CTDL_DEBUG, "Generating delivery instructions\n");
                instr_alloc = 1024;
                instr = malloc(instr_alloc);
                snprintf(instr, instr_alloc,
@@ -2939,7 +2939,7 @@ char *CtdlReadMessageBody(char *terminator,       /* token signalling EOT */
                                } else {
                                        buffer_len = (buffer_len * 2);
                                        m = ptr;
-                                       lprintf(CTDL_DEBUG, "buffer_len is now %ld\n", (long)buffer_len);
+                                       CtdlLogPrintf(CTDL_DEBUG, "buffer_len is now %ld\n", (long)buffer_len);
                                }
                        }
        
@@ -3281,7 +3281,7 @@ struct recptypes *validate_recipients(char *supplied_recipients,
                striplt(this_recp);
                if (IsEmptyStr(this_recp))
                        break;
-               lprintf(CTDL_DEBUG, "Evaluating recipient #%d: %s\n", num_recps, this_recp);
+               CtdlLogPrintf(CTDL_DEBUG, "Evaluating recipient #%d: %s\n", num_recps, this_recp);
                ++num_recps;
                mailtype = alias(this_recp);
                mailtype = alias(this_recp);
@@ -3423,12 +3423,12 @@ struct recptypes *validate_recipients(char *supplied_recipients,
                strcpy(ret->errormsg, "No recipients specified.");
        }
 
-       lprintf(CTDL_DEBUG, "validate_recipients()\n");
-       lprintf(CTDL_DEBUG, " local: %d <%s>\n", ret->num_local, ret->recp_local);
-       lprintf(CTDL_DEBUG, "  room: %d <%s>\n", ret->num_room, ret->recp_room);
-       lprintf(CTDL_DEBUG, "  inet: %d <%s>\n", ret->num_internet, ret->recp_internet);
-       lprintf(CTDL_DEBUG, " ignet: %d <%s>\n", ret->num_ignet, ret->recp_ignet);
-       lprintf(CTDL_DEBUG, " error: %d <%s>\n", ret->num_error, ret->errormsg);
+       CtdlLogPrintf(CTDL_DEBUG, "validate_recipients()\n");
+       CtdlLogPrintf(CTDL_DEBUG, " local: %d <%s>\n", ret->num_local, ret->recp_local);
+       CtdlLogPrintf(CTDL_DEBUG, "  room: %d <%s>\n", ret->num_room, ret->recp_room);
+       CtdlLogPrintf(CTDL_DEBUG, "  inet: %d <%s>\n", ret->num_internet, ret->recp_internet);
+       CtdlLogPrintf(CTDL_DEBUG, " ignet: %d <%s>\n", ret->num_ignet, ret->recp_ignet);
+       CtdlLogPrintf(CTDL_DEBUG, " error: %d <%s>\n", ret->num_error, ret->errormsg);
 
        free(recipients);
        return(ret);
@@ -3445,7 +3445,7 @@ void free_recipients(struct recptypes *valid) {
        }
 
        if (valid->recptypes_magic != RECPTYPES_MAGIC) {
-               lprintf(CTDL_EMERG, "Attempt to call free_recipients() on some other data type!\n");
+               CtdlLogPrintf(CTDL_EMERG, "Attempt to call free_recipients() on some other data type!\n");
                abort();
        }
 
@@ -3787,12 +3787,12 @@ int CtdlDeleteMessages(char *room_name,         /* which room */
                regcomp(&re, content_type, 0);
                need_to_free_re = 1;
        }
-       lprintf(CTDL_DEBUG, "CtdlDeleteMessages(%s, %d msgs, %s)\n",
+       CtdlLogPrintf(CTDL_DEBUG, "CtdlDeleteMessages(%s, %d msgs, %s)\n",
                room_name, num_dmsgnums, content_type);
 
        /* get room record, obtaining a lock... */
        if (lgetroom(&qrbuf, room_name) != 0) {
-               lprintf(CTDL_ERR, "CtdlDeleteMessages(): Room <%s> not found\n",
+               CtdlLogPrintf(CTDL_ERR, "CtdlDeleteMessages(): Room <%s> not found\n",
                        room_name);
                if (need_to_free_re) regfree(&re);
                return (0);     /* room not found */
@@ -3866,7 +3866,7 @@ int CtdlDeleteMessages(char *room_name,           /* which room */
        /* Now free the memory we used, and go away. */
        if (msglist != NULL) free(msglist);
        if (dellist != NULL) free(dellist);
-       lprintf(CTDL_DEBUG, "%d message(s) deleted.\n", num_deleted);
+       CtdlLogPrintf(CTDL_DEBUG, "%d message(s) deleted.\n", num_deleted);
        if (need_to_free_re) regfree(&re);
        return (num_deleted);
 }
@@ -4116,7 +4116,7 @@ void AdjRefCount(long msgnum, int incr)
 
        /* msgnum < 0 means that we're trying to close the file */
        if (msgnum < 0) {
-               lprintf(CTDL_DEBUG, "Closing the AdjRefCount queue file\n");
+               CtdlLogPrintf(CTDL_DEBUG, "Closing the AdjRefCount queue file\n");
                begin_critical_section(S_SUPPMSGMAIN);
                if (arcfp != NULL) {
                        fclose(arcfp);
@@ -4168,7 +4168,7 @@ int TDAP_ProcessAdjRefCountQueue(void)
 
        r = link(file_arcq, file_arcq_temp);
        if (r != 0) {
-               lprintf(CTDL_CRIT, "%s: %s\n", file_arcq_temp, strerror(errno));
+               CtdlLogPrintf(CTDL_CRIT, "%s: %s\n", file_arcq_temp, strerror(errno));
                end_critical_section(S_SUPPMSGMAIN);
                return(num_records_processed);
        }
@@ -4178,7 +4178,7 @@ int TDAP_ProcessAdjRefCountQueue(void)
 
        fp = fopen(file_arcq_temp, "rb");
        if (fp == NULL) {
-               lprintf(CTDL_CRIT, "%s: %s\n", file_arcq_temp, strerror(errno));
+               CtdlLogPrintf(CTDL_CRIT, "%s: %s\n", file_arcq_temp, strerror(errno));
                return(num_records_processed);
        }
 
@@ -4190,7 +4190,7 @@ int TDAP_ProcessAdjRefCountQueue(void)
        fclose(fp);
        r = unlink(file_arcq_temp);
        if (r != 0) {
-               lprintf(CTDL_CRIT, "%s: %s\n", file_arcq_temp, strerror(errno));
+               CtdlLogPrintf(CTDL_CRIT, "%s: %s\n", file_arcq_temp, strerror(errno));
        }
 
        return(num_records_processed);
@@ -4221,14 +4221,14 @@ void TDAP_AdjRefCount(long msgnum, int incr)
        smi.meta_refcount += incr;
        PutMetaData(&smi);
        end_critical_section(S_SUPPMSGMAIN);
-       lprintf(CTDL_DEBUG, "msg %ld ref count delta %d, is now %d\n",
+       CtdlLogPrintf(CTDL_DEBUG, "msg %ld ref count delta %d, is now %d\n",
                msgnum, incr, smi.meta_refcount);
 
        /* If the reference count is now zero, delete the message
         * (and its supplementary record as well).
         */
        if (smi.meta_refcount == 0) {
-               lprintf(CTDL_DEBUG, "Deleting message <%ld>\n", msgnum);
+               CtdlLogPrintf(CTDL_DEBUG, "Deleting message <%ld>\n", msgnum);
                
                /* Call delete hooks with NULL room to show it has gone altogether */
                PerformDeleteHooks(NULL, msgnum);
@@ -4279,14 +4279,14 @@ void CtdlWriteObject(char *req_room,            /* Room to stuff it in */
 
        fp = fopen(tempfilename, "rb");
        if (fp == NULL) {
-               lprintf(CTDL_CRIT, "Cannot open %s: %s\n",
+               CtdlLogPrintf(CTDL_CRIT, "Cannot open %s: %s\n",
                        tempfilename, strerror(errno));
                return;
        }
        fseek(fp, 0L, SEEK_END);
        raw_length = ftell(fp);
        rewind(fp);
-       lprintf(CTDL_DEBUG, "Raw length is %ld\n", (long)raw_length);
+       CtdlLogPrintf(CTDL_DEBUG, "Raw length is %ld\n", (long)raw_length);
 
        raw_message = malloc((size_t)raw_length + 2);
        fread(raw_message, (size_t)raw_length, 1, fp);
@@ -4332,7 +4332,7 @@ void CtdlWriteObject(char *req_room,              /* Room to stuff it in */
 
        free(raw_message);
 
-       lprintf(CTDL_DEBUG, "Allocating\n");
+       CtdlLogPrintf(CTDL_DEBUG, "Allocating\n");
        msg = malloc(sizeof(struct CtdlMessage));
        memset(msg, 0, sizeof(struct CtdlMessage));
        msg->cm_magic = CTDLMESSAGE_MAGIC;
@@ -4356,7 +4356,7 @@ void CtdlWriteObject(char *req_room,              /* Room to stuff it in */
         * other objects of this type that are currently in the room.
         */
        if (is_unique) {
-               lprintf(CTDL_DEBUG, "Deleted %d other msgs of this type\n",
+               CtdlLogPrintf(CTDL_DEBUG, "Deleted %d other msgs of this type\n",
                        CtdlDeleteMessages(roomname, NULL, 0, content_type)
                );
        }
index b82016ba558452923564cc482d870e7a943e6875..e3720e3cc948490be0f52adf888886c71c0a2805 100644 (file)
@@ -933,7 +933,7 @@ void usergoto(char *where, int display_result, int transiently,
 
        if (retmsgs != NULL) *retmsgs = total_messages;
        if (retnew != NULL) *retnew = new_messages;
-       lprintf(CTDL_DEBUG, "<%s> %d new of %d total messages\n",
+       CtdlLogPrintf(CTDL_DEBUG, "<%s> %d new of %d total messages\n",
                CC->room.QRname,
                new_messages, total_messages
        );
@@ -1073,7 +1073,7 @@ void cmd_goto(char *gargs)
                                   ((ra & UA_KNOWN) == 0) &&
                                   (CC->user.axlevel < 6)
                                   ) {
-                               lprintf(CTDL_DEBUG, "Failed to acquire private room\n");
+                               CtdlLogPrintf(CTDL_DEBUG, "Failed to acquire private room\n");
                        } else {
                                memcpy(&CC->room, &QRscratch,
                                        sizeof(struct ctdlroom));
@@ -1249,7 +1249,7 @@ int CtdlRenameRoom(char *old_name, char *new_name, int new_floor) {
        long owner = 0L;
        char actual_old_name[ROOMNAMELEN];
 
-       lprintf(CTDL_DEBUG, "CtdlRenameRoom(%s, %s, %d)\n",
+       CtdlLogPrintf(CTDL_DEBUG, "CtdlRenameRoom(%s, %s, %d)\n",
                old_name, new_name, new_floor);
 
        if (new_floor >= 0) {
@@ -1340,11 +1340,11 @@ int CtdlRenameRoom(char *old_name, char *new_name, int new_floor) {
                lgetfloor(&flbuf, old_floor);
                --flbuf.f_ref_count;
                lputfloor(&flbuf, old_floor);
-               lprintf(CTDL_DEBUG, "Reference count for floor %d is now %d\n", old_floor, flbuf.f_ref_count);
+               CtdlLogPrintf(CTDL_DEBUG, "Reference count for floor %d is now %d\n", old_floor, flbuf.f_ref_count);
                lgetfloor(&flbuf, new_floor);
                ++flbuf.f_ref_count;
                lputfloor(&flbuf, new_floor);
-               lprintf(CTDL_DEBUG, "Reference count for floor %d is now %d\n", new_floor, flbuf.f_ref_count);
+               CtdlLogPrintf(CTDL_DEBUG, "Reference count for floor %d is now %d\n", new_floor, flbuf.f_ref_count);
        }
 
        /* ...and everybody say "YATTA!" */     
@@ -1593,7 +1593,7 @@ void schedule_room_for_deletion(struct ctdlroom *qrbuf)
        char old_name[ROOMNAMELEN];
        static int seq = 0;
 
-       lprintf(CTDL_NOTICE, "Scheduling room <%s> for deletion\n",
+       CtdlLogPrintf(CTDL_NOTICE, "Scheduling room <%s> for deletion\n",
                qrbuf->QRname);
 
        safestrncpy(old_name, qrbuf->QRname, sizeof old_name);
@@ -1631,7 +1631,7 @@ void delete_room(struct ctdlroom *qrbuf)
        char filename[100];
        /* TODO: filename magic? does this realy work? */
 
-       lprintf(CTDL_NOTICE, "Deleting room <%s>\n", qrbuf->QRname);
+       CtdlLogPrintf(CTDL_NOTICE, "Deleting room <%s>\n", qrbuf->QRname);
 
        /* Delete the info file */
        assoc_file_name(filename, sizeof filename, qrbuf, ctdl_info_dir);
@@ -1762,11 +1762,11 @@ unsigned create_room(char *new_room_name,
        struct floor flbuf;
        struct visit vbuf;
 
-       lprintf(CTDL_DEBUG, "create_room(name=%s, type=%d, view=%d)\n",
+       CtdlLogPrintf(CTDL_DEBUG, "create_room(name=%s, type=%d, view=%d)\n",
                new_room_name, new_room_type, new_room_view);
 
        if (getroom(&qrbuf, new_room_name) == 0) {
-               lprintf(CTDL_DEBUG, "%s already exists.\n", new_room_name);
+               CtdlLogPrintf(CTDL_DEBUG, "%s already exists.\n", new_room_name);
                return(0);
        }
 
@@ -1974,9 +1974,9 @@ void cmd_einf(char *ok)
                return;
        }
        assoc_file_name(infofilename, sizeof infofilename, &CC->room, ctdl_info_dir);
-       lprintf(CTDL_DEBUG, "opening\n");
+       CtdlLogPrintf(CTDL_DEBUG, "opening\n");
        fp = fopen(infofilename, "w");
-       lprintf(CTDL_DEBUG, "checking\n");
+       CtdlLogPrintf(CTDL_DEBUG, "checking\n");
        if (fp == NULL) {
                cprintf("%d Cannot open %s: %s\n",
                  ERROR + INTERNAL_ERROR, infofilename, strerror(errno));
index 026af0680ac64500d8dbf896513c9369aef9e88c..7644b624345aa3fba8ccf9da1f6b6be972a5a250 100644 (file)
@@ -122,8 +122,8 @@ void LogPrintMessages(long err)
 
        snprintf(Message, n * SIZ, ErrGeneral, Short, Where, List, Hint, DetailList);
 
-       lprintf(0,Message);
-       lprintf(0,ErrSubject);
+       CtdlLogPrintf(0,Message);
+       CtdlLogPrintf(0,ErrSubject);
        quickie_message("Citadel", NULL, NULL, AIDEROOM, Message, FMT_FIXED, ErrSubject);
        if (errormessages!=NULL) free (errormessages);
        errormessages = NULL;
@@ -219,7 +219,7 @@ void CtdlRegisterProtoHook(void (*handler) (char *), char *cmd, char *desc)
        p->desc = desc;
        p->next = ProtoHookList;
        ProtoHookList = p;
-       lprintf(CTDL_INFO, "Registered server command %s (%s)\n", cmd, desc);
+       CtdlLogPrintf(CTDL_INFO, "Registered server command %s (%s)\n", cmd, desc);
 }
 
 
@@ -236,7 +236,7 @@ void CtdlUnregisterProtoHook(void (*handler) (char *), char *cmd)
                while (cur != NULL &&
                                handler == cur->handler &&
                                !strcmp(cmd, cur->cmd)) {
-                       lprintf(CTDL_INFO, "Unregistered server command %s (%s)\n",
+                       CtdlLogPrintf(CTDL_INFO, "Unregistered server command %s (%s)\n",
                                        cmd, cur->desc);
                        p = cur->next;
                        if (cur == ProtoHookList) {
@@ -260,7 +260,7 @@ void CtdlDestroyProtoHooks(void)
        cur = ProtoHookList; 
        while (cur != NULL)
        {
-               lprintf(CTDL_INFO, "Destroyed server command %s (%s)\n",
+               CtdlLogPrintf(CTDL_INFO, "Destroyed server command %s (%s)\n",
                        cur->cmd, cur->desc);
                p = cur->next;
                free(cur);
@@ -281,7 +281,7 @@ void CtdlRegisterCleanupHook(void (*fcn_ptr) (void))
        newfcn->h_function_pointer = fcn_ptr;
        CleanupHookTable = newfcn;
 
-       lprintf(CTDL_INFO, "Registered a new cleanup function\n");
+       CtdlLogPrintf(CTDL_INFO, "Registered a new cleanup function\n");
 }
 
 
@@ -293,7 +293,7 @@ void CtdlUnregisterCleanupHook(void (*fcn_ptr) (void))
                /* This will also remove duplicates if any */
                while (cur != NULL &&
                                fcn_ptr == cur->h_function_pointer) {
-                       lprintf(CTDL_INFO, "Unregistered cleanup function\n");
+                       CtdlLogPrintf(CTDL_INFO, "Unregistered cleanup function\n");
                        p = cur->next;
                        if (cur == CleanupHookTable) {
                                CleanupHookTable = p;
@@ -311,7 +311,7 @@ void CtdlDestroyCleanupHooks(void)
        cur = CleanupHookTable;
        while (cur != NULL)
        {
-               lprintf(CTDL_INFO, "Destroyed cleanup function\n");
+               CtdlLogPrintf(CTDL_INFO, "Destroyed cleanup function\n");
                p = cur->next;
                free(cur);
                cur = p;
@@ -332,7 +332,7 @@ void CtdlRegisterSessionHook(void (*fcn_ptr) (void), int EventType)
        newfcn->eventtype = EventType;
        SessionHookTable = newfcn;
 
-       lprintf(CTDL_INFO, "Registered a new session function (type %d)\n",
+       CtdlLogPrintf(CTDL_INFO, "Registered a new session function (type %d)\n",
                EventType);
 }
 
@@ -346,7 +346,7 @@ void CtdlUnregisterSessionHook(void (*fcn_ptr) (void), int EventType)
                while (cur != NULL &&
                                fcn_ptr == cur->h_function_pointer &&
                                EventType == cur->eventtype) {
-                       lprintf(CTDL_INFO, "Unregistered session function (type %d)\n",
+                       CtdlLogPrintf(CTDL_INFO, "Unregistered session function (type %d)\n",
                                        EventType);
                        p = cur->next;
                        if (cur == SessionHookTable) {
@@ -365,7 +365,7 @@ void CtdlDestroySessionHooks(void)
        cur = SessionHookTable;
        while (cur != NULL)
        {
-               lprintf(CTDL_INFO, "Destroyed session function\n");
+               CtdlLogPrintf(CTDL_INFO, "Destroyed session function\n");
                p = cur->next;
                free(cur);
                cur = p;
@@ -386,7 +386,7 @@ void CtdlRegisterUserHook(void (*fcn_ptr) (struct ctdluser *), int EventType)
        newfcn->eventtype = EventType;
        UserHookTable = newfcn;
 
-       lprintf(CTDL_INFO, "Registered a new user function (type %d)\n",
+       CtdlLogPrintf(CTDL_INFO, "Registered a new user function (type %d)\n",
                EventType);
 }
 
@@ -400,7 +400,7 @@ void CtdlUnregisterUserHook(void (*fcn_ptr) (struct ctdluser *), int EventType)
                while (cur != NULL &&
                                fcn_ptr == cur->h_function_pointer &&
                                EventType == cur->eventtype) {
-                       lprintf(CTDL_INFO, "Unregistered user function (type %d)\n",
+                       CtdlLogPrintf(CTDL_INFO, "Unregistered user function (type %d)\n",
                                        EventType);
                        p = cur->next;
                        if (cur == UserHookTable) {
@@ -419,7 +419,7 @@ void CtdlDestroyUserHooks(void)
        cur = UserHookTable;
        while (cur != NULL)
        {
-               lprintf(CTDL_INFO, "Destroyed user function \n");
+               CtdlLogPrintf(CTDL_INFO, "Destroyed user function \n");
                p = cur->next;
                free(cur);
                cur = p;
@@ -441,7 +441,7 @@ void CtdlRegisterMessageHook(int (*handler)(struct CtdlMessage *),
        newfcn->eventtype = EventType;
        MessageHookTable = newfcn;
 
-       lprintf(CTDL_INFO, "Registered a new message function (type %d)\n",
+       CtdlLogPrintf(CTDL_INFO, "Registered a new message function (type %d)\n",
                EventType);
 }
 
@@ -456,7 +456,7 @@ void CtdlUnregisterMessageHook(int (*handler)(struct CtdlMessage *),
                while (cur != NULL &&
                                handler == cur->h_function_pointer &&
                                EventType == cur->eventtype) {
-                       lprintf(CTDL_INFO, "Unregistered message function (type %d)\n",
+                       CtdlLogPrintf(CTDL_INFO, "Unregistered message function (type %d)\n",
                                        EventType);
                        p = cur->next;
                        if (cur == MessageHookTable) {
@@ -475,7 +475,7 @@ void CtdlDestroyMessageHook(void)
        cur = MessageHookTable; 
        while (cur != NULL)
        {
-               lprintf(CTDL_INFO, "Destroyed message function \n");
+               CtdlLogPrintf(CTDL_INFO, "Destroyed message function \n");
                p = cur->next;
                free(cur);
                cur = p;
@@ -494,7 +494,7 @@ void CtdlRegisterRoomHook(int (*fcn_ptr)(struct ctdlroom *))
        newfcn->fcn_ptr = fcn_ptr;
        RoomHookTable = newfcn;
 
-       lprintf(CTDL_INFO, "Registered a new room function\n");
+       CtdlLogPrintf(CTDL_INFO, "Registered a new room function\n");
 }
 
 
@@ -504,7 +504,7 @@ void CtdlUnregisterRoomHook(int (*fcn_ptr)(struct ctdlroom *))
 
        for (cur = RoomHookTable; cur != NULL; cur = cur->next) {
                while (cur != NULL && fcn_ptr == cur->fcn_ptr) {
-                       lprintf(CTDL_INFO, "Unregistered room function\n");
+                       CtdlLogPrintf(CTDL_INFO, "Unregistered room function\n");
                        p = cur->next;
                        if (cur == RoomHookTable) {
                                RoomHookTable = p;
@@ -523,7 +523,7 @@ void CtdlDestroyRoomHooks(void)
        cur = RoomHookTable;
        while (cur != NULL)
        {
-               lprintf(CTDL_INFO, "Unregistered room function\n");
+               CtdlLogPrintf(CTDL_INFO, "Unregistered room function\n");
                p = cur->next;
                free(cur);
                cur = p;
@@ -541,7 +541,7 @@ void CtdlRegisterNetprocHook(int (*handler)(struct CtdlMessage *, char *) )
        newfcn->h_function_pointer = handler;
        NetprocHookTable = newfcn;
 
-       lprintf(CTDL_INFO, "Registered a new netproc function\n");
+       CtdlLogPrintf(CTDL_INFO, "Registered a new netproc function\n");
 }
 
 
@@ -553,7 +553,7 @@ void CtdlUnregisterNetprocHook(int (*handler)(struct CtdlMessage *, char *) )
                /* This will also remove duplicates if any */
                while (cur != NULL &&
                                handler == cur->h_function_pointer ) {
-                       lprintf(CTDL_INFO, "Unregistered netproc function\n");
+                       CtdlLogPrintf(CTDL_INFO, "Unregistered netproc function\n");
                        p = cur->next;
                        if (cur == NetprocHookTable) {
                                NetprocHookTable = p;
@@ -571,7 +571,7 @@ void CtdlDestroyNetprocHooks(void)
        cur = NetprocHookTable;
        while (cur != NULL)
        {
-               lprintf(CTDL_INFO, "Unregistered netproc function\n");
+               CtdlLogPrintf(CTDL_INFO, "Unregistered netproc function\n");
                p = cur->next;
                free(cur);
                cur = p;
@@ -590,7 +590,7 @@ void CtdlRegisterDeleteHook(void (*handler)(char *, long) )
        newfcn->h_function_pointer = handler;
        DeleteHookTable = newfcn;
 
-       lprintf(CTDL_INFO, "Registered a new netproc function\n");
+       CtdlLogPrintf(CTDL_INFO, "Registered a new netproc function\n");
 }
 
 
@@ -602,7 +602,7 @@ void CtdlUnregisterDeleteHook(void (*handler)(char *, long) )
                /* This will also remove duplicates if any */
                while (cur != NULL &&
                                handler == cur->h_function_pointer ) {
-                       lprintf(CTDL_INFO, "Unregistered netproc function\n");
+                       CtdlLogPrintf(CTDL_INFO, "Unregistered netproc function\n");
                        p = cur->next;
                        if (cur == DeleteHookTable) {
                                DeleteHookTable = p;
@@ -619,7 +619,7 @@ void CtdlDestroyDeleteHooks(void)
        cur = DeleteHookTable;
        while (cur != NULL)
        {
-               lprintf(CTDL_INFO, "Destroyed netproc function\n");
+               CtdlLogPrintf(CTDL_INFO, "Destroyed netproc function\n");
                p = cur->next;
                free(cur);
                cur = p;                
@@ -641,7 +641,7 @@ void CtdlRegisterFixedOutputHook(char *content_type, void (*handler)(char *, int
        safestrncpy(newfcn->content_type, content_type, sizeof newfcn->content_type);
        FixedOutputTable = newfcn;
 
-       lprintf(CTDL_INFO, "Registered a new fixed output function for %s\n", newfcn->content_type);
+       CtdlLogPrintf(CTDL_INFO, "Registered a new fixed output function for %s\n", newfcn->content_type);
 }
 
 
@@ -652,7 +652,7 @@ void CtdlUnregisterFixedOutputHook(char *content_type)
        for (cur = FixedOutputTable; cur != NULL; cur = cur->next) {
                /* This will also remove duplicates if any */
                while (cur != NULL && (!strcasecmp(content_type, cur->content_type))) {
-                       lprintf(CTDL_INFO, "Unregistered fixed output function for %s\n", content_type);
+                       CtdlLogPrintf(CTDL_INFO, "Unregistered fixed output function for %s\n", content_type);
                        p = cur->next;
                        if (cur == FixedOutputTable) {
                                FixedOutputTable = p;
@@ -670,7 +670,7 @@ void CtdlDestroyFixedOutputHooks(void)
        cur = FixedOutputTable; 
        while (cur != NULL)
        {
-               lprintf(CTDL_INFO, "Destroyed fixed output function for %s\n", cur->content_type);
+               CtdlLogPrintf(CTDL_INFO, "Destroyed fixed output function for %s\n", cur->content_type);
                p = cur->next;
                free(cur);
                cur = p;
@@ -707,7 +707,7 @@ void CtdlRegisterXmsgHook(int (*fcn_ptr) (char *, char *, char *, char *), int o
        newfcn->order = order;
        newfcn->h_function_pointer = fcn_ptr;
        XmsgHookTable = newfcn;
-       lprintf(CTDL_INFO, "Registered a new x-msg function (priority %d)\n", order);
+       CtdlLogPrintf(CTDL_INFO, "Registered a new x-msg function (priority %d)\n", order);
 }
 
 
@@ -720,7 +720,7 @@ void CtdlUnregisterXmsgHook(int (*fcn_ptr) (char *, char *, char *, char *), int
                while (cur != NULL &&
                                fcn_ptr == cur->h_function_pointer &&
                                order == cur->order) {
-                       lprintf(CTDL_INFO, "Unregistered x-msg function "
+                       CtdlLogPrintf(CTDL_INFO, "Unregistered x-msg function "
                                        "(priority %d)\n", order);
                        p = cur->next;
                        if (cur == XmsgHookTable) {
@@ -739,7 +739,7 @@ void CtdlDestroyXmsgHooks(void)
        cur = XmsgHookTable;
        while (cur != NULL)
        {
-               lprintf(CTDL_INFO, "Destroyed x-msg function "
+               CtdlLogPrintf(CTDL_INFO, "Destroyed x-msg function "
                        "(priority %d)\n", cur->order);
                p = cur->next;
                        
@@ -779,7 +779,7 @@ void CtdlRegisterServiceHook(int tcp_port,
                snprintf(message, SIZ, "Unix domain socket '%s': ", sockpath);
        }
        else if (tcp_port <= 0) {       /* port -1 to disable */
-               lprintf(CTDL_INFO, "Service %s has been manually disabled, skipping\n", ServiceName);
+               CtdlLogPrintf(CTDL_INFO, "Service %s has been manually disabled, skipping\n", ServiceName);
                free (message);
                free(newfcn);
                return;
@@ -796,12 +796,12 @@ void CtdlRegisterServiceHook(int tcp_port,
        if (newfcn->msock > 0) {
                ServiceHookTable = newfcn;
                strcat(message, "registered.");
-               lprintf(CTDL_INFO, "%s\n", message);
+               CtdlLogPrintf(CTDL_INFO, "%s\n", message);
        }
        else {
                AddPortError(message, error);
                strcat(message, "FAILED.");
-               lprintf(CTDL_CRIT, "%s\n", message);
+               CtdlLogPrintf(CTDL_CRIT, "%s\n", message);
                free(error);
                free(newfcn);
        }
@@ -828,12 +828,12 @@ void CtdlUnregisterServiceHook(int tcp_port, char *sockpath,
                                tcp_port == cur->tcp_port) {
                        close(cur->msock);
                        if (sockpath) {
-                               lprintf(CTDL_INFO, "Closed UNIX domain socket %s\n",
+                               CtdlLogPrintf(CTDL_INFO, "Closed UNIX domain socket %s\n",
                                                sockpath);
                        } else if (tcp_port) {
-                               lprintf(CTDL_INFO, "Closed TCP port %d\n", tcp_port);
+                               CtdlLogPrintf(CTDL_INFO, "Closed TCP port %d\n", tcp_port);
                        } else {
-                               lprintf(CTDL_INFO, "Unregistered unknown service\n");
+                               CtdlLogPrintf(CTDL_INFO, "Unregistered unknown service\n");
                        }
                        p = cur->next;
                        if (cur == ServiceHookTable) {
@@ -854,12 +854,12 @@ void CtdlDestroyServiceHook(void)
        {
                close(cur->msock);
                if (cur->sockpath) {
-                       lprintf(CTDL_INFO, "Closed UNIX domain socket %s\n",
+                       CtdlLogPrintf(CTDL_INFO, "Closed UNIX domain socket %s\n",
                                cur->sockpath);
                } else if (cur->tcp_port) {
-                       lprintf(CTDL_INFO, "Closed TCP port %d\n", cur->tcp_port);
+                       CtdlLogPrintf(CTDL_INFO, "Closed TCP port %d\n", cur->tcp_port);
                } else {
-                       lprintf(CTDL_INFO, "Unregistered unknown service\n");
+                       CtdlLogPrintf(CTDL_INFO, "Unregistered unknown service\n");
                }
                p = cur->next;
                free(cur);
@@ -883,7 +883,7 @@ void CtdlRegisterSearchFuncHook(void (*fcn_ptr)(int *, long **, char *), char *n
        newfcn->fcn_ptr = fcn_ptr;
        SearchFunctionHookTable = newfcn;
 
-       lprintf(CTDL_INFO, "Registered a new search function (%s)\n", name);
+       CtdlLogPrintf(CTDL_INFO, "Registered a new search function (%s)\n", name);
 }
 
 void CtdlUnregisterSearchFuncHook(void (*fcn_ptr)(int *, long **, char *), char *name)
@@ -892,7 +892,7 @@ void CtdlUnregisterSearchFuncHook(void (*fcn_ptr)(int *, long **, char *), char
        
        for (cur = SearchFunctionHookTable; cur != NULL; cur = cur->next) {
                while (fcn_ptr && (cur->fcn_ptr == fcn_ptr) && name && !strcmp(name, cur->name)) {
-                       lprintf(CTDL_INFO, "Unregistered search function(%s)\n", name);
+                       CtdlLogPrintf(CTDL_INFO, "Unregistered search function(%s)\n", name);
                        p = cur->next;
                        if (cur == SearchFunctionHookTable) {
                                SearchFunctionHookTable = p;
@@ -946,11 +946,11 @@ int PerformMessageHooks(struct CtdlMessage *msg, int EventType)
 
        /* Other code may elect to protect this message from server-side
         * handlers; if this is the case, don't do anything.
-       lprintf(CTDL_DEBUG, "** Event type is %d, flags are %d\n",
+       CtdlLogPrintf(CTDL_DEBUG, "** Event type is %d, flags are %d\n",
                EventType, msg->cm_flags);
         */
        if (msg->cm_flags & CM_SKIP_HOOKS) {
-               lprintf(CTDL_DEBUG, "Skipping hooks\n");
+               CtdlLogPrintf(CTDL_DEBUG, "Skipping hooks\n");
                return(0);
        }
 
@@ -976,7 +976,7 @@ int PerformRoomHooks(struct ctdlroom *target_room)
        struct RoomFunctionHook *fcn;
        int total_retval = 0;
 
-       lprintf(CTDL_DEBUG, "Performing room hooks for <%s>\n", target_room->QRname);
+       CtdlLogPrintf(CTDL_DEBUG, "Performing room hooks for <%s>\n", target_room->QRname);
 
        for (fcn = RoomHookTable; fcn != NULL; fcn = fcn->next) {
                total_retval = total_retval + (*fcn->fcn_ptr) (target_room);
@@ -1054,7 +1054,7 @@ int CtdlRegisterDirectoryServiceFunc(int (*func)(char *cn, char *ou, void **obje
        {
                if (newfcn->cmd == cmd && !strcmp(newfcn->module, module))
                {
-                       lprintf(CTDL_ERR, "Directory service function already handled by module %s\n", module);
+                       CtdlLogPrintf(CTDL_ERR, "Directory service function already handled by module %s\n", module);
                        return -1;
                }
                newfcn = newfcn->next;
@@ -1067,7 +1067,7 @@ int CtdlRegisterDirectoryServiceFunc(int (*func)(char *cn, char *ou, void **obje
        newfcn->next = DirectoryServiceHookList;
        DirectoryServiceHookList = newfcn;
        
-       lprintf(CTDL_INFO, "Registered a new directory service function from module %s\n", module);
+       CtdlLogPrintf(CTDL_INFO, "Registered a new directory service function from module %s\n", module);
        return 0;
 }
 
index 3f90a79d288833cc121c351dd3ceafc01d054f01..acc3f9aa09f436c335177b0b8d45292dff619b80 100644 (file)
@@ -97,30 +97,16 @@ int enable_syslog = 0;
 
 
 /*
- * Create an interface to lprintf that follows the coding convention.
- * This is here until such time as we have replaced all calls to lprintf with CtdlLogPrintf
+ * CtdlLogPrintf()  ...   Write logging information
  */
-void CtdlLogPrintf(enum LogLevel loglevel, const char *format, ...)
-{
-       va_list arg_ptr;
-       va_start(arg_ptr, format);
-       vlprintf(loglevel, format, arg_ptr);
-       va_end(arg_ptr);
-}
-
-
-/*
- * lprintf()  ...   Write logging information
- */
-void lprintf(enum LogLevel loglevel, const char *format, ...) {   
+void CtdlLogPrintf(enum LogLevel loglevel, const char *format, ...) {   
        va_list arg_ptr;
        va_start(arg_ptr, format);
-       vlprintf(loglevel, format, arg_ptr);
+       vCtdlLogPrintf(loglevel, format, arg_ptr);
        va_end(arg_ptr);
 }
 
-void vlprintf(enum LogLevel loglevel, const char *format, va_list arg_ptr)
+void vCtdlLogPrintf(enum LogLevel loglevel, const char *format, va_list arg_ptr)
 {
        char buf[SIZ], buf2[SIZ];
 
@@ -774,7 +760,7 @@ void context_cleanup(void)
                rem = ptr->next;
                --num_sessions;
                
-               lprintf(CTDL_DEBUG, "Purging session %d\n", ptr->cs_pid);
+               CtdlLogPrintf(CTDL_DEBUG, "Purging session %d\n", ptr->cs_pid);
                RemoveContext(ptr);
                free (ptr);
                ptr = rem;
index 7d02ba74b52ee7532df63bd7c0efbe2f69829e26..a20c35cdb46cef5ed904ed29cc2ac8ec078ad68a 100644 (file)
@@ -62,14 +62,13 @@ enum LogLevel {
 };
 
 #ifdef __GNUC__
-void lprintf (enum LogLevel loglevel, const char *format, ...) __attribute__((__format__(__printf__,2,3)));
 void cprintf (const char *format, ...) __attribute__((__format__(__printf__,1,2)));
 #else
-void lprintf (enum LogLevel loglevel, const char *format, ...);
 void cprintf (const char *format, ...);
 #endif
 
-void vlprintf (enum LogLevel loglevel, const char *format, va_list arg_ptr);
+void CtdlLogPrintf(enum LogLevel loglevel, const char *format, ...);
+void vCtdlLogPrintf (enum LogLevel loglevel, const char *format, va_list arg_ptr);
 
 extern pthread_key_t MyConKey;                 /* TSD key for MyContext() */
 
index df68b87a3077923b0cd941055524d526ff49bdb4..c4003b012086dc9eba69cbbdcff3448fb09e5b6d 100644 (file)
@@ -153,7 +153,7 @@ void ctdl_thread_internal_init_tsd(void)
        int ret;
        
        if ((ret = citthread_key_create(&ThreadKey, ctdl_thread_internal_dest_tsd))) {
-               lprintf(CTDL_EMERG, "citthread_key_create: %s\n", strerror(ret));
+               CtdlLogPrintf(CTDL_EMERG, "citthread_key_create: %s\n", strerror(ret));
                exit(CTDLEXIT_DB);
        }
 }
index b638ccc209cfa2667d2789325af39e24adbbf56e..e7331e8d246f3f2ff5668202ffbde190ece92a57 100644 (file)
@@ -65,7 +65,7 @@ static INLINE void makeuserkey(char *key, char *username) {
        len = strlen(username);
        if (len >= USERNAME_SIZE)
        {
-               lprintf (CTDL_EMERG, "Username to long: %s", username);
+               CtdlLogPrintf (CTDL_EMERG, "Username to long: %s", username);
                cit_backtrace ();
                len = USERNAME_SIZE - 1; 
                username[USERNAME_SIZE - 1]='\0';
@@ -188,7 +188,7 @@ int rename_user(char *oldname, char *newname) {
 
                else {          /* Sanity checks succeeded.  Now rename the user. */
 
-                       lprintf(CTDL_DEBUG, "Renaming <%s> to <%s>\n", oldname, newname);
+                       CtdlLogPrintf(CTDL_DEBUG, "Renaming <%s> to <%s>\n", oldname, newname);
                        cdb_delete(CDB_USERS, oldnamekey, strlen(oldnamekey));
                        safestrncpy(usbuf.fullname, newname, sizeof usbuf.fullname);
                        putuser(&usbuf);
@@ -414,7 +414,7 @@ int CtdlLoginExistingUser(char *authname, char *trythisname)
        char username[SIZ];
        int found_user;
 
-       lprintf(9, "CtdlLoginExistingUser(%s, %s)\n", authname, trythisname);
+       CtdlLogPrintf(9, "CtdlLoginExistingUser(%s, %s)\n", authname, trythisname);
 
        if ((CC->logged_in)) {
                return login_already_logged_in;
@@ -446,21 +446,21 @@ int CtdlLoginExistingUser(char *authname, char *trythisname)
                struct passwd *tempPwdPtr;
                char pwdbuffer[256];
        
-               lprintf(CTDL_DEBUG, "asking host about <%s>\n", username);
+               CtdlLogPrintf(CTDL_DEBUG, "asking host about <%s>\n", username);
 #ifdef HAVE_GETPWNAM_R
 #ifdef SOLARIS_GETPWUID
-               lprintf(CTDL_DEBUG, "Calling getpwnam_r()\n");
+               CtdlLogPrintf(CTDL_DEBUG, "Calling getpwnam_r()\n");
                tempPwdPtr = getpwnam_r(username, &pd, pwdbuffer, sizeof pwdbuffer);
 #else // SOLARIS_GETPWUID
-               lprintf(CTDL_DEBUG, "Calling getpwnam_r()\n");
+               CtdlLogPrintf(CTDL_DEBUG, "Calling getpwnam_r()\n");
                getpwnam_r(username, &pd, pwdbuffer, sizeof pwdbuffer, &tempPwdPtr);
 #endif // SOLARIS_GETPWUID
 #else // HAVE_GETPWNAM_R
-               lprintf(CTDL_DEBUG, "SHOULD NEVER GET HERE!!!\n");
+               CtdlLogPrintf(CTDL_DEBUG, "SHOULD NEVER GET HERE!!!\n");
                tempPwdPtr = NULL;
 #endif // HAVE_GETPWNAM_R
                if (tempPwdPtr == NULL) {
-                       lprintf(CTDL_DEBUG, "no such user <%s>\n", username);
+                       CtdlLogPrintf(CTDL_DEBUG, "no such user <%s>\n", username);
                        return login_not_found;
                }
        
@@ -468,7 +468,7 @@ int CtdlLoginExistingUser(char *authname, char *trythisname)
                 * If not found, make one attempt to create it.
                 */
                found_user = getuserbyuid(&CC->user, pd.pw_uid);
-               lprintf(CTDL_DEBUG, "found it: uid=%ld, gecos=%s here: %d\n",
+               CtdlLogPrintf(CTDL_DEBUG, "found it: uid=%ld, gecos=%s here: %d\n",
                        (long)pd.pw_uid, pd.pw_gecos, found_user);
                if (found_user != 0) {
                        create_user(username, 0);
@@ -556,7 +556,7 @@ void cmd_user(char *cmdbuf)
  */
 void session_startup(void)
 {
-       lprintf(CTDL_NOTICE, "<%s> logged in\n", CC->curr_user);
+       CtdlLogPrintf(CTDL_NOTICE, "<%s> logged in\n", CC->curr_user);
 
        lgetuser(&CC->user, CC->curr_user);
        ++(CC->user.timescalled);
@@ -676,11 +676,11 @@ static int validpw(uid_t uid, const char *pass)
        char buf[256];
 
        if (IsEmptyStr(pass)) {
-               lprintf(CTDL_DEBUG, "refusing to check empty password for uid=%d using chkpwd...\n", uid);
+               CtdlLogPrintf(CTDL_DEBUG, "refusing to check empty password for uid=%d using chkpwd...\n", uid);
                return 0;
        }
 
-       lprintf(CTDL_DEBUG, "Validating password for uid=%d using chkpwd...\n", uid);
+       CtdlLogPrintf(CTDL_DEBUG, "Validating password for uid=%d using chkpwd...\n", uid);
 
        begin_critical_section(S_CHKPWD);
        write(chkpwd_write_pipe[1], &uid, sizeof(uid_t));
@@ -689,11 +689,11 @@ static int validpw(uid_t uid, const char *pass)
        end_critical_section(S_CHKPWD);
 
        if (!strncmp(buf, "PASS", 4)) {
-               lprintf(CTDL_DEBUG, "...pass\n");
+               CtdlLogPrintf(CTDL_DEBUG, "...pass\n");
                return(1);
        }
 
-       lprintf(CTDL_DEBUG, "...fail\n");
+       CtdlLogPrintf(CTDL_DEBUG, "...fail\n");
        return 0;
 }
 
@@ -705,7 +705,7 @@ void start_chkpwd_daemon(void) {
        struct stat filestats;
        int i;
 
-       lprintf(CTDL_DEBUG, "Starting chkpwd daemon for host authentication mode\n");
+       CtdlLogPrintf(CTDL_DEBUG, "Starting chkpwd daemon for host authentication mode\n");
 
        if ((stat(file_chkpwd, &filestats)==-1) ||
            (filestats.st_size==0)){
@@ -713,29 +713,29 @@ void start_chkpwd_daemon(void) {
                abort();
        }
        if (pipe(chkpwd_write_pipe) != 0) {
-               lprintf(CTDL_EMERG, "Unable to create pipe for chkpwd daemon: %s\n", strerror(errno));
+               CtdlLogPrintf(CTDL_EMERG, "Unable to create pipe for chkpwd daemon: %s\n", strerror(errno));
                abort();
        }
        if (pipe(chkpwd_read_pipe) != 0) {
-               lprintf(CTDL_EMERG, "Unable to create pipe for chkpwd daemon: %s\n", strerror(errno));
+               CtdlLogPrintf(CTDL_EMERG, "Unable to create pipe for chkpwd daemon: %s\n", strerror(errno));
                abort();
        }
 
        chkpwd_pid = fork();
        if (chkpwd_pid < 0) {
-               lprintf(CTDL_EMERG, "Unable to fork chkpwd daemon: %s\n", strerror(errno));
+               CtdlLogPrintf(CTDL_EMERG, "Unable to fork chkpwd daemon: %s\n", strerror(errno));
                abort();
        }
        if (chkpwd_pid == 0) {
-               lprintf(CTDL_DEBUG, "Now calling dup2() write\n");
+               CtdlLogPrintf(CTDL_DEBUG, "Now calling dup2() write\n");
                dup2(chkpwd_write_pipe[0], 0);
-               lprintf(CTDL_DEBUG, "Now calling dup2() write\n");
+               CtdlLogPrintf(CTDL_DEBUG, "Now calling dup2() write\n");
                dup2(chkpwd_read_pipe[1], 1);
-               lprintf(CTDL_DEBUG, "Now closing stuff\n");
+               CtdlLogPrintf(CTDL_DEBUG, "Now closing stuff\n");
                for (i=2; i<256; ++i) close(i);
-               lprintf(CTDL_DEBUG, "Now calling execl(%s)\n", file_chkpwd);
+               CtdlLogPrintf(CTDL_DEBUG, "Now calling execl(%s)\n", file_chkpwd);
                execl(file_chkpwd, file_chkpwd, NULL);
-               lprintf(CTDL_EMERG, "Unable to exec chkpwd daemon: %s\n", strerror(errno));
+               CtdlLogPrintf(CTDL_EMERG, "Unable to exec chkpwd daemon: %s\n", strerror(errno));
                abort();
                exit(errno);
        }
@@ -754,19 +754,19 @@ int CtdlTryPassword(char *password)
        int code;
 
        if ((CC->logged_in)) {
-               lprintf(CTDL_WARNING, "CtdlTryPassword: already logged in\n");
+               CtdlLogPrintf(CTDL_WARNING, "CtdlTryPassword: already logged in\n");
                return pass_already_logged_in;
        }
        if (!strcmp(CC->curr_user, NLI)) {
-               lprintf(CTDL_WARNING, "CtdlTryPassword: no user selected\n");
+               CtdlLogPrintf(CTDL_WARNING, "CtdlTryPassword: no user selected\n");
                return pass_no_user;
        }
        if (getuser(&CC->user, CC->curr_user)) {
-               lprintf(CTDL_ERR, "CtdlTryPassword: internal error\n");
+               CtdlLogPrintf(CTDL_ERR, "CtdlTryPassword: internal error\n");
                return pass_internal_error;
        }
        if (password == NULL) {
-               lprintf(CTDL_INFO, "CtdlTryPassword: NULL password string supplied\n");
+               CtdlLogPrintf(CTDL_INFO, "CtdlTryPassword: NULL password string supplied\n");
                return pass_wrong_password;
        }
        code = (-1);
@@ -820,7 +820,7 @@ int CtdlTryPassword(char *password)
                do_login();
                return pass_ok;
        } else {
-               lprintf(CTDL_WARNING, "Bad password specified for <%s>\n", CC->curr_user);
+               CtdlLogPrintf(CTDL_WARNING, "Bad password specified for <%s>\n", CC->curr_user);
                return pass_wrong_password;
        }
 }
@@ -871,7 +871,7 @@ int purge_user(char pname[])
                return (ERROR + NO_SUCH_USER);
 
        if (getuser(&usbuf, pname) != 0) {
-               lprintf(CTDL_ERR, "Cannot purge user <%s> - not found\n", pname);
+               CtdlLogPrintf(CTDL_ERR, "Cannot purge user <%s> - not found\n", pname);
                return (ERROR + NO_SUCH_USER);
        }
        /* Don't delete a user who is currently logged in.  Instead, just
@@ -887,12 +887,12 @@ int purge_user(char pname[])
        }
        end_critical_section(S_SESSION_TABLE);
        if (user_is_logged_in == 1) {
-               lprintf(CTDL_WARNING, "User <%s> is logged in; not deleting.\n", pname);
+               CtdlLogPrintf(CTDL_WARNING, "User <%s> is logged in; not deleting.\n", pname);
                usbuf.axlevel = 0;
                putuser(&usbuf);
                return (1);
        }
-       lprintf(CTDL_NOTICE, "Deleting user <%s>\n", pname);
+       CtdlLogPrintf(CTDL_NOTICE, "Deleting user <%s>\n", pname);
 
        /* Perform any purge functions registered by server extensions */
        PerformUserHooks(&usbuf, EVT_PURGEUSER);
@@ -964,7 +964,7 @@ int create_user(char *newusername, int become_user)
                        uid = pd.pw_uid;
                        if (IsEmptyStr (username))
                        {
-                               lprintf (CTDL_EMERG, 
+                               CtdlLogPrintf (CTDL_EMERG, 
                                         "Can't find Realname for user %s [%d] in the Host Auth Database; giving up.\n", 
                                         newusername, pd.pw_uid);
                                snprintf(buf, SIZ, 
@@ -1050,7 +1050,7 @@ int create_user(char *newusername, int become_user)
                CC->cs_addr
        );
        aide_message(buf, "User Creation Notice");
-       lprintf(CTDL_NOTICE, "New user <%s> created\n", username);
+       CtdlLogPrintf(CTDL_NOTICE, "New user <%s> created\n", username);
        return (0);
 }
 
@@ -1148,7 +1148,7 @@ void cmd_setp(char *new_pw)
        safestrncpy(CC->user.password, new_pw, sizeof(CC->user.password));
        lputuser(&CC->user);
        cprintf("%d Password changed.\n", CIT_OK);
-       lprintf(CTDL_INFO, "Password changed for user <%s>\n", CC->curr_user);
+       CtdlLogPrintf(CTDL_INFO, "Password changed for user <%s>\n", CC->curr_user);
        PerformSessionHooks(EVT_SETPASS);
 }