Getting list of mail-ids instead of a single mail-id. Added support for
2005-08-24 Shakti Sen <shprasad@novell.com> * exchange-permissions-dialog.c (add_clicked): Getting list of mail-ids instead of a single mail-id. * exchange-user-dialog.[c/h] (e2k_user_dialog_get_user_list): Added support for adding multiple IDs. Fixes bug #313919. svn path=/trunk/; revision=30239
This commit is contained in:
committed by
Shakti Prasad Sen
parent
90f4d3fa8f
commit
294ca271de
@ -1,3 +1,12 @@
|
||||
2005-08-24 Shakti Sen <shprasad@novell.com>
|
||||
|
||||
* exchange-permissions-dialog.c (add_clicked): Getting list of mail-ids
|
||||
instead of a single mail-id.
|
||||
* exchange-user-dialog.[c/h] (e2k_user_dialog_get_user_list): Added
|
||||
support for adding multiple IDs.
|
||||
|
||||
Fixes bug #313919.
|
||||
|
||||
2005-08-24 Praveen Kumar <kpraveen@novell.com>
|
||||
|
||||
* plugins/exchange-operations/exchange-account-setup.c:
|
||||
|
||||
@ -392,6 +392,8 @@ add_clicked (GtkButton *button, gpointer user_data)
|
||||
GtkTreeIter iter;
|
||||
GtkWidget *user_dialog;
|
||||
const guint8 *bsid, *bsid2;
|
||||
GList *email_list = NULL;
|
||||
GList *l = NULL;
|
||||
char *email = NULL;
|
||||
gboolean valid;
|
||||
gint result;
|
||||
@ -408,61 +410,62 @@ add_clicked (GtkButton *button, gpointer user_data)
|
||||
result = gtk_dialog_run (GTK_DIALOG (user_dialog));
|
||||
|
||||
if (result == GTK_RESPONSE_OK)
|
||||
email = e2k_user_dialog_get_user (E2K_USER_DIALOG (user_dialog));
|
||||
else
|
||||
email = NULL;
|
||||
email_list = e2k_user_dialog_get_user_list (E2K_USER_DIALOG (user_dialog));
|
||||
gtk_widget_destroy (user_dialog);
|
||||
|
||||
if (email == NULL)
|
||||
if (email_list == NULL)
|
||||
return;
|
||||
|
||||
status = e2k_global_catalog_lookup (
|
||||
gc, NULL, /* FIXME: cancellable */
|
||||
E2K_GLOBAL_CATALOG_LOOKUP_BY_EMAIL, email,
|
||||
E2K_GLOBAL_CATALOG_LOOKUP_SID, &entry);
|
||||
switch (status) {
|
||||
case E2K_GLOBAL_CATALOG_OK:
|
||||
break;
|
||||
case E2K_GLOBAL_CATALOG_NO_SUCH_USER:
|
||||
e_error_run (GTK_WINDOW (dialog), ERROR_DOMAIN ":no-user-error", email, NULL);
|
||||
break;
|
||||
case E2K_GLOBAL_CATALOG_NO_DATA:
|
||||
e_error_run (GTK_WINDOW (dialog), ERROR_DOMAIN ":acl-add-error", email, NULL);
|
||||
break;
|
||||
default:
|
||||
e_error_run (GTK_WINDOW (dialog), ERROR_DOMAIN ":perm-unknown-error", email, NULL);
|
||||
break;
|
||||
}
|
||||
g_free (email);
|
||||
if (status != E2K_GLOBAL_CATALOG_OK)
|
||||
return;
|
||||
|
||||
/* Make sure the user isn't already there. */
|
||||
bsid = e2k_sid_get_binary_sid (entry->sid);
|
||||
valid = gtk_tree_model_get_iter_first (GTK_TREE_MODEL (dialog->priv->list_store), &iter);
|
||||
while (valid) {
|
||||
gtk_tree_model_get (GTK_TREE_MODEL (dialog->priv->list_store), &iter,
|
||||
EXCHANGE_PERMISSIONS_DIALOG_SID_COLUMN, &sid2,
|
||||
-1);
|
||||
bsid2 = e2k_sid_get_binary_sid (sid2);
|
||||
if (e2k_sid_binary_sid_equal (bsid, bsid2)) {
|
||||
e_error_run (GTK_WINDOW (dialog), ERROR_DOMAIN ":perm-existing-error",
|
||||
entry->display_name, NULL);
|
||||
e2k_global_catalog_entry_free (gc, entry);
|
||||
gtk_tree_selection_select_iter (dialog->priv->list_selection, &iter);
|
||||
for (l = email_list; l; l = g_list_next (l)) {
|
||||
email = l->data;
|
||||
status = e2k_global_catalog_lookup (
|
||||
gc, NULL, /* FIXME: cancellable */
|
||||
E2K_GLOBAL_CATALOG_LOOKUP_BY_EMAIL, email,
|
||||
E2K_GLOBAL_CATALOG_LOOKUP_SID, &entry);
|
||||
switch (status) {
|
||||
case E2K_GLOBAL_CATALOG_OK:
|
||||
break;
|
||||
case E2K_GLOBAL_CATALOG_NO_SUCH_USER:
|
||||
e_error_run (GTK_WINDOW (dialog), ERROR_DOMAIN ":no-user-error", email, NULL);
|
||||
break;
|
||||
case E2K_GLOBAL_CATALOG_NO_DATA:
|
||||
e_error_run (GTK_WINDOW (dialog), ERROR_DOMAIN ":acl-add-error", email, NULL);
|
||||
break;
|
||||
default:
|
||||
e_error_run (GTK_WINDOW (dialog), ERROR_DOMAIN ":perm-unknown-error", email, NULL);
|
||||
break;
|
||||
}
|
||||
if (status != E2K_GLOBAL_CATALOG_OK)
|
||||
return;
|
||||
|
||||
/* Make sure the user isn't already there. */
|
||||
bsid = e2k_sid_get_binary_sid (entry->sid);
|
||||
valid = gtk_tree_model_get_iter_first (GTK_TREE_MODEL (dialog->priv->list_store), &iter);
|
||||
while (valid) {
|
||||
gtk_tree_model_get (GTK_TREE_MODEL (dialog->priv->list_store), &iter,
|
||||
EXCHANGE_PERMISSIONS_DIALOG_SID_COLUMN, &sid2,
|
||||
-1);
|
||||
bsid2 = e2k_sid_get_binary_sid (sid2);
|
||||
if (e2k_sid_binary_sid_equal (bsid, bsid2)) {
|
||||
e_error_run (GTK_WINDOW (dialog), ERROR_DOMAIN ":perm-existing-error",
|
||||
entry->display_name, NULL);
|
||||
e2k_global_catalog_entry_free (gc, entry);
|
||||
gtk_tree_selection_select_iter (dialog->priv->list_selection, &iter);
|
||||
return;
|
||||
}
|
||||
|
||||
valid = gtk_tree_model_iter_next (GTK_TREE_MODEL (dialog->priv->list_store), &iter);
|
||||
}
|
||||
|
||||
valid = gtk_tree_model_iter_next (GTK_TREE_MODEL (dialog->priv->list_store), &iter);
|
||||
add_user_to_list (dialog, entry->sid, TRUE);
|
||||
|
||||
/* Calling set_permissions will cause the sd to take a
|
||||
* ref on the sid, allowing us to unref it.
|
||||
*/
|
||||
set_permissions (dialog, 0);
|
||||
e2k_global_catalog_entry_free (gc, entry);
|
||||
}
|
||||
|
||||
add_user_to_list (dialog, entry->sid, TRUE);
|
||||
|
||||
/* Calling set_permissions will cause the sd to take a
|
||||
* ref on the sid, allowing us to unref it.
|
||||
*/
|
||||
set_permissions (dialog, 0);
|
||||
e2k_global_catalog_entry_free (gc, entry);
|
||||
g_list_free (email_list);
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@ -223,6 +223,42 @@ e2k_user_dialog_new (GtkWidget *parent_window,
|
||||
return GTK_WIDGET (dialog);
|
||||
}
|
||||
|
||||
/**
|
||||
* e2k_user_dialog_get_user_list:
|
||||
* @dialog: the dialog
|
||||
*
|
||||
* Gets the email addresses of the selected user from the dialog.
|
||||
*
|
||||
* Return value: the email addresses.
|
||||
**/
|
||||
GList *
|
||||
e2k_user_dialog_get_user_list (E2kUserDialog *dialog)
|
||||
{
|
||||
E2kUserDialogPrivate *priv;
|
||||
EDestinationStore *destination_store;
|
||||
GList *destinations;
|
||||
GList *l;
|
||||
GList *email_list = NULL;
|
||||
EDestination *destination;
|
||||
|
||||
g_return_val_if_fail (E2K_IS_USER_DIALOG (dialog), NULL);
|
||||
|
||||
priv = dialog->priv;
|
||||
|
||||
destination_store = e_name_selector_entry_peek_destination_store (E_NAME_SELECTOR_ENTRY (priv->entry));
|
||||
destinations = e_destination_store_list_destinations (destination_store);
|
||||
if (!destinations)
|
||||
return NULL;
|
||||
|
||||
for (l = destinations; l; l = g_list_next (l)) {
|
||||
destination = l->data;
|
||||
email_list = g_list_prepend (email_list, g_strdup (e_destination_get_email (destination)));
|
||||
}
|
||||
g_list_free (destinations);
|
||||
|
||||
return email_list;
|
||||
}
|
||||
|
||||
/**
|
||||
* e2k_user_dialog_get_user:
|
||||
* @dialog: the dialog
|
||||
|
||||
@ -33,5 +33,6 @@ GtkWidget *e2k_user_dialog_new (GtkWidget *parent_window,
|
||||
const char *label_text,
|
||||
const char *section_name);
|
||||
char *e2k_user_dialog_get_user (E2kUserDialog *dialog);
|
||||
GList *e2k_user_dialog_get_user_list (E2kUserDialog *dialog);
|
||||
|
||||
#endif /* __E2K_USER_DIALOG_H__ */
|
||||
|
||||
Reference in New Issue
Block a user