diff options
author | Symphorien Wanko <wsympho@gmail.com> | 2007-09-14 08:07:13 +0000 |
---|---|---|
committer | Symphorien Wanko <wsympho@gmail.com> | 2007-09-14 08:07:13 +0000 |
commit | 546b0ba82762d3c3bd637fd00eaff8a479c7c663 (patch) | |
tree | 96e7e388365e8cd05615343a0fd7f9d1a54042b4 /src | |
parent | 5d85bde3c96cbdc073e994d8085cc1976253be0e (diff) | |
download | jitsi-546b0ba82762d3c3bd637fd00eaff8a479c7c663.zip jitsi-546b0ba82762d3c3bd637fd00eaff8a479c7c663.tar.gz jitsi-546b0ba82762d3c3bd637fd00eaff8a479c7c663.tar.bz2 |
add javadoc and resource files for internationalization
Diffstat (limited to 'src')
3 files changed, 106 insertions, 6 deletions
diff --git a/src/net/java/sip/communicator/impl/protocol/yahoo/OperationSetBasicInstantMessagingYahooImpl.java b/src/net/java/sip/communicator/impl/protocol/yahoo/OperationSetBasicInstantMessagingYahooImpl.java index b115692..31f5226 100644 --- a/src/net/java/sip/communicator/impl/protocol/yahoo/OperationSetBasicInstantMessagingYahooImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/yahoo/OperationSetBasicInstantMessagingYahooImpl.java @@ -27,6 +27,9 @@ import ymsg.network.event.*; public class OperationSetBasicInstantMessagingYahooImpl implements OperationSetBasicInstantMessaging { + /** + * Logger for this class + */ private static final Logger logger = Logger.getLogger(OperationSetBasicInstantMessagingYahooImpl.class); @@ -334,37 +337,64 @@ public class OperationSetBasicInstantMessagingYahooImpl } } + /** + * This class provides methods to listen for yahoo events which interest us. + */ private class YahooMessageListener extends SessionAdapter { + /** + * Overrides <tt>messageReceived</tt> from <tt>SessionAdapter</tt>, + * called when we receive a new intant message. + * + * @param ev Event with information on the received message + */ public void messageReceived(SessionEvent ev) { handleNewMessage(ev); } + /** + * Overrides <tt>offlineMessageReceived</tt> from <tt>SessionAdapter</tt>, + * called when we receive a message which has been sent to us + * when we were offline. + * + * @param ev Event with information on the received message + */ public void offlineMessageReceived(SessionEvent ev) { handleNewMessage(ev); } + /** + * Overrides <tt>newMailReceived</tt> from <tt>SessionAdapter</tt>, + * called when yahoo alert us that there is a new message in our mailbox. + * + * @param ev Event with information on the received email + */ public void newMailReceived(SessionNewMailEvent ev) { String myEmail = yahooProvider.getAccountID().getAccountAddress(); // this was intended to obtain the user server i.e. mail.yahoo.com, // or mail.yahoo.fr so that the login page is in the preferred user - // language. but it always gives yahoo.com, even if the account is registered - // with yahoo.fr ... perhaps because the pps always login on yahoo.com ? + // language. but it always gives yahoo.com, even if the account + // is registered with yahoo.fr ... + // perhaps because the pps always login on yahoo.com ? String yahooMailLogon = "http://mail." + myEmail.substring(myEmail.indexOf("@") + 1); + yahooMailLogon = "<a href=\"" + yahooMailLogon + "\">" + yahooMailLogon + "</a>"; - // TODO: care about internationalization ... - String newMail = "<small>New mail, subject :</small> " - + ev.getSubject(); - newMail += "\n<br /><small>From :</small> " + ev.getEmailAddress(); + String newMail = "<small>" + Resources.getString("newMail") + + " : </small> " + ev.getSubject(); + + newMail += "\n<br /><small>" + Resources.getString("from") + + " : </small> " + ev.getFrom() + + " <" + ev.getEmailAddress() + ">"; + newMail += "\n<br /> " + yahooMailLogon; Message newMailMessage = new MessageYahooImpl( @@ -392,6 +422,14 @@ public class OperationSetBasicInstantMessagingYahooImpl fireMessageEvent(msgReceivedEvt); } + /** + * Handle incoming message by creating an appropriate Sip Communicator + * <tt>Message</tt> and firing a <tt>MessageReceivedEvent</tt> + * to interested listeners. + * + * @param ev The original <tt>SessionEvent</tt> which noticed us + * of an incoming message. + */ private void handleNewMessage(SessionEvent ev) { logger.debug("Message received : " + ev); diff --git a/src/net/java/sip/communicator/impl/protocol/yahoo/Resources.java b/src/net/java/sip/communicator/impl/protocol/yahoo/Resources.java new file mode 100644 index 0000000..b62f025 --- /dev/null +++ b/src/net/java/sip/communicator/impl/protocol/yahoo/Resources.java @@ -0,0 +1,60 @@ +/*
+ * SIP Communicator, the OpenSource Java VoIP and Instant Messaging client.
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+
+package net.java.sip.communicator.impl.protocol.yahoo;
+
+import java.io.*;
+import java.util.*;
+
+import net.java.sip.communicator.util.*;
+
+/**
+ * The Resources class manages the access to the internationalization
+ * properties files.
+ *
+ * @author Yana Stamcheva
+ */
+public class Resources
+{
+
+ /**
+ * Logger for this class.
+ */
+ private static Logger log = Logger.getLogger(Resources.class);
+
+ /**
+ * Name of the bundle were we will search for localized string.
+ */
+ private static final String BUNDLE_NAME
+ = "net.java.sip.communicator.impl.protocol.yahoo.resources";
+
+ /**
+ * Bundle which handle access to localized resources.
+ */
+ private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle
+ .getBundle(BUNDLE_NAME);
+
+ /**
+ * Returns an internationalized string corresponding to the given key.
+ *
+ * @param key The key of the string.
+ *
+ * @return An internationalized string corresponding to the given key.
+ */
+ public static String getString(String key)
+ {
+ try
+ {
+ return RESOURCE_BUNDLE.getString(key);
+
+ }
+ catch (MissingResourceException e) {
+
+ return '!' + key + '!';
+ }
+ }
+}
diff --git a/src/net/java/sip/communicator/impl/protocol/yahoo/resources.properties b/src/net/java/sip/communicator/impl/protocol/yahoo/resources.properties new file mode 100644 index 0000000..6797533 --- /dev/null +++ b/src/net/java/sip/communicator/impl/protocol/yahoo/resources.properties @@ -0,0 +1,2 @@ +newMail=New mail, subject +from=From |