feature: Added a irc_alert_short option to only send the alert title (#8312)

* Add a irc_alert_short option to only send the alert title

* Add doc for 'irc_alert_short'
This commit is contained in:
Arzhel Younsi
2018-03-03 02:52:47 +09:00
committed by Neil Lathwood
parent 5af51fa46f
commit 7eda8d9989
3 changed files with 16 additions and 10 deletions

View File

@@ -259,11 +259,13 @@ class IRCBot
if ($this->config['irc_alert_chan']) {
foreach ($this->config['irc_alert_chan'] as $chan) {
$this->ircRaw('PRIVMSG '.$chan.' :'.$severity.trim($alert['title']));
foreach (explode("\n", $alert['msg']) as $line) {
// We don't need to repeat the title
$line = strip_tags($line);
if (trim($line) != trim($alert['title'])) {
$this->ircRaw('PRIVMSG '.$chan.' :'.$line);
if (!$this->config['irc_alert_short']) { // Only send the title if set to short
foreach (explode("\n", $alert['msg']) as $line) {
// We don't need to repeat the title
$line = strip_tags($line);
if (trim($line) != trim($alert['title'])) {
$this->ircRaw('PRIVMSG '.$chan.' :'.$line);
}
}
}
}
@@ -271,11 +273,13 @@ class IRCBot
foreach ($this->authd as $nick => $data) {
if ($data['expire'] >= time()) {
$this->ircRaw('PRIVMSG '.$nick.' :'.$severity.trim($alert['title']));
foreach (explode("\n", $alert['msg']) as $line) {
// We don't need to repeat the title
$line = strip_tags($line);
if (trim($line) != trim($alert['title'])) {
$this->ircRaw('PRIVMSG '.$nick.' :'.$line);
if (!$this->config['irc_alert_short']) { // Only send the title if set to short
foreach (explode("\n", $alert['msg']) as $line) {
// We don't need to repeat the title
$line = strip_tags($line);
if (trim($line) != trim($alert['title'])) {
$this->ircRaw('PRIVMSG '.$nick.' :'.$line);
}
}
}
}