Index: ./twitter/twitter.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/twitter/twitter.module,v
retrieving revision 1.1
diff -u -p -r1.1 twitter.module
--- ./twitter/twitter.module	23 Jan 2007 17:05:50 -0000	1.1
+++ ./twitter/twitter.module	26 Jan 2007 03:20:44 -0000
@@ -25,6 +25,10 @@ function twitter_user($op, &$edit, &$acc
         '#title' => t('Text format'),
         '#default_value' => $edit['twitter_text'],
         '#description' => t('Format of the text to submit. Use !title and !url for the post title and url respectively.'));
+			$form['twitter']['twitter_timeline'] = array(
+        '#type' => 'checkbox',
+        '#title' => t('Show your twitter timeline on profile'),
+ 				'#default_value' => $edit['twitter_timeline']);
       return $form;
     case 'insert':
     case 'update':
@@ -32,6 +36,15 @@ function twitter_user($op, &$edit, &$acc
         $edit['twitter_encrypted'] = base64_encode($edit['twitter_user'] .':'. $edit['twitter_pass']);
       }
       unset($edit['twitter_pass']);
+			return;
+		case 'view':
+			if ($account->twitter_timeline) {
+				
+				$items[] = array('title' => twitter_get_friends_timeline($account));
+
+		    return array(t('Twitter Timeline') => $items);
+	    }
+			return;
   }
 }
 
@@ -64,4 +77,31 @@ function twitter_post($node, $account) {
 
   $result = drupal_http_request(TWITTER_URL, $headers, 'POST', $data);
   drupal_set_message(t('Posted to twitter.com'));
-}
\ No newline at end of file
+}
+
+/**
+* Grab the latest posts from you and your twitter friends.
+*/
+function twitter_get_friends_timeline($account) {
+  if (empty($account->twitter_encrypted)) {
+    return false;
+  }
+  $headers = array('Authorization' => 'Basic '. $account->twitter_encrypted,
+                   'Content-type' => 'application/x-www-form-urlencoded');
+  
+  $result = drupal_http_request('http://twitter.com/statuses/friends_timeline.xml', $headers, 'POST');
+	$xml = new SimpleXMLElement($result->data);
+	foreach ($xml->status as $message){
+		$output .= theme('twitter_message', $message);
+	}
+	return $output;
+}
+
+/**
+* Theme each meesage.
+*/
+function theme_twitter_message($message){
+	$output = $message->text . "  From " . $message->user->name . " on " . format_date(strtotime($message->created_at)) . "<br /><br />";
+	return $output; 
+}
+	
\ No newline at end of file
