- $content_shortened = common_shorten_link($body);
- if (mb_strlen($content_shortened) > 140) {
- $content = trim(mb_substr($body, 0, 140));
- $content_shortened = common_shorten_link($content);
- }
- else {
- $content = $body;
+ $content_shortened = common_shorten_links($body);
+ if (Notice::contentTooLong($content_shortened)) {
+ $from = jabber_normalize_jid($pl['from']);
+ $this->from_site($from, sprintf(_("Message too long - maximum is %d characters, you sent %d"),
+ Notice::maxContent(),
+ mb_strlen($content_shortened)));
+ return;