Add store protocol to the data obtained in DBUS GetUnreadMessages
authorJosé Dapena Paz <jdapena@igalia.com>
Thu, 28 Jan 2010 16:48:46 +0000 (17:48 +0100)
committerJosé Dapena Paz <jdapena@igalia.com>
Thu, 28 Jan 2010 16:56:19 +0000 (17:56 +0100)
New libmodest-dbus-client version is 3.2.4.

debian/control
debian/control.maemo-fremantle
libmodest-dbus-client/configure.ac
libmodest-dbus-client/debian/changelog
libmodest-dbus-client/src/libmodest-dbus-client.c
libmodest-dbus-client/src/libmodest-dbus-client.h
src/dbus_api/modest-dbus-callbacks.c
tests/dbus_api/test_get_unread_msgs.c

index 4116bd2..b69c4ec 100644 (file)
@@ -2,7 +2,7 @@ Source: modest
 Section: mail
 Priority: optional
 Maintainer: Moises Martinez <moises.martinez@nokia.com>
 Section: mail
 Priority: optional
 Maintainer: Moises Martinez <moises.martinez@nokia.com>
-Build-Depends: debhelper (>= 4.0.0), cdbs, libmodest-dbus-client-dev (>= 3.2.3), gnome-common, gtkhtml3.14-dev,
+Build-Depends: debhelper (>= 4.0.0), cdbs, libmodest-dbus-client-dev (>= 3.2.4), 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,
  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,
index 8e36857..dfa7c01 100644 (file)
@@ -2,7 +2,7 @@ Source: modest
 Section: mail
 Priority: optional
 Maintainer: Moises Martinez <moises.martinez@nokia.com>
 Section: mail
 Priority: optional
 Maintainer: Moises Martinez <moises.martinez@nokia.com>
-Build-Depends: debhelper (>= 4.0.0), cdbs, libmodest-dbus-client-dev (>= 3.2.3), gnome-common, gtkhtml3.14-dev, libconic0-dev, libhildon1-dev, libdbus-1-dev,
+Build-Depends: debhelper (>= 4.0.0), cdbs, libmodest-dbus-client-dev (>= 3.2.4), 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-abook-dev, libosso-gnomevfs2-dev, libhildonmime-dev, libprofile-dev, libtime-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,
  libdbus-glib-1-dev, libebook-dev, osso-af-settings, libedataserver-dev, libhildonnotify-dev, libgconf2-dev,
  libglib2.0-dev, libosso-abook-dev, libosso-gnomevfs2-dev, libhildonmime-dev, libprofile-dev, libtime-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,
index ff01809..bd7a5d7 100644 (file)
 # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 # 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([libmodestclient],[3.2.3],[http://maemo.org])
+AC_INIT([libmodestclient],[3.2.4],[http://maemo.org])
 AC_CONFIG_HEADERS([config.h])
 
 m4_define([modest_api_major_version], [1])
 m4_define([modest_api_minor_version], [99])
 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], [4])
+m4_define([modest_api_micro_version], [5])
 m4_define([modest_api_version], [modest_api_major_version.modest_api_minor_version.modest_api_micro_version])
 
 
 m4_define([modest_api_version], [modest_api_major_version.modest_api_minor_version.modest_api_micro_version])
 
 
index 7c20ab7..f9ad723 100644 (file)
@@ -1,3 +1,9 @@
+libmodest-dbus-client (4:3.2.4-0) unstable; urgency=low
+
+  * Now GetUnreadMessages also tells the protocol of each account.
+
+ -- Moises Martinez <moises.martinez@nokia.com>  Thu, 28 Jan 2010 17:47:31 +0100
+
 libmodest-dbus-client (4:3.2.3-0) unstable; urgency=low
 
   * Added GetUnreadMessages signal, that obtains a list of latest unread
 libmodest-dbus-client (4:3.2.3-0) unstable; urgency=low
 
   * Added GetUnreadMessages signal, that obtains a list of latest unread
index aac04ce..f7faf9e 100644 (file)
@@ -400,6 +400,7 @@ modest_account_hits_free (ModestAccountHits *account_hits)
 {
        g_free (account_hits->account_id);
        g_free (account_hits->account_name);
 {
        g_free (account_hits->account_id);
        g_free (account_hits->account_name);
+       g_free (account_hits->store_protocol);
        modest_account_hits_hits_list_free (account_hits->hits);
        g_slice_free (ModestAccountHits, account_hits);
 }
        modest_account_hits_hits_list_free (account_hits->hits);
        g_slice_free (ModestAccountHits, account_hits);
 }
@@ -986,6 +987,22 @@ modest_dbus_message_iter_get_account_hits (DBusMessageIter *parent)
                goto out;
        }
 
                goto out;
        }
 
+       /* store protocol */
+       arg_type = dbus_message_iter_get_arg_type (&child);
+
+       if (arg_type != DBUS_TYPE_STRING) {
+               error = TRUE;
+               goto out;
+       }
+
+       account_hits->store_protocol = _dbus_iter_get_string_or_null (&child);
+
+       res = dbus_message_iter_next (&child);
+       if (res == FALSE) {
+               error = TRUE;
+               goto out;
+       }
+
        /* list of hits  */
        dbus_message_iter_recurse (&child, &traverse);
        account_hits->hits = NULL;
        /* list of hits  */
        dbus_message_iter_recurse (&child, &traverse);
        account_hits->hits = NULL;
index 145924e..5ffa393 100644 (file)
@@ -225,6 +225,7 @@ typedef struct {
 typedef struct {
        gchar *account_id;
        gchar *account_name;
 typedef struct {
        gchar *account_id;
        gchar *account_name;
+       gchar *store_protocol;
        GList *hits;
 } ModestAccountHits;
 
        GList *hits;
 } ModestAccountHits;
 
index 92a89cc..298b454 100644 (file)
@@ -1643,6 +1643,7 @@ modest_dbus_req_handler(const gchar * interface, const gchar * method,
        DBUS_STRUCT_BEGIN_CHAR_AS_STRING \
        DBUS_TYPE_STRING_AS_STRING \
        DBUS_TYPE_STRING_AS_STRING \
        DBUS_STRUCT_BEGIN_CHAR_AS_STRING \
        DBUS_TYPE_STRING_AS_STRING \
        DBUS_TYPE_STRING_AS_STRING \
+       DBUS_TYPE_STRING_AS_STRING \
        DBUS_TYPE_ARRAY_AS_STRING \
        ACCOUNT_HIT_DBUS_TYPE \
        DBUS_STRUCT_END_CHAR_AS_STRING
        DBUS_TYPE_ARRAY_AS_STRING \
        ACCOUNT_HIT_DBUS_TYPE \
        DBUS_STRUCT_END_CHAR_AS_STRING
@@ -1902,6 +1903,7 @@ typedef struct {
 typedef struct {
        gchar *account_id;
        gchar *account_name;
 typedef struct {
        gchar *account_id;
        gchar *account_name;
+       gchar *store_protocol;
        gchar *mailbox_id;
        GList *header_list;
 } AccountHits;
        gchar *mailbox_id;
        GList *header_list;
 } AccountHits;
@@ -1926,6 +1928,7 @@ static void return_results (GetUnreadMessagesHelper *helper)
                        AccountHits *ah = (AccountHits *) node->data;
                        const char *account_id;
                        const char *account_name;
                        AccountHits *ah = (AccountHits *) node->data;
                        const char *account_id;
                        const char *account_name;
+                       const char *store_protocol;
                        DBusMessageIter ah_struct_iter;
                        DBusMessageIter sh_array_iter;
                        GList *result_node;
                        DBusMessageIter ah_struct_iter;
                        DBusMessageIter sh_array_iter;
                        GList *result_node;
@@ -1936,12 +1939,16 @@ static void return_results (GetUnreadMessagesHelper *helper)
                                                          &ah_struct_iter);
                        account_id = ah->account_id;
                        account_name = ah->account_name;
                                                          &ah_struct_iter);
                        account_id = ah->account_id;
                        account_name = ah->account_name;
+                       store_protocol = ah->store_protocol;
                        dbus_message_iter_append_basic (&ah_struct_iter,
                                                        DBUS_TYPE_STRING,
                                                        &account_id);
                        dbus_message_iter_append_basic (&ah_struct_iter,
                                                        DBUS_TYPE_STRING,
                                                        &account_name);
                        dbus_message_iter_append_basic (&ah_struct_iter,
                                                        DBUS_TYPE_STRING,
                                                        &account_id);
                        dbus_message_iter_append_basic (&ah_struct_iter,
                                                        DBUS_TYPE_STRING,
                                                        &account_name);
+                       dbus_message_iter_append_basic (&ah_struct_iter,
+                                                       DBUS_TYPE_STRING,
+                                                       &store_protocol);
 
                        dbus_message_iter_open_container (&ah_struct_iter,
                                                          DBUS_TYPE_ARRAY,
 
                        dbus_message_iter_open_container (&ah_struct_iter,
                                                          DBUS_TYPE_ARRAY,
@@ -1975,6 +1982,7 @@ static void return_results (GetUnreadMessagesHelper *helper)
                                                           &ah_struct_iter); 
                        g_free (ah->account_id);
                        g_free (ah->account_name);
                                                           &ah_struct_iter); 
                        g_free (ah->account_id);
                        g_free (ah->account_name);
+                       g_free (ah->store_protocol);
                        g_list_free (ah->header_list);
                }
 
                        g_list_free (ah->header_list);
                }
 
@@ -2012,6 +2020,8 @@ static void get_unread_messages_get_headers_cb (TnyFolder *self,
        AccountHits *account_hits;
        const gchar *folder_id;
        const gchar *bar;
        AccountHits *account_hits;
        const gchar *folder_id;
        const gchar *bar;
+       ModestProtocolType store_protocol_type;
+       ModestProtocol *store_protocol;
 
        acc_iterator = tny_list_create_iterator (helper->accounts_list);
        account = TNY_ACCOUNT (tny_iterator_get_current (acc_iterator));
 
        acc_iterator = tny_list_create_iterator (helper->accounts_list);
        account = TNY_ACCOUNT (tny_iterator_get_current (acc_iterator));
@@ -2041,6 +2051,10 @@ static void get_unread_messages_get_headers_cb (TnyFolder *self,
        account_hits = g_slice_new (AccountHits);
        account_hits->account_id = g_strdup (modest_tny_account_get_parent_modest_account_name_for_server_account (account));
        account_hits->account_name = g_strdup (tny_account_get_name (account));
        account_hits = g_slice_new (AccountHits);
        account_hits->account_id = g_strdup (modest_tny_account_get_parent_modest_account_name_for_server_account (account));
        account_hits->account_name = g_strdup (tny_account_get_name (account));
+       store_protocol_type = modest_tny_account_get_protocol_type (account);
+       store_protocol = modest_protocol_registry_get_protocol_by_type (modest_runtime_get_protocol_registry (), 
+                                                                       store_protocol_type);
+       account_hits->store_protocol = g_strdup (modest_protocol_get_name (store_protocol));
        account_hits->header_list = result_list;
        account_hits->mailbox_id = NULL;
 
        account_hits->header_list = result_list;
        account_hits->mailbox_id = NULL;
 
index 5825996..3d741a0 100644 (file)
@@ -42,7 +42,7 @@ int main (int argc, char *argv[])
                ModestAccountHits *hits = (ModestAccountHits *) iter->data;
                GList *header_node;
 
                ModestAccountHits *hits = (ModestAccountHits *) iter->data;
                GList *header_node;
 
-               g_print ("Account: id: %s name: %s\n", hits->account_id, hits->account_name);
+               g_print ("Account: id: %s name: %s protocol: %s\n", hits->account_id, hits->account_name, hits->store_protocol);
                for (header_node = hits->hits; header_node != NULL; header_node = g_list_next (header_node)) {
                        ModestGetUnreadMessagesHit *hit = (ModestGetUnreadMessagesHit *) header_node->data;
 
                for (header_node = hits->hits; header_node != NULL; header_node = g_list_next (header_node)) {
                        ModestGetUnreadMessagesHit *hit = (ModestGetUnreadMessagesHit *) header_node->data;