Browse Source
introduced an AbstractMessage base class (for the generated parts), to be extended into Message (there we can enhance ond override the generated code). Works, only problem is the enum types that are being generated into the Message class... e.g. Message.EncType, Message.Direction. These of course are now in AbstractMessage.EncType etc.. and thats of course not good. but because they are generated they cant be in the Message class, so at the moment having copies of these types in Message.java... Like this everything works, but of course it needs a design solution. Of course the plan then is to add the Message.toXER() method in Message.java as non-generated code (because it cant really be generated because of the "compound" nature of the function being approx: is msg encrypted, then decrypt with 0x200 flag, then getAttachement(0), if sync msg Sync::PER_to_XER else distribution::PER_toXER(), return.) in accordance with JNI-84 Reverse hierarchy of Engine and AbstractEngine.JNI-87

5 changed files with 124 additions and 16 deletions
@ -0,0 +1,105 @@ |
|||
package foundation.pEp.jniadapter; |
|||
|
|||
import java.util.HashMap; |
|||
|
|||
|
|||
public class Message extends AbstractMessage { |
|||
|
|||
// Explicit Super Constructor call
|
|||
public Message() { |
|||
super(); |
|||
} |
|||
|
|||
public Message(String mime_text) { |
|||
super(mime_text); |
|||
} |
|||
|
|||
private Message(long h) { |
|||
super(h); |
|||
} |
|||
|
|||
|
|||
public enum TextFormat { |
|||
Plain (0), |
|||
Html (1), |
|||
Other (255) |
|||
; |
|||
|
|||
public final int value; |
|||
|
|||
private static HashMap<Integer, TextFormat> intMap; |
|||
|
|||
private TextFormat(int value) { |
|||
this.value = value; |
|||
} |
|||
|
|||
public static TextFormat getByInt(int value){ |
|||
if (intMap == null) { |
|||
intMap = new HashMap<Integer, TextFormat>(); |
|||
for (TextFormat s : TextFormat.values()) { |
|||
intMap.put(s.value, s); |
|||
} |
|||
} |
|||
if (intMap.containsKey(value)) { |
|||
return intMap.get(value); |
|||
} |
|||
return null; |
|||
} |
|||
} |
|||
public enum Direction { |
|||
Incoming (0), |
|||
Outgoing (1) |
|||
; |
|||
|
|||
public final int value; |
|||
|
|||
private static HashMap<Integer, Direction> intMap; |
|||
|
|||
private Direction(int value) { |
|||
this.value = value; |
|||
} |
|||
|
|||
public static Direction getByInt(int value){ |
|||
if (intMap == null) { |
|||
intMap = new HashMap<Integer, Direction>(); |
|||
for (Direction s : Direction.values()) { |
|||
intMap.put(s.value, s); |
|||
} |
|||
} |
|||
if (intMap.containsKey(value)) { |
|||
return intMap.get(value); |
|||
} |
|||
return null; |
|||
} |
|||
} |
|||
public enum EncFormat { |
|||
None (0), |
|||
Inline (1), |
|||
SMIME (2), |
|||
PGPMIME (3), |
|||
PEP (4) |
|||
; |
|||
|
|||
public final int value; |
|||
|
|||
private static HashMap<Integer, EncFormat> intMap; |
|||
|
|||
private EncFormat(int value) { |
|||
this.value = value; |
|||
} |
|||
|
|||
public static EncFormat getByInt(int value){ |
|||
if (intMap == null) { |
|||
intMap = new HashMap<Integer, EncFormat>(); |
|||
for (EncFormat s : EncFormat.values()) { |
|||
intMap.put(s.value, s); |
|||
} |
|||
} |
|||
if (intMap.containsKey(value)) { |
|||
return intMap.get(value); |
|||
} |
|||
return null; |
|||
} |
|||
} |
|||
|
|||
} |
Loading…
Reference in new issue