Connecting got a little bit better



I decided to review connecting a little bit. Bringing it a lot closer to
some day asynchronously connecting.

You now also have a tny_account_set_port and a tny_account_try_connect
public API. Though the try_connect is handled internally by the session
too.

Normally should the try_connect's errors be handler by the alert
function implementation of your account store. The idea is that this
alert implementation will indeed be used once asynchronous connecting is
implemented (otherwise, there's not really another way to know about
connection errors that happened in the worker thread).

There's four phases to connecting now. 


First the account must be prepared, which is something libtinymail-camel
handles fully internally while you are setting its properties in your
account store.

Then the session must be globally set to online (and I have no idea why,
I should check in camel-lite's code I guess)

Then the accounts must be try-connected.

Then the accounts's DISCO stores must be set online. This will let the
code path be in such a way that the "online" implementations of the
functions of CamelFolder will be used and that the status of the
camel-lite types is "online". This of course implies errors when it's
not really online, and only-reading-from-the-cache if it's offline.


The last two phases should someday become asynchronous. The problem, of
course, is that the last two ones invoke the get_pass and the forget-
pass functions in their thread. Those can be implemented using gtk+
code.


-- 
Philip Van Hoof, software developer
home: me at pvanhoof dot be 
gnome: pvanhoof at gnome dot org 
http://www.pvanhoof.be/blog







[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]