[evolution-data-server] Bug #482171 - IMAP warnings are presented without folder context



commit 96c5278380d1bbcb5f13da70ab0d84bd3678829a
Author: Milan Crha <mcrha redhat com>
Date:   Thu Dec 22 20:06:43 2011 +0100

    Bug #482171 - IMAP warnings are presented without folder context

 camel/providers/imap/camel-imap-command.c |   23 +++++++++++++++++------
 camel/providers/imap/camel-imap-command.h |    2 ++
 camel/providers/imap/camel-imap-folder.c  |    8 ++++----
 camel/providers/imap/camel-imap-store.c   |    4 ++--
 4 files changed, 25 insertions(+), 12 deletions(-)
---
diff --git a/camel/providers/imap/camel-imap-command.c b/camel/providers/imap/camel-imap-command.c
index 741db3a..f57547a 100644
--- a/camel/providers/imap/camel-imap-command.c
+++ b/camel/providers/imap/camel-imap-command.c
@@ -47,6 +47,7 @@ static gboolean imap_command_start (CamelImapStore *store, CamelFolder *folder,
 				    const gchar *cmd, GCancellable *cancellable,
 				    GError **error);
 static CamelImapResponse *imap_read_response (CamelImapStore *store,
+					      CamelFolder *folder,
 					      GCancellable *cancellable,
 					      GError **error);
 static gchar *imap_read_untagged (CamelImapStore *store, gchar *line,
@@ -119,7 +120,7 @@ camel_imap_command (CamelImapStore *store,
 	}
 	g_free (cmd);
 
-	return imap_read_response (store, cancellable, error);
+	return imap_read_response (store, folder, cancellable, error);
 }
 
 /**
@@ -264,6 +265,7 @@ imap_command_start (CamelImapStore *store,
 /**
  * camel_imap_command_continuation:
  * @store: the IMAP store
+ * @folder: a #CamelFolder on which the command was run; can be %NULL
  * @cmd: buffer containing the response/request data
  * @cmdlen: command length
  * @error: return location for a #GError, or %NULL
@@ -279,6 +281,7 @@ imap_command_start (CamelImapStore *store,
  **/
 CamelImapResponse *
 camel_imap_command_continuation (CamelImapStore *store,
+				 CamelFolder *folder,
                                  const gchar *cmd,
                                  gsize cmdlen,
                                  GCancellable *cancellable,
@@ -311,12 +314,13 @@ camel_imap_command_continuation (CamelImapStore *store,
 		return NULL;
 	}
 
-	return imap_read_response (store, cancellable, error);
+	return imap_read_response (store, folder, cancellable, error);
 }
 
 /**
  * camel_imap_command_response:
  * @store: the IMAP store
+ * @folder: a #CamelFolder on which the command was run; can be %NULL
  * @response: a pointer to pass back the response data in
  * @cancellable: optional #GCancellable object, or %NULL
  * @error: return location for a #GError, or %NULL
@@ -332,6 +336,7 @@ camel_imap_command_continuation (CamelImapStore *store,
  **/
 CamelImapResponseType
 camel_imap_command_response (CamelImapStore *store,
+			     CamelFolder *folder,
                              gchar **response,
                              GCancellable *cancellable,
                              GError **error)
@@ -405,9 +410,14 @@ camel_imap_command_response (CamelImapStore *store,
 					g_hash_table_insert (store->known_alerts, g_strdup (alert), GINT_TO_POINTER (1));
 				}
 
-				msg = g_strdup_printf (
-					_("Alert from IMAP server %s %s:\n%s"),
-					user, host, alert);
+				if (folder)
+					msg = g_strdup_printf (
+						_("Alert from IMAP server %s %s in folder %s:\n%s"),
+						user, host, camel_folder_get_full_name (folder), alert);
+				else
+					msg = g_strdup_printf (
+						_("Alert from IMAP server %s %s:\n%s"),
+						user, host, alert);
 				camel_session_alert_user (
 					session, CAMEL_SESSION_ALERT_WARNING,
 					msg, NULL);
@@ -434,6 +444,7 @@ camel_imap_command_response (CamelImapStore *store,
 
 static CamelImapResponse *
 imap_read_response (CamelImapStore *store,
+		    CamelFolder *folder,
                     GCancellable *cancellable,
                     GError **error)
 {
@@ -456,7 +467,7 @@ imap_read_response (CamelImapStore *store,
 
 	response->untagged = g_ptr_array_new ();
 	while ((type = camel_imap_command_response (
-		store, &respbuf, cancellable, error))
+		store, folder, &respbuf, cancellable, error))
 		== CAMEL_IMAP_RESPONSE_UNTAGGED)
 		g_ptr_array_add (response->untagged, respbuf);
 
diff --git a/camel/providers/imap/camel-imap-command.h b/camel/providers/imap/camel-imap-command.h
index 4c82f5b..deeeb23 100644
--- a/camel/providers/imap/camel-imap-command.h
+++ b/camel/providers/imap/camel-imap-command.h
@@ -53,6 +53,7 @@ CamelImapResponse *
 						 const gchar *fmt, ...);
 CamelImapResponse *
 		camel_imap_command_continuation	(CamelImapStore *store,
+						 CamelFolder *folder,
 						 const gchar *cmd,
 						 gsize cmdlen,
 						 GCancellable *cancellable,
@@ -77,6 +78,7 @@ gboolean	camel_imap_command_start	(CamelImapStore *store,
 						 const gchar *fmt, ...);
 CamelImapResponseType
 		camel_imap_command_response	(CamelImapStore *store,
+						 CamelFolder *folder,
 						 gchar **response,
 						 GCancellable *cancellable,
 						 GError **error);
diff --git a/camel/providers/imap/camel-imap-folder.c b/camel/providers/imap/camel-imap-folder.c
index 7b9b157..05fa87c 100644
--- a/camel/providers/imap/camel-imap-folder.c
+++ b/camel/providers/imap/camel-imap-folder.c
@@ -1095,7 +1095,7 @@ imap_rescan (CamelFolder *folder,
 	resp = NULL;
 	new = g_malloc0 (summary_len * sizeof (*new));
 	summary_got = 0;
-	while ((type = camel_imap_command_response (store, &resp, cancellable, error)) == CAMEL_IMAP_RESPONSE_UNTAGGED && !camel_application_is_exiting) {
+	while ((type = camel_imap_command_response (store, folder, &resp, cancellable, error)) == CAMEL_IMAP_RESPONSE_UNTAGGED && !camel_application_is_exiting) {
 		GData *data;
 		gchar *uid;
 		guint32 flags;
@@ -2377,7 +2377,7 @@ retry:
 	}
 
 	/* send the rest of our data - the mime message */
-	response2 = camel_imap_command_continuation (store, (const gchar *) ba->data, ba->len, cancellable, error);
+	response2 = camel_imap_command_continuation (store, folder, (const gchar *) ba->data, ba->len, cancellable, error);
 	g_byte_array_free (ba, TRUE);
 
 	/* free it only after message is sent. This may cause more FETCHes. */
@@ -3999,7 +3999,7 @@ imap_update_summary (CamelFolder *folder,
 	fetch_data = g_ptr_array_new ();
 	messages = g_ptr_array_new ();
 	ct = exists - seq;
-	while ((type = camel_imap_command_response (store, &resp, cancellable, error)) ==
+	while ((type = camel_imap_command_response (store, folder, &resp, cancellable, error)) ==
 	       CAMEL_IMAP_RESPONSE_UNTAGGED && !camel_application_is_exiting) {
 		data = parse_fetch_response (imap_folder, resp);
 		g_free (resp);
@@ -4088,7 +4088,7 @@ imap_update_summary (CamelFolder *folder,
 			}
 			g_free (uidset);
 
-			while ((type = camel_imap_command_response (store, &resp, cancellable, error))
+			while ((type = camel_imap_command_response (store, folder, &resp, cancellable, error))
 			       == CAMEL_IMAP_RESPONSE_UNTAGGED && !camel_application_is_exiting) {
 				data = parse_fetch_response (imap_folder, resp);
 				g_free (resp);
diff --git a/camel/providers/imap/camel-imap-store.c b/camel/providers/imap/camel-imap-store.c
index af02ec1..3e9b456 100644
--- a/camel/providers/imap/camel-imap-store.c
+++ b/camel/providers/imap/camel-imap-store.c
@@ -1121,7 +1121,7 @@ imap_store_authenticate_sync (CamelService *service,
 			goto break_and_exit;
 
 		response = camel_imap_command_continuation (
-			store, sasl_resp, strlen (sasl_resp),
+			store, NULL, sasl_resp, strlen (sasl_resp),
 			cancellable, &local_error);
 
 		g_free (sasl_resp);
@@ -1143,7 +1143,7 @@ imap_store_authenticate_sync (CamelService *service,
 break_and_exit:
 	/* Get the server out of "waiting for continuation data" mode. */
 	response = camel_imap_command_continuation (
-		store, "*", 1, cancellable, NULL);
+		store, NULL, "*", 1, cancellable, NULL);
 	if (response != NULL)
 		camel_imap_response_free (store, response);
 



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