[tuxdroid-svn] r5710 - software_suite_v3/software/plugin/plugin-facebook/branches/october_release/s
Status: Beta
Brought to you by:
ks156
|
From: jerome <c2m...@c2...> - 2009-10-16 09:22:54
|
Author: jerome
Date: 2009-10-16 11:22:44 +0200 (Fri, 16 Oct 2009)
New Revision: 5710
Modified:
software_suite_v3/software/plugin/plugin-facebook/branches/october_release/src/FacebookPlugin.java
Log:
* Moved the configuration on a new package.
* Created new FB connection directory.
Modified: 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:14:49 UTC (rev 5709)
+++ software_suite_v3/software/plugin/plugin-facebook/branches/october_release/src/FacebookPlugin.java 2009-10-16 09:22:44 UTC (rev 5710)
@@ -21,169 +21,14 @@
*/
import com.kysoh.tuxdroid.plugin.framework.plugin.SimplePlugin;
-import com.kysoh.tuxdroid.plugin.framework.plugin.SimplePluginConfiguration;
+import com.kysoh.plugins.facebook.configuration.PluginFacebookConfiguration;
-/**
- * Facebook gadget class.
- * @author nux
- *
- */
-public class FacebookPlugin extends SimplePlugin<FacebookPlugin.Configuration>{
+
+public class FacebookPlugin extends SimplePlugin<PluginFacebookConfiguration>{
private boolean check = false;
/**
- * Configuration Class.
- * @author nux
- */
- public static class Configuration 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;
- }
- }
-
-
- /**
* Gadget start method.
*/
@Override
@@ -196,210 +41,178 @@
{
this.check = true;
}
-
- if ( !(this.configuration().notifyEmail || this.configuration().showEventsInvites || this.configuration().showFriendRequests
- || this.configuration().showGroupsInvites || this.configuration().showPokes))
+ FacebookConnection facebook = new FacebookConnection();
+ if ( facebook.Connect(this.configuration().getLogin(), this.configuration().getPassword()) )
{
- this.quitGadget();
- }
-
- if(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())
{
- FacebookFunctions functions = new FacebookFunctions(facebook);
-
- //Get email informations.
- if(this.configuration().notifyEmail)
+ if(functions.getEmailNotifications().intValue() > 0)
{
- if(functions.getEmailNotifications().intValue() > 0)
+ news = true;
+ if(this.check && (!throwNotif))
{
- 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());
- }
+ 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().showFriendRequests)
+ }
+
+ //Get friend requests notification.
+ if(this.configuration().getShowFriendRequests())
+ {
+ if(functions.getFriendRequestsCount().intValue() > 0)
{
- if(functions.getFriendRequestsCount().intValue() > 0)
+ news = true;
+ if(this.check && (!throwNotif))
{
- news = true;
+ 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);
}
-
- 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);
- }
+ throwMessage("From {0}", friendName);
}
}
-
- //Get group invites notifications.
- if(this.configuration().showGroupsInvites)
+ }
+
+ //Get group invites notifications.
+ if(this.configuration().getShowGroupsInvites())
+ {
+ news = true;
+ if(functions.getGroupsInvitesCount().intValue() > 0)
{
- 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);
}
-
- 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);
- }
+ throwMessage("to {0}", group);
}
}
-
- //Get pokes notification.
- if(this.configuration().showEventsInvites)
+ }
+
+ //Get pokes notification.
+ if(this.configuration().getShowEventsInvites())
+ {
+ if(functions.getEventsInvitesCount().intValue() > 0)
{
- if(functions.getEventsInvitesCount().intValue() > 0)
+ news = true;
+ if(this.check && (!throwNotif))
{
- news = true;
+ 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);
}
-
- 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);
- }
+ throwMessage("to {0}", event);
}
}
-
- if(this.configuration().showPokes)
+ }
+
+ if(this.configuration().getShowPokes())
+ {
+ if(functions.getPokesCount().intValue() > 0)
{
- if(functions.getPokesCount().intValue() > 0)
+ news = true;
+ if(this.check && (!throwNotif))
{
- 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());
- }
+ 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
+
+ if((!throwNotif) && this.check )
{
- this.throwMessage("I cannot get connected to your facebook account.");
+ this.throwResult(false);
}
+ else if((!this.check) && (!news))
+ {
+ this.throwMessage("Nothing new on your account");
+ }
}
else
{
- if(!this.check)
- {
- throwMessage("I must be connected to access your facebook account.");
- }
- else
- {
- this.throwResult(false);
- }
+ this.throwMessage("I cannot get connected to your facebook account.");
}
-
- this.quitGadget();
}
/**
- * Called when user stop the gadget.
- */
- private void quitGadget()
- {
- System.exit(0);
- }
-
-
- /**
* Main entry point.
* @param args
*/
public static void main(String[] args)
{
- new FacebookPlugin().boot(args, new Configuration());
+ new FacebookPlugin().boot(args, new PluginFacebookConfiguration());
}
|