Skip to content

Commit

Permalink
conversion Message -> MSG moved to msgparser
Browse files Browse the repository at this point in the history
  • Loading branch information
lolo101 committed Jul 29, 2024
1 parent e005a81 commit eda2459
Show file tree
Hide file tree
Showing 26 changed files with 100 additions and 260 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package net.sourceforge.MSGViewer.factory;

import com.auxilii.msgparser.Message;
import com.auxilii.msgparser.MsgWriter;
import net.sourceforge.MSGViewer.AttachmentRepository;
import net.sourceforge.MSGViewer.factory.mbox.EMLWriterViaJavaMail;
import net.sourceforge.MSGViewer.factory.mbox.MBoxWriterViaJavaMail;
import net.sourceforge.MSGViewer.factory.msg.MsgWriter;

import java.io.IOException;
import java.io.OutputStream;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,39 +3,23 @@
public class MSTimeConvert {

/**
* difference between 1-1-1601 and 1-1-1970 in millisecond
* difference between 1-1-1601 and 1-1-1970 in milliseconds
*/
public static final long MS_EPOCH_OFFSET = 11644473600000L;

/**
* convert a 64 bit Integer value to a normal time field.
* MS hat here nanoseconds since 1601
* convert a 64-bit Integer value to a normal time field.
* MS time counts hundreds of nanoseconds since 1601.
*
* @return the time in millis since 1970 same as System.currentTime() does
* this is the value in UTC timezone!
*/
public static long PtypeTime2Millis(long time) {
time /= 10L; // micro
time /= 1000L; // milli
time /= 10L; // micros
time /= 1000L; // millis

time -= MS_EPOCH_OFFSET; // offset since 1601

return time;
}


/**
* convert a 64 bit Integer value to a normal time field.
* MS hat here nanoseconds since 1601
*
* @return returns the time in nabos since 1.1.1601
*/
public static long Millis2PtypeTime(long time) {
time += MS_EPOCH_OFFSET; // offset since 1601

time *= 10L; // micro
time *= 1000L; // milli

return time;
}
}

This file was deleted.

142 changes: 0 additions & 142 deletions MSGViewer/src/test/resources/issue129/test.eml

This file was deleted.

12 changes: 12 additions & 0 deletions msgparser/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,17 @@
<version>5.10.3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.google.jimfs</groupId>
<artifactId>jimfs</artifactId>
<version>1.3.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>3.25.3</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
14 changes: 0 additions & 14 deletions msgparser/src/main/java/com/auxilii/msgparser/Message.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,6 @@ public class Message {
private static final String DATE_HEADER_KEY = "date:";
public static final DateTimeFormatter DATE_TIME_FORMATTER = new DateTimeFormatterBuilder().appendPattern("[EEE, ]d MMM y HH:mm[:ss] Z").toFormatter(Locale.US);

/**
* The message class as defined in the .msg file.
*/
private String messageClass = "IPM.Note";
/**
* The message Id.
*/
Expand Down Expand Up @@ -143,9 +139,6 @@ public void addRecipient(RecipientEntry recipient) {
void setProperty(Property property) {
this.properties.add(property);
switch (property.getPid()) {
case PidTagMessageClass:
this.setMessageClass((String) property.getValue());
break;
case PidTagInternetMessageId:
this.setMessageId((String) property.getValue());
break;
Expand Down Expand Up @@ -362,13 +355,6 @@ private void setDisplayBcc(String displayBcc) {
this.displayBcc = displayBcc;
}

/**
* @param messageClass the messageClass to set
*/
private void setMessageClass(String messageClass) {
this.messageClass = messageClass;
}

/**
* @return the messageId
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
package net.sourceforge.MSGViewer.factory.msg;
package com.auxilii.msgparser;

import com.auxilii.msgparser.Message;
import com.auxilii.msgparser.Ptyp;
import com.auxilii.msgparser.RecipientEntry;
import com.auxilii.msgparser.attachment.Attachment;
import com.auxilii.msgparser.attachment.FileAttachment;
import com.auxilii.msgparser.attachment.MsgAttachment;
import net.sourceforge.MSGViewer.factory.msg.entries.*;
import net.sourceforge.MSGViewer.factory.msg.properties.PropPtypInteger32;
import net.sourceforge.MSGViewer.factory.msg.properties.PropPtypTime;
import net.sourceforge.MSGViewer.factory.msg.properties.PropType;
import com.auxilii.msgparser.entries.*;
import com.auxilii.msgparser.properties.PropPtypInteger32;
import com.auxilii.msgparser.properties.PropPtypTime;
import com.auxilii.msgparser.properties.PropType;
import org.apache.poi.poifs.filesystem.DirectoryEntry;

import java.io.ByteArrayInputStream;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package net.sourceforge.MSGViewer.factory.msg;
package com.auxilii.msgparser;

import com.auxilii.msgparser.Message;
import org.apache.poi.poifs.filesystem.DirectoryNode;
import org.apache.poi.poifs.filesystem.POIFSFileSystem;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package net.sourceforge.MSGViewer.factory.msg.entries;
package com.auxilii.msgparser.entries;

import com.auxilii.msgparser.Pid;
import net.sourceforge.MSGViewer.factory.msg.properties.PropPtypByteArray;
import net.sourceforge.MSGViewer.factory.msg.properties.PropType;
import com.auxilii.msgparser.properties.PropPtypByteArray;
import com.auxilii.msgparser.properties.PropType;

import java.io.ByteArrayInputStream;
import java.io.InputStream;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package net.sourceforge.MSGViewer.factory.msg.entries;
package com.auxilii.msgparser.entries;

import static com.auxilii.msgparser.Pid.PidTagHtml;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package net.sourceforge.MSGViewer.factory.msg.entries;
package com.auxilii.msgparser.entries;

import static com.auxilii.msgparser.Pid.PidTagBody;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package net.sourceforge.MSGViewer.factory.msg.entries;
package com.auxilii.msgparser.entries;

import static com.auxilii.msgparser.Pid.PidTagRtfCompressed;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package net.sourceforge.MSGViewer.factory.msg.entries;
package com.auxilii.msgparser.entries;

import static com.auxilii.msgparser.Pid.PidTagEntryStream;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package net.sourceforge.MSGViewer.factory.msg.entries;
package com.auxilii.msgparser.entries;

import static com.auxilii.msgparser.Pid.PidTagGuidStream;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package net.sourceforge.MSGViewer.factory.msg.entries;
package com.auxilii.msgparser.entries;

import static com.auxilii.msgparser.Pid.PidTagTransportMessageHeaders;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package net.sourceforge.MSGViewer.factory.msg.entries;
package com.auxilii.msgparser.entries;

import static com.auxilii.msgparser.Pid.PidTagMessageClass;

public class MessageClassEntry extends StringUTF16SubstgEntry {
public static final String IPM_NOTE = "IPM.Note";
private static final String IPM_NOTE = "IPM.Note";

public MessageClassEntry() {
super(PidTagMessageClass, IPM_NOTE);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package net.sourceforge.MSGViewer.factory.msg.entries;
package com.auxilii.msgparser.entries;

import static com.auxilii.msgparser.Pid.PidTagStringStream;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package net.sourceforge.MSGViewer.factory.msg.entries;
package com.auxilii.msgparser.entries;

import com.auxilii.msgparser.Pid;
import net.sourceforge.MSGViewer.factory.msg.properties.PropPtypString;
import net.sourceforge.MSGViewer.factory.msg.properties.PropType;
import com.auxilii.msgparser.properties.PropPtypString;
import com.auxilii.msgparser.properties.PropType;

import java.io.ByteArrayInputStream;
import java.io.InputStream;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package net.sourceforge.MSGViewer.factory.msg.entries;
package com.auxilii.msgparser.entries;

import com.auxilii.msgparser.Pid;
import com.auxilii.msgparser.Ptyp;
import net.sourceforge.MSGViewer.factory.msg.properties.PropType;
import com.auxilii.msgparser.properties.PropType;
import org.apache.poi.poifs.filesystem.DirectoryEntry;

import java.io.IOException;
Expand Down
Loading

0 comments on commit eda2459

Please sign in to comment.