summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--examples/lsf.c2
-rw-r--r--include/mailutils/cpp/folder.h4
-rw-r--r--include/mailutils/folder.h9
-rw-r--r--libmailutils/mailbox/folder.c8
-rw-r--r--libmailutils/mailbox/fsfolder.c12
-rw-r--r--libmailutils/tests/fsfolder.c8
-rw-r--r--libmu_cpp/folder.cc8
-rw-r--r--libproto/imap/folder.c4
-rw-r--r--libproto/imap/genlist.c12
-rw-r--r--libproto/imap/tests/imapfolder.c2
-rw-r--r--libproto/nntp/folder.c2
-rw-r--r--mu/libexec/imap.c2
-rw-r--r--python/2/libmu_py/folder.c8
-rw-r--r--python/2/mailutils/folder.py4
-rw-r--r--python/3/libmu_py/folder.c10
-rw-r--r--python/3/mailutils/folder.py4
16 files changed, 50 insertions, 49 deletions
diff --git a/examples/lsf.c b/examples/lsf.c
index cba79d3..c386893 100644
--- a/examples/lsf.c
+++ b/examples/lsf.c
@@ -29,7 +29,7 @@ enumfun (mu_folder_t folder, struct mu_list_response *resp, void *data)
(resp->type & MU_FOLDER_ATTRIBUTE_DIRECTORY) ? 'd' : '-',
(resp->type & MU_FOLDER_ATTRIBUTE_FILE) ? 'f' : '-',
resp->separator,
- resp->level,
+ resp->depth,
resp->name);
return 0;
}
diff --git a/include/mailutils/cpp/folder.h b/include/mailutils/cpp/folder.h
index fe4ed77..97c6d0f 100644
--- a/include/mailutils/cpp/folder.h
+++ b/include/mailutils/cpp/folder.h
@@ -43,9 +43,9 @@ class Folder
void open (int flag);
void close ();
- List& list (const std::string& dirname, void* pattern, size_t max_level);
+ List& list (const std::string& dirname, void* pattern, size_t max_depth);
List& enumerate (const std::string& name, void* pattern,
- int flags, size_t max_level,
+ int flags, size_t max_depth,
mu_folder_enumerate_fp enumfun, void* enumdata);
Url& get_url ();
diff --git a/include/mailutils/folder.h b/include/mailutils/folder.h
index 4ca4b92..ceb54dd 100644
--- a/include/mailutils/folder.h
+++ b/include/mailutils/folder.h
@@ -27,9 +27,9 @@ extern "C" {
struct mu_list_response
{
int type; /* MU_FOLDER_ATTRIBUTE_.* flags */
- int level;
- int separator;
- char *name;
+ int depth; /* Item depth within the hierarchy */
+ int separator; /* Directory separator character */
+ char *name; /* Item name */
mu_record_t format; /* Associated mailbox format record */
};
@@ -66,7 +66,8 @@ struct mu_folder_scanner
char const *refname; /* Reference name */
void *pattern; /* Matching pattern */
int match_flags; /* Matching flags */
- size_t max_level; /* Max. nesting level to descend */
+ size_t max_depth; /* Max. depth to descend
+ (1-based, 0 means 'unlimited') */
mu_folder_enumerate_fp enumfun; /* Enumeration function */
void *enumdata; /* Data for enumfun */
mu_list_t records; /* List of allowed records */
diff --git a/libmailutils/mailbox/folder.c b/libmailutils/mailbox/folder.c
index 8a474c8..d22bb33 100644
--- a/libmailutils/mailbox/folder.c
+++ b/libmailutils/mailbox/folder.c
@@ -356,18 +356,18 @@ mu_folder_scan (mu_folder_t folder, struct mu_folder_scanner *scn)
int
mu_folder_list (mu_folder_t folder, const char *dirname, void *pattern,
- size_t max_level,
+ size_t max_depth,
mu_list_t *pflist)
{
return mu_folder_enumerate (folder, dirname, pattern,
- MU_FOLDER_ATTRIBUTE_ALL, max_level,
+ MU_FOLDER_ATTRIBUTE_ALL, max_depth,
pflist, NULL, NULL);
}
int
mu_folder_enumerate (mu_folder_t folder, const char *name,
void *pattern, int flags,
- size_t max_level,
+ size_t max_depth,
mu_list_t *pflist,
mu_folder_enumerate_fp enumfun, void *enumdata)
{
@@ -383,7 +383,7 @@ mu_folder_enumerate (mu_folder_t folder, const char *name,
scn.refname = name;
scn.pattern = pattern;
scn.match_flags = flags;
- scn.max_level = max_level;
+ scn.max_depth = max_depth;
scn.enumfun = enumfun;
scn.enumdata = enumdata;
scn.records = NULL;
diff --git a/libmailutils/mailbox/fsfolder.c b/libmailutils/mailbox/fsfolder.c
index 553c9fd..4afdbd6 100644
--- a/libmailutils/mailbox/fsfolder.c
+++ b/libmailutils/mailbox/fsfolder.c
@@ -294,13 +294,13 @@ static int
list_helper (struct mu_folder_scanner *scn,
struct folder_scan_data *data,
struct inode_list *ilist,
- const char *dirname, size_t level)
+ const char *dirname, size_t depth)
{
DIR *dirp;
struct dirent *dp;
int stop = 0;
- if (scn->max_level && level >= scn->max_level)
+ if (scn->max_depth && depth >= scn->max_depth)
return 0;
dirp = opendir (dirname);
@@ -377,7 +377,7 @@ list_helper (struct mu_folder_scanner *scn,
else
{
resp->name = fname;
- resp->level = level;
+ resp->depth = depth;
resp->separator = '/';
resp->type = type;
resp->format = rec;
@@ -421,7 +421,7 @@ list_helper (struct mu_folder_scanner *scn,
idata.dev = st.st_dev;
idata.next = ilist;
stop = list_helper (scn, data, &idata, refname,
- level + 1);
+ depth + 1);
}
}
else if (S_ISDIR (st.st_mode))
@@ -431,7 +431,7 @@ list_helper (struct mu_folder_scanner *scn,
idata.inode = st.st_ino;
idata.dev = st.st_dev;
idata.next = ilist;
- stop = list_helper (scn, data, &idata, fname, level + 1);
+ stop = list_helper (scn, data, &idata, fname, depth + 1);
}
}
}
@@ -508,7 +508,7 @@ _fsfolder_lsub (mu_folder_t folder, const char *ref, const char *name,
break;
}
resp->type = MU_FOLDER_ATTRIBUTE_FILE;
- resp->level = 0;
+ resp->depth = 0;
resp->separator = '/';
rc = mu_list_append (flist, resp);
if (rc)
diff --git a/libmailutils/tests/fsfolder.c b/libmailutils/tests/fsfolder.c
index 5a4d9df..e6c45b7 100644
--- a/libmailutils/tests/fsfolder.c
+++ b/libmailutils/tests/fsfolder.c
@@ -44,9 +44,9 @@ compare_response (void const *a, void const *b)
struct mu_list_response const *ra = a;
struct mu_list_response const *rb = b;
- if (ra->level < rb->level)
+ if (ra->depth < rb->depth)
return -1;
- if (ra->level > rb->level)
+ if (ra->depth > rb->depth)
return 1;
return strcmp (ra->name, rb->name);
}
@@ -60,7 +60,7 @@ _print_list_entry (void *item, void *data)
(resp->type & MU_FOLDER_ATTRIBUTE_DIRECTORY) ? 'd' : '-',
(resp->type & MU_FOLDER_ATTRIBUTE_FILE) ? 'f' : '-',
resp->separator ? resp->separator : ' ',
- resp->level,
+ resp->depth,
resp->name + len);
return 0;
}
@@ -173,7 +173,7 @@ com_scan (int argc, char **argv, mu_assoc_t options, void *env)
{
char *p;
errno = 0;
- scn.max_level = strtoul (s, &p, 10);
+ scn.max_depth = strtoul (s, &p, 10);
if (errno || *p)
{
mu_error ("-maxdepth=%s: invalid depth", s);
diff --git a/libmu_cpp/folder.cc b/libmu_cpp/folder.cc
index ebc7401..cf6857f 100644
--- a/libmu_cpp/folder.cc
+++ b/libmu_cpp/folder.cc
@@ -82,12 +82,12 @@ Folder :: close ()
List&
Folder :: list (const std::string& dirname, void* pattern,
- size_t max_level = 0)
+ size_t max_depth = 0)
{
mu_list_t c_list;
int status = mu_folder_list (folder, dirname.c_str (), pattern,
- max_level, &c_list);
+ max_depth, &c_list);
if (status)
throw Exception ("Folder::list", status);
@@ -96,13 +96,13 @@ Folder :: list (const std::string& dirname, void* pattern,
List&
Folder :: enumerate (const std::string& name, void* pattern,
- int flags, size_t max_level,
+ int flags, size_t max_depth,
mu_folder_enumerate_fp enumfun, void* enumdata)
{
mu_list_t c_list;
int status = mu_folder_enumerate (folder, name.c_str (), pattern,
- flags, max_level, &c_list,
+ flags, max_depth, &c_list,
enumfun, enumdata);
if (status)
throw Exception ("Folder::enumerate", status);
diff --git a/libproto/imap/folder.c b/libproto/imap/folder.c
index 5e43312..9e23847 100644
--- a/libproto/imap/folder.c
+++ b/libproto/imap/folder.c
@@ -272,7 +272,7 @@ _mu_imap_folder_list (mu_folder_t folder, struct mu_folder_scanner *scn)
if (rc)
return rc;
- if (scn->max_level
+ if (scn->max_depth
|| (scn->match_flags & MU_FOLDER_ATTRIBUTE_ALL) != MU_FOLDER_ATTRIBUTE_ALL)
{
/* Filter out the list, eliminating non-matching entries */
@@ -292,7 +292,7 @@ _mu_imap_folder_list (mu_folder_t folder, struct mu_folder_scanner *scn)
mu_iterator_current (itr, (void**) &rp);
if (!(rp->type & scn->match_flags)
- || (scn->max_level && rp->level > scn->max_level))
+ || (scn->max_depth && rp->depth > scn->max_depth))
mu_iterator_ctl (itr, mu_itrctl_delete, NULL);
}
mu_iterator_destroy (&itr);
diff --git a/libproto/imap/genlist.c b/libproto/imap/genlist.c
index 1e2de88..13352b6 100644
--- a/libproto/imap/genlist.c
+++ b/libproto/imap/genlist.c
@@ -37,14 +37,14 @@ struct list_closure
};
static int
-count_level (const char *name, int delim)
+count_depth (const char *name, int delim)
{
- int level = 0;
+ int depth = 0;
while (*name)
if (*name++ == delim)
- level++;
- return level;
+ depth++;
+ return depth;
}
static int
@@ -109,14 +109,14 @@ list_untagged_handler (mu_imap_t imap, mu_list_t resp, void *data)
if (_mu_imap_list_element_is_nil (elt))
{
rp->separator = 0;
- rp->level = 0;
+ rp->depth = 0;
}
else if (elt->type != imap_eltype_string)
return;
else
{
rp->separator = elt->v.string[0];
- rp->level = count_level (rp->name, rp->separator);
+ rp->depth = count_depth (rp->name, rp->separator);
}
if ((clos->error_code = mu_list_append (clos->retlist, rp)))
mu_list_response_free (rp);
diff --git a/libproto/imap/tests/imapfolder.c b/libproto/imap/tests/imapfolder.c
index 8d3f6ce..2de8506 100644
--- a/libproto/imap/tests/imapfolder.c
+++ b/libproto/imap/tests/imapfolder.c
@@ -37,7 +37,7 @@ _print_list_entry (void *item, void *data)
(resp->type & MU_FOLDER_ATTRIBUTE_DIRECTORY) ? 'd' : '-',
(resp->type & MU_FOLDER_ATTRIBUTE_FILE) ? 'f' : '-',
resp->separator ? resp->separator : ' ',
- resp->level,
+ resp->depth,
resp->name);
return 0;
}
diff --git a/libproto/nntp/folder.c b/libproto/nntp/folder.c
index bdc16f5..8919a03 100644
--- a/libproto/nntp/folder.c
+++ b/libproto/nntp/folder.c
@@ -189,7 +189,7 @@ nntp_folder_destroy (mu_folder_t folder)
static int
nntp_folder_list (mu_folder_t folder, const char *ref, void *pat, int flags,
- size_t max_level, mu_list_t flist,
+ size_t max_depth, mu_list_t flist,
mu_folder_enumerate_fp efp, void *edp)
{
return ENOTSUP;
diff --git a/mu/libexec/imap.c b/mu/libexec/imap.c
index 3496e5b..8136f4b 100644
--- a/mu/libexec/imap.c
+++ b/mu/libexec/imap.c
@@ -1124,7 +1124,7 @@ print_list_item (void *item, void *data)
(resp->type & MU_FOLDER_ATTRIBUTE_FILE) ? 'f' : '-',
resp->separator ?
resp->separator : MU_HIERARCHY_DELIMITER,
- resp->level,
+ resp->depth,
resp->name);
return 0;
}
diff --git a/python/2/libmu_py/folder.c b/python/2/libmu_py/folder.c
index cf1ae69..20b731f 100644
--- a/python/2/libmu_py/folder.c
+++ b/python/2/libmu_py/folder.c
@@ -203,21 +203,21 @@ static PyObject *
api_folder_list (PyObject *self, PyObject *args)
{
int status = 0;
- Py_ssize_t max_level = 0;
+ Py_ssize_t max_depth = 0;
char *dirname, *pattern;
PyFolder *py_folder;
PyObject *py_list;
mu_list_t c_list = NULL;
if (!PyArg_ParseTuple (args, "O!zs|n", &PyFolderType, &py_folder,
- &dirname, &pattern, &max_level))
+ &dirname, &pattern, &max_depth))
return NULL;
- if (max_level < 0)
+ if (max_depth < 0)
{
PyErr_SetString (PyExc_RuntimeError, "max level out of range");
return NULL;
}
- status = mu_folder_list (py_folder->folder, dirname, pattern, max_level,
+ status = mu_folder_list (py_folder->folder, dirname, pattern, max_depth,
&c_list);
if (c_list)
diff --git a/python/2/mailutils/folder.py b/python/2/mailutils/folder.py
index ecd3fc9..8e33d65 100644
--- a/python/2/mailutils/folder.py
+++ b/python/2/mailutils/folder.py
@@ -66,8 +66,8 @@ class Folder:
raise FolderError (status)
return url.Url (u)
- def list (self, dirname, pattern, max_level=0):
- status, lst = folder.list (self.folder, dirname, pattern, max_level)
+ def list (self, dirname, pattern, max_depth=0):
+ status, lst = folder.list (self.folder, dirname, pattern, max_depth)
if status:
raise FolderError (status)
return lst
diff --git a/python/3/libmu_py/folder.c b/python/3/libmu_py/folder.c
index 8b3dc93..b24bd0b 100644
--- a/python/3/libmu_py/folder.c
+++ b/python/3/libmu_py/folder.c
@@ -162,7 +162,7 @@ folderdata_extractor (void *data, PyObject **dst)
*dst = PyTuple_New (4);
PyTuple_SetItem (*dst, 0, PyUnicode_FromString (attr));
- PyTuple_SetItem (*dst, 1, PyLong_FromLong (resp->level));
+ PyTuple_SetItem (*dst, 1, PyLong_FromLong (resp->depth));
PyTuple_SetItem (*dst, 2, PyUnicode_FromString (separator));
PyTuple_SetItem (*dst, 3, PyUnicode_FromString (resp->name));
return 0;
@@ -172,21 +172,21 @@ static PyObject *
api_folder_list (PyObject *self, PyObject *args)
{
int status = 0;
- Py_ssize_t max_level = 0;
+ Py_ssize_t max_depth = 0;
char *dirname, *pattern;
PyFolder *py_folder;
PyObject *py_list;
mu_list_t c_list = NULL;
if (!PyArg_ParseTuple (args, "O!zs|n", &PyFolderType, &py_folder,
- &dirname, &pattern, &max_level))
+ &dirname, &pattern, &max_depth))
return NULL;
- if (max_level < 0)
+ if (max_depth < 0)
{
PyErr_SetString (PyExc_RuntimeError, "max level out of range");
return NULL;
}
- status = mu_folder_list (py_folder->folder, dirname, pattern, max_level,
+ status = mu_folder_list (py_folder->folder, dirname, pattern, max_depth,
&c_list);
if (c_list)
diff --git a/python/3/mailutils/folder.py b/python/3/mailutils/folder.py
index ecd3fc9..8e33d65 100644
--- a/python/3/mailutils/folder.py
+++ b/python/3/mailutils/folder.py
@@ -66,8 +66,8 @@ class Folder:
raise FolderError (status)
return url.Url (u)
- def list (self, dirname, pattern, max_level=0):
- status, lst = folder.list (self.folder, dirname, pattern, max_level)
+ def list (self, dirname, pattern, max_depth=0):
+ status, lst = folder.list (self.folder, dirname, pattern, max_depth)
if status:
raise FolderError (status)
return lst

Return to:

Send suggestions and report system problems to the System administrator.