diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2011-05-13 04:57:37 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2011-05-13 06:24:42 +0800 |
commit | 6ae1b3fe3c4dfd391de92bfca42e44ff7cc8fe19 (patch) | |
tree | 83baf88eed47f8934e3a4243d6a1112fffe7b660 /mail | |
parent | 58a6db9875d58d1bc7458cd049304e82e113205a (diff) | |
download | gsoc2013-evolution-6ae1b3fe3c4dfd391de92bfca42e44ff7cc8fe19.tar.gz gsoc2013-evolution-6ae1b3fe3c4dfd391de92bfca42e44ff7cc8fe19.tar.zst gsoc2013-evolution-6ae1b3fe3c4dfd391de92bfca42e44ff7cc8fe19.zip |
em_utils_reply_to_message(): Require a CamelMimeMessage.
No more fetching a message itself. Oh, and stop unreffing the message.
Those kinds of insane semantics are what lead to crashes.
Diffstat (limited to 'mail')
-rw-r--r-- | mail/e-mail-reader-utils.c | 6 | ||||
-rw-r--r-- | mail/e-mail-reader.c | 7 | ||||
-rw-r--r-- | mail/em-composer-utils.c | 74 | ||||
-rw-r--r-- | mail/em-composer-utils.h | 4 |
4 files changed, 15 insertions, 76 deletions
diff --git a/mail/e-mail-reader-utils.c b/mail/e-mail-reader-utils.c index 1da1a65084..6ed50b1742 100644 --- a/mail/e-mail-reader-utils.c +++ b/mail/e-mail-reader-utils.c @@ -612,16 +612,18 @@ e_mail_reader_reply_to_message (EMailReader *reader, g_object_unref (src_message); em_utils_reply_to_message ( - shell, folder, uid, new_message, + shell, new_message, folder, uid, reply_type, reply_style, NULL); + g_object_unref (new_message); + g_free (selection); return; whole_message: em_utils_reply_to_message ( - shell, folder, uid, src_message, + shell, src_message, folder, uid, reply_type, reply_style, EM_FORMAT (formatter)); } diff --git a/mail/e-mail-reader.c b/mail/e-mail-reader.c index 315e6b91c1..673a5b206f 100644 --- a/mail/e-mail-reader.c +++ b/mail/e-mail-reader.c @@ -1122,9 +1122,6 @@ action_mail_reply_all_check (CamelFolder *folder, if (!message) return; - /* get_message_free () will unref the message, so we need to take an - extra ref for e_mail_reader_reply_to_message () to own. */ - g_object_ref (message); to = camel_mime_message_get_recipients (message, CAMEL_RECIPIENT_TYPE_TO); cc = camel_mime_message_get_recipients (message, CAMEL_RECIPIENT_TYPE_CC); @@ -1291,10 +1288,6 @@ action_mail_reply_sender_check (CamelFolder *folder, munged_list_message = em_utils_is_munged_list_message (message); - /* get_message_free () will unref the message, so we need to take an - extra ref for e_mail_reader_reply_to_message () to own. */ - g_object_ref (message); - /* Don't do the "Are you sure you want to reply in private?" pop-up if it's a Reply-To: munged list message... unless we're ignoring munging */ if (ask_ignore_list_reply_to || !munged_list_message) { diff --git a/mail/em-composer-utils.c b/mail/em-composer-utils.c index 654144b6f8..a8208dc225 100644 --- a/mail/em-composer-utils.c +++ b/mail/em-composer-utils.c @@ -2672,13 +2672,6 @@ composer_set_body (EMsgComposer *composer, g_object_unref (client); } -struct _reply_data { - EShell *shell; - EMFormat *source; - EMailReplyType reply_type; - EMailReplyStyle reply_style; -}; - gchar * em_utils_construct_composer_text (CamelMimeMessage *message, EMFormat *source) { @@ -2694,56 +2687,26 @@ em_utils_construct_composer_text (CamelMimeMessage *message, EMFormat *source) return text; } -static void -reply_to_message (CamelFolder *folder, - const gchar *uid, - CamelMimeMessage *message, - gpointer user_data) -{ - struct _reply_data *rd = user_data; - - if (message != NULL) { - /* get_message_free() will also unref the message, so we need - an extra ref for em_utils_reply_to_message () to drop. */ - g_object_ref (message); - em_utils_reply_to_message ( - rd->shell, folder, uid, message, - rd->reply_type, rd->reply_style, rd->source); - } - - if (rd->shell != NULL) - g_object_unref (rd->shell); - - if (rd->source != NULL) - g_object_unref (rd->source); - - g_free (rd); -} - /** * em_utils_reply_to_message: * @shell: an #EShell - * @folder: optional folder - * @uid: optional uid - * @message: message to reply to, optional + * @message: a #CamelMimeMessage + * @folder: a #CamelFolder, or %NULL + * @message_uid: the UID of @message, or %NULL * @type: the type of reply to create * @style: the reply style to use * @source: source to inherit view settings from * * Creates a new composer ready to reply to @message. * - * If @message is NULL then @folder and @uid must be set to the - * message to be replied to, it will be loaded asynchronously. - * - * If @message is non null, then it is used directly, @folder and @uid - * may be supplied in order to update the message flags once it has - * been replied to. Note that @message will be unreferenced on completion. + * @folder and @message_uid may be supplied in order to update the message + * flags once it has been replied to. **/ EMsgComposer * em_utils_reply_to_message (EShell *shell, - CamelFolder *folder, - const gchar *uid, CamelMimeMessage *message, + CamelFolder *folder, + const gchar *message_uid, EMailReplyType type, EMailReplyStyle style, EMFormat *source) @@ -2755,24 +2718,7 @@ em_utils_reply_to_message (EShell *shell, guint32 flags; g_return_val_if_fail (E_IS_SHELL (shell), NULL); - - if (folder && uid && message == NULL) { - struct _reply_data *rd = g_malloc0 (sizeof (*rd)); - - rd->shell = g_object_ref (shell); - rd->reply_type = type; - rd->reply_style = style; - rd->source = source; - if (rd->source) - g_object_ref (rd->source); - mail_get_message ( - folder, uid, reply_to_message, - rd, mail_msg_unordered_push); - - return NULL; - } - - g_return_val_if_fail (message != NULL, NULL); + g_return_val_if_fail (CAMEL_IS_MIME_MESSAGE (message), NULL); to = camel_internet_address_new (); cc = camel_internet_address_new (); @@ -2818,15 +2764,13 @@ em_utils_reply_to_message (EShell *shell, composer_set_body (composer, message, style, source); - g_object_unref (message); - if (folder != NULL) { gchar *folder_uri; folder_uri = e_mail_folder_uri_from_folder (folder); e_msg_composer_set_source_headers ( - composer, folder_uri, uid, flags); + composer, folder_uri, message_uid, flags); g_free (folder_uri); } diff --git a/mail/em-composer-utils.h b/mail/em-composer-utils.h index 7a0d2d7511..be76148764 100644 --- a/mail/em-composer-utils.h +++ b/mail/em-composer-utils.h @@ -76,9 +76,9 @@ void em_utils_get_reply_all (CamelMimeMessage *message, CamelInternetAddress *cc, CamelNNTPAddress *postto); EMsgComposer * em_utils_reply_to_message (EShell *shell, - CamelFolder *folder, - const gchar *uid, CamelMimeMessage *message, + CamelFolder *folder, + const gchar *message_uid, EMailReplyType type, EMailReplyStyle style, EMFormat *source); |