]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - lib/jabber.php
Remove more contractions
[quix0rs-gnu-social.git] / lib / jabber.php
index 7d584ad0164edc18155e4e541f9025b14ace0294..d666fcbb3838899e14486bcf930ec49e044794da 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * Laconica, the distributed open-source microblogging tool
+ * StatusNet, the distributed open-source microblogging tool
  *
  * utility functions for Jabber/GTalk/XMPP messages
  *
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  *
  * @category  Network
- * @package   Laconica
- * @author    Evan Prodromou <evan@controlyourself.ca>
- * @copyright 2008 Control Yourself, Inc.
+ * @package   StatusNet
+ * @author    Evan Prodromou <evan@status.net>
+ * @copyright 2008 StatusNet, Inc.
  * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
- * @link      http://laconi.ca/
+ * @link      http://status.net/
  */
 
-if (!defined('LACONICA')) {
+if (!defined('STATUSNET') && !defined('LACONICA')) {
     exit(1);
 }
 
@@ -67,7 +67,7 @@ function jabber_normalize_jid($jid)
 }
 
 /**
- * the JID of the Jabber daemon for this Laconica instance
+ * the JID of the Jabber daemon for this StatusNet instance
  *
  * @return string JID of the Jabber daemon
  */
@@ -77,6 +77,14 @@ function jabber_daemon_address()
     return common_config('xmpp', 'user') . '@' . common_config('xmpp', 'server');
 }
 
+class Sharing_XMPP extends XMPPHP_XMPP
+{
+    function getSocket()
+    {
+        return $this->socket;
+    }
+}
+
 /**
  * connect the configured Jabber account to the configured server
  *
@@ -89,7 +97,7 @@ function jabber_connect($resource=null)
 {
     static $conn = null;
     if (!$conn) {
-        $conn = new XMPPHP_XMPP(common_config('xmpp', 'host') ?
+        $conn = new Sharing_XMPP(common_config('xmpp', 'host') ?
                                 common_config('xmpp', 'host') :
                                 common_config('xmpp', 'server'),
                                 common_config('xmpp', 'port'),
@@ -168,6 +176,7 @@ function jabber_format_entry($profile, $notice)
     $xs = new XMLStringer();
     $xs->elementStart('html', array('xmlns' => 'http://jabber.org/protocol/xhtml-im'));
     $xs->elementStart('body', array('xmlns' => 'http://www.w3.org/1999/xhtml'));
+    $xs->element("img", array('src'=> $profile->avatarUrl(AVATAR_MINI_SIZE) , 'alt' => $profile->nickname));
     $xs->element('a', array('href' => $profile->profileurl),
                  $profile->nickname);
     $xs->text(": ");
@@ -176,6 +185,11 @@ function jabber_format_entry($profile, $notice)
     } else {
         $xs->raw(common_render_content($notice->content, $notice));
     }
+    $xs->raw(" ");
+    $xs->element('a', array(
+        'href'=>common_local_url('conversation',
+            array('id' => $notice->conversation)).'#notice-'.$notice->id
+         ),sprintf(_('notice id: %s'),$notice->id));
     $xs->elementEnd('body');
     $xs->elementEnd('html');
 
@@ -301,7 +315,7 @@ function jabber_special_presence($type, $to=null, $show=null, $status=null)
  * who have Jabber addresses, and have Jabber notification enabled, and
  * have this subscription enabled for Jabber. It also sends the notice to
  * all recipients of @-replies who have Jabber addresses and Jabber notification
- * enabled. This is really the heart of Jabber distribution in Laconica.
+ * enabled. This is really the heart of Jabber distribution in StatusNet.
  *
  * @param Notice $notice The notice to broadcast
  *
@@ -423,7 +437,7 @@ function jabber_public_notice($notice)
 
     $public = common_config('xmpp', 'public');
 
-    // FIXME PRIV don't send out private messages here
+    // FIXME PRIV do not send out private messages here
     // XXX: should we send out non-local messages if public,localonly
     // = false? I think not