mirror of
https://github.com/ProtonMail/proton-bridge.git
synced 2025-12-15 14:56:42 +00:00
Pop-out messageID format into constants
This commit is contained in:
@ -74,19 +74,19 @@ func GetHeader(msg *pmapi.Message) textproto.MIMEHeader { //nolint[funlen]
|
||||
}
|
||||
if msg.ID != "" {
|
||||
if h.Get("Message-Id") == "" {
|
||||
h.Set("Message-Id", "<"+msg.ID+"@protonmail.internalid>")
|
||||
h.Set("Message-Id", "<"+msg.ID+"@"+pmapi.InternalIDDomain+">")
|
||||
}
|
||||
h.Set("X-Pm-Internal-Id", msg.ID)
|
||||
// Forward References, and include the message ID here (to improve outlook support).
|
||||
if references := h.Get("References"); !strings.Contains(references, msg.ID) {
|
||||
references += " <" + msg.ID + "@protonmail.internalid>"
|
||||
references += " <" + msg.ID + "@" + pmapi.InternalIDDomain + ">"
|
||||
h.Set("References", references)
|
||||
}
|
||||
}
|
||||
if msg.ConversationID != "" {
|
||||
h.Set("X-Pm-ConversationID-Id", msg.ConversationID)
|
||||
if references := h.Get("References"); !strings.Contains(references, msg.ConversationID) {
|
||||
references += " <" + msg.ConversationID + "@protonmail.conversationid>"
|
||||
references += " <" + msg.ConversationID + "@" + pmapi.ConversationIDDomain + ">"
|
||||
h.Set("References", references)
|
||||
}
|
||||
}
|
||||
|
||||
@ -141,6 +141,15 @@ const (
|
||||
// Due to API limitations, we shouldn't make requests with more than 100 message IDs at a time.
|
||||
const messageIDPageSize = 100
|
||||
|
||||
// ConversationIDDomain is used as a placeholder for conversation reference headers to improve compatibility with various clients
|
||||
const ConversationIDDomain = `protonmail.conversationid`
|
||||
|
||||
// InternalIDDomain is used as a placeholder for reference/message ID headers to improve compatibility with various clients
|
||||
const InternalIDDomain = `protonmail.internalid`
|
||||
|
||||
// InternalReferenceFormat describes format of the message ID (as regex) used for parsing reference headers
|
||||
const InternalReferenceFormat = `(?U)<.*@` + InternalIDDomain + `>`
|
||||
|
||||
// Message structure.
|
||||
type Message struct {
|
||||
ID string `json:",omitempty"`
|
||||
|
||||
Reference in New Issue
Block a user