47 if (!isset($msg->headers[$this->get_setting(
'generic_detect_header')]))
return FALSE;
48 $header = $msg->headers[$this->
get_setting(
'generic_detect_header')];
49 dpm($header,
'generic_list_match');
60 drupal_alter(
'mailinglist_message', $message, $this);
61 module_invoke_all(
'mailinglist_message', $message, $this);
81 return array(
'next' => FALSE);
100 $path = variable_get(
'file_private_path');
104 $path = file_directory_temp();
107 $path = DRUPAL_ROOT .
'/' . $path;
110 $cookie = $path .
"/mailinglist_cookie.inc";
111 $handle = curl_init($url);
112 curl_setopt($handle, CURLOPT_CRLF, TRUE);
113 curl_setopt($handle, CURLOPT_HEADER, TRUE);
114 curl_setopt($handle, CURLOPT_USERAGENT, $_SERVER[
'HTTP_USER_AGENT']);
115 curl_setopt($handle, CURLOPT_FOLLOWLOCATION, TRUE);
116 curl_setopt($handle, CURLOPT_COOKIEJAR, $cookie);
117 curl_setopt($handle, CURLOPT_COOKIEFILE, $cookie);
118 curl_setopt($handle, CURLOPT_RETURNTRANSFER, TRUE);
120 curl_setopt($handle, CURLOPT_POST, TRUE);
121 curl_setopt($handle, CURLOPT_POSTFIELDS, $post);
123 $page = curl_exec($handle);
124 $page = str_replace(
"\r\n",
"\n", $page);
125 $headerbreak = strpos($page,
"\n\n");
126 $headers = substr($page, 0, $headerbreak);
127 $body = substr($page, $headerbreak+2);
130 $headers = str_replace(array(
"\n ",
"\n\t"),
" ", $headers);
131 $headers = explode(
"\n", $headers);
133 foreach ($headers as $header) {
134 $colon = strpos($header,
':');
135 if ($colon === FALSE) {
139 $sub = substr($header, 0, $colon);
140 $value = substr($header, $colon+1);
141 if (isset($head[$sub])) {
142 if (!is_array($head[$sub])) {
143 $head[$sub] = array($head[$sub]);
145 $head[$sub][] = trim($value);
148 $head[$sub] = trim($value);
153 $page = array(
'header' => $head,
'body' => $body);
170 parent::edit_form($form, $form_state);
173 $form[
'info'][
'admin_title'][
'#description'] = t(
'Suggested, but not required, to be the email address of the maiinglist.');
175 $form[
'basic'][
'settings'][
'to_address'] = array(
176 '#type' =>
'textfield',
177 '#title' => t(
'To Address'),
178 '#default_value' => $this->
get_setting(
'to_address'),
180 '#description' => t(
'The Email address to send messages to the list'),
184 $form[
'basic'][
'settings'][
'from_address'] = array(
185 '#type' =>
'textfield',
186 '#title' => t(
'From Address'),
187 '#default_value' => $this->
get_setting(
'from_address'),
189 '#description' => t(
'The default From address the site should use to send Email to the list'),
193 if (!isset($form[
'basic'][
'settings'][
'detect_method'])) {
195 $form[
'basic'][
'settings'][
'detect_method'] = array(
197 '#title' => t(
'Message Detection'),
198 '#options' => array(
'rfc' =>
'RFC-2369',
'generic' =>
'Generic'),
199 '#default_value' => $this->
get_setting(
'detect_method'),
200 '#description' => t(
'The method to use to detect messages from list'),
207 $form[
'basic'][
'settings'][
'detect_method_menu'] = array(
209 '#value' => isset($form[
'basic'][
'settings'][
'detect_method'][
'#default_value']) ? $form[
'basic'][
'settings'][
'detect_method'][
'#default_value'] : $form[
'basic'][
'settings'][
'detect_method'][
'#value']
212 if ($form[
'basic'][
'settings'][
'detect_method_menu'][
'#value'] ==
'generic') {
213 $form[
'basic'][
'settings'][
'generic_detect_header'] = array(
214 '#type' =>
'textfield',
215 '#title' => t(
'Header'),
216 '#default_value' => $this->
get_setting(
'generic_detect_header'),
218 '#description' => t(
'The Header to check to see if message comes from the list'),
221 $form[
'basic'][
'settings'][
'generic_detect_regex'] = array(
222 '#type' =>
'textfield',
223 '#title' => t(
'Regex'),
224 '#default_value' => $this->
get_setting(
'generic_detect_regex'),
226 '#description' => t(
'Regex to test Header with'),
230 elseif ($form[
'basic'][
'settings'][
'detect_method'][
'#default_value'] ==
'rfc') {
231 $form[
'basic'][
'settings'][
'list_id'] = array(
232 '#type' =>
'textfield',
233 '#title' => t(
'List ID'),
236 '#description' => t(
'The value if the List-ID header to check for'),
241 $form[
'operations'] = array(
244 'operations' => array(
245 '#type' =>
'fieldset',
246 '#title' =>
'Enabled Operations',
248 '#collapsible' => TRUE,
249 '#collapsed' => FALSE,
253 foreach ($opers as $key => $oper) {
256 $form[
'operations'][
'operations'][$key] = array(
257 '#type' =>
'checkbox',
258 '#title' => check_plain($oper->plugin[
'name']),
259 '#default_value' => isset($this->operations[$key]) && !empty($this->operations[$key]),
270 parent::edit_form_validate($form, $form_state);
272 if (!valid_email_address($form_state[
'input'][
'settings'][
'to_address'])) {
273 form_set_error(
'to_address',
'To email address is not valid');
275 if (!valid_email_address($form_state[
'input'][
'settings'][
'from_address'])) {
276 form_set_error(
'from_address',
'From email address is not valid');
278 if ($form_state[
'input'][
'settings'][
'detect_method'] != $form_state[
'input'][
'settings'][
'detect_method_menu']) {
279 form_set_error(
'detect_method',
'Type Changed, Check Settings!');
Interface MailinglistMessageInterface.
genericListMatch(MailinglistMessageInterface $msg)
generic_list_match()
schema(&$schema, $type)
schema()
get_setting($name, $def=NULL)
get_settings()
edit_form_validate(&$form, &$form_state)
edit_form_validate()
Interface to a mailing list.
getWebPage($url, $post="")
getWebPage
checkMessage(MailinglistMessageInterface $msg)
Called on each message read from a mailbox to see if we want to process it.
mailinglist_operation_load_all()
mailinglist_operation_load_all()
Place for common code for classes used in export_ui classes.
edit_form(&$form, &$form_state)
Implements ctools_export_ui::edit_form(), cross linked via mailinglist_export_ui.class.php.
getMemberInfo($email)
getMemberInfo()
Retrieve messages from a Mailhandler Mailbox.
getMemberPage($page)
getMemberPage()
processMessage(MailinglistMessageInterface $message)
message_process()