diff options
author | Sebastian Reichel <sre@ring0.de> | 2018-06-28 01:03:02 +0200 |
---|---|---|
committer | Sebastian Reichel <sre@ring0.de> | 2018-06-28 01:53:40 +0200 |
commit | f466538a3527cd539c732d3abee481fa7a34fc2f (patch) | |
tree | 0a244c5b3594ee42d25744bdbdd3f0a44595c87b /src/mail | |
parent | c70d626e473c8cbdbd87125a256ca221c0c3fa23 (diff) | |
download | serial-barcode-scanner-f466538a3527cd539c732d3abee481fa7a34fc2f.tar.bz2 |
all: Add DBusError to avoid warnings with valac 0.40
Diffstat (limited to 'src/mail')
-rw-r--r-- | src/mail/mail.vala | 6 | ||||
-rw-r--r-- | src/mail/mailer-interface.vala | 12 | ||||
-rw-r--r-- | src/mail/mailer.vala | 10 | ||||
-rw-r--r-- | src/mail/main.vala | 2 |
4 files changed, 15 insertions, 15 deletions
diff --git a/src/mail/mail.vala b/src/mail/mail.vala index 63e9362..e1eec1d 100644 --- a/src/mail/mail.vala +++ b/src/mail/mail.vala @@ -101,12 +101,12 @@ public class MailImplementation { } #endif - public void add_recipient(MailContact contact, GMime.AddressType type) { + public void add_recipient(MailContact contact, GMime.AddressType type) throws DBusError, IOError { m.add_mailbox(type, contact.name, contact.email); recipients += contact.email; } - public void set_main_part(string text, MessageType type) { + public void set_main_part(string text, MessageType type) throws DBusError, IOError { GMime.DataWrapper content = new GMime.DataWrapper.with_stream( new GMime.StreamMem.with_buffer(text.data), GMime.ContentEncoding.DEFAULT); @@ -129,7 +129,7 @@ public class MailImplementation { } } - public void add_attachment(string filename, string content_type, uint8[] data) { + public void add_attachment(string filename, string content_type, uint8[] data) throws DBusError, IOError { GMime.Part part = new GMime.Part(); GMime.DataWrapper content = new GMime.DataWrapper.with_stream( diff --git a/src/mail/mailer-interface.vala b/src/mail/mailer-interface.vala index 1b819d5..019585b 100644 --- a/src/mail/mailer-interface.vala +++ b/src/mail/mailer-interface.vala @@ -15,9 +15,9 @@ [DBus (name = "io.mainframe.shopsystem.Mailer")] public interface Mailer : Object { - public abstract string create_mail() throws IOError; - public abstract void delete_mail(string path) throws IOError; - public abstract void send_mail(string path) throws IOError; + public abstract string create_mail() throws IOError, DBusError; + public abstract void delete_mail(string path) throws IOError, DBusError; + public abstract void send_mail(string path) throws IOError, DBusError; } [DBus (name = "io.mainframe.shopsystem.Mail")] @@ -28,9 +28,9 @@ public interface Mail : Object { public abstract string reply_to { owned get; set; } public abstract MailDate date { owned get; set; } - public abstract void add_recipient(MailContact contact, RecipientType type = RecipientType.TO) throws IOError; - public abstract void set_main_part(string text, MessageType type = MessageType.PLAIN) throws IOError; - public abstract void add_attachment(string filename, string content_type, uint8[] data) throws IOError; + public abstract void add_recipient(MailContact contact, RecipientType type = RecipientType.TO) throws IOError, DBusError; + public abstract void set_main_part(string text, MessageType type = MessageType.PLAIN) throws IOError, DBusError; + public abstract void add_attachment(string filename, string content_type, uint8[] data) throws IOError, DBusError; } public struct MailAttachment { diff --git a/src/mail/mailer.vala b/src/mail/mailer.vala index d83e4b0..c8d609c 100644 --- a/src/mail/mailer.vala +++ b/src/mail/mailer.vala @@ -56,7 +56,7 @@ public class MailerImplementation { return 1; } - public MailerImplementation() throws IOError { + public MailerImplementation() throws DBusError, IOError { int result; GMime.init(); @@ -67,7 +67,7 @@ public class MailerImplementation { send_queue = new Queue<MailImplementation>(); /* ignore SIGPIPE, as suggested by libESMTP */ - Posix.signal(Posix.SIGPIPE, Posix.SIG_IGN); + Posix.signal(Posix.Signal.PIPE, Posix.SIG_IGN); /* get configuration */ Config config = Bus.get_proxy_sync(BusType.SYSTEM, "io.mainframe.shopsystem.Config", "/io/mainframe/shopsystem/config"); @@ -120,7 +120,7 @@ public class MailerImplementation { GMime.shutdown(); } - public string create_mail() throws IOError { + public string create_mail() throws DBusError, IOError { string path = @"/io/mainframe/shopsystem/mail/$mailcounter"; var mail = new MailImplementation(); @@ -136,7 +136,7 @@ public class MailerImplementation { return path; } - public void delete_mail(string path) throws IOError { + public void delete_mail(string path) throws DBusError, IOError { if(!(path in mails)) throw new IOError.NOT_FOUND("No such mail"); @@ -144,7 +144,7 @@ public class MailerImplementation { mails.remove(path); } - public void send_mail(string path) throws IOError { + public void send_mail(string path) throws DBusError, IOError { if(!(path in mails)) throw new IOError.NOT_FOUND("No such mail"); diff --git a/src/mail/main.vala b/src/mail/main.vala index 0c36f6b..989c4f1 100644 --- a/src/mail/main.vala +++ b/src/mail/main.vala @@ -19,7 +19,7 @@ DBusConnection mail_bus; public static int main(string[] args) { try { m = new MailerImplementation(); - } catch(IOError e) { + } catch(Error e) { stderr.printf("Error: %s\n", e.message); } |