--- aggregator.module.4.6.5	2006-01-25 23:06:08.000000000 -0800
+++ aggregator.module	2006-01-25 23:10:53.000000000 -0800
@@ -272,16 +272,40 @@ function aggregator_remove($feed) {
  * Call-back function used by the XML parser.
  */
 function aggregator_element_start($parser, $name, $attributes) {
-  global $item, $element, $tag;
+  global $item, $element, $tag, $items, $channel;
 
   switch ($name) {
     case 'IMAGE':
     case 'TEXTINPUT':
+    case 'CONTENT':
+    case 'SUMMARY':
+    case 'TAGLINE':
+    case 'SUBTITLE':
+    case 'LOGO':
+    case 'INFO':
       $element = $name;
       break;
+    case 'ID':
+      if ($element != 'ITEM') {
+        $element = $name;
+      }
+    case 'LINK':
+      if ($attributes['REL'] == 'alternate') {
+        if ($element == 'ITEM') {
+          $items[$item]['LINK'] = $attributes['HREF'];
+        } else {
+          $channel['LINK'] = $attributes['HREF'];
+        }
+      }
+      break;
     case 'ITEM':
       $element = $name;
       $item += 1;
+      break;
+    case 'ENTRY':
+      $element = 'ITEM';
+      $item += 1;
+      break;
   }
 
   $tag = $name;
@@ -297,9 +321,17 @@ function aggregator_element_end($parser,
     case 'IMAGE':
     case 'TEXTINPUT':
     case 'ITEM':
+    case 'ENTRY':
+    case 'CONTENT':
+    case 'INFO':
+      $element = '';
+      break;
+    case 'ID':
+      if ($element == 'ID') {
       $element = '';
   }
 }
+}
 
 /**
  * Call-back function used by the XML parser.
@@ -312,8 +344,26 @@ function aggregator_element_data($parser
       $items[$item][$tag] .= $data;
       break;
     case 'IMAGE':
+    case 'LOGO':
       $image[$tag] .= $data;
       break;
+    case 'LINK':
+      if ($data) {
+        $items[$item][$tag] .= $data;
+      }
+      break;
+    case 'CONTENT':
+      $items[$item]['CONTENT'] .= $data;
+      break;
+    case 'SUMMARY':
+      $items[$item]['SUMMARY'] .= $data;
+      break;
+    case 'TAGLINE':
+    case 'SUBTITLE':
+      $channel['DESCRIPTION'] .= $data;
+      break;
+    case 'INFO':
+    case 'ID':
     case 'TEXTINPUT':
       // The sub-element is not supported. However, we must recognize
       // it or its contents will end up in the item array.
@@ -488,7 +538,6 @@ function aggregator_parse_feed(&$data, $
       }
       $item[$key] = $value;
     }
-
     /*
     ** Resolve the item's title.  If no title is found, we use
     ** up to 40 characters of the description ending at a word
@@ -516,6 +565,14 @@ function aggregator_parse_feed(&$data, $
       $link = $feed['link'];
     }
 
+    /**
+     * Atom feeds have a CONTENT and/or SUMMARY tag instead of a DESCRIPTION tag
+     */
+    if ($item['CONTENT']) {
+      $item['DESCRIPTION'] = $item['CONTENT'];
+    } else if ($item['SUMMARY']) {
+      $item['DESCRIPTION'] = $item['SUMMARY'];
+    }
     /*
     ** Try to resolve and parse the item's publication date.  If no
     ** date is found, we use the current date instead.
@@ -1091,17 +1148,22 @@ function theme_aggregator_summary_item($
  */
 function theme_aggregator_page_item($item) {
   static $last;
+  global $user;
 
   $date = format_date($item->timestamp, 'custom', 'Ymd');
   if ($date != $last) {
     $last = $date;
     $output .= '<h3>'. format_date($item->timestamp, 'custom', 'F j, Y') ."</h3>\n";
   }
-
+  if ($user->uid && module_exist('blog') && user_access('edit own blog')) {
+    if ($image = theme('image', 'misc/blog.png', t('blog it'), t('blog it'))) {
+      $blogit_link = ''. l($image, 'node/add/blog', array('title' => t('Post this news item as a blog entry.'), 'class' => 'blog-it'), "iid=$item->iid", NULL, FALSE, TRUE) .'';
+    }
+  }
   $output .= "<div class=\"news-item\">\n";
   $output .= ' <div class="date">'. format_date($item->timestamp, 'custom', 'H:i') ."</div>\n";
   $output .= " <div class=\"body\">\n";
-  $output .= '  <div class="title"><a href="'. check_url($item->link) .'">'. check_plain($item->title) ."</a></div>\n";
+  $output .= '  <div class="title"><a href="'. check_url($item->link) .'">'. check_plain($item->title) ."</a>  &nbsp;&nbsp;$blogit_link&nbsp;&nbsp;$story_link</div>\n";
   if ($item->description) {
     $output .= '  <div class="description">'. $item->description ."</div>\n";
   }
