diff options
author | Not Zed <NotZed@Ximian.com> | 2004-10-19 14:35:44 +0800 |
---|---|---|
committer | Michael Zucci <zucchi@src.gnome.org> | 2004-10-19 14:35:44 +0800 |
commit | be00bf6ac1a1397207ee17c559f637741fb0e640 (patch) | |
tree | 20c4547441219cf8b01f4bf74e9bb105ccd50b44 /mail/mail-ops.c | |
parent | 0caac5ff878a9cb7dc5d53906c7d57ef6483b5f7 (diff) | |
download | gsoc2013-evolution-be00bf6ac1a1397207ee17c559f637741fb0e640.tar.gz gsoc2013-evolution-be00bf6ac1a1397207ee17c559f637741fb0e640.tar.zst gsoc2013-evolution-be00bf6ac1a1397207ee17c559f637741fb0e640.zip |
** See bug #67014.
2004-10-11 Not Zed <NotZed@Ximian.com>
** See bug #67014.
* mail-errors.xml: added "checking-service" error.
* em-account-editor.c (em_account_editor_construct): keep track of
the dialogue
(emae_editor_destroyed): , and clean up when destroyed.
* em-account-editor.c (emae_check_authtype)
(emae_check_authtype_response, emae_check_authtype_done): handle
checking authtype gui here.
* mail-config.c (check_service_describe, check_service_check)
(check_response, mail_config_check_service): removed.
* mail-ops.c (mail_check_service): moved here from mail-config,
and modified to be a re-usable threaded function.
svn path=/trunk/; revision=27615
Diffstat (limited to 'mail/mail-ops.c')
-rw-r--r-- | mail/mail-ops.c | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/mail/mail-ops.c b/mail/mail-ops.c index 51de559c8e..c4cb73e908 100644 --- a/mail/mail-ops.c +++ b/mail/mail-ops.c @@ -2265,3 +2265,80 @@ mail_execute_shell_command (CamelFilterDriver *driver, int argc, char **argv, vo gnome_execute_async_fds (NULL, argc, argv, TRUE); } + +/* Async service-checking/authtype-lookup code. */ +struct _check_msg { + struct _mail_msg msg; + + char *url; + CamelProviderType type; + GList *authtypes; + + void (*done)(const char *url, CamelProviderType type, GList *types, void *data); + void *data; +}; + +static char * +check_service_describe(struct _mail_msg *mm, int complete) +{ + return g_strdup(_("Checking Service")); +} + +static void +check_service_check(struct _mail_msg *mm) +{ + struct _check_msg *m = (struct _check_msg *)mm; + CamelService *service; + + service = camel_session_get_service(session, m->url, m->type, &mm->ex); + if (!service) { + camel_operation_unregister(mm->cancel); + return; + } + + m->authtypes = camel_service_query_auth_types(service, &mm->ex); + camel_object_unref(service); +} + +static void +check_service_done(struct _mail_msg *mm) +{ + struct _check_msg *m = (struct _check_msg *)mm; + + if (m->done) + m->done(m->url, m->type, m->authtypes, m->data); +} + +static void +check_service_free(struct _mail_msg *mm) +{ + struct _check_msg *m = (struct _check_msg *)mm; + + g_free(m->url); + g_list_free(m->authtypes); +} + +static struct _mail_msg_op check_service_op = { + check_service_describe, + check_service_check, + check_service_done, + check_service_free, +}; + +int +mail_check_service(const char *url, CamelProviderType type, void (*done)(const char *url, CamelProviderType type, GList *authtypes, void *data), void *data) +{ + struct _check_msg *m; + int id; + + m = mail_msg_new (&check_service_op, NULL, sizeof(*m)); + m->url = g_strdup(url); + m->type = type; + m->done = done; + m->data = data; + + id = m->msg.seq; + e_thread_put(mail_thread_new, (EMsg *)m); + + return id; +} |