diff options
author | Sarfraaz Ahmed <asarfraaz@novell.com> | 2005-08-02 20:04:56 +0800 |
---|---|---|
committer | Ahmed Sarfraaz <sarfraaz@src.gnome.org> | 2005-08-02 20:04:56 +0800 |
commit | 9ec2d0dd087d7842e0a3c262fcb89061751892b9 (patch) | |
tree | 9b6ee40302c02d7293ffa3f1a7c61f4a583d9386 /plugins | |
parent | 7d7df9d581ec287e5a4598507a0bbe64b1669b01 (diff) | |
download | gsoc2013-evolution-9ec2d0dd087d7842e0a3c262fcb89061751892b9.tar.gz gsoc2013-evolution-9ec2d0dd087d7842e0a3c262fcb89061751892b9.tar.zst gsoc2013-evolution-9ec2d0dd087d7842e0a3c262fcb89061751892b9.zip |
Check for NULL target Similar Similar Similar
2005-08-02 Sarfraaz Ahmed <asarfraaz@novell.com>
* exchange-calendar.c : Check for NULL target
* exchange-contacts.c : Similar
* exchange-folder-permission.c : Similar
* exchange-folder.c : Similar
svn path=/trunk/; revision=29955
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/exchange-operations/ChangeLog | 8 | ||||
-rw-r--r-- | plugins/exchange-operations/exchange-calendar.c | 29 | ||||
-rw-r--r-- | plugins/exchange-operations/exchange-contacts.c | 32 | ||||
-rw-r--r-- | plugins/exchange-operations/exchange-folder-permission.c | 59 | ||||
-rw-r--r-- | plugins/exchange-operations/exchange-folder.c | 8 |
5 files changed, 69 insertions, 67 deletions
diff --git a/plugins/exchange-operations/ChangeLog b/plugins/exchange-operations/ChangeLog index 5548357cec..4311d9f265 100644 --- a/plugins/exchange-operations/ChangeLog +++ b/plugins/exchange-operations/ChangeLog @@ -1,4 +1,12 @@ +2005-08-02 Sarfraaz Ahmed <asarfraaz@novell.com> + + * exchange-calendar.c : Check for NULL target + * exchange-contacts.c : Similar + * exchange-folder-permission.c : Similar + * exchange-folder.c : Similar + 2005-08-01 Praveen Kumar <kpraveen@novell.com> + * exchnage-config-listener.c (exchange_add_autocompletion_folders) : Added new (add_defaults_for_account) : Added a call to the newly added function diff --git a/plugins/exchange-operations/exchange-calendar.c b/plugins/exchange-operations/exchange-calendar.c index 2562eea667..0ed24770d0 100644 --- a/plugins/exchange-operations/exchange-calendar.c +++ b/plugins/exchange-operations/exchange-calendar.c @@ -150,8 +150,10 @@ e_exchange_calendar_pcalendar (EPlugin *epl, EConfigHookItemFactoryData *data) gchar *uri_text; gchar *cal_name; char *folder_size; + const char *rel_uri; int row, i; + if (!hidden) hidden = gtk_label_new (""); @@ -165,7 +167,7 @@ e_exchange_calendar_pcalendar (EPlugin *epl, EConfigHookItemFactoryData *data) uri_text = e_source_get_uri (t->source); uri = e_uri_new (uri_text); - if (strcmp (uri->protocol, "exchange")) { + if (uri && strcmp (uri->protocol, "exchange")) { e_uri_free (uri); g_free (uri_text); return hidden; @@ -174,10 +176,11 @@ e_exchange_calendar_pcalendar (EPlugin *epl, EConfigHookItemFactoryData *data) e_uri_free (uri); g_free (uri_text); - if (strlen (e_source_peek_relative_uri (t->source))) { + rel_uri = e_source_peek_relative_uri (t->source); + if (rel_uri && strlen (rel_uri)) { calendar_src_exists = TRUE; g_free (calendar_old_source_uri); - calendar_old_source_uri = g_strdup (e_source_peek_relative_uri (t->source)); + calendar_old_source_uri = g_strdup (rel_uri); } else { calendar_src_exists = FALSE; @@ -249,7 +252,7 @@ e_exchange_calendar_pcalendar (EPlugin *epl, EConfigHookItemFactoryData *data) uri_prefix = g_strconcat (account->account_filename, "/", NULL); prefix_len = strlen (uri_prefix); - tmpruri = (gchar*) e_source_peek_relative_uri (t->source); + tmpruri = rel_uri; if (g_str_has_prefix (tmpruri, uri_prefix)) { sruri = g_strdup (tmpruri+prefix_len); @@ -274,10 +277,15 @@ e_exchange_calendar_check (EPlugin *epl, EConfigHookPageCheckData *data) { /* FIXME - check pageid */ ECalConfigTargetSource *t = (ECalConfigTargetSource *) data->target; - ESourceGroup *group = e_source_peek_group (t->source); - - if (!strncmp (e_source_group_peek_base_uri (group), "exchange", 8)) { - if (!strlen (e_source_peek_relative_uri (t->source))) { + ESourceGroup *group; + const char *base_uri; + const char *rel_uri; + + rel_uri = e_source_peek_relative_uri (t->source); + group = e_source_peek_group (t->source); + base_uri = e_source_group_peek_base_uri (group); + if (base_uri && !strncmp (base_uri, "exchange", 8)) { + if (rel_uri && !strlen (rel_uri)) { return FALSE; } } @@ -292,12 +300,11 @@ e_exchange_calendar_commit (EPlugin *epl, EConfigTarget *target) ESource *source = t->source; gchar *uri_text, *gruri, *gname, *ruri, *ftype, *path, *path_prefix, *oldpath=NULL; int prefix_len; - ExchangeAccount *account; ExchangeAccountFolderResult result; uri_text = e_source_get_uri (source); - if (strncmp (uri_text, "exchange", 8)) { + if (uri_text && strncmp (uri_text, "exchange", 8)) { g_free (uri_text); return ; } @@ -340,7 +347,7 @@ e_exchange_calendar_commit (EPlugin *epl, EConfigTarget *target) /* Create the new folder */ result = exchange_account_create_folder (account, path, ftype); } - else if (strcmp (e_source_peek_relative_uri (source), calendar_old_source_uri)) { + else if (gruri && strcmp (gruri, calendar_old_source_uri)) { /* Rename the folder */ oldpath = g_strdup_printf ("/%s", calendar_old_source_uri+prefix_len); result = exchange_account_xfer_folder (account, oldpath, path, TRUE); diff --git a/plugins/exchange-operations/exchange-contacts.c b/plugins/exchange-operations/exchange-contacts.c index a08df5798e..6a5cb754ce 100644 --- a/plugins/exchange-operations/exchange-contacts.c +++ b/plugins/exchange-operations/exchange-contacts.c @@ -131,6 +131,8 @@ e_exchange_contacts_pcontacts (EPlugin *epl, EConfigHookItemFactoryData *data) int i; char *folder_size, *abook_name; + const char *rel_uri; + const char *uid; EABConfigTargetSource *t = (EABConfigTargetSource *) data->target; ESource *source = t->source; @@ -140,19 +142,19 @@ e_exchange_contacts_pcontacts (EPlugin *epl, EConfigHookItemFactoryData *data) } uri_text = e_source_get_uri (source); - if (strncmp (uri_text, "exchange", 8)) { + if (uri_text && strncmp (uri_text, "exchange", 8)) { g_free (uri_text); return NULL; } g_free (uri_text); - if (e_source_peek_relative_uri (source) && - e_source_peek_uid (source) && - (strcmp (e_source_peek_relative_uri (source), e_source_peek_uid (source)))) { + rel_uri = e_source_peek_relative_uri (source); + uid = e_source_peek_uid (source); + if (rel_uri && uid && (strcmp (rel_uri, uid))) { contacts_src_exists = TRUE; g_free (contacts_old_src_uri); - contacts_old_src_uri = g_strdup (e_source_peek_relative_uri (source)); + contacts_old_src_uri = g_strdup (rel_uri); } else { contacts_src_exists = FALSE; @@ -226,7 +228,7 @@ e_exchange_contacts_pcontacts (EPlugin *epl, EConfigHookItemFactoryData *data) int prefix_len; GtkTreeSelection *selection; - tmpruri = (gchar*)e_source_peek_relative_uri (t->source); + tmpruri = rel_uri; uri_prefix = g_strconcat (account->account_filename, "/", NULL); prefix_len = strlen (uri_prefix); @@ -258,10 +260,15 @@ e_exchange_contacts_check (EPlugin *epl, EConfigHookPageCheckData *data) { /* FIXME - check pageid */ EABConfigTargetSource *t = (EABConfigTargetSource *) data->target; - ESourceGroup *group = e_source_peek_group (t->source); - - if (!strncmp (e_source_group_peek_base_uri (group), "exchange", 8)) { - if (!strlen (e_source_peek_relative_uri (t->source))) { + ESourceGroup *group; + const char *base_uri; + const char *rel_uri; + + rel_uri = e_source_peek_relative_uri (t->source); + group = e_source_peek_group (t->source); + base_uri = e_source_group_peek_base_uri (group); + if (base_uri && !strncmp (base_uri, "exchange", 8)) { + if (rel_uri && !strlen (rel_uri)) { return FALSE; } } @@ -276,12 +283,11 @@ e_exchange_contacts_commit (EPlugin *epl, EConfigTarget *target) ESource *source = t->source; gchar *uri_text, *gname, *gruri, *ruri, *path, *path_prefix, *oldpath=NULL; int prefix_len; - ExchangeAccount *account; ExchangeAccountFolderResult result; uri_text = e_source_get_uri (source); - if (strncmp (uri_text, "exchange", 8)) { + if (uri_text && strncmp (uri_text, "exchange", 8)) { g_free (uri_text); return ; } @@ -313,7 +319,7 @@ e_exchange_contacts_commit (EPlugin *epl, EConfigTarget *target) /* Create the new folder */ result = exchange_account_create_folder (account, path, "contacts"); } - else if (strcmp (e_source_peek_relative_uri (source), contacts_old_src_uri)) { + else if (strcmp (gruri, contacts_old_src_uri)) { /* Rename the folder */ oldpath = g_strdup_printf ("/%s", contacts_old_src_uri+prefix_len); result = exchange_account_xfer_folder (account, oldpath, path, TRUE); diff --git a/plugins/exchange-operations/exchange-folder-permission.c b/plugins/exchange-operations/exchange-folder-permission.c index 78d190c5a4..11beb9e080 100644 --- a/plugins/exchange-operations/exchange-folder-permission.c +++ b/plugins/exchange-operations/exchange-folder-permission.c @@ -70,25 +70,22 @@ org_gnome_exchange_calendar_permissions (EPlugin *ep, ECalPopupTargetSource *tar int i = 0; static int first =0; ExchangeAccount *account = NULL; - EFolder *folder = NULL; ESource *source = NULL; gchar *uri = NULL; - source = e_source_selector_peek_primary_selection (E_SOURCE_SELECTOR (target->selector)); - uri = (gchar *) e_source_get_uri (source); - - if (! g_strrstr (uri, "exchange://")) { - return ; - } - account = exchange_operations_get_exchange_account (); if (!account) return; - folder = exchange_account_get_folder (account, uri); + source = e_source_selector_peek_primary_selection (E_SOURCE_SELECTOR (target->selector)); + uri = (gchar *) e_source_get_uri (source); - if (!folder) + if (uri && ! g_strrstr (uri, "exchange://")) { + return; + } + + if (!exchange_account_get_folder (account, uri)) return; selected_exchange_folder_uri = uri; @@ -114,28 +111,22 @@ org_gnome_exchange_addressbook_permissions (EPlugin *ep, EABPopupTargetSource *t int i = 0; static int first =0; ExchangeAccount *account = NULL; - EFolder *folder = NULL; ESource *source = NULL; gchar *uri = NULL; - source = e_source_selector_peek_primary_selection (E_SOURCE_SELECTOR (target->selector)); - uri = (gchar *) e_source_get_uri (source); - - if (! g_strrstr (uri, "exchange://")) { - return ; - } - account = exchange_operations_get_exchange_account (); if (!account) return; + source = e_source_selector_peek_primary_selection (E_SOURCE_SELECTOR (target->selector)); + uri = (gchar *) e_source_get_uri (source); - folder = exchange_account_get_folder (account, uri); + if (!g_strrstr (uri, "exchange://")) + return; - if (!folder) { + if (!exchange_account_get_folder (account, uri)) return; - } selected_exchange_folder_uri = uri; @@ -152,29 +143,18 @@ org_gnome_exchange_addressbook_permissions (EPlugin *ep, EABPopupTargetSource *t } void -org_gnome_exchange_folder_permissions (EPlugin *ep, EMPopupTargetFolder *t) +org_gnome_exchange_folder_permissions (EPlugin *ep, EMPopupTargetFolder *target) { GSList *menus = NULL; int i = 0; static int first =0; - ExchangeAccount *account = NULL; - EFolder *folder = NULL; + ExchangeAccount *account = exchange_operations_get_exchange_account (); - if (! g_strrstr (t->uri, "exchange://")) + if (!account || ! g_strrstr (target->uri, "exchange://") || + !exchange_account_get_folder (account, target->uri)) return ; - account = exchange_operations_get_exchange_account (); - - if (!account) - return; - - folder = exchange_account_get_folder (account, t->uri); - - - if (!folder) - return; - - selected_exchange_folder_uri = t->uri; + selected_exchange_folder_uri = target->uri; /* for translation*/ if (!first) { popup_items[0].label = _(popup_items[0].label); @@ -184,7 +164,7 @@ org_gnome_exchange_folder_permissions (EPlugin *ep, EMPopupTargetFolder *t) for (i = 0; i < sizeof (popup_items) / sizeof (popup_items[0]); i++) menus = g_slist_prepend (menus, &popup_items[i]); - e_popup_add_items (t->target.popup, menus, NULL, popup_free, NULL); + e_popup_add_items (target->target.popup, menus, NULL, popup_free, NULL); } @@ -211,9 +191,6 @@ org_gnome_exchange_menu_folder_permissions (EPlugin *ep, EMMenuTargetSelect *tar ExchangeAccount *account = NULL; EFolder *folder = NULL; - if (target == NULL) - return; - account = exchange_operations_get_exchange_account (); if (!account) diff --git a/plugins/exchange-operations/exchange-folder.c b/plugins/exchange-operations/exchange-folder.c index 8347cbe18e..016d6bccfa 100644 --- a/plugins/exchange-operations/exchange-folder.c +++ b/plugins/exchange-operations/exchange-folder.c @@ -125,6 +125,7 @@ org_gnome_exchange_check_address_book_subscribed (EPlugin *ep, EABPopupTargetSou gchar *uri = NULL; gchar *path = NULL; char *sub_folder = NULL; + const char *base_uri; ExchangeAccount *account = NULL; ESourceGroup *group; @@ -135,7 +136,8 @@ org_gnome_exchange_check_address_book_subscribed (EPlugin *ep, EABPopupTargetSou source = e_source_selector_peek_primary_selection (E_SOURCE_SELECTOR (target->selector)); group = e_source_peek_group (source); - if (!group || strcmp (e_source_group_peek_base_uri (group), "exchange://")) + base_uri = e_source_group_peek_base_uri (group); + if (!base_uri || strcmp (base_uri, "exchange://")) return; uri = e_source_get_uri (source); @@ -164,6 +166,7 @@ org_gnome_exchange_check_subscribed (EPlugin *ep, ECalPopupTargetSource *target) gchar *ruri = NULL; gchar *path = NULL; char *sub_folder = NULL; + const char *base_uri; ExchangeAccount *account = NULL; ESourceGroup *group; @@ -174,7 +177,8 @@ org_gnome_exchange_check_subscribed (EPlugin *ep, ECalPopupTargetSource *target) source = e_source_selector_peek_primary_selection (E_SOURCE_SELECTOR (target->selector)); group = e_source_peek_group (source); - if (!group || strcmp (e_source_group_peek_base_uri (group), "exchange://")) + base_uri = e_source_group_peek_base_uri (group); + if (!basu_uri || strcmp (base_uri, "exchange://")) return; ruri = (gchar *) e_source_peek_relative_uri (source); |