aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Weiske <cweiske@cweiske.de>2014-12-01 18:11:57 +0100
committerChristian Weiske <cweiske@cweiske.de>2014-12-01 18:11:57 +0100
commiteee192bea92b2c206dd172a03287438185d58bfc (patch)
tree432c4105d2874cfa03af5928173e46eec6278141 /src
parent884e4dd0464c9bf08d94f4c197e1f2835aca30d0 (diff)
downloadauerswald-callnotifier-eee192bea92b2c206dd172a03287438185d58bfc.tar.gz
auerswald-callnotifier-eee192bea92b2c206dd172a03287438185d58bfc.zip
more debugging for sendxmpp logger
Diffstat (limited to 'src')
-rw-r--r--src/callnotifier/Logger/CallSendXmpp.php19
1 files changed, 13 insertions, 6 deletions
diff --git a/src/callnotifier/Logger/CallSendXmpp.php b/src/callnotifier/Logger/CallSendXmpp.php
index c970430..33fc6da 100644
--- a/src/callnotifier/Logger/CallSendXmpp.php
+++ b/src/callnotifier/Logger/CallSendXmpp.php
@@ -8,7 +8,7 @@ namespace callnotifier;
class Logger_CallSendXmpp extends Logger_CallBase
{
protected $recipients;
- protected $debug = false;
+ public $debug = false;
public function __construct($recipients, $callTypes = 'i', $msns = array())
{
@@ -61,19 +61,26 @@ class Logger_CallSendXmpp extends Logger_CallBase
$runInBackground = ' > /dev/null 2>&1 &';
if ($this->debug) {
$runInBackground = '';
- echo $msg . "\n";
+ echo "Message:\n" . $msg . "\n";
+ echo 'Sending to ' . count((array) $this->recipients)
+ . " recipients\n";
}
foreach ((array)$this->recipients as $recipient) {
//use system instead of exec to make debugging possible
- system(
- 'echo ' . escapeshellarg($msg)
+ $cmd = 'echo ' . escapeshellarg($msg)
. ' | sendxmpp'
. ' --message-type=headline'//no offline storage
. ' --resource callnotifier'
. ' ' . escapeshellarg($recipient)
- . $runInBackground
- );
+ . $runInBackground;
+ if ($this->debug) {
+ echo "Executing:\n" . $cmd . "\n";
+ }
+ system($cmd, $retval);
+ if ($this->debug) {
+ echo 'Exit code: ' . $retval . "\n";
+ }
}
}
}