Fix some compiler warnings.
authorChenthill Palanisamy <pchenthill@novell.com>
Tue, 29 Sep 2009 06:56:45 +0000 (12:26 +0530)
committerChenthill Palanisamy <pchenthill@novell.com>
Wed, 30 Sep 2009 10:07:22 +0000 (15:37 +0530)
camel/providers/imapx/camel-imapx-server.c
camel/providers/imapx/camel-imapx-store-summary.h
camel/providers/imapx/camel-imapx-store.c
camel/providers/imapx/camel-imapx-store.h
camel/providers/imapx/camel-imapx-summary.h
camel/providers/imapx/camel-imapx-utils.c
camel/providers/imapx/camel-imapx-utils.h

index 6ba3ff5..3379e14 100644 (file)
@@ -1066,7 +1066,7 @@ imapx_untagged(CamelIMAPXServer *imap)
 
                                mp = camel_mime_parser_new();
                                camel_mime_parser_init_with_stream(mp, finfo->header);
-                               mi = camel_message_info_new_from_parser(job->folder->summary, mp);
+                               mi = camel_folder_summary_info_new_from_parser(job->folder->summary, mp);
                                camel_object_unref(mp);
 
                                if (mi) {
@@ -1083,7 +1083,7 @@ imapx_untagged(CamelIMAPXServer *imap)
                                                        ((CamelMessageInfoBase *)mi)->flags = r->server_flags;
                                                        ((CamelIMAPXMessageInfo *)mi)->server_flags = r->server_flags;
                                                        camel_flag_list_copy(&((CamelMessageInfoBase *)mi)->user_flags, &r->server_user_flags);
-                                                       ((CamelIMAPXMessageInfo *)mi)->server_flags = r->server_user_flags; /*check this*/
+                                                       ((CamelIMAPXMessageInfo *)mi)->server_user_flags = r->server_user_flags;
                                                        break;
                                                }
                                        }
@@ -2517,7 +2517,7 @@ camel_imapx_server_append_message(CamelIMAPXServer *is, CamelFolder *folder, Cam
                goto fail;
        }
 
-       info = camel_message_info_new_from_message(folder->summary, message, mi);
+       info = camel_folder_summary_info_new_from_message((CamelFolderSummary *)folder->summary, message, NULL);
        info->uid = uid;
        uid = NULL;
        camel_folder_summary_add(folder->summary, info);
@@ -2676,7 +2676,7 @@ camel_imapx_server_sync_changes(CamelIMAPXServer *is, CamelFolder *folder, GPtrA
                }
 
                uflags = ((CamelMessageInfoBase *)info)->user_flags;
-               suflags = info->server_flags; /*check*/
+               suflags = info->server_user_flags;
                while (uflags || suflags) {
                        int res;
 
index b1ff121..7cc60db 100644 (file)
@@ -70,7 +70,7 @@ struct _CamelIMAPXStoreSummaryClass {
 };
 
 CamelType                       camel_imapx_store_summary_get_type     (void);
-CamelIMAPXStoreSummary      *camel_iMAPX_store_summary_new     (void);
+CamelIMAPXStoreSummary      *camel_imapx_store_summary_new     (void);
 
 /* TODO: this api needs some more work, needs to support lists */
 CamelIMAPXStoreNamespace *camel_imapx_store_summary_namespace_new(CamelIMAPXStoreSummary *s, const gchar *full_name, gchar dir_sep);
index 0defd11..b412192 100644 (file)
@@ -235,9 +235,10 @@ get_folder_offline (CamelStore *store, const gchar *folder_name,
                        folder_name = "INBOX";
 
                storage_path = g_strdup_printf("%s/folders", imapx_store->storage_path);
-               folder_dir = imap_path_to_physical (storage_path, folder_name);
+               folder_dir = imapx_path_to_physical (storage_path, folder_name);
                g_free(storage_path);
-               new_folder = camel_imap_folder_new (store, folder_name, folder_dir, ex);
+               /* FIXME */
+               new_folder = camel_imapx_folder_new (store, folder_dir, folder_name);
                g_free(folder_dir);
 
                camel_store_summary_info_free((CamelStoreSummary *)imapx_store->summary, si);
@@ -253,7 +254,7 @@ static CamelFolder *
 imap_get_folder (CamelStore *store, const char *folder_name, guint32 flags, CamelException *ex)
 {
        CamelIMAPXStore *istore = (CamelIMAPXStore *)store;
-       CamelIMAPXFolder *folder;
+       CamelFolder *folder;
 
        folder = get_folder_offline(store, folder_name, flags, ex);
        if (folder == NULL) {
@@ -261,7 +262,7 @@ imap_get_folder (CamelStore *store, const char *folder_name, guint32 flags, Came
                return NULL;
        }
 
-       return (CamelFolder *)folder;
+       return folder;
 }
 
 static CamelFolder *
@@ -420,6 +421,47 @@ folder_info_fill(CamelStore *store, CamelFolderInfo *fi)
        }
 }
 
+
+/* folder_name is path name */
+static CamelFolderInfo *
+imapx_build_folder_info (CamelIMAPXStore *imap_store, const gchar *folder_name)
+{
+       CamelURL *url;
+       const gchar *name;
+       CamelFolderInfo *fi;
+
+       fi = camel_folder_info_new ();
+       fi->full_name = g_strdup(folder_name);
+       fi->unread = -1;
+       fi->total = -1;
+
+       url = camel_url_new (imap_store->base_url, NULL);
+       g_free (url->path);
+       url->path = g_strdup_printf ("/%s", folder_name);
+       fi->uri = camel_url_to_string (url, CAMEL_URL_HIDE_ALL);
+       camel_url_free(url);
+       name = strrchr (fi->full_name, '/');
+       if (name == NULL)
+               name = fi->full_name;
+       else
+               name++;
+       if (!g_ascii_strcasecmp (fi->full_name, "INBOX"))
+               fi->name = g_strdup (_("Inbox"));
+       /* Do not localize the rest, these are from a server, thus shouldn't be localized */
+       /*else if (!g_ascii_strcasecmp (fi->full_name, "Drafts"))
+               fi->name = g_strdup (_("Drafts"));
+       else if (!g_ascii_strcasecmp (fi->full_name, "Sent"))
+               fi->name = g_strdup (_("Sent"));
+       else if (!g_ascii_strcasecmp (fi->full_name, "Templates"))
+               fi->name = g_strdup (_("Templates"));
+       else if (!g_ascii_strcasecmp (fi->full_name, "Trash"))
+               fi->name = g_strdup (_("Trash"));*/
+       else
+               fi->name = g_strdup (name);
+
+       return fi;
+}
+
 static CamelFolderInfo *
 get_folder_info_offline (CamelStore *store, const gchar *top,
                         guint32 flags, CamelException *ex)
@@ -456,7 +498,7 @@ get_folder_info_offline (CamelStore *store, const gchar *top,
                        name = camel_imapx_store_summary_path_to_full(imapx_store->summary, top, imapx_store->dir_sep);
        }
 
-       pattern = imap_concat(imapx_store, name, "*");
+       pattern = imapx_concat(imapx_store, name, "*");
 
        /* folder_info_build will insert parent nodes as necessary and mark
         * them as noselect, which is information we actually don't have at
@@ -483,7 +525,7 @@ get_folder_info_offline (CamelStore *store, const gchar *top,
                        &&((flags & CAMEL_STORE_FOLDER_INFO_SUBSCRIBED) == 0
                        || (si->flags & CAMEL_STORE_INFO_FOLDER_SUBSCRIBED))) {
 
-                       fi = imap_build_folder_info(imapx_store, camel_store_info_path((CamelStoreSummary *)imapx_store->summary, si));
+                       fi = imapx_build_folder_info(imapx_store, camel_store_info_path((CamelStoreSummary *)imapx_store->summary, si));
                        fi->unread = si->unread;
                        fi->total = si->total;
                        fi->flags = si->flags;
index 78b8ee0..13cfdbc 100644 (file)
@@ -52,7 +52,7 @@ typedef struct {
        struct _CamelIMAPXServer *server;
 
        CamelIMAPXStoreSummary *summary; /* in-memory list of folders */
-       gchar *namespace, *dir_sep, *base_url, *storage_path;
+       gchar *namespace, dir_sep, *base_url, *storage_path;
 
        /* if we had a login error, what to show to user */
        char *login_error;
index 6da7910..06f5b29 100644 (file)
@@ -51,6 +51,7 @@ typedef struct _CamelIMAPXMessageInfo {
        CamelMessageInfoBase info;
 
        guint32 server_flags;
+       struct _CamelFlag *server_user_flags;
 } CamelIMAPXMessageInfo;
 
 struct _CamelIMAPXSummary {
index 33f4403..3772ad4 100644 (file)
@@ -1382,3 +1382,38 @@ unsigned char imapx_is_mask(const char *p)
        return v;
 }
 
+gchar *
+imapx_path_to_physical (const gchar *prefix, const gchar *vpath)
+{
+       GString *out = g_string_new(prefix);
+       const gchar *p = vpath;
+       gchar c, *res;
+
+       g_string_append_c(out, '/');
+       p = vpath;
+       while ((c = *p++)) {
+               if (c == '/') {
+                       g_string_append(out, "/" SUBFOLDER_DIR_NAME "/");
+                       while (*p == '/')
+                               p++;
+               } else
+                       g_string_append_c(out, c);
+       }
+
+       res = out->str;
+       g_string_free(out, FALSE);
+
+       return res;
+}
+
+gchar *
+imapx_concat (CamelImapStore *imap_store, const gchar *prefix, const gchar *suffix)
+{
+       gsize len;
+
+       len = strlen (prefix);
+       if (len == 0 || prefix[len - 1] == imap_store->dir_sep)
+               return g_strdup_printf ("%s%s", prefix, suffix);
+       else
+               return g_strdup_printf ("%s%c%s", prefix, imap_store->dir_sep, suffix);
+}
index bf3558c..a0299cc 100644 (file)
@@ -4,6 +4,7 @@
 
 #include <camel/camel-mime-utils.h>
 #include <camel/camel-folder-summary.h>
+#include "camel-imapx-store.h"
 
 struct _CamelIMAPXStream;
 struct _CamelFlag;
@@ -186,4 +187,8 @@ unsigned char imapx_is_mask(const char *p);
 
 void imapx_utils_init(void);
 
+/* chen adds from old imap provider - place it in right place */
+gchar *imapx_path_to_physical (const gchar *prefix, const gchar *vpath);
+gchar *imapx_concat (CamelIMAPXStore *imap_store, const gchar *prefix, const gchar *suffix);
+
 #endif