Thu, 26 Dec 2024 17:19:15 +0100
update status in contact list and conversations
|
1
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1 | package de.unixwork.im; |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
2 | |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
3 | import java.security.KeyPair; |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
4 | import java.security.KeyPairGenerator; |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
5 | import java.security.MessageDigest; |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
6 | import java.security.NoSuchAlgorithmException; |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
7 | import java.security.PublicKey; |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
8 | import java.util.HashMap; |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
9 | import java.util.Map; |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
10 | import java.util.logging.Level; |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
11 | import java.util.logging.Logger; |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
12 | import net.java.otr4j.OtrEngineHost; |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
13 | import net.java.otr4j.OtrException; |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
14 | import net.java.otr4j.OtrPolicy; |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
15 | import net.java.otr4j.OtrPolicyImpl; |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
16 | import net.java.otr4j.crypto.OtrCryptoEngineImpl; |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
17 | import net.java.otr4j.crypto.OtrCryptoException; |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
18 | import net.java.otr4j.session.FragmenterInstructions; |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
19 | import net.java.otr4j.session.InstanceTag; |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
20 | import net.java.otr4j.session.SessionID; |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
21 | |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
22 | public class OTR implements OtrEngineHost { |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
23 | private final Xmpp xmpp; |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
24 | |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
25 | // Map to store key pairs for each session |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
26 | private final Map<SessionID, KeyPair> keyPairCache = new HashMap<>(); |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
27 | |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
28 | public OTR(Xmpp xmpp) { |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
29 | this.xmpp = xmpp; |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
30 | } |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
31 | |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
32 | @Override |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
33 | public void injectMessage(SessionID sid, String string) throws OtrException { |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
34 | System.out.println("inject " + string); |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
35 | xmpp.send(sid.getUserID(), string); |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
36 | } |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
37 | |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
38 | @Override |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
39 | public void unreadableMessageReceived(SessionID sid) throws OtrException { |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
40 | // TODO: send error to App |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
41 | } |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
42 | |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
43 | @Override |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
44 | public void unencryptedMessageReceived(SessionID sid, String string) throws OtrException { |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
45 | // TODO: send error to App |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
46 | } |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
47 | |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
48 | @Override |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
49 | public void showError(SessionID sid, String string) throws OtrException { |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
50 | System.out.println("showError " + string); |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
51 | } |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
52 | |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
53 | @Override |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
54 | public void smpError(SessionID sid, int i, boolean bln) throws OtrException { |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
55 | System.out.println("smpError"); |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
56 | } |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
57 | |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
58 | @Override |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
59 | public void smpAborted(SessionID sid) throws OtrException { |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
60 | |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
61 | } |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
62 | |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
63 | @Override |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
64 | public void finishedSessionMessage(SessionID sid, String string) throws OtrException { |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
65 | System.out.println("finishedSessionMessage: " + sid); |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
66 | } |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
67 | |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
68 | @Override |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
69 | public void requireEncryptedMessage(SessionID sid, String string) throws OtrException { |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
70 | System.out.println("requireEncryptedMessage"); |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
71 | } |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
72 | |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
73 | @Override |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
74 | public OtrPolicy getSessionPolicy(SessionID sid) { |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
75 | return new OtrPolicyImpl(OtrPolicy.ALLOW_V2 | OtrPolicy.ALLOW_V3 | OtrPolicy.OPPORTUNISTIC); |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
76 | } |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
77 | |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
78 | @Override |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
79 | public FragmenterInstructions getFragmenterInstructions(SessionID sid) { |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
80 | return new FragmenterInstructions(4096, 131072); |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
81 | } |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
82 | |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
83 | @Override |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
84 | public KeyPair getLocalKeyPair(SessionID sid) throws OtrException { |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
85 | // Check if a key pair already exists for the session |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
86 | if (keyPairCache.containsKey(sid)) { |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
87 | return keyPairCache.get(sid); |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
88 | } |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
89 | |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
90 | // Generate a new key pair |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
91 | KeyPair keyPair = generateKeyPair(); |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
92 | |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
93 | // Cache the key pair for this session |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
94 | keyPairCache.put(sid, keyPair); |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
95 | |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
96 | return keyPair; |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
97 | } |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
98 | |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
99 | // Helper method to generate a new key pair |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
100 | private KeyPair generateKeyPair() { |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
101 | try { |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
102 | KeyPairGenerator keyPairGenerator = KeyPairGenerator.getInstance("DSA"); // Use DSA for OTR |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
103 | keyPairGenerator.initialize(1024); // OTR uses 1024-bit keys |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
104 | return keyPairGenerator.generateKeyPair(); |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
105 | } catch (NoSuchAlgorithmException e) { |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
106 | throw new RuntimeException("Error generating key pair", e); |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
107 | } |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
108 | } |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
109 | |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
110 | @Override |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
111 | public byte[] getLocalFingerprintRaw(SessionID sid) { |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
112 | // code from DummyClient: https://github.com/jitsi/otr4j/blob/master/src/test/java/net/java/otr4j/session/DummyClient.java |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
113 | try { |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
114 | return new OtrCryptoEngineImpl() |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
115 | .getFingerprintRaw(getLocalKeyPair(sid) |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
116 | .getPublic()); |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
117 | } catch (OtrCryptoException e) { |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
118 | e.printStackTrace(); |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
119 | } catch (OtrException ex) { |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
120 | Logger.getLogger(OTR.class.getName()).log(Level.SEVERE, null, ex); |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
121 | } |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
122 | return null; |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
123 | } |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
124 | |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
125 | @Override |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
126 | public void askForSecret(SessionID sid, InstanceTag it, String string) { |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
127 | System.out.println("askForSecret " + sid); |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
128 | } |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
129 | |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
130 | @Override |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
131 | public void verify(SessionID sid, String string, boolean bln) { |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
132 | System.out.println("verify"); |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
133 | } |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
134 | |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
135 | @Override |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
136 | public void unverify(SessionID sid, String string) { |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
137 | System.out.println("unverify"); |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
138 | } |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
139 | |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
140 | @Override |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
141 | public String getReplyForUnreadableMessage(SessionID sid) { |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
142 | return "Message unreadable"; |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
143 | } |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
144 | |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
145 | @Override |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
146 | public String getFallbackMessage(SessionID sid) { |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
147 | return "error"; |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
148 | } |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
149 | |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
150 | @Override |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
151 | public void messageFromAnotherInstanceReceived(SessionID sid) { |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
152 | System.out.println("messageFromAnotherInstanceReceived"); |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
153 | } |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
154 | |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
155 | @Override |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
156 | public void multipleInstancesDetected(SessionID sid) { |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
157 | System.out.println("multipleInstancesDeteced"); |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
158 | } |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
159 | |
|
42d0d099492b
add incomplete otr code
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
160 | } |