remove most of the debug code: often makes the code unreadable, for little
[apps/madmutt.git] / nntp / nntp.c
index 7eae011..aa9d915 100644 (file)
@@ -17,7 +17,6 @@
 #include <lib-lib/str.h>
 #include <lib-lib/file.h>
 #include <lib-lib/macros.h>
-#include <lib-lib/debug.h>
 
 #include <lib-mime/mime.h>
 
@@ -83,10 +82,6 @@ void nntp_sync_sidebar (NNTP_DATA* data) {
   tmp->msgcount = data->lastMessage - data->firstMessage;
 }
 
-static void nntp_error (const char *where, const char *msg) {
-  debug_print (1, ("unexpected response in %s: %s\n", where, msg));
-}
-
 static int nntp_auth (NNTP_SERVER * serv)
 {
   CONNECTION *conn = serv->conn;
@@ -108,11 +103,6 @@ static int nntp_auth (NNTP_SERVER * serv)
     return -1;
   }
 
-#ifdef DEBUG
-  /* don't print the password unless we're at the ungodly debugging level */
-  if (DebugLevel < M_SOCK_LOG_FULL)
-    debug_print (M_SOCK_LOG_CMD, ("> AUTHINFO PASS *\n"));
-#endif
   snprintf (buf, sizeof (buf), "AUTHINFO PASS %s\r\n", conn->account.pass);
   mutt_socket_write_d (conn, buf, M_SOCK_LOG_FULL);
   if (mutt_socket_readln (buf, sizeof (buf), conn) < 0) {
@@ -475,8 +465,6 @@ static int nntp_read_header (CONTEXT * ctx, const char *msgid,
 
   ret = mutt_nntp_fetch (nntp_data, buf, NULL, NULL, nntp_read_tempfile, f, 0);
   if (ret) {
-    if (ret != -1)
-      debug_print (1, ("%s\n", buf));
     fclose (f);
     unlink (tempfile);
     return (ret == -1 ? -1 : 1);
@@ -512,7 +500,6 @@ static int parse_description (char *line, void *n)
   d++;
   while (*d && (*d == '\t' || *d == ' '))
     d++;
-  debug_print (2, ("group: %s, desc: %s\n", line, d));
   if ((data = (NNTP_DATA *) hash_find (news->newsgroups, line)) != NULL &&
       m_strcmp(d, data->desc)) {
     p_delete(&data->desc);
@@ -536,9 +523,6 @@ static void nntp_get_desc (NNTP_DATA * data, const char *mask, char *msg, progre
     snprintf (buf, sizeof (buf), "string_list_t NEWSGROUPS %s\r\n", mask);
   if (mutt_nntp_fetch (data, buf, msg, bar, parse_description, data->nserv, 0) !=
       0) {
-#ifdef DEBUG
-    nntp_error ("nntp_get_desc()", buf);
-#endif
   }
 }
 
@@ -722,9 +706,6 @@ static int nntp_fetch_headers (CONTEXT * ctx, unsigned int first,
         0) {
       mutt_error (_("LISTGROUP command failed: %s"), buf);
       sleep (2);
-#ifdef DEBUG
-      nntp_error ("nntp_fetch_headers()", buf);
-#endif
       p_delete(&fc.messages);
       return -1;
     }
@@ -792,9 +773,6 @@ static int nntp_fetch_headers (CONTEXT * ctx, unsigned int first,
       mx_update_context (ctx, ctx->msgcount - oldmsgcount);
     if (ret != 0) {
       mutt_error (_("XOVER command failed: %s"), buf);
-#ifdef DEBUG
-      nntp_error ("nntp_fetch_headers()", buf);
-#endif
       p_delete(&fc.messages);
       return -1;
     }
@@ -886,9 +864,6 @@ int nntp_open_mailbox (CONTEXT * ctx)
 
   buf[0] = 0;
   if (mutt_nntp_query (nntp_data, buf, sizeof (buf)) < 0) {
-#ifdef DEBUG
-    nntp_error ("nntp_open_mailbox()", buf);
-#endif
     return -1;
   }
 
@@ -980,7 +955,6 @@ int nntp_fetch_message (MESSAGE * msg, CONTEXT * ctx, int msgno)
   if (ret == 1) {
     mutt_error (_("Article %d not found on server"),
                 ctx->hdrs[msgno]->article_num);
-    debug_print (1, ("%s\n", buf));
   }
 
   if (ret) {
@@ -1204,17 +1178,11 @@ static int _nntp_check_mailbox (CONTEXT * ctx, NNTP_DATA * nntp_data)
 
   buf[0] = 0;
   if (mutt_nntp_query (nntp_data, buf, sizeof (buf)) < 0) {
-#ifdef DEBUG
-    nntp_error ("nntp_check_mailbox()", buf);
-#endif
     return -1;
   }
   if (m_strncmp("211", buf, 3)) {
     buf[0] = 0;
     if (mutt_nntp_query (nntp_data, buf, sizeof (buf)) < 0) {
-#ifdef DEBUG
-      nntp_error ("nntp_check_mailbox()", buf);
-#endif
       return -1;
     }
   }
@@ -1355,9 +1323,6 @@ int nntp_check_newgroups (NNTP_SERVER * serv, int force)
   l = serv->tail;
   if (mutt_nntp_fetch (&nntp_data, buf, _("Adding new newsgroups..."), NULL,
                        add_group, serv, 0) != 0) {
-#ifdef DEBUG
-    nntp_error ("nntp_check_newgroups()", buf);
-#endif
     return -1;
   }
 
@@ -1426,9 +1391,6 @@ int nntp_get_active (NNTP_SERVER * serv)
   nntp_data.group = NULL;
 
   if (mutt_nntp_fetch (&nntp_data, "string_list_t\r\n", msg, NULL, add_group, serv, 0) < 0) {
-#ifdef DEBUG
-    nntp_error ("nntp_get_active()", "string_list_t\r\n");
-#endif
     return -1;
   }