AC_MSG_ERROR([install gtkhtml 3.8 or newer])
fi
-
+PKG_CHECK_MODULES(LIBMODEST_DBUS_CLIENT,libmodest-dbus-client-1.0 >= 3.1.0)
+re.ac
dnl # GLib/Gobject/Gtk/Gconf => mandatory
PKG_CHECK_MODULES(MODEST_GSTUFF,glib-2.0 >= 2.6 gobject-2.0 gtk+-2.0 >= 2.6 gconf-2.0 gnome-vfs-2.0 libgtkhtml-${gtk_html_version} libtinymail-1.0 libtinymail-camel-1.0 libtinymail-gnomevfs-1.0 libtinymailui-1.0 libtinymailui-gtk-1.0)
Section: mail
Priority: optional
Maintainer: Moises Martinez <moises.martinez@nokia.com>
-Build-Depends: debhelper (>= 4.0.0), cdbs, libmodest-dbus-client-dev, gnome-common, gtkhtml3.14-dev, libconic0-dev, libhildon1-dev, libdbus-1-dev,
- libdbus-glib-1-dev, libebook-dev, osso-af-settings, libedataserver-dev, libhildonnotify-dev, libgconf2-dev,
- libglib2.0-dev, libosso-gnomevfs2-dev, libhildonmime-dev, libtinymail-1.0-0-dev, libtinymail-camel-1.0-0-dev,
- libtinymail-maemo-1.0-0-dev, libtinymailui-1.0-0-dev, libtinymail-gnomevfs-1.0-0-dev, libtinymailui-gtk-1.0-0-dev, wpeditor0,
- wpeditor-dev, modest-providers-data | maemo-providers-data, libalarm-dev, gtk-doc-tools, libhildonnotify-dev, libnotify-dev,
- microb-engine-dev, mce-dev, maemo-launcher-dev, libhildonfm2-dev
+Build-Depends: debhelper (>= 4.0.0), cdbs, libmodest-dbus-client-dev (>= 3.1.0), gnome-common, gtkhtml3.14-dev,
+ libconic0-dev, libhildon1-dev, libdbus-1-dev, libdbus-glib-1-dev, libebook-dev, osso-af-settings, libedataserver-dev,
+ libhildonnotify-dev, libgconf2-dev, libglib2.0-dev, libosso-gnomevfs2-dev, libhildonmime-dev, libtinymail-1.0-0-dev,
+ libtinymail-camel-1.0-0-dev, libtinymail-maemo-1.0-0-dev, libtinymailui-1.0-0-dev, libtinymail-gnomevfs-1.0-0-dev,
+ libtinymailui-gtk-1.0-0-dev, wpeditor0, wpeditor-dev, modest-providers-data | maemo-providers-data, libalarm-dev,
+ gtk-doc-tools, libhildonnotify-dev, libnotify-dev, microb-engine-dev, mce-dev, maemo-launcher-dev, libhildonfm2-dev
Standards-Version: 3.6.0
Package: modest
Architecture: any
-Depends: ${shlibs:Depends}, ${misc:Depends}, ${launcher:Depends}, libmodest-dbus-client, modest-providers-data, modest-l10n-mr | modest-l10n-mr0,
- osso-icons-theme, operator-wizard-settings, osso-countries-l10n-mr | osso-countries-l10n-mr0, microb-engine
+Depends: ${shlibs:Depends}, ${misc:Depends}, ${launcher:Depends}, libmodest-dbus-client (>= 3.1.0),
+ modest-providers-data, modest-l10n-mr | modest-l10n-mr0, osso-icons-theme, operator-wizard-settings,
+ osso-countries-l10n-mr | osso-countries-l10n-mr0, microb-engine
Description: an e-mail client for platforms with modest resources
e-mail client for osso
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-AC_INIT([modest],[3.0],[http://maemo.org])
+AC_INIT([libmodestclient],[3.1.0],[http://maemo.org])
AC_CONFIG_HEADERS([config.h])
m4_define([modest_api_major_version], [1])
m4_define([modest_api_minor_version], [99])
-m4_define([modest_api_micro_version], [0])
+m4_define([modest_api_micro_version], [1])
m4_define([modest_api_version], [modest_api_major_version.modest_api_minor_version.modest_api_micro_version])
-libmodest-dbus-client (3.0.17-rc33) unstable; urgency=low
+libmodest-dbus-client (4:3.1.0-0) unstable; urgency=low
+
+ * Week 42, 2009 - second release
+ * Add API method SendReceiveFull
+
+ -- Moises Martinez <moises.martinez@nokia.com> Wed, 16 Oct 2009 11:18:00 +0200
+
+libmodest-dbus-client (4:1.0.0-2) unstable; urgency=low
* Initial import
#define MODEST_DBUS_METHOD_SEND_RECEIVE "SendReceive"
+#define MODEST_DBUS_METHOD_SEND_RECEIVE_FULL "SendReceiveFull"
+enum ModestDbusSendReceiveFullArguments
+{
+ MODEST_DBUS_SEND_RECEIVE_FULL_ARG_ACCOUNT_ID,
+ MODEST_DBUS_SEND_RECEIVE_FULL_ARG_MANUAL,
+ MODEST_DBUS_SEND_RECEIVE_FULL_ARGS_COUNT
+};
+
#define MODEST_DBUS_METHOD_COMPOSE_MAIL "ComposeMail"
enum ModestDbusComposeMailArguments
{
Name: libmodest-dbus-client-1.0
Description: Some library.
-Requires: glib-2.0 dbus-1
+Requires: glib-2.0 dbus-1 libosso
Version: @VERSION@
Libs: -L${libdir} -lmodest-dbus-client-1.0
Cflags: -I${includedir}/libmodest-dbus-client-1.0
}
gboolean
+libmodest_dbus_client_send_and_receive_full (osso_context_t *osso_context,
+ const gchar *account,
+ gboolean manual)
+{
+ osso_rpc_t retval = { 0 };
+ const osso_return_t ret = osso_rpc_run_with_defaults(osso_context,
+ MODEST_DBUS_NAME,
+ MODEST_DBUS_METHOD_SEND_RECEIVE_FULL, &retval,
+ DBUS_TYPE_STRING, account,
+ DBUS_TYPE_BOOLEAN, manual,
+ DBUS_TYPE_INVALID);
+
+ if (ret != OSSO_OK) {
+ printf("debug: %s: osso_rpc_run() failed.\n", __FUNCTION__);
+ return FALSE;
+ } else {
+ printf("debug: %s: osso_rpc_run() succeeded.\n", __FUNCTION__);
+ }
+
+ osso_rpc_free_val(&retval);
+
+ return TRUE;
+}
+
+gboolean
libmodest_dbus_client_open_default_inbox (osso_context_t *osso_context)
{
osso_rpc_t retval = { 0 };
* libmodest_dbus_client_send_and_receive:
* @osso_context: a valid osso_context instance
*
- * send/receive messages
+ * send/receive messages automatically for all accounts. This is equivalent
+ * to the call
+ * libmodest_dbus_client_send_and_receive_full (@osso_context, %NULL, %TRUE)
*
- * Returns: TRUE upon success, FALSE otherwise
+ * Returns: %TRUE upon success, %FALSE otherwise
*/
gboolean libmodest_dbus_client_send_and_receive (osso_context_t *osso_context);
/**
+ * libmodest_dbus_client_send_and_receive_full:
+ * @osso_context: a valid osso_context instance
+ * @account: the account name, or %NULL to do a send receive on all accounts.
+ * @manual: a #gboolean
+ *
+ * send/receive messages. If @manual is %TRUE, the send receive request
+ * will start immediately. If @manual if %FALSE, it may wait for IP heartbeat
+ * if enabled.
+ *
+ * If Modest is built without heartbeat support, then the result of the call
+ * will be the same independently of @manual value (always immediate start).
+ *
+ * The call will apply to @account only, unless @account is %NULL, that means
+ * send receive will be performed on all accounts.
+ *
+ * Returns: %TRUE upon success, %FALSE otherwise
+ */
+gboolean libmodest_dbus_client_send_and_receive_full (osso_context_t *osso_context,
+ const gchar *account,
+ gboolean manual);
+
+
+
+/**
* libmodest_dbus_client_open_default_inbox:
* @osso_context: a valid osso_context instance
*
return OSSO_OK;
}
+typedef struct _SendReceivePerformerData {
+ gchar *account_id;
+ gboolean manual;
+ ModestMailOperation *mail_op;
+} SendReceivePerformerData;
+
+static void send_receive_performer_data_free (SendReceivePerformerData *data)
+{
+ if (data->mail_op) {
+ g_object_unref (data->mail_op);
+ }
+ g_free (data->account_id);
+ g_slice_free (SendReceivePerformerData, data);
+}
+
static gboolean
on_idle_send_receive(gpointer user_data)
{
gboolean auto_update;
- ModestMailOperation *mail_op = (ModestMailOperation *) user_data;
+ SendReceivePerformerData *data = (SendReceivePerformerData *) user_data;
ModestConnectedVia connect_when;
-
+ gboolean right_connection = FALSE;
gdk_threads_enter (); /* CHECKED */
same as the one specified by the user */
if (connect_when == MODEST_CONNECTED_VIA_ANY ||
connect_when == modest_platform_get_current_connection ()) {
- modest_ui_actions_do_send_receive_all (NULL, FALSE, FALSE, FALSE);
+ right_connection = TRUE;
}
} else {
/* Disable auto update */
modest_platform_set_update_interval (0);
}
+ if ((auto_update && right_connection) || data->manual) {
+ if (data->account_id) {
+ modest_ui_actions_do_send_receive (data->account_id, data->manual, FALSE, data->manual, NULL);
+ } else {
+ modest_ui_actions_do_send_receive_all (NULL, data->manual, FALSE, data->manual);
+ }
+ }
+
modest_mail_operation_queue_remove (modest_runtime_get_mail_operation_queue (),
- mail_op);
+ data->mail_op);
- g_object_unref (mail_op);
+ send_receive_performer_data_free (data);
gdk_threads_leave (); /* CHECKED */
TnyAccount *account,
gpointer user_data)
{
- ModestMailOperation *mail_op;
+ SendReceivePerformerData *data = (SendReceivePerformerData *) user_data;
- if (err || canceled) {
+ if (err || canceled || data == NULL) {
g_idle_add (notify_error_in_dbus_callback, NULL);
+ if (data) {
+ send_receive_performer_data_free (data);
+ }
return;
}
- mail_op = modest_mail_operation_new (NULL);
+ data->mail_op = modest_mail_operation_new (NULL);
modest_mail_operation_queue_add (modest_runtime_get_mail_operation_queue (),
- mail_op);
- modest_heartbeat_add (on_idle_send_receive, mail_op);
+ data->mail_op);
+ if (data->manual) {
+ g_idle_add (on_idle_send_receive, data);
+ } else {
+ modest_heartbeat_add (on_idle_send_receive, data);
+ }
}
on_send_receive(GArray *arguments, gpointer data, osso_rpc_t * retval)
{
TnyDevice *device = modest_runtime_get_device ();
+ SendReceivePerformerData *srp_data;
+
+ srp_data = g_slice_new0 (SendReceivePerformerData);
+ srp_data->account_id = NULL;
+ srp_data->manual = FALSE;
+ srp_data->mail_op = NULL;
if (!tny_device_is_online (device))
- modest_platform_connect_and_perform (NULL, FALSE, NULL, on_send_receive_performer, NULL);
+ modest_platform_connect_and_perform (NULL, FALSE, NULL, on_send_receive_performer, srp_data);
else
- on_send_receive_performer (FALSE, NULL, NULL, NULL, NULL);
+ on_send_receive_performer (FALSE, NULL, NULL, NULL, srp_data);
+
+ return OSSO_OK;
+}
+
+static gint
+on_send_receive_full (GArray *arguments, gpointer data, osso_rpc_t * retval)
+{
+ osso_rpc_t val;
+ gchar *account_id;
+ gboolean manual;
+ TnyDevice *device;
+ SendReceivePerformerData *srp_data;
+
+ val = g_array_index (arguments, osso_rpc_t, MODEST_DBUS_SEND_RECEIVE_FULL_ARG_ACCOUNT_ID);
+ account_id = g_strdup (val.value.s);
+ val = g_array_index (arguments, osso_rpc_t, MODEST_DBUS_SEND_RECEIVE_FULL_ARG_MANUAL);
+ manual = val.value.b;
+
+ srp_data = g_slice_new0 (SendReceivePerformerData);
+ srp_data->manual = manual;
+ if (account_id && account_id[0] != '\0') {
+ srp_data->account_id = account_id;
+ } else {
+ srp_data->account_id = NULL;
+ g_free (account_id);
+ }
+ srp_data->mail_op = NULL;
+ device = modest_runtime_get_device ();
+ if (!tny_device_is_online (device))
+ modest_platform_connect_and_perform (NULL, FALSE, NULL, on_send_receive_performer, srp_data);
+ else
+ on_send_receive_performer (FALSE, NULL, NULL, NULL, srp_data);
return OSSO_OK;
}
if (arguments->len != 0)
goto param_error;
return on_send_receive (arguments, data, retval);
+ } else if (g_ascii_strcasecmp (method, MODEST_DBUS_METHOD_SEND_RECEIVE_FULL) == 0) {
+ if (arguments->len != MODEST_DBUS_SEND_RECEIVE_FULL_ARGS_COUNT)
+ goto param_error;
+ return on_send_receive_full (arguments, data, retval);
} else if (g_ascii_strcasecmp (method, MODEST_DBUS_METHOD_COMPOSE_MAIL) == 0) {
if (arguments->len != MODEST_DBUS_COMPOSE_MAIL_ARGS_COUNT)
goto param_error;
#include <libmodest-dbus-client/libmodest-dbus-api.h>
#include <libmodest-dbus-client/libmodest-dbus-client.h>
#include <stdio.h>
+#include <stdlib.h>
+#include <glib.h>
+
+static gboolean manual = FALSE;
+static gchar *account_id = NULL;
+
+static GOptionEntry option_entries [] =
+{
+ { "manual", 'm', 0, G_OPTION_ARG_NONE, &manual, "Manual send receive, so behave as interactive.", NULL },
+ { "account", 'a', 0, G_OPTION_ARG_STRING, &account_id, "Account to perform send receive into", NULL },
+ { NULL }
+};
+
int
main (int argc, char *argv[])
{
osso_context_t *osso_context;
+ GOptionContext *context;
+ gboolean result;
+ GError *error = NULL;
+
+ context = g_option_context_new ("- Modest email client");
+ g_option_context_add_main_entries (context, option_entries, NULL);
+ if (!g_option_context_parse (context, &argc, &argv, &error)) {
+ g_print ("option parsing failed: %s\n", error->message);
+ g_option_context_free (context);
+ exit (1);
+ }
+ g_option_context_free (context);
osso_context = osso_initialize ("test_update_account",
"0.0.1",
return -1;
}
- return libmodest_dbus_client_send_and_receive (osso_context);
+ result = libmodest_dbus_client_send_and_receive_full (osso_context, account_id, manual);
+ g_free (account_id);
+
+ return result;
+
}