1
/* libtinymail - The Tiny Mail base library
2
* Copyright (C) 2006-2007 Philip Van Hoof <pvanhoof@gnome.org>
4
* This library is free software; you can redistribute it and/or
5
* modify it under the terms of the GNU Lesser General Public
6
* License as published by the Free Software Foundation; either
7
* version 2 of the License, or (at your option) any later version.
9
* This library is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
* Lesser General Public License for more details.
14
* You should have received a copy of the GNU Lesser General Public
15
* License along with self library; if not, write to the
16
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17
* Boston, MA 02111-1307, USA.
22
#include <tny-msg-receive-strategy.h>
23
#include <tny-folder.h>
24
#include <tny-header.h>
27
/* Possible future API changes:
28
* tny_msg_receive_strategy_perform_get_msg will get a status callback handler.
29
* Also take a look at the possible API changes for TnyFolder's get_msg_async
30
* as this would affect that API too. */
33
* tny_msg_receive_strategy_perform_get_msg:
34
* @self: A #TnyMsgReceiveStrategy instance
35
* @folder: The #TnyFolder instance from which the message will be received
36
* @header: The #TnyHeader instance of the message that must be received
37
* @err: A #GError instance or NULL
39
* Performs the receiving of a message from a folder. If not NULL, the returned
40
* value must be unreferenced after use. If the returned value is NULL and @err
41
* wasn't NULL, then @err will be set.
43
* Return value: the received message or NULL
46
tny_msg_receive_strategy_perform_get_msg (TnyMsgReceiveStrategy *self, TnyFolder *folder, TnyHeader *header, GError **err)
50
#ifdef DBC /* require */
51
g_assert (TNY_IS_MSG_RECEIVE_STRATEGY (self));
53
g_assert (TNY_IS_FOLDER (folder));
55
g_assert (TNY_IS_HEADER (header));
56
g_assert (TNY_MSG_RECEIVE_STRATEGY_GET_IFACE (self)->perform_get_msg_func != NULL);
59
retval = TNY_MSG_RECEIVE_STRATEGY_GET_IFACE (self)->perform_get_msg_func (self, folder, header, err);
61
#ifdef DBC /* ensure */
63
g_assert (TNY_IS_MSG (retval));
70
tny_msg_receive_strategy_base_init (gpointer g_class)
72
static gboolean initialized = FALSE;
79
tny_msg_receive_strategy_get_type (void)
81
static GType type = 0;
83
if (G_UNLIKELY(type == 0))
85
static const GTypeInfo info =
87
sizeof (TnyMsgReceiveStrategyIface),
88
tny_msg_receive_strategy_base_init, /* base_init */
89
NULL, /* base_finalize */
90
NULL, /* class_init */
91
NULL, /* class_finalize */
92
NULL, /* class_data */
95
NULL /* instance_init */
97
type = g_type_register_static (G_TYPE_INTERFACE,
98
"TnyMsgReceiveStrategy", &info, 0);