aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIngo Bauersachs <ingo@jitsi.org>2016-10-24 22:39:39 +0200
committerIngo Bauersachs <ingo@jitsi.org>2016-10-24 22:39:39 +0200
commit2cca1f070ccfda479a43d82a2a24ac656f8ad396 (patch)
treeab99faa97af5a9bc2dc20a351e66e2abccab64e9
parent94db8054a6f7de9d7af5dcc7a51273926e5427f9 (diff)
downloadjitsi-2cca1f070ccfda479a43d82a2a24ac656f8ad396.zip
jitsi-2cca1f070ccfda479a43d82a2a24ac656f8ad396.tar.gz
jitsi-2cca1f070ccfda479a43d82a2a24ac656f8ad396.tar.bz2
Remove Yahoo protocol
Closes #76, #293
-rw-r--r--README.md2
-rw-r--r--build.xml38
-rw-r--r--lib/accounts.properties.template41
-rw-r--r--lib/felix.client.run.properties2
-rw-r--r--lib/felix.unit.test.properties2
-rw-r--r--lib/installer-exclude/ymsg_network_v0_67.jarbin142376 -> 0 bytes
-rw-r--r--lib/jitsi-defaults.properties2
-rw-r--r--lib/testing.properties4
-rw-r--r--m2/jitsi-protocol/pom.xml2
-rw-r--r--resources/images/images.properties36
-rwxr-xr-xresources/images/protocol/dict/dict-16x16-offline.pngbin687 -> 0 bytes
-rw-r--r--resources/images/protocol/dict/dict-16x16.pngbin739 -> 0 bytes
-rw-r--r--resources/images/protocol/dict/dict-32x32.pngbin1663 -> 0 bytes
-rw-r--r--resources/images/protocol/dict/dict-48x48.pngbin3071 -> 0 bytes
-rw-r--r--resources/images/protocol/dict/dict-64x64.pngbin4367 -> 0 bytes
-rw-r--r--resources/images/protocol/ssh/ssh-connected.pngbin1703 -> 0 bytes
-rw-r--r--resources/images/protocol/ssh/ssh-connecting.pngbin1657 -> 0 bytes
-rw-r--r--resources/images/protocol/ssh/ssh-filetransfer.pngbin1725 -> 0 bytes
-rw-r--r--resources/images/protocol/ssh/ssh-na.pngbin1719 -> 0 bytes
-rw-r--r--resources/images/protocol/ssh/ssh-offline.pngbin1309 -> 0 bytes
-rw-r--r--resources/images/protocol/ssh/ssh-online.pngbin1391 -> 0 bytes
-rw-r--r--resources/images/protocol/ssh/ssh32x32.pngbin1730 -> 0 bytes
-rw-r--r--resources/images/protocol/ssh/ssh48x48.pngbin3126 -> 0 bytes
-rw-r--r--resources/images/protocol/ssh/ssh64x64.pngbin4327 -> 0 bytes
-rw-r--r--resources/images/protocol/yahoo/yahoo16x16-away.pngbin728 -> 0 bytes
-rw-r--r--resources/images/protocol/yahoo/yahoo16x16-busy.pngbin721 -> 0 bytes
-rw-r--r--resources/images/protocol/yahoo/yahoo16x16-connecting.gifbin6152 -> 0 bytes
-rw-r--r--resources/images/protocol/yahoo/yahoo16x16-connecting.pngbin639 -> 0 bytes
-rw-r--r--resources/images/protocol/yahoo/yahoo16x16-idle.pngbin681 -> 0 bytes
-rw-r--r--resources/images/protocol/yahoo/yahoo16x16-invisible.pngbin742 -> 0 bytes
-rw-r--r--resources/images/protocol/yahoo/yahoo16x16-lunch.pngbin683 -> 0 bytes
-rw-r--r--resources/images/protocol/yahoo/yahoo16x16-na.pngbin697 -> 0 bytes
-rw-r--r--resources/images/protocol/yahoo/yahoo16x16-offline.pngbin459 -> 0 bytes
-rw-r--r--resources/images/protocol/yahoo/yahoo16x16-online.pngbin495 -> 0 bytes
-rw-r--r--resources/images/protocol/yahoo/yahoo16x16-phone.pngbin766 -> 0 bytes
-rw-r--r--resources/images/protocol/yahoo/yahoo16x16-vacation.pngbin699 -> 0 bytes
-rw-r--r--resources/images/protocol/yahoo/yahoo16x16.pngbin495 -> 0 bytes
-rw-r--r--resources/images/protocol/yahoo/yahoo32x32.pngbin946 -> 0 bytes
-rw-r--r--resources/images/protocol/yahoo/yahoo48x48.pngbin1338 -> 0 bytes
-rw-r--r--resources/images/protocol/yahoo/yahoo64x64.pngbin1758 -> 0 bytes
-rw-r--r--resources/images/protocol/zeroconf/zeroconf-away.pngbin1962 -> 0 bytes
-rw-r--r--resources/images/protocol/zeroconf/zeroconf-dnd.pngbin1933 -> 0 bytes
-rw-r--r--resources/images/protocol/zeroconf/zeroconf-invisible.pngbin1967 -> 0 bytes
-rw-r--r--resources/images/protocol/zeroconf/zeroconf-offline.pngbin1673 -> 0 bytes
-rw-r--r--resources/images/protocol/zeroconf/zeroconf-online.pngbin1648 -> 0 bytes
-rw-r--r--resources/images/protocol/zeroconf/zeroconf16x16.pngbin1648 -> 0 bytes
-rw-r--r--resources/images/protocol/zeroconf/zeroconf32x32.pngbin1868 -> 0 bytes
-rw-r--r--resources/images/protocol/zeroconf/zeroconf48x48.pngbin3524 -> 0 bytes
-rw-r--r--resources/images/protocol/zeroconf/zeroconf64x64.pngbin4985 -> 0 bytes
-rw-r--r--resources/install/debian/README.embedded-libraries6
-rw-r--r--resources/install/debian/control-src.tmpl2
-rw-r--r--resources/install/debian/control.tmpl2
-rw-r--r--resources/install/debian/jitsi.1.tmpl2
-rw-r--r--resources/install/rpm/SPECS/jitsi.spec8
-rw-r--r--resources/languages/resources.properties8
-rw-r--r--src/net/java/sip/communicator/impl/googlecontacts/GoogleContactsEntryImpl.java18
-rw-r--r--src/net/java/sip/communicator/impl/googlecontacts/GoogleContactsQuery.java13
-rw-r--r--src/net/java/sip/communicator/impl/gui/main/contactlist/contactsource/SourceUIContact.java2
-rw-r--r--src/net/java/sip/communicator/impl/protocol/icq/icq.provider.manifest.mf1
-rw-r--r--src/net/java/sip/communicator/impl/protocol/yahoo/AbstractContactGroupYahooImpl.java40
-rw-r--r--src/net/java/sip/communicator/impl/protocol/yahoo/AdHocChatRoomInvitationYahooImpl.java90
-rw-r--r--src/net/java/sip/communicator/impl/protocol/yahoo/AdHocChatRoomYahooImpl.java581
-rw-r--r--src/net/java/sip/communicator/impl/protocol/yahoo/ContactGroupYahooImpl.java445
-rw-r--r--src/net/java/sip/communicator/impl/protocol/yahoo/ContactYahooImpl.java397
-rw-r--r--src/net/java/sip/communicator/impl/protocol/yahoo/FileTransferImpl.java117
-rw-r--r--src/net/java/sip/communicator/impl/protocol/yahoo/IncomingFileTransferRequestYahooImpl.java190
-rw-r--r--src/net/java/sip/communicator/impl/protocol/yahoo/MessageYahooImpl.java48
-rw-r--r--src/net/java/sip/communicator/impl/protocol/yahoo/OperationSetAdHocMultiUserChatYahooImpl.java714
-rw-r--r--src/net/java/sip/communicator/impl/protocol/yahoo/OperationSetBasicInstantMessagingYahooImpl.java649
-rw-r--r--src/net/java/sip/communicator/impl/protocol/yahoo/OperationSetFileTransferYahooImpl.java466
-rw-r--r--src/net/java/sip/communicator/impl/protocol/yahoo/OperationSetPersistentPresenceYahooImpl.java954
-rw-r--r--src/net/java/sip/communicator/impl/protocol/yahoo/OperationSetTypingNotificationsYahooImpl.java153
-rw-r--r--src/net/java/sip/communicator/impl/protocol/yahoo/ProtocolIconYahooImpl.java173
-rw-r--r--src/net/java/sip/communicator/impl/protocol/yahoo/ProtocolProviderFactoryYahooImpl.java172
-rw-r--r--src/net/java/sip/communicator/impl/protocol/yahoo/ProtocolProviderServiceYahooImpl.java574
-rw-r--r--src/net/java/sip/communicator/impl/protocol/yahoo/RootContactGroupYahooImpl.java280
-rw-r--r--src/net/java/sip/communicator/impl/protocol/yahoo/ServerStoredContactListYahooImpl.java1278
-rw-r--r--src/net/java/sip/communicator/impl/protocol/yahoo/VolatileContactGroupYahooImpl.java97
-rw-r--r--src/net/java/sip/communicator/impl/protocol/yahoo/YahooAccountID.java42
-rw-r--r--src/net/java/sip/communicator/impl/protocol/yahoo/YahooActivator.java145
-rw-r--r--src/net/java/sip/communicator/impl/protocol/yahoo/YahooSession.java76
-rw-r--r--src/net/java/sip/communicator/impl/protocol/yahoo/yahoo.provider.manifest.mf22
-rw-r--r--src/net/java/sip/communicator/plugin/addrbook/macosx/MacOSXAddrBookContactQuery.java10
-rw-r--r--src/net/java/sip/communicator/plugin/aimaccregwizz/aimaccregwizz.manifest.mf1
-rw-r--r--src/net/java/sip/communicator/plugin/globalproxyconfig/GlobalProxyPluginActivator.java10
-rw-r--r--src/net/java/sip/communicator/plugin/msofficecomm/Messenger.java6
-rw-r--r--src/net/java/sip/communicator/plugin/msofficecomm/msofficecomm.manifest.mf1
-rw-r--r--src/net/java/sip/communicator/plugin/yahooaccregwizz/FirstWizardPage.java299
-rw-r--r--src/net/java/sip/communicator/plugin/yahooaccregwizz/Resources.java73
-rw-r--r--src/net/java/sip/communicator/plugin/yahooaccregwizz/YahooAccRegWizzActivator.java160
-rw-r--r--src/net/java/sip/communicator/plugin/yahooaccregwizz/YahooAccountRegistration.java83
-rw-r--r--src/net/java/sip/communicator/plugin/yahooaccregwizz/YahooAccountRegistrationWizard.java379
-rw-r--r--src/net/java/sip/communicator/plugin/yahooaccregwizz/yahooaccregwizz.manifest.mf33
-rw-r--r--src/net/java/sip/communicator/service/contactsource/ContactDetail.java4
-rw-r--r--src/net/java/sip/communicator/service/googlecontacts/GoogleContactsEntry.java15
-rw-r--r--src/net/java/sip/communicator/service/protocol/AdHocChatRoom.java3
-rw-r--r--src/net/java/sip/communicator/service/protocol/ProtocolNames.java30
-rw-r--r--src/net/java/sip/communicator/service/protocol/protocol.provider.manifest.mf4
-rw-r--r--src/net/java/sip/communicator/service/protocol/yahooconstants/YahooStatusEnum.java200
-rw-r--r--test/net/java/sip/communicator/slick/protocol/generic/TestOperationSetAdHocMultiUserChat.java7
-rw-r--r--test/net/java/sip/communicator/slick/protocol/generic/TestOperationSetFileTransfer.java3
-rw-r--r--test/net/java/sip/communicator/slick/protocol/icq/icq.provider.slick.manifest.mf1
-rw-r--r--test/net/java/sip/communicator/slick/protocol/yahoo/TestAccountInstallation.java233
-rw-r--r--test/net/java/sip/communicator/slick/protocol/yahoo/TestAccountUninstallation.java287
-rw-r--r--test/net/java/sip/communicator/slick/protocol/yahoo/TestAccountUninstallationPersistence.java113
-rw-r--r--test/net/java/sip/communicator/slick/protocol/yahoo/TestOperationSetAdHocMultiUserChatYahooImpl.java182
-rw-r--r--test/net/java/sip/communicator/slick/protocol/yahoo/TestOperationSetBasicInstantMessaging.java537
-rw-r--r--test/net/java/sip/communicator/slick/protocol/yahoo/TestOperationSetFileTransferImpl.java253
-rw-r--r--test/net/java/sip/communicator/slick/protocol/yahoo/TestOperationSetPersistentPresence.java582
-rw-r--r--test/net/java/sip/communicator/slick/protocol/yahoo/TestOperationSetPresence.java1003
-rw-r--r--test/net/java/sip/communicator/slick/protocol/yahoo/TestOperationSetTypingNotifications.java318
-rw-r--r--test/net/java/sip/communicator/slick/protocol/yahoo/TestProtocolProviderServiceYahooImpl.java262
-rw-r--r--test/net/java/sip/communicator/slick/protocol/yahoo/YahooProtocolProviderServiceLick.java129
-rw-r--r--test/net/java/sip/communicator/slick/protocol/yahoo/YahooSlickFixture.java144
-rw-r--r--test/net/java/sip/communicator/slick/protocol/yahoo/yahoo.provider.slick.manifest.mf17
115 files changed, 32 insertions, 13244 deletions
diff --git a/README.md b/README.md
index 1e16f85..c356062 100644
--- a/README.md
+++ b/README.md
@@ -1,7 +1,7 @@
Jitsi
=====
-Jitsi is a free open-source audio/video and chat communicator that supports protocols such as SIP, XMPP/Jabber, AIM/ICQ, IRC, Yahoo! and many other useful features.
+Jitsi is a free open-source audio/video and chat communicator that supports protocols such as SIP, XMPP/Jabber, AIM/ICQ, IRC and many other useful features.
Helpful Resources
-----------------
diff --git a/build.xml b/build.xml
index ccdf34e..47745ef 100644
--- a/build.xml
+++ b/build.xml
@@ -930,11 +930,10 @@
bundle-jabber,bundle-jabber-slick,bundle-swing-ui,bundle-ui-service,
bundle-phonenumbers,
bundle-irc,bundle-irc-commands,bundle-plugin-ircaccregwizz,
- bundle-yahoo,bundle-yahoo-slick,
bundle-contactlist,meta-contactlist,meta-contactlist-slick,
bundle-plugin-icqaccregwizz,bundle-plugin-jabberaccregwizz,
bundle-plugin-sipaccregwizz,
- bundle-plugin-yahooaccregwizz,bundle-plugin-aimaccregwizz,
+ bundle-plugin-aimaccregwizz,
bundle-httputil,bundle-plugin-spellcheck,
bundle-version-impl,bundle-shutdown-timeout,bundle-windows-clean-shutdown,
bundle-growlnotification,bundle-swingnotification,bundle-galagonotification,
@@ -1425,7 +1424,6 @@ javax.swing.event, javax.swing.border"/>
<include name="protocol/icq/**/*"/>
<include name="protocol/googletalk/**/*"/>
<include name="protocol/jabber/**/*"/>
- <include name="protocol/yahoo/**/*"/>
<!-- the media package lives in the protocol-media bundle -->
<exclude name="protocol/media/**/*"/>
</zipfileset>
@@ -1536,30 +1534,6 @@ javax.swing.event, javax.swing.border"/>
</jar>
</target>
- <!-- BUNDLE-YAHOO -->
- <target name="bundle-yahoo">
- <!-- Creates a bundle containing the yahoo impl of the protocol provider.-->
- <jar compress="false" destfile="${bundles.dest}/protocol-yahoo.jar"
- manifest="${src}/net/java/sip/communicator/impl/protocol/yahoo/yahoo.provider.manifest.mf">
- <zipfileset dir="${dest}/net/java/sip/communicator/impl/protocol/yahoo"
- prefix="net/java/sip/communicator/impl/protocol/yahoo"/>
- <zipfileset src="${lib.noinst}/ymsg_network_v0_67.jar" prefix=""/>
- </jar>
- </target>
-
- <!-- BUNDLE-YAHOO-SLICK -->
- <!-- Creates a bundle containing the slick for the Yahoo protocol provider.-->
- <target name="bundle-yahoo-slick">
- <jar compress="false" destfile="${bundles.dest}/protocol-yahoo-slick.jar"
- manifest="${testsrc}/net/java/sip/communicator/slick/protocol/yahoo/yahoo.provider.slick.manifest.mf">
- <zipfileset dir="${dest}/net/java/sip/communicator/slick/protocol/yahoo"
- prefix="net/java/sip/communicator/slick/protocol/yahoo"/>
- <zipfileset src="${lib.noinst}/ymsg_network_v0_67.jar" prefix=""/>
- <zipfileset dir="${dest}/net/java/sip/communicator/slick/protocol/generic"
- prefix="net/java/sip/communicator/slick/protocol/generic"/>
- </jar>
- </target>
-
<!-- BUNDLE-GIBBERISH -->
<target name="bundle-gibberish">
<!-- Creates a bundle containing the Gibberish impl of the protocol provider.-->
@@ -1676,16 +1650,6 @@ javax.swing.event, javax.swing.border"/>
</jar>
</target>
- <!-- BUNDLE-PLUGIN-YAHOOACCREGWIZZ -->
- <target name="bundle-plugin-yahooaccregwizz">
- <!-- Creates a bundle for the plugin Yahoo Account Registration Wizard.-->
- <jar compress="false" destfile="${bundles.dest}/yahooaccregwizz.jar"
- manifest="${src}/net/java/sip/communicator/plugin/yahooaccregwizz/yahooaccregwizz.manifest.mf">
- <zipfileset dir="${dest}/net/java/sip/communicator/plugin/yahooaccregwizz"
- prefix="net/java/sip/communicator/plugin/yahooaccregwizz"/>
- </jar>
- </target>
-
<!-- BUNDLE-PLUGIN-SIPACCREGWIZZ -->
<target name="bundle-plugin-sipaccregwizz">
<!-- Creates a bundle for the plugin SIP Account Registration Wizard.-->
diff --git a/lib/accounts.properties.template b/lib/accounts.properties.template
index 3845c47..3b6b540 100644
--- a/lib/accounts.properties.template
+++ b/lib/accounts.properties.template
@@ -189,47 +189,6 @@ accounts.jabber.CONTACT_LIST=
# list of icq accounts to notify during testing (optional)
accounts.reporting.JABBER_REPORT_LIST=
-# YAHOO PROPERTIES
-
-# YAHOO ACCOUNT 1
-# The username needed to log onto the server
-accounts.yahoo.account1.USER_ID=
-
-# The password (in plain text) needed to log the user specified in USER_ID
-# on the server
-accounts.yahoo.account1.PASSWORD=
-
-# YAHOO ACCOUNT 2
-
-# The username needed to log onto the server
-accounts.yahoo.account2.USER_ID=
-
-# The password (in plain text) needed to log the user specified in USER_ID
-# on the server
-accounts.yahoo.account2.PASSWORD=
-
-# YAHOO ACCOUNT 3
-
-# The username needed to log onto the server
-accounts.yahoo.account3.USER_ID=
-
-# The password (in plain text) needed to log the user specified in USER_ID
-# on the server
-accounts.yahoo.account3.PASSWORD=
-
-# The following describes the contact list that we will store on the yahoo
-# server for the tested account implementation. The value of the CONTACT_LIST
-# property must be a space separated string containing elements each of which
-# is in the format: GroupName.UIN
-
-
-# VERY IMPORTANT!!! All other users in this contact list will be removed and
-# the contacts and contact groups enumerated beneath will be added instead
-accounts.yahoo.CONTACT_LIST=
-
-# list of yahoo accounts to notify during testing (optional)
-accounts.reporting.YAHOO_REPORT_LIST=
-
# GIBBERISH Account 1
# The username to create the first Gibberish account with.
accounts.gibberish.account1.USER_ID=gibacc1
diff --git a/lib/felix.client.run.properties b/lib/felix.client.run.properties
index 59951c3..ad9a08a 100644
--- a/lib/felix.client.run.properties
+++ b/lib/felix.client.run.properties
@@ -152,7 +152,6 @@ felix.auto.start.52= \
reference:file:sc-bundles/protocol-sip.jar \
reference:file:sc-bundles/smacklib.jar \
reference:file:sc-bundles/protocol-jabber.jar \
- reference:file:sc-bundles/protocol-yahoo.jar \
reference:file:sc-bundles/protocol-irc.jar \
reference:file:sc-bundles/reconnectplugin.jar
@@ -193,7 +192,6 @@ felix.auto.start.67= \
reference:file:sc-bundles/sipaccregwizz.jar \
reference:file:sc-bundles/jabberaccregwizz.jar \
reference:file:sc-bundles/googletalkaccregwizz.jar \
- reference:file:sc-bundles/yahooaccregwizz.jar \
reference:file:sc-bundles/ircaccregwizz.jar \
reference:file:sc-bundles/contacteventhandler.jar \
reference:file:sc-bundles/notificationconfig.jar \
diff --git a/lib/felix.unit.test.properties b/lib/felix.unit.test.properties
index 8c7cfa4..e8df121 100644
--- a/lib/felix.unit.test.properties
+++ b/lib/felix.unit.test.properties
@@ -141,7 +141,6 @@ felix.auto.start.60= \
reference:file:sc-bundles/neomedia.jar \
reference:file:sc-bundles/protocol-jabber.jar \
reference:file:sc-bundles/protocol-sip.jar \
- reference:file:sc-bundles/protocol-yahoo.jar \
reference:file:sc-bundles/protocol-mock.jar \
reference:file:sc-bundles/meta-cl.jar \
reference:file:sc-bundles/msghistory.jar \
@@ -165,7 +164,6 @@ felix.auto.start.70= \
reference:file:sc-bundles/meta-cl-slick.jar \
reference:file:sc-bundles/protocol-sip-slick.jar \
reference:file:sc-bundles/protocol-jabber-slick.jar \
- reference:file:sc-bundles/protocol-yahoo-slick.jar \
reference:file:sc-bundles/protocol-icq-slick.jar \
reference:file:sc-bundles/msghistory-slick.jar \
reference:file:sc-bundles/metahistory-slick.jar \
diff --git a/lib/installer-exclude/ymsg_network_v0_67.jar b/lib/installer-exclude/ymsg_network_v0_67.jar
deleted file mode 100644
index 998358a..0000000
--- a/lib/installer-exclude/ymsg_network_v0_67.jar
+++ /dev/null
Binary files differ
diff --git a/lib/jitsi-defaults.properties b/lib/jitsi-defaults.properties
index a132d7e..ff21e05 100644
--- a/lib/jitsi-defaults.properties
+++ b/lib/jitsi-defaults.properties
@@ -151,8 +151,6 @@ net.java.sip.communicator.plugin.pluginmanager.SYSTEM_BUNDLES=\
net.java.sip.communicator.version,\
net.java.sip.communicator.replacement.viddler,\
net.java.sip.communicator.replacement.vimeo,\
- net.java.sip.communicator.protocol.yahoo,\
- net.java.sip.communicator.plugin.yahooaccregwizz,\
net.java.sip.communicator.replacement.youtube,\
net.java.sip.communicator.libjitsi,\
net.java.sip.communicator.provdisc.mdns,\
diff --git a/lib/testing.properties b/lib/testing.properties
index 850a47c..7b5c1b8 100644
--- a/lib/testing.properties
+++ b/lib/testing.properties
@@ -35,10 +35,6 @@ net.java.sip.communicator.slick.runner.TEST_LIST=ConfigurationServiceLick \
# GenericProtocolProviderServiceLick because it does not add any tests.
#
# IcqProtocolProviderSlick because 2 of its 25 tests fail.
-#
-# Temporally disabling failing test
-# MsnProtocolProviderSlick
-# YahooProtocolProviderSlick
# define all the test classes that can be run standalone, or by the
diff --git a/m2/jitsi-protocol/pom.xml b/m2/jitsi-protocol/pom.xml
index d61a018..d97e083 100644
--- a/m2/jitsi-protocol/pom.xml
+++ b/m2/jitsi-protocol/pom.xml
@@ -64,7 +64,6 @@
<include>resources/images/protocol/googletalk/**</include>
<include>resources/images/protocol/icq/**</include>
<include>resources/images/protocol/jabber/**</include>
- <include>resources/images/protocol/yahoo/**</include>
</includes>
</configuration>
</plugin>
@@ -79,7 +78,6 @@
<include>resources/images/protocol/googletalk/**</include>
<include>resources/images/protocol/icq/**</include>
<include>resources/images/protocol/jabber/**</include>
- <include>resources/images/protocol/yahoo/**</include>
</includes>
</resource>
</resources>
diff --git a/resources/images/images.properties b/resources/images/images.properties
index 736cb54..643e9ca 100644
--- a/resources/images/images.properties
+++ b/resources/images/images.properties
@@ -411,13 +411,6 @@ service.systray.STATUS_MENU_ICON=resources/images/impl/systray/statusIcon.png
service.systray.QUIT_MENU_ICON=resources/images/impl/gui/common/quit16x16.png
service.systray.CONFIGURE_ICON=resources/images/impl/gui/common/configureIcon.png
-# dict protocol icons
-service.protocol.dict.DICT_16x16=resources/images/protocol/dict/dict-16x16.png
-service.protocol.dict.DICT_32x32=resources/images/protocol/dict/dict-32x32.png
-service.protocol.dict.DICT_48x48=resources/images/protocol/dict/dict-48x48.png
-service.protocol.dict.DICT_64x64=resources/images/protocol/dict/dict-64x64.png
-service.protocol.dict.OFFLINE_STATUS_ICON=resources/images/protocol/dict/dict-16x16-offline.png
-
# icq protocol icons
service.protocol.icq.ICQ_16x16=resources/images/protocol/icq/icq16x16-online.png
service.protocol.icq.ICQ_32x32=resources/images/protocol/icq/icq32x32.png
@@ -425,33 +418,6 @@ service.protocol.icq.ICQ_48x48=resources/images/protocol/icq/icq48x48.png
service.protocol.icq.ICQ_64x64=resources/images/protocol/icq/icq64x64.png
service.protocol.icq.CONNECTING=resources/images/protocol/icq/cr16-action-icq_connecting-1.gif
-# yahoo protocol icons
-service.protocol.yahoo.YAHOO_16x16=resources/images/protocol/yahoo/yahoo16x16.png
-service.protocol.yahoo.YAHOO_32x32=resources/images/protocol/yahoo/yahoo32x32.png
-service.protocol.yahoo.YAHOO_48x48=resources/images/protocol/yahoo/yahoo48x48.png
-service.protocol.yahoo.YAHOO_64x64=resources/images/protocol/yahoo/yahoo64x64.png
-
-# zeroconf protocol icons
-service.protocol.zeroconf.ZEROCONF_16x16=resources/images/protocol/zeroconf/zeroconf16x16.png
-service.protocol.zeroconf.ZEROCONF_32x32=resources/images/protocol/zeroconf/zeroconf32x32.png
-service.protocol.zeroconf.ZEROCONF_48x48=resources/images/protocol/zeroconf/zeroconf48x48.png
-service.protocol.zeroconf.ZEROCONF_64x64=resources/images/protocol/zeroconf/zeroconf64x64.png
-service.protocol.zeroconf.ONLINE_STATUS_ICON=resources/images/protocol/zeroconf/zeroconf-online.png
-service.protocol.zeroconf.OFFLINE_STATUS_ICON=resources/images/protocol/zeroconf/zeroconf-offline.png
-service.protocol.zeroconf.DND_STATUS_ICON=resources/images/protocol/zeroconf/zeroconf-dnd.png
-service.protocol.zeroconf.INVISIBLE_STATUS_ICON=resources/images/protocol/zeroconf/zeroconf-invisible.png
-
-# ssh protocol icons
-service.protocol.ssh.SSH_16x16=resources/images/protocol/ssh/ssh-online.png
-service.protocol.ssh.SSH_32x32=resources/images/protocol/ssh/ssh32x32.png
-service.protocol.ssh.SSH_48x48=resources/images/protocol/ssh/ssh48x48.png
-service.protocol.ssh.SSH_64x64=resources/images/protocol/ssh/ssh64x64.png
-service.protocol.ssh.OFFLINE_STATUS_ICON=resources/images/protocol/ssh/ssh-offline.png
-service.protocol.ssh.NA_STATUS_ICON=resources/images/protocol/ssh/ssh-na.png
-service.protocol.ssh.CONNECTING_ICON=resources/images/protocol/ssh/ssh-connecting.png
-service.protocol.ssh.CONNECTED_ICON=resources/images/protocol/ssh/ssh-connected.png
-service.protocol.ssh.FILE_TRANSFER_ICON=resources/images/protocol/ssh/ssh-filetransfer.png
-
# sip protocol icons
service.protocol.sip.SIP_16x16=resources/images/protocol/sip/sip16x16.png
service.protocol.sip.SIP_64x64=resources/images/protocol/sip/sip64x64.png
@@ -617,4 +583,4 @@ plugin.spellcheck.PERSONAL_DIR=resources/images/plugin/spellcheck/personalDictio
plugin.spellcheck.WORD_INCLUDE=resources/images/plugin/spellcheck/wordInclude.png
plugin.spellcheck.WORD_EXCLUDE=resources/images/plugin/spellcheck/wordExclude.png
plugin.spellcheck.ENABLE=resources/images/plugin/spellcheck/enableSpellchecker.png
-plugin.spellcheck.DISABLE=resources/images/plugin/spellcheck/disableSpellchecker.png \ No newline at end of file
+plugin.spellcheck.DISABLE=resources/images/plugin/spellcheck/disableSpellchecker.png
diff --git a/resources/images/protocol/dict/dict-16x16-offline.png b/resources/images/protocol/dict/dict-16x16-offline.png
deleted file mode 100755
index f450b04..0000000
--- a/resources/images/protocol/dict/dict-16x16-offline.png
+++ /dev/null
Binary files differ
diff --git a/resources/images/protocol/dict/dict-16x16.png b/resources/images/protocol/dict/dict-16x16.png
deleted file mode 100644
index 0c79371..0000000
--- a/resources/images/protocol/dict/dict-16x16.png
+++ /dev/null
Binary files differ
diff --git a/resources/images/protocol/dict/dict-32x32.png b/resources/images/protocol/dict/dict-32x32.png
deleted file mode 100644
index 8009db2..0000000
--- a/resources/images/protocol/dict/dict-32x32.png
+++ /dev/null
Binary files differ
diff --git a/resources/images/protocol/dict/dict-48x48.png b/resources/images/protocol/dict/dict-48x48.png
deleted file mode 100644
index 1a33a27..0000000
--- a/resources/images/protocol/dict/dict-48x48.png
+++ /dev/null
Binary files differ
diff --git a/resources/images/protocol/dict/dict-64x64.png b/resources/images/protocol/dict/dict-64x64.png
deleted file mode 100644
index 8230e15..0000000
--- a/resources/images/protocol/dict/dict-64x64.png
+++ /dev/null
Binary files differ
diff --git a/resources/images/protocol/ssh/ssh-connected.png b/resources/images/protocol/ssh/ssh-connected.png
deleted file mode 100644
index ac168e0..0000000
--- a/resources/images/protocol/ssh/ssh-connected.png
+++ /dev/null
Binary files differ
diff --git a/resources/images/protocol/ssh/ssh-connecting.png b/resources/images/protocol/ssh/ssh-connecting.png
deleted file mode 100644
index 5ae7f03..0000000
--- a/resources/images/protocol/ssh/ssh-connecting.png
+++ /dev/null
Binary files differ
diff --git a/resources/images/protocol/ssh/ssh-filetransfer.png b/resources/images/protocol/ssh/ssh-filetransfer.png
deleted file mode 100644
index 50eca81..0000000
--- a/resources/images/protocol/ssh/ssh-filetransfer.png
+++ /dev/null
Binary files differ
diff --git a/resources/images/protocol/ssh/ssh-na.png b/resources/images/protocol/ssh/ssh-na.png
deleted file mode 100644
index 90e5028..0000000
--- a/resources/images/protocol/ssh/ssh-na.png
+++ /dev/null
Binary files differ
diff --git a/resources/images/protocol/ssh/ssh-offline.png b/resources/images/protocol/ssh/ssh-offline.png
deleted file mode 100644
index c8c429a..0000000
--- a/resources/images/protocol/ssh/ssh-offline.png
+++ /dev/null
Binary files differ
diff --git a/resources/images/protocol/ssh/ssh-online.png b/resources/images/protocol/ssh/ssh-online.png
deleted file mode 100644
index e67f418..0000000
--- a/resources/images/protocol/ssh/ssh-online.png
+++ /dev/null
Binary files differ
diff --git a/resources/images/protocol/ssh/ssh32x32.png b/resources/images/protocol/ssh/ssh32x32.png
deleted file mode 100644
index c873cb5..0000000
--- a/resources/images/protocol/ssh/ssh32x32.png
+++ /dev/null
Binary files differ
diff --git a/resources/images/protocol/ssh/ssh48x48.png b/resources/images/protocol/ssh/ssh48x48.png
deleted file mode 100644
index a53f740..0000000
--- a/resources/images/protocol/ssh/ssh48x48.png
+++ /dev/null
Binary files differ
diff --git a/resources/images/protocol/ssh/ssh64x64.png b/resources/images/protocol/ssh/ssh64x64.png
deleted file mode 100644
index 2a62b39..0000000
--- a/resources/images/protocol/ssh/ssh64x64.png
+++ /dev/null
Binary files differ
diff --git a/resources/images/protocol/yahoo/yahoo16x16-away.png b/resources/images/protocol/yahoo/yahoo16x16-away.png
deleted file mode 100644
index fc853f0..0000000
--- a/resources/images/protocol/yahoo/yahoo16x16-away.png
+++ /dev/null
Binary files differ
diff --git a/resources/images/protocol/yahoo/yahoo16x16-busy.png b/resources/images/protocol/yahoo/yahoo16x16-busy.png
deleted file mode 100644
index 4f30abc..0000000
--- a/resources/images/protocol/yahoo/yahoo16x16-busy.png
+++ /dev/null
Binary files differ
diff --git a/resources/images/protocol/yahoo/yahoo16x16-connecting.gif b/resources/images/protocol/yahoo/yahoo16x16-connecting.gif
deleted file mode 100644
index 4f07cb7..0000000
--- a/resources/images/protocol/yahoo/yahoo16x16-connecting.gif
+++ /dev/null
Binary files differ
diff --git a/resources/images/protocol/yahoo/yahoo16x16-connecting.png b/resources/images/protocol/yahoo/yahoo16x16-connecting.png
deleted file mode 100644
index 189c45e..0000000
--- a/resources/images/protocol/yahoo/yahoo16x16-connecting.png
+++ /dev/null
Binary files differ
diff --git a/resources/images/protocol/yahoo/yahoo16x16-idle.png b/resources/images/protocol/yahoo/yahoo16x16-idle.png
deleted file mode 100644
index 2c81b77..0000000
--- a/resources/images/protocol/yahoo/yahoo16x16-idle.png
+++ /dev/null
Binary files differ
diff --git a/resources/images/protocol/yahoo/yahoo16x16-invisible.png b/resources/images/protocol/yahoo/yahoo16x16-invisible.png
deleted file mode 100644
index 8c8bc0c..0000000
--- a/resources/images/protocol/yahoo/yahoo16x16-invisible.png
+++ /dev/null
Binary files differ
diff --git a/resources/images/protocol/yahoo/yahoo16x16-lunch.png b/resources/images/protocol/yahoo/yahoo16x16-lunch.png
deleted file mode 100644
index 3cfa10f..0000000
--- a/resources/images/protocol/yahoo/yahoo16x16-lunch.png
+++ /dev/null
Binary files differ
diff --git a/resources/images/protocol/yahoo/yahoo16x16-na.png b/resources/images/protocol/yahoo/yahoo16x16-na.png
deleted file mode 100644
index 9a1f8ad..0000000
--- a/resources/images/protocol/yahoo/yahoo16x16-na.png
+++ /dev/null
Binary files differ
diff --git a/resources/images/protocol/yahoo/yahoo16x16-offline.png b/resources/images/protocol/yahoo/yahoo16x16-offline.png
deleted file mode 100644
index 851bb54..0000000
--- a/resources/images/protocol/yahoo/yahoo16x16-offline.png
+++ /dev/null
Binary files differ
diff --git a/resources/images/protocol/yahoo/yahoo16x16-online.png b/resources/images/protocol/yahoo/yahoo16x16-online.png
deleted file mode 100644
index eaea8e2..0000000
--- a/resources/images/protocol/yahoo/yahoo16x16-online.png
+++ /dev/null
Binary files differ
diff --git a/resources/images/protocol/yahoo/yahoo16x16-phone.png b/resources/images/protocol/yahoo/yahoo16x16-phone.png
deleted file mode 100644
index c037ad1..0000000
--- a/resources/images/protocol/yahoo/yahoo16x16-phone.png
+++ /dev/null
Binary files differ
diff --git a/resources/images/protocol/yahoo/yahoo16x16-vacation.png b/resources/images/protocol/yahoo/yahoo16x16-vacation.png
deleted file mode 100644
index 02e8b1f..0000000
--- a/resources/images/protocol/yahoo/yahoo16x16-vacation.png
+++ /dev/null
Binary files differ
diff --git a/resources/images/protocol/yahoo/yahoo16x16.png b/resources/images/protocol/yahoo/yahoo16x16.png
deleted file mode 100644
index eaea8e2..0000000
--- a/resources/images/protocol/yahoo/yahoo16x16.png
+++ /dev/null
Binary files differ
diff --git a/resources/images/protocol/yahoo/yahoo32x32.png b/resources/images/protocol/yahoo/yahoo32x32.png
deleted file mode 100644
index eed8b25..0000000
--- a/resources/images/protocol/yahoo/yahoo32x32.png
+++ /dev/null
Binary files differ
diff --git a/resources/images/protocol/yahoo/yahoo48x48.png b/resources/images/protocol/yahoo/yahoo48x48.png
deleted file mode 100644
index 132a990..0000000
--- a/resources/images/protocol/yahoo/yahoo48x48.png
+++ /dev/null
Binary files differ
diff --git a/resources/images/protocol/yahoo/yahoo64x64.png b/resources/images/protocol/yahoo/yahoo64x64.png
deleted file mode 100644
index 827133f..0000000
--- a/resources/images/protocol/yahoo/yahoo64x64.png
+++ /dev/null
Binary files differ
diff --git a/resources/images/protocol/zeroconf/zeroconf-away.png b/resources/images/protocol/zeroconf/zeroconf-away.png
deleted file mode 100644
index 8265d5a..0000000
--- a/resources/images/protocol/zeroconf/zeroconf-away.png
+++ /dev/null
Binary files differ
diff --git a/resources/images/protocol/zeroconf/zeroconf-dnd.png b/resources/images/protocol/zeroconf/zeroconf-dnd.png
deleted file mode 100644
index fa1b70b..0000000
--- a/resources/images/protocol/zeroconf/zeroconf-dnd.png
+++ /dev/null
Binary files differ
diff --git a/resources/images/protocol/zeroconf/zeroconf-invisible.png b/resources/images/protocol/zeroconf/zeroconf-invisible.png
deleted file mode 100644
index e3bd0cf..0000000
--- a/resources/images/protocol/zeroconf/zeroconf-invisible.png
+++ /dev/null
Binary files differ
diff --git a/resources/images/protocol/zeroconf/zeroconf-offline.png b/resources/images/protocol/zeroconf/zeroconf-offline.png
deleted file mode 100644
index de37240..0000000
--- a/resources/images/protocol/zeroconf/zeroconf-offline.png
+++ /dev/null
Binary files differ
diff --git a/resources/images/protocol/zeroconf/zeroconf-online.png b/resources/images/protocol/zeroconf/zeroconf-online.png
deleted file mode 100644
index be66b1b..0000000
--- a/resources/images/protocol/zeroconf/zeroconf-online.png
+++ /dev/null
Binary files differ
diff --git a/resources/images/protocol/zeroconf/zeroconf16x16.png b/resources/images/protocol/zeroconf/zeroconf16x16.png
deleted file mode 100644
index be66b1b..0000000
--- a/resources/images/protocol/zeroconf/zeroconf16x16.png
+++ /dev/null
Binary files differ
diff --git a/resources/images/protocol/zeroconf/zeroconf32x32.png b/resources/images/protocol/zeroconf/zeroconf32x32.png
deleted file mode 100644
index 58754b6..0000000
--- a/resources/images/protocol/zeroconf/zeroconf32x32.png
+++ /dev/null
Binary files differ
diff --git a/resources/images/protocol/zeroconf/zeroconf48x48.png b/resources/images/protocol/zeroconf/zeroconf48x48.png
deleted file mode 100644
index fbae916..0000000
--- a/resources/images/protocol/zeroconf/zeroconf48x48.png
+++ /dev/null
Binary files differ
diff --git a/resources/images/protocol/zeroconf/zeroconf64x64.png b/resources/images/protocol/zeroconf/zeroconf64x64.png
deleted file mode 100644
index 6db9d49..0000000
--- a/resources/images/protocol/zeroconf/zeroconf64x64.png
+++ /dev/null
Binary files differ
diff --git a/resources/install/debian/README.embedded-libraries b/resources/install/debian/README.embedded-libraries
index 036029f..6ecff8a 100644
--- a/resources/install/debian/README.embedded-libraries
+++ b/resources/install/debian/README.embedded-libraries
@@ -12,12 +12,6 @@ Jingle Nodes is an XMPP Extension that enable users to share and discover
P2P Media Relays that can be used to enable Voice and Video Chat via Jingle.
Reason: No Debian package.
-- jymsg http://jymsg9.sourceforge.net/
-This API provides a way for Java applications to connect and
-use the Yahoo Instant Messenger protocol.
-Damian Minkov from Jitsi team is contributor and has commit right in the project.
-Reason: No Debian package.
-
- OrangeExtensions http://ymasory.github.com/OrangeExtensions/
A pluggable jar containing stubs for the Apple Java Extensions.
Reason: No Debian package.
diff --git a/resources/install/debian/control-src.tmpl b/resources/install/debian/control-src.tmpl
index cc5f976..1bfcee4 100644
--- a/resources/install/debian/control-src.tmpl
+++ b/resources/install/debian/control-src.tmpl
@@ -92,7 +92,7 @@ Description: VoIP and Instant Messaging client
_APP_NAME_ is an application that allows you to do audio/video
conversations over the Internet through the SIP and XMPP/Jabber protocol,
as well as chat with your friends using some of the most popular instant
- messaging protocols such as SIP/SIMPLE, XMPP/Jabber, AIM/ICQ, Yahoo and others.
+ messaging protocols such as SIP/SIMPLE, XMPP/Jabber, AIM/ICQ and others.
Package: _PACKAGE_NAME_-jni
Replaces: libjitsi-jni (<< 415)
diff --git a/resources/install/debian/control.tmpl b/resources/install/debian/control.tmpl
index 135ad37..e722ff7 100644
--- a/resources/install/debian/control.tmpl
+++ b/resources/install/debian/control.tmpl
@@ -65,4 +65,4 @@ Description: VoIP and Instant Messaging client
_APP_NAME_ is an application that allows you to do audio/video
conversations over the Internet through the SIP and XMPP/Jabber protocol,
as well as chat with your friends using some of the most popular instant
- messaging protocols such as SIP/SIMPLE, XMPP/Jabber, AIM/ICQ, Yahoo and others.
+ messaging protocols such as SIP/SIMPLE, XMPP/Jabber, AIM/ICQ and others.
diff --git a/resources/install/debian/jitsi.1.tmpl b/resources/install/debian/jitsi.1.tmpl
index 5608d63..d09beb5 100644
--- a/resources/install/debian/jitsi.1.tmpl
+++ b/resources/install/debian/jitsi.1.tmpl
@@ -26,7 +26,7 @@ _PACKAGE_NAME_ \- the Java VoIP and Instant Messaging client
.\" respectively.
\fB_APP_NAME_\fP is an audio/video Internet phone and instant messenger
that supports some of the most popular instant messaging and telephony
-protocols such as SIP, Jabber, AIM/ICQ, Yahoo! Messenger, Bonjour, IRC
+protocols such as SIP, Jabber/XMPP, AIM/ICQ, IRC
and soon others like IAX.
.PP
.RI "An optional " uri-to-call " expression can be specified to start a call from the command-line. If _APP_NAME_ is already running then the call is handled by the running application, except when it is explicitly told to allow multiple instance launch."
diff --git a/resources/install/rpm/SPECS/jitsi.spec b/resources/install/rpm/SPECS/jitsi.spec
index 0d60ff7..c427c4d 100644
--- a/resources/install/rpm/SPECS/jitsi.spec
+++ b/resources/install/rpm/SPECS/jitsi.spec
@@ -5,9 +5,9 @@ Summary: Jitsi - Open Source Video Calls and Chat
Packager: Damian Minkov <damencho@jitsi.org>
Group: Applications/Internet
-License: GNU Lesser General Public License
+License: Apache License 2.0
URL: https://www.jitsi.org
-Source0: http://download.jitsi.org/jitsi/nightly/src/%{name}-src-%{version}-%{release}.zip
+Source0: https://download.jitsi.org/jitsi/nightly/src/%{name}-src-%{version}-%{release}.zip
BuildRoot: %{_topdir}/buildroot
AutoReqProv: no
@@ -21,8 +21,8 @@ Requires: java >= 0:1.6
%description
Jitsi (formerly SIP Communicator) is an audio/video and chat communicator
-that supports protocols such as SIP, XMPP/Jabber, AIM/ICQ, IRC,
-Yahoo! and many other useful features.
+that supports protocols such as SIP, XMPP/Jabber, AIM/ICQ, IRC
+and many other useful features.
%define debug_package %{nil}
diff --git a/resources/languages/resources.properties b/resources/languages/resources.properties
index 44f0c70..deea410 100644
--- a/resources/languages/resources.properties
+++ b/resources/languages/resources.properties
@@ -1356,12 +1356,6 @@ plugin.whiteboard.DESELECT=Deselect
plugin.whiteboard.DELETE=Delete
plugin.whiteboard.PROPERTIES=Properties
-# yahoo accregwizz
-plugin.yahooaccregwizz.PROTOCOL_NAME=Yahoo!
-plugin.yahooaccregwizz.PROTOCOL_DESCRIPTION=A protocol to connect and chat on the Yahoo! Service.
-plugin.yahooaccregwizz.USERNAME=Username:
-plugin.yahooaccregwizz.USERID_AND_PASSWORD=ID and Password
-
# zero accregwizz
plugin.zeroaccregwizz.PROTOCOL_NAME=Zeroconf
plugin.zeroaccregwizz.PROTOCOL_DESCRIPTION=The Zeroconf (Bonjour) service protocol.
@@ -1726,8 +1720,6 @@ Proxy support is currently experimental and only works with some protocols. \
Check out the table below for more details:
plugin.globalproxy.PROTOCOL_SUPPORT=<html><table> \
<tr><td></td><td> SOSCKS4/5 </td><td> SOSCKS4/5+Auth </td><td> HTTP </td><td> HTTP+Auth </td></tr>\
-<tr><td>Yahoo!</td><td>+</td><td>+</td><td>-</td><td>-</td></tr>\
-<tr><td>MSN</td><td>+</td><td>+</td><td>-</td><td>-</td></tr>\
<tr><td>XMPP</td><td>+</td><td>+</td><td>+</td><td>+</td></tr>\
<tr><td>ICQ/AIM</td><td>+</td><td>+</td><td>+</td><td>+</td></tr>\
</table></html>
diff --git a/src/net/java/sip/communicator/impl/googlecontacts/GoogleContactsEntryImpl.java b/src/net/java/sip/communicator/impl/googlecontacts/GoogleContactsEntryImpl.java
index d4d2ed5..cf42720 100644
--- a/src/net/java/sip/communicator/impl/googlecontacts/GoogleContactsEntryImpl.java
+++ b/src/net/java/sip/communicator/impl/googlecontacts/GoogleContactsEntryImpl.java
@@ -43,20 +43,14 @@ public class GoogleContactsEntryImpl
/**
* Google Talk protocol type.
*/
- private static final String YAHOO_PROTOCOL =
- "http://schemas.google.com/g/2005#YAHOO";
-
- /**
- * Google Talk protocol type.
- */
private static final String AIM_PROTOCOL =
"http://schemas.google.com/g/2005#AIM";
/**
* Google Talk protocol type.
*/
- private static final String MSN_PROTOCOL =
- "http://schemas.google.com/g/2005#MSN";
+ private static final String SKYPE_PROTOCOL =
+ "http://schemas.google.com/g/2005#SKYPE";
/**
* Google Talk protocol type.
@@ -432,17 +426,13 @@ public class GoogleContactsEntryImpl
{
proto = GoogleContactsEntry.IMProtocol.GOOGLETALK;
}
- else if(protocol.equals(YAHOO_PROTOCOL))
- {
- proto = GoogleContactsEntry.IMProtocol.YAHOO;
- }
else if(protocol.equals(AIM_PROTOCOL))
{
proto = GoogleContactsEntry.IMProtocol.AIM;
}
- else if(protocol.equals(MSN_PROTOCOL))
+ else if(protocol.equals(SKYPE_PROTOCOL))
{
- proto = GoogleContactsEntry.IMProtocol.MSN;
+ proto = GoogleContactsEntry.IMProtocol.SKYPE;
}
else if(protocol.equals(ICQ_PROTOCOL))
{
diff --git a/src/net/java/sip/communicator/impl/googlecontacts/GoogleContactsQuery.java b/src/net/java/sip/communicator/impl/googlecontacts/GoogleContactsQuery.java
index d33e4da..66ea7ad 100644
--- a/src/net/java/sip/communicator/impl/googlecontacts/GoogleContactsQuery.java
+++ b/src/net/java/sip/communicator/impl/googlecontacts/GoogleContactsQuery.java
@@ -279,14 +279,11 @@ public class GoogleContactsQuery
case ICQ:
imSubCat = ContactDetail.SubCategory.ICQ;
break;
- case YAHOO:
- imSubCat = ContactDetail.SubCategory.Yahoo;
- break;
case JABBER:
imSubCat = ContactDetail.SubCategory.Jabber;
break;
- case MSN:
- imSubCat = ContactDetail.SubCategory.MSN;
+ case SKYPE:
+ imSubCat = ContactDetail.SubCategory.Skype;
break;
case GOOGLETALK:
imSubCat = ContactDetail.SubCategory.GoogleTalk;
@@ -357,12 +354,6 @@ public class GoogleContactsQuery
OperationSetBasicTelephony.class,
ProtocolNames.JABBER);
break;
- case YAHOO:
- supportedOpSets.add(OperationSetBasicInstantMessaging.class);
- preferredProtocols.put(
- OperationSetBasicInstantMessaging.class,
- ProtocolNames.YAHOO);
- break;
default:
break;
}
diff --git a/src/net/java/sip/communicator/impl/gui/main/contactlist/contactsource/SourceUIContact.java b/src/net/java/sip/communicator/impl/gui/main/contactlist/contactsource/SourceUIContact.java
index 08aaf7e..1419416 100644
--- a/src/net/java/sip/communicator/impl/gui/main/contactlist/contactsource/SourceUIContact.java
+++ b/src/net/java/sip/communicator/impl/gui/main/contactlist/contactsource/SourceUIContact.java
@@ -709,11 +709,9 @@ public class SourceUIContact
case AIM:
case ICQ:
case Jabber:
- case MSN:
case Yahoo:
case Skype:
case GoogleTalk:
- case Facebook:
label = subCategory.value();
break;
default:
diff --git a/src/net/java/sip/communicator/impl/protocol/icq/icq.provider.manifest.mf b/src/net/java/sip/communicator/impl/protocol/icq/icq.provider.manifest.mf
index da47277..959ae6d 100644
--- a/src/net/java/sip/communicator/impl/protocol/icq/icq.provider.manifest.mf
+++ b/src/net/java/sip/communicator/impl/protocol/icq/icq.provider.manifest.mf
@@ -13,5 +13,4 @@ Import-Package: org.osgi.framework,
net.java.sip.communicator.service.dns,
net.java.sip.communicator.service.protocol,
net.java.sip.communicator.service.protocol.icqconstants,
- net.java.sip.communicator.service.protocol.aimconstants,
net.java.sip.communicator.service.protocol.event
diff --git a/src/net/java/sip/communicator/impl/protocol/yahoo/AbstractContactGroupYahooImpl.java b/src/net/java/sip/communicator/impl/protocol/yahoo/AbstractContactGroupYahooImpl.java
deleted file mode 100644
index 0514c16..0000000
--- a/src/net/java/sip/communicator/impl/protocol/yahoo/AbstractContactGroupYahooImpl.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Jitsi, the OpenSource Java VoIP and Instant Messaging client.
- *
- * Copyright @ 2015 Atlassian Pty Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.java.sip.communicator.impl.protocol.yahoo;
-
-import net.java.sip.communicator.service.protocol.*;
-
-/**
- * The Yahoo implementation of the service.protocol.ContactGroup interface. There
- * are two types of groups possible here. <tt>RootContactGroupYahooImpl</tt>
- * which is the root node of the ContactList itself and
- * <tt>ContactGroupYahooImpl</tt> which represents standard groups. The
- * reason for having those 2 is that generally, Yahoo groups may not contain
- * subgroups. A contact list on the other hand may not directly contain buddies.
- *
- *
- * The reason for having an abstract class is only - being able to esily
- * recognize our own (Yahoo) contacts.
- * @author Damian Minkov
- */
-public abstract class AbstractContactGroupYahooImpl
- implements ContactGroup
-{
-
-
-}
diff --git a/src/net/java/sip/communicator/impl/protocol/yahoo/AdHocChatRoomInvitationYahooImpl.java b/src/net/java/sip/communicator/impl/protocol/yahoo/AdHocChatRoomInvitationYahooImpl.java
deleted file mode 100644
index e849f6c..0000000
--- a/src/net/java/sip/communicator/impl/protocol/yahoo/AdHocChatRoomInvitationYahooImpl.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Jitsi, the OpenSource Java VoIP and Instant Messaging client.
- *
- * Copyright @ 2015 Atlassian Pty Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.java.sip.communicator.impl.protocol.yahoo;
-
-import net.java.sip.communicator.service.protocol.*;
-
-/**
- * The Yahoo implementation of the <tt>AdHocChatRoomInvitation</tt> interface.
- *
- * @author Rupert Burchardi
- * @author Valentin Martinet
- */
-public class AdHocChatRoomInvitationYahooImpl
- implements AdHocChatRoomInvitation
-{
- /**
- * Corresponding chat room instance.
- */
- private AdHocChatRoom chatRoom;
- /**
- * The name of the inviter
- */
- private String inviter;
-
- /**
- * The invitation reason.
- */
- private String reason;
-
-
- /**
- * Creates an instance of the <tt>ChatRoomInvitationMsnImpl</tt> by
- * specifying the targetChatRoom, the inviter, the reason.
- *
- * @param targetChatRoom The <tt>AdHocChatRoom</tt> for which the invitation
- * is
- * @param inviter The <tt>Contact</tt>, which sent the invitation
- * @param reason The Reason for the invitation
- */
- public AdHocChatRoomInvitationYahooImpl( AdHocChatRoom targetChatRoom,
- String inviter,
- String reason)
- {
- this.chatRoom = targetChatRoom;
- this.inviter = inviter;
- this.reason = reason;
- }
-
- /**
- * Returns the corresponding chat room.
- * @return The ad-hoc chat room
- */
- public AdHocChatRoom getTargetAdHocChatRoom()
- {
- return chatRoom;
- }
-
- /**
- * Returns the corresponding inviter.
- * @return The name of the inviter
- */
- public String getInviter()
- {
- return inviter;
- }
-
- /**
- * Returns the invitation reason.
- * @return the invitation reason
- */
- public String getReason()
- {
- return reason;
- }
-}
diff --git a/src/net/java/sip/communicator/impl/protocol/yahoo/AdHocChatRoomYahooImpl.java b/src/net/java/sip/communicator/impl/protocol/yahoo/AdHocChatRoomYahooImpl.java
deleted file mode 100644
index 2775f6f..0000000
--- a/src/net/java/sip/communicator/impl/protocol/yahoo/AdHocChatRoomYahooImpl.java
+++ /dev/null
@@ -1,581 +0,0 @@
-/*
- * Jitsi, the OpenSource Java VoIP and Instant Messaging client.
- *
- * Copyright @ 2015 Atlassian Pty Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.java.sip.communicator.impl.protocol.yahoo;
-
-import java.io.*;
-import java.util.*;
-
-import net.java.sip.communicator.service.protocol.*;
-import net.java.sip.communicator.service.protocol.event.*;
-import net.java.sip.communicator.util.*;
-import ymsg.network.*;
-
-/**
- * Represents a Yahoo ad-hoc chat room, where multiple chat users could
- * communicate in a many-to-many fashion.
- *
- * @author Rupert Burchardi
- * @author Valentin Martinet
- */
-public class AdHocChatRoomYahooImpl
- implements AdHocChatRoom
-{
- private static final Logger logger = Logger
- .getLogger(AdHocChatRoomYahooImpl.class);
-
- /**
- * Listeners that will be notified of changes in member status in the room
- * such as member joined, left or being kicked or dropped.
- */
- private Vector<AdHocChatRoomParticipantPresenceListener> memberListeners
- = new Vector<AdHocChatRoomParticipantPresenceListener>();
-
- /**
- * Listeners that will be notified every time a new message is received on
- * this ad-hoc chat room.
- */
- private Vector<AdHocChatRoomMessageListener> messageListeners
- = new Vector<AdHocChatRoomMessageListener>();
-
- /**
- * The protocol provider that created us
- */
- private ProtocolProviderServiceYahooImpl provider = null;
-
- /**
- * The operation set that created us.
- */
- private OperationSetAdHocMultiUserChatYahooImpl opSetMuc = null;
-
- /**
- * The list of participants of this chat room.
- */
- private Hashtable<String, Contact> participants
- = new Hashtable<String, Contact>();
-
- /**
- * The nickname of this chat room local user participant.
- */
- private String nickname;
-
- /**
- * The yahoo conference model of this ad-hoc chat room, its the
- * representation of an ad-hoc chat room in the lib for this protocol.
- */
- private YahooConference yahooConference = null;
-
- /**
- * Creates an instance of a chat room that has been.
- *
- * @param multiUserChat
- * MultiUserChat
- * @param provider
- * a reference to the currently valid jabber protocol provider.
- */
- public AdHocChatRoomYahooImpl( YahooConference multiUserChat,
- ProtocolProviderServiceYahooImpl provider)
- {
- this.yahooConference = multiUserChat;
- this.provider = provider;
- this.opSetMuc = (OperationSetAdHocMultiUserChatYahooImpl) provider
- .getOperationSet(OperationSetAdHocMultiUserChat.class);
- }
-
- /**
- * Registers <tt>listener</tt> so that it would receive events every time a
- * new message is received on this chat room.
- *
- * @param listener A <tt>MessageListener</tt> that would be notified every
- * time a new message is received on this chat room.
- */
- public void addMessageListener(AdHocChatRoomMessageListener listener)
- {
- synchronized (messageListeners)
- {
- if (!messageListeners.contains(listener))
- messageListeners.add(listener);
- }
- }
-
- /**
- * Removes <tt>listener</tt> so that it won't receive any further message
- * events from this room.
- *
- * @param listener The <tt>MessageListener</tt> to remove from this room
- */
- public void removeMessageListener(AdHocChatRoomMessageListener listener)
- {
- synchronized (messageListeners)
- {
- messageListeners.remove(listener);
- }
- }
-
- /**
- * Adds a listener that will be notified of changes in our status in the
- * room.
- *
- * @param listener A participant status listener.
- */
- public void addParticipantPresenceListener(
- AdHocChatRoomParticipantPresenceListener listener)
- {
- synchronized (memberListeners)
- {
- if (!memberListeners.contains(listener))
- memberListeners.add(listener);
- }
- }
-
- /**
- * Removes a listener that was being notified of changes in the status of
- * other chat room participants.
- *
- * @param listener A participant status listener.
- */
- public void removeParticipantPresenceListener(
- AdHocChatRoomParticipantPresenceListener listener)
- {
- synchronized (memberListeners)
- {
- memberListeners.remove(listener);
- }
- }
-
- /**
- * Create a Message instance for sending a simple text messages with default
- * (text/plain) content type and encoding.
- *
- * @param messageText
- * the string content of the message.
- * @return Message the newly created message
- */
- public Message createMessage(String messageText)
- {
- Message msg = new MessageYahooImpl(messageText,
- OperationSetBasicInstantMessaging.DEFAULT_MIME_TYPE,
- OperationSetBasicInstantMessaging.DEFAULT_MIME_ENCODING, null);
- return msg;
- }
-
- /**
- * Returns a <tt>List</tt> of <tt>Contact</tt>s corresponding to all members
- * currently participating in this room.
- *
- * @return a <tt>List</tt> of <tt>Contact</tt> corresponding to all room
- * members.
- */
- public List<Contact> getParticipants()
- {
- return new LinkedList<Contact>(participants.values());
- }
-
- /**
- * Updates the member list of the chat room.
- *
- */
- public void updateParticipantsList()
- {
- Iterator<?> it = yahooConference.getMembers().iterator();
-
- while (it.hasNext())
- {
- YahooUser user = (YahooUser) it.next();
- Contact contact;
- OperationSetPersistentPresenceYahooImpl presenceOpSet
- = (OperationSetPersistentPresenceYahooImpl) this
- .getParentProvider().getOperationSet(
- OperationSetPersistentPresence.class);
-
- contact = presenceOpSet.findContactByID(user.getId());
-
- if(!participants.containsKey(contact.getDisplayName()))
- {
- participants.put(contact.getDisplayName(), contact);
- }
- }
- }
-
- /**
- * Returns the identifier of this <tt>AdHocChatRoom</tt>.
- *
- * @return a <tt>String</tt> containing the identifier of this
- * <tt>AdHocChatRoom</tt>.
- */
- public String getIdentifier()
- {
- return yahooConference.getName();
- }
-
- /**
- * Returns the number of participants that are currently in this ad-hoc chat
- * room.
- *
- * @return the number of <tt>Contact</tt>s, currently participating in
- * this ad-hoc room.
- */
- public int getParticipantsCount()
- {
- return yahooConference.getMembers().size();
- }
-
- /**
- * Returns the name of this <tt>AdHocChatRoom</tt>.
- *
- * @return a <tt>String</tt> containing the name of this
- * <tt>AdHocChatRoom</tt>.
- */
- public String getName()
- {
- return yahooConference.getName();
- }
-
- /**
- * Returns the protocol provider service that created us.
- *
- * @return the protocol provider service that created us.
- */
- public ProtocolProviderService getParentProvider()
- {
- return provider;
- }
-
- /**
- * Returns the local user's nickname in the context of this chat room or
- * <tt>null</tt> if not currently joined.
- *
- * @return the nickname currently being used by the local user in the
- * context of the local ad-hoc chat room.
- */
-
- public String getUserNickname()
- {
- if(nickname == null)
- nickname = provider.getYahooSession().getLoginIdentity().getId();
-
- return nickname;
- }
-
- /**
- * Invites another user to this room. If we're not joined nothing will
- * happen.
- *
- * @param userAddress The identifier of the contact (email address or yahoo
- * id)
- * @param reason The invite reason, which is send to the invitee.
- */
- public void invite(String userAddress, String reason)
- {
- try
- {
- provider.getYahooSession().extendConference(yahooConference,
- userAddress, reason);
- }
- catch (IOException ioe)
- {
- if (logger.isDebugEnabled())
- logger.debug("Failed to invite the user: " + userAddress
- + " Error: " + ioe);
- }
- }
-
- /**
- * Indicates whether or not this chat room is corresponding to a server
- * channel. Note: Returns always <code>false</code>.
- *
- * @return Always <code>false</code> since system chat room can't be joined
- * with current yahoo library.
- */
- public boolean isSystem()
- {
- return false;
- }
-
- /**
- * Joins this chat room with the nickname of the local user so that the user
- * would start receiving events and messages for it.
- *
- * @throws OperationFailedException with the corresponding code if an error
- * occurs while joining the room.
- */
- public void join() throws OperationFailedException
- {
- this.nickname = provider.getAccountID().getUserID();
- try
- {
- provider.getYahooSession().acceptConferenceInvite(yahooConference);
-
- // We don't specify a reason.
- opSetMuc.fireLocalUserPresenceEvent(this,
- LocalUserAdHocChatRoomPresenceChangeEvent.LOCAL_USER_JOINED,
- null);
- }
- catch (Exception e)
- {
- if (logger.isDebugEnabled())
- logger.debug("Couldn't join the chat room: "
- + yahooConference.getName() + e);
- }
- }
-
- /**
- * Leave this chat room. Once this method is called, the user won't be
- * listed as a member of the chat room any more and no further chat events
- * will be delivered. Depending on the underlying protocol and
- * implementation leave() might cause the room to be destroyed if it has
- * been created by the local user.
- */
- public void leave()
- {
- try
- {
- provider.getYahooSession().leaveConference(yahooConference);
-
- Iterator< Map.Entry<String, Contact>> membersSet
- = participants.entrySet().iterator();
-
- while (membersSet.hasNext())
- {
- Map.Entry<String, Contact> memberEntry = membersSet.next();
- Contact participant = memberEntry.getValue();
-
- fireParticipantPresenceEvent(participant,
- AdHocChatRoomParticipantPresenceChangeEvent.CONTACT_LEFT,
- "Local user has left the chat room.");
- }
- }
- catch (IOException ioe)
- {
- if (logger.isDebugEnabled())
- logger.debug("Failed to leave the chat room: "
- + yahooConference.getName() + " Error: " + ioe);
- }
-
- participants.clear();
- }
-
- /**
- * Sends the <tt>message</tt> to the destination indicated by the
- * <tt>to</tt> contact.
- *
- * @param message The <tt>Message</tt> to send.
- * @throws OperationFailedException if the underlying stack is not
- * registered or initialized or if the chat room is not joined.
- */
- public void sendMessage(Message message) throws OperationFailedException
- {
- assertConnected();
-
- try
- {
- provider.getYahooSession().sendConferenceMessage(yahooConference,
- message.getContent());
-
- AdHocChatRoomMessageDeliveredEvent msgDeliveredEvt
- = new AdHocChatRoomMessageDeliveredEvent(
- this,
- new Date(),
- message,
- ChatRoomMessageDeliveredEvent.CONVERSATION_MESSAGE_DELIVERED);
-
- fireMessageEvent(msgDeliveredEvt);
- }
- catch (Exception e)
- {
- if (logger.isDebugEnabled())
- logger.debug("Failed to send a conference message.");
- }
- }
-
- /**
- * Notifies all interested listeners that a
- * <tt>AdHocChatRoomMessageDeliveredEvent</tt>,
- * <tt>AdHocChatRoomMessageReceivedEvent</tt> or a
- * <tt>AdHocChatRoomMessageDeliveryFailedEvent</tt> has been fired.
- * @param evt The specific event
- */
- public void fireMessageEvent(EventObject evt)
- {
- Iterator<AdHocChatRoomMessageListener> listeners = null;
- synchronized (messageListeners)
- {
- listeners = new ArrayList<AdHocChatRoomMessageListener>(
- messageListeners).iterator();
- }
-
- while (listeners.hasNext())
- {
- AdHocChatRoomMessageListener listener = listeners.next();
-
- if (evt instanceof AdHocChatRoomMessageDeliveredEvent)
- {
- listener.messageDelivered(
- (AdHocChatRoomMessageDeliveredEvent) evt);
- }
- else if (evt instanceof AdHocChatRoomMessageReceivedEvent)
- {
- listener.messageReceived(
- (AdHocChatRoomMessageReceivedEvent) evt);
- }
- else if (evt instanceof AdHocChatRoomMessageDeliveryFailedEvent)
- {
- listener.messageDeliveryFailed(
- (AdHocChatRoomMessageDeliveryFailedEvent) evt);
- }
- }
- }
-
- /**
- * Creates the corresponding AdHocChatRoomParticipantPresenceChangeEvent and
- * notifies all <tt>AdHocChatRoomParticipantPresenceListener</tt>s that a
- * Contact has joined or left this <tt>AdHocChatRoom</tt>.
- *
- * @param participant the <tt>Contact</tt> that this
- * @param eventID the identifier of the event
- * @param eventReason the reason of the event
- */
- public void fireParticipantPresenceEvent(Contact participant, String eventID,
- String eventReason)
- {
- AdHocChatRoomParticipantPresenceChangeEvent evt
- = new AdHocChatRoomParticipantPresenceChangeEvent(this,
- participant,
- eventID,
- eventReason);
-
- if (logger.isTraceEnabled())
- logger.trace("Will dispatch the following ChatRoom event: " + evt);
-
- Iterator<AdHocChatRoomParticipantPresenceListener> listeners = null;
- synchronized (memberListeners)
- {
- listeners = new ArrayList<AdHocChatRoomParticipantPresenceListener>
- (memberListeners).iterator();
- }
-
- while (listeners.hasNext())
- {
- AdHocChatRoomParticipantPresenceListener listener = listeners.next();
-
- listener.participantPresenceChanged(evt);
- }
- }
-
- /**
- * Finds the participant of this ad-hoc chat room corresponding to the
- * given address.
- *
- * @param address the address to search for.
- * @return the participant of this chat room corresponding to the given
- * nick name.
- */
- public Contact findParticipantForAddress(String address)
- {
- Iterator<Contact> participantsIter
- = this.participants.values().iterator();
-
- while (participantsIter.hasNext())
- {
- Contact contact = participantsIter.next();
-
- if (contact.getAddress().equals(address))
- {
- return contact;
- }
- }
-
- return null;
- }
-
- /**
- * Removes the specified ad-hoc chat room participant from the participants
- * list of this ad-hoc chat room.
- * @param participant The member, who should be removed from the ad-hoc chat room
- * participants list.
- */
- public void removeChatRoomParticipant(Contact participant)
- {
- if(participant == null)
- return;
-
- participants.remove(participant.getDisplayName());
-
- fireParticipantPresenceEvent(participant,
- AdHocChatRoomParticipantPresenceChangeEvent.CONTACT_LEFT, null);
- }
-
- /**
- * Adds a participant to the ad-hoc chat room participant list.
- * @param participant The participant, who should be added to the ad-hoc
- * chat room participant list.
- */
- public void addChatRoomParticipant(Contact participant)
- {
- if (participant == null)
- return;
-
- if (!participants.containsKey(participant.getDisplayName()))
- {
- participants.put(participant.getDisplayName(), participant);
-
- fireParticipantPresenceEvent(participant,
- AdHocChatRoomParticipantPresenceChangeEvent.CONTACT_JOINED,
- null);
- }
- }
-
- /**
- * Returns the yahoo conference model of this chat room.
- * @return The yahoo conference.
- */
- public YahooConference getYahooConference()
- {
- return yahooConference;
- }
-
- /**
- * Utility method throwing an exception if the stack is not properly
- * initialized.
- * @throws java.lang.IllegalStateException if the underlying stack is
- * not registered and initialized.
- */
- private void assertConnected() throws IllegalStateException
- {
- if (provider == null)
- throw new IllegalStateException(
- "The provider must be non-null and signed on the "
- +"service before being able to communicate.");
- if (!provider.isRegistered())
- throw new IllegalStateException(
- "The provider must be signed on the service before "
- +"being able to communicate.");
- }
-
- /**
- * Determines whether this chat room should be stored in the configuration
- * file or not. If the chat room is persistent it still will be shown after a
- * restart in the chat room list. A non-persistent chat room will be only in
- * the chat room list until the the program is running.
- *
- * @return true if this chat room is persistent, false otherwise
- */
- public boolean isPersistent()
- {
- return false;
- }
-}
diff --git a/src/net/java/sip/communicator/impl/protocol/yahoo/ContactGroupYahooImpl.java b/src/net/java/sip/communicator/impl/protocol/yahoo/ContactGroupYahooImpl.java
deleted file mode 100644
index 1f73aac..0000000
--- a/src/net/java/sip/communicator/impl/protocol/yahoo/ContactGroupYahooImpl.java
+++ /dev/null
@@ -1,445 +0,0 @@
-/*
- * Jitsi, the OpenSource Java VoIP and Instant Messaging client.
- *
- * Copyright @ 2015 Atlassian Pty Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.java.sip.communicator.impl.protocol.yahoo;
-
-import java.util.*;
-
-import net.java.sip.communicator.service.protocol.*;
-import ymsg.network.*;
-
-/**
- * The Yahoo implementation of the ContactGroup interface. Intances of this class
- * (contrary to <tt>RootContactGroupYahooImpl</tt>) may only contain buddies
- * and cannot have sub groups. Note that instances of this class only use the
- * corresponding smack source group for reading their names and only
- * initially fill their <tt>buddies</tt> <tt>java.util.List</tt> with
- * the ContactYahooImpl objects corresponding to those contained in the source
- * group at the moment it is being created. They would, however, never try to
- * sync or update their contents ulteriorly. This would have to be done through
- * the addContact()/removeContact() methods.
- * The content of buddies is created on creating of the group and when the smack
- * source group is changed.
- *
- * @author Damian Minkov
- * @author Emil Ivov
- */
-public class ContactGroupYahooImpl
- extends AbstractContactGroupYahooImpl
-{
- private final Map<String, Contact> buddies
- = new Hashtable<String, Contact>();
-
- private boolean isResolved = false;
-
- /**
- * The Yahoo Group corresponding to this contact group.
- */
- private YahooGroup yahooGroup = null;
-
- /**
- * a list that would always remain empty. We only use it so that we're able
- * to extract empty iterators
- */
- private final List<ContactGroup> dummyGroupsList
- = new LinkedList<ContactGroup>();
-
- private String tempId = null;
-
- private final ServerStoredContactListYahooImpl ssclCallback;
-
- /**
- * Creates an Yahoo group using the specified <tt>YahooGroup</tt> as
- * a source. The newly created group will always return the name of the
- * underlying RosterGroup and would thus automatically adapt to changes.
- * It would, however, not receive or try to poll for modifications of the
- * buddies it contains and would therefore have to be updated manually by
- * ServerStoredContactListImpl update will only be done if source group
- * is changed.
-
- * @param yahooGroup the Yahoo Group correspoinding to the group
- * @param groupMembers the group members that we should add to the group.
- * @param ssclCallback a callback to the server stored contact list
- * we're creating.
- * @param isResolved a boolean indicating whether or not the group has been
- * resolved against the server.
- */
- ContactGroupYahooImpl(
- YahooGroup yahooGroup,
- Vector<YahooUser> groupMembers,
- ServerStoredContactListYahooImpl ssclCallback,
- boolean isResolved)
- {
- this.yahooGroup = yahooGroup;
- this.isResolved = isResolved;
- this.ssclCallback = ssclCallback;
-
- for (YahooUser yahooUser : groupMembers)
- {
- //only add the contact if it doesn't already exist in some other
- //group. this would be necessary if Yahoo! one day start allowing
- //the same contact in more than one group, which is not quite
- //unlikely since most of the other protocols do it.
- if(ssclCallback.findContactByYahooUser(yahooUser) != null)
- {
- continue;
- }
-
-
- addContact(
- new ContactYahooImpl(yahooUser,ssclCallback, true, true));
- }
- }
-
- ContactGroupYahooImpl( String id,
- ServerStoredContactListYahooImpl ssclCallback)
- {
- this.tempId = id;
- this.isResolved = false;
- this.ssclCallback = ssclCallback;
- }
-
-
- /**
- * Returns the number of <tt>Contact</tt> members of this
- * <tt>ContactGroup</tt>
- *
- * @return an int indicating the number of <tt>Contact</tt>s,
- * members of this <tt>ContactGroup</tt>.
- */
- public int countContacts()
- {
- return buddies.size();
- }
-
- /**
- * Returns a reference to the root group which in Yahoo is the parent of
- * any other group since the protocol does not support subgroups.
- * @return a reference to the root group.
- */
- public ContactGroup getParentContactGroup()
- {
- return ssclCallback.getRootGroup();
- }
-
- /**
- * Adds the specified contact to the end of this group.
- * @param contact the new contact to add to this group
- */
- void addContact(ContactYahooImpl contact)
- {
- buddies.put(contact.getAddress().toLowerCase(), contact);
- }
-
-
- /**
- * Removes the specified contact from this contact group
- * @param contact the contact to remove.
- */
- void removeContact(ContactYahooImpl contact)
- {
- buddies.remove(contact.getAddress().toLowerCase());
- }
-
- /**
- * Returns an Iterator over all contacts, member of this
- * <tt>ContactGroup</tt>.
- *
- * @return a java.util.Iterator over all contacts inside this
- * <tt>ContactGroup</tt>. In case the group doesn't contain any
- * memebers it will return an empty iterator.
- */
- public Iterator<Contact> contacts()
- {
- return buddies.values().iterator();
- }
-
- /**
- * Returns the <tt>Contact</tt> with the specified address or
- * identifier.
- * @param id the addres or identifier of the <tt>Contact</tt> we are
- * looking for.
- * @return the <tt>Contact</tt> with the specified id or address.
- */
- public Contact getContact(String id)
- {
- return this.findContact(id);
- }
-
- /**
- * Returns the name of this group.
- * @return a String containing the name of this group.
- */
- public String getGroupName()
- {
- if(isResolved)
- return ServerStoredContactListYahooImpl
- .replaceIllegalChars(yahooGroup.getName());
- else
- return tempId;
- }
-
- /**
- * Determines whether the group may contain subgroups or not.
- *
- * @return always false since only the root group may contain subgroups.
- */
- public boolean canContainSubgroups()
- {
- return false;
- }
-
- /**
- * Returns the subgroup with the specified index (i.e. always null since
- * this group may not contain subgroups).
- *
- * @param index the index of the <tt>ContactGroup</tt> to retrieve.
- * @return always null
- */
- public ContactGroup getGroup(int index)
- {
- return null;
- }
-
- /**
- * Returns the subgroup with the specified name.
- * @param groupName the name of the <tt>ContactGroup</tt> to retrieve.
- * @return the <tt>ContactGroup</tt> with the specified index.
- */
- public ContactGroup getGroup(String groupName)
- {
- return null;
- }
-
- /**
- * Returns an empty iterator. Subgroups may only be present in the root
- * group.
- *
- * @return an empty iterator
- */
- public Iterator<ContactGroup> subgroups()
- {
- return dummyGroupsList.iterator();
- }
-
- /**
- * Returns the number of subgroups contained by this group, which is
- * always 0 since sub groups in the protocol may only be contained
- * by the root group - <tt>RootContactGroupImpl</tt>.
- * @return a 0 int.
- */
- public int countSubgroups()
- {
- return 0;
- }
-
- /**
- * Returns a hash code value for the object, which is actually the hashcode
- * value of the groupname.
- *
- * @return a hash code value for this ContactGroup.
- */
- @Override
- public int hashCode()
- {
- return getGroupName().hashCode();
- }
-
- /**
- * Indicates whether some other object is "equal to" this group.
- *
- * @param obj the reference object with which to compare.
- * @return <tt>true</tt> if this object is the same as the obj
- * argument; <tt>false</tt> otherwise.
- */
- @Override
- public boolean equals(Object obj)
- {
- if( obj == this )
- return true;
-
- if (obj == null
- || !(obj instanceof ContactGroupYahooImpl) )
- return false;
-
- if(!((ContactGroup)obj).getGroupName().equals(getGroupName()))
- return false;
-
- if(getProtocolProvider() != ((ContactGroup)obj).getProtocolProvider())
- return false;
-
- //since Yahoo does not support having two groups with the same name
- // at this point we could bravely state that the groups are the same
- // and not bother to compare buddies. (gotta check that though)
- return true;
- }
-
- /**
- * Returns the protocol provider that this group belongs to.
- * @return a reference to the ProtocolProviderService instance that this
- * ContactGroup belongs to.
- */
- public ProtocolProviderService getProtocolProvider()
- {
- return this.ssclCallback.getParentProvider();
- }
-
- /**
- * Returns a string representation of this group, in the form
- * YahooGroup.GroupName[size]{ buddy1.toString(), buddy2.toString(), ...}.
- * @return a String representation of the object.
- */
- @Override
- public String toString()
- {
- StringBuffer buff = new StringBuffer("YahooGroup.");
- buff.append(getGroupName());
- buff.append(", childContacts="+countContacts()+":[");
-
- Iterator<Contact> contacts = contacts();
- while (contacts.hasNext())
- {
- Contact contact = contacts.next();
- buff.append(contact.toString());
- if(contacts.hasNext())
- buff.append(", ");
- }
- return buff.append("]").toString();
- }
-
- /**
- * Returns the contact encapsulating with the spcieified name or
- * null if no such contact was found.
- *
- * @param id the id for the contact we're looking for.
- * @return the <tt>ContactYahooImpl</tt> corresponding to the specified
- * screnname or null if no such contact existed.
- */
- ContactYahooImpl findContact(String id)
- {
- if(id == null)
- return null;
- return (ContactYahooImpl)buddies.get(id.toLowerCase());
- }
-
- /**
- * Determines whether or not this contact group is being stored by the
- * server. Non persistent contact groups exist for the sole purpose of
- * containing non persistent contacts.
- * @return true if the contact group is persistent and false otherwise.
- */
- public boolean isPersistent()
- {
- return true;
- }
-
- /**
- * Returns null as no persistent data is required and the contact address is
- * sufficient for restoring the contact.
- * <p>
- * @return null as no such data is needed.
- */
- public String getPersistentData()
- {
- return null;
- }
-
- /**
- * Determines whether or not this contact group has been resolved against
- * the server. Unresolved group are used when initially loading a contact
- * list that has been stored in a local file until the presence operation
- * set has managed to retrieve all the contact list from the server and has
- * properly mapped contacts and groups to their corresponding on-line
- * buddies.
- * @return true if the contact has been resolved (mapped against a buddy)
- * and false otherwise.
- */
- public boolean isResolved()
- {
- return isResolved;
- }
-
- /**
- * Resolve this contact group against the specified group
- * @param yahooGroup the server stored group
- */
- @SuppressWarnings("unchecked") //jymsg legacy code
- void setResolved(YahooGroup yahooGroup)
- {
- if(isResolved)
- return;
-
- this.isResolved = true;
-
- this.yahooGroup = yahooGroup;
-
- Vector<YahooUser> contacts = yahooGroup.getMembers();
- for (YahooUser item : contacts)
- {
- ContactYahooImpl contact =
- ssclCallback.findContactById(item.getId());
- if(contact != null)
- {
- contact.setResolved(item);
-
- ssclCallback.fireContactResolved(this, contact);
- }
- else
- {
- ContactYahooImpl newContact =
- new ContactYahooImpl(item, ssclCallback, true, true);
- addContact(newContact);
-
- ssclCallback.fireContactAdded(this, newContact);
- }
- }
- }
-
- /**
- * Returns a <tt>String</tt> that uniquely represnets the group. In this we
- * use the name of the group as an identifier. This may cause problems
- * though, in clase the name is changed by some other application between
- * consecutive runs of the sip-communicator.
- *
- * @return a String representing this group in a unique and persistent
- * way.
- */
- public String getUID()
- {
- return getGroupName();
- }
-
- /**
- * The source group we are encapsulating
- * @return YahooGroup
- */
- YahooGroup getSourceGroup()
- {
- return yahooGroup;
- }
-
- /**
- * Change the source group
- * change the buddies
- *
- * @param newGroup YahooGroup
- */
- void setSourceGroup(YahooGroup newGroup)
- {
- this.yahooGroup = newGroup;
- }
-}
diff --git a/src/net/java/sip/communicator/impl/protocol/yahoo/ContactYahooImpl.java b/src/net/java/sip/communicator/impl/protocol/yahoo/ContactYahooImpl.java
deleted file mode 100644
index b23ee3d..0000000
--- a/src/net/java/sip/communicator/impl/protocol/yahoo/ContactYahooImpl.java
+++ /dev/null
@@ -1,397 +0,0 @@
-/*
- * Jitsi, the OpenSource Java VoIP and Instant Messaging client.
- *
- * Copyright @ 2015 Atlassian Pty Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.java.sip.communicator.impl.protocol.yahoo;
-
-import net.java.sip.communicator.service.protocol.*;
-import net.java.sip.communicator.service.protocol.yahooconstants.*;
-import net.java.sip.communicator.util.*;
-import ymsg.network.*;
-
-/**
- * The Yahoo implementation of the service.protocol.Contact interface.
- * @author Damian Minkov
- * @author Emil Ivov
- */
-public class ContactYahooImpl
- extends AbstractContact
-{
- private static final Logger logger =
- Logger.getLogger(ContactYahooImpl.class);
-
- private YahooUser contact = null;
- private byte[] image = null;
- private PresenceStatus status = YahooStatusEnum.OFFLINE;
- private ServerStoredContactListYahooImpl ssclCallback = null;
- private boolean isPersistent = false;
- private boolean isResolved = false;
- private boolean isVolatile = false;
-
- private String yahooID = null;
- private String id = null;
-
- private String statusMessage = null;
-
- /**
- * Creates an YahooContactImpl with custom yahooID
- * @param yahooID sets the contact Id if its different from the YahooUser id
- * @param contact the contact object that we will be encapsulating.
- * @param ssclCallback a reference to the ServerStoredContactListImpl
- * instance that created us.
- * @param isPersistent determines whether this contact is persistent or not.
- * @param isResolved specifies whether the contact has been resolved against
- * the server contact list
- */
- ContactYahooImpl(
- String yahooID,
- YahooUser contact,
- ServerStoredContactListYahooImpl ssclCallback,
- boolean isPersistent,
- boolean isResolved)
- {
- this.yahooID = yahooID;
-
- this.contact = contact;
- this.ssclCallback = ssclCallback;
- this.isPersistent = isPersistent;
- this.isResolved = isResolved;
-
- if(contact != null)
- id = contact.getId();
- else if(yahooID != null)
- id = YahooSession.getYahooUserID(yahooID);
- }
-
- /**
- * Creates an YahooContactImpl
- * @param contact the contact object that we will be encapsulating.
- * @param ssclCallback a reference to the ServerStoredContactListImpl
- * instance that created us.
- * @param isPersistent determines whether this contact is persistent or not.
- * @param isResolved specifies whether the contact has been resolved against
- * the server contact list
- */
- ContactYahooImpl(
- YahooUser contact,
- ServerStoredContactListYahooImpl ssclCallback,
- boolean isPersistent,
- boolean isResolved)
- {
- this(null, contact, ssclCallback, isPersistent, isResolved);
- }
-
- /**
- * Creates volatile or unresolved contact
- */
- ContactYahooImpl(
- String id,
- ServerStoredContactListYahooImpl ssclCallback,
- boolean isResolved,
- boolean isPersistent,
- boolean isVolatile)
- {
- this.yahooID = id;
- this.ssclCallback = ssclCallback;
- this.isPersistent = isPersistent;
- this.isResolved = isResolved;
- this.isVolatile = isVolatile;
-
- if(id != null)
- this.id = YahooSession.getYahooUserID(yahooID);
- }
-
- /**
- * Returns the Yahoo Userid of this contact
- * @return the Yahoo Userid of this contact
- */
- public String getAddress()
- {
- // if the contact is volatile or with custom id return it
- if(yahooID != null)
- return yahooID;
- // otherwise return the supplied contact id
- else
- return contact.getId();
- }
-
- /**
- * Returns the custom yahooID if set
- */
- String getYahooID()
- {
- return yahooID;
- }
-
- /**
- * Returns the contact Id.
- * If contact missing the yahooID without @yahoo.com part is returned
- */
- String getID()
- {
- return id;
- }
-
- /**
- * Returns whether the contact is volatile.
- */
- boolean isVolatile()
- {
- return isVolatile;
- }
-
- /**
- * Returns an avatar if one is already present or <tt>null</tt> in case it
- * is not in which case it the method also queues the contact for image
- * updates.
- *
- * @return the avatar of this contact or <tt>null</tt> if no avatar is
- * currently available.
- */
- public byte[] getImage()
- {
- return getImage(true);
- }
-
- /**
- * Returns a reference to the image assigned to this contact. If no image
- * is present and the retrieveIfNecessary flag is true, we schedule the
- * image for retrieval from the server.
- *
- * @param retrieveIfNecessary specifies whether the method should queue
- * this contact for avatar update from the server.
- *
- * @return a reference to the image currently stored by this contact.
- */
- public byte[] getImage(boolean retrieveIfNecessary)
- {
- try
- {
- if(retrieveIfNecessary)
- {
- if(ssclCallback.getParentProvider() == null
- || !ssclCallback.getParentProvider().isRegistered())
- {
- throw new IllegalStateException(
- "The provider must be signed on the service before "
- +"being able to communicate.");
- }
-
- YahooSession ses = ssclCallback.getParentProvider().
- getYahooSession();
- if(image == null && ses != null)
- ses.requestPicture(id);
- }
- }
- catch (Exception e)
- {
- if (logger.isInfoEnabled())
- logger.info("Error requesting image!", e);
- }
-
- if(logger.isDebugEnabled())
- logger.debug("returning picture " + image);
-
- return image;
- }
-
- /**
- * Used to set the image of the contact if it is updated
- *
- * @param image a photo/avatar associated with this contact.
- */
- protected void setImage(byte[] image)
- {
- if (logger.isInfoEnabled())
- logger.info("setting image " + image);
-
- this.image = image;
- }
-
- /**
- * Returns a string representation of this contact, containing most of its
- * representative details.
- *
- * @return a string representation of this contact.
- */
- @Override
- public String toString()
- {
- StringBuffer buff = new StringBuffer("YahooContact[ id=");
- buff.append(getAddress()).append("]");
-
- return buff.toString();
- }
-
- /**
- * Sets the status that this contact is currently in. The method is to
- * only be called as a result of a status update received from the server.
- *
- * @param status the YahooStatusEnum that this contact is currently in.
- */
- void updatePresenceStatus(PresenceStatus status)
- {
- this.status = status;
- }
-
- /**
- * Returns the status of the contact as per the last status update we've
- * received for it. Note that this method is not to perform any network
- * operations and will simply return the status received in the last
- * status update message. If you want a reliable way of retrieving someone's
- * status, you should use the <tt>queryContactStatus()</tt> method in
- * <tt>OperationSetPresence</tt>.
- * @return the PresenceStatus that we've received in the last status update
- * pertaining to this contact.
- */
- public PresenceStatus getPresenceStatus()
- {
- return status;
- }
-
- /**
- * Returns a String that could be used by any user interacting modules for
- * referring to this contact. An alias is not necessarily unique but is
- * often more human readable than an address (or id).
- * @return a String that can be used for referring to this contact when
- * interacting with the user.
- */
- public String getDisplayName()
- {
- return getAddress();
- }
-
- /**
- * Returns a reference to the contact group that this contact is currently
- * a child of or null if the underlying protocol does not suppord persistent
- * presence.
- * @return a reference to the contact group that this contact is currently
- * a child of or null if the underlying protocol does not suppord persistent
- * presence.
- */
- public ContactGroup getParentContactGroup()
- {
- return ssclCallback.findContactGroup(this);
- }
-
-
- /**
- * Returns a reference to the protocol provider that created the contact.
- * @return a refererence to an instance of the ProtocolProviderService
- */
- public ProtocolProviderService getProtocolProvider()
- {
- return ssclCallback.getParentProvider();
- }
-
- /**
- * Determines whether or not this contact is being stored by the server.
- * Non persistent contacts are common in the case of simple, non-persistent
- * presence operation sets. They could however also be seen in persistent
- * presence operation sets when for example we have received an event
- * from someone not on our contact list. Non persistent contacts are
- * volatile even when coming from a persistent presence op. set. They would
- * only exist until the application is closed and will not be there next
- * time it is loaded.
- * @return true if the contact is persistent and false otherwise.
- */
- public boolean isPersistent()
- {
- return isPersistent;
- }
-
- /**
- * Specifies whether this contact is to be considered persistent or not. The
- * method is to be used _only_ when a non-persistent contact has been added
- * to the contact list and its encapsulated VolatileBuddy has been repalced
- * with a standard buddy.
- * @param persistent true if the buddy is to be considered persistent and
- * false for volatile.
- */
- void setPersistent(boolean persistent)
- {
- this.isPersistent = persistent;
- }
-
- /**
- * Resolve this contact against the given entry
- * @param entry the server stored entry
- */
- void setResolved(YahooUser entry)
- {
- if(isResolved)
- return;
-
- this.isResolved = true;
- contact = entry;
- isVolatile = false;
- }
-
- /**
- * Returns the persistent data
- * @return the persistent data
- */
- public String getPersistentData()
- {
- return null;
- }
-
- /**
- * Determines whether or not this contact has been resolved against the
- * server. Unresolved contacts are used when initially loading a contact
- * list that has been stored in a local file until the presence operation
- * set has managed to retrieve all the contact list from the server and has
- * properly mapped contacts to their on-line buddies.
- * @return true if the contact has been resolved (mapped against a buddy)
- * and false otherwise.
- */
- public boolean isResolved()
- {
- return isResolved;
- }
-
- public void setPersistentData(String persistentData)
- {
- }
-
- /**
- * Get source contact
- * @return YahooContact
- */
- YahooUser getSourceContact()
- {
- return contact;
- }
-
- /**
- * Return the current status message of this contact.
- *
- * @return the current status message
- */
- public String getStatusMessage()
- {
- return statusMessage;
- }
-
- /**
- * Sets the current status message for this contact
- * @param statusMessage the message
- */
- protected void setStatusMessage(String statusMessage)
- {
- this.statusMessage = statusMessage;
- }
-}
diff --git a/src/net/java/sip/communicator/impl/protocol/yahoo/FileTransferImpl.java b/src/net/java/sip/communicator/impl/protocol/yahoo/FileTransferImpl.java
deleted file mode 100644
index 3f42079..0000000
--- a/src/net/java/sip/communicator/impl/protocol/yahoo/FileTransferImpl.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * Jitsi, the OpenSource Java VoIP and Instant Messaging client.
- *
- * Copyright @ 2015 Atlassian Pty Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.java.sip.communicator.impl.protocol.yahoo;
-
-import java.io.*;
-
-import net.java.sip.communicator.service.protocol.*;
-
-/**
- * The Filetransfer imeplementation for yahoo.
- * @author Damian Minkov
- */
-public class FileTransferImpl
- extends AbstractFileTransfer
-
-{
- private ProtocolProviderServiceYahooImpl yahooProvider;
- private String id = null;
- private Contact contact = null;
- private File file = null;
- private int direction = -1;
- private long transferedBytes;
-
- public FileTransferImpl(ProtocolProviderServiceYahooImpl yahooProvider,
- String id, Contact contact, File file, int direction)
- {
- this.yahooProvider = yahooProvider;
- this.id = id;
- this.contact = contact;
- this.file = file;
- this.direction = direction;
- }
-
- /**
- * Cancels this file transfer. When this method is called transfer should
- * be interrupted.
- */
- @Override
- public void cancel()
- {
- yahooProvider.getYahooSession().cancelRunningFileTransfer(id);
- }
-
- /**
- * Returns the number of bytes already transfered through this file transfer.
- *
- * @return the number of bytes already transfered through this file transfer
- */
- @Override
- public long getTransferedBytes()
- {
- return transferedBytes;
- }
-
- /**
- * Uniquie ID that is identifying the FileTransfer
- * if the request has been accepted.
- *
- * @return the id.
- */
- public String getID()
- {
- return id;
- }
-
- /**
- * The file transfer direction.
- * @return returns the direction of the file transfer : IN or OUT.
- */
- public int getDirection()
- {
- return direction;
- }
-
- /**
- * Returns the file that is transfered.
- *
- * @return the file
- */
- public File getLocalFile()
- {
- return file;
- }
-
- /**
- * Returns the contact that we are transfering files with.
- * @return the contact.
- */
- public Contact getContact()
- {
- return contact;
- }
-
- /**
- * @param transferedBytes the transferedBytes to set
- */
- public void setTransferedBytes(long transferedBytes)
- {
- this.transferedBytes = transferedBytes;
- }
-
-}
diff --git a/src/net/java/sip/communicator/impl/protocol/yahoo/IncomingFileTransferRequestYahooImpl.java b/src/net/java/sip/communicator/impl/protocol/yahoo/IncomingFileTransferRequestYahooImpl.java
deleted file mode 100644
index 25561d0..0000000
--- a/src/net/java/sip/communicator/impl/protocol/yahoo/IncomingFileTransferRequestYahooImpl.java
+++ /dev/null
@@ -1,190 +0,0 @@
-/*
- * Jitsi, the OpenSource Java VoIP and Instant Messaging client.
- *
- * Copyright @ 2015 Atlassian Pty Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.java.sip.communicator.impl.protocol.yahoo;
-
-import java.io.*;
-import java.util.*;
-
-import net.java.sip.communicator.service.protocol.*;
-import net.java.sip.communicator.service.protocol.event.*;
-
-/**
- * Implementation of the incoming file transfer request.
- *
- * @author Damian Minkov
- */
-public class IncomingFileTransferRequestYahooImpl
- implements IncomingFileTransferRequest
-{
- private String id;
-
- /**
- * The yahoo provider.
- */
- private ProtocolProviderServiceYahooImpl yahooProvider;
-
- private final OperationSetFileTransferYahooImpl fileTransferOpSet;
-
- private Contact sender;
-
- private Date date;
-
- private String fileName;
-
- private long fileSize;
-
- public IncomingFileTransferRequestYahooImpl(
- ProtocolProviderServiceYahooImpl yahooProvider,
- OperationSetFileTransferYahooImpl fileTransferOpSet,
- Contact sender,
- Date date,
- String fileName,
- String fileSize,
- String id)
- {
- this.yahooProvider = yahooProvider;
- this.fileTransferOpSet = fileTransferOpSet;
- this.sender = sender;
- this.date = date;
- this.fileName = fileName;
-
- try
- {
- this.fileSize = Long.valueOf(fileSize);
- }
- catch (NumberFormatException e)
- {}
-
- this.id = id;
- }
-
- /**
- * Unique ID that is identifying the request and then the FileTransfer
- * if the request has been accepted.
- *
- * @return the id.
- */
- public String getID()
- {
- return id;
- }
-
- /**
- * Returns a String that represents the name of the file that is being
- * received.
- * If there is no name, returns null.
- * @return a String that represents the name of the file
- */
- public String getFileName()
- {
- return fileName;
- }
-
- /**
- * Returns a String that represents the description of the file that is
- * being received.
- * If there is no description available, returns null.
- *
- * @return a String that represents the description of the file
- */
- public String getFileDescription()
- {
- return "";
- }
-
- /**
- * Returns a long that represents the size of the file that is being
- * received.
- * If there is no file size available, returns null.
- *
- * @return a long that represents the size of the file
- */
- public long getFileSize()
- {
- return fileSize;
- }
-
- /**
- * Returns a String that represents the name of the sender of the file
- * being received.
- * If there is no sender name available, returns null.
- *
- * @return a String that represents the name of the sender
- */
- public Contact getSender()
- {
- return sender;
- }
-
- /**
- * Function called to accept and receive the file.
- *
- * @param file the file to accept
- * @return the <tt>FileTransfer</tt> object managing the transfer
- */
- public FileTransfer acceptFile(File file)
- {
- AbstractFileTransfer incomingTransfer = null;
-
- incomingTransfer =
- new FileTransferImpl(yahooProvider,
- id, sender, file, FileTransfer.IN);
-
- yahooProvider.getYahooSession().fileTransferAccept(id, file);
-
- FileTransferCreatedEvent event
- = new FileTransferCreatedEvent(incomingTransfer, new Date());
-
- fileTransferOpSet.fireFileTransferCreated(event);
-
- incomingTransfer.fireStatusChangeEvent(
- FileTransferStatusChangeEvent.PREPARING);
-
- return incomingTransfer;
- }
-
- /**
- * Function called to refuse the file.
- */
- public void rejectFile()
- {
- yahooProvider.getYahooSession().fileTransferReject(id);
-
- fileTransferOpSet.fireFileTransferRequestRejected(
- new FileTransferRequestEvent(
- fileTransferOpSet, this, this.getDate()));
- }
-
- /**
- * @return the date
- */
- public Date getDate()
- {
- return date;
- }
-
- /**
- * Returns the thumbnail contained in this request.
- *
- * @return the thumbnail contained in this request
- */
- public byte[] getThumbnail()
- {
- return null;
- }
-}
diff --git a/src/net/java/sip/communicator/impl/protocol/yahoo/MessageYahooImpl.java b/src/net/java/sip/communicator/impl/protocol/yahoo/MessageYahooImpl.java
deleted file mode 100644
index e35a3c1..0000000
--- a/src/net/java/sip/communicator/impl/protocol/yahoo/MessageYahooImpl.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Jitsi, the OpenSource Java VoIP and Instant Messaging client.
- *
- * Copyright @ 2015 Atlassian Pty Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.java.sip.communicator.impl.protocol.yahoo;
-
-import net.java.sip.communicator.service.protocol.*;
-
-/**
- * A simple implementation of the <tt>Message</tt> interface. Right now the
- * message only supports test contents and no binary data.
- *
- * @author Damian Minkov
- * @author Lubomir Marinov
- */
-public class MessageYahooImpl
- extends AbstractMessage
-{
-
- /**
- * Creates an instance of this Message with the specified parameters.
- *
- * @param content the text content of the message.
- * @param contentType a MIME string indicating the content type of the
- * <tt>content</tt> String.
- * @param contentEncoding a MIME String indicating the content encoding of
- * the <tt>content</tt> String.
- * @param subject the subject of the message or null for empty.
- */
- public MessageYahooImpl(String content, String contentType,
- String contentEncoding, String subject)
- {
- super(content, contentType, contentEncoding, subject);
- }
-}
diff --git a/src/net/java/sip/communicator/impl/protocol/yahoo/OperationSetAdHocMultiUserChatYahooImpl.java b/src/net/java/sip/communicator/impl/protocol/yahoo/OperationSetAdHocMultiUserChatYahooImpl.java
deleted file mode 100644
index dd5f73f..0000000
--- a/src/net/java/sip/communicator/impl/protocol/yahoo/OperationSetAdHocMultiUserChatYahooImpl.java
+++ /dev/null
@@ -1,714 +0,0 @@
-/*
- * Jitsi, the OpenSource Java VoIP and Instant Messaging client.
- *
- * Copyright @ 2015 Atlassian Pty Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.java.sip.communicator.impl.protocol.yahoo;
-
-import java.io.*;
-import java.util.*;
-
-import net.java.sip.communicator.service.protocol.*;
-import net.java.sip.communicator.service.protocol.event.*;
-import net.java.sip.communicator.util.*;
-import ymsg.network.*;
-import ymsg.network.event.*;
-
-/**
- * A Yahoo implementation of the ad-hoc multi user chat operation set.
- *
- * @author Rupert Burchardi
- * @author Valentin Martinet
- * @author Yana Stamcheva
- */
-public class OperationSetAdHocMultiUserChatYahooImpl
-implements OperationSetAdHocMultiUserChat
-{
- private static final Logger logger =
- Logger.getLogger(OperationSetAdHocMultiUserChatYahooImpl.class);
-
- /**
- * A list of listeners subscribed for invitations multi user chat events.
- */
- private final List<AdHocChatRoomInvitationListener> invitationListeners
- = new Vector<AdHocChatRoomInvitationListener>();
-
- /**
- * A list of listeners subscribed for events indicating rejection of a multi
- * user chat invitation sent by us.
- */
- private final List<AdHocChatRoomInvitationRejectionListener>
- invitationRejectionListeners
- = new Vector<AdHocChatRoomInvitationRejectionListener>();
-
- /**
- * Listeners that will be notified of changes in our status in the room such
- * as us being kicked, banned, or granted admin permissions.
- */
- private final List<LocalUserAdHocChatRoomPresenceListener> presenceListeners
- = new Vector<LocalUserAdHocChatRoomPresenceListener>();
-
- /**
- * A list of the rooms that are currently open by this account.
- */
- private final Hashtable<String, AdHocChatRoomYahooImpl> chatRoomCache
- = new Hashtable<String, AdHocChatRoomYahooImpl>();
-
- /**
- * The currently valid Yahoo protocol provider service implementation.
- */
- private final ProtocolProviderServiceYahooImpl yahooProvider;
-
- /**
- * The operation set for the basic instant messaging, provides some message
- * format functions.
- */
- private final OperationSetBasicInstantMessagingYahooImpl opSetBasic;
-
- /**
- * Instantiates the user operation set with a currently valid instance of
- * the Yahoo protocol provider.
- *
- * @param yahooProvider a currently valid instance of
- * ProtocolProviderServiceYahooImpl.
- */
- OperationSetAdHocMultiUserChatYahooImpl(
- ProtocolProviderServiceYahooImpl yahooProvider)
- {
- this.yahooProvider = yahooProvider;
-
- yahooProvider
- .addRegistrationStateChangeListener(new RegistrationStateListener());
-
- opSetBasic =
- (OperationSetBasicInstantMessagingYahooImpl) yahooProvider
- .getOperationSet(OperationSetBasicInstantMessaging.class);
- }
-
- /**
- * Adds a listener to invitation notifications.
- *
- * @param listener An invitation listener.
- */
- public void addInvitationListener(AdHocChatRoomInvitationListener listener)
- {
- synchronized (invitationListeners)
- {
- if (!invitationListeners.contains(listener))
- invitationListeners.add(listener);
- }
- }
-
- /**
- * Removes a listener that was being notified of changes in our status in a
- * room such as us being kicked, banned or dropped.
- *
- * @param listener the <tt>LocalUserAdHocChatRoomPresenceListener</tt>.
- */
- public void removeInvitationListener(
- AdHocChatRoomInvitationListener listener)
- {
- synchronized (invitationListeners)
- {
- invitationListeners.remove(listener);
- }
- }
-
- /**
- * Subscribes <tt>listener</tt> so that it would receive events indicating
- * rejection of a multi user chat invitation that we've sent earlier.
- *
- * @param listener the listener that we'll subscribe for invitation
- * rejection events.
- */
-
- public void addInvitationRejectionListener(
- AdHocChatRoomInvitationRejectionListener listener)
- {
- synchronized (invitationRejectionListeners)
- {
- if (!invitationRejectionListeners.contains(listener))
- invitationRejectionListeners.add(listener);
- }
- }
-
- /**
- * Removes <tt>listener</tt> from the list of invitation listeners
- * registered to receive invitation rejection events.
- *
- * @param listener the invitation listener to remove.
- */
- public void removeInvitationRejectionListener(
- AdHocChatRoomInvitationRejectionListener listener)
- {
- synchronized (invitationRejectionListeners)
- {
- invitationRejectionListeners.remove(listener);
- }
- }
-
- /**
- * Adds a listener that will be notified of changes in our status in a chat
- * room such as us being kicked, banned or dropped.
- *
- * @param listener the <tt>LocalUserAdHocChatRoomPresenceListener</tt>.
- */
- public void addPresenceListener(
- LocalUserAdHocChatRoomPresenceListener listener)
- {
- synchronized (presenceListeners)
- {
- if (!presenceListeners.contains(listener))
- presenceListeners.add(listener);
- }
- }
-
- /**
- * Removes a listener that was being notified of changes in our status in a
- * room such as us being kicked, banned or dropped.
- *
- * @param listener the <tt>LocalUserChatRoomPresenceListener</tt>.
- */
- public void removePresenceListener(
- LocalUserAdHocChatRoomPresenceListener listener)
- {
- synchronized (presenceListeners)
- {
- presenceListeners.remove(listener);
- }
- }
-
- /**
- * Creates a room with the named <tt>roomName</tt> and according to the
- * specified <tt>roomProperties</tt> on the server that this protocol
- * provider is currently connected to. Note the roomProperties also contain
- * users that we like to invite to the chatRoom, this is required in the
- * yahoo protocol.
- *
- * @param roomName the name of the <tt>AdHocChatRoom</tt> to create.
- * @param roomProperties properties specifying how the room should be
- * created.
- *
- * @throws OperationFailedException if the room couldn't be created for some
- * reason (e.g. room already exists; user already joined to an
- * existent room or user has no permissions to create a chat
- * room).
- *
- * @return ChatRoom the chat room that we've just created.
- */
- public AdHocChatRoom createAdHocChatRoom(String roomName,
- Map<String, Object> roomProperties)
- throws OperationFailedException
- {
- return createAdHocChatRoom(roomName, (String[]) null, "");
- }
-
- /**
- * Creates an ad-hoc room with the named <tt>adHocRoomName</tt> and in
- * including to the specified <tt>contacts</tt>. When the method returns the
- * ad-hoc room the local user will have joined it.
- *
- * @return the ad-hoc room that has been just created
- * @param adHocRoomName the name of the room to be created
- * @param contacts the list of contacts ID
- * @param reason the reason for contacts' invitation
- * @throws OperationFailedException if the room couldn't be created for
- * some reason
- */
- public AdHocChatRoom createAdHocChatRoom( String adHocRoomName,
- List<String> contacts,
- String reason)
- throws OperationFailedException
- {
- String[] contactsToInvite = new String[contacts.size()];
- for(int i=0; i<contacts.size(); i++)
- {
- contactsToInvite[i] = contacts.get(i);
- }
- return createAdHocChatRoom(
- adHocRoomName, contactsToInvite, reason);
- }
-
- /**
- * Creates an ad-hoc room with the named <tt>adHocRoomName</tt> and in
- * including to the specified <tt>contacts</tt>. When the method returns the
- * ad-hoc room the local user will have joined it.
- *
- * @param roomName name of the chatroom
- * @param invitedContacts contacts to be invited to this room
- * @param reason reason of this invitation
- * @return AdHocChatRoom the ad-hoc room that has been just created
- * @throws OperationFailedException
- */
- private AdHocChatRoom createAdHocChatRoom(
- String roomName,
- String[] invitedContacts,
- String reason)
- throws OperationFailedException
- {
- if (invitedContacts == null)
- invitedContacts = new String[0];
-
- AdHocChatRoom chatRoom = null;
-
- try
- {
- YahooConference conference =
- yahooProvider.getYahooSession().createConference(
- invitedContacts, // users invited to this conference
- reason, // invite message / topic
- yahooProvider.getYahooSession().getLoginIdentity());
-
- chatRoom = createLocalChatRoomInstance(conference);
- }
- catch (Exception e)
- {
- String errorMessage
- = "Failed to create chat room with name: " + roomName;
-
- if (logger.isDebugEnabled())
- logger.debug(errorMessage, e);
- throw new OperationFailedException(errorMessage,
- OperationFailedException.CHAT_ROOM_NOT_JOINED, e);
- }
- chatRoom.join();
- return chatRoom;
- }
-
- /**
- * Creates a <tt>AdHocChatRoom</tt> instance from the specified Yahoo
- * conference.
- *
- * @param yahooConference The chat room model from the yahoo lib.
- *
- * @return AdHocChatRoom the chat room that we've just created.
- */
- private AdHocChatRoomYahooImpl createLocalChatRoomInstance(
- YahooConference yahooConference)
- {
- synchronized (chatRoomCache)
- {
- AdHocChatRoomYahooImpl newChatRoom
- = new AdHocChatRoomYahooImpl(yahooConference, yahooProvider);
-
- chatRoomCache.put(yahooConference.getName(), newChatRoom);
-
- return newChatRoom;
- }
- }
-
- /**
- * Creates a <tt>AdHocChatRoom</tt> instance (where the inviter is
- * represented by inviterID parameter) from the specified Yahoo conference.
- *
- * @param yahooConference The chat room model from the yahoo lib.
- * @param inviterID inviter's Yahoo ID which has to be added as room member
- *
- * @return AdHocChatRoom the chat room that we've just created.
- */
- private AdHocChatRoomYahooImpl createLocalChatRoomInstance(
- YahooConference yahooConference, String inviterID)
- {
- synchronized (chatRoomCache)
- {
- AdHocChatRoomYahooImpl newChatRoom
- = new AdHocChatRoomYahooImpl(yahooConference, yahooProvider);
-
- OperationSetPersistentPresenceYahooImpl opSetPresence =
- (OperationSetPersistentPresenceYahooImpl) yahooProvider
- .getOperationSet(OperationSetPersistentPresence.class);
-
- newChatRoom.addChatRoomParticipant(
- opSetPresence.findContactByID(inviterID));
- chatRoomCache.put(yahooConference.getName(), newChatRoom);
-
- return newChatRoom;
- }
- }
-
- /**
- * Returns the <tt>AdHocChatRoomYahooImpl</tt> corresponding to the given
- * <tt>conference</tt> if such exists, otherwise returns null.
- *
- * @param conference the <tt>YahooConference</tt>, for which we're searching
- * correspondence
- * @return the <tt>AdHocChatRoomYahooImpl</tt> corresponding to the given
- * <tt>conference</tt> if such exists, otherwise returns null
- */
- private AdHocChatRoomYahooImpl getLocalChatRoomInstance(
- YahooConference conference)
- {
- synchronized (chatRoomCache)
- {
- for (AdHocChatRoomYahooImpl chatRoom : chatRoomCache.values())
- {
- if (chatRoom.getYahooConference().equals(conference))
- return chatRoom;
- }
- }
-
- return null;
- }
-
- /**
- * Informs the sender of an invitation that we decline their invitation.
- *
- * @param invitation the connection to use for sending the rejection.
- * @param rejectReason the reason to reject the given invitation
- */
- public void rejectInvitation(AdHocChatRoomInvitation invitation,
- String rejectReason)
- {
- AdHocChatRoomYahooImpl chatRoom =
- (AdHocChatRoomYahooImpl) invitation.getTargetAdHocChatRoom();
-
- try
- {
- yahooProvider.getYahooSession().declineConferenceInvite(
- chatRoom.getYahooConference(), rejectReason);
- }
- catch (IOException e)
- {
- if (logger.isDebugEnabled())
- logger.debug("Failed to reject Invitation: " + e);
- }
- }
-
- /**
- * Delivers a <tt>AdHocChatRoomInvitationReceivedEvent</tt> to all
- * registered <tt>AdHocChatRoomInvitationListener</tt>s.
- *
- * @param targetChatRoom the room that invitation refers to
- * @param inviter the inviter that sent the invitation
- * @param reason the reason why the inviter sent the invitation
- */
- public void fireInvitationEvent(AdHocChatRoom targetChatRoom,
- String inviter, String reason)
- {
- AdHocChatRoomInvitationYahooImpl invitation =
- new AdHocChatRoomInvitationYahooImpl(targetChatRoom, inviter,
- reason);
-
- AdHocChatRoomInvitationReceivedEvent evt =
- new AdHocChatRoomInvitationReceivedEvent(this, invitation,
- new Date(System.currentTimeMillis()));
-
- Iterable<AdHocChatRoomInvitationListener> listeners;
- synchronized (invitationListeners)
- {
- listeners
- = new ArrayList<AdHocChatRoomInvitationListener>(
- invitationListeners);
- }
-
- for (AdHocChatRoomInvitationListener listener : listeners)
- listener.invitationReceived(evt);
- }
-
- /**
- * Delivers a <tt>AdHocChatRoomInvitationRejectedEvent</tt> to all
- * registered <tt>AdHocChatRoomInvitationRejectionListener</tt>s.
- *
- * @param sourceChatRoom the room that invitation refers to
- * @param invitee the name of the invitee that rejected the invitation
- * @param reason the reason of the rejection
- */
- public void fireInvitationRejectedEvent(AdHocChatRoom sourceChatRoom,
- String invitee, String reason)
- {
- AdHocChatRoomInvitationRejectedEvent evt =
- new AdHocChatRoomInvitationRejectedEvent(
- this, sourceChatRoom, invitee,
- reason, new Date(System.currentTimeMillis()));
-
- Iterable<AdHocChatRoomInvitationRejectionListener> listeners;
- synchronized (invitationRejectionListeners)
- {
- listeners
- = new ArrayList<AdHocChatRoomInvitationRejectionListener>(
- invitationRejectionListeners);
- }
-
- for (AdHocChatRoomInvitationRejectionListener listener : listeners)
- listener.invitationRejected(evt);
- }
-
- /**
- * Delivers a <tt>LocalUserAdHocChatRoomPresenceChangeEvent</tt> to all
- * registered <tt>LocalUserAdHocChatRoomPresenceListener</tt>s.
- *
- * @param chatRoom the <tt>ChatRoom</tt> which has been joined, left, etc.
- * @param eventType the type of this event; one of LOCAL_USER_JOINED,
- * LOCAL_USER_LEFT, etc.
- * @param reason the reason
- */
- public void fireLocalUserPresenceEvent(AdHocChatRoom chatRoom,
- String eventType, String reason)
- {
- LocalUserAdHocChatRoomPresenceChangeEvent evt =
- new LocalUserAdHocChatRoomPresenceChangeEvent(
- this, chatRoom, eventType,
- reason);
-
- Iterable<LocalUserAdHocChatRoomPresenceListener> listeners;
- synchronized (presenceListeners)
- {
- listeners =
- new ArrayList<LocalUserAdHocChatRoomPresenceListener>(
- presenceListeners);
- }
-
- for (LocalUserAdHocChatRoomPresenceListener listener : listeners)
- listener.localUserAdHocPresenceChanged(evt);
- }
-
- /**
- * Create a Message instance for sending arbitrary MIME-encoding content.
- *
- * @param content content value
- * @param contentType the MIME-type for <tt>content</tt>
- * @param contentEncoding encoding used for <tt>content</tt>
- * @param subject a <tt>String</tt> subject or <tt>null</tt> for now
- * subject.
- * @return the newly created message.
- * @throws UnsupportedEncodingException missing utf-8 in platform we use.
- */
- private Message createMessage(byte[] content, String contentType,
- String contentEncoding, String subject)
- throws UnsupportedEncodingException
- {
- return new MessageYahooImpl(new String(content, "UTF-8"), contentType,
- contentEncoding, subject);
- }
-
- /**
- * Creates a message by a given message text.
- *
- * @param messageText The message text.
- * @return the newly created message.
- */
- public Message createMessage(String messageText)
- {
- return new MessageYahooImpl(messageText,
- OperationSetBasicInstantMessaging.DEFAULT_MIME_TYPE,
- OperationSetBasicInstantMessaging.DEFAULT_MIME_ENCODING, null);
- }
-
- /**
- * Our listener that will tell us when we're registered to yahoo network.
- *
- */
- private class RegistrationStateListener
- implements RegistrationStateChangeListener
- {
- /**
- * The method is called by a ProtocolProvider implementation whenever a
- * change in the registration state of the corresponding provider had
- * occurred.
- *
- * @param evt ProviderStatusChangeEvent the event describing the status
- * change.
- */
- public void registrationStateChanged(RegistrationStateChangeEvent evt)
- {
- if (evt.getNewState() == RegistrationState.REGISTERED)
- {
- yahooProvider.getYahooSession().addSessionListener(
- new YahooMessageListener());
- }
- }
- }
-
- /**
- * Our group chat message listener, it extends the SessionAdapter from the
- * the Yahoo library.
- *
- */
- private class YahooMessageListener
- extends SessionAdapter
- {
-
- @Override
- public void conferenceInviteDeclinedReceived(SessionConferenceEvent ev)
- {
- if (logger.isDebugEnabled())
- logger.debug("Group Chat invite declined received. "
- + ev.toString());
- try
- {
- AdHocChatRoom chatRoom = getLocalChatRoomInstance(ev.getRoom());
-
- fireInvitationRejectedEvent(chatRoom, ev.getFrom(), ev
- .getMessage());
- }
- catch (Exception e)
- {
- if (logger.isDebugEnabled())
- logger.debug("Error: " + e);
- }
- }
-
- @Override
- public void conferenceInviteReceived(SessionConferenceEvent ev)
- {
- if (logger.isDebugEnabled())
- logger.debug("Conference Invite Received: " + ev.toString());
-
- try
- {
- AdHocChatRoom chatRoom = getLocalChatRoomInstance(ev.getRoom());
-
- if (chatRoom == null)
- {
- chatRoom =
- createLocalChatRoomInstance(ev.getRoom(), ev.getFrom());
-
- fireInvitationEvent(
- chatRoom, ev.getFrom(), ev.getMessage());
- }
-
- }
- catch (Exception e)
- {
- if (logger.isDebugEnabled())
- logger.debug("Error: " + e);
- }
- }
-
- @Override
- public void conferenceLogoffReceived(SessionConferenceEvent ev)
- {
- if (logger.isDebugEnabled())
- logger.debug("Conference Logoff Received: " + ev.toString());
-
- try
- {
- AdHocChatRoomYahooImpl chatRoom
- = getLocalChatRoomInstance(ev.getRoom());
-
- if (chatRoom != null)
- {
- Contact participant =
- chatRoom.findParticipantForAddress(ev.getFrom());
-
- chatRoom.removeChatRoomParticipant(participant);
- }
- }
- catch (Exception e)
- {
- logger
- .debug("Failed to remove a user from the chat room. " + e);
- }
- }
-
- @Override
- public void conferenceLogonReceived(SessionConferenceEvent ev)
- {
- if (logger.isDebugEnabled())
- logger.debug("Conference Logon Received: " + ev.toString());
-
- try
- {
- AdHocChatRoomYahooImpl chatRoom
- = getLocalChatRoomInstance(ev.getRoom());
-
- if (chatRoom != null)
- {
- OperationSetPersistentPresenceYahooImpl presenceOpSet =
- (OperationSetPersistentPresenceYahooImpl) chatRoom
- .getParentProvider().getOperationSet(
- OperationSetPersistentPresence.class);
-
- Contact participant =
- presenceOpSet.findContactByID(ev.getFrom());
-
- chatRoom.addChatRoomParticipant(participant);
- }
- }
- catch (Exception e)
- {
- if (logger.isDebugEnabled())
- logger.debug("Failed to add a user to the chat room. " + e);
- }
- }
-
- @Override
- public void conferenceMessageReceived(SessionConferenceEvent ev)
- {
- if (logger.isDebugEnabled())
- logger.debug("Conference Message Received: " + ev.toString());
-
- try
- {
- String formattedMessage = ev.getMessage();
- if (logger.isDebugEnabled())
- logger.debug("original message received : " + formattedMessage);
-
- formattedMessage = opSetBasic.decodeMessage(formattedMessage);
- if (logger.isDebugEnabled())
- logger.debug("formatted Message : " + formattedMessage);
- // As no indications in the protocol is it html or not. No harm
- // to set all messages html - doesn't affect the appearance of
- // the gui
-
- Message newMessage =
- createMessage(
- formattedMessage.getBytes("UTF-8"),
- OperationSetBasicInstantMessaging.HTML_MIME_TYPE,
- OperationSetBasicInstantMessaging.DEFAULT_MIME_ENCODING,
- null);
-
- AdHocChatRoomYahooImpl chatRoom =
- getLocalChatRoomInstance(ev.getRoom());
-
- if (chatRoom != null)
- {
- Contact member =
- chatRoom.findParticipantForAddress(ev.getFrom());
-
- AdHocChatRoomMessageReceivedEvent msgReceivedEvent =
- new AdHocChatRoomMessageReceivedEvent(
- chatRoom,
- member,
- new Date(),
- newMessage,
- AdHocChatRoomMessageReceivedEvent
- .CONVERSATION_MESSAGE_RECEIVED);
-
- chatRoom.fireMessageEvent(msgReceivedEvent);
- }
- }
- catch (Exception e)
- {
- logger
- .debug("Error while receiving a multi user chat message: "
- + e);
- }
-
- }
-
- @Override
- public void connectionClosed(SessionEvent ev)
- {
- if (logger.isDebugEnabled())
- logger.debug("Connection Closed: " + ev.toString());
- }
- }
-
- public List<AdHocChatRoom> getAdHocChatRooms()
- {
- return new ArrayList<AdHocChatRoom>(chatRoomCache.values());
- }
-}
diff --git a/src/net/java/sip/communicator/impl/protocol/yahoo/OperationSetBasicInstantMessagingYahooImpl.java b/src/net/java/sip/communicator/impl/protocol/yahoo/OperationSetBasicInstantMessagingYahooImpl.java
deleted file mode 100644
index 84059de..0000000
--- a/src/net/java/sip/communicator/impl/protocol/yahoo/OperationSetBasicInstantMessagingYahooImpl.java
+++ /dev/null
@@ -1,649 +0,0 @@
-/*
- * Jitsi, the OpenSource Java VoIP and Instant Messaging client.
- *
- * Copyright @ 2015 Atlassian Pty Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.java.sip.communicator.impl.protocol.yahoo;
-
-import java.io.*;
-import java.util.*;
-import java.util.regex.*;
-
-import net.java.sip.communicator.service.protocol.*;
-import net.java.sip.communicator.service.protocol.event.*;
-import net.java.sip.communicator.util.*;
-import ymsg.network.event.*;
-import ymsg.support.*;
-
-/**
- * A straightforward implementation of the basic instant messaging operation
- * set.
- *
- * @author Damian Minkov
- * @author Symphorien Wanko
- * @author Keio Kraaner
- */
-public class OperationSetBasicInstantMessagingYahooImpl
- extends AbstractOperationSetBasicInstantMessaging
- implements OperationSetInstantMessageFiltering
-{
- /**
- * Logger for this class
- */
- private static final Logger logger =
- Logger.getLogger(OperationSetBasicInstantMessagingYahooImpl.class);
-
- /**
- * Yahoo has limit of message length. If exceeded
- * message is not delivered and no notification is received for that.
- */
- private static final int MAX_MESSAGE_LENGTH = 800; // 949
-
- /**
- * A regexp that is used to escape some chars in messages.
- */
- private static final Pattern MESSAGE_CHARS_ESCAPE = Pattern.compile("([.()^&$*|])");
-
- /**
- * A list of filters registered for message events.
- */
- private final List<EventFilter> eventFilters = new ArrayList<EventFilter>();
-
- /**
- * The provider that created us.
- */
- private ProtocolProviderServiceYahooImpl yahooProvider = null;
-
- /**
- * Message decoder allows to convert Yahoo formated messages, which can
- * contains some specials characters, to HTML or to plain text.
- */
- private final MessageDecoder messageDecoder = new MessageDecoder();
-
- /**
- * A reference to the persistent presence operation set that we use
- * to match incoming messages to <tt>Contact</tt>s and vice versa.
- */
- private OperationSetPersistentPresenceYahooImpl opSetPersPresence = null;
- private static final Pattern FONT_SIZE_0_PATTERN = Pattern.compile("(<font) (.*) size=\"0\">");
- private static final Pattern FONT_SIZE_INT_PATTERN = Pattern.compile("(<font) (.*) size=\"(\\d+)\">");
-
- /**
- * Creates an instance of this operation set.
- * @param provider a ref to the <tt>ProtocolProviderServiceImpl</tt>
- * that created us and that we'll use for retrieving the underlying aim
- * connection.
- */
- OperationSetBasicInstantMessagingYahooImpl(
- ProtocolProviderServiceYahooImpl provider)
- {
- this.yahooProvider = provider;
- provider.addRegistrationStateChangeListener(
- new RegistrationStateListener());
- }
-
- /**
- * Determines wheter the protocol provider (or the protocol itself) support
- * sending and receiving offline messages. Most often this method would
- * return true for protocols that support offline messages and false for
- * those that don't. It is however possible for a protocol to support these
- * messages and yet have a particular account that does not (i.e. feature
- * not enabled on the protocol server). In cases like this it is possible
- * for this method to return true even when offline messaging is not
- * supported, and then have the sendMessage method throw an
- * OperationFailedException with code - OFFLINE_MESSAGES_NOT_SUPPORTED.
- *
- * @return <tt>true</tt> if the protocol supports offline messages and
- * <tt>false</tt> otherwise.
- */
- public boolean isOfflineMessagingSupported()
- {
- return true;
- }
-
- /**
- * Determines wheter the protocol supports the supplied content type
- *
- * @param contentType the type we want to check
- * @return <tt>true</tt> if the protocol supports it and
- * <tt>false</tt> otherwise.
- */
- public boolean isContentTypeSupported(String contentType)
- {
- if(contentType.equals(DEFAULT_MIME_TYPE) ||
- contentType.equals(HTML_MIME_TYPE))
- return true;
- else
- return false;
- }
-
- @Override
- public Message createMessage(String content, String contentType,
- String encoding, String subject)
- {
- return new MessageYahooImpl(content, contentType, encoding, subject);
- }
-
- /**
- * Sends the <tt>message</tt> to the destination indicated by the
- * <tt>to</tt> contact.
- *
- * @param to the <tt>Contact</tt> to send <tt>message</tt> to
- * @param message the <tt>Message</tt> to send.
- * @throws IllegalStateException if the underlying stack is
- * not registered and initialized.
- * @throws IllegalArgumentException if <tt>to</tt> is not an
- * instance of ContactImpl.
- */
- public void sendInstantMessage(Contact to, Message message)
- throws IllegalStateException, IllegalArgumentException
- {
- assertConnected();
-
- if( !(to instanceof ContactYahooImpl) )
- throw new IllegalArgumentException(
- "The specified contact is not a Yahoo contact."
- + to);
-
- try
- {
- String toUserID = ((ContactYahooImpl) to).getID();
-
- MessageDeliveredEvent msgDeliveryPendingEvt =
- new MessageDeliveredEvent(message, to, new Date());
-
- MessageDeliveredEvent[] msgDeliveryPendingEvts = messageDeliveryPendingTransform(msgDeliveryPendingEvt);
-
- if (msgDeliveryPendingEvts == null || msgDeliveryPendingEvts.length == 0)
- return;
-
- for (MessageDeliveredEvent event : msgDeliveryPendingEvts)
- {
- byte[] msgBytesToBeSent =
- event.getSourceMessage().getContent().trim()
- .getBytes("UTF-8");
-
- // split the message in parts with max allowed length
- // and send them all
- do
- {
- if (msgBytesToBeSent.length > MAX_MESSAGE_LENGTH)
- {
- byte[] tmp1 = new byte[MAX_MESSAGE_LENGTH];
- System.arraycopy(msgBytesToBeSent, 0, tmp1, 0,
- MAX_MESSAGE_LENGTH);
-
- byte[] tmp2 =
- new byte[msgBytesToBeSent.length
- - MAX_MESSAGE_LENGTH];
- System.arraycopy(msgBytesToBeSent, MAX_MESSAGE_LENGTH,
- tmp2, 0, tmp2.length);
-
- msgBytesToBeSent = tmp2;
-
- yahooProvider.getYahooSession().sendMessage(toUserID,
- new String(tmp1, "UTF-8"));
- }
- else
- {
- yahooProvider.getYahooSession().sendMessage(toUserID,
- new String(msgBytesToBeSent, "UTF-8"));
- }
-
- MessageDeliveredEvent msgDeliveredEvt =
- new MessageDeliveredEvent(message, to, new Date());
-
- if (msgDeliveredEvt != null)
- fireMessageEvent(msgDeliveredEvt);
- }
- while (msgBytesToBeSent.length > MAX_MESSAGE_LENGTH);
- }
- }
- catch (IOException ex)
- {
- logger.fatal("Cannot Send Message! " + ex.getMessage());
- MessageDeliveryFailedEvent evt =
- new MessageDeliveryFailedEvent(
- message,
- to,
- MessageDeliveryFailedEvent.NETWORK_FAILURE);
-
- if (evt != null)
- fireMessageEvent(evt);
- }
- }
-
- /**
- * Utility method throwing an exception if the stack is not properly
- * initialized.
- * @throws IllegalStateException if the underlying stack is
- * not registered and initialized.
- */
- private void assertConnected() throws IllegalStateException
- {
- if (yahooProvider == null)
- throw new IllegalStateException(
- "The provider must be non-null and signed on the "
- +"service before being able to communicate.");
- if (!yahooProvider.isRegistered())
- throw new IllegalStateException(
- "The provider must be signed on the service before "
- +"being able to communicate.");
- }
-
- /**
- * Our listener that will tell us when we're registered to
- */
- private class RegistrationStateListener
- implements RegistrationStateChangeListener
- {
- /**
- * The method is called by a ProtocolProvider implementation whenver
- * a change in the registration state of the corresponding provider had
- * occurred.
- * @param evt ProviderStatusChangeEvent the event describing the status
- * change.
- */
- public void registrationStateChanged(RegistrationStateChangeEvent evt)
- {
- if (logger.isDebugEnabled())
- logger.debug("The provider changed state from: "
- + evt.getOldState()
- + " to: " + evt.getNewState());
-
- if (evt.getNewState() == RegistrationState.REGISTERED)
- {
- opSetPersPresence =
- (OperationSetPersistentPresenceYahooImpl) yahooProvider
- .getOperationSet(OperationSetPersistentPresence.class);
-
- yahooProvider.getYahooSession().
- addSessionListener(new YahooMessageListener());
- }
- }
- }
-
- /**
- * Delivers the specified event to all registered message listeners.
- * @param evt the <tt>EventObject</tt> that we'd like delivered to all
- * registered message listerners.
- */
- @Override
- protected void fireMessageEvent(EventObject evt)
- {
- // check if this event should be filtered out
- Iterator<EventFilter> filters;
- synchronized (eventFilters)
- {
- filters = new ArrayList<EventFilter>(eventFilters).iterator();
- }
- // return if a filter has filtered this event out
- boolean filtered = false;
- while (filters.hasNext())
- {
- try
- {
- if (filters.next().filterEvent(evt))
- {
- filtered = true;
- }
- }
- catch(Exception exc)
- {
- logger.error("An exception occurred while filtering an event.",
- exc);
- }
- }
-
- if (filtered)
- {
- if (logger.isTraceEnabled())
- logger.trace("Message event filtered.");
- return;
- }
-
- super.fireMessageEvent(evt);
- }
-
- /**
- * 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
- */
- @Override
- 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
- */
- @Override
- 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.
- * There is two types of notification, the first one provides only
- * the number of unread mails and the second gives informations about
- * a precise new mail. Here, we care about only the second case in which
- * we should always have the email of the sender of the mail.
- *
- * @param ev Event with information on the received email
- */
- @Override
- public void newMailReceived(SessionNewMailEvent ev)
- {
- // why, if I provide mail@yahoo.FR when registering my account,
- // SC later tells me that my email address is mail@yahoo.COM ??
- // because of this users will always be sent on yahoo.com mail
- // login page rather than their usual (yahoo.XXX) login page.
- String myEmail = yahooProvider.getAccountID().getAccountAddress();
-
- // we don't process incoming email event without source address.
- // it allows us to avoid some spams
- if ((ev.getEmailAddress() == null)
- || (ev.getEmailAddress().indexOf('@') < 0))
- {
- return;
- }
-
- String yahooMailLogon = "http://mail."
- + myEmail.substring(myEmail.indexOf('@') + 1);
-
- yahooMailLogon = "&nbsp;&nbsp;&nbsp;&nbsp;<a href=\""
- + yahooMailLogon + "\">"
- + yahooMailLogon + "</a>";
-
- // FIXME Escape HTML!
- String newMail = YahooActivator.getResources().getI18NString(
- "service.gui.NEW_MAIL",
- new String[]{ev.getFrom(),
- "&lt;" + ev.getEmailAddress() + "&gt;",
- ev.getSubject(),
- "&nbsp;&nbsp;&nbsp;&nbsp;"+yahooMailLogon}) ;
-
- Message newMailMessage = new MessageYahooImpl(
- newMail,
- HTML_MIME_TYPE,
- DEFAULT_MIME_ENCODING,
- null);
-
- Contact sourceContact = opSetPersPresence.
- findContactByID(ev.getEmailAddress());
-
- if (sourceContact == null)
- {
- if (logger.isDebugEnabled())
- logger.debug("received a new mail from an unknown contact: "
- + ev.getFrom()
- + " &lt;" + ev.getEmailAddress() + "&gt;");
- //create the volatile contact
- sourceContact = opSetPersPresence
- .createVolatileContact(ev.getEmailAddress());
- }
- MessageReceivedEvent msgReceivedEvt
- = new MessageReceivedEvent(
- newMailMessage, sourceContact, new Date(),
- MessageReceivedEvent.SYSTEM_MESSAGE_RECEIVED);
-
- 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)
- {
- if (logger.isDebugEnabled())
- logger.debug("Message received : " + ev);
-
- // to keep things simple, we can decodeToText()
- //String formattedMessage = processLinks(
- // messageDecoder.decodeToText(ev.getMessage()));
-
- String formattedMessage = ev.getMessage();
- if (logger.isDebugEnabled())
- logger.debug("original message received : " + formattedMessage);
-
- formattedMessage = decodeMessage(formattedMessage);
-
- if (logger.isDebugEnabled())
- logger.debug("formatted Message : " + formattedMessage);
- // As no indications in the protocol is it html or not. No harm
- // to set all messages html - doesn't affect the appearance of the
- // gui
- Message newMessage =
- createMessage(formattedMessage, HTML_MIME_TYPE,
- DEFAULT_MIME_ENCODING, null);
-
- Contact sourceContact = opSetPersPresence.
- findContactByID(ev.getFrom());
-
- if(sourceContact == null)
- {
- if (logger.isDebugEnabled())
- logger.debug("received a message from an unknown contact: "
- + ev.getFrom());
- //create the volatile contact
- sourceContact = opSetPersPresence
- .createVolatileContact(ev.getFrom());
- }
-
- MessageReceivedEvent msgReceivedEvt
- = new MessageReceivedEvent(
- newMessage, sourceContact , new Date());
-
- // msgReceivedEvt = messageReceivedTransform(msgReceivedEvt);
-
- if (msgReceivedEvt != null)
- fireMessageEvent(msgReceivedEvt);
- }
- }
-
- /**
- * Decode the received chat message.
- * If the message contains \u001b the following text is decoded by
- * the MessageDecoder of yahoo api
- * Then make http links clickable and fix the font size of html code
- *
- * @param message the chat message
- * @return a decoded message.
- */
- String decodeMessage(String message)
- {
- message = messageDecoder.decodeToHTML(message);
- message = processLinks(message);
- message =
- FONT_SIZE_0_PATTERN.matcher(message)
- .replaceAll("$1 $2 size=\"10\">");
- message =
- FONT_SIZE_INT_PATTERN.matcher(message)
- .replaceAll("$1 $2 style=\"font-size: $3px;\">");
- return message;
- }
-
- /**
- * Format links in the given message. Skips all links, which are already in
- * HTML format and converts all other links.
- *
- * @param message The source message string.
- * @return The message string with properly formatted links.
- */
- public String processLinks(String message)
- {
- StringBuffer msgBuffer = new StringBuffer();
-
- // We match two groups of Strings. The first group is the group of any
- // String. The second group is a well formatted HTML link.
- Pattern p = Pattern.compile("(.*?)(<a[\\s][^<]*(/>|</a>))",
- Pattern.CASE_INSENSITIVE);
-
- Matcher m = p.matcher(message);
-
- int lastMatchIndex = 0;
- while (m.find())
- {
- lastMatchIndex = m.end();
-
- String matchGroup1 = m.group(1);
- String matchGroup2 = m.group(2);
-
- String formattedString = formatLinksToHTML(matchGroup1);
-
- m.appendReplacement(msgBuffer,
- replaceSpecialRegExpChars(formattedString) + matchGroup2);
- }
-
- String tailString = message.substring(lastMatchIndex);
-
- String formattedTailString = formatLinksToHTML(tailString);
-
- msgBuffer.append(formattedTailString);
-
- return msgBuffer.toString();
- }
-
- /**
- * Replaces some chars that are special in a regular expression.
- *
- * @param text The initial text.
- * @return the formatted text
- */
- private static String replaceSpecialRegExpChars(String text)
- {
- return MESSAGE_CHARS_ESCAPE.matcher(text).replaceAll("\\\\$1");
- }
-
- /**
- * Goes through the given text and converts all links to HTML links.
- * <p>
- * For example all occurrences of http://jitsi.org/ will be
- * replaced by <a href="http://jitsi.org/">
- * http://jitsi.org/</a>. The same is true for all strings
- * starting with "www".
- *
- * @param text the text on which the regular expression would be performed
- * @return the initial text containing only HTML links
- */
- private static String formatLinksToHTML(String text)
- {
- String wwwURL = "(www\\." + // Matches the "www" string.
- "[^/?#<\"'\\s]+" + // Matches at least one char of
- // any type except / ? # < " '
- // and space.
- "[\\.]" + // Matches the second point of the link.
- "[^?#<\"'\\s]+" + // Matches at least one char of
- // any type except ? # < " '
- // and space.
- "(\\?[^#<\"'\\s]*)?" +
- "(#.*)?)";
-
- String protocolURL
- = "([^\"'<>:/?#\\s]+" + // Matches at least one char of
- // any type except " ' < > : / ? #
- // and space.
- "://" + // Matches the :// delimiter in links
- "[^/?#<\"'\\s]*" + // Matches any number of times any char
- // except / ? # < " ' and space.
- "[^?#<\"'\\s]*" + // Matches any number of times any char
- // except ? # < " ' and space.
- "(\\?[^#<\"'\\s]*)?" +
- "(#.*)?)";
-
- String url = '(' + wwwURL + '|' + protocolURL + ')';
-
- Pattern p = Pattern.compile(url, Pattern.CASE_INSENSITIVE);
-
- Matcher m = p.matcher(text);
-
- StringBuffer linkBuffer = new StringBuffer();
-
- while (m.find())
- {
- String linkGroup = m.group();
-
- String replacement;
- if (linkGroup.startsWith("www"))
- {
- replacement = "<A href=\"" + "http://"
- + linkGroup + "\">" + linkGroup + "</A>";
- }
- else
- {
- replacement = "<A href=\"" + linkGroup
- + "\">" + linkGroup + "</A>";
- }
-
- m.appendReplacement(linkBuffer,
- replaceSpecialRegExpChars(replacement));
- }
-
- m.appendTail(linkBuffer);
-
- return linkBuffer.toString();
- }
-
- /**
- * Registers an <tt>EventFilter</tt> with this operation set so that
- * events, that do not need processing, are filtered out.
- *
- * @param filter the <tt>EventFilter</tt> to register.
- */
- public void addEventFilter(EventFilter filter)
- {
- synchronized(eventFilters)
- {
- if(!eventFilters.contains(filter))
- {
- eventFilters.add(filter);
- }
- }
- }
-
- /**
- * Unregisteres an <tt>EventFilter</tt> so that it won't check any more
- * if an event should be filtered out.
- *
- * @param filter the <tt>EventFilter</tt> to unregister.
- */
- public void removeEventFilter(EventFilter filter)
- {
- synchronized(eventFilters)
- {
- eventFilters.remove(filter);
- }
- }
-}
diff --git a/src/net/java/sip/communicator/impl/protocol/yahoo/OperationSetFileTransferYahooImpl.java b/src/net/java/sip/communicator/impl/protocol/yahoo/OperationSetFileTransferYahooImpl.java
deleted file mode 100644
index 85f25b1..0000000
--- a/src/net/java/sip/communicator/impl/protocol/yahoo/OperationSetFileTransferYahooImpl.java
+++ /dev/null
@@ -1,466 +0,0 @@
-/*
- * Jitsi, the OpenSource Java VoIP and Instant Messaging client.
- *
- * Copyright @ 2015 Atlassian Pty Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.java.sip.communicator.impl.protocol.yahoo;
-
-import java.io.*;
-import java.util.*;
-
-import net.java.sip.communicator.service.protocol.*;
-import net.java.sip.communicator.service.protocol.event.*;
-import net.java.sip.communicator.util.*;
-import ymsg.network.event.*;
-
-/**
- * The Yahoo protocol filetransfer OperationSet.
- *
- * @author Damian Minkov
- */
-public class OperationSetFileTransferYahooImpl
- implements OperationSetFileTransfer,
- SessionFileTransferListener
-{
- /**
- * The logger for this class.
- */
- private static final Logger logger =
- Logger.getLogger(OperationSetFileTransferYahooImpl.class);
-
- /**
- * The provider that created us.
- */
- private final ProtocolProviderServiceYahooImpl yahooProvider;
-
- /**
- * A list of listeners registered for file transfer events.
- */
- private ArrayList<FileTransferListener> fileTransferListeners
- = new ArrayList<FileTransferListener>();
-
- /**
- * A list of active fileTransfers.
- */
- private Hashtable<String, Object> activeFileTransfers
- = new Hashtable<String, Object>();
-
- /**
- * Constructor
- * @param provider is the provider that created us
- */
- public OperationSetFileTransferYahooImpl(
- ProtocolProviderServiceYahooImpl provider)
- {
- this.yahooProvider = provider;
-
- provider.addRegistrationStateChangeListener(
- new RegistrationStateListener());
- }
-
- /**
- * Sends a file transfer request to the given <tt>toContact</tt> by
- * specifying the local and remote file path and the <tt>fromContact</tt>,
- * sending the file.
- *
- * @param toContact the contact that should receive the file
- * @param file the file to send
- *
- * @return the transfer object
- *
- * @throws IllegalStateException if the protocol provider is not registered
- * or connected
- * @throws IllegalArgumentException if some of the arguments doesn't fit the
- * protocol requirements
- */
- public FileTransfer sendFile( Contact toContact,
- File file)
- throws IllegalStateException,
- IllegalArgumentException
- {
- try
- {
- assertConnected();
-
- if(file.length() > getMaximumFileLength())
- throw new IllegalArgumentException(
- "File length exceeds the allowed one for this protocol");
-
- ArrayList<String> filesToSend = new ArrayList<String>();
- filesToSend.add(file.getCanonicalPath());
- Date sentDate = new Date();
- String id = yahooProvider.getYahooSession().sendFiles(
- filesToSend, toContact.getAddress());
-
- FileTransferImpl ft =
- new FileTransferImpl(yahooProvider,
- id, toContact, file, FileTransfer.OUT);
-
- // Notify all interested listeners that a file transfer has been
- // created.
- FileTransferCreatedEvent event
- = new FileTransferCreatedEvent(ft, sentDate);
-
- fireFileTransferCreated(event);
-
- ft.fireStatusChangeEvent(FileTransferStatusChangeEvent.PREPARING);
-
- return ft;
- }
- catch(IOException e)
- {
- logger.error("Cannot send fileTransfer", e);
- return null;
- }
- }
-
- /**
- * Sends a file transfer request to the given <tt>toContact</tt> by
- * specifying the local and remote file path and the <tt>fromContact</tt>,
- * sending the file.
- *
- * @param toContact the contact that should receive the file
- * @param fromContact the contact sending the file
- * @param remotePath the remote file path
- * @param localPath the local file path
- *
- * @return the transfer object
- *
- * @throws IllegalStateException if the protocol provider is not registered
- * or connected
- * @throws IllegalArgumentException if some of the arguments doesn't fit the
- * protocol requirements
- */
- public FileTransfer sendFile( Contact toContact,
- Contact fromContact,
- String remotePath,
- String localPath)
- throws IllegalStateException,
- IllegalArgumentException
- {
- return this.sendFile(toContact, new File(localPath));
- }
-
- /**
- * Adds the given <tt>FileTransferListener</tt> that would listen for
- * file transfer requests and created file transfers.
- *
- * @param listener the <tt>FileTransferListener</tt> to add
- */
- public void addFileTransferListener(
- FileTransferListener listener)
- {
- synchronized(fileTransferListeners)
- {
- if(!fileTransferListeners.contains(listener))
- {
- this.fileTransferListeners.add(listener);
- }
- }
- }
-
- /**
- * Removes the given <tt>FileTransferListener</tt> that listens for
- * file transfer requests and created file transfers.
- *
- * @param listener the <tt>FileTransferListener</tt> to remove
- */
- public void removeFileTransferListener(
- FileTransferListener listener)
- {
- synchronized(fileTransferListeners)
- {
- this.fileTransferListeners.remove(listener);
- }
- }
-
- /**
- * Utility method throwing an exception if the stack is not properly
- * initialized.
- * @throws java.lang.IllegalStateException if the underlying stack is
- * not registered and initialized.
- */
- private void assertConnected()
- throws IllegalStateException
- {
- if (yahooProvider == null)
- throw new IllegalStateException(
- "The provider must be non-null and signed on the "
- +"service before being able to send a file.");
- else if (!yahooProvider.isRegistered())
- throw new IllegalStateException(
- "The provider must be signed on the service before "
- +"being able to send a file.");
- }
-
- /**
- * Delivers the file transfer to all registered listeners.
- *
- * @param event the <tt>FileTransferEvent</tt> that we'd like delivered to
- * all registered file transfer listeners.
- */
- void fireFileTransferCreated(FileTransferCreatedEvent event)
- {
- activeFileTransfers.put(
- event.getFileTransfer().getID(), event.getFileTransfer());
-
- Iterator<FileTransferListener> listeners = null;
- synchronized (fileTransferListeners)
- {
- listeners = new ArrayList<FileTransferListener>
- (fileTransferListeners).iterator();
- }
-
- while (listeners.hasNext())
- {
- FileTransferListener listener = listeners.next();
- listener.fileTransferCreated(event);
- }
- }
-
- /**
- * Delivers the specified event to all registered file transfer listeners.
- *
- * @param event the <tt>EventObject</tt> that we'd like delivered to all
- * registered file transfer listeners.
- */
- void fireFileTransferRequestRejected(FileTransferRequestEvent event)
- {
- Iterator<FileTransferListener> listeners = null;
- synchronized (fileTransferListeners)
- {
- listeners = new ArrayList<FileTransferListener>
- (fileTransferListeners).iterator();
- }
-
- while (listeners.hasNext())
- {
- FileTransferListener listener = listeners.next();
-
- listener.fileTransferRequestRejected(event);
- }
- }
-
- /**
- * Delivers the specified event to all registered file transfer listeners.
- *
- * @param event the <tt>EventObject</tt> that we'd like delivered to all
- * registered file transfer listeners.
- */
- private void fireFileTransferRequest(FileTransferRequestEvent event)
- {
- Iterator<FileTransferListener> listeners = null;
- synchronized (fileTransferListeners)
- {
- listeners = new ArrayList<FileTransferListener>
- (fileTransferListeners).iterator();
- }
-
- while (listeners.hasNext())
- {
- FileTransferListener listener = listeners.next();
-
- listener.fileTransferRequestReceived(event);
- }
- }
-
- /**
- * Delivers the specified event to all registered file transfer listeners.
- *
- * @param event the <tt>EventObject</tt> that we'd like delivered to all
- * registered file transfer listeners.
- */
- void fireFileTransferRequestCanceled(FileTransferRequestEvent event)
- {
- Iterator<FileTransferListener> listeners = null;
- synchronized (fileTransferListeners)
- {
- listeners = new ArrayList<FileTransferListener>
- (fileTransferListeners).iterator();
- }
-
- while (listeners.hasNext())
- {
- FileTransferListener listener = listeners.next();
-
- listener.fileTransferRequestCanceled(event);
- }
- }
-
- private int getStateMapping(int s)
- {
- switch(s)
- {
- case SessionFileTransferEvent.REFUSED :
- return FileTransferStatusChangeEvent.REFUSED;
- case SessionFileTransferEvent.CANCEL :
- return FileTransferStatusChangeEvent.CANCELED;
- case SessionFileTransferEvent.FAILED :
- return FileTransferStatusChangeEvent.FAILED;
- case SessionFileTransferEvent.IN_PROGRESS :
- return FileTransferStatusChangeEvent.IN_PROGRESS;
- case SessionFileTransferEvent.RECEIVED :
- return FileTransferStatusChangeEvent.COMPLETED;
- case SessionFileTransferEvent.SENT :
- return FileTransferStatusChangeEvent.COMPLETED;
- default: return FileTransferStatusChangeEvent.WAITING;
- }
- }
-
- /**
- * Starting point for incoming filetransfer.
- * @param ev
- */
- public void fileTransferRequestReceived(SessionFileTransferEvent ev)
- {
- OperationSetPersistentPresenceYahooImpl opSetPersPresence
- = (OperationSetPersistentPresenceYahooImpl)
- yahooProvider.getOperationSet(
- OperationSetPersistentPresence.class);
-
- Contact sender = opSetPersPresence.findContactByID(ev.getFrom());
-
- if(sender == null)
- return;
-
- Date recvDate = new Date();
-
- for(int i = 0; i < ev.getFileNames().size(); i++)
- {
- String fileName = ev.getFileNames().get(i);
- String fileSize = ev.getFileSizes().get(i);
-
- IncomingFileTransferRequest req =
- new IncomingFileTransferRequestYahooImpl(
- yahooProvider, this, sender, recvDate,
- fileName, fileSize,
- ev.getId());
-
- activeFileTransfers.put(ev.getId(), req);
- fireFileTransferRequest(
- new FileTransferRequestEvent(this, req, recvDate));
- }
- }
-
- /**
- * Status changed for filetransfer.
- * @param ev
- */
- public void statusChanged(SessionFileTransferEvent ev)
- {
- if(ev.getId() == null)
- return;
-
- Object ftObj = activeFileTransfers.get(ev.getId());
-
- if(ftObj == null)
- {
- logger.warn("File Transfer or request not found. " + ev.getId() + "/ " + ev.getState());
- return;
- }
-
- int newState = ev.getState();
-
- if(newState == SessionFileTransferEvent.CANCEL
- || newState == SessionFileTransferEvent.FAILED
- || newState == SessionFileTransferEvent.RECEIVED
- || newState == SessionFileTransferEvent.REFUSED
- || newState == SessionFileTransferEvent.SENT)
- {
- // this is an final state so remove it from active filetransfers
- activeFileTransfers.remove(ev.getId());
- }
-
- if(ftObj instanceof IncomingFileTransferRequest)
- {
- if(newState == SessionFileTransferEvent.REFUSED)
- {
- IncomingFileTransferRequestYahooImpl req =
- (IncomingFileTransferRequestYahooImpl)ftObj;
- fireFileTransferRequestCanceled(
- new FileTransferRequestEvent(this, req, req.getDate()));
- return;
- }
- }
-
- if(!(ftObj instanceof FileTransferImpl))
- {
- logger.warn("File Transfer not found." + ftObj);
- return;
- }
-
- FileTransferImpl ft = (FileTransferImpl)ftObj;
-
- if( newState == SessionFileTransferEvent.IN_PROGRESS)
- {
- // if we start sending progress fire that we are in progress
- if(ev.getProgress() == 0)
- ft.fireStatusChangeEvent(
- FileTransferStatusChangeEvent.IN_PROGRESS);
-
- ft.setTransferedBytes(ev.getProgress());
- ft.fireProgressChangeEvent(
- System.currentTimeMillis(), ev.getProgress());
- }
- else
- ft.fireStatusChangeEvent(getStateMapping(newState));
- }
-
- /**
- * Returns the maximum file length supported by the protocol in bytes.
- * Supports up to 256MB.
- *
- * @return the file length that is supported.
- */
- public long getMaximumFileLength()
- {
- return 268435456l;// = 256*1024*1024;
- }
-
- /**
- * Our listener that will tell us when we're registered to
- */
- private class RegistrationStateListener
- implements RegistrationStateChangeListener
- {
- /**
- * The method is called by a ProtocolProvider implementation whenever
- * a change in the registration state of the corresponding provider had
- * occurred.
- * @param evt ProviderStatusChangeEvent the event describing the status
- * change.
- */
- public void registrationStateChanged(RegistrationStateChangeEvent evt)
- {
- if (logger.isDebugEnabled())
- logger.debug("The provider changed state from: "
- + evt.getOldState()
- + " to: " + evt.getNewState());
-
- if (evt.getNewState() == RegistrationState.REGISTERED)
- {
- yahooProvider.getYahooSession().addSessionFileListener(
- OperationSetFileTransferYahooImpl.this);
- }
- else if (evt.getNewState() == RegistrationState.UNREGISTERED)
- {
- YahooSession ys = yahooProvider.getYahooSession();
- if(ys != null)
- ys.removeSessionFileListener(
- OperationSetFileTransferYahooImpl.this);
- }
- }
- }
-}
diff --git a/src/net/java/sip/communicator/impl/protocol/yahoo/OperationSetPersistentPresenceYahooImpl.java b/src/net/java/sip/communicator/impl/protocol/yahoo/OperationSetPersistentPresenceYahooImpl.java
deleted file mode 100644
index a99bdb7..0000000
--- a/src/net/java/sip/communicator/impl/protocol/yahoo/OperationSetPersistentPresenceYahooImpl.java
+++ /dev/null
@@ -1,954 +0,0 @@
-/*
- * Jitsi, the OpenSource Java VoIP and Instant Messaging client.
- *
- * Copyright @ 2015 Atlassian Pty Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.java.sip.communicator.impl.protocol.yahoo;
-
-import java.io.*;
-import java.util.*;
-
-import net.java.sip.communicator.service.protocol.*;
-import net.java.sip.communicator.service.protocol.event.*;
-import net.java.sip.communicator.service.protocol.yahooconstants.*;
-import net.java.sip.communicator.util.*;
-import ymsg.network.*;
-import ymsg.network.event.*;
-
-/**
- * The Yahoo implementation of a Persistent Presence Operation set. This class
- * manages our own presence status as well as subscriptions for the presence
- * status of our buddies. It also offers methods for retrieving and modifying
- * the buddy contact list and adding listeners for changes in its layout.
- *
- * @author Damian Minkov
- */
-public class OperationSetPersistentPresenceYahooImpl
- extends AbstractOperationSetPersistentPresence<ProtocolProviderServiceYahooImpl>
-{
- private static final Logger logger =
- Logger.getLogger(OperationSetPersistentPresenceYahooImpl.class);
-
- /**
- * Contains our current status message. Note that this field would only
- * be changed once the server has confirmed the new status message and
- * not immediately upon setting a new one..
- */
- private String currentStatusMessage = "";
-
- /**
- * The presence status that we were last notified of entering.
- * The initial one is OFFLINE
- */
- private PresenceStatus currentStatus = YahooStatusEnum.OFFLINE;
-
- /**
- * Sometimes status changes are received before the contact list is inited
- * here we store such events so we can show them correctly
- */
-// private Hashtable earlyStatusChange = new Hashtable();
-
- /**
- * The array list we use when returning from the getSupportedStatusSet()
- * method.
- */
- private static final List<PresenceStatus> supportedPresenceStatusSet = new ArrayList<PresenceStatus>();
- static{
- supportedPresenceStatusSet.add(YahooStatusEnum.AVAILABLE);
- supportedPresenceStatusSet.add(YahooStatusEnum.BE_RIGHT_BACK);
- supportedPresenceStatusSet.add(YahooStatusEnum.BUSY);
- supportedPresenceStatusSet.add(YahooStatusEnum.IDLE);
- supportedPresenceStatusSet.add(YahooStatusEnum.INVISIBLE);
- supportedPresenceStatusSet.add(YahooStatusEnum.NOT_AT_DESK);
- supportedPresenceStatusSet.add(YahooStatusEnum.NOT_AT_HOME);
- supportedPresenceStatusSet.add(YahooStatusEnum.NOT_IN_OFFICE);
- supportedPresenceStatusSet.add(YahooStatusEnum.OFFLINE);
- supportedPresenceStatusSet.add(YahooStatusEnum.ON_THE_PHONE);
- supportedPresenceStatusSet.add(YahooStatusEnum.ON_VACATION);
- supportedPresenceStatusSet.add(YahooStatusEnum.OUT_TO_LUNCH);
- supportedPresenceStatusSet.add(YahooStatusEnum.STEPPED_OUT);
- }
-
- /**
- * A map containing bindings between SIP Communicator's yahoo presence status
- * instances and Yahoo status codes
- */
- private static final Map<PresenceStatus, Long> scToYahooModesMappings
- = new Hashtable<PresenceStatus, Long>();
- static{
- scToYahooModesMappings.put(YahooStatusEnum.AVAILABLE,
- StatusConstants.STATUS_AVAILABLE);
- scToYahooModesMappings.put(YahooStatusEnum.BE_RIGHT_BACK,
- StatusConstants.STATUS_BRB);
- scToYahooModesMappings.put(YahooStatusEnum.BUSY,
- StatusConstants.STATUS_BUSY);
- scToYahooModesMappings.put(YahooStatusEnum.IDLE,
- StatusConstants.STATUS_IDLE);
- scToYahooModesMappings.put(YahooStatusEnum.INVISIBLE,
- StatusConstants.STATUS_INVISIBLE);
- scToYahooModesMappings.put(YahooStatusEnum.NOT_AT_DESK,
- StatusConstants.STATUS_NOTATDESK);
- scToYahooModesMappings.put(YahooStatusEnum.NOT_AT_HOME,
- StatusConstants.STATUS_NOTATHOME);
- scToYahooModesMappings.put(YahooStatusEnum.NOT_IN_OFFICE,
- StatusConstants.STATUS_NOTINOFFICE);
- scToYahooModesMappings.put(YahooStatusEnum.OFFLINE,
- StatusConstants.STATUS_OFFLINE);
- scToYahooModesMappings.put(YahooStatusEnum.ON_THE_PHONE,
- StatusConstants.STATUS_ONPHONE);
- scToYahooModesMappings.put(YahooStatusEnum.ON_VACATION,
- StatusConstants.STATUS_ONVACATION);
- scToYahooModesMappings.put(YahooStatusEnum.OUT_TO_LUNCH,
- StatusConstants.STATUS_OUTTOLUNCH);
- scToYahooModesMappings.put(YahooStatusEnum.STEPPED_OUT,
- StatusConstants.STATUS_STEPPEDOUT);
- }
-
- /**
- * The server stored contact list that will be encapsulating smack's
- * buddy list.
- */
- private ServerStoredContactListYahooImpl ssContactList = null;
-
- /**
- * Listens for events that are fired while registering to server.
- * After we are registered instance is cleared and never used.
- */
- private EarlyEventListener earlyEventListener = null;
-
- /**
- * Status events are received before subscription one.
- * And when subscription is received we deliver
- * and the status events.
- */
- private StatusUpdater statusUpdater = new StatusUpdater();
-
- public OperationSetPersistentPresenceYahooImpl(
- ProtocolProviderServiceYahooImpl provider)
- {
- super(provider);
-
- ssContactList = new ServerStoredContactListYahooImpl( this , provider);
-
- parentProvider.addRegistrationStateChangeListener(
- new RegistrationStateListener());
- }
-
- /**
- * Registers a listener that would receive events upong changes in server
- * stored groups.
- *
- * @param listener a ServerStoredGroupChangeListener impl that would
- * receive events upong group changes.
- */
- @Override
- public void addServerStoredGroupChangeListener(ServerStoredGroupListener
- listener)
- {
- ssContactList.addGroupListener(listener);
- }
-
- /**
- * Creates a group with the specified name and parent in the server
- * stored contact list.
- *
- * @param parent the group where the new group should be created
- * @param groupName the name of the new group to create.
- * @throws OperationFailedException if such group already exists
- */
- public void createServerStoredContactGroup(ContactGroup parent,
- String groupName)
- throws OperationFailedException
- {
- assertConnected();
-
- if (!parent.canContainSubgroups())
- throw new IllegalArgumentException(
- "The specified contact group cannot contain child groups. Group:"
- + parent );
-
- ssContactList.createGroup(groupName);
- }
-
- /**
- * Creates a non persistent contact for the specified address. This would
- * also create (if necessary) a group for volatile contacts that would not
- * be added to the server stored contact list. The volatile contact would
- * remain in the list until it is really added to the contact list or
- * until the application is terminated.
- * @param id the address of the contact to create.
- * @return the newly created volatile <tt>ContactImpl</tt>
- */
- public ContactYahooImpl createVolatileContact(String id)
- {
- return ssContactList.createVolatileContact(id);
- }
-
- /**
- * Creates and returns a unresolved contact from the specified
- * <tt>address</tt> and <tt>persistentData</tt>.
- *
- * @param address an identifier of the contact that we'll be creating.
- * @param persistentData a String returned Contact's getPersistentData()
- * method during a previous run and that has been persistently stored
- * locally.
- * @param parentGroup the group where the unresolved contact is supposed
- * to belong to.
- * @return the unresolved <tt>Contact</tt> created from the specified
- * <tt>address</tt> and <tt>persistentData</tt>
- */
- public Contact createUnresolvedContact(String address,
- String persistentData,
- ContactGroup parentGroup)
- {
- if(! (parentGroup instanceof ContactGroupYahooImpl ||
- parentGroup instanceof RootContactGroupYahooImpl) )
- throw new IllegalArgumentException(
- "Argument is not an yahoo contact group (group="
- + parentGroup + ")");
-
- ContactYahooImpl contact =
- ssContactList.createUnresolvedContact(parentGroup, address);
-
- contact.setPersistentData(persistentData);
-
- return contact;
- }
-
- /**
- * Creates and returns a unresolved contact from the specified
- * <tt>address</tt> and <tt>persistentData</tt>.
- *
- * @param address an identifier of the contact that we'll be creating.
- * @param persistentData a String returned Contact's getPersistentData()
- * method during a previous run and that has been persistently stored
- * locally.
- * @return the unresolved <tt>Contact</tt> created from the specified
- * <tt>address</tt> and <tt>persistentData</tt>
- */
- public Contact createUnresolvedContact(String address,
- String persistentData)
- {
- return createUnresolvedContact( address
- , persistentData
- , getServerStoredContactListRoot());
- }
-
- /**
- * Creates and returns a unresolved contact group from the specified
- * <tt>address</tt> and <tt>persistentData</tt>.
- *
- * @param groupUID an identifier, returned by ContactGroup's
- * getGroupUID, that the protocol provider may use in order to create
- * the group.
- * @param persistentData a String returned ContactGroups's
- * getPersistentData() method during a previous run and that has been
- * persistently stored locally.
- * @param parentGroup the group under which the new group is to be
- * created or null if this is group directly underneath the root.
- * @return the unresolved <tt>ContactGroup</tt> created from the
- * specified <tt>uid</tt> and <tt>persistentData</tt>
- */
- public ContactGroup createUnresolvedContactGroup(String groupUID,
- String persistentData, ContactGroup parentGroup)
- {
- return ssContactList.createUnresolvedContactGroup(groupUID);
- }
-
- /**
- * Returns a reference to the contact with the specified ID in case we
- * have a subscription for it and null otherwise/
- *
- * @param contactID a String identifier of the contact which we're
- * seeking a reference of.
- * @return a reference to the Contact with the specified
- * <tt>contactID</tt> or null if we don't have a subscription for the
- * that identifier.
- */
- public Contact findContactByID(String contactID)
- {
- return ssContactList.findContactById(contactID);
- }
-
- /**
- * Returns the status message that was confirmed by the serfver
- *
- * @return the last status message that we have requested and the aim
- * server has confirmed.
- */
- public String getCurrentStatusMessage()
- {
- return currentStatusMessage;
- }
-
- /**
- * Returns the protocol specific contact instance representing the local
- * user.
- *
- * @return the Contact (address, phone number, or uin) that the Provider
- * implementation is communicating on behalf of.
- */
- public Contact getLocalContact()
- {
- return null;
- }
-
- /**
- * Returns a PresenceStatus instance representing the state this provider
- * is currently in.
- *
- * @return the PresenceStatus last published by this provider.
- */
- public PresenceStatus getPresenceStatus()
- {
- return currentStatus;
- }
-
- /**
- * Returns the root group of the server stored contact list.
- *
- * @return the root ContactGroup for the ContactList stored by this
- * service.
- */
- public ContactGroup getServerStoredContactListRoot()
- {
- return ssContactList.getRootGroup();
- }
-
- /**
- * Returns the set of PresenceStatus objects that a user of this service
- * may request the provider to enter.
- *
- * @return Iterator a PresenceStatus array containing "enterable" status
- * instances.
- */
- public Iterator<PresenceStatus> getSupportedStatusSet()
- {
- return supportedPresenceStatusSet.iterator();
- }
-
- /**
- * Removes the specified contact from its current parent and places it
- * under <tt>newParent</tt>.
- *
- * @param contactToMove the <tt>Contact</tt> to move
- * @param newParent the <tt>ContactGroup</tt> where <tt>Contact</tt>
- * would be placed.
- */
- public void moveContactToGroup(Contact contactToMove,
- ContactGroup newParent)
- {
- assertConnected();
-
- if( !(contactToMove instanceof ContactYahooImpl) )
- throw new IllegalArgumentException(
- "The specified contact is not an yahoo contact." + contactToMove);
- if( !(newParent instanceof ContactGroupYahooImpl) )
- throw new IllegalArgumentException(
- "The specified group is not an yahoo contact group."
- + newParent);
-
- ssContactList.moveContact((ContactYahooImpl)contactToMove,
- (ContactGroupYahooImpl)newParent);
- }
-
- /**
- * Requests the provider to enter into a status corresponding to the
- * specified paramters.
- *
- * @param status the PresenceStatus as returned by
- * getRequestableStatusSet
- * @param statusMessage the message that should be set as the reason to
- * enter that status
- * @throws IllegalArgumentException if the status requested is not a
- * valid PresenceStatus supported by this provider.
- * @throws IllegalStateException if the provider is not currently
- * registered.
- * @throws OperationFailedException with code NETWORK_FAILURE if
- * publishing the status fails due to a network error.
- */
- public void publishPresenceStatus(PresenceStatus status,
- String statusMessage) throws
- IllegalArgumentException, IllegalStateException,
- OperationFailedException
- {
- assertConnected();
-
- if (!(status instanceof YahooStatusEnum))
- throw new IllegalArgumentException(
- status + " is not a valid Yahoo status");
-
- if(status.equals(YahooStatusEnum.OFFLINE))
- {
- parentProvider.unregister();
- return;
- }
-
- try
- {
- if(statusMessage != null && statusMessage.length() != 0)
- {
- boolean isAvailable = false;
-
- if(status.equals(YahooStatusEnum.AVAILABLE))
- isAvailable = true;
-
- // false - away
- // true - available
- parentProvider.getYahooSession().
- setStatus(statusMessage, isAvailable);
- }
-
- parentProvider.getYahooSession().setStatus(
- scToYahooModesMappings.get(status).longValue());
-
- fireProviderStatusChangeEvent(currentStatus, status);
- }
- catch(IOException ex)
- {
- throw new OperationFailedException("Failed to set Status",
- OperationFailedException.NETWORK_FAILURE);
- }
- }
-
- /**
- * Get the PresenceStatus for a particular contact.
- *
- * @param contactIdentifier the identifier of the contact whose status
- * we're interested in.
- * @return PresenceStatus the <tt>PresenceStatus</tt> of the specified
- * <tt>contact</tt>
- * @throws IllegalArgumentException if <tt>contact</tt> is not a contact
- * known to the underlying protocol provider
- * @throws IllegalStateException if the underlying protocol provider is
- * not registered/signed on a public service.
- * @throws OperationFailedException with code NETWORK_FAILURE if
- * retrieving the status fails due to errors experienced during
- * network communication
- */
- public PresenceStatus queryContactStatus(String contactIdentifier) throws
- IllegalArgumentException, IllegalStateException,
- OperationFailedException
- {
-
- ContactYahooImpl contact = ssContactList.findContactById(contactIdentifier);
- if(contact == null)
- {
- if (logger.isInfoEnabled())
- logger.info("Contact not found id :" + contactIdentifier);
- return null;
- }
- else
- return yahooStatusToPresenceStatus(contact.getSourceContact().getStatus());
- }
-
- /**
- * Removes the specified group from the server stored contact list.
- *
- * @param group the group to remove.
- */
- public void removeServerStoredContactGroup(ContactGroup group)
- {
- assertConnected();
-
- if( !(group instanceof ContactGroupYahooImpl) )
- throw new IllegalArgumentException(
- "The specified group is not an yahoo contact group: " + group);
-
- ssContactList.removeGroup(((ContactGroupYahooImpl)group));
- }
-
- /**
- * Removes the specified group change listener so that it won't receive
- * any further events.
- *
- * @param listener the ServerStoredGroupChangeListener to remove
- */
- @Override
- public void removeServerStoredGroupChangeListener(ServerStoredGroupListener
- listener)
- {
- ssContactList.removeGroupListener(listener);
- }
-
- /**
- * Renames the specified group from the server stored contact list.
- *
- * @param group the group to rename.
- * @param newName the new name of the group.
- */
- public void renameServerStoredContactGroup(ContactGroup group,
- String newName)
- {
- assertConnected();
-
- if( !(group instanceof ContactGroupYahooImpl) )
- throw new IllegalArgumentException(
- "The specified group is not an yahoo contact group: " + group);
-
- throw new UnsupportedOperationException("Renaming group not supported!");
- //ssContactList.renameGroup((ContactGroupYahooImpl)group, newName);
- }
-
- /**
- * Handler for incoming authorization requests.
- *
- * @param handler an instance of an AuthorizationHandler for
- * authorization requests coming from other users requesting
- * permission add us to their contact list.
- */
- public void setAuthorizationHandler(AuthorizationHandler handler)
- {
- ssContactList.setAuthorizationHandler(handler);
-
- // we got a handler. Lets process if something has came
- // during login process
- if(earlyEventListener != null)
- {
- earlyEventListener.processEarlyAuthorizations();
- earlyEventListener = null;
- }
- }
-
- /**
- * Persistently adds a subscription for the presence status of the
- * contact corresponding to the specified contactIdentifier and indicates
- * that it should be added to the specified group of the server stored
- * contact list.
- *
- * @param parent the parent group of the server stored contact list
- * where the contact should be added. <p>
- * @param contactIdentifier the contact whose status updates we are
- * subscribing for.
- * @throws IllegalArgumentException if <tt>contact</tt> or
- * <tt>parent</tt> are not a contact known to the underlying protocol
- * provider.
- * @throws IllegalStateException if the underlying protocol provider is
- * not registered/signed on a public service.
- * @throws OperationFailedException with code NETWORK_FAILURE if
- * subscribing fails due to errors experienced during network
- * communication
- */
- public void subscribe(ContactGroup parent, String contactIdentifier) throws
- IllegalArgumentException, IllegalStateException,
- OperationFailedException
- {
- assertConnected();
-
- if(! (parent instanceof ContactGroupYahooImpl) )
- throw new IllegalArgumentException(
- "Argument is not an yahoo contact group (group=" + parent + ")");
-
- ssContactList.addContact((ContactGroupYahooImpl)parent, contactIdentifier);
- }
-
- /**
- * Adds a subscription for the presence status of the contact
- * corresponding to the specified contactIdentifier.
- *
- * @param contactIdentifier the identifier of the contact whose status
- * updates we are subscribing for. <p>
- * @throws IllegalArgumentException if <tt>contact</tt> is not a contact
- * known to the underlying protocol provider
- * @throws IllegalStateException if the underlying protocol provider is
- * not registered/signed on a public service.
- * @throws OperationFailedException with code NETWORK_FAILURE if
- * subscribing fails due to errors experienced during network
- * communication
- */
- public void subscribe(String contactIdentifier) throws
- IllegalArgumentException, IllegalStateException,
- OperationFailedException
- {
- assertConnected();
-
- ssContactList.addContact(contactIdentifier);
- }
-
- /**
- * Removes a subscription for the presence status of the specified
- * contact.
- *
- * @param contact the contact whose status updates we are unsubscribing
- * from.
- * @throws IllegalArgumentException if <tt>contact</tt> is not a contact
- * known to the underlying protocol provider
- * @throws IllegalStateException if the underlying protocol provider is
- * not registered/signed on a public service.
- * @throws OperationFailedException with code NETWORK_FAILURE if
- * unsubscribing fails due to errors experienced during network
- * communication
- */
- public void unsubscribe(Contact contact) throws IllegalArgumentException,
- IllegalStateException, OperationFailedException
- {
- assertConnected();
-
- if(! (contact instanceof ContactYahooImpl) )
- throw new IllegalArgumentException(
- "Argument is not an yahoo contact (contact=" + contact + ")");
-
- ssContactList.removeContact((ContactYahooImpl)contact);
- }
-
- /**
- * Converts the specified yahoo status to one of the status fields of the
- * YahooStatusEnum class.
- *
- * @param status the yahoo Status
- * @return a PresenceStatus instance representation of the yahoo Status
- * parameter. The returned result is one of the YahooStatusEnum fields.
- */
- YahooStatusEnum yahooStatusToPresenceStatus(long status)
- {
- if(status == StatusConstants.STATUS_AVAILABLE)
- return YahooStatusEnum.AVAILABLE;
- else if(status == StatusConstants.STATUS_BRB)
- return YahooStatusEnum.BE_RIGHT_BACK;
- else if(status == StatusConstants.STATUS_BUSY)
- return YahooStatusEnum.BUSY;
- else if(status == StatusConstants.STATUS_NOTATHOME)
- return YahooStatusEnum.NOT_AT_HOME;
- else if(status == StatusConstants.STATUS_NOTATDESK)
- return YahooStatusEnum.NOT_AT_DESK;
- else if(status == StatusConstants.STATUS_NOTINOFFICE)
- return YahooStatusEnum.NOT_IN_OFFICE;
- else if(status == StatusConstants.STATUS_ONPHONE)
- return YahooStatusEnum.ON_THE_PHONE;
- else if(status == StatusConstants.STATUS_ONVACATION)
- return YahooStatusEnum.ON_VACATION;
- else if(status == StatusConstants.STATUS_OUTTOLUNCH)
- return YahooStatusEnum.OUT_TO_LUNCH;
- else if(status == StatusConstants.STATUS_STEPPEDOUT)
- return YahooStatusEnum.STEPPED_OUT;
- else if(status == StatusConstants.STATUS_INVISIBLE)
- return YahooStatusEnum.INVISIBLE;
- else if(status == StatusConstants.STATUS_IDLE)
- return YahooStatusEnum.IDLE;
- else if(status == StatusConstants.STATUS_OFFLINE)
- return YahooStatusEnum.OFFLINE;
- // Yahoo supports custom statuses so if such is set just return available
- else
- return YahooStatusEnum.AVAILABLE;
- }
-
- /**
- * Utility method throwing an exception if the stack is not properly
- * initialized.
- * @throws java.lang.IllegalStateException if the underlying stack is
- * not registered and initialized.
- */
- private void assertConnected() throws IllegalStateException
- {
- if (parentProvider == null)
- throw new IllegalStateException(
- "The provider must be non-null and signed on the yahoo "
- +"service before being able to communicate.");
- if (!parentProvider.isRegistered())
- throw new IllegalStateException(
- "The provider must be signed on the yahoo service before "
- +"being able to communicate.");
- }
-
- /**
- * Notify all provider presence listeners of the corresponding event change
- *
- * @param oldStatus
- * the status our stack had so far
- * @param newStatus
- * the status we have from now on
- */
- @Override
- protected void fireProviderStatusChangeEvent(
- PresenceStatus oldStatus,
- PresenceStatus newStatus)
- {
- if (!oldStatus.equals(newStatus))
- {
- currentStatus = newStatus;
-
- super.fireProviderStatusChangeEvent(oldStatus, newStatus);
- }
- }
-
- /**
- * Statuses have been received durring login process
- * so we will init them once we are logged in
- */
- private void initContactStatuses()
- {
- YahooGroup[] groups = parentProvider.getYahooSession().getGroups();
-
- for (YahooGroup item : groups)
- {
- @SuppressWarnings("unchecked")
- Iterable<YahooUser> members = item.getMembers();
-
- for (YahooUser user : members)
- {
- ContactYahooImpl sourceContact =
- ssContactList.findContactById(user.getId());
-
- if(sourceContact != null)
- handleContactStatusChange(sourceContact, user);
- }
- }
- }
-
- /**
- * Our listener that will tell us when we're registered to server
- * and is ready to accept us as a listener.
- */
- private class RegistrationStateListener
- implements RegistrationStateChangeListener
- {
- /**
- * The method is called by a ProtocolProvider implementation whenever
- * a change in the registration state of the corresponding provider had
- * occurred.
- * @param evt ProviderStatusChangeEvent the event describing the status
- * change.
- */
- public void registrationStateChanged(RegistrationStateChangeEvent evt)
- {
- if (logger.isDebugEnabled())
- logger.debug("The yahoo provider changed state from: "
- + evt.getOldState()
- + " to: " + evt.getNewState());
-
- if(evt.getNewState() == RegistrationState.REGISTERING)
- {
- // add new listener waiting for events during login process
- earlyEventListener
- = new EarlyEventListener(parentProvider.getYahooSession());
- }
- else if(evt.getNewState() == RegistrationState.REGISTERED)
- {
- parentProvider.getYahooSession().
- addSessionListener(new StatusChangedListener());
-
- ssContactList.setYahooSession(parentProvider.getYahooSession());
-
- initContactStatuses();
-
- addSubscriptionListener(statusUpdater);
-
- if(earlyEventListener != null)
- {
- earlyEventListener.dispose();
- earlyEventListener = null;
- }
- }
- else if(evt.getNewState() == RegistrationState.UNREGISTERED
- || evt.getNewState() == RegistrationState.AUTHENTICATION_FAILED
- || evt.getNewState() == RegistrationState.CONNECTION_FAILED)
- {
- //since we are disconnected, we won't receive any further status
- //updates so we need to change by ourselves our own status as
- //well as set to offline all contacts in our contact list that
- //were online
- PresenceStatus oldStatus = currentStatus;
- currentStatus = YahooStatusEnum.OFFLINE;
-
- fireProviderStatusChangeEvent(oldStatus, currentStatus);
-
- removeSubscriptionListener(statusUpdater);
-
- //send event notifications saying that all our buddies are
- //offline. The protocol does not implement top level buddies
- //nor subgroups for top level groups so a simple nested loop
- //would be enough.
- Iterator<ContactGroup> groupsIter =
- getServerStoredContactListRoot().subgroups();
- while(groupsIter.hasNext())
- {
- ContactGroup group = groupsIter.next();
- Iterator<Contact> contactsIter = group.contacts();
-
- while(contactsIter.hasNext())
- {
- ContactYahooImpl contact
- = (ContactYahooImpl)contactsIter.next();
-
- PresenceStatus oldContactStatus
- = contact.getPresenceStatus();
-
- if(!oldContactStatus.isOnline())
- continue;
-
- contact.updatePresenceStatus(YahooStatusEnum.OFFLINE);
-
- fireContactPresenceStatusChangeEvent(
- contact
- , contact.getParentContactGroup()
- , oldContactStatus, YahooStatusEnum.OFFLINE);
- }
- }
-
- // clear listener
- if(earlyEventListener != null)
- {
- earlyEventListener.dispose();
- earlyEventListener = null;
- }
- }
- }
- }
-
- private void handleContactStatusChange(YahooUser yFriend)
- {
- ContactYahooImpl sourceContact =
- ssContactList.findContactById(yFriend.getId());
-
- if(sourceContact == null)
- {
- if(parentProvider.getAccountID().getUserID().
- equals(yFriend.getId()))
- {
- // thats my own status
- if (logger.isTraceEnabled())
- logger.trace("Own status changed to " + yFriend.getStatus());
- PresenceStatus oldStatus = currentStatus;
- currentStatus =
- yahooStatusToPresenceStatus(yFriend.getStatus());
- fireProviderStatusChangeEvent(oldStatus, currentStatus);
-
- return;
- }
- // strange
- else
- return;
- }
-
- handleContactStatusChange(sourceContact, yFriend);
- }
-
- void handleContactStatusChange(ContactYahooImpl sourceContact, YahooUser yFriend)
- {
- PresenceStatus oldStatus
- = sourceContact.getPresenceStatus();
-
- PresenceStatus newStatus = yahooStatusToPresenceStatus(yFriend.getStatus());
-
- // statuses maybe the same and only change in status message
- sourceContact.setStatusMessage(yFriend.getCustomStatusMessage());
-
- // when old and new status are the same do nothing - no change
- if(oldStatus.equals(newStatus))
- {
- if (logger.isDebugEnabled())
- logger.debug("old(" + oldStatus + ") and new("+ newStatus + ") statuses are the same!");
- return;
- }
-
- sourceContact.updatePresenceStatus(newStatus);
-
- ContactGroup parent
- = ssContactList.findContactGroup(sourceContact);
-
- if (logger.isDebugEnabled())
- logger.debug("Will Dispatch the contact status event.");
- fireContactPresenceStatusChangeEvent(sourceContact, parent,
- oldStatus, newStatus);
- }
-
- private class StatusChangedListener
- extends SessionAdapter
- {
- @Override
- public void friendsUpdateReceived(SessionFriendEvent evt)
- {
- if (logger.isDebugEnabled())
- logger.debug("Received a status update for contact " + evt);
-
- if(evt.getFriend() != null)
- {
- handleContactStatusChange(evt.getFriend());
- }
- else if(evt.getFriends() != null)
- {
- YahooUser[] yfs = evt.getFriends();
- for (int i = 0; i < yfs.length; i++)
- handleContactStatusChange(yfs[i]);
- }
- }
- }
-
- /**
- * Updates the statuses of newly created persistent contacts
- */
- private class StatusUpdater
- extends SubscriptionAdapter
- {
- @Override
- public void subscriptionCreated(SubscriptionEvent evt)
- {
- ContactYahooImpl contact =
- (ContactYahooImpl)evt.getSourceContact();
-
- if(!contact.isPersistent() || !contact.isResolved())
- return;
-
- handleContactStatusChange(contact, contact.getSourceContact());
- }
- }
-
- private class EarlyEventListener
- extends SessionAdapter
- {
- private final List<SessionAuthorizationEvent> receivedAuthorizations
- = new Vector<SessionAuthorizationEvent>();
-
- /**
- * The <code>YahooSession</code> this instance is listening to because
- * the <code>YahooSession</code> isn't available in
- * <code>parentProvider</code> after
- * {@link RegistrationState#UNREGISTERED} and then this listener cannot
- * be removed.
- */
- private final YahooSession yahooSession;
-
- public EarlyEventListener(YahooSession yahooSession)
- {
- this.yahooSession = yahooSession;
- this.yahooSession.addSessionListener(this);
- }
-
- @Override
- public void authorizationReceived(SessionAuthorizationEvent ev)
- {
- if(ev.isAuthorizationRequest())
- {
- if (logger.isTraceEnabled())
- logger.trace("authorizationRequestReceived from " +
- ev.getFrom());
- receivedAuthorizations.add(ev);
- }
- }
-
- public void dispose()
- {
- yahooSession.removeSessionListener(this);
- }
-
- public void processEarlyAuthorizations()
- {
- for (SessionAuthorizationEvent e : receivedAuthorizations)
- {
- ssContactList.processAuthorizationRequest(e);
- }
- }
- }
-}
diff --git a/src/net/java/sip/communicator/impl/protocol/yahoo/OperationSetTypingNotificationsYahooImpl.java b/src/net/java/sip/communicator/impl/protocol/yahoo/OperationSetTypingNotificationsYahooImpl.java
deleted file mode 100644
index 81e266a..0000000
--- a/src/net/java/sip/communicator/impl/protocol/yahoo/OperationSetTypingNotificationsYahooImpl.java
+++ /dev/null
@@ -1,153 +0,0 @@
-/*
- * Jitsi, the OpenSource Java VoIP and Instant Messaging client.
- *
- * Copyright @ 2015 Atlassian Pty Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.java.sip.communicator.impl.protocol.yahoo;
-
-import net.java.sip.communicator.service.protocol.*;
-import net.java.sip.communicator.service.protocol.event.*;
-import net.java.sip.communicator.util.*;
-import ymsg.network.event.*;
-
-/**
- * Maps SIP Communicator typing notifications to those going and coming from
- * smack lib.
- *
- * @author Damian Minkov
- */
-public class OperationSetTypingNotificationsYahooImpl
- extends AbstractOperationSetTypingNotifications<ProtocolProviderServiceYahooImpl>
-{
- private static final Logger logger =
- Logger.getLogger(OperationSetTypingNotificationsYahooImpl.class);
-
- /**
- * An active instance of the opSetPersPresence operation set. We're using
- * it to map incoming events to contacts in our contact list.
- */
- private OperationSetPersistentPresenceYahooImpl opSetPersPresence = null;
-
- /**
- * @param provider a ref to the <tt>ProtocolProviderServiceImpl</tt>
- * that created us and that we'll use for retrieving the underlying aim
- * connection.
- */
- OperationSetTypingNotificationsYahooImpl(
- ProtocolProviderServiceYahooImpl provider)
- {
- super(provider);
-
- provider.addRegistrationStateChangeListener(new ProviderRegListener());
- }
-
- /**
- * Sends a notification to <tt>notifiedContatct</tt> that we have entered
- * <tt>typingState</tt>.
- *
- * @param notifiedContact the <tt>Contact</tt> to notify
- * @param typingState the typing state that we have entered.
- *
- * @throws java.lang.IllegalStateException if the underlying stack is
- * not registered and initialized.
- * @throws java.lang.IllegalArgumentException if <tt>notifiedContact</tt> is
- * not an instance belonging to the underlying implementation.
- */
- public void sendTypingNotification(Contact notifiedContact, int typingState)
- throws IllegalStateException, IllegalArgumentException
- {
- assertConnected();
-
- if( !(notifiedContact instanceof ContactYahooImpl) )
- throw new IllegalArgumentException(
- "The specified contact is not an yahoo contact."
- + notifiedContact);
-
- if(typingState == OperationSetTypingNotifications.STATE_TYPING)
- {
-
- parentProvider.getYahooSession().
- keyTyped(notifiedContact.getAddress(),
- parentProvider.getAccountID().getUserID());
- }
- else
- if(typingState == OperationSetTypingNotifications.STATE_STOPPED ||
- typingState == OperationSetTypingNotifications.STATE_PAUSED)
- {
- parentProvider.getYahooSession().
- stopTyping(notifiedContact.getAddress(),
- parentProvider.getAccountID().getUserID());
- }
- }
-
- private class TypingListener
- extends SessionAdapter
- {
- @Override
- public void notifyReceived(SessionNotifyEvent evt)
- {
- if(evt.isTyping())
- {
- String typingUserID = evt.getFrom();
-
- if(typingUserID != null)
- {
- Contact sourceContact =
- opSetPersPresence.findContactByID(typingUserID);
-
- if(sourceContact == null)
- return;
-
- // typing on
- fireTypingNotificationsEvent(
- sourceContact,
- (evt.getMode() == 1) ? STATE_TYPING : STATE_STOPPED);
- }
- }
- }
- }
-
- /**
- * Our listener that will tell us when we're registered and
- * ready to accept us as a listener.
- */
- private class ProviderRegListener
- implements RegistrationStateChangeListener
- {
- /**
- * The method is called by a ProtocolProvider implementation whenever
- * a change in the registration state of the corresponding provider had
- * occurred.
- * @param evt ProviderStatusChangeEvent the event describing the status
- * change.
- */
- public void registrationStateChanged(RegistrationStateChangeEvent evt)
- {
- if (logger.isDebugEnabled())
- logger.debug("The provider changed state from: "
- + evt.getOldState()
- + " to: " + evt.getNewState());
- if (evt.getNewState() == RegistrationState.REGISTERED)
- {
- opSetPersPresence =
- (OperationSetPersistentPresenceYahooImpl) parentProvider
- .getOperationSet(OperationSetPersistentPresence.class);
-
- parentProvider
- .getYahooSession().addSessionListener(new TypingListener());
- }
- }
- }
-}
diff --git a/src/net/java/sip/communicator/impl/protocol/yahoo/ProtocolIconYahooImpl.java b/src/net/java/sip/communicator/impl/protocol/yahoo/ProtocolIconYahooImpl.java
deleted file mode 100644
index 34befc9..0000000
--- a/src/net/java/sip/communicator/impl/protocol/yahoo/ProtocolIconYahooImpl.java
+++ /dev/null
@@ -1,173 +0,0 @@
-/*
- * Jitsi, the OpenSource Java VoIP and Instant Messaging client.
- *
- * Copyright @ 2015 Atlassian Pty Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.java.sip.communicator.impl.protocol.yahoo;
-
-import java.io.*;
-import java.util.*;
-
-import net.java.sip.communicator.service.protocol.*;
-import net.java.sip.communicator.util.*;
-
-import org.jitsi.service.resources.*;
-import org.osgi.framework.*;
-
-/**
- * Represents the Yahoo protocol icon. Implements the <tt>ProtocolIcon</tt>
- * interface in order to provide an Yahoo icon image in two different sizes.
- *
- * @author Yana Stamcheva
- */
-public class ProtocolIconYahooImpl
- implements ProtocolIcon
-{
- private static Logger logger = Logger.getLogger(ProtocolIconYahooImpl.class);
-
- private static ResourceManagementService resourcesService;
-
- /**
- * A hash table containing the protocol icon in different sizes.
- */
- private static Hashtable<String, byte[]> iconsTable
- = new Hashtable<String, byte[]>();
- static
- {
- iconsTable.put(ProtocolIcon.ICON_SIZE_16x16,
- getImageInBytes("service.protocol.yahoo.YAHOO_16x16"));
-
- iconsTable.put(ProtocolIcon.ICON_SIZE_32x32,
- getImageInBytes("service.protocol.yahoo.YAHOO_32x32"));
-
- iconsTable.put(ProtocolIcon.ICON_SIZE_48x48,
- getImageInBytes("service.protocol.yahoo.YAHOO_48x48"));
-
- iconsTable.put(ProtocolIcon.ICON_SIZE_64x64,
- getImageInBytes("service.protocol.yahoo.YAHOO_64x64"));
- }
-
- /**
- * A hash table containing the protocol icon in different sizes.
- */
- private static Hashtable<String, String> iconPathsTable
- = new Hashtable<String, String>();
- static
- {
- iconPathsTable.put(ProtocolIcon.ICON_SIZE_16x16,
- getResources().getImagePath("service.protocol.yahoo.YAHOO_16x16"));
-
- iconPathsTable.put(ProtocolIcon.ICON_SIZE_32x32,
- getResources().getImagePath("service.protocol.yahoo.YAHOO_32x32"));
-
- iconPathsTable.put(ProtocolIcon.ICON_SIZE_48x48,
- getResources().getImagePath("service.protocol.yahoo.YAHOO_48x48"));
-
- iconPathsTable.put(ProtocolIcon.ICON_SIZE_64x64,
- getResources().getImagePath("service.protocol.yahoo.YAHOO_64x64"));
- }
-
- /**
- * Implements the <tt>ProtocolIcon.getSupportedSizes()</tt> method. Returns
- * an iterator to a set containing the supported icon sizes.
- * @return an iterator to a set containing the supported icon sizes
- */
- public Iterator<String> getSupportedSizes()
- {
- return iconsTable.keySet().iterator();
- }
-
- /**
- * Returns TRUE if a icon with the given size is supported, FALSE-otherwise.
- */
- public boolean isSizeSupported(String iconSize)
- {
- return iconsTable.containsKey(iconSize);
- }
-
- /**
- * Returns the icon image in the given size.
- * @param iconSize the icon size; one of ICON_SIZE_XXX constants
- */
- public byte[] getIcon(String iconSize)
- {
- return iconsTable.get(iconSize);
- }
-
- /**
- * Returns a path to the icon with the given size.
- * @param iconSize the size of the icon we're looking for
- * @return the path to the icon with the given size
- */
- public String getIconPath(String iconSize)
- {
- return iconPathsTable.get(iconSize);
- }
-
- /**
- * Returns the icon image used to represent the protocol connecting state.
- * @return the icon image used to represent the protocol connecting state
- */
- public byte[] getConnectingIcon()
- {
- return getImageInBytes("yahooConnectingIcon");
- }
-
- /**
- * Returns the byte representation of the image corresponding to the given
- * identifier.
- *
- * @param imageID the identifier of the image
- * @return the byte representation of the image corresponding to the given
- * identifier.
- */
- public static byte[] getImageInBytes(String imageID)
- {
- InputStream in = getResources().getImageInputStream(imageID);
-
- if (in == null)
- return null;
- byte[] image = null;
- try
- {
- image = new byte[in.available()];
-
- in.read(image);
- }
- catch (IOException e)
- {
- logger.error("Failed to load image:" + imageID, e);
- }
-
- return image;
- }
-
- public static ResourceManagementService getResources()
- {
- if (resourcesService == null)
- {
- ServiceReference serviceReference = YahooActivator.getBundleContext()
- .getServiceReference(ResourceManagementService.class.getName());
-
- if(serviceReference == null)
- return null;
-
- resourcesService = (ResourceManagementService)
- YahooActivator.getBundleContext().getService(serviceReference);
- }
-
- return resourcesService;
- }
-}
diff --git a/src/net/java/sip/communicator/impl/protocol/yahoo/ProtocolProviderFactoryYahooImpl.java b/src/net/java/sip/communicator/impl/protocol/yahoo/ProtocolProviderFactoryYahooImpl.java
deleted file mode 100644
index 358286c..0000000
--- a/src/net/java/sip/communicator/impl/protocol/yahoo/ProtocolProviderFactoryYahooImpl.java
+++ /dev/null
@@ -1,172 +0,0 @@
-/*
- * Jitsi, the OpenSource Java VoIP and Instant Messaging client.
- *
- * Copyright @ 2015 Atlassian Pty Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.java.sip.communicator.impl.protocol.yahoo;
-
-import java.util.*;
-
-import net.java.sip.communicator.service.protocol.*;
-
-import org.osgi.framework.*;
-
-/**
- * The Yahoo implementation of the ProtocolProviderFactory.
- * @author Damian Minkov
- */
-public class ProtocolProviderFactoryYahooImpl
- extends ProtocolProviderFactory
-{
-
- /**
- * Creates an instance of the ProtocolProviderFactoryYahooImpl.
- */
- protected ProtocolProviderFactoryYahooImpl()
- {
- super(YahooActivator.getBundleContext(), ProtocolNames.YAHOO);
- }
-
- /**
- * Initializes and creates an account corresponding to the specified
- * accountProperties and registers the resulting ProtocolProvider in the
- * <tt>context</tt> BundleContext parameter. This method has a persistent
- * effect. Once created the resulting account will remain installed until
- * removed through the uninstall account method.
- *
- * @param userIDStr the user identifier for the new account
- * @param accountProperties a set of protocol (or implementation)
- * specific properties defining the new account.
- * @return the AccountID of the newly created account
- */
- @Override
- public AccountID installAccount( String userIDStr,
- Map<String, String> accountProperties)
- {
- BundleContext context
- = YahooActivator.getBundleContext();
- if (context == null)
- throw new NullPointerException("The specified BundleContext was null");
-
- if (userIDStr == null)
- throw new NullPointerException("The specified AccountID was null");
-
- if (accountProperties == null)
- throw new NullPointerException("The specified property map was null");
-
- accountProperties.put(USER_ID, userIDStr);
-
- AccountID accountID = new YahooAccountID(userIDStr, accountProperties);
-
- //make sure we haven't seen this account id before.
- if( registeredAccounts.containsKey(accountID) )
- throw new IllegalStateException(
- "An account for id " + userIDStr + " was already installed!");
-
- //first store the account and only then load it as the load generates
- //an osgi event, the osgi event triggers (through the UI) a call to
- //the register() method and it needs to access the configuration service
- //and check for a password.
- this.storeAccount(accountID, false);
-
- accountID = loadAccount(accountProperties);
-
- return accountID;
- }
-
- @Override
- protected AccountID createAccountID(String userID, Map<String, String> accountProperties)
- {
- return new YahooAccountID(userID, accountProperties);
- }
-
- @Override
- protected ProtocolProviderService createService(String userID,
- AccountID accountID)
- {
- ProtocolProviderServiceYahooImpl service =
- new ProtocolProviderServiceYahooImpl();
-
- service.initialize(userID, accountID);
- return service;
- }
-
- @Override
- public void modifyAccount( ProtocolProviderService protocolProvider,
- Map<String, String> accountProperties)
- throws NullPointerException
- {
- BundleContext context
- = YahooActivator.getBundleContext();
-
- if (context == null)
- throw new NullPointerException(
- "The specified BundleContext was null");
-
- if (protocolProvider == null)
- throw new NullPointerException(
- "The specified Protocol Provider was null");
-
- YahooAccountID accountID
- = (YahooAccountID) protocolProvider.getAccountID();
-
- // If the given accountID doesn't correspond to an existing account
- // we return.
- if(!registeredAccounts.containsKey(accountID))
- return;
-
- ServiceRegistration registration = registeredAccounts.get(accountID);
-
- // kill the service
- if (registration != null)
- registration.unregister();
-
- if (accountProperties == null)
- throw new NullPointerException(
- "The specified property map was null");
-
- accountProperties.put(USER_ID, accountID.getUserID());
-
- if (!accountProperties.containsKey(PROTOCOL))
- accountProperties.put(PROTOCOL, ProtocolNames.YAHOO);
-
- accountID.setAccountProperties(accountProperties);
-
- // First store the account and only then load it as the load generates
- // an osgi event, the osgi event triggers (trhgough the UI) a call to
- // the register() method and it needs to acces the configuration service
- // and check for a password.
- this.storeAccount(accountID);
-
- Hashtable<String, String> properties = new Hashtable<String, String>();
- properties.put(PROTOCOL, ProtocolNames.YAHOO);
- properties.put(USER_ID, accountID.getUserID());
-
- ((ProtocolProviderServiceYahooImpl)protocolProvider)
- .initialize(accountID.getUserID(), accountID);
-
- // We store again the account in order to store all properties added
- // during the protocol provider initialization.
- this.storeAccount(accountID);
-
- registration
- = context.registerService(
- ProtocolProviderService.class.getName(),
- protocolProvider,
- properties);
-
- registeredAccounts.put(accountID, registration);
- }
-}
diff --git a/src/net/java/sip/communicator/impl/protocol/yahoo/ProtocolProviderServiceYahooImpl.java b/src/net/java/sip/communicator/impl/protocol/yahoo/ProtocolProviderServiceYahooImpl.java
deleted file mode 100644
index 264aaab..0000000
--- a/src/net/java/sip/communicator/impl/protocol/yahoo/ProtocolProviderServiceYahooImpl.java
+++ /dev/null
@@ -1,574 +0,0 @@
-/*
- * Jitsi, the OpenSource Java VoIP and Instant Messaging client.
- *
- * Copyright @ 2015 Atlassian Pty Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.java.sip.communicator.impl.protocol.yahoo;
-
-import java.io.*;
-
-import net.java.sip.communicator.service.dns.*;
-import net.java.sip.communicator.service.protocol.*;
-import net.java.sip.communicator.service.protocol.event.*;
-import net.java.sip.communicator.util.*;
-import ymsg.network.*;
-import ymsg.network.event.*;
-
-/**
- * An implementation of the protocol provider service over the Yahoo protocol
- *
- * @author Damian Minkov
- */
-public class ProtocolProviderServiceYahooImpl
- extends AbstractProtocolProviderService
-{
- /**
- * This class logger.
- */
- private static final Logger logger =
- Logger.getLogger(ProtocolProviderServiceYahooImpl.class);
-
- /**
- * The current yahoo session.
- */
- private YahooSession yahooSession = null;
-
- /**
- * indicates whether or not the provider is initialized and ready for use.
- */
- private boolean isInitialized = false;
-
- /**
- * We use this to lock access to initialization.
- */
- private final Object initializationLock = new Object();
-
- /**
- * The identifier of the account that this provider represents.
- */
- private AccountID accountID = null;
-
- /**
- * Used when we need to re-register
- */
- private SecurityAuthority authority = null;
-
- /**
- * The persistent presence operations set.
- */
- private OperationSetPersistentPresenceYahooImpl persistentPresence = null;
-
- /**
- * Typing notifications operations set.
- */
- private OperationSetTypingNotificationsYahooImpl typingNotifications = null;
-
- /**
- * The logo corresponding to the msn protocol.
- */
- private ProtocolIconYahooImpl yahooIcon
- = new ProtocolIconYahooImpl();
-
- /**
- * The connection listener.
- */
- private YahooConnectionListener connectionListener = null;
-
- /**
- * Returns the state of the registration of this protocol provider
- * @return the <tt>RegistrationState</tt> that this provider is
- * currently in or null in case it is in a unknown state.
- */
- public RegistrationState getRegistrationState()
- {
- if(yahooSession != null &&
- yahooSession.getSessionStatus() == StatusConstants.MESSAGING)
- return RegistrationState.REGISTERED;
- else
- return RegistrationState.UNREGISTERED;
- }
-
- /**
- * Starts the registration process. Connection details such as
- * registration server, user name/number are provided through the
- * configuration service through implementation specific properties.
- *
- * @param authority the security authority that will be used for resolving
- * any security challenges that may be returned during the
- * registration or at any moment while wer're registered.
- * @throws OperationFailedException with the corresponding code it the
- * registration fails for some reason (e.g. a networking error or an
- * implementation problem).
- */
- public void register(final SecurityAuthority authority)
- throws OperationFailedException
- {
- if(authority == null)
- throw new IllegalArgumentException(
- "The register method needs a valid non-null authority impl "
- + " in order to be able and retrieve passwords.");
-
- this.authority = authority;
-
- connectAndLogin(authority, SecurityAuthority.AUTHENTICATION_REQUIRED);
- }
-
- /**
- * Connects and logins to the server
- * @param authority SecurityAuthority
- * @param authReasonCode the authentication reason code, which should
- * indicate why are making an authentication request
- * @throws OperationFailedException if login parameters
- * as server port are not correct
- */
- private void connectAndLogin( SecurityAuthority authority,
- int authReasonCode)
- throws OperationFailedException
- {
- synchronized(initializationLock)
- {
- //verify whether a password has already been stored for this account
- String password = YahooActivator.
- getProtocolProviderFactory().loadPassword(getAccountID());
-
- // If the password hasn't been saved or the reason is one of those
- // listed below we need to ask the user for credentials again.
- if (password == null
- || authReasonCode == SecurityAuthority.WRONG_PASSWORD
- || authReasonCode == SecurityAuthority.WRONG_USERNAME)
- {
- //create a default credentials object
- UserCredentials credentials = new UserCredentials();
- credentials.setUserName(getAccountID().getUserID());
-
- //request a password from the user
- credentials = authority.obtainCredentials(
- getAccountID().getDisplayName(),
- credentials,
- authReasonCode);
-
- // in case user has canceled the login window
- if(credentials == null)
- {
- fireRegistrationStateChanged(
- getRegistrationState(),
- RegistrationState.UNREGISTERED,
- RegistrationStateChangeEvent.REASON_USER_REQUEST, "");
- return;
- }
-
- //extract the password the user passed us.
- char[] pass = credentials.getPassword();
-
- // the user didn't provide us a password (canceled the operation)
- if(pass == null)
- {
- fireRegistrationStateChanged(
- getRegistrationState(),
- RegistrationState.UNREGISTERED,
- RegistrationStateChangeEvent.REASON_USER_REQUEST, "");
- return;
- }
- password = new String(pass);
-
- if (credentials.isPasswordPersistent())
- {
- YahooActivator.getProtocolProviderFactory()
- .storePassword(getAccountID(), password);
- }
- }
-
- yahooSession = new YahooSession();
- connectionListener = new YahooConnectionListener();
- yahooSession.addSessionListener(connectionListener);
-
- try
- {
- fireRegistrationStateChanged(
- getRegistrationState(),
- RegistrationState.REGISTERING,
- RegistrationStateChangeEvent.REASON_NOT_SPECIFIED, null);
-
- yahooSession.login(getAccountID().getUserID(), password);
-
- if(yahooSession.getSessionStatus()==StatusConstants.MESSAGING)
- {
- persistentPresence.fireProviderStatusChangeEvent(
- persistentPresence.getPresenceStatus(),
- persistentPresence.yahooStatusToPresenceStatus(
- yahooSession.getStatus()));
-
- fireRegistrationStateChanged(
- getRegistrationState(),
- RegistrationState.REGISTERED,
- RegistrationStateChangeEvent.REASON_NOT_SPECIFIED, null);
- }
- else
- {
- fireRegistrationStateChanged(
- getRegistrationState(),
- RegistrationState.UNREGISTERED,
- RegistrationStateChangeEvent.REASON_NOT_SPECIFIED, null);
- }
- }
- catch (LoginRefusedException ex)
- {
- if(ex.getStatus() == StatusConstants.STATUS_BADUSERNAME)
- {
- fireRegistrationStateChanged(
- getRegistrationState(),
- RegistrationState.AUTHENTICATION_FAILED,
- RegistrationStateChangeEvent.REASON_NON_EXISTING_USER_ID,
- null);
-
- reregister(SecurityAuthority.WRONG_USERNAME);
- }
- else if(ex.getStatus() == StatusConstants.STATUS_BAD)
- {
- YahooActivator.getProtocolProviderFactory()
- .storePassword(getAccountID(), null);
-
- fireRegistrationStateChanged(
- getRegistrationState(),
- RegistrationState.AUTHENTICATION_FAILED,
- RegistrationStateChangeEvent.REASON_AUTHENTICATION_FAILED,
- null);
-
- // Try to re-register and ask the user to retype the password.
- reregister(SecurityAuthority.WRONG_PASSWORD);
- }
- else if(ex.getStatus() == StatusConstants.STATUS_LOCKED)
- {
- fireRegistrationStateChanged(
- getRegistrationState(),
- RegistrationState.AUTHENTICATION_FAILED,
- RegistrationStateChangeEvent.REASON_RECONNECTION_RATE_LIMIT_EXCEEDED,
- null);
- }
- }
- catch (IOException ex)
- {
- fireRegistrationStateChanged(
- getRegistrationState(),
- RegistrationState.CONNECTION_FAILED,
- RegistrationStateChangeEvent.REASON_NOT_SPECIFIED, null);
- }
- catch (DnssecRuntimeException ex)
- {
- fireRegistrationStateChanged(
- getRegistrationState(),
- RegistrationState.UNREGISTERED,
- RegistrationStateChangeEvent.REASON_USER_REQUEST, null);
- }
- }
- }
-
- /**
- * Reconnects if fails fire connection failed.
- * @param reasonCode the appropriate <tt>SecurityAuthority</tt> reasonCode,
- * which would specify the reason for which we're re-calling the login.
- */
- void reregister(int reasonCode)
- {
- try
- {
- connectAndLogin(authority, reasonCode);
- }
- catch (OperationFailedException ex)
- {
- fireRegistrationStateChanged(
- getRegistrationState(),
- RegistrationState.CONNECTION_FAILED,
- RegistrationStateChangeEvent.REASON_NOT_SPECIFIED, null);
- }
- }
-
- /**
- * Ends the registration of this protocol provider with the service.
- */
- public void unregister()
- {
- unregisterInternal(true);
- }
-
- /**
- * Unregister and fire the event if requested
- * @param fireEvent boolean
- */
- void unregisterInternal(boolean fireEvent)
- {
- RegistrationState currRegState = getRegistrationState();
-
- if(fireEvent)
- fireRegistrationStateChanged(
- currRegState,
- RegistrationState.UNREGISTERING,
- RegistrationStateChangeEvent.REASON_USER_REQUEST,
- null);
-
- try
- {
- if(connectionListener != null && yahooSession != null)
- {
- yahooSession.removeSessionListener(connectionListener);
- connectionListener = null;
- }
-
- if((yahooSession != null)
- && (yahooSession.getSessionStatus() == StatusConstants.MESSAGING))
- yahooSession.logout();
- }
- catch(Exception ex)
- {
- logger.error("Cannot logout! ", ex);
- }
-
- yahooSession = null;
-
- if(fireEvent)
- fireRegistrationStateChanged(
- currRegState,
- RegistrationState.UNREGISTERED,
- RegistrationStateChangeEvent.REASON_USER_REQUEST,
- null);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see net.java.sip.communicator.service.protocol.ProtocolProviderService#
- * isSignallingTransportSecure()
- */
- public boolean isSignalingTransportSecure()
- {
- return false;
- }
-
- /**
- * Returns the "transport" protocol of this instance used to carry the
- * control channel for the current protocol service.
- *
- * @return The "transport" protocol of this instance: TCP.
- */
- public TransportProtocol getTransportProtocol()
- {
- return TransportProtocol.TCP;
- }
-
- /**
- * Returns the short name of the protocol that the implementation of this
- * provider is based upon (like SIP, Msn, ICQ/AIM, or others for
- * example).
- *
- * @return a String containing the short name of the protocol this
- * service is taking care of.
- */
- public String getProtocolName()
- {
- return ProtocolNames.YAHOO;
- }
-
- /**
- * Initialized the service implementation, and puts it in a sate where it
- * could interoperate with other services. It is strongly recomended that
- * properties in this Map be mapped to property names as specified by
- * <tt>AccountProperties</tt>.
- *
- * @param screenname the account id/uin/screenname of the account that
- * we're about to create
- * @param accountID the identifier of the account that this protocol
- * provider represents.
- *
- * @see net.java.sip.communicator.service.protocol.AccountID
- */
- protected void initialize(String screenname,
- AccountID accountID)
- {
- synchronized(initializationLock)
- {
- this.accountID = accountID;
-
- addSupportedOperationSet(
- OperationSetInstantMessageTransform.class,
- new OperationSetInstantMessageTransformImpl());
-
- //initialize the presence operationset
- persistentPresence
- = new OperationSetPersistentPresenceYahooImpl(this);
- addSupportedOperationSet(
- OperationSetPersistentPresence.class,
- persistentPresence);
- //register it once again for those that simply need presence
- addSupportedOperationSet(
- OperationSetPresence.class,
- persistentPresence);
-
- //initialize the IM operation set
- addSupportedOperationSet(
- OperationSetBasicInstantMessaging.class,
- new OperationSetBasicInstantMessagingYahooImpl(this));
-
- //initialize the multi user chat operation set
- addSupportedOperationSet(
- OperationSetAdHocMultiUserChat.class,
- new OperationSetAdHocMultiUserChatYahooImpl(this));
-
- //initialize the typing notifications operation set
- typingNotifications
- = new OperationSetTypingNotificationsYahooImpl(this);
- addSupportedOperationSet(
- OperationSetTypingNotifications.class,
- typingNotifications);
-
- addSupportedOperationSet(
- OperationSetFileTransfer.class,
- new OperationSetFileTransferYahooImpl(this));
-
- isInitialized = true;
- }
- }
-
- /**
- * Makes the service implementation close all open sockets and release
- * any resources that it might have taken and prepare for
- * shutdown/garbage collection.
- */
- public void shutdown()
- {
- synchronized(initializationLock){
- unregisterInternal(false);
- yahooSession = null;
- isInitialized = false;
- }
- }
-
- /**
- * Returns true if the provider service implementation is initialized and
- * ready for use by other services, and false otherwise.
- *
- * @return true if the provider is initialized and ready for use and false
- * otherwise
- */
- public boolean isInitialized()
- {
- return isInitialized;
- }
-
- /**
- * Returns the AccountID that uniquely identifies the account represented
- * by this instance of the ProtocolProviderService.
- * @return the id of the account represented by this provider.
- */
- public AccountID getAccountID()
- {
- return accountID;
- }
-
- /**
- * Returns the Yahoo<tt>Session</tt>opened by this provider
- * @return a reference to the <tt>Session</tt> last opened by this
- * provider.
- */
- YahooSession getYahooSession()
- {
- return yahooSession;
- }
-
- /**
- * Creates a RegistrationStateChange event corresponding to the specified
- * old and new states and notifies all currently registered listeners.
- *
- * @param oldState the state that the provider had before the change
- * occurred
- * @param newState the state that the provider is currently in.
- * @param reasonCode a value corresponding to one of the REASON_XXX fields
- * of the RegistrationStateChangeEvent class, indicating the reason for
- * this state transition.
- * @param reason a String further explaining the reason code or null if
- * no such explanation is necessary.
- */
- @Override
- public void fireRegistrationStateChanged( RegistrationState oldState,
- RegistrationState newState,
- int reasonCode,
- String reason)
- {
- if(newState.equals(RegistrationState.UNREGISTERED))
- {
- unregisterInternal(false);
- yahooSession = null;
- }
-
- super.fireRegistrationStateChanged(oldState, newState, reasonCode, reason);
- }
-
- /**
- * Listens when we are logged in the server
- * or incoming exception in the lib impl.
- */
- private class YahooConnectionListener
- extends SessionAdapter
- {
- /**
- * Yahoo has logged us off the system, or the connection was lost
- *
- * @param ev the event
- */
- @Override
- public void connectionClosed(SessionEvent ev)
- {
- if(isRegistered())
- fireRegistrationStateChanged(
- getRegistrationState(),
- RegistrationState.CONNECTION_FAILED,
- RegistrationStateChangeEvent.REASON_NOT_SPECIFIED, null);
- }
-
- /**
- * Some exception has occurred in stack.
- * @param ev
- */
- @Override
- public void inputExceptionThrown(SessionExceptionEvent ev)
- {
- if(ev.getException() instanceof YMSG9BadFormatException)
- {
- logger.error("Yahoo protocol exception occured exception",
- ev.getException());
- logger.error("Yahoo protocol exception occured exception cause",
- ev.getException().getCause());
- }
- else
- logger.error(
- "Yahoo protocol exception occured", ev.getException());
-
- unregisterInternal(false);
- if(isRegistered())
- fireRegistrationStateChanged(
- getRegistrationState(),
- RegistrationState.UNREGISTERED,
- RegistrationStateChangeEvent.REASON_INTERNAL_ERROR, null);
- }
- }
-
- /**
- * Returns the yahoo protocol icon.
- * @return the yahoo protocol icon
- */
- public ProtocolIcon getProtocolIcon()
- {
- return yahooIcon;
- }
-}
diff --git a/src/net/java/sip/communicator/impl/protocol/yahoo/RootContactGroupYahooImpl.java b/src/net/java/sip/communicator/impl/protocol/yahoo/RootContactGroupYahooImpl.java
deleted file mode 100644
index 856bb30..0000000
--- a/src/net/java/sip/communicator/impl/protocol/yahoo/RootContactGroupYahooImpl.java
+++ /dev/null
@@ -1,280 +0,0 @@
-/*
- * Jitsi, the OpenSource Java VoIP and Instant Messaging client.
- *
- * Copyright @ 2015 Atlassian Pty Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.java.sip.communicator.impl.protocol.yahoo;
-
-import java.util.*;
-
-import net.java.sip.communicator.service.protocol.*;
-
-/**
- * A dummy ContactGroup implementation representing the ContactList root for
- * Yahoo contact lists.
- * @author Damian Minkov
- */
-public class RootContactGroupYahooImpl
- extends AbstractContactGroupYahooImpl
-{
- private String ROOT_CONTACT_GROUP_NAME = "ContactListRoot";
- private List<ContactGroup> subGroups = new LinkedList<ContactGroup>();
- private boolean isResolved = false;
-
- /**
- * An empty list that we use when returning an iterator.
- */
- private List<Contact> dummyContacts = new LinkedList<Contact>();
-
- private final ProtocolProviderServiceYahooImpl protocolProvider;
-
- /**
- * Creates a ContactGroup instance.
- */
- RootContactGroupYahooImpl(ProtocolProviderServiceYahooImpl protocolProvider)
- {
- this.protocolProvider = protocolProvider;
- }
-
- /**
- * The ContactListRoot is the only group that can contain subgroups.
- *
- * @return true (always)
- */
- public boolean canContainSubgroups()
- {
- return true;
- }
-
- /**
- * Returns the name of this group which is always
- * <tt>ROOT_CONTACT_GROUP_NAME</tt>.
- *
- * @return a String containing the name of this group.
- */
- public String getGroupName()
- {
- return ROOT_CONTACT_GROUP_NAME;
- }
-
- /**
- * Adds the specified group to the end of the list of sub groups.
- * @param group the group to add.
- */
- void addSubGroup(ContactGroupYahooImpl group)
- {
- subGroups.add(group);
- }
-
- /**
- * Removes the specified from the list of sub groups
- * @param group the group to remove.
- */
- void removeSubGroup(ContactGroupYahooImpl group)
- {
- removeSubGroup(subGroups.indexOf(group));
- }
-
- /**
- * Removes the sub group with the specified index.
- * @param index the index of the group to remove
- */
- void removeSubGroup(int index)
- {
- subGroups.remove(index);
- }
-
- /**
- * Returns the number of subgroups contained by this
- * <tt>RootContactGroupImpl</tt>.
- *
- * @return an int indicating the number of subgroups that this
- * ContactGroup contains.
- */
- public int countSubgroups()
- {
- return subGroups.size();
- }
-
- /**
- * Returns null as this is the root contact group.
- * @return null as this is the root contact group.
- */
- public ContactGroup getParentContactGroup()
- {
- return null;
- }
-
- /**
- * Returns the subgroup with the specified index.
- *
- * @param index the index of the <tt>ContactGroup</tt> to retrieve.
- * @return the <tt>ContactGroup</tt> with the specified index.
- */
- public ContactGroup getGroup(int index)
- {
- return subGroups.get(index);
- }
-
- /**
- * Returns the subgroup with the specified name.
- * @param groupName the name of the <tt>ContactGroup</tt> to retrieve.
- * @return the <tt>ContactGroup</tt> with the specified index.
- */
- public ContactGroup getGroup(String groupName)
- {
- Iterator<ContactGroup> subgroups = subgroups();
- while (subgroups.hasNext())
- {
- ContactGroup grp = subgroups.next();
-
- if (grp.getGroupName().equals(groupName))
- return grp;
- }
-
- return null;
- }
-
- /**
- * Returns an iterator over the sub groups that this
- * <tt>ContactGroup</tt> contains.
- *
- * @return a java.util.Iterator over the <tt>ContactGroup</tt>
- * children of this group (i.e. subgroups).
- */
- public Iterator<ContactGroup> subgroups()
- {
- return subGroups.iterator();
- }
-
- /**
- * Returns the number, which is always 0, of <tt>Contact</tt> members
- * of this <tt>ContactGroup</tt>
- * @return an int indicating the number of <tt>Contact</tt>s, members
- * of this <tt>ContactGroup</tt>.
- */
- public int countContacts()
- {
- return dummyContacts.size();
- }
-
- /**
- * Returns an Iterator over all contacts, member of this
- * <tt>ContactGroup</tt>.
- * @return a java.util.Iterator over all contacts inside this
- * <tt>ContactGroup</tt>
- */
- public Iterator<Contact> contacts()
- {
- return dummyContacts.iterator();
- }
-
- /**
- * Returns the <tt>Contact</tt> with the specified address or
- * identifier.
- * @param id the addres or identifier of the <tt>Contact</tt> we are
- * looking for.
- * @return the <tt>Contact</tt> with the specified id or address.
- */
- public Contact getContact(String id)
- {
- //no contacts in the root group for this yahoo impl.
- return null;
- }
-
-
- /**
- * Returns a string representation of the root contact group that contains
- * all subgroups and subcontacts of this group.
- *
- * @return a string representation of this root contact group.
- */
- @Override
- public String toString()
- {
- StringBuffer buff = new StringBuffer(getGroupName());
- buff.append(".subGroups=" + countSubgroups() + ":\n");
-
- Iterator<ContactGroup> subGroups = subgroups();
- while (subGroups.hasNext())
- {
- ContactGroup group = subGroups.next();
- buff.append(group.toString());
- if (subGroups.hasNext())
- buff.append("\n");
- }
- return buff.toString();
- }
-
- /**
- * Returns the protocol provider that this group belongs to.
- * @return a regerence to the ProtocolProviderService instance that this
- * ContactGroup belongs to.
- */
- public ProtocolProviderService getProtocolProvider()
- {
- return protocolProvider;
- }
-
- /**
- * Determines whether or not this contact group is being stored by the
- * server. Non persistent contact groups exist for the sole purpose of
- * containing non persistent contacts.
- * @return true if the contact group is persistent and false otherwise.
- */
- public boolean isPersistent()
- {
- return true;
- }
-
- /**
- * Returns null as no persistent data is required and the group name is
- * sufficient for restoring the contact.
- * <p>
- * @return null as no such data is needed.
- */
- public String getPersistentData()
- {
- return null;
- }
-
- /**
- * Determines whether or not this group has been resolved against the
- * server. Unresolved groups are used when initially loading a contact
- * list that has been stored in a local file until the presence operation
- * set has managed to retrieve all the contact list from the server and has
- * properly mapped groups to their on-line buddies.
- * @return true if the group has been resolved (mapped against a buddy)
- * and false otherwise.
- */
- public boolean isResolved()
- {
- return isResolved;
- }
-
- /**
- * Returns a <tt>String</tt> that uniquely represnets the group. In this we
- * use the name of the group as an identifier. This may cause problems
- * though, in clase the name is changed by some other application between
- * consecutive runs of the sip-communicator.
- *
- * @return a String representing this group in a unique and persistent
- * way.
- */
- public String getUID()
- {
- return getGroupName();
- }
-}
diff --git a/src/net/java/sip/communicator/impl/protocol/yahoo/ServerStoredContactListYahooImpl.java b/src/net/java/sip/communicator/impl/protocol/yahoo/ServerStoredContactListYahooImpl.java
deleted file mode 100644
index 6bfb239..0000000
--- a/src/net/java/sip/communicator/impl/protocol/yahoo/ServerStoredContactListYahooImpl.java
+++ /dev/null
@@ -1,1278 +0,0 @@
-/*
- * Jitsi, the OpenSource Java VoIP and Instant Messaging client.
- *
- * Copyright @ 2015 Atlassian Pty Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.java.sip.communicator.impl.protocol.yahoo;
-
-import java.io.*;
-import java.util.*;
-
-import net.java.sip.communicator.service.protocol.*;
-import net.java.sip.communicator.service.protocol.event.*;
-import net.java.sip.communicator.util.*;
-import ymsg.network.*;
-import ymsg.network.event.*;
-
-/**
- * This class encapsulates the Roster class. Once created, it will
- * register itself as a listener to the encapsulated Roster and modify it's
- * local copy of Contacts and ContactGroups every time an event is generated
- * by the underlying framework. The class would also generate
- * corresponding sip-communicator events to all events coming from smack.
- *
- * @author Damian Minkov
- * @author Emil Ivov
- */
-public class ServerStoredContactListYahooImpl
-{
- private static final Logger logger =
- Logger.getLogger(ServerStoredContactListYahooImpl.class);
-
- /**
- * If there is no group and we add contact with no parent
- * a default group is created with name : DEFAULT_GROUP_NAME
- */
- private static final String DEFAULT_GROUP_NAME = "General";
-
- /**
- * The root contagroup. The container for all yahoo buddies and groups.
- */
- private final RootContactGroupYahooImpl rootGroup;
-
- /**
- * The operation set that created us and that we could use when dispatching
- * subscription events.
- */
- private final OperationSetPersistentPresenceYahooImpl parentOperationSet;
-
- /**
- * The provider that is on top of us.
- */
- private final ProtocolProviderServiceYahooImpl yahooProvider;
-
- private YahooSession yahooSession = null;
-
- /**
- * Listeners that would receive event notifications for changes in group
- * names or other properties, removal or creation of groups.
- */
- private Vector<ServerStoredGroupListener> serverStoredGroupListeners
- = new Vector<ServerStoredGroupListener>();
-
- private ContactListModListenerImpl contactListModListenerImpl
- = new ContactListModListenerImpl();
-
- /**
- * Handler for incoming authorization requests.
- */
- private AuthorizationHandler handler = null;
-
- private Hashtable<String, String> addedCustomYahooIds
- = new Hashtable<String, String>();
-
- /**
- * Creates a ServerStoredContactList wrapper for the specified BuddyList.
- *
- * @param parentOperationSet the operation set that created us and that
- * we could use for dispatching subscription events
- * @param provider the provider that has instantiated us.
- */
- ServerStoredContactListYahooImpl(
- OperationSetPersistentPresenceYahooImpl parentOperationSet,
- ProtocolProviderServiceYahooImpl provider)
- {
- //We need to init these as early as possible to ensure that the provider
- //and the operationsset would not be null in the incoming events.
- this.parentOperationSet = parentOperationSet;
-
- this.yahooProvider = provider;
- this.rootGroup = new RootContactGroupYahooImpl(this.yahooProvider);
- }
-
- /**
- * Handler for incoming authorization requests.
- *
- * @param handler an instance of an AuthorizationHandler for
- * authorization requests coming from other users requesting
- * permission add us to their contact list.
- */
- public void setAuthorizationHandler(AuthorizationHandler handler)
- {
- this.handler = handler;
- }
-
- /**
- * Returns the root group of the contact list.
- *
- * @return the root ContactGroup for the ContactList
- */
- public ContactGroup getRootGroup()
- {
- return rootGroup;
- }
-
- /**
- * Registers the specified group listener so that it would receive events
- * on group modification/creation/destruction.
- * @param listener the ServerStoredGroupListener to register for group
- * events
- */
- void addGroupListener(ServerStoredGroupListener listener)
- {
- synchronized(serverStoredGroupListeners)
- {
- if(!serverStoredGroupListeners.contains(listener))
- serverStoredGroupListeners.add(listener);
- }
- }
-
- /**
- * Removes the specified group listener so that it won't receive further
- * events on group modification/creation/destruction.
- * @param listener the ServerStoredGroupListener to unregister
- */
- void removeGroupListener(ServerStoredGroupListener listener)
- {
- synchronized(serverStoredGroupListeners)
- {
- this.serverStoredGroupListeners.remove(listener);
- }
- }
-
- /**
- * Creates the corresponding event and notifies all
- * <tt>ServerStoredGroupListener</tt>s that the source group has been
- * removed, changed, renamed or whatever happened to it.
- * @param group the ContactGroup that has been created/modified/removed
- * @param eventID the id of the event to generate.
- */
- private void fireGroupEvent(ContactGroupYahooImpl group, int eventID)
- {
- //bail out if no one's listening
- if(parentOperationSet == null){
- if (logger.isDebugEnabled())
- logger.debug("No presence op. set available. Bailing out.");
- return;
- }
-
- ServerStoredGroupEvent evt = new ServerStoredGroupEvent(
- group
- , eventID
- , parentOperationSet.getServerStoredContactListRoot()
- , yahooProvider
- , parentOperationSet);
-
- if (logger.isTraceEnabled())
- logger.trace("Will dispatch the following grp event: " + evt);
-
- Iterable<ServerStoredGroupListener> listeners;
- synchronized (serverStoredGroupListeners)
- {
- listeners
- = new ArrayList<ServerStoredGroupListener>(
- serverStoredGroupListeners);
- }
-
- for (ServerStoredGroupListener listener : listeners)
- {
- try{
- if (eventID == ServerStoredGroupEvent.GROUP_REMOVED_EVENT)
- listener.groupRemoved(evt);
- else if (eventID == ServerStoredGroupEvent.GROUP_RENAMED_EVENT)
- listener.groupNameChanged(evt);
- else if (eventID == ServerStoredGroupEvent.GROUP_CREATED_EVENT)
- listener.groupCreated(evt);
- else if (eventID == ServerStoredGroupEvent.GROUP_RESOLVED_EVENT)
- listener.groupResolved(evt);
- }catch(Exception ex){
- logger.warn("Unhandled Exception! ", ex);
- }
- }
- }
-
- /**
- * Make the parent persistent presence operation set dispatch a contact
- * removed event.
- * @param parentGroup the group where that the removed contact belonged to.
- * @param contact the contact that was removed.
- */
- private void fireContactRemoved( ContactGroup parentGroup,
- ContactYahooImpl contact)
- {
- //bail out if no one's listening
- if(parentOperationSet == null){
- if (logger.isDebugEnabled())
- logger.debug("No presence op. set available. Bailing out.");
- return;
- }
-
- //dispatch
- parentOperationSet.fireSubscriptionEvent(
- contact, parentGroup, SubscriptionEvent.SUBSCRIPTION_REMOVED);
- }
-
- /**
- * Make the parent persistent presence operation set dispatch a subscription
- * moved event.
- * @param oldParentGroup the group where the source contact was located
- * before being moved
- * @param newParentGroup the group that the source contact is currently in.
- * @param contact the contact that was added
- */
- private void fireContactMoved( ContactGroup oldParentGroup,
- ContactGroupYahooImpl newParentGroup,
- ContactYahooImpl contact)
- {
- //bail out if no one's listening
- if(parentOperationSet == null){
- if (logger.isDebugEnabled())
- logger.debug("No presence op. set available. Bailing out.");
- return;
- }
-
- //dispatch
- parentOperationSet.fireSubscriptionMovedEvent(
- contact, oldParentGroup, newParentGroup);
- }
-
- /**
- * Returns a reference to the provider that created us.
- * @return a reference to a ProtocolProviderServiceImpl instance.
- */
- ProtocolProviderServiceYahooImpl getParentProvider()
- {
- return yahooProvider;
- }
-
- /**
- * Returns the ConntactGroup with the specified name or null if no such
- * group was found.
- * <p>
- * @param name the name of the group we're looking for.
- * @return a reference to the ContactGroupYahooImpl instance we're looking
- * for or null if no such group was found.
- */
- public ContactGroupYahooImpl findContactGroup(String name)
- {
- String nameToLookFor = replaceIllegalChars(name);
- Iterator<ContactGroup> contactGroups = rootGroup.subgroups();
-
- while(contactGroups.hasNext())
- {
- ContactGroupYahooImpl contactGroup
- = (ContactGroupYahooImpl) contactGroups.next();
-
- if (contactGroup.getGroupName().equals(nameToLookFor))
- return contactGroup;
- }
-
- return null;
- }
-
- /**
- * Returns the Contact with the specified id or null if
- * no such id was found.
- *
- * @param id the id of the contact to find.
- * @return the <tt>Contact</tt> carrying the specified
- * <tt>screenName</tt> or <tt>null</tt> if no such contact exits.
- */
- public ContactYahooImpl findContactById(String id)
- {
- Iterator<ContactGroup> contactGroups = rootGroup.subgroups();
- ContactYahooImpl result = null;
-
- while(contactGroups.hasNext())
- {
- ContactGroupYahooImpl contactGroup
- = (ContactGroupYahooImpl) contactGroups.next();
-
- result = contactGroup.findContact(id);
-
- if (result != null)
- return result;
- }
-
- return null;
- }
-
- /**
- * Returns the Contact corresponding to the specified <tt>YahooUser</tt>
- * or null if no such id was found.
- *
- * @param yahooUser the YahooUser of the contact to find.
- * @return the <tt>Contact</tt> carrying the specified
- * <tt>screenName</tt> or <tt>null</tt> if no such contact exits.
- */
- public ContactYahooImpl findContactByYahooUser(YahooUser yahooUser)
- {
- return findContactById(yahooUser.getId().toLowerCase());
- }
-
- /**
- * Returns the ContactGroup containing the specified contact or null
- * if no such group or contact exist.
- *
- * @param child the contact whose parent group we're looking for.
- * @return the <tt>ContactGroup</tt> containing the specified
- * <tt>contact</tt> or <tt>null</tt> if no such groupo or contact
- * exist.
- */
- public ContactGroup findContactGroup(ContactYahooImpl child)
- {
- Iterator<ContactGroup> contactGroups = rootGroup.subgroups();
- String contactAddress = child.getAddress();
-
- while(contactGroups.hasNext())
- {
- ContactGroupYahooImpl contactGroup
- = (ContactGroupYahooImpl) contactGroups.next();
-
- if( contactGroup.findContact(contactAddress)!= null)
- return contactGroup;
- }
-
- return null;
- }
-
- /**
- * Adds a new contact with the specified screenname to the list under a
- * default location.
- * @param id the id of the contact to add.
- * @throws OperationFailedException
- */
- public void addContact(String id)
- throws OperationFailedException
- {
- ContactGroupYahooImpl parent = getFirstPersistentGroup();
-
- if(parent == null)
- {
- // if there is no group create it
- parent = createUnresolvedContactGroup(DEFAULT_GROUP_NAME);
- }
-
- addContact(parent, id);
- }
-
- /**
- * Adds a new contact with the specified screenname to the list under the
- * specified group.
- * @param id the id of the contact to add.
- * @param parent the group under which we want the new contact placed.
- * @throws OperationFailedException if the contact already exist
- */
- public void addContact(final ContactGroupYahooImpl parent, String id)
- throws OperationFailedException
- {
- if (logger.isTraceEnabled())
- logger.trace("Adding contact " + id + " to parent=" + parent);
-
- //if the contact is already in the contact list and is not volatile,
- //then only broadcast an event
- ContactYahooImpl existingContact = findContactById(id);
-
- if( existingContact != null
- && existingContact.isPersistent() )
- {
- if (logger.isDebugEnabled())
- logger.debug("Contact " + id + " already exists.");
- throw new OperationFailedException(
- "Contact " + id + " already exists.",
- OperationFailedException.SUBSCRIPTION_ALREADY_EXISTS);
- }
-
- if(id.indexOf("@") > -1 )
- addedCustomYahooIds.put(YahooSession.getYahooUserID(id), id);
-
- try
- {
- yahooSession.addFriend(YahooSession.getYahooUserID(id),
- parent.getGroupName());
- }
- catch(IOException ex)
- {
- throw new OperationFailedException(
- "Contact cannot be added " + id,
- OperationFailedException.NETWORK_FAILURE);
- }
- }
-
- /**
- * Creates a non persistent contact for the specified address. This would
- * also create (if necessary) a group for volatile contacts that would not
- * be added to the server stored contact list. This method would have no
- * effect on the server stored contact list.
- * @param id the address of the contact to create.
- * @return the newly created volatile <tt>ContactImpl</tt>
- */
- ContactYahooImpl createVolatileContact(String id)
- {
- if (logger.isTraceEnabled())
- logger.trace("Creating volatile contact " + id);
- ContactYahooImpl newVolatileContact =
- new ContactYahooImpl(id, this, false, false, true);
-
- //Check whether a volatile group already exists and if not create one
- ContactGroupYahooImpl theVolatileGroup = getNonPersistentGroup();
-
- //if the parent group is null then create it
- if (theVolatileGroup == null)
- {
- theVolatileGroup = new VolatileContactGroupYahooImpl(
- YahooActivator.getResources().getI18NString(
- "service.gui.NOT_IN_CONTACT_LIST_GROUP_NAME"),
- this);
-
- theVolatileGroup.addContact(newVolatileContact);
-
- this.rootGroup.addSubGroup(theVolatileGroup);
-
- fireGroupEvent(theVolatileGroup
- , ServerStoredGroupEvent.GROUP_CREATED_EVENT);
- }
- else
- {
- theVolatileGroup.addContact(newVolatileContact);
-
- fireContactAdded(theVolatileGroup, newVolatileContact);
- }
-
- return newVolatileContact;
- }
-
-
- /**
- * Creates a non resolved contact for the specified address and inside the
- * specified group. The newly created contact would be added to the local
- * contact list as a standard contact but when an event is received from the
- * server concerning this contact, then it will be reused and only its
- * isResolved field would be updated instead of creating the whole contact
- * again.
- *
- * @param parentGroup the group where the unersolved contact is to be
- * created
- * @param id the Address of the contact to create.
- * @return the newly created unresolved <tt>ContactImpl</tt>
- */
- ContactYahooImpl createUnresolvedContact(ContactGroup parentGroup,
- String id)
- {
- if (logger.isTraceEnabled())
- logger.trace("Creating unresolved contact " + id
- + " to parent=" + parentGroup);
-
- ContactYahooImpl existingContact = findContactById(id);
-
- if( existingContact != null)
- {
- return existingContact;
- }
-
- ContactYahooImpl newUnresolvedContact
- = new ContactYahooImpl(id, this, false, true, false);
-
- if(parentGroup instanceof ContactGroupYahooImpl)
- ((ContactGroupYahooImpl)parentGroup).
- addContact(newUnresolvedContact);
-
- fireContactAdded(parentGroup, newUnresolvedContact);
-
- return newUnresolvedContact;
- }
-
- /**
- * Creates a non resolved contact group for the specified name. The newly
- * created group would be added to the local contact list as any other group
- * but when an event is received from the server concerning this group, then
- * it will be reused and only its isResolved field would be updated instead
- * of creating the whole group again.
- * <p>
- * @param groupName the name of the group to create.
- * @return the newly created unresolved <tt>ContactGroupImpl</tt>
- */
- ContactGroupYahooImpl createUnresolvedContactGroup(String groupName)
- {
- ContactGroupYahooImpl existingGroup = findContactGroup(groupName);
-
- if( existingGroup != null )
- {
- if (logger.isDebugEnabled())
- logger.debug("ContactGroup " + groupName + " already exists.");
- return existingGroup;
- }
-
- ContactGroupYahooImpl newUnresolvedGroup =
- new ContactGroupYahooImpl(groupName, this);
-
- this.rootGroup.addSubGroup(newUnresolvedGroup);
-
- fireGroupEvent(newUnresolvedGroup
- , ServerStoredGroupEvent.GROUP_CREATED_EVENT);
-
- return newUnresolvedGroup;
- }
-
- /**
- * Creates the specified group on the server stored contact list.
- * @param groupName a String containing the name of the new group.
- * @throws OperationFailedException with code CONTACT_GROUP_ALREADY_EXISTS
- * if the group we're trying to create is already in our contact list.
- */
- public void createGroup(String groupName)
- throws OperationFailedException
- {
- if (logger.isTraceEnabled())
- logger.trace("Creating group: " + groupName);
-
- ContactGroupYahooImpl existingGroup = findContactGroup(groupName);
-
- if( existingGroup != null && existingGroup.isPersistent() )
- {
- if (logger.isDebugEnabled())
- logger.debug("ContactGroup " + groupName + " already exists.");
- throw new OperationFailedException(
- "ContactGroup " + groupName + " already exists.",
- OperationFailedException.CONTACT_GROUP_ALREADY_EXISTS);
- }
-
- // create unresolved group if friend is added - group will be resolved
- createUnresolvedContactGroup(groupName);
- }
-
- /**
- * Removes the specified group from the buddy list.
- * @param groupToRemove the group that we'd like removed.
- */
- @SuppressWarnings("unchecked") //jymsg legacy code
- public void removeGroup(ContactGroupYahooImpl groupToRemove)
- {
- // to remove group just remove all the contacts in it
-
- if (logger.isTraceEnabled())
- logger.trace("removing group " + groupToRemove);
-
- // if its not persistent group just remove it
- if(!groupToRemove.isPersistent() || !groupToRemove.isResolved())
- {
- rootGroup.removeSubGroup(groupToRemove);
- fireGroupEvent(groupToRemove,
- ServerStoredGroupEvent.GROUP_REMOVED_EVENT);
- return;
- }
-
- Vector<YahooUser> contacts
- = groupToRemove.getSourceGroup().getMembers();
-
- if(contacts.size() == 0)
- {
- // the group is empty just remove it
- rootGroup.removeSubGroup(groupToRemove);
- fireGroupEvent(groupToRemove,
- ServerStoredGroupEvent.GROUP_REMOVED_EVENT);
- return;
- }
-
- /*
- * ContactGroupYahooImpl#getGroupName() isn't a plain getter so
- * performance-wise we're better off not calling it multiple times in
- * the following loop.
- */
- String groupToRemoveName = groupToRemove.getGroupName();
-
- for (YahooUser item : contacts)
- {
- try
- {
- yahooSession.removeFriend(item.getId(), groupToRemoveName);
- }
- catch(IOException ex)
- {
- if (logger.isInfoEnabled())
- logger.info("Cannot Remove contact " + item.getId());
- }
- }
- }
-
- /**
- * Removes a contact from the serverside list
- * Event will come for successful operation
- * @param contactToRemove ContactYahooImpl
- */
- void removeContact(ContactYahooImpl contactToRemove)
- {
- if (logger.isTraceEnabled())
- logger.trace("Removing yahoo contact "
- + contactToRemove.getSourceContact());
-
- if(contactToRemove.isVolatile())
- {
- ContactGroupYahooImpl parent =
- (ContactGroupYahooImpl)contactToRemove.getParentContactGroup();
-
- parent.removeContact(contactToRemove);
- fireContactRemoved(parent, contactToRemove);
- return;
- }
-
- try
- {
- yahooSession.removeFriend(
- contactToRemove.getSourceContact().getId(),
- contactToRemove.getParentContactGroup().getGroupName());
- }
- catch(IOException ex)
- {
- if (logger.isInfoEnabled())
- logger.info("Cannot Remove contact " + contactToRemove);
- }
- }
-
- /**
- * Renames the specified group according to the specified new name..
- * @param groupToRename the group that we'd like removed.
- * @param newName the new name of the group
- */
- public void renameGroup(ContactGroupYahooImpl groupToRename, String newName)
- {
- // not working
- /*
- try
- {
- yahooSession.renameGroup(groupToRename.getGroupName(), newName);
- }
- catch(IOException ex)
- {
- if (logger.isInfoEnabled())
- logger.info("Cannot rename group " + groupToRename);
- }
-
- fireGroupEvent(groupToRename,
- ServerStoredGroupEvent.GROUP_RENAMED_EVENT);
- */
- }
-
- /**
- * Moves the specified <tt>contact</tt> to the group indicated by
- * <tt>newParent</tt>.
- * @param contact the contact that we'd like moved under the new group.
- * @param newParent the group where we'd like the parent placed.
- */
- public void moveContact(ContactYahooImpl contact,
- ContactGroupYahooImpl newParent)
- {
- String userID = contact.getID();
- try
- {
- contactListModListenerImpl.
- waitForMove(userID,
- contact.getParentContactGroup().getGroupName());
-
- yahooSession.addFriend(
- userID,
- newParent.getGroupName());
- }
- catch(IOException ex)
- {
- contactListModListenerImpl.removeWaitForMove(userID);
- logger.error("Contact cannot be added " + ex.getMessage());
- }
- }
-
- /**
- * Returns the volatile group
- *
- * @return ContactGroupYahooImpl
- */
- private ContactGroupYahooImpl getNonPersistentGroup()
- {
- for (int i = 0; i < getRootGroup().countSubgroups(); i++)
- {
- ContactGroupYahooImpl gr =
- (ContactGroupYahooImpl)getRootGroup().getGroup(i);
-
- if(!gr.isPersistent())
- return gr;
- }
-
- return null;
- }
-
- /**
- * Returns the first persistent group
- *
- * @return ContactGroupIcqImpl
- */
- private ContactGroupYahooImpl getFirstPersistentGroup()
- {
- for (int i = 0; i < getRootGroup().countSubgroups(); i++)
- {
- ContactGroupYahooImpl gr =
- (ContactGroupYahooImpl)getRootGroup().getGroup(i);
-
- if(gr.isPersistent())
- return gr;
- }
-
- return null;
- }
-
- /**
- * Make the parent persistent presence operation set dispatch a contact
- * added event.
- * @param parentGroup the group where the new contact was added
- * @param contact the contact that was added
- */
- void fireContactAdded( ContactGroup parentGroup,
- ContactYahooImpl contact)
- {
- //bail out if no one's listening
- if(parentOperationSet == null){
- if (logger.isDebugEnabled())
- logger.debug("No presence op. set available. Bailing out.");
- return;
- }
-
- //dispatch
- parentOperationSet.fireSubscriptionEvent(
- contact, parentGroup, SubscriptionEvent.SUBSCRIPTION_CREATED);
- }
-
- /**
- * Make the parent persistent presence operation set dispatch a contact
- * resolved event.
- * @param parentGroup the group that the resolved contact belongs to.
- * @param contact the contact that was resolved
- */
- void fireContactResolved( ContactGroup parentGroup,
- ContactYahooImpl contact)
- {
- //bail out if no one's listening
- if(parentOperationSet == null){
- if (logger.isDebugEnabled())
- logger.debug("No presence op. set available. Bailing out.");
- return;
- }
-
- //dispatch
- parentOperationSet.fireSubscriptionEvent(
- contact, parentGroup, SubscriptionEvent.SUBSCRIPTION_RESOLVED);
- }
-
- /**
- * When the protocol is online this method is used to fill or resolve
- * the current contact list
- */
- @SuppressWarnings("unchecked") //jymsg legacy code
- private void initList()
- {
- if (logger.isTraceEnabled())
- logger.trace("Start init list of "
- + yahooProvider.getAccountID().getUserID());
-
- for (YahooGroup item : yahooSession.getGroups())
- {
- ContactGroupYahooImpl group = findContactGroup(item.getName());
-
- if(group == null)
- {
- // create the group as it doesn't exist
- group = new ContactGroupYahooImpl(
- item, item.getMembers(), this, true);
-
- rootGroup.addSubGroup(group);
-
- //tell listeners about the added group
- fireGroupEvent(group,
- ServerStoredGroupEvent.GROUP_CREATED_EVENT);
- }
- else
- {
- // the group exist so just resolved. The group will check and
- // create or resolve its entries
- group.setResolved(item);
-
- //fire an event saying that the group has been resolved
- fireGroupEvent(group
- , ServerStoredGroupEvent.GROUP_RESOLVED_EVENT);
-
- /** @todo if something to delete . delete it */
- }
-
- if (logger.isTraceEnabled())
- logger.trace("Init of group done! : " + group);
- }
- }
-
- /**
- * @param name Name of the group to search
- * @return The yahoo group with given name
- */
- private YahooGroup findGroup(String name)
- {
- for (YahooGroup elem : yahooSession.getGroups())
- {
- if(elem.getName().equals(name))
- return elem;
- }
- return null;
- }
-
- /**
- * Process incoming authorization requests.
- * @param ev the event to process.
- */
- void processAuthorizationRequest(SessionAuthorizationEvent ev)
- {
- if(handler == null)
- return;
-
- Contact srcContact = findContactById(ev.getFrom());
-
- // if there is no such contact we create it as
- // volatile so we can fire notification
- // and then if accepted add it in the protocol
- // so we can receive its states
- boolean isCurrentlyCreated = false;
- if(srcContact == null)
- {
- srcContact = createVolatileContact(ev.getFrom());
- isCurrentlyCreated = true;
- }
-
- AuthorizationRequest authRequest = new AuthorizationRequest();
- authRequest.setReason(ev.getMessage());
-
- AuthorizationResponse authResponse =
- handler.processAuthorisationRequest(
- authRequest, srcContact);
-
- if (authResponse.getResponseCode() == AuthorizationResponse.IGNORE)
- {
- return;
- }
- else if (authResponse.getResponseCode() == AuthorizationResponse.REJECT)
- {
- removeContact((ContactYahooImpl)srcContact);
- try
- {
- yahooSession.rejectFriendAuthorization(
- ev, ev.getFrom(), authResponse.getReason());
- }
- catch(IOException ex)
- {
- logger.error("cannot send auth deny", ex);
- }
-
- return;
- }
-
- // else we accepted it
- try
- {
- yahooSession.acceptFriendAuthorization(ev, ev.getFrom());
- }
- catch(IOException ex)
- {
- logger.error("cannot send auth deny", ex);
- }
-
- if(isCurrentlyCreated)
- try
- {
- addContact(ev.getFrom());
- }
- catch (OperationFailedException ex)
- {
- logger.error("Cannot add friend", ex);
- }
- }
-
- /**
- * Imulates firing adding contact in group and moving contact to group.
- * When moving contact it is first adding to the new group then
- * it is removed from the old one.
- */
- private class ContactListModListenerImpl
- extends SessionAdapter
- {
- private final Hashtable<String, Object> waitMove
- = new Hashtable<String, Object>();
-
- public void waitForMove(String id, String oldParent)
- {
- waitMove.put(id, oldParent);
- }
-
- public void removeWaitForMove(String id)
- {
- waitMove.remove(id);
- }
-
- /**
- * Successfully added a friend
- * friend - YahooUser of friend
- * group - name of group added to
- * @param ev fired event
- */
- @Override
- public void friendAddedReceived(SessionFriendEvent ev)
- {
- if (logger.isTraceEnabled())
- logger.trace("Receive event for adding a friend : " + ev);
-
- ContactGroupYahooImpl group =
- findContactGroup(ev.getGroup());
-
- if(group == null){
- if (logger.isTraceEnabled())
- logger.trace("Group not found!" + ev.getGroup());
- return;
- }
-
- String contactID = ev.getFriend().getId();
- ContactYahooImpl contactToAdd = findContactById(contactID);
-
- // if group is note resolved resolve it
- // this means newly created group
- if(!group.isResolved())
- {
- // if the contact is volatile me must remove it
- // as new one will be created
- if(contactToAdd != null && contactToAdd.isVolatile())
- {
- ContactGroupYahooImpl parent
- = (ContactGroupYahooImpl)contactToAdd
- .getParentContactGroup();
-
- parent.removeContact(contactToAdd);
- fireContactRemoved(parent, contactToAdd);
- }
-
- YahooGroup gr = findGroup(ev.getGroup());
-
- if(gr != null)
- group.setResolved(gr);
-
- // contact will be added when resolving the group
-
- return;
- }
-
-
- boolean isVolatile = false;
-
- if(contactToAdd == null)
- {
- if(addedCustomYahooIds.containsKey(contactID))
- {
- String expectedContactID =
- addedCustomYahooIds.remove(contactID);
-
- contactToAdd =
- new ContactYahooImpl(expectedContactID, ev.getFriend(),
- ServerStoredContactListYahooImpl.this, true, true);
- }
- else
- {
- contactToAdd =
- new ContactYahooImpl(ev.getFriend(),
- ServerStoredContactListYahooImpl.this, true, true);
- }
- }
- else
- {
- isVolatile = contactToAdd.isVolatile();
- }
-
- //first check is contact is moving from a group
- Object isWaitingForMove = waitMove.get(contactID);
-
- if(isWaitingForMove != null && isWaitingForMove instanceof String)
- {
- // waits for move into group
- // will remove it from old group and will wait for event remove
- // from group, then will fire moved to group event
- String oldParent = (String)isWaitingForMove;
-
- group.addContact(contactToAdd);
- waitMove.put(contactID, group.getSourceGroup());
- try
- {
- yahooSession.removeFriend(contactID, oldParent);
- }
- catch(IOException ex)
- {
- if (logger.isInfoEnabled())
- logger.info("Cannot Remove(till moving) contact :" +
- contactToAdd + " from group " + oldParent);
- }
- return;
- }
-
- if(isVolatile)
- {
- // we must remove the volatile buddy as we will add
- // the persistent one.
- // Volatile buddy is moving from the volatile group
- // to the new one
- ContactGroupYahooImpl parent =
- (ContactGroupYahooImpl)contactToAdd.getParentContactGroup();
-
- parent.removeContact(contactToAdd);
- fireContactRemoved(parent, contactToAdd);
-
- contactToAdd.setPersistent(true);
- contactToAdd.setResolved(ev.getFriend());
-
- group.addContact(contactToAdd);
-
- fireContactAdded(group, contactToAdd);
- waitMove.remove(contactID);
-
- return;
- }
-
- group.addContact(contactToAdd);
- fireContactAdded(group, contactToAdd);
- }
-
- /**
- * Successfully removed a friend
- * friend - YahooUser of friend
- * group - name of group removed from
- * @param ev fired event
- */
- @Override
- public void friendRemovedReceived(SessionFriendEvent ev)
- {
- if (logger.isTraceEnabled())
- logger.trace("Receive event for removing a friend : " + ev);
-
- String contactID = ev.getFriend().getId();
-
- // first check is this part of move action
- Object waitForMoveObj = waitMove.get(contactID);
- if(waitForMoveObj != null && waitForMoveObj instanceof YahooGroup)
- {
- // first get the group - oldParent
- ContactGroupYahooImpl oldParent
- = findContactGroup(ev.getGroup());
- ContactYahooImpl contactToRemove
- = oldParent.findContact(contactID);
-
- oldParent.removeContact(contactToRemove);
- waitMove.remove(contactID);
-
- ContactGroupYahooImpl newParent =
- findContactGroup(((YahooGroup)waitForMoveObj).getName());
-
- fireContactMoved(oldParent, newParent, contactToRemove);
- return;
- }
-
- ContactYahooImpl contactToRemove = findContactById(contactID);
-
- // strange we cannot find the contact to be removed
- if(contactToRemove == null)
- return;
-
- ContactGroupYahooImpl parentGroup =
- (ContactGroupYahooImpl)contactToRemove.
- getParentContactGroup();
- parentGroup.removeContact(contactToRemove);
- fireContactRemoved(parentGroup, contactToRemove);
-
- // check if the group is deleted. If the contact is the last one in
- // the group. The group is also deleted
- if(findGroup(ev.getGroup()) == null)
- {
- rootGroup.removeSubGroup(parentGroup);
- fireGroupEvent(parentGroup,
- ServerStoredGroupEvent.GROUP_REMOVED_EVENT);
- }
- }
-
- /**
- * Someone wants to add us to their friends list
- * to - the target (us!)
- * from - the user who wants to add us
- * message - the request message text
- * @param ev fired event
- */
- @Override
- public void contactRequestReceived(SessionEvent ev)
- {
- if (logger.isInfoEnabled())
- logger.info("contactRequestReceived : " + ev);
-
- if(handler == null || ev.getFrom() == null)
- return;
-
- ContactYahooImpl contact = findContactById(ev.getFrom());
-
- if(contact == null)
- contact = createVolatileContact(ev.getFrom());
-
- AuthorizationRequest request = new AuthorizationRequest();
- request.setReason(ev.getMessage());
-
- AuthorizationResponse resp =
- handler.processAuthorisationRequest(request, contact);
-
- if (resp.getResponseCode() == AuthorizationResponse.REJECT)
- {
- try{
- yahooSession.rejectContact(ev, resp.getReason());
- }catch(IOException ex){
- logger.error("Cannot send reject : " + ex.getMessage());
- }
- }
- }
-
- /**
- * Someone has rejected our attempts to add them to our friends list
- * from - the user who rejected us
- * message - rejection message text
- * @param ev fired event
- */
- @Override
- public void contactRejectionReceived(SessionEvent ev)
- {
- if (logger.isInfoEnabled())
- logger.info("contactRejectionReceived : " + ev);
-
- if(handler == null)
- return;
-
- ContactYahooImpl contact = findContactById(ev.getFrom());
-
- AuthorizationResponse resp =
- new AuthorizationResponse(AuthorizationResponse.REJECT,
- ev.getMessage());
- handler.processAuthorizationResponse(resp, contact);
- }
-
- /**
- * Invoked on picture received.
- * @param ev fired event
- */
- @Override
- public void pictureReceived(SessionPictureEvent ev)
- {
- ContactYahooImpl contact = findContactById(ev.getFrom());
-
- if(contact == null)
- return;
-
- contact.setImage(ev.getPictureData());
-
- parentOperationSet.fireContactPropertyChangeEvent(
- ContactPropertyChangeEvent.PROPERTY_IMAGE,
- contact, null, ev.getPictureData());
- }
-
- /**
- * Process Authorization responses
- * @param ev the event to process
- */
- @Override
- public void authorizationReceived(SessionAuthorizationEvent ev)
- {
- if(ev.isAuthorizationAccepted())
- {
- if (logger.isTraceEnabled())
- logger.trace("authorizationAccepted from " + ev.getFrom());
- Contact srcContact = findContactById(ev.getFrom());
-
- if(srcContact == null)
- {
- if (logger.isTraceEnabled())
- logger.trace("No contact found");
- }
- else
- handler.processAuthorizationResponse(
- new AuthorizationResponse(
- AuthorizationResponse.ACCEPT,
- ev.getMessage()),
- srcContact);
- }
- else if(ev.isAuthorizationDenied())
- {
- if (logger.isTraceEnabled())
- logger.trace("authorizationDenied from " + ev.getFrom());
- Contact srcContact = findContactById(ev.getFrom());
-
- if(srcContact == null)
- {
- if (logger.isTraceEnabled())
- logger.trace("No contact found");
- }
- else
- {
- handler.processAuthorizationResponse(
- new AuthorizationResponse(
- AuthorizationResponse.REJECT,
- ev.getMessage()),
- srcContact);
- try
- {
- removeContact((ContactYahooImpl)srcContact);
- } catch (Exception ex)
- {
- logger.error("cannot remove denied contact : " +
- srcContact, ex);
- }
- }
- }
- else if(ev.isAuthorizationRequest())
- {
- if (logger.isTraceEnabled())
- logger.trace("authorizationRequestReceived from "
- + ev.getFrom());
- processAuthorizationRequest(ev);
- }
- }
- }
-
- /**
- * Sets the yahoo session instance of the lib
- * which comunicates with the server
- * @param session YahooSession
- */
- void setYahooSession(YahooSession session)
- {
- this.yahooSession = session;
- session.addSessionListener(contactListModListenerImpl);
- initList();
- }
-
- /**
- * It seems that ymsg (or the Yahoo! service itself as the problem also
- * appears with libpurple) would return illegal chars for names that were
- * entered in cyrillic. We use this method to translate their names into
- * something that we could actually display and store here.
- *
- * @param ymsgString the <tt>String</tt> containing illegal chars.
- *
- * @return a String where all illegal chars are converted into human
- * readable ones
- */
- static String replaceIllegalChars(String ymsgString)
- {
- return ymsgString.replace((char)26, '?');
- }
-}
diff --git a/src/net/java/sip/communicator/impl/protocol/yahoo/VolatileContactGroupYahooImpl.java b/src/net/java/sip/communicator/impl/protocol/yahoo/VolatileContactGroupYahooImpl.java
deleted file mode 100644
index e2c589a..0000000
--- a/src/net/java/sip/communicator/impl/protocol/yahoo/VolatileContactGroupYahooImpl.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Jitsi, the OpenSource Java VoIP and Instant Messaging client.
- *
- * Copyright @ 2015 Atlassian Pty Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.java.sip.communicator.impl.protocol.yahoo;
-
-import java.util.*;
-
-import net.java.sip.communicator.service.protocol.*;
-
-/**
- * The Yahoo implementation of the Volatile ContactGroup interface.
- *
- * @author Damian Minkov
- */
-public class VolatileContactGroupYahooImpl
- extends ContactGroupYahooImpl
-{
- /**
- * This contact group name
- */
- private String contactGroupName = null;
-
- /**
- * Creates an Yahoo group using the specified group name
- * @param groupName String groupname
- * @param ssclCallback a callback to the server stored contact list
- * we're creating.
- */
- VolatileContactGroupYahooImpl(
- String groupName,
- ServerStoredContactListYahooImpl ssclCallback)
- {
- super(groupName, ssclCallback);
- this.contactGroupName = groupName;
- }
-
- /**
- * Returns the name of this group.
- * @return a String containing the name of this group.
- */
- @Override
- public String getGroupName()
- {
- return contactGroupName;
- }
-
- /**
- * Returns a string representation of this group, in the form
- * YahooGroup.GroupName[size]{ buddy1.toString(), buddy2.toString(), ...}.
- * @return a String representation of the object.
- */
- @Override
- public String toString()
- {
- StringBuffer buff = new StringBuffer("VolatileYahooGroup.");
- buff.append(getGroupName());
- buff.append(", childContacts="+countContacts()+":[");
-
- Iterator<Contact> contacts = contacts();
-
- while (contacts.hasNext())
- {
- Contact contact = contacts.next();
-
- buff.append(contact.toString());
- if(contacts.hasNext())
- buff.append(", ");
- }
- return buff.append("]").toString();
- }
-
- /**
- * Determines whether or not this contact group is being stored by the
- * server. Non persistent contact groups exist for the sole purpose of
- * containing non persistent contacts.
- * @return true if the contact group is persistent and false otherwise.
- */
- @Override
- public boolean isPersistent()
- {
- return false;
- }
-}
diff --git a/src/net/java/sip/communicator/impl/protocol/yahoo/YahooAccountID.java b/src/net/java/sip/communicator/impl/protocol/yahoo/YahooAccountID.java
deleted file mode 100644
index 0eb0e86..0000000
--- a/src/net/java/sip/communicator/impl/protocol/yahoo/YahooAccountID.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Jitsi, the OpenSource Java VoIP and Instant Messaging client.
- *
- * Copyright @ 2015 Atlassian Pty Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.java.sip.communicator.impl.protocol.yahoo;
-
-import java.util.*;
-
-import net.java.sip.communicator.service.protocol.*;
-
-/**
- * The Yahoo implementation of a sip-communicator AccountID
- *
- * @author Damian Minkov
- */
-public class YahooAccountID
- extends AccountID
-{
- /**
- * Creates an account id from the specified id and account properties.
- * @param id the id identifying this account
- * @param accountProperties any other properties necessary for the account.
- */
- YahooAccountID(String id, Map<String, String> accountProperties )
- {
- super(YahooSession.getYahooUserID(id),
- accountProperties, ProtocolNames.YAHOO, "yahoo.com");
- }
-}
diff --git a/src/net/java/sip/communicator/impl/protocol/yahoo/YahooActivator.java b/src/net/java/sip/communicator/impl/protocol/yahoo/YahooActivator.java
deleted file mode 100644
index 1e7ca01..0000000
--- a/src/net/java/sip/communicator/impl/protocol/yahoo/YahooActivator.java
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- * Jitsi, the OpenSource Java VoIP and Instant Messaging client.
- *
- * Copyright @ 2015 Atlassian Pty Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.java.sip.communicator.impl.protocol.yahoo;
-
-import java.util.*;
-
-import net.java.sip.communicator.service.protocol.*;
-
-import org.jitsi.service.configuration.*;
-import org.jitsi.service.resources.*;
-import org.osgi.framework.*;
-
-/**
- * Loads the Yahoo provider factory and registers it with service in the OSGI
- * bundle context.
- *
- * @author Damian Minkov
- */
-public class YahooActivator
- implements BundleActivator
-{
- private ServiceRegistration yahooPpFactoryServReg = null;
- private static BundleContext bundleContext = null;
- private static ConfigurationService configurationService = null;
-
- private static ProtocolProviderFactoryYahooImpl yahooProviderFactory = null;
-
- private static ResourceManagementService resourcesService;
-
- /**
- * Called when this bundle is started so the Framework can perform the
- * bundle-specific activities necessary to start this bundle.
- *
- * @param context The execution context of the bundle being started.
- * @throws Exception If this method throws an exception, this bundle is
- * marked as stopped and the Framework will remove this bundle's
- * listeners, unregister all services registered by this bundle, and
- * release all services used by this bundle.
- */
- public void start(BundleContext context) throws Exception
- {
- bundleContext = context;
-
- Hashtable<String, String> hashtable = new Hashtable<String, String>();
- hashtable.put(ProtocolProviderFactory.PROTOCOL, ProtocolNames.YAHOO);
-
- yahooProviderFactory = new ProtocolProviderFactoryYahooImpl();
-
- //reg the yahoo account man.
- yahooPpFactoryServReg = context.registerService(
- ProtocolProviderFactory.class.getName(),
- yahooProviderFactory,
- hashtable);
- }
-
- /**
- * Returns a reference to a ConfigurationService implementation currently
- * registered in the bundle context or null if no such implementation was
- * found.
- *
- * @return ConfigurationService a currently valid implementation of the
- * configuration service.
- */
- public static ConfigurationService getConfigurationService()
- {
- if(configurationService == null)
- {
- ServiceReference confReference
- = bundleContext.getServiceReference(
- ConfigurationService.class.getName());
- configurationService
- = (ConfigurationService) bundleContext.getService(confReference);
- }
- return configurationService;
- }
-
- /**
- * Returns a reference to the bundle context that we were started with.
- * @return a reference to the BundleContext instance that we were started
- * witn.
- */
- public static BundleContext getBundleContext()
- {
- return bundleContext;
- }
-
- /**
- * Retrurns a reference to the protocol provider factory that we have
- * registered.
- * @return a reference to the <tt>ProtocolProviderFactoryYahooImpl</tt>
- * instance that we have registered from this package.
- */
- static ProtocolProviderFactoryYahooImpl getProtocolProviderFactory()
- {
- return yahooProviderFactory;
- }
-
- /**
- * Called when this bundle is stopped so the Framework can perform the
- * bundle-specific activities necessary to stop the bundle.
- *
- * @param context The execution context of the bundle being stopped.
- * @throws Exception If this method throws an exception, the bundle is
- * still marked as stopped, and the Framework will remove the bundle's
- * listeners, unregister all services registered by the bundle, and
- * release all services used by the bundle.
- */
- public void stop(BundleContext context) throws Exception
- {
- yahooProviderFactory.stop();
- yahooPpFactoryServReg.unregister();
- }
-
- public static ResourceManagementService getResources()
- {
- if (resourcesService == null)
- {
- ServiceReference serviceReference = bundleContext
- .getServiceReference(ResourceManagementService.class.getName());
-
- if(serviceReference == null)
- return null;
-
- resourcesService = (ResourceManagementService) bundleContext
- .getService(serviceReference);
- }
-
- return resourcesService;
- }
-}
diff --git a/src/net/java/sip/communicator/impl/protocol/yahoo/YahooSession.java b/src/net/java/sip/communicator/impl/protocol/yahoo/YahooSession.java
deleted file mode 100644
index f24e50c..0000000
--- a/src/net/java/sip/communicator/impl/protocol/yahoo/YahooSession.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Jitsi, the OpenSource Java VoIP and Instant Messaging client.
- *
- * Copyright @ 2015 Atlassian Pty Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.java.sip.communicator.impl.protocol.yahoo;
-
-import java.io.*;
-
-import ymsg.network.*;
-
-/**
- * Extends The Yahoo session to have access to some
- * protected functionality
- * Not working for now.
- *
- * @author Damian Minkov
- */
-public class YahooSession
- extends Session
-{
- /**
- * Renames a group. Not working for now
- */
- public void renameGroup(String oldName, String newName)
- throws IOException
- {
- transmitGroupRename(oldName, newName);
- }
-
- /**
- * Removes the server part from the given id
- */
- public static String getYahooUserID(String id)
- {
- return (id.indexOf("@") > -1 )
- ? id.substring(0, id.indexOf("@"))
- : id;
- }
-
- /**
- * Sending typing notifications
- * @param to user we are notifing
- * @param from our user id
- */
- void keyTyped(String to, String from)
- {
- try {
- transmitNotify(to, from, true, " ", NOTIFY_TYPING);
- }catch(IOException e){}
- }
-
- /**
- * Sending stop typing notifications
- * @param to user we are notifing
- * @param from our user id
- */
- void stopTyping(String to, String from)
- {
- try {
- transmitNotify(to, from, false, " ", NOTIFY_TYPING);
- }catch(IOException e){}
- }
-}
diff --git a/src/net/java/sip/communicator/impl/protocol/yahoo/yahoo.provider.manifest.mf b/src/net/java/sip/communicator/impl/protocol/yahoo/yahoo.provider.manifest.mf
deleted file mode 100644
index 39e23bf..0000000
--- a/src/net/java/sip/communicator/impl/protocol/yahoo/yahoo.provider.manifest.mf
+++ /dev/null
@@ -1,22 +0,0 @@
-Bundle-Activator: net.java.sip.communicator.impl.protocol.yahoo.YahooActivator
-Bundle-Name: Yahoo Protocol Provider Implementation
-Bundle-Description: An Yahoo implementation of the Protocol Provider Service.
-Bundle-Vendor: jitsi.org
-Bundle-Version: 0.0.1
-Bundle-SymbolicName: net.java.sip.communicator.protocol.yahoo
-Import-Package: org.osgi.framework,
- javax.net.ssl,
- javax.swing,
- javax.swing.text,
- javax.xml.parsers,
- javax.naming,
- javax.naming.directory,
- org.xml.sax,
- sun.security.action,
- org.jitsi.service.configuration,
- org.jitsi.service.resources, net.java.sip.communicator.service.resources,
- net.java.sip.communicator.util,
- net.java.sip.communicator.service.dns,
- net.java.sip.communicator.service.protocol,
- net.java.sip.communicator.service.protocol.yahooconstants,
- net.java.sip.communicator.service.protocol.event
diff --git a/src/net/java/sip/communicator/plugin/addrbook/macosx/MacOSXAddrBookContactQuery.java b/src/net/java/sip/communicator/plugin/addrbook/macosx/MacOSXAddrBookContactQuery.java
index 0658d59..81a4aad 100644
--- a/src/net/java/sip/communicator/plugin/addrbook/macosx/MacOSXAddrBookContactQuery.java
+++ b/src/net/java/sip/communicator/plugin/addrbook/macosx/MacOSXAddrBookContactQuery.java
@@ -419,7 +419,7 @@ public class MacOSXAddrBookContactQuery
c = Category.InstantMessaging;
break;
case kABMSNInstantProperty:
- sc = SubCategory.MSN;
+ sc = SubCategory.Skype;
c = Category.InstantMessaging;
break;
case kABYahooInstantProperty:
@@ -1240,12 +1240,6 @@ public class MacOSXAddrBookContactQuery
case kABPhoneProperty:
supportedOpSets.add(OperationSetBasicTelephony.class);
break;
- case kABYahooInstantProperty:
- supportedOpSets.add(OperationSetBasicInstantMessaging.class);
- preferredProtocols.put(
- OperationSetBasicInstantMessaging.class,
- ProtocolNames.YAHOO);
- break;
default:
break;
}
@@ -1339,7 +1333,7 @@ public class MacOSXAddrBookContactQuery
return kABAIMInstantProperty;
else if(subCategories.contains(SubCategory.ICQ))
return kABICQInstantProperty;
- else if(subCategories.contains(SubCategory.MSN))
+ else if(subCategories.contains(SubCategory.Skype))
return kABMSNInstantProperty;
else if(subCategories.contains(SubCategory.Jabber))
return kABJabberInstantProperty;
diff --git a/src/net/java/sip/communicator/plugin/aimaccregwizz/aimaccregwizz.manifest.mf b/src/net/java/sip/communicator/plugin/aimaccregwizz/aimaccregwizz.manifest.mf
index 274310a..b5d678f 100644
--- a/src/net/java/sip/communicator/plugin/aimaccregwizz/aimaccregwizz.manifest.mf
+++ b/src/net/java/sip/communicator/plugin/aimaccregwizz/aimaccregwizz.manifest.mf
@@ -12,7 +12,6 @@ Import-Package: org.osgi.framework,
net.java.sip.communicator.service.gui,
net.java.sip.communicator.service.gui.event,
net.java.sip.communicator.service.protocol,
- net.java.sip.communicator.service.protocol.aimconstants,
net.java.sip.communicator.service.protocol.event,
net.java.sip.communicator.service.protocol.icqconstants,
org.jitsi.service.resources, net.java.sip.communicator.service.resources,
diff --git a/src/net/java/sip/communicator/plugin/globalproxyconfig/GlobalProxyPluginActivator.java b/src/net/java/sip/communicator/plugin/globalproxyconfig/GlobalProxyPluginActivator.java
index a80633e..7e9dbd5 100644
--- a/src/net/java/sip/communicator/plugin/globalproxyconfig/GlobalProxyPluginActivator.java
+++ b/src/net/java/sip/communicator/plugin/globalproxyconfig/GlobalProxyPluginActivator.java
@@ -175,9 +175,8 @@ public class GlobalProxyPluginActivator implements BundleActivator
"http.proxyPort", globalProxyPortStr);
}
- // used by some protocols like yahoo
- System.setProperty(
- "proxySet", "true");
+ // used by some protocols
+ System.setProperty("proxySet", "true");
}
else if(globalProxyType.equals(
ProxyInfo.ProxyType.SOCKS4.name()) ||
@@ -196,9 +195,8 @@ public class GlobalProxyPluginActivator implements BundleActivator
"socksProxyPort", globalProxyPortStr);
}
- // used by some protocols like yahoo
- System.setProperty(
- "socksProxySet", "true");
+ // used by some protocols
+ System.setProperty("socksProxySet", "true");
}
Authenticator.setDefault(new AuthenticatorImpl(
diff --git a/src/net/java/sip/communicator/plugin/msofficecomm/Messenger.java b/src/net/java/sip/communicator/plugin/msofficecomm/Messenger.java
index 28754e4..51b3a67 100644
--- a/src/net/java/sip/communicator/plugin/msofficecomm/Messenger.java
+++ b/src/net/java/sip/communicator/plugin/msofficecomm/Messenger.java
@@ -28,7 +28,6 @@ import net.java.sip.communicator.service.protocol.*;
import net.java.sip.communicator.service.protocol.ServerStoredDetails.*;
import net.java.sip.communicator.service.protocol.event.*;
import net.java.sip.communicator.service.protocol.jabberconstants.*;
-import net.java.sip.communicator.service.protocol.yahooconstants.*;
import net.java.sip.communicator.util.*;
import org.jitsi.service.configuration.*;
@@ -1123,11 +1122,6 @@ public class Messenger
{
mistatus = MISTATUS_ON_THE_PHONE;
}
- else if (ProtocolNames.YAHOO.equalsIgnoreCase(protocolName)
- && YahooStatusEnum.ON_THE_PHONE.equals(presenceStatus))
- {
- mistatus = MISTATUS_ON_THE_PHONE;
- }
else if ((i == 32 /* FIXME */)
&& ProtocolNames.JABBER.equalsIgnoreCase(protocolName)
&& JabberStatusEnum.IN_A_MEETING.equalsIgnoreCase(
diff --git a/src/net/java/sip/communicator/plugin/msofficecomm/msofficecomm.manifest.mf b/src/net/java/sip/communicator/plugin/msofficecomm/msofficecomm.manifest.mf
index 54d8545..2a3a712 100644
--- a/src/net/java/sip/communicator/plugin/msofficecomm/msofficecomm.manifest.mf
+++ b/src/net/java/sip/communicator/plugin/msofficecomm/msofficecomm.manifest.mf
@@ -10,7 +10,6 @@ Import-Package: javax.swing,
net.java.sip.communicator.service.protocol,
net.java.sip.communicator.service.protocol.event,
net.java.sip.communicator.service.protocol.jabberconstants,
- net.java.sip.communicator.service.protocol.yahooconstants,
net.java.sip.communicator.util,
org.jitsi.service.configuration,
org.jitsi.util,
diff --git a/src/net/java/sip/communicator/plugin/yahooaccregwizz/FirstWizardPage.java b/src/net/java/sip/communicator/plugin/yahooaccregwizz/FirstWizardPage.java
deleted file mode 100644
index 27e32c6..0000000
--- a/src/net/java/sip/communicator/plugin/yahooaccregwizz/FirstWizardPage.java
+++ /dev/null
@@ -1,299 +0,0 @@
-/*
- * Jitsi, the OpenSource Java VoIP and Instant Messaging client.
- *
- * Copyright @ 2015 Atlassian Pty Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.java.sip.communicator.plugin.yahooaccregwizz;
-
-import java.awt.*;
-
-import javax.swing.*;
-import javax.swing.event.*;
-
-import net.java.sip.communicator.service.gui.*;
-import net.java.sip.communicator.service.protocol.*;
-import net.java.sip.communicator.plugin.desktoputil.*;
-
-/**
- * The <tt>FirstWizardPage</tt> is the page, where user could enter the uin
- * and the password of the account.
- *
- * @author Yana Stamcheva
- * @author Damian Minkov
- */
-public class FirstWizardPage
- extends TransparentPanel
- implements WizardPage,
- DocumentListener
-{
- /**
- * Serial version UID.
- */
- private static final long serialVersionUID = 0L;
-
- public static final String FIRST_PAGE_IDENTIFIER = "FirstPageIdentifier";
-
- public static final String USER_NAME_EXAMPLE
- = "Ex: johnsmith@yahoo.com or johnsmith";
-
- private JPanel uinPassPanel = new TransparentPanel(new BorderLayout(10, 10));
-
- private JPanel labelsPanel = new TransparentPanel();
-
- private JPanel valuesPanel = new TransparentPanel();
-
- private JLabel uinLabel = new JLabel(
- Resources.getString("plugin.yahooaccregwizz.USERNAME"));
-
- private JLabel passLabel
- = new JLabel(Resources.getString("service.gui.PASSWORD"));
-
- private JPanel emptyPanel = new TransparentPanel();
-
- private JLabel uinExampleLabel = new JLabel(USER_NAME_EXAMPLE);
-
- private JTextField userIDField = new TrimTextField();
-
- private JPasswordField passField = new JPasswordField();
-
- private JCheckBox rememberPassBox =
- new SIPCommCheckBox(
- Resources.getString("service.gui.REMEMBER_PASSWORD"));
-
- private JPanel mainPanel = new TransparentPanel();
-
- private Object nextPageIdentifier = WizardPage.SUMMARY_PAGE_IDENTIFIER;
-
- private YahooAccountRegistrationWizard wizard;
-
- private boolean isCommitted = false;
-
- /**
- * Creates an instance of <tt>FirstWizardPage</tt>.
- *
- * @param wizard the parent wizard
- */
- public FirstWizardPage(YahooAccountRegistrationWizard wizard)
- {
-
- super(new BorderLayout());
-
- this.wizard = wizard;
-
- mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS));
-
- this.init();
-
- this.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
-
- this.labelsPanel
- .setLayout(new BoxLayout(labelsPanel, BoxLayout.Y_AXIS));
-
- this.valuesPanel
- .setLayout(new BoxLayout(valuesPanel, BoxLayout.Y_AXIS));
- }
-
- /**
- * Initializes all panels, buttons, etc.
- */
- private void init()
- {
- this.mainPanel.setOpaque(false);
- this.labelsPanel.setOpaque(false);
- this.valuesPanel.setOpaque(false);
- this.uinPassPanel.setOpaque(false);
- this.emptyPanel.setOpaque(false);
-
- this.userIDField.getDocument().addDocumentListener(this);
- this.rememberPassBox.setSelected(true);
-
- this.uinExampleLabel.setForeground(Color.GRAY);
- this.uinExampleLabel.setFont(uinExampleLabel.getFont().deriveFont(8));
- this.emptyPanel.setMaximumSize(new Dimension(40, 35));
- this.uinExampleLabel.setBorder(
- BorderFactory.createEmptyBorder(0, 0, 8, 0));
-
- labelsPanel.add(uinLabel);
- labelsPanel.add(emptyPanel);
- labelsPanel.add(passLabel);
-
- valuesPanel.add(userIDField);
- valuesPanel.add(uinExampleLabel);
- valuesPanel.add(passField);
-
- uinPassPanel.add(labelsPanel, BorderLayout.WEST);
- uinPassPanel.add(valuesPanel, BorderLayout.CENTER);
- uinPassPanel.add(rememberPassBox, BorderLayout.SOUTH);
-
- uinPassPanel.setBorder(BorderFactory.createTitledBorder(Resources
- .getString("plugin.yahooaccregwizz.USERID_AND_PASSWORD")));
-
- mainPanel.add(uinPassPanel);
- this.add(mainPanel, BorderLayout.NORTH);
- }
-
- /**
- * Implements the <code>WizardPage.getIdentifier</code> to return this
- * page identifier.
- */
- public Object getIdentifier()
- {
- return FIRST_PAGE_IDENTIFIER;
- }
-
- /**
- * Implements the <code>WizardPage.getNextPageIdentifier</code> to return
- * the next page identifier - the summary page.
- */
- public Object getNextPageIdentifier()
- {
- return nextPageIdentifier;
- }
-
- /**
- * Implements the <code>WizardPage.getBackPageIdentifier</code> to return
- * the back identifier. In this case it's null because this is the first
- * wizard page.
- * @return the identifier of the previous wizard page
- */
- public Object getBackPageIdentifier()
- {
- return null;
- }
-
- /**
- * Implements the <code>WizardPage.getWizardForm</code> to return this
- * panel.
- */
- public Object getWizardForm()
- {
- return this;
- }
-
- /**
- * Before this page is displayed enables or disables the "Next" wizard
- * button according to whether the UIN field is empty.
- */
- public void pageShowing()
- {
- this.setNextButtonAccordingToUIN();
- }
-
- /**
- * Saves the user input when the "Next" wizard buttons is clicked.
- */
- public void commitPage()
- {
- YahooAccountRegistration registration = wizard.getRegistration();
-
- String userID = userIDField.getText();
-
- if(userID == null || userID.trim().length() == 0)
- throw new IllegalStateException("No user ID provided.");
-
- registration.setUserID(userID);
- registration.setPassword(new String(passField.getPassword()));
- registration.setRememberPassword(rememberPassBox.isSelected());
-
- nextPageIdentifier = SUMMARY_PAGE_IDENTIFIER;
-
- isCommitted = true;
- }
-
- /**
- * Enables or disables the "Next" wizard button according to whether the UIN
- * field is empty.
- */
- private void setNextButtonAccordingToUIN()
- {
- if (userIDField.getText() == null || userIDField.getText().equals(""))
- {
- wizard.getWizardContainer().setNextFinishButtonEnabled(false);
- }
- else
- {
- wizard.getWizardContainer().setNextFinishButtonEnabled(true);
- }
- }
-
- /**
- * Handles the <tt>DocumentEvent</tt> triggered when user types in the UIN
- * field. Enables or disables the "Next" wizard button according to whether
- * the UIN field is empty.
- */
- public void insertUpdate(DocumentEvent e)
- {
- this.setNextButtonAccordingToUIN();
- }
-
- /**
- * Handles the <tt>DocumentEvent</tt> triggered when user deletes letters
- * from the UIN field. Enables or disables the "Next" wizard button
- * according to whether the UIN field is empty.
- */
- public void removeUpdate(DocumentEvent e)
- {
- this.setNextButtonAccordingToUIN();
- }
-
- public void changedUpdate(DocumentEvent e)
- {
- }
-
- public void pageHiding()
- {
- }
-
- public void pageShown()
- {
- }
-
- public void pageBack()
- {
- }
-
- /**
- * Fills the UIN and Password fields in this panel with the data coming
- * from the given protocolProvider.
- *
- * @param protocolProvider The <tt>ProtocolProviderService</tt> to load
- * the data from.
- */
- public void loadAccount(ProtocolProviderService protocolProvider)
- {
- AccountID accountID = protocolProvider.getAccountID();
- String password = YahooAccRegWizzActivator
- .getYahooProtocolProviderFactory().loadPassword(accountID);
-
- this.userIDField.setEnabled(false);
- this.userIDField.setText(accountID.getUserID());
-
- if (password != null)
- {
- this.passField.setText(password);
- this.rememberPassBox.setSelected(true);
- }
- }
-
- public Object getSimpleForm()
- {
- return uinPassPanel;
- }
-
- public boolean isCommitted()
- {
- return isCommitted;
- }
-}
diff --git a/src/net/java/sip/communicator/plugin/yahooaccregwizz/Resources.java b/src/net/java/sip/communicator/plugin/yahooaccregwizz/Resources.java
deleted file mode 100644
index c41a72f..0000000
--- a/src/net/java/sip/communicator/plugin/yahooaccregwizz/Resources.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Jitsi, the OpenSource Java VoIP and Instant Messaging client.
- *
- * Copyright @ 2015 Atlassian Pty Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.java.sip.communicator.plugin.yahooaccregwizz;
-
-import net.java.sip.communicator.service.resources.*;
-
-import org.jitsi.service.resources.*;
-
-/**
- * The <tt>Resources</tt> class manages the access to the internationalization
- * properties files and the image resources used in this plugin.
- *
- * @author Yana Stamcheva
- */
-public class Resources
-{
- private static ResourceManagementService resourcesService;
-
- public static ImageID YAHOO_LOGO
- = new ImageID("service.protocol.yahoo.YAHOO_16x16");
-
- public static ImageID PAGE_IMAGE
- = new ImageID("service.protocol.yahoo.YAHOO_64x64");
-
- /**
- * 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)
- {
- return getResources().getI18NString(key);
- }
-
- /**
- * Loads an image from a given image identifier.
- * @param imageID The identifier of the image.
- * @return The image for the given identifier.
- */
- public static byte[] getImage(ImageID imageID)
- {
- return getResources().getImageInBytes(imageID.getId());
- }
-
- /**
- * Returns the <tt>ResourceManagementService</tt>.
- *
- * @return the <tt>ResourceManagementService</tt>.
- */
- public static ResourceManagementService getResources()
- {
- if (resourcesService == null)
- resourcesService =
- ResourceManagementServiceUtils
- .getService(YahooAccRegWizzActivator.bundleContext);
- return resourcesService;
- }
-}
diff --git a/src/net/java/sip/communicator/plugin/yahooaccregwizz/YahooAccRegWizzActivator.java b/src/net/java/sip/communicator/plugin/yahooaccregwizz/YahooAccRegWizzActivator.java
deleted file mode 100644
index cd526a9..0000000
--- a/src/net/java/sip/communicator/plugin/yahooaccregwizz/YahooAccRegWizzActivator.java
+++ /dev/null
@@ -1,160 +0,0 @@
-/*
- * Jitsi, the OpenSource Java VoIP and Instant Messaging client.
- *
- * Copyright @ 2015 Atlassian Pty Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.java.sip.communicator.plugin.yahooaccregwizz;
-
-import java.util.*;
-
-import net.java.sip.communicator.service.browserlauncher.*;
-import net.java.sip.communicator.service.gui.*;
-import net.java.sip.communicator.service.protocol.*;
-import net.java.sip.communicator.util.*;
-
-import org.osgi.framework.*;
-
-/**
- * Registers the <tt>YahooAccountRegistrationWizard</tt> in the UI Service.
- *
- * @author Yana Stamcheva
- */
-public class YahooAccRegWizzActivator
- extends AbstractServiceDependentActivator
-{
- /**
- * OSGi bundle context.
- */
- public static BundleContext bundleContext;
-
- private static final Logger logger =
- Logger.getLogger(YahooAccRegWizzActivator.class);
-
- private static BrowserLauncherService browserLauncherService;
-
- private static WizardContainer wizardContainer;
-
- private static YahooAccountRegistrationWizard yahooWizard;
-
- private static UIService uiService;
-
- /**
- * Starts this bundle.
- */
- @Override
- public void start(Object dependentService)
- {
- uiService = (UIService)dependentService;
-
- wizardContainer = uiService.getAccountRegWizardContainer();
-
- yahooWizard = new YahooAccountRegistrationWizard(wizardContainer);
-
- Hashtable<String, String> containerFilter
- = new Hashtable<String, String>();
-
- containerFilter.put(
- ProtocolProviderFactory.PROTOCOL,
- ProtocolNames.YAHOO);
-
- bundleContext.registerService(
- AccountRegistrationWizard.class.getName(),
- yahooWizard,
- containerFilter);
- }
-
- /**
- * The dependent class. We are waiting for the ui service.
- * @return the ui service class.
- */
- @Override
- public Class<?> getDependentServiceClass()
- {
- return UIService.class;
- }
-
- /**
- * The bundle context to use.
- * @param context the context to set.
- */
- @Override
- public void setBundleContext(BundleContext context)
- {
- bundleContext = context;
- }
-
- public void stop(BundleContext bundleContext) throws Exception
- {
- }
-
- /**
- * Returns the <tt>ProtocolProviderFactory</tt> for the Yahoo protocol.
- * @return the <tt>ProtocolProviderFactory</tt> for the Yahoo protocol
- */
- public static ProtocolProviderFactory getYahooProtocolProviderFactory()
- {
- ServiceReference[] serRefs = null;
- String osgiFilter
- = "("
- + ProtocolProviderFactory.PROTOCOL
- + "="
- + ProtocolNames.YAHOO
- + ")";
-
- try {
- serRefs
- = bundleContext.getServiceReferences(
- ProtocolProviderFactory.class.getName(),
- osgiFilter);
- }
- catch (InvalidSyntaxException ex){
- logger.error("YahooAccRegWizzActivator : " + ex);
- }
-
- return
- (serRefs == null)
- ? null
- : (ProtocolProviderFactory)
- bundleContext.getService(serRefs[0]);
- }
-
- /**
- * Returns the <tt>UIService</tt>.
- *
- * @return the <tt>UIService</tt>
- */
- public static UIService getUIService()
- {
- return uiService;
- }
-
- /**
- * Returns the <tt>BrowserLauncherService</tt> obtained from the bundle
- * context.
- * @return the <tt>BrowserLauncherService</tt> obtained from the bundle
- * context
- */
- public static BrowserLauncherService getBrowserLauncher() {
- if (browserLauncherService == null) {
- ServiceReference serviceReference = bundleContext
- .getServiceReference(BrowserLauncherService.class.getName());
-
- browserLauncherService = (BrowserLauncherService) bundleContext
- .getService(serviceReference);
- }
-
- return browserLauncherService;
- }
-}
diff --git a/src/net/java/sip/communicator/plugin/yahooaccregwizz/YahooAccountRegistration.java b/src/net/java/sip/communicator/plugin/yahooaccregwizz/YahooAccountRegistration.java
deleted file mode 100644
index 6cf7759..0000000
--- a/src/net/java/sip/communicator/plugin/yahooaccregwizz/YahooAccountRegistration.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Jitsi, the OpenSource Java VoIP and Instant Messaging client.
- *
- * Copyright @ 2015 Atlassian Pty Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.java.sip.communicator.plugin.yahooaccregwizz;
-
-/**
- * The <tt>YahooAccountRegistration</tt> is used to store all user input data
- * through the <tt>YahooAccountRegistrationWizard</tt>.
- *
- * @author Yana Stamcheva
- */
-public class YahooAccountRegistration {
-
- private String uin;
-
- private String password;
-
- private boolean rememberPassword = true;
-
- /**
- * Returns the password of the yahoo registration account.
- * @return the password of the yahoo registration account.
- */
- public String getPassword() {
- return password;
- }
-
- /**
- * Sets the password of the yahoo registration account.
- * @param password the password of the yahoo registration account.
- */
- public void setPassword(String password) {
- this.password = password;
- }
-
- /**
- * Returns TRUE if password has to remembered, FALSE otherwise.
- * @return TRUE if password has to remembered, FALSE otherwise
- */
- public boolean isRememberPassword() {
- return rememberPassword;
- }
-
- /**
- * Sets the rememberPassword value of this yahoo account registration.
- * @param rememberPassword TRUE if password has to remembered, FALSE
- * otherwise
- */
- public void setRememberPassword(boolean rememberPassword) {
- this.rememberPassword = rememberPassword;
- }
-
- /**
- * Returns the UIN of the yahoo registration account.
- * @return the UIN of the yahoo registration account.
- */
- public String getUin() {
- return uin;
- }
-
- /**
- * Sets the UIN of the yahoo registration account.
- * @param uin the UIN of the yahoo registration account.
- */
- public void setUserID(String uin) {
- this.uin = uin;
- }
-
-}
diff --git a/src/net/java/sip/communicator/plugin/yahooaccregwizz/YahooAccountRegistrationWizard.java b/src/net/java/sip/communicator/plugin/yahooaccregwizz/YahooAccountRegistrationWizard.java
deleted file mode 100644
index 033f409..0000000
--- a/src/net/java/sip/communicator/plugin/yahooaccregwizz/YahooAccountRegistrationWizard.java
+++ /dev/null
@@ -1,379 +0,0 @@
-/*
- * Jitsi, the OpenSource Java VoIP and Instant Messaging client.
- *
- * Copyright @ 2015 Atlassian Pty Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.java.sip.communicator.plugin.yahooaccregwizz;
-
-import java.awt.*;
-import java.util.*;
-
-import net.java.sip.communicator.service.gui.*;
-import net.java.sip.communicator.service.protocol.*;
-import net.java.sip.communicator.util.*;
-
-import org.osgi.framework.*;
-
-/**
- * The <tt>YahooAccountRegistrationWizard</tt> is an implementation of the
- * <tt>AccountRegistrationWizard</tt> for the Yahoo protocol. It should allow
- * the user to create and configure a new Yahoo account.
- *
- * @author Yana Stamcheva
- */
-public class YahooAccountRegistrationWizard
- extends DesktopAccountRegistrationWizard
-{
- private final Logger logger
- = Logger.getLogger(YahooAccountRegistrationWizard.class);
-
- private FirstWizardPage firstWizardPage;
-
- private YahooAccountRegistration registration =
- new YahooAccountRegistration();
-
- private ProtocolProviderService protocolProvider;
-
- /**
- * Creates an instance of <tt>YahooAccountRegistrationWizard</tt>.
- *
- * @param wizardContainer the wizard container, where this wizard is added
- */
- public YahooAccountRegistrationWizard(WizardContainer wizardContainer)
- {
- setWizardContainer(wizardContainer);
-
- wizardContainer
- .setFinishButtonText(Resources.getString("service.gui.SIGN_IN"));
- }
-
- /**
- * Implements the <code>AccountRegistrationWizard.getIcon</code> method.
- * Returns the icon to be used for this wizard.
- *
- * @return byte[]
- */
- @Override
- public byte[] getIcon()
- {
- return Resources.getImage(Resources.YAHOO_LOGO);
- }
-
- /**
- * Implements the <code>AccountRegistrationWizard.getPageImage</code>
- * method. Returns the image used to decorate the wizard page
- *
- * @return byte[] the image used to decorate the wizard page
- */
- @Override
- public byte[] getPageImage()
- {
- return Resources.getImage(Resources.PAGE_IMAGE);
- }
-
- /**
- * Implements the <code>AccountRegistrationWizard.getProtocolName</code>
- * method. Returns the protocol name for this wizard.
- *
- * @return String
- */
- @Override
- public String getProtocolName()
- {
- return Resources.getString("plugin.yahooaccregwizz.PROTOCOL_NAME");
- }
-
- /**
- * Implements the <code>AccountRegistrationWizard.getProtocolDescription
- * </code>
- * method. Returns the description of the protocol for this wizard.
- *
- * @return String
- */
- @Override
- public String getProtocolDescription()
- {
- return Resources
- .getString("plugin.yahooaccregwizz.PROTOCOL_DESCRIPTION");
- }
-
- /**
- * Returns the set of pages contained in this wizard.
- *
- * @return Iterator
- */
- @Override
- public Iterator<WizardPage> getPages()
- {
- java.util.List<WizardPage> pages = new ArrayList<WizardPage>();
- firstWizardPage = new FirstWizardPage(this);
-
- pages.add(firstWizardPage);
-
- return pages.iterator();
- }
-
- /**
- * Returns the set of data that user has entered through this wizard.
- *
- * @return Iterator
- */
- @Override
- public Iterator<Map.Entry<String, String>> getSummary()
- {
- Hashtable<String, String> summaryTable
- = new Hashtable<String, String>();
-
- summaryTable.put(
- Resources.getString("plugin.yahooaccregwizz.USERNAME"),
- registration.getUin());
- summaryTable.put(
- Resources.getString("service.gui.REMEMBER_PASSWORD"),
- Boolean.toString(registration.isRememberPassword()));
-
- return summaryTable.entrySet().iterator();
- }
-
- /**
- * Defines the operations that will be executed when the user clicks on
- * the wizard "Signin" button.
- *
- * @return the created <tt>ProtocolProviderService</tt> corresponding to the
- * new account
- * @throws OperationFailedException if the operation didn't succeed
- */
- @Override
- public ProtocolProviderService signin()
- throws OperationFailedException
- {
- firstWizardPage.commitPage();
-
- return signin( registration.getUin(),
- registration.getPassword());
- }
-
- /**
- * Defines the operations that will be executed when the user clicks on
- * the wizard "Signin" button.
- *
- * @param userName the user name to sign in with
- * @param password the password to sign in with
- * @return the created <tt>ProtocolProviderService</tt> corresponding to the
- * new account
- * @throws OperationFailedException if the operation didn't succeed
- */
- @Override
- public ProtocolProviderService signin(String userName, String password)
- throws OperationFailedException
- {
- ProtocolProviderFactory factory =
- YahooAccRegWizzActivator.getYahooProtocolProviderFactory();
-
- return this.installAccount( factory,
- userName,
- password);
- }
-
- /**
- * Creates an account for the given user and password.
- *
- * @param providerFactory the ProtocolProviderFactory which will create the
- * account
- * @param user the user identifier
- * @param passwd the password
- * @return the <tt>ProtocolProviderService</tt> for the new account.
- */
- public ProtocolProviderService installAccount(
- ProtocolProviderFactory providerFactory, String user, String passwd)
- throws OperationFailedException
- {
- Hashtable<String, String> accountProperties
- = new Hashtable<String, String>();
-
- accountProperties.put(ProtocolProviderFactory.ACCOUNT_ICON_PATH,
- "resources/images/protocol/yahoo/yahoo32x32.png");
-
- if (registration.isRememberPassword())
- {
- accountProperties.put(ProtocolProviderFactory.PASSWORD, passwd);
- }
-
- if (isModification())
- {
- providerFactory.modifyAccount( protocolProvider,
- accountProperties);
-
- setModification(false);
-
- return protocolProvider;
- }
-
- try
- {
- AccountID accountID =
- providerFactory.installAccount(user, accountProperties);
-
- ServiceReference serRef =
- providerFactory.getProviderForAccount(accountID);
-
- protocolProvider =
- (ProtocolProviderService) YahooAccRegWizzActivator
- .bundleContext.getService(serRef);
- }
- catch (IllegalStateException exc)
- {
- logger.warn(exc.getMessage());
-
- throw new OperationFailedException(
- "Account already exists.",
- OperationFailedException.IDENTIFICATION_CONFLICT);
- }
- catch (Exception exc)
- {
- logger.warn(exc.getMessage());
-
- throw new OperationFailedException(
- "Failed to add account",
- OperationFailedException.GENERAL_ERROR);
- }
-
- return protocolProvider;
- }
-
- /**
- * Fills the UIN and Password fields in this panel with the data coming
- * from the given protocolProvider.
- *
- * @param protocolProvider The <tt>ProtocolProviderService</tt> to load
- * the data from.
- */
- @Override
- public void loadAccount(ProtocolProviderService protocolProvider)
- {
- setModification(true);
-
- this.protocolProvider = protocolProvider;
-
- this.registration = new YahooAccountRegistration();
-
- this.firstWizardPage.loadAccount(protocolProvider);
- }
-
- /**
- * Returns the registration object, which will store all the data through
- * the wizard.
- *
- * @return the registration object, which will store all the data through
- * the wizard
- */
- public YahooAccountRegistration getRegistration()
- {
- return registration;
- }
-
- /**
- * Returns the size of this wizard.
- * @return the size of this wizard
- */
- @Override
- public Dimension getSize()
- {
- return new Dimension(600, 500);
- }
-
- /**
- * Returns the identifier of the page to show first in the wizard.
- * @return the identifier of the page to show first in the wizard.
- */
- @Override
- public Object getFirstPageIdentifier()
- {
- return firstWizardPage.getIdentifier();
- }
-
- /**
- * Returns the identifier of the page to show last in the wizard.
- * @return the identifier of the page to show last in the wizard.
- */
- @Override
- public Object getLastPageIdentifier()
- {
- return firstWizardPage.getIdentifier();
- }
-
- /**
- * Returns an example string, which should indicate to the user how the
- * user name should look like.
- * @return an example string, which should indicate to the user how the
- * user name should look like.
- */
- @Override
- public String getUserNameExample()
- {
- return FirstWizardPage.USER_NAME_EXAMPLE;
- }
-
- /**
- * Defines the operation that will be executed when user clicks on the
- * "Sign up" link.
- * @throws UnsupportedOperationException if the web sign up operation is
- * not supported by the current implementation.
- */
- @Override
- public void webSignup()
- {
- YahooAccRegWizzActivator.getBrowserLauncher()
- .openURL("https://edit.yahoo.com/registration");
- }
-
- /**
- * Returns <code>true</code> if the web sign up is supported by the current
- * implementation, <code>false</code> - otherwise.
- * @return <code>true</code> if the web sign up is supported by the current
- * implementation, <code>false</code> - otherwise
- */
- @Override
- public boolean isWebSignupSupported()
- {
- return true;
- }
-
- /**
- * Returns a simple account registration form that would be the first form
- * shown to the user. Only if the user needs more settings she'll choose
- * to open the advanced wizard, consisted by all pages.
- *
- * @param isCreateAccount indicates if the simple form should be opened as
- * a create account form or as a login form
- * @return a simple account registration form
- */
- @Override
- public Object getSimpleForm(boolean isCreateAccount)
- {
- firstWizardPage = new FirstWizardPage(this);
-
- return firstWizardPage.getSimpleForm();
- }
-
- /**
- * Whether the advanced configuration is enabled. Gives an option
- * to disable/hide advanced config button.
- * @return whether the advanced configuration is enabled.
- */
- public boolean isAdvancedConfigurationEnabled()
- {
- return false;
- }
-}
diff --git a/src/net/java/sip/communicator/plugin/yahooaccregwizz/yahooaccregwizz.manifest.mf b/src/net/java/sip/communicator/plugin/yahooaccregwizz/yahooaccregwizz.manifest.mf
deleted file mode 100644
index a975e2e..0000000
--- a/src/net/java/sip/communicator/plugin/yahooaccregwizz/yahooaccregwizz.manifest.mf
+++ /dev/null
@@ -1,33 +0,0 @@
-Bundle-Activator: net.java.sip.communicator.plugin.yahooaccregwizz.YahooAccRegWizzActivator
-Bundle-Name: Yahoo account registration wizard
-Bundle-Description: Yahoo account registration wizard.
-Bundle-Vendor: jitsi.org
-Bundle-Version: 0.0.1
-Bundle-SymbolicName: net.java.sip.communicator.plugin.yahooaccregwizz
-Import-Package: org.osgi.framework,
- net.java.sip.communicator.service.browserlauncher,
- org.jitsi.service.configuration,
- net.java.sip.communicator.service.contactlist,
- net.java.sip.communicator.service.contactlist.event,
- net.java.sip.communicator.service.gui,
- net.java.sip.communicator.service.gui.event,
- net.java.sip.communicator.service.protocol,
- net.java.sip.communicator.service.protocol.event,
- net.java.sip.communicator.service.protocol.icqconstants,
- org.jitsi.service.resources, net.java.sip.communicator.service.resources,
- net.java.sip.communicator.util,
- net.java.sip.communicator.plugin.desktoputil,
- javax.swing,
- javax.swing.event,
- javax.swing.table,
- javax.swing.text,
- javax.swing.text.html,
- javax.accessibility,
- javax.swing.plaf,
- javax.swing.plaf.metal,
- javax.swing.plaf.basic,
- javax.imageio,
- javax.swing.filechooser,
- javax.swing.tree,
- javax.swing.undo,
- javax.swing.border
diff --git a/src/net/java/sip/communicator/service/contactsource/ContactDetail.java b/src/net/java/sip/communicator/service/contactsource/ContactDetail.java
index 332c18d..362faf4 100644
--- a/src/net/java/sip/communicator/service/contactsource/ContactDetail.java
+++ b/src/net/java/sip/communicator/service/contactsource/ContactDetail.java
@@ -210,11 +210,9 @@ public class ContactDetail
*/
AIM("AIM"),
ICQ("ICQ"),
- MSN("MSN"),
- Jabber("Jabber"),
+ Jabber("XMPP"),
Skype("Skype"),
Yahoo("Yahoo"),
- Facebook("Facebook"),
GoogleTalk("GoogleTalk"),
/**
diff --git a/src/net/java/sip/communicator/service/googlecontacts/GoogleContactsEntry.java b/src/net/java/sip/communicator/service/googlecontacts/GoogleContactsEntry.java
index 0e89162..e72fe67 100644
--- a/src/net/java/sip/communicator/service/googlecontacts/GoogleContactsEntry.java
+++ b/src/net/java/sip/communicator/service/googlecontacts/GoogleContactsEntry.java
@@ -37,21 +37,11 @@ public interface GoogleContactsEntry
GOOGLETALK,
/**
- * Yahoo protocol.
- */
- YAHOO,
-
- /**
* AIM protocol.
*/
AIM,
/**
- * MSN protocol.
- */
- MSN,
-
- /**
* ICQ protocol.
*/
ICQ,
@@ -62,6 +52,11 @@ public interface GoogleContactsEntry
JABBER,
/**
+ * Skype protocol.
+ */
+ SKYPE,
+
+ /**
* Other protocol (i.e. not supported).
*/
OTHER,
diff --git a/src/net/java/sip/communicator/service/protocol/AdHocChatRoom.java b/src/net/java/sip/communicator/service/protocol/AdHocChatRoom.java
index 6f07bd1..e2af0a8 100644
--- a/src/net/java/sip/communicator/service/protocol/AdHocChatRoom.java
+++ b/src/net/java/sip/communicator/service/protocol/AdHocChatRoom.java
@@ -25,8 +25,7 @@ import net.java.sip.communicator.service.protocol.event.*;
* Represents an ad-hoc rendez-vous point where multiple chat users could
* communicate together. This interface describes the main methods used by some
* protocols for multi user chat, without useless methods (such as kicking a
- * participant) which aren't supported by these protocols (MSN, ICQ, Yahoo!,
- * etc.).
+ * participant) which aren't supported by these protocols (MSN, ICQ, etc.).
*
* <tt>AdHocChatRoom</tt> acts like a simplified <tt>ChatRoom</tt>.
*
diff --git a/src/net/java/sip/communicator/service/protocol/ProtocolNames.java b/src/net/java/sip/communicator/service/protocol/ProtocolNames.java
index 51ac63d..ba51c91 100644
--- a/src/net/java/sip/communicator/service/protocol/ProtocolNames.java
+++ b/src/net/java/sip/communicator/service/protocol/ProtocolNames.java
@@ -44,16 +44,6 @@ public interface ProtocolNames
public static final String IRC = "IRC";
/**
- * The Gadu-Gadu protocol.
- */
- public static final String GADU_GADU = "Gadu-Gadu";
-
- /**
- * The GroupWise protocol.
- */
- public static final String GROUP_WISE = "GroupWise";
-
- /**
* The ICQ service protocol.
*/
public static final String ICQ = "ICQ";
@@ -64,26 +54,11 @@ public interface ProtocolNames
public static final String AIM = "AIM";
/**
- * The Yahoo! messenger protocol.
- */
- public static final String YAHOO = "Yahoo!";
-
- /**
- * The Skype protocol.
- */
- public static final String SKYPE = "Skype";
-
- /**
* The SIP Communicator MOCK protocol.
*/
public static final String SIP_COMMUNICATOR_MOCK = "sip-communicator-mock";
/**
- * The Zeroconf protocol.
- */
- public static final String ZEROCONF = "Zeroconf";
-
- /**
* The SSH protocol.
*/
public static final String SSH = "SSH";
@@ -92,9 +67,4 @@ public interface ProtocolNames
* The Gibberish protocol.
*/
public static final String GIBBERISH = "Gibberish";
-
- /**
- * The Dict protocol.
- */
- public static final String DICT = "Dict";
}
diff --git a/src/net/java/sip/communicator/service/protocol/protocol.provider.manifest.mf b/src/net/java/sip/communicator/service/protocol/protocol.provider.manifest.mf
index 271af97..233eb84 100644
--- a/src/net/java/sip/communicator/service/protocol/protocol.provider.manifest.mf
+++ b/src/net/java/sip/communicator/service/protocol/protocol.provider.manifest.mf
@@ -17,12 +17,10 @@ Import-Package: net.java.sip.communicator.service.credentialsstorage,
org.jitsi.util.event,
org.osgi.framework
Export-Package: net.java.sip.communicator.service.protocol,
- net.java.sip.communicator.service.protocol.aimconstants,
net.java.sip.communicator.service.protocol.event,
net.java.sip.communicator.service.protocol.globalstatus,
net.java.sip.communicator.service.protocol.icqconstants,
net.java.sip.communicator.service.protocol.jabber,
net.java.sip.communicator.service.protocol.jabberconstants,
net.java.sip.communicator.service.protocol.sip,
- net.java.sip.communicator.service.protocol.whiteboardobjects,
- net.java.sip.communicator.service.protocol.yahooconstants
+ net.java.sip.communicator.service.protocol.whiteboardobjects
diff --git a/src/net/java/sip/communicator/service/protocol/yahooconstants/YahooStatusEnum.java b/src/net/java/sip/communicator/service/protocol/yahooconstants/YahooStatusEnum.java
deleted file mode 100644
index d21ec033..0000000
--- a/src/net/java/sip/communicator/service/protocol/yahooconstants/YahooStatusEnum.java
+++ /dev/null
@@ -1,200 +0,0 @@
-/*
- * Jitsi, the OpenSource Java VoIP and Instant Messaging client.
- *
- * Copyright @ 2015 Atlassian Pty Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.java.sip.communicator.service.protocol.yahooconstants;
-
-import java.io.*;
-import java.util.*;
-
-import net.java.sip.communicator.service.protocol.*;
-import net.java.sip.communicator.util.*;
-
-/**
- * An enumeration containing all status instances that MUST be supported by
- * an implementation of the yahoo protocol. Implementations may
- * support other forms of PresenceStatus but they MUST ALL support those
- * enumerated here.
- * <p>
- * For testing purposes, this class also provides a <tt>List</tt> containing
- * all of the status fields.
- *
- * @author Damian Minkov
- */
-public class YahooStatusEnum
- extends PresenceStatus
-{
- /**
- * The <tt>Logger</tt> used by the <tt>YahooStatusEnum</tt> class and its
- * instances for logging output.
- */
- private static Logger logger = Logger.getLogger(YahooStatusEnum.class);
-
- /**
- * The Online status. Indicate that the user is able and willing to
- * communicate.
- */
- public static final YahooStatusEnum AVAILABLE
- = new YahooStatusEnum(65, "Available",
- loadIcon("resources/images/protocol/yahoo/yahoo16x16-online.png"));
-
- /**
- * The Not Available status. Indicates that the user has connectivity
- * but might not be able to immediately act (i.e. even less immediately than
- * when in an Away status ;-P ) upon initiation of communication.
- */
- public static final YahooStatusEnum BE_RIGHT_BACK
- = new YahooStatusEnum(48, "Be Right Back",
- loadIcon("resources/images/protocol/yahoo/yahoo16x16-away.png"));
-
- /**
- * The Idle status. Indicates that the user is not using the messanger.
- */
- public static final YahooStatusEnum IDLE
- = new YahooStatusEnum(46, "Idle",
- loadIcon("resources/images/protocol/yahoo/yahoo16x16-idle.png"));
-
- /**
- * The Invisible status. Indicates that the user has connectivity even
- * though it may appear otherwise to others, to whom she would appear to be
- * offline.
- */
- public static final YahooStatusEnum INVISIBLE
- = new YahooStatusEnum(45, "Invisible",
- loadIcon("resources/images/protocol/yahoo/yahoo16x16-invisible.png"));
-
- /**
- * The STEPPED_OUT status. Indicates that the user has connectivity but might
- * not be able to immediately act upon initiation of communication.
- */
- public static final YahooStatusEnum STEPPED_OUT
- = new YahooStatusEnum(40, "Stepped out",
- loadIcon("resources/images/protocol/yahoo/yahoo16x16-away.png"));
-
- /**
- * The Out to lunch status. Indicates that the user is eating.
- */
- public static final YahooStatusEnum OUT_TO_LUNCH
- = new YahooStatusEnum(39, "Out to lunch",
- loadIcon("resources/images/protocol/yahoo/yahoo16x16-lunch.png"));
-
- /**
- * The Not at home status. Indicates that the user is not at home.
- */
- public static final YahooStatusEnum NOT_AT_HOME
- = new YahooStatusEnum(38, "Not at home",
- loadIcon("resources/images/protocol/yahoo/yahoo16x16-na.png"));
-
- /**
- * The Not at desk status. Indicates that the user is not at his desk, but
- * somewhere in the office.
- */
- public static final YahooStatusEnum NOT_AT_DESK
- = new YahooStatusEnum(36, "Not at desk",
- loadIcon("resources/images/protocol/yahoo/yahoo16x16-na.png"));
-
- /**
- * The Not in office status. Indicates that the user is out of the office.
- */
- public static final YahooStatusEnum NOT_IN_OFFICE
- = new YahooStatusEnum(34, "Not in office",
- loadIcon("resources/images/protocol/yahoo/yahoo16x16-na.png"));
-
- /**
- * The On vacation status. Indicates that the user is somewhere on the
- * beach or skiing.
- */
- public static final YahooStatusEnum ON_VACATION
- = new YahooStatusEnum(33, "On vacation",
- loadIcon("resources/images/protocol/yahoo/yahoo16x16-vacation.png"));
-
- /**
- * The On the phone status. Indicates that the user is talking to the phone.
- */
- public static final YahooStatusEnum ON_THE_PHONE
- = new YahooStatusEnum(31, "On the phone",
- loadIcon("resources/images/protocol/yahoo/yahoo16x16-phone.png"));
-
- /**
- * The DND status. Indicates that the user has connectivity but prefers
- * not to be contacted.
- */
- public static final YahooStatusEnum BUSY
- = new YahooStatusEnum(30, "Busy",
- loadIcon("resources/images/protocol/yahoo/yahoo16x16-busy.png"));
-
- /**
- * The Offline status. Indicates the user does not seem to be connected
- * to the network or at least does not want us to know she is
- */
- public static final YahooStatusEnum OFFLINE
- = new YahooStatusEnum(0, "Offline",
- loadIcon("resources/images/protocol/yahoo/yahoo16x16-offline.png"));
-
- /**
- * The minimal set of states that any implementation must support.
- */
- public static final ArrayList<YahooStatusEnum> yahooStatusSet
- = new ArrayList<YahooStatusEnum>();
- static{
- yahooStatusSet.add(AVAILABLE);
- yahooStatusSet.add(BE_RIGHT_BACK);
- yahooStatusSet.add(BUSY);
- yahooStatusSet.add(IDLE);
- yahooStatusSet.add(INVISIBLE);
- yahooStatusSet.add(NOT_AT_DESK);
- yahooStatusSet.add(NOT_AT_HOME);
- yahooStatusSet.add(NOT_IN_OFFICE);
- yahooStatusSet.add(OFFLINE);
- yahooStatusSet.add(ON_THE_PHONE);
- yahooStatusSet.add(ON_VACATION);
- yahooStatusSet.add(OUT_TO_LUNCH);
- yahooStatusSet.add(STEPPED_OUT);
- }
-
- /**
- * Creates a status with the specified connectivity coeff, name and icon.
- * @param status the connectivity coefficient for the specified status
- * @param statusName String
- * @param statusIcon the icon associated with this status
- */
- protected YahooStatusEnum(int status, String statusName, byte[] statusIcon)
- {
- super(status, statusName, statusIcon);
- }
-
- /**
- * Loads an image from a given image path.
- * @param imagePath The identifier of the image.
- * @return The image for the given identifier.
- */
- public static byte[] loadIcon(String imagePath) {
- InputStream is = YahooStatusEnum.class.getClassLoader()
- .getResourceAsStream(imagePath);
-
- if(is == null)
- return null;
-
- byte[] icon = null;
- try {
- icon = new byte[is.available()];
- is.read(icon);
- } catch (IOException exc) {
- logger.error("Failed to load icon: " + imagePath, exc);
- }
- return icon;
- }
-}
diff --git a/test/net/java/sip/communicator/slick/protocol/generic/TestOperationSetAdHocMultiUserChat.java b/test/net/java/sip/communicator/slick/protocol/generic/TestOperationSetAdHocMultiUserChat.java
index 13e5092..1f7db0f 100644
--- a/test/net/java/sip/communicator/slick/protocol/generic/TestOperationSetAdHocMultiUserChat.java
+++ b/test/net/java/sip/communicator/slick/protocol/generic/TestOperationSetAdHocMultiUserChat.java
@@ -138,10 +138,6 @@ public abstract class TestOperationSetAdHocMultiUserChat extends TestCase
* -Then they will leave the room. They will be invited again in another
* test.
*
- * NOTE that this test will be especially used by Yahoo! protocol because of
- * the fact that creating a conference chat with this protocol fails if any
- * participants are given to the dedicated constructor of the library.
- *
* @throws OperationNotSupportedException
* @throws OperationFailedException
*/
@@ -160,7 +156,6 @@ public abstract class TestOperationSetAdHocMultiUserChat extends TestCase
opSetAHMUC3, AHMUCEventCollector.INVITATION_EVENT);
// We create the room with the given contacts:
- // (NOTE that in Yahoo! adHocChatRoomName won't be considered!)
AdHocChatRoom room = opSetAHMUC1.createAdHocChatRoom(
adHocChatRoomName, contacts, invitationReason);
@@ -440,7 +435,7 @@ public abstract class TestOperationSetAdHocMultiUserChat extends TestCase
/**
* Make sure that invitations have been received on both side (user2 and
* user3). Note that it only make sense to use this method with protocol
- * who support invitations (Yahoo! and ICQ).
+ * who support invitations (ICQ).
*
* We will first test that after having accept an invitation the concerned
* user joins the room and be a part of participants.
diff --git a/test/net/java/sip/communicator/slick/protocol/generic/TestOperationSetFileTransfer.java b/test/net/java/sip/communicator/slick/protocol/generic/TestOperationSetFileTransfer.java
index e123bd3..d29092d 100644
--- a/test/net/java/sip/communicator/slick/protocol/generic/TestOperationSetFileTransfer.java
+++ b/test/net/java/sip/communicator/slick/protocol/generic/TestOperationSetFileTransfer.java
@@ -605,9 +605,8 @@ public abstract class TestOperationSetFileTransfer
,FileTransferStatusChangeEvent.PREPARING
,stat1.getNewStatus());
- // now wait if some protocol filres inProgress
+ // now wait if some protocol fires inProgress
// jabber doesn't fire inProgress here
- // yahoo fires it
receiverStatusListener.waitForEvent(14000);
// wait in_progress
diff --git a/test/net/java/sip/communicator/slick/protocol/icq/icq.provider.slick.manifest.mf b/test/net/java/sip/communicator/slick/protocol/icq/icq.provider.slick.manifest.mf
index 68d09e2..d1420bd 100644
--- a/test/net/java/sip/communicator/slick/protocol/icq/icq.provider.slick.manifest.mf
+++ b/test/net/java/sip/communicator/slick/protocol/icq/icq.provider.slick.manifest.mf
@@ -12,6 +12,5 @@ Import-Package: junit.framework,
net.java.sip.communicator.service.dns,
net.java.sip.communicator.service.protocol,
net.java.sip.communicator.service.protocol.icqconstants,
- net.java.sip.communicator.service.protocol.aimconstants,
net.java.sip.communicator.service.protocol.event,
org.jitsi.service.fileaccess
diff --git a/test/net/java/sip/communicator/slick/protocol/yahoo/TestAccountInstallation.java b/test/net/java/sip/communicator/slick/protocol/yahoo/TestAccountInstallation.java
deleted file mode 100644
index 0df8b3c..0000000
--- a/test/net/java/sip/communicator/slick/protocol/yahoo/TestAccountInstallation.java
+++ /dev/null
@@ -1,233 +0,0 @@
-/*
- * Jitsi, the OpenSource Java VoIP and Instant Messaging client.
- *
- * Copyright @ 2015 Atlassian Pty Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.java.sip.communicator.slick.protocol.yahoo;
-
-import java.util.*;
-
-import junit.framework.*;
-import net.java.sip.communicator.service.protocol.*;
-
-import org.osgi.framework.*;
-
-public class TestAccountInstallation
- extends TestCase
-{
-
- /**
- * Creates the test with the specified method name.
- * @param name the name of the method to execute.
- */
- public TestAccountInstallation(String name)
- {
- super(name);
- }
-
- /**
- * JUnit setup method.
- * @throws Exception in case anything goes wrong.
- */
- @Override
- protected void setUp() throws Exception
- {
- super.setUp();
- }
-
- /**
- * JUnit teardown method.
- * @throws Exception in case anything goes wrong.
- */
- @Override
- protected void tearDown() throws Exception
- {
- super.tearDown();
- }
-
- /**
- * Installs an account and verifies whether the installation has gone well.
- */
- public void testInstallAccount()
- {
- // first obtain a reference to the provider factory
- ServiceReference[] serRefs = null;
- String osgiFilter = "(" + ProtocolProviderFactory.PROTOCOL
- + "="+ProtocolNames.YAHOO+")";
- try{
- serRefs = YahooSlickFixture.bc.getServiceReferences(
- ProtocolProviderFactory.class.getName(), osgiFilter);
- }
- catch (InvalidSyntaxException ex)
- {
- //this really shouldhn't occur as the filter expression is static.
- fail(osgiFilter + " is not a valid osgi filter");
- }
-
- assertTrue(
- "Failed to find a provider factory service for protocol Yahoo",
- serRefs != null && serRefs.length > 0);
-
- //Keep the reference for later usage.
- ProtocolProviderFactory yahooProviderFactory = (ProtocolProviderFactory)
- YahooSlickFixture.bc.getService(serRefs[0]);
-
- //make sure the account is empty
- assertTrue("There was an account registered with the account mananger "
- +"before we've installed any",
- yahooProviderFactory.getRegisteredAccounts().size() == 0);
-
-
- //Prepare the properties of the first yahoo account.
-
- Hashtable<String, String> yahooAccount1Properties = getAccountProperties(
- YahooProtocolProviderServiceLick.ACCOUNT_1_PREFIX);
- Hashtable<String, String> yahooAccount2Properties = getAccountProperties(
- YahooProtocolProviderServiceLick.ACCOUNT_2_PREFIX);
- Hashtable<String, String> yahooAccount3Properties = getAccountProperties(
- YahooProtocolProviderServiceLick.ACCOUNT_3_PREFIX);
-
- //try to install an account with a null account id
- try{
- yahooProviderFactory.installAccount(
- null, yahooAccount1Properties);
- fail("installing an account with a null account id must result "
- +"in a NullPointerException");
- }catch(NullPointerException exc)
- {
- //that's what had to happen
- }
-
- //now really install the accounts
- yahooProviderFactory.installAccount(
- yahooAccount1Properties.get(ProtocolProviderFactory.USER_ID)
- , yahooAccount1Properties);
- yahooProviderFactory.installAccount(
- yahooAccount2Properties.get(ProtocolProviderFactory.USER_ID)
- , yahooAccount2Properties);
- yahooProviderFactory.installAccount(
- yahooAccount3Properties.get(ProtocolProviderFactory.USER_ID)
- , yahooAccount3Properties);
-
-
- //try to install one of the accounts one more time and verify that an
- //excepion is thrown.
- try{
- yahooProviderFactory.installAccount(
- yahooAccount1Properties.get(ProtocolProviderFactory.USER_ID)
- , yahooAccount1Properties);
-
- fail("An IllegalStateException must be thrown when trying to "+
- "install a duplicate account");
-
- }catch(IllegalStateException exc)
- {
- //that's what supposed to happen.
- }
-
- //Verify that the provider factory is aware of our installation
- assertTrue(
- "The newly installed account was not in the acc man's "
- +"registered accounts!",
- yahooProviderFactory.getRegisteredAccounts().size() == 3);
-
- //Verify protocol providers corresponding to the new account have
- //been properly registered with the osgi framework.
-
- osgiFilter =
- "(&("+ProtocolProviderFactory.PROTOCOL +"="+ProtocolNames.YAHOO+")"
- +"(" + ProtocolProviderFactory.USER_ID
- + "=" + yahooAccount1Properties.get(
- ProtocolProviderFactory.USER_ID)
- + "))";
-
- try
- {
- serRefs = YahooSlickFixture.bc.getServiceReferences(
- ProtocolProviderService.class.getName(),
- osgiFilter);
- }
- catch (InvalidSyntaxException ex)
- {
- //this really shouldhn't occur as the filter expression is static.
- fail(osgiFilter + "is not a valid osgi filter");
- }
-
- assertTrue("An protocol provider was apparently not installed as "
- + "requested."
- , serRefs != null && serRefs.length > 0);
-
- Object yahooProtocolProvider
- = YahooSlickFixture.bc.getService(serRefs[0]);
-
- assertTrue("The installed protocol provider does not implement "
- + "the protocol provider service."
- ,yahooProtocolProvider instanceof ProtocolProviderService);
- }
-
- /**
- * Returns all properties necessary for the intialization of the account
- * with <tt>accountPrefix</tt>.
- * @param accountPrefix the prefix contained by all property names for the
- * the account we'd like to initialized
- * @return a Hashtable that can be used when creating the account in a
- * protocol provider factory.
- */
- private Hashtable<String, String> getAccountProperties(String accountPrefix)
- {
- Hashtable<String, String> table = new Hashtable<String, String>();
-
- String userID = System.getProperty(
- accountPrefix + ProtocolProviderFactory.USER_ID, null);
-
- assertNotNull(
- "The system property named "
- + accountPrefix + ProtocolProviderFactory.USER_ID
- +" has to tontain a valid yahoo address that could be used during "
- +"SIP Communicator's tests."
- , userID);
-
- table.put(ProtocolProviderFactory.USER_ID, userID);
-
- String passwd = System.getProperty(
- accountPrefix + ProtocolProviderFactory.PASSWORD, null );
-
- assertNotNull(
- "The system property named "
- + accountPrefix + ProtocolProviderFactory.PASSWORD
- +" has to contain the password corresponding to the account "
- + "specified in "
- + accountPrefix + ProtocolProviderFactory.USER_ID
- , passwd);
-
- table.put(ProtocolProviderFactory.PASSWORD, passwd);
-
- String serverAddress = System.getProperty(
- accountPrefix + ProtocolProviderFactory.SERVER_ADDRESS, null);
-
- // optional
- if(serverAddress != null)
- table.put(ProtocolProviderFactory.SERVER_ADDRESS, serverAddress);
-
- String serverPort = System.getProperty(
- accountPrefix + ProtocolProviderFactory.SERVER_PORT, null);
-
- // optional
- if(serverPort != null)
- table.put(ProtocolProviderFactory.SERVER_PORT, serverPort);
-
- return table;
- }
-}
diff --git a/test/net/java/sip/communicator/slick/protocol/yahoo/TestAccountUninstallation.java b/test/net/java/sip/communicator/slick/protocol/yahoo/TestAccountUninstallation.java
deleted file mode 100644
index 7b04758..0000000
--- a/test/net/java/sip/communicator/slick/protocol/yahoo/TestAccountUninstallation.java
+++ /dev/null
@@ -1,287 +0,0 @@
-/*
- * Jitsi, the OpenSource Java VoIP and Instant Messaging client.
- *
- * Copyright @ 2015 Atlassian Pty Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.java.sip.communicator.slick.protocol.yahoo;
-
-import junit.framework.*;
-import net.java.sip.communicator.service.protocol.*;
-import net.java.sip.communicator.slick.protocol.generic.*;
-
-import org.osgi.framework.*;
-
-/**
- * Tests whether accounts are uninstalled properly. It is important that
- * tests from this class be called last since they will install the accounts
- * that have been used to test the implementations. Apart from uninstallation
- * tests the class also contains tests that remove and reinstall the protocol
- * provider bundle in order to verify that accounts are persistent.
- *
- * @author Emil Ivov
- * @author Valentin Martinet
- */
-public class TestAccountUninstallation
- extends TestCase
-{
- private YahooSlickFixture fixture = new YahooSlickFixture();
-
- /**
- * Constructs a test instance
- * @param name The name of the test.
- */
- public TestAccountUninstallation(String name)
- {
- super(name);
- }
-
- /**
- * JUnit setup method.
- * @throws Exception in case anything goes wrong.
- */
- @Override
- protected void setUp() throws Exception
- {
- super.setUp();
- fixture.setUp();
- }
-
- /**
- * JUnit teardown method.
- * @throws Exception in case anything goes wrong.
- */
- @Override
- protected void tearDown() throws Exception
- {
- fixture.tearDown();
- super.tearDown();
- }
-
- /**
- * Returns a suite containing tests in this class in the order that we'd
- * like them executed.
- * @return a Test suite containing tests in this class in the order that
- * we'd like them executed.
- */
- public static Test suite()
- {
- TestSuite suite = new TestSuite();
-
- suite.addTest(
- new TestAccountUninstallation("testInstallationPersistency"));
- suite.addTest(
- new TestAccountUninstallation("testUninstallAccount"));
-
- return suite;
- }
-
- /**
- * Stops and removes the tested bundle, verifies that it has unregistered
- * its provider, then reloads and restarts the bundle and verifies that
- * the protocol provider is reRegistered in the bundle context.
- *
- * @throws java.lang.Exception if an exception occurs during testing.
- */
- public void testInstallationPersistency() throws Exception
- {
- Bundle providerBundle
- = AdHocMultiUserChatSlickFixture.findProtocolProviderBundle(fixture.provider1);
-
- //set the global providerBundle reference that we will be using
- //in the last series of tests (Account uninstallation persistency)
- YahooSlickFixture.providerBundle = providerBundle;
-
- assertNotNull("Couldn't find a bundle for the tested provider"
- , providerBundle);
-
- providerBundle.stop();
-
- assertTrue("Couldn't stop the protocol provider bundle. State was "
- + providerBundle.getState()
- , Bundle.ACTIVE != providerBundle.getState()
- && Bundle.STOPPING != providerBundle.getState());
-
- providerBundle.uninstall();
-
- assertEquals("Couldn't stop the protocol provider bundle."
- , Bundle.UNINSTALLED, providerBundle.getState());
-
- //verify that the provider is no longer available
- ServiceReference[] yahooProviderRefs = null;
- try
- {
- yahooProviderRefs = AdHocMultiUserChatSlickFixture.bc.getServiceReferences(
- ProtocolProviderService.class.getName(),
- "(&"
- + "(" + ProtocolProviderFactory.PROTOCOL
- + "=" +ProtocolNames.YAHOO + ")"
- + "(" + ProtocolProviderFactory.USER_ID
- + "="+ fixture.userID1 + ")"
- + ")");
- }
- catch (InvalidSyntaxException ex)
- {
- fail("We apparently got our filter wrong: " + ex.getMessage());
- }
-
- //make sure we didn't see a service
- assertTrue("A Protocol Provider Service was still regged as an osgi service "
- +"for yahoo URI:" + fixture.userID1
- + "After it was explicitly uninstalled"
- ,yahooProviderRefs == null || yahooProviderRefs.length == 0);
-
- //verify that the provider factory knows that we have uninstalled the
- //provider.
- assertTrue(
- "The yahoo provider factory kept a reference to the provider we just "
- +"uninstalled (uri="+fixture.userID1+")",
- fixture.providerFactory.getRegisteredAccounts().isEmpty()
- && fixture.providerFactory.getProviderForAccount(
- fixture.provider1.getAccountID())
- == null);
-
- //Now reinstall the bundle
- providerBundle = AdHocMultiUserChatSlickFixture.bc.installBundle(providerBundle.getLocation());
-
- //set the global providerBundle reference that we will be using
- //in the last series of tests (Account uninstallation persistency)
- YahooSlickFixture.providerBundle = providerBundle;
-
- assertEquals("Couldn't re-install protocol provider bundle."
- , Bundle.INSTALLED, providerBundle.getState());
-
- AccountManagerUtils.startBundleAndWaitStoredAccountsLoaded(AdHocMultiUserChatSlickFixture.bc,
- providerBundle, ProtocolNames.YAHOO);
- assertEquals("Couldn't re-start protocol provider bundle."
- , Bundle.ACTIVE, providerBundle.getState());
-
- //Make sure that the provider is there again.
- //verify that the provider is no longer available
- try
- {
- yahooProviderRefs = AdHocMultiUserChatSlickFixture.bc.getServiceReferences(
- ProtocolProviderService.class.getName(),
- "(&"
- + "(" + ProtocolProviderFactory.PROTOCOL
- + "=" +ProtocolNames.YAHOO + ")"
- + "(" + ProtocolProviderFactory.USER_ID
- + "="+ fixture.userID1 + ")"
- + ")");
- }
- catch (InvalidSyntaxException ex)
- {
- fail("We apparently got our filter wrong " + ex.getMessage());
- }
-
- //make sure we didn't see a service
- assertTrue("A Protocol Provider Service was not restored after being"
- +"reinstalled. yahoo URI:" + fixture.userID1
- ,yahooProviderRefs != null && yahooProviderRefs.length > 0);
-
- ServiceReference[] yahooFactoryRefs = null;
- try
- {
- yahooFactoryRefs = AdHocMultiUserChatSlickFixture.bc.getServiceReferences(
- ProtocolProviderFactory.class.getName(),
- "(" + ProtocolProviderFactory.PROTOCOL
- + "=" +ProtocolNames.YAHOO + ")");
- }
- catch (InvalidSyntaxException ex)
- {
- fail("We apparently got our filter wrong " + ex.getMessage());
- }
-
- //we're the ones who've reinstalled the factory so it's our
- //responsibility to update the fixture.
- fixture.providerFactory
- = (ProtocolProviderFactory)AdHocMultiUserChatSlickFixture.bc.getService(yahooFactoryRefs[0]);
- fixture.provider1
- = (ProtocolProviderService)AdHocMultiUserChatSlickFixture.bc.getService(yahooProviderRefs[0]);
-
-
- //verify that the provider is also restored in the provider factory
- //itself
- assertTrue(
- "The yahoo provider did not restore its own reference to the provider "
- +"that we just reinstalled (URI="+fixture.userID1+")",
- !fixture.providerFactory.getRegisteredAccounts().isEmpty()
- && fixture.providerFactory.getProviderForAccount(
- fixture.provider1.getAccountID())
- != null);
-
- }
-
- /**
- * Uninstalls our test account and makes sure it really has been removed.
- *
- */
- public void testUninstallAccount()
- {
- assertFalse("No installed accounts found",
- fixture.providerFactory.getRegisteredAccounts().isEmpty());
-
- assertNotNull(
- "Found no provider corresponding to URI " + fixture.userID1
- ,fixture.providerFactory.getProviderForAccount(
- fixture.provider1.getAccountID()));
-
- assertTrue(
- "Failed to remove a provider corresponding to URI "
- + fixture.userID1
- ,fixture.providerFactory.uninstallAccount(
- fixture.provider1.getAccountID()));
- assertTrue(
- "Failed to remove a provider corresponding to URI "
- + fixture.userID2
- ,fixture.providerFactory.uninstallAccount(
- fixture.provider2.getAccountID()));
- assertTrue(
- "Failed to remove a provider corresponding to URI "
- + fixture.userID3
- ,fixture.providerFactory.uninstallAccount(
- fixture.provider3.getAccountID()));
-
- //make sure no providers have remained installed.
- ServiceReference[] yahooProviderRefs = null;
- try
- {
- yahooProviderRefs = AdHocMultiUserChatSlickFixture.bc.getServiceReferences(
- ProtocolProviderService.class.getName(),
- "(" + ProtocolProviderFactory.PROTOCOL
- + "=" +ProtocolNames.YAHOO + ")");
- }
- catch (InvalidSyntaxException ex)
- {
- fail("We apparently got our filter wrong " + ex.getMessage());
- }
-
- //make sure we didn't see a service
- assertTrue("A Protocol Provider Service was still regged as an osgi "
- + "service for yahoo URI:" + fixture.userID1
- + "After it was explicitly uninstalled"
- ,yahooProviderRefs == null || yahooProviderRefs.length == 0);
-
- //verify that the provider factory knows that we have uninstalled the
- //provider.
- assertTrue(
- "The yahoo provider factory kept a reference to the provider we just "
- +"uninstalled (uri="+fixture.userID1+")",
- fixture.providerFactory.getRegisteredAccounts().isEmpty()
- && fixture.providerFactory.getProviderForAccount(
- fixture.provider1.getAccountID())
- == null);
-
- }
-}
diff --git a/test/net/java/sip/communicator/slick/protocol/yahoo/TestAccountUninstallationPersistence.java b/test/net/java/sip/communicator/slick/protocol/yahoo/TestAccountUninstallationPersistence.java
deleted file mode 100644
index d87a238..0000000
--- a/test/net/java/sip/communicator/slick/protocol/yahoo/TestAccountUninstallationPersistence.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * Jitsi, the OpenSource Java VoIP and Instant Messaging client.
- *
- * Copyright @ 2015 Atlassian Pty Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.java.sip.communicator.slick.protocol.yahoo;
-
-import junit.framework.*;
-import net.java.sip.communicator.service.protocol.*;
-
-import org.jitsi.service.configuration.*;
-import org.osgi.framework.*;
-
-/**
- * Contains tests verifying persistence of account uninstallation. In other
- * words we try to make sure that once uninstalled an account remains
- * uninstalled.
- *
- * @author Emil Ivov
- */
-public class TestAccountUninstallationPersistence
- extends TestCase
-{
- /**
- * Creates a new test instance wrapper around the test with the specified
- * name.
- * @param testName the name of the test that we will be executing.
- */
- public TestAccountUninstallationPersistence(String testName)
- {
- super(testName);
- }
-
- /**
- * Retrieves a reference to the yahoo bundle, stops it and uninstalls it and
- * then reinstalls it in order to make sure that accounts are not reloaded
- * once removed.
- *
- * @throws java.lang.Exception if something goes wrong while manipulating
- * the bundles.
- */
- public void testAccountUninstallationPersistence()
- throws Exception
- {
- Bundle providerBundle = YahooSlickFixture.providerBundle;
-
- providerBundle.stop();
-
- assertTrue("Couldn't stop the protocol provider bundle. State was "
- + providerBundle.getState()
- , Bundle.ACTIVE != providerBundle.getState()
- && Bundle.STOPPING != providerBundle.getState());
-
- providerBundle.uninstall();
-
- assertEquals("Couldn't stop the protocol provider bundle."
- , Bundle.UNINSTALLED, providerBundle.getState());
-
- //Now reinstall the bundle and restart the provider
- providerBundle
- = YahooSlickFixture.bc.installBundle(providerBundle.getLocation());
-
- assertEquals("Couldn't re-install protocol provider bundle."
- , Bundle.INSTALLED, providerBundle.getState());
-
- AccountManagerUtils.startBundleAndWaitStoredAccountsLoaded(
- YahooSlickFixture.bc, providerBundle, ProtocolNames.YAHOO);
- assertEquals("Couldn't re-start protocol provider bundle."
- , Bundle.ACTIVE, providerBundle.getState());
-
-
- //verify that the provider is not reinstalled
- ServiceReference[] yahooProviderRefs = null;
- try
- {
- yahooProviderRefs = YahooSlickFixture.bc.getServiceReferences(
- ProtocolProviderService.class.getName(),
- "(" + ProtocolProviderFactory.PROTOCOL
- + "=" +ProtocolNames.YAHOO + ")");
- }
- catch (InvalidSyntaxException ex)
- {
- fail("We apparently got our filter wrong " + ex.getMessage());
- }
-
- //make sure we didn't retrieve a service
- assertTrue("A yahoo Protocol Provider Service was still regged as an "
- +"osgi service after it was explicitly uninstalled"
- ,yahooProviderRefs == null || yahooProviderRefs.length == 0);
-
- //and a nasty hack at the end - delete the configuration file so that
- //we get a fresh start on next run.
- ServiceReference confReference
- = YahooSlickFixture.bc.getServiceReference(
- ConfigurationService.class.getName());
- ConfigurationService configurationService
- = (ConfigurationService) YahooSlickFixture.bc.getService(confReference);
-
- configurationService.purgeStoredConfiguration();
- }
-}
diff --git a/test/net/java/sip/communicator/slick/protocol/yahoo/TestOperationSetAdHocMultiUserChatYahooImpl.java b/test/net/java/sip/communicator/slick/protocol/yahoo/TestOperationSetAdHocMultiUserChatYahooImpl.java
deleted file mode 100644
index 3f66045..0000000
--- a/test/net/java/sip/communicator/slick/protocol/yahoo/TestOperationSetAdHocMultiUserChatYahooImpl.java
+++ /dev/null
@@ -1,182 +0,0 @@
-/*
- * Jitsi, the OpenSource Java VoIP and Instant Messaging client.
- *
- * Copyright @ 2015 Atlassian Pty Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.java.sip.communicator.slick.protocol.yahoo;
-
-import java.util.*;
-
-import junit.framework.*;
-import net.java.sip.communicator.service.protocol.*;
-import net.java.sip.communicator.slick.protocol.generic.*;
-
-/**
- * Tests for the Yahoo! ad-hoc multi-user chat operation set.
- *
- * @author Valentin Martinet
- */
-public class TestOperationSetAdHocMultiUserChatYahooImpl
-extends TestOperationSetAdHocMultiUserChat
-{
- /**
- * Creates the test with the specified method name.
- *
- * @param name the name of the method to execute.
- */
- public TestOperationSetAdHocMultiUserChatYahooImpl(String name)
- {
- super(name);
- }
-
-
- /**
- * Creates a test suite containing tests of this class in a specific order.
- *
- * @return Test a testsuite containing all tests to execute.
- */
- public static TestSuite suite()
- {
- TestSuite suite = new TestSuite();
-
- suite.addTest(new TestOperationSetAdHocMultiUserChatYahooImpl(
- "testRegisterAccount3"));
- suite.addTest(new TestOperationSetAdHocMultiUserChatYahooImpl(
- "prepareContactList"));
- suite.addTest(new TestOperationSetAdHocMultiUserChatYahooImpl(
- "testCreateRoomWithParticipants"));
- suite.addTest(new TestOperationSetAdHocMultiUserChatYahooImpl(
- "testInvitations"));
- suite.addTest(new TestOperationSetAdHocMultiUserChatYahooImpl(
- "testSendIM"));
- suite.addTest(new TestOperationSetAdHocMultiUserChatYahooImpl(
- "testPeerLeaved"));
-
- return suite;
- }
-
- /**
- * Register the third testing account.
- *
- * @throws OperationFailedException
- */
- public void testRegisterAccount3() throws OperationFailedException
- {
- fixture.provider3.register(
- new SecurityAuthorityImpl(
- System.getProperty(
- YahooProtocolProviderServiceLick.ACCOUNT_3_PREFIX
- + ProtocolProviderFactory.PASSWORD).toCharArray()));
-
- assertEquals(fixture.provider3.getRegistrationState(),
- RegistrationState.REGISTERED);
- }
-
- /**
- * JUnit setUp method.
- * @throws Exception
- *
- * @throws Exception
- */
- @Override
- public void start() throws Exception
- {
- fixture = new YahooSlickFixture();
- fixture.setUp();
-
- // Supported operation sets by each protocol provider.
- Map<String, OperationSet>
- supportedOpSets1, supportedOpSets2, supportedOpSets3;
-
- supportedOpSets1 = fixture.provider1.getSupportedOperationSets();
- supportedOpSets2 = fixture.provider2.getSupportedOperationSets();
- supportedOpSets3 = fixture.provider3.getSupportedOperationSets();
-
- //
- // Initialization of operation sets for the first testing account:
- //
-
- if (supportedOpSets1 == null || supportedOpSets1.size() < 1)
- throw new NullPointerException(
- "No OperationSet implementations are supported by " +
- "this implementation. ");
-
- opSetAHMUC1 = (OperationSetAdHocMultiUserChat) supportedOpSets1.get(
- OperationSetAdHocMultiUserChat.class.getName());
-
- if (opSetAHMUC1 == null)
- throw new NullPointerException(
- "No implementation for multi user chat was found");
-
- opSetPresence1 = (OperationSetPresence) supportedOpSets1.get(
- OperationSetPresence.class.getName());
-
- if (opSetPresence1 == null)
- throw new NullPointerException(
- "An implementation of the service must provide an " +
- "implementation of at least one of the PresenceOperationSets");
-
-
- //
- // Initialization of operation sets for the second testing account:
- //
-
- if (supportedOpSets2 == null || supportedOpSets2.size() < 1)
- throw new NullPointerException(
- "No OperationSet implementations are supported by " +
- "this implementation. ");
-
- opSetAHMUC2 = (OperationSetAdHocMultiUserChat) supportedOpSets2.get(
- OperationSetAdHocMultiUserChat.class.getName());
-
- if (opSetAHMUC2 == null)
- throw new NullPointerException(
- "No implementation for ad hoc multi user chat was found");
-
- opSetPresence2 = (OperationSetPresence) supportedOpSets2.get(
- OperationSetPresence.class.getName());
-
- if (opSetPresence2 == null)
- throw new NullPointerException(
- "An implementation of the service must provide an " +
- "implementation of at least one of the PresenceOperationSets");
-
-
- //
- // Initialization of operation sets for the third testing account:
- //
-
- if (supportedOpSets3 == null || supportedOpSets3.size() < 1)
- throw new NullPointerException(
- "No OperationSet implementations are supported by " +
- "this implementation. ");
-
- opSetAHMUC3 = (OperationSetAdHocMultiUserChat) supportedOpSets3.get(
- OperationSetAdHocMultiUserChat.class.getName());
-
- if (opSetAHMUC3 == null)
- throw new NullPointerException(
- "No implementation for ad hoc multi user chat was found");
-
- opSetPresence3 = (OperationSetPresence) supportedOpSets3.get(
- OperationSetPresence.class.getName());
-
- if (opSetPresence3 == null)
- throw new NullPointerException(
- "An implementation of the service must provide an " +
- "implementation of at least one of the PresenceOperationSets");
- }
-
-}
diff --git a/test/net/java/sip/communicator/slick/protocol/yahoo/TestOperationSetBasicInstantMessaging.java b/test/net/java/sip/communicator/slick/protocol/yahoo/TestOperationSetBasicInstantMessaging.java
deleted file mode 100644
index 9b8fa7b..0000000
--- a/test/net/java/sip/communicator/slick/protocol/yahoo/TestOperationSetBasicInstantMessaging.java
+++ /dev/null
@@ -1,537 +0,0 @@
-/*
- * Jitsi, the OpenSource Java VoIP and Instant Messaging client.
- *
- * Copyright @ 2015 Atlassian Pty Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.java.sip.communicator.slick.protocol.yahoo;
-
-import java.io.*;
-import java.net.*;
-import java.util.*;
-
-import junit.framework.*;
-import net.java.sip.communicator.service.protocol.*;
-import net.java.sip.communicator.service.protocol.event.*;
-import net.java.sip.communicator.util.*;
-
-/**
- * Performs testing of the basic instant messaging operation set. Tests include
- * going over basic functionality such as sending a message from the tested
- * implementation and asserting reception by the tester agent and vice versa.
- * @author Emil Ivov
- */
-public class TestOperationSetBasicInstantMessaging
- extends TestCase
-{
- private static final Logger logger =
- Logger.getLogger(TestOperationSetBasicInstantMessaging.class);
-
- private YahooSlickFixture fixture = new YahooSlickFixture();
-
- private OperationSetBasicInstantMessaging opSetBasicIM1 = null;
- private OperationSetBasicInstantMessaging opSetBasicIM2 = null;
-
- private OperationSetPresence opSetPresence1 = null;
- private OperationSetPresence opSetPresence2 = null;
-
- public TestOperationSetBasicInstantMessaging(String name)
- {
- super(name);
- }
-
- /**
- * Get a reference to the basic IM operation set.
- * @throws Exception if this is not a good day.
- */
- @Override
- protected void setUp() throws Exception
- {
- super.setUp();
- fixture.setUp();
-
- Map<String, OperationSet> supportedOperationSets1 =
- fixture.provider1.getSupportedOperationSets();
-
- if ( supportedOperationSets1 == null
- || supportedOperationSets1.size() < 1)
- throw new NullPointerException(
- "No OperationSet implementations are supported by "
- +"this implementation. ");
-
- //get the operation set presence here.
- opSetBasicIM1 =
- (OperationSetBasicInstantMessaging)supportedOperationSets1.get(
- OperationSetBasicInstantMessaging.class.getName());
-
- if (opSetBasicIM1 == null)
- {
- throw new NullPointerException(
- "No implementation for basic IM was found");
- }
-
- //we also need the presence op set in order to retrieve contacts.
- opSetPresence1 =
- (OperationSetPresence)supportedOperationSets1.get(
- OperationSetPresence.class.getName());
-
- //if the op set is null show that we're not happy.
- if (opSetPresence1 == null)
- {
- throw new NullPointerException(
- "An implementation of the service must provide an "
- + "implementation of at least one of the PresenceOperationSets");
- }
-
- Map<String, OperationSet> supportedOperationSets2 =
- fixture.provider2.getSupportedOperationSets();
-
- if ( supportedOperationSets2 == null
- || supportedOperationSets2.size() < 1)
- throw new NullPointerException(
- "No OperationSet implementations are supported by "
- +"this implementation. ");
-
- //get the operation set presence here.
- opSetBasicIM2 =
- (OperationSetBasicInstantMessaging)supportedOperationSets2.get(
- OperationSetBasicInstantMessaging.class.getName());
-
- if (opSetBasicIM2 == null)
- {
- throw new NullPointerException(
- "No implementation for basic IM was found");
- }
-
- opSetPresence2 =
- (OperationSetPresence) supportedOperationSets2.get(
- OperationSetPresence.class.getName());
-
- //if the op set is null show that we're not happy.
- if (opSetPresence2 == null)
- {
- throw new NullPointerException(
- "An implementation of the service must provide an "
- + "implementation of at least one of the PresenceOperationSets");
- }
-
- }
-
- @Override
- protected void tearDown() throws Exception
- {
- super.tearDown();
-
- fixture.tearDown();
- }
-
- /**
- * Creates a test suite containing tests of this class in a specific order.
- * We'll first execute tests beginning with the "test" prefix and then go to
- * ordered tests.We first execture tests for receiving messagese, so that
- * a volatile contact is created for the sender. we'll then be able to
- * retrieve this volatile contact and send them a message on our turn.
- * We need to do things this way as the contact corresponding to the tester
- * agent has been removed in the previous test and we no longer have it
- * in our contact list.
- *
- * @return Test a testsuite containing all tests to execute.
- */
- public static Test suite()
- {
- TestSuite suite = new TestSuite();
-
- suite.addTest(new TestOperationSetBasicInstantMessaging(
- "prepareContactList"));
-
- suite.addTestSuite(TestOperationSetBasicInstantMessaging.class);
-
- //the following 2 need to be run in the specified order.
- suite.addTest(new TestOperationSetBasicInstantMessaging(
- "firstTestReceiveMessage"));
- suite.addTest(new TestOperationSetBasicInstantMessaging(
- "thenTestSendMessage"));
-
- return suite;
- }
-
- /**
- * Create the list to be sure that contacts exchanging messages
- * exists in each other lists
- * @throws Exception
- */
- public void prepareContactList()
- throws Exception
- {
- fixture.clearProvidersLists();
-
- Object o = new Object();
- synchronized(o)
- {
- o.wait(2000);
- }
-
- try
- {
- opSetPresence1.subscribe(fixture.userID2);
- }
- catch (OperationFailedException ex)
- {
- // the contact already exist its OK
- }
-
- try
- {
- opSetPresence2.subscribe(fixture.userID1);
- }
- catch (OperationFailedException ex1)
- {
- // the contact already exist its OK
- }
-
- synchronized(o)
- {
- o.wait(2000);
- }
- }
-
- /**
- * Send an instant message from the tested operation set and assert
- * reception by the tester agent.
- */
- public void firstTestReceiveMessage()
- {
- ContactGroup rootGroup
- = ((OperationSetPersistentPresence)opSetPresence2).getServerStoredContactListRoot();
-
- logger.debug("=========== Server Stored Contact List =================");
-
- logger.debug("rootGroup="+rootGroup.getGroupName()
- +" rootGroup.childContacts="+rootGroup.countContacts()
- + "rootGroup.childGroups="+rootGroup.countSubgroups()
- + "Printing rootGroupContents=\n"+rootGroup.toString());
-
- String body = "This is an IM coming from the tester agent"
- + " on " + new Date().toString();
-
- ImEventCollector evtCollector = new ImEventCollector();
-
- //add a msg listener and register to the op set and send an instant
- //msg from the tester agent.
- opSetBasicIM1.addMessageListener(evtCollector);
-
- Contact testerAgentContact
- = opSetPresence2.findContactByID(fixture.userID1);
-
- logger.debug("Will send message " + body + " to: " + testerAgentContact);
-
- opSetBasicIM2.sendInstantMessage(testerAgentContact,
- opSetBasicIM2.createMessage(body));
-
- evtCollector.waitForEvent(10000);
-
- opSetBasicIM1.removeMessageListener(evtCollector);
-
- //assert reception of a message event
- assertTrue( "No events delivered upon a received message"
- , evtCollector.collectedEvents.size() > 0);
-
- //assert event instance of Message Received Evt
- assertTrue( "Received evt was not an instance of "
- + MessageReceivedEvent.class.getName()
- , evtCollector.collectedEvents.get(0)
- instanceof MessageReceivedEvent);
-
- //assert source contact == testAgent.uin
- MessageReceivedEvent evt
- = (MessageReceivedEvent)evtCollector.collectedEvents.get(0);
- assertEquals("message sender "
- , evt.getSourceContact().getAddress()
- , fixture.userID2);
-
- //assert messageBody == body
- assertEquals("message body", body, evt.getSourceMessage().getContent());
- }
-
- /**
- * Send an instant message from the tester agent and assert reception by
- * the tested implementation
- */
- public void thenTestSendMessage()
- {
- String body = "This is an IM coming from the tested implementation"
- + " on " + new Date().toString();
-
- //create the message
- net.java.sip.communicator.service.protocol.Message msg
- = opSetBasicIM1.createMessage(body);
-
- //register a listener in the op set
- ImEventCollector imEvtCollector1 = new ImEventCollector();
- opSetBasicIM1.addMessageListener(imEvtCollector1);
-
- //register a listener in the tester agent
- ImEventCollector imEvtCollector2 = new ImEventCollector();
- opSetBasicIM2.addMessageListener(imEvtCollector2);
-
- Contact testerAgentContact
- = opSetPresence1.findContactByID(fixture.userID2);
-
- opSetBasicIM1.sendInstantMessage(testerAgentContact, msg);
-
- imEvtCollector1.waitForEvent(10000);
- imEvtCollector2.waitForEvent(10000);
-
- opSetBasicIM1.removeMessageListener(imEvtCollector1);
- opSetBasicIM2.removeMessageListener(imEvtCollector2);
-
- //verify that the message delivered event was dispatched
- assertTrue( "No events delivered when sending a message"
- , imEvtCollector1.collectedEvents.size() > 0);
-
- assertTrue( "Received evt was not an instance of "
- + MessageDeliveredEvent.class.getName()
- , imEvtCollector1.collectedEvents.get(0)
- instanceof MessageDeliveredEvent);
-
- MessageDeliveredEvent evt
- = (MessageDeliveredEvent)imEvtCollector1.collectedEvents.get(0);
- assertEquals("message destination "
- , evt.getDestinationContact().getAddress()
- , fixture.userID2);
-
- assertSame("source message", msg, evt.getSourceMessage());
-
-
- //verify that the message has successfully arived at the destination
- assertTrue( "No messages received by the tester agent"
- , imEvtCollector2.collectedEvents.size() > 0);
- String receivedBody =
- ((MessageReceivedEvent)imEvtCollector2.collectedEvents
- .get(0)).getSourceMessage().getContent();
-
- assertEquals("received message body", msg.getContent(), receivedBody);
- }
-
- /**
- * Creates an Message through the simple createMessage() method and inspects
- * its parameters.
- */
- public void testCreateMessage1()
- {
- String body = "This is an IM coming from the tested implementation"
- + " on " + new Date().toString();
- net.java.sip.communicator.service.protocol.Message msg
- = opSetBasicIM1.createMessage(body);
-
- assertEquals("message body", body, msg.getContent());
- assertTrue("message body bytes"
- , Arrays.equals(body.getBytes(), msg.getRawData()));
- assertEquals("message length", body.length(), msg.getSize());
- assertEquals("message content type"
- , OperationSetBasicInstantMessaging.DEFAULT_MIME_TYPE
- , msg.getContentType());
-
- assertEquals("message encoding"
- , OperationSetBasicInstantMessaging.DEFAULT_MIME_ENCODING
- , msg.getEncoding());
-
- assertNotNull("message uid", msg.getMessageUID());
-
- //a further test on message uid.
- net.java.sip.communicator.service.protocol.Message msg2
- = opSetBasicIM1.createMessage(body);
- assertFalse("message uid", msg.getMessageUID().equals(
- msg2.getMessageUID()));
- }
-
- /**
- * Creates an Message through the advance createMessage() method and
- * inspects its parameters.
- */
- public void testCreateMessage2()
- throws UnsupportedEncodingException
- {
- String body = "This is an IM coming from the tested implementation"
- + " on " + new Date().toString();
- String contentType = "text/html";
- String encoding = "UTF-16";
- String subject = "test message";
- net.java.sip.communicator.service.protocol.Message msg =
- opSetBasicIM1.createMessage(body, contentType, encoding, subject);
- byte[] bodyBytes = body.getBytes(encoding);
-
- assertEquals("message body", body, msg.getContent());
- assertTrue("message body bytes"
- , Arrays.equals(bodyBytes, msg.getRawData()));
- assertEquals("message length", bodyBytes.length, msg.getSize());
- assertEquals("message content type", contentType, msg.getContentType());
- assertEquals("message encoding", encoding, msg.getEncoding());
- assertNotNull("message uid", msg.getMessageUID());
-
- //a further test on message uid.
- net.java.sip.communicator.service.protocol.Message msg2
- = opSetBasicIM1.createMessage(body);
- assertFalse("message uid", msg.getMessageUID().equals(
- msg2.getMessageUID()));
- }
-
- /**
- * Collects instant messaging events.
- */
- private class ImEventCollector implements MessageListener
- {
- private List<EventObject> collectedEvents = new LinkedList<EventObject>();
- /**
- * Called when a new incoming <tt>Message</tt> has been received.
- * @param evt the <tt>MessageReceivedEvent</tt> containing the newly
- * received message, its sender and other details.
- */
- public void messageReceived(MessageReceivedEvent evt)
- {
- logger.debug("Received a MessageReceivedEvent: " + evt);
-
- synchronized(this)
- {
- collectedEvents.add(evt);
- notifyAll();
- }
- }
-
- /**
- * Called to indicated that delivery of a message sent earlier has failed.
- * Reason code and phrase are contained by the <tt>MessageFailedEvent</tt>
- * @param evt the <tt>MessageFailedEvent</tt> containing the ID of the
- * message whose delivery has failed.
- */
- public void messageDeliveryFailed(MessageDeliveryFailedEvent evt)
- {
- logger.debug("Received a MessageDeliveryFailedEvent: " + evt);
-
- synchronized(this)
- {
- collectedEvents.add(evt);
- notifyAll();
- }
- }
-
-
- /**
- * Called when the underlying implementation has received an indication
- * that a message, sent earlier has been successfully received by the
- * destination.
- * @param evt the MessageDeliveredEvent containing the id of the message
- * that has caused the event.
- */
- public void messageDelivered(MessageDeliveredEvent evt)
- {
- logger.debug("Received a MessageDeliveredEvent: " + evt);
-
- synchronized(this)
- {
- collectedEvents.add(evt);
- notifyAll();
- }
- }
-
- /**
- * Blocks until at least one event is received or until waitFor
- * miliseconds pass (whichever happens first).
- *
- * @param waitFor the number of miliseconds that we should be waiting
- * for an event before simply bailing out.
- */
- public void waitForEvent(long waitFor)
- {
- synchronized(this)
- {
-
- if(collectedEvents.size() > 0)
- {
- logger.trace("ImEvent already received. " + collectedEvents);
- return;
- }
-
- try{
- wait(waitFor);
- }
- catch (InterruptedException ex)
- {
- logger.debug(
- "Interrupted while waiting for a message evt", ex);
- }
- }
- }
- }
-
- /**
- * A method that would simply send messages to a group of people so that
- * they would get notified that tests are being run.
- */
- public void testSendFunMessages()
- {
- String hostname = "";
-
- try{
- hostname = java.net.InetAddress.getLocalHost().getHostName() + ": ";
- }catch (UnknownHostException ex){}
-
- String message = hostname
- + "Hello this is the SIP Communicator (version "
- + System.getProperty("sip-communicator.version")
- + ") build on: "
- + new Date().toString()
- + ". Have a very nice day!";
-
- String list = System.getProperty("accounts.reporting.YAHOO_REPORT_LIST");
-
- logger.debug("Will send message " + message + " to: " + list);
-
- //if no property is specified - return
- if(list == null || list.trim().length() == 0)
- return;
-
- StringTokenizer tokenizer = new StringTokenizer(list, " ");
-
- while(tokenizer.hasMoreTokens())
- {
- String contactID = tokenizer.nextToken();
- Contact contact
- = opSetPresence2.findContactByID(contactID);
-
- if(contact == null)
- {
- try
- {
- opSetPresence2.subscribe(contactID);
- Object o = new Object();
- synchronized (o)
- {
- o.wait(2000);
- }
- }
- catch (Exception ex1)
- {
- continue;
- }
- }
-
- contact
- = opSetPresence2.findContactByID(contactID);
-
- opSetBasicIM2.sendInstantMessage(contact,
- opSetBasicIM2.createMessage(message));
- }
- }
-}
diff --git a/test/net/java/sip/communicator/slick/protocol/yahoo/TestOperationSetFileTransferImpl.java b/test/net/java/sip/communicator/slick/protocol/yahoo/TestOperationSetFileTransferImpl.java
deleted file mode 100644
index 90a2ff3..0000000
--- a/test/net/java/sip/communicator/slick/protocol/yahoo/TestOperationSetFileTransferImpl.java
+++ /dev/null
@@ -1,253 +0,0 @@
-/*
- * Jitsi, the OpenSource Java VoIP and Instant Messaging client.
- *
- * Copyright @ 2015 Atlassian Pty Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.java.sip.communicator.slick.protocol.yahoo;
-
-import java.util.*;
-
-import net.java.sip.communicator.service.protocol.*;
-import net.java.sip.communicator.slick.protocol.generic.*;
-import net.java.sip.communicator.util.*;
-
-import org.osgi.framework.*;
-
-/**
- * Implementation for generic file transfer.
- * @author Damian Minkov
- */
-public class TestOperationSetFileTransferImpl
- extends TestOperationSetFileTransfer
-{
- private static final Logger logger =
- Logger.getLogger(TestOperationSetFileTransferImpl.class);
-
- private YahooSlickFixture fixture = new YahooSlickFixture();
-
- private OperationSetPresence opSetPresence1 = null;
- private OperationSetPresence opSetPresence2 = null;
-
- private OperationSetFileTransfer opSetFT1 = null;
- private OperationSetFileTransfer opSetFT2 = null;
-
- private static Contact contact1 = null;
- private static Contact contact2 = null;
-
- @Override
- public Contact getContact1()
- {
- if(contact1 == null)
- {
- contact1 = opSetPresence1.findContactByID(fixture.userID2);
- }
-
- return contact1;
- }
-
- @Override
- public Contact getContact2()
- {
- if(contact2 == null)
- {
- contact2 = opSetPresence2.findContactByID(fixture.userID1);
- }
-
- return contact2;
- }
-
- @Override
- public void start()
- throws Exception
- {
- fixture.setUp();
-
- Map<String, OperationSet> supportedOperationSets1 =
- fixture.provider1.getSupportedOperationSets();
-
- if ( supportedOperationSets1 == null
- || supportedOperationSets1.size() < 1)
- throw new NullPointerException(
- "No OperationSet implementations are supported by "
- +"this implementation. ");
-
- //we also need the presence op set in order to retrieve contacts.
- opSetPresence1 =
- (OperationSetPresence)supportedOperationSets1.get(
- OperationSetPresence.class.getName());
-
- //if the op set is null show that we're not happy.
- if (opSetPresence1 == null)
- {
- throw new NullPointerException(
- "An implementation of the service must provide an "
- + "implementation of at least one of the PresenceOperationSets");
- }
-
- opSetFT1 =
- (OperationSetFileTransfer)supportedOperationSets1.get(
- OperationSetFileTransfer.class.getName());
-
- //if the op set is null show that we're not happy.
- if (opSetFT1 == null)
- {
- throw new NullPointerException(
- "An implementation of the service must provide an "
- + "implementation of at least one of the FileTransferOperationSets");
- }
-
- Map<String, OperationSet> supportedOperationSets2 =
- fixture.provider2.getSupportedOperationSets();
-
- if ( supportedOperationSets2 == null
- || supportedOperationSets2.size() < 1)
- throw new NullPointerException(
- "No OperationSet implementations are supported by "
- +"this implementation. ");
-
- opSetPresence2 =
- (OperationSetPresence) supportedOperationSets2.get(
- OperationSetPresence.class.getName());
-
- //if the op set is null show that we're not happy.
- if (opSetPresence2 == null)
- {
- throw new NullPointerException(
- "An implementation of the service must provide an "
- + "implementation of at least one of the PresenceOperationSets");
- }
-
- opSetFT2 =
- (OperationSetFileTransfer)supportedOperationSets2.get(
- OperationSetFileTransfer.class.getName());
-
- //if the op set is null show that we're not happy.
- if (opSetFT2 == null)
- {
- throw new NullPointerException(
- "An implementation of the service must provide an "
- + "implementation of at least one of the FileTransferOperationSets");
- }
-
- prepareContactList();
- }
-
- @Override
- public void stop()
- throws Exception
- {
- fixture.tearDown();
- }
-
- /**
- * Create the list to be sure that contacts exchanging messages
- * exists in each other lists
- * @throws Exception
- */
- public void prepareContactList()
- throws Exception
- {
- // clear the provider the first time we run a filetransfer list
- if(getContact1() == null && getContact2() == null)
- fixture.clearProvidersLists();
-
- if(getContact1() == null)
- {
- Object o = new Object();
- synchronized(o)
- {
- o.wait(2000);
- }
-
- try
- {
- opSetPresence1.setAuthorizationHandler(new AuthHandler());
- opSetPresence1.subscribe(fixture.userID2);
- }
- catch (OperationFailedException ex)
- {
- // the contact already exist its OK
- }
- }
-
- if(getContact2() == null)
- {
- try
- {
- opSetPresence2.setAuthorizationHandler(new AuthHandler());
- opSetPresence2.subscribe(fixture.userID1);
- }
- catch (OperationFailedException ex1)
- {
- // the contact already exist its OK
- }
-
- logger.info("will wait till the list prepare is completed");
- Object o = new Object();
- synchronized(o)
- {
- o.wait(4000);
- }
- }
- }
-
- @Override
- public OperationSetFileTransfer getOpSetFilTransfer1()
- {
- return opSetFT1;
- }
-
- @Override
- public OperationSetFileTransfer getOpSetFilTransfer2()
- {
- return opSetFT2;
- }
-
- @Override
- public BundleContext getContext()
- {
- return AdHocMultiUserChatSlickFixture.bc;
- }
-
- @Override
- public boolean enableTestSendAndReceive()
- {
- return true;
- }
-
- @Override
- public boolean enableTestSenderCancelBeforeAccepted()
- {
- return true;
- }
-
- @Override
- public boolean enableTestReceiverDecline()
- {
- return true;
- }
-
- @Override
- public boolean enableTestReceiverCancelsWhileTransfering()
- {
- return true;
- }
-
- @Override
- public boolean enableTestSenderCancelsWhileTransfering()
- {
- return true;
- }
-}
diff --git a/test/net/java/sip/communicator/slick/protocol/yahoo/TestOperationSetPersistentPresence.java b/test/net/java/sip/communicator/slick/protocol/yahoo/TestOperationSetPersistentPresence.java
deleted file mode 100644
index 2ebf0e6..0000000
--- a/test/net/java/sip/communicator/slick/protocol/yahoo/TestOperationSetPersistentPresence.java
+++ /dev/null
@@ -1,582 +0,0 @@
-/*
- * Jitsi, the OpenSource Java VoIP and Instant Messaging client.
- *
- * Copyright @ 2015 Atlassian Pty Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.java.sip.communicator.slick.protocol.yahoo;
-
-import java.util.*;
-
-import junit.framework.*;
-import net.java.sip.communicator.service.protocol.*;
-import net.java.sip.communicator.service.protocol.event.*;
-import net.java.sip.communicator.slick.protocol.generic.*;
-import net.java.sip.communicator.util.*;
-
-/**
- * @author Damian Minkov
- */
-public class TestOperationSetPersistentPresence
- extends TestCase
-{
- private static final Logger logger =
- Logger.getLogger(TestOperationSetPersistentPresence.class);
-
- private YahooSlickFixture fixture = new YahooSlickFixture();
- private OperationSetPersistentPresence opSetPersPresence1 = null;
- private OperationSetPersistentPresence opSetPersPresence2 = null;
- private static final String testGroupName = "NewGroup";
- private static final String testGroupName2 = "Renamed";
-
- public TestOperationSetPersistentPresence(String name)
- {
- super(name);
- }
-
- /**
- * Creates a test suite containing all tests of this class followed by
- * test methods that we want executed in a specified order.
- * @return the Test suite to run
- */
- public static Test suite()
- {
- TestSuite suite =
- new TestSuite();
-
- //the following 2 need to be run in the specified order.
- //(postTestRemoveGroup() needs the group created from
- //postTestCreateGroup() )
- suite.addTest(
- new TestOperationSetPersistentPresence("postTestCreateGroup"));
-
- //rename
- //suite.addTest( new TestOperationSetPersistentPresence(
- // "postTestRenameGroup"));
-
- suite.addTest(
- new TestOperationSetPersistentPresence("postTestRemoveGroup"));
-
- // create the contact list
- suite.addTest(
- new TestOperationSetPersistentPresence("prepareContactList"));
-
- suite.addTestSuite(TestOperationSetPersistentPresence.class);
-
- return suite;
- }
-
- @Override
- protected void setUp() throws Exception
- {
- super.setUp();
- fixture.setUp();
-
- Map<String, OperationSet> supportedOperationSets1 =
- fixture.provider1.getSupportedOperationSets();
-
- if ( supportedOperationSets1 == null
- || supportedOperationSets1.size() < 1)
- throw new NullPointerException(
- "No OperationSet implementations are supported by "
- +"this Yahoo implementation. ");
-
- //get the operation set presence here.
- opSetPersPresence1 =
- (OperationSetPersistentPresence)supportedOperationSets1.get(
- OperationSetPersistentPresence.class.getName());
-
- //if still null then the implementation doesn't offer a presence
- //operation set which is unacceptable for yahoo.
- if (opSetPersPresence1 == null)
- throw new NullPointerException(
- "An implementation of the Yahoo service must provide an "
- + "implementation of at least the one of the Presence "
- + "Operation Sets");
-
- // lets do it once again for the second provider
- Map<String, OperationSet> supportedOperationSets2 =
- fixture.provider2.getSupportedOperationSets();
-
- if (supportedOperationSets2 == null
- || supportedOperationSets2.size() < 1)
- throw new NullPointerException(
- "No OperationSet implementations are supported by "
- + "this Yahoo implementation. ");
-
- //get the operation set presence here.
- opSetPersPresence2 =
- (OperationSetPersistentPresence) supportedOperationSets2.get(
- OperationSetPersistentPresence.class.getName());
-
- //if still null then the implementation doesn't offer a presence
- //operation set which is unacceptable for yahoo.
- if (opSetPersPresence2 == null)
- throw new NullPointerException(
- "An implementation of the yahoo service must provide an "
- + "implementation of at least the one of the Presence "
- + "Operation Sets");
- }
-
- @Override
- protected void tearDown() throws Exception
- {
- fixture.tearDown();
- super.tearDown();
- }
-
- /**
- * Retrieves a server stored contact list and checks whether it contains
- * all contacts that have been added there during the initialization
- * phase by the testerAgent.
- */
- public void testRetrievingServerStoredContactList()
- {
- ContactGroup rootGroup
- = opSetPersPresence1.getServerStoredContactListRoot();
-
- logger.debug("=========== Server Stored Contact List =================");
-
- logger.debug("rootGroup="+rootGroup.getGroupName()
- +" rootGroup.childContacts="+rootGroup.countContacts()
- + "rootGroup.childGroups="+rootGroup.countSubgroups()
- + "Printing rootGroupContents=\n"+rootGroup.toString());
-
- Hashtable<String, List<String>> expectedContactList
- = AdHocMultiUserChatSlickFixture.preInstalledBuddyList;
-
- logger.debug("============== Expected Contact List ===================");
- logger.debug(expectedContactList);
-
- //Go through the contact list retrieved by the persistence presence set
- //and remove the name of every contact and group that we find there from
- //the expected contct list hashtable.
- Iterator<ContactGroup> groups = rootGroup.subgroups();
- while (groups.hasNext() )
- {
- ContactGroup group = groups.next();
-
- List<String> expectedContactsInGroup
- = expectedContactList.get(group.getGroupName());
-
- // When sending the offline message
- // the sever creates a group NotInContactList,
- // because the buddy we are sending message to is not in
- // the contactlist. So this group must be ignored
- // Also we must ignore the group created by default
- // from the yahoo lib
- if(!group.getGroupName().equals("NotInContactList") &&
- !group.getGroupName().equals("Default group"))
- {
- assertNotNull("Group " + group.getGroupName() +
- " was returned by "
- +
- "the server but was not in the expected contact list."
- , expectedContactsInGroup);
-
- Iterator<Contact> contactsIter = group.contacts();
- while(contactsIter.hasNext())
- {
- String contactID = contactsIter.next().getAddress();
- expectedContactsInGroup.remove(contactID);
- }
-
- //If we've removed all the sub contacts, remove the group too.
- if(expectedContactsInGroup.size() == 0)
- expectedContactList.remove(group.getGroupName());
- }
- }
-
- //whatever we now have in the expected contact list snapshot are groups,
- //that have been added by the testerAgent but that were not retrieved
- //by the persistent presence operation set.
- assertTrue("The following contacts were on the server sidec contact "
- +"list, but were not returned by the pers. pres. op. set"
- + expectedContactList.toString()
- , expectedContactList.isEmpty());
- }
-
- /**
- * Creates a group in the server stored contact list, makes sure that the
- * corresponding event has been generated and verifies that the group is
- * in the list.
- *
- * @throws java.lang.Exception
- */
- public void postTestCreateGroup()
- throws Exception
- {
- // first clear the list
- fixture.clearProvidersLists();
-
- waitFor(5000);
-
- logger.trace("testing creation of server stored groups");
- //first add a listener
- GroupChangeCollector groupChangeCollector = new GroupChangeCollector();
- opSetPersPresence1
- .addServerStoredGroupChangeListener(groupChangeCollector);
-
- //create the group
- opSetPersPresence1.createServerStoredContactGroup(
- opSetPersPresence1.getServerStoredContactListRoot(), testGroupName);
-
- groupChangeCollector.waitForEvent(10000);
-
- opSetPersPresence1
- .removeServerStoredGroupChangeListener(groupChangeCollector);
-
- // check whether we got group created event
- assertEquals("Collected Group Change events: ",
- 1, groupChangeCollector.collectedEvents.size());
-
- assertEquals("Group name.", testGroupName,
- ((ServerStoredGroupEvent)groupChangeCollector.collectedEvents
- .get(0)).getSourceGroup().getGroupName());
-
- // check whether the group is retrievable
- ContactGroup group = opSetPersPresence1.getServerStoredContactListRoot()
- .getGroup(testGroupName);
-
- assertNotNull("A newly created group was not in the contact list.",
- group);
-
- assertEquals("New group name", testGroupName, group.getGroupName());
-
- // when opearting with groups . the group must have entries
- // so changes to take effect. Otherwise group will be lost after loggingout
- try
- {
- opSetPersPresence1.subscribe(group, fixture.userID2);
-
- waitFor(1500);
- }
- catch (Exception ex)
- {
- fail("error adding entry to group : " +
- group.getGroupName() + " " +
- ex.getMessage());
- }
- }
-
-
- /**
- * Removes the group created in the server stored contact list by the create
- * group test, makes sure that the corresponding event has been generated
- * and verifies that the group is not in the list any more.
- */
- public void postTestRemoveGroup()
- {
- logger.trace("testing removal of server stored groups");
-
- //first add a listener
- GroupChangeCollector groupChangeCollector = new GroupChangeCollector();
- opSetPersPresence1
- .addServerStoredGroupChangeListener(groupChangeCollector);
-
- try
- {
- //remove the group
- opSetPersPresence1.removeServerStoredContactGroup(
- opSetPersPresence1.getServerStoredContactListRoot()
- .getGroup(testGroupName));
- }
- catch(OperationFailedException ex)
- {
- logger.error("error removing group", ex);
- }
-
- groupChangeCollector.waitForEvent(10000);
-
- opSetPersPresence1
- .removeServerStoredGroupChangeListener(groupChangeCollector);
-
- // check whether we got group created event
- assertEquals("Collected Group Change event",
- 1, groupChangeCollector.collectedEvents.size());
-
- assertEquals("Group name.", testGroupName,
- ((ServerStoredGroupEvent)groupChangeCollector.collectedEvents
- .get(0)).getSourceGroup().getGroupName());
-
- // check whether the group is still on the contact list
- ContactGroup group = opSetPersPresence1.getServerStoredContactListRoot()
- .getGroup(testGroupName);
-
- assertNull("A freshly removed group was still on the contact list. - " + group,
- group);
- }
-
- /**
- * Renames our test group and checks whether corresponding events are
- * triggered. Verifies whether the group has really changed its name and
- * whether it is findable by its new name. Also makes sure that it does
- * not exist under its previous name any more.
- */
- public void postTestRenameGroup()
- {
- logger.trace("Testing renaming groups.");
-
- ContactGroup group = opSetPersPresence1.getServerStoredContactListRoot()
- .getGroup(testGroupName);
-
- //first add a listener
- GroupChangeCollector groupChangeCollector = new GroupChangeCollector();
- opSetPersPresence1
- .addServerStoredGroupChangeListener(groupChangeCollector);
-
- //change the name and wait for a confirmation event
- opSetPersPresence1.renameServerStoredContactGroup(group, testGroupName2);
-
- groupChangeCollector.waitForEvent(10000);
-
- opSetPersPresence1
- .removeServerStoredGroupChangeListener(groupChangeCollector);
-
- //examine the event
- assertEquals("Collected Group Change event",
- 1, groupChangeCollector.collectedEvents.size());
-
- assertEquals("Group name.", testGroupName2,
- ((ServerStoredGroupEvent)groupChangeCollector.collectedEvents
- .get(0)).getSourceGroup().getGroupName());
-
- // check whether the group is still on the contact list
- ContactGroup oldGroup = opSetPersPresence1.getServerStoredContactListRoot()
- .getGroup(testGroupName);
-
- assertNull("A group was still findable by its old name after renaming.",
- oldGroup);
-
- //make sure that we could find the group by its new name.
- ContactGroup newGroup = opSetPersPresence1.getServerStoredContactListRoot()
- .getGroup(testGroupName2);
-
- assertNotNull("Could not find a renamed group by its new name.",
- newGroup);
- }
-
- /**
- * Create the contact list. Later will be test to be sure that creating is ok
- * @throws Exception
- */
- public void prepareContactList()
- throws Exception
- {
- logger.trace("prepareContactList");
-
- fixture.clearProvidersLists();
-
- waitFor(3000);
-
- String contactList = System.getProperty(
- YahooProtocolProviderServiceLick.CONTACT_LIST_PROPERTY_NAME, null);
-
- logger.debug("The "
- + YahooProtocolProviderServiceLick.CONTACT_LIST_PROPERTY_NAME
- + " property is set to=" + contactList);
-
- if( contactList == null
- || contactList.trim().length() < 6)//at least 4 for a UIN, 1 for the
- // dot and 1 for the grp name
- throw new IllegalArgumentException(
- "The " +
- YahooProtocolProviderServiceLick.CONTACT_LIST_PROPERTY_NAME +
- " property did not contain a contact list.");
- StringTokenizer tokenizer = new StringTokenizer(contactList, " \n\t");
-
- logger.debug("tokens contained by the CL tokenized="
- +tokenizer.countTokens());
-
- Hashtable<String, List<String>> contactListToCreate = new Hashtable<String, List<String>>();
-
- //go over all group.uin tokens
- while (tokenizer.hasMoreTokens())
- {
- String groupUinToken = tokenizer.nextToken();
- int dotIndex = groupUinToken.indexOf(".");
-
- if ( dotIndex == -1 )
- {
- throw new IllegalArgumentException(groupUinToken
- + " is not a valid Group.UIN token");
- }
-
- String groupName = groupUinToken.substring(0, dotIndex);
- String uin = groupUinToken.substring(dotIndex + 1);
-
- if( groupName.trim().length() < 1
- || uin.trim().length() < 4 )
- {
- throw new IllegalArgumentException(
- groupName + " or " + uin +
- " are not a valid group name or yahoo UIN.");
- }
-
- //check if we've already seen this group and if not - add it
- List<String> uinInThisGroup = contactListToCreate.get(groupName);
- if (uinInThisGroup == null)
- {
- uinInThisGroup = new ArrayList<String>();
- contactListToCreate.put(groupName, uinInThisGroup);
- }
-
- uinInThisGroup.add(uin);
- }
-
- // now init the list
- Enumeration<String> newGroupsEnum = contactListToCreate.keys();
-
- GroupChangeCollector groupChangeCollector = new GroupChangeCollector();
- opSetPersPresence1.addServerStoredGroupChangeListener(groupChangeCollector);
-
- //go over all groups in the contactsToAdd table
- while (newGroupsEnum.hasMoreElements())
- {
- String groupName = newGroupsEnum.nextElement();
- logger.debug("Will add group " + groupName);
-
- opSetPersPresence1.createServerStoredContactGroup(
- opSetPersPresence1.getServerStoredContactListRoot(), groupName);
-
- groupChangeCollector.waitForEvent(3000);
-
- ContactGroup newlyCreatedGroup =
- opSetPersPresence1.getServerStoredContactListRoot().getGroup(groupName);
-
- Iterator<String> contactsToAddToThisGroup
- = contactListToCreate.get(groupName).iterator();
- while (contactsToAddToThisGroup.hasNext())
- {
- String id = contactsToAddToThisGroup.next();
-
- logger.debug("Will add buddy " + id);
- opSetPersPresence1.subscribe(newlyCreatedGroup, id);
- }
- }
-
- waitFor(4000);
-
- //store the created contact list for later reference
- YahooSlickFixture.preInstalledBuddyList = contactListToCreate;
- }
-
- private void waitFor(long time)
- throws Exception
- {
- Object o = new Object();
- synchronized(o)
- {
- o.wait(time);
- }
- }
-
- /**
- * The class would listen for and store received events delivered to
- * <tt>ServerStoredGroupListener</tt>s.
- */
- private class GroupChangeCollector implements ServerStoredGroupListener
- {
- public ArrayList<EventObject> collectedEvents = new ArrayList<EventObject>();
-
- /**
- * Blocks until at least one event is received or until waitFor
- * miliseconds pass (whicever happens first).
- *
- * @param waitFor the number of miliseconds that we should be waiting
- * for an event before simply bailing out.
- */
- public void waitForEvent(long waitFor)
- {
- synchronized(this)
- {
- if(collectedEvents.size() > 0)
- return;
-
- try{
- wait(waitFor);
- }
- catch (InterruptedException ex)
- {
- logger.debug(
- "Interrupted while waiting for a subscription evt", ex);
- }
- }
- }
-
- /**
- * Called whnever an indication is received that a new server stored
- * group is created.
- * @param evt a ServerStoredGroupChangeEvent containing a reference to
- * the newly created group.
- */
- public void groupCreated(ServerStoredGroupEvent evt)
- {
- synchronized(this)
- {
- logger.debug("Collected evt("+collectedEvents.size()+")= "+evt);
- collectedEvents.add(evt);
- notifyAll();
- }
- }
-
- /**
- * Called when an indication is received that the name of a server stored
- * contact group has changed.
- * @param evt a ServerStoredGroupChangeEvent containing the details of the
- * name change.
- */
- public void groupNameChanged(ServerStoredGroupEvent evt)
- {
- synchronized(this)
- {
- logger.debug("Collected evt("+collectedEvents.size()+")= "+evt);
- collectedEvents.add(evt);
- notifyAll();
- }
- }
-
- /**
- * Called whnever an indication is received that an existing server stored
- * group has been removed.
- * @param evt a ServerStoredGroupChangeEvent containing a reference to the
- * newly created group.
- */
- public void groupRemoved(ServerStoredGroupEvent evt)
- {
- synchronized(this)
- {
- logger.debug("Collected evt("+collectedEvents.size()+")= "+evt);
- collectedEvents.add(evt);
- notifyAll();
- }
- }
-
- /**
- * Called whnever an indication is received that an existing server
- * stored group has been resolved.
- * @param evt a ServerStoredGroupChangeEvent containing a reference to
- * the resolved group.
- */
- public void groupResolved(ServerStoredGroupEvent evt)
- {
- synchronized(this)
- {
- logger.debug("Collected evt("+collectedEvents.size()+")= "+evt);
- collectedEvents.add(evt);
- notifyAll();
- }
- }
- }
-}
diff --git a/test/net/java/sip/communicator/slick/protocol/yahoo/TestOperationSetPresence.java b/test/net/java/sip/communicator/slick/protocol/yahoo/TestOperationSetPresence.java
deleted file mode 100644
index 1413a42..0000000
--- a/test/net/java/sip/communicator/slick/protocol/yahoo/TestOperationSetPresence.java
+++ /dev/null
@@ -1,1003 +0,0 @@
-/*
- * Jitsi, the OpenSource Java VoIP and Instant Messaging client.
- *
- * Copyright @ 2015 Atlassian Pty Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.java.sip.communicator.slick.protocol.yahoo;
-
-import java.beans.*;
-import java.util.*;
-
-import junit.framework.*;
-import net.java.sip.communicator.service.protocol.*;
-import net.java.sip.communicator.service.protocol.event.*;
-import net.java.sip.communicator.service.protocol.yahooconstants.*;
-import net.java.sip.communicator.util.*;
-
-/**
- * Tests yahoo implementations of a Presence Operation Set. Tests in this class
- * verify functionality such as: Changing local (our own) status and
- * corresponding event dispatching; Querying status of contacts, Subscribing
- * for presence notifications upong status changes of specific contacts.
- * <p>
- * Using a custom suite() method, we make sure that apart from standard test
- * methods (those with a <tt>test</tt> prefix) we also execute those that
- * we want run in a specific order like for example - postTestSubscribe() and
- * postTestUnsubscribe().
- * <p>
- * @author Damian Minkov
- */
-public class TestOperationSetPresence
- extends TestCase
-{
- private static final Logger logger =
- Logger.getLogger(TestOperationSetPresence.class);
-
- private YahooSlickFixture fixture = new YahooSlickFixture();
- private OperationSetPresence operationSetPresence1 = null;
- private OperationSetPresence operationSetPresence2 = null;
-
- private AuthHandler authHandler1 = null;
- private AuthHandler authHandler2 = null;
-
- public TestOperationSetPresence(String name)
- {
- super(name);
- }
-
- @Override
- protected void setUp() throws Exception
- {
- super.setUp();
- fixture.setUp();
-
- Map<String, OperationSet> supportedOperationSets1 =
- fixture.provider1.getSupportedOperationSets();
-
- if ( supportedOperationSets1 == null
- || supportedOperationSets1.size() < 1)
- throw new NullPointerException(
- "No OperationSet implementations are supported by "
- +"this implementation. ");
-
- //get the operation set presence here.
- operationSetPresence1 =
- (OperationSetPresence)supportedOperationSets1.get(
- OperationSetPresence.class.getName());
-
- //if the op set is null then the implementation doesn't offer a presence
- //operation set which is unacceptable for yahoo.
- if (operationSetPresence1 == null)
- {
- throw new NullPointerException(
- "An implementation of the yahoo service must provide an "
- + "implementation of at least the one of the Presence "
- + "Operation Sets");
- }
-
- // do it once again for the second provider
- Map<String, OperationSet> supportedOperationSets2 =
- fixture.provider2.getSupportedOperationSets();
-
- if ( supportedOperationSets2 == null
- || supportedOperationSets2.size() < 1)
- throw new NullPointerException(
- "No OperationSet implementations are supported by "
- +"this yahoo implementation. ");
-
- //get the operation set presence here.
- operationSetPresence2 =
- (OperationSetPresence)supportedOperationSets2.get(
- OperationSetPresence.class.getName());
-
- //if the op set is null then the implementation doesn't offer a presence
- //operation set which is unacceptable for yahoo.
- if (operationSetPresence2 == null)
- {
- throw new NullPointerException(
- "An implementation of the yahoo service must provide an "
- + "implementation of at least the one of the Presence "
- + "Operation Sets");
- }
-
- if(authHandler1 == null)
- {
- authHandler1 = new AuthHandler(operationSetPresence1);
- operationSetPresence1.setAuthorizationHandler(authHandler1);
- }
-
- if(authHandler2 == null)
- {
- authHandler2 = new AuthHandler(operationSetPresence2);
- operationSetPresence2.setAuthorizationHandler(authHandler2);
- }
- }
-
- @Override
- protected void tearDown() throws Exception
- {
- super.tearDown();
-
- fixture.tearDown();
- }
-
- /**
- * Creates a test suite containing all tests of this class followed by
- * test methods that we want executed in a specified order.
- * @return Test
- */
- public static Test suite()
- {
- //return an (almost) empty suite if we're running in offline mode.
- if(YahooSlickFixture.onlineTestingDisabled)
- {
- TestSuite suite = new TestSuite();
- //the only test around here that we could run without net
- //connectivity
- suite.addTest(
- new TestOperationSetPresence(
- "testSupportedStatusSetForCompleteness"));
- return suite;
- }
-
- TestSuite suite = new TestSuite();
-
- // clear the lists before subscribing users
- suite.addTest(new TestOperationSetPresence("clearLists"));
-
- // first postTestSubscribe. to be sure that contacts are in the
- // list so we can further continue and test presences each other
- suite.addTest(new TestOperationSetPresence("postTestSubscribe"));
-
- // add other tests
- suite.addTestSuite(TestOperationSetPresence.class);
-
- // now test unsubscribe
- suite.addTest(new TestOperationSetPresence("postTestUnsubscribe"));
-
- return suite;
- }
-
- /**
- * Verifies that all necessary yahoo test states are supported by the
- * implementation.
- */
- public void testSupportedStatusSetForCompleteness()
- {
- //first create a local list containing the presence status instances
- //supported by the underlying implementation.
- Iterator<PresenceStatus> supportedStatusSetIter =
- operationSetPresence1.getSupportedStatusSet();
-
- List<PresenceStatus> supportedStatusSet
- = new LinkedList<PresenceStatus>();
- while (supportedStatusSetIter.hasNext()){
- supportedStatusSet.add(supportedStatusSetIter.next());
- }
-
- //create a copy of the MUST status set and remove any matching status
- //that is also present in the supported set.
- List<?> requiredStatusSetCopy
- = (List<?>) YahooStatusEnum.yahooStatusSet.clone();
-
- requiredStatusSetCopy.removeAll(supportedStatusSet);
-
- //if we have anything left then the implementation is wrong.
- int unsupported = requiredStatusSetCopy.size();
- assertTrue( "There are " + unsupported + " statuses as follows:"
- + requiredStatusSetCopy,
- unsupported == 0);
- }
-
- /**
- * Verify that changing state to STEPPED_OUT works as supposed to and that it
- * generates the corresponding event.
- * @throws Exception in case a failure occurs while the operation set
- * is switching to the new state.
- */
- public void testChangingStateToSteppedOut() throws Exception
- {
- subtestStateTransition(YahooStatusEnum.STEPPED_OUT);
- }
-
- /**
- * Verify that changing state to NOT_IN_OFFICE works as supposed to and that it
- * generates the corresponding event.
- * @throws Exception in case a failure occurs while the operation set
- * is switching to the new state.
- */
- public void testChangingStateToNotInOffice() throws Exception
- {
- subtestStateTransition(YahooStatusEnum.NOT_IN_OFFICE);
- }
-
- /**
- * Verify that changing state to BUSY works as supposed to and that it
- * generates the corresponding event.
- * @throws Exception in case a failure occurs while the operation set
- * is switching to the new state.
- */
- public void testChangingStateToBusy() throws Exception
- {
- subtestStateTransition(YahooStatusEnum.BUSY);
- }
-
- /**
- * Verify that changing state to FREE_FOR_CHAT works as supposed to and that it
- * generates the corresponding event.
- * @throws Exception in case a failure occurs while the operation set
- * is switching to the new state.
- */
- public void testChangingStateToIdle() throws Exception
- {
- subtestStateTransition(YahooStatusEnum.IDLE);
- }
-
- /**
- * Verify that changing state to BE_RIGHT_BACK works as supposed to and that it
- * generates the corresponding event.
- * @throws Exception in case a failure occurs while the operation set
- * is switching to the new state.
- */
- public void testChangingStateToBRB() throws Exception
- {
- subtestStateTransition(YahooStatusEnum.BE_RIGHT_BACK);
- }
-
- /**
- * Verify that changing state to OUT_TO_LUNCH works as supposed to and that it
- * generates the corresponding event.
- * @throws Exception in case a failure occurs while the operation set
- * is switching to the new state.
- */
- public void testChangingStateToOutToLunch() throws Exception
- {
- subtestStateTransition(YahooStatusEnum.OUT_TO_LUNCH);
- }
-
- /**
- * Verify that changing state to ON_THE_PHONE works as supposed to and that it
- * generates the corresponding event.
- * @throws Exception in case a failure occurs while the operation set
- * is switching to the new state.
- */
- public void testChangingStateToOnThePhone() throws Exception
- {
- subtestStateTransition(YahooStatusEnum.ON_THE_PHONE);
- }
-
- /**
- * Used by methods testing state transiotions
- *
- * @param newStatus the YahooStatusEnum field corresponding to the status
- * that we'd like the opeation set to enter.
- *
- * @throws Exception in case changing the state causes an exception
- */
- public void subtestStateTransition( YahooStatusEnum newStatus)
- throws Exception
- {
- logger.trace(" --=== beginning state transition test ===--");
-
- PresenceStatus oldStatus = operationSetPresence2.getPresenceStatus();
-
- logger.debug( "old status is=" + oldStatus.getStatusName()
- + " new status=" + newStatus.getStatusName()
- + " for contact : " + fixture.userID2);
-
- //First register a listener to make sure that all corresponding
- //events have been generated.
- PresenceStatusEventCollector statusEventCollector2
- = new PresenceStatusEventCollector();
- ContactPresenceEventCollector statusEventCollector1
- = new ContactPresenceEventCollector(fixture.userID2, newStatus);
- operationSetPresence2.addProviderPresenceStatusListener(
- statusEventCollector2);
- operationSetPresence1.addContactPresenceStatusListener(
- statusEventCollector1);
-
- //change the status
- operationSetPresence2.publishPresenceStatus(newStatus, null);
-
- //test event notification.
- statusEventCollector2.waitForPresEvent(10000);
- statusEventCollector1.waitForEvent(10000);
-
- operationSetPresence2.removeProviderPresenceStatusListener(
- statusEventCollector2);
- operationSetPresence1.removeContactPresenceStatusListener(
- statusEventCollector1);
-
- assertEquals("Events dispatched during an event transition.",
- 1, statusEventCollector2.collectedPresEvents.size());
- assertEquals("A status changed event contained wrong old status.",
- oldStatus,
- ((ProviderPresenceStatusChangeEvent)
- statusEventCollector2.collectedPresEvents.get(0))
- .getOldStatus());
- assertEquals("A status changed event contained wrong new status.",
- newStatus,
- ((ProviderPresenceStatusChangeEvent)
- statusEventCollector2.collectedPresEvents.get(0))
- .getNewStatus());
-
- // verify that the operation set itself is aware of the status change
- assertEquals("opSet.getPresenceStatus() did not return properly.",
- newStatus,
- operationSetPresence2.getPresenceStatus());
-
- YahooStatusEnum actualStatus = (YahooStatusEnum)
- operationSetPresence1.queryContactStatus(fixture.userID2);
-
- assertEquals("The underlying implementation did not switch to the "
- +"requested presence status.",
- newStatus,
- actualStatus);
-
- logger.trace(" --=== finished test ===--");
- }
-
- /**
- * The method would add a subscription for a contact, wait for a
- * subscription event confirming the subscription, then change the status
- * of the newly added contact (which is actually the testerAgent) and
- * make sure that the corresponding notification events have been generated.
- *
- * @throws java.lang.Exception if an exception occurs during testing.
- */
- public void postTestSubscribe()
- throws Exception
- {
- logger.debug("Testing Subscription and Subscription Event Dispatch.");
-
- dumplists();
-
- SubscriptionEventCollector subEvtCollector
- = new SubscriptionEventCollector();
- operationSetPresence1.addSubscriptionListener(subEvtCollector);
-
-
- synchronized (subEvtCollector){
- operationSetPresence1.subscribe(fixture.userID2);
- //we may already have the event, but it won't hurt to check.
- subEvtCollector.waitForEvent(10000);
- operationSetPresence1.removeSubscriptionListener(subEvtCollector);
- }
-
- assertEquals("Subscription event dispatching failed."
- , 1, subEvtCollector.collectedEvents.size());
- SubscriptionEvent subEvt =
- (SubscriptionEvent)subEvtCollector.collectedEvents.get(0);
-
- assertEquals("SubscriptionEvent Source:",
- fixture.userID2,
- ((Contact)subEvt.getSource()).getAddress());
- assertEquals("SubscriptionEvent Source Contact:",
- fixture.userID2,
- subEvt.getSourceContact().getAddress());
- assertSame("SubscriptionEvent Source Provider:",
- fixture.provider1,
- subEvt.getSourceProvider());
-
- subEvtCollector.collectedEvents.clear();
-
- // make the user agent tester change its states and make sure we are
- // notified
- logger.debug("Testing presence notifications.");
- YahooStatusEnum oldStatus
- = (YahooStatusEnum)operationSetPresence2.getPresenceStatus();
-
-
- YahooStatusEnum newStatus = YahooStatusEnum.ON_THE_PHONE;
-
- //in case we are by any chance already in a ON_THE_PHONE status, we'll
- //be changing to something else
- if(oldStatus.equals(newStatus)){
- newStatus = YahooStatusEnum.BUSY;
- }
-
- //now do the actual status notification testing
- ContactPresenceEventCollector contactPresEvtCollector
- = new ContactPresenceEventCollector(
- fixture.userID2, newStatus);
- operationSetPresence1.addContactPresenceStatusListener(
- contactPresEvtCollector);
-
- synchronized (contactPresEvtCollector){
- operationSetPresence2.publishPresenceStatus(newStatus, "new status");
- //we may already have the event, but it won't hurt to check.
- contactPresEvtCollector.waitForEvent(10000);
- operationSetPresence1
- .removeContactPresenceStatusListener(contactPresEvtCollector);
- }
-
- // something happened. the friend is not added correctly will
- // try to remove it and add it again
- if(contactPresEvtCollector.collectedEvents.size() == 0)
- {
- logger.info("ATTENTION: Yahoo friend not added correctly will remove and add him again");
-
- // remove it
- operationSetPresence1.unsubscribe(subEvt.getSourceContact());
-
- // wait remove to be finished
- Object lock = new Object();
- synchronized(lock){
- try{
- lock.wait(3000);
- }catch (Exception e){}
- }
-
- // add it
- operationSetPresence1.addSubscriptionListener(subEvtCollector);
- subEvtCollector.collectedEvents.clear();
- synchronized (subEvtCollector){
- operationSetPresence1.subscribe(fixture.userID2);
- //we may already have the event, but it won't hurt to check.
- subEvtCollector.waitForEvent(10000);
- operationSetPresence1.removeSubscriptionListener(subEvtCollector);
- }
- subEvtCollector.collectedEvents.clear();
-
- if(newStatus.equals(YahooStatusEnum.BUSY)){
- newStatus = YahooStatusEnum.OUT_TO_LUNCH;
- }
- else
- newStatus = YahooStatusEnum.BUSY;
-
- // query it again for the status
- contactPresEvtCollector = new ContactPresenceEventCollector(
- fixture.userID2, newStatus);
- operationSetPresence1.addContactPresenceStatusListener(
- contactPresEvtCollector);
-
- synchronized (contactPresEvtCollector){
-// operationSetPresence2.publishPresenceStatus(newStatus, "new status");
- operationSetPresence2.publishPresenceStatus(newStatus, null);
- //we may already have the event, but it won't hurt to check.
- contactPresEvtCollector.waitForEvent(10000);
- operationSetPresence1
- .removeContactPresenceStatusListener(contactPresEvtCollector);
- }
- }
-
- assertEquals("Presence Notif. event dispatching failed."
- , 1, contactPresEvtCollector.collectedEvents.size());
- ContactPresenceStatusChangeEvent presEvt =
- (ContactPresenceStatusChangeEvent)
- contactPresEvtCollector.collectedEvents.get(0);
-
- assertEquals("Presence Notif. event Source:",
- fixture.userID2,
- ((Contact)presEvt.getSource()).getAddress());
- assertEquals("Presence Notif. event Source Contact:",
- fixture.userID2,
- presEvt.getSourceContact().getAddress());
- assertSame("Presence Notif. event Source Provider:",
- fixture.provider1,
- presEvt.getSourceProvider());
-
- PresenceStatus reportedNewStatus = presEvt.getNewStatus();
- PresenceStatus reportedOldStatus = presEvt.getOldStatus();
-
- assertEquals( "Reported new PresenceStatus: ",
- newStatus, reportedNewStatus );
-
- //don't require equality between the reported old PresenceStatus and
- //the actual presence status of the tester agent because a first
- //notification is not supposed to have the old status as it really was.
- assertNotNull( "Reported old PresenceStatus: ", reportedOldStatus );
-
- try
- {
- // add the the user to the reverse side needed for status tests
- subEvtCollector.collectedEvents.clear();
- operationSetPresence2.addSubscriptionListener(subEvtCollector);
-
- synchronized (subEvtCollector)
- {
- operationSetPresence2.subscribe(fixture.userID1);
- //we may already have the event, but it won't hurt to check.
- subEvtCollector.waitForEvent(10000);
- operationSetPresence2.removeSubscriptionListener(
- subEvtCollector);
- }
- }
- catch (OperationFailedException ex)
- {
- // happens if the user is already subscribed
- }
- }
-
- /**
- * We unsubscribe from presence notification deliveries concerning
- * testerAgent's presence status and verify that we receive the
- * subscription removed event. We then make the tester agent change status
- * and make sure that no notifications are delivered.
- *
- * @throws java.lang.Exception in case unsubscribing fails.
- */
- public void postTestUnsubscribe()
- throws Exception
- {
- logger.debug("Testing Unsubscribe and unsubscription event dispatch.");
-
- // First create a subscription and verify that it really gets created.
- SubscriptionEventCollector subEvtCollector
- = new SubscriptionEventCollector();
- operationSetPresence1.addSubscriptionListener(subEvtCollector);
-
- Contact yahooTesterAgentContact = operationSetPresence1
- .findContactByID(fixture.userID2);
-
- assertNotNull(
- "Failed to find an existing subscription for the tester agent"
- , yahooTesterAgentContact);
-
- synchronized(subEvtCollector){
- operationSetPresence1.unsubscribe(yahooTesterAgentContact);
- subEvtCollector.waitForEvent(10000);
- //don't want any more events
- operationSetPresence1.removeSubscriptionListener(subEvtCollector);
- }
-
- assertEquals("Subscription event dispatching failed."
- , 1, subEvtCollector.collectedEvents.size());
- SubscriptionEvent subEvt =
- (SubscriptionEvent)subEvtCollector.collectedEvents.get(0);
-
- assertEquals("SubscriptionEvent Source:",
- yahooTesterAgentContact, subEvt.getSource());
-
- assertEquals("SubscriptionEvent Source Contact:",
- yahooTesterAgentContact, subEvt.getSourceContact());
-
- assertSame("SubscriptionEvent Source Provider:",
- fixture.provider1,
- subEvt.getSourceProvider());
-
- subEvtCollector.collectedEvents.clear();
-
- // make the user agent tester change its states and make sure we don't
- // get notifications as we're now unsubscribed.
- logger.debug("Testing (lack of) presence notifications.");
- YahooStatusEnum oldStatus
- = (YahooStatusEnum)operationSetPresence2.getPresenceStatus();
- YahooStatusEnum newStatus = YahooStatusEnum.ON_THE_PHONE;
-
- //in case we are by any chance already in a ON_THE_PHONE status, we'll
- //be changing to something else
- if(oldStatus.equals(newStatus)){
- newStatus = YahooStatusEnum.BUSY;
- }
-
- //now do the actual status notification testing
- ContactPresenceEventCollector contactPresEvtCollector
- = new ContactPresenceEventCollector(fixture.userID2, null);
- operationSetPresence1.addContactPresenceStatusListener(
- contactPresEvtCollector);
-
- synchronized (contactPresEvtCollector){
- operationSetPresence2.publishPresenceStatus(newStatus, "new status");
-
- //we may already have the event, but it won't hurt to check.
- contactPresEvtCollector.waitForEvent(10000);
- operationSetPresence1
- .removeContactPresenceStatusListener(contactPresEvtCollector);
- }
-
- assertEquals("Presence Notifications were received after unsubscibing."
- , 0, contactPresEvtCollector.collectedEvents.size());
- }
-
- public void clearLists()
- throws Exception
- {
- logger.debug("Clear the two lists before tests");
-
- // wait a moment if any event hes left from the previous tests
- Object o = new Object();
- synchronized(o)
- {
- o.wait(2000);
- }
-
- // wait for a moment
- // give time the impl to get the lists
- logger.debug("start clearing");
- fixture.clearProvidersLists();
-
- synchronized(o)
- {
- o.wait(3000);
- }
- }
-
- /**
- * An event collector that would collect all events generated by a
- * provider after a status change. The collector would also do a notidyAll
- * every time it receives an event.
- */
- private class PresenceStatusEventCollector
- implements ProviderPresenceStatusListener
- {
- public ArrayList<EventObject> collectedPresEvents = new ArrayList<EventObject>();
- public ArrayList<EventObject> collectedStatMsgEvents = new ArrayList<EventObject>();
-
- public void providerStatusChanged(ProviderPresenceStatusChangeEvent evt)
- {
- synchronized(this)
- {
- logger.debug("Collected evt("+collectedPresEvents.size()+")= "+evt);
- collectedPresEvents.add(evt);
- notifyAll();
- }
- }
-
- public void providerStatusMessageChanged(PropertyChangeEvent evt)
- {
- synchronized(this)
- {
- logger.debug("Collected stat.msg. evt("
- +collectedPresEvents.size()+")= "+evt);
- collectedStatMsgEvents.add(evt);
- notifyAll();
- }
- }
-
- /**
- * Blocks until at least one event is received or until waitFor
- * miliseconds pass (whicever happens first).
- *
- * @param waitFor the number of miliseconds that we should be waiting
- * for an event before simply bailing out.
- */
- public void waitForPresEvent(long waitFor)
- {
- logger.trace("Waiting for a change in provider status.");
- synchronized(this)
- {
- if(collectedPresEvents.size() > 0){
- logger.trace("Change already received. " + collectedPresEvents);
- return;
- }
-
- try{
- wait(waitFor);
- if(collectedPresEvents.size() > 0)
- logger.trace("Received a change in provider status.");
- else
- logger.trace("No change received for "+waitFor+"ms.");
- }
- catch (InterruptedException ex){
- logger.debug("Interrupted while waiting for a provider evt"
- , ex);
- }
- }
- }
-
- /**
- * Blocks until at least one staus message event is received or until
- * waitFor miliseconds pass (whichever happens first).
- *
- * @param waitFor the number of miliseconds that we should be waiting
- * for a status message event before simply bailing out.
- */
- public void waitForStatMsgEvent(long waitFor)
- {
- logger.trace("Waiting for a provider status message event.");
- synchronized(this)
- {
- if(collectedStatMsgEvents.size() > 0){
- logger.trace("Stat msg. evt already received. "
- + collectedStatMsgEvents);
- return;
- }
-
- try{
- wait(waitFor);
- if(collectedStatMsgEvents.size() > 0)
- logger.trace("Received a prov. stat. msg. evt.");
- else
- logger.trace("No prov. stat msg. received for "
- +waitFor+"ms.");
- }
- catch (InterruptedException ex){
- logger.debug("Interrupted while waiting for a status msg evt"
- , ex);
- }
- }
- }
- }
-
- /**
- * The class would listen for and store received subscription modification
- * events.
- */
- private class SubscriptionEventCollector implements SubscriptionListener
- {
- public ArrayList<EventObject> collectedEvents = new ArrayList<EventObject>();
-
- /**
- * Blocks until at least one event is received or until waitFor
- * miliseconds pass (whicever happens first).
- *
- * @param waitFor the number of miliseconds that we should be waiting
- * for an event before simply bailing out.
- */
- public void waitForEvent(long waitFor)
- {
- synchronized(this)
- {
- if(collectedEvents.size() > 0)
- {
- logger.trace("Event already received. " + collectedEvents);
- return;
- }
-
- try{
- wait(waitFor);
- }
- catch (InterruptedException ex)
- {
- logger.debug(
- "Interrupted while waiting for a subscription evt", ex);
- }
- }
- }
-
- /**
- * Stores the received subsctiption and notifies all waiting on this
- * object
- * @param evt the SubscriptionEvent containing the corresponding contact
- */
- public void subscriptionCreated(SubscriptionEvent evt)
- {
- synchronized(this)
- {
- logger.debug("Collected evt("+collectedEvents.size()+")= "+evt);
- collectedEvents.add(evt);
- notifyAll();
- }
- }
-
- /**
- * Stores the received subsctiption and notifies all waiting on this
- * object
- * @param evt the SubscriptionEvent containing the corresponding contact
- */
- public void subscriptionRemoved(SubscriptionEvent evt)
- {
- synchronized(this)
- {
- logger.debug("Collected evt("+collectedEvents.size()+")= "+evt);
- collectedEvents.add(evt);
- notifyAll();
- }
- }
-
- /**
- * Stores the received subsctiption and notifies all waiting on this
- * object
- * @param evt the SubscriptionEvent containing the corresponding contact
- */
- public void contactModified(ContactPropertyChangeEvent evt)
- {
- synchronized(this)
- {
- logger.debug("Collected evt("+collectedEvents.size()+")= "+evt);
- collectedEvents.add(evt);
- notifyAll();
- }
- }
-
-
- /**
- * Stores the received subsctiption and notifies all waiting on this
- * object
- * @param evt the SubscriptionEvent containing the corresponding contact
- */
- public void subscriptionMoved(SubscriptionMovedEvent evt)
- {
- synchronized(this)
- {
- logger.debug("Collected evt("+collectedEvents.size()+")= "+evt);
- collectedEvents.add(evt);
- notifyAll();
- }
- }
-
- /**
- * Stores the received subsctiption and notifies all waiting on this
- * object
- * @param evt the SubscriptionEvent containing the corresponding contact
- */
- public void subscriptionFailed(SubscriptionEvent evt)
- {
- synchronized(this)
- {
- logger.debug("Collected evt("+collectedEvents.size()+")= "+evt);
- collectedEvents.add(evt);
- notifyAll();
- }
- }
-
- /**
- * Stores the received subsctiption and notifies all waiting on this
- * object
- * @param evt the SubscriptionEvent containing the corresponding contact
- */
- public void subscriptionResolved(SubscriptionEvent evt)
- {
- synchronized(this)
- {
- logger.debug("Collected evt("+collectedEvents.size()+")= "+evt);
- collectedEvents.add(evt);
- notifyAll();
- }
- }
-
- }
-
- /**
- * The class would listen for and store received events caused by changes
- * in contact presence states.
- */
- private class ContactPresenceEventCollector
- implements ContactPresenceStatusListener
- {
- public ArrayList<EventObject> collectedEvents = new ArrayList<EventObject>();
- private String trackedScreenName = null;
- private YahooStatusEnum status = null;
-
- ContactPresenceEventCollector(String screenname,
- YahooStatusEnum wantedStatus)
- {
- this.trackedScreenName = screenname;
- this.status = wantedStatus;
- }
-
- /**
- * Blocks until at least one event is received or until waitFor
- * miliseconds pass (whicever happens first).
- *
- * @param waitFor the number of miliseconds that we should be waiting
- * for an event before simply bailing out.
- */
- public void waitForEvent(long waitFor)
- {
- synchronized(this)
- {
- if(collectedEvents.size() > 0)
- return;
-
- try{
- wait(waitFor);
- if(collectedEvents.size() > 0)
- logger.trace("Received a change in contact status.");
- else
- logger.trace("No change received for "+waitFor+"ms.");
- }
- catch (InterruptedException ex)
- {
- logger.debug(
- "Interrupted while waiting for a subscription evt", ex);
- }
- }
- }
-
- /**
- * Stores the received status change event and notifies all waiting on
- * this object
- * @param evt the SubscriptionEvent containing the corresponding contact
- */
- public void contactPresenceStatusChanged(
- ContactPresenceStatusChangeEvent evt)
- {
- synchronized(this)
- {
- //if the user has specified event details and the received
- //event does not match - then ignore it.
- if( this.trackedScreenName != null
- && !evt.getSourceContact().getAddress()
- .equals(trackedScreenName))
- return;
- if( status != null
- && status != evt.getNewStatus())
- return;
-
- logger.debug("Collected evt("+collectedEvents.size()+")= "+evt);
- collectedEvents.add(evt);
- notifyAll();
- }
- }
- }
-
- /**
- * AuthorizationHandler which accepts all requests!
- */
- private class AuthHandler
- implements AuthorizationHandler
- {
- private OperationSetPresence opset = null;
- AuthHandler(OperationSetPresence opset)
- {
- this.opset = opset;
- }
-
- public AuthorizationResponse processAuthorisationRequest(
- AuthorizationRequest req, Contact sourceContact)
- {
-// try{
-// opset.subscribe(sourceContact.getAddress());
-// }catch(Exception ex){}
-
- return
- new AuthorizationResponse(AuthorizationResponse.ACCEPT, "");
- }
- public AuthorizationRequest createAuthorizationRequest(Contact contact )
- {
- return new AuthorizationRequest();
- }
- public void processAuthorizationResponse(
- AuthorizationResponse response, Contact sourceContact){}
- }
-
- private void dumplists()
- {
- // just wait a little all modification events to be received
- Object o = new Object();
- synchronized(o)
- {
- try{o.wait(3000);}catch (InterruptedException ex){}
- }
-
- OperationSetPersistentPresence op1 = (OperationSetPersistentPresence)operationSetPresence1;
- OperationSetPersistentPresence op2 = (OperationSetPersistentPresence)operationSetPresence2;
-
- logger.info("------------ START DUMP LIST " + fixture.userID1 + " ------------");
- ContactGroup rootGroup = op1.getServerStoredContactListRoot();
- Iterator<ContactGroup> groups = rootGroup.subgroups();
- while (groups.hasNext() )
- {
- ContactGroup group = groups.next();
- logger.info("group " + group.getGroupName());
-
- Iterator<Contact> contactsIter = group.contacts();
- while(contactsIter.hasNext())
- {
- logger.info("\tcontact " + contactsIter.next());
- }
- }
- logger.info("------------ END DUMP LIST " + fixture.userID1 + " ------------");
-
-
- logger.info("------------ START DUMP LIST " + fixture.userID2 + " ------------");
- rootGroup = op2.getServerStoredContactListRoot();
- groups = rootGroup.subgroups();
- while (groups.hasNext() )
- {
- ContactGroup group = groups.next();
- logger.info("group " + group.getGroupName());
-
- Iterator<Contact> contactsIter = group.contacts();
- while(contactsIter.hasNext())
- {
- logger.info("\tcontact " + contactsIter.next());
- }
- }
- logger.info("------------ END DUMP LIST " + fixture.userID2 + " ------------");
- }
-}
diff --git a/test/net/java/sip/communicator/slick/protocol/yahoo/TestOperationSetTypingNotifications.java b/test/net/java/sip/communicator/slick/protocol/yahoo/TestOperationSetTypingNotifications.java
deleted file mode 100644
index 5138fed..0000000
--- a/test/net/java/sip/communicator/slick/protocol/yahoo/TestOperationSetTypingNotifications.java
+++ /dev/null
@@ -1,318 +0,0 @@
-/*
- * Jitsi, the OpenSource Java VoIP and Instant Messaging client.
- *
- * Copyright @ 2015 Atlassian Pty Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.java.sip.communicator.slick.protocol.yahoo;
-
-import java.util.*;
-
-import junit.framework.*;
-import net.java.sip.communicator.service.protocol.*;
-import net.java.sip.communicator.service.protocol.event.*;
-import net.java.sip.communicator.util.*;
-
-/**
- * Tests functionality of the typing notifications operation set.
- *
- * @author Damian Minkov
- */
-public class TestOperationSetTypingNotifications
- extends TestCase
-{
- private static final Logger logger =
- Logger.getLogger(TestOperationSetTypingNotifications.class);
-
- private YahooSlickFixture fixture = new YahooSlickFixture();
- private OperationSetTypingNotifications opSetTypingNotifs1 = null;
- private OperationSetPresence opSetPresence1 = null;
- private OperationSetTypingNotifications opSetTypingNotifs2 = null;
- private OperationSetPresence opSetPresence2 = null;
-
- private OperationSetBasicInstantMessaging opSetBasicIM1 = null;
- private OperationSetBasicInstantMessaging opSetBasicIM2 = null;
-
-
- public TestOperationSetTypingNotifications(String name)
- {
- super(name);
- }
-
- @Override
- protected void setUp() throws Exception
- {
- super.setUp();
- fixture.setUp();
-
- Map<String, OperationSet> supportedOperationSets1 =
- fixture.provider1.getSupportedOperationSets();
-
- if ( supportedOperationSets1 == null
- || supportedOperationSets1.size() < 1)
- throw new NullPointerException(
- "No OperationSet implementations are supported by "
- +"this implementation. ");
-
- //get the operation set presence here.
- opSetTypingNotifs1 =
- (OperationSetTypingNotifications)supportedOperationSets1.get(
- OperationSetTypingNotifications.class.getName());
-
- //if the op set is null then the implementation doesn't offer a typing.n
- //operation set which is unacceptable.
- if (opSetTypingNotifs1 == null)
- {
- throw new NullPointerException(
- "No implementation for typing notifications was found");
- }
-
- opSetBasicIM1 =
- (OperationSetBasicInstantMessaging)supportedOperationSets1.get(
- OperationSetBasicInstantMessaging.class.getName());
-
- if (opSetBasicIM1 == null)
- {
- throw new NullPointerException(
- "No implementation for basic IM was found");
- }
-
-
- //we also need the presence op set in order to retrieve contacts.
- opSetPresence1 =
- (OperationSetPresence)supportedOperationSets1.get(
- OperationSetPresence.class.getName());
-
- //if the op set is null show that we're not happy.
- if (opSetPresence1 == null)
- {
- throw new NullPointerException(
- "An implementation of the service must provide an "
- + "implementation of at least one of the PresenceOperationSets");
- }
-
- Map<String, OperationSet> supportedOperationSets2 =
- fixture.provider2.getSupportedOperationSets();
-
- if ( supportedOperationSets2 == null
- || supportedOperationSets2.size() < 1)
- throw new NullPointerException(
- "No OperationSet implementations are supported by "
- +"this implementation. ");
-
- //get the operation set presence here.
- opSetTypingNotifs2 =
- (OperationSetTypingNotifications)supportedOperationSets2.get(
- OperationSetTypingNotifications.class.getName());
-
- //if the op set is null then the implementation doesn't offer a typing.n
- //operation set which is unacceptable for.
- if (opSetTypingNotifs2 == null)
- {
- throw new NullPointerException(
- "No implementation for typing notifications was found");
- }
-
- opSetBasicIM2 =
- (OperationSetBasicInstantMessaging)supportedOperationSets2.get(
- OperationSetBasicInstantMessaging.class.getName());
-
- if (opSetBasicIM2 == null)
- {
- throw new NullPointerException(
- "No implementation for basic IM was found");
- }
-
-
- //we also need the presence op set in order to retrieve contacts.
- opSetPresence2 =
- (OperationSetPresence)supportedOperationSets2.get(
- OperationSetPresence.class.getName());
-
- //if the op set is null show that we're not happy.
- if (opSetPresence2 == null)
- {
- throw new NullPointerException(
- "An implementation of the service must provide an "
- + "implementation of at least one of the PresenceOperationSets");
- }
- }
-
- /**
- * Create the list to be sure that contacts exchanging messages
- * exists in each other lists
- * @throws Exception
- */
- public void prepareContactList() throws Exception
- {
- // be sure that contacts are in their lists
- try{
- opSetPresence1.subscribe(fixture.userID2);
- }
- catch (OperationFailedException ex){
- // the contact already exist its OK
- }
-
- try{
- opSetPresence2.subscribe(fixture.userID1);
- }
- catch (OperationFailedException ex1){
- // the contact already exist its OK
- }
-
- Object o = new Object();
- synchronized (o)
- {
- o.wait(2000);
- }
- }
-
- @Override
- protected void tearDown() throws Exception
- {
- super.tearDown();
-
- fixture.tearDown();
- }
-
- /**
- * Creates a test suite containing tests of this class in a specific order.
- * We'll first execute a test where we receive a typing notification, and
- * a volatile contact is created for the sender. we'll then be able to
- * retrieve this volatile contact and them a notification on our turn.
- * We need to do things this way as the contact corresponding to the tester
- * agent has been removed in the previous test and we no longer have it
- * in our contact list.
- *
- * @return Test a testsuite containing all tests to execute.
- */
- public static Test suite()
- {
- TestSuite suite = new TestSuite();
-
- suite.addTest(new TestOperationSetTypingNotifications(
- "prepareContactList"));
-
- //the following 2 need to be run in the specified order.
- suite.addTest(new TestOperationSetTypingNotifications(
- "testTypingNotificationsEventDelivery"));
- return suite;
- }
-
- /**
- * Sends a typing notification and verifies
- * whether it is properly received by the tested implementation
- */
- public void testTypingNotificationsEventDelivery()
- {
- TypingEventCollector evtCollector = new TypingEventCollector();
-
- // send message so request for receiving notifications also to be set
- Contact notifingContact =
- opSetPresence1.findContactByID(fixture.userID2);
- opSetBasicIM1.sendInstantMessage(notifingContact,
- opSetBasicIM1.createMessage("ping"));
-
- opSetTypingNotifs1.addTypingNotificationsListener(evtCollector);
-
- Contact contactToNotify =
- opSetPresence2.findContactByID(fixture.userID1);
-
- opSetBasicIM2.sendInstantMessage(contactToNotify,
- opSetBasicIM2.createMessage("pong"));
-
- Object w = new Object();
- synchronized(w){try {w.wait(500);}catch (Exception e) {}}
-
- opSetTypingNotifs2.sendTypingNotification(
- contactToNotify, OperationSetTypingNotifications.STATE_TYPING);
-
- evtCollector.waitForEvent(10000);
-
- opSetTypingNotifs1.removeTypingNotificationsListener(evtCollector);
-
- //check event dispatching
- assertTrue("Number of typing events received was zero."
- , evtCollector.collectedEvents.size() > 0);
-
- TypingNotificationEvent evt = (TypingNotificationEvent)evtCollector
- .collectedEvents.get(0);
-
- assertEquals("Source of the typing notification event"
- , fixture.userID2
- , evt.getSourceContact().getAddress() );
-
- assertEquals("Source of the typing notification event"
- , OperationSetTypingNotifications.STATE_TYPING
- , evt.getTypingState());
- }
-
- /**
- * Simply collects allre received events and provides a mechanisim for
- * waiting for the next event.
- */
- private class TypingEventCollector implements TypingNotificationsListener
- {
- private List<EventObject> collectedEvents = new LinkedList<EventObject>();
- /**
- * Called to indicate that a remote <tt>Contact</tt> has sent us a typing
- * notification. The method adds the <tt>event</tt> to the list of
- * captured events.
- * @param event a <tt>TypingNotificationEvent</tt> containing the sender
- * of the notification and its type.
- */
- public void typingNotificationReceived(TypingNotificationEvent event)
- {
- logger.debug("Received a typing notification: " + event);
- synchronized (this)
- {
- collectedEvents.add(event);
- notifyAll();
- }
- }
-
- /**
- * Called to indicate that sending typing notification has failed.
- *
- * @param event a <tt>TypingNotificationEvent</tt> containing the sender
- * of the notification and its type.
- */
- public void typingNotificationDeliveryFailed(TypingNotificationEvent event)
- {}
-
- /**
- * Blocks until at least one event is received or until waitFor
- * miliseconds pass (whicever happens first).
- *
- * @param waitFor the number of miliseconds that we should be waiting
- * for an event before simply bailing out.
- */
- public void waitForEvent(long waitFor)
- {
- synchronized(this){
-
- if(collectedEvents.size() > 0)
- return;
-
- try{
- wait(waitFor);
- }
- catch (InterruptedException ex){
- logger.debug(
- "Interrupted while waiting for a subscription evt", ex);
- }
- }
- }
- }
-}
diff --git a/test/net/java/sip/communicator/slick/protocol/yahoo/TestProtocolProviderServiceYahooImpl.java b/test/net/java/sip/communicator/slick/protocol/yahoo/TestProtocolProviderServiceYahooImpl.java
deleted file mode 100644
index 87c07f3..0000000
--- a/test/net/java/sip/communicator/slick/protocol/yahoo/TestProtocolProviderServiceYahooImpl.java
+++ /dev/null
@@ -1,262 +0,0 @@
-/*
- * Jitsi, the OpenSource Java VoIP and Instant Messaging client.
- *
- * Copyright @ 2015 Atlassian Pty Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.java.sip.communicator.slick.protocol.yahoo;
-
-import java.util.*;
-
-import junit.framework.*;
-import net.java.sip.communicator.service.protocol.*;
-import net.java.sip.communicator.service.protocol.event.*;
-import net.java.sip.communicator.slick.protocol.generic.*;
-import net.java.sip.communicator.util.*;
-
-/**
- * Performs testing on protocol provider methods.
- * @todo add more detailed docs once the tests are written.
- * @author Damian Minkov
- */
-public class TestProtocolProviderServiceYahooImpl
- extends TestCase
-{
- private static final Logger logger =
- Logger.getLogger(TestProtocolProviderServiceYahooImpl.class);
-
- private YahooSlickFixture fixture = new YahooSlickFixture();
-
- /**
- * An event adapter that would collec registation state change events
- */
- public RegistrationEventCollector regEvtCollector1
- = new RegistrationEventCollector();
-
- /**
- * An event adapter that would collec registation state change events
- */
- public RegistrationEventCollector regEvtCollector2
- = new RegistrationEventCollector();
-
- /**
- * An event adapter that would collec registation state change events
- */
- public RegistrationEventCollector regEvtCollector3
- = new RegistrationEventCollector();
-
- /**
- * Creates a test encapsulator for the method with the specified name.
- * @param name the name of the method this test should run.
- */
- public TestProtocolProviderServiceYahooImpl(String name)
- {
- super(name);
- }
-
- /**
- * Initializes the fixture.
- * @throws Exception if super.setUp() throws one.
- */
- @Override
- protected void setUp() throws Exception
- {
- super.setUp();
- fixture.setUp();
- }
-
- /**
- * Tears the fixture down.
- * @throws Exception if fixture.tearDown() fails.
- */
- @Override
- protected void tearDown() throws Exception
- {
- fixture.tearDown();
- super.tearDown();
- }
-
- /**
- * Makes sure that the instance of the Yahoo protocol provider that we're
- * going to use for testing is properly initialized and registered with
- * a Yahoo registrar. This MUST be called before any other online testing
- * of the Yahoo provider so that we won't have to reregister for every single
- * test.
- * <p>
- * The method also verifies that a registration event is fired upon
- * succesful registration and collected by our event collector.
- *
- * @throws OperationFailedException if provider.register() fails.
- */
- public void testRegister()
- throws OperationFailedException
- {
- //add an event collector that will collect all events during the
- //registration and allow us to later inspect them and make sure
- //they were properly dispatched.
- fixture.provider1.addRegistrationStateChangeListener(regEvtCollector1);
- fixture.provider2.addRegistrationStateChangeListener(regEvtCollector2);
-
- //register our three providers
- fixture.provider1.register(new SecurityAuthorityImpl(
- System.getProperty(YahooProtocolProviderServiceLick.ACCOUNT_1_PREFIX
- + ProtocolProviderFactory.PASSWORD).toCharArray()));
- fixture.provider2.register(new SecurityAuthorityImpl(
- System.getProperty(YahooProtocolProviderServiceLick.ACCOUNT_2_PREFIX
- + ProtocolProviderFactory.PASSWORD).toCharArray()));
-
- //give it enough time to register. We won't really have to wait all this
- //time since the registration event collector would notify us the moment
- //we get signed on.
- logger.debug("Waiting for registration to complete ...");
-
- regEvtCollector1.waitForEvent(15000);
- regEvtCollector2.waitForEvent(40000);
-
- //make sure that the registration process trigerred the corresponding
- //events.
- assertTrue(
- "No events were dispatched during the registration process."
- ,regEvtCollector1.collectedNewStates.size() > 0);
-
- assertTrue(
- "No registration event notifying of registration was dispatched. "
- +"All events were: " + regEvtCollector1.collectedNewStates
- ,regEvtCollector1.collectedNewStates
- .contains(RegistrationState.REGISTERED));
-
- //now the same for provider 2
- assertTrue(
- "No events were dispatched during the registration process "
- +"of provider2."
- ,regEvtCollector2.collectedNewStates.size() > 0);
-
- assertTrue(
- "No registration event notifying of registration was dispatched. "
- +"All events were: " + regEvtCollector2.collectedNewStates
- ,regEvtCollector2.collectedNewStates
- .contains(RegistrationState.REGISTERED));
-
- fixture.provider1
- .removeRegistrationStateChangeListener(regEvtCollector1);
- fixture.provider2
- .removeRegistrationStateChangeListener(regEvtCollector2);
- }
-
-
- /**
- * Verifies that all operation sets have the type they are declarded to
- * have.
- *
- * @throws java.lang.Exception if a class indicated in one of the keys
- * could not be forName()ed.
- */
- public void testOperationSetTypes() throws Exception
- {
- Map<String, OperationSet> supportedOperationSets =
- fixture.provider1.getSupportedOperationSets();
-
- // make sure that keys (which are supposed to be class names) correspond
- // what the class of the values recorded against them.
- for (Map.Entry<String, OperationSet> entry : supportedOperationSets
- .entrySet())
- {
- String setName = entry.getKey();
- Object opSet = entry.getValue();
-
- assertTrue(opSet + " was not an instance of " + setName
- + " as declared", Class.forName(setName).isInstance(opSet));
- }
- }
-
- /**
- * A class that would plugin as a registration listener to a protocol
- * provider and simply record all events that it sees and notifyAll()
- * if it sees an event that notifies us of a completed
- * registration.
- */
- public class RegistrationEventCollector
- implements RegistrationStateChangeListener
- {
- public List<RegistrationState> collectedNewStates = new LinkedList<RegistrationState>();
-
- /**
- * The method would simply register all received events so that they
- * could be available for later inspection by the unit tests. In the
- * case where a registraiton event notifying us of a completed
- * registration is seen, the method would call notifyAll().
- *
- * @param evt ProviderStatusChangeEvent the event describing the status
- * change.
- */
- public void registrationStateChanged(RegistrationStateChangeEvent evt)
- {
- logger.debug("Received a RegistrationStateChangeEvent: " + evt);
-
- collectedNewStates.add(evt.getNewState());
-
- if (evt.getNewState().equals(RegistrationState.REGISTERED))
- {
- logger.debug("We're registered and will notify those who wait");
- synchronized (this)
- {
- notifyAll();
- }
- }
- }
-
- /**
- * Blocks until an event notifying us of the awaited state change is
- * received or until waitFor miliseconds pass (whichever happens first).
- *
- * @param waitFor the number of miliseconds that we should be waiting
- * for an event before simply bailing out.
- */
- public void waitForEvent(long waitFor)
- {
- logger.trace("Waiting for a RegistrationStateChangeEvent ");
-
- synchronized (this)
- {
- if (collectedNewStates.contains(RegistrationState.REGISTERED))
- {
- logger.trace("Event already received. "
- + collectedNewStates);
- return;
- }
-
- try
- {
- wait(waitFor);
-
- if (collectedNewStates.size() > 0)
- logger.trace(
- "Received a RegistrationStateChangeEvent.");
- else
- logger.trace(
- "No RegistrationStateChangeEvent received for "
- + waitFor + "ms.");
-
- }
- catch (InterruptedException ex)
- {
- logger.debug(
- "Interrupted while waiting for a "
- +"RegistrationStateChangeEvent"
- , ex);
- }
- }
- }
- }
-}
diff --git a/test/net/java/sip/communicator/slick/protocol/yahoo/YahooProtocolProviderServiceLick.java b/test/net/java/sip/communicator/slick/protocol/yahoo/YahooProtocolProviderServiceLick.java
deleted file mode 100644
index a9dc75d..0000000
--- a/test/net/java/sip/communicator/slick/protocol/yahoo/YahooProtocolProviderServiceLick.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- * Jitsi, the OpenSource Java VoIP and Instant Messaging client.
- *
- * Copyright @ 2015 Atlassian Pty Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.java.sip.communicator.slick.protocol.yahoo;
-
-import java.util.*;
-
-import junit.framework.*;
-
-import org.osgi.framework.*;
-
-/**
- * Yahoo specific testing for a Yahoo Protocol Provider Service implementation.
- * The test suite registers three accounts for
- *
- * @author Damian Minkov
- * @author Valentin Martinet
- */
-public class YahooProtocolProviderServiceLick
- extends TestSuite
- implements BundleActivator
-{
- /**
- * The prefix used for property names containing settings for our first
- * testing account.
- */
- public static final String ACCOUNT_1_PREFIX
- = "accounts.yahoo.account1.";
-
- /**
- * The prefix used for property names containing settings for our second
- * testing account.
- */
- public static final String ACCOUNT_2_PREFIX
- = "accounts.yahoo.account2.";
-
- /**
- * The prefix used for property names containing settings for our third
- * testing account.
- */
- public static final String ACCOUNT_3_PREFIX
- = "accounts.yahoo.account3.";
-
- /**
- * The name of the property that indicates whether the user would like to
- * only run the offline tests.
- */
- public static final String DISABLE_ONLINE_TESTS_PROPERTY_NAME
- = "accounts.yahoo.DISABLE_ONLINE_TESTING";
-
- /**
- * The name of the property the value of which is a formatted string that
- * contains the contact list that.
- */
- public static final String CONTACT_LIST_PROPERTY_NAME
- = "accounts.yahoo.CONTACT_LIST";
-
- /**
- * Initializes and registers all tests that we'll run as a part of this
- * slick.
- *
- * @param context a currently valid bundle context.
- */
- public void start(BundleContext context)
- {
- setName("YahooProtocolProviderSlick");
-
- Hashtable<String, String> properties = new Hashtable<String, String>();
- properties.put("service.pid", getName());
-
- YahooSlickFixture.bc = context;
-
- // verify whether the user wants to avoid online testing
- String offlineMode = System.getProperty(
- DISABLE_ONLINE_TESTS_PROPERTY_NAME, null);
-
- if (offlineMode != null && offlineMode.equalsIgnoreCase("true"))
- YahooSlickFixture.onlineTestingDisabled = true;
-
-
- addTestSuite(TestAccountInstallation.class);
- addTestSuite(TestProtocolProviderServiceYahooImpl.class);
-
- addTest(TestOperationSetPresence.suite());
-
- //the following should only be run when we want online testing.
- if(!YahooSlickFixture.onlineTestingDisabled)
- {
- addTest(TestOperationSetPersistentPresence.suite());
-
- addTest(TestOperationSetBasicInstantMessaging.suite());
-
- addTest(TestOperationSetTypingNotifications.suite());
-
- addTestSuite(TestOperationSetFileTransferImpl.class);
-
- //addTest(TestOperationSetAdHocMultiUserChatYahooImpl.suite());
- }
-
- addTest(TestAccountUninstallation.suite());
- addTestSuite(TestAccountUninstallationPersistence.class);
-
- context.registerService(getClass().getName(), this, properties);
- }
-
- /**
- * Prepares the slick for shutdown.
- *
- * @param context a currently valid bundle context.
- */
- public void stop(BundleContext context)
- {
-
- }
-}
diff --git a/test/net/java/sip/communicator/slick/protocol/yahoo/YahooSlickFixture.java b/test/net/java/sip/communicator/slick/protocol/yahoo/YahooSlickFixture.java
deleted file mode 100644
index 88d36f5..0000000
--- a/test/net/java/sip/communicator/slick/protocol/yahoo/YahooSlickFixture.java
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * Jitsi, the OpenSource Java VoIP and Instant Messaging client.
- *
- * Copyright @ 2015 Atlassian Pty Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.java.sip.communicator.slick.protocol.yahoo;
-
-import net.java.sip.communicator.service.protocol.*;
-import net.java.sip.communicator.slick.protocol.generic.*;
-
-import org.osgi.framework.*;
-
-/**
- * Contains fields and methods used by most or all tests in the yahoo slick.
- *
- * @author Damian Minkov
- * @author Valentin Martinet
- */
-public class YahooSlickFixture
- extends AdHocMultiUserChatSlickFixture
-{
- /**
- * Constructor
- */
- public YahooSlickFixture()
- {
- super();
- }
-
- /**
- * Initializes protocol provider references and whatever else there is to
- * initialize.
- *
- * @throws InvalidSyntaxException in case we meet problems while retrieving
- * protocol providers through OSGI
- */
- @Override
- public void setUp() throws InvalidSyntaxException
- {
- // first obtain a reference to the provider factory
- ServiceReference[] serRefs = null;
- String osgiFilter = "(" + ProtocolProviderFactory.PROTOCOL
- + "="+ProtocolNames.YAHOO+")";
- try{
- serRefs = bc.getServiceReferences(
- ProtocolProviderFactory.class.getName(), osgiFilter);
- }
- catch (InvalidSyntaxException ex){
- //this really shouldhn't occur as the filter expression is static.
- fail(osgiFilter + " is not a valid osgi filter");
- }
-
- assertTrue(
- "Failed to find a provider factory service for protocol yahoo",
- (serRefs != null) && (serRefs.length > 0));
-
- //Keep the reference for later usage.
- providerFactory = (ProtocolProviderFactory)bc.getService(serRefs[0]);
-
- userID1 =
- System.getProperty(
- YahooProtocolProviderServiceLick.ACCOUNT_1_PREFIX
- + ProtocolProviderFactory.USER_ID);
-
- userID2 =
- System.getProperty(
- YahooProtocolProviderServiceLick.ACCOUNT_2_PREFIX
- + ProtocolProviderFactory.USER_ID);
-
- userID3 =
- System.getProperty(
- YahooProtocolProviderServiceLick.ACCOUNT_3_PREFIX
- + ProtocolProviderFactory.USER_ID);
-
- //find the protocol providers exported for the three accounts
- ServiceReference[] yahooProvider1Refs
- = bc.getServiceReferences(
- ProtocolProviderService.class.getName(),
- "(&"
- +"("+ProtocolProviderFactory.PROTOCOL+"="+ProtocolNames.YAHOO+")"
- +"("+ProtocolProviderFactory.USER_ID+"="
- + userID1 +")"
- +")");
-
- //make sure we found a service
- assertNotNull("No Protocol Provider was found for yahoo account1:"
- + userID1
- , yahooProvider1Refs);
- assertTrue("No Protocol Provider was found for yahoo account1:"+userID1,
- yahooProvider1Refs.length > 0);
-
- ServiceReference[] yahooProvider2Refs
- = bc.getServiceReferences(
- ProtocolProviderService.class.getName(),
- "(&"
- +"("+ProtocolProviderFactory.PROTOCOL+"="+ProtocolNames.YAHOO+")"
- +"("+ProtocolProviderFactory.USER_ID+"="
- + userID2 +")"
- +")");
-
- //again make sure we found a service.
- assertNotNull("No Protocol Provider was found for yahoo account2:"
- + userID2
- , yahooProvider2Refs);
- assertTrue("No Protocol Provider was found for yahoo account2:"+userID2,
- yahooProvider2Refs.length > 0);
-
- ServiceReference[] yahooProvider3Refs
- = bc.getServiceReferences(
- ProtocolProviderService.class.getName(),
- "(&"
- +"("+ProtocolProviderFactory.PROTOCOL+"="+ProtocolNames.YAHOO+")"
- +"("+ProtocolProviderFactory.USER_ID+"="
- + userID3 +")"
- +")");
-
- //again make sure we found a service.
- assertNotNull("No Protocol Provider was found for yahoo account3:"
- + userID3
- , yahooProvider3Refs);
- assertTrue("No Protocol Provider was found for yahoo account2:"+userID3,
- yahooProvider3Refs.length > 0);
-
- //save the service for other tests to use.
- provider1ServiceRef = yahooProvider1Refs[0];
- provider1 = (ProtocolProviderService)bc.getService(provider1ServiceRef);
- provider2ServiceRef = yahooProvider2Refs[0];
- provider2 = (ProtocolProviderService)bc.getService(provider2ServiceRef);
- provider3ServiceRef = yahooProvider3Refs[0];
- provider3 = (ProtocolProviderService)bc.getService(provider3ServiceRef);
- }
-}
diff --git a/test/net/java/sip/communicator/slick/protocol/yahoo/yahoo.provider.slick.manifest.mf b/test/net/java/sip/communicator/slick/protocol/yahoo/yahoo.provider.slick.manifest.mf
deleted file mode 100644
index e57e344..0000000
--- a/test/net/java/sip/communicator/slick/protocol/yahoo/yahoo.provider.slick.manifest.mf
+++ /dev/null
@@ -1,17 +0,0 @@
-Bundle-Activator: net.java.sip.communicator.slick.protocol.yahoo.YahooProtocolProviderServiceLick
-Bundle-Name: Yahoo Protocol Provider Service Leveraging Implementation Compatibility Kit
-Bundle-Description: A Service Leveraging Implementation Compatibility Kit for the Yahoo implementation of the ProtocolProvider Service
-Bundle-Vendor: sip-communicator.org
-Bundle-Version: 0.0.1
-System-Bundle: yes
-Import-Package: org.jitsi.service.configuration,
- junit.framework,
- org.osgi.framework,
- javax.net.ssl,
- javax.xml.parsers,
- net.java.sip.communicator.util,
- net.java.sip.communicator.service.dns,
- net.java.sip.communicator.service.protocol,
- net.java.sip.communicator.service.protocol.yahooconstants,
- net.java.sip.communicator.service.protocol.event,
- org.jitsi.service.fileaccess