Hi Dave.
I know you may eventually add customizable alert messages, but in the meantime could this be achieved temporarily by a code hack? I would like to send alerts to end users and they phreak out with the verbage ***FREENATS ALERT***, etc
Thanks!
Custom alerts
Re: Custom alerts
Hi Paul,
This bit is well due a rewrite to make it more configurable etc. But yes a code hack can be done for the moment.
In server/base/freenats.inc.php - from line 187 onwards in the current version is this code:
The $row['esubject'] checks are for blank (0), short (1) or long (2).
As for the body - the actual alerts themselves are stored in $row['mdata'] and if the type is short (0) then they are just put in, otherwise it pads them with the header etc.
I can very easily implement some config variables to replace these i.e. site.alert.shortsubject site.alert.longsubject etc or I could make them configurable on a per-action basis in the interface (take a bit longer).
Cheers,
Dave.
This bit is well due a rewrite to make it more configurable etc. But yes a code hack can be done for the moment.
In server/base/freenats.inc.php - from line 187 onwards in the current version is this code:
Code: Select all
if ($row['atype']=="email")
{
if ($row['esubject']==0) $sub="";
else if ($row['esubject']==1) $sub="FreeNATS Alert";
else $sub="** FreeNATS Alert **";
$body="";
if ($row['etype']==0) $body=$row['mdata'];
else $body="FreeNATS Alert,\r\n".$row['mdata']."\r\n--FreeNATS @ ".nicedt(time());
As for the body - the actual alerts themselves are stored in $row['mdata'] and if the type is short (0) then they are just put in, otherwise it pads them with the header etc.
I can very easily implement some config variables to replace these i.e. site.alert.shortsubject site.alert.longsubject etc or I could make them configurable on a per-action basis in the interface (take a bit longer).
Cheers,
Dave.
-
- Posts: 92
- Joined: Thu Sep 04, 2008 9:48 pm
Re: Custom alerts
Hi Dave.
I think the variables would be fine, especially if I'm the only one requesting this mod. In the meantime I just hacked my code.
Thanks again!
Paul
I think the variables would be fine, especially if I'm the only one requesting this mod. In the meantime I just hacked my code.
Thanks again!
Paul
Re: Custom alerts
Hi,
This has been done in the latest dev version (1.01.10a) now available for download. I'll update the wiki but for the moment...
alert.subject.long and alert.subject.short define the long and short subjects in email alerts (default to "FreeNATS Alert" and "** FreeNATS Alert **" repectively)
alert.body.header is the very top of a long email with a few newlines after it before the alerts themselves (defaults to "FreeNATS Alert,")
alert.body.footer is an optional footer added after the alerts in a long email (defaults to nothing)
Cheers,
Dave.
This has been done in the latest dev version (1.01.10a) now available for download. I'll update the wiki but for the moment...
alert.subject.long and alert.subject.short define the long and short subjects in email alerts (default to "FreeNATS Alert" and "** FreeNATS Alert **" repectively)
alert.body.header is the very top of a long email with a few newlines after it before the alerts themselves (defaults to "FreeNATS Alert,")
alert.body.footer is an optional footer added after the alerts in a long email (defaults to nothing)
Cheers,
Dave.