diff --git a/INSTALL.chat b/INSTALL.chat
index 8753a29..f6210a3 100644
--- a/INSTALL.chat
+++ b/INSTALL.chat
@@ -6,15 +6,13 @@ To configure XMPP/BOSH in Noosfero you need:
* SystemTimer - http://ph7spot.com/musings/system-timer
* Pidgin data files - http://www.pidgin.im/
-If you use Debian Lenny:
+If you use Debian Wheezy:
-# apt-get install librestclient-ruby (from backports)
-# apt-get install pidgin-data
-# apt-get install ruby1.8-dev
+# apt-get install librestclient-ruby pidgin-data ruby1.8-dev
# gem install SystemTimer
-Take a look at util/chat directory to see samples of config file to configure a
-XMPP/BOSH server with ejabberd, postgresql and apache2.
+The samples of config file to configure a XMPP/BOSH server with
+ejabberd, postgresql and apache2 can be found at util/chat directory.
== XMPP/Chat Server Setup
@@ -22,8 +20,7 @@ This is a step-by-step guide to get a XMPP service working, in a Debian system.
1. Install the required packages
-# apt-get -t lenny-backports install ejabberd
-# apt-get install odbc-postgresql
+# apt-get install ejabberd odbc-postgresql
2. Ejabberd configuration
@@ -108,7 +105,7 @@ Unused modules can be disabled, for example:
* web_admin
* mod_pubsub
* mod_irc
- * mod_offine
+ * mod_offline
* mod_admin_extra
* mod_register
@@ -132,7 +129,7 @@ This will create a new schema inside the noosfero database, called 'ejabberd'.
Note 'noosfero' user should have permission to create Postgresql schemas. Also,
there should be at least one domain with 'is_default = true' in 'domains'
-table, otherwise people couldn't see your friends online.
+table, otherwise people won't be able to see their friends online.
4. ODBC configuration
@@ -168,9 +165,12 @@ Debug = 0
CommLog = 1
UsageCount = 3
- * testing all:
+ 4.1 testing all:
-# isql 'PostgreSQLEjabberdNoosfero' DBUSER
+# isql 'PostgreSQLEjabberdNoosfero'
+
+If the configuration was done right, the message "Connected!"
+will be displayed.
5. Enabling kernel polling and SMP in /etc/default/ejabberd
diff --git a/app/models/user.rb b/app/models/user.rb
index 6ddd9ee..fd5d7aa 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -294,7 +294,8 @@ class User < ActiveRecord::Base
'email_domain' => self.enable_email ? self.email_domain : nil,
'friends_list' => friends_list,
'enterprises' => enterprises,
- 'amount_of_friends' => friends_list.count
+ 'amount_of_friends' => friends_list.count,
+ 'chat_enabled' => person.environment.enabled?('xmpp_chat')
}
end
diff --git a/app/views/shared/logged_in/xmpp_chat.rhtml b/app/views/shared/logged_in/xmpp_chat.rhtml
index 7463bd3..a380e97 100644
--- a/app/views/shared/logged_in/xmpp_chat.rhtml
+++ b/app/views/shared/logged_in/xmpp_chat.rhtml
@@ -6,6 +6,6 @@
-
+
diff --git a/public/javascripts/application.js b/public/javascripts/application.js
index 6e54dd9..6a30322 100644
--- a/public/javascripts/application.js
+++ b/public/javascripts/application.js
@@ -486,7 +486,9 @@ jQuery(function($) {
// logged in
loggedInDataCallBack(data);
addManageEnterprisesToOldStyleMenu(data);
- chatOnlineUsersDataCallBack(data);
+ if (data.chat_enabled) {
+ setInterval(function(){ $.getJSON('/account/user_data', chatOnlineUsersDataCallBack)}, 10000);
+ }
} else {
// not logged in
$('#user .not-logged-in, .login-block .not-logged-user').fadeIn();
@@ -538,7 +540,7 @@ jQuery(function($) {
return;
}
var content = '';
- $('#chat-online-users').html($('#chat-online-users').html().replace(/%{amount}/g, data['amount_of_friends']));
+ $('#chat-online-users .amount_of_friends').html(data['amount_of_friends']);
$('#chat-online-users').fadeIn();
for (var user in data['friends_list']) {
var name = "%{name}";
diff --git a/public/javascripts/chat.js b/public/javascripts/chat.js
index 35914a1..6e59864 100644
--- a/public/javascripts/chat.js
+++ b/public/javascripts/chat.js
@@ -253,7 +253,7 @@ jQuery(function($) {
result.show = 'away';
}
}
- if ($(stanza).find('x[xmlns='+ Strophe.NS.MUC_USER +']').length > 0) {
+ if ($(stanza).find('x[xmlns="'+ Strophe.NS.MUC_USER +'"]').length > 0) {
result.is_from_room = true;
result.from_user = $(stanza).find('x item').attr('jid');
if ($(stanza).find('x item').attr('affiliation') == 'owner') {
@@ -351,7 +351,7 @@ jQuery(function($) {
},
on_muc_support: function(iq) {
- if ($(iq).find('identity[category=conference]').length > 0 && $(iq).find('feature[var='+ Strophe.NS.MUC +']').length > 0) {
+ if ($(iq).find('identity[category=conference]').length > 0 && $(iq).find('feature[var="'+ Strophe.NS.MUC +'"]').length > 0) {
var name = $(iq).find('identity[category=conference]').attr('name');
log('muc support found with identity '+ name);
Jabber.muc_supported = true;
diff --git a/test/unit/user_test.rb b/test/unit/user_test.rb
index 2c774fa..cc01a0c 100644
--- a/test/unit/user_test.rb
+++ b/test/unit/user_test.rb
@@ -399,6 +399,19 @@ class UserTest < ActiveSupport::TestCase
assert_equal 15, User.expires_chat_status_every
end
+ should "return status of chat on environment in data_hash" do
+ person = create_user('coldplay').person
+ env = person.environment
+ env.enable('xmpp_chat')
+ env.save
+ assert_equal true, person.user.data_hash['chat_enabled']
+
+ env.disable('xmpp_chat')
+ env.save
+ person.reload
+ assert_equal false, person.user.data_hash['chat_enabled']
+ end
+
should 'respond name with related person name' do
user = create_user('testuser')
user.person.name = 'Test User'
--
libgit2 0.21.2