From 7b5dab6185ff5fc4a8ffd8a4c3c28dfda86561d2 Mon Sep 17 00:00:00 2001 From: Alexandre Russo Date: Wed, 21 May 2014 12:25:05 +0200 Subject: [PATCH] PHPCI/Plugin/Xmpp.php : Fix command to send to system --- PHPCI/Plugin/Xmpp.php | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/PHPCI/Plugin/Xmpp.php b/PHPCI/Plugin/Xmpp.php index 9f4c0696..6cf4576f 100644 --- a/PHPCI/Plugin/Xmpp.php +++ b/PHPCI/Plugin/Xmpp.php @@ -189,17 +189,24 @@ class XMPP implements \PHPCI\Plugin /* * Send XMPP notification for all recipients */ - $success = array() + $cmd = $sendxmpp . "%s -f .sendxmpprc -m %s %s"; + $recipients = ''; foreach($this->recipients as $recipient) { - if($cmd = $this->phpci->executeCommand('echo %s | ' . $sendxmpp . - ' %s %s', $this->getMessage(), $tls, $recipients)) { - $success[] = $cmd; - } - - print $this->phpci->getLastOutput(); + if(!empty($recipients)) + $recipients .= ' '; + $recipients .= $recipient; } - return (count($success) === count($this->recipients)); + $success = $this->phpci->executeCommand( + $cmd, $tls, $message_file, $recipients); + print $this->phpci->getLastOutput(); + + /* + * Remove temp message file + */ + $this->phpci->executeCommand("rm -rf ".$message_file); + + return $success; } /**