// return true if the post is new, false if old
  private boolean handlePost(
      JDFeedMeFeed feed, JDFeedMePost post, String post_description, String timestamp) {
    // make sure this rss item is indeed newer than what we have
    if (post.isTimestampNewer(timestamp)) {
      if (JDFeedMe.VERBOSE)
        logger.info("JDFeedMe found new item with timestamp: [" + post.getTimestamp() + "]");
      post.setNewpost(true);

      // check for filters on this item (see if it passes download filters)
      boolean need_to_add = runFilterOnPost(feed, post, post_description);

      // if we don't need to add, we can return now
      if (!need_to_add) {
        if (JDFeedMe.VERBOSE)
          logger.info(
              "JDFeedMe new item title: ["
                  + post.getTitle()
                  + "] description: ["
                  + post_description
                  + "] did not pass filters");
        post.setAdded(JDFeedMePost.ADDED_NO);
      } else {
        // start processing this rss item - we're going to download it
        downloadPost(feed, post, post_description);
      }

      // update the post history
      gui.addPostToFeed(post, feed);

      return true;
    } else {
      if (JDFeedMe.VERBOSE)
        logger.info("JDFeedMe ignoring item with old timestamp: [" + post.getTimestamp() + "]");
      return false;
    }
  }
  private String parseFeed(JDFeedMeFeed feed, String timestamp, String content) throws Exception {
    String new_timestamp = timestamp;
    boolean found_new_posts = false;

    // parse the rss xml
    RssParser feed_parser = new RssParser(feed);
    feed_parser.parseContent(content);
    int feed_item_number = 0;
    JDFeedMePost post = null;
    while ((post = feed_parser.getPost()) != null) {
      feed_item_number++;

      // get the original description
      String post_description = post.getDescription();

      // originally we removed the description from the posts since posts are saved in xml and this
      // could become large
      // new feature: let's do save the description, but make it somewhat shorter (extract links
      // from it)
      post.setDescription(
          extractLinksFromHtml(
              post_description, JDFeedMeFeed.HOSTER_ANY_HOSTER, JDFeedMeFeed.HOSTER_EXCLUDE));

      // handle the rss item
      if (post.isValid()) {
        boolean is_new = handlePost(feed, post, post_description, timestamp);
        if (is_new) found_new_posts = true;
        if (post.isTimestampNewer(new_timestamp)) new_timestamp = post.getTimestamp();
      } else {
        logger.severe(
            "JDFeedMe rss item "
                + Integer.toString(feed_item_number)
                + " is invalid for feed: "
                + feed.getAddress());
      }
    }

    // if found new posts, update the feed
    if (found_new_posts) gui.setFeedNewposts(feed, true);

    return new_timestamp;
  }