Added user/domain place holders for move rule action

This commit is contained in:
M66B
2025-03-06 16:09:14 +01:00
parent 8d9388af47
commit ebc15f66aa
3 changed files with 21 additions and 0 deletions

7
FAQ.md
View File

@@ -3012,10 +3012,17 @@ $day$ (since version 1.2030)
$week$
$month$
$year$
$user$ (since version 1.2265)
$extra$ (since version 1.2265)
$domain$
$group$ (since version 1.2030)
```
$user$ is the domain name of the 'from' email address,
and $domain$ is the domain name of the 'from' email address: *user@domain*.
$extra$ is the part after the plus sign if the username: *user+extra$example.org*.
$group$ will be replaced with the contact group name of the sender, provided that the related contact is assigned to one contact group only.
Note that the Android contact provider isn't very fast, so using this placeholder can slow down fetching messages.

View File

@@ -863,13 +863,23 @@ public class EntityRule {
create = create.replace("$week$", week);
create = create.replace("$day$", day);
String user = null;
String extra = null;
String domain = null;
if (message.from != null &&
message.from.length > 0 &&
message.from[0] instanceof InternetAddress) {
InternetAddress from = (InternetAddress) message.from[0];
user = UriHelper.getEmailUser(from.getAddress());
domain = UriHelper.getEmailDomain(from.getAddress());
if (user != null) {
int plus = user.indexOf('+');
if (plus > 0)
extra = user.substring(plus + 1);
}
}
create = create.replace("$user$", user == null ? "" : user);
create = create.replace("$extra$", extra == null ? "" : extra);
create = create.replace("$domain$", domain == null ? "" : domain);
if (create.contains("$group$")) {

View File

@@ -1658,8 +1658,12 @@ X-Google-Original-From: Somebody &lt;somebody+extra@example.org&gt;</code></pre>
$week$
$month$
$year$
$user$ (since version 1.2265)
$extra$ (since version 1.2265)
$domain$
$group$ (since version 1.2030)</code></pre>
<p><span class="math inline"><em>u</em><em>s</em><em>e</em><em>r</em></span> is the domain name of the from email address, and <span class="math inline"><em>d</em><em>o</em><em>m</em><em>a</em><em>i</em><em>n</em></span> is the domain name of the from email address: <em>user@domain</em>.</p>
<p><span class="math inline"><em>e</em><em>x</em><em>t</em><em>r</em><em>a</em></span> is the part after the plus sign if the username: <em>user+extra$example.org</em>.</p>
<p><span class="math inline"><em>g</em><em>r</em><em>o</em><em>u</em><em>p</em></span> will be replaced with the contact group name of the sender, provided that the related contact is assigned to one contact group only. Note that the Android contact provider isnt very fast, so using this placeholder can slow down fetching messages.</p>
<p><br /></p>
<p>Since version 1.2132 it is possible to use the following placeholders in keywords:</p>