[balsa] Avoid warning messages



commit c2ba48de25dec06a5a1180a4e676a08b485271e4
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date:   Wed Mar 3 18:39:29 2010 -0500

    Avoid warning messages
    
    	* libbalsa/message.c (libbalsa_message_change_flags): check
    	argument validity.
    	* libbalsa/send.c (handle_successful_send): check that the
    	message still belongs to a mailbox.

 ChangeLog          |    7 +++++++
 libbalsa/message.c |    4 ++++
 libbalsa/send.c    |    9 +++++----
 3 files changed, 16 insertions(+), 4 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 7102328..2d997ba 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 2010-03-03  Peter Bloomfield
 
+	* libbalsa/message.c (libbalsa_message_change_flags): check
+	argument validity.
+	* libbalsa/send.c (handle_successful_send): check that the
+	message still belongs to a mailbox.
+
+2010-03-03  Peter Bloomfield
+
 	* libbalsa/address-view.c (libbalsa_address_view_get_list): do
 	not append NULL list in internet_address_list_append.
 
diff --git a/libbalsa/message.c b/libbalsa/message.c
index 1f65c9d..eded049 100644
--- a/libbalsa/message.c
+++ b/libbalsa/message.c
@@ -608,6 +608,10 @@ libbalsa_message_change_flags(LibBalsaMessage * message,
                               LibBalsaMessageFlag set,
                               LibBalsaMessageFlag clear)
 {
+    g_return_if_fail(LIBBALSA_IS_MESSAGE(message));
+    g_return_if_fail(LIBBALSA_IS_MAILBOX(message->mailbox));
+    g_return_if_fail(message->msgno > 0);
+
     if (message->mailbox->readonly) {
         libbalsa_information(LIBBALSA_INFORMATION_WARNING,
                              _("Mailbox (%s) is readonly: "
diff --git a/libbalsa/send.c b/libbalsa/send.c
index b8ae03d..a22861c 100644
--- a/libbalsa/send.c
+++ b/libbalsa/send.c
@@ -983,7 +983,7 @@ handle_successful_send(smtp_message_t message, void *be_verbose)
             const gchar *fccurl =
                 libbalsa_message_get_user_header(mqi->orig, "X-Balsa-Fcc");
 
-	    if (mqi->orig->mailbox && fccurl) {
+	    if (fccurl) {
                 LibBalsaMailbox *fccbox = mqi->finder(fccurl);
                 GError *err = NULL;
                 libbalsa_message_change_flags(mqi->orig, 0,
@@ -1014,9 +1014,10 @@ handle_successful_send(smtp_message_t message, void *be_verbose)
          *   - flagged, so it will not be sent again until the error
          *     is fixed and the user manually clears the flag;
          *   - undeleted, in case it was already deleted. */
-        libbalsa_message_change_flags(mqi->orig,
-                                      LIBBALSA_MESSAGE_FLAG_FLAGGED,
-                                      LIBBALSA_MESSAGE_FLAG_DELETED);
+        if (mqi->orig && mqi->orig->mailbox)
+            libbalsa_message_change_flags(mqi->orig,
+                                          LIBBALSA_MESSAGE_FLAG_FLAGGED,
+                                          LIBBALSA_MESSAGE_FLAG_DELETED);
 	/* Check whether it was a problem with transfer. */
         if(*(gboolean*)be_verbose) {
             int cnt = 0;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]