[tuxdroid-svn] r5615 - in software_suite_v3/software/plugin/plugin-email/trunk/plugin-email: resou
Status: Beta
Brought to you by:
ks156
|
From: remi <c2m...@c2...> - 2009-10-09 09:01:49
|
Author: remi Date: 2009-10-09 11:01:40 +0200 (Fri, 09 Oct 2009) New Revision: 5615 Removed: software_suite_v3/software/plugin/plugin-email/trunk/plugin-email/src/net/karmaLab/tuxDroid/plugins/ServerProtocol.java Modified: software_suite_v3/software/plugin/plugin-email/trunk/plugin-email/resources/plugin.xml software_suite_v3/software/plugin/plugin-email/trunk/plugin-email/src/net/karmaLab/tuxDroid/plugins/Configuration.java software_suite_v3/software/plugin/plugin-email/trunk/plugin-email/src/net/karmaLab/tuxDroid/plugins/MailPlugin.java Log: * Cleaned code and plugin.xml file Modified: software_suite_v3/software/plugin/plugin-email/trunk/plugin-email/resources/plugin.xml =================================================================== --- software_suite_v3/software/plugin/plugin-email/trunk/plugin-email/resources/plugin.xml 2009-10-09 08:54:25 UTC (rev 5614) +++ software_suite_v3/software/plugin/plugin-email/trunk/plugin-email/resources/plugin.xml 2009-10-09 09:01:40 UTC (rev 5615) @@ -21,12 +21,6 @@ type="string" defaultValue="your.server.com" /> <parameter - category="Server parameters" - name="protocol" - description="Protocol" - type="enum(pop3,pop3s,imap,imaps)" - defaultValue="pop3" /> - <parameter category="User parameters" name="user" description="Username" @@ -38,36 +32,6 @@ description="Password" type="password" defaultValue="_secret_" /> - <parameter - name="folder" - category="Advanced Server parameters" - description="IMAP folder to retreive" - type="string" - defaultValue="INBOX" /> - <parameter - name="filterSender" - category= "User parameters" - description="Use sender filter" - type="boolean" - defaultValue="false" /> - <parameter - name="senderFilter" - category= "User parameters" - description="Sender filter to apply" - type="string" - defaultValue="bo...@my...,myg...@ho..." /> - <parameter - name="filerSubject" - category= "User parameters" - description="Use subject filter" - type="boolean" - defaultValue="false" /> - <parameter - name="subjectFilter" - category= "User parameters" - description="Subject filter to apply" - type="string" - defaultValue="Re:important document" /> </parameters> <commands> <command @@ -93,32 +57,5 @@ delayMask="true,true,true" delayVisible="false" /> - <task - name="Start every x from full hour" - description="Start me every x (From full hour)" - command="run" - type="every x from full hour" - activated="false" - - weekMask="true,true,true,true,true,true,true" - weekMaskType="weekpart" - weekMaskVisible="true" - - date="0000/00/00" - dateVisible="false" - - hoursBegin="00:00:00" - hoursBeginMask="true,true,true" - hoursBeginVisible="false" - - hoursEnd="23:59:00" - hoursEndMask="true,true,true" - hoursEndVisible="false" - - delay="00:15:00" - delayType="quarters" - delayMask="true,true,false" - delayVisible="true" - /> </tasks> </plugin> Modified: software_suite_v3/software/plugin/plugin-email/trunk/plugin-email/src/net/karmaLab/tuxDroid/plugins/Configuration.java =================================================================== --- software_suite_v3/software/plugin/plugin-email/trunk/plugin-email/src/net/karmaLab/tuxDroid/plugins/Configuration.java 2009-10-09 08:54:25 UTC (rev 5614) +++ software_suite_v3/software/plugin/plugin-email/trunk/plugin-email/src/net/karmaLab/tuxDroid/plugins/Configuration.java 2009-10-09 09:01:40 UTC (rev 5615) @@ -23,43 +23,15 @@ package net.karmaLab.tuxDroid.plugins; -import java.util.Vector; - import com.kysoh.tuxdroid.plugin.framework.plugin.SimplePluginConfiguration; public class Configuration extends SimplePluginConfiguration { private String host; - private int port; - private ServerProtocol protocol; private String password; private String user; - private String folder; - - private boolean filerSubject; - private boolean filterSender; - - private String subjectFilter; - private String senderFilter; /** - * @return the folder - */ - public String getFolder() - { - return folder; - } - - /** - * @param folder - * the folder to set - */ - public void setFolder(String folder) - { - this.folder = folder; - } - - /** * @return the password */ public String getPassword() @@ -94,40 +66,6 @@ } /** - * @return the port - */ - public int getPort() - { - return port; - } - - /** - * @param port - * the port to set - */ - public void setPort(int port) - { - this.port = port; - } - - /** - * @return the kind - */ - public ServerProtocol getProtocol() - { - return protocol; - } - - /** - * @param kind - * the kind to set - */ - public void setProtocol(ServerProtocol kind) - { - this.protocol = kind; - } - - /** * * @return */ @@ -144,60 +82,4 @@ { this.host = host; } - - - /** - * Return true if sender is filtered. - * @return - */ - public boolean isSenderFiltered() - { - return this.filterSender; - } - - - /** - * Return true if Subject is filtered. - * @return - */ - public boolean isSubjectFiltered() - { - return this.filerSubject; - } - - - /** - * Return a list of allowed sender. - * @return - */ - public Vector<String> getSenderFilter() - { - Vector<String> ret = new Vector<String>(); - String value = this.senderFilter; - while(value.contains(",")) - { - ret.add(value.substring(0, value.indexOf(","))); - value = value.substring(value.indexOf(",") + 1); - } - ret.add(value); - return ret; - } - - - /** - * Return a list of allowed words. - * @return - */ - public Vector<String> getSubjectFilter() - { - Vector<String> ret = new Vector<String>(); - String value = this.subjectFilter; - while(value.contains(",")) - { - ret.add(value.substring(0, value.indexOf(","))); - value = value.substring(value.indexOf(",") + 1); - } - ret.add(value); - return ret; - } } \ No newline at end of file Modified: software_suite_v3/software/plugin/plugin-email/trunk/plugin-email/src/net/karmaLab/tuxDroid/plugins/MailPlugin.java =================================================================== --- software_suite_v3/software/plugin/plugin-email/trunk/plugin-email/src/net/karmaLab/tuxDroid/plugins/MailPlugin.java 2009-10-09 08:54:25 UTC (rev 5614) +++ software_suite_v3/software/plugin/plugin-email/trunk/plugin-email/src/net/karmaLab/tuxDroid/plugins/MailPlugin.java 2009-10-09 09:01:40 UTC (rev 5615) @@ -91,7 +91,7 @@ throwResult(false); return; } - String sessionId = configuration().getHost() + "_" + configuration().getPort() + "_" + configuration().getUser(); + String sessionId = configuration().getHost() + "_" + configuration().getUser(); State stateAlert = readState(State.class, sessionId + "ALERT"); /* Is first check ? */ boolean firstCheck; @@ -192,7 +192,7 @@ { return; } - String sessionId = configuration().getHost() + "_" + configuration().getPort() + "_" + configuration().getUser(); + String sessionId = configuration().getHost() + "_" + configuration().getUser(); State stateRun = readState(State.class, sessionId + "RUN"); /* Check for new message */ boolean newMessageRun = false; @@ -478,56 +478,6 @@ return messages; } - /** - * Return true if the sender is not allowed. - * @param mail - * @return - */ - private boolean filterSender(String mail) - { - Vector<Boolean> ver = new Vector<Boolean>(); - for(String allowedSender : this.configuration().getSenderFilter()) - { - if(!mail.equals(allowedSender)) - { - ver.add(new Boolean(false)); - } - } - for(Boolean bool : ver) - { - if(!bool.booleanValue()) - { - return true; - } - } - return false; - } - - /** - * Return true if subject is not allowed. - * @param subject - * @return - */ - private boolean filterSubject(String subject) - { - Vector<Boolean> ver = new Vector<Boolean>(); - for(String allowedContent : this.configuration().getSubjectFilter()) - { - if(!subject.contains(allowedContent)) - { - ver.add(new Boolean(false)); - } - } - for(Boolean bool : ver) - { - if(!bool.booleanValue()) - { - return true; - } - } - return false; - } - @Override protected void onPluginEvent(String arg0, String[] arg1) throws Throwable { Deleted: software_suite_v3/software/plugin/plugin-email/trunk/plugin-email/src/net/karmaLab/tuxDroid/plugins/ServerProtocol.java =================================================================== --- software_suite_v3/software/plugin/plugin-email/trunk/plugin-email/src/net/karmaLab/tuxDroid/plugins/ServerProtocol.java 2009-10-09 08:54:25 UTC (rev 5614) +++ software_suite_v3/software/plugin/plugin-email/trunk/plugin-email/src/net/karmaLab/tuxDroid/plugins/ServerProtocol.java 2009-10-09 09:01:40 UTC (rev 5615) @@ -1,27 +0,0 @@ -/* This file is part of "TuxDroid Plugin Mail". - * Copyright 2009, kysoh - * Author : Yoran Brault - * eMail : software@_bad_karma-lab.net (remove _bad_ before sending an email) - * Site : http://www.kysoh.com/ - * - * "TuxDroid Plugin Mail" is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * "TuxDroid Plugin Mail" is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with "TuxDroid Plugin Mail"; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ - -package net.karmaLab.tuxDroid.plugins; - -public enum ServerProtocol { - pop3, imap, imaps, pop3s; -} \ No newline at end of file |