![]() |
![]() |
![]() |
Camel Reference Manual | ![]() |
---|---|---|---|---|
Top | Description | Object Hierarchy | Properties | Signals |
struct CamelSession; enum CamelSessionAlertType; constgchar * camel_session_get_user_data_dir (CamelSession *session
); constgchar * camel_session_get_user_cache_dir (CamelSession *session
);void camel_session_get_socks_proxy (CamelSession *session
,const
,gchar *for_host,
gchar **host_ret); CamelService * camel_session_add_service (
gint *port_retCamelSession *session
,const
,gchar *uidconst
,gchar *protocolCamelProviderType type
,);
GError **errorgboolean camel_session_remove_service (CamelSession *session
,const
); CamelService * camel_session_get_service (gchar *uidCamelSession *session
,const
); CamelService * camel_session_get_service_by_url (gchar *uidCamelSession *session
,CamelURL *url
,CamelProviderType type
);GList * camel_session_list_services (CamelSession *session
);void camel_session_remove_services (CamelSession *session
);gchar * camel_session_get_password (CamelSession *session
,CamelService *service
,const
,gchar *promptconst
,gchar *item,
guint32 flags);
GError **errorgboolean camel_session_forget_password (CamelSession *session
,CamelService *service
,const
,gchar *item);
GError **errorgint camel_session_alert_user (CamelSession *session
,CamelSessionAlertType type
,const
,gchar *prompt);
GSList *button_captionsgchar * camel_session_build_password_prompt (const
,gchar *typeconst
,gchar *userconst
);gchar *hostgboolean camel_session_get_online (CamelSession *session
);void camel_session_set_online (CamelSession *session
,); CamelFilterDriver * camel_session_get_filter_driver (
gboolean onlineCamelSession *session
,const
,gchar *type);
GError **errorgboolean camel_session_get_check_junk (CamelSession *session
);void camel_session_set_check_junk (CamelSession *session
,); CamelJunkFilter * camel_session_get_junk_filter (
gboolean check_junkCamelSession *session
);void camel_session_set_junk_filter (CamelSession *session
,CamelJunkFilter *junk_filter
);void (*CamelSessionCallback) (CamelSession *session
,,
GCancellable *cancellable,
gpointer user_data);
GError **errorvoid camel_session_submit_job (CamelSession *session
,CamelSessionCallback callback
,,
gpointer user_data);
GDestroyNotify notifygboolean camel_session_get_network_available (CamelSession *session
);void camel_session_set_network_available (CamelSession *session
,); const
gboolean network_availableGHashTable * camel_session_get_junk_headers (CamelSession *session
);void camel_session_set_junk_headers (CamelSession *session
,const
,gchar **headersconst
,gchar **values);
gint lengboolean camel_session_lookup_addressbook (CamelSession *session
,const
);gchar *namegboolean camel_session_forward_to (CamelSession *session
,CamelFolder *folder
,CamelMimeMessage *message
,const
,gchar *address); enum CamelSessionLock;
GError **errorvoid camel_session_lock (CamelSession *session
,CamelSessionLock lock
);void camel_session_unlock (CamelSession *session
,CamelSessionLock lock
);gboolean camel_session_authenticate_sync (CamelSession *session
,CamelService *service
,const
,gchar *mechanism,
GCancellable *cancellable);
GError **errorvoid camel_session_authenticate (CamelSession *session
,CamelService *service
,const
,gchar *mechanism,
gint io_priority,
GCancellable *cancellable,
GAsyncReadyCallback callback);
gpointer user_datagboolean camel_session_authenticate_finish (CamelSession *session
,,
GAsyncResult *result);
GError **error
"check-junk"gboolean : Read / Write / Construct "junk-filter" CamelJunkFilter* : Read / Write "network-available"gboolean : Read / Write / Construct "online"gboolean : Read / Write / Construct "user-cache-dir"gchar * : Read / Write / Construct "user-data-dir"gchar * : Read / Write / Construct
typedef enum { CAMEL_SESSION_ALERT_INFO, CAMEL_SESSION_ALERT_WARNING, CAMEL_SESSION_ALERT_ERROR } CamelSessionAlertType;
constgchar * camel_session_get_user_data_dir (CamelSession *session
);
Returns the base directory under which to store user-specific mail data.
|
a CamelSession |
Returns : |
the base directory for mail data |
Since 3.2
constgchar * camel_session_get_user_cache_dir (CamelSession *session
);
Returns the base directory under which to store user-specific mail cache.
|
a CamelSession |
Returns : |
the base directory for mail cache |
Since 3.4
void camel_session_get_socks_proxy (CamelSession *session
,const
,gchar *for_host,
gchar **host_ret);
gint *port_ret
Queries the SOCKS proxy that is configured for a session
. This will
put NULL
hosts_ret
if there is no proxy configured or when
the for_host
is listed in proxy ignore list.
|
A CamelSession |
|
Host name to which the connection will be requested |
|
Location to return the SOCKS proxy hostname |
|
Location to return the SOCKS proxy port |
Since 2.32
CamelService * camel_session_add_service (CamelSession *session
,const
,gchar *uidconst
,gchar *protocolCamelProviderType type
,);
GError **error
Instantiates a new CamelService for session
. The uid
identifies the
service for future lookup. The protocol
indicates which CamelProvider
holds the type
explicitly designates the service as a CamelStore or CamelTransport.
If the given uid
has already been added, the existing CamelService
with that uid
is returned regardless of whether it agrees with the
given protocol
and type
.
If no CamelProvider is available to handle the given protocol
, or
if the CamelProvider does not specify a valid type
, the
function sets error
and returns NULL
|
a CamelSession |
|
a unique identifier string |
|
the service protocol |
|
the service type |
|
return location for a NULL |
Returns : |
a CamelService instance, or NULL |
Since 3.2
gboolean camel_session_remove_service (CamelSession *session
,const
);gchar *uid
Removes previously added CamelService by camel_session_add_service()
.
Internally stored CamelService is unreffed, if found.
|
a CamelSession |
|
a unique identifier for CamelService to remove |
Returns : |
TRUE uid was found and removed,
FALSE |
Since 3.2
CamelService * camel_session_get_service (CamelSession *session
,const
);gchar *uid
Looks up a CamelService by its unique identifier string. The service
must have been previously added using camel_session_add_service()
.
|
a CamelSession |
|
a unique identifier string |
Returns : |
a CamelService instance, or NULL |
CamelService * camel_session_get_service_by_url (CamelSession *session
,CamelURL *url
,CamelProviderType type
);
Looks up a CamelService by trying to match its CamelURL against the
given url
and then checking that the object is of the desired type
.
The service must have been previously added using
camel_session_add_service()
.
Note this function is significantly slower than camel_session_get_service()
.
|
a CamelSession |
|
a CamelURL |
|
a CamelProviderType |
Returns : |
a CamelService instance, or NULL |
Since 3.2
GList * camel_session_list_services (CamelSession *session
);
Returns a list of all CamelService objects previously added using
camel_session_add_service()
. Free the returned list using g_list_free()
|
a CamelSession |
Returns : |
an unsorted list of CamelService objects |
Since 3.2
void camel_session_remove_services (CamelSession *session
);
Removes all CamelService instances added by camel_session_add_service()
.
This can be useful during application shutdown to ensure all CamelService instances are freed properly, especially since CamelSession instances are prone to reference cycles.
|
a CamelSession |
Since 3.2
gchar * camel_session_get_password (CamelSession *session
,CamelService *service
,const
,gchar *promptconst
,gchar *item,
guint32 flags);
GError **error
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 CAMEL_SESSION_PASSWORD_SECRET
If CAMEL_SESSION_PASSWORD_STATIC
The authenticator should set error
to G_IO_ERROR_CANCELLED
g_free()
|
a CamelSession |
|
the CamelService this query is being made by |
|
prompt to provide to user |
|
an identifier, unique within this service, for the information |
|
CAMEL_SESSION_PASSWORD_REPROMPT CAMEL_SESSION_PASSWORD_SECRET CAMEL_SESSION_PASSWORD_STATIC |
|
return location for a NULL |
Returns : |
the authentication information or NULL |
gboolean camel_session_forget_password (CamelSession *session
,CamelService *service
,const
,gchar *item);
GError **error
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 |
|
the CamelService rejecting the password |
|
an identifier, unique within this service, for the information |
|
return location for a NULL |
Returns : |
TRUE FALSE |
gint camel_session_alert_user (CamelSession *session
,CamelSessionAlertType type
,const
,gchar *prompt);
GSList *button_captions
Presents the given prompt
to the user, in the style indicated by
type
. If cancel
is TRUE
|
a CamelSession |
|
the type of alert (info, warning, or error) |
|
the message for the user |
|
List of button captions to use. If NULL, only "Dismiss" button is shown. |
Returns : |
Index of pressed button from button_captions , -1 if NULL. |
gchar * camel_session_build_password_prompt (const
,gchar *typeconst
,gchar *userconst
);gchar *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 |
Since 2.22
gboolean camel_session_get_online (CamelSession *session
);
|
a CamelSession |
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 |
|
whether or not the session should be online |
CamelFilterDriver * camel_session_get_filter_driver (CamelSession *session
,const
,gchar *type);
GError **error
|
a CamelSession |
|
the type of filter (eg, "incoming") |
|
return location for a NULL |
Returns : |
a filter driver, loaded with applicable rules |
gboolean camel_session_get_check_junk (CamelSession *session
);
Do we have to check incoming messages to be junk?
|
a CamelSession |
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 |
|
whether to check incoming messages for junk |
CamelJunkFilter * camel_session_get_junk_filter (CamelSession *session
);
Returns the CamelJunkFilter instance used to classify messages as junk or not junk during filtering.
Note that CamelJunkFilter itself is just an interface. The application must implement the interface and install a CamelJunkFilter instance for junk filtering to take place.
|
a CamelSession |
Returns : |
a CamelJunkFilter, or NULL |
Since 3.2
void camel_session_set_junk_filter (CamelSession *session
,CamelJunkFilter *junk_filter
);
Installs the CamelJunkFilter instance used to classify messages as junk or not junk during filtering.
Note that CamelJunkFilter itself is just an interface. The application must implement the interface and install a CamelJunkFilter instance for junk filtering to take place.
|
a CamelSession |
|
a CamelJunkFilter, or NULL |
Since 3.2
void (*CamelSessionCallback) (CamelSession *session
,,
GCancellable *cancellable,
gpointer user_data);
GError **error
This is the callback signature for jobs submitted to the CamelSession
via camel_session_submit_job()
. The error
pointer is always non-NULL
|
a CamelSession |
|
a CamelOperation cast as a |
|
data passed to camel_session_submit_job()
|
|
return location for a |
Since 3.2
void camel_session_submit_job (CamelSession *session
,CamelSessionCallback callback
,,
gpointer user_data);
GDestroyNotify notify
This function provides a simple mechanism for providers to initiate low-priority background jobs. Jobs can be submitted from any thread, but execution of the jobs is always as follows:
1) The session
was created. This is typically the same thread
that hosts the global default
2) The callback
function is invoked from a different thread where
it's safe to call synchronous functions.
3) Once callback
has returned, the
4) Finally if a notify
function was provided, it is invoked and
passed user_data
so that user_data
can be freed.
|
a CamelSession |
|
a CamelSessionCallback |
|
user data passed to the callback |
|
a |
Since 3.2
gboolean camel_session_get_network_available (CamelSession *session
);
|
a CamelSession |
Since 2.32
void camel_session_set_network_available (CamelSession *session
,);
gboolean network_available
|
a CamelSession |
|
whether a network is available |
Since 2.32
constGHashTable * camel_session_get_junk_headers (CamelSession *session
);
Since 2.22
void camel_session_set_junk_headers (CamelSession *session
,const
,gchar **headersconst
,gchar **values);
gint len
Since 2.22
gboolean camel_session_lookup_addressbook (CamelSession *session
,const
);gchar *name
Since 2.22
gboolean camel_session_forward_to (CamelSession *session
,CamelFolder *folder
,CamelMimeMessage *message
,const
,gchar *address);
GError **error
Since 2.26
typedef enum { CAMEL_SESSION_SESSION_LOCK, CAMEL_SESSION_THREAD_LOCK } CamelSessionLock;
Since 2.32
void camel_session_lock (CamelSession *session
,CamelSessionLock lock
);
Locks session
's lock
. Unlock it with camel_session_unlock()
.
|
a CamelSession |
|
lock type to lock |
Since 2.32
void camel_session_unlock (CamelSession *session
,CamelSessionLock lock
);
Unlocks session
's lock
, previously locked with camel_session_lock()
.
|
a CamelSession |
|
lock type to unlock |
Since 2.32
gboolean camel_session_authenticate_sync (CamelSession *session
,CamelService *service
,const
,gchar *mechanism,
GCancellable *cancellable);
GError **error
Authenticates service
, which may involve repeated calls to
camel_service_authenticate()
or camel_service_authenticate_sync()
.
A CamelSession subclass is largely responsible for implementing this,
and should handle things like user prompts and secure password storage.
These issues are out-of-scope for Camel.
If an error occurs, or if authentication is aborted, the function sets
error
and returns FALSE
|
a CamelSession |
|
a CamelService |
|
a SASL mechanism name, or NULL |
|
optional NULL |
|
return location for a NULL |
Returns : |
TRUE FALSE |
Since 3.4
void camel_session_authenticate (CamelSession *session
,CamelService *service
,const
,gchar *mechanism,
gint io_priority,
GCancellable *cancellable,
GAsyncReadyCallback callback);
gpointer user_data
Asynchronously authenticates service
, which may involve repeated calls
to camel_service_authenticate()
or camel_service_authenticate_sync()
.
A CamelSession subclass is largely responsible for implementing this,
and should handle things like user prompts and secure password storage.
These issues are out-of-scope for Camel.
When the operation is finished, callback
will be called. You can
then call camel_session_authenticate_finish()
to get the result of
the operation.
|
a CamelSession |
|
a CamelService |
|
a SASL mechanism name, or NULL |
|
the I/O priority for the request |
|
optional NULL |
|
a |
|
data to pass to the callback function |
Since 3.4
gboolean camel_session_authenticate_finish (CamelSession *session
,,
GAsyncResult *result);
GError **error
Finishes the operation started with camel_session_authenticate()
.
If an error occurred, or if authentication was aborted, the function
sets error
and returns FALSE
|
a CamelSession |
|
a |
|
return location for a NULL |
Returns : |
TRUE FALSE |
Since 3.4
"check-junk"
property"check-junk"gboolean : Read / Write / Construct
Check incoming messages for junk.
Default value: FALSE
"junk-filter"
property"junk-filter" CamelJunkFilter* : Read / Write
Classifies messages as junk or not junk.
"network-available"
property"network-available"gboolean : Read / Write / Construct
Whether the network is available.
Default value: TRUE
"online"
property"online"gboolean : Read / Write / Construct
Whether the shell is online.
Default value: TRUE
"user-cache-dir"
property"user-cache-dir"gchar * : Read / Write / Construct
User-specific base directory for mail cache.
Default value: NULL
"job-finished"
signalvoid user_function (CamelSession *camelsession,GCancellable *arg1,gpointer arg2,gpointer user_data) :Run Last
"job-started"
signalvoid user_function (CamelSession *camelsession,GCancellable *arg1,gpointer user_data) :Run Last