diff options
author | Dan Winship <danw@src.gnome.org> | 2000-07-02 07:07:18 +0800 |
---|---|---|
committer | Dan Winship <danw@src.gnome.org> | 2000-07-02 07:07:18 +0800 |
commit | 98753e92d2b6bb52978c2ac9d38d29b8d2372978 (patch) | |
tree | 89bb98c0ad5d252931f0e65c9db1d904c8324d96 /camel | |
parent | 6dabd2bd964e2e6692fa01261104fe4a510a0fa8 (diff) | |
download | gsoc2013-evolution-98753e92d2b6bb52978c2ac9d38d29b8d2372978.tar gsoc2013-evolution-98753e92d2b6bb52978c2ac9d38d29b8d2372978.tar.gz gsoc2013-evolution-98753e92d2b6bb52978c2ac9d38d29b8d2372978.tar.bz2 gsoc2013-evolution-98753e92d2b6bb52978c2ac9d38d29b8d2372978.tar.lz gsoc2013-evolution-98753e92d2b6bb52978c2ac9d38d29b8d2372978.tar.xz gsoc2013-evolution-98753e92d2b6bb52978c2ac9d38d29b8d2372978.tar.zst gsoc2013-evolution-98753e92d2b6bb52978c2ac9d38d29b8d2372978.zip |
New method, to return an end-user-friendly name corresponding to a
* camel-service.c (camel_service_get_name): New method, to return
an end-user-friendly name corresponding to a service. (eg, "POP
service for danw on trna.helixcode.com").
* providers/imap/camel-imap-store.c,
providers/mbox/camel-mbox-store.c,
providers/nntp/camel-nntp-store.c,
providers/pop3/camel-pop3-store.c,
providers/sendmail/camel-sendmail-transport.c,
providers/smtp/camel-smtp-transport.c: Implement.
svn path=/trunk/; revision=3851
Diffstat (limited to 'camel')
-rw-r--r-- | camel/ChangeLog | 11 | ||||
-rw-r--r-- | camel/camel-service.c | 33 | ||||
-rw-r--r-- | camel/camel-service.h | 5 | ||||
-rw-r--r-- | camel/providers/imap/camel-imap-store.c | 14 | ||||
-rw-r--r-- | camel/providers/mbox/camel-mbox-store.c | 13 | ||||
-rw-r--r-- | camel/providers/nntp/camel-nntp-store.c | 11 | ||||
-rw-r--r-- | camel/providers/pop3/camel-pop3-store.c | 15 | ||||
-rw-r--r-- | camel/providers/sendmail/camel-sendmail-transport.c | 15 | ||||
-rw-r--r-- | camel/providers/smtp/camel-smtp-transport.c | 13 |
9 files changed, 128 insertions, 2 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog index 45e4540365..15f01eb181 100644 --- a/camel/ChangeLog +++ b/camel/ChangeLog @@ -1,5 +1,16 @@ 2000-07-01 Dan Winship <danw@helixcode.com> + * camel-service.c (camel_service_get_name): New method, to return + an end-user-friendly name corresponding to a service. (eg, "POP + service for danw on trna.helixcode.com"). + + * providers/imap/camel-imap-store.c, + providers/mbox/camel-mbox-store.c, + providers/nntp/camel-nntp-store.c, + providers/pop3/camel-pop3-store.c, + providers/sendmail/camel-sendmail-transport.c, + providers/smtp/camel-smtp-transport.c: Implement. + * providers/imap/Makefile.am: remove unneeded libcamelimap_la_LDADD. diff --git a/camel/camel-service.c b/camel/camel-service.c index 1efcafcfe8..ec2e4d3712 100644 --- a/camel/camel-service.c +++ b/camel/camel-service.c @@ -41,6 +41,7 @@ static gboolean service_disconnect(CamelService *service, CamelException *ex); static gboolean is_connected (CamelService *service); static GList * query_auth_types (CamelService *service, CamelException *ex); static void free_auth_types (CamelService *service, GList *authtypes); +static char * get_name (CamelService *service, gboolean brief); static void finalize (GtkObject *object); static gboolean check_url (CamelService *service, CamelException *ex); @@ -60,6 +61,7 @@ camel_service_class_init (CamelServiceClass *camel_service_class) camel_service_class->is_connected = is_connected; camel_service_class->query_auth_types = query_auth_types; camel_service_class->free_auth_types = free_auth_types; + camel_service_class->get_name = get_name; /* virtual method overload */ gtk_object_class->finalize = finalize; @@ -262,6 +264,36 @@ camel_service_get_url (CamelService *service) } +static char * +get_name (CamelService *service, gboolean brief) +{ + g_warning ("CamelService::get_name not implemented for `%s'", + gtk_type_name (GTK_OBJECT_TYPE (service))); + return "???"; +} + +/** + * camel_service_get_name: + * @service: the service + * @brief: whether or not to use a briefer form + * + * This gets the name of the service in a "friendly" (suitable for + * humans) form. If @brief is %TRUE, this should be a brief description + * such as for use in the folder tree. If @brief is %FALSE, it should + * be a more complete and mostly unambiguous description. + * + * Return value: the description, which the caller must free. + **/ +char * +camel_service_get_name (CamelService *service, gboolean brief) +{ + g_return_val_if_fail (CAMEL_IS_SERVICE (service), NULL); + g_return_val_if_fail (service->url, NULL); + + return CSERV_CLASS (service)->get_name (service, brief); +} + + /** * camel_service_get_session: * @service: a service @@ -329,7 +361,6 @@ camel_service_free_auth_types (CamelService *service, GList *authtypes) } - /* URL utility routines */ /** diff --git a/camel/camel-service.h b/camel/camel-service.h index 179447661b..a4e69ed6f3 100644 --- a/camel/camel-service.h +++ b/camel/camel-service.h @@ -69,6 +69,9 @@ typedef struct { void (*free_auth_types) (CamelService *service, GList *authtypes); + char * (*get_name) (CamelService *service, + gboolean brief); + } CamelServiceClass; @@ -100,6 +103,8 @@ gboolean camel_service_disconnect (CamelService *service, gboolean camel_service_is_connected (CamelService *service); char * camel_service_get_url (CamelService *service); +char * camel_service_get_name (CamelService *service, + gboolean brief); CamelSession * camel_service_get_session (CamelService *service); GList * camel_service_query_auth_types (CamelService *service, diff --git a/camel/providers/imap/camel-imap-store.c b/camel/providers/imap/camel-imap-store.c index 017ab97116..75da7529b3 100644 --- a/camel/providers/imap/camel-imap-store.c +++ b/camel/providers/imap/camel-imap-store.c @@ -58,6 +58,7 @@ static gboolean imap_connect (CamelService *service, CamelException *ex); static gboolean imap_disconnect (CamelService *service, CamelException *ex); static GList *query_auth_types (CamelService *service, CamelException *ex); static void free_auth_types (CamelService *service, GList *authtypes); +static char *get_name (CamelService *service, gboolean brief); static CamelFolder *get_folder (CamelStore *store, const char *folder_name, gboolean create, CamelException *ex); static char *get_folder_name (CamelStore *store, const char *folder_name, CamelException *ex); @@ -83,6 +84,7 @@ camel_imap_store_class_init (CamelImapStoreClass *camel_imap_store_class) camel_service_class->disconnect = imap_disconnect; camel_service_class->query_auth_types = query_auth_types; camel_service_class->free_auth_types = free_auth_types; + camel_service_class->get_name = get_name; camel_store_class->get_folder = get_folder; camel_store_class->get_folder_name = get_folder_name; @@ -204,6 +206,18 @@ free_auth_types (CamelService *service, GList *authtypes) g_list_free (authtypes); } +static char * +get_name (CamelService *service, gboolean brief) +{ + if (brief) + return g_strdup_printf ("IMAP server %s", service->url->host); + else { + return g_strdup_printf ("IMAP service for %s on %s", + service->url->user, + service->url->host); + } +} + static gboolean imap_connect (CamelService *service, CamelException *ex) { diff --git a/camel/providers/mbox/camel-mbox-store.c b/camel/providers/mbox/camel-mbox-store.c index 42cb931927..19b7c54612 100644 --- a/camel/providers/mbox/camel-mbox-store.c +++ b/camel/providers/mbox/camel-mbox-store.c @@ -39,6 +39,7 @@ #define CF_CLASS(so) CAMEL_FOLDER_CLASS (GTK_OBJECT(so)->klass) #define CMBOXF_CLASS(so) CAMEL_MBOX_FOLDER_CLASS (GTK_OBJECT(so)->klass) +static char *get_name (CamelService *service, gboolean brief); static CamelFolder *get_folder (CamelStore *store, const char *folder_name, gboolean create, CamelException *ex); static void delete_folder (CamelStore *store, const char *folder_name, @@ -50,8 +51,11 @@ static void camel_mbox_store_class_init (CamelMboxStoreClass *camel_mbox_store_class) { CamelStoreClass *camel_store_class = CAMEL_STORE_CLASS (camel_mbox_store_class); + CamelServiceClass *camel_service_class = CAMEL_SERVICE_CLASS (camel_mbox_store_class); /* virtual method overload */ + camel_service_class->get_name = get_name; + camel_store_class->get_folder = get_folder; camel_store_class->delete_folder = delete_folder; camel_store_class->get_folder_name = get_folder_name; @@ -229,3 +233,12 @@ get_folder_name (CamelStore *store, const char *folder_name, CamelException *ex) return *folder_name == '/' ? g_strdup (folder_name) : g_strdup_printf ("/%s", folder_name); } + +static char * +get_name (CamelService *service, gboolean brief) +{ + if (brief) + return g_strdup (service->url->path); + else + return g_strdup_printf ("Local mail file %s", service->url->path); +} diff --git a/camel/providers/nntp/camel-nntp-store.c b/camel/providers/nntp/camel-nntp-store.c index 765cd8796b..03ab14ccdb 100644 --- a/camel/providers/nntp/camel-nntp-store.c +++ b/camel/providers/nntp/camel-nntp-store.c @@ -58,7 +58,6 @@ static CamelServiceClass *service_class = NULL; static gboolean nntp_connect (CamelService *service, CamelException *ex); static gboolean nntp_disconnect (CamelService *service, CamelException *ex); - static CamelFolder * nntp_store_get_folder (CamelStore *store, const gchar *folder_name, gboolean get_folder, CamelException *ex) @@ -96,15 +95,25 @@ nntp_store_get_folder_name (CamelStore *store, const char *folder_name, return g_strdup (folder_name); } +static char * +nntp_store_get_name (CamelService *service, gboolean brief) +{ + /* Same info for long and brief... */ + return g_strdup_sprintf ("USENET news via %s", service->url->host); +} + static void camel_nntp_store_class_init (CamelNNTPStoreClass *camel_nntp_store_class) { CamelStoreClass *camel_store_class = CAMEL_STORE_CLASS (camel_nntp_store_class); + CamelServiceClass *camel_store_class = CAMEL_SERVICE_CLASS (camel_nntp_store_class); service_class = gtk_type_class (camel_service_get_type ()); /* virtual method overload */ + camel_service_class->get_name = nntp_store_get_name; + camel_store_class->get_folder = nntp_store_get_folder; camel_store_class->get_folder_name = nntp_store_get_folder_name; } diff --git a/camel/providers/pop3/camel-pop3-store.c b/camel/providers/pop3/camel-pop3-store.c index 636172bb94..2dd6e99326 100644 --- a/camel/providers/pop3/camel-pop3-store.c +++ b/camel/providers/pop3/camel-pop3-store.c @@ -62,6 +62,7 @@ static gboolean pop3_connect (CamelService *service, CamelException *ex); static gboolean pop3_disconnect (CamelService *service, CamelException *ex); static GList *query_auth_types (CamelService *service, CamelException *ex); static void free_auth_types (CamelService *service, GList *authtypes); +static char *get_name (CamelService *service, gboolean brief); static CamelFolder *get_folder (CamelStore *store, const char *folder_name, gboolean create, CamelException *ex); @@ -89,6 +90,7 @@ camel_pop3_store_class_init (CamelPop3StoreClass *camel_pop3_store_class) camel_service_class->disconnect = pop3_disconnect; camel_service_class->query_auth_types = query_auth_types; camel_service_class->free_auth_types = free_auth_types; + camel_service_class->get_name = get_name; camel_store_class->get_folder = get_folder; camel_store_class->get_folder_name = get_folder_name; @@ -368,6 +370,19 @@ free_auth_types (CamelService *service, GList *authtypes) g_list_free (authtypes); } +static char * +get_name (CamelService *service, gboolean brief) +{ + if (brief) + return g_strdup_printf ("POP server %s", service->url->host); + else { + return g_strdup_printf ("POP service for %s on %s", + service->url->user, + service->url->host); + } +} + + /** * camel_pop3_store_expunge: * @store: the store diff --git a/camel/providers/sendmail/camel-sendmail-transport.c b/camel/providers/sendmail/camel-sendmail-transport.c index 3b84d5cb90..3facc42676 100644 --- a/camel/providers/sendmail/camel-sendmail-transport.c +++ b/camel/providers/sendmail/camel-sendmail-transport.c @@ -39,6 +39,8 @@ #include "camel-stream-fs.h" #include "camel-exception.h" +static char *get_name (CamelService *service, gboolean brief); + static gboolean _can_send (CamelTransport *transport, CamelMedium *message); static gboolean _send (CamelTransport *transport, CamelMedium *message, CamelException *ex); @@ -51,8 +53,12 @@ camel_sendmail_transport_class_init (CamelSendmailTransportClass *camel_sendmail { CamelTransportClass *camel_transport_class = CAMEL_TRANSPORT_CLASS (camel_sendmail_transport_class); + CamelServiceClass *camel_service_class = + CAMEL_SERVICE_CLASS (camel_sendmail_transport_class); /* virtual method overload */ + camel_service_class->get_name = get_name; + camel_transport_class->can_send = _can_send; camel_transport_class->send = _send; camel_transport_class->send_to = _send_to; @@ -210,3 +216,12 @@ _send (CamelTransport *transport, CamelMedium *message, return _send_internal (message, argv, ex); } + +static char * +get_name (CamelService *service, gboolean brief) +{ + if (brief) + return g_strdup ("sendmail"); + else + return g_strdup ("Mail delivery via the sendmail program"); +} diff --git a/camel/providers/smtp/camel-smtp-transport.c b/camel/providers/smtp/camel-smtp-transport.c index 68adf24178..6188015bc8 100644 --- a/camel/providers/smtp/camel-smtp-transport.c +++ b/camel/providers/smtp/camel-smtp-transport.c @@ -61,6 +61,7 @@ static gboolean smtp_disconnect (CamelService *service, CamelException *ex); static GList *esmtp_get_authtypes(gchar *buffer); static GList *query_auth_types (CamelService *service, CamelException *ex); static void free_auth_types (CamelService *service, GList *authtypes); +static char *get_name (CamelService *service, gboolean brief); static gchar *smtp_get_email_addr_from_text (gchar *text); static gboolean smtp_helo (CamelSmtpTransport *transport, CamelException *ex); static gboolean smtp_mail (CamelSmtpTransport *transport, gchar *sender, CamelException *ex); @@ -87,6 +88,7 @@ camel_smtp_transport_class_init (CamelSmtpTransportClass *camel_smtp_transport_c camel_service_class->disconnect = smtp_disconnect; camel_service_class->query_auth_types = query_auth_types; camel_service_class->free_auth_types = free_auth_types; + camel_service_class->get_name = get_name; camel_transport_class->can_send = _can_send; camel_transport_class->send = _send; @@ -306,6 +308,17 @@ free_auth_types (CamelService *service, GList *authtypes) g_list_free (authtypes); } +static char * +get_name (CamelService *service, gboolean brief) +{ + if (brief) + return g_strdup_printf ("SMTP server %s", service->url->host); + else { + return g_strdup_printf ("SMTP mail delivery via %s", + service->url->host); + } +} + static gboolean _can_send (CamelTransport *transport, CamelMedium *message) { |