diff options
author | Not Zed <NotZed@Ximian.com> | 2004-05-26 12:24:01 +0800 |
---|---|---|
committer | Michael Zucci <zucchi@src.gnome.org> | 2004-05-26 12:24:01 +0800 |
commit | 1c11041eebd485a471e842ba4f75834c2ce6e1f7 (patch) | |
tree | c708d5ff8c87af387e5ad790f15616053068e9f4 | |
parent | ca6276f9e5e5813b6954e2869667458c3b1d9f10 (diff) | |
download | gsoc2013-evolution-1c11041eebd485a471e842ba4f75834c2ce6e1f7.tar.gz gsoc2013-evolution-1c11041eebd485a471e842ba4f75834c2ce6e1f7.tar.zst gsoc2013-evolution-1c11041eebd485a471e842ba4f75834c2ce6e1f7.zip |
removed.
2004-05-25 Not Zed <NotZed@Ximian.com>
* camel-store.c (camel_folder_info_build_path): removed.
* camel-store.h (CamelFolderInfo): removed 'path', fixed all
callers.
(struct _CamelStore): removed 'dir_sep' fixed all uses.
svn path=/trunk/; revision=26089
-rw-r--r-- | camel/ChangeLog | 8 | ||||
-rw-r--r-- | camel/camel-store.c | 39 | ||||
-rw-r--r-- | camel/camel-store.h | 9 | ||||
-rw-r--r-- | camel/camel-vee-store.c | 3 | ||||
-rw-r--r-- | camel/providers/imap/camel-imap-store.c | 40 | ||||
-rw-r--r-- | camel/providers/imapp/camel-imapp-store.c | 1 | ||||
-rw-r--r-- | camel/providers/local/camel-local-folder.c | 1 | ||||
-rw-r--r-- | camel/providers/local/camel-local-store.c | 1 | ||||
-rw-r--r-- | camel/providers/local/camel-maildir-store.c | 1 | ||||
-rw-r--r-- | camel/providers/local/camel-mbox-store.c | 3 | ||||
-rw-r--r-- | camel/providers/local/camel-mh-store.c | 1 | ||||
-rw-r--r-- | camel/providers/local/camel-spool-store.c | 4 | ||||
-rw-r--r-- | camel/providers/nntp/camel-nntp-store.c | 23 |
13 files changed, 36 insertions, 98 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog index b2ddb7e148..89e2fbd073 100644 --- a/camel/ChangeLog +++ b/camel/ChangeLog @@ -1,3 +1,11 @@ +2004-05-25 Not Zed <NotZed@Ximian.com> + + * camel-store.c (camel_folder_info_build_path): removed. + + * camel-store.h (CamelFolderInfo): removed 'path', fixed all + callers. + (struct _CamelStore): removed 'dir_sep' fixed all uses. + 2004-05-25 Sivaiah Nallagatla <snallagatla@novell.com> * providers/groupwise/camel-gw-listener.c (add_addressbook_sources) diff --git a/camel/camel-store.c b/camel/camel-store.c index 861edeced4..042e9509da 100644 --- a/camel/camel-store.c +++ b/camel/camel-store.c @@ -138,8 +138,6 @@ camel_store_init (void *o) /* set vtrash and vjunk on by default */ store->flags = CAMEL_STORE_VTRASH | CAMEL_STORE_VJUNK; - store->dir_sep = '/'; - store->priv = g_malloc0 (sizeof (*store->priv)); store->priv->folder_lock = e_mutex_new (E_MUTEX_REC); } @@ -459,7 +457,7 @@ camel_store_rename_folder (CamelStore *store, const char *old_namein, const char strcmp(folder->full_name, old_name) == 0) || ((namelen > oldlen) && strncmp(folder->full_name, old_name, oldlen) == 0 - && folder->full_name[oldlen] == store->dir_sep)) { + && folder->full_name[oldlen] == '/')) { d(printf("Found subfolder of '%s' == '%s'\n", old_name, folder->full_name)); CAMEL_FOLDER_LOCK(folder, lock); } else { @@ -730,7 +728,6 @@ add_special_info (CamelStore *store, CamelFolderInfo *info, const char *name, co g_free (vinfo->full_name); g_free (vinfo->name); g_free (vinfo->uri); - g_free (vinfo->path); } else { /* There wasn't a Trash/Junk folder so create a new folder entry */ vinfo = g_new0 (CamelFolderInfo, 1); @@ -751,7 +748,6 @@ add_special_info (CamelStore *store, CamelFolderInfo *info, const char *name, co vinfo->uri = uri; if (!unread_count) vinfo->unread = -1; - vinfo->path = g_strdup_printf ("/%s", vinfo->full_name); } static void @@ -889,39 +885,11 @@ camel_folder_info_free (CamelFolderInfo *fi) camel_folder_info_free (fi->child); g_free (fi->name); g_free (fi->full_name); - g_free (fi->path); g_free (fi->uri); g_free (fi); } } -/** - * camel_folder_info_build_path: - * @fi: folder info - * @separator: directory separator - * - * Sets the folder info path based on the folder's full name and - * directory separator. - **/ -void -camel_folder_info_build_path (CamelFolderInfo *fi, char separator) -{ - const char *full_name; - char *p; - - full_name = fi->full_name; - while (*full_name == separator) - full_name++; - - fi->path = g_strdup_printf ("/%s", full_name); - if (separator != '/') { - for (p = fi->path; *p; p++) { - if (*p == separator) - *p = '/'; - } - } -} - static int folder_info_cmp (const void *ap, const void *bp) { @@ -997,10 +965,6 @@ camel_folder_info_build (GPtrArray *folders, const char *namespace, if (*name == separator) name++; - /* set the path if it isn't already set */ - if (!fi->path) - camel_folder_info_build_path (fi, separator); - p = strrchr (name, separator); if (p) { pname = g_strndup (name, p - name); @@ -1079,7 +1043,6 @@ static CamelFolderInfo *folder_info_clone_rec(CamelFolderInfo *fi, CamelFolderIn info->uri = g_strdup(fi->uri); info->name = g_strdup(fi->name); info->full_name = g_strdup(fi->full_name); - info->path = g_strdup(fi->path); info->unread = fi->unread; info->flags = fi->flags; diff --git a/camel/camel-store.h b/camel/camel-store.h index cc5179c05d..adffedfa31 100644 --- a/camel/camel-store.h +++ b/camel/camel-store.h @@ -50,7 +50,6 @@ typedef struct _CamelFolderInfo { char *uri; char *name; char *full_name; - char *path; guint32 flags; guint32 unread; @@ -102,14 +101,8 @@ struct _CamelStore CamelObjectBag *folders; int flags; - - /* FIXME: This is a temporary measure until IMAP namespaces are properly implemented, - after that, all external folder api's will assume a dir separator of '/' */ - /* This is always a copy of IMAP_STORE()->dir_sep, or '/' */ - char dir_sep; }; - /* open mode for folder */ #define CAMEL_STORE_FOLDER_CREATE (1<<0) #define CAMEL_STORE_FOLDER_EXCL (1<<1) @@ -214,8 +207,6 @@ void camel_store_free_folder_info_nop (CamelStore *store, CamelFolderInfo *fi); void camel_folder_info_free (CamelFolderInfo *fi); -void camel_folder_info_build_path (CamelFolderInfo *fi, - char separator); CamelFolderInfo *camel_folder_info_build (GPtrArray *folders, const char *namespace, char separator, diff --git a/camel/camel-vee-store.c b/camel/camel-vee-store.c index 10321bac00..bb8cf22b2c 100644 --- a/camel/camel-vee-store.c +++ b/camel/camel-vee-store.c @@ -149,7 +149,6 @@ change_folder(CamelStore *store, const char *name, guint32 flags, int count) fi->flags = CAMEL_FOLDER_VIRTUAL; if (!(flags & CHANGE_DELETE)) fi->flags |= CAMEL_FOLDER_NOCHILDREN; - camel_folder_info_build_path(fi, '/'); camel_object_trigger_event(store, (flags&CHANGE_DELETE)?"folder_deleted":"folder_created", fi); camel_folder_info_free(fi); } @@ -272,7 +271,6 @@ vee_get_folder_info(CamelStore *store, const char *top, guint32 flags, CamelExce info->name = g_strdup(((CamelFolder *)folder)->name); info->unread = camel_folder_get_unread_message_count((CamelFolder *)folder); info->flags = CAMEL_FOLDER_NOCHILDREN|CAMEL_FOLDER_VIRTUAL; - camel_folder_info_build_path(info, '/'); g_hash_table_insert(infos_hash, info->full_name, info); if (res == NULL) @@ -329,7 +327,6 @@ vee_get_folder_info(CamelStore *store, const char *top, guint32 flags, CamelExce info->name = g_strdup(_("Unmatched")); info->unread = -1; info->flags = CAMEL_FOLDER_NOCHILDREN|CAMEL_FOLDER_NOINFERIORS|CAMEL_FOLDER_SYSTEM|CAMEL_FOLDER_VIRTUAL; - camel_folder_info_build_path(info, '/'); if (res == NULL) res = info; diff --git a/camel/providers/imap/camel-imap-store.c b/camel/providers/imap/camel-imap-store.c index ccba426398..9401c559fb 100644 --- a/camel/providers/imap/camel-imap-store.c +++ b/camel/providers/imap/camel-imap-store.c @@ -296,7 +296,6 @@ construct (CamelService *service, CamelSession *session, } else { imap_store->namespace = g_strdup(is->namespace->full_name); imap_store->dir_sep = is->namespace->sep; - store->dir_sep = is->namespace->sep; } } @@ -1011,13 +1010,11 @@ imap_build_folder_info(CamelImapStore *imap_store, const char *folder_name) url->path = g_strdup_printf ("/%s", folder_name); fi->uri = camel_url_to_string (url, CAMEL_URL_HIDE_ALL); camel_url_free(url); - fi->path = g_strdup_printf("/%s", folder_name); - name = strrchr (fi->path, '/'); - if (name) - name++; + name = strrchr (fi->full_name, '/'); + if (name == NULL) + name = fi->full_name; else - name = fi->path; - + name++; fi->name = g_strdup (name); return fi; @@ -1414,7 +1411,6 @@ imap_connect_online (CamelService *service, CamelException *ex) sep = imap_parse_string ((const char **) &name, &len); if (sep) { store->dir_sep = *sep; - ((CamelStore *)store)->dir_sep = store->dir_sep; g_free (sep); } } @@ -1452,7 +1448,6 @@ imap_connect_online (CamelService *service, CamelException *ex) } if (!store->dir_sep) { store->dir_sep = '/'; /* Guess */ - ((CamelStore *)store)->dir_sep = store->dir_sep; } } @@ -1875,7 +1870,7 @@ get_folder_online (CamelStore *store, const char *folder_name, guint32 flags, Ca if ((parent_name = strrchr (folder_name, '/'))) { parent_name = g_strndup (folder_name, parent_name - folder_name); - parent_real = camel_imap_store_summary_path_to_full (imap_store->summary, parent_name, store->dir_sep); + parent_real = camel_imap_store_summary_path_to_full (imap_store->summary, parent_name, imap_store->dir_sep); } else { parent_real = NULL; } @@ -1983,11 +1978,11 @@ get_folder_online (CamelStore *store, const char *folder_name, guint32 flags, Ca g_free (parent_name); - folder_real = camel_imap_store_summary_path_to_full(imap_store->summary, folder_name, store->dir_sep); + folder_real = camel_imap_store_summary_path_to_full(imap_store->summary, folder_name, imap_store->dir_sep); response = camel_imap_command (imap_store, NULL, ex, "CREATE %S", folder_real); if (response) { - camel_imap_store_summary_add_from_full(imap_store->summary, folder_real, store->dir_sep); + camel_imap_store_summary_add_from_full(imap_store->summary, folder_real, imap_store->dir_sep); camel_imap_response_free (imap_store, response); @@ -2204,7 +2199,7 @@ rename_folder (CamelStore *store, const char *old_name, const char *new_name_in, if (store->flags & CAMEL_STORE_SUBSCRIPTIONS) manage_subscriptions(store, old_name, FALSE); - new_name = camel_imap_store_summary_path_to_full(imap_store->summary, new_name_in, store->dir_sep); + new_name = camel_imap_store_summary_path_to_full(imap_store->summary, new_name_in, imap_store->dir_sep); response = camel_imap_command (imap_store, NULL, ex, "RENAME %F %S", old_name, new_name); if (!response) { @@ -2354,7 +2349,7 @@ create_folder (CamelStore *store, const char *parent_name, } /* ok now we can create the folder */ - real_name = camel_imap_store_summary_path_to_full(imap_store->summary, folder_name, store->dir_sep); + real_name = camel_imap_store_summary_path_to_full(imap_store->summary, folder_name, imap_store->dir_sep); full_name = imap_concat (imap_store, parent_real, real_name); g_free(real_name); response = camel_imap_command (imap_store, NULL, ex, "CREATE %S", full_name); @@ -2365,7 +2360,7 @@ create_folder (CamelStore *store, const char *parent_name, camel_imap_response_free (imap_store, response); - si = camel_imap_store_summary_add_from_full(imap_store->summary, full_name, store->dir_sep); + si = camel_imap_store_summary_add_from_full(imap_store->summary, full_name, imap_store->dir_sep); camel_store_summary_save((CamelStoreSummary *)imap_store->summary); fi = imap_build_folder_info(imap_store, camel_store_info_path(imap_store->summary, si)); fi->flags |= CAMEL_FOLDER_NOCHILDREN; @@ -2395,7 +2390,7 @@ parse_list_response_as_folder_info (CamelImapStore *imap_store, { CamelFolderInfo *fi; int flags; - char sep, *dir; + char sep, *dir, *path; CamelURL *url; CamelImapStoreInfo *si; guint32 newflags; @@ -2417,8 +2412,7 @@ parse_list_response_as_folder_info (CamelImapStore *imap_store, fi = g_new0 (CamelFolderInfo, 1); fi->name = g_strdup(camel_store_info_name(imap_store->summary, si)); - fi->path = g_strdup_printf("/%s", camel_store_info_path(imap_store->summary, si)); - fi->full_name = g_strdup(fi->path+1); + fi->full_name = g_strdup(camel_store_info_path(imap_store->summary, si)); if (!g_ascii_strcasecmp(fi->full_name, "inbox")) flags |= CAMEL_FOLDER_SYSTEM; /* HACK: some servers report noinferiors for all folders (uw-imapd) @@ -2429,7 +2423,9 @@ parse_list_response_as_folder_info (CamelImapStore *imap_store, fi->flags = flags; url = camel_url_new (imap_store->base_url, NULL); - camel_url_set_path(url, fi->path); + path = alloca(strlen(fi->full_name)+2); + sprintf(path, "/%s", fi->full_name); + camel_url_set_path(url, path); if (flags & CAMEL_FOLDER_NOSELECT || fi->name[0] == 0) camel_url_set_param (url, "noselect", "yes"); @@ -2563,7 +2559,7 @@ get_folders_online (CamelImapStore *imap_store, const char *pattern, if (si == NULL) continue; - if (imap_match_pattern(((CamelStore *)imap_store)->dir_sep, pattern, camel_imap_store_info_full_name(imap_store->summary, si))) { + if (imap_match_pattern(imap_store->dir_sep, pattern, camel_imap_store_info_full_name(imap_store->summary, si))) { if (g_hash_table_lookup(present, camel_store_info_path(imap_store->summary, si)) != NULL) { if (lsub && (si->flags & CAMEL_STORE_INFO_FOLDER_SUBSCRIBED) == 0) { si->flags |= CAMEL_STORE_INFO_FOLDER_SUBSCRIBED; @@ -2831,14 +2827,14 @@ get_folders(CamelStore *store, const char *top, guint32 flags, CamelException *e i = strlen(top)-1; name = g_malloc(i+2); strcpy(name, top); - while (i>0 && name[i] == store->dir_sep) + while (i>0 && name[i] == imap_store->dir_sep) name[i--] = 0; } else name = g_strdup(""); } else { name = camel_imap_store_summary_full_from_path(imap_store->summary, top); if (name == NULL) - name = camel_imap_store_summary_path_to_full(imap_store->summary, top, store->dir_sep); + name = camel_imap_store_summary_path_to_full(imap_store->summary, top, imap_store->dir_sep); } d(printf("\n\nList '%s' %s\n", name, flags&CAMEL_STORE_FOLDER_INFO_RECURSIVE?"RECURSIVE":"NON-RECURSIVE")); diff --git a/camel/providers/imapp/camel-imapp-store.c b/camel/providers/imapp/camel-imapp-store.c index 6ae79cae2e..290d3c0a17 100644 --- a/camel/providers/imapp/camel-imapp-store.c +++ b/camel/providers/imapp/camel-imapp-store.c @@ -543,7 +543,6 @@ folders_build_info(CamelURL *base, struct _list_info *li) fi->uri = camel_url_to_string(base, CAMEL_URL_HIDE_ALL); fi->name = g_strdup(name); fi->full_name = full_name; - fi->path = g_strdup(path); fi->unread = -1; fi->total = -1; fi->flags = li->flags; diff --git a/camel/providers/local/camel-local-folder.c b/camel/providers/local/camel-local-folder.c index 2c352c749d..2f5cc53223 100644 --- a/camel/providers/local/camel-local-folder.c +++ b/camel/providers/local/camel-local-folder.c @@ -319,7 +319,6 @@ camel_local_folder_construct(CamelLocalFolder *lf, CamelStore *parent_store, con fi->name = g_strdup (name); fi->uri = camel_url_to_string (url, 0); fi->unread = camel_folder_get_unread_message_count(folder); - camel_folder_info_build_path(fi, '/'); fi->flags = CAMEL_FOLDER_NOCHILDREN; camel_url_free (url); diff --git a/camel/providers/local/camel-local-store.c b/camel/providers/local/camel-local-store.c index 2a154d1556..f39f597f08 100644 --- a/camel/providers/local/camel-local-store.c +++ b/camel/providers/local/camel-local-store.c @@ -469,7 +469,6 @@ delete_folder(CamelStore *store, const char *folder_name, CamelException *ex) fi->uri = g_strdup_printf ("%s:%s#%s", ((CamelService *) store)->url->protocol, CAMEL_LOCAL_STORE(store)->toplevel_dir, folder_name); fi->unread = -1; - camel_folder_info_build_path(fi, '/'); camel_object_trigger_event (store, "folder_deleted", fi); diff --git a/camel/providers/local/camel-maildir-store.c b/camel/providers/local/camel-maildir-store.c index 33daf0521e..5a81965ede 100644 --- a/camel/providers/local/camel-maildir-store.c +++ b/camel/providers/local/camel-maildir-store.c @@ -232,7 +232,6 @@ static CamelFolderInfo *camel_folder_info_new(const char *url, const char *full, fi->name = g_strdup(name); fi->unread = -1; fi->total = -1; - camel_folder_info_build_path(fi, '/'); if (!strcmp(full, ".")) fi->flags |= CAMEL_FOLDER_SYSTEM; diff --git a/camel/providers/local/camel-mbox-store.c b/camel/providers/local/camel-mbox-store.c index 4893853689..a2bafd4ab0 100644 --- a/camel/providers/local/camel-mbox-store.c +++ b/camel/providers/local/camel-mbox-store.c @@ -333,7 +333,6 @@ delete_folder(CamelStore *store, const char *folder_name, CamelException *ex) fi->name = g_path_get_basename(folder_name); fi->uri = g_strdup_printf("mbox:%s#%s",((CamelService *) store)->url->path, folder_name); fi->unread = -1; - camel_folder_info_build_path(fi, '/'); camel_object_trigger_event(store, "folder_deleted", fi); @@ -705,7 +704,6 @@ scan_dir(CamelStore *store, CamelURL *url, GHashTable *visited, CamelFolderInfo fi->uri = camel_url_to_string (url, 0); fi->name = short_name; fi->full_name = full_name; - fi->path = g_strdup_printf("/%s", full_name); fi->unread = -1; fi->total = -1; @@ -815,7 +813,6 @@ get_folder_info(CamelStore *store, const char *top, guint32 flags, CamelExceptio fi->full_name = g_strdup(top); fi->unread = -1; fi->total = -1; - fi->path = g_strdup_printf("/%s", top); subdir = g_strdup_printf("%s.sbd", path); if (stat(subdir, &st) == 0) { diff --git a/camel/providers/local/camel-mh-store.c b/camel/providers/local/camel-mh-store.c index 7e57b69766..ee35d8ec25 100644 --- a/camel/providers/local/camel-mh-store.c +++ b/camel/providers/local/camel-mh-store.c @@ -350,7 +350,6 @@ folder_info_new (CamelStore *store, CamelURL *url, const char *root, const char fi->uri = camel_url_to_string (url, 0); fi->full_name = g_strdup(path); fi->name = g_strdup(base?base+1:path); - camel_folder_info_build_path(fi, '/'); fill_fi(store, fi, flags); d(printf("New folderinfo:\n '%s'\n '%s'\n '%s'\n", fi->full_name, fi->uri, fi->path)); diff --git a/camel/providers/local/camel-spool-store.c b/camel/providers/local/camel-spool-store.c index 1aa18965ae..96278bf538 100644 --- a/camel/providers/local/camel-spool-store.c +++ b/camel/providers/local/camel-spool-store.c @@ -231,7 +231,6 @@ static void free_folder_info (CamelStore *store, CamelFolderInfo *fi) g_free(fi->uri); g_free(fi->name); g_free(fi->full_name); - g_free(fi->path); g_free(fi); } } @@ -246,7 +245,6 @@ camel_folder_info_new(const char *url, const char *full, const char *name, int u fi->full_name = g_strdup(full); fi->name = g_strdup(name); fi->unread = unread; - camel_folder_info_build_path(fi, '/'); d(printf("Adding spoold info: '%s' '%s' '%s' '%s'\n", fi->path, fi->name, fi->full_name, fi->url)); @@ -466,8 +464,6 @@ get_folder_info_mbox(CamelStore *store, const char *top, guint32 flags, CamelExc camel_object_unref(folder); } else fi->unread = -1; - - camel_folder_info_build_path(fi, '/'); } return fi; diff --git a/camel/providers/nntp/camel-nntp-store.c b/camel/providers/nntp/camel-nntp-store.c index d43fc13ca9..26e825436b 100644 --- a/camel/providers/nntp/camel-nntp-store.c +++ b/camel/providers/nntp/camel-nntp-store.c @@ -390,6 +390,7 @@ nntp_folder_info_from_store_info (CamelNNTPStore *store, gboolean short_notation CamelURL *base_url = ((CamelService *) store)->url; CamelFolderInfo *fi = g_malloc0(sizeof(*fi)); CamelURL *url; + char *path; fi->full_name = g_strdup (si->path); @@ -399,16 +400,9 @@ nntp_folder_info_from_store_info (CamelNNTPStore *store, gboolean short_notation fi->name = g_strdup (si->path); fi->unread = -1; - /* fi->path is the 'canonicalised' path used by the UI (folder-tree). Not - * as important these days, but folders used to get added to the tree based - * on its path rather than the structure of the CamelFolderInfo's. - * - * must be delimited by '/' which also means that if the user doesn't want - * a flat list of newsgroups, you'll have to replace '.' with '/' for - * full_name too. */ - /*camel_folder_info_build_path(fi, '/');*/ - fi->path = g_strdup_printf ("/%s", si->path); - url = camel_url_new_with_base (base_url, fi->path); + path = alloca(strlen(fi->full_name)+2); + sprintf(path, "/%s", fi->full_name); + url = camel_url_new_with_base (base_url, path); fi->uri = camel_url_to_string (url, CAMEL_URL_HIDE_ALL); camel_url_free (url); @@ -421,7 +415,8 @@ nntp_folder_info_from_name (CamelNNTPStore *store, gboolean short_notation, cons CamelFolderInfo *fi = g_malloc0(sizeof(*fi)); CamelURL *base_url = ((CamelService *)store)->url; CamelURL *url; - + char *path; + fi->full_name = g_strdup (name); if (short_notation) @@ -431,9 +426,9 @@ nntp_folder_info_from_name (CamelNNTPStore *store, gboolean short_notation, cons fi->unread = -1; - fi->path = g_strdup_printf ("/%s", name); - - url = camel_url_new_with_base (base_url, fi->path); + path = alloca(strlen(fi->full_name)+2); + sprintf(path, "/%s", fi->full_name); + url = camel_url_new_with_base (base_url, path); fi->uri = camel_url_to_string (url, CAMEL_URL_HIDE_ALL); camel_url_free (url); |