Author: jflesch
Date: 2007-04-19 22:17:37 +0000 (Thu, 19 Apr 2007)
New Revision: 12808

Modified:
   trunk/apps/Thaw/src/thaw/plugins/index/Comment.java
   trunk/apps/Thaw/src/thaw/plugins/index/Index.java
Log:
Fix new comments detection

Modified: trunk/apps/Thaw/src/thaw/plugins/index/Comment.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/index/Comment.java 2007-04-19 22:03:08 UTC 
(rev 12807)
+++ trunk/apps/Thaw/src/thaw/plugins/index/Comment.java 2007-04-19 22:17:37 UTC 
(rev 12808)
@@ -380,6 +380,8 @@
         * @return false if already in the bdd or if there is any error
         */
        public boolean parseComment(java.io.File xmlFile) {
+               newComment = false;
+
                Logger.info(this, "Parsing comment ...");

                FileInputStream in;
@@ -430,6 +432,8 @@
                                                return false;
                                        }

+                                       Logger.info(this, "New comment !");
+
                                        newComment = true;

                                        st = 
db.getConnection().prepareStatement("INSERT INTO indexComments "+
@@ -454,6 +458,9 @@



+       /**
+        * On freenet
+        */
        public boolean exists() {
                return (comment != null && author != null);
        }

Modified: trunk/apps/Thaw/src/thaw/plugins/index/Index.java
===================================================================
--- trunk/apps/Thaw/src/thaw/plugins/index/Index.java   2007-04-19 22:03:08 UTC 
(rev 12807)
+++ trunk/apps/Thaw/src/thaw/plugins/index/Index.java   2007-04-19 22:17:37 UTC 
(rev 12808)
@@ -855,6 +855,8 @@
                                nmbFailedCommentFetching = 0;

                                if (c.isNew()) {
+                                       Logger.info(this, "New comment !");
+
                                        setNewCommentFlag(true);

                                        setChanged();
@@ -1762,6 +1764,17 @@
         * will reset the comments !
         */
        public void setCommentKeys(String publicKey, String privateKey) {
+               String oldPubKey = getCommentPublicKey();
+               String oldPrivKey = getCommentPrivateKey();
+
+               if ( ((publicKey == null && oldPubKey == null)
+                     || (publicKey != null && publicKey.equals(oldPubKey)))
+                    &&
+                    ((privateKey == null && oldPrivKey == null)
+                     || (privateKey != null && privateKey.equals(oldPrivKey))) 
)
+                       return; /* same keys => no change */
+
+
                purgeCommentKeys();

                try {


Reply via email to