Package net.sourceforge.pebble.event.response

Examples of net.sourceforge.pebble.event.response.IpAddressListener


    if (SecurityUtils.isUserAuthorisedForBlog(blog)) {
      return false;
    } else {
      // run a subset of the default comment listeners to figure out whether
      // the comment is spam
      CommentListener listener1 = new IpAddressListener();
      CommentListener listener2 = new LinkSpamListener();
      CommentListener listener3 = new ContentSpamListener();
      CommentListener listener4 = new SpamScoreListener();
      CommentEvent event = new CommentEvent(comment, CommentEvent.COMMENT_ADDED);

      listener1.commentAdded(event);
      listener2.commentAdded(event);
      listener3.commentAdded(event);
      listener4.commentAdded(event);

      return (required != null && required.equalsIgnoreCase("true")) || !comment.isApproved();
View Full Code Here


   *
   * @param blog    a Blog instance
   */
  public static void buildIpAddressLists(Blog blog) {
    Iterator blogEntries = blog.getBlogEntries().iterator();
    IpAddressListener ipAddressListener = new IpAddressListener();

    while (blogEntries.hasNext()) {
      BlogEntry blogEntry = (BlogEntry)blogEntries.next();
      log.info("Processing " + blogEntry.getTitle() + " (" + blogEntry.getDate() + ")");
      Iterator comments = blogEntry.getComments().iterator();
      while (comments.hasNext()) {
        Comment comment = (Comment)comments.next();
        if (comment.isApproved()) {
          CommentEvent event = new CommentEvent(comment, CommentEvent.COMMENT_APPROVED);
          ipAddressListener.commentApproved(event);
        } else if (comment.isRejected()) {
          CommentEvent event = new CommentEvent(comment, CommentEvent.COMMENT_REJECTED);
          ipAddressListener.commentRejected(event);
        }
      }

      Iterator trackbacks = blogEntry.getTrackBacks().iterator();
      while (trackbacks.hasNext()) {
        TrackBack trackback = (TrackBack)trackbacks.next();
        if (trackback.isApproved()) {
          TrackBackEvent event = new TrackBackEvent(trackback, TrackBackEvent.TRACKBACK_APPROVED);
          ipAddressListener.trackBackApproved(event);
        } else if (trackback.isRejected()) {
          TrackBackEvent event = new TrackBackEvent(trackback, TrackBackEvent.TRACKBACK_REJECTED);
          ipAddressListener.trackBackRejected(event);
        }
      }
//
//      try {
//        blogEntry.store();
View Full Code Here

TOP

Related Classes of net.sourceforge.pebble.event.response.IpAddressListener

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.