From decd480c42630338e909bf9bfce6b2c3e5cdaae5 Mon Sep 17 00:00:00 2001 From: Simey Lameze Date: Mon, 5 Oct 2020 13:35:56 +0800 Subject: [PATCH] MDL-65743 lib: add XMPPHP namespace and update calls --- lib/classes/component.php | 1 + message/output/jabber/message_output_jabber.php | 6 ++---- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/classes/component.php b/lib/classes/component.php index fa25ae4dd90..e3366b6a6e3 100644 --- a/lib/classes/component.php +++ b/lib/classes/component.php @@ -96,6 +96,7 @@ class core_component { 'MoodleHQ\\RTLCSS' => 'lib/rtlcss', 'ScssPhp\\ScssPhp' => 'lib/scssphp', 'Box\\Spout' => 'lib/spout/src/Spout', + 'BirknerAlex\\XMPPHP' => 'lib/jabber/XMPP', 'MatthiasMullie\\Minify' => 'lib/minify/matthiasmullie-minify/src/', 'MatthiasMullie\\PathConverter' => 'lib/minify/matthiasmullie-pathconverter/src/', 'IMSGlobal\LTI' => 'lib/ltiprovider/src', diff --git a/message/output/jabber/message_output_jabber.php b/message/output/jabber/message_output_jabber.php index 7556cd73da7..f2c2a6bab39 100644 --- a/message/output/jabber/message_output_jabber.php +++ b/message/output/jabber/message_output_jabber.php @@ -23,8 +23,6 @@ */ require_once($CFG->dirroot.'/message/output/lib.php'); -require_once($CFG->libdir.'/jabber/XMPP/XMPP.php'); - /** * The jabber message processor * @@ -76,7 +74,7 @@ class message_output_jabber extends message_output { $jabbermessage .= "\n(".get_string('noreply','message').')'; - $conn = new XMPPHP_XMPP($CFG->jabberhost,$CFG->jabberport,$CFG->jabberusername,$CFG->jabberpassword,'moodle',$CFG->jabberserver); + $conn = new \BirknerAlex\XMPPHP\XMPP($CFG->jabberhost,$CFG->jabberport,$CFG->jabberusername,$CFG->jabberpassword,'moodle',$CFG->jabberserver); // No need to track the presence during the sending message process. $conn->track_presence = false; @@ -88,7 +86,7 @@ class message_output_jabber extends message_output { $conn->presence(); $conn->message($jabberaddress, $jabbermessage); $conn->disconnect(); - } catch(XMPPHP_Exception $e) { + } catch(\BirknerAlex\XMPPHP\Exception $e) { debugging($e->getMessage()); return false; } -- 2.43.0