aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNot Zed <NotZed@Ximian.com>2005-08-15 12:40:55 +0800
committerMichael Zucci <zucchi@src.gnome.org>2005-08-15 12:40:55 +0800
commit821f184e823e86877d9034c0d4280ccbd492ebb8 (patch)
tree57c2e0a8391d3074ea103f81400ca3fcb5ff03b6
parenta4acb907a481ddc2761c17324071f16dd54ec0e7 (diff)
downloadgsoc2013-evolution-821f184e823e86877d9034c0d4280ccbd492ebb8.tar.gz
gsoc2013-evolution-821f184e823e86877d9034c0d4280ccbd492ebb8.tar.zst
gsoc2013-evolution-821f184e823e86877d9034c0d4280ccbd492ebb8.zip
** See #271985.
2005-08-10 Not Zed <NotZed@Ximian.com> ** See #271985. * evolution-mail-session.c (is_storage): check for uri "" and pass exception to provider get. Disable lots of debug output. svn path=/trunk/; revision=30119
-rw-r--r--plugins/mail-remote/ChangeLog7
-rw-r--r--plugins/mail-remote/e-corba-utils.c2
-rw-r--r--plugins/mail-remote/e-corba-utils.h5
-rw-r--r--plugins/mail-remote/em-message-stream.c4
-rw-r--r--plugins/mail-remote/evolution-mail-folder.c4
-rw-r--r--plugins/mail-remote/evolution-mail-folderlistener.c9
-rw-r--r--plugins/mail-remote/evolution-mail-messageiterator.c4
-rw-r--r--plugins/mail-remote/evolution-mail-messagestream.c2
-rw-r--r--plugins/mail-remote/evolution-mail-session.c34
-rw-r--r--plugins/mail-remote/evolution-mail-sessionlistener.c11
-rw-r--r--plugins/mail-remote/evolution-mail-store.c6
-rw-r--r--plugins/mail-remote/evolution-mail-storelistener.c9
-rw-r--r--plugins/mail-remote/mail-remote.c4
13 files changed, 64 insertions, 37 deletions
diff --git a/plugins/mail-remote/ChangeLog b/plugins/mail-remote/ChangeLog
index de7ef43631..0011da3bdc 100644
--- a/plugins/mail-remote/ChangeLog
+++ b/plugins/mail-remote/ChangeLog
@@ -1,3 +1,10 @@
+2005-08-10 Not Zed <NotZed@Ximian.com>
+
+ ** See #271985.
+
+ * evolution-mail-session.c (is_storage): check for uri "" and pass
+ exception to provider get.
+
2005-08-02 Not Zed <NotZed@Ximian.com>
* org-gnome-evolution-mail-remote.eplug.xml: How strange, this was
diff --git a/plugins/mail-remote/e-corba-utils.c b/plugins/mail-remote/e-corba-utils.c
index bd08ac0502..0b4aae19a4 100644
--- a/plugins/mail-remote/e-corba-utils.c
+++ b/plugins/mail-remote/e-corba-utils.c
@@ -246,7 +246,7 @@ gboolean e_mail_listener_emit(struct _EDList *list, EMailListenerChanged emit, C
while (n) {
emit(l->listener, source, changes, &ev);
if (ev._major != CORBA_NO_EXCEPTION) {
- printf("emit changed failed '%s', removing listener\n", ev._id);
+ e(printf("emit changed failed '%s', removing listener\n", ev._id));
CORBA_exception_free(&ev);
eml_remove(l);
}
diff --git a/plugins/mail-remote/e-corba-utils.h b/plugins/mail-remote/e-corba-utils.h
index ba70976882..43fef0c474 100644
--- a/plugins/mail-remote/e-corba-utils.h
+++ b/plugins/mail-remote/e-corba-utils.h
@@ -4,6 +4,11 @@
#include "Evolution-DataServer-Mail.h"
+/* Debug, warning debug, error debug, global for whole plugin to make it easier to enable/disable */
+#define d(x)
+#define w(x)
+#define e(x)
+
struct _EvolutionMailStore;
struct _EvolutionMailFolder;
struct _CamelMessageInfo;
diff --git a/plugins/mail-remote/em-message-stream.c b/plugins/mail-remote/em-message-stream.c
index 77f6300cb5..48fb6613b2 100644
--- a/plugins/mail-remote/em-message-stream.c
+++ b/plugins/mail-remote/em-message-stream.c
@@ -30,7 +30,7 @@
#include <camel/camel-stream.h>
#include "em-message-stream.h"
-#define d(x)
+#include "e-corba-utils.h"
#define EMSS_CLASS(x) ((EMMessageStreamClass *)(((CamelObject *)(x))->klass))
@@ -83,7 +83,7 @@ em_message_stream_finalize (CamelObject *object)
{
EMMessageStream *emms = (EMMessageStream *)object;
- printf("EMMessageStream.finalise()\n");
+ d(printf("EMMessageStream.finalise()\n"));
if (emms->source) {
CORBA_Environment ev = { 0 };
diff --git a/plugins/mail-remote/evolution-mail-folder.c b/plugins/mail-remote/evolution-mail-folder.c
index f25ef44e35..0b2c78a940 100644
--- a/plugins/mail-remote/evolution-mail-folder.c
+++ b/plugins/mail-remote/evolution-mail-folder.c
@@ -311,7 +311,7 @@ emf_set_change(Evolution_Mail_FolderChange *change, Evolution_Mail_ChangeType ho
camel_message_info_free(info);
total++;
} else {
- printf("couldn't get info for changed uid '%s'?\n", (char *)uids->pdata[i]);
+ w(printf("couldn't get info for changed uid '%s'?\n", (char *)uids->pdata[i]));
}
}
@@ -411,7 +411,7 @@ evolution_mail_folder_changed(EvolutionMailFolder *emf, Evolution_Mail_FolderCha
if (!e_mail_listener_emit(&p->listeners, (EMailListenerChanged)Evolution_Mail_FolderListener_changed,
bonobo_object_corba_objref((BonoboObject *)emf), changes)) {
- printf("No more listeners for folder, could dispose store object now\n");
+ d(printf("No more listeners for folder, could dispose store object now\n"));
evolution_mail_folder_close_folder(emf);
}
}
diff --git a/plugins/mail-remote/evolution-mail-folderlistener.c b/plugins/mail-remote/evolution-mail-folderlistener.c
index ba758d9483..8d897bd6fb 100644
--- a/plugins/mail-remote/evolution-mail-folderlistener.c
+++ b/plugins/mail-remote/evolution-mail-folderlistener.c
@@ -30,6 +30,7 @@
#include "evolution-mail-folderlistener.h"
#include "evolution-mail-marshal.h"
+#include "e-corba-utils.h"
#define PARENT_TYPE bonobo_object_get_type ()
@@ -63,7 +64,7 @@ impl_dispose (GObject *object)
static void
impl_finalize (GObject *object)
{
- printf("EvolutionMailFolderListener finalised!\n");
+ d(printf("EvolutionMailFolderListener finalised!\n"));
(* G_OBJECT_CLASS (parent_class)->finalize) (object);
}
@@ -95,11 +96,11 @@ impl_changed(PortableServer_Servant _servant,
EvolutionMailFolderListener *eml = (EvolutionMailFolderListener *)bonobo_object_from_servant(_servant);
int i, j;
- printf("folder changed!\n");
+ d(printf("folder changed!\n"));
for (i=0;i<changes->_length;i++) {
- printf(" %d %s", changes->_buffer[i].messages._length, change_type_name(changes->_buffer[i].type));
+ d(printf(" %d %s", changes->_buffer[i].messages._length, change_type_name(changes->_buffer[i].type)));
for (j=0;j<changes->_buffer[i].messages._length;j++) {
- printf(" %s %s\n", changes->_buffer[i].messages._buffer[j].uid, changes->_buffer[i].messages._buffer[j].subject);
+ d(printf(" %s %s\n", changes->_buffer[i].messages._buffer[j].uid, changes->_buffer[i].messages._buffer[j].subject));
}
}
diff --git a/plugins/mail-remote/evolution-mail-messageiterator.c b/plugins/mail-remote/evolution-mail-messageiterator.c
index 2a039f7e9a..94f9c7c830 100644
--- a/plugins/mail-remote/evolution-mail-messageiterator.c
+++ b/plugins/mail-remote/evolution-mail-messageiterator.c
@@ -34,6 +34,8 @@
#include "e-corba-utils.h"
+#define d(x)
+
#define PARENT_TYPE bonobo_object_get_type ()
static BonoboObjectClass *parent_class = NULL;
@@ -60,7 +62,7 @@ impl_finalize (GObject *object)
{
struct _EvolutionMailMessageIteratorPrivate *p = _PRIVATE(object);
- printf("EvolutionMailMessageIterator: finalise\n");
+ d(printf("EvolutionMailMessageIterator: finalise\n"));
if (*p->expr)
camel_folder_search_free(p->folder, p->search);
diff --git a/plugins/mail-remote/evolution-mail-messagestream.c b/plugins/mail-remote/evolution-mail-messagestream.c
index f00e904e5f..1be4ff2e8e 100644
--- a/plugins/mail-remote/evolution-mail-messagestream.c
+++ b/plugins/mail-remote/evolution-mail-messagestream.c
@@ -49,7 +49,7 @@ impl_finalize (GObject *object)
{
EvolutionMailMessageStream *emms = (EvolutionMailMessageStream *)object;
- printf("EvolutionMailMessageStream: finalise\n");
+ d(printf("EvolutionMailMessageStream: finalise\n"));
if (emms->source)
camel_object_unref(emms->source);
diff --git a/plugins/mail-remote/evolution-mail-session.c b/plugins/mail-remote/evolution-mail-session.c
index e670e40f50..b5a508b91d 100644
--- a/plugins/mail-remote/evolution-mail-session.c
+++ b/plugins/mail-remote/evolution-mail-session.c
@@ -60,11 +60,19 @@ static int
is_storage(EAccount *ea)
{
const char *uri;
- CamelProvider *prov;
+ int ok = FALSE;
- return(uri = e_account_get_string(ea, E_ACCOUNT_SOURCE_URL))
- && (prov = camel_provider_get(uri, NULL))
- && (prov->flags & CAMEL_PROVIDER_IS_STORAGE);
+ uri = e_account_get_string(ea, E_ACCOUNT_SOURCE_URL);
+ if (uri && uri[0]) {
+ CamelProvider *prov;
+ CamelException ex = { 0 };
+
+ prov = camel_provider_get(uri, &ex);
+ camel_exception_clear(&ex);
+ ok = prov && (prov->flags & CAMEL_PROVIDER_IS_STORAGE);
+ }
+
+ return ok;
}
/* GObject methods */
@@ -163,10 +171,10 @@ impl_removeListener(PortableServer_Servant _servant,
EvolutionMailSession *ems = (EvolutionMailSession *)bonobo_object_from_servant(_servant);
struct _EvolutionMailSessionPrivate *p = _PRIVATE(ems);
- printf("Removing listener from session\n");
+ d(printf("Removing listener from session\n"));
if (!e_mail_listener_remove(&p->listeners, listener)) {
- printf("no more listeners, could shut down session?\n");
+ d(printf("no more listeners, could shut down session?\n"));
}
}
@@ -231,7 +239,7 @@ ems_account_added(EAccountList *eal, EAccount *ea, EvolutionMailSession *ems)
if (ea->enabled && is_storage(ea)) {
EvolutionMailStore *store;
- printf("Account added %s\n", ea->uid);
+ d(printf("Account added %s\n", ea->uid));
store = evolution_mail_store_new(ems, ea);
p->stores = g_list_append(p->stores, store);
ems_listener_session_event(ems, Evolution_Mail_ADDED, store);
@@ -255,16 +263,16 @@ ems_account_changed(EAccountList *eal, EAccount *ea, EvolutionMailSession *ems)
if (store) {
/* account has been disabled? */
if (!ea->enabled) {
- printf("Account changed, now disabled %s\n", ea->uid);
+ d(printf("Account changed, now disabled %s\n", ea->uid));
p->stores = g_list_remove(p->stores, store);
ems_listener_session_event(ems, Evolution_Mail_REMOVED, store);
g_object_unref(store);
} else {
- printf("Account changed, dont know how %s\n", ea->uid);
+ d(printf("Account changed, dont know how %s\n", ea->uid));
ems_listener_session_event(ems, Evolution_Mail_CHANGED, store);
}
} else if (ea->enabled && is_storage(ea)) {
- printf("Account changed, now added %s\n", ea->uid);
+ d(printf("Account changed, now added %s\n", ea->uid));
store = evolution_mail_store_new(ems, ea);
p->stores = g_list_append(p->stores, store);
ems_listener_session_event(ems, Evolution_Mail_ADDED, store);
@@ -283,7 +291,7 @@ ems_account_removed(EAccountList *eal, EAccount *ea, EvolutionMailSession *ems)
EvolutionMailStore *store = l->data;
if (store->account == ea) {
- printf("Account removed %s\n", ea->uid);
+ d(printf("Account removed %s\n", ea->uid));
p->stores = g_list_remove(p->stores, store);
ems_listener_session_event(ems, Evolution_Mail_REMOVED, store);
g_object_unref(store);
@@ -299,7 +307,7 @@ evolution_mail_session_init (EvolutionMailSession *ems, EvolutionMailSessionClas
struct _EvolutionMailSessionPrivate *p = _PRIVATE(ems);
EIterator *iter;
- printf("EvolutionMailSession.init\n");
+ d(printf("EvolutionMailSession.init\n"));
e_dlist_init(&p->listeners);
@@ -339,7 +347,7 @@ evolution_mail_session_changed(EvolutionMailSession *ems, Evolution_Mail_Session
if (!e_mail_listener_emit(&p->listeners, (EMailListenerChanged)Evolution_Mail_SessionListener_changed,
bonobo_object_corba_objref((BonoboObject *)ems), changes)) {
- printf("No more listeners for store, could dispose session object now?\n");
+ w(printf("No more listeners for store, could dispose session object now?\n"));
}
}
diff --git a/plugins/mail-remote/evolution-mail-sessionlistener.c b/plugins/mail-remote/evolution-mail-sessionlistener.c
index addbe1a820..8e75f1df1e 100644
--- a/plugins/mail-remote/evolution-mail-sessionlistener.c
+++ b/plugins/mail-remote/evolution-mail-sessionlistener.c
@@ -30,6 +30,7 @@
#include "evolution-mail-sessionlistener.h"
#include "evolution-mail-marshal.h"
+#include "e-corba-utils.h"
#define PARENT_TYPE bonobo_object_get_type ()
@@ -64,7 +65,7 @@ impl_dispose (GObject *object)
static void
impl_finalize (GObject *object)
{
- printf("EvolutionMailSessionListener finalised!\n");
+ d(printf("EvolutionMailSessionListener finalised!\n"));
(* G_OBJECT_CLASS (parent_class)->finalize) (object);
}
@@ -96,11 +97,11 @@ impl_changed(PortableServer_Servant _servant,
EvolutionMailSessionListener *eml = (EvolutionMailSessionListener *)bonobo_object_from_servant(_servant);
int i, j;
- printf("session changed!\n");
+ d(printf("session changed!\n"));
for (i=0;i<changes->_length;i++) {
- printf(" %d %s", changes->_buffer[i].stores._length, change_type_name(changes->_buffer[i].type));
+ d(printf(" %d %s", changes->_buffer[i].stores._length, change_type_name(changes->_buffer[i].type)));
for (j=0;j<changes->_buffer[i].stores._length;j++) {
- printf(" %s %s\n", changes->_buffer[i].stores._buffer[j].uid, changes->_buffer[i].stores._buffer[j].name);
+ d(printf(" %s %s\n", changes->_buffer[i].stores._buffer[j].uid, changes->_buffer[i].stores._buffer[j].name));
}
}
@@ -114,7 +115,7 @@ impl_shutdown(PortableServer_Servant _servant,
{
EvolutionMailSessionListener *eml = (EvolutionMailSessionListener *)bonobo_object_from_servant(_servant);
- printf("session shutdown?\n");
+ d(printf("session shutdown?\n"));
g_signal_emit(eml, eml_signals[EML_SHUTDOWN], 0, session);
}
diff --git a/plugins/mail-remote/evolution-mail-store.c b/plugins/mail-remote/evolution-mail-store.c
index c5025900cb..0bd3624c6c 100644
--- a/plugins/mail-remote/evolution-mail-store.c
+++ b/plugins/mail-remote/evolution-mail-store.c
@@ -134,7 +134,7 @@ impl_getProperties(PortableServer_Servant _servant,
const CORBA_char *name = names->_buffer[i];
Evolution_Mail_Property *prop = &props->_buffer[i];
- printf("getting property '%s'\n", name);
+ d(printf("getting property '%s'\n", name));
if (!strcmp(name, "name")) {
e_mail_property_set_string(prop, name, evolution_mail_store_get_name(ems));
@@ -548,7 +548,7 @@ evolution_mail_store_new(struct _EvolutionMailSession *s, struct _EAccount *ea)
struct _EvolutionMailStorePrivate *p;
static PortableServer_POA poa = NULL;
- printf("EvolutionMailStore.new(\"%s\")\n", ea?ea->name:"local");
+ d(printf("EvolutionMailStore.new(\"%s\")\n", ea?ea->name:"local"));
if (poa == NULL)
poa = bonobo_poa_get_threaded (ORBIT_THREAD_HINT_PER_REQUEST, NULL);
@@ -660,6 +660,6 @@ evolution_mail_store_changed(EvolutionMailStore *ems, Evolution_Mail_StoreChange
if (!e_mail_listener_emit(&p->listeners, (EMailListenerChanged)Evolution_Mail_StoreListener_changed,
bonobo_object_corba_objref((BonoboObject *)ems), changes)) {
evolution_mail_store_close_store(ems);
- printf("No more listeners for store, could dispose store object now?\n");
+ w(printf("No more listeners for store, could dispose store object now?\n"));
}
}
diff --git a/plugins/mail-remote/evolution-mail-storelistener.c b/plugins/mail-remote/evolution-mail-storelistener.c
index 3d859383c0..c19c7b4b85 100644
--- a/plugins/mail-remote/evolution-mail-storelistener.c
+++ b/plugins/mail-remote/evolution-mail-storelistener.c
@@ -30,6 +30,7 @@
#include "evolution-mail-storelistener.h"
#include "evolution-mail-marshal.h"
+#include "e-corba-utils.h"
#define PARENT_TYPE bonobo_object_get_type ()
@@ -63,7 +64,7 @@ impl_dispose (GObject *object)
static void
impl_finalize (GObject *object)
{
- printf("EvolutionMailStoreListener finalised!\n");
+ d(printf("EvolutionMailStoreListener finalised!\n"));
(* G_OBJECT_CLASS (parent_class)->finalize) (object);
}
@@ -95,11 +96,11 @@ impl_changed(PortableServer_Servant _servant,
EvolutionMailStoreListener *eml = (EvolutionMailStoreListener *)bonobo_object_from_servant(_servant);
int i, j;
- printf("store changed!\n");
+ d(printf("store changed!\n"));
for (i=0;i<changes->_length;i++) {
- printf(" %d %s", changes->_buffer[i].folders._length, change_type_name(changes->_buffer[i].type));
+ d(printf(" %d %s", changes->_buffer[i].folders._length, change_type_name(changes->_buffer[i].type)));
for (j=0;j<changes->_buffer[i].folders._length;j++) {
- printf(" %s %s\n", changes->_buffer[i].folders._buffer[j].full_name, changes->_buffer[i].folders._buffer[j].name);
+ d(printf(" %s %s\n", changes->_buffer[i].folders._buffer[j].full_name, changes->_buffer[i].folders._buffer[j].name));
}
}
diff --git a/plugins/mail-remote/mail-remote.c b/plugins/mail-remote/mail-remote.c
index 7d082d3465..3c8eb7c988 100644
--- a/plugins/mail-remote/mail-remote.c
+++ b/plugins/mail-remote/mail-remote.c
@@ -5,6 +5,8 @@
#include "evolution-mail-session.h"
#include <bonobo/bonobo-main.h>
+#include "e-corba-utils.h"
+
struct _EPlugin;
struct _ESEventTargetUpgrade;
@@ -47,7 +49,7 @@ int e_plugin_lib_enable(int enable)
to retrieve it */
bonobo_object_add_interface((BonoboObject *)component, (BonoboObject *)sess);
- printf(" ** Added mail interface to mail component\n");
+ w(printf(" ** Added mail interface to mail component\n"));
} else {
/* can't easily disable this until restart? */
/* can we just destroy it? */