summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/maildaemon.php5
-rwxr-xr-xscripts/xmppdaemon.php10
2 files changed, 13 insertions, 2 deletions
diff --git a/scripts/maildaemon.php b/scripts/maildaemon.php
index 64f913bf9..8b809f646 100755
--- a/scripts/maildaemon.php
+++ b/scripts/maildaemon.php
@@ -120,6 +120,9 @@ class MailerDaemon {
}
function add_notice($user, $msg) {
+ // should test
+ // $msg_shortened = common_shorten_links($msg);
+ // if (mb_strlen($msg_shortened) > 140) ERROR and STOP
$notice = Notice::saveNew($user->id, $msg, 'mail');
if (is_string($notice)) {
$this->log(LOG_ERR, $notice);
@@ -209,4 +212,4 @@ class MailerDaemon {
}
$md = new MailerDaemon();
-$md->handle_message('php://stdin'); \ No newline at end of file
+$md->handle_message('php://stdin');
diff --git a/scripts/xmppdaemon.php b/scripts/xmppdaemon.php
index 90506a0f4..e55b9e3e9 100755
--- a/scripts/xmppdaemon.php
+++ b/scripts/xmppdaemon.php
@@ -236,7 +236,15 @@ class XMPPDaemon extends Daemon {
}
function add_notice(&$user, &$pl) {
- $notice = Notice::saveNew($user->id, trim(mb_substr($pl['body'], 0, 140)), 'xmpp');
+ $content_shortened = common_shorten_link($pl['body']);
+ if (mb_strlen($content_shortened) > 140) {
+ $content = trim(mb_substr($pl['body'], 0, 140));
+ $content_shortened = common_shorten_link($content);
+ }
+ else {
+ $content = $pl['body'];
+ }
+ $notice = Notice::saveNew($user->id, $content, 'xmpp');
if (is_string($notice)) {
$this->log(LOG_ERR, $notice);
return;