From: Thorsten Gunkel <tgunkel-lists@tgunkel.de>
[apps/madmutt.git] / imap / imap.c
index 4f0395f..6ad04df 100644 (file)
@@ -211,10 +211,8 @@ int imap_read_literal (FILE * fp, IMAP_DATA * idata, long bytes, progress_t* bar
       r = 0;
 #endif
     fputc (c, fp);
-#ifdef USE_SOCKET
-    if (bar && pos % 1024)
+    if (bar && !(pos % 1024))
       mutt_progress_bar (bar, pos);
-#endif
 #ifdef DEBUG
     if (DebugLevel >= IMAP_LOG_LTRL)
       fputc (c, DebugFile);
@@ -1259,8 +1257,6 @@ static int do_search (const pattern_t* search, int allpats)
 * match types, and does a better job (eg server doesn't support regexps). */
 static int imap_compile_search (const pattern_t* pat, BUFFER* buf)
 {
-  char term[STRING];
-
   if (! do_search (pat, 0))
     return 0;
 
@@ -1293,6 +1289,7 @@ static int imap_compile_search (const pattern_t* pat, BUFFER* buf)
       mutt_buffer_addch (buf, ')');
     }
   } else {
+    char term[STRING];
     char *delim;
 
     switch (pat->op) {
@@ -1444,7 +1441,7 @@ int imap_subscribe (char *path, int subscribe)
   BUFFER err, token;
   IMAP_MBOX mx;
 
-  if (mx_get_magic (path) == M_IMAP || imap_parse_path (path, &mx)) {
+  if (mx_get_magic (path) != M_IMAP || imap_parse_path (path, &mx) < 0) {
     mutt_error (_("Bad mailbox name"));
     return -1;
   }
@@ -1522,7 +1519,7 @@ static int imap_complete_hosts (char *dest, size_t len) {
     }
   }
 
-  for (conn = mutt_socket_head (); conn->next; conn = conn->next) {
+  for (conn = mutt_socket_head (); conn && conn->next; conn = conn->next) {
     ciss_url_t url;
     char urlstr[LONG_STRING];