Index: pontomail.module
===================================================================
RCS file: /cvs/drupal/contributions/modules/pontomail/pontomail.module,v
retrieving revision 1.31
diff -u -r1.31 pontomail.module
--- pontomail.module	5 Oct 2006 08:59:41 -0000	1.31
+++ pontomail.module	5 Oct 2006 11:42:52 -0000
@@ -195,8 +195,11 @@
   else if($op == 'view') {
     switch($delta) {
       case 0:
-        $block['subject'] = 'Mail View';
+        $block['subject'] = 'Mail view';
         //$block['content'] = 'Mail Content';
+        if(module_exist('pontomail_sendmail')) {
+          $block['content'] .= '<li class="leaf">'. l(t('compose'), 'pontomail/compose') .'</li>'."\n";
+        }
         if(variable_get('pontomail_use_predefined_server', '') && !$_SESSION['mail_auth_session']['error']) {
           $row['sid'] = -1;
           $row['server_name'] = variable_get('pontomail_server_name', '');
@@ -236,10 +239,9 @@
   global $user;
   $str = '';
   if((arg(1) == 'viewmailbox' || arg(0) == 'pontomail') && arg(3) == $row['sid']) {
-    $imap = new IMAPService();
+    $imap = _pontomail_get_imap_obj($row['sid']);
     $str .= '<li class="expanded">'. l($row['server_name'], 'pontomail/viewmailbox/accounts/'. $row['sid']) .'</li>'."\n";
     // List Subscribed Mail Boxes for this Account
-    $imap->connect($row['server_address'], $row['server_port'], $user->name, $_SESSION['mail_auth_session']['password'], "", $row);
     $str .= '<ul>'."\n";
     if($imap->open()) {
       $subs = $imap->get_subscriptions();
