From d31092e263286b346d5ecc36a5f06932fe545d79 Mon Sep 17 00:00:00 2001 From: Michael Zucci Date: Thu, 12 May 2005 11:25:45 +0000 Subject: Now compiles, with a test client too. svn path=/trunk/; revision=29338 --- plugins/mail-remote/mail-remote.c | 49 ++++++++++++++++++++++++++++----------- 1 file changed, 35 insertions(+), 14 deletions(-) (limited to 'plugins/mail-remote/mail-remote.c') diff --git a/plugins/mail-remote/mail-remote.c b/plugins/mail-remote/mail-remote.c index 369a38da2b..6ee41f6c9d 100644 --- a/plugins/mail-remote/mail-remote.c +++ b/plugins/mail-remote/mail-remote.c @@ -1,31 +1,52 @@ +#include +#include + #include "evolution-mail-session.h" #include #define MAIL_SESSION_ID "OAFIID:GNOME_Evolution_Mail_Session:" BASE_VERSION -init() +int e_plugin_lib_enable(int enable); + +int e_plugin_lib_enable(int enable) { static EvolutionMailSession *sess; - /* placeholder for EvolutionMailSession registration, this must use a different poa */ - if (sess == NULL) { + char *path; + FILE *fp; + + if (enable) { static PortableServer_POA poa = NULL; - int res; - CORBA_Object existing; + CORBA_string ior; + CORBA_Environment ev = { 0 }; + + if (sess != NULL) + return 0; if (poa == NULL) poa = bonobo_poa_get_threaded (ORBIT_THREAD_HINT_PER_REQUEST, NULL); - sess = g_object_new(evolution_mail_session_get_type(), NULL); //"poa", poa, NULL); + sess = g_object_new(evolution_mail_session_get_type(), "poa", poa, NULL); + ior = CORBA_ORB_object_to_string(bonobo_orb(), bonobo_object_corba_objref((BonoboObject *)sess), &ev); - if ((res = bonobo_activation_register_active_server_ext(MAIL_SESSION_ID, bonobo_object_corba_objref((BonoboObject *)sess), NULL, - Bonobo_REGISTRATION_FLAG_NO_SERVERINFO, &existing, NULL)) != Bonobo_ACTIVATION_REG_SUCCESS) { - g_warning("Could not register Mail EDS Interface: %d", res); - g_object_unref(sess); - sess = NULL; - } + path = g_build_filename(g_get_home_dir(), ".evolution-mail-remote.ior", NULL); + fp = fopen(path, "w"); + fprintf(fp, "%s", ior); + fclose(fp); + g_free(path); - if (existing != CORBA_OBJECT_NIL) - CORBA_Object_release(existing, NULL); + printf("Enable mail-remote: IOR=%s\n", ior); + } else { + if (sess == NULL) + return 0; + + path = g_build_filename(g_get_home_dir(), ".evolution-mail-remote.ior", NULL); + unlink(path); + g_free(path); + + g_object_unref(sess); + sess = NULL; } + + return 0; } -- cgit v1.2.3