roller-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From snoopd...@apache.org
Subject svn commit: r355278 - /incubator/roller/trunk/src/org/roller/presentation/servlets/TrackbackServlet.java
Date Thu, 08 Dec 2005 23:33:32 GMT
Author: snoopdave
Date: Thu Dec  8 15:33:28 2005
New Revision: 355278

URL: http://svn.apache.org/viewcvs?rev=355278&view=rev
Log:
Put unverified trackbacks into moderation queue instead of rejecting them outright

Modified:
    incubator/roller/trunk/src/org/roller/presentation/servlets/TrackbackServlet.java

Modified: incubator/roller/trunk/src/org/roller/presentation/servlets/TrackbackServlet.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/src/org/roller/presentation/servlets/TrackbackServlet.java?rev=355278&r1=355277&r2=355278&view=diff
==============================================================================
--- incubator/roller/trunk/src/org/roller/presentation/servlets/TrackbackServlet.java (original)
+++ incubator/roller/trunk/src/org/roller/presentation/servlets/TrackbackServlet.java Thu
Dec  8 15:33:28 2005
@@ -121,6 +121,7 @@
         }
         
         String error = null;
+        boolean verified = true;
         PrintWriter pw = new PrintWriter(res.getOutputStream());
         try {
             if(!RollerRuntimeConfig.getBooleanProperty("users.trackbacks.enabled")) {
@@ -163,19 +164,19 @@
                         LinkbackExtractor linkback = new LinkbackExtractor(
                             comment.getUrl(), absurl + entry.getPermaLink());
                         if (linkback.getExcerpt() == null) {
-                           comment.setSpam(Boolean.TRUE);
-                           logger.debug("Trackback invalid: "+comment.getUrl());
-                           error = "REJECTED: your blog does not link to: " 
-                                   + absurl + entry.getPermaLink();
+                           comment.setPending(Boolean.TRUE);
+                           comment.setApproved(Boolean.FALSE);
+                           verified = false;
+                           logger.debug("Trackback failed verification: "+comment.getUrl());
                         }
                     }
                     
                     if (error == null) {
                         // If comment moderation is on, set comment as pending
-                        if (website.getModerateComments().booleanValue()) {
+                        if (verified && website.getModerateComments().booleanValue())
{
                             comment.setPending(Boolean.TRUE);   
                             comment.setApproved(Boolean.FALSE);
-                        } else { 
+                        } else if (verified) { 
                             comment.setPending(Boolean.FALSE);   
                             comment.setApproved(Boolean.TRUE);
                         } 
@@ -193,6 +194,11 @@
                         pw.println("<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>");
                         pw.println("<response>");
                         pw.println("<error>0</error>");
+                        if (comment.getPending().booleanValue()) {
+                            pw.println("<message>Trackback sumitted to moderation</message>");
+                        } else {
+                            pw.println("<message>Trackback accepted</message>");
+                        }
                         pw.println("</response>");
                         pw.flush();
                     }



Mime
View raw message