|
|
|
@ -15,10 +15,16 @@
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @author Loic Kempf
|
|
|
|
* @author Loic Kempf
|
|
|
|
* @author Stephane Remy
|
|
|
|
* @author Stephane Remy
|
|
|
|
|
|
|
|
* @author Danny van Heumen
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public class ProtocolProviderServiceIrcImpl
|
|
|
|
public class ProtocolProviderServiceIrcImpl
|
|
|
|
extends AbstractProtocolProviderService
|
|
|
|
extends AbstractProtocolProviderService
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* The default secure IRC server port.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
private static final int DEFAULT_SECURE_IRC_PORT = 6697;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Logger.
|
|
|
|
* Logger.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@ -77,8 +83,10 @@ public class ProtocolProviderServiceIrcImpl
|
|
|
|
public ProtocolProviderServiceIrcImpl()
|
|
|
|
public ProtocolProviderServiceIrcImpl()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (LOGGER.isTraceEnabled())
|
|
|
|
if (LOGGER.isTraceEnabled())
|
|
|
|
|
|
|
|
{
|
|
|
|
LOGGER.trace("Creating a irc provider.");
|
|
|
|
LOGGER.trace("Creating a irc provider.");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Initializes the service implementation, and puts it in a sate where it
|
|
|
|
* Initializes the service implementation, and puts it in a sate where it
|
|
|
|
@ -93,9 +101,9 @@ public ProtocolProviderServiceIrcImpl()
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @see net.java.sip.communicator.service.protocol.AccountID
|
|
|
|
* @see net.java.sip.communicator.service.protocol.AccountID
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
protected void initialize(String userID, AccountID accountID)
|
|
|
|
protected void initialize(final String userID, final AccountID accountID)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
synchronized(initializationLock)
|
|
|
|
synchronized (initializationLock)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
this.accountID = accountID;
|
|
|
|
this.accountID = accountID;
|
|
|
|
|
|
|
|
|
|
|
|
@ -123,15 +131,15 @@ protected void initialize(String userID, AccountID accountID)
|
|
|
|
// TODO Implement OperationSetServerStoredAccountInfo so we can
|
|
|
|
// TODO Implement OperationSetServerStoredAccountInfo so we can
|
|
|
|
// suggest a display name to use when adding new chat rooms?
|
|
|
|
// suggest a display name to use when adding new chat rooms?
|
|
|
|
|
|
|
|
|
|
|
|
userID = getAccountID().getUserID();
|
|
|
|
final String user = getAccountID().getUserID();
|
|
|
|
|
|
|
|
|
|
|
|
ircStack
|
|
|
|
ircStack
|
|
|
|
= new IrcStack(
|
|
|
|
= new IrcStack(
|
|
|
|
this,
|
|
|
|
this,
|
|
|
|
userID,
|
|
|
|
user,
|
|
|
|
userID,
|
|
|
|
user,
|
|
|
|
"Jitsi",
|
|
|
|
"Jitsi",
|
|
|
|
userID);
|
|
|
|
user);
|
|
|
|
|
|
|
|
|
|
|
|
isInitialized = true;
|
|
|
|
isInitialized = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -203,7 +211,6 @@ public RegistrationState getRegistrationState()
|
|
|
|
return currentRegistrationState;
|
|
|
|
return currentRegistrationState;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Starts the registration process.
|
|
|
|
* Starts the registration process.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
@ -214,7 +221,7 @@ public RegistrationState getRegistrationState()
|
|
|
|
* registration fails for some reason (e.g. a networking error or an
|
|
|
|
* registration fails for some reason (e.g. a networking error or an
|
|
|
|
* implementation problem).
|
|
|
|
* implementation problem).
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public void register(SecurityAuthority authority)
|
|
|
|
public void register(final SecurityAuthority authority)
|
|
|
|
throws OperationFailedException
|
|
|
|
throws OperationFailedException
|
|
|
|
{
|
|
|
|
{
|
|
|
|
AccountID accountID = getAccountID();
|
|
|
|
AccountID accountID = getAccountID();
|
|
|
|
@ -226,7 +233,7 @@ public void register(SecurityAuthority authority)
|
|
|
|
= accountID
|
|
|
|
= accountID
|
|
|
|
.getAccountPropertyInt(
|
|
|
|
.getAccountPropertyInt(
|
|
|
|
ProtocolProviderFactory.SERVER_PORT,
|
|
|
|
ProtocolProviderFactory.SERVER_PORT,
|
|
|
|
6697);
|
|
|
|
DEFAULT_SECURE_IRC_PORT);
|
|
|
|
//Verify whether a password has already been stored for this account
|
|
|
|
//Verify whether a password has already been stored for this account
|
|
|
|
String serverPassword = IrcActivator.
|
|
|
|
String serverPassword = IrcActivator.
|
|
|
|
getProtocolProviderFactory().loadPassword(getAccountID());
|
|
|
|
getProtocolProviderFactory().loadPassword(getAccountID());
|
|
|
|
@ -299,19 +306,21 @@ public void register(SecurityAuthority authority)
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public void shutdown()
|
|
|
|
public void shutdown()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if(!isInitialized)
|
|
|
|
if (!isInitialized)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (LOGGER.isTraceEnabled())
|
|
|
|
if (LOGGER.isTraceEnabled())
|
|
|
|
|
|
|
|
{
|
|
|
|
LOGGER.trace("Killing the Irc Protocol Provider.");
|
|
|
|
LOGGER.trace("Killing the Irc Protocol Provider.");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if(isRegistered())
|
|
|
|
if (isRegistered())
|
|
|
|
{
|
|
|
|
{
|
|
|
|
try
|
|
|
|
try
|
|
|
|
{
|
|
|
|
{
|
|
|
|
//do the un-registration
|
|
|
|
//do the un-registration
|
|
|
|
synchronized(this.initializationLock)
|
|
|
|
synchronized (this.initializationLock)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
unregister();
|
|
|
|
unregister();
|
|
|
|
this.ircStack.dispose();
|
|
|
|
this.ircStack.dispose();
|
|
|
|
@ -344,18 +353,23 @@ public void unregister()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
for (ChatRoom joinedChatRoom
|
|
|
|
for (ChatRoom joinedChatRoom
|
|
|
|
: multiUserChat.getCurrentlyJoinedChatRooms())
|
|
|
|
: multiUserChat.getCurrentlyJoinedChatRooms())
|
|
|
|
|
|
|
|
{
|
|
|
|
joinedChatRoom.leave();
|
|
|
|
joinedChatRoom.leave();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (ircStack.isConnected())
|
|
|
|
if (ircStack.isConnected())
|
|
|
|
|
|
|
|
{
|
|
|
|
ircStack.disconnect();
|
|
|
|
ircStack.disconnect();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
/**
|
|
|
|
* (non-Javadoc)
|
|
|
|
* {@inheritDoc}
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @see net.java.sip.communicator.service.protocol.ProtocolProviderService#
|
|
|
|
* @return returns true in case of secure transport, or false if transport
|
|
|
|
* isSignallingTransportSecure()
|
|
|
|
* is not secure
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean isSignalingTransportSecure()
|
|
|
|
public boolean isSignalingTransportSecure()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return this.ircStack.isSecureConnection();
|
|
|
|
return this.ircStack.isSecureConnection();
|
|
|
|
@ -408,9 +422,9 @@ protected RegistrationState getCurrentRegistrationState()
|
|
|
|
* @param regState the new registration state to set
|
|
|
|
* @param regState the new registration state to set
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
protected void setCurrentRegistrationState(
|
|
|
|
protected void setCurrentRegistrationState(
|
|
|
|
RegistrationState regState)
|
|
|
|
final RegistrationState regState)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
RegistrationState oldState = this.currentRegistrationState;
|
|
|
|
final RegistrationState oldState = this.currentRegistrationState;
|
|
|
|
|
|
|
|
|
|
|
|
this.currentRegistrationState = regState;
|
|
|
|
this.currentRegistrationState = regState;
|
|
|
|
|
|
|
|
|
|
|
|
|