jberkel / sms-backup-plus

Backup Android SMS, MMS and call log to Gmail / Gcal / IMAP
https://play.google.com/store/apps/details?id=com.zegoggles.smssync
Apache License 2.0
1.79k stars 497 forks source link

Parameterize the IMAP folder path #1022

Open kurahaupo opened 4 years ago

kurahaupo commented 4 years ago

(This follows on from implementing multi-SIM.)

Allow tokens to be included in the Gmail label/IMAP folder, such as:

kurahaupo commented 4 years ago

The %{slot} notation could be expanded to allow %{slot+char} where char is any printable unicode character, indicating the first slot. The default would be +1 giving 1/2/3.

Other possibilities include:

kurahaupo commented 4 years ago

It may then also make sense to use these same tokens for configuring the RFC2822 headers in the saved messages, rather than having specialized code in each case.

To that end, it may also be useful to recognize

kurahaupo commented 4 years ago

I have in mind a generic parsing mechanism that would work through a string and pick out each token of the form %{…}, then from that take the first "C" identifier (matching /\<[[:alpha:]_][[:alnum:]]*\>/) and look that up to determine the precise function. The result from that function would replace the token in the initial string.

Modifiers could be introduced by any sensible punctuation, such as

Any number of generic modifiers may be given after any specific ones, as they apply to whatever result is returned by the lookup and previous modifiers.

NB: this implies that the matching of %{ to } must take nested brackets into account.

kurahaupo commented 4 years ago

If anyone has any preferences for the start and end symbols, please say so now...