[tuxdroid-svn] r5721 - in software_suite_v3/software/plugin/plugin-twitter/branches/random_sentence
Status: Beta
Brought to you by:
ks156
|
From: ks156 <c2m...@c2...> - 2009-10-19 09:05:34
|
Author: ks156 Date: 2009-10-19 11:05:21 +0200 (Mon, 19 Oct 2009) New Revision: 5721 Modified: software_suite_v3/software/plugin/plugin-twitter/branches/random_sentences/plugin-twitter/resources/de.wiki software_suite_v3/software/plugin/plugin-twitter/branches/random_sentences/plugin-twitter/resources/en.po software_suite_v3/software/plugin/plugin-twitter/branches/random_sentences/plugin-twitter/resources/nl.po software_suite_v3/software/plugin/plugin-twitter/branches/random_sentences/plugin-twitter/src/Configuration.java software_suite_v3/software/plugin/plugin-twitter/branches/random_sentences/plugin-twitter/src/FriendStatut.java software_suite_v3/software/plugin/plugin-twitter/branches/random_sentences/plugin-twitter/src/Message.java software_suite_v3/software/plugin/plugin-twitter/branches/random_sentences/plugin-twitter/src/Reply.java software_suite_v3/software/plugin/plugin-twitter/branches/random_sentences/plugin-twitter/src/TwitterDatasStruct.java software_suite_v3/software/plugin/plugin-twitter/branches/random_sentences/plugin-twitter/src/TwitterPlugin.java Log: * Set file format to unix Modified: software_suite_v3/software/plugin/plugin-twitter/branches/random_sentences/plugin-twitter/resources/de.wiki =================================================================== --- software_suite_v3/software/plugin/plugin-twitter/branches/random_sentences/plugin-twitter/resources/de.wiki 2009-10-19 09:02:14 UTC (rev 5720) +++ software_suite_v3/software/plugin/plugin-twitter/branches/random_sentences/plugin-twitter/resources/de.wiki 2009-10-19 09:05:21 UTC (rev 5721) @@ -1,10 +1,10 @@ -= Übersicht = -Dieses Plugin liest Ihre Twitter-Nachrichten. Keine Ahnung, was Twitter ist? Infos unter http://www.twitter.com - -Nach der Eingabe von Twitter-Login und Kennwort können Sie verschiedene Optionen anpassen: -* Tweeten Sie Ihren neuen Status: Jedes Mal, wenn diese Funktion gestartet wird, erstellt sie einen neuen Tweet auf Ihrer Twitter-Seite. -* Tweeten Sie entsprechend dem Statustext: Hier können Sie den Text für den Tweet der obigen Option festlegen. -* Maximale Tweetanzahl: Die Anzahl der neuesten von Tux Droid vorzulesenden Tweets wählen. -* Gibt die unter den Followern gegebenen Antworten wieder: Tux Droid liest die unter den Followern gegebenen Antworten vor. -* Meine Nachrichten/Antworten wiedergeben: Tux Droid liest Ihre eigenen Nachrichten und Antworten auf Twitter vor. - += Übersicht = +Dieses Plugin liest Ihre Twitter-Nachrichten. Keine Ahnung, was Twitter ist? Infos unter http://www.twitter.com + +Nach der Eingabe von Twitter-Login und Kennwort können Sie verschiedene Optionen anpassen: +* Tweeten Sie Ihren neuen Status: Jedes Mal, wenn diese Funktion gestartet wird, erstellt sie einen neuen Tweet auf Ihrer Twitter-Seite. +* Tweeten Sie entsprechend dem Statustext: Hier können Sie den Text für den Tweet der obigen Option festlegen. +* Maximale Tweetanzahl: Die Anzahl der neuesten von Tux Droid vorzulesenden Tweets wählen. +* Gibt die unter den Followern gegebenen Antworten wieder: Tux Droid liest die unter den Followern gegebenen Antworten vor. +* Meine Nachrichten/Antworten wiedergeben: Tux Droid liest Ihre eigenen Nachrichten und Antworten auf Twitter vor. + Modified: software_suite_v3/software/plugin/plugin-twitter/branches/random_sentences/plugin-twitter/resources/en.po =================================================================== --- software_suite_v3/software/plugin/plugin-twitter/branches/random_sentences/plugin-twitter/resources/en.po 2009-10-19 09:02:14 UTC (rev 5720) +++ software_suite_v3/software/plugin/plugin-twitter/branches/random_sentences/plugin-twitter/resources/en.po 2009-10-19 09:05:21 UTC (rev 5721) @@ -1,80 +1,80 @@ -msgid "Twitter Plugin" -msgstr "Twitter Plugin" - -msgid "The Twitter plugin will make Tux Droid check your Twitter account." -msgstr "The Twitter plugin will make Tux Droid check your Twitter account." - -msgid "Username" -msgstr "Username" - -msgid "Password" -msgstr "Password" - -msgid "Tweet your new status" -msgstr "Tweet my new status" - -msgid "Tweet following status text" -msgstr "Tweet following status text" - -msgid "Hello all from my Tux Droid Twitter gadget" -msgstr "Hello all from my Tux Droid Twitter gadget." - -msgid "Check Friends updates" -msgstr "Check for new Tweets" - -msgid "Check my messages/replies" -msgstr "Check my messages/replies" - -msgid "Check your Twitter account." -msgstr "Check my Twitter account." - -msgid "Check your tweets from your Twitter account." -msgstr "Check my Tweets from my Twitter account." - -msgid "Start every x" -msgstr "Alerts" - -msgid "Start me every x" -msgstr "Check my Twitter account automatically" - -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." - -msgid "There is a new Tweet available." -msgstr "There is a new Tweet available." - -msgid "You have {0} new Tweets." -msgstr "You have {0} new Tweets." - -msgid "You don't have any new Tweets." -msgstr "You don't have any new Tweets." - -msgid "You don't have any messages" -msgstr "You don't have any messages." - -msgid "You don't have any replies" -msgstr "You don't have any replies." - -msgid "Your new Tweet was not set, please, try again later" -msgstr "Your new Tweet was not set, please, try again later." - -msgid "Your Tweet was added" -msgstr "Your Tweet was added." - -msgid "Twitter is busy for now, please, try again later." -msgstr "Twitter is busy for now, please, try again later." - -msgid "One reply from {0}" -msgstr "One reply from {0}." - -msgid "{0} replies from {1}" -msgstr "{0} replies from {1}." - -msgid "One message from {0}" -msgstr "One message from {0}." - -msgid "{0} messages from {1}" -msgstr "{0} messages from {1}." - -msgid "Sorry, there was an error when connecting to Twitter. Please check your Twitter configuration." -msgstr "Sorry, there was an error when connecting to Twitter. Please check your Twitter configuration." +msgid "Twitter Plugin" +msgstr "Twitter Plugin" + +msgid "The Twitter plugin will make Tux Droid check your Twitter account." +msgstr "The Twitter plugin will make Tux Droid check your Twitter account." + +msgid "Username" +msgstr "Username" + +msgid "Password" +msgstr "Password" + +msgid "Tweet your new status" +msgstr "Tweet my new status" + +msgid "Tweet following status text" +msgstr "Tweet following status text" + +msgid "Hello all from my Tux Droid Twitter gadget" +msgstr "Hello all from my Tux Droid Twitter gadget." + +msgid "Check Friends updates" +msgstr "Check for new Tweets" + +msgid "Check my messages/replies" +msgstr "Check my messages/replies" + +msgid "Check your Twitter account." +msgstr "Check my Twitter account." + +msgid "Check your tweets from your Twitter account." +msgstr "Check my Tweets from my Twitter account." + +msgid "Start every x" +msgstr "Alerts" + +msgid "Start me every x" +msgstr "Check my Twitter account automatically" + +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." + +msgid "There is a new Tweet available." +msgstr "There is a new Tweet available." + +msgid "You have {0} new Tweets." +msgstr "You have {0} new Tweets." + +msgid "You don't have any new Tweets." +msgstr "You don't have any new Tweets." + +msgid "You don't have any messages" +msgstr "You don't have any messages." + +msgid "You don't have any replies" +msgstr "You don't have any replies." + +msgid "Your new Tweet was not set, please, try again later" +msgstr "Your new Tweet was not set, please, try again later." + +msgid "Your Tweet was added" +msgstr "Your Tweet was added." + +msgid "Twitter is busy for now, please, try again later." +msgstr "Twitter is busy for now, please, try again later." + +msgid "One reply from {0}" +msgstr "One reply from {0}." + +msgid "{0} replies from {1}" +msgstr "{0} replies from {1}." + +msgid "One message from {0}" +msgstr "One message from {0}." + +msgid "{0} messages from {1}" +msgstr "{0} messages from {1}." + +msgid "Sorry, there was an error when connecting to Twitter. Please check your Twitter configuration." +msgstr "Sorry, there was an error when connecting to Twitter. Please check your Twitter configuration." Modified: software_suite_v3/software/plugin/plugin-twitter/branches/random_sentences/plugin-twitter/resources/nl.po =================================================================== --- software_suite_v3/software/plugin/plugin-twitter/branches/random_sentences/plugin-twitter/resources/nl.po 2009-10-19 09:02:14 UTC (rev 5720) +++ software_suite_v3/software/plugin/plugin-twitter/branches/random_sentences/plugin-twitter/resources/nl.po 2009-10-19 09:05:21 UTC (rev 5721) @@ -1,80 +1,80 @@ -msgid "Twitter Plugin" -msgstr "Twitter Plugin" - -msgid "The Twitter plugin will make Tux Droid check your Twitter account." -msgstr "De Twitter plugin zal Tux Droid je Twitter account laten checken." - -msgid "Username" -msgstr "Gebruikersnaam" - -msgid "Password" -msgstr "Wachtwoord" - -msgid "Tweet your new status" -msgstr "Tweet je nieuwe status" - -msgid "Tweet following status text" -msgstr "Tweet volgende status tekst" - -msgid "Hello all from my Tux Droid Twitter gadget" -msgstr "Hallo allemaal van mijn Tux Droid Twitter gadget" - -msgid "Check Friends updates" -msgstr "Check nieuwe Tweets" - -msgid "Check my messages/replies" -msgstr "Check mijn berichten/ antwoorden" - -msgid "Check your Twitter account." -msgstr "Check mijn Twitter account." - -msgid "Check your tweets from your Twitter account." -msgstr "Check mijn Tweets op mijn Twitter account." - -msgid "Start every x" -msgstr "Alarmen" - -msgid "Start me every x" -msgstr "Check mijn Twitter account automatisch" - -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." - -msgid "There is a new Tweet available." -msgstr "Er is een nieuwe Tweet beschikbaar." - -msgid "You have {0} new Tweets." -msgstr "Je hebt {0} nieuwe Tweets." - -msgid "You don't have any new Tweets." -msgstr "Je hebt geen nieuwe Tweets." - -msgid "You don't have any messages" -msgstr "Je hebt geen nieuwe berichten." - -msgid "You don't have any replies" -msgstr "Je hebt geen nieuwe antwoorden." - -msgid "Your new Tweet was not set, please, try again later" -msgstr "Je nieuwe Tweet werd niet geplaatst, probeer later opnieuw." - -msgid "Your Tweet was added" -msgstr "Je nieuwe Tweet werd toegevoegd." - -msgid "Twitter is busy for now, please, try again later." -msgstr "Twitter is bezet op het ogenblik, probeer later opnieuw." - -msgid "One reply from {0}" -msgstr "Je hebt 1 antwoord van {0}." - -msgid "{0} replies from {1}" -msgstr "{0} antwoorden van {1}." - -msgid "One message from {0}" -msgstr "1 bericht van {0}." - -msgid "{0} messages from {1}" -msgstr "{0} berichten van {1}." - -msgid "Sorry, there was an error when connecting to Twitter. Please check your Twitter configuration." -msgstr "Sorry, ik kan geen connectie maken met Twitter. Controleer je configuratie of probeer later opnieuw." +msgid "Twitter Plugin" +msgstr "Twitter Plugin" + +msgid "The Twitter plugin will make Tux Droid check your Twitter account." +msgstr "De Twitter plugin zal Tux Droid je Twitter account laten checken." + +msgid "Username" +msgstr "Gebruikersnaam" + +msgid "Password" +msgstr "Wachtwoord" + +msgid "Tweet your new status" +msgstr "Tweet je nieuwe status" + +msgid "Tweet following status text" +msgstr "Tweet volgende status tekst" + +msgid "Hello all from my Tux Droid Twitter gadget" +msgstr "Hallo allemaal van mijn Tux Droid Twitter gadget" + +msgid "Check Friends updates" +msgstr "Check nieuwe Tweets" + +msgid "Check my messages/replies" +msgstr "Check mijn berichten/ antwoorden" + +msgid "Check your Twitter account." +msgstr "Check mijn Twitter account." + +msgid "Check your tweets from your Twitter account." +msgstr "Check mijn Tweets op mijn Twitter account." + +msgid "Start every x" +msgstr "Alarmen" + +msgid "Start me every x" +msgstr "Check mijn Twitter account automatisch" + +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." + +msgid "There is a new Tweet available." +msgstr "Er is een nieuwe Tweet beschikbaar." + +msgid "You have {0} new Tweets." +msgstr "Je hebt {0} nieuwe Tweets." + +msgid "You don't have any new Tweets." +msgstr "Je hebt geen nieuwe Tweets." + +msgid "You don't have any messages" +msgstr "Je hebt geen nieuwe berichten." + +msgid "You don't have any replies" +msgstr "Je hebt geen nieuwe antwoorden." + +msgid "Your new Tweet was not set, please, try again later" +msgstr "Je nieuwe Tweet werd niet geplaatst, probeer later opnieuw." + +msgid "Your Tweet was added" +msgstr "Je nieuwe Tweet werd toegevoegd." + +msgid "Twitter is busy for now, please, try again later." +msgstr "Twitter is bezet op het ogenblik, probeer later opnieuw." + +msgid "One reply from {0}" +msgstr "Je hebt 1 antwoord van {0}." + +msgid "{0} replies from {1}" +msgstr "{0} antwoorden van {1}." + +msgid "One message from {0}" +msgstr "1 bericht van {0}." + +msgid "{0} messages from {1}" +msgstr "{0} berichten van {1}." + +msgid "Sorry, there was an error when connecting to Twitter. Please check your Twitter configuration." +msgstr "Sorry, ik kan geen connectie maken met Twitter. Controleer je configuratie of probeer later opnieuw." Modified: software_suite_v3/software/plugin/plugin-twitter/branches/random_sentences/plugin-twitter/src/Configuration.java =================================================================== --- software_suite_v3/software/plugin/plugin-twitter/branches/random_sentences/plugin-twitter/src/Configuration.java 2009-10-19 09:02:14 UTC (rev 5720) +++ software_suite_v3/software/plugin/plugin-twitter/branches/random_sentences/plugin-twitter/src/Configuration.java 2009-10-19 09:05:21 UTC (rev 5721) @@ -1,168 +1,168 @@ -/* 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 com.kysoh.tuxdroid.plugin.framework.plugin.SimplePluginConfiguration; - - -public class Configuration extends SimplePluginConfiguration{ - - private String username = ""; - private String password = ""; - - private String myStatus = "Hello all from my tuxdroid Twitter gadget"; - private boolean updateStatus = false; - - private boolean checkFriends = true; - private boolean checkMessages = true; - - private String defaultUser = "your_user_name"; - private String defaultPassword = "_secret_"; - - - /** - * Sets the username. - * @param username - */ - public void setUsername(String username) - { - this.username = username; - } - - - /** - * Return the username. - * @return - */ - public String getUsername() - { - if (this.username.equalsIgnoreCase(this.defaultUser)) - { - return null; - } - - 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() - { - if (this.password.equalsIgnoreCase(this.defaultPassword)) - { - return null; - } - 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 or not the checkf friends updates check. - * @param updateStatus - */ - public void setCheckFriends(boolean aCheckFriends) - { - this.checkFriends = aCheckFriends; - } - - - /** - * Return true if user want to check his new friends statuses. - * @return - */ - public boolean getCheckFriends() - { - return this.checkFriends; - } - - - /** - * Set or not the check messages option. - * @param updateStatus - */ - public void setCheckMessages(boolean aCheckMessages) - { - this.checkMessages = aCheckMessages; - } - - - /** - * Return true if user want to check his replies / messages. - * @return - */ - public boolean getCheckMessages() - { - return this.checkMessages; - } - -} +/* 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 com.kysoh.tuxdroid.plugin.framework.plugin.SimplePluginConfiguration; + + +public class Configuration extends SimplePluginConfiguration{ + + private String username = ""; + private String password = ""; + + private String myStatus = "Hello all from my tuxdroid Twitter gadget"; + private boolean updateStatus = false; + + private boolean checkFriends = true; + private boolean checkMessages = true; + + private String defaultUser = "your_user_name"; + private String defaultPassword = "_secret_"; + + + /** + * Sets the username. + * @param username + */ + public void setUsername(String username) + { + this.username = username; + } + + + /** + * Return the username. + * @return + */ + public String getUsername() + { + if (this.username.equalsIgnoreCase(this.defaultUser)) + { + return null; + } + + 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() + { + if (this.password.equalsIgnoreCase(this.defaultPassword)) + { + return null; + } + 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 or not the checkf friends updates check. + * @param updateStatus + */ + public void setCheckFriends(boolean aCheckFriends) + { + this.checkFriends = aCheckFriends; + } + + + /** + * Return true if user want to check his new friends statuses. + * @return + */ + public boolean getCheckFriends() + { + return this.checkFriends; + } + + + /** + * Set or not the check messages option. + * @param updateStatus + */ + public void setCheckMessages(boolean aCheckMessages) + { + this.checkMessages = aCheckMessages; + } + + + /** + * Return true if user want to check his replies / messages. + * @return + */ + public boolean getCheckMessages() + { + return this.checkMessages; + } + +} Modified: software_suite_v3/software/plugin/plugin-twitter/branches/random_sentences/plugin-twitter/src/FriendStatut.java =================================================================== --- software_suite_v3/software/plugin/plugin-twitter/branches/random_sentences/plugin-twitter/src/FriendStatut.java 2009-10-19 09:02:14 UTC (rev 5720) +++ software_suite_v3/software/plugin/plugin-twitter/branches/random_sentences/plugin-twitter/src/FriendStatut.java 2009-10-19 09:05:21 UTC (rev 5721) @@ -1,81 +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; - } -} +/* 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; + } +} Modified: software_suite_v3/software/plugin/plugin-twitter/branches/random_sentences/plugin-twitter/src/Message.java =================================================================== --- software_suite_v3/software/plugin/plugin-twitter/branches/random_sentences/plugin-twitter/src/Message.java 2009-10-19 09:02:14 UTC (rev 5720) +++ software_suite_v3/software/plugin/plugin-twitter/branches/random_sentences/plugin-twitter/src/Message.java 2009-10-19 09:05:21 UTC (rev 5721) @@ -1,82 +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; - } - -} +/* 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; + } + +} Modified: software_suite_v3/software/plugin/plugin-twitter/branches/random_sentences/plugin-twitter/src/Reply.java =================================================================== --- software_suite_v3/software/plugin/plugin-twitter/branches/random_sentences/plugin-twitter/src/Reply.java 2009-10-19 09:02:14 UTC (rev 5720) +++ software_suite_v3/software/plugin/plugin-twitter/branches/random_sentences/plugin-twitter/src/Reply.java 2009-10-19 09:05:21 UTC (rev 5721) @@ -1,81 +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; - } -} +/* 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; + } +} Modified: software_suite_v3/software/plugin/plugin-twitter/branches/random_sentences/plugin-twitter/src/TwitterDatasStruct.java =================================================================== --- software_suite_v3/software/plugin/plugin-twitter/branches/random_sentences/plugin-twitter/src/TwitterDatasStruct.java 2009-10-19 09:02:14 UTC (rev 5720) +++ software_suite_v3/software/plugin/plugin-twitter/branches/random_sentences/plugin-twitter/src/TwitterDatasStruct.java 2009-10-19 09:05:21 UTC (rev 5721) @@ -1,312 +1,312 @@ -/* 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; - private boolean firstCycle; - - - - public TwitterDatasStruct(String username) - { - //tds = tuxdroid datas saved. - - File path = new File(""); - structFile = new File( path.getAbsolutePath() + File.separator + username + "@twitter.sav"); - - if(structFile.exists()) - { - //Getting serialized object struct. - this.firstCycle = false; - vktStruct = this.loadStruct(); - } - else - { - this.firstCycle = true; - //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); - } - - - - /** - * This function return the state of cycle ( first start or not for the current user ). - * @return - */ - public boolean isFirstCycle() - { - return this.firstCycle; - } - - /** - * 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; - } -} -} +/* 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; + private boolean firstCycle; + + + + public TwitterDatasStruct(String username) + { + //tds = tuxdroid datas saved. + + File path = new File(""); + structFile = new File( path.getAbsolutePath() + File.separator + username + "@twitter.sav"); + + if(structFile.exists()) + { + //Getting serialized object struct. + this.firstCycle = false; + vktStruct = this.loadStruct(); + } + else + { + this.firstCycle = true; + //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); + } + + + + /** + * This function return the state of cycle ( first start or not for the current user ). + * @return + */ + public boolean isFirstCycle() + { + return this.firstCycle; + } + + /** + * 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; + } +} +} Modified: software_suite_v3/software/plugin/plugin-twitter/branches/random_sentences/plugin-twitter/src/TwitterPlugin.java =================================================================== --- software_suite_v3/software/plugin/plugin-twitter/branches/random_sentences/plugin-twitter/src/TwitterPlugin.java 2009-10-19 09:02:14 UTC (rev 5720) +++ software_suite_v3/software/plugin/plugin-twitter/branches/random_sentences/plugin-twitter/src/TwitterPlugin.java 2009-10-19 09:05:21 UTC (rev 5721) @@ -1,539 +1,539 @@ -/* This file is part of "Tux Droid Plugin Twitter". - * Copyright 2008, kysoh - * Author : Jerome Conan - * Site : http://www.kysoh.com/ - * - * "Tux Droid Plugin 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 Plugin 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 Plugin 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.ArrayList; -import java.util.Collections; -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 static TwitterDatasStruct savedStruct; - private static byte REPLY = 0; - private static byte MESSAGE = 1; - - private List<String> messagesList = new ArrayList<String>(); - private List<String> repliesList = new ArrayList<String>(); - - private boolean throwed = false; - - /*** - This function set the new user status. - Préconditions : - - To be in run mode - - Activate targeted option. - ***/ - private boolean setUserStatus(Twitter twitter) - { - if(this.getCommand().equalsIgnoreCase("run")) - { - //Set user status - if(this.configuration().getUpdateStatus()) - { - try - { - twitter.updateStatus(this.configuration().getMyStatus()); - - if ( twitter.getStatus().getText().equalsIgnoreCase(this.configuration().getMyStatus()) ) - { - return true; - } - else - { - return false; - } - } - catch(TwitterException notConnected) - { - if (!this.getCommand().equalsIgnoreCase("check")) - { - throwMessage("You do not seem to be connected. Please, verify you username and password, then try again."); - } - this.quitGadget(); - } - } - } - - return false; - } - - - /*** - * Get all new friend statuses. - * Automatic option. - ***/ - private int getNewFriendStatusesCount(Twitter twitter) - { - int statusesCount = 0; - List<User> friend = twitter.getFriends(); - - for( int i = 0 ; i < friend.size() ; i++ ) - { - try - { - Status status = friend.get(i).getStatus(); - - String statusText = status.getText(); - String username = status.getUser().getName(); - - - //if a new status was set for this user text. - boolean said = savedStruct.isRegistered(TwitterDatasStruct.FRIENDS_STATUSES, username, statusText); - - if((statusText != "null") && !said) - { - String stat = statusText.replace("&", ""); - stat = this.urlFilter(stat); - - if (! isReplyToOtherUser(stat)) - { - statusesCount += 1; - //Saving last entry. - savedStruct.addFriendStatus(username, statusText); - } - } - } - catch(NullPointerException statusNotExists) - { - //Simply pass in case of exception, friend status change will not be counted. - ; - } - - } - - return statusesCount; - } - - - - /*** - * This function return how many messages user has into his private Twitter mailbox. - * @return an integer that represent user privates messages count. - ***/ - private int getPrivateMessagesCount(Twitter twitter) - { - List<Message> messages = twitter.getDirectMessages(); - if(messages.size() > 0) - { - try - { - //then give messages. - for(Message message : messages) - { - String username = message.getSender().getName(); - - boolean said = savedStruct.isRegistered(TwitterDatasStruct.MESSAGES, username, message.getText()); - - if((message.getText() != "null") && !said) - { - messagesList.add(username); - savedStruct.addMessage(username, message.getText()); - } - } - } - catch(NullPointerException pointerError) - { - ; - } - } - - return messagesList.size(); - } - - - - /*** - * This function return how many messages user has into his public Twitter mailbox. - * @return an integer that represent user public messages count. - ***/ - private int getPublicMessagesCount(Twitter twitter) - { - List<Message> replies = twitter.getReplies(); - - if(replies.size() > 0) - { - try - { - for(Message reply : replies) - { - String username = reply.getSender().getName(); - - boolean said = savedStruct.isRegistered(TwitterDatasStruct.REPLIES, username, reply.getText()); - - if((reply.getText() != "null") && !said) - { - repliesList.add(username); - savedStruct.addReply(username, reply.getText()); - } - - } - } - catch(NullPointerException pointerError) - { - ; - } - } - return repliesList.size(); - } - - - private void throwRes() - { - if ( ( !throwed ) && ( this.getCommand().equalsIgnoreCase("check") )) - { - this.throwed = true; - this.throwResult(true); - this.throwMessage("Twitter"); - } - } - - - @Override - protected void start() throws Throwable - { - - if(( this.configuration().getPassword() == null) || (this.configuration().getUsername() == null)) - { - if( ! this.getCommand().equalsIgnoreCase("check")) - { - this.throwMessage("Sorry, there was an error when connecting to Twitter. Please check your Twitter configuration."); - } - this.quitGadget(); - } - - //Creating / getting sav context. - savedStruct = new TwitterDatasStruct(this.configuration().getUsername()); - - boolean secondCycle = ( this.getCommand().equalsIgnoreCase("check") && savedStruct.isFirstCycle() ) ? false : true; - - /*** - * Getting connected to twitter and setting update source ( here TuxDroid ). - ***/ - Twitter twitter = null; - twitter = new Twitter(this.configuration().getUsername(), this.configuration().getPassword()); - twitter.setSource("tuxdroid"); - - //Getting Twitter informations. - try - { - if (! this.configuration().getUpdateStatus()) - { - /** - * Getting new friend statuses count if option is enabled. - */ - if(this.configuration().getCheckFriends()) - { - int updateCount = getNewFriendStatusesCount(twitter); - - //First check insilent mode. - if(this.getCommand().equalsIgnoreCase("run") || secondCycle) - { - - if ( updateCount == 1 ) - { - throwRes(); - throwMessage("There is a new Tweet available."); - } - else if ( updateCount > 1 ) - { - throwRes(); - throwMessage("You have {0} new Tweets.", String.valueOf(updateCount)); - } - else - { - if ( ! this.getCommand().equalsIgnoreCase("check") ) - { - throwMessage("You don't have any new Tweets."); - } - } - } - } - - - /** - * Getting, sorting new user private / public ( replies ) messages. - * if option is enabled. - */ - if (this.configuration().getCheckMessages()) - { - if ( getPrivateMessagesCount(twitter) > 0 ) - { - //First check insilent mode. - if(this.getCommand().equalsIgnoreCase("run") || secondCycle) - { - this.sort(this.messagesList); - //Counting by name and throwing messages. - this.getByNames(this.messagesList, MESSAGE); - } - } - else - { - if ( ! this.getCommand().equalsIgnoreCase("check") ) - { - throwMessage("You don't have any messages"); - } - } - - //Getting and sorting new user replies. - if ( getPublicMessagesCount(twitter) > 0 ) - { - //First check insilent mode. - if(this.getCommand().equalsIgnoreCase("run") || secondCycle) - { - this.sort(this.repliesList); - //Counting by name and throwing messages. - this.getByNames(this.repliesList, REPLY); - } - } - else - { - if ( ! this.getCommand().equalsIgnoreCase("check") ) - { - throwMessage("You don't have any replies"); - } - } - - //Registering couted messages. - savedStruct.registerStruct(); - - } - } - else - { - //Updating user status. - if( ! this.setUserStatus(twitter) ) - { - this.throwMessage("Your new Tweet was not set, please, try again later"); - } - else - { - this.throwMessage("Your Tweet was added"); - } - } - } - catch(TwitterException badRequest) - { - if ( ! this.getCommand().equalsIgnoreCase("check") ) - { - throwMessage("Twitter is busy for now, please, try again later."); - } - - this.quitGadget(); - } - - } - - - /*** - * Sort a typ string list. - * @param list - */ - private void sort(List<String> list) - { - Collections.sort(list); - } - - - /*** - * Throw messages by user names. - * @param list - */ - private void getByNames(List<String> list, byte type) - { - Vector<String> dtUsers = new Vector<String>(); - Vector<Integer> dtCount = new Vector<Integer>(); - int count = 1; - - //Handling no replies / no messages. - if (list.size() == 0) - { - return; - } - - //Counting by names. - for( int i = 0 ; i != list.size() ; i ++) - { - - if (dtUsers.contains(list.get(i))) - { - dtCount.set(dtUsers.indexOf(list.get(i)), dtCount.get(dtUsers.indexOf(list.get(i))) + 1); - } - else - { - dtUsers.add(list.get(i)); - dtCount.add(1); - } - - } - - if (dtUsers.size() > 0) - { - throwRes(); - } - - for(String it : dtUsers) - { - count = dtCount.get(dtUsers.indexOf(it)); - - if ( type == REPLY ) - { - if ( count == 1 ) - { - throwMessage("One reply from {0}", it); - } - else - { - throwMessage ("{0} replies from {1}", count, it); - } - } - else - { - if ( count == 1 ) - { - throwMessage("One message from {0}", it); - } - else - { - throwMessage("{0} messages from {1}", count, it); - } - } - } - } - - - /** - * Return true if the text value indicates that the message was sent from a user - * to an other user , but not the TuxDroid owner. - * @param value - * @return - */ - private boolean isReplyToOtherUser(String value) - { - if(value.charAt(0) == '@') - { - return true; - } - return false; - } - - - /*** - * Remove Url's from text. - * @param string - * @ret... [truncated message content] |