diff --git a/build.xml b/build.xml index 28fb0eb9c..34677b354 100644 --- a/build.xml +++ b/build.xml @@ -662,7 +662,7 @@ as a test environment--> - + @@ -1147,7 +1147,7 @@ javax.swing.event, javax.swing.border"/> - + @@ -1164,7 +1164,7 @@ javax.swing.event, javax.swing.border"/> - + @@ -1188,6 +1188,9 @@ javax.swing.event, javax.swing.border"/> prefix="net/java/sip/communicator/impl/protocol/jabber"/> + + + @@ -1203,6 +1206,9 @@ javax.swing.event, javax.swing.border"/> prefix="net/java/sip/communicator/slick/protocol/jabber"/> + + + diff --git a/lib/installer-exclude/backport-util-concurrent.jar b/lib/installer-exclude/backport-util-concurrent.jar new file mode 100644 index 000000000..99f9b9c6a Binary files /dev/null and b/lib/installer-exclude/backport-util-concurrent.jar differ diff --git a/lib/installer-exclude/retroweaver-rt-2.0.jar b/lib/installer-exclude/retroweaver-rt-2.0.jar new file mode 100644 index 000000000..af511e277 Binary files /dev/null and b/lib/installer-exclude/retroweaver-rt-2.0.jar differ diff --git a/lib/installer-exclude/retroweaver-rt-2.0Beta4.jar b/lib/installer-exclude/retroweaver-rt-2.0Beta4.jar deleted file mode 100644 index baf70b994..000000000 Binary files a/lib/installer-exclude/retroweaver-rt-2.0Beta4.jar and /dev/null differ diff --git a/lib/installer-exclude/smack.jar b/lib/installer-exclude/smack.jar index 47269deba..30d0be844 100644 Binary files a/lib/installer-exclude/smack.jar and b/lib/installer-exclude/smack.jar differ diff --git a/lib/installer-exclude/smackx-jingle.jar b/lib/installer-exclude/smackx-jingle.jar new file mode 100644 index 000000000..4b6274da1 Binary files /dev/null and b/lib/installer-exclude/smackx-jingle.jar differ diff --git a/lib/installer-exclude/smackx.jar b/lib/installer-exclude/smackx.jar index 5b68f1666..606152f2a 100644 Binary files a/lib/installer-exclude/smackx.jar and b/lib/installer-exclude/smackx.jar differ diff --git a/src/net/java/sip/communicator/impl/protocol/jabber/ContactGroupJabberImpl.java b/src/net/java/sip/communicator/impl/protocol/jabber/ContactGroupJabberImpl.java index 36cef640d..e8cd21ae4 100644 --- a/src/net/java/sip/communicator/impl/protocol/jabber/ContactGroupJabberImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/jabber/ContactGroupJabberImpl.java @@ -441,7 +441,7 @@ void setResolved(RosterGroup source) this.rosterGroup = source; - Iterator iter = source.getEntries(); + Iterator iter = source.getEntries().iterator(); while (iter.hasNext()) { RosterEntry item = (RosterEntry) iter.next(); @@ -501,7 +501,7 @@ void setSourceGroup(RosterGroup newGroup) // clear current buddies . new entries will be added buddies.clear(); - Iterator iter = newGroup.getEntries(); + Iterator iter = newGroup.getEntries().iterator(); while (iter.hasNext()) { RosterEntry item = (RosterEntry) iter.next(); diff --git a/src/net/java/sip/communicator/impl/protocol/jabber/OperationSetBasicInstantMessagingJabberImpl.java b/src/net/java/sip/communicator/impl/protocol/jabber/OperationSetBasicInstantMessagingJabberImpl.java index 95fe1c7a3..a488a0964 100644 --- a/src/net/java/sip/communicator/impl/protocol/jabber/OperationSetBasicInstantMessagingJabberImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/jabber/OperationSetBasicInstantMessagingJabberImpl.java @@ -18,6 +18,7 @@ import net.java.sip.communicator.service.protocol.*; import net.java.sip.communicator.service.protocol.Message; import net.java.sip.communicator.service.protocol.event.*; +import net.java.sip.communicator.service.protocol.event.MessageListener; import net.java.sip.communicator.service.protocol.jabberconstants.*; import net.java.sip.communicator.util.*; @@ -89,7 +90,7 @@ public class OperationSetBasicInstantMessagingJabberImpl provider.addRegistrationStateChangeListener(new RegistrationStateListener()); // register the KeepAlive Extension in the smack library - ProviderManager.addIQProvider(KeepAliveEventProvider.ELEMENT_NAME, + ProviderManager.getInstance().addIQProvider(KeepAliveEventProvider.ELEMENT_NAME, KeepAliveEventProvider.NAMESPACE, new KeepAliveEventProvider()); } @@ -198,11 +199,19 @@ public void sendInstantMessage(Contact to, Message message) { assertConnected(); - Chat chat = - jabberProvider.getConnection(). - createChat(to.getAddress()); + org.jivesoftware.smack.MessageListener msgListener = + new org.jivesoftware.smack.MessageListener() { + public void processMessage(Chat arg0, org.jivesoftware.smack.packet.Message arg1) { + } + }; - org.jivesoftware.smack.packet.Message msg = chat.createMessage(); + Chat chat = jabberProvider.getConnection().getChatManager().createChat( + to.getAddress(), msgListener + ); + + org.jivesoftware.smack.packet.Message msg = + new org.jivesoftware.smack.packet.Message(); + msg.setBody(message.getContent()); msg.addExtension(new Version()); @@ -350,7 +359,7 @@ public void processPacket(Packet packet) Contact sourceContact = opSetPersPresence.findContactByID(fromUserID); - if(msg.getType() == org.jivesoftware.smack.packet.Message.Type.ERROR) + if(msg.getType() == org.jivesoftware.smack.packet.Message.Type.error) { logger.info("Message error received from " + fromUserID); diff --git a/src/net/java/sip/communicator/impl/protocol/jabber/OperationSetPersistentPresenceJabberImpl.java b/src/net/java/sip/communicator/impl/protocol/jabber/OperationSetPersistentPresenceJabberImpl.java index 7830c279e..d9f707be1 100644 --- a/src/net/java/sip/communicator/impl/protocol/jabber/OperationSetPersistentPresenceJabberImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/jabber/OperationSetPersistentPresenceJabberImpl.java @@ -78,8 +78,6 @@ public class OperationSetPersistentPresenceJabberImpl supportedPresenceStatusSet.add(JabberStatusEnum.AWAY); supportedPresenceStatusSet.add(JabberStatusEnum.DO_NOT_DISTURB); supportedPresenceStatusSet.add(JabberStatusEnum.FREE_FOR_CHAT); - supportedPresenceStatusSet.add(JabberStatusEnum.INVISIBLE); - supportedPresenceStatusSet.add(JabberStatusEnum.EXTENDED_AWAY); supportedPresenceStatusSet.add(JabberStatusEnum.OFFLINE); supportedPresenceStatusSet.add(JabberStatusEnum.AVAILABLE); } @@ -91,17 +89,13 @@ public class OperationSetPersistentPresenceJabberImpl private static Map scToJabberModesMappings = new Hashtable(); static{ scToJabberModesMappings.put(JabberStatusEnum.AWAY, - Presence.Mode.AWAY); + Presence.Mode.away); scToJabberModesMappings.put(JabberStatusEnum.DO_NOT_DISTURB, - Presence.Mode.DO_NOT_DISTURB); + Presence.Mode.dnd); scToJabberModesMappings.put(JabberStatusEnum.FREE_FOR_CHAT, - Presence.Mode.CHAT); - scToJabberModesMappings.put(JabberStatusEnum.INVISIBLE, - Presence.Mode.INVISIBLE); - scToJabberModesMappings.put(JabberStatusEnum.EXTENDED_AWAY, - Presence.Mode.EXTENDED_AWAY); + Presence.Mode.chat); scToJabberModesMappings.put(JabberStatusEnum.AVAILABLE, - Presence.Mode.AVAILABLE); + Presence.Mode.available); } /** @@ -414,12 +408,12 @@ public void publishPresenceStatus(PresenceStatus status, Presence presence = null; if(((JabberStatusEnum)status).equals(JabberStatusEnum.OFFLINE)) { - presence = new Presence(Presence.Type.UNAVAILABLE); + presence = new Presence(Presence.Type.unavailable); jabberProvider.unregister(); } else { - presence = new Presence(Presence.Type.AVAILABLE); + presence = new Presence(Presence.Type.available); presence.setMode(presenceStatusToJabberMode((JabberStatusEnum)status)); presence.setStatus(statusMessage); @@ -665,18 +659,14 @@ public void unsubscribe(Contact contact) throws IllegalArgumentException, */ private JabberStatusEnum jabberStatusToPresenceStatus(Presence.Mode mode) { - if(mode.equals(Presence.Mode.AVAILABLE)) + if(mode.equals(Presence.Mode.available)) return JabberStatusEnum.AVAILABLE; - else if(mode.equals(Presence.Mode.AWAY)) + else if(mode.equals(Presence.Mode.away)) return JabberStatusEnum.AWAY; - else if(mode.equals(Presence.Mode.CHAT)) + else if(mode.equals(Presence.Mode.chat)) return JabberStatusEnum.FREE_FOR_CHAT; - else if(mode.equals(Presence.Mode.DO_NOT_DISTURB)) + else if(mode.equals(Presence.Mode.dnd)) return JabberStatusEnum.DO_NOT_DISTURB; - else if(mode.equals(Presence.Mode.EXTENDED_AWAY)) - return JabberStatusEnum.EXTENDED_AWAY; - else if(mode.equals(Presence.Mode.INVISIBLE)) - return JabberStatusEnum.INVISIBLE; else return JabberStatusEnum.OFFLINE; } @@ -1011,11 +1001,11 @@ public void entriesUpdated(Collection addresses) public void entriesDeleted(Collection addresses) {} - public void presenceChanged(String XMPPAddress) + public void presenceChanged(Presence presence) { try { - String userID = StringUtils.parseBareAddress(XMPPAddress); + String userID = StringUtils.parseBareAddress(presence.getFrom()); logger.debug("Received a status update for buddy=" + userID); @@ -1071,7 +1061,7 @@ public void processPacket(Packet packet) { Presence presence = (Presence)packet; - if (presence != null && presence.getType() == Presence.Type.SUBSCRIBE) + if (presence != null && presence.getType() == Presence.Type.subscribe) { logger.trace(presence.getFrom() + " wants to add you to its contact list"); // buddy want to add you to its roster @@ -1086,21 +1076,21 @@ public void processPacket(Packet packet) if(response != null && response.getResponseCode().equals(AuthorizationResponse.ACCEPT)) { - Presence responsePacket = new Presence(Presence.Type.SUBSCRIBED); + Presence responsePacket = new Presence(Presence.Type.subscribed); responsePacket.setTo(fromID); logger.info("Sending Accepted Subscription"); jabberProvider.getConnection().sendPacket(responsePacket); } else { - Presence responsePacket = new Presence(Presence.Type.UNSUBSCRIBED); + Presence responsePacket = new Presence(Presence.Type.unsubscribed); responsePacket.setTo(fromID); logger.info("Sending Rejected Subscription"); jabberProvider.getConnection().sendPacket(responsePacket); } } - else if (presence != null && presence.getType() == Presence.Type.UNSUBSCRIBED) + else if (presence != null && presence.getType() == Presence.Type.unsubscribed) { logger.trace(presence.getFrom() + " does not allow your subscription"); ContactJabberImpl contact = @@ -1115,7 +1105,7 @@ else if (presence != null && presence.getType() == Presence.Type.UNSUBSCRIBED) ssContactList.removeContact(contact); } } - else if (presence != null && presence.getType() == Presence.Type.SUBSCRIBED) + else if (presence != null && presence.getType() == Presence.Type.subscribed) { ContactJabberImpl contact = ssContactList.findContactById(presence.getFrom()); diff --git a/src/net/java/sip/communicator/impl/protocol/jabber/ProtocolProviderServiceJabberImpl.java b/src/net/java/sip/communicator/impl/protocol/jabber/ProtocolProviderServiceJabberImpl.java index fc20d9ead..8750af844 100644 --- a/src/net/java/sip/communicator/impl/protocol/jabber/ProtocolProviderServiceJabberImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/jabber/ProtocolProviderServiceJabberImpl.java @@ -270,14 +270,19 @@ private void connectAndLogin(SecurityAuthority authority) logger.error("Domain not resolved " + ex1.getMessage()); } - Roster.setDefaultSubscriptionMode(Roster.SUBSCRIPTION_MANUAL); + Roster.setDefaultSubscriptionMode(Roster.SubscriptionMode.manual); try { - connection = new XMPPConnection( - serverAddress, - Integer.parseInt(serverPort), - serviceName); + ConnectionConfiguration confConn = + new ConnectionConfiguration( + serverAddress, + Integer.parseInt(serverPort), + serviceName + ); + connection = new XMPPConnection(confConn); + + connection.connect(); } catch (XMPPException exc) { @@ -310,7 +315,7 @@ private void connectAndLogin(SecurityAuthority authority) this.reconnecting = false; connection.getRoster(). - setSubscriptionMode(Roster.SUBSCRIPTION_MANUAL); + setSubscriptionMode(Roster.SubscriptionMode.manual); fireRegistrationStateChanged( getRegistrationState(), @@ -352,7 +357,7 @@ private void unregister(boolean fireEvent) RegistrationState currRegState = getRegistrationState(); if(connection != null) - connection.close(); + connection.disconnect(); if(fireEvent) { @@ -490,7 +495,7 @@ protected void initialize(String screenname, public void shutdown() { synchronized(initializationLock){ - connection.close(); + connection.disconnect(); connection = null; isInitialized = false; } @@ -629,6 +634,21 @@ public void connectionClosedOnError(Exception exception) else reconnecting = false; } + + public void reconnectingIn(int i) + { + logger.info("reconnectingIn " + i); + } + + public void reconnectionSuccessful() + { + logger.info("reconnectionSuccessful"); + } + + public void reconnectionFailed(Exception exception) + { + logger.info("reconnectionFailed ", exception); + } } /** diff --git a/src/net/java/sip/communicator/impl/protocol/jabber/ServerStoredContactListJabberImpl.java b/src/net/java/sip/communicator/impl/protocol/jabber/ServerStoredContactListJabberImpl.java index a2bd2efee..5d427f91d 100644 --- a/src/net/java/sip/communicator/impl/protocol/jabber/ServerStoredContactListJabberImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/jabber/ServerStoredContactListJabberImpl.java @@ -9,6 +9,7 @@ import java.util.*; import org.jivesoftware.smack.*; +import org.jivesoftware.smack.packet.*; import net.java.sip.communicator.service.protocol.*; import net.java.sip.communicator.service.protocol.event.*; import net.java.sip.communicator.util.*; @@ -626,7 +627,7 @@ private void initRoster() // first if unfiled exntries will move them in a group if(roster.getUnfiledEntryCount() > 0) { - Iterator iter = roster.getUnfiledEntries(); + Iterator iter = roster.getUnfiledEntries().iterator(); while (iter.hasNext()) { RosterEntry item = (RosterEntry) iter.next(); @@ -651,7 +652,7 @@ private void initRoster() // fill in root group - Iterator iter = roster.getGroups(); + Iterator iter = roster.getGroups().iterator(); while (iter.hasNext()) { RosterGroup item = (RosterGroup) iter.next(); @@ -663,7 +664,8 @@ private void initRoster() { // create the group as it doesn't exist ContactGroupJabberImpl newGroup = - new ContactGroupJabberImpl(item, item.getEntries(), this, true); + new ContactGroupJabberImpl( + item, item.getEntries().iterator(), this, true); rootGroup.addSubGroup(newGroup); @@ -778,7 +780,7 @@ public void entriesAdded(Collection addresses) true); boolean isUnfiledEntry = true; - Iterator groupIter = entry.getGroups(); + Iterator groupIter = entry.getGroups().iterator(); while (groupIter.hasNext()) { RosterGroup group = (RosterGroup) groupIter.next(); @@ -822,7 +824,7 @@ public void entriesUpdated(Collection addresses) String contactID = (String) iter.next(); RosterEntry entry = roster.getEntry(contactID); - Iterator iter1 = entry.getGroups(); + Iterator iter1 = entry.getGroups().iterator(); while (iter1.hasNext()) { RosterGroup gr = (RosterGroup) iter1.next(); @@ -933,7 +935,7 @@ else if(group instanceof RootContactGroupJabberImpl) } } - public void presenceChanged(String XMPPAddress) + public void presenceChanged(Presence presence) {} } } diff --git a/src/net/java/sip/communicator/service/protocol/jabberconstants/JabberStatusEnum.java b/src/net/java/sip/communicator/service/protocol/jabberconstants/JabberStatusEnum.java index 644726a8c..583aa86fc 100644 --- a/src/net/java/sip/communicator/service/protocol/jabberconstants/JabberStatusEnum.java +++ b/src/net/java/sip/communicator/service/protocol/jabberconstants/JabberStatusEnum.java @@ -44,15 +44,6 @@ public class JabberStatusEnum = new JabberStatusEnum(65, "Available", loadIcon("resources/images/jabber/jabber16x16-online.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 JabberStatusEnum INVISIBLE - = new JabberStatusEnum(45, "Invisible", - loadIcon("resources/images/jabber/jabber16x16-invisible.png")); - /** * The Away status. Indicates that the user has connectivity but might * not be able to immediately act upon initiation of communication. @@ -61,17 +52,6 @@ public class JabberStatusEnum = new JabberStatusEnum(40, "Away", loadIcon("resources/images/jabber/jabber16x16-away.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 JabberStatusEnum EXTENDED_AWAY - = new JabberStatusEnum(35, "Extended Away", - loadIcon("resources/images/jabber/jabber16x16-na.png")); - /** * The DND status. Indicates that the user has connectivity but prefers * not to be contacted. @@ -95,9 +75,7 @@ public class JabberStatusEnum static{ jabberStatusSet.add(FREE_FOR_CHAT); jabberStatusSet.add(AVAILABLE); - jabberStatusSet.add(INVISIBLE); jabberStatusSet.add(AWAY); - jabberStatusSet.add(EXTENDED_AWAY); jabberStatusSet.add(DO_NOT_DISTURB); jabberStatusSet.add(OFFLINE); } diff --git a/test/net/java/sip/communicator/slick/protocol/jabber/TestOperationSetBasicInstantMessaging.java b/test/net/java/sip/communicator/slick/protocol/jabber/TestOperationSetBasicInstantMessaging.java index 7ed4e85b4..e24ae172e 100644 --- a/test/net/java/sip/communicator/slick/protocol/jabber/TestOperationSetBasicInstantMessaging.java +++ b/test/net/java/sip/communicator/slick/protocol/jabber/TestOperationSetBasicInstantMessaging.java @@ -190,9 +190,10 @@ public void prepareContactList() // the contact already exist its OK } + logger.info("will wait till the list prepare is completed"); synchronized(o) { - o.wait(2000); + o.wait(4000); } } diff --git a/test/net/java/sip/communicator/slick/protocol/jabber/TestOperationSetPresence.java b/test/net/java/sip/communicator/slick/protocol/jabber/TestOperationSetPresence.java index 5f3553dfc..14b3209bd 100644 --- a/test/net/java/sip/communicator/slick/protocol/jabber/TestOperationSetPresence.java +++ b/test/net/java/sip/communicator/slick/protocol/jabber/TestOperationSetPresence.java @@ -187,17 +187,6 @@ public void testChangingStateToAway() throws Exception subtestStateTransition(JabberStatusEnum.AWAY); } - /** - * Verify that changing state to NOT_AVAILABLE 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 testChangingStateToNotAvailable() throws Exception - { - subtestStateTransition(JabberStatusEnum.EXTENDED_AWAY); - } - /** * Verify that changing state to DND works as supposed to and that it * generates the corresponding event. @@ -209,17 +198,6 @@ public void testChangingStateToDnd() throws Exception subtestStateTransition(JabberStatusEnum.DO_NOT_DISTURB); } - /** - * Verify that changing state to INVISIBLE 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 testChangingStateToInvisible() throws Exception - { - subtestStateTransition(JabberStatusEnum.INVISIBLE); - } - /** * Verify that changing state to FREE_FOR_CHAT works as supposed to and that it * generates the corresponding event. @@ -357,11 +335,6 @@ public void testQueryContactStatus() subtestQueryContactStatus(JabberStatusEnum.AWAY, JabberStatusEnum.AWAY); - // --- NA --- - logger.debug("Will Query an NA contact."); - subtestQueryContactStatus(JabberStatusEnum.EXTENDED_AWAY, - JabberStatusEnum.EXTENDED_AWAY); - // --- DND --- logger.debug("Will Query a DND contact."); subtestQueryContactStatus(JabberStatusEnum.DO_NOT_DISTURB, @@ -372,11 +345,6 @@ public void testQueryContactStatus() subtestQueryContactStatus(JabberStatusEnum.FREE_FOR_CHAT, JabberStatusEnum.FREE_FOR_CHAT); - // --- INVISIBLE --- - logger.debug("Will Query an Invisible contact."); - subtestQueryContactStatus(JabberStatusEnum.INVISIBLE, - JabberStatusEnum.INVISIBLE); - // --- Online --- logger.debug("Will Query an Online contact."); subtestQueryContactStatus(JabberStatusEnum.AVAILABLE,