summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/maildaemon.php22
-rwxr-xr-xscripts/ombqueuehandler.php2
-rwxr-xr-xscripts/xmppdaemon.php6
3 files changed, 17 insertions, 13 deletions
diff --git a/scripts/maildaemon.php b/scripts/maildaemon.php
index 11911dcbd..5705cfd50 100755
--- a/scripts/maildaemon.php
+++ b/scripts/maildaemon.php
@@ -66,9 +66,10 @@ class MailerDaemon
}
$msg = $this->cleanup_msg($msg);
$msg = common_shorten_links($msg);
- if (mb_strlen($msg) > 140) {
- $this->error($from,_('That\'s too long. '.
- 'Max notice size is 140 chars.'));
+ if (Notice::contentTooLong($msg)) {
+ $this->error($from, sprintf(_('That\'s too long. '.
+ 'Max notice size is %d chars.'),
+ Notice::maxContent()));
}
$fileRecords = array();
foreach($attachments as $attachment){
@@ -78,9 +79,9 @@ class MailerDaemon
die('error() should trigger an exception before reaching here.');
}
$filename = $this->saveFile($user, $attachment,$mimetype);
-
+
fclose($attachment);
-
+
if (empty($filename)) {
$this->error($from,_('Couldn\'t save file.'));
}
@@ -96,9 +97,10 @@ class MailerDaemon
$short_fileurl = common_shorten_url($fileurl);
$msg .= ' ' . $short_fileurl;
- if (mb_strlen($msg) > 140) {
+ if (Notice::contentTooLong($msg)) {
$this->deleteFile($filename);
- $this->error($from,_('Max notice size is 140 chars, including attachment URL.'));
+ $this->error($from, sprintf(_('Max notice size is %d chars, including attachment URL.'),
+ Notice::maxContent()));
}
// Also, not sure this is necessary -- Zach
@@ -123,7 +125,7 @@ class MailerDaemon
$stream = stream_get_meta_data($attachment);
if (copy($stream['uri'], $filepath) && chmod($filepath,0664)) {
return $filename;
- } else {
+ } else {
$this->error(null,_('File could not be moved to destination directory.' . $stream['uri'] . ' ' . $filepath));
}
}
@@ -152,7 +154,7 @@ class MailerDaemon
}
function maybeAddRedir($file_id, $url)
- {
+ {
$file_redir = File_redirection::staticGet('url', $url);
if (empty($file_redir)) {
@@ -273,7 +275,7 @@ class MailerDaemon
}
function attachFile($notice, $filerec)
- {
+ {
File_to_post::processNew($filerec->id, $notice->id);
$this->maybeAddRedir($filerec->id,
diff --git a/scripts/ombqueuehandler.php b/scripts/ombqueuehandler.php
index 8e685f1c8..be33b9821 100755
--- a/scripts/ombqueuehandler.php
+++ b/scripts/ombqueuehandler.php
@@ -57,7 +57,7 @@ class OmbQueueHandler extends QueueHandler
$this->log(LOG_DEBUG, 'Ignoring remote notice ' . $notice->id);
return true;
} else {
- return omb_broadcast_remote_subscribers($notice);
+ return omb_broadcast_notice($notice);
}
}
diff --git a/scripts/xmppdaemon.php b/scripts/xmppdaemon.php
index 9e621e725..1b1aec3e6 100755
--- a/scripts/xmppdaemon.php
+++ b/scripts/xmppdaemon.php
@@ -316,9 +316,11 @@ class XMPPDaemon extends Daemon
{
$body = trim($pl['body']);
$content_shortened = common_shorten_links($body);
- if (mb_strlen($content_shortened) > 140) {
+ if (Notice::contentTooLong($content_shortened)) {
$from = jabber_normalize_jid($pl['from']);
- $this->from_site($from, "Message too long - maximum is 140 characters, you sent ".mb_strlen($content_shortened));
+ $this->from_site($from, sprintf(_("Message too long - maximum is %d characters, you sent %d"),
+ Notice::maxContent(),
+ mb_strlen($content_shortened)));
return;
}
$notice = Notice::saveNew($user->id, $content_shortened, 'xmpp');