Author: jerome
Date: 2009-10-09 13:59:28 +0200 (Fri, 09 Oct 2009)
New Revision: 5625

Modified:
   
software_suite_v3/software/plugin/plugin-twitter/branches/october_release/plugin-twitter/src/TwitterPlugin.java
Log:
* Added update Tweet option.
* Improved Tweets add by a tts sentense for result.

Modified: 
software_suite_v3/software/plugin/plugin-twitter/branches/october_release/plugin-twitter/src/TwitterPlugin.java
===================================================================
--- 
software_suite_v3/software/plugin/plugin-twitter/branches/october_release/plugin-twitter/src/TwitterPlugin.java
     2009-10-09 11:34:42 UTC (rev 5624)
+++ 
software_suite_v3/software/plugin/plugin-twitter/branches/october_release/plugin-twitter/src/TwitterPlugin.java
     2009-10-09 11:59:28 UTC (rev 5625)
@@ -61,7 +61,15 @@
                                try
                                {
                                        
twitter.updateStatus(this.configuration().getMyStatus());
-                                       return true;
+                                       
+                                       if ( 
twitter.getStatus().getText().equalsIgnoreCase(this.configuration().getMyStatus())
 )
+                                       {
+                                               return true;
+                                       }
+                                       else
+                                       {
+                                         return true;
+                                       }
                                }
                                catch(TwitterException notConnected)
                                {
@@ -226,66 +234,85 @@
                {
                        if (! this.configuration().getUpdateStatus())
                        {
-                               //Getting new friend statuses count.
-                               int updateCount = 
getNewFriendStatusesCount(twitter);
-       
-                               if ( updateCount == 1 )
+                               /**
+                                * Getting new friend statuses count if option 
is enabled.
+                                */
+                               if(this.configuration().getCheckFriends())
                                {
-                                       throwRes();
-                                       throwMessage("You have a new friend 
update");
-                               }
-                               else if ( updateCount > 1 )
-                               {
-                                       throwRes();
-                                       throwMessage("You have {0} friend 
updates", String.valueOf(updateCount));
-                               }
-                               else
-                               {
-                                       if ( ! 
this.getCommand().equalsIgnoreCase("check") )
+                                       int updateCount = 
getNewFriendStatusesCount(twitter);
+               
+                                       if ( updateCount == 1 )
                                        {
-                                           throwMessage("You don't have any 
friend updates.");
+                                               throwRes();
+                                               throwMessage("You have a new 
friend update");
                                        }
+                                       else if ( updateCount > 1 )
+                                       {
+                                               throwRes();
+                                               throwMessage("You have {0} 
friend updates", String.valueOf(updateCount));
+                                       }
+                                       else
+                                       {
+                                               if ( ! 
this.getCommand().equalsIgnoreCase("check") )
+                                               {
+                                                   throwMessage("You don't 
have any friend updates.");
+                                               }
+                                       }
                                }
                                
-                //Getting and sorting new user private messages.
-                           if ( getPrivateMessagesCount(twitter) > 0 )
-                           {
-                               
-                               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 )
-                           {
-                               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();
-                               
+                
+                               /**
+                                *  Getting, sorting new user private / public 
( replies ) messages.
+                                *  if option is enabled. 
+                                */
+                               if (this.configuration().getCheckMessages())
+                               {
+                                   if ( getPrivateMessagesCount(twitter) > 0 )
+                                   {
+                                       
+                                       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 )
+                                   {
+                                       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.
-                               this.setUserStatus(twitter);
+                               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)


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Tux-droid-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tux-droid-svn

Reply via email to