=== modified file 'src/empathy-chat-window.c'
diff -Nur -x '*.orig' -x '*~' empathy-2.30.2//src/empathy-chat-window.c empathy-2.30.2.new//src/empathy-chat-window.c
--- empathy-2.30.2//src/empathy-chat-window.c	2010-06-28 11:32:13.809918001 +0200
+++ empathy-2.30.2.new//src/empathy-chat-window.c	2010-06-28 11:36:09.965918001 +0200
@@ -1207,7 +1207,11 @@
 	EmpathyChatWindowPriv *priv = GET_PRIV (self);
 
 	g_object_unref (notify);
-	priv->notification = NULL;
+
+	if (priv->notification == notify) {
+		priv->notification = NULL;
+	}
+
 }
 
 #ifdef HAVE_LIBINDICATE
@@ -1286,7 +1290,8 @@
 	const char *body;
 	GdkPixbuf *pixbuf;
 	EmpathyChatWindowPriv *priv = GET_PRIV (window);
-	gboolean res;
+	gboolean res, has_x_canonical_append;
+	NotifyNotification *notification = priv->notification;
 
 	if (!empathy_notify_manager_notification_is_enabled (priv->notify_mgr)) {
 		return;
@@ -1302,27 +1307,38 @@
 	header = empathy_contact_get_name (sender);
 	body = empathy_message_get_body (message);
 	escaped = g_markup_escape_text (body, -1);
+	has_x_canonical_append = empathy_notify_manager_has_capability (priv->notify_mgr,
+		EMPATHY_NOTIFY_MANAGER_CAP_X_CANONICAL_APPEND);
 
-	if (priv->notification != NULL) {
-		notify_notification_update (priv->notification,
+	if (notification != NULL && ! has_x_canonical_append) {
+		notify_notification_update (notification,
 					    header, escaped, NULL);
 	} else {
-		priv->notification = notify_notification_new (header, escaped, NULL, NULL);
-		notify_notification_set_timeout (priv->notification, NOTIFY_EXPIRES_DEFAULT);
+		notification = notify_notification_new (header, escaped, NULL, NULL);
+		if (priv->notification == NULL) {
+			priv->notification = notification;
+		}
+
+		notify_notification_set_timeout (notification, NOTIFY_EXPIRES_DEFAULT);
 
-		empathy_signal_connect_weak (priv->notification, "closed",
+		g_signal_connect (notification, "closed",
 				  G_CALLBACK (chat_window_notification_closed_cb), G_OBJECT (window));
+
+		if (has_x_canonical_append) {
+			notify_notification_set_hint_string (notification,
+				EMPATHY_NOTIFY_MANAGER_CAP_X_CANONICAL_APPEND, "");
+		}
 	}
 
 	pixbuf = empathy_notify_manager_get_pixbuf_for_notification (priv->notify_mgr,
 		sender, EMPATHY_IMAGE_NEW_MESSAGE);
 
 	if (pixbuf != NULL) {
-		notify_notification_set_icon_from_pixbuf (priv->notification, pixbuf);
+		notify_notification_set_icon_from_pixbuf (notification, pixbuf);
 		g_object_unref (pixbuf);
 	}
 
-	notify_notification_show (priv->notification, NULL);
+	notify_notification_show (notification, NULL);
 
 	g_free (escaped);
 }
@@ -2025,6 +2041,7 @@
 	priv->chats_new_msg = NULL;
 	priv->chats_composing = NULL;
 	priv->current_chat = NULL;
+	priv->notification = NULL;
 
 	priv->notify_mgr = empathy_notify_manager_dup_singleton ();
 
diff -Nur -x '*.orig' -x '*~' empathy-2.30.2//src/empathy-status-icon.c empathy-2.30.2.new//src/empathy-status-icon.c
--- empathy-2.30.2//src/empathy-status-icon.c	2010-06-28 11:32:13.813918001 +0200
+++ empathy-2.30.2.new//src/empathy-status-icon.c	2010-06-28 11:32:14.501918001 +0200
@@ -110,9 +110,8 @@
 static void
 notification_close_helper (EmpathyStatusIconPriv *priv)
 {
-	if (priv->notification) {
+	if (priv->notification != NULL) {
 		notify_notification_close (priv->notification, NULL);
-		g_object_unref (priv->notification);
 		priv->notification = NULL;
 	}
 }
@@ -142,29 +141,45 @@
 
 	if (priv->event) {
 		gchar *message_esc = NULL;
+		gboolean has_x_canonical_append;
+		NotifyNotification *notification = priv->notification;
 
 		if (priv->event->message != NULL)
 			message_esc = g_markup_escape_text (priv->event->message, -1);
 
-		if (priv->notification) {
-			notify_notification_update (priv->notification,
+		has_x_canonical_append =
+				empathy_notify_manager_has_capability (priv->notify_mgr,
+					EMPATHY_NOTIFY_MANAGER_CAP_X_CANONICAL_APPEND);
+
+		if (notification != NULL && ! has_x_canonical_append) {
+			notify_notification_update (notification,
 						    priv->event->header, message_esc,
 						    NULL);
 		} else {
 			if (gtk_status_icon_get_visible (priv->icon)) {
-				priv->notification = notify_notification_new_with_status_icon
-				(priv->event->header, message_esc, NULL, priv->icon);
+				notification = notify_notification_new_with_status_icon
+					(priv->event->header, message_esc, NULL, priv->icon);
 			} else {
-				priv->notification = notify_notification_new
+				notification = notify_notification_new
 					(priv->event->header, message_esc, NULL, NULL);
 			}
-			notify_notification_set_timeout (priv->notification,
+
+			if (priv->notification == NULL) {
+				priv->notification = notification;
+			}
+
+			notify_notification_set_timeout (notification,
 							 NOTIFY_EXPIRES_DEFAULT);
 
+			if (has_x_canonical_append) {
+				notify_notification_set_hint_string (notification,
+					EMPATHY_NOTIFY_MANAGER_CAP_X_CANONICAL_APPEND, "");
+			}
+
 			if (empathy_notify_manager_has_capability (priv->notify_mgr,
 			           EMPATHY_NOTIFY_MANAGER_CAP_ACTIONS) &&
 			           priv->event->type != EMPATHY_EVENT_TYPE_PRESENCE) {
-				notify_notification_add_action (priv->notification,
+				notify_notification_add_action (notification,
 					"respond",
 					_("Respond"),
 					(NotifyActionCallback) notification_action_cb,
@@ -172,7 +187,7 @@
 					NULL);
 			}
 
-			g_signal_connect (priv->notification, "closed",
+			g_signal_connect (notification, "closed",
 					  G_CALLBACK (status_icon_notification_closed_cb), icon);
 		}
 
@@ -181,12 +196,11 @@
 								   priv->event->icon_name);
 
 		if (pixbuf != NULL) {
-			notify_notification_set_icon_from_pixbuf (priv->notification,
-							  pixbuf);
+			notify_notification_set_icon_from_pixbuf (notification, pixbuf);
 			g_object_unref (pixbuf);
 		}
 
-		notify_notification_show (priv->notification, NULL);
+		notify_notification_show (notification, NULL);
 
 		g_free (message_esc);
 	} else {
@@ -510,7 +524,6 @@
 
 		if (priv->notification) {
 			notify_notification_close (priv->notification, NULL);
-			g_object_unref (priv->notification);
 			priv->notification = NULL;
 		}
 	}
@@ -771,6 +784,7 @@
 			  G_CALLBACK (status_icon_popup_menu_cb),
 			  icon);
 
+	priv->notification = NULL;
 	priv->notify_mgr = empathy_notify_manager_dup_singleton ();
 }
 
