Browse Source

Change date handling

- Change date to unix time seconds format
- Add read/unread flag set while open message
- Get basic message details. Template and data are not ready yet
Alexey Edelev 5 years ago
parent
commit
29e333bd8d
9 changed files with 247 additions and 42 deletions
  1. 124 24
      common/gostfix.pb.go
  2. 11 1
      common/gostfix.proto
  3. 53 4
      db/db.go
  4. 11 3
      scanner/parser.go
  5. 8 1
      web/css/styles.css
  6. 26 6
      web/js/index.js
  7. 12 2
      web/server.go
  8. 1 0
      web/templates/details.html
  9. 1 1
      web/templates/maillist.html

+ 124 - 24
common/gostfix.pb.go

@@ -80,7 +80,7 @@ type MailHeader struct {
 	To                   string   `protobuf:"bytes,2,opt,name=to,proto3" json:"to,omitempty"`
 	Cc                   string   `protobuf:"bytes,3,opt,name=cc,proto3" json:"cc,omitempty"`
 	Bcc                  string   `protobuf:"bytes,4,opt,name=bcc,proto3" json:"bcc,omitempty"`
-	Date                 string   `protobuf:"bytes,5,opt,name=date,proto3" json:"date,omitempty"`
+	Date                 int64    `protobuf:"zigzag64,5,opt,name=date,proto3" json:"date,omitempty"`
 	Subject              string   `protobuf:"bytes,6,opt,name=subject,proto3" json:"subject,omitempty"`
 	XXX_NoUnkeyedLiteral struct{} `json:"-" bson:"-"`
 	XXX_unrecognized     []byte   `json:"-" bson:"-"`
@@ -140,11 +140,11 @@ func (m *MailHeader) GetBcc() string {
 	return ""
 }
 
-func (m *MailHeader) GetDate() string {
+func (m *MailHeader) GetDate() int64 {
 	if m != nil {
 		return m.Date
 	}
-	return ""
+	return 0
 }
 
 func (m *MailHeader) GetSubject() string {
@@ -295,12 +295,108 @@ func (m *AttachmentHeader) GetContentType() string {
 	return ""
 }
 
+type UserInfo struct {
+	User                 string   `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"`
+	FullName             string   `protobuf:"bytes,2,opt,name=fullName,proto3" json:"fullName,omitempty"`
+	XXX_NoUnkeyedLiteral struct{} `json:"-" bson:"-"`
+	XXX_unrecognized     []byte   `json:"-" bson:"-"`
+	XXX_sizecache        int32    `json:"-" bson:"-"`
+}
+
+func (m *UserInfo) Reset()         { *m = UserInfo{} }
+func (m *UserInfo) String() string { return proto.CompactTextString(m) }
+func (*UserInfo) ProtoMessage()    {}
+func (*UserInfo) Descriptor() ([]byte, []int) {
+	return fileDescriptor_0ab36b6dc6e1dcaa, []int{5}
+}
+
+func (m *UserInfo) XXX_Unmarshal(b []byte) error {
+	return xxx_messageInfo_UserInfo.Unmarshal(m, b)
+}
+func (m *UserInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+	return xxx_messageInfo_UserInfo.Marshal(b, m, deterministic)
+}
+func (m *UserInfo) XXX_Merge(src proto.Message) {
+	xxx_messageInfo_UserInfo.Merge(m, src)
+}
+func (m *UserInfo) XXX_Size() int {
+	return xxx_messageInfo_UserInfo.Size(m)
+}
+func (m *UserInfo) XXX_DiscardUnknown() {
+	xxx_messageInfo_UserInfo.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_UserInfo proto.InternalMessageInfo
+
+func (m *UserInfo) GetUser() string {
+	if m != nil {
+		return m.User
+	}
+	return ""
+}
+
+func (m *UserInfo) GetFullName() string {
+	if m != nil {
+		return m.FullName
+	}
+	return ""
+}
+
+type Frame struct {
+	Skip                 int32    `protobuf:"zigzag32,1,opt,name=skip,proto3" json:"skip,omitempty"`
+	Limit                int32    `protobuf:"zigzag32,2,opt,name=limit,proto3" json:"limit,omitempty"`
+	XXX_NoUnkeyedLiteral struct{} `json:"-" bson:"-"`
+	XXX_unrecognized     []byte   `json:"-" bson:"-"`
+	XXX_sizecache        int32    `json:"-" bson:"-"`
+}
+
+func (m *Frame) Reset()         { *m = Frame{} }
+func (m *Frame) String() string { return proto.CompactTextString(m) }
+func (*Frame) ProtoMessage()    {}
+func (*Frame) Descriptor() ([]byte, []int) {
+	return fileDescriptor_0ab36b6dc6e1dcaa, []int{6}
+}
+
+func (m *Frame) XXX_Unmarshal(b []byte) error {
+	return xxx_messageInfo_Frame.Unmarshal(m, b)
+}
+func (m *Frame) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+	return xxx_messageInfo_Frame.Marshal(b, m, deterministic)
+}
+func (m *Frame) XXX_Merge(src proto.Message) {
+	xxx_messageInfo_Frame.Merge(m, src)
+}
+func (m *Frame) XXX_Size() int {
+	return xxx_messageInfo_Frame.Size(m)
+}
+func (m *Frame) XXX_DiscardUnknown() {
+	xxx_messageInfo_Frame.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_Frame proto.InternalMessageInfo
+
+func (m *Frame) GetSkip() int32 {
+	if m != nil {
+		return m.Skip
+	}
+	return 0
+}
+
+func (m *Frame) GetLimit() int32 {
+	if m != nil {
+		return m.Limit
+	}
+	return 0
+}
+
 func init() {
 	proto.RegisterType((*MailBody)(nil), "common.MailBody")
 	proto.RegisterType((*MailHeader)(nil), "common.MailHeader")
 	proto.RegisterType((*Mail)(nil), "common.Mail")
 	proto.RegisterType((*Attachment)(nil), "common.Attachment")
 	proto.RegisterType((*AttachmentHeader)(nil), "common.AttachmentHeader")
+	proto.RegisterType((*UserInfo)(nil), "common.UserInfo")
+	proto.RegisterType((*Frame)(nil), "common.Frame")
 }
 
 func init() {
@@ -308,25 +404,29 @@ func init() {
 }
 
 var fileDescriptor_0ab36b6dc6e1dcaa = []byte{
-	// 311 bytes of a gzipped FileDescriptorProto
-	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x52, 0xbf, 0x4b, 0xf4, 0x40,
-	0x10, 0xe5, 0x2e, 0xf9, 0xf2, 0xdd, 0x4d, 0x54, 0x8e, 0xa9, 0x16, 0xb1, 0x38, 0x82, 0xc5, 0x61,
-	0x71, 0xc8, 0xd9, 0xd9, 0x69, 0x65, 0xa3, 0x48, 0xb8, 0xc2, 0x76, 0xb3, 0xd9, 0x98, 0x48, 0x92,
-	0x0d, 0xc9, 0x08, 0x97, 0xce, 0x3f, 0x5d, 0x76, 0xf2, 0x93, 0x03, 0xbb, 0x79, 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xc4, 0x18,
+	0x43, 0x24, 0x4d, 0x65, 0x55, 0x65, 0x37, 0x87, 0x5a, 0xf5, 0x67, 0x3c, 0x6f, 0x25, 0x6b, 0x98,
+	0x3c, 0xb5, 0xaa, 0xb9, 0xab, 0x72, 0xe3, 0x1c, 0x77, 0x6d, 0x9f, 0x70, 0xca, 0xa9, 0xa6, 0xe9,
+	0xbb, 0xa2, 0xa0, 0xe9, 0xfd, 0xaf, 0x1f, 0x70, 0xf2, 0x0f, 0xc6, 0x37, 0x8d, 0xb3, 0x41, 0x08,
+	0xda, 0x37, 0x5d, 0xd3, 0x87, 0x73, 0x4e, 0x35, 0xfe, 0x80, 0x71, 0xa1, 0x4b, 0xdd, 0x3d, 0x98,
+	0x39, 0xef, 0x40, 0x1a, 0xd2, 0x1b, 0xfc, 0xff, 0x11, 0x00, 0x00, 0xff, 0xff, 0x58, 0xe1, 0xb1,
+	0x5c, 0x94, 0x02, 0x00, 0x00,
 }

+ 11 - 1
common/gostfix.proto

@@ -13,7 +13,7 @@ message MailHeader {
 	string to = 2;
 	string cc = 3;
 	string bcc = 4;
-	string date = 5;
+	sint64 date = 5;
 	string subject = 6;
 }
 
@@ -31,3 +31,13 @@ message AttachmentHeader {
 	string fileName = 1;
 	string contentType = 2;
 }
+
+message UserInfo {
+	string user = 1;
+	string fullName = 2;
+}
+
+message Frame {
+	sint32 skip = 1;
+	sint32 limit = 2;
+}

+ 53 - 4
db/db.go

@@ -37,6 +37,7 @@ import (
 	bcrypt "golang.org/x/crypto/bcrypt"
 
 	bson "go.mongodb.org/mongo-driver/bson"
+	"go.mongodb.org/mongo-driver/bson/primitive"
 	mongo "go.mongodb.org/mongo-driver/mongo"
 	options "go.mongodb.org/mongo-driver/mongo/options"
 
@@ -277,9 +278,23 @@ func (s *Storage) RemoveMail(user string, m *common.Mail) error {
 	return nil
 }
 
-func (s *Storage) MailList(user, email, folder string) ([]*common.MailMetadata, error) {
+func (s *Storage) MailList(user, email, folder string, frame common.Frame) ([]*common.MailMetadata, error) {
 	mailsCollection := s.db.Collection(qualifiedMailCollection(user))
-	cur, err := mailsCollection.Find(context.Background(), bson.M{"email": email})
+
+	request := bson.A{
+		bson.M{"$match": bson.M{"email": email}},
+		bson.M{"$sort": bson.M{"mail.header.date": 1}},
+	}
+
+	if frame.Skip > 0 {
+		request = append(request, bson.M{"$skip": frame.Skip})
+	}
+
+	if frame.Limit > 0 {
+		request = append(request, bson.M{"$limit": frame.Limit})
+	}
+
+	cur, err := mailsCollection.Aggregate(context.Background(), request)
 
 	if err != nil {
 		return nil, err
@@ -301,8 +316,42 @@ func (s *Storage) MailList(user, email, folder string) ([]*common.MailMetadata,
 	return headers, nil
 }
 
-func (s *Storage) GetMail(user string, header *common.MailHeader) (m *common.Mail, err error) {
-	return nil, nil
+func (s *Storage) GetUserInfo(user string) (*common.UserInfo, error) {
+	result := &common.UserInfo{}
+	err := s.usersCollection.FindOne(context.Background(), bson.M{"user": user}).Decode(result)
+	return result, err
+}
+
+func (s *Storage) GetMail(user string, id string) (m *common.Mail, err error) {
+	mailsCollection := s.db.Collection(qualifiedMailCollection(user))
+
+	oId, err := primitive.ObjectIDFromHex(id)
+	if err != nil {
+		return nil, err
+	}
+
+	m = &common.Mail{}
+	result := &struct {
+		Mail *common.Mail
+	}{
+		Mail: m,
+	}
+	err = mailsCollection.FindOne(context.Background(), bson.M{"_id": oId}).Decode(result)
+	if err != nil {
+		return nil, err
+	}
+	return result.Mail, nil
+}
+
+func (s *Storage) SetRead(user string, id string, read bool) error {
+	mailsCollection := s.db.Collection(qualifiedMailCollection(user))
+
+	oId, err := primitive.ObjectIDFromHex(id)
+	if err != nil {
+		return err
+	}
+	_, err = mailsCollection.UpdateOne(context.Background(), bson.M{"_id": oId}, bson.M{"$set": bson.M{"read": true}})
+	return err
 }
 
 func (s *Storage) GetAttachment(user string, attachmentId string) (filePath string, err error) {

+ 11 - 3
scanner/parser.go

@@ -27,7 +27,9 @@ package scanner
 
 import (
 	"bufio"
+	"log"
 	"strings"
+	"time"
 
 	"git.semlanik.org/semlanik/gostfix/common"
 	utils "git.semlanik.org/semlanik/gostfix/utils"
@@ -145,15 +147,21 @@ func (pd *parseData) parseHeader(headerRaw string) {
 		case "subject":
 			pd.previousHeader = &pd.email.Header.Subject
 		case "date":
-			pd.previousHeader = &pd.email.Header.Date
-			pd.mandatoryHeaders |= DateHeaderMask
+			pd.previousHeader = nil
+			time, err := time.Parse(time.RFC1123Z, strings.Trim(capture[2], " \t"))
+			if err == nil {
+				pd.email.Header.Date = time.Unix()
+				pd.mandatoryHeaders |= DateHeaderMask
+			}
+			log.Printf("Invalid date format %s, %s", strings.Trim(capture[2], " \t"), err)
 		case "content-type":
 			pd.previousHeader = &pd.bodyContentType
 		default:
 			pd.previousHeader = nil
 		}
+
 		if pd.previousHeader != nil {
-			*pd.previousHeader += capture[2]
+			*pd.previousHeader = capture[2]
 		}
 		return
 	}

+ 8 - 1
web/css/styles.css

@@ -32,7 +32,6 @@ table.mailList {
 
 td.fromCol {
     width: 300pt;
-    font-weight: bold;
 }
 
 td.subjCol {
@@ -49,6 +48,14 @@ td.dateCol {
     white-space: nowrap;
 }
 
+tr.read {
+    font-weight: normal;
+}
+
+tr.unread {
+    font-weight: bold;
+}
+
 .materialLevel1 {
     box-shadow: 0 1pt 3pt rgba(0, 0, 0, .6);
     margin-top: 1pt;

+ 26 - 6
web/js/index.js

@@ -30,9 +30,9 @@ $(document).ready(function(){
         global: false,
         type: "POST"
     })
-    $(window).bind('hashchange', requestDetails);
-    requestDetails();
-    loadStatusLine();
+    $(window).bind('hashchange', requestDetails)
+    requestDetails()
+    loadStatusLine()
 })
 
 function openEmail(id) {
@@ -46,14 +46,16 @@ function requestDetails() {
         if (messageId != "") {
             $.ajax({
                 url: "/messageDetails",
-                data: {detailsUrl: messageId},
+                data: {messageId: messageId},
                 success: function(result) {
                     $("#details").html(result);
                     $("#maillist").css({pointerEvents: "none"})
                     $("#details").show()
                 },
                 error: function(jqXHR, textStatus, errorThrown) {
-                    window.location.hash = ""
+                    $("#details").html(result);
+                    $("#maillist").css({pointerEvents: "none"})
+                    $("#details").show()
                 }
             })
         }
@@ -71,10 +73,28 @@ function loadStatusLine() {
     $.ajax({
         url: "/statusLine",
         success: function(result) {
-            $("#statusLine").html(result);
+            $("#statusLine").html(result)
         },
         error: function(jqXHR, textStatus, errorThrown) {
             //TODO: some toast message here once implemented
         }
     })
+}
+
+function localDate(timestamp) {
+    var today = new Date()
+    var date = new Date(timestamp*1000)
+
+    dateString = ""
+    if (today.getDay() == date.getDay()
+        && today.getMonth() == date.getMonth()
+        && today.getFullYear() == date.getFullYear()) {
+            dateString = date.toLocaleTimeString("en-US")
+    } else if (today.getFullYear() == date.getFullYear()) {
+        const options = { day: 'numeric', month: 'short' }
+        dateString = date.toLocaleDateString("en-US", options)
+    } else {
+        dateString = date.toLocaleDateString("en-US")
+    }
+    document.write(dateString)
 }

+ 12 - 2
web/server.go

@@ -156,7 +156,17 @@ func (s *Server) handleMessageDetails(w http.ResponseWriter, r *http.Request) {
 		fmt.Fprint(w, "")
 		return
 	}
-	fmt.Fprint(w, s.templater.ExecuteDetails(""))
+
+	messageId := r.FormValue("messageId")
+
+	mail, err := s.storage.GetMail(user, messageId)
+	if err != nil {
+		s.error(http.StatusInternalServerError, "Unable to read message", w, r)
+		return
+	}
+
+	s.storage.SetRead(user, messageId, true)
+	fmt.Fprint(w, s.templater.ExecuteDetails(mail))
 }
 
 func (s *Server) handleStatusLine(w http.ResponseWriter, r *http.Request) {
@@ -186,7 +196,7 @@ func (s *Server) handleMailbox(w http.ResponseWriter, r *http.Request) {
 		return
 	}
 
-	mailList, err := s.storage.MailList(user, user, "Inbox")
+	mailList, err := s.storage.MailList(user, user, "Inbox", common.Frame{Skip: 0, Limit: 0})
 
 	if err != nil {
 		s.error(http.StatusInternalServerError, "Couldn't read email database", w, r)

+ 1 - 0
web/templates/details.html

@@ -2,4 +2,5 @@
     <img src="assets/back.svg" style="width: 20pt"/>
 </div>
 <div id="emailDetails">
+    {{.Header}}
 </div>

+ 1 - 1
web/templates/maillist.html

@@ -6,7 +6,7 @@
                 <tr id="mail{{.Id}}" class="{{if .Read}}read{{else}}unread{{end}}" onclick="openEmail('{{.Id}}');">
                     <td class="fromCol">{{.Mail.Header.From}}</td>
                     <td class="subjCol">{{.Mail.Header.Subject}}</td>
-                    <td class="dateCol">{{.Mail.Header.Date}}</td>
+                    <td class="dateCol"><script type="text/javascript">localDate({{.Mail.Header.Date}})</script></td>
                 </tr>
                 {{else}}
                 <tr><td><b>Mail folder is empty</b></td></tr>