"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/libemail-engine/e-mail-session.c" between
evolution-3.32.4.tar.xz and evolution-3.34.0.tar.xz

About: Evolution is a personal information management application that provides integrated mail, calendaring and address book functionality (GNOME desktop).

e-mail-session.c  (evolution-3.32.4.tar.xz):e-mail-session.c  (evolution-3.34.0.tar.xz)
skipping to change at line 91 skipping to change at line 91
GPtrArray *local_folders; GPtrArray *local_folders;
GPtrArray *local_folder_uris; GPtrArray *local_folder_uris;
guint preparing_flush; guint preparing_flush;
guint outbox_flush_id; guint outbox_flush_id;
GMutex preparing_flush_lock; GMutex preparing_flush_lock;
GMutex used_services_lock; GMutex used_services_lock;
GCond used_services_cond; GCond used_services_cond;
GHashTable *used_services; GHashTable *used_services;
GMutex archive_folders_hash_lock;
GHashTable *archive_folders_hash; /* ESource::uid ~> archive folder URI *
/
}; };
struct _AsyncContext { struct _AsyncContext {
/* arguments */ /* arguments */
CamelStoreGetFolderFlags flags; CamelStoreGetFolderFlags flags;
gchar *uid; gchar *uid;
gchar *uri; gchar *uri;
/* results */ /* results */
CamelFolder *folder; CamelFolder *folder;
skipping to change at line 132 skipping to change at line 135
"Inbox" /* E_MAIL_LOCAL_FOLDER_LOCAL_INBOX */ "Inbox" /* E_MAIL_LOCAL_FOLDER_LOCAL_INBOX */
}; };
enum { enum {
FLUSH_OUTBOX, FLUSH_OUTBOX,
REFRESH_SERVICE, REFRESH_SERVICE,
STORE_ADDED, STORE_ADDED,
STORE_REMOVED, STORE_REMOVED,
ALLOW_AUTH_PROMPT, ALLOW_AUTH_PROMPT,
GET_RECIPIENT_CERTIFICATE, GET_RECIPIENT_CERTIFICATE,
ARCHIVE_FOLDER_CHANGED,
CONNECT_STORE, CONNECT_STORE,
LAST_SIGNAL LAST_SIGNAL
}; };
static guint signals[LAST_SIGNAL]; static guint signals[LAST_SIGNAL];
static gchar *mail_data_dir; static gchar *mail_data_dir;
static gchar *mail_cache_dir; static gchar *mail_cache_dir;
static gchar *mail_config_dir; static gchar *mail_config_dir;
skipping to change at line 354 skipping to change at line 358
} }
g_free (uid); g_free (uid);
} }
g_list_free_full (list, (GDestroyNotify) g_object_unref); g_list_free_full (list, (GDestroyNotify) g_object_unref);
return pop_uid; return pop_uid;
} }
typedef struct _ArchiveFolderChangedData {
GWeakRef *session;
gchar *service_uid;
gchar *old_folder_uri;
gchar *new_folder_uri;
} ArchiveFolderChangedData;
static void
archived_folder_changed_data_free (gpointer ptr)
{
ArchiveFolderChangedData *data = ptr;
if (data) {
e_weak_ref_free (data->session);
g_free (data->service_uid);
g_free (data->old_folder_uri);
g_free (data->new_folder_uri);
g_free (data);
}
}
static gboolean
mail_session_emit_archive_folder_changed_idle (gpointer user_data)
{
ArchiveFolderChangedData *data = user_data;
EMailSession *session;
g_return_val_if_fail (data != NULL, FALSE);
session = g_weak_ref_get (data->session);
if (session) {
g_signal_emit (session, signals[ARCHIVE_FOLDER_CHANGED], 0,
data->service_uid, data->old_folder_uri, data->new_folder
_uri);
g_object_unref (session);
}
return FALSE;
}
static void
mail_session_schedule_archive_folder_changed_locked (EMailSession *session,
const gchar *service_uid,
const gchar *old_folder_uri,
const gchar *new_folder_uri)
{
ArchiveFolderChangedData *data;
data = g_new0 (ArchiveFolderChangedData, 1);
data->session = e_weak_ref_new (session);
data->service_uid = g_strdup (service_uid);
data->old_folder_uri = g_strdup (old_folder_uri);
data->new_folder_uri = g_strdup (new_folder_uri);
g_idle_add_full (G_PRIORITY_LOW, mail_session_emit_archive_folder_changed
_idle,
data, archived_folder_changed_data_free);
}
static void
mail_session_remember_archive_folder (EMailSession *session,
const gchar *uid,
const gchar *folder_uri)
{
g_return_if_fail (E_IS_MAIL_SESSION (session));
g_return_if_fail (uid != NULL);
g_mutex_lock (&session->priv->archive_folders_hash_lock);
if (session->priv->archive_folders_hash) {
gchar *old_folder_uri;
old_folder_uri = g_strdup (g_hash_table_lookup (session->priv->ar
chive_folders_hash, uid));
if (g_strcmp0 (old_folder_uri, folder_uri) != 0) {
g_hash_table_insert (session->priv->archive_folders_hash,
g_strdup (uid), g_strdup (folder_uri));
mail_session_schedule_archive_folder_changed_locked (sess
ion, uid, old_folder_uri, folder_uri);
}
g_free (old_folder_uri);
}
g_mutex_unlock (&session->priv->archive_folders_hash_lock);
}
static void
mail_session_forget_archive_folder (EMailSession *session,
const gchar *uid)
{
g_return_if_fail (E_IS_MAIL_SESSION (session));
g_return_if_fail (uid != NULL);
g_mutex_lock (&session->priv->archive_folders_hash_lock);
if (session->priv->archive_folders_hash) {
gchar *old_folder_uri;
old_folder_uri = g_strdup (g_hash_table_lookup (session->priv->ar
chive_folders_hash, uid));
g_hash_table_remove (session->priv->archive_folders_hash, uid);
if (old_folder_uri && *old_folder_uri)
mail_session_schedule_archive_folder_changed_locked (sess
ion, uid, old_folder_uri, NULL);
g_free (old_folder_uri);
}
g_mutex_unlock (&session->priv->archive_folders_hash_lock);
}
static void
mail_session_archive_folder_notify_cb (ESourceExtension *extension,
GParamSpec *param,
EMailSession *session)
{
ESource *source;
g_return_if_fail (E_IS_MAIL_SESSION (session));
source = e_source_extension_ref_source (extension);
if (source) {
gchar *archive_folder;
archive_folder = e_source_mail_account_dup_archive_folder (E_SOUR
CE_MAIL_ACCOUNT (extension));
mail_session_remember_archive_folder (session, e_source_get_uid (
source), archive_folder);
g_free (archive_folder);
g_object_unref (source);
}
}
static void
mail_session_local_archive_folder_changed_cb (GSettings *settings,
const gchar *key,
EMailSession *session)
{
gchar *local_archive_folder;
g_return_if_fail (E_IS_MAIL_SESSION (session));
local_archive_folder = g_settings_get_string (settings, "local-archive-fo
lder");
mail_session_remember_archive_folder (session, E_MAIL_SESSION_LOCAL_UID,
local_archive_folder);
g_free (local_archive_folder);
}
static void static void
mail_session_refresh_cb (ESource *source, mail_session_refresh_cb (ESource *source,
EMailSession *session) EMailSession *session)
{ {
ESourceRegistry *registry; ESourceRegistry *registry;
CamelService *service; CamelService *service;
const gchar *uid; const gchar *uid;
registry = e_mail_session_get_registry (session); registry = e_mail_session_get_registry (session);
skipping to change at line 469 skipping to change at line 619
return; return;
/* Same deal for the [Ubuntu Online Accounts] extension. */ /* Same deal for the [Ubuntu Online Accounts] extension. */
if (mail_session_check_uoa_mail_disabled (session, source)) if (mail_session_check_uoa_mail_disabled (session, source))
return; return;
service = camel_session_add_service ( service = camel_session_add_service (
CAMEL_SESSION (session), uid, CAMEL_SESSION (session), uid,
backend_name, type, &error); backend_name, type, &error);
if (type == CAMEL_PROVIDER_STORE &&
e_source_has_extension (source, E_SOURCE_EXTENSION_MAIL_ACCOUNT)) {
ESourceMailAccount *extension;
gchar *archive_folder_uri;
extension = e_source_get_extension (source, E_SOURCE_EXTENSION_MA
IL_ACCOUNT);
archive_folder_uri = e_source_mail_account_dup_archive_folder (ex
tension);
mail_session_remember_archive_folder (session, e_source_get_uid (
source), archive_folder_uri);
g_free (archive_folder_uri);
g_signal_connect (extension, "notify::archive-folder",
G_CALLBACK (mail_session_archive_folder_notify_cb), sessi
on);
}
/* Our own CamelSession.add_service() method will handle the /* Our own CamelSession.add_service() method will handle the
* new CamelService, so we only need to unreference it here. */ * new CamelService, so we only need to unreference it here. */
if (service != NULL) if (service != NULL)
g_object_unref (service); g_object_unref (service);
if (error != NULL) { if (error != NULL) {
g_warning ( g_warning (
"Failed to add service '%s' (%s): %s", "Failed to add service '%s' (%s): %s",
display_name, uid, error->message); display_name, uid, error->message);
g_error_free (error); g_error_free (error);
skipping to change at line 536 skipping to change at line 700
{ {
CamelSession *camel_session; CamelSession *camel_session;
CamelService *service; CamelService *service;
const gchar *uid; const gchar *uid;
camel_session = CAMEL_SESSION (session); camel_session = CAMEL_SESSION (session);
uid = e_source_get_uid (source); uid = e_source_get_uid (source);
service = camel_session_ref_service (camel_session, uid); service = camel_session_ref_service (camel_session, uid);
if (e_source_has_extension (source, E_SOURCE_EXTENSION_MAIL_ACCOUNT)) {
ESourceMailAccount *extension;
extension = e_source_get_extension (source, E_SOURCE_EXTENSION_MA
IL_ACCOUNT);
g_signal_handlers_disconnect_by_func (extension,
G_CALLBACK (mail_session_archive_folder_notify_cb), sessi
on);
mail_session_forget_archive_folder (session, e_source_get_uid (so
urce));
}
if (service != NULL) { if (service != NULL) {
camel_session_remove_service (camel_session, service); camel_session_remove_service (camel_session, service);
g_object_unref (service); g_object_unref (service);
} }
} }
static void static void
mail_session_source_enabled_cb (ESourceRegistry *registry, mail_session_source_enabled_cb (ESourceRegistry *registry,
ESource *source, ESource *source,
EMailSession *session) EMailSession *session)
skipping to change at line 924 skipping to change at line 1099
return; return;
} }
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
} }
static void static void
mail_session_dispose (GObject *object) mail_session_dispose (GObject *object)
{ {
EMailSessionPrivate *priv; EMailSessionPrivate *priv;
GSettings *settings;
priv = E_MAIL_SESSION_GET_PRIVATE (object); priv = E_MAIL_SESSION_GET_PRIVATE (object);
if (priv->outbox_changed_handler_id) { if (priv->outbox_changed_handler_id) {
CamelFolder *folder; CamelFolder *folder;
folder = e_mail_session_get_local_folder (E_MAIL_SESSION (object) , E_MAIL_LOCAL_FOLDER_OUTBOX); folder = e_mail_session_get_local_folder (E_MAIL_SESSION (object) , E_MAIL_LOCAL_FOLDER_OUTBOX);
if (folder) if (folder)
g_signal_handler_disconnect (folder, priv->outbox_changed _handler_id); g_signal_handler_disconnect (folder, priv->outbox_changed _handler_id);
skipping to change at line 969 skipping to change at line 1145
if (priv->local_store != NULL) { if (priv->local_store != NULL) {
g_object_unref (priv->local_store); g_object_unref (priv->local_store);
priv->local_store = NULL; priv->local_store = NULL;
} }
if (priv->vfolder_store != NULL) { if (priv->vfolder_store != NULL) {
g_object_unref (priv->vfolder_store); g_object_unref (priv->vfolder_store);
priv->vfolder_store = NULL; priv->vfolder_store = NULL;
} }
g_mutex_lock (&priv->archive_folders_hash_lock);
if (priv->archive_folders_hash) {
if (priv->registry) {
GHashTableIter iter;
gpointer key;
g_hash_table_iter_init (&iter, priv->archive_folders_hash
);
while (g_hash_table_iter_next (&iter, &key, NULL)) {
ESource *source;
source = e_source_registry_ref_source (priv->regi
stry, key);
if (source) {
if (e_source_has_extension (source, E_SOU
RCE_EXTENSION_MAIL_ACCOUNT)) {
ESourceExtension *extension;
extension = e_source_get_extensio
n (source, E_SOURCE_EXTENSION_MAIL_ACCOUNT);
g_signal_handlers_disconnect_by_f
unc (extension,
G_CALLBACK (mail_session_
archive_folder_notify_cb), object);
}
g_object_unref (source);
}
}
}
g_hash_table_destroy (priv->archive_folders_hash);
priv->archive_folders_hash = NULL;
}
g_mutex_unlock (&priv->archive_folders_hash_lock);
if (priv->registry != NULL) { if (priv->registry != NULL) {
g_signal_handler_disconnect ( g_signal_handler_disconnect (
priv->registry, priv->registry,
priv->source_added_handler_id); priv->source_added_handler_id);
g_signal_handler_disconnect ( g_signal_handler_disconnect (
priv->registry, priv->registry,
priv->source_removed_handler_id); priv->source_removed_handler_id);
g_signal_handler_disconnect ( g_signal_handler_disconnect (
priv->registry, priv->registry,
priv->source_enabled_handler_id); priv->source_enabled_handler_id);
skipping to change at line 993 skipping to change at line 1201
priv->registry, priv->registry,
priv->default_mail_account_handler_id); priv->default_mail_account_handler_id);
/* This requires the registry. */ /* This requires the registry. */
mail_session_cancel_refresh (E_MAIL_SESSION (object)); mail_session_cancel_refresh (E_MAIL_SESSION (object));
g_object_unref (priv->registry); g_object_unref (priv->registry);
priv->registry = NULL; priv->registry = NULL;
} }
settings = e_util_ref_settings ("org.gnome.evolution.mail");
g_signal_handlers_disconnect_by_func (settings,
G_CALLBACK (mail_session_local_archive_folder_changed_cb), object
);
g_object_unref (settings);
/* Chain up to parent's dispose() method. */ /* Chain up to parent's dispose() method. */
G_OBJECT_CLASS (e_mail_session_parent_class)->dispose (object); G_OBJECT_CLASS (e_mail_session_parent_class)->dispose (object);
} }
static void static void
mail_session_finalize (GObject *object) mail_session_finalize (GObject *object)
{ {
EMailSessionPrivate *priv; EMailSessionPrivate *priv;
priv = E_MAIL_SESSION_GET_PRIVATE (object); priv = E_MAIL_SESSION_GET_PRIVATE (object);
g_hash_table_destroy (priv->auto_refresh_table); g_hash_table_destroy (priv->auto_refresh_table);
g_hash_table_destroy (priv->junk_filters); g_hash_table_destroy (priv->junk_filters);
g_hash_table_destroy (priv->used_services); g_hash_table_destroy (priv->used_services);
g_ptr_array_free (priv->local_folders, TRUE); g_ptr_array_free (priv->local_folders, TRUE);
g_ptr_array_free (priv->local_folder_uris, TRUE); g_ptr_array_free (priv->local_folder_uris, TRUE);
g_mutex_clear (&priv->preparing_flush_lock); g_mutex_clear (&priv->preparing_flush_lock);
g_mutex_clear (&priv->used_services_lock); g_mutex_clear (&priv->used_services_lock);
g_mutex_clear (&priv->archive_folders_hash_lock);
g_cond_clear (&priv->used_services_cond); g_cond_clear (&priv->used_services_cond);
g_free (mail_data_dir); g_free (mail_data_dir);
g_free (mail_config_dir); g_free (mail_config_dir);
/* Chain up to parent's finalize() method. */ /* Chain up to parent's finalize() method. */
G_OBJECT_CLASS (e_mail_session_parent_class)->finalize (object); G_OBJECT_CLASS (e_mail_session_parent_class)->finalize (object);
} }
static void static void
mail_session_constructed (GObject *object) mail_session_constructed (GObject *object)
{ {
EMailSession *session; EMailSession *session;
EExtensible *extensible; EExtensible *extensible;
ESourceRegistry *registry; ESourceRegistry *registry;
GType extension_type; GType extension_type;
GList *list, *link; GList *list, *link;
GSettings *settings; GSettings *settings;
CamelProviderType provider_type; CamelProviderType provider_type;
const gchar *extension_name; const gchar *extension_name;
gchar *local_archive_folder;
gulong handler_id; gulong handler_id;
session = E_MAIL_SESSION (object); session = E_MAIL_SESSION (object);
registry = e_mail_session_get_registry (session); registry = e_mail_session_get_registry (session);
/* Chain up to parent's constructed() method. */ /* Chain up to parent's constructed() method. */
G_OBJECT_CLASS (e_mail_session_parent_class)->constructed (object); G_OBJECT_CLASS (e_mail_session_parent_class)->constructed (object);
camel_session_set_network_monitor (CAMEL_SESSION (session), e_network_mon itor_get_default ()); camel_session_set_network_monitor (CAMEL_SESSION (session), e_network_mon itor_get_default ());
skipping to change at line 1169 skipping to change at line 1386
/* The application is not yet fully initialized at this point, /* The application is not yet fully initialized at this point,
* so run the first mail store refresh from an idle callback. */ * so run the first mail store refresh from an idle callback. */
if (g_settings_get_boolean (settings, "send-recv-on-start")) if (g_settings_get_boolean (settings, "send-recv-on-start"))
g_idle_add_full ( g_idle_add_full (
G_PRIORITY_DEFAULT, G_PRIORITY_DEFAULT,
(GSourceFunc) mail_session_idle_refresh_cb, (GSourceFunc) mail_session_idle_refresh_cb,
g_object_ref (session), g_object_ref (session),
(GDestroyNotify) g_object_unref); (GDestroyNotify) g_object_unref);
g_signal_connect (settings, "changed::local-archive-folder",
G_CALLBACK (mail_session_local_archive_folder_changed_cb), sessio
n);
local_archive_folder = g_settings_get_string (settings, "local-archive-fo
lder");
mail_session_remember_archive_folder (session, E_MAIL_SESSION_LOCAL_UID,
local_archive_folder);
g_free (local_archive_folder);
g_object_unref (settings); g_object_unref (settings);
} }
static CamelService * static CamelService *
mail_session_add_service (CamelSession *session, mail_session_add_service (CamelSession *session,
const gchar *uid, const gchar *uid,
const gchar *protocol, const gchar *protocol,
CamelProviderType type, CamelProviderType type,
GError **error) GError **error)
{ {
skipping to change at line 1329 skipping to change at line 1553
CamelFolder *folder, CamelFolder *folder,
CamelMimeMessage *message, CamelMimeMessage *message,
const gchar *address, const gchar *address,
GCancellable *cancellable, GCancellable *cancellable,
GError **error) GError **error)
{ {
EMailSessionPrivate *priv; EMailSessionPrivate *priv;
ESource *source; ESource *source;
ESourceRegistry *registry; ESourceRegistry *registry;
ESourceMailIdentity *extension; ESourceMailIdentity *extension;
ESourceMailSubmission *mail_submission;
CamelMimeMessage *forward; CamelMimeMessage *forward;
CamelStream *mem; CamelStream *mem;
CamelInternetAddress *addr; CamelInternetAddress *addr;
CamelFolder *out_folder; CamelFolder *out_folder;
CamelMessageInfo *info; CamelMessageInfo *info;
CamelMedium *medium; CamelMedium *medium;
CamelNameValueArray *orig_headers;
GString *references = NULL;
const gchar *extension_name; const gchar *extension_name;
const gchar *from_address; const gchar *from_address;
const gchar *from_name; const gchar *from_name;
const gchar *header_name; const gchar *reply_to, *message_id, *sent_folder = NULL, *transport_uid;
gboolean success; gboolean success;
gchar *subject; gchar *subject;
gchar *alias_name = NULL, *alias_address = NULL; gchar *alias_name = NULL, *alias_address = NULL;
guint ii, len;
g_return_val_if_fail (folder != NULL, FALSE); g_return_val_if_fail (folder != NULL, FALSE);
g_return_val_if_fail (message != NULL, FALSE); g_return_val_if_fail (message != NULL, FALSE);
g_return_val_if_fail (address != NULL, FALSE); g_return_val_if_fail (address != NULL, FALSE);
priv = E_MAIL_SESSION_GET_PRIVATE (session); priv = E_MAIL_SESSION_GET_PRIVATE (session);
if (!*address) { if (!*address) {
g_set_error ( g_set_error (
error, CAMEL_ERROR, CAMEL_ERROR_GENERIC, error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
skipping to change at line 1383 skipping to change at line 1611
from_name = alias_name; from_name = alias_name;
from_address = alias_address; from_address = alias_address;
} else { } else {
from_name = e_source_mail_identity_get_name (extension); from_name = e_source_mail_identity_get_name (extension);
from_address = e_source_mail_identity_get_address (extension); from_address = e_source_mail_identity_get_address (extension);
} }
if (!from_name || !*from_name) if (!from_name || !*from_name)
from_name = e_source_mail_identity_get_name (extension); from_name = e_source_mail_identity_get_name (extension);
reply_to = e_source_mail_identity_get_reply_to (extension);
forward = camel_mime_message_new (); forward = camel_mime_message_new ();
/* make copy of the message, because we are going to modify it */ /* make copy of the message, because we are going to modify it */
mem = camel_stream_mem_new (); mem = camel_stream_mem_new ();
camel_data_wrapper_write_to_stream_sync ( camel_data_wrapper_write_to_stream_sync (
CAMEL_DATA_WRAPPER (message), mem, NULL, NULL); CAMEL_DATA_WRAPPER (message), mem, NULL, NULL);
g_seekable_seek (G_SEEKABLE (mem), 0, G_SEEK_SET, NULL, NULL); g_seekable_seek (G_SEEKABLE (mem), 0, G_SEEK_SET, NULL, NULL);
camel_data_wrapper_construct_from_stream_sync ( camel_data_wrapper_construct_from_stream_sync (
CAMEL_DATA_WRAPPER (forward), mem, NULL, NULL); CAMEL_DATA_WRAPPER (forward), mem, NULL, NULL);
g_object_unref (mem); g_object_unref (mem);
/* clear previous recipients */
camel_mime_message_set_recipients (
forward, CAMEL_RECIPIENT_TYPE_TO, NULL);
camel_mime_message_set_recipients (
forward, CAMEL_RECIPIENT_TYPE_CC, NULL);
camel_mime_message_set_recipients (
forward, CAMEL_RECIPIENT_TYPE_BCC, NULL);
camel_mime_message_set_recipients (
forward, CAMEL_RECIPIENT_TYPE_RESENT_TO, NULL);
camel_mime_message_set_recipients (
forward, CAMEL_RECIPIENT_TYPE_RESENT_CC, NULL);
camel_mime_message_set_recipients (
forward, CAMEL_RECIPIENT_TYPE_RESENT_BCC, NULL);
medium = CAMEL_MEDIUM (forward); medium = CAMEL_MEDIUM (forward);
/* remove all delivery and notification headers */ message_id = camel_mime_message_get_message_id (message);
header_name = "Disposition-Notification-To"; if (message_id && *message_id) {
while (camel_medium_get_header (medium, header_name)) references = g_string_sized_new (128);
camel_medium_remove_header (medium, header_name);
if (*message_id != '<')
header_name = "Delivered-To"; g_string_append_c (references, '<');
while (camel_medium_get_header (medium, header_name))
camel_medium_remove_header (medium, header_name); g_string_append (references, message_id);
if (*message_id != '<')
g_string_append_c (references, '>');
}
/* Remove all but content describing headers and Subject */
orig_headers = camel_medium_dup_headers (medium);
len = camel_name_value_array_get_length (orig_headers);
for (ii = 0; ii < len; ii++) {
const gchar *header_name = NULL, *header_value = NULL;
if (!camel_name_value_array_get (orig_headers, ii, &header_name,
&header_value) || !header_name)
continue;
if (g_ascii_strncasecmp (header_name, "Content-", 8) != 0 &&
g_ascii_strcasecmp (header_name, "Subject") != 0) {
if (g_ascii_strcasecmp (header_name, "References") == 0)
{
if (header_value && *header_value) {
if (!references)
references = g_string_sized_new (
128);
if (references->len)
g_string_append_c (references, '
');
g_string_append (references, header_value
);
}
}
camel_medium_remove_header (medium, header_name);
}
}
camel_name_value_array_free (orig_headers);
/* remove any X-Evolution-* headers that may have been set */ if (references) {
camel_name_value_array_free (mail_tool_remove_xevolution_headers (forward gchar *unfolded;
));
unfolded = camel_header_unfold (references->str);
if (unfolded && *unfolded)
camel_medium_add_header (medium, "References", unfolded);
g_string_free (references, TRUE);
g_free (unfolded);
}
/* reply-to */
if (reply_to && *reply_to) {
addr = camel_internet_address_new ();
if (camel_address_unformat (CAMEL_ADDRESS (addr), reply_to) > 0)
camel_mime_message_set_reply_to (forward, addr);
g_object_unref (addr);
}
/* from */ /* from */
addr = camel_internet_address_new (); addr = camel_internet_address_new ();
camel_internet_address_add (addr, from_name, from_address); camel_internet_address_add (addr, from_name, from_address);
camel_mime_message_set_from (forward, addr); camel_mime_message_set_from (forward, addr);
g_object_unref (addr); g_object_unref (addr);
/* to */ /* to */
addr = camel_internet_address_new (); addr = camel_internet_address_new ();
camel_address_decode (CAMEL_ADDRESS (addr), address); camel_address_decode (CAMEL_ADDRESS (addr), address);
camel_mime_message_set_recipients ( camel_mime_message_set_recipients (
forward, CAMEL_RECIPIENT_TYPE_TO, addr); forward, CAMEL_RECIPIENT_TYPE_TO, addr);
g_object_unref (addr); g_object_unref (addr);
/* subject */ /* subject */
subject = mail_tool_generate_forward_subject (message); subject = mail_tool_generate_forward_subject (message);
camel_mime_message_set_subject (forward, subject); camel_mime_message_set_subject (forward, subject);
g_free (subject); g_free (subject);
/* store send account information */
mail_submission = e_source_get_extension (source, E_SOURCE_EXTENSION_MAIL
_SUBMISSION);
if (e_source_mail_submission_get_use_sent_folder (mail_submission))
sent_folder = e_source_mail_submission_get_sent_folder (mail_subm
ission);
transport_uid = e_source_mail_submission_get_transport_uid (mail_submissi
on);
camel_medium_set_header (medium, "X-Evolution-Identity", e_source_get_uid
(source));
camel_medium_set_header (medium, "X-Evolution-Fcc", sent_folder);
camel_medium_set_header (medium, "X-Evolution-Transport", transport_uid);
/* and send it */ /* and send it */
info = camel_message_info_new (NULL); info = camel_message_info_new (NULL);
out_folder = e_mail_session_get_local_folder ( out_folder = e_mail_session_get_local_folder (
E_MAIL_SESSION (session), E_MAIL_LOCAL_FOLDER_OUTBOX); E_MAIL_SESSION (session), E_MAIL_LOCAL_FOLDER_OUTBOX);
camel_message_info_set_flags ( camel_message_info_set_flags (
info, CAMEL_MESSAGE_SEEN, CAMEL_MESSAGE_SEEN); info, CAMEL_MESSAGE_SEEN, CAMEL_MESSAGE_SEEN);
success = e_mail_folder_append_message_sync ( success = e_mail_folder_append_message_sync (
out_folder, forward, info, NULL, cancellable, error); out_folder, forward, info, NULL, cancellable, error);
skipping to change at line 1896 skipping to change at line 2173
G_OBJECT_CLASS_TYPE (object_class), G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_ACTION, G_SIGNAL_ACTION,
G_STRUCT_OFFSET (EMailSessionClass, get_recipient_certificate), G_STRUCT_OFFSET (EMailSessionClass, get_recipient_certificate),
NULL, NULL, NULL, NULL,
NULL, NULL,
G_TYPE_STRING, 2, G_TYPE_STRING, 2,
G_TYPE_UINT, G_TYPE_UINT,
G_TYPE_STRING); G_TYPE_STRING);
/** /**
* EMailSession::archive-folder-changed
* @session: the #EMailSession that emitted the signal
* @service_uid: UID of a #CamelService, whose archive folder setting cha
nged
* @old_folder_uri: (nullable): an old archive folder URI, or %NULL, when
none had been set already
* @new_folder_uri: (nullable): a new archive folder URI, or %NULL, when
none had been set
*
* Notifies about changes in archive folders setup.
*
* Since: 3.34
**/
signals[ARCHIVE_FOLDER_CHANGED] = g_signal_new (
"archive-folder-changed",
G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (EMailSessionClass, archive_folder_changed),
NULL, NULL,
NULL,
G_TYPE_NONE, 3,
G_TYPE_STRING,
G_TYPE_STRING,
G_TYPE_STRING);
/**
* EMailSession::connect-store * EMailSession::connect-store
* @session: the #EMailSession that emitted the signal * @session: the #EMailSession that emitted the signal
* @store: a #CamelStore * @store: a #CamelStore
* *
* This signal is emitted with e_mail_session_emit_connect_store() to let * This signal is emitted with e_mail_session_emit_connect_store() to let
* any listeners know to connect the given @store. * any listeners know to connect the given @store.
* *
* Since: 3.32.3 * Since: 3.34
**/ **/
signals[CONNECT_STORE] = g_signal_new ( signals[CONNECT_STORE] = g_signal_new (
"connect-store", "connect-store",
G_OBJECT_CLASS_TYPE (object_class), G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_FIRST, G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (EMailSessionClass, connect_store), G_STRUCT_OFFSET (EMailSessionClass, connect_store),
NULL, NULL, NULL, NULL,
g_cclosure_marshal_VOID__OBJECT, g_cclosure_marshal_VOID__OBJECT,
G_TYPE_NONE, 1, G_TYPE_NONE, 1,
CAMEL_TYPE_STORE); CAMEL_TYPE_STORE);
skipping to change at line 1948 skipping to change at line 2248
session->priv->folder_cache = mail_folder_cache_new (); session->priv->folder_cache = mail_folder_cache_new ();
session->priv->auto_refresh_table = auto_refresh_table; session->priv->auto_refresh_table = auto_refresh_table;
session->priv->junk_filters = junk_filters; session->priv->junk_filters = junk_filters;
session->priv->local_folders = session->priv->local_folders =
g_ptr_array_new_with_free_func ( g_ptr_array_new_with_free_func (
(GDestroyNotify) g_object_unref); (GDestroyNotify) g_object_unref);
session->priv->local_folder_uris = session->priv->local_folder_uris =
g_ptr_array_new_with_free_func ( g_ptr_array_new_with_free_func (
(GDestroyNotify) g_free); (GDestroyNotify) g_free);
session->priv->archive_folders_hash =
g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
g_mutex_init (&session->priv->preparing_flush_lock); g_mutex_init (&session->priv->preparing_flush_lock);
g_mutex_init (&session->priv->used_services_lock); g_mutex_init (&session->priv->used_services_lock);
g_mutex_init (&session->priv->archive_folders_hash_lock);
g_cond_init (&session->priv->used_services_cond); g_cond_init (&session->priv->used_services_cond);
session->priv->used_services = g_hash_table_new (g_direct_hash, g_direct_ equal); session->priv->used_services = g_hash_table_new (g_direct_hash, g_direct_ equal);
} }
EMailSession * EMailSession *
e_mail_session_new (ESourceRegistry *registry) e_mail_session_new (ESourceRegistry *registry)
{ {
const gchar *user_data_dir; const gchar *user_data_dir;
const gchar *user_cache_dir; const gchar *user_cache_dir;
skipping to change at line 2728 skipping to change at line 3031
e_mail_session_emit_allow_auth_prompt (EMailSession *session, e_mail_session_emit_allow_auth_prompt (EMailSession *session,
ESource *source) ESource *source)
{ {
g_return_if_fail (E_IS_MAIL_SESSION (session)); g_return_if_fail (E_IS_MAIL_SESSION (session));
g_return_if_fail (E_IS_SOURCE (source)); g_return_if_fail (E_IS_SOURCE (source));
g_signal_emit (session, signals[ALLOW_AUTH_PROMPT], 0, source); g_signal_emit (session, signals[ALLOW_AUTH_PROMPT], 0, source);
} }
/** /**
* e_mail_session_is_archive_folder:
* @session: an #EMailSession
* @folder_uri: a folder URI
*
* Returns: whether the @folder_uri is one of configured archive folders
*
* Since: 3.34
**/
gboolean
e_mail_session_is_archive_folder (EMailSession *session,
const gchar *folder_uri)
{
CamelSession *camel_session;
GHashTableIter iter;
gpointer value;
gboolean is_archive_folder = FALSE;
g_return_val_if_fail (E_IS_MAIL_SESSION (session), FALSE);
if (!folder_uri || !*folder_uri)
return FALSE;
camel_session = CAMEL_SESSION (session);
g_mutex_lock (&session->priv->archive_folders_hash_lock);
g_hash_table_iter_init (&iter, session->priv->archive_folders_hash);
while (!is_archive_folder && g_hash_table_iter_next (&iter, NULL, &value)
) {
const gchar *uri = value;
if (uri && *uri)
is_archive_folder = e_mail_folder_uri_equal (camel_sessio
n, folder_uri, uri);
}
g_mutex_unlock (&session->priv->archive_folders_hash_lock);
return is_archive_folder;
}
/**
* e_mail_session_emit_connect_store: * e_mail_session_emit_connect_store:
* @session: an #EMailSession * @session: an #EMailSession
* @store: a #CamelStore * @store: a #CamelStore
* *
* Emits 'connect-store' on @session for @store. This lets * Emits 'connect-store' on @session for @store. This lets
* any listeners know to connect the @store. * any listeners know to connect the @store.
* *
* Since: 3.32.3 * Since: 3.34
**/ **/
void void
e_mail_session_emit_connect_store (EMailSession *session, e_mail_session_emit_connect_store (EMailSession *session,
CamelStore *store) CamelStore *store)
{ {
g_return_if_fail (E_IS_MAIL_SESSION (session)); g_return_if_fail (E_IS_MAIL_SESSION (session));
g_return_if_fail (CAMEL_IS_STORE (store)); g_return_if_fail (CAMEL_IS_STORE (store));
g_signal_emit (session, signals[CONNECT_STORE], 0, store); g_signal_emit (session, signals[CONNECT_STORE], 0, store);
} }
 End of changes. 26 change blocks. 
28 lines changed or deleted 413 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)