1 package net.java.otr4j; |
|
2 |
|
3 import java.security.PublicKey; |
|
4 |
|
5 import net.java.otr4j.session.SessionID; |
|
6 import net.java.otr4j.session.SessionStatus; |
|
7 |
|
8 /** |
|
9 * |
|
10 * @author George Politis |
|
11 * |
|
12 */ |
|
13 public interface OtrEngine { |
|
14 |
|
15 /** |
|
16 * |
|
17 * @param sessionID |
|
18 * The session identifier. |
|
19 * @param content |
|
20 * The message content to be transformed. |
|
21 * @return The transformed message content. |
|
22 * @throws OtrException |
|
23 */ |
|
24 public abstract String transformReceiving(SessionID sessionID, |
|
25 String content) throws OtrException; |
|
26 |
|
27 /** |
|
28 * |
|
29 * @param sessionID |
|
30 * The session identifier. |
|
31 * @param content |
|
32 * The message content to be transformed. |
|
33 * @return The transformed message content. |
|
34 * @throws OtrException |
|
35 */ |
|
36 public abstract String transformSending(SessionID sessionID, String content) throws OtrException; |
|
37 |
|
38 /** |
|
39 * Starts an Off-the-Record session, if there is no active one. |
|
40 * |
|
41 * @param sessionID |
|
42 * The session identifier. |
|
43 * @throws OtrException |
|
44 */ |
|
45 public abstract void startSession(SessionID sessionID) throws OtrException; |
|
46 |
|
47 /** |
|
48 * Ends the Off-the-Record session, if exists. |
|
49 * |
|
50 * @param sessionID |
|
51 * The session identifier. |
|
52 * @throws OtrException |
|
53 */ |
|
54 public abstract void endSession(SessionID sessionID) throws OtrException; |
|
55 |
|
56 /** |
|
57 * Stops/Starts the Off-the-Record session. |
|
58 * |
|
59 * @param sessionID |
|
60 * The session identifier. |
|
61 * @throws OtrException |
|
62 */ |
|
63 public abstract void refreshSession(SessionID sessionID) throws OtrException; |
|
64 |
|
65 /** |
|
66 * |
|
67 * @param sessionID |
|
68 * The session identifier. |
|
69 * @return The status of an Off-the-Record session. |
|
70 */ |
|
71 public abstract SessionStatus getSessionStatus(SessionID sessionID); |
|
72 |
|
73 /** |
|
74 * |
|
75 * @param sessionID |
|
76 * The session identifier. |
|
77 * @return The remote public key. |
|
78 */ |
|
79 public abstract PublicKey getRemotePublicKey(SessionID sessionID); |
|
80 |
|
81 public abstract void addOtrEngineListener(OtrEngineListener l); |
|
82 |
|
83 public abstract void removeOtrEngineListener(OtrEngineListener l); |
|
84 } |
|