summaryrefslogtreecommitdiff
path: root/lib/command.php
diff options
context:
space:
mode:
authorEvan Prodromou <evan@controlyourself.ca>2009-08-21 16:27:43 -0400
committerEvan Prodromou <evan@controlyourself.ca>2009-08-21 16:27:43 -0400
commit9f356b55c6f419468771c0f3c2450010c0242abe (patch)
tree4cd175c7ef96380b5be82722581d63cf2f2fcb30 /lib/command.php
parent5dc1291b59a1079cbe9bab05d12dae06b8e4c96d (diff)
parenta645d0468b368c7c659b440f72ec80498055ac3e (diff)
Merge branch '0.9.x' into openidplugin
Conflicts: actions/login.php actions/register.php
Diffstat (limited to 'lib/command.php')
-rw-r--r--lib/command.php16
1 files changed, 10 insertions, 6 deletions
diff --git a/lib/command.php b/lib/command.php
index 4e2280bc8..371386dc5 100644
--- a/lib/command.php
+++ b/lib/command.php
@@ -211,16 +211,20 @@ class MessageCommand extends Command
function execute($channel)
{
$other = User::staticGet('nickname', common_canonical_nickname($this->other));
+
$len = mb_strlen($this->text);
+
if ($len == 0) {
$channel->error($this->user, _('No content!'));
return;
- } else if ($len > 140) {
- $content = common_shorten_links($content);
- if (mb_strlen($content) > 140) {
- $channel->error($this->user, sprintf(_('Message too long - maximum is 140 characters, you sent %d'), $len));
- return;
- }
+ }
+
+ $this->text = common_shorten_links($this->text);
+
+ if (Message::contentTooLong($this->text)) {
+ $channel->error($this->user, sprintf(_('Message too long - maximum is %d characters, you sent %d'),
+ Message::maxContent(), mb_strlen($this->text)));
+ return;
}
if (!$other) {