Re: [evolution-patches] patch to fix problems with folder name (camel-groupwise)
- From: Vivek Jain <jvivek novell com>
- To: Not Zed <notzed ximian com>
- Cc: evolution-patches lists ximian com
- Subject: Re: [evolution-patches] patch to fix problems with folder name (camel-groupwise)
- Date: Fri, 15 Jul 2005 15:24:52 +0530
Thanks for pointing that out. (Actually ya, I shouldn't have missed it)
Here is the revised patch, which also addresses the memory leak issues
as well as corrects some styling issues.
Thanks,
Vivek
On Tue, 2005-07-12 at 09:02 +0800, Not Zed wrote:
> This leaks memory:
>
> On Mon, 2005-07-11 at 00:31 -0600, Jain Vivek wrote:
> > - }
> > +
> > + container_id = g_strdup (g_hash_table_lookup
> > (priv->name_hash, g_strdup(folder_name))) ;
> >
>
> This leaks memory:
>
> > + if (parent_name) {
> > + if (strlen(parent_name) > 0)
> > + fi->full_name =
> > g_strconcat(parent_name,"/",g_strdup(folder_name), NULL) ;
> >
>
> And surprise, so does this:
>
> > - } else
> > + if (parent_name && (strlen(parent_name) > 0) )
> > + parent_id = g_hash_table_lookup (priv->name_hash,
> > g_strdup(parent_name)) ;
> > + else
> > parent_id = "" ;
>
> Sigh, and another one:
>
> > + g_hash_table_remove (priv->name_hash, g_strdup(old_name)) ;
>
>
> Yes, it leaked it before your patch, but it should be obvious to spot
> the problems when transcribing existing code.
>
>
> _______________________________________________
> evolution-patches mailing list
> evolution-patches lists ximian com
> http://lists.ximian.com/mailman/listinfo/evolution-patches
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution-data-server/camel/providers/groupwise/ChangeLog,v
retrieving revision 1.63
diff -u -p -r1.63 ChangeLog
--- ChangeLog 10 Jul 2005 10:15:28 -0000 1.63
+++ ChangeLog 15 Jul 2005 08:14:54 -0000
@@ -1,3 +1,31 @@
+2005-07-14 Vivek Jain <jvivek novell com>
+
+ * camel-groupwise-store.[ch] :
+ (gw_get_path) : removed
+ * camel-groupwise-store.c:
+ (groupwise_get_folder_info): Changed the name hash. Now
+ it stores full names of the folders
+ (groupwise_rename_folder):
+ (groupwise_delete_folder):
+ (groupwise_create_folder):
+ (groupwise_get_folder) :
+ use full name of the folder to perform any operation, when
+ folder name is to be taken from name_hash
+ (groupwise_build_folder_info): we don't need to call gw_get_path
+ use full name passed directly
+
+ * camel-groupwise-folder.c :
+ (groupwise_transfer_messages_to):
+ (groupwise_append_message):
+ (groupwise_expunge):
+ (groupwise_sync):
+ (groupwise_folder_get_message):
+ (groupwise_folder_get_message):
+ (groupwise_refresh_folder):
+ (groupwise_update_summary):
+ use full_name in container id lookup
+ also fixed some memory leaks and removed unnecesary white spaces
+
2005-07-10 Shreyas Srinivasan <sshreyas novell com>
* camel-groupwise-store.c: Add check that uses parents password
Index: camel-groupwise-folder.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/camel/providers/groupwise/camel-groupwise-folder.c,v
retrieving revision 1.58
diff -u -p -r1.58 camel-groupwise-folder.c
--- camel-groupwise-folder.c 10 Jul 2005 10:15:28 -0000 1.58
+++ camel-groupwise-folder.c 15 Jul 2005 08:14:55 -0000
@@ -99,7 +99,7 @@ groupwise_folder_get_message( CamelFolde
CamelGroupwiseStore *gw_store = CAMEL_GROUPWISE_STORE(folder->parent_store);
CamelGroupwiseStorePrivate *priv = gw_store->priv;
CamelGroupwiseMessageInfo *mi = NULL;
- char *temp_name, *folder_name, *container_id;
+ char *container_id;
EGwConnectionStatus status;
EGwConnection *cnc;
EGwItem *item;
@@ -155,20 +155,8 @@ groupwise_folder_get_message( CamelFolde
return NULL;
}
+ container_id = g_strdup (camel_groupwise_store_container_id_lookup (gw_store, folder->full_name)) ;
- folder_name = g_strdup(folder->name);
- temp_name = strrchr (folder_name,'/');
- if(temp_name == NULL) {
- container_id = g_strdup (camel_groupwise_store_container_id_lookup (gw_store, folder_name));
- }
- else {
- temp_name++;
- container_id = g_strdup (camel_groupwise_store_container_id_lookup (gw_store, temp_name));
- }
-
- g_free (folder_name);
- //XXX:free container_id
-
cnc = cnc_lookup (priv);
status = e_gw_connection_get_item (cnc, container_id, uid, "peek default distribution recipient message attachments subject notification created recipientStatus status", &item);
if (status != E_GW_CONNECTION_STATUS_OK) {
@@ -182,6 +170,8 @@ groupwise_folder_get_message( CamelFolde
if (!msg) {
camel_exception_set (ex, CAMEL_EXCEPTION_SERVICE_INVALID, _("Could not get message"));
CAMEL_SERVICE_UNLOCK (folder->parent_store, connect_lock);
+ g_free (container_id);
+
return NULL;
}
@@ -196,7 +186,10 @@ groupwise_folder_get_message( CamelFolde
CAMEL_GROUPWISE_FOLDER_UNLOCK (folder, cache_lock);
CAMEL_SERVICE_UNLOCK (folder->parent_store, connect_lock);
+
+ g_free (container_id);
return msg;
+
}
static void
@@ -579,8 +572,8 @@ groupwise_sync (CamelFolder *folder, gbo
if (((CamelOfflineStore *) gw_store)->state == CAMEL_OFFLINE_STORE_NETWORK_UNAVAIL)
return;
- container_id = camel_groupwise_store_container_id_lookup (gw_store, folder->name);
-
+ container_id = camel_groupwise_store_container_id_lookup (gw_store, folder->full_name) ;
+
CAMEL_SERVICE_LOCK (gw_store, connect_lock);
count = camel_folder_summary_count (folder->summary);
@@ -790,9 +783,10 @@ groupwise_refresh_folder(CamelFolder *fo
return;
}
- container_id = g_strdup (camel_groupwise_store_container_id_lookup (gw_store, folder->name));
+ container_id = g_strdup (camel_groupwise_store_container_id_lookup (gw_store, folder->full_name)) ;
+
if (!container_id) {
- g_error ("\nERROR - Container id not present. Cannot refresh info\n");
+ g_error ("\nERROR - Container id not present. Cannot refresh info for %s\n", folder->full_name);
return;
}
@@ -809,7 +803,6 @@ groupwise_refresh_folder(CamelFolder *fo
/*Done....should refresh now.....*/
if (!g_ascii_strncasecmp (folder->full_name, "Trash", 5) || is_proxy) {
- g_print ("I am entering here ...\n");
status = e_gw_connection_get_items (cnc, container_id, "recipient distribution created attachments subject status size", NULL, &list);
if (status != E_GW_CONNECTION_STATUS_OK) {
camel_exception_set (ex, CAMEL_EXCEPTION_SERVICE_INVALID, _("Authentication failed"));
@@ -825,8 +818,7 @@ groupwise_refresh_folder(CamelFolder *fo
}
time_string = g_strdup (((CamelGroupwiseSummary *) folder->summary)->time_string);
- t_str = g_strdup (time_string);
-
+ t_str = g_strdup (time_string);
/*Get the New Items*/
status = e_gw_connection_get_quick_messages (cnc, container_id,
"peek id",
@@ -843,7 +835,8 @@ groupwise_refresh_folder(CamelFolder *fo
if (summary->time_string)
g_free (summary->time_string);
summary->time_string = g_strdup (t_str);
- g_free (t_str); t_str = NULL;
+ g_free (t_str);
+ t_str = NULL;
for ( sl = slist ; sl != NULL; sl = sl->next)
list = g_list_append (list, sl->data);
@@ -929,7 +922,7 @@ gw_update_summary ( CamelFolder *folder,
msg = g_ptr_array_new ();
changes = camel_folder_change_info_new ();
- container_id = g_strdup (camel_groupwise_store_container_id_lookup (gw_store, folder->name));
+ container_id = g_strdup (camel_groupwise_store_container_id_lookup (gw_store, folder->full_name));
if (!container_id) {
g_error ("\nERROR - Container id not present. Cannot refresh info\n");
return;
@@ -1129,7 +1122,7 @@ groupwise_folder_item_to_msg( CamelFolde
!g_ascii_strncasecmp (attach->name, "TEXT.htm", 8)) {
status = e_gw_connection_get_attachment (cnc,
- g_strdup(attach->id), 0, -1,
+ attach->id, 0, -1,
(const char **)&attachment, &len);
if (status != E_GW_CONNECTION_STATUS_OK) {
g_warning ("Could not get attachment\n");
@@ -1219,7 +1212,7 @@ groupwise_folder_item_to_msg( CamelFolde
g_object_unref (temp_item);
} else {
status = e_gw_connection_get_attachment (cnc,
- g_strdup(attach->id), 0, -1,
+ attach->id, 0, -1,
(const char **)&attachment, &len);
if (status != E_GW_CONNECTION_STATUS_OK) {
g_warning ("Could not get attachment\n");
@@ -1251,7 +1244,6 @@ groupwise_folder_item_to_msg( CamelFolde
camel_object_unref (multipart);
-
if (body)
g_free (body);
@@ -1315,7 +1307,8 @@ groupwise_append_message (CamelFolder *f
}
CAMEL_SERVICE_LOCK (folder->parent_store, connect_lock);
/*Get the container id*/
- container_id = camel_groupwise_store_container_id_lookup (gw_store, folder->name);
+ container_id = camel_groupwise_store_container_id_lookup (gw_store, folder->full_name) ;
+
/* FIXME Separate To/CC/BCC? */
recipients = CAMEL_ADDRESS (camel_internet_address_new ());
camel_address_cat (recipients, CAMEL_ADDRESS (camel_mime_message_get_recipients (message, CAMEL_RECIPIENT_TYPE_TO)));
@@ -1381,8 +1374,6 @@ uid_compar (const void *va, const void *
return 1;
}
-
-
static void
groupwise_transfer_messages_to (CamelFolder *source, GPtrArray *uids,
CamelFolder *destination, GPtrArray **transferred_uids,
@@ -1409,11 +1400,11 @@ groupwise_transfer_messages_to (CamelFol
*transferred_uids = NULL;
if (delete_originals)
- source_container_id = camel_groupwise_store_container_id_lookup (gw_store, source->name);
+ source_container_id = camel_groupwise_store_container_id_lookup (gw_store, source->full_name) ;
else
source_container_id = NULL;
- dest_container_id = camel_groupwise_store_container_id_lookup (gw_store, destination->name);
-
+ dest_container_id = camel_groupwise_store_container_id_lookup (gw_store, destination->full_name) ;
+
CAMEL_SERVICE_LOCK (source->parent_store, connect_lock);
/* check for offline operation */
if (offline->state == CAMEL_OFFLINE_STORE_NETWORK_UNAVAIL) {
@@ -1501,7 +1492,7 @@ groupwise_expunge (CamelFolder *folder,
cnc = cnc_lookup (priv);
- container_id = g_strdup (camel_groupwise_store_container_id_lookup (groupwise_store, folder->name));
+ container_id = g_strdup (camel_groupwise_store_container_id_lookup (groupwise_store, folder->full_name)) ;
max = camel_folder_summary_count (folder->summary);
for (i = 0; i < max; i++) {
@@ -1606,7 +1597,6 @@ camel_groupwise_folder_get_type (void)
return camel_groupwise_folder_type;
}
-
static int
gw_getv (CamelObject *object, CamelException *ex, CamelArgGetV *args)
{
@@ -1641,7 +1631,6 @@ gw_getv (CamelObject *object, CamelExcep
return ((CamelObjectClass *)parent_class)->getv(object, ex, args);
return 0;
-
}
@@ -1654,8 +1643,6 @@ convert_to_calendar (EGwItem *item, char
GString *gstr = g_string_new (NULL);
char **tmp;
const char *temp = NULL;
-
-
tmp = g_strsplit (e_gw_item_get_id (item), "@", -1);
@@ -1718,7 +1705,6 @@ convert_to_calendar (EGwItem *item, char
gstr = g_string_append (gstr, "END:VEVENT\n");
gstr = g_string_append (gstr, "END:VCALENDAR\n");
-
*str = gstr->str;
*len = gstr->len;
@@ -1735,8 +1721,6 @@ convert_to_task (EGwItem *item, char **s
char **tmp;
const char *temp = NULL;
-
-
tmp = g_strsplit (e_gw_item_get_id (item), "@", -1);
gstr = g_string_append (gstr, "BEGIN:VCALENDAR\n");
Index: camel-groupwise-store.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/camel/providers/groupwise/camel-groupwise-store.c,v
retrieving revision 1.49
diff -u -p -r1.49 camel-groupwise-store.c
--- camel-groupwise-store.c 10 Jul 2005 10:15:28 -0000 1.49
+++ camel-groupwise-store.c 15 Jul 2005 08:14:55 -0000
@@ -519,8 +519,7 @@ groupwise_get_folder (CamelStore *store,
CamelSession *session = camel_service_get_session (CAMEL_SERVICE (store));
CamelGroupwiseSummary *summary;
char *time_string = NULL;
- char *storage_path, *folder_dir, *temp_str,*container_id ;
- const char *temp_name;
+ char *storage_path, *folder_dir, *container_id ;
EGwConnectionStatus status ;
GList *list = NULL ;
gboolean done = FALSE ;
@@ -556,16 +555,8 @@ groupwise_get_folder (CamelStore *store,
return NULL;
}
}
-
- temp_name = folder_name ;
- temp_str = strrchr(folder_name,'/') ;
- if(temp_str == NULL) {
- container_id = g_strdup (g_hash_table_lookup (priv->name_hash, g_strdup(folder_name))) ;
- }
- else {
- temp_str++ ;
- container_id = g_strdup (g_hash_table_lookup (priv->name_hash, g_strdup(temp_str))) ;
- }
+
+ container_id = g_strdup (g_hash_table_lookup (priv->name_hash, folder_name)) ;
folder = camel_gw_folder_new (store, folder_name, folder_dir, ex) ;
if (!folder) {
@@ -675,7 +666,7 @@ static CamelFolderInfo *
groupwise_build_folder_info(CamelGroupwiseStore *gw_store, const char *parent_name, const char *folder_name)
{
CamelURL *url ;
- const char *name, *full_name ;
+ const char *name;
CamelFolderInfo *fi ;
CamelGroupwiseStorePrivate *priv = gw_store->priv ;
@@ -684,22 +675,14 @@ groupwise_build_folder_info(CamelGroupwi
fi->unread = 0 ;
fi->total = 0 ;
-
-
- if (parent_name)
- if (strlen(parent_name) > 0) {
- full_name = gw_get_path (gw_store, parent_name) ;
- fi->full_name = g_strconcat(full_name,"/",g_strdup(folder_name), NULL) ;
- } else
- fi->full_name = g_strdup (folder_name) ;
- else {
- full_name = gw_get_path (gw_store, folder_name) ;
- if (full_name)
- fi->full_name = g_strdup (full_name) ;
+ if (parent_name) {
+ if (strlen(parent_name) > 0)
+ fi->full_name = g_strconcat(parent_name, "/", folder_name, NULL) ;
else
- fi->full_name = g_strdup(folder_name) ;
- }
-
+ fi->full_name = g_strdup (folder_name) ;
+ } else
+ fi->full_name = g_strdup(folder_name) ;
+
url = camel_url_new(priv->base_url,NULL) ;
g_free(url->path) ;
url->path = g_strdup_printf("/%s", fi->full_name) ;
@@ -811,7 +794,7 @@ groupwise_get_folder_info (CamelStore *s
GPtrArray *folders;
GList *folder_list = NULL, *temp_list = NULL ;
const char *url, *top_folder, *temp_url ;
- char *temp_str = NULL, *folder_real = NULL ;
+ char *folder_real = NULL ;
CamelFolderInfo *info = NULL ;
struct _store_folder_refresh *msg;
@@ -835,12 +818,7 @@ groupwise_get_folder_info (CamelStore *s
top_folder = "folders" ;
top = "" ;
} else {
- temp_str = strrchr (top, '/') ;
- if (temp_str) {
- temp_str++ ;
- top_folder = g_hash_table_lookup (priv->name_hash, temp_str) ;
- } else
- top_folder = g_hash_table_lookup (priv->name_hash, top) ;
+ top_folder = g_hash_table_lookup (priv->name_hash, top) ;
/* 'top' is a valid path, but doesnt have a container id
* return NULL */
if (!top_folder)
@@ -883,8 +861,6 @@ groupwise_get_folder_info (CamelStore *s
/*id_hash returns the name for a given container id*/
g_hash_table_insert (priv->id_hash, g_strdup(id), g_strdup(name)) ;
- /*name_hash returns the container id given the name */
- g_hash_table_insert (priv->name_hash, g_strdup(name), g_strdup(id)) ;
/*parent_hash returns the parent container id, given an id*/
g_hash_table_insert (priv->parent_hash, g_strdup(id), g_strdup(parent)) ;
@@ -898,6 +874,7 @@ groupwise_get_folder_info (CamelStore *s
EGwContainer *container = E_GW_CONTAINER (folder_list->data) ;
EGwContainerType type = e_gw_container_get_container_type (container) ;
const char *name = e_gw_container_get_name (container) ;
+ const char *id = e_gw_container_get_id (container);
if (e_gw_container_is_root (container))
continue ;
@@ -931,7 +908,7 @@ groupwise_get_folder_info (CamelStore *s
if (par_name != NULL) {
gchar *temp_parent = NULL, *temp = NULL ;
- gchar *str = g_strconcat (par_name,"/",name, NULL) ;
+ gchar *str = g_strconcat (par_name, "/", name, NULL) ;
fi->name = g_strdup (name) ;
@@ -947,13 +924,15 @@ groupwise_get_folder_info (CamelStore *s
}
fi->full_name = g_strdup (str) ;
- fi->uri = g_strconcat (url,str,NULL) ;
+ fi->uri = g_strconcat (url, str, NULL) ;
g_free (str) ;
}
else {
fi->name = fi->full_name = g_strdup (name);
fi->uri = g_strconcat (url, "", name, NULL) ;
}
+ /*name_hash returns the container id given the name */
+ g_hash_table_insert (priv->name_hash, g_strdup(fi->full_name), g_strdup(id)) ;
if (e_gw_container_get_is_shared_to_me (container))
fi->flags |= CAMEL_FOLDER_SHARED_TO_ME;
@@ -980,14 +959,9 @@ groupwise_get_folder_info (CamelStore *s
/*Thread stuff ends*/
g_free ((char *)url) ;
if ( (top != NULL) && (folders->len == 0)) {
- /*temp_str already contains the value if any*/
- if (temp_str) {
- CAMEL_SERVICE_UNLOCK (store, connect_lock);
- return groupwise_build_folder_info (groupwise_store, NULL, temp_str ) ;
- } else {
- CAMEL_SERVICE_UNLOCK (store, connect_lock);
- return groupwise_build_folder_info (groupwise_store, NULL, top ) ;
- }
+ CAMEL_SERVICE_UNLOCK (store, connect_lock);
+ return groupwise_build_folder_info (groupwise_store, NULL, top ) ;
+
}
info = camel_folder_info_build (folders, top, '/', TRUE) ;
g_ptr_array_free (folders, TRUE) ;
@@ -996,6 +970,7 @@ groupwise_get_folder_info (CamelStore *s
camel_groupwise_store_summary_add_from_full(groupwise_store->summary, folder_real, '/') ;
camel_store_summary_save ((CamelStoreSummary *)groupwise_store->summary) ;
CAMEL_SERVICE_UNLOCK (store, connect_lock);
+
return info ;
}
@@ -1043,7 +1018,7 @@ groupwise_create_folder(CamelStore *stor
CamelGroupwiseStore *groupwise_store = CAMEL_GROUPWISE_STORE (store);
CamelGroupwiseStorePrivate *priv = groupwise_store->priv;
CamelFolderInfo *root = NULL ;
- char *parent_id , *child_container_id, *temp_parent = NULL;
+ char *parent_id , *child_container_id;
int status;
if (((CamelOfflineStore *) store)->state == CAMEL_OFFLINE_STORE_NETWORK_UNAVAIL) {
@@ -1054,14 +1029,9 @@ groupwise_create_folder(CamelStore *stor
if(parent_name == NULL)
parent_name = "" ;
- if (parent_name && (strlen(parent_name) > 0) ) {
- temp_parent = strrchr (parent_name,'/') ;
- if (temp_parent && temp_parent[0]) {
- temp_parent++ ;
- parent_id = g_hash_table_lookup (priv->name_hash, g_strdup(temp_parent)) ;
- } else
- parent_id = g_hash_table_lookup (priv->name_hash, g_strdup(parent_name)) ;
- } else
+ if (parent_name && (strlen(parent_name) > 0) )
+ parent_id = g_hash_table_lookup (priv->name_hash, parent_name) ;
+ else
parent_id = "" ;
if (!E_IS_GW_CONNECTION( priv->cnc)) {
@@ -1077,7 +1047,7 @@ groupwise_create_folder(CamelStore *stor
camel_store_summary_save((CamelStoreSummary *)groupwise_store->summary);
g_hash_table_insert (priv->id_hash, g_strdup(child_container_id), g_strdup(folder_name)) ;
- g_hash_table_insert (priv->name_hash, g_strdup(folder_name), g_strdup(child_container_id)) ;
+ g_hash_table_insert (priv->name_hash, g_strdup(root->full_name), g_strdup(child_container_id)) ;
g_hash_table_insert (priv->parent_hash, g_strdup(child_container_id), g_strdup(parent_id)) ;
camel_object_trigger_event (CAMEL_OBJECT (store), "folder_created", root);
@@ -1094,7 +1064,6 @@ groupwise_delete_folder(CamelStore *stor
CamelGroupwiseStore *groupwise_store = CAMEL_GROUPWISE_STORE (store);
CamelGroupwiseStorePrivate *priv = groupwise_store->priv;
EGwConnectionStatus status ;
- const char *name = NULL;
const char * container ;
if (((CamelOfflineStore *) store)->state == CAMEL_OFFLINE_STORE_NETWORK_UNAVAIL) {
@@ -1102,26 +1071,17 @@ groupwise_delete_folder(CamelStore *stor
return;
}
- name = strrchr (folder_name, '/') ;
- if (name) {
- name++ ;
- container = g_hash_table_lookup (priv->name_hash, name) ;
- } else
- container = g_hash_table_lookup (priv->name_hash, folder_name) ;
+ container = g_hash_table_lookup (priv->name_hash, folder_name) ;
CAMEL_SERVICE_LOCK (store, connect_lock) ;
-
+
status = e_gw_connection_remove_item (priv->cnc, container, container) ;
if (status == E_GW_CONNECTION_STATUS_OK) {
groupwise_forget_folder(groupwise_store,folder_name,ex) ;
-
+
g_hash_table_remove (priv->id_hash, container) ;
-
- if (name)
- g_hash_table_remove (priv->name_hash, name) ;
- else
- g_hash_table_remove (priv->name_hash, folder_name) ;
+ g_hash_table_remove (priv->name_hash, folder_name) ;
g_hash_table_remove (priv->parent_hash, container) ;
}
@@ -1141,20 +1101,15 @@ groupwise_rename_folder(CamelStore *stor
CamelGroupwiseStorePrivate *priv = groupwise_store->priv;
char *oldpath, *newpath, *storepath ;
const char *container_id ;
- char *temp_old = NULL, *temp_new = NULL ;
+ char *temp_new = NULL ;
if (((CamelOfflineStore *) store)->state == CAMEL_OFFLINE_STORE_NETWORK_UNAVAIL) {
camel_exception_set (ex, CAMEL_EXCEPTION_SYSTEM, _("Cannot rename GroupWise folders in offline mode."));
return;
}
CAMEL_SERVICE_LOCK (store, connect_lock) ;
- temp_old = strrchr (old_name,'/') ;
- if (temp_old) {
- temp_old++ ;
- container_id = camel_groupwise_store_container_id_lookup (groupwise_store, temp_old) ;
- } else
- container_id = camel_groupwise_store_container_id_lookup (groupwise_store, old_name) ;
-
+
+ container_id = camel_groupwise_store_container_id_lookup (groupwise_store, old_name) ;
temp_new = strrchr (new_name, '/') ;
if (temp_new)
temp_new++ ;
@@ -1171,12 +1126,8 @@ groupwise_rename_folder(CamelStore *stor
g_hash_table_replace (priv->id_hash, g_strdup(container_id), g_strdup(temp_new)) ;
- g_hash_table_insert (priv->name_hash, g_strdup(temp_new), g_strdup(container_id)) ;
-
- if (temp_old)
- g_hash_table_remove (priv->name_hash, g_strdup(temp_old)) ;
- else
- g_hash_table_remove (priv->name_hash, g_strdup(old_name)) ;
+ g_hash_table_insert (priv->name_hash, g_strdup(new_name), g_strdup(container_id)) ;
+ g_hash_table_remove (priv->name_hash, old_name) ;
/*FIXME:Update all the id in the parent_hash*/
storepath = g_strdup_printf ("%s/folders", priv->storage_path) ;
@@ -1286,33 +1237,6 @@ storage_path_lookup (CamelGroupwiseStore
return priv->storage_path ;
}
-const char *
-gw_get_path (CamelGroupwiseStore *gw_store, const char *folder_name)
-{
- CamelGroupwiseStorePrivate *priv = gw_store->priv ;
-
- const char *str = g_strdup (folder_name) ;
- gchar *container_id = NULL, *temp_parent = NULL, *temp = NULL ;
-
-
- container_id = g_hash_table_lookup (priv->name_hash, folder_name) ;
-
- if (container_id)
- temp_parent = g_hash_table_lookup (priv->parent_hash, container_id) ;
- else
- temp_parent = NULL ;
- while (temp_parent) {
- temp = g_hash_table_lookup (priv->id_hash, temp_parent ) ;
- if (temp == NULL) {
- break ;
- }
- str = g_strconcat ( temp, "/", str, NULL) ;
-
- temp_parent = g_hash_table_lookup (priv->parent_hash, temp_parent) ;
- }
-
- return str ;
-}
static void
free_hash (gpointer key, gpointer value, gpointer data)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]