summaryrefslogtreecommitdiff
path: root/src/jwebmail/model/jwebmail.proto
diff options
context:
space:
mode:
authorJannis M. Hoffmann <jannis@fehcom.de>2024-03-12 18:46:44 +0100
committerJannis M. Hoffmann <jannis@fehcom.de>2024-03-12 18:46:44 +0100
commitd70dc2ad3094d865de7b0482ebefce3828441c89 (patch)
tree368366e50f950c85b503b23e1e73f315665cc562 /src/jwebmail/model/jwebmail.proto
parent3ecf83aa14e01b8bca16dd24790a10af9838aa3a (diff)
convert internal message format from json to protobuf
Diffstat (limited to 'src/jwebmail/model/jwebmail.proto')
-rw-r--r--src/jwebmail/model/jwebmail.proto156
1 files changed, 156 insertions, 0 deletions
diff --git a/src/jwebmail/model/jwebmail.proto b/src/jwebmail/model/jwebmail.proto
new file mode 100644
index 0000000..bf1454a
--- /dev/null
+++ b/src/jwebmail/model/jwebmail.proto
@@ -0,0 +1,156 @@
+syntax = "proto3";
+
+package jwebmail;
+
+message MIMEHeader {
+
+ enum ContentDisposition {
+ CONTENT_DISPOSITION_NONE = 0;
+ CONTENT_DISPOSITION_INLINE = 1;
+ CONTENT_DISPOSITION_ATTACHMENT = 2;
+ }
+
+ string maintype = 1;
+ string subtype = 2;
+ ContentDisposition contentdispo = 3;
+ optional string file_name = 4;
+}
+
+message MailHeader {
+
+ message MailAddr {
+ optional string name = 1;
+ string address = 2;
+ }
+
+ string send_date = 1;
+ repeated MailAddr written_from = 2;
+ optional MailAddr sender = 3;
+ repeated MailAddr reply_to = 4;
+ repeated MailAddr send_to = 5;
+ repeated MailAddr cc = 6;
+ repeated MailAddr bcc = 7;
+ string subject = 8;
+ repeated string comments = 9;
+ repeated string keywords = 10;
+ MIMEHeader mime = 11;
+}
+
+message ListMailHeader {
+ uint64 byte_size = 1;
+ bool unread = 2;
+ string rec_date = 3;
+ string mid = 4;
+ MailHeader header = 5;
+}
+
+message MailBody {
+ message Multipart {
+ optional string preamble = 1;
+ repeated MIMEPart parts = 2;
+ optional string epilogue = 3;
+ }
+
+ oneof Body {
+ string discrete = 1;
+ Multipart multipart = 2;
+ Mail mail = 3;
+ }
+}
+
+message Mail {
+ MailHeader head = 1;
+ MailBody body = 2;
+}
+
+message MIMEPart {
+ MIMEHeader mime_header = 1;
+ MailBody body = 2;
+}
+
+// Request-Response pairs
+
+message ListReq {
+ string folder = 1;
+ int32 start = 2;
+ int32 end = 3;
+ string sort = 4;
+}
+
+message ListResp {
+ repeated ListMailHeader mail_heads = 1;
+}
+
+message StatsReq {
+ string folder = 1;
+}
+
+message StatsResp {
+ uint32 mail_count = 1;
+ uint32 unread_count = 2;
+ uint64 byte_size = 3;
+}
+
+message ShowReq {
+ string folder = 1;
+ string mid = 2;
+}
+
+message ShowResp {
+ Mail mail = 1;
+}
+
+message RawReq {
+ string folder = 1;
+ string mid = 2;
+ optional string path = 3;
+}
+
+message RawResp {
+ MIMEHeader header = 1;
+ bytes body = 2;
+}
+
+message SearchReq {
+ string folder = 1;
+ string pattern = 2;
+}
+
+message SearchResp {
+ repeated ListMailHeader found = 1;
+}
+
+message FoldersReq {
+}
+
+message FoldersResp {
+ repeated string folders = 1;
+}
+
+message MoveReq {
+ string mid = 1;
+ string from_f = 2;
+ string to_f = 3;
+}
+
+message MoveResp {
+}
+
+message RemoveReq {
+ string folder = 1;
+ string mid = 2;
+}
+
+message RemoveResp {
+}
+
+service MailService {
+ rpc List(ListReq) returns (ListResp);
+ rpc Stats(StatsReq) returns (StatsResp);
+ rpc Show(ShowReq) returns (ShowResp);
+ rpc Raw(RawReq) returns (RawResp);
+ rpc Search(SearchReq) returns (SearchResp);
+ rpc Folders(FoldersReq) returns (FoldersResp);
+ rpc Move(MoveReq) returns (MoveResp);
+ rpc Remove(RemoveReq) returns (RemoveResp);
+}