aboutsummaryrefslogtreecommitdiffstats
path: root/camel/providers/pop3/camel-pop3-store.c
diff options
context:
space:
mode:
authorDan Winship <danw@src.gnome.org>2000-06-16 06:19:44 +0800
committerDan Winship <danw@src.gnome.org>2000-06-16 06:19:44 +0800
commitcd157eecb933748212bf87b41dcf5fa863e75fd5 (patch)
tree29dc32794de0449c4a7e5fb544150e57ea4183bb /camel/providers/pop3/camel-pop3-store.c
parente1de51e60e715983d1063810ac0cbfd80f99cc2c (diff)
downloadgsoc2013-evolution-cd157eecb933748212bf87b41dcf5fa863e75fd5.tar
gsoc2013-evolution-cd157eecb933748212bf87b41dcf5fa863e75fd5.tar.gz
gsoc2013-evolution-cd157eecb933748212bf87b41dcf5fa863e75fd5.tar.bz2
gsoc2013-evolution-cd157eecb933748212bf87b41dcf5fa863e75fd5.tar.lz
gsoc2013-evolution-cd157eecb933748212bf87b41dcf5fa863e75fd5.tar.xz
gsoc2013-evolution-cd157eecb933748212bf87b41dcf5fa863e75fd5.tar.zst
gsoc2013-evolution-cd157eecb933748212bf87b41dcf5fa863e75fd5.zip
Kill. Folders are now always open, and handle "closing" sorts of
* camel-folder.c: (camel_folder_open, camel_folder_is_open, camel_folder_get_mode): Kill. Folders are now always open, and handle "closing" sorts of operations at sync or finalize time. (camel_folder_sync): renamed from camel_folder_close. Syncs state to the store but doesn't necessarily close/disconnect. * providers/*/camel-*-folder.c: Merge "open" methods into "init" methods. Rename close to sync and update appropriately. * providers/imap/camel-imap-store.c: Remove camel_imap_store_open and camel_imap_store_close, which should not have been copied from the POP provider (where the exist to work around limitations of the POP protocol). svn path=/trunk/; revision=3581
Diffstat (limited to 'camel/providers/pop3/camel-pop3-store.c')
-rw-r--r--camel/providers/pop3/camel-pop3-store.c57
1 files changed, 25 insertions, 32 deletions
diff --git a/camel/providers/pop3/camel-pop3-store.c b/camel/providers/pop3/camel-pop3-store.c
index c915b0916f..b465faa499 100644
--- a/camel/providers/pop3/camel-pop3-store.c
+++ b/camel/providers/pop3/camel-pop3-store.c
@@ -372,44 +372,18 @@ free_auth_types (CamelService *service, GList *authtypes)
}
/**
- * camel_pop3_store_open: Connect to the server if we are currently
- * disconnected.
+ * camel_pop3_store_expunge:
* @store: the store
* @ex: a CamelException
*
- * The POP protocol does not allow deleted messages to be expunged
- * except by closing the connection. Thus, camel_pop3_folder_{open,close}
- * sometimes need to connect to or disconnect from the server. This
- * routine reconnects to the server if we have disconnected.
- *
+ * Expunge messages from the store. This will result in the connection
+ * being closed, which may cause later commands to fail if they can't
+ * reconnect.
**/
void
-camel_pop3_store_open (CamelPop3Store *store, CamelException *ex)
+camel_pop3_store_expunge (CamelPop3Store *store, CamelException *ex)
{
- CamelService *service = CAMEL_SERVICE (store);
-
- if (!camel_service_is_connected (service))
- pop3_connect (service, ex);
-}
-
-/**
- * camel_pop3_store_close: Close the connection to the server and
- * possibly expunge deleted messages.
- * @store: the store
- * @expunge: whether or not to expunge deleted messages
- * @ex: a CamelException
- *
- * See camel_pop3_store_open for an explanation of why this is needed.
- *
- **/
-void
-camel_pop3_store_close (CamelPop3Store *store, gboolean expunge,
- CamelException *ex)
-{
- if (expunge)
- camel_pop3_command (store, NULL, "QUIT");
- else
- camel_pop3_command (store, NULL, "RSET");
+ camel_pop3_command (store, NULL, "QUIT");
pop3_disconnect (CAMEL_SERVICE (store), ex);
}
@@ -539,6 +513,12 @@ static CamelFolder *
get_folder (CamelStore *store, const char *folder_name,
gboolean create, CamelException *ex)
{
+ CamelService *service = CAMEL_SERVICE (store);
+
+ if (!camel_service_is_connected (service)) {
+ if (!camel_service_connect (service, ex))
+ return NULL;
+ }
return camel_pop3_folder_new (store, ex);
}
@@ -585,10 +565,23 @@ get_root_folder_name (CamelStore *store, CamelException *ex)
int
camel_pop3_command (CamelPop3Store *store, char **ret, char *fmt, ...)
{
+ CamelService *service = CAMEL_SERVICE (store);
char *cmdbuf, *respbuf;
va_list ap;
int status;
+ if (!store->ostream) {
+ CamelException ex;
+
+ camel_exception_init (&ex);
+ if (!camel_service_connect (service, &ex)) {
+ if (ret)
+ *ret = g_strdup (camel_exception_get_description (&ex));
+ camel_exception_clear (&ex);
+ return CAMEL_POP3_FAIL;
+ }
+ }
+
va_start (ap, fmt);
cmdbuf = g_strdup_vprintf (fmt, ap);
va_end (ap);