Jitsi: the OpenSource Java VoIP and Instant Messaging client.

net.java.sip.communicator.plugin.otr
Class ScOtrEngineImpl

java.lang.Object
  extended by net.java.sip.communicator.plugin.otr.ScOtrEngineImpl
All Implemented Interfaces:
ScOtrEngine, ChatLinkClickedListener

public class ScOtrEngineImpl
extends Object
implements ScOtrEngine, ChatLinkClickedListener

Author:
George Politis

Nested Class Summary
(package private)  class ScOtrEngineImpl.ScOtrEngineHost
           
 
Constructor Summary
ScOtrEngineImpl()
           
 
Method Summary
 void addListener(ScOtrEngineListener l)
          Registers an ScOtrEngineListener.
 void chatLinkClicked(URI url)
          Callback that is executed when a link was clicked.
 void endSession(Contact contact)
          Ends the Off-the-Record session for the given Contact, if it is not already started.
static Contact getContact(net.java.otr4j.session.SessionID sessionID)
           
 net.java.otr4j.OtrPolicy getContactPolicy(Contact contact)
          Gets a Contact specific policy.
 net.java.otr4j.OtrPolicy getGlobalPolicy()
          Gets the global OtrPolicy.
static net.java.otr4j.session.SessionID getSessionID(Contact contact)
           
 net.java.otr4j.session.SessionStatus getSessionStatus(Contact contact)
          Gets the SessionStatus for the given Contact.
 boolean isMessageUIDInjected(String mUID)
          Gets weather the passed in messageUID is injected by the engine or not.
 void launchHelp()
          Launches the help page.
 void refreshSession(Contact contact)
          Refreshes the Off-the-Record session for the given Contact.
 void removeListener(ScOtrEngineListener l)
          Unregisters an ScOtrEngineListener.
 void setContactPolicy(Contact contact, net.java.otr4j.OtrPolicy policy)
          Sets the contact specific policy
 void setGlobalPolicy(net.java.otr4j.OtrPolicy policy)
          Sets the global policy.
 void showError(net.java.otr4j.session.SessionID sessionID, String err)
           
 void startSession(Contact contact)
          Starts the Off-the-Record session for the given Contact, if it's not already started.
 String transformReceiving(Contact contact, String msgText)
          Transforms an incoming message.
 String transformSending(Contact contact, String msgText)
          Transforms an outgoing message.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ScOtrEngineImpl

public ScOtrEngineImpl()
Method Detail

addListener

public void addListener(ScOtrEngineListener l)
Description copied from interface: ScOtrEngine
Registers an ScOtrEngineListener.

Specified by:
addListener in interface ScOtrEngine
Parameters:
l - the ScOtrEngineListener to register.

removeListener

public void removeListener(ScOtrEngineListener l)
Description copied from interface: ScOtrEngine
Unregisters an ScOtrEngineListener.

Specified by:
removeListener in interface ScOtrEngine
Parameters:
l - the ScOtrEngineListener to unregister.

isMessageUIDInjected

public boolean isMessageUIDInjected(String mUID)
Description copied from interface: ScOtrEngine
Gets weather the passed in messageUID is injected by the engine or not. If it is injected, it shouldn't be re-transformed.

Specified by:
isMessageUIDInjected in interface ScOtrEngine
Parameters:
mUID - the messageUID which is to be determined whether it is injected by the engine or not
Returns:
true if the passed in messageUID is injected by the engine; false, otherwise

showError

public void showError(net.java.otr4j.session.SessionID sessionID,
                      String err)

getSessionID

public static net.java.otr4j.session.SessionID getSessionID(Contact contact)

getContact

public static Contact getContact(net.java.otr4j.session.SessionID sessionID)

endSession

public void endSession(Contact contact)
Description copied from interface: ScOtrEngine
Ends the Off-the-Record session for the given Contact, if it is not already started.

Specified by:
endSession in interface ScOtrEngine
Parameters:
contact - the Contact with whom we want to end the OTR session.

getSessionStatus

public net.java.otr4j.session.SessionStatus getSessionStatus(Contact contact)
Description copied from interface: ScOtrEngine
Gets the SessionStatus for the given Contact.

Specified by:
getSessionStatus in interface ScOtrEngine
Parameters:
contact - the Contact whose SessionStatus we are interested in.
Returns:
the SessionStatus.

transformReceiving

public String transformReceiving(Contact contact,
                                 String msgText)
Description copied from interface: ScOtrEngine
Transforms an incoming message.

Specified by:
transformReceiving in interface ScOtrEngine
Parameters:
contact - the source Contact.
msgText - the original message content.
Returns:
the transformed message content.

transformSending

public String transformSending(Contact contact,
                               String msgText)
Description copied from interface: ScOtrEngine
Transforms an outgoing message.

Specified by:
transformSending in interface ScOtrEngine
Parameters:
contact - the destination Contact.
msgText - the original message content.
Returns:
the transformed message content.

refreshSession

public void refreshSession(Contact contact)
Description copied from interface: ScOtrEngine
Refreshes the Off-the-Record session for the given Contact. If the session does not exist, a new session is established.

Specified by:
refreshSession in interface ScOtrEngine
Parameters:
contact - the Contact with whom we want to refresh the OTR session.

startSession

public void startSession(Contact contact)
Description copied from interface: ScOtrEngine
Starts the Off-the-Record session for the given Contact, if it's not already started.

Specified by:
startSession in interface ScOtrEngine
Parameters:
contact - the Contact with whom we want to start an OTR session.

getGlobalPolicy

public net.java.otr4j.OtrPolicy getGlobalPolicy()
Description copied from interface: ScOtrEngine
Gets the global OtrPolicy.

Specified by:
getGlobalPolicy in interface ScOtrEngine
Returns:
the global OtrPolicy

setGlobalPolicy

public void setGlobalPolicy(net.java.otr4j.OtrPolicy policy)
Description copied from interface: ScOtrEngine
Sets the global policy.

Specified by:
setGlobalPolicy in interface ScOtrEngine
Parameters:
policy - the global policy

launchHelp

public void launchHelp()
Description copied from interface: ScOtrEngine
Launches the help page.

Specified by:
launchHelp in interface ScOtrEngine

getContactPolicy

public net.java.otr4j.OtrPolicy getContactPolicy(Contact contact)
Description copied from interface: ScOtrEngine
Gets a Contact specific policy.

Specified by:
getContactPolicy in interface ScOtrEngine
Parameters:
contact - the Contact whose policy we want.
Returns:
The Contact specific OTR policy. If the specified Contact has no policy, the global policy is returned.

setContactPolicy

public void setContactPolicy(Contact contact,
                             net.java.otr4j.OtrPolicy policy)
Description copied from interface: ScOtrEngine
Sets the contact specific policy

Specified by:
setContactPolicy in interface ScOtrEngine
Parameters:
contact - the Contact whose policy we want to set
policy - the OtrPolicy

chatLinkClicked

public void chatLinkClicked(URI url)
Description copied from interface: ChatLinkClickedListener
Callback that is executed when a link was clicked.

Specified by:
chatLinkClicked in interface ChatLinkClickedListener
Parameters:
url - The URI of the link that was clicked.

Jitsi: the OpenSource Java VoIP and Instant Messaging client.

Jitsi, the OpenSource Java VoIP and Instant Messaging client.
Distributable under LGPL license.