Author: jflesch Date: 2007-07-31 17:32:17 +0000 (Tue, 31 Jul 2007) New Revision: 14451
Added: trunk/apps/Thaw/images/min-window-new.png trunk/apps/Thaw/images/window-new.png trunk/apps/Thaw/licenses/one-jar-license.txt Modified: trunk/apps/Thaw/readme.txt trunk/apps/Thaw/src/thaw/core/ConfigWindow.java trunk/apps/Thaw/src/thaw/i18n/source.thaw_fr.properties trunk/apps/Thaw/src/thaw/i18n/thaw.properties trunk/apps/Thaw/src/thaw/i18n/thaw_fr.properties trunk/apps/Thaw/src/thaw/plugins/MiniFrost.java trunk/apps/Thaw/src/thaw/plugins/miniFrost/MiniFrostConfigTab.java trunk/apps/Thaw/src/thaw/plugins/miniFrost/frostKSK/KSKMessage.java trunk/apps/Thaw/src/thaw/plugins/miniFrost/frostKSK/KSKMessageParser.java trunk/apps/Thaw/src/thaw/plugins/signatures/Identity.java trunk/apps/Thaw/src/thaw/plugins/signatures/SigConfigTab.java Log: Implement message filtering (allow the use of regexs) Added: trunk/apps/Thaw/images/min-window-new.png =================================================================== (Binary files differ) Property changes on: trunk/apps/Thaw/images/min-window-new.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/apps/Thaw/images/window-new.png =================================================================== (Binary files differ) Property changes on: trunk/apps/Thaw/images/window-new.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/apps/Thaw/licenses/one-jar-license.txt =================================================================== --- trunk/apps/Thaw/licenses/one-jar-license.txt (rev 0) +++ trunk/apps/Thaw/licenses/one-jar-license.txt 2007-07-31 17:32:17 UTC (rev 14451) @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2004, P. Simon Tuffs (simon at simontuffs.com) + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * Neither the name of P. Simon Tuffs nor the names of any contributors may be + * used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + Modified: trunk/apps/Thaw/readme.txt =================================================================== --- trunk/apps/Thaw/readme.txt 2007-07-31 15:46:37 UTC (rev 14450) +++ trunk/apps/Thaw/readme.txt 2007-07-31 17:32:17 UTC (rev 14451) @@ -40,7 +40,6 @@ * Download the provider for the JDK 1.4 * Rename the file to BouncyCastle.jar * Put this .jar in lib/ -* You will also need the "unrestricted policy files" for the JCE (see http://bouncycastle.org/fr/documentation.html ) and jmDNS: * download the jar and put it in lib/ Modified: trunk/apps/Thaw/src/thaw/core/ConfigWindow.java =================================================================== --- trunk/apps/Thaw/src/thaw/core/ConfigWindow.java 2007-07-31 15:46:37 UTC (rev 14450) +++ trunk/apps/Thaw/src/thaw/core/ConfigWindow.java 2007-07-31 17:32:17 UTC (rev 14451) @@ -129,6 +129,11 @@ return true; } + public boolean setSelectedTab(java.awt.Component c) { + tabs.setSelectedComponent(c); + return true; + } + public boolean removeTab(final java.awt.Component panel) { tabs.remove(panel); return true; Modified: trunk/apps/Thaw/src/thaw/i18n/source.thaw_fr.properties =================================================================== --- trunk/apps/Thaw/src/thaw/i18n/source.thaw_fr.properties 2007-07-31 15:46:37 UTC (rev 14450) +++ trunk/apps/Thaw/src/thaw/i18n/source.thaw_fr.properties 2007-07-31 17:32:17 UTC (rev 14451) @@ -243,7 +243,7 @@ thaw.about.title=? propos thaw.about.l02=par Jerome Flesch thaw.about.l03=2006-2007(c) Freenet Project Incorporated -thaw.about.l04=sous GPLv2 ( http://www.fsf.org/licensing/licenses/gpl.html ) +thaw.about.l04=sous GPLv3 ( http://www.fsf.org/licensing/licenses/gpl.html ) thaw.about.l06=Les principaux composants de Thaw sont: thaw.about.l07=- Le jeu d'icones "Tango" ( http://tango.freedesktop.org/ ; CC attribution share-alike ) thaw.about.l08=- Le look&feel InfoNode ( http://www.infonode.net/ ; GPL ) @@ -593,3 +593,9 @@ thaw.plugin.miniFrost.encrypted=Crypt? thaw.plugin.miniFrost.encryptedBody=Crypt? pour 'X' +thaw.plugin.miniFrost.regexpBlacklistLongDesc=Archiver imm?diatement les messages correspondant aux expressions suivantes (une par line): +thaw.plugin.miniFrost.seeSunManual=(Voir X) +thaw.plugin.miniFrost.regexpBlacklist=Filtrage +thaw.plugin.miniFrost.invalidRegexp=Une de vos regexp est invalide : X + +thaw.plugin.miniFrost.modifyRegexp=Modifier les r?gles de filtrage Modified: trunk/apps/Thaw/src/thaw/i18n/thaw.properties =================================================================== --- trunk/apps/Thaw/src/thaw/i18n/thaw.properties 2007-07-31 15:46:37 UTC (rev 14450) +++ trunk/apps/Thaw/src/thaw/i18n/thaw.properties 2007-07-31 17:32:17 UTC (rev 14451) @@ -250,7 +250,7 @@ thaw.about.l02=by Jerome Flesch thaw.about.l03=2006-2007(c) Freenet Project Incorporated -thaw.about.l04=under GPLv2 or higher ( http://www.fsf.org/licensing/licenses/gpl.html ) +thaw.about.l04=under GPLv3 or higher ( http://www.fsf.org/licensing/licenses/gpl.html ) thaw.about.l06=Some of the Thaw components are: thaw.about.l07=- Icon theme "Tango" ( http://tango.freedesktop.org/ ; CC attribution share-alike ) @@ -610,3 +610,11 @@ thaw.plugin.miniFrost.encrypted=Encrypted thaw.plugin.miniFrost.encryptedFor=[Encrypted for 'X'] thaw.plugin.miniFrost.encryptedBody=Encrypted for 'X' + +thaw.plugin.miniFrost.regexpBlacklistLongDesc=Archivate immediatly the messages matching the following expressions (one per line): +thaw.plugin.miniFrost.seeSunManual=(See X) + +thaw.plugin.miniFrost.regexpBlacklist=Filtering +thaw.plugin.miniFrost.invalidRegexp=One of your regexp is invalid : X +thaw.plugin.miniFrost.modifyRegexp=Modify the filtering rules + Modified: trunk/apps/Thaw/src/thaw/i18n/thaw_fr.properties =================================================================== --- trunk/apps/Thaw/src/thaw/i18n/thaw_fr.properties 2007-07-31 15:46:37 UTC (rev 14450) +++ trunk/apps/Thaw/src/thaw/i18n/thaw_fr.properties 2007-07-31 17:32:17 UTC (rev 14451) @@ -243,14 +243,14 @@ thaw.about.title=\u00c0 propos thaw.about.l02=par Jerome Flesch thaw.about.l03=2006-2007(c) Freenet Project Incorporated -thaw.about.l04=sous GPLv2 ( http://www.fsf.org/licensing/licenses/gpl.html ) +thaw.about.l04=sous GPLv3 ( http://www.fsf.org/licensing/licenses/gpl.html ) thaw.about.l06=Les principaux composants de Thaw sont: thaw.about.l07=- Le jeu d'icones "Tango" ( http://tango.freedesktop.org/ ; CC attribution share-alike ) thaw.about.l08=- Le look&feel InfoNode ( http://www.infonode.net/ ; GPL ) thaw.about.l09=- Le look&feel Liquid ( https://liquidlnf.dev.java.net/ ; LGPL ) thaw.about.l10=- Hsqldb ( http://hsqldb.org/ ; Hsqldb license ) thaw.about.l11=- JmDNS ( http://jmdns.sourceforge.net/ ; LGPL ) -thaw.about.l10=- One-jar ( http://one-jar.sourceforge.net/ ; License one-jar ) +thaw.about.l12=- One-jar ( http://one-jar.sourceforge.net/ ; License one-jar ) thaw.about.l13=- Certaines parties du code source du noeud Freenet ( http://freenetproject.org/ ; GPL ) thaw.about.l14=- Certaines parties du code source de Frost ( http://jtcfrost.sourceforge.net/ ; GPL ) thaw.about.l15=Toutes ces licenses sont incluses dans Thaw.jar @@ -592,3 +592,10 @@ thaw.plugin.miniFrost.draft=Brouillon thaw.plugin.miniFrost.encrypted=Crypt\u00e9 thaw.plugin.miniFrost.encryptedBody=Crypt\u00e9 pour 'X' + +thaw.plugin.miniFrost.regexpBlacklist=Archiver imm\u00e9diatement les messages correspondant aux expressions suivantes (une par line): +thaw.plugin.miniFrost.seeSunManual=(Voir X) +thaw.plugin.miniFrost.regexpBlacklist=Filtrage +thaw.plugin.miniFrost.invalidRegexp=Une de vos regexp est invalide : X + +thaw.plugin.miniFrost.modifyRegexp=Modifier les r\u00e8gles de filtrage Modified: trunk/apps/Thaw/src/thaw/plugins/MiniFrost.java =================================================================== --- trunk/apps/Thaw/src/thaw/plugins/MiniFrost.java 2007-07-31 15:46:37 UTC (rev 14450) +++ trunk/apps/Thaw/src/thaw/plugins/MiniFrost.java 2007-07-31 17:32:17 UTC (rev 14451) @@ -9,6 +9,7 @@ import thaw.plugins.miniFrost.AutoRefresh; import thaw.plugins.miniFrost.MiniFrostConfigTab; +import thaw.plugins.miniFrost.RegexpBlacklist; public class MiniFrost implements thaw.core.Plugin { @@ -19,6 +20,8 @@ private MiniFrostConfigTab configTab; private AutoRefresh autoRefresh; + private RegexpBlacklist regexpBlacklist; + private boolean firstStart; @@ -38,14 +41,22 @@ || !loadAutoRefresh()) return false; + regexpBlacklist = new RegexpBlacklist(hsqldb); + configTab = new MiniFrostConfigTab(core.getConfig(), - core.getConfigWindow()); + core.getConfigWindow(), + regexpBlacklist); configTab.display(); return true; } + public RegexpBlacklist getRegexpBlacklist() { + return regexpBlacklist; + } + + protected boolean loadDeps() { if(core.getPluginManager().getPlugin("thaw.plugins.Hsqldb") == null) { Logger.info(this, "Loading Hsqldb plugin"); Modified: trunk/apps/Thaw/src/thaw/plugins/miniFrost/MiniFrostConfigTab.java =================================================================== --- trunk/apps/Thaw/src/thaw/plugins/miniFrost/MiniFrostConfigTab.java 2007-07-31 15:46:37 UTC (rev 14450) +++ trunk/apps/Thaw/src/thaw/plugins/miniFrost/MiniFrostConfigTab.java 2007-07-31 17:32:17 UTC (rev 14451) @@ -3,12 +3,17 @@ import javax.swing.JPanel; import javax.swing.JLabel; import javax.swing.JComboBox; +import javax.swing.JButton; import java.util.Observer; import java.util.Observable; import java.awt.GridLayout; +import java.awt.BorderLayout; +import java.awt.event.ActionListener; +import java.awt.event.ActionEvent; + import thaw.core.Config; import thaw.core.ConfigWindow; import thaw.core.I18n; @@ -16,10 +21,11 @@ import thaw.gui.IconBox; -public class MiniFrostConfigTab implements Observer { +public class MiniFrostConfigTab implements Observer, ActionListener { private Config config; private ConfigWindow configWindow; + private RegexpBlacklist regexpBlacklist; private JPanel panel; @@ -27,11 +33,15 @@ public final static int MAX_BOARDS = 30; private JComboBox maxBoards; + private JButton regexpButton; + public MiniFrostConfigTab(Config config, - ConfigWindow configWindow) { + ConfigWindow configWindow, + RegexpBlacklist regexpBlacklist) { this.config = config; this.configWindow = configWindow; + this.regexpBlacklist = regexpBlacklist; panel = new JPanel(new GridLayout(16, 1)); @@ -45,6 +55,15 @@ panel.add(new JLabel(I18n.getMessage("thaw.plugin.miniFrost.maxBoardsRefreshed"))); panel.add(maxBoards); + JPanel regexpPanel = new JPanel(new BorderLayout()); + regexpPanel.add(new JLabel(""), BorderLayout.CENTER); + regexpButton = new JButton(I18n.getMessage("thaw.plugin.miniFrost.modifyRegexp")); + regexpButton.addActionListener(this); + regexpPanel.add(regexpButton, BorderLayout.EAST); + + panel.add(new JLabel("")); + panel.add(regexpPanel); + configWindow.addObserver(this); } @@ -87,4 +106,10 @@ } } + + public void actionPerformed(ActionEvent e) { + if (e.getSource() == regexpButton) { + regexpBlacklist.displayTab(configWindow); + } + } } Modified: trunk/apps/Thaw/src/thaw/plugins/miniFrost/frostKSK/KSKMessage.java =================================================================== --- trunk/apps/Thaw/src/thaw/plugins/miniFrost/frostKSK/KSKMessage.java 2007-07-31 15:46:37 UTC (rev 14450) +++ trunk/apps/Thaw/src/thaw/plugins/miniFrost/frostKSK/KSKMessage.java 2007-07-31 17:32:17 UTC (rev 14451) @@ -118,6 +118,7 @@ if (parser.loadFile(new File(get.getPath()), db) && parser.checkSignature(db) + && parser.filter(board.getFactory().getPlugin().getRegexpBlacklist()) && parser.insert(db, board.getId(), date, rev, board.getName())) { Modified: trunk/apps/Thaw/src/thaw/plugins/miniFrost/frostKSK/KSKMessageParser.java =================================================================== --- trunk/apps/Thaw/src/thaw/plugins/miniFrost/frostKSK/KSKMessageParser.java 2007-07-31 15:46:37 UTC (rev 14450) +++ trunk/apps/Thaw/src/thaw/plugins/miniFrost/frostKSK/KSKMessageParser.java 2007-07-31 17:32:17 UTC (rev 14451) @@ -24,7 +24,9 @@ import thaw.core.Logger; import thaw.core.I18n; +import thaw.plugins.miniFrost.RegexpBlacklist; + /** * Dirty parser reusing some Frost functions * (Note: dirty mainly because of the Frost format :p) @@ -262,6 +264,19 @@ } + public boolean filter(RegexpBlacklist blacklist) { + if (blacklist.isBlacklisted(subject) + || blacklist.isBlacklisted(from) + || blacklist.isBlacklisted(body)) { + read = true; + archived = true; + } + + return true; + } + + + public final static char SIGNATURE_ELEMENTS_SEPARATOR = '|'; private String getSignedContent() { @@ -316,6 +331,7 @@ } + protected boolean loadXMLElements(Element root) { messageId = XMLTools.getChildElementsCDATAValue(root, "MessageId"); inReplyTo = XMLTools.getChildElementsCDATAValue(root, "InReplyTo"); Modified: trunk/apps/Thaw/src/thaw/plugins/signatures/Identity.java =================================================================== --- trunk/apps/Thaw/src/thaw/plugins/signatures/Identity.java 2007-07-31 15:46:37 UTC (rev 14450) +++ trunk/apps/Thaw/src/thaw/plugins/signatures/Identity.java 2007-07-31 17:32:17 UTC (rev 14451) @@ -63,7 +63,9 @@ Color.RED }; + public final static Color trustLevelColorMe = new Color(0, 128, 0); + private Hsqldb db; private int id; @@ -188,7 +190,7 @@ int i; if (privateKey != null) - return new java.awt.Color(0, 175, 0); + return trustLevelColorMe; for (i = 0 ; i < trustLevelInt.length ; i++) { if (trustLevelInt[i] == trustLevel) Modified: trunk/apps/Thaw/src/thaw/plugins/signatures/SigConfigTab.java =================================================================== --- trunk/apps/Thaw/src/thaw/plugins/signatures/SigConfigTab.java 2007-07-31 15:46:37 UTC (rev 14450) +++ trunk/apps/Thaw/src/thaw/plugins/signatures/SigConfigTab.java 2007-07-31 17:32:17 UTC (rev 14451) @@ -120,7 +120,7 @@ if (i >= Identity.trustLevelStr.length) return; - Logger.error(this, "Setting min trust level to : "+Integer.toString(Identity.trustLevelInt[i])); + Logger.info(this, "Setting min trust level to : "+Integer.toString(Identity.trustLevelInt[i])); config.setValue("minTrustLevel", Integer.toString(Identity.trustLevelInt[i])); }
