TnyCamelAccount

TnyCamelAccount — A abstract account type implemented for Camel

Synopsis




#define             TNY_TYPE_CAMEL_ACCOUNT
#define             TNY_CAMEL_ACCOUNT                   (obj)
#define             TNY_CAMEL_ACCOUNT_CLASS             (vtable)
#define             TNY_IS_CAMEL_ACCOUNT                (obj)
#define             TNY_CAMEL_ACCOUNT_GET_CLASS         (inst)
void                (*TnyCamelSetOnlineCallback)        (TnyCamelAccount *account,
                                                         gboolean canceled,
                                                         GError *err,
                                                         gpointer user_data);
                    TnyCamelAccount;
void                tny_camel_account_add_option        (TnyCamelAccount *self,
                                                         const gchar *option);
void                tny_camel_account_set_session       (TnyCamelAccount *self,
                                                         TnySessionCamel *session);
void                tny_camel_account_set_online        (TnyCamelAccount *self,
                                                         gboolean online,
                                                         TnyCamelSetOnlineCallback callback,
                                                         gpointer user_data);
void                (*TnyCamelGetSupportedSecureAuthCallback)
                                                        (TnyCamelAccount *self,
                                                         gboolean cancelled,
                                                         TnyList *auth_types,
                                                         GError *err,
                                                         gpointer user_data);
void                tny_camel_account_get_supported_secure_authentication
                                                        (TnyCamelAccount *self,
                                                         TnyCamelGetSupportedSecureAuthCallback callback,
                                                         TnyStatusCallback status_callback,
                                                         gpointer user_data);

Object Hierarchy


  GObject
   +----TnyCamelAccount
         +----TnyCamelStoreAccount
         +----TnyCamelTransportAccount

Implemented Interfaces

TnyCamelAccount implements TnyAccount.

Signals


  "set-online-happened"                            : Run First

Description

A abstract account type implemented for Camel

Details

TNY_TYPE_CAMEL_ACCOUNT

#define TNY_TYPE_CAMEL_ACCOUNT             (tny_camel_account_get_type ())


TNY_CAMEL_ACCOUNT()

#define TNY_CAMEL_ACCOUNT(obj)             (G_TYPE_CHECK_INSTANCE_CAST ((obj), TNY_TYPE_CAMEL_ACCOUNT, TnyCamelAccount))

obj :

TNY_CAMEL_ACCOUNT_CLASS()

#define TNY_CAMEL_ACCOUNT_CLASS(vtable)    (G_TYPE_CHECK_CLASS_CAST ((vtable), TNY_TYPE_CAMEL_ACCOUNT, TnyCamelAccountClass))

vtable :

TNY_IS_CAMEL_ACCOUNT()

#define TNY_IS_CAMEL_ACCOUNT(obj)          (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TNY_TYPE_CAMEL_ACCOUNT))

obj :

TNY_CAMEL_ACCOUNT_GET_CLASS()

#define TNY_CAMEL_ACCOUNT_GET_CLASS(inst)  (G_TYPE_INSTANCE_GET_CLASS ((inst), TNY_TYPE_CAMEL_ACCOUNT, TnyCamelAccountClass))

inst :

TnyCamelSetOnlineCallback ()

void                (*TnyCamelSetOnlineCallback)        (TnyCamelAccount *account,
                                                         gboolean canceled,
                                                         GError *err,
                                                         gpointer user_data);

account :
canceled :
err :
user_data :

TnyCamelAccount

typedef struct _TnyCamelAccount TnyCamelAccount;


tny_camel_account_add_option ()

void                tny_camel_account_add_option        (TnyCamelAccount *self,
                                                         const gchar *option);

Add a Camel option to this TnyCamelAccount instance.

An often used option is the use_ssl one. For example "use_ssl=wrapped" or "use_ssl=tls" are the typical options added. Other possibilities for the "use_ssl" option are "never" and "when-possible":

use_ssl=wrapped will wrap the connection on default port 993 with IMAP and defualt port 995 with POP3 with SSL or also called "imaps" or "pops".

use_ssl=tls will connect using default port 143 for IMAP and 110 for POP and requires support for STARTTLS, which is often a command for letting the connection be or become encrypted in IMAP and POP3 servers.

use_ssl=when-possible will try to do a STARTTLS, but will fallback to a non encrypted session if it fails (not recommended, as your users will want SSL if they require this security for their accounts).

use_ssl=never will forcefully make sure that no SSL is to be used.

One option for some accounts (like the IMAP accounts) is idle_delay. The parameter is the amount of seconds that you want to wait for the IDLE state to be stopped. Stopping the IDLE state will make the server flush all the pending events for the IDLE state. This improve responsibility of the Push E-mail and expunge events, although it will cause a little bit more continuous bandwidth consumption (each delayth second). For example idle_delay=20. The defualt value is 20.

Another option is getsrv_delay, also for IMAP accounts, which allows you to specify the delay before the connection that gets created for receiving uncached messages gets shut down. If this service is not yet shut down, then it'll be reused. Else a new one will be created that will be kept around for delay seconds (in the hopes that new requests will happen). Keeping a socket open for a long period of time might not be ideal for some situations, but closing it very quickly will let almost each request create a new connection with the IMAP server. Which is why you can play with the value yourself. For example getsrv_delay=100. The default value is 100.

self : a TnyCamelAccount object
option : a "key=value" Camel option

tny_camel_account_set_session ()

void                tny_camel_account_set_session       (TnyCamelAccount *self,
                                                         TnySessionCamel *session);

Set the TnySessionCamel session this account will use

self : a TnyCamelAccount object
session : a TnySessionCamel object

tny_camel_account_set_online ()

void                tny_camel_account_set_online        (TnyCamelAccount *self,
                                                         gboolean online,
                                                         TnyCamelSetOnlineCallback callback,
                                                         gpointer user_data);

Set the connectivity status of an account. Setting this to FALSE means that the account will not attempt to use the network, and will use only the cache. Setting this to TRUE means that the account may use the network to provide up-to-date information.

The callback will be invoke as soon as the account is actually online. It's guaranteed that the callback will happen in the mainloop, if available.

This is a cancelable operation which means that if another cancelable operation executes, this operation will be aborted. Being aborted means that the callback will still be called, but with cancelled=TRUE.

Only one instance of tny_camel_account_set_online for folder self can run at the same time. If you call for another, the first will be aborted. This means that it's callback will be called with cancelled=TRUE. If the TnyDevice's online state changes while operation is taking place, the behaviour is undefined. Although the callback will always happen and in that case with cancelled=TRUE.

self : a TnyCamelAccount object
online : whether or not the account is online
callback : a callback when the account went online
user_data : user data for the callback

TnyCamelGetSupportedSecureAuthCallback ()

void                (*TnyCamelGetSupportedSecureAuthCallback)
                                                        (TnyCamelAccount *self,
                                                         gboolean cancelled,
                                                         TnyList *auth_types,
                                                         GError *err,
                                                         gpointer user_data);

The callback for tny_camel_account_get_supported_secure_authentication().

self : The TnyCamelAccount on which tny_camel_account_get_supported_secure_authentication() was called.
cancelled : Whether the operation was cancelled.
auth_types : A TnyList of TnyPair objects. Each TnyPair in the list has a supported secure authentication method name as its name. This list must be freed with g_object_unref().
err : A GError if an error occurred, or NULL.
user_data : The user data that was provided to tny_camel_account_get_supported_secure_authentication().

tny_camel_account_get_supported_secure_authentication ()

void                tny_camel_account_get_supported_secure_authentication
                                                        (TnyCamelAccount *self,
                                                         TnyCamelGetSupportedSecureAuthCallback callback,
                                                         TnyStatusCallback status_callback,
                                                         gpointer user_data);

Query the server for the list of supported secure authentication mechanisms. The TnyCamelAccount must have a valid hostname and the port number must be set if appropriate. The returned strings may be used as parameters to tny_account_set_secure_auth_mech().

self : a TnyCamelAccount object.
callback : A function to be called when the operation is complete.
status_callback : A function to be called one or more times while the operation is in progress.
user_data : Data to be passed to the callback and status callback.

Signal Details

The "set-online-happened" signal

void                user_function                      (TnyCamelAccount *self,
                                                        gboolean         online,
                                                        gpointer         user_data)      : Run First

Emitted when tny_camel_account_set_online happened

self : the object on which the signal is emitted
online : whether it was online
user_data : user data set when the signal handler was connected.
user_data : user data set when the signal handler was connected.

See Also

TnyAccount