Commit 655279cd 655279cde3acb090140d2ef80cda110ceb1e526a by Sergey Poznyakoff

Remove get_stream methods from folder and mailbox.

* doc/texinfo/folder.texi: Update
* include/mailutils/cpp/folder.h (Folder) <set_stream>
<get_stream>: Remove.
* include/mailutils/folder.h (mu_folder_get_stream)
(mu_folder_get_streamref)
(mu_folder_set_stream): Remove.
* include/mailutils/mailbox.h (mu_folder_get_stream)
(mu_folder_get_streamref)
(mu_folder_set_stream): Remove protos.
* include/mailutils/sys/folder.h (_mu_folder)<stream>: Remove.
All uses updated.
* libmailutils/mailbox/folder.c (mu_folder_set_stream)
(mu_folder_get_stream,mu_folder_get_streamref): Remove.
* libmailutils/mailbox/mailbox.c (mu_mailbox_get_stream)
(mu_mailbox_get_streamref): Remove.
* libmu_cpp/folder.cc (get_stream, set_stream): Remove.
* libmu_scm/mu_mailbox.c (mu-mailbox-get-port): Remove.
* python/libmu_py/folder.c (get_stream): Remove.
1 parent a67f251c
......@@ -83,12 +83,6 @@ struct mu_list_response
@c Stream Settings.
@c
@deftypefun int mu_folder_get_stream (mu_folder_t, mu_stream_t *)
@end deftypefun
@deftypefun int mu_folder_set_stream (mu_folder_t, mu_stream_t)
@end deftypefun
@c
@c Notifications.
@c
......
......@@ -48,9 +48,6 @@ class Folder
int flags, size_t max_level,
mu_folder_enumerate_fp enumfun, void* enumdata);
Stream& get_stream ();
void set_stream (const Stream& stream);
Url& get_url ();
};
......
......@@ -61,14 +61,6 @@ extern int mu_folder_enumerate (mu_folder_t, const char *,
extern int mu_folder_lsub (mu_folder_t, const char *, const char *,
mu_list_t *);
/* Stream settings. Don't use these functions.
FIXME: To be removed. */
extern int mu_folder_get_stream (mu_folder_t, mu_stream_t *)
__attribute__ ((deprecated));
extern int mu_folder_get_streamref (mu_folder_t, mu_stream_t *);
extern int mu_folder_set_stream (mu_folder_t, mu_stream_t);
/* Match function */
extern int mu_folder_set_match (mu_folder_t folder, mu_folder_match_fp pmatch);
extern int mu_folder_get_match (mu_folder_t folder,
......
......@@ -86,12 +86,6 @@ extern int mu_mailbox_get_size (mu_mailbox_t, mu_off_t *size);
extern int mu_mailbox_is_updated (mu_mailbox_t);
extern int mu_mailbox_scan (mu_mailbox_t, size_t no, size_t *count);
/* Mailbox Stream. */
extern int mu_mailbox_set_stream (mu_mailbox_t, mu_stream_t);
extern int mu_mailbox_get_stream (mu_mailbox_t, mu_stream_t *)
__attribute__ ((deprecated));
extern int mu_mailbox_get_streamref (mu_mailbox_t, mu_stream_t *);
/* Lock settings. */
extern int mu_mailbox_get_locker (mu_mailbox_t, mu_locker_t *);
extern int mu_mailbox_set_locker (mu_mailbox_t, mu_locker_t);
......
......@@ -38,7 +38,6 @@ struct _mu_folder
mu_authority_t authority;
mu_observable_t observable;
mu_property_t property;
mu_stream_t stream;
mu_monitor_t monitor;
mu_url_t url;
int flags;
......
......@@ -31,7 +31,6 @@
#include <mailutils/monitor.h>
#include <mailutils/observer.h>
#include <mailutils/registrar.h>
#include <mailutils/stream.h>
#include <mailutils/url.h>
#include <mailutils/errno.h>
#include <mailutils/property.h>
......@@ -212,8 +211,6 @@ mu_folder_destroy (mu_folder_t *pfolder)
mu_monitor_wrlock (monitor);
if (folder->authority)
mu_authority_destroy (&folder->authority, folder);
if (folder->stream)
mu_stream_destroy (&folder->stream);
if (folder->url)
mu_url_destroy (&folder->url);
if (folder->property)
......@@ -274,39 +271,6 @@ mu_folder_close (mu_folder_t folder)
}
int
mu_folder_set_stream (mu_folder_t folder, mu_stream_t stream)
{
if (folder == NULL)
return EINVAL;
if (folder->stream)
mu_stream_destroy (&folder->stream);
folder->stream = stream;
return 0;
}
int
mu_folder_get_stream (mu_folder_t folder, mu_stream_t *pstream)
{
/* FIXME: Deprecation warning */
if (folder == NULL)
return EINVAL;
if (pstream == NULL)
return MU_ERR_OUT_PTR_NULL;
*pstream = folder->stream;
return 0;
}
int
mu_folder_get_streamref (mu_folder_t folder, mu_stream_t *pstream)
{
if (folder == NULL)
return EINVAL;
if (pstream == NULL)
return MU_ERR_OUT_PTR_NULL;
return mu_streamref_create (pstream, folder->stream);
}
int
mu_folder_set_authority (mu_folder_t folder, mu_authority_t authority)
{
if (folder == NULL)
......
......@@ -648,55 +648,6 @@ mu_mailbox_set_stream (mu_mailbox_t mbox, mu_stream_t stream)
return 0;
}
/* FIXME: This is a problem. We provide a mu_mailbox_get_stream ()
and this stream is special: it should, in theory, represent
a "view" of a flow of messages. However, providing this perspective
may make sense for local mailboxes, but downright impossible
for remote mailboxes, short on downloading entire mailbox
locally.
This function will be removed in the short run. It is no longer
used by MU. */
int
mu_mailbox_get_stream (mu_mailbox_t mbox, mu_stream_t *pstream)
{
/* FIXME: Deprecation warning */
if (mbox == NULL)
return EINVAL;
if (pstream == NULL)
return MU_ERR_OUT_PTR_NULL;
/* If null two cases:
- it is no open yet.
- it a remote stream and the socket stream is on the folder. */
if (mbox->stream == NULL)
{
if (mbox->folder)
return mu_folder_get_stream (mbox->folder, pstream);
}
*pstream = mbox->stream;
return 0;
}
int
mu_mailbox_get_streamref (mu_mailbox_t mbox, mu_stream_t *pstream)
{
if (mbox == NULL)
return EINVAL;
if (pstream == NULL)
return MU_ERR_OUT_PTR_NULL;
/* If null two cases:
- it is no open yet.
- it a remote stream and the socket stream is on the folder. */
if (mbox->stream == NULL)
{
if (mbox->folder)
return mu_folder_get_streamref (mbox->folder, pstream);
}
return mu_streamref_create (pstream, mbox->stream);
}
int
mu_mailbox_get_observable (mu_mailbox_t mbox, mu_observable_t *pobservable)
{
......
......@@ -110,26 +110,6 @@ Folder :: enumerate (const std::string& name, void* pattern,
return *new List (c_list);
}
Stream&
Folder :: get_stream ()
{
mu_stream_t c_stream;
int status = mu_folder_get_stream (folder, &c_stream);
if (status)
throw Exception ("Folder::get_stream", status);
return *new Stream (c_stream);
}
void
Folder :: set_stream (const Stream& stream)
{
int status = mu_folder_set_stream (folder, stream.stm);
if (status)
throw Exception ("Folder::set_stream", status);
}
Url&
Folder :: get_url ()
{
......
......@@ -307,35 +307,6 @@ SCM_DEFINE_PUBLIC (scm_mu_mailbox_get_url, "mu-mailbox-get-url", 1, 0, 0,
}
#undef FUNC_NAME
SCM_DEFINE_PUBLIC (scm_mu_mailbox_get_port, "mu-mailbox-get-port", 2, 0, 0,
(SCM mbox, SCM mode),
"Returns a port associated with the contents of the @var{mbox},\n"
"which is a string defining operation mode of the stream. It may\n"
"contain any of the two characters: @samp{r} for reading, @samp{w} for\n"
"writing.\n")
#define FUNC_NAME s_scm_mu_mailbox_get_port
{
struct mu_mailbox *mum;
mu_stream_t stream;
int status;
char *s;
SCM ret;
SCM_ASSERT (mu_scm_is_mailbox (mbox), mbox, SCM_ARG1, FUNC_NAME);
SCM_ASSERT (scm_is_string (mode), mode, SCM_ARG2, FUNC_NAME);
mum = (struct mu_mailbox *) SCM_CDR (mbox);
status = mu_mailbox_get_streamref (mum->mbox, &stream);
if (status)
mu_scm_error (FUNC_NAME, status,
"Cannot get mailbox stream",
scm_list_1 (mbox));
s = scm_to_locale_string (mode);
ret = mu_port_make_from_stream (mbox, stream, scm_mode_bits (s));
free (s);
return ret;
}
#undef FUNC_NAME
SCM_DEFINE_PUBLIC (scm_mu_mailbox_get_message, "mu-mailbox-get-message", 2, 0, 0,
(SCM mbox, SCM msgno),
"Retrieve from message #@var{msgno} from the mailbox @var{mbox}.")
......
......@@ -129,22 +129,6 @@ api_folder_close (PyObject *self, PyObject *args)
}
static PyObject *
api_folder_get_stream (PyObject *self, PyObject *args)
{
int status;
PyFolder *py_folder;
PyStream *py_stm = PyStream_NEW ();
if (!PyArg_ParseTuple (args, "O!", &PyFolderType, &py_folder))
return NULL;
Py_INCREF (py_stm);
status = mu_folder_get_streamref (py_folder->folder, &py_stm->stm);
return status_object (status, (PyObject *)py_stm);
}
static PyObject *
api_folder_get_authority (PyObject *self, PyObject *args)
{
int status;
......@@ -253,9 +237,6 @@ static PyMethodDef methods[] = {
{ "close", (PyCFunction) api_folder_close, METH_VARARGS,
"" },
{ "get_stream", (PyCFunction) api_folder_get_stream, METH_VARARGS,
"" },
{ "get_authority", (PyCFunction) api_folder_get_authority, METH_VARARGS,
"" },
......