| Camel Reference Manual | ||||
|---|---|---|---|---|
struct CamelSession;gboolean (*CamelTimeoutCallback) (gpointer data); enum CamelSessionAlertType; CamelSessionThreadOps; CamelSessionThreadMsg;void camel_session_construct (CamelSession *session, constgchar *storage_path); CamelService * camel_session_get_service (CamelSession *session, constgchar *url_string, CamelProviderType type, CamelException *ex); CamelService * camel_session_get_service_connected (CamelSession *session, constgchar *url_string, CamelProviderType type, CamelException *ex); #define camel_session_get_store (session, url_string, ex) #define camel_session_get_transport (session, url_string, ex)gchar * camel_session_get_storage_path (CamelSession *session, CamelService *service, CamelException *ex);gchar * camel_session_get_password (CamelSession *session, CamelService *service, constgchar *domain, constgchar *prompt, constgchar *item,guint32 flags, CamelException *ex);void camel_session_forget_password (CamelSession *session, CamelService *service, constgchar *domain, constgchar *item, CamelException *ex);gboolean camel_session_alert_user (CamelSession *session, CamelSessionAlertType type, constgchar *prompt,gboolean cancel);gchar * camel_session_build_password_prompt (constgchar *type, constgchar *user, constgchar *host);gboolean camel_session_is_online (CamelSession *session);void camel_session_set_online (CamelSession *session,gboolean online); CamelFilterDriver * camel_session_get_filter_driver (CamelSession *session, constgchar *type, CamelException *ex);gboolean camel_session_check_junk (CamelSession *session);void camel_session_set_check_junk (CamelSession *session,gboolean check_junk);gpointer camel_session_thread_msg_new (CamelSession *session, CamelSessionThreadOps *ops,guint size);void camel_session_thread_msg_free (CamelSession *session, CamelSessionThreadMsg *msg);gint camel_session_thread_queue (CamelSession *session, CamelSessionThreadMsg *msg,gint flags);void camel_session_thread_wait (CamelSession *session,gint id);gboolean camel_session_get_network_state (CamelSession *session);void camel_session_set_network_state (CamelSession *session,gboolean network_state); constGHashTable * camel_session_get_junk_headers (CamelSession *session);void camel_session_set_junk_headers (CamelSession *session, constgchar **headers, constgchar **values,gint len);gboolean camel_session_lookup_addressbook (CamelSession *session, constgchar *name);void camel_session_forward_to (CamelSession *session,struct _CamelFolder *folder,struct _CamelMimeMessage *message, constgchar *address, CamelException *ex);
struct CamelSession {
CamelObject parent_object;
struct _CamelSessionPrivate *priv;
gchar *storage_path;
CamelJunkPlugin *junk_plugin;
guint online:1;
guint check_junk:1;
guint network_state:1;
};
typedef enum {
CAMEL_SESSION_ALERT_INFO,
CAMEL_SESSION_ALERT_WARNING,
CAMEL_SESSION_ALERT_ERROR
} CamelSessionAlertType;
typedef struct {
void (*receive)(CamelSession *session, struct _CamelSessionThreadMsg *m);
void (*free)(CamelSession *session, struct _CamelSessionThreadMsg *m);
} CamelSessionThreadOps;
typedef struct {
CamelMsg msg;
gint id;
CamelException ex;
CamelSessionThreadOps *ops;
struct _CamelOperation *op;
CamelSession *session;
gpointer data; /* free for implementation to define, not used by camel, do not use in client code */
/* user fields follow */
} CamelSessionThreadMsg;
void camel_session_construct (CamelSession *session, constgchar *storage_path);
Constructs session.
|
a CamelSession object to construct |
|
path to a directory the session can use for persistent storage. (This directory must already exist.) |
CamelService * camel_session_get_service (CamelSession *session, constgchar *url_string, CamelProviderType type, CamelException *ex);
This resolves a CamelURL into a CamelService, including loading the provider library for that service if it has not already been loaded.
Services are cached, and asking for "the same" url_string multiple
times will return the same CamelService (with its reference count
incremented by one each time). What constitutes "the same" URL
depends in part on the provider.
|
a CamelSession object |
|
a CamelURL describing the service to get |
|
the provider type ( |
|
a CamelException |
Returns : |
the requested CamelService, or NULL |
CamelService * camel_session_get_service_connected (CamelSession *session, constgchar *url_string, CamelProviderType type, CamelException *ex);
This works like camel_session_get_service, but also ensures that the returned service will have been successfully connected (via camel_service_connect.)
|
a CamelSession object |
|
a CamelURL describing the service to get |
|
the provider type |
|
a CamelException |
Returns : |
the requested CamelService, or NULL |
#define camel_session_get_store(session, url_string, ex)
|
|
|
|
|
#define camel_session_get_transport(session, url_string, ex)
|
|
|
|
|
gchar * camel_session_get_storage_path (CamelSession *session, CamelService *service, CamelException *ex);
This returns the path to a directory which the service can use for its own purposes. Data stored there will remain between Evolution sessions. No code outside of that service should ever touch the files in this directory. If the directory does not exist, it will be created.
|
a CamelSession object |
|
a CamelService |
|
a CamelException |
Returns : |
the path (which the caller must free), or NULL |
gchar * camel_session_get_password (CamelSession *session, CamelService *service, constgchar *domain, constgchar *prompt, constgchar *item,guint32 flags, CamelException *ex);
This function is used by a CamelService to ask the application and the user for a password or other authentication data.
service and item together uniquely identify the piece of data the
caller is concerned with.
prompt is a question to ask the user (if the application doesn't
already have the answer cached). If
If
The authenticator should set ex to
|
a CamelSession object |
|
the CamelService this query is being made by |
|
domain of password request. May be null to use the default. |
|
prompt to provide to user |
|
an identifier, unique within this service, for the information |
|
|
|
a CamelException |
Returns : |
the authentication information or NULL |
void camel_session_forget_password (CamelSession *session, CamelService *service, constgchar *domain, constgchar *item, CamelException *ex);
This function is used by a CamelService to tell the application that the authentication information it provided via camel_session_get_password was rejected by the service. If the application was caching this information, it should stop, and if the service asks for it again, it should ask the user.
service and item identify the rejected authentication information,
as with camel_session_get_password.
|
a CamelSession object |
|
the CamelService rejecting the password |
|
|
|
an identifier, unique within this service, for the information |
|
a CamelException |
gboolean camel_session_alert_user (CamelSession *session, CamelSessionAlertType type, constgchar *prompt,gboolean cancel);
Presents the given prompt to the user, in the style indicated by
type. If cancel is TRUE
|
a CamelSession object |
|
the type of alert (info, warning, or error) |
|
the message for the user |
|
whether or not to provide a "Cancel" option in addition to an "OK" option. |
Returns : |
TRUEFALSE |
gchar * camel_session_build_password_prompt (constgchar *type, constgchar *user, constgchar *host);
Constructs a localized password prompt from type, user and host,
suitable for passing to camel_session_get_password(). The resulting
string contains markup tags. Use g_free()
|
account type (e.g. "IMAP") |
|
user name for the account |
|
host name for the account |
Returns : |
a newly-allocated password prompt string |
gboolean camel_session_is_online (CamelSession *session);
|
a CamelSession object |
Returns : |
whether or not session is online
|
void camel_session_set_online (CamelSession *session,gboolean online);
Sets the online status of session to online.
|
a CamelSession object |
|
whether or not the session should be online |
CamelFilterDriver * camel_session_get_filter_driver (CamelSession *session, constgchar *type, CamelException *ex);
|
a CamelSession object |
|
the type of filter (eg, "incoming") |
|
a CamelException |
Returns : |
a filter driver, loaded with applicable rules |
gboolean camel_session_check_junk (CamelSession *session);
Do we have to check incoming messages to be junk?
|
a CamelSession object |
Returns : |
whether or not we are checking incoming messages for junk |
void camel_session_set_check_junk (CamelSession *session,gboolean check_junk);
Set check_junk flag, if set, incoming mail will be checked for being junk.
|
a CamelSession object |
|
state |
gpointer camel_session_thread_msg_new (CamelSession *session, CamelSessionThreadOps *ops,guint size);
Create a new thread message, using ops as the receive/reply/free
ops, of size bytes.
ops points to the operations used to recieve/process and finally
free the message.
|
a CamelSession object |
|
thread operations |
|
number of bytes |
Returns : |
a new CamelSessionThreadMsg |
void camel_session_thread_msg_free (CamelSession *session, CamelSessionThreadMsg *msg);
Free a msg. Note that the message must have been allocated using
msg_new, and must nto have been submitted to any queue function.
|
a CamelSession object |
|
a CamelSessionThreadMsg |
gint camel_session_thread_queue (CamelSession *session, CamelSessionThreadMsg *msg,gint flags);
Queue a thread message in another thread for processing. The operation should be (but needn't) run in a queued manner with other operations queued in this manner.
|
a CamelSession object |
|
a CamelSessionThreadMsg |
|
queue type flags, currently 0. |
Returns : |
the id of the operation queued |
void camel_session_thread_wait (CamelSession *session,gint id);
Wait on an operation to complete (by id).
|
a CamelSession object |
|
id of the operation to wait on |
gboolean camel_session_get_network_state (CamelSession *session);
|
|
Returns : |
void camel_session_set_network_state (CamelSession *session,gboolean network_state);
|
|
|
constGHashTable * camel_session_get_junk_headers (CamelSession *session);
|
|
Returns : |
void camel_session_set_junk_headers (CamelSession *session, constgchar **headers, constgchar **values,gint len);
|
|
|
|
|
|
|
gboolean camel_session_lookup_addressbook (CamelSession *session, constgchar *name);
|
|
|
|
Returns : |
void camel_session_forward_to (CamelSession *session,struct _CamelFolder *folder,struct _CamelMimeMessage *message, constgchar *address, CamelException *ex);
|
|
|
|
|
|
|
|
|