1cdbf97517ccd78183e8000e39142db5a02b0f6c
diff --git a/libsoup/soup-cookie-jar.c b/libsoup/soup-cookie-jar.c
index 4e15a2d..7c20a7c 100644
--- a/libsoup/soup-cookie-jar.c
+++ b/libsoup/soup-cookie-jar.c
@@ -15,6 +15,7 @@
 #include "soup-cookie.h"
 #include "soup-cookie-jar.h"
 #include "soup-date.h"
+#include "soup-marshal.h"
 #include "soup-message.h"
 #include "soup-session-feature.h"
 #include "soup-uri.h"
@@ -45,6 +46,13 @@ G_DEFINE_TYPE_WITH_CODE (SoupCookieJar, soup_cookie_jar, G_TYPE_OBJECT,
 			 G_IMPLEMENT_INTERFACE (SOUP_TYPE_SESSION_FEATURE,
 						soup_cookie_jar_session_feature_init))
 
+enum {
+	CHANGED,
+	LAST_SIGNAL
+};
+
+static guint signals[LAST_SIGNAL] = { 0 };
+
 typedef struct {
 	GHashTable *domains;
 } SoupCookieJarPrivate;
@@ -81,6 +89,17 @@ soup_cookie_jar_class_init (SoupCookieJarClass *jar_class)
 
 	g_type_class_add_private (jar_class, sizeof (SoupCookieJarPrivate));
 
+	signals[CHANGED] =
+		g_signal_new ("changed",
+			      G_OBJECT_CLASS_TYPE (object_class),
+			      G_SIGNAL_RUN_FIRST,
+			      G_STRUCT_OFFSET (SoupCookieJarClass, changed),
+			      NULL, NULL,
+			      soup_marshal_NONE__BOXED_BOXED,
+			      G_TYPE_NONE, 2, 
+			      SOUP_TYPE_COOKIE | G_SIGNAL_TYPE_STATIC_SCOPE,
+			      SOUP_TYPE_COOKIE | G_SIGNAL_TYPE_STATIC_SCOPE);
+
 	object_class->finalize = finalize;
 }
 
@@ -225,6 +244,8 @@ soup_cookie_jar_set_cookie_internal (SoupCookieJar *jar, SoupCookie *cookie)
 			 * get_cookies_for_domain() will delete it
 			 * later.
 			 */
+			g_signal_emit (jar, signals[CHANGED], 0,
+				       old_cookie, cookie);
 			soup_cookie_free (old_cookie);
 			oc->data = cookie;
 			return;
@@ -233,15 +254,21 @@ soup_cookie_jar_set_cookie_internal (SoupCookieJar *jar, SoupCookie *cookie)
 	}
 
 	/* The new cookie is... a new cookie */
-	if (cookie->expires && soup_date_is_past (cookie->expires))
+	if (cookie->expires && soup_date_is_past (cookie->expires)) {
 		soup_cookie_free (cookie);
-	else if (prev)
+		return;
+	}
+
+	if (prev)
 		prev = g_slist_append (prev, cookie);
 	else {
 		old_cookies = g_slist_append (NULL, cookie);
 		g_hash_table_insert (priv->domains, g_strdup (cookie->domain),
 				     old_cookies);
 	}
+
+	g_signal_emit (jar, signals[CHANGED], 0,
+		       NULL, cookie);
 }
 
 /**
diff --git a/libsoup/soup-cookie-jar.h b/libsoup/soup-cookie-jar.h
index 14c9d92..d0c35cf 100644
--- a/libsoup/soup-cookie-jar.h
+++ b/libsoup/soup-cookie-jar.h
@@ -25,13 +25,17 @@ typedef struct {
 typedef struct {
 	GObjectClass parent_class;
 
-	void (*save) (SoupCookieJar *jar);
+	void (*save)    (SoupCookieJar *jar);
+
+	/* signals */
+	void (*changed) (SoupCookieJar *jar,
+			 SoupCookie    *old_cookie,
+			 SoupCookie    *new_cookie);
 
 	/* Padding for future expansion */
 	void (*_libsoup_reserved1) (void);
 	void (*_libsoup_reserved2) (void);
 	void (*_libsoup_reserved3) (void);
-	void (*_libsoup_reserved4) (void);
 } SoupCookieJarClass;
 
 GType          soup_cookie_jar_get_type            (void);
diff --git a/libsoup/soup-marshal.list b/libsoup/soup-marshal.list
index 4e1b2bc..1a43570 100644
--- a/libsoup/soup-marshal.list
+++ b/libsoup/soup-marshal.list
@@ -4,4 +4,5 @@ NONE:NONE
 NONE:OBJECT
 NONE:OBJECT,OBJECT
 NONE:OBJECT,POINTER
+NONE:BOXED,BOXED
 NONE:OBJECT,OBJECT,BOOLEAN
