--- simplenews.module	2007-01-18 11:27:57.868852616 +0100
+++ simplenews.module.rev2	2007-01-18 19:23:55.550425120 +0100
@@ -188,12 +188,22 @@
       'weight' => -10,
     );
 
-    $items[] = array('path' => 'newsletter/confirm',
+    $items[] = array('path' => 'newsletter/confirm/add',
       'title' => t('Confirm newsletter subscriptions'),
       'access' => user_access('access content'),
-      'callback' => 'simplenews_confirm_subscription',
+      'callback' => 'drupal_get_form',
+      'callback arguments' => array('simplenews_confirm_add_subscription'),
+      'type' => MENU_CALLBACK,
+    );
+
+    $items[] = array('path' => 'newsletter/confirm/remove',
+      'title' => t('Confirm newsletter unsubscriptions'),
+      'access' => user_access('access content'),
+      'callback' => 'drupal_get_form',
+      'callback arguments' => array('simplenews_confirm_remove_subscription'),
       'type' => MENU_CALLBACK,
     );
+    
     $items[] = array('path' => 'newsletter/subscriptions',
       'title' => t('Manage newsletter subscriptions'),
       'access' => user_access('subscribe to newsletters'),
@@ -2163,12 +2173,13 @@
 }
 
 /**
- * Menu callback; confirm the user's (un)subscription request when they click
+ * Menu callback; confirm the user's subscription request when they click
  * on the confirm link in the e-mail footer.
  */
-function simplenews_confirm_subscription($op1 = NULL, $op2 = NULL) {
-  $md5 = drupal_substr($op2, 0, 10);
-  list($snid, $tid) = explode('t', drupal_substr($op2, 10));
+function simplenews_confirm_add_subscription($op1 = NULL) {
+
+  $md5 = drupal_substr($op1, 0, 10);
+  list($snid, $tid) = explode('t', drupal_substr($op1, 10));
 
   $result = db_query('SELECT snid, mail FROM {simplenews_subscriptions} WHERE snid = %d', $snid);
   if (!($subs = db_fetch_object($result))) {
@@ -2178,12 +2189,7 @@
 
   if ($md5 == drupal_substr(md5($subs->mail . simplenews_private_key()), 0, 10)) {
     $newsletter = taxonomy_get_term($tid);
-    if ($op1 == 'remove') {
-      return drupal_get_form('simplenews_confirm_removal_form', $subs->mail, $newsletter);
-    }
-    elseif ($op1 == 'add') {
-      return drupal_get_form('simplenews_confirm_add_form', $subs->mail, $newsletter);
-    }
+    return simplenews_confirm_add_form($subs->mail, $newsletter);
   }
 
   // If md5 didn't match, do a not found.
@@ -2192,6 +2198,31 @@
 }
 
 /**
+ * Menu callback; confirm the user's unsubscription request when they click
+ * on the confirm link in the e-mail footer.
+ */
+function simplenews_confirm_remove_subscription($op1 = NULL) {
+
+  $md5 = drupal_substr($op1, 0, 10);
+  list($snid, $tid) = explode('t', drupal_substr($op1, 10));
+
+  $result = db_query('SELECT snid, mail FROM {simplenews_subscriptions} WHERE snid = %d', $snid);
+  if (!($subs = db_fetch_object($result))) {
+    drupal_not_found();
+    return;
+  }
+
+  if ($md5 == drupal_substr(md5($subs->mail . simplenews_private_key()), 0, 10)) {
+    $newsletter = taxonomy_get_term($tid);
+    return simplenews_confirm_removal_form($subs->mail, $newsletter);
+  }
+
+  // If md5 didn't match, do a not found.
+  //drupal_not_found();
+  return;
+}
+
+/**
  * Generate the confirm add form.
  */
 function simplenews_confirm_add_form($mail, $newsletter) {
@@ -2212,10 +2243,10 @@
  * Forms API callback; handles form submission for a user confirming subscribe
  * request.
  */
-function simplenews_confirm_add_form_submit($form_id, $form_values) {
+function simplenews_confirm_add_subscription_submit($form_id, $form_values) {
   simplenews_subscribe_user($form_values['mail'], $form_values['newsletter']->tid, FALSE);
   drupal_set_message(t('%user was successfully added to the %newsletter subscription list.', array('%user' => $form_values['mail'], '%newsletter' => $form_values['newsletter']->name)));
-  return '';
+  return '<front>';
 }
 
 /**
@@ -2239,10 +2270,10 @@
  * Forms API callback; handles form submission for a user confirming unsubscribe
  * request.
  */
-function simplenews_confirm_removal_form_submit($form_id, $form_values) {
+function simplenews_confirm_remove_subscription_submit($form_id, $form_values) {
   simplenews_unsubscribe_user($form_values['mail'], $form_values['newsletter']->tid, FALSE);
   drupal_set_message(t('%user was successfully removed from the %newsletter subscription list.', array('%user' => $form_values['mail'], '%newsletter'=> $form_values['newsletter']->name)));
-  return '';
+  return '<front>';
 }
 
 function simplenews_replace_vars($node, $teaser = TRUE) {
