Skip to content

Commit

Permalink
added settings to mailboxes. issue #2708
Browse files Browse the repository at this point in the history
  • Loading branch information
j-dimension committed Nov 27, 2024
1 parent 1226305 commit 9e775f1
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -702,7 +702,6 @@ public void nextEvent() {
this.data.put("epost.letter.duplex", this.chkDuplex.isSelected());
this.data.put("epost.letter.color", this.chkColor.isSelected());
this.data.put("epost.letter.coverpage", this.chkDefaultCoverPage.isSelected());
return;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -662,7 +662,10 @@ You should also get your employer (if you work as a programmer) or school,
*/
package com.jdimension.jlawyer.persistence;

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.Serializable;
import java.util.Properties;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
Expand Down Expand Up @@ -747,6 +750,9 @@ public class MailboxSetup implements Serializable, EventTypes {
private boolean scanIgnoreInline=true;
@Column(name = "scan_minattachmentsize", columnDefinition = "INTEGER DEFAULT 5000")
private int scanMinAttachmentSize=0;

@Column(name = "settings", columnDefinition = "MEDIUMBLOB")
private byte[] settings;

public String getId() {
return id;
Expand Down Expand Up @@ -1168,5 +1174,36 @@ public void setScanMinAttachmentSize(int minAttachmentSize) {
this.scanMinAttachmentSize = minAttachmentSize;
}

/**
* @return the settings
*/
public byte[] getSettings() {
if(this.settings==null)
this.settings=emptySettings();
return settings;
}

/**
* @param settings the settings to set
*/
public void setSettings(byte[] settings) {
this.settings = settings;
}

private byte[] emptySettings() {
if(this.settings==null) {
ByteArrayOutputStream out = new ByteArrayOutputStream();
try {
new Properties().store(out, "updated " + new java.util.Date().toString());
out.flush();
out.close();
} catch (IOException ioe) {
// no logging
}
this.settings = out.toByteArray();
}
return this.settings;
}


}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
alter table mailbox_setup add `settings` MEDIUMBLOB;

insert into server_settings(settingKey, settingValue) values('jlawyer.server.database.version','3.0.0.5') ON DUPLICATE KEY UPDATE settingValue = '3.0.0.5';
commit;

0 comments on commit 9e775f1

Please sign in to comment.