]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - plugins/Xmpp/XmppPlugin.php
Fix plural issue.
[quix0rs-gnu-social.git] / plugins / Xmpp / XmppPlugin.php
index a2521536bcfdbbd240932636263406c097a6b3b4..f7df6812cf3db6a294b17d5084ccd2730d595009 100644 (file)
@@ -34,8 +34,6 @@ if (!defined('STATUSNET')) {
     exit(1);
 }
 
-set_include_path(get_include_path() . PATH_SEPARATOR . INSTALLDIR . '/extlib/XMPPHP');
-
 /**
  * Plugin for XMPP
  *
@@ -256,7 +254,7 @@ class XmppPlugin extends ImPlugin
         return false;
     }
 
-    function daemon_screenname()
+    function daemonScreenname()
     {
         $ret = $this->user . '@' . $this->server;
         if($this->resource)
@@ -287,7 +285,7 @@ class XmppPlugin extends ImPlugin
         switch ($cls)
         {
         case 'XMPPHP_XMPP':
-            require_once 'XMPP.php';
+            require_once $dir . '/extlib/XMPPHP/XMPP.php';
             return false;
         case 'Sharing_XMPP':
         case 'Queued_XMPP':
@@ -313,14 +311,14 @@ class XmppPlugin extends ImPlugin
         return 'xmpp:' . $screenname;    
     }
 
-    function send_message($screenname, $body)
+    function sendMessage($screenname, $body)
     {
         $this->queuedConnection()->message($screenname, $body, 'chat');
     }
 
-    function send_notice($screenname, $notice)
+    function sendNotice($screenname, $notice)
     {
-        $msg   = $this->format_notice($notice);
+        $msg   = $this->formatNotice($notice);
         $entry = $this->format_entry($notice);
         
         $this->queuedConnection()->message($screenname, $msg, 'chat', null, $entry);
@@ -356,8 +354,9 @@ class XmppPlugin extends ImPlugin
         $xs->text(" ");
         $xs->element('a', array(
             'href'=>common_local_url('conversation',
-                array('id' => $notice->conversation)).'#notice-'.$notice->id
-             ),sprintf(_('[%s]'),$notice->id));
+                array('id' => $notice->conversation)).'#notice-'.$notice->id),
+             // TRANS: %s is a notice ID.
+             sprintf(_m('[%s]'),$notice->id));
         $xs->elementEnd('body');
         $xs->elementEnd('html');
 
@@ -366,21 +365,21 @@ class XmppPlugin extends ImPlugin
         return $html . ' ' . $entry;
     }
 
-    function receive_raw_message($pl)
+    function receiveRawMessage($pl)
     {
         $from = $this->normalize($pl['from']);
 
         if ($pl['type'] != 'chat') {
-            common_log(LOG_WARNING, "Ignoring message of type ".$pl['type']." from $from.");
-            return true;
+            $this->log(LOG_WARNING, "Ignoring message of type ".$pl['type']." from $from: " . $pl['xml']->toString());
+            return;
         }
 
         if (mb_strlen($pl['body']) == 0) {
-            common_log(LOG_WARNING, "Ignoring message with empty body from $from.");
-            return true;
+            $this->log(LOG_WARNING, "Ignoring message with empty body from $from: "  . $pl['xml']->toString());
+            return;
         }
 
-        $this->handle_incoming($from, $pl['body']);
+        $this->handleIncoming($from, $pl['body']);
         
         return true;
     }