public class ScOtrEngineImpl extends java.lang.Object implements ScOtrEngine, ChatLinkClickedListener, org.osgi.framework.ServiceListener
Constructor and Description |
---|
ScOtrEngineImpl() |
Modifier and Type | Method and Description |
---|---|
void |
abortSmp(OtrContactManager.OtrContact otrContact)
Aborts the Smp negotiation process.
|
void |
addListener(ScOtrEngineListener l)
Registers an
ScOtrEngineListener . |
void |
chatLinkClicked(java.net.URI url)
Callback that is executed when a link was clicked.
|
void |
endSession(OtrContactManager.OtrContact otrContact)
Ends the Off-the-Record session for the given
OtrContactManager.OtrContact , if it is
not already started. |
net.java.otr4j.OtrPolicy |
getContactPolicy(Contact contact)
Gets a
Contact specific policy. |
net.java.otr4j.OtrPolicy |
getGlobalPolicy()
Gets the global
OtrPolicy . |
static OtrContactManager.OtrContact |
getOtrContact(net.java.otr4j.session.SessionID sessionID) |
net.java.otr4j.session.Session |
getOutgoingSession(OtrContactManager.OtrContact contact)
Get the outgoing OTRv3 Session.
|
java.security.PublicKey |
getRemotePublicKey(OtrContactManager.OtrContact otrContact) |
static ScSessionID |
getScSessionForGuid(java.util.UUID guid)
Returns the ScSessionID for given UUID.
|
static net.java.otr4j.session.SessionID |
getSessionID(OtrContactManager.OtrContact otrContact) |
java.util.List<net.java.otr4j.session.Session> |
getSessionInstances(OtrContactManager.OtrContact otrContact)
Some IM networks always relay all messages to all sessions of a client
who is logged in multiple times.
|
ScSessionStatus |
getSessionStatus(OtrContactManager.OtrContact contact)
Gets the
ScSessionStatus for the given OtrContactManager.OtrContact . |
void |
initSmp(OtrContactManager.OtrContact otrContact,
java.lang.String question,
java.lang.String secret)
Initializes Smp negotiation.
|
boolean |
isMessageUIDInjected(java.lang.String mUID)
Gets weather the passed in messageUID is injected by the engine or not.
|
void |
launchHelp()
Launches the help page.
|
void |
refreshSession(OtrContactManager.OtrContact otrContact)
Refreshes the Off-the-Record session for the given
OtrContactManager.OtrContact . |
void |
removeListener(ScOtrEngineListener l)
Unregisters an
ScOtrEngineListener . |
void |
respondSmp(OtrContactManager.OtrContact otrContact,
net.java.otr4j.session.InstanceTag receiverTag,
java.lang.String question,
java.lang.String secret)
Responds to a question that is asked during the Smp negotiation process.
|
void |
serviceChanged(org.osgi.framework.ServiceEvent ev)
Cleans the contactsMap when ProtocolProviderService
gets unregistered.
|
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.
|
boolean |
setOutgoingSession(OtrContactManager.OtrContact contact,
net.java.otr4j.session.InstanceTag tag)
Some IM networks always relay all messages to all sessions of a client
who is logged in multiple times.
|
void |
showError(net.java.otr4j.session.SessionID sessionID,
java.lang.String err) |
void |
startSession(OtrContactManager.OtrContact otrContact)
Starts the Off-the-Record session for the given
OtrContactManager.OtrContact , if it's
not already started. |
java.lang.String |
transformReceiving(OtrContactManager.OtrContact otrContact,
java.lang.String msgText)
Transforms an incoming message.
|
java.lang.String[] |
transformSending(OtrContactManager.OtrContact otrContact,
java.lang.String msgText)
Transforms an outgoing message.
|
public static OtrContactManager.OtrContact getOtrContact(net.java.otr4j.session.SessionID sessionID)
public static ScSessionID getScSessionForGuid(java.util.UUID guid)
guid
- the UUID identifying ScSessionID.public static net.java.otr4j.session.SessionID getSessionID(OtrContactManager.OtrContact otrContact)
public void addListener(ScOtrEngineListener l)
ScOtrEngine
ScOtrEngineListener
.addListener
in interface ScOtrEngine
l
- the ScOtrEngineListener
to register.public void chatLinkClicked(java.net.URI url)
ChatLinkClickedListener
chatLinkClicked
in interface ChatLinkClickedListener
url
- The URI of the link that was clicked.public void endSession(OtrContactManager.OtrContact otrContact)
ScOtrEngine
OtrContactManager.OtrContact
, if it is
not already started.endSession
in interface ScOtrEngine
otrContact
- the OtrContactManager.OtrContact
with whom we want to end the OTR
session.public net.java.otr4j.OtrPolicy getContactPolicy(Contact contact)
ScOtrEngine
Contact
specific policy.getContactPolicy
in interface ScOtrEngine
contact
- the Contact
whose policy we want.Contact
specific OTR policy. If the specified
Contact
has no policy, the global policy is returned.public net.java.otr4j.OtrPolicy getGlobalPolicy()
ScOtrEngine
OtrPolicy
.getGlobalPolicy
in interface ScOtrEngine
OtrPolicy
public ScSessionStatus getSessionStatus(OtrContactManager.OtrContact contact)
ScOtrEngine
ScSessionStatus
for the given OtrContactManager.OtrContact
.getSessionStatus
in interface ScOtrEngine
contact
- the OtrContactManager.OtrContact
whose ScSessionStatus
we are
interested in.ScSessionStatus
.public boolean isMessageUIDInjected(java.lang.String mUID)
ScOtrEngine
isMessageUIDInjected
in interface ScOtrEngine
mUID
- the messageUID which is to be determined whether it is
injected by the engine or notpublic void launchHelp()
ScOtrEngine
launchHelp
in interface ScOtrEngine
public void refreshSession(OtrContactManager.OtrContact otrContact)
ScOtrEngine
OtrContactManager.OtrContact
. If
the session does not exist, a new session is established.refreshSession
in interface ScOtrEngine
otrContact
- the OtrContactManager.OtrContact
with whom we want to refresh the OTR
session.public void removeListener(ScOtrEngineListener l)
ScOtrEngine
ScOtrEngineListener
.removeListener
in interface ScOtrEngine
l
- the ScOtrEngineListener
to unregister.public void serviceChanged(org.osgi.framework.ServiceEvent ev)
serviceChanged
in interface org.osgi.framework.ServiceListener
public void setContactPolicy(Contact contact, net.java.otr4j.OtrPolicy policy)
ScOtrEngine
setContactPolicy
in interface ScOtrEngine
contact
- the Contact
whose policy we want to setpolicy
- the OtrPolicy
public void setGlobalPolicy(net.java.otr4j.OtrPolicy policy)
ScOtrEngine
setGlobalPolicy
in interface ScOtrEngine
policy
- the global policypublic void showError(net.java.otr4j.session.SessionID sessionID, java.lang.String err)
public void startSession(OtrContactManager.OtrContact otrContact)
ScOtrEngine
OtrContactManager.OtrContact
, if it's
not already started.startSession
in interface ScOtrEngine
otrContact
- the OtrContactManager.OtrContact
with whom we want to start an OTR
session.public java.lang.String transformReceiving(OtrContactManager.OtrContact otrContact, java.lang.String msgText)
ScOtrEngine
transformReceiving
in interface ScOtrEngine
otrContact
- the source OtrContactManager.OtrContact
.msgText
- the original message content.public java.lang.String[] transformSending(OtrContactManager.OtrContact otrContact, java.lang.String msgText)
ScOtrEngine
transformSending
in interface ScOtrEngine
otrContact
- the destination OtrContactManager.OtrContact
.msgText
- the original message content.public void initSmp(OtrContactManager.OtrContact otrContact, java.lang.String question, java.lang.String secret)
ScOtrEngine
initSmp
in interface ScOtrEngine
otrContact
- The contact with whom we want to start the Smp negotiationquestion
- The question that is asked during the Smp negotiationsecret
- The secret answer for the question.public void respondSmp(OtrContactManager.OtrContact otrContact, net.java.otr4j.session.InstanceTag receiverTag, java.lang.String question, java.lang.String secret)
ScOtrEngine
respondSmp
in interface ScOtrEngine
otrContact
- The contact for whom we want to respond to a question
during the Smp negotiation process.receiverTag
- The instance tag of the intended receiver of the SMP
responsequestion
- The question that is asked during the Smp negotiation.secret
- The secret answer for the question.public void abortSmp(OtrContactManager.OtrContact otrContact)
ScOtrEngine
abortSmp
in interface ScOtrEngine
otrContact
- The contact with whom we want to abort the
Smp negotiation process.public java.security.PublicKey getRemotePublicKey(OtrContactManager.OtrContact otrContact)
getRemotePublicKey
in interface ScOtrEngine
public java.util.List<net.java.otr4j.session.Session> getSessionInstances(OtrContactManager.OtrContact otrContact)
ScOtrEngine
Returns a list containing all instances of a session. The 'master' session is always first in the list.
getSessionInstances
in interface ScOtrEngine
otrContact
- the OtrContactManager.OtrContact
for whom we want to get the instancespublic boolean setOutgoingSession(OtrContactManager.OtrContact contact, net.java.otr4j.session.InstanceTag tag)
ScOtrEngine
When the client wishes to start sending OTRv3 encrypted messages to a specific session of his buddy who is logged in multiple times, he can set the outgoing instance of his buddy by specifying his InstanceTag.
setOutgoingSession
in interface ScOtrEngine
contact
- the OtrContactManager.OtrContact
to whom we want to set the outgoing
instance tag.tag
- the outgoing InstanceTag
InstanceTag
exists
. Otherwise falsepublic net.java.otr4j.session.Session getOutgoingSession(OtrContactManager.OtrContact contact)
ScOtrEngine
getOutgoingSession
in interface ScOtrEngine
contact
- the OtrContactManager.OtrContact
for whom we want to get the
outgoing OTR session.
Jitsi, the OpenSource Java VoIP and Instant Messaging client.
Distributable under Apache license.