Skip to content

Commit

Permalink
feat(notification): add custom message
Browse files Browse the repository at this point in the history
  • Loading branch information
QHivert committed Aug 30, 2023
1 parent acaddf5 commit 6b64705
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 3 deletions.
5 changes: 4 additions & 1 deletion SoObjects/SOGo/SOGoSieveManager.m
Expand Up @@ -1220,6 +1220,7 @@ - (NSException *) updateFiltersForAccount: (SOGoMailAccount *) theAccount
{
// BOOL alwaysSend;
NSString *notify;
NSString *message;
id addresses;
int i;

Expand All @@ -1232,12 +1233,14 @@ - (NSException *) updateFiltersForAccount: (SOGoMailAccount *) theAccount
if ([addresses isKindOfClass: [NSString class]])
addresses = [addresses componentsSeparatedByString: @","];

message = [values objectForKey: @"notificationMessage"];

for (i = 0; i < [addresses count]; i++)
{
v = [addresses objectAtIndex: i];
if (v && [v length] > 0)
{
notify = [NSString stringWithFormat: @"notify \"mailto:%@\";\r\n", v];
notify = [NSString stringWithFormat: @"notify :message \"%@\"\r\n \"mailto:%@\";\r\n", message, v];

// if (alwaysSend)
// [script insertString: notify atIndex: 0];
Expand Down
2 changes: 2 additions & 0 deletions UI/PreferencesUI/English.lproj/Localizable.strings
Expand Up @@ -82,6 +82,8 @@

/* notification */
"Notify incoming messsages" = "Notify incoming messsages";
"Notification Message Sent" = "Notification message sent";
"Notification Message" = "Notification of new message on %{0}";

/* d & t */
"Time Zone" = "Time Zone";
Expand Down
2 changes: 2 additions & 0 deletions UI/PreferencesUI/French.lproj/Localizable.strings
Expand Up @@ -82,6 +82,8 @@

/* notify messages */
"Notify incoming messsages" = "Notifier les messages entrants";
"Notification Message Sent" = "Message de notification envoyé";
"Notification Message" = "Nouveau message reçu sur %{0}";

/* d & t */
"Time Zone" = "Fuseau horaire";
Expand Down
11 changes: 10 additions & 1 deletion UI/Templates/PreferencesUI/UIxPreferences.wox
Expand Up @@ -1437,11 +1437,20 @@
</md-autocomplete>
</md-chips>
</md-input-container>

<md-input-container class="md-block md-flex md-input-has-placeholder">
<label><var:string label:value="Notification Message Sent"/></label>
<textarea name="notificationMessage"
id="notificationMessage"
ng-model="app.preferences.defaults.Notification.notificationMessage"
ng-required="app.preferences.defaults.Notification.enabled == 1">
</textarea>
</md-input-container>
</div>
</div>
</md-tab>
</var:if>
<!-- END OF MAIL > FORWARD -->
<!-- END OF MAIL > NOTIFICATIONS -->

</md-tabs>
</var:if>
Expand Down
Expand Up @@ -20,6 +20,8 @@
this.autocomplete = {forward: [], notification: []};
this.mailLabelKeyRE = new RegExp(/^(?!^_\$)[^(){} %*\"\\\\]*?$/);
this.emailSeparatorKeys = Preferences.defaults.emailSeparatorKeys;
if (!Preferences.defaults.Notification.notificationMessage)
this.preferences.defaults.Notification.notificationMessage = l('Notification Message', $window.defaultEmailAddresses);
if (Preferences.defaults.SOGoMailAutoMarkAsReadMode == 'delay')
this.mailAutoMarkAsReadDelay = Math.max(1, this.preferences.defaults.SOGoMailAutoMarkAsReadDelay);
else
Expand Down Expand Up @@ -724,7 +726,7 @@
});
}
else {
recipient = contact.$shortFormat();
recipient = contact.$$email;
}

if (recipient)
Expand Down

0 comments on commit 6b64705

Please sign in to comment.