|
1 | 1 | package net.sharksystem.asap.listenermanager; |
2 | 2 |
|
| 3 | +import net.sharksystem.EncounterConnectionType; |
3 | 4 | import net.sharksystem.asap.ASAPMessages; |
4 | 5 | import net.sharksystem.asap.ASAPMessageReceivedListener; |
5 | 6 | import net.sharksystem.asap.ASAPMessageReceivedListenerManagement; |
@@ -35,30 +36,54 @@ public void removeAllListeners() { |
35 | 36 | this.listenerMap = new HashMap(); |
36 | 37 | } |
37 | 38 |
|
38 | | - public void notifyReceived(CharSequence format, ASAPMessages asapMessage) { |
39 | | - this.notifyReceived(format, asapMessage, false); |
| 39 | + public void notifyReceived(CharSequence format, ASAPMessages asapMessage, |
| 40 | + String senderE2E, // E2E part |
| 41 | + String senderPoint2Point, boolean verified, boolean encrypted, // Point2Point part |
| 42 | + EncounterConnectionType connectionType) { |
| 43 | + |
| 44 | + this.notifyReceived(format, asapMessage, false, senderE2E, senderPoint2Point, |
| 45 | + verified, encrypted, connectionType); |
40 | 46 | } |
41 | 47 |
|
42 | | - public void notifyReceived(CharSequence format, ASAPMessages asapMessage, boolean useThreads) { |
| 48 | + public void notifyReceived(CharSequence format, ASAPMessages asapMessage, boolean useThreads, |
| 49 | + String senderE2E, String senderPoint2Point, boolean verified, boolean encrypted, |
| 50 | + EncounterConnectionType connectionType) { |
| 51 | + |
43 | 52 | GenericListenerImplementation<ASAPMessageReceivedListener> listenerList = this.listenerMap.get(format); |
44 | 53 | if(listenerList != null) { |
45 | 54 | ASAPMessageReceivedNotifier asapMessageReceivedNotifier |
46 | | - = new ASAPMessageReceivedNotifier(asapMessage); |
| 55 | + = new ASAPMessageReceivedNotifier(asapMessage, senderE2E, senderPoint2Point, |
| 56 | + verified, encrypted, connectionType); |
47 | 57 |
|
48 | 58 | listenerList.notifyAll(asapMessageReceivedNotifier, useThreads); |
49 | 59 | } |
50 | 60 | } |
51 | 61 |
|
52 | 62 | public class ASAPMessageReceivedNotifier implements GenericNotifier<ASAPMessageReceivedListener> { |
53 | 63 | private final ASAPMessages asapMessage; |
| 64 | + private final String senderE2E; |
| 65 | + private final String senderPoint2Point; |
| 66 | + private final boolean verified; |
| 67 | + private final boolean encrypted; |
| 68 | + private final EncounterConnectionType connectionType; |
| 69 | + |
| 70 | + ASAPMessageReceivedNotifier(ASAPMessages asapMessage, |
| 71 | + String senderE2E, |
| 72 | + String senderPoint2Point, boolean verified, boolean encrypted, |
| 73 | + EncounterConnectionType connectionType) { |
54 | 74 |
|
55 | | - ASAPMessageReceivedNotifier(ASAPMessages asapMessage) { |
56 | 75 | this.asapMessage = asapMessage; |
| 76 | + this.senderE2E = senderE2E; |
| 77 | + this.senderPoint2Point = senderPoint2Point; |
| 78 | + this.verified = verified; |
| 79 | + this.encrypted = encrypted; |
| 80 | + this.connectionType = connectionType; |
57 | 81 | } |
58 | 82 |
|
59 | 83 | public void doNotify(ASAPMessageReceivedListener listener) { |
60 | 84 | try { |
61 | | - listener.asapMessagesReceived(this.asapMessage); |
| 85 | + listener.asapMessagesReceived(this.asapMessage, this.senderE2E, this.senderPoint2Point, |
| 86 | + this.verified, this.encrypted, this.connectionType); |
62 | 87 | } catch (IOException e) { |
63 | 88 | System.err.println("error when notifying about received asap message: " |
64 | 89 | + e.getLocalizedMessage()); |
|
0 commit comments