Skip to content

Commit 26dc80f

Browse files
committed
first simple Shark Net Channel test works
1 parent f43518a commit 26dc80f

File tree

3 files changed

+13
-8
lines changed

3 files changed

+13
-8
lines changed

src/net/sharksystem/asap/sharknet/InMemoSNMessage.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,8 @@ public boolean encrypted() {
187187
}
188188

189189
public boolean couldBeDecrypted() {
190-
return this.encryptedMessagePackage != null;
190+
// we have decrypted this message if there is no(!) encrypted package left
191+
return this.encryptedMessagePackage == null;
191192
}
192193

193194
@Override
@@ -281,6 +282,15 @@ public static InMemoSNMessage parseMessage(byte[] message, BasicKeyStore basicKe
281282
}
282283
}
283284

285+
// replace special sn symbols
284286
return new InMemoSNMessage(snMessage, snSender, snReceivers, creationTime, verified, encrypted);
285287
}
288+
289+
public boolean isAnonymousSender(CharSequence peerID) {
290+
return peerID.toString().equalsIgnoreCase(SNMessage.ANONYMOUS);
291+
}
292+
293+
public boolean isAnyRecipient(CharSequence peerID) {
294+
return peerID.toString().equalsIgnoreCase(SNMessage.ANY_RECIPIENT);
295+
}
286296
}

src/net/sharksystem/asap/sharknet/SNMessage.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
import java.util.Set;
99

1010
public interface SNMessage {
11-
CharSequence ANY_RECIPIENT = "SN_ANY";
12-
CharSequence ANONYMOUS = "SN_ANON";
11+
String ANY_RECIPIENT = "SN_ANY";
12+
String ANONYMOUS = "SN_ANON";
1313
int SIGNED_MASK = 0x1;
1414
int ENCRYPTED_MASK = 0x2;
1515

src/net/sharksystem/utils/ASAPSerialization.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -135,9 +135,4 @@ public static Set<CharSequence> readCharSequenceSetParameter(InputStream is) thr
135135

136136
return charSet;
137137
}
138-
139-
public static void writeDate(Date date, OutputStream os) throws IOException {
140-
141-
}
142-
143138
}

0 commit comments

Comments
 (0)