[tuxdroid-svn] r4986 - software_suite_v3/software/plugin/plugin-twitter/trunk/plugin-twitter/src
Status: Beta
Brought to you by:
ks156
|
From: jerome <c2m...@c2...> - 2009-07-01 14:29:23
|
Author: jerome
Date: 2009-07-01 16:29:09 +0200 (Wed, 01 Jul 2009)
New Revision: 4986
Modified:
software_suite_v3/software/plugin/plugin-twitter/trunk/plugin-twitter/src/TwitterPlugin.java
Log:
* Added 'check' method in the source.
Modified: 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 2009-07-01 14:17:22 UTC (rev 4985)
+++ software_suite_v3/software/plugin/plugin-twitter/trunk/plugin-twitter/src/TwitterPlugin.java 2009-07-01 14:29:09 UTC (rev 4986)
@@ -35,6 +35,9 @@
private TwitterDatasStruct savedStruct;
+ private boolean isCheck = false;
+ private boolean throwed = false;
+
private String[] smileys = new String[]{":)", ":-)", ":(", ":-(", ":|", ":-|",
":$", ":-$", ";)", ";-)", ";(", ";-(",
"o/", "\\o", "\\o/", ":o", ":-o", ":@",
@@ -44,6 +47,11 @@
@Override
protected void start() throws Throwable
{
+ if(this.getCommand().equalsIgnoreCase("check"))
+ {
+ this.isCheck = true;
+ }
+
savedStruct = new TwitterDatasStruct(this.configuration().getUsername());
// Getting connected to twitter.
Twitter twitter = null;
@@ -52,18 +60,21 @@
twitter.setSource("tuxdroid");
- //Set user status
- if(this.configuration().getUpdateStatus())
+ if(!this.isCheck)
{
- try
+ //Set user status
+ if(this.configuration().getUpdateStatus())
{
- twitter.updateStatus(this.configuration().getMyStatus());
+ 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();
+ }
}
- 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>();
@@ -111,6 +122,11 @@
else
{
+ if(this.isCheck && (!throwed))
+ {
+ this.throwResult(true);
+ this.throwed = true;
+ }
throwMessage(username + ", " + stat);
max += 1;
}
@@ -143,6 +159,13 @@
{
String reply = state.getText().substring(state.getText().indexOf(" ") + 1 );
reply = this.urlFilter(reply);
+
+ if(this.isCheck && (!throwed))
+ {
+ this.throwResult(true);
+ this.throwed = true;
+ }
+
throwMessage("Reply from {0} to {0}, the reply is : {2}", sender, to, reply);
}
@@ -153,12 +176,18 @@
if(noStatuses)
{
- throwMessage("No new tweets available.");
+ if(!this.isCheck)
+ {
+ throwMessage("No new tweets available.");
+ }
}
}
catch(TwitterException badRequest)
{
- throwMessage("Twitter is busy for now, please, try later.");
+ if(!this.isCheck)
+ {
+ throwMessage("Twitter is busy for now, please, try later.");
+ }
this.quitGadget();
}
@@ -206,6 +235,12 @@
repl = this.urlFilter(repl);
+ if(this.isCheck && (!throwed))
+ {
+ this.throwResult(true);
+ this.throwed = true;
+ }
+
throwMessage("reply from {0}, the reply is: {1}", username, repl);
this.savedStruct.addReply(username, reply.getText());
}
@@ -216,7 +251,10 @@
if(noReplies)
{
- throwMessage("you don't have replies");
+ if(!this.isCheck)
+ {
+ throwMessage("you don't have replies");
+ }
}
if(messages.size() > 0)
@@ -247,6 +285,12 @@
mess = this.urlFilter(mess);
+ if(this.isCheck && (!throwed))
+ {
+ this.throwResult(true);
+ this.throwed = true;
+ }
+
throwMessage("message from {0}, the message is: {1}", username, mess);
this.savedStruct.addMessage(username, message.getText());
}
@@ -257,12 +301,18 @@
if(noMessage)
{
- throwMessage("you don't have private messages");
+ if(!this.isCheck)
+ {
+ throwMessage("you don't have private messages");
+ }
}
}
catch(TwitterException badRequest)
{
- throwMessage("Twitter is busy for now, please, try later.");
+ if(!this.isCheck)
+ {
+ throwMessage("Twitter is busy for now, please, try later.");
+ }
this.quitGadget();
}
}
@@ -349,6 +399,10 @@
*/
public void quitGadget()
{
+ if(this.isCheck && this.throwed)
+ {
+ this.throwResult(false);
+ }
System.exit(0);
}
|