Mailinglist
 All Data Structures Files Functions Variables Pages
Public Member Functions
MailinglistMailboxRetrieve Class Reference

Retrieve messages from a local mailbox file. More...

Inheritance diagram for MailinglistMailboxRetrieve:
Inheritance graph
[legend]
Collaboration diagram for MailinglistMailboxRetrieve:
Collaboration graph
[legend]

Public Member Functions

 __destruct ()
 Destructor. More...
 
ctools_export_ui
 edit_form (&$form, &$form_state)
 Implements ctools_export_ui::edit_form(). More...
 
 edit_form_validate (&$form, &$form_state)
 Implements ctools_export_ui::edit_form_validate(). More...
 
 edit_form_submit (&$form, &$form_state)
 Implements ctools_export_ui::edit_form_submit(). More...
 
MailinglistRetrieveInterface
 get_message_list ($max=0)
 Overrides/Implements Mailinglist:Retrieve::get_message_list Connect to mailbox and run message retrieval. More...
 
 get_message ($id)
 Overrides/Implements MailinglistRetrieve::get_message(). More...
 
 purge_message ($id)
 Overrides/Implements MailinglistRetrieve::purge_message();. More...
 
 close ()
 Overrides/Implements MailinglistRetrieve::close(). More...
 
- Public Member Functions inherited from MailinglistRetrieve
 test ()
 Test connection. More...
 
 get_message_list ($max=0)
 Returns a list of messages that are available. More...
 
 get_message ($id)
 Get an email message by its id code (what is returned by get_message_list() More...
 
 purge_message ($id)
 mark message for deletion More...
 
 close ()
 delete marked messages and close connection More...
 
 edit_form (&$form, &$form_state)
 Implements ctools_export_ui::edit_form(). More...
 
 edit_form_validate (&$form, &$form_state)
 Implements ctools_export_ui::edit_form_validate(). More...
 
 edit_form_submit (&$form, &$form_state)
 Implements ctools_export_ui::edit_form_submit(). More...
 
- Public Member Functions inherited from MailinglistExportable
 get_setting ($name, $def=NULL)
 get_settings() More...
 
 created ()
 created() More...
 
 edited ($old)
 edited() More...
 
 changedType (MailinglistPolymorpicExportableInterface $old)
 changedType() More...
 
 delete ()
 delete() More...
 
 baseName ()
 baseName() More...
 
 edit_form (&$form, &$form_state)
 Implements ctools_export_ui::edit_form() called via mailinglist_export_ui Build an edit form for our object. More...
 
 edit_form_validate (&$form, &$form_state)
 Implements ctools_export_ui::edit_form_validate(). More...
 
 edit_form_submit (&$form, &$form_state)
 Implements ctools_export_ui::edit_form_submit(). More...
 
 log ($str, $level=self::LOG_NOTICE, $parms=array())
 log() More...
 
 log_screen ($str, $parms=array(), $level=self::LOG_NOTICE)
 log_screen() More...
 
 log_db ($str, $parms=array(), $level=self::LOG_ERROR)
 log_db(). More...
 
 log_file ($str, $parms=array(), $level=self::LOG_INFO)
 log_file(). More...
 
MailinglistPolymorphicExportableInterface
MailinglistRetrieveInterface

Additional Inherited Members

- Data Fields inherited from MailinglistExportable
 $object_type
 The type of object we are. More...
 
 $settings
 Generic Array to hold misc settings so all can use same schema. More...
 
 $export_type
 Needed by CTools. More...
 
const LOG_OFF = 0
 
const LOG_SCREEN = 1
 
const LOG_DB = 2
 
const LOG_DB_SCREEN = 3
 
const LOG_FILE = 4
 
const LOG_FILE_SCREEN = 5
 
const LOG_DEBUG = WATCHDOG_DEBUG
 
const LOG_INFO = WATCHDOG_INFO
 
const LOG_NOTICE = WATCHDOG_NOTICE
 
const LOG_WARNING = WATCHDOG_WARNING
 
const LOG_ERROR = WATCHDOG_ERROR
 
const LOG_CRITICAL = WATCHDOG_CRITICAL
 
const LOG_ALERT = WATCHDOG_ALERT
 
const LOG_EMERGENCY = WATCHDOG_EMERGENCY
 
 $logging_screen = self::LOG_DEBUG
 
 $logging_db = self::LOG_INFO
 
 $logging_file = self::LOG_DEBUG
 

Detailed Description

Retrieve messages from a local mailbox file.

Definition at line 10 of file MailinglistMailboxRetrieve.class.php.

Constructor & Destructor Documentation

__destruct ( )

Destructor.

Definition at line 200 of file MailinglistMailboxRetrieve.class.php.

200  {
201  }

Member Function Documentation

close ( )

Overrides/Implements MailinglistRetrieve::close().

Implements MailinglistRetrieveInterface.

Definition at line 192 of file MailinglistMailboxRetrieve.class.php.

192  {
193  }
edit_form ( $form,
$form_state 
)

Implements ctools_export_ui::edit_form().

called via mailinglist_export_ui

Definition at line 21 of file MailinglistMailboxRetrieve.class.php.

References _mailinglist_decode_password(), and MailinglistExportable\get_setting().

21  {
22  parent::edit_form($form, $form_state);
23  global $cookie_domain;
24 
25  /* Parameters that we need:
26  Base:
27  Hostname:
28  Port:
29  Timeout:
30  UseSocket
31  Username:
32  Password:
33 
34  Extra:
35  APOPDetect:
36  Delete when done:
37  Logging: No, Yes, Yes-ShowPasswords
38  */
39 
40  $ajax_settings = array(
41  'callback' => '_mailinglist_mailbox_test',
42  'wrapper' => 'mailinglist_test_results',
43  'event' => 'change',
44  'progress' => array(
45  'type' => 'throbber',
46  'message' => t('Please wait - testing connection settings...'),
47  ),
48  );
49  $form['connection']['settings']['domain'] = array(
50  '#type' => 'textfield',
51  '#title' => t('Domain'),
52  '#default_value' => $this->get_setting('domain'),
53  '#required' => TRUE,
54  '#description' => t('The domain of the server used to collect mail.'),
55  '#ajax' => $ajax_settings,
56  );
57  $form['connection']['settings']['port'] = array(
58  '#type' => 'textfield',
59  '#title' => t('Port'),
60  '#size' => 5,
61  '#maxlength' => 5,
62  '#default_value' => $this->get_setting('port'),
63  '#description' => t('The mailbox port number (usually 110 for POP3).'),
64  '#element_validate' => array('element_validate_integer_positive'),
65  '#required' => TRUE,
66  '#ajax' => $ajax_settings,
67  );
68  $form['connection']['settings']['name'] = array(
69  '#type' => 'textfield',
70  '#title' => t('Username'),
71  '#default_value' => $this->get_setting('name'),
72  '#required' => TRUE,
73  '#description' => t('This username is used while logging into this mailbox during mail retrieval.'),
74  '#ajax' => $ajax_settings,
75  );
76  $form['connection']['settings']['pass'] = array(
77  '#type' => 'textfield',
78  '#title' => t('Password'),
79  '#default_value' => _mailinglist_decode_password($this->get_setting('pass')),
80  '#description' => t('The mailbox password corresponding to the username above. Consider using a non-vital password, since this field is stored with minimal encryption in the database and displayed here.'),
81  '#ajax' => $ajax_settings,
82  );
83 
84  $form['connection']['settings']['results'] = array(
85  '#type' => 'container',
86  '#attributes' => array(
87  'id' => 'mailinglist_test_results',
88  ),
89  );
90 
91  $form['connection']['settings']['timeout'] = array(
92  '#type' => 'textfield',
93  '#title' => t('Timeout'),
94  '#size' => 5,
95  '#maxlength' => 5,
96  '#default_value' => $this->get_setting('timeout', 10),
97  '#description' => t('Timeout (in Sec) to connect to server'),
98  '#element_validate' => array('element_validate_number'),
99  '#required' => TRUE,
100  '#ajax' => $ajax_settings,
101  );
102 
103  $form['extra']['settings']['apop'] = array(
104  '#type' => 'checkbox',
105  '#title' => t('Detect APOP?'),
106  '#default_value' => $this->get_setting('apop', FALSE),
107  '#description' => t('Check to enable APOP protocal detection'),
108  );
109 
110  $form['extra']['settings']['delete_after_read'] = array(
111  '#type' => 'checkbox',
112  '#title' => t('Delete messages after they are processed?'),
113  '#default_value' => $this->get_setting('delete_after_read', TRUE),
114  '#description' => t('Uncheck this box to leave read messages in the mailbox. They will not be processed again unless they become marked as unread. You normallys should check this box.'),
115  );
116 
117  $form['extra']['settings']['ipv6'] = array(
118  '#type' => 'checkbox',
119  '#title' => t('IPv6'),
120  '#default_value' => $this->get_setting('ipv6', FALSE),
121  '#description' => t('Use IPv6'),
122  );
123 
124  }
get_setting($name, $def=NULL)
get_settings()
_mailinglist_decode_password($code)
_mailinglist_decode_password

Here is the call graph for this function:

edit_form_submit ( $form,
$form_state 
)

Implements ctools_export_ui::edit_form_submit().

Called via mailinglist_export_ui.

Definition at line 151 of file MailinglistMailboxRetrieve.class.php.

151  {
152  parent::edit_form_submit($form, $form_state);
153  }
edit_form_validate ( $form,
$form_state 
)

Implements ctools_export_ui::edit_form_validate().

Called via mailinglist_export_ui.

Definition at line 130 of file MailinglistMailboxRetrieve.class.php.

130  {
131  parent::edit_form_validate($form, $form_state);
132  if ($form_state['values']['settings']['port'] < 1 || 65535 < $form_state['values']['settings']['port']) {
133  form_set_error('port', t('Port must be between 1 and 65535'));
134  }
135 
136  if ($form_state['values']['settings']['port'] != 110) {
137  drupal_set_message(t('Non-standard Pop3 Port: @port', array('@port' => (int)$form_state['values']['settings']['port'])), 'warning');
138  }
139 
140  // If POP3 mailbox is chosen, messages should be deleted after processing.
141  // Do not set an actual error because this is helpful for testing purposes.
142  if ( $form_state['values']['settings']['delete_after_read'] == 0) {
143  drupal_set_message(t('Unless you check off "Delete messages after they are processed" when using a POP3 mailbox, old emails will be re-imported each time the mailbox is processed.'), 'warning');
144  }
145  }
get_message (   $id)

Overrides/Implements MailinglistRetrieve::get_message().

Implements MailinglistRetrieveInterface.

Definition at line 178 of file MailinglistMailboxRetrieve.class.php.

178  {
179  $msg = "";
180  return new MailinglistMessage($msg);
181  }
Class defining the contents of an e-mail message.
get_message_list (   $max = 0)

Overrides/Implements Mailinglist:Retrieve::get_message_list Connect to mailbox and run message retrieval.

Returns
array Retrieved messages.

Implements MailinglistRetrieveInterface.

Definition at line 170 of file MailinglistMailboxRetrieve.class.php.

170  {
171  $res = array();
172  return $res;
173  }
purge_message (   $id)

Overrides/Implements MailinglistRetrieve::purge_message();.

Implements MailinglistRetrieveInterface.

Definition at line 186 of file MailinglistMailboxRetrieve.class.php.

186  {
187  }

The documentation for this class was generated from the following file: