Commit Graph
398 Commits
Author SHA1 Message Date
Slavi Pantaleev ed5ff6456a Ensure settings map is always initialized
Without this, if settings are not found in account data (`M_NOT_FOUND`),
we won't initialize the map and we'll panic later:

> assignment to entry in nil map

Breaking settings for all new rooms is definitely not what we inteded.

Likely a regression since 726bc95c26, but related to fcac0a202d as
well.
2022-08-24 12:22:19 +03:00
Aine ef22ca03d9 Merge branch 'ordered-commands' into 'main'
Revert "visual fixes"

See merge request etke.cc/postmoogle!11
2022-08-24 09:10:10 +00:00
Aine d021e6715e Revert "visual fixes"
This reverts commit 34735b2614.
2022-08-24 12:09:23 +03:00
Aine 8d4cb1d883 Merge branch 'ordered-commands' into 'main'
Use a command list (not a map) to have a consistent manually-defined commands order

See merge request etke.cc/postmoogle!10
2022-08-24 09:05:54 +00:00
Aine 34735b2614 visual fixes 2022-08-24 12:02:41 +03:00
Slavi Pantaleev afe24beb4d Use a command list (not a map) to have a consistent manually-defined commands order 2022-08-24 11:39:24 +03:00
Aine 382fe43dd0 Merge branch 'no-magic-strings' into 'main'
Use string constants for options, not magic strings

See merge request etke.cc/postmoogle!9
2022-08-24 08:00:03 +00:00
Slavi Pantaleev 26edcdadbc Use string constants for options, not magic strings
This also adds `Mailbox()` and `Owner()` getters for completeness.

Wording has been changed a bit to avoid saying "that room". It sounds
better if it's "this room" or just "the room".
2022-08-24 10:56:47 +03:00
Aine 79ed440fdc Merge branch 'sanitize-on-get-option' into 'main'
Sanitize settings on Get() and add convenience getters

See merge request etke.cc/postmoogle!8
2022-08-24 07:36:51 +00:00
Slavi Pantaleev e86a9ed952 Rename variable 2022-08-24 10:33:19 +03:00
Slavi Pantaleev 6103164881 Fix linting error 2022-08-24 10:31:42 +03:00
Slavi Pantaleev 16ce4314b9 Sanitize settings on Get() and add convenience getters
Sanitizing options on Get() ensures that when someone asks
for a given option which may not be defined (`nosubject`, `nosender`),
we'll return a valid value (`'true'` or `'false'`) and not `''` (empty
string, undefined).

This way, users do not need to wonder if "nosender is not set" is
handled like "true" or "false" or in some 3rd way. They also don't need
to think about "how to unset this setting, now that I've set it to something".
Options will appear to have a default sanitized value no matter if
they've explicitly been set or not.

The `NoSender()` and `NoSubject()` getters are just there for
convenience, so that we won't need to do casting in other places.
2022-08-24 10:16:28 +03:00
Aine d361e31a60 adjust stop's help message 2022-08-24 09:57:22 +03:00
Aine 82b84e3c35 Merge branch 'stop' into 'main'
add '!pm stop'

See merge request etke.cc/postmoogle!7
2022-08-24 06:41:15 +00:00
Aine 76457f8e3c add '!pm stop' 2022-08-24 09:38:13 +03:00
Aine c8fb811ae9 Merge branch 'add-no-subject-option' into 'main'
Add nosubject option

See merge request etke.cc/postmoogle!6
2022-08-24 06:34:29 +00:00
Slavi Pantaleev e4acbb31f0 Add nosubject option 2022-08-24 07:37:34 +03:00
Aine bd92e54614 Merge branch 'hide-sender-address-support' into 'main'
Add ability to hide sender's email address (hide-sender-address setting)

See merge request etke.cc/postmoogle!5
2022-08-23 19:16:34 +00:00
Aine 85fc06cfce lint; rearrange code 2022-08-23 22:12:11 +03:00
Aine e5e9be528b refactor options to be more generic 2022-08-23 21:58:05 +03:00
Aine 9eec8738f9 move syncRooms 2022-08-23 19:25:45 +03:00
Aine 81abe8c785 unoptimal refactoring 2022-08-23 19:23:15 +03:00
Aine 609e19c133 Merge branch 'main' into hide-sender-address-support 2022-08-23 18:58:40 +03:00
Slavi Pantaleev a7e789fe56 Swap key/value parameters for setBooleanConfigurationKey()
Not that it matters much, but it's more consistent.
2022-08-23 18:44:13 +03:00
Slavi Pantaleev 9f3aa3dd68 Add ability to hide sender's email address (hide-sender-address setting)
The configuration setting is called `Hide*` instead of `Show*`, because
it's backward compatible with existing configuration settings.

This is useful for when you setup an email forwarding inbox and you're
always sending to it through the same email address. In that case, you
don't need to see the email address in each Matrix message.

In the future, another similar `bool` setting (`hide-subject`) will land,
which controls whether the email's subject is shown in the final message
or not. That setting can make use of most of the same setup (all of
`handleBooleanConfigurationKey`).
2022-08-23 18:21:23 +03:00
Aine 0178c3cff3 do not convert plaintext as html 2022-08-23 18:11:38 +03:00
Aine 24686ef501 lint fixes 2022-08-23 17:56:38 +03:00
Aine b8cb8196c2 Merge branch 'notice-instead-of-error' into 'main'
Use notice instead of error for expected "errors"

See merge request etke.cc/postmoogle!4
2022-08-23 14:54:34 +00:00
Aine 518ec97160 lint fix 2022-08-23 17:54:01 +03:00
Slavi Pantaleev b79a728967 Use notice instead of error for expected "errors"
Notice() is like Error(), but:

- the message is not sent to the error log (and Sentry)
- the message sent to the room is not prefixed with `ERROR: `
2022-08-23 17:52:07 +03:00
Aine 99e62a54a5 Merge branch 'settings-or-error' into 'main'
Suppress M_NOT_FOUND error when fetching settings

See merge request etke.cc/postmoogle!3
2022-08-23 14:50:08 +00:00
Slavi Pantaleev 55a76c5c6b Use just Error, not Warn + Error
The downside of this is that the raw error gets reported to the user
in the room, instead of just being logged.
2022-08-23 17:45:15 +03:00
Slavi Pantaleev 726bc95c26 Suppress M_NOT_FOUND error when fetching settings
.. and ensure that getSettings() always returns either a default empty
settings object or an error.
2022-08-23 16:30:19 +03:00
Aine b24bd498a0 Merge branch 'always-return-settings' into 'main'
Make sure getSettings() always returns settings or error

See merge request etke.cc/postmoogle!2
2022-08-23 13:04:55 +00:00
Slavi PantaleevandAine fcac0a202d Make sure getSettings() always returns settings or error 2022-08-23 13:04:54 +00:00
Aine c71c876e69 update deps 2022-08-23 15:45:40 +03:00
Aine d6c9e2c048 enable multi-arch build 2022-08-23 14:33:37 +03:00
Aine 848d6a7187 refactor mappings getter 2022-08-22 23:24:51 +03:00
Aine 0decd4fad6 add noowner and federation 2022-08-22 22:08:32 +03:00
Aine 564cd82c6b fix prefix; test attachments; add maxsize 2022-08-22 20:21:22 +03:00
Aine d5cf9a84f5 update readme and license 2022-08-22 19:11:00 +03:00
Aine 8f3faaa2d0 prepare dockerfile 2022-08-22 18:47:53 +03:00
Aine 69f20e5670 try to receive attachments 2022-08-22 18:43:12 +03:00
Aine abb6c027bf fix autojoins 2022-08-22 16:22:55 +03:00
Aine aee56030ba rearrange roadmap 2022-08-22 12:49:11 +03:00
Aine e6d5e81efe bugfixes; email parsing; send emails into matrix rooms; e2e tests 2022-08-22 12:28:29 +03:00
Aine c746c91dbb account data only; integrate smtp server; logging 2022-08-21 23:00:20 +03:00
Aine c4b7a16e21 wip 2022-08-21 18:41:35 +03:00