Did away with lprintf all together now its called CtdlLogPrintf()
[citadel.git] / citadel / modules / pop3client / serv_pop3client.c
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;
 }