Index: listhandler.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/listhandler/listhandler.install,v
retrieving revision 1.1
diff -u -b -B -u -F^f -r1.1 listhandler.install
--- listhandler.install	26 Sep 2006 23:35:23 -0000	1.1
+++ listhandler.install	15 Jun 2007 15:31:06 -0000
@@ -7,7 +7,7 @@ function listhandler_install() {
   switch ($GLOBALS['db_type']) {
     case 'mysql':
     case 'mysqli':
-      db_query("CREATE TABLE listhandler (
+      db_query("CREATE TABLE {listhandler} (
       lid         int(10) unsigned not null auto_increment primary key,
       msgid       varchar(255) not null,
       nid         int(10) NOT NULL default '0',
@@ -16,10 +16,25 @@ function listhandler_install() {
       uid         int(10) NOT NULL default '0',
       mid         int(10) NOT NULL default '0',
       tid         int(10) NOT NULL default '0',
+      prefix      varchar(255) NOT NULL DEFAULT'',
       key (lid)
        ) /*!40100 DEFAULT CHARACTER SET utf8 */;");
-      db_query("ALTER TABLE mailhandler ADD prefix varchar(255) not null DEFAULT ''");
       break;  
+    case 'pgsql':
+      db_query("CREATE TABLE {listhandler} (
+      lid         serial,
+      msgid       text not null,
+      nid         integer NOT NULL default 0,
+      cid         integer NOT NULL default 0,
+      pid         integer NOT NULL default 0,
+      uid         integer NOT NULL default 0,
+      mid         integer NOT NULL default 0,
+      tid         integer NOT NULL default 0,
+      prefix      text NOT NULL DEFAULT '',
+      PRIMARY KEY (lid)
+       );");
+      break;  
+
   }
 }
 
Index: listhandler.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/listhandler/listhandler.module,v
retrieving revision 1.74
diff -u -b -B -u -F^f -r1.74 listhandler.module
--- listhandler.module	14 Feb 2007 11:25:57 -0000	1.74
+++ listhandler.module	15 Jun 2007 15:31:07 -0000
@@ -6,20 +6,21 @@ function listhandler_help($section) {
   switch($section) {
     case 'admin/help#listhandler':
       $output = '<p>'. t('The listhandler module allows you to connect mailing lists to forums and vice versa.  It works in conjunction with the mailhandler module.   Mailhandler receives an email and then asks listhandler if the received email is part of a list.  If the email is from a mailing list associated with a forum on your site, then listhandler adds the recieved email to the forum.') .'</p>';
-      $output .= '<p>' .t('Listhandler administration allows you to set the email address of the list administrator. The email address is used as the From: field to check the address of messages sent by anonymous users.  You can also enable and disable the listhandler for a list.') .'</p>';
+      $output .= '<p>'. t('Listhandler administration allows you to set the email address of the list administrator. The email address is used as the From: field to check the address of messages sent by anonymous users.  You can also enable and disable the listhandler for a list.') .'</p>';
       $output .= t('<p>You can:</p>
 <ul>
-<li>administer listhandler <a href="%admin-listhandler">administer &gt;&gt; listhandler</a>.</li>
-<li>administer mailhandler <a href="%admin-mailhandler">administer &gt;&gt; mailhandler</a> to create a mailbox which list handler can work with.</li>
-<li>administer forum <a href="%admin-forum">administer &gt;&gt; forum</a>.</li>
-', array('%admin-listhandler' => url('admin/listhandler'), '%admin-mailhandler' => url('admin/mailhandler'), '%admin-forum' => url('admin/forum'))) .'</ul>';
-      $output .= '<p>'. t('For more information please read the configuration and customization handbook <a href="%listhandler">Listhandler page</a>.', array('%listhandler' => 'http://www.drupal.org/handbook/modules/listhandler/')) .'</p>';
+<li>administer listhandler <a href="!admin-listhandler">administer &gt;&gt; listhandler</a>.</li>
+<li>administer mailhandler <a href="!admin-mailhandler">administer &gt;&gt; mailhandler</a> to create a mailbox which list handler can work with.</li>
+<li>administer forum <a href="!admin-forum">administer &gt;&gt; forum</a>.</li>
+', array('!admin-listhandler' => url('admin/content/listhandler'), '!admin-mailhandler' => 
+url('admin/content/mailhandler'), '!admin-forum' => url('admin/content/forum'))) .'</ul>';
+      $output .= '<p>'. t('For more information please read the configuration and customization handbook <a href="!listhandler">Listhandler page</a>.', array('!listhandler' => 'http://www.drupal.org/handbook/modules/listhandler/')) .'</p>';
       return $output;
     case 'admin/modules#description':
       $output = t('Connect your mailing lists to your drupal site and your drupal site to your mailing lists.');
       break;
-    case 'admin/listhandler':
-      $output = t("First go to the <a href='%url'>mailhandler configuration screen</a> and add some mailboxes. A mailbox becomes recognised as a mailing list if the 'Second E-mail address' is set. This is not optional for mailing lists.", array('%url' => url('admin/mailhandler')));
+    case 'admin/content/listhandler':
+      $output = t("First go to the <a href='!url'>mailhandler configuration screen</a> and add some mailboxes. A mailbox becomes recognised as a mailing list if the 'Second E-mail address' is set. This is not optional for mailing lists.", array('!url' => url('admin/mailhandler')));
       break;
   }
   return $output;
@@ -37,8 +38,8 @@ function listhandler_menu($may_cache) {
   $items = array();
 
   if ($may_cache) {
-    $items[] = array('path' => 'admin/listhandler',
-                     'title' => t('listhandler'),
+    $items[] = array('path' => 'admin/content/listhandler',
+                     'title' => t('Listhandler'),
                      'callback' => 'listhandler_admin',
                      'access' => user_access('administer listhandler'));
   }
@@ -49,7 +50,7 @@ function listhandler_menu($may_cache) {
 /**
 * Configuration options for this module
 */
-function listhandler_admin_form() {
+function listhandler_admin_form($form) {
   $form['listhandler_from'] = array(
   '#type' => 'textfield',
   '#title' => t('Admin address'),
@@ -90,8 +91,9 @@ function listhandler_admin_form() {
   '#type' => 'submit',
   '#value' => t('Submit'),
   );
+  return $form;
 
-  return drupal_get_form('listhandler_settings', $form);
+//OLD  return drupal_get_form('listhandler_settings', $form);
 }
 
 /**
@@ -99,15 +101,15 @@ function listhandler_admin_form() {
 */
 
 function theme_listhandler_settings($form) {
-  $output = form_render($form['listhandler_from']);
-  $output .= form_render($form['listhandler_strip_title']);
-  $output .= form_render($form['listhandler_accountstatus']);
+  $output = drupal_render($form['listhandler_from']);
+  $output .= drupal_render($form['listhandler_strip_title']);
+  $output .= drupal_render($form['listhandler_accountstatus']);
   if (count($form['listhandler_list'])) {
     $rows = array();
     foreach(element_children($form['listhandler_list']) as $mid) {
       $row = array();
-      $row[] = form_render($form['listhandler_list'][$mid]);
-      $row[] = form_render($form['listhandler_prefix'][$mid]);
+      $row[] = drupal_render($form['listhandler_list'][$mid]);
+      $row[] = drupal_render($form['listhandler_prefix'][$mid]);
       $rows[] = $row;
     }
     $header = array(t('mailing list'), t('prefix'));
@@ -115,9 +117,9 @@ function theme_listhandler_settings($for
     $output .= '<div>'. t("The prefix well be prepended to all outgoing mail subjects for the specified list. It is a good idea to put the prefix in the 'strip title' field.") .'</div>';
   }
   else {
-    $output .= '<div>'. t("No mailing lists have been defined. Please go to the <a href='%url'>mailhandler configuration screen</a> and add some mailboxes. A mailbox becomes recognised as a mailing list if the 'Second E-mail address' is set.", array('%url' => 'admin/mailhandler')) .'</div>';
+    $output .= '<div>'. t("No mailing lists have been defined. Please go to the <a href='!url'>mailhandler configuration screen</a> and add some mailboxes. A mailbox becomes recognised as a mailing list if the 'Second E-mail address' is set.", array('!url' => 'admin/mailhandler')) .'</div>';
   }
-  $output .= form_render($form);
+  $output .= drupal_render($form);
   return $output;
 }
 
@@ -135,8 +137,8 @@ function listhandler_admin() {
     }
     drupal_set_message('The configuration options have been saved.');
   }
-
-  print theme('page', listhandler_admin_form());
+  $output = drupal_get_form('listhandler_admin_form', $form);
+  return $output;
 }
 
 /**
@@ -295,12 +297,15 @@ function listhandler_send_mail($edit) {
       $body = strip_tags($edit['comment']);
     }
 
-    $err = user_mail($address, $subject, $body, "From: ". $edit["name"] ." <". $edit["mail"] .">\n". $mid);
+    // OLD  $err = user_mail($address, $subject, $body, "From: ". $edit["name"] ." <". $edit["mail"] .">\n". $mid);
+
+    $err = drupal_mail($mid, $address, $subject, $body, $edit["mail"]);
+
     // save comment ids in listhandler table.
     // Not strictly needed, the same info is stored in the msgid.
     db_query("INSERT INTO {listhandler} (msgid, nid, cid, pid, uid, mid, tid) VALUES ('%s','%s','%s','%s','%s','%s','%s')", $msgid, $edit["nid"], $edit["cid"], $edit["pid"], $user->uid, $edit["mid"], $edit["tid"]);
     // call watchdog
-    watchdog('listhandler', t("'%s' sent to '%a'.", array("%s" => $edit["subject"], "%a" => $address)));
+    watchdog('listhandler', t("'!s' sent to '!a'.", array("!s" => $edit["subject"], "!a" => $address)));
   }
 }
 
@@ -328,7 +333,7 @@ function listhandler_mailhandler($node, 
     $regex = "<listhandler=[[:print:]]+@". $dir . strtolower($_SERVER["SERVER_NAME"]) .">";
     if(ereg($regex, $header->message_id)){
       // Sent by listhandler on this site. Destroy the node.
-      watchdog('listhandler', t("Discarded message '%s' to avoid loop.", array("%s" => $node->title)));
+      watchdog('listhandler', t("Discarded message '!s' to avoid loop.", array("!s" => $node->title)));
       unset($node);
       return;
     }
@@ -392,19 +397,19 @@ function listhandler_create_author($node
   }
   // check if name is available
   if (db_num_rows(db_query("SELECT name FROM {users} WHERE LOWER(name) = LOWER('%s')", $from_name)) > 0) {
-    $node->body = t('Message from %n %a', array('%n' => $from_name, '%a' => $from_address)) ."\n\n". $node->body;
-    watchdog('listhandler', t("Cannot create account: The name '%s' is already taken.", array("%s" => $from_name)));
+    $node->body = t('Message from !n !a', array('!n' => $from_name, '!a' => $from_address)) ."\n\n". $node->body;
+    watchdog('listhandler', t("Cannot create account: The name '!s' is already taken.", array("!s" => $from_name)));
   }
   // check if address is valid
   elseif (!valid_email_address($from_address)) {
-    $node->body = t('Message from %n %a', array('%n' => $from_name, '%a' => $from_address)) ."\n\n". $node->body;
-    watchdog('listhandler', t("Listhandler: Cannot create account: The email address '%s' is not valid.", array("%s" => $from_address)));
+    $node->body = t('Message from !n !a', array('!n' => $from_name, '!a' => $from_address)) ."\n\n". $node->body;
+    watchdog('listhandler', t("Listhandler: Cannot create account: The email address '!s' is not valid.", array("!s" => $from_address)));
   }
   // create account
   else {
     $empty_account = new StdClass();
     $from_user = user_save($empty_account, array('name' => $from_name, 'pass' => user_password(), 'init' => $from_address,  'mail' => $from_address, 'roles' => array(DRUPAL_AUTHENTICATED_RID), 'status' => variable_get('listhandler_accountstatus', 0)), 'account');
-    watchdog('listhandler', t('Created account for %fa, with roles %rid', array ('%fa' => $from_address, '%rid' => implode(', ', $from_user->roles))));
+    watchdog('listhandler', t('Created account for !fa, with roles !rid', array ('!fa' => $from_address, '!rid' => implode(', ', $from_user->roles))));
     mailhandler_switch_user($from_user->uid);
   }
   $node->uid = $from_user->uid;
