Re: [Evolution-hackers] [Camel] How can I get a reference to the store class from another class?
- From: Jules Colding <colding omesc com>
- To: Not Zed <notzed ximian com>
- Cc: evolution-hackers gnome org
- Subject: Re: [Evolution-hackers] [Camel] How can I get a reference to the store class from another class?
- Date: Mon, 10 Oct 2005 12:05:26 +0200
On Tue, 2005-09-13 at 22:15 +0800, Not Zed wrote:
> On Tue, 2005-09-13 at 04:31 -0600, Susarla Parthasarathi wrote:
> > On Tue, 2005-09-13 at 10:26 +0000, Jules Colding wrote:
> > > On Tue, 2005-09-13 at 04:08 -0600, Susarla Parthasarathi wrote:
> > > > On Tue, 2005-09-13 at 09:56 +0000, Jules Colding wrote:
> > > > > Hi,
> > > > >
> > > > > There is a connect method in the transport class. I would like to use
> > > > > the connect method that I implemented in the store class. How do I get a
> > > > > reference to that one from a CamelService?
> > > > If you want to use the same session, just implementing the send_to
> > > > method should do.
> > > > You could get the service object from CamelTransport and further get the
> > > > pointer to the CamelStore. Getting a session from the store should be
> > > > easy.
> > >
> > > Something like:
> > >
> > > CAMEL_SERVICE_CLASS(parent_class)->connect(service, ex);
> > >
> > > from within the transport connect() method?
> > >
> > yup. you could do it. Should be no problem. Guess its a clean way to do
> > it.
>
> Partha, what are you saying here?
>
> parent_class.connect() will only call the super-class method.
>
> Transport doesn't derive from Store, they both derive from Service.
>
> So if you want to share the connect() implementation from both classes,
> then it must be implemented in a sharable manner, and not separately.
I just noticed this recently added wiki entry:
http://go-evolution.org/Camel.Transport#Example:_Sending_a_message
where camel_service_connect() is used. It looks very much like
camel_service_connect() is using the inherited Camel store connect()
method:
############## snip ###############
trans = (CamelTransport *)camel_session_get_service(session, "smtp://localhost/", ex);
if (camel_exception_is_set(ex))
return;
camel_service_connect(trans, ex);
if (camel_exception_is_set(ex))
goto noconnect;
############## snip ###############
and from camel-service.c:
ret = CSERV_CLASS (service)->connect (service, ex);
Can the camel_service_connect() method be used from the transport class
to invoke the provider specific Camel store connect() method or am I
totally off here once again?
Thanks,
jules
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]