]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
trim the body of an incoming message
authorEvan Prodromou <evan@prodromou.name>
Sun, 14 Dec 2008 00:22:39 +0000 (19:22 -0500)
committerEvan Prodromou <evan@prodromou.name>
Sun, 14 Dec 2008 00:22:39 +0000 (19:22 -0500)
darcs-hash:20081214002239-84dde-9d4d15f37b48ed1830c0423e7e34cb11c7cf9c2d.gz

scripts/xmppdaemon.php

index f460ec6e1a5e020a68477c868a91813520e264e5..9a60970a6e99414ec86b0f9cc594d2a67c35962a 100755 (executable)
@@ -236,13 +236,14 @@ class XMPPDaemon extends Daemon {
        }
 
        function add_notice(&$user, &$pl) {
-        $content_shortened = common_shorten_link($pl['body']);
+        $body = trim($pl['body']);
+        $content_shortened = common_shorten_link($body);
         if (mb_strlen($content_shortened) > 140) {
-            $content = trim(mb_substr($pl['body'], 0, 140));
+            $content = trim(mb_substr($body, 0, 140));
             $content_shortened = common_shorten_link($content);
         }
         else {
-            $content = $pl['body'];
+            $content = $body;
         }
                $notice = Notice::saveNew($user->id, $content, 'xmpp');
                if (is_string($notice)) {