aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@novell.com>2004-06-24 04:26:56 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2004-06-24 04:26:56 +0800
commiteb44d99148fb658e40fb3f9961f43962ba2f39e4 (patch)
tree22ce524505c316bc7346899242d0ba3147932076
parenta13993737588ffc3d8c2caedf235634e8eadfe1c (diff)
downloadgsoc2013-evolution-eb44d99148fb658e40fb3f9961f43962ba2f39e4.tar
gsoc2013-evolution-eb44d99148fb658e40fb3f9961f43962ba2f39e4.tar.gz
gsoc2013-evolution-eb44d99148fb658e40fb3f9961f43962ba2f39e4.tar.bz2
gsoc2013-evolution-eb44d99148fb658e40fb3f9961f43962ba2f39e4.tar.lz
gsoc2013-evolution-eb44d99148fb658e40fb3f9961f43962ba2f39e4.tar.xz
gsoc2013-evolution-eb44d99148fb658e40fb3f9961f43962ba2f39e4.tar.zst
gsoc2013-evolution-eb44d99148fb658e40fb3f9961f43962ba2f39e4.zip
Hide password, etc info in the fi->uri's. (imap4_create_folder): Don't
2004-06-23 Jeffrey Stedfast <fejj@novell.com> * providers/imap4/camel-imap4-store.c (imap4_build_folder_info): Hide password, etc info in the fi->uri's. (imap4_create_folder): Don't bother to use imap4_get_folder_info(), we can construct the fi ourselves. (imap4_delete_folder): Emit the folder_deleted signal and construct an fi ourselves. (imap4_subscribe_folder): Same. (imap4_unsubscribe_folder): Same. * providers/imap4/camel-imap4-provider.c: Specify that the fragment is the path. svn path=/trunk/; revision=26483
-rw-r--r--camel/ChangeLog6
-rw-r--r--camel/providers/imap4/camel-imap4-store.c93
2 files changed, 79 insertions, 20 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog
index b0c3dd141e..a35ff1761f 100644
--- a/camel/ChangeLog
+++ b/camel/ChangeLog
@@ -2,6 +2,12 @@
* providers/imap4/camel-imap4-store.c (imap4_build_folder_info):
Hide password, etc info in the fi->uri's.
+ (imap4_create_folder): Don't bother to use
+ imap4_get_folder_info(), we can construct the fi ourselves.
+ (imap4_delete_folder): Emit the folder_deleted signal and
+ construct an fi ourselves.
+ (imap4_subscribe_folder): Same.
+ (imap4_unsubscribe_folder): Same.
* providers/imap4/camel-imap4-provider.c: Specify that the
fragment is the path.
diff --git a/camel/providers/imap4/camel-imap4-store.c b/camel/providers/imap4/camel-imap4-store.c
index 6c80dcd777..4223ab0c32 100644
--- a/camel/providers/imap4/camel-imap4-store.c
+++ b/camel/providers/imap4/camel-imap4-store.c
@@ -780,6 +780,7 @@ imap4_create_folder (CamelStore *store, const char *parent_name, const char *fol
CamelFolderInfo *fi = NULL;
CamelIMAP4Command *ic;
char *utf7_name;
+ CamelURL *url;
const char *c;
char *name;
char sep;
@@ -823,12 +824,19 @@ imap4_create_folder (CamelStore *store, const char *parent_name, const char *fol
switch (ic->result) {
case CAMEL_IMAP4_RESULT_OK:
- if (!(fi = imap4_get_folder_info (store, name, CAMEL_STORE_FOLDER_INFO_FAST, ex))) {
- camel_imap4_command_unref (ic);
- g_free (name);
-
- goto done;
- }
+ url = camel_url_copy (engine->url);
+ camel_url_set_fragment (url, name);
+
+ c = strrchr (name, '/');
+
+ fi = g_malloc0 (sizeof (CamelFolderInfo));
+ fi->full_name = name;
+ fi->name = g_strdup (c ? c + 1: name);
+ fi->uri = camel_url_to_string (url, CAMEL_URL_HIDE_ALL);
+ camel_url_free (url);
+ fi->flags = 0;
+ fi->unread = -1;
+ fi->total = -1;
camel_object_trigger_event (store, "folder_created", fi);
break;
@@ -837,11 +845,13 @@ imap4_create_folder (CamelStore *store, const char *parent_name, const char *fol
camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
_("Cannot create folder `%s': Invalid mailbox name"),
name);
+ g_free (name);
break;
case CAMEL_IMAP4_RESULT_BAD:
camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
_("Cannot create folder `%s': Bad command"),
name);
+ g_free (name);
break;
default:
g_assert_not_reached ();
@@ -849,8 +859,6 @@ imap4_create_folder (CamelStore *store, const char *parent_name, const char *fol
camel_imap4_command_unref (ic);
- g_free (name);
-
done:
CAMEL_SERVICE_UNLOCK (store, connect_lock);
@@ -863,7 +871,10 @@ imap4_delete_folder (CamelStore *store, const char *folder_name, CamelException
{
CamelIMAP4Engine *engine = ((CamelIMAP4Store *) store)->engine;
CamelIMAP4Command *ic;
+ CamelFolderInfo *fi;
char *utf7_name;
+ CamelURL *url;
+ const char *p;
int id;
if (!g_ascii_strcasecmp (folder_name, "INBOX")) {
@@ -893,10 +904,23 @@ imap4_delete_folder (CamelStore *store, const char *folder_name, CamelException
switch (ic->result) {
case CAMEL_IMAP4_RESULT_OK:
/* deleted */
- /* FIXME: emit the "folder_deleted" signal? */
- /*fi = imap4_build_folder_info (store, folder_name);
+ url = camel_url_copy (engine->url);
+ camel_url_set_fragment (url, folder_name);
+
+ p = strrchr (folder_name, '/');
+
+ fi = g_malloc0 (sizeof (CamelFolderInfo));
+ fi->full_name = g_strdup (folder_name);
+ fi->name = g_strdup (p ? p + 1: folder_name);
+ fi->uri = camel_url_to_string (url, CAMEL_URL_HIDE_ALL);
+ camel_url_free (url);
+ fi->flags = 0;
+ fi->unread = -1;
+ fi->total = -1;
+
camel_object_trigger_event (store, "folder_deleted", fi);
- camel_folder_info_free (fi);*/
+
+ camel_folder_info_free (fi);
break;
case CAMEL_IMAP4_RESULT_NO:
/* FIXME: would be good to save the NO reason into the err message */
@@ -1207,7 +1231,10 @@ imap4_subscribe_folder (CamelStore *store, const char *folder_name, CamelExcepti
{
CamelIMAP4Engine *engine = ((CamelIMAP4Store *) store)->engine;
CamelIMAP4Command *ic;
+ CamelFolderInfo *fi;
char *utf7_name;
+ CamelURL *url;
+ const char *p;
int id;
CAMEL_SERVICE_LOCK (store, connect_lock);
@@ -1229,11 +1256,22 @@ imap4_subscribe_folder (CamelStore *store, const char *folder_name, CamelExcepti
switch (ic->result) {
case CAMEL_IMAP4_RESULT_OK:
/* subscribed */
- /* FIXME: emit the "folder_subscribed" signal? */
- /*fi = imap4_build_folder_info (store, folder_name);
- fi->flags |= CAMEL_FOLDER_NOCHILDREN;
- camel_object_trigger_event (store, "folder_subscribed", fi);
- camel_folder_info_free (fi);*/
+ url = camel_url_copy (engine->url);
+ camel_url_set_fragment (url, folder_name);
+
+ p = strrchr (folder_name, '/');
+
+ fi = g_malloc0 (sizeof (CamelFolderInfo));
+ fi->full_name = g_strdup (folder_name);
+ fi->name = g_strdup (p ? p + 1: folder_name);
+ fi->uri = camel_url_to_string (url, CAMEL_URL_HIDE_ALL);
+ camel_url_free (url);
+ fi->flags = CAMEL_FOLDER_NOCHILDREN;
+ fi->unread = -1;
+ fi->total = -1;
+
+ camel_object_trigger_event (store, "folder_subscribed", fi);
+ camel_folder_info_free (fi);
break;
case CAMEL_IMAP4_RESULT_NO:
/* FIXME: would be good to save the NO reason into the err message */
@@ -1258,7 +1296,10 @@ imap4_unsubscribe_folder (CamelStore *store, const char *folder_name, CamelExcep
{
CamelIMAP4Engine *engine = ((CamelIMAP4Store *) store)->engine;
CamelIMAP4Command *ic;
+ CamelFolderInfo *fi;
char *utf7_name;
+ CamelURL *url;
+ const char *p;
int id;
CAMEL_SERVICE_LOCK (store, connect_lock);
@@ -1280,10 +1321,22 @@ imap4_unsubscribe_folder (CamelStore *store, const char *folder_name, CamelExcep
switch (ic->result) {
case CAMEL_IMAP4_RESULT_OK:
/* unsubscribed */
- /* FIXME: emit the "folder_unsubscribed" signal? */
- /*fi = imap4_build_folder_info (store, folder_name);
- camel_object_trigger_event (store, "folder_unsubscribed", fi);
- camel_folder_info_free (fi);*/
+ url = camel_url_copy (engine->url);
+ camel_url_set_fragment (url, folder_name);
+
+ p = strrchr (folder_name, '/');
+
+ fi = g_malloc0 (sizeof (CamelFolderInfo));
+ fi->full_name = g_strdup (folder_name);
+ fi->name = g_strdup (p ? p + 1: folder_name);
+ fi->uri = camel_url_to_string (url, CAMEL_URL_HIDE_ALL);
+ camel_url_free (url);
+ fi->flags = 0;
+ fi->unread = -1;
+ fi->total = -1;
+
+ camel_object_trigger_event (store, "folder_unsubscribed", fi);
+ camel_folder_info_free (fi);
break;
case CAMEL_IMAP4_RESULT_NO:
/* FIXME: would be good to save the NO reason into the err message */