From 5d2343810cde0d4dca4e9a18abea26ac32dbb700 Mon Sep 17 00:00:00 2001 From: Vivek Jain Date: Mon, 17 Jan 2005 14:14:30 +0000 Subject: *install-shared.c : (org_gnome_popup_wizard): included a condition (null 2005-01-17 Vivek Jain *install-shared.c : (org_gnome_popup_wizard): included a condition (null check) to fix a crash * shared-folder-common.c :(org_gnome_shared_folder_factory): some condition checks to avoid the possible crashes (get_container_id): included code to return top level container id if folder name is passed as null svn path=/trunk/; revision=28423 --- plugins/shared-folder/ChangeLog | 42 +++++++++++++++++------------ plugins/shared-folder/install-shared.c | 12 +++++++-- plugins/shared-folder/share-folder-common.c | 33 ++++++++++++++--------- 3 files changed, 56 insertions(+), 31 deletions(-) (limited to 'plugins') diff --git a/plugins/shared-folder/ChangeLog b/plugins/shared-folder/ChangeLog index 2782a217d0..ec3c594104 100644 --- a/plugins/shared-folder/ChangeLog +++ b/plugins/shared-folder/ChangeLog @@ -1,3 +1,11 @@ +2005-01-17 Vivek Jain + *install-shared.c : (org_gnome_popup_wizard): included a condition + (null check) to fix a crash + * shared-folder-common.c :(org_gnome_shared_folder_factory): some + condition checks to avoid the possible crashes + (get_container_id): included code to return top level container id if + folder name is passed as null + 2005-01-13 Vivek Jain * share-folder.c :changed the function find_node to return user node corresponding to the mail address given. @@ -6,32 +14,32 @@ * share-folder-common.c : calling share_folder with a cnc in it. 2005-01-11 Vivek Jain -killed compile time warnings by including suitable definitions -and type casting widgets + killed compile time warnings by including suitable definitions + and type casting widgets 2005-01-10 Vivek Jain Included -* install-shared.c : opens up a wizard on reading a shared folder -notification and installs shared folder at the recepient end. -* share-folder-common.c : added -(refresh_folder_tree) : to refresh the folder tree when a folder is shared or -a shared folder is created so that different icons are displayed -(get_cnc): to get a connection -(get_container_id):to get the container id of the folder user selects -* share-folder.c : minor changes to fix the crash -* Makefile.am : including install-shared.c in sources -* org-gnome-shared-folder.eplug.in : added a plugin to the e-plugin list for -the message-read event + * install-shared.c : opens up a wizard on reading a shared folder + notification and installs shared folder at the recepient end. + * share-folder-common.c : added + (refresh_folder_tree) : to refresh the folder tree when a folder is shared or + a shared folder is created so that different icons are displayed + (get_cnc): to get a connection + (get_container_id):to get the container id of the folder user selects + * share-folder.c : minor changes to fix the crash + * Makefile.am : including install-shared.c in sources + * org-gnome-shared-folder.eplug.in : added a plugin to the e-plugin list for + the message-read event 2004-12-15 Vivek Jain -Added (Create a shared folder) functionality in the plugin -* org-gnome-shared-folder.eplug.in : added a plugin in the plugin list -* share-folder-common.c : included functions to create a shared folder + Added (Create a shared folder) functionality in the plugin + * org-gnome-shared-folder.eplug.in : added a plugin in the plugin list + * share-folder-common.c : included functions to create a shared folder 2004-12-15 Vivek Jain -* shared-folder-common.c : (org_gnome_shared_folder_factory) + * shared-folder-common.c : (org_gnome_shared_folder_factory) * shared-folder.c : some whitespace changes, typecasting widgets, in (on_add_clicked) removed assigning the rights portion diff --git a/plugins/shared-folder/install-shared.c b/plugins/shared-folder/install-shared.c index 6b7e7b8f78..a49073be57 100644 --- a/plugins/shared-folder/install-shared.c +++ b/plugins/shared-folder/install-shared.c @@ -90,7 +90,10 @@ install_folder_response (EMFolderSelector *emfs, int response, gpointer *data) while (names [parts]) parts++; folder_name = names[parts -1]; - parent_name = names[parts -2]; + if (parts >= 2) + parent_name = names[parts -2]; + else + parent_name = NULL; } camel_exception_init (&ex); if (!(store = (CamelStore *) camel_session_get_service (session, uri, CAMEL_PROVIDER_STORE, &ex))) { @@ -168,7 +171,7 @@ org_gnome_popup_wizard (EPlugin *ep, EMEventTargetMessage *target) CamelMimeMessage *msg = (CamelMimeMessage *) target->message ; CamelStreamMem *content ; CamelDataWrapper *dw ; - CamelMimePart *mime_part = CAMEL_MIME_PART(msg) ; + CamelMimePart *mime_part ; char *notification; char *start_message; char *buffer = NULL; @@ -178,6 +181,11 @@ org_gnome_popup_wizard (EPlugin *ep, EMEventTargetMessage *target) GtkWidget *selector_dialog ; struct AcceptData *accept_data; + + if (!msg) + return ; + + mime_part = CAMEL_MIME_PART(msg) ; notification = (char *)camel_medium_get_header (CAMEL_MEDIUM(msg),"X-notification") ; if (!notification) { return ; diff --git a/plugins/shared-folder/share-folder-common.c b/plugins/shared-folder/share-folder-common.c index dd79b6f43c..a704da805e 100644 --- a/plugins/shared-folder/share-folder-common.c +++ b/plugins/shared-folder/share-folder-common.c @@ -269,7 +269,6 @@ users_dialog_response(GtkWidget *dialog, int response, struct ShareInfo *ssi) return; } - /* HACK: we need to create vfolders using the vfolder editor */ if (CAMEL_IS_VEE_STORE(store)) { EMVFolderRule *rule; @@ -292,7 +291,7 @@ new_folder_response (EMFolderSelector *emfs, int response, EMFolderTreeModel *mo GtkWidget *users_dialog; GtkWidget *w; struct ShareInfo *ssi; - const char *uri, *path; + const char *uri; EGwConnection *cnc; CamelException ex; CamelStore *store; @@ -346,7 +345,6 @@ org_gnome_create_option(EPlugin *ep, EMPopupTargetFolder *target) folder_tree = (EMFolderTree *) em_folder_tree_new_with_model (model); dialog = em_folder_selector_create_new (folder_tree, 0, _("Create folder"), _("Specify where to create the folder:")); uri = em_folder_tree_get_selected_uri(folder_tree); - g_print("\nselected uri:%s\n",uri); em_folder_selector_set_selected ((EMFolderSelector *) dialog, uri); g_free(uri); g_signal_connect (dialog, "response", G_CALLBACK (new_folder_response), model); @@ -368,11 +366,18 @@ org_gnome_shared_folder_factory (EPlugin *ep, EConfigHookItemFactoryData *hook_d EMConfigTargetFolder *target= (EMConfigTargetFolder *)hook_data->config->target; folderuri = g_strdup(target->uri); - account = g_strrstr(folderuri, "groupwise"); - sub = g_strrstr(folderuri, "#"); - if(sub == NULL) - sub = g_strrstr(folderuri, "/"); + if (folderuri) { + account = g_strrstr(folderuri, "groupwise"); + sub = g_strrstr(folderuri, "#"); + } else + return NULL; + + if(sub == NULL) + sub = g_strrstr(folderuri, "/"); + if (sub) sub++; + else + return NULL; if ( !( strcmp (sub, "Mailbox") && strcmp (sub, "Calendar") && strcmp (sub, "Contacts") && strcmp (sub, "Documents") && strcmp (sub, "Authored") && strcmp (sub, "Default Library") && strcmp (sub, "Work In Progress") && strcmp (sub, "Cabinet") && strcmp (sub, "Sent Items") && strcmp (sub, "Trash") && strcmp (sub, "Checklist"))) { g_free (folderuri); @@ -387,13 +392,13 @@ org_gnome_shared_folder_factory (EPlugin *ep, EConfigHookItemFactoryData *hook_d id = get_container_id (cnc, sub); else g_warning("Could not Connnect\n"); - + + g_free (folderuri); if (cnc && id) sharing_tab = share_folder_new (cnc, id); else return NULL; - g_free (folderuri); gtk_notebook_append_page((GtkNotebook *) hook_data->parent, (GtkWidget *) sharing_tab->vbox, gtk_label_new_with_mnemonic N_("Sharing")); common = sharing_tab; @@ -409,6 +414,9 @@ get_cnc (CamelStore *store) const char *uri, *property_value, *use_ssl, *server_name, *user, *port; CamelService *service; CamelURL *url; + + if (!store) + return NULL; service = CAMEL_SERVICE(store); url = service->url; @@ -429,6 +437,7 @@ get_cnc (CamelStore *store) uri = g_strconcat ("http://", server_name, ":", port, "/soap", NULL); cnc = e_gw_connection_new (uri, user, service->url->passwd); + return cnc; } @@ -445,12 +454,12 @@ get_container_id(EGwConnection *cnc, gchar *fname) for (container = container_list; container != NULL; container = container->next) { name = e_gw_container_get_name (container->data); - g_print ("\n\nchecking container for: %s\n\n", name); + //g_print ("\n\nchecking container for: %s\n %s\n", name, fname); /* if Null is passed as name then we return top lavel id*/ - /*if (fname == NULL) { + if (fname == NULL) { id = g_strdup (e_gw_container_get_id (container->data)); break; - } else*/ if (!strcmp (name, fname)) { + } else if (!strcmp (name, fname)) { id = g_strdup (e_gw_container_get_id (container->data)); break; } -- cgit v1.2.3