[Xfce4-commits] <moka:master> Take the group string length into account.

Jannis Pohlmann noreply at xfce.org
Mon Jan 17 18:12:01 CET 2011


Updating branch refs/heads/master
         to 62c9d2a289c4e137ef65163f3d086055563c228c (commit)
       from 6a3b71d02a80b536635fc89701af734e507e9334 (commit)

commit 62c9d2a289c4e137ef65163f3d086055563c228c
Author: Jannis Pohlmann <jannis at xfce.org>
Date:   Mon Jan 17 18:10:40 2011 +0100

    Take the group string length into account.

 lib/controllers/announcements.rb |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/lib/controllers/announcements.rb b/lib/controllers/announcements.rb
index b9faa10..d43a8cf 100755
--- a/lib/controllers/announcements.rb
+++ b/lib/controllers/announcements.rb
@@ -24,8 +24,13 @@ module Moka
           end
 
           unless error_set?
-            if params[:text].size > 140
-              error_set(:text, 'Message length is limited to 140 characters.')
+            group_length = if env['identica'].group then 1 + env['identica'].group.size else 0 end
+            if params[:text].size > (140 - group_string_length)
+              if group_length > 0
+                error_set(:text, "Message length is limited to 140 characters including the <tt>!#{env['identica'].group}</tt> that will be appended to the message.")
+              else
+                error_set(:text, 'Message length is limited to 140 characters.')
+              end
             end
           end
 



More information about the Xfce4-commits mailing list