summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorEvan Prodromou <evan@controlyourself.ca>2009-08-21 07:21:29 -0400
committerEvan Prodromou <evan@controlyourself.ca>2009-08-21 07:21:29 -0400
commiteb309f788bc9e52fd7108e024e58594b425de426 (patch)
tree40dd38a0fc69533e24f83977b2f4b38caf366261 /lib
parentd88839d167e136c5f585e3584b4fee5ba6e5795f (diff)
correctly check Message length for d-commands
Diffstat (limited to 'lib')
-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) {