Index: pontomail.module =================================================================== RCS file: /cvs/drupal/contributions/modules/pontomail/pontomail.module,v retrieving revision 1.30 diff -u -r1.30 pontomail.module --- pontomail.module 28 Sep 2006 14:10:42 -0000 1.30 +++ pontomail.module 5 Oct 2006 07:54:44 -0000 @@ -863,6 +863,40 @@ $imap = _pontomail_get_imap_obj($sid, $folder); } $message_obj = $imap->get_message($mid); + + // extract the email address, first and last names + $address = $message_obj->headers->fromaddress; + $address = preg_replace('/[<>"]/', '', $address); + if(preg_match('/\s/', $address)) { + $email = preg_replace('/.*\s/', '', $address); + $first_name = preg_replace('/(\S+).*/', '\1', $address); + $last_name = preg_replace('/\S+\s*(.*)\s\S+/', '\1', $address); + } else { + $email = $address; + } + + // if user is in drupal, we will print a picture + $picture = ''; + if (variable_get('user_pictures', 0)) { + if($account = db_fetch_object(db_query("SELECT * FROM {users} WHERE mail = '%s'", $email))) { + if ($account->picture && file_exists($account->picture)) { + $picture = file_create_url($account->picture); + } elseif(variable_get('user_picture_default', '')) { + $picture = variable_get('user_picture_default', ''); + } + + if (isset($picture)) { + $alt = t('%user\'s picture', array('%user' => $account->name)); + $picture = theme('image', $picture, $alt, $alt, '', false); + if(user_access('access user profiles')) { + $picture = l($picture, "user/$account->uid", array('title' => t('View user profile.')), NULL, NULL, FALSE, TRUE); + } + } + + $page .= "