MDL-65743 lib: add XMPPHP namespace and update calls
authorSimey Lameze <simey@moodle.com>
Mon, 5 Oct 2020 05:35:56 +0000 (13:35 +0800)
committerSimey Lameze <simey@moodle.com>
Mon, 5 Oct 2020 05:37:51 +0000 (13:37 +0800)
lib/classes/component.php
message/output/jabber/message_output_jabber.php

index fa25ae4..e3366b6 100644 (file)
@@ -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',
index 7556cd7..f2c2a6b 100644 (file)
@@ -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;
         }