summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Reichel <sre@ring0.de>2018-07-20 23:41:06 +0200
committerSebastian Reichel <sre@ring0.de>2018-07-20 23:41:34 +0200
commitb0b79db354a2bb89009e206b0fa19f810a816cec (patch)
treeadb3899b3dcc5032e8964abb8119a383d2933bb0
parentadc439496804ab9eb405e18d8a5e74d340e055eb (diff)
downloadserial-barcode-scanner-b0b79db354a2bb89009e206b0fa19f810a816cec.tar.bz2
fix date in mailer
-rw-r--r--src/mail/mail.vala22
1 files changed, 7 insertions, 15 deletions
diff --git a/src/mail/mail.vala b/src/mail/mail.vala
index 4f9f7e3..f6cedc0 100644
--- a/src/mail/mail.vala
+++ b/src/mail/mail.vala
@@ -19,6 +19,7 @@ public class MailImplementation {
private GMime.Part? main_text = null;
private GMime.Part? main_html = null;
private GMime.Part[] attachments;
+ private DateTime gdate;
private GMime.FilterUnix2Dos filter_unix2dos;
private GMime.FilterSmtpData filter_smtp;
@@ -65,27 +66,22 @@ public class MailImplementation {
public MailDate date {
owned get {
MailDate result = {};
- var tmp = m.get_date();
- if (tmp != null) {
- result.timezone = tmp.get_timezone_abbreviation();
- result.date = tmp.to_unix();
- } else {
- result.timezone = "";
- result.date = 0;
- }
+ result.timezone = this.gdate.get_timezone_abbreviation();
+ result.date = this.gdate.to_unix();
return result;
}
set {
var timezone = new TimeZone(value.timezone);
- var date = new DateTime.from_unix_utc((int64) value.date).to_timezone(timezone);
- m.set_date(date);
+ this.gdate = new DateTime.from_unix_utc((int64) value.date).to_timezone(timezone);
+ m.set_date(this.gdate);
}
}
public MailImplementation() {
m = new GMime.Message(true);
m.set_header("X-Mailer", "KtT Shopsystem", "utf-8");
- m.set_date(new DateTime.now_local());
+ this.gdate = new DateTime.now_local();
+ m.set_date(this.gdate);
attachments = new GMime.Part[0];
filter_smtp = new GMime.FilterSmtpData();
filter_unix2dos = new GMime.FilterUnix2Dos(true);
@@ -101,10 +97,6 @@ public class MailImplementation {
public void set_subject(string subject) {
m.set_subject(subject);
}
-
- public void set_date(uint64 date, int tz_offset) {
- m.set_date((ulong) date, tz_offset);
- }
#endif
public void add_recipient(MailContact contact, GMime.AddressType type) throws DBusError, IOError {