Re: [Evolution-hackers] [Camel] How can I get a reference to the store class from another class?

2005-10-10 Thread Jules Colding
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 +, Jules Colding  wrote:
   On Tue, 2005-09-13 at 04:08 -0600, Susarla Parthasarathi wrote:
On Tue, 2005-09-13 at 09:56 +, 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


___
Evolution-hackers mailing list
Evolution-hackers@gnome.org
http://mail.gnome.org/mailman/listinfo/evolution-hackers


Re: [Evolution-hackers] [Camel] How can I get a reference to the store class from another class?

2005-09-14 Thread Not Zed

 I should always call the parent class's connect method at the start of
 my own connect() implementation???
 
 Now I am really confused. I can't see any of the other Camel providers
 calling the parent connect() in their own connect() implementation in
 the store or transport classes.

Well, if you're using disco-store, it's a bit different and it does
things for you, otherwise yeah you probably should.

Not that it actually does anything mind you ... 


___
Evolution-hackers mailing list
Evolution-hackers@gnome.org
http://mail.gnome.org/mailman/listinfo/evolution-hackers


Re: [Evolution-hackers] [Camel] How can I get a reference to the store class from another class?

2005-09-13 Thread Not Zed

Well, I guess you call it ;-)

Really if you want to share connections like this you need to have some
other struct/object to represent the session, and share them between the
two objects.

Another alternative which might be easier is to have the transport just
get the corresponding store from the session; camel-provider should
handle the store resolution properly and then you can just connect/use
that itself.

I've considered merging the transport/store objects for just this
purpose, but currently this is not the case.


On Tue, 2005-09-13 at 11:56 +0200, 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?
 
 Thanks,
   jules
 
 
 ___
 Evolution-hackers mailing list
 Evolution-hackers@gnome.org
 http://mail.gnome.org/mailman/listinfo/evolution-hackers
-- 
adfa(evolution-2.4:20087): gtkhtml-WARNING **: cannot find icon:
'stock_insert-url' in gnome 

___
Evolution-hackers mailing list
Evolution-hackers@gnome.org
http://mail.gnome.org/mailman/listinfo/evolution-hackers