using stls should not enable new CAPAs
[apps/madmutt.git] / lib-ui / complete.c
index 06e70c3..f8a660a 100644 (file)
@@ -7,24 +7,11 @@
  * please see the file GPL in the top level source directory.
  */
 
-#if HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#include <dirent.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <errno.h>
-
-#include <lib-lib/lib-lib.h>
+#include <lib-ui/lib-ui.h>
+#include <lib-mx/mx.h>
 
 #include "mutt.h"
-#include "mx.h"
 #include <imap/imap.h>
-#ifdef USE_NNTP
-#include <nntp/nntp.h>
-#endif
 
 /* given a partial pathname, this routine fills in as much of the rest of the
  * path as is unique.
@@ -43,56 +30,6 @@ int mutt_complete (char *s, ssize_t slen)
 
   char imap_path[LONG_STRING];
 
-#ifdef USE_NNTP
-  if (option (OPTNEWS)) {
-    string_list_t *l = CurrentNewsSrv->list;
-
-    m_strcpy(filepart, sizeof(filepart), s);
-
-    /*
-     * special case to handle when there is no filepart yet.
-     * find the first subscribed newsgroup
-     */
-    if ((len = m_strlen(filepart)) == 0) {
-      for (; l; l = l->next) {
-        NNTP_DATA *data = (NNTP_DATA *) l->data;
-
-        if (data && data->subscribed) {
-          m_strcpy(filepart, sizeof(filepart), data->group);
-          init++;
-          l = l->next;
-          break;
-        }
-      }
-    }
-
-    for (; l; l = l->next) {
-      NNTP_DATA *data = (NNTP_DATA *) l->data;
-
-      if (data && data->subscribed &&
-          m_strncmp(data->group, filepart, len) == 0) {
-        if (init) {
-          for (i = 0; filepart[i] && data->group[i]; i++) {
-            if (filepart[i] != data->group[i]) {
-              filepart[i] = 0;
-              break;
-            }
-          }
-          filepart[i] = 0;
-        }
-        else {
-          m_strcpy(filepart, sizeof(filepart), data->group);
-          init = 1;
-        }
-      }
-    }
-
-    strcpy (s, filepart);
-
-    return (init ? 0 : -1);
-  }
-#endif
-
   /* we can use '/' as a delimiter, imap_complete rewrites it */
   if (*s == '=' || *s == '+' || *s == '!') {
       const char *q = NONULL(*s == '!' ? Spoolfile : Maildir);
@@ -155,7 +92,7 @@ int mutt_complete (char *s, ssize_t slen)
   }
 
   if (dirp == NULL) {
-    return (-1);
+    return -1;
   }
 
   /*
@@ -217,5 +154,5 @@ int mutt_complete (char *s, ssize_t slen)
   else
     m_strcpy(s, slen, filepart);
 
-  return (init ? 0 : -1);
+  return init ? 0 : -1;
 }