add nocc option
This commit is contained in:
@@ -102,6 +102,7 @@ If you want to change them - check available options in the help message (`!pm h
|
|||||||
|
|
||||||
* **!pm nosender** - Get or set `nosender` of the room (`true` - hide email sender; `false` - show email sender)
|
* **!pm nosender** - Get or set `nosender` of the room (`true` - hide email sender; `false` - show email sender)
|
||||||
* **!pm norecipient** - Get or set `norecipient` of the room (`true` - hide recipient; `false` - show recipient)
|
* **!pm norecipient** - Get or set `norecipient` of the room (`true` - hide recipient; `false` - show recipient)
|
||||||
|
* **!pm nocc** - Get or set `nocc` of the room (`true` - hide CC; `false` - show CC)
|
||||||
* **!pm nosubject** - Get or set `nosubject` of the room (`true` - hide email subject; `false` - show email subject)
|
* **!pm nosubject** - Get or set `nosubject` of the room (`true` - hide email subject; `false` - show email subject)
|
||||||
* **!pm nohtml** - Get or set `nohtml` of the room (`true` - ignore HTML in email; `false` - parse HTML in emails)
|
* **!pm nohtml** - Get or set `nohtml` of the room (`true` - ignore HTML in email; `false` - parse HTML in emails)
|
||||||
* **!pm nothreads** - Get or set `nothreads` of the room (`true` - ignore email threads; `false` - convert email threads into matrix threads)
|
* **!pm nothreads** - Get or set `nothreads` of the room (`true` - ignore email threads; `false` - convert email threads into matrix threads)
|
||||||
|
|||||||
@@ -121,6 +121,15 @@ func (b *Bot) initCommands() commandList {
|
|||||||
sanitizer: utils.SanitizeBoolString,
|
sanitizer: utils.SanitizeBoolString,
|
||||||
allowed: b.allowOwner,
|
allowed: b.allowOwner,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
key: roomOptionNoCC,
|
||||||
|
description: fmt.Sprintf(
|
||||||
|
"Get or set `%s` of the room (`true` - hide CC; `false` - show CC)",
|
||||||
|
roomOptionNoCC,
|
||||||
|
),
|
||||||
|
sanitizer: utils.SanitizeBoolString,
|
||||||
|
allowed: b.allowOwner,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
key: roomOptionNoSubject,
|
key: roomOptionNoSubject,
|
||||||
description: fmt.Sprintf(
|
description: fmt.Sprintf(
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ const (
|
|||||||
roomOptionMailbox = "mailbox"
|
roomOptionMailbox = "mailbox"
|
||||||
roomOptionDomain = "domain"
|
roomOptionDomain = "domain"
|
||||||
roomOptionNoSend = "nosend"
|
roomOptionNoSend = "nosend"
|
||||||
|
roomOptionNoCC = "nocc"
|
||||||
roomOptionNoSender = "nosender"
|
roomOptionNoSender = "nosender"
|
||||||
roomOptionNoRecipient = "norecipient"
|
roomOptionNoRecipient = "norecipient"
|
||||||
roomOptionNoSubject = "nosubject"
|
roomOptionNoSubject = "nosubject"
|
||||||
@@ -62,6 +63,10 @@ func (s roomSettings) NoSend() bool {
|
|||||||
return utils.Bool(s.Get(roomOptionNoSend))
|
return utils.Bool(s.Get(roomOptionNoSend))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s roomSettings) NoCC() bool {
|
||||||
|
return utils.Bool(s.Get(roomOptionNoCC))
|
||||||
|
}
|
||||||
|
|
||||||
func (s roomSettings) NoSender() bool {
|
func (s roomSettings) NoSender() bool {
|
||||||
return utils.Bool(s.Get(roomOptionNoSender))
|
return utils.Bool(s.Get(roomOptionNoSender))
|
||||||
}
|
}
|
||||||
@@ -146,6 +151,7 @@ func (s roomSettings) migrateSpamlistSettings() {
|
|||||||
// ContentOptions converts room display settings to content options
|
// ContentOptions converts room display settings to content options
|
||||||
func (s roomSettings) ContentOptions() *email.ContentOptions {
|
func (s roomSettings) ContentOptions() *email.ContentOptions {
|
||||||
return &email.ContentOptions{
|
return &email.ContentOptions{
|
||||||
|
CC: !s.NoCC(),
|
||||||
HTML: !s.NoHTML(),
|
HTML: !s.NoHTML(),
|
||||||
Sender: !s.NoSender(),
|
Sender: !s.NoSender(),
|
||||||
Recipient: !s.NoRecipient(),
|
Recipient: !s.NoRecipient(),
|
||||||
|
|||||||
@@ -107,7 +107,11 @@ func (e *Email) Content(threadID id.EventID, options *ContentOptions) *event.Con
|
|||||||
text.WriteString(" ➡️ ")
|
text.WriteString(" ➡️ ")
|
||||||
text.WriteString(e.To)
|
text.WriteString(e.To)
|
||||||
}
|
}
|
||||||
if options.Sender || options.Recipient {
|
if options.CC && e.CC != "" {
|
||||||
|
text.WriteString("\ncc: ")
|
||||||
|
text.WriteString(e.CC)
|
||||||
|
}
|
||||||
|
if options.Sender || options.Recipient || options.CC {
|
||||||
text.WriteString("\n\n")
|
text.WriteString("\n\n")
|
||||||
}
|
}
|
||||||
if options.Subject && threadID == "" {
|
if options.Subject && threadID == "" {
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ type IncomingFilteringOptions interface {
|
|||||||
// ContentOptions represents settings that specify how an email is to be converted to a Matrix message
|
// ContentOptions represents settings that specify how an email is to be converted to a Matrix message
|
||||||
type ContentOptions struct {
|
type ContentOptions struct {
|
||||||
// On/Off
|
// On/Off
|
||||||
|
CC bool
|
||||||
Sender bool
|
Sender bool
|
||||||
Recipient bool
|
Recipient bool
|
||||||
Subject bool
|
Subject bool
|
||||||
|
|||||||
Reference in New Issue
Block a user