Author: jerome
Date: 2009-10-16 11:31:59 +0200 (Fri, 16 Oct 2009)
New Revision: 5711

Added:
   
software_suite_v3/software/plugin/plugin-facebook/branches/october_release/src/com/
   
software_suite_v3/software/plugin/plugin-facebook/branches/october_release/src/com/kysoh/
   
software_suite_v3/software/plugin/plugin-facebook/branches/october_release/src/com/kysoh/plugins/
   
software_suite_v3/software/plugin/plugin-facebook/branches/october_release/src/com/kysoh/plugins/facebook/
   
software_suite_v3/software/plugin/plugin-facebook/branches/october_release/src/com/kysoh/plugins/facebook/FacebookConnection.java
   
software_suite_v3/software/plugin/plugin-facebook/branches/october_release/src/com/kysoh/plugins/facebook/FacebookFunctions.java
   
software_suite_v3/software/plugin/plugin-facebook/branches/october_release/src/com/kysoh/plugins/facebook/FacebookPlugin.java
   
software_suite_v3/software/plugin/plugin-facebook/branches/october_release/src/com/kysoh/plugins/facebook/configuration/
   
software_suite_v3/software/plugin/plugin-facebook/branches/october_release/src/com/kysoh/plugins/facebook/configuration/PluginFacebookConfiguration.java
   
software_suite_v3/software/plugin/plugin-facebook/branches/october_release/src/com/kysoh/plugins/facebook/connection/
Removed:
   
software_suite_v3/software/plugin/plugin-facebook/branches/october_release/src/FacebookConnection.java
   
software_suite_v3/software/plugin/plugin-facebook/branches/october_release/src/FacebookFunctions.java
   
software_suite_v3/software/plugin/plugin-facebook/branches/october_release/src/FacebookPlugin.java
Modified:
   
software_suite_v3/software/plugin/plugin-facebook/branches/october_release/resources/plugin.xml
Log:
* Refactored project.

Modified: 
software_suite_v3/software/plugin/plugin-facebook/branches/october_release/resources/plugin.xml
===================================================================
--- 
software_suite_v3/software/plugin/plugin-facebook/branches/october_release/resources/plugin.xml
     2009-10-16 09:22:44 UTC (rev 5710)
+++ 
software_suite_v3/software/plugin/plugin-facebook/branches/october_release/resources/plugin.xml
     2009-10-16 09:31:59 UTC (rev 5711)
@@ -2,7 +2,7 @@
 <plugin>
        <interpreter
                kind="java">
-               <executable> FacebookPlugin</executable>
+               <executable> 
com.kysoh.plugins.facebook.FacebookPlugin</executable>
        </interpreter>
        <description>
                <name>Facebook Plugin</name>

Deleted: 
software_suite_v3/software/plugin/plugin-facebook/branches/october_release/src/FacebookConnection.java
===================================================================
--- 
software_suite_v3/software/plugin/plugin-facebook/branches/october_release/src/FacebookConnection.java
      2009-10-16 09:22:44 UTC (rev 5710)
+++ 
software_suite_v3/software/plugin/plugin-facebook/branches/october_release/src/FacebookConnection.java
      2009-10-16 09:31:59 UTC (rev 5711)
@@ -1,67 +0,0 @@
-/* This file is part of "TuxDroid plugin Facebook".
- *    Copyright 2009, kysoh
- *    Author : Conan Jerome.
- *    eMail  : [email protected]
- *    Site   : http://www.kysoh.com/
- *
- * "TuxDroid plugin Facebook" is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * "TuxDroid plugin Facebook" is distributed in the hope that it will be 
useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with "TuxDroid plugin Facebook"; 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.google.code.facebookapi.FacebookJsonRestClient;
-
-public class FacebookConnection {
-
-       public static String api_key = "a9eb7b7e52df160fb1dfc437b0b487c8";
-       public static String f_key = "0314c8569f89d0411e5a4823372ae27a";
-       private FacebookJsonRestClient client;
-       
-       
-       /**
-        * Class constructor.
-        */
-       public FacebookConnection()
-       {
-               //TODO facebook connection.
-       }
-       
-       
-       public boolean Connect(String username, String password)
-       {
-               return true;
-       }
-       
-       
-       /**
-        * This function return the facebook user id.
-        * @return
-        */
-       public Long getFacebookUserId()
-       {
-               //TODO
-               return null;
-       }
-       
-       
-       /**
-        * Return the JSon Facebook client object.
-        * @return
-        */
-       public FacebookJsonRestClient getClient()
-       {
-               //TODO
-               return null;
-       }
-}

Deleted: 
software_suite_v3/software/plugin/plugin-facebook/branches/october_release/src/FacebookFunctions.java
===================================================================
--- 
software_suite_v3/software/plugin/plugin-facebook/branches/october_release/src/FacebookFunctions.java
       2009-10-16 09:22:44 UTC (rev 5710)
+++ 
software_suite_v3/software/plugin/plugin-facebook/branches/october_release/src/FacebookFunctions.java
       2009-10-16 09:31:59 UTC (rev 5711)
@@ -1,517 +0,0 @@
-/* This file is part of "TuxDroid plugin Facebook".
- *    Copyright 2009, kysoh
- *    Author : Conan Jerome.
- *    eMail  : [email protected]
- *    Site   : http://www.kysoh.com/
- *
- * "TuxDroid plugin Facebook" is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * "TuxDroid plugin Facebook" is distributed in the hope that it will be 
useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with "TuxDroid plugin Facebook"; 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.EnumSet;
-import java.util.Hashtable;
-import java.util.List;
-import java.util.Vector;
-
-import com.google.code.facebookapi.FacebookException;
-import com.google.code.facebookapi.ProfileField;
-import com.google.code.facebookapi.schema.FriendsGetResponse;
-import com.google.code.facebookapi.schema.User;
-import com.google.code.facebookapi.schema.UsersGetInfoResponse;
-
-
-public class FacebookFunctions {
-
-       private FacebookConnection connection;
-       private Hashtable<String, Vector<String>> notifications = new 
Hashtable<String, Vector<String>>();
-       
-       /**
-        * Class constructor.
-        * @param connection
-        */
-       public FacebookFunctions(FacebookConnection connection)
-       {
-               this.connection = connection;
-               this.notifications = this.getUserNotification();
-       }
-       
-       
-       /**
-        * Return the user friend list as Vector<String>.
-        * @return
-        */
-       public Vector<String> getFriends()
-       {
-               Vector<String> friendsList = new Vector<String>();
-               
-               try 
-               {
-                       // Get friends list
-                       connection.getClient().friends_get();
-                       FriendsGetResponse response = (FriendsGetResponse) 
connection.getClient().getResponsePOJO();
-                       List<Long> friends = response.getUid();
-
-                       // Go fetch the information for the user list of user 
ids
-                       connection.getClient().users_getInfo(friends, 
EnumSet.of(ProfileField.NAME));
-
-                       UsersGetInfoResponse userResponse = 
(UsersGetInfoResponse) connection.getClient().getResponsePOJO();
-
-                       // Print out the user information
-                       List<User> users = userResponse.getUser();
-                       for (User user : users) 
-                       {
-                               friendsList.add(user.getName());
-                       }
-               } 
-               catch (FacebookException e) 
-               {
-                       return null;
-               } 
-               
-               return friendsList;
-       }
-       
-       
-       /**
-        * Gets all notifications.
-        */
-       private Hashtable<String, Vector<String>> getUserNotification() 
-       {
-               //Will contain all availables notifications.
-               //availables notifications : messages, pokes, shares, 
friends_requests, group_invites, event_invites
-               Hashtable<String, Vector<String>> notifications = new 
Hashtable<String, Vector<String>>();
-               
-               try
-               {
-                       connection.getClient().notifications_get();
-                       String notifs = connection.getClient().getRawResponse();
-                       
-                       /**
-                        * Getting messages notifications.
-                        */
-                       if(notifs.contains("<messages"))
-                       {
-                               String messagesString = notifs.substring(
-                                                               
notifs.indexOf("<messages"), 
-                                                               
notifs.indexOf("</messages>"));
-                               
-                               Vector<String> msDatas = new Vector<String>();
-                               
-                               String unreaded = messagesString.substring(
-                                                         
messagesString.indexOf("<unread>") + "<unread>".length(), 
-                                                         
messagesString.indexOf("</unread>"));
-                               
-                               msDatas.add(unreaded);
-                               
-                               
-                               if(Integer.valueOf(unreaded).intValue() > 0)
-                               {
-                                       notifications.put("messages", msDatas);
-                               }
-                       }
-                       
-                       /**
-                        * Getting pokes notifications.
-                        */
-                       if(notifs.contains("<pokes"))
-                       {
-                               String pokesString;
-                               
-                               try
-                               {
-                                       pokesString = 
notifs.substring(notifs.indexOf("<pokes"), notifs.indexOf("</pokes>"));
-                               }
-                               catch(IndexOutOfBoundsException indexError)
-                               {
-                                       pokesString = 
notifs.substring(notifs.indexOf("<pokes"), notifs.indexOf("/>"));
-                               }
-                               
-                               Vector<String> pkDatas = new Vector<String>();
-                               
-                               String unreaded = pokesString.substring(
-                                                         
pokesString.indexOf("<unread>") + "<unread>".length(), 
-                                                         
pokesString.indexOf("</unread>"));
-                               
-                               pkDatas.add(unreaded);
-                               
-                               if(Integer.valueOf(unreaded).intValue() > 0 )
-                               {
-                                       notifications.put("pokes", pkDatas);
-                               }
-                       }
-                       
-                       /**
-                        * Getting shares notifications.
-                        */
-                       if(notifs.contains("<shares"))
-                       {
-                               String sharesString;
-                               
-                               try
-                               {
-                                       sharesString = 
notifs.substring(notifs.indexOf("<shares"), notifs.indexOf("</shares>"));
-                               }
-                               catch(IndexOutOfBoundsException indexError)
-                               {
-                                       sharesString = 
notifs.substring(notifs.indexOf("<shares"), notifs.indexOf("/>"));
-                               }
-                               
-                               Vector<String> shDatas = new Vector<String>();
-                               
-                               String unreaded = sharesString.substring(
-                                                         
sharesString.indexOf("<unread>") + "<unread>".length(), 
-                                                         
sharesString.indexOf("</unread>"));
-                               
-                               shDatas.add(unreaded);
-                               
-                               if(Integer.valueOf(unreaded).intValue() > 0)
-                               {
-                                       notifications.put("shares", shDatas);
-                               }
-                       }
-                       
-                       /**
-                        * Get the friend_requests notifications.
-                        */
-                       if(notifs.contains("<friend_requests"))
-                       {
-                               
-                               String friendsString = "";
-                               try
-                               {
-                                       friendsString = 
notifs.substring(notifs.indexOf("<friend_requests"), 
notifs.indexOf("</friend_requests>"));
-                               }
-                               catch(StringIndexOutOfBoundsException no)
-                               {
-                                       friendsString = 
notifs.substring(notifs.indexOf("<friend_requests"), notifs.indexOf("/>", 
notifs.indexOf("<friend_requests")));
-                               }
-                               
-                               Vector<String> friendsDatas = new 
Vector<String>();
-                               Vector<Long> friendsDatasAsLong = new 
Vector<Long>();
-                               
-                               //Getting friends uid that ask for friends.
-                               if(friendsString.contains("<uid>"))
-                               {
-                                       while(friendsString.contains("<uid>"))
-                                       {
-                                               String friend = 
friendsString.substring(
-                                                                       
friendsString.indexOf("<uid>") + "<uid>".length(), 
-                                                                       
friendsString.indexOf("</uid>"));
-                                               
-                                               friendsString = 
friendsString.replace("<uid>" + friend + "</uid>", "");
-                                               
-                                               
friendsDatasAsLong.add(Long.valueOf(friend).longValue());
-                                       }
-                               
-                               
-                                       // Go fetch the information for the 
user list of user ids
-                                       
connection.getClient().users_getInfo(friendsDatasAsLong, 
EnumSet.of(ProfileField.NAME));
-       
-                                       UsersGetInfoResponse userResponse = 
(UsersGetInfoResponse) connection.getClient().getResponsePOJO();
-       
-                                       // Print out the user information
-                                       List<User> users = 
userResponse.getUser();
-                                       for (User user : users) 
-                                       {
-                                               
friendsDatas.add(user.getName());
-                                       }
-                                       
-                                       notifications.put("friend_requests", 
friendsDatas);
-                               }
-                       }
-                       
-                       /**
-                        * Getting new groups invitations.
-                        */
-                       if(notifs.contains("<group_invites"))
-                       {
-                               String groupString;
-                               
-                               try
-                               {
-                                       groupString = 
notifs.substring(notifs.indexOf("<group_invites"), 
notifs.indexOf("</group_invites>"));
-                               }
-                               catch(IndexOutOfBoundsException indexError)
-                               {
-                                       groupString = 
notifs.substring(notifs.indexOf("<group_invites"), notifs.indexOf("/>", 
notifs.indexOf("<group_invites")));
-                               }
-                               
-                               Vector<Long> groupsDatasAsLong = new 
Vector<Long>();
-                               Vector<String> groupsDatas = new 
Vector<String>();
-                               
-                               //Getting friends uid that ask for friends.
-                               if(groupString.contains("<gid>"))
-                               {
-                                       while(groupString.contains("<gid>"))
-                                       {
-                                               String friend = 
groupString.substring(
-                                                                       
groupString.indexOf("<gid>") + "<gid>".length(), 
-                                                                       
groupString.indexOf("</gid>"));
-                                               
-                                               groupString = 
groupString.replace("<gid>" + friend + "</gid>", "");
-                                               
-                                               
groupsDatasAsLong.add(Long.valueOf(friend).longValue());
-                                       }
-                                       
-                                       
groupsDatas.add(String.valueOf(groupsDatasAsLong.size()));
-                                       
-                                       for(Long gid : groupsDatasAsLong)
-                                       {
-                                               try
-                                               {
-                                                       Thread.sleep(200);
-                                                       
connection.getClient().fql_query("Select name from group WHERE gid=" + 
gid.longValue());
-                                                       String response = 
connection.getClient().getRawResponse();
-                                                       
if(response.contains("<group>") && response.contains("<name>"))
-                                                       {
-                                                               String 
groupName = response.substring(
-                                                                               
           response.indexOf("<name>") + "<name>".length(),
-                                                                               
           response.indexOf("</name>", response.indexOf("<name>")));
-                                                               
groupsDatas.add(groupName);
-                                                       }
-                                               }
-                                               catch(Exception fqlError)
-                                               {
-                                                       
groupsDatas.add("Unknown group");
-                                               }
-                                       }
-                                       
-                                       //Only if they have some group invites.
-                                       if(groupsDatasAsLong.size() > 0)
-                                       {
-                                               
notifications.put("group_invites", groupsDatas);
-                                       }
-                               }
-                       }
-                       
-                       /**
-                        * Getting new events invitations.
-                        */
-                       if(notifs.contains("<event_invites"))
-                       {
-                               String eventString = "";
-                               try
-                               {
-                                       eventString = 
notifs.substring(notifs.indexOf("<event_invites"), notifs.indexOf("/>", 
notifs.indexOf("<event_invites")));
-                               }
-                               catch(IndexOutOfBoundsException indexError)
-                               {
-                                       eventString = 
notifs.substring(notifs.indexOf("<event_invites"), 
notifs.indexOf("</event_invites>"));
-                               }
-                               
-                               Vector<Long> eventsDatasAsLong = new 
Vector<Long>();
-                               Vector<String> eventsDatas = new 
Vector<String>();
-                               
-                               //Getting friends uid that ask for friends.
-                               if(eventString.contains("<eid>") || 
(eventString.contains("<event_invites_elt>")))
-                               {
-                                       while(eventString.contains("<eid>"))
-                                       {
-                                               String event = 
eventString.substring(
-                                                                       
eventString.indexOf("<eid>") + "<eid>".length(), 
-                                                                       
eventString.indexOf("</eid>"));
-                                               
-                                               eventString = 
eventString.replace("<eid>" + event + "</eid>", "");
-                                               
-                                               
eventsDatasAsLong.add(Long.valueOf(event).longValue());
-                                       }
-                                       
-                                       
-                                       
while(eventString.contains("<event_invites_elt>"))
-                                       {       
-                                               String event = 
eventString.substring(
-                                                       
eventString.indexOf("<event_invites_elt>") + "<event_invites_elt>".length(), 
-                                                       
eventString.indexOf("</event_invites_elt>"));
-                               
-                                       eventString = 
eventString.replace("<event_invites_elt>" + event + "</event_invites_elt>", "");
-                                       
eventsDatasAsLong.add(Long.valueOf(event).longValue());
-                                       }
-                                       
-                                       //Adding the number of event invites.
-                                       
eventsDatas.add(String.valueOf(eventsDatasAsLong.size()));
-                                       
-                                       for(Long eid : eventsDatasAsLong)
-                                       {
-                                               try
-                                               {
-                                                       Thread.sleep(200);
-                                                       
connection.getClient().fql_query("Select name from event WHERE eid=" + 
eid.longValue());
-                                                       String response = 
connection.getClient().getRawResponse();
-                                                       
if(response.contains("<event>") && response.contains("<name>"))
-                                                       {
-                                                               String 
groupName = response.substring(
-                                                                               
           response.indexOf("<name>") + "<name>".length(),
-                                                                               
           response.indexOf("</name>", response.indexOf("<name>")));
-                                                               
eventsDatas.add(groupName);
-                                                       }
-                                               }
-                                               catch(Exception fqlError)
-                                               {
-                                                       
eventsDatas.add("Unknown event");
-                                               }
-                                       
-                                       }
-                                       
-                                       if(eventsDatasAsLong.size() > 0)
-                                       {
-                                               
notifications.put("event_invites", eventsDatas);
-                                       }
-                               }
-                       }
-               }
-               catch (FacebookException e) 
-               {
-                       ;
-               } 
-               
-               return notifications;
-       }
-       
-       
-       /**
-        * Return email notifications.
-        */
-       public Integer getEmailNotifications()
-       {
-               if(this.notifications.containsKey("messages"))
-               {
-                       return 
Integer.valueOf(this.notifications.get("messages").get(0));
-               }
-               else
-               {
-                       return 0;
-               }
-       }
-       
-       
-       /**
-        * Return how many pokes user has.
-        * @return
-        */
-       public Integer getPokesCount()
-       {
-               if(this.notifications.containsKey("pokes"))
-               {
-                       return 
Integer.valueOf(this.notifications.get("pokes").get(0));
-               }
-               else
-               {
-                       return 0;
-               }
-       }
-       
-       
-       /**
-        * Return the number of friend requests.
-        * @return
-        */
-       public Integer getFriendRequestsCount()
-       {
-               if(this.notifications.containsKey("friend_requests"))
-               {
-                       return 
Integer.valueOf(this.notifications.get("friend_requests").size());
-               }
-               else
-               {
-                       return 0;
-               }
-       }
-       
-       
-       /**
-        * Return the name of people that ask to be a friend of user.
-        * @return
-        */
-       public Vector<String> getFriendRequestNames()
-       {
-               Vector<String> friends = new Vector<String>();
-               
-               if(this.notifications.containsKey("friend_requests"))
-               {
-                       Vector<String> dat = 
this.notifications.get("friend_requests");
-                       friends = dat;
-               }
-               return friends;
-       }
-       
-       
-       /**
-        * Return the number of availables groups invites.
-        * @return
-        */
-       public Integer getGroupsInvitesCount()
-       {
-               if(this.notifications.containsKey("group_invites"))
-               {
-                       return 
Integer.valueOf(this.notifications.get("group_invites").get(0));
-               }
-               else
-               {
-                       return 0;
-               }
-       }
-       
-       
-       /**
-        * Return the name of groups invites.
-        * @return
-        */
-       public Vector<String> getGroupInvitesNames()
-       {
-               Vector<String> groups = new Vector<String>();
-               
-               if(this.notifications.containsKey("group_invites"))
-               {
-                       Vector<String> dat = 
this.notifications.get("group_invites");
-                       dat.remove(0);
-                       groups = dat;
-               }
-               return groups;
-       }
-       
-       /**
-        * Return the number of events invites.
-        * @return
-        */
-       public Integer getEventsInvitesCount()
-       {
-               if(this.notifications.containsKey("event_invites"))
-               {
-                       return 
Integer.valueOf(this.notifications.get("event_invites").get(0));
-               }
-               else
-               {
-                       return 0;
-               }
-       }
-       
-       /**
-        * Return the name of events invites.
-        * @return
-        */
-       public Vector<String> getEventInvitesNames()
-       {
-               Vector<String> events = new Vector<String>();
-               
-               if(this.notifications.containsKey("event_invites"))
-               {
-                       Vector<String> dat = 
this.notifications.get("event_invites");
-                       dat.remove(0);
-                       events = dat;
-               }
-               return events;
-       }
-}

Deleted: 
software_suite_v3/software/plugin/plugin-facebook/branches/october_release/src/FacebookPlugin.java
===================================================================
--- 
software_suite_v3/software/plugin/plugin-facebook/branches/october_release/src/FacebookPlugin.java
  2009-10-16 09:22:44 UTC (rev 5710)
+++ 
software_suite_v3/software/plugin/plugin-facebook/branches/october_release/src/FacebookPlugin.java
  2009-10-16 09:31:59 UTC (rev 5711)
@@ -1,231 +0,0 @@
-/* This file is part of "TuxDroid plugin Facebook".
- *    Copyright 2009, kysoh
- *    Author : Conan Jerome.
- *    eMail  : [email protected]
- *    Site   : http://www.kysoh.com/
- *
- * "TuxDroid plugin Facebook" is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * "TuxDroid plugin Facebook" is distributed in the hope that it will be 
useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with "TuxDroid plugin Facebook"; 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.SimplePlugin;
-import com.kysoh.plugins.facebook.configuration.PluginFacebookConfiguration;
-
-
-public class FacebookPlugin extends SimplePlugin<PluginFacebookConfiguration>{
-       
-       private boolean check = false;
-       
-       /**
-        * Gadget start method.
-        */
-       @Override
-       protected void start() throws Throwable
-       {
-               boolean throwNotif = false;
-        boolean news = false;
-               
-               if(getCommand().equals("check"))
-               {
-                       this.check = true;
-               }
-               FacebookConnection facebook = new FacebookConnection();
-               if ( facebook.Connect(this.configuration().getLogin(), 
this.configuration().getPassword()) )
-               {
-                       FacebookFunctions functions = new 
FacebookFunctions(facebook);
-                       
-                       //Get email informations.
-                       if(this.configuration().getNotifyEmail())
-                       {
-                               if(functions.getEmailNotifications().intValue() 
> 0)
-                               {
-                    news = true;
-                                       if(this.check && (!throwNotif))
-                                       {
-                                               throwNotif = true;
-                                               this.throwResult(true);
-                                       }
-                                       
-                                       
if(functions.getEmailNotifications().intValue() == 1)
-                                       {
-                                               throwMessage("You have one new 
message");
-                                       }
-                                       else
-                                       {
-                                               throwMessage("You have {0} new 
messages", functions.getEmailNotifications().intValue());
-                                       }
-                               }
-                       }
-                       
-                       //Get friend requests notification.
-                       if(this.configuration().getShowFriendRequests())
-                       {
-                               
if(functions.getFriendRequestsCount().intValue() > 0)
-                               {
-                    news = true;
-                                       if(this.check && (!throwNotif))
-                                       {
-                                               throwNotif = true;
-                                               this.throwResult(true);
-                                       }
-                                       
-                                       
if(functions.getFriendRequestsCount().intValue() == 1)
-                                       {
-                                               throwMessage("You have one 
friend request");
-                                       }
-                                       else
-                                       {
-                                               throwMessage("You have {0} 
friend requests", functions.getFriendRequestsCount());
-                                       }
-                                       
-                                       for(String friendName : 
functions.getFriendRequestNames())
-                                       {
-                                               if(this.check && (!throwNotif))
-                                               {
-                                                       throwNotif = true;
-                                                       this.throwResult(true);
-                                               }
-                                               throwMessage("From {0}", 
friendName);
-                                       }
-                               }
-                       }
-                       
-                       //Get group invites notifications.
-                       if(this.configuration().getShowGroupsInvites())
-                       {
-                news = true;
-                               if(functions.getGroupsInvitesCount().intValue() 
> 0)
-                               {
-                                       if(this.check && (!throwNotif))
-                                       {
-                                               throwNotif = true;
-                                               this.throwResult(true);
-                                       }
-                                       
-                                       
if(functions.getGroupsInvitesCount().intValue() == 1)
-                                       {
-                                               throwMessage("You have one 
group invite");
-                                       }
-                                       else
-                                       {
-                                               throwMessage("You have {0} 
group invites", functions.getGroupsInvitesCount().intValue());
-                                       }
-                                       
-                                       for(String group : 
functions.getGroupInvitesNames())
-                                       {
-                                               if(this.check && (!throwNotif))
-                                               {
-                                                       throwNotif = true;
-                                                       this.throwResult(true);
-                                               }
-                                               throwMessage("to {0}", group);
-                                       }
-                               }
-                       }
-                       
-                       //Get pokes notification.
-                       if(this.configuration().getShowEventsInvites())
-                       {
-                               if(functions.getEventsInvitesCount().intValue() 
> 0)
-                               {
-                    news = true;
-                                       if(this.check && (!throwNotif))
-                                       {
-                                               throwNotif = true;
-                                               this.throwResult(true);
-                                       }
-                                       
-                                       
if(functions.getEventsInvitesCount().intValue() == 1)
-                                       {
-                                               throwMessage("You have one 
event invite");
-                                       }
-                                       else
-                                       {
-                                               throwMessage("You have {0} 
event invites", functions.getEventsInvitesCount().intValue());
-                                       }
-                                       
-                                       for(String event : 
functions.getEventInvitesNames())
-                                       {
-                                               if(this.check && (!throwNotif))
-                                               {
-                                                       throwNotif = true;
-                                                       this.throwResult(true);
-                                               }
-                                               throwMessage("to {0}", event);
-                                       }
-                               }
-                       }
-                       
-                       if(this.configuration().getShowPokes())
-                       {
-                               if(functions.getPokesCount().intValue() > 0)
-                               {
-                    news = true;
-                                       if(this.check && (!throwNotif))
-                                       {
-                                               throwNotif = true;
-                                               this.throwResult(true);
-                                       }
-                                       
-                                       if(functions.getPokesCount().intValue() 
== 1)
-                                       {
-                                               throwMessage("You have one 
poke");
-                                       }
-                                       else
-                                       {
-                                               throwMessage("You have {0} 
pokes", functions.getPokesCount().intValue());
-                                       }
-                               }
-                       }
-                       
-                       if((!throwNotif) && this.check )
-                       {
-                               this.throwResult(false);
-                       }
-                       else if((!this.check) && (!news))
-                       {
-                               this.throwMessage("Nothing new on your 
account");
-                       }
-               }
-               else
-               {
-                       this.throwMessage("I cannot get connected to your 
facebook account.");
-               }
-       }
-       
-       
-       /**
-        * Main entry point.
-        * @param args
-        */
-       public static void main(String[] args)
-       {
-               new FacebookPlugin().boot(args, new 
PluginFacebookConfiguration());
-       }
-
-
-       @Override
-       protected void onPluginEvent(String arg0, String[] arg1) throws 
Throwable 
-       {
-               ;
-       }
-
-
-       @Override
-       protected void onPluginStop() throws Throwable
-       {
-               ;
-       }
-}

Added: 
software_suite_v3/software/plugin/plugin-facebook/branches/october_release/src/com/kysoh/plugins/facebook/FacebookConnection.java
===================================================================
--- 
software_suite_v3/software/plugin/plugin-facebook/branches/october_release/src/com/kysoh/plugins/facebook/FacebookConnection.java
                           (rev 0)
+++ 
software_suite_v3/software/plugin/plugin-facebook/branches/october_release/src/com/kysoh/plugins/facebook/FacebookConnection.java
   2009-10-16 09:31:59 UTC (rev 5711)
@@ -0,0 +1,69 @@
+/* This file is part of "TuxDroid plugin Facebook".
+ *    Copyright 2009, kysoh
+ *    Author : Conan Jerome.
+ *    eMail  : [email protected]
+ *    Site   : http://www.kysoh.com/
+ *
+ * "TuxDroid plugin Facebook" is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * "TuxDroid plugin Facebook" is distributed in the hope that it will be 
useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with "TuxDroid plugin Facebook"; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package com.kysoh.plugins.facebook;
+
+import com.google.code.facebookapi.FacebookJsonRestClient;
+
+public class FacebookConnection {
+
+       public static String api_key = "a9eb7b7e52df160fb1dfc437b0b487c8";
+       public static String f_key = "0314c8569f89d0411e5a4823372ae27a";
+       private FacebookJsonRestClient client;
+       
+       
+       /**
+        * Class constructor.
+        */
+       public FacebookConnection()
+       {
+               //TODO facebook connection.
+       }
+       
+       
+       public boolean Connect(String username, String password)
+       {
+               return true;
+       }
+       
+       
+       /**
+        * This function return the facebook user id.
+        * @return
+        */
+       public Long getFacebookUserId()
+       {
+               //TODO
+               return null;
+       }
+       
+       
+       /**
+        * Return the JSon Facebook client object.
+        * @return
+        */
+       public FacebookJsonRestClient getClient()
+       {
+               //TODO
+               return null;
+       }
+}

Added: 
software_suite_v3/software/plugin/plugin-facebook/branches/october_release/src/com/kysoh/plugins/facebook/FacebookFunctions.java
===================================================================
--- 
software_suite_v3/software/plugin/plugin-facebook/branches/october_release/src/com/kysoh/plugins/facebook/FacebookFunctions.java
                            (rev 0)
+++ 
software_suite_v3/software/plugin/plugin-facebook/branches/october_release/src/com/kysoh/plugins/facebook/FacebookFunctions.java
    2009-10-16 09:31:59 UTC (rev 5711)
@@ -0,0 +1,519 @@
+/* This file is part of "TuxDroid plugin Facebook".
+ *    Copyright 2009, kysoh
+ *    Author : Conan Jerome.
+ *    eMail  : [email protected]
+ *    Site   : http://www.kysoh.com/
+ *
+ * "TuxDroid plugin Facebook" is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * "TuxDroid plugin Facebook" is distributed in the hope that it will be 
useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with "TuxDroid plugin Facebook"; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package com.kysoh.plugins.facebook;
+
+
+import java.util.EnumSet;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Vector;
+
+import com.google.code.facebookapi.FacebookException;
+import com.google.code.facebookapi.ProfileField;
+import com.google.code.facebookapi.schema.FriendsGetResponse;
+import com.google.code.facebookapi.schema.User;
+import com.google.code.facebookapi.schema.UsersGetInfoResponse;
+
+
+public class FacebookFunctions {
+
+       private FacebookConnection connection;
+       private Hashtable<String, Vector<String>> notifications = new 
Hashtable<String, Vector<String>>();
+       
+       /**
+        * Class constructor.
+        * @param connection
+        */
+       public FacebookFunctions(FacebookConnection connection)
+       {
+               this.connection = connection;
+               this.notifications = this.getUserNotification();
+       }
+       
+       
+       /**
+        * Return the user friend list as Vector<String>.
+        * @return
+        */
+       public Vector<String> getFriends()
+       {
+               Vector<String> friendsList = new Vector<String>();
+               
+               try 
+               {
+                       // Get friends list
+                       connection.getClient().friends_get();
+                       FriendsGetResponse response = (FriendsGetResponse) 
connection.getClient().getResponsePOJO();
+                       List<Long> friends = response.getUid();
+
+                       // Go fetch the information for the user list of user 
ids
+                       connection.getClient().users_getInfo(friends, 
EnumSet.of(ProfileField.NAME));
+
+                       UsersGetInfoResponse userResponse = 
(UsersGetInfoResponse) connection.getClient().getResponsePOJO();
+
+                       // Print out the user information
+                       List<User> users = userResponse.getUser();
+                       for (User user : users) 
+                       {
+                               friendsList.add(user.getName());
+                       }
+               } 
+               catch (FacebookException e) 
+               {
+                       return null;
+               } 
+               
+               return friendsList;
+       }
+       
+       
+       /**
+        * Gets all notifications.
+        */
+       private Hashtable<String, Vector<String>> getUserNotification() 
+       {
+               //Will contain all availables notifications.
+               //availables notifications : messages, pokes, shares, 
friends_requests, group_invites, event_invites
+               Hashtable<String, Vector<String>> notifications = new 
Hashtable<String, Vector<String>>();
+               
+               try
+               {
+                       connection.getClient().notifications_get();
+                       String notifs = connection.getClient().getRawResponse();
+                       
+                       /**
+                        * Getting messages notifications.
+                        */
+                       if(notifs.contains("<messages"))
+                       {
+                               String messagesString = notifs.substring(
+                                                               
notifs.indexOf("<messages"), 
+                                                               
notifs.indexOf("</messages>"));
+                               
+                               Vector<String> msDatas = new Vector<String>();
+                               
+                               String unreaded = messagesString.substring(
+                                                         
messagesString.indexOf("<unread>") + "<unread>".length(), 
+                                                         
messagesString.indexOf("</unread>"));
+                               
+                               msDatas.add(unreaded);
+                               
+                               
+                               if(Integer.valueOf(unreaded).intValue() > 0)
+                               {
+                                       notifications.put("messages", msDatas);
+                               }
+                       }
+                       
+                       /**
+                        * Getting pokes notifications.
+                        */
+                       if(notifs.contains("<pokes"))
+                       {
+                               String pokesString;
+                               
+                               try
+                               {
+                                       pokesString = 
notifs.substring(notifs.indexOf("<pokes"), notifs.indexOf("</pokes>"));
+                               }
+                               catch(IndexOutOfBoundsException indexError)
+                               {
+                                       pokesString = 
notifs.substring(notifs.indexOf("<pokes"), notifs.indexOf("/>"));
+                               }
+                               
+                               Vector<String> pkDatas = new Vector<String>();
+                               
+                               String unreaded = pokesString.substring(
+                                                         
pokesString.indexOf("<unread>") + "<unread>".length(), 
+                                                         
pokesString.indexOf("</unread>"));
+                               
+                               pkDatas.add(unreaded);
+                               
+                               if(Integer.valueOf(unreaded).intValue() > 0 )
+                               {
+                                       notifications.put("pokes", pkDatas);
+                               }
+                       }
+                       
+                       /**
+                        * Getting shares notifications.
+                        */
+                       if(notifs.contains("<shares"))
+                       {
+                               String sharesString;
+                               
+                               try
+                               {
+                                       sharesString = 
notifs.substring(notifs.indexOf("<shares"), notifs.indexOf("</shares>"));
+                               }
+                               catch(IndexOutOfBoundsException indexError)
+                               {
+                                       sharesString = 
notifs.substring(notifs.indexOf("<shares"), notifs.indexOf("/>"));
+                               }
+                               
+                               Vector<String> shDatas = new Vector<String>();
+                               
+                               String unreaded = sharesString.substring(
+                                                         
sharesString.indexOf("<unread>") + "<unread>".length(), 
+                                                         
sharesString.indexOf("</unread>"));
+                               
+                               shDatas.add(unreaded);
+                               
+                               if(Integer.valueOf(unreaded).intValue() > 0)
+                               {
+                                       notifications.put("shares", shDatas);
+                               }
+                       }
+                       
+                       /**
+                        * Get the friend_requests notifications.
+                        */
+                       if(notifs.contains("<friend_requests"))
+                       {
+                               
+                               String friendsString = "";
+                               try
+                               {
+                                       friendsString = 
notifs.substring(notifs.indexOf("<friend_requests"), 
notifs.indexOf("</friend_requests>"));
+                               }
+                               catch(StringIndexOutOfBoundsException no)
+                               {
+                                       friendsString = 
notifs.substring(notifs.indexOf("<friend_requests"), notifs.indexOf("/>", 
notifs.indexOf("<friend_requests")));
+                               }
+                               
+                               Vector<String> friendsDatas = new 
Vector<String>();
+                               Vector<Long> friendsDatasAsLong = new 
Vector<Long>();
+                               
+                               //Getting friends uid that ask for friends.
+                               if(friendsString.contains("<uid>"))
+                               {
+                                       while(friendsString.contains("<uid>"))
+                                       {
+                                               String friend = 
friendsString.substring(
+                                                                       
friendsString.indexOf("<uid>") + "<uid>".length(), 
+                                                                       
friendsString.indexOf("</uid>"));
+                                               
+                                               friendsString = 
friendsString.replace("<uid>" + friend + "</uid>", "");
+                                               
+                                               
friendsDatasAsLong.add(Long.valueOf(friend).longValue());
+                                       }
+                               
+                               
+                                       // Go fetch the information for the 
user list of user ids
+                                       
connection.getClient().users_getInfo(friendsDatasAsLong, 
EnumSet.of(ProfileField.NAME));
+       
+                                       UsersGetInfoResponse userResponse = 
(UsersGetInfoResponse) connection.getClient().getResponsePOJO();
+       
+                                       // Print out the user information
+                                       List<User> users = 
userResponse.getUser();
+                                       for (User user : users) 
+                                       {
+                                               
friendsDatas.add(user.getName());
+                                       }
+                                       
+                                       notifications.put("friend_requests", 
friendsDatas);
+                               }
+                       }
+                       
+                       /**
+                        * Getting new groups invitations.
+                        */
+                       if(notifs.contains("<group_invites"))
+                       {
+                               String groupString;
+                               
+                               try
+                               {
+                                       groupString = 
notifs.substring(notifs.indexOf("<group_invites"), 
notifs.indexOf("</group_invites>"));
+                               }
+                               catch(IndexOutOfBoundsException indexError)
+                               {
+                                       groupString = 
notifs.substring(notifs.indexOf("<group_invites"), notifs.indexOf("/>", 
notifs.indexOf("<group_invites")));
+                               }
+                               
+                               Vector<Long> groupsDatasAsLong = new 
Vector<Long>();
+                               Vector<String> groupsDatas = new 
Vector<String>();
+                               
+                               //Getting friends uid that ask for friends.
+                               if(groupString.contains("<gid>"))
+                               {
+                                       while(groupString.contains("<gid>"))
+                                       {
+                                               String friend = 
groupString.substring(
+                                                                       
groupString.indexOf("<gid>") + "<gid>".length(), 
+                                                                       
groupString.indexOf("</gid>"));
+                                               
+                                               groupString = 
groupString.replace("<gid>" + friend + "</gid>", "");
+                                               
+                                               
groupsDatasAsLong.add(Long.valueOf(friend).longValue());
+                                       }
+                                       
+                                       
groupsDatas.add(String.valueOf(groupsDatasAsLong.size()));
+                                       
+                                       for(Long gid : groupsDatasAsLong)
+                                       {
+                                               try
+                                               {
+                                                       Thread.sleep(200);
+                                                       
connection.getClient().fql_query("Select name from group WHERE gid=" + 
gid.longValue());
+                                                       String response = 
connection.getClient().getRawResponse();
+                                                       
if(response.contains("<group>") && response.contains("<name>"))
+                                                       {
+                                                               String 
groupName = response.substring(
+                                                                               
           response.indexOf("<name>") + "<name>".length(),
+                                                                               
           response.indexOf("</name>", response.indexOf("<name>")));
+                                                               
groupsDatas.add(groupName);
+                                                       }
+                                               }
+                                               catch(Exception fqlError)
+                                               {
+                                                       
groupsDatas.add("Unknown group");
+                                               }
+                                       }
+                                       
+                                       //Only if they have some group invites.
+                                       if(groupsDatasAsLong.size() > 0)
+                                       {
+                                               
notifications.put("group_invites", groupsDatas);
+                                       }
+                               }
+                       }
+                       
+                       /**
+                        * Getting new events invitations.
+                        */
+                       if(notifs.contains("<event_invites"))
+                       {
+                               String eventString = "";
+                               try
+                               {
+                                       eventString = 
notifs.substring(notifs.indexOf("<event_invites"), notifs.indexOf("/>", 
notifs.indexOf("<event_invites")));
+                               }
+                               catch(IndexOutOfBoundsException indexError)
+                               {
+                                       eventString = 
notifs.substring(notifs.indexOf("<event_invites"), 
notifs.indexOf("</event_invites>"));
+                               }
+                               
+                               Vector<Long> eventsDatasAsLong = new 
Vector<Long>();
+                               Vector<String> eventsDatas = new 
Vector<String>();
+                               
+                               //Getting friends uid that ask for friends.
+                               if(eventString.contains("<eid>") || 
(eventString.contains("<event_invites_elt>")))
+                               {
+                                       while(eventString.contains("<eid>"))
+                                       {
+                                               String event = 
eventString.substring(
+                                                                       
eventString.indexOf("<eid>") + "<eid>".length(), 
+                                                                       
eventString.indexOf("</eid>"));
+                                               
+                                               eventString = 
eventString.replace("<eid>" + event + "</eid>", "");
+                                               
+                                               
eventsDatasAsLong.add(Long.valueOf(event).longValue());
+                                       }
+                                       
+                                       
+                                       
while(eventString.contains("<event_invites_elt>"))
+                                       {       
+                                               String event = 
eventString.substring(
+                                                       
eventString.indexOf("<event_invites_elt>") + "<event_invites_elt>".length(), 
+                                                       
eventString.indexOf("</event_invites_elt>"));
+                               
+                                       eventString = 
eventString.replace("<event_invites_elt>" + event + "</event_invites_elt>", "");
+                                       
eventsDatasAsLong.add(Long.valueOf(event).longValue());
+                                       }
+                                       
+                                       //Adding the number of event invites.
+                                       
eventsDatas.add(String.valueOf(eventsDatasAsLong.size()));
+                                       
+                                       for(Long eid : eventsDatasAsLong)
+                                       {
+                                               try
+                                               {
+                                                       Thread.sleep(200);
+                                                       
connection.getClient().fql_query("Select name from event WHERE eid=" + 
eid.longValue());
+                                                       String response = 
connection.getClient().getRawResponse();
+                                                       
if(response.contains("<event>") && response.contains("<name>"))
+                                                       {
+                                                               String 
groupName = response.substring(
+                                                                               
           response.indexOf("<name>") + "<name>".length(),
+                                                                               
           response.indexOf("</name>", response.indexOf("<name>")));
+                                                               
eventsDatas.add(groupName);
+                                                       }
+                                               }
+                                               catch(Exception fqlError)
+                                               {
+                                                       
eventsDatas.add("Unknown event");
+                                               }
+                                       
+                                       }
+                                       
+                                       if(eventsDatasAsLong.size() > 0)
+                                       {
+                                               
notifications.put("event_invites", eventsDatas);
+                                       }
+                               }
+                       }
+               }
+               catch (FacebookException e) 
+               {
+                       ;
+               } 
+               
+               return notifications;
+       }
+       
+       
+       /**
+        * Return email notifications.
+        */
+       public Integer getEmailNotifications()
+       {
+               if(this.notifications.containsKey("messages"))
+               {
+                       return 
Integer.valueOf(this.notifications.get("messages").get(0));
+               }
+               else
+               {
+                       return 0;
+               }
+       }
+       
+       
+       /**
+        * Return how many pokes user has.
+        * @return
+        */
+       public Integer getPokesCount()
+       {
+               if(this.notifications.containsKey("pokes"))
+               {
+                       return 
Integer.valueOf(this.notifications.get("pokes").get(0));
+               }
+               else
+               {
+                       return 0;
+               }
+       }
+       
+       
+       /**
+        * Return the number of friend requests.
+        * @return
+        */
+       public Integer getFriendRequestsCount()
+       {
+               if(this.notifications.containsKey("friend_requests"))
+               {
+                       return 
Integer.valueOf(this.notifications.get("friend_requests").size());
+               }
+               else
+               {
+                       return 0;
+               }
+       }
+       
+       
+       /**
+        * Return the name of people that ask to be a friend of user.
+        * @return
+        */
+       public Vector<String> getFriendRequestNames()
+       {
+               Vector<String> friends = new Vector<String>();
+               
+               if(this.notifications.containsKey("friend_requests"))
+               {
+                       Vector<String> dat = 
this.notifications.get("friend_requests");
+                       friends = dat;
+               }
+               return friends;
+       }
+       
+       
+       /**
+        * Return the number of availables groups invites.
+        * @return
+        */
+       public Integer getGroupsInvitesCount()
+       {
+               if(this.notifications.containsKey("group_invites"))
+               {
+                       return 
Integer.valueOf(this.notifications.get("group_invites").get(0));
+               }
+               else
+               {
+                       return 0;
+               }
+       }
+       
+       
+       /**
+        * Return the name of groups invites.
+        * @return
+        */
+       public Vector<String> getGroupInvitesNames()
+       {
+               Vector<String> groups = new Vector<String>();
+               
+               if(this.notifications.containsKey("group_invites"))
+               {
+                       Vector<String> dat = 
this.notifications.get("group_invites");
+                       dat.remove(0);
+                       groups = dat;
+               }
+               return groups;
+       }
+       
+       /**
+        * Return the number of events invites.
+        * @return
+        */
+       public Integer getEventsInvitesCount()
+       {
+               if(this.notifications.containsKey("event_invites"))
+               {
+                       return 
Integer.valueOf(this.notifications.get("event_invites").get(0));
+               }
+               else
+               {
+                       return 0;
+               }
+       }
+       
+       /**
+        * Return the name of events invites.
+        * @return
+        */
+       public Vector<String> getEventInvitesNames()
+       {
+               Vector<String> events = new Vector<String>();
+               
+               if(this.notifications.containsKey("event_invites"))
+               {
+                       Vector<String> dat = 
this.notifications.get("event_invites");
+                       dat.remove(0);
+                       events = dat;
+               }
+               return events;
+       }
+}

Added: 
software_suite_v3/software/plugin/plugin-facebook/branches/october_release/src/com/kysoh/plugins/facebook/FacebookPlugin.java
===================================================================
--- 
software_suite_v3/software/plugin/plugin-facebook/branches/october_release/src/com/kysoh/plugins/facebook/FacebookPlugin.java
                               (rev 0)
+++ 
software_suite_v3/software/plugin/plugin-facebook/branches/october_release/src/com/kysoh/plugins/facebook/FacebookPlugin.java
       2009-10-16 09:31:59 UTC (rev 5711)
@@ -0,0 +1,234 @@
+/* This file is part of "TuxDroid plugin Facebook".
+ *    Copyright 2009, kysoh
+ *    Author : Conan Jerome.
+ *    eMail  : [email protected]
+ *    Site   : http://www.kysoh.com/
+ *
+ * "TuxDroid plugin Facebook" is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * "TuxDroid plugin Facebook" is distributed in the hope that it will be 
useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with "TuxDroid plugin Facebook"; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package com.kysoh.plugins.facebook;
+
+
+import com.kysoh.tuxdroid.plugin.framework.plugin.SimplePlugin;
+import com.kysoh.plugins.facebook.configuration.PluginFacebookConfiguration;
+
+
+public class FacebookPlugin extends SimplePlugin<PluginFacebookConfiguration>{
+       
+       private boolean check = false;
+       
+       /**
+        * Gadget start method.
+        */
+       @Override
+       protected void start() throws Throwable
+       {
+               boolean throwNotif = false;
+        boolean news = false;
+               
+               if(getCommand().equals("check"))
+               {
+                       this.check = true;
+               }
+               FacebookConnection facebook = new FacebookConnection();
+               if ( facebook.Connect(this.configuration().getLogin(), 
this.configuration().getPassword()) )
+               {
+                       FacebookFunctions functions = new 
FacebookFunctions(facebook);
+                       
+                       //Get email informations.
+                       if(this.configuration().getNotifyEmail())
+                       {
+                               if(functions.getEmailNotifications().intValue() 
> 0)
+                               {
+                    news = true;
+                                       if(this.check && (!throwNotif))
+                                       {
+                                               throwNotif = true;
+                                               this.throwResult(true);
+                                       }
+                                       
+                                       
if(functions.getEmailNotifications().intValue() == 1)
+                                       {
+                                               throwMessage("You have one new 
message");
+                                       }
+                                       else
+                                       {
+                                               throwMessage("You have {0} new 
messages", functions.getEmailNotifications().intValue());
+                                       }
+                               }
+                       }
+                       
+                       //Get friend requests notification.
+                       if(this.configuration().getShowFriendRequests())
+                       {
+                               
if(functions.getFriendRequestsCount().intValue() > 0)
+                               {
+                    news = true;
+                                       if(this.check && (!throwNotif))
+                                       {
+                                               throwNotif = true;
+                                               this.throwResult(true);
+                                       }
+                                       
+                                       
if(functions.getFriendRequestsCount().intValue() == 1)
+                                       {
+                                               throwMessage("You have one 
friend request");
+                                       }
+                                       else
+                                       {
+                                               throwMessage("You have {0} 
friend requests", functions.getFriendRequestsCount());
+                                       }
+                                       
+                                       for(String friendName : 
functions.getFriendRequestNames())
+                                       {
+                                               if(this.check && (!throwNotif))
+                                               {
+                                                       throwNotif = true;
+                                                       this.throwResult(true);
+                                               }
+                                               throwMessage("From {0}", 
friendName);
+                                       }
+                               }
+                       }
+                       
+                       //Get group invites notifications.
+                       if(this.configuration().getShowGroupsInvites())
+                       {
+                news = true;
+                               if(functions.getGroupsInvitesCount().intValue() 
> 0)
+                               {
+                                       if(this.check && (!throwNotif))
+                                       {
+                                               throwNotif = true;
+                                               this.throwResult(true);
+                                       }
+                                       
+                                       
if(functions.getGroupsInvitesCount().intValue() == 1)
+                                       {
+                                               throwMessage("You have one 
group invite");
+                                       }
+                                       else
+                                       {
+                                               throwMessage("You have {0} 
group invites", functions.getGroupsInvitesCount().intValue());
+                                       }
+                                       
+                                       for(String group : 
functions.getGroupInvitesNames())
+                                       {
+                                               if(this.check && (!throwNotif))
+                                               {
+                                                       throwNotif = true;
+                                                       this.throwResult(true);
+                                               }
+                                               throwMessage("to {0}", group);
+                                       }
+                               }
+                       }
+                       
+                       //Get pokes notification.
+                       if(this.configuration().getShowEventsInvites())
+                       {
+                               if(functions.getEventsInvitesCount().intValue() 
> 0)
+                               {
+                    news = true;
+                                       if(this.check && (!throwNotif))
+                                       {
+                                               throwNotif = true;
+                                               this.throwResult(true);
+                                       }
+                                       
+                                       
if(functions.getEventsInvitesCount().intValue() == 1)
+                                       {
+                                               throwMessage("You have one 
event invite");
+                                       }
+                                       else
+                                       {
+                                               throwMessage("You have {0} 
event invites", functions.getEventsInvitesCount().intValue());
+                                       }
+                                       
+                                       for(String event : 
functions.getEventInvitesNames())
+                                       {
+                                               if(this.check && (!throwNotif))
+                                               {
+                                                       throwNotif = true;
+                                                       this.throwResult(true);
+                                               }
+                                               throwMessage("to {0}", event);
+                                       }
+                               }
+                       }
+                       
+                       if(this.configuration().getShowPokes())
+                       {
+                               if(functions.getPokesCount().intValue() > 0)
+                               {
+                    news = true;
+                                       if(this.check && (!throwNotif))
+                                       {
+                                               throwNotif = true;
+                                               this.throwResult(true);
+                                       }
+                                       
+                                       if(functions.getPokesCount().intValue() 
== 1)
+                                       {
+                                               throwMessage("You have one 
poke");
+                                       }
+                                       else
+                                       {
+                                               throwMessage("You have {0} 
pokes", functions.getPokesCount().intValue());
+                                       }
+                               }
+                       }
+                       
+                       if((!throwNotif) && this.check )
+                       {
+                               this.throwResult(false);
+                       }
+                       else if((!this.check) && (!news))
+                       {
+                               this.throwMessage("Nothing new on your 
account");
+                       }
+               }
+               else
+               {
+                       this.throwMessage("I cannot get connected to your 
facebook account.");
+               }
+       }
+       
+       
+       /**
+        * Main entry point.
+        * @param args
+        */
+       public static void main(String[] args)
+       {
+               new FacebookPlugin().boot(args, new 
PluginFacebookConfiguration());
+       }
+
+
+       @Override
+       protected void onPluginEvent(String arg0, String[] arg1) throws 
Throwable 
+       {
+               ;
+       }
+
+
+       @Override
+       protected void onPluginStop() throws Throwable
+       {
+               ;
+       }
+}

Added: 
software_suite_v3/software/plugin/plugin-facebook/branches/october_release/src/com/kysoh/plugins/facebook/configuration/PluginFacebookConfiguration.java
===================================================================
--- 
software_suite_v3/software/plugin/plugin-facebook/branches/october_release/src/com/kysoh/plugins/facebook/configuration/PluginFacebookConfiguration.java
                            (rev 0)
+++ 
software_suite_v3/software/plugin/plugin-facebook/branches/october_release/src/com/kysoh/plugins/facebook/configuration/PluginFacebookConfiguration.java
    2009-10-16 09:31:59 UTC (rev 5711)
@@ -0,0 +1,171 @@
+/* This file is part of "TuxDroid plugin Facebook".
+ *    Copyright 2009, kysoh
+ *    Author : Conan Jerome.
+ *    eMail  : [email protected]
+ *    Site   : http://www.kysoh.com/
+ *
+ * "TuxDroid plugin Facebook" is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * "TuxDroid plugin Facebook" is distributed in the hope that it will be 
useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with "TuxDroid plugin Facebook"; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package com.kysoh.plugins.facebook.configuration;
+
+import com.kysoh.tuxdroid.plugin.framework.plugin.SimplePluginConfiguration;
+
+public class PluginFacebookConfiguration extends SimplePluginConfiguration{
+               
+       private String login = "";
+       private String password = "";
+       
+       private boolean showFriendRequests = true;
+       private boolean showGroupsInvites = true;
+       private boolean showEventsInvites = true;
+       private boolean showPokes = true;
+       private boolean notifyEmail = true;
+       
+       /**
+        * Return the user login.
+        * @return
+        */
+       public String getLogin()
+       {
+               return this.login;
+       }
+       
+       
+       /**
+        * Set the user login.
+        * @param aLogin
+        */
+       public void setLogin(String aLogin)
+       {
+               this.login = aLogin;
+       }
+       
+       
+       /**
+        * Return tthe user password.
+        * @return
+        */
+       public String getPassword()
+       {
+               return this.password;
+       }
+       
+       
+       /**
+        * Set the user password.
+        * @param aPassword
+        */
+       public void setPassword(String aPassword)
+       {
+               this.password = aPassword;
+       }
+       
+       
+       /**
+        * Return true if user want to hear his email notifications.
+        * @return
+        */
+       public boolean getNotifyEmail()
+       {
+               return this.notifyEmail;
+       }
+       
+       
+       /**
+        * Set the notify email parameter value.
+        * @param aNotifyEmail
+        */
+       public void setNotifyEmail(boolean aNotifyEmail)
+       {
+               this.notifyEmail = aNotifyEmail;
+       }
+       
+       /**
+        * Return true if user want to hear his pokes notifications.
+        * @return
+        */
+       public boolean getShowPokes()
+       {
+               return this.showPokes;
+       }
+       
+       
+       /**
+        * Set the show pokes parameter value.
+        * @param aShowPokes
+        */
+       public void setShowPokes(boolean aShowPokes)
+       {
+               this.showPokes = aShowPokes;
+       }
+       
+       /**
+        * Return true if user want to hear his events invites.
+        * @return
+        */
+       public boolean getShowEventsInvites()
+       {
+               return this.showEventsInvites;
+       }
+       
+       
+       /**
+        * Set the show events invites parameter value.
+        * @param aEventsInvites
+        */
+       public void setShowEventsInvites(boolean aEventsInvites)
+       {
+               this.showEventsInvites = aEventsInvites;
+       }
+       
+       /**
+        * Return true if user want to hear his group invites.
+        * @return
+        */
+       public boolean getShowGroupsInvites()
+       {
+               return this.showGroupsInvites;
+       }
+       
+       
+       /**
+        * Sets the show group invites parameter value.
+        * @param aShowGroupsInvites
+        */
+       public void setShowGroupsInvites(boolean aShowGroupsInvites)
+       {
+               this.showGroupsInvites = aShowGroupsInvites;
+       }
+       
+       /**
+        * Return true if user want to hear his friend requests.
+        * @return
+        */
+       public boolean getShowFriendRequests()
+       {
+               return this.showFriendRequests;
+       }
+       
+       /**
+        * Set the friend request value.
+        * @param aShowFriendRequests
+        */
+       public void setShowFriendRequests(boolean aShowFriendRequests)
+       {
+               this.showFriendRequests = aShowFriendRequests;
+       }
+}


------------------------------------------------------------------------------
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