[tuxdroid-svn] r4794 - in software_suite_v3/software/plugin: . plugin-twitter plugin-twitter/trunk
Status: Beta
Brought to you by:
ks156
Author: jerome Date: 2009-06-12 09:03:24 +0200 (Fri, 12 Jun 2009) New Revision: 4794 Added: software_suite_v3/software/plugin/plugin-twitter/ software_suite_v3/software/plugin/plugin-twitter/branches/ software_suite_v3/software/plugin/plugin-twitter/tags/ software_suite_v3/software/plugin/plugin-twitter/trunk/ software_suite_v3/software/plugin/plugin-twitter/trunk/plugin-twitter/ software_suite_v3/software/plugin/plugin-twitter/trunk/plugin-twitter/pom.xml software_suite_v3/software/plugin/plugin-twitter/trunk/plugin-twitter/resources/ software_suite_v3/software/plugin/plugin-twitter/trunk/plugin-twitter/resources/en.po software_suite_v3/software/plugin/plugin-twitter/trunk/plugin-twitter/resources/es.po software_suite_v3/software/plugin/plugin-twitter/trunk/plugin-twitter/resources/fr.po software_suite_v3/software/plugin/plugin-twitter/trunk/plugin-twitter/resources/help.wiki software_suite_v3/software/plugin/plugin-twitter/trunk/plugin-twitter/resources/help_en.wiki software_suite_v3/software/plugin/plugin-twitter/trunk/plugin-twitter/resources/help_es.wiki software_suite_v3/software/plugin/plugin-twitter/trunk/plugin-twitter/resources/help_fr.wiki software_suite_v3/software/plugin/plugin-twitter/trunk/plugin-twitter/resources/help_nl.wiki software_suite_v3/software/plugin/plugin-twitter/trunk/plugin-twitter/resources/nl.po software_suite_v3/software/plugin/plugin-twitter/trunk/plugin-twitter/resources/plugin.png software_suite_v3/software/plugin/plugin-twitter/trunk/plugin-twitter/resources/plugin.pot software_suite_v3/software/plugin/plugin-twitter/trunk/plugin-twitter/resources/plugin.xml software_suite_v3/software/plugin/plugin-twitter/trunk/plugin-twitter/src/ software_suite_v3/software/plugin/plugin-twitter/trunk/plugin-twitter/src/Configuration.java software_suite_v3/software/plugin/plugin-twitter/trunk/plugin-twitter/src/FriendStatut.java software_suite_v3/software/plugin/plugin-twitter/trunk/plugin-twitter/src/Message.java software_suite_v3/software/plugin/plugin-twitter/trunk/plugin-twitter/src/Reply.java software_suite_v3/software/plugin/plugin-twitter/trunk/plugin-twitter/src/TwitterDatasStruct.java software_suite_v3/software/plugin/plugin-twitter/trunk/plugin-twitter/src/TwitterPlugin.java Log: * Added plugin-twitter. Added: software_suite_v3/software/plugin/plugin-twitter/trunk/plugin-twitter/pom.xml =================================================================== --- software_suite_v3/software/plugin/plugin-twitter/trunk/plugin-twitter/pom.xml (rev 0) +++ software_suite_v3/software/plugin/plugin-twitter/trunk/plugin-twitter/pom.xml 2009-06-12 07:03:24 UTC (rev 4794) @@ -0,0 +1,116 @@ +<project> + <!--General project informations--> + <modelVersion>4.0.0</modelVersion> + <groupId>com.kysoh</groupId> + <artifactId>plugin-twitter</artifactId> + <packaging>jar</packaging> + <version>2.0</version> + <name>Twitter plugin for Tux Droid</name> + <url>http://www.tuxisalive.com</url> + + <!--Dependency list--> + <dependencies> + <dependency> + <groupId>com.kysoh</groupId> + <artifactId>tuxdroid-plugin-java-kit</artifactId> + <version>0.0.3</version> + </dependency> + <dependency> + <groupId>jtwitter</groupId> + <artifactId>jtwitter</artifactId> + <version>0.9.8</version> + </dependency> + </dependencies> + + <!--Repository list--> + <repositories> + <repository> + <id>kysoh</id> + <name>Kysoh Repository</name> + <layout>default</layout> + <url>http://ftp.kysoh.com/maven2</url> + <snapshots> + <enabled>false</enabled> + </snapshots> + </repository> + </repositories> + + <!--Build process--> + <build> + <sourceDirectory>src</sourceDirectory> + <plugins> + + <!--This section copy the dependencies into ./libraries--> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-dependency-plugin</artifactId> + <executions> + <execution> + <id>copy-dependencies</id> + <phase>package</phase> + <goals> + <goal>copy-dependencies</goal> + </goals> + <configuration> + <outputDirectory>./libraries</outputDirectory> + </configuration> + </execution> + </executions> + </plugin> + + <!--This plugin run small ant scripts to pack and clean the plugin--> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-antrun-plugin</artifactId> + <version>1.3</version> + <executions> + + <!--This section create the .scp file during the package lifecycle--> + <execution> + <phase>package</phase> + <id>package</id> + <configuration> + <tasks> + <mkdir dir="./libraries"/> + <copy file="${project.build.directory}/${project.artifactId}-${project.version}.jar" + todir="./libraries" /> + <zip destfile="./${project.artifactId}.scp"> + <zipfileset dir="." includes="resources/*" /> + <zipfileset dir="." includes="libraries/*" /> + <zipfileset dir="." includes="executables/*" /> + </zip> + </tasks> + </configuration> + <goals> + <goal>run</goal> + </goals> + </execution> + + <!--This section clean the ./libraries and the SCP file during the 'clean' lifecycle--> + <execution> + <phase>clean</phase> + <configuration> + <tasks> + <delete dir="./libraries"/> + <delete file="./${project.artifactId}.scp"/> + </tasks> + </configuration> + <goals> + <goal>run</goal> + </goals> + </execution> + </executions> + </plugin> + + <!--This plugin compile the project--> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <configuration> + <source>1.6</source> + <target>1.6</target> + </configuration> + </plugin> + </plugins> + </build> +</project> Added: software_suite_v3/software/plugin/plugin-twitter/trunk/plugin-twitter/resources/en.po =================================================================== --- software_suite_v3/software/plugin/plugin-twitter/trunk/plugin-twitter/resources/en.po (rev 0) +++ software_suite_v3/software/plugin/plugin-twitter/trunk/plugin-twitter/resources/en.po 2009-06-12 07:03:24 UTC (rev 4794) @@ -0,0 +1,61 @@ + +msgid "" +msgstr "Project-Id-Version: PACKAGE VERSION\nReport-Msgid-Bugs-To: \nPOT-Creation-Date: 2009-04-16 14:12+0200\nPO-Revision-Date: 2009-04-16 14:13+0200\nLast-Translator: jerome <jer...@ky...>\nLanguage-Team: LANGUAGE <LL...@li...>\nLanguage: en\nMIME-Version: 1.0\nContent-Type: text/plain; charset=UTF-8\nContent-Transfer-Encoding: 8bit\nPlural-Forms: nplurals=2; plural=(n != 1);\nX-Generator: Pootle 1.2.1\n" + +msgid "Twitter Gadget" +msgstr "Twitter Gadget" + +msgid "Username" +msgstr "Username" + +msgid "your_user_name" +msgstr "your_user_name" + +msgid "Password" +msgstr "Password" + +msgid "your_password" +msgstr "your_password" + +msgid "Tweet your new status" +msgstr "Tweet your new status" + +msgid "Tweet following status text" +msgstr "Tweet following status text" + +msgid "Give my messages/replies" +msgstr "Give my messages/replies" + +msgid "The Twitter gadget will make Tux Droid read your tweets from your Twitter account." +msgstr "The Twitter gadget will make Tux Droid read your tweets from your Twitter account." + +msgid "reply from {0}, the reply is: {1}" +msgstr "reply from {0}, the reply is: {1}" + +msgid "message from {0}, the message is: {1}" +msgstr "message from {0}, the message is: {1}" + +msgid "you don't have replies" +msgstr "you don't have replies" + +msgid "you don't have private messages" +msgstr "you don't have private messages" + +msgid "No new tweets available." +msgstr "No new tweets available." + +msgid "I cannot get connected to your twitter accound. Please, verify your internet connection." +msgstr "I cannot get connected to your twitter accound. Please, verify your internet connection." + +msgid "Give replies sent between followers" +msgstr "Give replies sent between followers" + +msgid "Maximum tweets to read" +msgstr "Maximum tweets to read" + +msgid "Hello all from my Tux Droid twitter gadget" +msgstr "Hello all from my Tux Droid twitter gadget" + +msgid "You do not seem to be connected. Please, verify you username and password, then try again." +msgstr "You do not seem to be connected. Please, verify you username and password, then try again." + Added: software_suite_v3/software/plugin/plugin-twitter/trunk/plugin-twitter/resources/es.po =================================================================== --- software_suite_v3/software/plugin/plugin-twitter/trunk/plugin-twitter/resources/es.po (rev 0) +++ software_suite_v3/software/plugin/plugin-twitter/trunk/plugin-twitter/resources/es.po 2009-06-12 07:03:24 UTC (rev 4794) @@ -0,0 +1,61 @@ + +msgid "" +msgstr "Project-Id-Version: PACKAGE VERSION\nReport-Msgid-Bugs-To: \nPOT-Creation-Date: 2009-04-16 14:12+0200\nPO-Revision-Date: 2009-04-16 14:17+0200\nLast-Translator: jerome <jer...@ky...>\nLanguage-Team: LANGUAGE <LL...@li...>\nLanguage: es\nMIME-Version: 1.0\nContent-Type: text/plain; charset=UTF-8\nContent-Transfer-Encoding: 8bit\nPlural-Forms: nplurals=2; plural=(n != 1);\nX-Generator: Pootle 1.2.1\n" + +msgid "Twitter Gadget" +msgstr "Gadget para Twitter" + +msgid "Username" +msgstr "Nombre de Usuario" + +msgid "your_user_name" +msgstr "su_nombre_de_usuario" + +msgid "Password" +msgstr "Contraseña" + +msgid "your_password" +msgstr "su_contraseña" + +msgid "Tweet your new status" +msgstr "Tweetee su nuevo estado" + +msgid "Tweet following status text" +msgstr "Tweetee el siguiente texto de estado" + +msgid "Give my messages/replies" +msgstr "Leer mis mensajes/respuestas" + +msgid "The Twitter gadget will make Tux Droid read your tweets from your Twitter account." +msgstr "El gadget para Twitter hara que Tux Droid lea sus tweets desde su cuenta en Twitter." + +msgid "reply from {0}, the reply is: {1}" +msgstr "respuesta de {0}, la respuesta es: {1}" + +msgid "message from {0}, the message is: {1}" +msgstr "mansaje de {0}, el mensaje es {1}" + +msgid "you don't have replies" +msgstr "no tiene respuestas" + +msgid "you don't have private messages" +msgstr "no tiene mensajes privados" + +msgid "No new tweets available." +msgstr "No nuevos tweets disponibles." + +msgid "I cannot get connected to your twitter accound. Please, verify your internet connection." +msgstr "No es posible conectar sun su cuenta twitter. Por favor compruebe su conexión a internet." + +msgid "Give replies sent between followers" +msgstr "Lee las respuestas enviadas por followers" + +msgid "Maximum tweets to read" +msgstr "Maximo numero de tweets a leer" + +msgid "Hello all from my Tux Droid twitter gadget" +msgstr "Hola a todos desde my gadget para Twitter en Tux Droid" + +msgid "You do not seem to be connected. Please, verify you username and password, then try again." +msgstr "Perece no estar conectado. Por favor verifique su nombre y contraseña, y vuelva a intentarlo." + Added: software_suite_v3/software/plugin/plugin-twitter/trunk/plugin-twitter/resources/fr.po =================================================================== --- software_suite_v3/software/plugin/plugin-twitter/trunk/plugin-twitter/resources/fr.po (rev 0) +++ software_suite_v3/software/plugin/plugin-twitter/trunk/plugin-twitter/resources/fr.po 2009-06-12 07:03:24 UTC (rev 4794) @@ -0,0 +1,61 @@ + +msgid "" +msgstr "Project-Id-Version: PACKAGE VERSION\nReport-Msgid-Bugs-To: \nPOT-Creation-Date: 2009-04-16 14:12+0200\nPO-Revision-Date: 2009-04-16 14:14+0200\nLast-Translator: jerome <jer...@ky...>\nLanguage-Team: LANGUAGE <LL...@li...>\nLanguage: fr\nMIME-Version: 1.0\nContent-Type: text/plain; charset=UTF-8\nContent-Transfer-Encoding: 8bit\nPlural-Forms: nplurals=2; plural=(n > 1);\nX-Generator: Pootle 1.2.1\n" + +msgid "Twitter Gadget" +msgstr "Gadget Twitter" + +msgid "Username" +msgstr "Utilisateur" + +msgid "your_user_name" +msgstr "votre_nom_utilisateur" + +msgid "Password" +msgstr "Mot de passe" + +msgid "your_password" +msgstr "votre_mot_de_passe" + +msgid "Tweet your new status" +msgstr "Publier un nouveau tweet" + +msgid "Tweet following status text" +msgstr "Tweet à ajouter" + +msgid "Give my messages/replies" +msgstr "Donner mes messages / réponses" + +msgid "The Twitter gadget will make Tux Droid read your tweets from your Twitter account." +msgstr "Le gadget Twitter permet à Tux Droid de lire vos tweets à partir de votre compte Twitter." + +msgid "reply from {0}, the reply is: {1}" +msgstr "Réponse de {0}, la réponse est: {1}" + +msgid "message from {0}, the message is: {1}" +msgstr "Message de {0}, les message est: {1}" + +msgid "you don't have replies" +msgstr "Vous n'avez pas de réponses" + +msgid "you don't have private messages" +msgstr "Vous n'avez pas de messages privés." + +msgid "No new tweets available." +msgstr "Aucun nouveau tweet disponible." + +msgid "I cannot get connected to your twitter accound. Please, verify your internet connection." +msgstr "Je ne peux me connecter à votre compte Twitter. S'il vous plait, vérifiez votre connexion internet." + +msgid "Give replies sent between followers" +msgstr "Donne les réponses entre followers" + +msgid "Maximum tweets to read" +msgstr "Tweets maximum à lire" + +msgid "Hello all from my Tux Droid twitter gadget" +msgstr "Bonjour à tous à partir du gadget Twitter de mon Tux Droid" + +msgid "You do not seem to be connected. Please, verify you username and password, then try again." +msgstr "Il semble que vous n'êtes pas connecté. Vérifiez votre login et votre mot de passe et essayez à nouveau." + Added: software_suite_v3/software/plugin/plugin-twitter/trunk/plugin-twitter/resources/help.wiki =================================================================== --- software_suite_v3/software/plugin/plugin-twitter/trunk/plugin-twitter/resources/help.wiki (rev 0) +++ software_suite_v3/software/plugin/plugin-twitter/trunk/plugin-twitter/resources/help.wiki 2009-06-12 07:03:24 UTC (rev 4794) @@ -0,0 +1,9 @@ += Synopsis = +This plugin will read your Twitter messages.Not familiar with Twitter? Have a look at "http://www.twitter.com" + +After entering your Twitter login and password you can customize several options : +- Tweet your new status : Every time the gadget is started it will make a new tweet on your twitter page. +- Tweet following status text : Here you can specify the text of the tweet for the above option. +- Maximum tweets to read : Select the number of most recent tweets Tux Droid has to read. +- Give replies sent between followers : Will make Tux Droid read the replies between followers. +- Give my messages/replies : Will make Tux Droid read your own messages and replies on twitter. Added: software_suite_v3/software/plugin/plugin-twitter/trunk/plugin-twitter/resources/help_en.wiki =================================================================== --- software_suite_v3/software/plugin/plugin-twitter/trunk/plugin-twitter/resources/help_en.wiki (rev 0) +++ software_suite_v3/software/plugin/plugin-twitter/trunk/plugin-twitter/resources/help_en.wiki 2009-06-12 07:03:24 UTC (rev 4794) @@ -0,0 +1,9 @@ += Synopsis = +This plugin will read your Twitter messages.Not familiar with Twitter? Have a look at "http://www.twitter.com" + +After entering your Twitter login and password you can customize several options : +- Tweet your new status : Every time the gadget is started it will make a new tweet on your twitter page. +- Tweet following status text : Here you can specify the text of the tweet for the above option. +- Maximum tweets to read : Select the number of most recent tweets Tux Droid has to read. +- Give replies sent between followers : Will make Tux Droid read the replies between followers. +- Give my messages/replies : Will make Tux Droid read your own messages and replies on twitter. Added: software_suite_v3/software/plugin/plugin-twitter/trunk/plugin-twitter/resources/help_es.wiki =================================================================== --- software_suite_v3/software/plugin/plugin-twitter/trunk/plugin-twitter/resources/help_es.wiki (rev 0) +++ software_suite_v3/software/plugin/plugin-twitter/trunk/plugin-twitter/resources/help_es.wiki 2009-06-12 07:03:24 UTC (rev 4794) @@ -0,0 +1,10 @@ += Synopsis = +Este plugin leera sus mensajes en Twitter. ¿No conoce Twitter? Eche un vistazo a http://www.twitter.com" + +Despues de registrar su usuario y contraseña de Twitter podrá personalizar varias opciones: +- Tweet su nuevo estado : Cada vez que el gadget se inicie se establecer'a un nuevo estado en su página de Twitter. +- Tweet el siguiente texto de estado : Aqui podrá especificar el texto del tweet para la opción anterior. +- Número máximo de tweets a leer : Selecciona el número de los tweets mas recientes que Tux Droid leera. +- Leer las respuestas enviadas entres sus seguidores : Hará que Tux Droid lea las respuestas enviadas por aquellos que le estan siguiendo. +- Leer mis mensajes/respuestas : Hara que Tux Droid lea tambien sus propias respuestas y mensajes en Twitter. + \ No newline at end of file Added: software_suite_v3/software/plugin/plugin-twitter/trunk/plugin-twitter/resources/help_fr.wiki =================================================================== --- software_suite_v3/software/plugin/plugin-twitter/trunk/plugin-twitter/resources/help_fr.wiki (rev 0) +++ software_suite_v3/software/plugin/plugin-twitter/trunk/plugin-twitter/resources/help_fr.wiki 2009-06-12 07:03:24 UTC (rev 4794) @@ -0,0 +1,11 @@ += Synopsis = +Ce plugin va lire vos messages sur Twitter.Pas familier avec Twitter? Rendez-vous à http://www.twitter.com" + +Après avoir entré votre login Twitter et votre mot de passe, vous pourrez personnaliser quelques options : + +- Publier un nouveau tweet : Chaque fois que le gadget est lançé, il ajoutera un nouveau tweet sur votre page. +- Tweet à ajouter : Ici, vous pouvez spécifier le texte du nouveau tweet à ajouter dans le cas ou l'option précédante est activée. +- Tweets maximum à lire : Selectionnez le nombre maximum de tweets que Tux Droid doit lire. +- Donner les réponses entre followers : Va autoriser Tux Droid à lire les réponses envoyées entre vos followers. +- Donnes mes messages/réponses : Tux Droid lira vos messages et réponse sur Twitter. + \ No newline at end of file Added: software_suite_v3/software/plugin/plugin-twitter/trunk/plugin-twitter/resources/help_nl.wiki =================================================================== --- software_suite_v3/software/plugin/plugin-twitter/trunk/plugin-twitter/resources/help_nl.wiki (rev 0) +++ software_suite_v3/software/plugin/plugin-twitter/trunk/plugin-twitter/resources/help_nl.wiki 2009-06-12 07:03:24 UTC (rev 4794) @@ -0,0 +1,10 @@ += Synopsis = +Deze plugin zal je Twitter berichten lezen.Nog nooit van Twitter gehoord? Neem een kijkje op http://www.twitter.com. + +Nadat je jouw Twitter login en wachtwoord hebt ingegeven kan je verschillende opties aanpassen : +- Tweet je nieuwe status : Telkens de gadget start zal het een nieuwe tweet maken op je Twitter pagina. +- Tweet volgende status tekst : Hier kan je de tekst aanpassen van de tweet van de vorige optie. +- Maximum te lezen tweets: Selecteer het aantal meest recente tweets dat Tux Droid moet lezen. +- Geef de antwoorden weer tussen followers : Zal Tux Droid de replieken doen lezen tussen je followers. +- Geef mijn berichten/antwoorden weer : Zal Tux Droid je eigen berichten en replieken op Twitter doen lezen. + \ No newline at end of file Added: software_suite_v3/software/plugin/plugin-twitter/trunk/plugin-twitter/resources/nl.po =================================================================== --- software_suite_v3/software/plugin/plugin-twitter/trunk/plugin-twitter/resources/nl.po (rev 0) +++ software_suite_v3/software/plugin/plugin-twitter/trunk/plugin-twitter/resources/nl.po 2009-06-12 07:03:24 UTC (rev 4794) @@ -0,0 +1,61 @@ + +msgid "" +msgstr "Project-Id-Version: PACKAGE VERSION\nReport-Msgid-Bugs-To: \nPOT-Creation-Date: 2009-04-16 14:12+0200\nPO-Revision-Date: 2009-04-16 14:16+0200\nLast-Translator: Sebastiaan Vanpoucke <se...@ky...>\nLanguage-Team: LANGUAGE <LL...@li...>\nLanguage: nl\nMIME-Version: 1.0\nContent-Type: text/plain; charset=UTF-8\nContent-Transfer-Encoding: 8bit\nPlural-Forms: nplurals=2; plural=(n != 1);\nX-Generator: Pootle 1.2.1\n" + +msgid "Twitter Gadget" +msgstr "Twitter gadget" + +msgid "Username" +msgstr "Gebruikersnaam" + +msgid "your_user_name" +msgstr "jouw_gebruikersnaam" + +msgid "Password" +msgstr "Wachtwoord" + +msgid "your_password" +msgstr "jouw_wachtwoord" + +msgid "Tweet your new status" +msgstr "Tweet je nieuwe status" + +msgid "Tweet following status text" +msgstr "Tweet volgende status tekst" + +msgid "Give my messages/replies" +msgstr "Geef mijn berichten/antwoorden weer" + +msgid "The Twitter gadget will make Tux Droid read your tweets from your Twitter account." +msgstr "Met de Twitter gadget kan Tux Droid je tweets van je Twitter account lezen." + +msgid "reply from {0}, the reply is: {1}" +msgstr "antwoord van {0}, het antwoord is: {1}" + +msgid "message from {0}, the message is: {1}" +msgstr "bericht van {0}, het bericht is: {1}" + +msgid "you don't have replies" +msgstr "Er zijn geen antwoorden" + +msgid "you don't have private messages" +msgstr "Je hebt geen persoonlijke berichten" + +msgid "No new tweets available." +msgstr "Er zijn geen nieuwe tweets beschikbaar." + +msgid "I cannot get connected to your twitter accound. Please, verify your internet connection." +msgstr "Ik kan geen verbinding maken met je twitter account. Gelieve je internet connectie te controleren." + +msgid "Give replies sent between followers" +msgstr "Geef antwoorden weer tussen followers" + +msgid "Maximum tweets to read" +msgstr "Maximum te lezen tweets" + +msgid "Hello all from my Tux Droid twitter gadget" +msgstr "Hallo allemaal van mijn Tux Droid Twitter gadget" + +msgid "You do not seem to be connected. Please, verify you username and password, then try again." +msgstr "Ik kan geen verbinding maken. Controleer of je gebruikersnaam en wachtwoord correct zijn ingegeven." + Added: software_suite_v3/software/plugin/plugin-twitter/trunk/plugin-twitter/resources/plugin.png =================================================================== (Binary files differ) Property changes on: software_suite_v3/software/plugin/plugin-twitter/trunk/plugin-twitter/resources/plugin.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: software_suite_v3/software/plugin/plugin-twitter/trunk/plugin-twitter/resources/plugin.pot =================================================================== --- software_suite_v3/software/plugin/plugin-twitter/trunk/plugin-twitter/resources/plugin.pot (rev 0) +++ software_suite_v3/software/plugin/plugin-twitter/trunk/plugin-twitter/resources/plugin.pot 2009-06-12 07:03:24 UTC (rev 4794) @@ -0,0 +1,57 @@ +msgid "Twitter Gadget" +msgstr "" + +msgid "Username" +msgstr "" + +msgid "your_user_name" +msgstr "" + +msgid "Password" +msgstr "" + +msgid "your_password" +msgstr "" + +msgid "Tweet your new status" +msgstr "" + +msgid "Tweet following status text" +msgstr "" + +msgid "Give my messages/replies" +msgstr "" + +msgid "The Twitter gadget will make Tux Droid read your tweets from your Twitter account." +msgstr "" + +msgid "reply from {0}, the reply is: {1}" +msgstr "" + +msgid "message from {0}, the message is: {1}" +msgstr "" + +msgid "you don't have replies" +msgstr "" + +msgid "you don't have private messages" +msgstr "" + +msgid "No new tweets available." +msgstr "" + +msgid "I cannot get connected to your twitter accound. Please, verify your internet connection." +msgstr "" + +msgid "Give replies sent between followers" +msgstr "" + +msgid "Maximum tweets to read" +msgstr "" + +msgid "Hello all from my Tux Droid twitter gadget" +msgstr "" + +msgid "You do not seem to be connected. Please, verify you username and password, then try again." +msgstr "" + Added: software_suite_v3/software/plugin/plugin-twitter/trunk/plugin-twitter/resources/plugin.xml =================================================================== --- software_suite_v3/software/plugin/plugin-twitter/trunk/plugin-twitter/resources/plugin.xml (rev 0) +++ software_suite_v3/software/plugin/plugin-twitter/trunk/plugin-twitter/resources/plugin.xml 2009-06-12 07:03:24 UTC (rev 4794) @@ -0,0 +1,146 @@ + +<gadget> + <interpreter + kind="java"> + <executable>TwitterPlugin</executable> + </interpreter> + <description> + <name>Twitter Plugin</name> + <ttsName>Twitter</ttsName> + <description>The Twitter plugin will make Tux Droid read your tweets from your Twitter account.</description> + <author>Jérôme Conan</author> + <version>2.0</version> + <iconFile>resources/plugin.png</iconFile> + <executionMode>command</executionMode> + <uuid>623afa3f-7ae3-43f9-b89b-bc5a8185b0cf</uuid> + </description> + <parameters> + <parameter + category="User parameters" + name="username" + description="Username" + type="string" + defaultValue="your_user_name" /> + <parameter + category="User parameters" + name="password" + description="Password" + type="string" + defaultValue="your_password" /> + <parameter + category="User parameters" + name="updateStatus" + description="Tweet your new status" + type="boolean" + defaultValue="true" /> + <parameter + category="User parameters" + name="myStatus" + description="Tweet following status text" + type="string" + defaultValue="Hello all from my Tux Droid twitter gadget" /> + <parameter + category="User parameters" + name="maxRead" + description="Maximum tweets to read" + type="enum(10, 15, 20, 25, 30)" + defaultValue="10" /> + <parameter + category="User parameters" + name="giveOtherReplies" + description="Give replies sent between followers" + type="boolean" + defaultValue="true" /> + <parameter + category="User parameters" + name="giveMessages" + description="Give my messages/replies" + type="boolean" + defaultValue="true" /> + </parameters> + <commands> + <command + name="run" + description="The Twitter plugin will make Tux Droid read your tweets from your Twitter account." /> + </commands> + <tasks> + <task + name="Start every x" + description="Start me every x" + command="run" + type="every x" + activated="false" + + weekMask="true,true,true,true,true,true,true" + weekMaskType="flat" + weekMaskVisible="true" + + date="0000/00/00" + dateVisible="false" + + hoursBegin="00:00:00" + hoursBeginMask="true,true,true" + hoursBeginVisible="true" + + hoursEnd="23:59:00" + hoursEndMask="true,true,true" + hoursEndVisible="true" + + delay="00:01:00" + delayMask="true,true,true" + delayVisible="true" + /> + <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="flat" + weekMaskVisible="true" + + date="0000/00/00" + dateVisible="false" + + hoursBegin="00:00:00" + hoursBeginMask="true,true,true" + hoursBeginVisible="true" + + hoursEnd="23:59:00" + hoursEndMask="true,true,true" + hoursEndVisible="true" + + delay="00:01:00" + delayMask="true,true,true" + delayVisible="true" + /> + <task + name="Start daily at" + description="Start me daily" + command="run" + type="daily at" + activated="false" + + weekMask="true,true,true,true,true,true,true" + weekMaskType="flat" + weekMaskVisible="true" + + date="0000/00/00" + dateVisible="false" + + hoursBegin="00:00:00" + hoursBeginMask="true,true,true" + hoursBeginVisible="true" + + hoursEnd="23:59:00" + hoursEndMask="true,true,true" + hoursEndVisible="true" + + delay="00:01:00" + delayMask="true,true,true" + delayVisible="false" + /> + </tasks> +</gadget> Added: software_suite_v3/software/plugin/plugin-twitter/trunk/plugin-twitter/src/Configuration.java =================================================================== --- software_suite_v3/software/plugin/plugin-twitter/trunk/plugin-twitter/src/Configuration.java (rev 0) +++ software_suite_v3/software/plugin/plugin-twitter/trunk/plugin-twitter/src/Configuration.java 2009-06-12 07:03:24 UTC (rev 4794) @@ -0,0 +1,174 @@ +import com.kysoh.tuxdroid.plugin.framework.plugin.SimplePluginConfiguration; + +/* This file is part of "Tux Droid Gadget Twitter". + * Copyright 2008, kysoh + * Author : Jerome Conan + * Site : http://www.kysoh.com/ + * + * "Tux Droid Gadget Twitter" 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. + * + * "Tux Droid Gadget Twitter" 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 "Tux Droid Gadget Twitter"; 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. + */ + + + +public class Configuration extends SimplePluginConfiguration{ + + private String username = ""; + private String password = ""; + private String myStatus = "Hello all two gadgets will come soon : tuxdroid-gadget-system and tuxdroid-gadget-twitter."; + private boolean updateStatus = true; + private String maxRead = "10"; + private boolean giveMessages = true; + private boolean giveOtherReplies = true; + + + /** + * Sets the username. + * @param username + */ + public void setUsername(String username) + { + this.username = username; + } + + + /** + * Return the username. + * @return + */ + public String getUsername() + { + return this.username; + } + + + /** + * Set the user password. + * @param password + */ + public void setPassword(String password) + { + this.password = password; + } + + + /** + * Return the user password. + * @return + */ + public String getPassword() + { + return this.password; + } + + + /** + * Sets the user status on twitter. + */ + public void setMyStatus(String myStatus) + { + this.myStatus = myStatus; + } + + + /** + * Return the status to be set. + * @return + */ + public String getMyStatus() + { + return this.myStatus; + } + + + /** + * Set or not the update request. + * @param updateStatus + */ + public void setUpdateStatus(boolean updateStatus) + { + this.updateStatus = updateStatus; + } + + + /** + * Return true if user want to update his status. + * @return + */ + public boolean getUpdateStatus() + { + return this.updateStatus; + } + + + /** + * Set giveMessages parameter. + * @param giveMessages + */ + public void setGiveMessages(boolean giveMessages) + { + this.giveMessages = giveMessages; + } + + + /** + * Return true if user want to hear his messages. + * @return + */ + public boolean getGiveMessages() + { + return this.giveMessages; + } + + + /** + * Return true if users want the heard replies giver by different user to an other one. + * @return + */ + public boolean getGiveOtherReplies() + { + return this.giveOtherReplies; + } + + + /** + * Set 'give other replies' option. + * @param give + */ + public void setGiveOtherReplies(boolean give) + { + this.giveOtherReplies = give; + } + + + /** + * Set the maximum entries to read. + * @param value + */ + public void setMaxRead(String value) + { + this.maxRead = value; + } + + + /** + * Return the maximum entries allowed to be read. + * @return + */ + public int getMaxRead() + { + return Integer.valueOf(this.maxRead).intValue(); + } +} Added: software_suite_v3/software/plugin/plugin-twitter/trunk/plugin-twitter/src/FriendStatut.java =================================================================== --- software_suite_v3/software/plugin/plugin-twitter/trunk/plugin-twitter/src/FriendStatut.java (rev 0) +++ software_suite_v3/software/plugin/plugin-twitter/trunk/plugin-twitter/src/FriendStatut.java 2009-06-12 07:03:24 UTC (rev 4794) @@ -0,0 +1,81 @@ +/* This file is part of "Tux Droid Gadget Twitter". + * Copyright 2008, kysoh + * Author : Jerome Conan + * Site : http://www.kysoh.com/ + * + * "Tux Droid Gadget Twitter" 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. + * + * "Tux Droid Gadget Twitter" 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 "Tux Droid Gadget Twitter"; 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. + */ + +import java.io.Serializable; + +public class FriendStatut implements Serializable{ + + private static final long serialVersionUID = -2710016821846315218L; + + private String friend = null; + private String Status = null; + + /** + * Constructor. + * @param friendName + * @param status + */ + public FriendStatut(String friendName, String status) + { + this.friend = friendName; + this.Status = status; + } + + + /** + * Return the friend name. + * @return + */ + public String getFriendName() + { + return this.friend; + } + + + /** + * Return the friend status. + * @return + */ + public String getFriendStatus() + { + return this.Status; + } + + + /** + * Set the friend name. + * @param aFriendName + */ + public void setFriendName(String aFriendName) + { + this.friend = aFriendName; + } + + + /** + * Set the friend status. + * @param aFriendStatus + */ + public void setFriendStatus(String aFriendStatus) + { + this.Status = aFriendStatus; + } +} Added: software_suite_v3/software/plugin/plugin-twitter/trunk/plugin-twitter/src/Message.java =================================================================== --- software_suite_v3/software/plugin/plugin-twitter/trunk/plugin-twitter/src/Message.java (rev 0) +++ software_suite_v3/software/plugin/plugin-twitter/trunk/plugin-twitter/src/Message.java 2009-06-12 07:03:24 UTC (rev 4794) @@ -0,0 +1,82 @@ +/* This file is part of "Tux Droid Gadget Twitter". + * Copyright 2008, kysoh + * Author : Jerome Conan + * Site : http://www.kysoh.com/ + * + * "Tux Droid Gadget Twitter" 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. + * + * "Tux Droid Gadget Twitter" 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 "Tux Droid Gadget Twitter"; 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. + */ + +import java.io.Serializable; + +public class Message implements Serializable{ + + private static final long serialVersionUID = -2723363051271966964L; + + private String sender = null; + private String message = null; + + /** + * Constructor. + * @param sender + * @param message + */ + public Message(String sender, String message) + { + this.sender = sender; + this.message = message; + } + + + /** + * Return the message sender. + * @return + */ + public String getSender() + { + return this.sender; + } + + + /** + * Return the message itself. + * @return + */ + public String getMessage() + { + return this.message; + } + + + /** + * Set the message. + * @param aMessage + */ + public void setMessage(String aMessage) + { + this.message = aMessage; + } + + + /** + * Set the sender. + * @param aSender + */ + public void setSender(String aSender) + { + this.sender = aSender; + } + +} Added: software_suite_v3/software/plugin/plugin-twitter/trunk/plugin-twitter/src/Reply.java =================================================================== --- software_suite_v3/software/plugin/plugin-twitter/trunk/plugin-twitter/src/Reply.java (rev 0) +++ software_suite_v3/software/plugin/plugin-twitter/trunk/plugin-twitter/src/Reply.java 2009-06-12 07:03:24 UTC (rev 4794) @@ -0,0 +1,81 @@ +/* This file is part of "Tux Droid Gadget Twitter". + * Copyright 2008, kysoh + * Author : Jerome Conan + * Site : http://www.kysoh.com/ + * + * "Tux Droid Gadget Twitter" 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. + * + * "Tux Droid Gadget Twitter" 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 "Tux Droid Gadget Twitter"; 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. + */ + +import java.io.Serializable; + +public class Reply implements Serializable{ + + private static final long serialVersionUID = -4131206164350955300L; + + private String sender = null; + private String reply = null; + + /** + * Constructor. + * @param sender + * @param reply + */ + public Reply(String sender, String reply) + { + this.sender = sender; + this.reply = reply; + } + + + /** + * Return the reply sender. + * @return + */ + public String getSender() + { + return this.sender; + } + + + /** + * Return the reply itself. + * @return + */ + public String getReply() + { + return this.reply; + } + + + /** + * Set the reply sender. + * @param aSender + */ + public void setSender(String aSender) + { + this.sender = aSender; + } + + + /** + * Set the message itself. + * @param aReply + */ + public void setReply(String aReply) + { + this.reply = aReply; + } +} Added: software_suite_v3/software/plugin/plugin-twitter/trunk/plugin-twitter/src/TwitterDatasStruct.java =================================================================== --- software_suite_v3/software/plugin/plugin-twitter/trunk/plugin-twitter/src/TwitterDatasStruct.java (rev 0) +++ software_suite_v3/software/plugin/plugin-twitter/trunk/plugin-twitter/src/TwitterDatasStruct.java 2009-06-12 07:03:24 UTC (rev 4794) @@ -0,0 +1,297 @@ +/* This file is part of "Tux Droid Gadget Twitter". + * Copyright 2008, kysoh + * Author : Jerome Conan + * Site : http://www.kysoh.com/ + * + * "Tux Droid Gadget Twitter" 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. + * + * "Tux Droid Gadget Twitter" 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 "Tux Droid Gadget Twitter"; 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. + */ + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; +import java.io.Serializable; +import java.util.Vector; + + +public class TwitterDatasStruct extends Object implements Serializable{ + + private static final long serialVersionUID = 8395814134877723558L; + + public static final byte FRIENDS_STATUSES = 0; + public static final byte REPLIES = 1; + public static final byte MESSAGES = 2; + + public SerializedVector vktStruct; + private File structFile; + + + public TwitterDatasStruct(String username) + { + //Getting file where was registered serialized vector. + String path = System.getProperty("user.home") + File.separator + "MyTux" + File.separator + "TuxDroidSettings"; + //tds = tuxdroid datas saved. + structFile = new File(path + File.separator + username + "@twitter.sav"); + if(structFile.exists()) + { + //Getting serialized object struct. + vktStruct = this.loadStruct(); + } + else + { + //Create struct. + vktStruct = new SerializedVector(); + if(vktStruct == null) + { + vktStruct = new SerializedVector(); + } + } + } + + + /** + * Regiter the structure. + */ + public void registerStruct() + { + if(this.vktStruct.size() <= 0) + { + return; + } + + try + { + FileOutputStream file = new FileOutputStream(this.structFile); + ObjectOutputStream oos = new ObjectOutputStream(file); + oos.writeObject(this.vktStruct); + oos.flush(); + oos.close(); + } + catch (java.io.IOException e) + { + e.printStackTrace(); + } + } + + + + /** + * Load the twitterDatasStruct object. + */ + private SerializedVector loadStruct() + { + try + { + FileInputStream fichier = new FileInputStream(this.structFile); + ObjectInputStream ois = new ObjectInputStream(fichier); + return (SerializedVector) ois.readObject(); + } + catch (java.io.IOException e) + { + e.printStackTrace(); + } + catch (ClassNotFoundException e) + { + e.printStackTrace(); + } + return null; + } + + + /** + * Add a message to the message hashtable. + * @param sender + * @param message + */ + public void addMessage(String sender, String message) + { + this.vktStruct.addMessage(sender, message); + } + + + /** + * Add a reply to the reply hashtable. + * @param sender + * @param reply + */ + public void addReply(String sender, String reply) + { + this.vktStruct.addReply(sender, reply); + } + + + /** + * Add a status for selected friend. + * @param friens + * @param status + */ + public void addFriendStatus(String friend, String status) + { + this.vktStruct.addFriendStatus(friend, status); + } + + + /** + * Return true if the target is registered. + * @param list + * @param sender + * @param value + * @return + */ + public boolean isRegistered(byte list, String sender, String value) + { + + switch(list) + { + case TwitterDatasStruct.FRIENDS_STATUSES: + { + for(int index=0; index < this.vktStruct.size(); index ++) + { + if(this.vktStruct.isFriendStatut(index)) + { + FriendStatut friendStatus = (FriendStatut)this.vktStruct.get(index); + if(friendStatus.getFriendName().equals(sender)) + { + if(friendStatus.getFriendStatus().equals(value)) + { + return true; + } + } + } + } + } + + case TwitterDatasStruct.MESSAGES: + { + for(int index=0; index < this.vktStruct.size(); index ++) + { + if(this.vktStruct.isMessage(index)) + { + Message message = (Message) this.vktStruct.get(index); + if(message.getSender().equals(sender)) + { + if(message.getMessage().equals(value)) + { + return true; + } + } + } + } + } + + case TwitterDatasStruct.REPLIES: + { + for(int index=0; index < this.vktStruct.size(); index ++) + { + if(this.vktStruct.isReply(index)) + { + Reply reply = (Reply) this.vktStruct.get(index); + if(reply.getSender().equals(sender)) + { + if(reply.getReply().equals(value)) + { + return true; + } + } + } + } + } + } + return false; + } + + +/** + * Handle a serialized vector of hashtable typed as <string string> + * @author nux + * + */ +class SerializedVector extends Vector<Object> implements Serializable{ + + private static final long serialVersionUID = 7018170438526763017L; + + public SerializedVector() + { + super(); + } + + /** + * Add a new message in the object. + * @param sender + * @param message + */ + public void addMessage(String sender, String message) + { + this.add(new Message(sender, message)); + } + + + /** + * Add a new Reply in the object. + * @param sender + * @param reply + */ + public void addReply(String sender, String reply) + { + this.add(new Reply(sender, reply)); + } + + + /** + * Add a new user status in the object. + * @param friendName + * @param friendStatus + */ + public void addFriendStatus(String friendName, String friendStatus) + { + this.add(new FriendStatut(friendName, friendStatus)); + } + + + /** + * Return true if object at 'objectIndex' is a message. + * @param objectIndex + * @return + */ + public boolean isMessage(int objectIndex) + { + return this.get(objectIndex) instanceof Message; + } + + + /** + * Return true if the object at 'objectIndex' is a Reply. + * @param objectIndex + * @return + */ + public boolean isReply(int objectIndex) + { + return this.get(objectIndex) instanceof Reply; + } + + + /** + * Return true if the object at 'objectIndex' is a FriendStatut. + * @param objectIndex + * @return + */ + public boolean isFriendStatut(int objectIndex) + { + return this.get(objectIndex) instanceof FriendStatut; + } +} +} Added: software_suite_v3/software/plugin/plugin-twitter/trunk/plugin-twitter/src/TwitterPlugin.java =================================================================== --- software_suite_v3/software/plugin/plugin-twitter/trunk/plugin-twitter/src/TwitterPlugin.java (rev 0) +++ software_suite_v3/software/plugin/plugin-twitter/trunk/plugin-twitter/src/TwitterPlugin.java 2009-06-12 07:03:24 UTC (rev 4794) @@ -0,0 +1,375 @@ +/* This file is part of "Tux Droid Gadget Twitter". + * Copyright 2008, kysoh + * Author : Jerome Conan + * Site : http://www.kysoh.com/ + * + * "Tux Droid Gadget Twitter" 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. + * + * "Tux Droid Gadget Twitter" 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 "Tux Droid Gadget Twitter"; 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. + */ + +import java.util.List; +import java.util.Vector; + +import com.kysoh.tuxdroid.plugin.framework.plugin.SimplePlugin; + +import winterwell.jtwitter.Twitter; +import winterwell.jtwitter.TwitterException; +import winterwell.jtwitter.Twitter.Message; +import winterwell.jtwitter.Twitter.Status; +import winterwell.jtwitter.Twitter.User; + + +public class TwitterPlugin extends SimplePlugin<Configuration>{ + + private TwitterDatasStruct savedStruct; + + private String[] smileys = new String[]{":)", ":-)", ":(", ":-(", ":|", ":-|", + ":$", ":-$", ";)", ";-)", ";(", ";-(", + "o/", "\\o", "\\o/", ":o", ":-o", ":@", + ":-@", ":D", ":-D", ":p", ":d", ":-p", + ":-d", "=)", "=-)", "$)", "$-)"}; + + @Override + protected void start() throws Throwable + { + savedStruct = new TwitterDatasStruct(this.configuration().getUsername()); + // Getting connected to twitter. + Twitter twitter = null; + twitter = new Twitter(this.configuration().getUsername(), this.configuration().getPassword()); + + + twitter.setSource("tuxdroid"); + + //Set user status + if(this.configuration().getUpdateStatus()) + { + try + { + twitter.updateStatus(this.configuration().getMyStatus()); + } + catch(TwitterException notConnected) + { + throwMessage("You do not seem to be connected. Please, verify you username and password, then try again."); + this.quitGadget(); + } + } + + Vector<Twitter.Status> repliesToOtherUsers = new Vector<Twitter.Status>(); + + try + { + boolean noStatuses = true; + List<User> friend = twitter.getFriends(); + + int max = 0; + + for(int i=0; i < twitter.getFriends().size(); i++) + { + try + { + + if( max >= this.configuration().getMaxRead() ) + { + break; + } + + Status status = friend.get(i).getStatus(); + + String statusText = status.getText(); + String username = status.getUser().getName(); + + //if a new status was set for this user. + boolean said = this.savedStruct.isRegistered(TwitterDatasStruct.FRIENDS_STATUSES, username, statusText); + if((statusText != "null") && !said) + { + noStatuses = false; + String stat = statusText.replace("&", ""); + + for(String simley : this.smileys) + { + stat = stat.replace(simley, ""); + } + + stat = this.urlFilter(stat); + + if(isReplyToOtherUser(stat)) + { + repliesToOtherUsers.add(status); + } + + else + { + throwMessage(username + ", " + stat); + max += 1; + } + + //Saving last entry. + this.savedStruct.addFriendStatus(username, statusText); + } + } + catch(NullPointerException statusNotExists) + { + ; + } + } + + + if((repliesToOtherUsers.size() > 0) && this.configuration().getGiveOtherReplies()) + { + max = this.configuration().getMaxRead(); + + for(Twitter.Status state : repliesToOtherUsers) + { + if( max <= 0 ) + { + return; + } + + String sender = state.getUser().getName(); + String to = state.getText().substring(1, state.getText().indexOf(" ")); + if(!to.equals(this.configuration().getUsername())) + { + String reply = state.getText().substring(state.getText().indexOf(" ") + 1 ); + reply = this.urlFilter(reply); + throwMessage("Reply from {0} to {0}, the reply is : {2}", sender, to, reply); + } + + max -= 1; + } + } + + + if(noStatuses) + { + throwMessage("No new tweets available."); + } + } + catch(TwitterException badRequest) + { + throwMessage("Twitter is busy for now, please, try later."); + this.quitGadget(); + } + + + + //Getting provates and public messages. + if(this.configuration().getGiveMessages()) + { + boolean noReplies = true; + boolean noMessage = true; + + try + { + List<Message> replies = twitter.getReplies(); + List<Message> messages = twitter.getDirectMessages(); + + //Getting replies first. + if(replies.size() > 0) + { + int maxRead = this.configuration().getMaxRead(); + + //then give replies. + for(Message reply : replies) + { + boolean can = maxRead > 0 ? true : false; + + if(!can) + { + break; + } + + String username = reply.getSender().getName(); + + boolean said = this.savedStruct.isRegistered(TwitterDatasStruct.REPLIES, username, reply.getText()); + + if((reply.getText() != "null") && !said) + { + noReplies = false; + String repl = reply.getText().replace("&", "").replace("@" + this.configuration().getUsername(), ""); + + for(String simley : this.smileys) + { + repl = repl.replace(simley, ""); + } + + repl = this.urlFilter(repl); + + throwMessage("reply from {0}, the reply is: {1}", username, repl); + this.savedStruct.addReply(username, reply.getText()); + } + + maxRead -= 1; + } + } + + if(noReplies) + { + throwMessage("you don't have replies"); + } + + if(messages.size() > 0) + { + int maxRead = this.configuration().getMaxRead(); + + //then give messages. + for(Message message : messages) + { + boolean can = maxRead > 0 ? true : false; + + if(!can) + { + break; + } + + String username = message.getSender().getName(); + boolean said = this.savedStruct.isRegistered(TwitterDatasStruct.MESSAGES, username, message.getText()); + if((message.getText() != "null") && !said) + { + noMessage = false; + String mess = message.getText().replace("&", ""); + + for(String simley : this.smileys) + { + mess = mess.replace(simley, ""); + } + + mess = this.urlFilter(mess); + + throwMessage("message from {0}, the message is: {1}", username, mess); + this.savedStruct.addMessage(username, message.getText()); + } + + maxRead -=1; + } + } + + if(noMessage) + { + throwMessage("you don't have private messages"); + } + } + catch(TwitterException badRequest) + { + throwMessage("Twitter is busy for now, please, try later."); + this.quitGadget(); + } + } + + //RegisterStruct. + this.savedStruct.registerStruct(); + } + + + /** + * Return true if the text value indicates that the message was sent from a user + * to an other user , but not the current connected one. + * @param value + * @return + */ + private boolean isReplyToOtherUser(String value) + { + if(value.charAt(0) == '@') + { + return true; + } + return false; + } + + + public String urlFilter(String string) + { + while(string.contains("http://")) + { + try + { + int start = string.indexOf("http://"); + int stop = string.indexOf(" ", start); + + if( stop == -1 ) + { + stop = string.length() ; + } + + String url = string.substring(start, stop); + string = string.replace(url, "."); + } + catch(StringIndexOutOfBoundsException e) + { + return string; + } + catch(NullPointerException no) + { + return string; + } + } + + while(string.contains("ftp://")) + { + try + { + int start = string.indexOf("http://"); + int stop = string.indexOf(" ", start); + + if( stop == -1 ) + { + stop = string.length() ; + } + + String url = string.substring(start, stop); + string = string.replace(url, "."); + } + catch(StringIndexOutOfBoundsException e) + { + return string; + } + catch(NullPointerException no) + { + return string; + } + } + + return string; + } + + + /** + * Quit the gadget. + */ + public void quitGadget() + { + System.exit(0); + } + + + public static void main(String[] args) + { + new TwitterPlugin().boot(args, new Configuration()); + } + + + @Override + protected void onPluginEvent(String arg0, String[] arg1) throws Throwable { + // TODO Auto-generated method stub + ; + } + + + @Override + protected void onPluginStop() throws Throwable { + // TODO Auto-generated method stub + ; + } + +} |