social_stream 0.19.2 → 0.19.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.travis.yml +1 -1
 - data/README.rdoc +1 -1
 - data/base/app/assets/stylesheets/cheesecake.css.scss +43 -12
 - data/base/app/controllers/contacts_controller.rb +1 -1
 - data/base/app/models/activity.rb +4 -1
 - data/base/app/models/actor.rb +2 -14
 - data/base/app/models/relation.rb +2 -4
 - data/base/app/models/relation/single.rb +2 -7
 - data/base/app/models/tie.rb +2 -1
 - data/base/app/views/activities/_new.html.erb +1 -1
 - data/base/app/views/cheesecake/_cheesecake.html.erb +170 -105
 - data/base/app/views/cheesecake/_index.html.erb +45 -47
 - data/base/app/views/cheesecake/_sector_form.html.erb +1 -0
 - data/base/app/views/toolbar/_home.html.erb +1 -1
 - data/base/config/locales/en.yml +2 -0
 - data/base/config/locales/es.yml +2 -0
 - data/base/config/locales/rails.es.yml +192 -0
 - data/base/db/migrate/20110912074426_add_reject_relation.rb +2 -2
 - data/base/db/migrate/20120201185454_singleton_single_relations.rb +46 -0
 - data/base/lib/social_stream/base/version.rb +1 -1
 - data/base/lib/tasks/db/populate.rake +1 -1
 - data/base/spec/controllers/posts_controller_spec.rb +2 -2
 - data/base/spec/factories/activity.rb +1 -1
 - data/base/spec/factories/post.rb +1 -1
 - data/base/spec/factories/tie.rb +3 -3
 - data/base/spec/models/activity_authorization_spec.rb +3 -3
 - data/base/spec/support/db.rb +3 -1
 - data/documents/app/assets/images/48/{word.png → doc.png} +0 -0
 - data/documents/app/assets/images/48/{excel.png → xls.png} +0 -0
 - data/documents/lib/social_stream/documents/version.rb +1 -1
 - data/documents/social_stream-documents.gemspec +1 -1
 - data/documents/spec/factories/document.rb +1 -1
 - data/documents/spec/factories/picture.rb +1 -1
 - data/documents/spec/support/db.rb +3 -3
 - data/events/app/views/events/_sidebar_calendar.html.erb +5 -5
 - data/events/lib/social_stream/events/version.rb +1 -1
 - data/events/social_stream-events.gemspec +1 -1
 - data/lib/social_stream/version.rb +1 -1
 - data/linkser/db/migrate/20120202104549_add_links_foreign_key.rb +9 -0
 - data/presence/app/assets/javascripts/chat_interface_manager.js.erb +167 -177
 - data/presence/app/assets/javascripts/chat_persistence.js +194 -0
 - data/presence/app/assets/javascripts/chat_utilities.js +15 -0
 - data/presence/app/assets/javascripts/chat_window_manager.js +57 -1
 - data/presence/app/assets/javascripts/xmpp_client_management.js.erb +191 -143
 - data/presence/app/assets/stylesheets/chat.css.scss +4 -5
 - data/presence/app/views/chat/_contacts.html.erb +2 -5
 - data/presence/app/views/chat/_index.html.erb +46 -32
 - data/presence/app/views/chat/_off.html.erb +2 -2
 - data/presence/config/routes.rb +1 -1
 - data/presence/lib/social_stream/presence/version.rb +1 -1
 - data/presence/vendor/assets/javascripts/jquery.ui.chatbox.js +14 -11
 - data/social_stream.gemspec +4 -4
 - data/spec/support/db.rb +4 -4
 - metadata +37 -32
 
| 
         @@ -35,7 +35,7 @@ Factory.define :self_activity, :parent => :activity do |a| 
     | 
|
| 
       35 
35 
     | 
    
         
             
            end
         
     | 
| 
       36 
36 
     | 
    
         | 
| 
       37 
37 
     | 
    
         
             
            Factory.define :public_activity, :parent => :activity do |a|
         
     | 
| 
       38 
     | 
    
         
            -
              a.relation_ids  { |b| Array( 
     | 
| 
      
 38 
     | 
    
         
            +
              a.relation_ids  { |b| Array(Relation::Public.instance.id) }
         
     | 
| 
       39 
39 
     | 
    
         
             
            end
         
     | 
| 
       40 
40 
     | 
    
         | 
| 
       41 
41 
     | 
    
         
             
            Factory.define :like_activity, :class => 'Activity' do |a|
         
     | 
    
        data/base/spec/factories/post.rb
    CHANGED
    
    
    
        data/base/spec/factories/tie.rb
    CHANGED
    
    | 
         @@ -13,11 +13,11 @@ Factory.define :acquaintance, :parent => :tie do |t| 
     | 
|
| 
       13 
13 
     | 
    
         
             
            end
         
     | 
| 
       14 
14 
     | 
    
         | 
| 
       15 
15 
     | 
    
         
             
            Factory.define :public, :parent => :tie do |t|
         
     | 
| 
       16 
     | 
    
         
            -
              t.after_build { |u| u.relation =  
     | 
| 
      
 16 
     | 
    
         
            +
              t.after_build { |u| u.relation = Relation::Public.instance }
         
     | 
| 
       17 
17 
     | 
    
         
             
            end
         
     | 
| 
       18 
18 
     | 
    
         | 
| 
       19 
19 
     | 
    
         
             
            Factory.define :reject, :parent => :tie do |t|
         
     | 
| 
       20 
     | 
    
         
            -
              t.after_build { |u| u.relation =  
     | 
| 
      
 20 
     | 
    
         
            +
              t.after_build { |u| u.relation = Relation::Reject.instance }
         
     | 
| 
       21 
21 
     | 
    
         
             
            end
         
     | 
| 
       22 
22 
     | 
    
         | 
| 
       23 
23 
     | 
    
         
             
            # Group ties
         
     | 
| 
         @@ -38,6 +38,6 @@ Factory.define :partner, :parent => :g2g_tie do |t| 
     | 
|
| 
       38 
38 
     | 
    
         
             
            end
         
     | 
| 
       39 
39 
     | 
    
         | 
| 
       40 
40 
     | 
    
         
             
            Factory.define :group_public, :parent => :g2g_tie do |t|
         
     | 
| 
       41 
     | 
    
         
            -
              t.after_build { |u| u.relation =  
     | 
| 
      
 41 
     | 
    
         
            +
              t.after_build { |u| u.relation = Relation::Public.instance }
         
     | 
| 
       42 
42 
     | 
    
         
             
            end
         
     | 
| 
       43 
43 
     | 
    
         | 
| 
         @@ -89,7 +89,7 @@ describe Activity do 
     | 
|
| 
       89 
89 
     | 
    
         
             
                context "with public activity" do
         
     | 
| 
       90 
90 
     | 
    
         
             
                  before do
         
     | 
| 
       91 
91 
     | 
    
         
             
                    contact = @user.contact_to!(@user)
         
     | 
| 
       92 
     | 
    
         
            -
                    create_activity(contact,  
     | 
| 
      
 92 
     | 
    
         
            +
                    create_activity(contact, Relation::Public.instance)
         
     | 
| 
       93 
93 
     | 
    
         
             
                  end
         
     | 
| 
       94 
94 
     | 
    
         | 
| 
       95 
95 
     | 
    
         
             
                  describe "sender home" do
         
     | 
| 
         @@ -219,7 +219,7 @@ describe Activity do 
     | 
|
| 
       219 
219 
     | 
    
         
             
                describe "belonging to user's public relation" do
         
     | 
| 
       220 
220 
     | 
    
         | 
| 
       221 
221 
     | 
    
         
             
                  before do
         
     | 
| 
       222 
     | 
    
         
            -
                    create_activity(@user.contact_to!(@user),  
     | 
| 
      
 222 
     | 
    
         
            +
                    create_activity(@user.contact_to!(@user), Relation::Public.instance)
         
     | 
| 
       223 
223 
     | 
    
         
             
                  end
         
     | 
| 
       224 
224 
     | 
    
         | 
| 
       225 
225 
     | 
    
         
             
                  describe "accessed by the sender" do
         
     | 
| 
         @@ -271,7 +271,7 @@ describe Activity do 
     | 
|
| 
       271 
271 
     | 
    
         | 
| 
       272 
272 
     | 
    
         
             
                  before do
         
     | 
| 
       273 
273 
     | 
    
         
             
                    @tie = Factory(:public)
         
     | 
| 
       274 
     | 
    
         
            -
                    create_activity @tie.contact,  
     | 
| 
      
 274 
     | 
    
         
            +
                    create_activity @tie.contact, Relation::Public.instance
         
     | 
| 
       275 
275 
     | 
    
         
             
                    create_ability_accessed_by @tie.receiver_subject
         
     | 
| 
       276 
276 
     | 
    
         
             
                  end
         
     | 
| 
       277 
277 
     | 
    
         | 
    
        data/base/spec/support/db.rb
    CHANGED
    
    
| 
         
            File without changes
         
     | 
| 
         
            File without changes
         
     | 
| 
         @@ -12,7 +12,7 @@ Gem::Specification.new do |s| 
     | 
|
| 
       12 
12 
     | 
    
         
             
              s.files = `git ls-files`.split("\n")
         
     | 
| 
       13 
13 
     | 
    
         | 
| 
       14 
14 
     | 
    
         
             
              # Gem dependencies
         
     | 
| 
       15 
     | 
    
         
            -
              s.add_runtime_dependency('social_stream-base', '~> 0.14. 
     | 
| 
      
 15 
     | 
    
         
            +
              s.add_runtime_dependency('social_stream-base', '~> 0.14.3')
         
     | 
| 
       16 
16 
     | 
    
         
             
              s.add_runtime_dependency('paperclip-ffmpeg', '~> 0.7.0')
         
     | 
| 
       17 
17 
     | 
    
         
             
              s.add_runtime_dependency('paperclip','= 2.4.5')
         
     | 
| 
       18 
18 
     | 
    
         
             
              s.add_runtime_dependency('delayed_paperclip','2.4.5.1')
         
     | 
| 
         @@ -9,7 +9,7 @@ end 
     | 
|
| 
       9 
9 
     | 
    
         | 
| 
       10 
10 
     | 
    
         
             
            Factory.define :public_document, :parent => :document do |d|
         
     | 
| 
       11 
11 
     | 
    
         
             
              d.owner_id  { |q| q.author_id }
         
     | 
| 
       12 
     | 
    
         
            -
              d._relation_ids { |q| Array( 
     | 
| 
      
 12 
     | 
    
         
            +
              d._relation_ids { |q| Array(Relation::Public.instance.id) }
         
     | 
| 
       13 
13 
     | 
    
         
             
            end
         
     | 
| 
       14 
14 
     | 
    
         | 
| 
       15 
15 
     | 
    
         
             
            Factory.define :private_document, :parent => :document do |d|
         
     | 
| 
         @@ -9,7 +9,7 @@ end 
     | 
|
| 
       9 
9 
     | 
    
         | 
| 
       10 
10 
     | 
    
         
             
            Factory.define :public_picture, :parent => :picture do |p|
         
     | 
| 
       11 
11 
     | 
    
         
             
              p.owner_id  { |q| q.author_id }
         
     | 
| 
       12 
     | 
    
         
            -
              p._relation_ids { |q| Array( 
     | 
| 
      
 12 
     | 
    
         
            +
              p._relation_ids { |q| Array(Relation::Public.instance.id) }
         
     | 
| 
       13 
13 
     | 
    
         
             
            end
         
     | 
| 
       14 
14 
     | 
    
         | 
| 
       15 
15 
     | 
    
         
             
            Factory.define :private_picture, :parent => :picture do |p|
         
     | 
| 
         @@ -1,8 +1,8 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            require 'social_stream/migrations/documents'
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
       3 
     | 
    
         
            -
             
     | 
| 
       4 
     | 
    
         
            -
             
     | 
| 
       5 
     | 
    
         
            -
             
     | 
| 
      
 3 
     | 
    
         
            +
            ActiveRecord::Base.connection.tables.each do |t|
         
     | 
| 
      
 4 
     | 
    
         
            +
              ActiveRecord::Base.connection.drop_table t
         
     | 
| 
      
 5 
     | 
    
         
            +
            end
         
     | 
| 
       6 
6 
     | 
    
         | 
| 
       7 
7 
     | 
    
         
             
            SocialStream::Migrations::Base.new.up
         
     | 
| 
       8 
8 
     | 
    
         
             
            SocialStream::Migrations::Documents.new.up
         
     | 
| 
         @@ -3,7 +3,7 @@ 
     | 
|
| 
       3 
3 
     | 
    
         
             
            <div class="block">
         
     | 
| 
       4 
4 
     | 
    
         
             
              <div class="content">
         
     | 
| 
       5 
5 
     | 
    
         | 
| 
       6 
     | 
    
         
            -
                <% bow = (Time.now -  
     | 
| 
      
 6 
     | 
    
         
            +
                <% bow = (Time.now - 6.days).beginning_of_week %>
         
     | 
| 
       7 
7 
     | 
    
         | 
| 
       8 
8 
     | 
    
         
             
                <%= render :partial => 'events/calendar_month',
         
     | 
| 
       9 
9 
     | 
    
         
             
                           :locals  => {
         
     | 
| 
         @@ -17,8 +17,8 @@ 
     | 
|
| 
       17 
17 
     | 
    
         
             
                  <% day = bow + i.days %>
         
     | 
| 
       18 
18 
     | 
    
         | 
| 
       19 
19 
     | 
    
         
             
                  <%= raw cycle(*(Array.wrap("<tr>") + 6.times.map{""}) + Array.wrap(:name => "tr_start")) %>
         
     | 
| 
       20 
     | 
    
         
            -
                  <td id="sidebar_day_<%= day.day %>_<%= day.month %>_<%= day.year %>" 
     | 
| 
       21 
     | 
    
         
            -
                    <%= link_to day.day, polymorphic_path([profile_or_current_subject, Event.new], :date => day.to_i, :view => " 
     | 
| 
      
 20 
     | 
    
         
            +
                  <td id="sidebar_day_<%= day.day %>_<%= day.month %>_<%= day.year %>">
         
     | 
| 
      
 21 
     | 
    
         
            +
                    <%= link_to day.day, polymorphic_path([profile_or_current_subject, Event.new], :date => day.to_i, :view => "agendaWeek") %>
         
     | 
| 
       22 
22 
     | 
    
         
             
                  </td>
         
     | 
| 
       23 
23 
     | 
    
         | 
| 
       24 
24 
     | 
    
         
             
                  <%= raw cycle(*(6.times.map{""} + Array.wrap('</tr>') + Array.wrap(:name => "tr_end"))) %>
         
     | 
| 
         @@ -29,12 +29,12 @@ 
     | 
|
| 
       29 
29 
     | 
    
         
             
                var now = new Date();
         
     | 
| 
       30 
30 
     | 
    
         
             
                $('#sidebar_day_' + now.getDate() + '_' + (now.getMonth()+1) + '_' + now.getFullYear()).addClass('today');
         
     | 
| 
       31 
31 
     | 
    
         
             
                var re = new RegExp('sidebar_day_(..?)_(..?)_(..?.?.?)');
         
     | 
| 
       32 
     | 
    
         
            -
                $(' 
     | 
| 
      
 32 
     | 
    
         
            +
                $('#sidebar_calendar td').each(function(index, domEl){
         
     | 
| 
       33 
33 
     | 
    
         
             
                  var m = re.exec(domEl.id);
         
     | 
| 
       34 
34 
     | 
    
         
             
                  if(m == null) return;
         
     | 
| 
       35 
35 
     | 
    
         
             
                  var d = new Date(m[3], (m[2]-1), m[1], 23, 59, 59);
         
     | 
| 
       36 
36 
     | 
    
         
             
                  if(d < now) $(domEl).addClass('past');
         
     | 
| 
       37 
     | 
    
         
            -
                  if(m[2] != (now.getMonth()+1)) $(domEl).addClass('next_month');
         
     | 
| 
      
 37 
     | 
    
         
            +
                  if(m[2] != (now.getMonth()+1) && d > now) $(domEl).addClass('next_month');
         
     | 
| 
       38 
38 
     | 
    
         
             
                });
         
     | 
| 
       39 
39 
     | 
    
         
             
                $.ajax({
         
     | 
| 
       40 
40 
     | 
    
         
             
                  dataType: 'json',
         
     | 
| 
         @@ -12,7 +12,7 @@ Gem::Specification.new do |s| 
     | 
|
| 
       12 
12 
     | 
    
         
             
              s.files = `git ls-files`.split("\n")
         
     | 
| 
       13 
13 
     | 
    
         | 
| 
       14 
14 
     | 
    
         
             
              # Gem dependencies
         
     | 
| 
       15 
     | 
    
         
            -
              s.add_runtime_dependency('social_stream-base', '~> 0.14. 
     | 
| 
      
 15 
     | 
    
         
            +
              s.add_runtime_dependency('social_stream-base', '~> 0.14.3')
         
     | 
| 
       16 
16 
     | 
    
         
             
              s.add_runtime_dependency('rails-scheduler', '~> 0.0.6')
         
     | 
| 
       17 
17 
     | 
    
         
             
              s.add_runtime_dependency('coffee-rails', '>= 3.1.0')
         
     | 
| 
       18 
18 
     | 
    
         | 
| 
         @@ -1,17 +1,3 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            ////////////////////
         
     | 
| 
       2 
     | 
    
         
            -
            //Hash table
         
     | 
| 
       3 
     | 
    
         
            -
            ////////////////////
         
     | 
| 
       4 
     | 
    
         
            -
             
     | 
| 
       5 
     | 
    
         
            -
            //Keys: Xmpp status
         
     | 
| 
       6 
     | 
    
         
            -
            //Value: Social Stream Status
         
     | 
| 
       7 
     | 
    
         
            -
            var statusIcons = new Array();
         
     | 
| 
       8 
     | 
    
         
            -
            statusIcons[''] = "available";
         
     | 
| 
       9 
     | 
    
         
            -
            statusIcons['chat'] = "available";
         
     | 
| 
       10 
     | 
    
         
            -
            statusIcons['away'] = "away";
         
     | 
| 
       11 
     | 
    
         
            -
            statusIcons['xa'] = "away";
         
     | 
| 
       12 
     | 
    
         
            -
            statusIcons['dnd'] = "dnd";
         
     | 
| 
       13 
     | 
    
         
            -
             
     | 
| 
       14 
     | 
    
         
            -
             
     | 
| 
       15 
1 
     | 
    
         
             
            ////////////////////
         
     | 
| 
       16 
2 
     | 
    
         
             
            //Reconnect button interface functions
         
     | 
| 
       17 
3 
     | 
    
         
             
            ////////////////////
         
     | 
| 
         @@ -21,18 +7,18 @@ var periodBetweenAttempts=15; //(seg) 
     | 
|
| 
       21 
7 
     | 
    
         
             
            var connectButtonTimerCounter=periodBetweenAttempts+1;
         
     | 
| 
       22 
8 
     | 
    
         | 
| 
       23 
9 
     | 
    
         
             
            function connectButtonTimerFunction(){
         
     | 
| 
       24 
     | 
    
         
            -
             
     | 
| 
       25 
     | 
    
         
            -
             
     | 
| 
       26 
     | 
    
         
            -
             
     | 
| 
       27 
     | 
    
         
            -
             
     | 
| 
       28 
     | 
    
         
            -
             
     | 
| 
      
 10 
     | 
    
         
            +
                connectButtonTimerCounter++;
         
     | 
| 
      
 11 
     | 
    
         
            +
                if (connectButtonTimerCounter > (periodBetweenAttempts-1)) {
         
     | 
| 
      
 12 
     | 
    
         
            +
                  clearTimeout(connectButtonTimer);
         
     | 
| 
      
 13 
     | 
    
         
            +
                  $("#chat_header_title").html('<%=I18n.t('chat.disconnected')%>')
         
     | 
| 
      
 14 
     | 
    
         
            +
                }
         
     | 
| 
       29 
15 
     | 
    
         
             
            }
         
     | 
| 
       30 
16 
     | 
    
         | 
| 
       31 
17 
     | 
    
         
             
            function requestConnectToChat(){
         
     | 
| 
       32 
18 
     | 
    
         
             
              if (connectButtonTimerCounter > (periodBetweenAttempts-1)) {
         
     | 
| 
       33 
19 
     | 
    
         
             
                connectButtonTimerCounter=0;
         
     | 
| 
       34 
     | 
    
         
            -
             
     | 
| 
       35 
     | 
    
         
            -
             
     | 
| 
      
 20 
     | 
    
         
            +
                connectButtonTimer = setInterval("connectButtonTimerFunction()", 1000) 
         
     | 
| 
      
 21 
     | 
    
         
            +
                $("#chat_header_title").html('<%=I18n.t('chat.connecting')%>')
         
     | 
| 
       36 
22 
     | 
    
         
             
                return true
         
     | 
| 
       37 
23 
     | 
    
         
             
              } else {
         
     | 
| 
       38 
24 
     | 
    
         
             
                return false
         
     | 
| 
         @@ -45,48 +31,48 @@ function requestConnectToChat(){ 
     | 
|
| 
       45 
31 
     | 
    
         
             
            ////////////////////
         
     | 
| 
       46 
32 
     | 
    
         | 
| 
       47 
33 
     | 
    
         
             
            function setUserFunctions(){
         
     | 
| 
       48 
     | 
    
         
            -
             
     | 
| 
       49 
     | 
    
         
            -
             
     | 
| 
       50 
     | 
    
         
            -
             
     | 
| 
       51 
     | 
    
         
            -
             
     | 
| 
       52 
     | 
    
         
            -
             
     | 
| 
       53 
     | 
    
         
            -
             
     | 
| 
       54 
     | 
    
         
            -
             
     | 
| 
       55 
     | 
    
         
            -
             
     | 
| 
       56 
     | 
    
         
            -
             
     | 
| 
       57 
     | 
    
         
            -
             
     | 
| 
       58 
     | 
    
         
            -
             
     | 
| 
       59 
     | 
    
         
            -
             
     | 
| 
       60 
     | 
    
         
            -
             
     | 
| 
      
 34 
     | 
    
         
            +
              
         
     | 
| 
      
 35 
     | 
    
         
            +
              $("div.user_presence").click(function(event, ui){
         
     | 
| 
      
 36 
     | 
    
         
            +
                var guest_name = $(this).attr("name");
         
     | 
| 
      
 37 
     | 
    
         
            +
                var guest_slug = $(this).attr("slug");
         
     | 
| 
      
 38 
     | 
    
         
            +
                var guest_jid = guest_slug + "@" + domain;
         
     | 
| 
      
 39 
     | 
    
         
            +
                
         
     | 
| 
      
 40 
     | 
    
         
            +
                if (createChatBox(guest_slug, guest_name, guest_jid, user_name, user_jid)) {
         
     | 
| 
      
 41 
     | 
    
         
            +
                } else {
         
     | 
| 
      
 42 
     | 
    
         
            +
                  window[getChatVariableFromSlug(guest_slug)].chatbox("option", "boxManager").toggleBox(true);
         
     | 
| 
      
 43 
     | 
    
         
            +
                };
         
     | 
| 
      
 44 
     | 
    
         
            +
              });
         
     | 
| 
      
 45 
     | 
    
         
            +
              
         
     | 
| 
      
 46 
     | 
    
         
            +
              
         
     | 
| 
       61 
47 
     | 
    
         
             
            ////////////////////
         
     | 
| 
       62 
48 
     | 
    
         
             
            //Chat interface: Status selector
         
     | 
| 
       63 
49 
     | 
    
         
             
            ////////////////////
         
     | 
| 
       64 
50 
     | 
    
         | 
| 
       65 
     | 
    
         
            -
             
     | 
| 
       66 
     | 
    
         
            -
             
     | 
| 
       67 
     | 
    
         
            -
             
     | 
| 
       68 
     | 
    
         
            -
             
     | 
| 
      
 51 
     | 
    
         
            +
              //JQuery DropdwanStatus
         
     | 
| 
      
 52 
     | 
    
         
            +
              
         
     | 
| 
      
 53 
     | 
    
         
            +
              $(".dropdown dt a").click(function(event) {
         
     | 
| 
      
 54 
     | 
    
         
            +
                event.preventDefault();
         
     | 
| 
       69 
55 
     | 
    
         
             
                $(".dropdown dd ul").toggle();
         
     | 
| 
       70 
     | 
    
         
            -
             
     | 
| 
       71 
     | 
    
         
            -
             
     | 
| 
       72 
     | 
    
         
            -
             
     | 
| 
       73 
     | 
    
         
            -
             
     | 
| 
       74 
     | 
    
         
            -
             
     | 
| 
       75 
     | 
    
         
            -
             
     | 
| 
       76 
     | 
    
         
            -
             
     | 
| 
       77 
     | 
    
         
            -
             
     | 
| 
       78 
     | 
    
         
            -
             
     | 
| 
      
 56 
     | 
    
         
            +
                
         
     | 
| 
      
 57 
     | 
    
         
            +
                if($(".dropdown dd ul").is(":visible")){
         
     | 
| 
      
 58 
     | 
    
         
            +
                  setStatusWidgetTitle("default");
         
     | 
| 
      
 59 
     | 
    
         
            +
                } else {
         
     | 
| 
      
 60 
     | 
    
         
            +
                  setStatusWidgetTitle(userStatus);
         
     | 
| 
      
 61 
     | 
    
         
            +
                }
         
     | 
| 
      
 62 
     | 
    
         
            +
                
         
     | 
| 
      
 63 
     | 
    
         
            +
                restartAwayTimer();
         
     | 
| 
      
 64 
     | 
    
         
            +
                
         
     | 
| 
       79 
65 
     | 
    
         
             
              });
         
     | 
| 
       80 
66 
     | 
    
         | 
| 
       81 
67 
     | 
    
         
             
              $(".dropdown dd ul li a.option").click(function(event) { 
         
     | 
| 
       82 
     | 
    
         
            -
             
     | 
| 
       83 
     | 
    
         
            -
             
     | 
| 
       84 
     | 
    
         
            -
             
     | 
| 
       85 
     | 
    
         
            -
             
     | 
| 
       86 
     | 
    
         
            -
             
     | 
| 
       87 
     | 
    
         
            -
             
     | 
| 
       88 
     | 
    
         
            -
             
     | 
| 
       89 
     | 
    
         
            -
             
     | 
| 
      
 68 
     | 
    
         
            +
                event.preventDefault();
         
     | 
| 
      
 69 
     | 
    
         
            +
                userStatus = $(this).find("span.value").html();
         
     | 
| 
      
 70 
     | 
    
         
            +
                if(userStatus == "offline"){
         
     | 
| 
      
 71 
     | 
    
         
            +
                  disconnectStrophe();
         
     | 
| 
      
 72 
     | 
    
         
            +
                } else {
         
     | 
| 
      
 73 
     | 
    
         
            +
                  sendStatus(userStatus);
         
     | 
| 
      
 74 
     | 
    
         
            +
                }
         
     | 
| 
      
 75 
     | 
    
         
            +
                $(".dropdown dd ul").hide();
         
     | 
| 
       90 
76 
     | 
    
         
             
              });
         
     | 
| 
       91 
77 
     | 
    
         | 
| 
       92 
78 
     | 
    
         | 
| 
         @@ -95,35 +81,40 @@ function setUserFunctions(){ 
     | 
|
| 
       95 
81 
     | 
    
         
             
                if (! $clicked.parents().hasClass("dropdown")){
         
     | 
| 
       96 
82 
     | 
    
         
             
                  //Click outside the select...
         
     | 
| 
       97 
83 
     | 
    
         
             
                    $(".dropdown dd ul").hide();
         
     | 
| 
       98 
     | 
    
         
            -
             
     | 
| 
      
 84 
     | 
    
         
            +
                    setStatusWidgetTitle(userStatus);
         
     | 
| 
       99 
85 
     | 
    
         
             
                }
         
     | 
| 
       100 
86 
     | 
    
         
             
              });
         
     | 
| 
       101 
     | 
    
         
            -
             
     | 
| 
      
 87 
     | 
    
         
            +
              
         
     | 
| 
       102 
88 
     | 
    
         
             
            }
         
     | 
| 
       103 
89 
     | 
    
         | 
| 
       104 
90 
     | 
    
         
             
            function setStatusWidgetTitle(status){
         
     | 
| 
       105 
     | 
    
         
            -
             
     | 
| 
       106 
     | 
    
         
            -
            	if 
     | 
| 
       107 
     | 
    
         
            -
            		 
     | 
| 
      
 91 
     | 
    
         
            +
              
         
     | 
| 
      
 92 
     | 
    
         
            +
            	if((status in sstreamChatStatus)){
         
     | 
| 
      
 93 
     | 
    
         
            +
            		status = sstreamChatStatus[status];
         
     | 
| 
       108 
94 
     | 
    
         
             
            	}
         
     | 
| 
       109 
95 
     | 
    
         | 
| 
       110 
     | 
    
         
            -
            	 
     | 
| 
       111 
     | 
    
         
            -
             
     | 
| 
      
 96 
     | 
    
         
            +
            	
         
     | 
| 
      
 97 
     | 
    
         
            +
              if ($(".dropdown dt a span").length == 0){
         
     | 
| 
      
 98 
     | 
    
         
            +
                return;
         
     | 
| 
      
 99 
     | 
    
         
            +
              }
         
     | 
| 
      
 100 
     | 
    
         
            +
              
         
     | 
| 
      
 101 
     | 
    
         
            +
              if(status=="default"){
         
     | 
| 
      
 102 
     | 
    
         
            +
                var defaultTitle = '<%=I18n.t('chat.status.choose')%>'
         
     | 
| 
       112 
103 
     | 
    
         
             
                $(".dropdown dt a span").html(defaultTitle);
         
     | 
| 
       113 
     | 
    
         
            -
             
     | 
| 
      
 104 
     | 
    
         
            +
                return;
         
     | 
| 
       114 
105 
     | 
    
         
             
              }
         
     | 
| 
       115 
     | 
    
         
            -
             
     | 
| 
       116 
     | 
    
         
            -
             
     | 
| 
       117 
     | 
    
         
            -
             
     | 
| 
      
 106 
     | 
    
         
            +
              
         
     | 
| 
      
 107 
     | 
    
         
            +
              if(status=="offline"){
         
     | 
| 
      
 108 
     | 
    
         
            +
                var text = $("#" + status).html();
         
     | 
| 
       118 
109 
     | 
    
         
             
                $(".dropdown dt a span").html(text);
         
     | 
| 
       119 
     | 
    
         
            -
             
     | 
| 
       120 
     | 
    
         
            -
             
     | 
| 
       121 
     | 
    
         
            -
             
     | 
| 
       122 
     | 
    
         
            -
              if ((status in statusIcons)&&($("#" + statusIcons[status]).length > 0)) { 
     | 
| 
       123 
     | 
    
         
            -
             
     | 
| 
      
 110 
     | 
    
         
            +
                return;
         
     | 
| 
      
 111 
     | 
    
         
            +
              }
         
     | 
| 
      
 112 
     | 
    
         
            +
              
         
     | 
| 
      
 113 
     | 
    
         
            +
              if ((status in statusIcons)&&($("#" + statusIcons[status]).length > 0)) {   
         
     | 
| 
      
 114 
     | 
    
         
            +
                var text = $("#" + statusIcons[status]).html();
         
     | 
| 
       124 
115 
     | 
    
         
             
                $(".dropdown dt a span").html(text);
         
     | 
| 
       125 
116 
     | 
    
         
             
              }
         
     | 
| 
       126 
     | 
    
         
            -
             
     | 
| 
      
 117 
     | 
    
         
            +
               
         
     | 
| 
       127 
118 
     | 
    
         
             
            }
         
     | 
| 
       128 
119 
     | 
    
         | 
| 
       129 
120 
     | 
    
         | 
| 
         @@ -132,34 +123,29 @@ function setStatusWidgetTitle(status){ 
     | 
|
| 
       132 
123 
     | 
    
         
             
            ////////////////////
         
     | 
| 
       133 
124 
     | 
    
         | 
| 
       134 
125 
     | 
    
         
             
            function awayTimerFunction(){
         
     | 
| 
       135 
     | 
    
         
            -
             
     | 
| 
       136 
     | 
    
         
            -
             
     | 
| 
       137 
     | 
    
         
            -
             
     | 
| 
       138 
     | 
    
         
            -
             
     | 
| 
       139 
     | 
    
         
            -
             
     | 
| 
       140 
     | 
    
         
            -
             
     | 
| 
       141 
     | 
    
         
            -
             
     | 
| 
       142 
     | 
    
         
            -
             
     | 
| 
      
 126 
     | 
    
         
            +
                awayCounter++;
         
     | 
| 
      
 127 
     | 
    
         
            +
                if (awayCounter > (awayTime/awayTimerPeriod)){
         
     | 
| 
      
 128 
     | 
    
         
            +
                  if ((userStatus != "dnd")&&(userStatus != "away")) {
         
     | 
| 
      
 129 
     | 
    
         
            +
                    userStatus = "autoaway";
         
     | 
| 
      
 130 
     | 
    
         
            +
                    sendStatus(userStatus);
         
     | 
| 
      
 131 
     | 
    
         
            +
                  }
         
     | 
| 
      
 132 
     | 
    
         
            +
                  clearTimeout(awayTimer);
         
     | 
| 
      
 133 
     | 
    
         
            +
                }
         
     | 
| 
       143 
134 
     | 
    
         
             
            }
         
     | 
| 
       144 
135 
     | 
    
         | 
| 
       145 
     | 
    
         
            -
            function  
     | 
| 
       146 
     | 
    
         
            -
             
     | 
| 
       147 
     | 
    
         
            -
                  userStatus = " 
     | 
| 
      
 136 
     | 
    
         
            +
            function autochangeStatusIfAutoAway(){
         
     | 
| 
      
 137 
     | 
    
         
            +
                if (userStatus == "autoaway"){
         
     | 
| 
      
 138 
     | 
    
         
            +
                  userStatus = "available";
         
     | 
| 
       148 
139 
     | 
    
         
             
                  sendStatus(userStatus);
         
     | 
| 
       149 
140 
     | 
    
         
             
                }
         
     | 
| 
       150 
141 
     | 
    
         
             
            }
         
     | 
| 
       151 
142 
     | 
    
         | 
| 
       152 
     | 
    
         
            -
            function restartAwayTimer( 
     | 
| 
       153 
     | 
    
         
            -
             
     | 
| 
       154 
     | 
    
         
            -
             
     | 
| 
       155 
     | 
    
         
            -
             
     | 
| 
       156 
     | 
    
         
            -
             
     | 
| 
       157 
     | 
    
         
            -
             
     | 
| 
       158 
     | 
    
         
            -
                    autochangeStatusOnUserAway();
         
     | 
| 
       159 
     | 
    
         
            -
                  }
         
     | 
| 
       160 
     | 
    
         
            -
            		}
         
     | 
| 
       161 
     | 
    
         
            -
            		
         
     | 
| 
       162 
     | 
    
         
            -
            		awayCounter = 0;		
         
     | 
| 
      
 143 
     | 
    
         
            +
            function restartAwayTimer(){   
         
     | 
| 
      
 144 
     | 
    
         
            +
                if (awayCounter > (awayTime/awayTimerPeriod)){
         
     | 
| 
      
 145 
     | 
    
         
            +
                  awayTimer = setInterval("awayTimerFunction()", awayTimerPeriod);
         
     | 
| 
      
 146 
     | 
    
         
            +
                  autochangeStatusIfAutoAway();
         
     | 
| 
      
 147 
     | 
    
         
            +
                }  
         
     | 
| 
      
 148 
     | 
    
         
            +
                awayCounter = 0;    
         
     | 
| 
       163 
149 
     | 
    
         
             
            }
         
     | 
| 
       164 
150 
     | 
    
         | 
| 
       165 
151 
     | 
    
         | 
| 
         @@ -168,82 +154,86 @@ function restartAwayTimer(autochangeStatus){ 
     | 
|
| 
       168 
154 
     | 
    
         
             
            ////////////////////
         
     | 
| 
       169 
155 
     | 
    
         | 
| 
       170 
156 
     | 
    
         
             
            function timerFunction(){
         
     | 
| 
       171 
     | 
    
         
            -
                timerCounter++; 
     | 
| 
       172 
     | 
    
         
            -
             
     | 
| 
      
 157 
     | 
    
         
            +
                timerCounter++; 
         
     | 
| 
      
 158 
     | 
    
         
            +
                
         
     | 
| 
       173 
159 
     | 
    
         
             
                if((timerCounter > cyclesToRefresh)&&(requestContacts)) {
         
     | 
| 
       174 
160 
     | 
    
         
             
                    requestContacts = false;
         
     | 
| 
       175 
161 
     | 
    
         
             
                    updateChatWindow();
         
     | 
| 
       176 
     | 
    
         
            -
             
     | 
| 
      
 162 
     | 
    
         
            +
                }
         
     | 
| 
       177 
163 
     | 
    
         
             
            }
         
     | 
| 
       178 
164 
     | 
    
         | 
| 
       179 
165 
     | 
    
         | 
| 
       180 
166 
     | 
    
         
             
            function refreshChatWindow(){  
         
     | 
| 
       181 
     | 
    
         
            -
             
     | 
| 
       182 
     | 
    
         
            -
             
     | 
| 
       183 
     | 
    
         
            -
             
     | 
| 
       184 
     | 
    
         
            -
             
     | 
| 
       185 
     | 
    
         
            -
             
     | 
| 
      
 167 
     | 
    
         
            +
                if(timerCounter > cyclesToRefresh){
         
     | 
| 
      
 168 
     | 
    
         
            +
                  updateChatWindow();
         
     | 
| 
      
 169 
     | 
    
         
            +
                } else {
         
     | 
| 
      
 170 
     | 
    
         
            +
                  requestContacts = true;
         
     | 
| 
      
 171 
     | 
    
         
            +
                }
         
     | 
| 
       186 
172 
     | 
    
         
             
            }
         
     | 
| 
       187 
173 
     | 
    
         | 
| 
       188 
174 
     | 
    
         | 
| 
       189 
175 
     | 
    
         
             
            function updateChatWindow(){
         
     | 
| 
       190 
     | 
    
         
            -
             
     | 
| 
       191 
     | 
    
         
            -
             
     | 
| 
       192 
     | 
    
         
            -
             
     | 
| 
      
 176 
     | 
    
         
            +
              timerCounter=0;
         
     | 
| 
      
 177 
     | 
    
         
            +
              log("updateChatWindow()");
         
     | 
| 
      
 178 
     | 
    
         
            +
              var stropheConnectedAndOnlineStatus = ((isStropheConnected()) && (userStatus!="offline") && (!disconnectionFlag));
         
     | 
| 
       193 
179 
     | 
    
         
             
              $.post("/chatWindow", { userConnected: stropheConnectedAndOnlineStatus }, function(data){
         
     | 
| 
       194 
     | 
    
         
            -
             
     | 
| 
      
 180 
     | 
    
         
            +
                  $(".tooltip").hide() //Prevent tooltips
         
     | 
| 
       195 
181 
     | 
    
         
             
                  $("#chat_partial").html(data);
         
     | 
| 
       196 
182 
     | 
    
         
             
                  if (isStropheConnected()) {
         
     | 
| 
       197 
     | 
    
         
            -
             
     | 
| 
      
 183 
     | 
    
         
            +
                    setStatusWidgetTitle(userStatus);
         
     | 
| 
       198 
184 
     | 
    
         
             
                    $(".user_presence a[title]").tooltip();
         
     | 
| 
       199 
185 
     | 
    
         
             
                    setUserFunctions();
         
     | 
| 
      
 186 
     | 
    
         
            +
                    if (afterNewConnectionFlag){
         
     | 
| 
      
 187 
     | 
    
         
            +
                      afterNewConnectionFlag = false;
         
     | 
| 
      
 188 
     | 
    
         
            +
                      restoreChatData();
         
     | 
| 
      
 189 
     | 
    
         
            +
                    }
         
     | 
| 
       200 
190 
     | 
    
         
             
                  }
         
     | 
| 
       201 
191 
     | 
    
         
             
              });
         
     | 
| 
       202 
192 
     | 
    
         
             
            }
         
     | 
| 
       203 
193 
     | 
    
         | 
| 
       204 
194 
     | 
    
         
             
            function getConnectionBoxFromSlug(slug){
         
     | 
| 
       205 
     | 
    
         
            -
             
     | 
| 
       206 
     | 
    
         
            -
             
     | 
| 
       207 
     | 
    
         
            -
             
     | 
| 
       208 
     | 
    
         
            -
             
     | 
| 
       209 
     | 
    
         
            -
             
     | 
| 
      
 195 
     | 
    
         
            +
              if ($('div.user_presence[slug=' + slug + ']').length > 0){
         
     | 
| 
      
 196 
     | 
    
         
            +
                return ($('div.user_presence[slug=' + slug + ']'))[0];
         
     | 
| 
      
 197 
     | 
    
         
            +
              }  else {
         
     | 
| 
      
 198 
     | 
    
         
            +
                return null;
         
     | 
| 
      
 199 
     | 
    
         
            +
              }
         
     | 
| 
       210 
200 
     | 
    
         
             
            }
         
     | 
| 
       211 
201 
     | 
    
         | 
| 
       212 
202 
     | 
    
         
             
            var cacheConnectedUsers = [];
         
     | 
| 
       213 
203 
     | 
    
         
             
            function hideConnectionBoxFromSlug(slug){
         
     | 
| 
       214 
204 
     | 
    
         
             
              if ($('div.user_presence[slug=' + slug + ']').length > 0){
         
     | 
| 
       215 
205 
     | 
    
         
             
                $('div.user_presence[slug=' + slug + ']').hide();
         
     | 
| 
       216 
     | 
    
         
            -
             
     | 
| 
       217 
     | 
    
         
            -
             
     | 
| 
       218 
     | 
    
         
            -
             
     | 
| 
      
 206 
     | 
    
         
            +
                if(cacheConnectedUsers.indexOf(slug)==-1){
         
     | 
| 
      
 207 
     | 
    
         
            +
                  cacheConnectedUsers.push(slug);
         
     | 
| 
      
 208 
     | 
    
         
            +
                }
         
     | 
| 
       219 
209 
     | 
    
         
             
              }
         
     | 
| 
       220 
210 
     | 
    
         
             
            }
         
     | 
| 
       221 
211 
     | 
    
         | 
| 
       222 
212 
     | 
    
         
             
            function showConnectionBoxFromSlug(slug){
         
     | 
| 
       223 
213 
     | 
    
         
             
              if ($('div.user_presence[slug=' + slug + ']').length > 0){
         
     | 
| 
       224 
     | 
    
         
            -
             
     | 
| 
       225 
     | 
    
         
            -
             
     | 
| 
       226 
     | 
    
         
            -
             
     | 
| 
      
 214 
     | 
    
         
            +
                if (!($('div.user_presence[slug=' + slug + ']').is(":visible"))){
         
     | 
| 
      
 215 
     | 
    
         
            +
                   $('div.user_presence[slug=' + slug + ']').show();
         
     | 
| 
      
 216 
     | 
    
         
            +
                }
         
     | 
| 
       227 
217 
     | 
    
         
             
              }
         
     | 
| 
       228 
218 
     | 
    
         
             
            }
         
     | 
| 
       229 
219 
     | 
    
         | 
| 
       230 
220 
     | 
    
         
             
            function setUserIconStatus(slug, status){
         
     | 
| 
       231 
     | 
    
         
            -
             
     | 
| 
       232 
     | 
    
         
            -
             
     | 
| 
       233 
     | 
    
         
            -
             
     | 
| 
       234 
     | 
    
         
            -
             
     | 
| 
      
 221 
     | 
    
         
            +
               if (status in statusIcons) {
         
     | 
| 
      
 222 
     | 
    
         
            +
                 iconName = statusIcons[status];
         
     | 
| 
      
 223 
     | 
    
         
            +
                 var $img_status = $('img.presence_status');
         
     | 
| 
      
 224 
     | 
    
         
            +
                 connectionBox = getConnectionBoxFromSlug(slug);
         
     | 
| 
       235 
225 
     | 
    
         
             
                 $(connectionBox).find($img_status).attr("src", "/assets/status/" + iconName + ".png")
         
     | 
| 
       236 
226 
     | 
    
         
             
               }
         
     | 
| 
       237 
227 
     | 
    
         
             
            }
         
     | 
| 
       238 
228 
     | 
    
         | 
| 
       239 
229 
     | 
    
         
             
            function getAllConnectedSlugs(){
         
     | 
| 
       240 
     | 
    
         
            -
             
     | 
| 
      
 230 
     | 
    
         
            +
              connectedSlugs=[];
         
     | 
| 
       241 
231 
     | 
    
         
             
              connectionBoxes = $('div.user_presence[slug]');
         
     | 
| 
       242 
     | 
    
         
            -
             
     | 
| 
       243 
     | 
    
         
            -
             
     | 
| 
       244 
     | 
    
         
            -
             
     | 
| 
       245 
     | 
    
         
            -
             
     | 
| 
       246 
     | 
    
         
            -
             
     | 
| 
      
 232 
     | 
    
         
            +
              $.each(connectionBoxes, function(index, value) {
         
     | 
| 
      
 233 
     | 
    
         
            +
                  if($(value).is(":visible")){
         
     | 
| 
      
 234 
     | 
    
         
            +
                      connectedSlugs.push($(value).attr("slug"))
         
     | 
| 
      
 235 
     | 
    
         
            +
                  }
         
     | 
| 
      
 236 
     | 
    
         
            +
              });
         
     | 
| 
       247 
237 
     | 
    
         
             
              return connectedSlugs
         
     | 
| 
       248 
238 
     | 
    
         
             
            }
         
     | 
| 
       249 
239 
     | 
    
         | 
| 
         @@ -253,47 +243,47 @@ function getAllConnectedSlugs(){ 
     | 
|
| 
       253 
243 
     | 
    
         
             
            ////////////////////
         
     | 
| 
       254 
244 
     | 
    
         | 
| 
       255 
245 
     | 
    
         
             
            function putReceivedMessageOnChatWindow(from_jid,from_slug,body,msgID){
         
     | 
| 
       256 
     | 
    
         
            -
             
     | 
| 
       257 
     | 
    
         
            -
             
     | 
| 
       258 
     | 
    
         
            -
             
     | 
| 
       259 
     | 
    
         
            -
             
     | 
| 
       260 
     | 
    
         
            -
             
     | 
| 
       261 
     | 
    
         
            -
             
     | 
| 
       262 
     | 
    
         
            -
             
     | 
| 
       263 
     | 
    
         
            -
             
     | 
| 
       264 
     | 
    
         
            -
             
     | 
| 
       265 
     | 
    
         
            -
             
     | 
| 
       266 
     | 
    
         
            -
             
     | 
| 
       267 
     | 
    
         
            -
             
     | 
| 
       268 
     | 
    
         
            -
             
     | 
| 
       269 
     | 
    
         
            -
             
     | 
| 
       270 
     | 
    
         
            -
             
     | 
| 
       271 
     | 
    
         
            -
             
     | 
| 
       272 
     | 
    
         
            -
             
     | 
| 
       273 
     | 
    
         
            -
             
     | 
| 
       274 
     | 
    
         
            -
             
     | 
| 
       275 
     | 
    
         
            -
             
     | 
| 
       276 
     | 
    
         
            -
             
     | 
| 
       277 
     | 
    
         
            -
             
     | 
| 
       278 
     | 
    
         
            -
             
     | 
| 
       279 
     | 
    
         
            -
             
     | 
| 
       280 
     | 
    
         
            -
             
     | 
| 
       281 
     | 
    
         
            -
             
     | 
| 
       282 
     | 
    
         
            -
             
     | 
| 
       283 
     | 
    
         
            -
             
     | 
| 
       284 
     | 
    
         
            -
             
     | 
| 
       285 
     | 
    
         
            -
             
     | 
| 
       286 
     | 
    
         
            -
             
     | 
| 
       287 
     | 
    
         
            -
             
     | 
| 
       288 
     | 
    
         
            -
             
     | 
| 
       289 
     | 
    
         
            -
             
     | 
| 
       290 
     | 
    
         
            -
             
     | 
| 
       291 
     | 
    
         
            -
             
     | 
| 
       292 
     | 
    
         
            -
             
     | 
| 
       293 
     | 
    
         
            -
             
     | 
| 
       294 
     | 
    
         
            -
             
     | 
| 
       295 
     | 
    
         
            -
             
     | 
| 
       296 
     | 
    
         
            -
             
     | 
| 
      
 246 
     | 
    
         
            +
              
         
     | 
| 
      
 247 
     | 
    
         
            +
              //Antiflood control
         
     | 
| 
      
 248 
     | 
    
         
            +
               if (antifloodControl(from_jid,from_slug,body,msgID)){
         
     | 
| 
      
 249 
     | 
    
         
            +
                return;
         
     | 
| 
      
 250 
     | 
    
         
            +
               }
         
     | 
| 
      
 251 
     | 
    
         
            +
              
         
     | 
| 
      
 252 
     | 
    
         
            +
              //Check for from_slug name and connectionBox visibility
         
     | 
| 
      
 253 
     | 
    
         
            +
              if (typeof($('div.user_presence[slug=' + from_slug + ']').attr('name')) == 'undefined') {
         
     | 
| 
      
 254 
     | 
    
         
            +
                //No connectionBox for this user!
         
     | 
| 
      
 255 
     | 
    
         
            +
                var from_name = from_slug;
         
     | 
| 
      
 256 
     | 
    
         
            +
                refreshChatWindow();
         
     | 
| 
      
 257 
     | 
    
         
            +
              } else {
         
     | 
| 
      
 258 
     | 
    
         
            +
                showConnectionBoxFromSlug(from_slug);
         
     | 
| 
      
 259 
     | 
    
         
            +
                var from_name = $('div.user_presence[slug=' + from_slug + ']').attr('name');
         
     | 
| 
      
 260 
     | 
    
         
            +
              }
         
     | 
| 
      
 261 
     | 
    
         
            +
              
         
     | 
| 
      
 262 
     | 
    
         
            +
              
         
     | 
| 
      
 263 
     | 
    
         
            +
              //Create or toggle from_slug's chatBox.
         
     | 
| 
      
 264 
     | 
    
         
            +
              if (createChatBox(from_slug, from_name, from_jid, user_name, user_jid)) {
         
     | 
| 
      
 265 
     | 
    
         
            +
              } else {
         
     | 
| 
      
 266 
     | 
    
         
            +
                window[getChatVariableFromSlug(from_slug)].chatbox("option", "boxManager").toggleBox(true);
         
     | 
| 
      
 267 
     | 
    
         
            +
              }
         
     | 
| 
      
 268 
     | 
    
         
            +
              
         
     | 
| 
      
 269 
     | 
    
         
            +
              //Parse content before show it.
         
     | 
| 
      
 270 
     | 
    
         
            +
              var content = getParsedContent(Strophe.getText(body), false)
         
     | 
| 
      
 271 
     | 
    
         
            +
              var headerMessage = getParsedName(from_name,false);
         
     | 
| 
      
 272 
     | 
    
         
            +
              
         
     | 
| 
      
 273 
     | 
    
         
            +
              //Show message to chatBox.        
         
     | 
| 
      
 274 
     | 
    
         
            +
              $("#" + from_slug).chatbox("option", "boxManager").addMsg(headerMessage, content);
         
     | 
| 
      
 275 
     | 
    
         
            +
              
         
     | 
| 
      
 276 
     | 
    
         
            +
              //Rotate chatBoxes priority.
         
     | 
| 
      
 277 
     | 
    
         
            +
              rotatePriority(from_slug);
         
     | 
| 
      
 278 
     | 
    
         
            +
              
         
     | 
| 
      
 279 
     | 
    
         
            +
              //Check for start blinkTitle.
         
     | 
| 
      
 280 
     | 
    
         
            +
              blinkTitleOnMessage(from_name);
         
     | 
| 
      
 281 
     | 
    
         
            +
              
         
     | 
| 
      
 282 
     | 
    
         
            +
              //Check for play sound
         
     | 
| 
      
 283 
     | 
    
         
            +
              if (mustPlaySoundForChatWindow(window[getChatVariableFromSlug(from_slug)])) {
         
     | 
| 
      
 284 
     | 
    
         
            +
                playSound("onMessageAudio");
         
     | 
| 
      
 285 
     | 
    
         
            +
              }
         
     | 
| 
      
 286 
     | 
    
         
            +
              
         
     | 
| 
       297 
287 
     | 
    
         
             
            }
         
     | 
| 
       298 
288 
     | 
    
         | 
| 
       299 
289 
     | 
    
         | 
| 
         @@ -302,8 +292,8 @@ function putReceivedMessageOnChatWindow(from_jid,from_slug,body,msgID){ 
     | 
|
| 
       302 
292 
     | 
    
         
             
            ////////////////////
         
     | 
| 
       303 
293 
     | 
    
         | 
| 
       304 
294 
     | 
    
         
             
            function showChatNotificationForSlug(slug,msg){
         
     | 
| 
       305 
     | 
    
         
            -
             
     | 
| 
       306 
     | 
    
         
            -
             
     | 
| 
      
 295 
     | 
    
         
            +
              var notification = $("#" + slug).parent().find("div.ui-chatbox-notify");
         
     | 
| 
      
 296 
     | 
    
         
            +
              showChatNotification(notification,msg);
         
     | 
| 
       307 
297 
     | 
    
         
             
            }
         
     | 
| 
       308 
298 
     | 
    
         | 
| 
       309 
299 
     | 
    
         
             
            function showChatNotification(notification,msg){
         
     | 
| 
         @@ -314,7 +304,7 @@ function showChatNotification(notification,msg){ 
     | 
|
| 
       314 
304 
     | 
    
         | 
| 
       315 
305 
     | 
    
         
             
            function hideChatNotificationForSlug(slug){
         
     | 
| 
       316 
306 
     | 
    
         
             
              var notification = $("#" + slug).parent().find("div.ui-chatbox-notify");
         
     | 
| 
       317 
     | 
    
         
            -
             
     | 
| 
      
 307 
     | 
    
         
            +
              hideChatNotification(notification);
         
     | 
| 
       318 
308 
     | 
    
         
             
            }
         
     | 
| 
       319 
309 
     | 
    
         | 
| 
       320 
310 
     | 
    
         
             
            function hideChatNotification(notification){
         
     | 
| 
         @@ -323,12 +313,12 @@ function hideChatNotification(notification){ 
     | 
|
| 
       323 
313 
     | 
    
         
             
            }
         
     | 
| 
       324 
314 
     | 
    
         | 
| 
       325 
315 
     | 
    
         
             
            function notifyWhenUsersDisconnect(){
         
     | 
| 
       326 
     | 
    
         
            -
             
     | 
| 
       327 
     | 
    
         
            -
             
     | 
| 
       328 
     | 
    
         
            -
             
     | 
| 
      
 316 
     | 
    
         
            +
              var notification = $("div.ui-chatbox-notify");
         
     | 
| 
      
 317 
     | 
    
         
            +
              var msg = '<%=I18n.t('chat.notify.offline')%>';
         
     | 
| 
      
 318 
     | 
    
         
            +
              showChatNotification(notification,msg);
         
     | 
| 
       329 
319 
     | 
    
         
             
            }
         
     | 
| 
       330 
320 
     | 
    
         | 
| 
       331 
321 
     | 
    
         
             
            function hideAllNotifications(){
         
     | 
| 
       332 
     | 
    
         
            -
             
     | 
| 
      
 322 
     | 
    
         
            +
              var notification = $("div.ui-chatbox-notify");
         
     | 
| 
       333 
323 
     | 
    
         
             
              hideChatNotification(notification);
         
     | 
| 
       334 
     | 
    
         
            -
            }
         
     | 
| 
      
 324 
     | 
    
         
            +
            }
         
     |