diff -urp listhandler/INSTALL listhandler.new/INSTALL --- listhandler/INSTALL 2006-09-27 01:31:36.000000000 +0200 +++ listhandler.new/INSTALL 2007-12-04 20:59:28.000000000 +0100 @@ -19,7 +19,10 @@ mailalias is considered a good idea. Sender is usually a good choice. This depends on the mailing list software. - Then give as a mailhandler default command: - tid: 123 + type: forum + taxonomy: [123] + promote: 0 + status: 1 where 123 would be the numeric taxonomy id of the forum you created above. diff -urp listhandler/listhandler.info listhandler.new/listhandler.info --- listhandler/listhandler.info 2007-07-10 18:51:10.000000000 +0200 +++ listhandler.new/listhandler.info 2007-12-04 20:59:28.000000000 +0100 @@ -1,4 +1,5 @@ ; $Id $ name = Listhandler description = "Integrate with mailing lists." +version = "5.1-1.0" dependencies = mailhandler diff -urp listhandler/listhandler.install listhandler.new/listhandler.install --- listhandler/listhandler.install 2007-07-10 18:51:10.000000000 +0200 +++ listhandler.new/listhandler.install 2007-12-04 20:59:28.000000000 +0100 @@ -33,7 +33,7 @@ function listhandler_install() { prefix text NOT NULL DEFAULT '', PRIMARY KEY (lid) );"); - break; + break; } } diff -urp listhandler/listhandler.module listhandler.new/listhandler.module --- listhandler/listhandler.module 2007-07-10 18:51:10.000000000 +0200 +++ listhandler.new/listhandler.module 2007-12-12 22:33:36.000000000 +0100 @@ -1,5 +1,4 @@ administer listhandler administer >> listhandler.
  • administer mailhandler administer >> mailhandler to create a mailbox which list handler can work with.
  • administer forum administer >> forum.
  • -', array('!admin-listhandler' => url('admin/content/listhandler'), '!admin-mailhandler' => +', array('!admin-listhandler' => url('admin/content/listhandler'), '!admin-mailhandler' => url('admin/content/mailhandler'), '!admin-forum' => url('admin/content/forum'))) .''; $output .= '

    '. t('For more information please read the configuration and customization handbook Listhandler page.', array('!listhandler' => 'http://www.drupal.org/handbook/modules/listhandler/')) .'

    '; return $output; @@ -75,8 +74,14 @@ function listhandler_admin_settings() { '#options' => array(0 => t('blocked'), 1 => t('active')), '#description' => t('The status of accounts created by listhandler.')); - $form['listhandler_list']['#tree'] = TRUE; - $form['listhandler_prefix']['#tree'] = TRUE; + $form['listhandler_list'] = array( + '#tree' => TRUE, + ); + + $form['listhandler_prefix'] = array( + '#tree' => TRUE, + ); + $result = db_query("SELECT * FROM {mailhandler} WHERE mailto != '' ORDER BY mailto"); while ($mailbox = db_fetch_object($result)) { @@ -84,7 +89,6 @@ function listhandler_admin_settings() { '#value' => "
    mailto\">$mailbox->mailto
    "); $form['listhandler_prefix'][$mailbox->mid] = array( '#type' => 'textfield', - '#title' => $mailbox->mid, '#default_value' => $mailbox->prefix, '#size' => 50, '#maxlength' => 100); @@ -97,7 +101,7 @@ function listhandler_admin_settings() { * Theme call to render the tabular form of mailing lists and prefixes */ -function theme_listhandler_settings($form) { +function theme_listhandler_admin_settings($form) { $output = drupal_render($form['listhandler_from']); $output .= drupal_render($form['listhandler_strip_title']); $output .= drupal_render($form['listhandler_accountstatus']); @@ -121,16 +125,14 @@ function theme_listhandler_settings($for } function listhandler_admin_settings_submit($form_id, &$form_values) { - $edit = $form_values['edit']; - variable_set('listhandler_from', $edit['listhandler_from']); - variable_set('listhandler_strip_title', $edit['listhandler_strip_title']); - variable_set('listhandler_accountstatus', $edit['listhandler_accountstatus']); - if (isset($edit['listhandler_prefix'])) { - foreach ($edit['listhandler_prefix'] as $key => $value) { + variable_set('listhandler_from', $form_values['listhandler_from']); + variable_set('listhandler_strip_title', $form_values['listhandler_strip_title']); + variable_set('listhandler_accountstatus', $form_values['listhandler_accountstatus']); + if (isset($form_values['listhandler_prefix'])) { + foreach ($form_values['listhandler_prefix'] as $key => $value) { db_query("UPDATE {mailhandler} SET prefix = '%s' WHERE mid = %d", $value, $key); } } - drupal_set_message('The configuration options have been saved.'); return system_settings_form_submit($form_id, $form_values); } @@ -209,6 +211,7 @@ function listhandler_comment($edit = arr function listhandler_send_mail($edit) { global $user, $base_url; + $mid=array(); if(!$user->uid) { $edit['name'] = variable_get('anonymous', 'Anonymous'); @@ -265,8 +268,8 @@ function listhandler_send_mail($edit) { $edit['pid']=0; } if($result) {// Parent was sent or received by listhandler - $mid = "References: ". $result->msgid ."\n"; - $mid .= "In-Reply-To: ". $result->msgid ."\n"; + $mid['References'] = $result->msgid; + $mid['In-Reply-To'] = $result->msgid; } //common headers $dir = str_replace("/", ".", substr(strchr(str_replace("http://", "", $base_url), "/"), 1)); @@ -276,7 +279,7 @@ function listhandler_send_mail($edit) { $edit["tid"] = $mbox[2]; // We add tokens to the MID. Replies to comments sent by listhandler can thus be classified easier. $msgid = ""; - $mid .= "Message-Id: ". $msgid ."\n"; + $mid['Message-Id']=$msgid; // send mail $file = drupal_get_path('module', 'listhandler') .'/mail.inc'; if (file_exists($file)) { @@ -290,16 +293,30 @@ function listhandler_send_mail($edit) { $subject = strip_tags($edit['subject']); $body = strip_tags($edit['comment']); } - - // OLD $err = user_mail($address, $subject, $body, "From: ". $edit["name"] ." <". $edit["mail"] .">\n". $mid); - - $err = drupal_mail($mid, $address, $subject, $body, $edit["mail"]); + $attachments=''; + if (is_array($edit['files'])) { + foreach ($edit['files'] as $key => $ufile) { + $href = file_create_url((strpos($ufile['fid'], 'upload') === FALSE ? $ufile['filepath'] : file_create_filename($ufile['filename'], file_create_path()))); + $text = $ufile['description'] ? $ufile['description'] : $ufile['filename'] ; + $attachments .= "\n".$href; + } + if (!empty($attachments)) { + $body .= "\n\n".t('Attachment').":\n"; + $body .= $attachments; + } + } + $ok = drupal_mail('listhandler-mail', $address, $subject, $body, $edit["mail"],$mid); // 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))); + if ($ok) { + watchdog('listhandler', t("'!s' sent to '!a'.", array("!s" => $edit["subject"], "!a" => $address))); + watchdog('listhandler', t("'!s'", array("!s" => "$address, $subject, ".$edit["mail"].", $mid"))); + } else { + watchdog('listhandler', t("Error sending '!s' to '!a'.", array("!s" => $edit["subject"], "!a" => $address))); + } } }