diff --git a/src/net/java/sip/communicator/impl/protocol/dict/ProtocolProviderServiceDictImpl.java b/src/net/java/sip/communicator/impl/protocol/dict/ProtocolProviderServiceDictImpl.java index 35d507c21..93e9e210e 100644 --- a/src/net/java/sip/communicator/impl/protocol/dict/ProtocolProviderServiceDictImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/dict/ProtocolProviderServiceDictImpl.java @@ -100,25 +100,22 @@ protected void initialize(String userID, OperationSetPersistentPresenceDictImpl persistentPresence = new OperationSetPersistentPresenceDictImpl(this); - supportedOperationSets.put( - OperationSetPersistentPresence.class.getName(), + addSupportedOperationSet( + OperationSetPersistentPresence.class, persistentPresence); - - //register it once again for those that simply need presence and //won't be smart enough to check for a persistent presence //alternative - supportedOperationSets.put( OperationSetPresence.class.getName(), - persistentPresence); + addSupportedOperationSet( + OperationSetPresence.class, + persistentPresence); //initialize the IM operation set - OperationSetBasicInstantMessagingDictImpl basicInstantMessaging - = new OperationSetBasicInstantMessagingDictImpl( - this, persistentPresence); - - supportedOperationSets.put( - OperationSetBasicInstantMessaging.class.getName(), - basicInstantMessaging); + addSupportedOperationSet( + OperationSetBasicInstantMessaging.class, + new OperationSetBasicInstantMessagingDictImpl( + this, + persistentPresence)); //initialize the typing notifications operation set /*OperationSetTypingNotifications typingNotifications = @@ -132,7 +129,7 @@ protected void initialize(String userID, isInitialized = true; } } - + /** * Returns the DictConnection opened by this provider * @return the DictConnection opened by this provider diff --git a/src/net/java/sip/communicator/impl/protocol/facebook/ProtocolProviderServiceFacebookImpl.java b/src/net/java/sip/communicator/impl/protocol/facebook/ProtocolProviderServiceFacebookImpl.java index d04d4bd84..e8d86243e 100644 --- a/src/net/java/sip/communicator/impl/protocol/facebook/ProtocolProviderServiceFacebookImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/facebook/ProtocolProviderServiceFacebookImpl.java @@ -89,18 +89,15 @@ protected void initialize(String userID, AccountID accountID) OperationSetPersistentPresenceFacebookImpl persistentPresence = new OperationSetPersistentPresenceFacebookImpl(this); - supportedOperationSets - .put( - OperationSetPersistentPresence.class.getName(), - persistentPresence); - + addSupportedOperationSet( + OperationSetPersistentPresence.class, + persistentPresence); // register it once again for those that simply need presence and // won't be smart enough to check for a persistent presence // alternative - supportedOperationSets - .put( - OperationSetPresence.class.getName(), - persistentPresence); + addSupportedOperationSet( + OperationSetPresence.class, + persistentPresence); // initialize the IM operation set OperationSetBasicInstantMessagingFacebookImpl basicInstantMessaging @@ -108,32 +105,29 @@ protected void initialize(String userID, AccountID accountID) this, persistentPresence); - supportedOperationSets - .put( - OperationSetBasicInstantMessaging.class.getName(), - basicInstantMessaging); + addSupportedOperationSet( + OperationSetBasicInstantMessaging.class, + basicInstantMessaging); // initialize the message operation set - supportedOperationSets - .put( - OperationSetSmsMessaging.class.getName(), - new OperationSetSmsMessagingFacebookImpl( - this, - persistentPresence)); + addSupportedOperationSet( + OperationSetSmsMessaging.class, + new OperationSetSmsMessagingFacebookImpl( + this, + persistentPresence)); // initialize the typing notifications operation set OperationSetTypingNotificationsFacebookImpl typingNotifications = new OperationSetTypingNotificationsFacebookImpl(this); - supportedOperationSets - .put( - OperationSetTypingNotifications.class.getName(), - typingNotifications); + + addSupportedOperationSet( + OperationSetTypingNotifications.class, + typingNotifications); // initialize the server stored contact info operation set - supportedOperationSets - .put( - OperationSetServerStoredContactInfo.class.getName(), - new OperationSetServerStoredContactInfoFacebookImpl(this)); + addSupportedOperationSet( + OperationSetServerStoredContactInfo.class, + new OperationSetServerStoredContactInfoFacebookImpl(this)); facebookAdapter = new FacebookAdapter( diff --git a/src/net/java/sip/communicator/impl/protocol/gibberish/ProtocolProviderServiceGibberishImpl.java b/src/net/java/sip/communicator/impl/protocol/gibberish/ProtocolProviderServiceGibberishImpl.java index 05e4c7368..40cf85c91 100644 --- a/src/net/java/sip/communicator/impl/protocol/gibberish/ProtocolProviderServiceGibberishImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/gibberish/ProtocolProviderServiceGibberishImpl.java @@ -88,51 +88,46 @@ protected void initialize(String userID, OperationSetPersistentPresenceGibberishImpl persistentPresence = new OperationSetPersistentPresenceGibberishImpl(this); - supportedOperationSets.put( - OperationSetPersistentPresence.class.getName(), + addSupportedOperationSet( + OperationSetPersistentPresence.class, persistentPresence); - - //register it once again for those that simply need presence and //won't be smart enough to check for a persistent presence //alternative - supportedOperationSets.put( OperationSetPresence.class.getName(), - persistentPresence); + addSupportedOperationSet( + OperationSetPresence.class, + persistentPresence); //initialize the IM operation set - OperationSetBasicInstantMessagingGibberishImpl basicInstantMessaging - = new OperationSetBasicInstantMessagingGibberishImpl( - this, persistentPresence); - - supportedOperationSets.put( - OperationSetBasicInstantMessaging.class.getName(), - basicInstantMessaging); + addSupportedOperationSet( + OperationSetBasicInstantMessaging.class, + new OperationSetBasicInstantMessagingGibberishImpl( + this, + persistentPresence)); //initialize the typing notifications operation set - OperationSetTypingNotifications typingNotifications = + addSupportedOperationSet( + OperationSetTypingNotifications.class, new OperationSetTypingNotificationsGibberishImpl( - this, persistentPresence); - - supportedOperationSets.put( - OperationSetTypingNotifications.class.getName(), - typingNotifications); + this, + persistentPresence)); //initialize the basic telephony operation set OperationSetBasicTelephonyGibberishImpl telphonyOpSet = new OperationSetBasicTelephonyGibberishImpl(this); - this.supportedOperationSets.put( - OperationSetBasicTelephony.class.getName(), - telphonyOpSet); + addSupportedOperationSet( + OperationSetBasicTelephony.class, + telphonyOpSet); //initialize the telephony conferencing operation set OperationSetTelephonyConferencing conferenceOpSet = new OperationSetTelephonyConferencingGibberishImpl( this, telphonyOpSet); - this.supportedOperationSets.put( - OperationSetTelephonyConferencing.class.getName(), - conferenceOpSet); + addSupportedOperationSet( + OperationSetTelephonyConferencing.class, + conferenceOpSet); isInitialized = true; } diff --git a/src/net/java/sip/communicator/impl/protocol/icq/ProtocolProviderServiceIcqImpl.java b/src/net/java/sip/communicator/impl/protocol/icq/ProtocolProviderServiceIcqImpl.java index 3d1d51800..72c99c7b8 100644 --- a/src/net/java/sip/communicator/impl/protocol/icq/ProtocolProviderServiceIcqImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/icq/ProtocolProviderServiceIcqImpl.java @@ -455,91 +455,70 @@ protected void initialize(String screenname, if(IcqAccountID.isAIM(accountID.getAccountProperties())) USING_ICQ = false; - supportedOperationSets.put( - OperationSetInstantMessageTransform.class.getName(), + addSupportedOperationSet( + OperationSetInstantMessageTransform.class, new OperationSetInstantMessageTransformImpl()); //initialize the presence operationset OperationSetPersistentPresence persistentPresence = new OperationSetPersistentPresenceIcqImpl(this, screenname); - supportedOperationSets.put( - OperationSetPersistentPresence.class.getName(), + addSupportedOperationSet( + OperationSetPersistentPresence.class, persistentPresence); - //register it once again for those that simply need presence - supportedOperationSets.put( OperationSetPresence.class.getName(), - persistentPresence); + addSupportedOperationSet( + OperationSetPresence.class, + persistentPresence); //initialize the IM operation set - OperationSetBasicInstantMessaging basicInstantMessaging = - new OperationSetBasicInstantMessagingIcqImpl(this); - - supportedOperationSets.put( - OperationSetBasicInstantMessaging.class.getName(), - basicInstantMessaging); + addSupportedOperationSet( + OperationSetBasicInstantMessaging.class, + new OperationSetBasicInstantMessagingIcqImpl(this)); - //initialize the multi chat operation set - OperationSetAdHocMultiUserChatIcqImpl multiUserOpSet - = new OperationSetAdHocMultiUserChatIcqImpl(this); - - supportedOperationSets.put( - OperationSetAdHocMultiUserChat.class.getName(), - multiUserOpSet); + //initialize the multi chat operation set + addSupportedOperationSet( + OperationSetAdHocMultiUserChat.class, + new OperationSetAdHocMultiUserChatIcqImpl(this)); //initialize the typing notifications operation set - OperationSetTypingNotifications typingNotifications = - new OperationSetTypingNotificationsIcqImpl(this); - - supportedOperationSets.put( - OperationSetTypingNotifications.class.getName(), - typingNotifications); + addSupportedOperationSet( + OperationSetTypingNotifications.class, + new OperationSetTypingNotificationsIcqImpl(this)); if(USING_ICQ) { this.infoRetreiver = new InfoRetreiver(this, screenname); - OperationSetServerStoredContactInfo serverStoredContactInfo = - new OperationSetServerStoredContactInfoIcqImpl - (infoRetreiver, this); - - supportedOperationSets.put( - OperationSetServerStoredContactInfo.class.getName(), - serverStoredContactInfo); - - OperationSetServerStoredAccountInfo serverStoredAccountInfo = - new OperationSetServerStoredAccountInfoIcqImpl - (infoRetreiver, screenname, this); - - supportedOperationSets.put( - OperationSetServerStoredAccountInfo.class.getName(), - serverStoredAccountInfo); - - OperationSetWebAccountRegistration webAccountRegistration = - new OperationSetWebAccountRegistrationIcqImpl(); - supportedOperationSets.put( - OperationSetWebAccountRegistration.class.getName(), - webAccountRegistration); - - OperationSetWebContactInfo webContactInfo = - new OperationSetWebContactInfoIcqImpl(); - supportedOperationSets.put( - OperationSetWebContactInfo.class.getName(), - webContactInfo); - - OperationSetExtendedAuthorizationsIcqImpl extendedAuth = - new OperationSetExtendedAuthorizationsIcqImpl(this); - supportedOperationSets.put( - OperationSetExtendedAuthorizations.class.getName(), - extendedAuth); - + addSupportedOperationSet( + OperationSetServerStoredContactInfo.class, + new OperationSetServerStoredContactInfoIcqImpl( + infoRetreiver, + this)); + + addSupportedOperationSet( + OperationSetServerStoredAccountInfo.class, + new OperationSetServerStoredAccountInfoIcqImpl( + infoRetreiver, + screenname, + this)); + + addSupportedOperationSet( + OperationSetWebAccountRegistration.class, + new OperationSetWebAccountRegistrationIcqImpl()); + + addSupportedOperationSet( + OperationSetWebContactInfo.class, + new OperationSetWebContactInfoIcqImpl()); + + addSupportedOperationSet( + OperationSetExtendedAuthorizations.class, + new OperationSetExtendedAuthorizationsIcqImpl(this)); } - OperationSetFileTransferIcqImpl fileTransferOpSet - = new OperationSetFileTransferIcqImpl(this); - supportedOperationSets.put( - OperationSetFileTransfer.class.getName(), - fileTransferOpSet); + addSupportedOperationSet( + OperationSetFileTransfer.class, + new OperationSetFileTransferIcqImpl(this)); isInitialized = true; } diff --git a/src/net/java/sip/communicator/impl/protocol/irc/ProtocolProviderServiceIrcImpl.java b/src/net/java/sip/communicator/impl/protocol/irc/ProtocolProviderServiceIrcImpl.java index e618b69d7..86cd780ea 100644 --- a/src/net/java/sip/communicator/impl/protocol/irc/ProtocolProviderServiceIrcImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/irc/ProtocolProviderServiceIrcImpl.java @@ -88,14 +88,19 @@ protected void initialize(String userID, AccountID accountID) //Initialize the multi user chat support multiUserChat = new OperationSetMultiUserChatIrcImpl(this); - supportedOperationSets.put( - OperationSetMultiUserChat.class.getName(), multiUserChat); + addSupportedOperationSet( + OperationSetMultiUserChat.class, + multiUserChat); - this.ircStack = new IrcStack( this, - getAccountID().getUserID(), - getAccountID().getUserID(), - "SIP Communicator 1.0", - ""); + userID = getAccountID().getUserID(); + + ircStack + = new IrcStack( + this, + userID, + userID, + "SIP Communicator 1.0", + ""); isInitialized = true; } @@ -151,28 +156,21 @@ public void register(SecurityAuthority authority) throws OperationFailedException { AccountID accountID = getAccountID(); - - String serverAddress = - accountID - .getAccountPropertyString(ProtocolProviderFactory.SERVER_ADDRESS); - - String serverPort = - accountID - .getAccountPropertyString(ProtocolProviderFactory.SERVER_PORT); - - if(serverPort == null || serverPort.equals("")) - { - serverPort = "6667"; - } - + String serverAddress + = accountID + .getAccountPropertyString( + ProtocolProviderFactory.SERVER_ADDRESS); + int serverPort + = accountID + .getAccountPropertyInt( + ProtocolProviderFactory.SERVER_PORT, + 6667); //Verify whether a password has already been stored for this account String serverPassword = IrcActivator. getProtocolProviderFactory().loadPassword(getAccountID()); - boolean autoNickChange = accountID.getAccountPropertyBoolean( ProtocolProviderFactory.AUTO_CHANGE_USER_NAME, true); - boolean passwordRequired = accountID.getAccountPropertyBoolean( ProtocolProviderFactory.NO_PASSWORD_REQUIRED, true); @@ -215,7 +213,7 @@ public void register(SecurityAuthority authority) } this.ircStack.connect( serverAddress, - Integer.parseInt(serverPort), + serverPort, serverPassword, autoNickChange); } 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 99b5879a6..f968ccf92 100644 --- a/src/net/java/sip/communicator/impl/protocol/jabber/ProtocolProviderServiceJabberImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/jabber/ProtocolProviderServiceJabberImpl.java @@ -567,16 +567,17 @@ protected void initialize(String screenname, "http://www.xmpp.org/extensions/xep-0168.html#ns"); } - supportedOperationSets.put( - OperationSetPersistentPresence.class.getName(), + addSupportedOperationSet( + OperationSetPersistentPresence.class, persistentPresence); // TODO: add the feature, if any, corresponding to persistent // presence, if someone knows // supportedFeatures.add(_PRESENCE_); //register it once again for those that simply need presence - supportedOperationSets.put( OperationSetPresence.class.getName(), - persistentPresence); + addSupportedOperationSet( + OperationSetPresence.class, + persistentPresence); //initialize the IM operation set OperationSetBasicInstantMessagingJabberImpl basicInstantMessaging = @@ -586,70 +587,53 @@ protected void initialize(String screenname, basicInstantMessaging.setKeepAliveEnabled(Boolean .parseBoolean(keepAliveStrValue)); - supportedOperationSets.put( - OperationSetBasicInstantMessaging.class.getName(), + addSupportedOperationSet( + OperationSetBasicInstantMessaging.class, basicInstantMessaging); // The http://jabber.org/protocol/xhtml-im feature is included // already in smack. //initialize the Whiteboard operation set - OperationSetWhiteboardingJabberImpl whiteboard = - new OperationSetWhiteboardingJabberImpl (this); - - supportedOperationSets.put ( - OperationSetWhiteboarding.class.getName(), whiteboard); + addSupportedOperationSet( + OperationSetWhiteboarding.class, + new OperationSetWhiteboardingJabberImpl(this)); //initialize the typing notifications operation set - OperationSetTypingNotifications typingNotifications = - new OperationSetTypingNotificationsJabberImpl(this); - - supportedOperationSets.put( - OperationSetTypingNotifications.class.getName(), - typingNotifications); + addSupportedOperationSet( + OperationSetTypingNotifications.class, + new OperationSetTypingNotificationsJabberImpl(this)); // The http://jabber.org/protocol/chatstates feature implemented in // OperationSetTypingNotifications is included already in smack. //initialize the multi user chat operation set - OperationSetMultiUserChat multiUserChat = - new OperationSetMultiUserChatJabberImpl(this); - - supportedOperationSets.put( - OperationSetMultiUserChat.class.getName(), - multiUserChat); + addSupportedOperationSet( + OperationSetMultiUserChat.class, + new OperationSetMultiUserChatJabberImpl(this)); InfoRetreiver infoRetreiver = new InfoRetreiver(this, screenname); - OperationSetServerStoredContactInfo contactInfo = - new OperationSetServerStoredContactInfoJabberImpl(infoRetreiver); - - supportedOperationSets.put( - OperationSetServerStoredContactInfo.class.getName(), - contactInfo); + addSupportedOperationSet( + OperationSetServerStoredContactInfo.class, + new OperationSetServerStoredContactInfoJabberImpl( + infoRetreiver)); - OperationSetServerStoredAccountInfo accountInfo = + addSupportedOperationSet( + OperationSetServerStoredAccountInfo.class, new OperationSetServerStoredAccountInfoJabberImpl( - this, infoRetreiver, screenname); - - supportedOperationSets.put( - OperationSetServerStoredAccountInfo.class.getName(), - accountInfo); + this, + infoRetreiver, + screenname)); // initialize the file transfer operation set - OperationSetFileTransfer fileTransfer - = new OperationSetFileTransferJabberImpl(this); - - supportedOperationSets.put( - OperationSetFileTransfer.class.getName(), - fileTransfer); - - OperationSetInstantMessageTransform messageTransform - = new OperationSetInstantMessageTransformImpl(); + addSupportedOperationSet( + OperationSetFileTransfer.class, + new OperationSetFileTransferJabberImpl(this)); - supportedOperationSets.put( - OperationSetInstantMessageTransform.class.getName(), - messageTransform); + addSupportedOperationSet( + OperationSetInstantMessageTransform.class, + new OperationSetInstantMessageTransformImpl()); // Include features we're supporting in plus of the four that // included by smack itself: @@ -661,12 +645,9 @@ protected void initialize(String screenname, supportedFeatures.add("urn:xmpp:bob"); // initialize the thumbnailed file factory operation set - OperationSetThumbnailedFileFactory thumbnailFactory - = new OperationSetThumbnailedFileFactoryImpl(); - - supportedOperationSets.put( - OperationSetThumbnailedFileFactory.class.getName(), - thumbnailFactory); + addSupportedOperationSet( + OperationSetThumbnailedFileFactory.class, + new OperationSetThumbnailedFileFactoryImpl()); // TODO: this is the "main" feature to advertise when a client // support muc. We have to add some features for @@ -681,17 +662,15 @@ protected void initialize(String screenname, //check if we are supposed to start telephony //initialize the telephony opset - String enableJingle = (String)JabberActivator - .getConfigurationService().getProperty(PNAME_ENABLE_JINGLE); - if( Boolean.getBoolean(enableJingle) - && JabberActivator.getMediaService() != null) + boolean enableJingle + = JabberActivator + .getConfigurationService() + .getBoolean(PNAME_ENABLE_JINGLE, false); + if(enableJingle && JabberActivator.getMediaService() != null) { - OperationSetBasicTelephony opSetBasicTelephony - = new OperationSetBasicTelephonyJabberImpl(this); - - supportedOperationSets.put( - OperationSetBasicTelephony.class.getName(), - opSetBasicTelephony); + addSupportedOperationSet( + OperationSetBasicTelephony.class, + new OperationSetBasicTelephonyJabberImpl(this)); // Add Jingle features to supported features. supportedFeatures.add("urn:xmpp:jingle:1"); diff --git a/src/net/java/sip/communicator/impl/protocol/rss/ProtocolProviderServiceRssImpl.java b/src/net/java/sip/communicator/impl/protocol/rss/ProtocolProviderServiceRssImpl.java index 4027e12ab..46ffb208f 100644 --- a/src/net/java/sip/communicator/impl/protocol/rss/ProtocolProviderServiceRssImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/rss/ProtocolProviderServiceRssImpl.java @@ -92,25 +92,24 @@ protected void initialize(String userID, OperationSetPersistentPresenceRssImpl persistentPresence = new OperationSetPersistentPresenceRssImpl(this); - supportedOperationSets.put( - OperationSetPersistentPresence.class.getName(), + addSupportedOperationSet( + OperationSetPersistentPresence.class, persistentPresence); - - //register it once again for those that simply need presence and //won't be smart enough to check for a persistent presence //alternative - supportedOperationSets.put( OperationSetPresence.class.getName(), - persistentPresence); + addSupportedOperationSet( + OperationSetPresence.class, + persistentPresence); //initialize the IM operation set //OperationSetBasicInstantMessagingRssImpl - basicInstantMessaging + basicInstantMessaging = new OperationSetBasicInstantMessagingRssImpl( - this, persistentPresence); - - supportedOperationSets.put( - OperationSetBasicInstantMessaging.class.getName(), + this, + persistentPresence); + addSupportedOperationSet( + OperationSetBasicInstantMessaging.class, basicInstantMessaging); isInitialized = true; diff --git a/src/net/java/sip/communicator/impl/protocol/sip/ProtocolProviderServiceSipImpl.java b/src/net/java/sip/communicator/impl/protocol/sip/ProtocolProviderServiceSipImpl.java index bc7a3d111..1f328c1ea 100644 --- a/src/net/java/sip/communicator/impl/protocol/sip/ProtocolProviderServiceSipImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/sip/ProtocolProviderServiceSipImpl.java @@ -425,60 +425,63 @@ protected void initialize(String sipAddress, //init our call processor OperationSetBasicTelephonySipImpl opSetBasicTelephonySipImpl = new OperationSetBasicTelephonySipImpl(this); - this.supportedOperationSets.put( - OperationSetBasicTelephony.class.getName() - , opSetBasicTelephonySipImpl); - this.supportedOperationSets.put( - OperationSetAdvancedTelephony.class.getName() - , opSetBasicTelephonySipImpl); + addSupportedOperationSet( + OperationSetBasicTelephony.class, + opSetBasicTelephonySipImpl); + addSupportedOperationSet( + OperationSetAdvancedTelephony.class, + opSetBasicTelephonySipImpl); // init ZRTP (OperationSetBasicTelephonySipImpl implements // OperationSetSecureTelephony) - this.supportedOperationSets.put( - OperationSetSecureTelephony.class.getName() - , opSetBasicTelephonySipImpl); + addSupportedOperationSet( + OperationSetSecureTelephony.class, + opSetBasicTelephonySipImpl); //init presence op set. OperationSetPersistentPresence opSetPersPresence = new OperationSetPresenceSipImpl(this, enablePresence, forceP2P, pollingValue, subscriptionExpiration); - this.supportedOperationSets.put( - OperationSetPersistentPresence.class.getName() - , opSetPersPresence); + + addSupportedOperationSet( + OperationSetPersistentPresence.class, + opSetPersPresence); //also register with standard presence - this.supportedOperationSets.put( - OperationSetPresence.class.getName() - , opSetPersPresence); + addSupportedOperationSet( + OperationSetPresence.class, + opSetPersPresence); if (enablePresence) { // init instant messaging OperationSetBasicInstantMessagingSipImpl opSetBasicIM = new OperationSetBasicInstantMessagingSipImpl(this); - this.supportedOperationSets.put( - OperationSetBasicInstantMessaging.class.getName(), + + addSupportedOperationSet( + OperationSetBasicInstantMessaging.class, opSetBasicIM); // init typing notifications - OperationSetTypingNotificationsSipImpl opSetTyping = - new OperationSetTypingNotificationsSipImpl(this, opSetBasicIM); - this.supportedOperationSets.put( - OperationSetTypingNotifications.class.getName(), - opSetTyping); + addSupportedOperationSet( + OperationSetTypingNotifications.class, + new OperationSetTypingNotificationsSipImpl( + this, + opSetBasicIM)); } // OperationSetVideoTelephony - supportedOperationSets.put( - OperationSetVideoTelephony.class.getName(), - new OperationSetVideoTelephonySipImpl(opSetBasicTelephonySipImpl)); + addSupportedOperationSet( + OperationSetVideoTelephony.class, + new OperationSetVideoTelephonySipImpl( + opSetBasicTelephonySipImpl)); // init DTMF (from JM Heitz) - supportedOperationSets.put( - OperationSetDTMF.class.getName(), + addSupportedOperationSet( + OperationSetDTMF.class, new OperationSetDTMFSipImpl(this)); - supportedOperationSets.put( - OperationSetTelephonyConferencing.class.getName(), + addSupportedOperationSet( + OperationSetTelephonyConferencing.class, new OperationSetTelephonyConferencingSipImpl(this)); //initialize our OPTIONS handler diff --git a/src/net/java/sip/communicator/impl/protocol/ssh/ProtocolProviderServiceSSHImpl.java b/src/net/java/sip/communicator/impl/protocol/ssh/ProtocolProviderServiceSSHImpl.java index f4934241a..10b135456 100644 --- a/src/net/java/sip/communicator/impl/protocol/ssh/ProtocolProviderServiceSSHImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/ssh/ProtocolProviderServiceSSHImpl.java @@ -144,33 +144,29 @@ protected void initialize( OperationSetPersistentPresenceSSHImpl persistentPresence = new OperationSetPersistentPresenceSSHImpl(this); - supportedOperationSets.put( - OperationSetPersistentPresence.class.getName(), - persistentPresence); - + addSupportedOperationSet( + OperationSetPersistentPresence.class, + persistentPresence); //register it once again for those that simply need presence and //won't be smart enough to check for a persistent presence //alternative - supportedOperationSets.put( - OperationSetPresence.class.getName(), - persistentPresence); + addSupportedOperationSet( + OperationSetPresence.class, + persistentPresence); //initialize the IM operation set basicInstantMessaging = new OperationSetBasicInstantMessagingSSHImpl( this); - - supportedOperationSets.put( - OperationSetBasicInstantMessaging.class.getName(), - basicInstantMessaging); + addSupportedOperationSet( + OperationSetBasicInstantMessaging.class, + basicInstantMessaging); //initialze the file transfer operation set - fileTranfer = new OperationSetFileTransferSSHImpl( - this); - - supportedOperationSets.put( - OperationSetFileTransfer.class.getName(), - fileTranfer); + fileTranfer = new OperationSetFileTransferSSHImpl(this); + addSupportedOperationSet( + OperationSetFileTransfer.class, + fileTranfer); isInitialized = true; } diff --git a/src/net/java/sip/communicator/impl/protocol/yahoo/ProtocolProviderServiceYahooImpl.java b/src/net/java/sip/communicator/impl/protocol/yahoo/ProtocolProviderServiceYahooImpl.java index 519828c3b..572d327e7 100644 --- a/src/net/java/sip/communicator/impl/protocol/yahoo/ProtocolProviderServiceYahooImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/yahoo/ProtocolProviderServiceYahooImpl.java @@ -318,50 +318,41 @@ protected void initialize(String screenname, { this.accountID = accountID; - supportedOperationSets.put( - OperationSetInstantMessageTransform.class.getName(), + addSupportedOperationSet( + OperationSetInstantMessageTransform.class, new OperationSetInstantMessageTransformImpl()); //initialize the presence operationset - persistentPresence = new OperationSetPersistentPresenceYahooImpl(this); - - supportedOperationSets.put( - OperationSetPersistentPresence.class.getName(), + persistentPresence + = new OperationSetPersistentPresenceYahooImpl(this); + addSupportedOperationSet( + OperationSetPersistentPresence.class, persistentPresence); - //register it once again for those that simply need presence - supportedOperationSets.put( OperationSetPresence.class.getName(), - persistentPresence); + addSupportedOperationSet( + OperationSetPresence.class, + persistentPresence); //initialize the IM operation set - OperationSetBasicInstantMessagingYahooImpl basicInstantMessaging = - new OperationSetBasicInstantMessagingYahooImpl(this); - - supportedOperationSets.put( - OperationSetBasicInstantMessaging.class.getName(), - basicInstantMessaging); + addSupportedOperationSet( + OperationSetBasicInstantMessaging.class, + new OperationSetBasicInstantMessagingYahooImpl(this)); - //initialize the multi user chat operation set - OperationSetAdHocMultiUserChatYahooImpl multiUserChatOpSet = - new OperationSetAdHocMultiUserChatYahooImpl(this); - - supportedOperationSets.put( - OperationSetAdHocMultiUserChat.class.getName(), - multiUserChatOpSet); + //initialize the multi user chat operation set + addSupportedOperationSet( + OperationSetAdHocMultiUserChat.class, + new OperationSetAdHocMultiUserChatYahooImpl(this)); //initialize the typing notifications operation set - typingNotifications = - new OperationSetTypingNotificationsYahooImpl(this); - - supportedOperationSets.put( - OperationSetTypingNotifications.class.getName(), + typingNotifications + = new OperationSetTypingNotificationsYahooImpl(this); + addSupportedOperationSet( + OperationSetTypingNotifications.class, typingNotifications); - OperationSetFileTransferYahooImpl fileTransferOpSet = - new OperationSetFileTransferYahooImpl(this); - - supportedOperationSets.put(OperationSetFileTransfer.class.getName(), - fileTransferOpSet); + addSupportedOperationSet( + OperationSetFileTransfer.class, + new OperationSetFileTransferYahooImpl(this)); isInitialized = true; } diff --git a/src/net/java/sip/communicator/impl/protocol/zeroconf/ProtocolProviderServiceZeroconfImpl.java b/src/net/java/sip/communicator/impl/protocol/zeroconf/ProtocolProviderServiceZeroconfImpl.java index 80f9e5449..fba8b40bc 100644 --- a/src/net/java/sip/communicator/impl/protocol/zeroconf/ProtocolProviderServiceZeroconfImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/zeroconf/ProtocolProviderServiceZeroconfImpl.java @@ -112,29 +112,26 @@ protected void initialize(String userID, OperationSetPersistentPresenceZeroconfImpl persistentPresence = new OperationSetPersistentPresenceZeroconfImpl(this); - supportedOperationSets.put( - OperationSetPersistentPresence.class.getName(), + addSupportedOperationSet( + OperationSetPersistentPresence.class, persistentPresence); - - //register it once again for those that simply need presence and //won't be smart enough to check for a persistent presence //alternative - supportedOperationSets.put( OperationSetPresence.class.getName(), - persistentPresence); + addSupportedOperationSet( + OperationSetPresence.class, + persistentPresence); //initialize the IM operation set - OperationSetBasicInstantMessagingZeroconfImpl basicInstantMessaging - = new OperationSetBasicInstantMessagingZeroconfImpl( - this, persistentPresence); - - supportedOperationSets.put( - OperationSetBasicInstantMessaging.class.getName(), - basicInstantMessaging); + addSupportedOperationSet( + OperationSetBasicInstantMessaging.class, + new OperationSetBasicInstantMessagingZeroconfImpl( + this, + persistentPresence)); //initialize the typing notifications operation set - supportedOperationSets.put( - OperationSetTypingNotifications.class.getName(), + addSupportedOperationSet( + OperationSetTypingNotifications.class, new OperationSetTypingNotificationsZeroconfImpl(this)); isInitialized = true; diff --git a/src/net/java/sip/communicator/service/protocol/AbstractProtocolProviderService.java b/src/net/java/sip/communicator/service/protocol/AbstractProtocolProviderService.java index c8d6fb5e4..8f4e2b017 100644 --- a/src/net/java/sip/communicator/service/protocol/AbstractProtocolProviderService.java +++ b/src/net/java/sip/communicator/service/protocol/AbstractProtocolProviderService.java @@ -21,8 +21,11 @@ public abstract class AbstractProtocolProviderService implements ProtocolProviderService { + /** - * Logger of this class + * The Logger instances used by the + * AbstractProtocolProviderService class and its instances for + * logging output. */ private static final Logger logger = Logger.getLogger(AbstractProtocolProviderService.class); @@ -37,7 +40,7 @@ public abstract class AbstractProtocolProviderService /** * The hashtable with the operation sets that we support locally. */ - protected final Map supportedOperationSets + private final Map supportedOperationSets = new Hashtable(); /** @@ -60,9 +63,9 @@ public void addRegistrationStateChangeListener( /** * Adds a specific OperationSet implementation to the set of * supported OperationSets of this instance. Serves as a type-safe - * wrapper around {@link #supportedOperationSets} and its - * {@link Hashtable#put(String, OperationSet)} and also shortens the code - * which performs such additions. + * wrapper around {@link #supportedOperationSets} which works with class + * names instead of Class and also shortens the code which performs + * such additions. * * @param the exact type of the OperationSet implementation to * be added @@ -146,11 +149,13 @@ public void fireRegistrationStateChanged( RegistrationState oldState, /** * Returns the operation set corresponding to the specified class or null if * this operation set is not supported by the provider implementation. - * + * + * @param the exact type of the OperationSet that we're looking + * for * @param opsetClass the Class of the operation set that we're * looking for. * @return returns an OperationSet of the specified Class - * if the undelying implementation supports it; null, otherwise. + * if the underlying implementation supports it; null, otherwise. */ @SuppressWarnings("unchecked") public T getOperationSet(Class opsetClass)