Uses AbstractProtocolProviderService#addSupportedOperationSet in its extenders because it's type-safe and shortens the code.

cusax-fix
Lyubomir Marinov 17 years ago
parent 7277bf34b9
commit 4268a877c9

@ -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 <tt>DictConnection</tt> opened by this provider
* @return the <tt>DictConnection</tt> opened by this provider

@ -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(

@ -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;
}

@ -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;
}

@ -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);
}

@ -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");

@ -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;

@ -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

@ -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;
}

@ -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;
}

@ -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;

@ -21,8 +21,11 @@
public abstract class AbstractProtocolProviderService
implements ProtocolProviderService
{
/**
* Logger of this class
* The <tt>Logger</tt> instances used by the
* <tt>AbstractProtocolProviderService</tt> 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<String, OperationSet> supportedOperationSets
private final Map<String, OperationSet> supportedOperationSets
= new Hashtable<String, OperationSet>();
/**
@ -60,9 +63,9 @@ public void addRegistrationStateChangeListener(
/**
* Adds a specific <tt>OperationSet</tt> implementation to the set of
* supported <tt>OperationSet</tt>s 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 <tt>Class</tt> and also shortens the code which performs
* such additions.
*
* @param <T> the exact type of the <tt>OperationSet</tt> 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 <T> the exact type of the <tt>OperationSet</tt> that we're looking
* for
* @param opsetClass the <tt>Class</tt> of the operation set that we're
* looking for.
* @return returns an <tt>OperationSet</tt> of the specified <tt>Class</tt>
* if the undelying implementation supports it; <tt>null</tt>, otherwise.
* if the underlying implementation supports it; <tt>null</tt>, otherwise.
*/
@SuppressWarnings("unchecked")
public <T extends OperationSet> T getOperationSet(Class<T> opsetClass)

Loading…
Cancel
Save