thunderbird / thunderbird-android

K-9 Mail – Open Source Email App for Android
https://k9mail.app/
Apache License 2.0
9.77k stars 2.45k forks source link

Space after address #5130

Open iiitomo opened 3 years ago

iiitomo commented 3 years ago

In To/Cc/Bcc fields, typing an email address followed by a space does NOT behave like typing coma or semicolon after address.

To Reproduce

  1. Start writing an email, go to the 'To' field
  2. Type a new email address followed by a coma or a semicolon, and observe that the address is immediately validated (replaced by an image)
  3. Type a new email address followed by a space, and observe that the address is not replaced by an image

Expected behavior Typing space after an email address should behave the same way as typing a coma or semicolon.

Environment:

toppk commented 3 years ago

To address this, I believe we'd need to create a new tokenizer, which is currently not possible due to this issue: https://github.com/splitwise/TokenAutoComplete/issues/412

iiitomo commented 3 years ago

the default email app of Lineage doesn't have this bug, maybe its code could be used ?

mgod commented 3 years ago

@toppk You can also probably fix this with setTokenizer(new CharacterTokenizer(Arrays.asList(';', ',', ' '), ","));

Edit: or whatever list of characters you want to use to break up tokens

toppk commented 3 years ago

@mgod the issue is that rfc822 allows (and k9 as well) you to type: ken topp <my@email.add> in the recipients field. There should be <> brackets there, github may not render them

cketti commented 3 years ago

It's much more fun than that. Both the name and the local-part are allowed to contain any of the characters you would normally use to separate recipients when entering them.

Examples:

Not that we're currently very good at supporting any of that.

mgod commented 3 years ago

I've been considering building a tokenizer for TokenAutoComplete based on top of https://developer.android.com/reference/android/text/util/Rfc822Tokenizer. I don't know how complete this tokenizer is or how hard this would be to build into the tokenizer structure I'm using in TokenAutoComplete, but it might be worth looking in to if you want something more robust.

toppk commented 3 years ago

k-9 actually sends the addresses from tokenautocomplete to rfc822tokenizer as a sanity check. (see c.f.k.m.Address).

It may be okay for our use case or it may be too strict. I'd imagine us wanting users to be able to cut and paste quoted email address and k9 accepting them. I suppose it's worth investigation.