Index: mailhandler.admin.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/mailhandler/Attic/mailhandler.admin.inc,v
retrieving revision 1.1.2.16
diff -u -r1.1.2.16 mailhandler.admin.inc
--- mailhandler.admin.inc	26 Jan 2011 23:48:13 -0000	1.1.2.16
+++ mailhandler.admin.inc	27 Jan 2011 14:29:40 -0000
@@ -345,29 +345,44 @@
   return;
 }
 
-
+/**
+ * Displays a list of mailboxes with operations.
+ *
+ * @return
+ * Mailboxes list rendered content.
+ */
 function mailhandler_list_mailboxes() {
-
-  $header = array(t('Mailbox'), t('Folder'), array('data' => t('Operations'), 'colspan' => 4));
   $rows = array();
-  $result = db_query('SELECT * FROM {mailhandler} ORDER BY mail');
-  while ($mailbox = db_fetch_object($result)) {
+
+  // Define a table header.
+  $header = array(
+    t('Mailbox'),
+    t('Folder'),
+    array('data' => t('Operations'), 'colspan' => 4)
+  );
+
+  // Show all the emails configured.
+  foreach (mailhandler_mailbox_load_multiple() as $mid => $mailbox) {
     $rows[] = array(
       '<a href="mailto:'. $mailbox->mail .'">'. $mailbox->mail .'</a>',
       $mailbox->folder ? check_plain($mailbox->folder) : '',
-      l(t('Retrieve'), 'admin/content/mailhandler/retrieve/'.$mailbox->mid, array('title' => t('Retrieve and process pending e-mails in this mailbox'))),
-      l(t('Edit'), 'admin/content/mailhandler/edit/'.$mailbox->mid, array('title' => t('Edit this mailbox configuration'))),
-      l(t('Clone'), 'admin/content/mailhandler/clone/'.$mailbox->mid, array('title' => t('Add a new mailbox, using this mailbox configuration as a template'))),
-      l(t('Delete'), 'admin/content/mailhandler/delete/'.$mailbox->mid, array('title' => t('Delete this mailbox'))),
+      l(t('Retrieve'), 'admin/content/mailhandler/retrieve/'.  $mid,
+        array('attributes' => array('title' => t('Retrieve and process pending e-mails in this mailbox')))),
+      l(t('Edit'), 'admin/content/mailhandler/edit/' . $mid,
+        array('attributes' => array('title' => t('Edit this mailbox configuration')))),
+      l(t('Clone'), 'admin/content/mailhandler/clone/' . $mid,
+        array('attributes' => array('title' => t('Add a new mailbox, using this mailbox configuration as a template')))),
+      l(t('Delete'), 'admin/content/mailhandler/delete/' . $mid,
+        array('attributes' => array('title' => t('Delete this mailbox')))),
     );
   }
 
-  if (empty($rows)) {
-    $rows[] = array(array('data' => '<em>'. t('No mailboxes have been defined.') .'</em>', 'colspan' => 4));
-  }
-
-  return theme('table', $header, $rows);
-
+  // Show the list of mailboxes as a themed table.
+  return theme(
+    'table',
+    $header,
+    count($rows) ? $rows : array(array('data' => '<em>'. t('No mailboxes have been defined.') .'</em>', 'colspan' => 4))
+  );
 }
 
 

