social_stream 0.11.2 → 0.11.3
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +0 -9
- data/base/app/assets/stylesheets/contacts.css.scss +8 -3
- data/base/app/assets/stylesheets/frontpage.css.scss +1 -1
- data/base/app/assets/stylesheets/search.css.scss +17 -1
- data/base/app/controllers/contacts_controller.rb +2 -5
- data/base/app/models/contact.rb +3 -2
- data/base/app/views/activities/_options.html.erb +1 -1
- data/base/app/views/contacts/_form.html.erb +14 -7
- data/base/app/views/frontpage/_social_networks.html.erb +3 -0
- data/base/app/views/groups/_new.html.erb +2 -2
- data/base/app/views/groups/_show.html.erb +1 -2
- data/base/app/views/groups/index.html.erb +1 -1
- data/base/app/views/layouts/_header_signed_out.erb +1 -3
- data/base/app/views/notifications/activities/_follow_subject.html.erb +5 -2
- data/base/app/views/notifications/activities/_like_subject.html.erb +6 -2
- data/base/app/views/notifications/activities/_make-friend_subject.html.erb +5 -2
- data/base/app/views/notifications/activities/_post_subject.html.erb +6 -1
- data/base/app/views/notifications/activities/_update_body.html.erb +5 -1
- data/base/app/views/notifications/activities/_update_subject.html.erb +5 -1
- data/base/app/views/posts/_post_focus_search.html.erb +37 -3
- data/base/app/views/posts/_post_global_search.html.erb +2 -0
- data/base/app/views/profiles/_contact.html.erb +1 -1
- data/base/app/views/search/index.js.erb +2 -0
- data/base/app/views/toolbar/_home.html.erb +4 -0
- data/base/config/locales/en.yml +26 -0
- data/base/config/locales/es.yml +26 -0
- data/base/lib/mailboxer/notification_decoder.rb +8 -6
- data/base/lib/social_stream-base.rb +1 -1
- data/base/lib/social_stream/base/version.rb +1 -1
- data/base/lib/social_stream/migrations/components.rb +1 -1
- data/base/lib/social_stream/toolbar_config/base.rb +12 -1
- data/base/social_stream-base.gemspec +1 -1
- data/base/spec/controllers/contacts_controller_spec.rb +4 -4
- data/events/app/assets/javascripts/social_stream-events.js +2 -2
- data/events/app/assets/stylesheets/social_stream-events.css +3 -0
- data/events/{app → vendor}/assets/javascripts/jquery.ad-gallery.js +0 -0
- data/events/{app → vendor}/assets/javascripts/jquery.ad-gallery.pack.js +0 -0
- data/events/{app → vendor}/assets/stylesheets/ad_next.png +0 -0
- data/events/{app → vendor}/assets/stylesheets/ad_prev.png +0 -0
- data/events/{app → vendor}/assets/stylesheets/ad_scroll_back.png +0 -0
- data/events/{app → vendor}/assets/stylesheets/ad_scroll_forward.png +0 -0
- data/events/{app → vendor}/assets/stylesheets/fullcalendar.css +0 -0
- data/events/{app → vendor}/assets/stylesheets/fullcalendar.print.css +0 -0
- data/events/{app → vendor}/assets/stylesheets/jquery.ad-gallery.css +0 -0
- data/events/{app → vendor}/assets/stylesheets/loader.gif +0 -0
- data/events/vendor/assets/stylesheets/social_stream-events.css +273 -0
- data/lib/social_stream.rb +0 -4
- data/lib/social_stream/version.rb +1 -1
- data/presence/.gitignore +4 -0
- data/presence/Gemfile +4 -0
- data/presence/Rakefile +1 -0
- data/presence/app/assets/audio/chat/onMessageAudio.mp3 +0 -0
- data/presence/app/assets/audio/chat/onMessageAudio.wav +0 -0
- data/presence/app/assets/images/arrow.png +0 -0
- data/presence/app/assets/images/black_arrow3.png +0 -0
- data/presence/app/assets/images/status/available.png +0 -0
- data/presence/app/assets/images/status/away.png +0 -0
- data/presence/app/assets/images/status/dnd.png +0 -0
- data/presence/app/assets/javascripts/jquery-ui-1.8.14.custom.min.js +789 -0
- data/presence/app/assets/javascripts/jquery.tools.min.js +17 -0
- data/presence/app/assets/javascripts/jquery.tools.tooltip.js +11 -0
- data/presence/app/assets/javascripts/jquery.ui.chatbox.js +260 -0
- data/presence/app/assets/javascripts/social_stream-presence.js +2 -0
- data/presence/app/assets/javascripts/store.js +27 -0
- data/presence/app/assets/javascripts/strophe.js +3612 -0
- data/presence/app/assets/javascripts/xmpp_client.js +498 -0
- data/presence/app/assets/stylesheets/chat.css +231 -0
- data/presence/app/assets/stylesheets/jquery.ui.chatbox.css +54 -0
- data/presence/app/assets/stylesheets/social_stream-presence.css +3 -0
- data/presence/app/controllers/xmpp_controller.rb +190 -0
- data/presence/app/helpers/xmpp_helper.rb +33 -0
- data/presence/app/views/xmpp/_chat.html.erb +59 -0
- data/presence/app/views/xmpp/_chat_connecting.html.erb +8 -0
- data/presence/app/views/xmpp/_chat_contacts.html.erb +46 -0
- data/presence/app/views/xmpp/_chat_off.html.erb +35 -0
- data/presence/app/views/xmpp/active_users.html.erb +33 -0
- data/presence/app/views/xmpp/chat.html.erb +13 -0
- data/presence/app/views/xmpp/index.html +19 -0
- data/presence/app/views/xmpp/test.html.erb +11 -0
- data/presence/config/routes.rb +15 -0
- data/presence/db/migrate/20110711111408_add_connected_column_to_user.rb +9 -0
- data/presence/db/migrate/20110928135031_add_status_column_to_user.rb +9 -0
- data/presence/ejabberd/conf/ejabberd.cfg +625 -0
- data/presence/ejabberd/conf/ejabberdctl.cfg +154 -0
- data/presence/ejabberd/conf/inetrc +3 -0
- data/presence/ejabberd/conf/server.pem +37 -0
- data/presence/ejabberd/conf/ssconfig.cfg +29 -0
- data/presence/ejabberd/ejabberd_scripts/authentication_script +117 -0
- data/presence/ejabberd/ejabberd_scripts/authentication_script_org +114 -0
- data/presence/ejabberd/ejabberd_scripts/compile_module +34 -0
- data/presence/ejabberd/ejabberd_scripts/generate_random_password +18 -0
- data/presence/ejabberd/ejabberd_scripts/kill_authentication_script.sh +13 -0
- data/presence/ejabberd/ejabberd_scripts/reset_connection_script +55 -0
- data/presence/ejabberd/ejabberd_scripts/reset_logs.sh +23 -0
- data/presence/ejabberd/ejabberd_scripts/set_connection_script +48 -0
- data/presence/ejabberd/ejabberd_scripts/set_presence_script +48 -0
- data/presence/ejabberd/ejabberd_scripts/show_config.sh +30 -0
- data/presence/ejabberd/ejabberd_scripts/start_ejabberd.sh +68 -0
- data/presence/ejabberd/ejabberd_scripts/stop_ejabberd.sh +12 -0
- data/presence/ejabberd/ejabberd_scripts/synchronize_presence_script +57 -0
- data/presence/ejabberd/ejabberd_scripts/unset_connection_script +48 -0
- data/presence/ejabberd/mod_admin_extra/mod_admin_extra.beam +0 -0
- data/presence/ejabberd/mod_admin_extra/mod_admin_extra.erl +1560 -0
- data/presence/ejabberd/mod_sspresence/mod_sspresence.erl +230 -0
- data/presence/lib/social_stream-presence.rb +13 -0
- data/presence/lib/social_stream/migrations/presence.rb +9 -0
- data/presence/lib/social_stream/presence/config.rb +9 -0
- data/presence/lib/social_stream/presence/engine.rb +49 -0
- data/presence/lib/social_stream/presence/models/buddy_manager.rb +67 -0
- data/presence/social_stream-presence.gemspec +28 -0
- data/presence/spec/demo/.gitignore +5 -0
- data/presence/spec/demo/.rspec +1 -0
- data/presence/spec/demo/README +261 -0
- data/presence/spec/demo/Rakefile +7 -0
- data/presence/spec/demo/app/assets/images/rails.png +0 -0
- data/presence/spec/demo/app/assets/javascripts/application.js +9 -0
- data/presence/spec/demo/app/assets/stylesheets/application.css +7 -0
- data/presence/spec/demo/app/controllers/application_controller.rb +3 -0
- data/presence/spec/demo/app/helpers/application_helper.rb +2 -0
- data/presence/spec/demo/app/mailers/.gitkeep +0 -0
- data/presence/spec/demo/app/models/.gitkeep +0 -0
- data/presence/spec/demo/app/views/layouts/application.html.erb +14 -0
- data/presence/spec/demo/autotest/discover.rb +2 -0
- data/presence/spec/demo/config.ru +4 -0
- data/presence/spec/demo/config/application.rb +41 -0
- data/presence/spec/demo/config/boot.rb +6 -0
- data/presence/spec/demo/config/database.yml +25 -0
- data/presence/spec/demo/config/environment.rb +5 -0
- data/presence/spec/demo/config/environments/development.rb +27 -0
- data/presence/spec/demo/config/environments/production.rb +54 -0
- data/presence/spec/demo/config/environments/test.rb +39 -0
- data/presence/spec/demo/config/initializers/backtrace_silencers.rb +7 -0
- data/presence/spec/demo/config/initializers/inflections.rb +10 -0
- data/presence/spec/demo/config/initializers/mime_types.rb +5 -0
- data/presence/spec/demo/config/initializers/secret_token.rb +7 -0
- data/presence/spec/demo/config/initializers/session_store.rb +8 -0
- data/presence/spec/demo/config/initializers/wrap_parameters.rb +12 -0
- data/presence/spec/demo/config/locales/en.yml +5 -0
- data/presence/spec/demo/config/routes.rb +58 -0
- data/presence/spec/demo/db/seeds.rb +7 -0
- data/presence/spec/demo/doc/README_FOR_APP +2 -0
- data/presence/spec/demo/lib/tasks/.gitkeep +0 -0
- data/presence/spec/demo/log/.gitkeep +0 -0
- data/presence/spec/demo/public/404.html +26 -0
- data/presence/spec/demo/public/422.html +26 -0
- data/presence/spec/demo/public/500.html +26 -0
- data/presence/spec/demo/public/favicon.ico +0 -0
- data/presence/spec/demo/public/index.html +241 -0
- data/presence/spec/demo/public/robots.txt +5 -0
- data/presence/spec/demo/script/rails +6 -0
- data/presence/spec/demo/spec/spec_helper.rb +27 -0
- data/presence/spec/demo/test/fixtures/.gitkeep +0 -0
- data/presence/spec/demo/test/functional/.gitkeep +0 -0
- data/presence/spec/demo/test/integration/.gitkeep +0 -0
- data/presence/spec/demo/test/performance/browsing_test.rb +12 -0
- data/presence/spec/demo/test/test_helper.rb +13 -0
- data/presence/spec/demo/test/unit/.gitkeep +0 -0
- data/presence/spec/demo/vendor/assets/stylesheets/.gitkeep +0 -0
- data/presence/spec/demo/vendor/plugins/.gitkeep +0 -0
- data/presence/spec/discover.rb +2 -0
- data/presence/spec/spec_helper.rb +27 -0
- data/social_stream.gemspec +9 -2
- data/spec/dummy/config/environments/{test_pg.rb → test_mysql.rb} +6 -2
- data/spec/dummy/config/environments/test_postgres.rb +39 -0
- data/spec/spec_helper.rb +1 -4
- metadata +135 -21
- data/base/app/views/groups/_new_activity.html.erb +0 -1
- data/base/app/views/groups/_new_activity_fields.html.erb +0 -7
@@ -0,0 +1,34 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
|
4
|
+
def getOption(option)
|
5
|
+
File.open('/etc/ejabberd/ssconfig.cfg', 'r') do |f1|
|
6
|
+
while line = f1.gets
|
7
|
+
line = line.gsub(/\n/,'')
|
8
|
+
if line.match(/^#/)
|
9
|
+
#Comments
|
10
|
+
elsif line.match(/^#{option}/)
|
11
|
+
return line.gsub(/#{option}/,'')
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
return "Undefined"
|
16
|
+
end
|
17
|
+
|
18
|
+
|
19
|
+
|
20
|
+
|
21
|
+
source_path = getOption("source_path=")
|
22
|
+
|
23
|
+
if source_path == "Undefined"
|
24
|
+
#puts "mod_sspresence source_path in undefined: define source_path in /etc/ejabberd/ssconfig.cfg to compile mod_sspresence"
|
25
|
+
puts "mod_sspresence source_path in undefined: Exit compile"
|
26
|
+
else
|
27
|
+
puts "Compile mod_sspresence"
|
28
|
+
system("erlc #{source_path}/mod_sspresence.erl")
|
29
|
+
system 'sudo mv mod_sspresence.beam /lib/ejabberd/ebin/mod_sspresence.beam'
|
30
|
+
puts "Compile mod_sspresence OK"
|
31
|
+
end
|
32
|
+
|
33
|
+
|
34
|
+
|
@@ -0,0 +1,18 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
def newpass(l)
|
4
|
+
chars = 'abcdefghjkmnpqrstuvwxyzABCDEFGHJKLMNOPQRSTUVWXYZ0123456789!$%&()=?|@^*'
|
5
|
+
password = ''
|
6
|
+
l.downto(1) { |i| password << chars[rand(chars.length - 1)] }
|
7
|
+
return password
|
8
|
+
end
|
9
|
+
|
10
|
+
puts "Generate random password"
|
11
|
+
|
12
|
+
unless ARGV[0]
|
13
|
+
puts "Error: Password lenght argument missed"
|
14
|
+
exit
|
15
|
+
else
|
16
|
+
puts ARGV[0]
|
17
|
+
puts newpass(Integer(ARGV[0]))
|
18
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#Reset Connection Script
|
3
|
+
#@author Aldo
|
4
|
+
|
5
|
+
require 'logger'
|
6
|
+
require 'rest_client'
|
7
|
+
|
8
|
+
path = "/var/log/ejabberd/scripts.log"
|
9
|
+
file = File.open(path, File::WRONLY | File::APPEND | File::CREAT)
|
10
|
+
file.sync = true
|
11
|
+
$logger = Logger.new(file)
|
12
|
+
$logger.level = Logger::DEBUG
|
13
|
+
|
14
|
+
def getOption(option)
|
15
|
+
File.open('/etc/ejabberd/ssconfig.cfg', 'r') do |f1|
|
16
|
+
while line = f1.gets
|
17
|
+
line = line.gsub(/\n/,'')
|
18
|
+
if line.match(/^#/)
|
19
|
+
#Comments
|
20
|
+
elsif line.match(/^#{option}/)
|
21
|
+
return line.gsub(/#{option}/,'')
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
return "Undefined"
|
26
|
+
end
|
27
|
+
|
28
|
+
$url = getOption("reset_connection_api=")
|
29
|
+
$pass = getOption("ejabberd_password=")
|
30
|
+
|
31
|
+
|
32
|
+
def log(text)
|
33
|
+
$logger.info "Reset Connection Script: " + text
|
34
|
+
end
|
35
|
+
|
36
|
+
|
37
|
+
def resetConnection()
|
38
|
+
begin
|
39
|
+
RestClient.post($url, :password => $pass)
|
40
|
+
return true
|
41
|
+
rescue => e
|
42
|
+
log("#{e.class.name}: #{e.message}")
|
43
|
+
return false
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
if (resetConnection())
|
48
|
+
puts "Reset Connection [OK]"
|
49
|
+
log( "Reset Connection [OK]" )
|
50
|
+
else
|
51
|
+
puts "Reset Connection [FAIL]"
|
52
|
+
log( "Reset Connection [FAIL]" )
|
53
|
+
end
|
54
|
+
|
55
|
+
|
@@ -0,0 +1,23 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
|
3
|
+
echo "Starting Reset logs"
|
4
|
+
|
5
|
+
rm /var/log/ejabberd/auth.log
|
6
|
+
rm /var/log/ejabberd/auth_error.log
|
7
|
+
rm /var/log/ejabberd/ejabberd.log
|
8
|
+
rm /var/log/ejabberd/erlang.log
|
9
|
+
rm /var/log/ejabberd/scripts.log
|
10
|
+
rm /var/log/ejabberd/erl_crash_*
|
11
|
+
|
12
|
+
touch /var/log/ejabberd/auth.log
|
13
|
+
touch /var/log/ejabberd/auth_error.log
|
14
|
+
touch /var/log/ejabberd/ejabberd.log
|
15
|
+
touch /var/log/ejabberd/erlang.log
|
16
|
+
touch /var/log/ejabberd/scripts.log
|
17
|
+
touch /var/log/ejabberd/erl_crash_dummy.log
|
18
|
+
|
19
|
+
echo "Reset logs OK"
|
20
|
+
|
21
|
+
|
22
|
+
|
23
|
+
|
@@ -0,0 +1,48 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#Set Connection Script
|
3
|
+
#@author Aldo
|
4
|
+
|
5
|
+
require 'logger'
|
6
|
+
require 'rest_client'
|
7
|
+
|
8
|
+
path = "/var/log/ejabberd/scripts.log"
|
9
|
+
file = File.open(path, File::WRONLY | File::APPEND | File::CREAT)
|
10
|
+
file.sync = true
|
11
|
+
$logger = Logger.new(file)
|
12
|
+
$logger.level = Logger::DEBUG
|
13
|
+
|
14
|
+
def getOption(option)
|
15
|
+
File.open('/etc/ejabberd/ssconfig.cfg', 'r') do |f1|
|
16
|
+
while line = f1.gets
|
17
|
+
line = line.gsub(/\n/,'')
|
18
|
+
if line.match(/^#/)
|
19
|
+
#Comments
|
20
|
+
elsif line.match(/^#{option}/)
|
21
|
+
return line.gsub(/#{option}/,'')
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
return "Undefined"
|
26
|
+
end
|
27
|
+
|
28
|
+
$url = getOption("set_connection_api=")
|
29
|
+
$pass = getOption("ejabberd_password=")
|
30
|
+
|
31
|
+
|
32
|
+
def log(text)
|
33
|
+
$logger.info "Set Connection Script: " + text
|
34
|
+
end
|
35
|
+
|
36
|
+
def setConnection(username)
|
37
|
+
log("setConnection(#{username})")
|
38
|
+
RestClient.post($url, :name => username, :password => $pass)
|
39
|
+
return true
|
40
|
+
|
41
|
+
rescue RestClient::Exception
|
42
|
+
log("RestClient::Exception with setConnection(#{username})")
|
43
|
+
end
|
44
|
+
|
45
|
+
|
46
|
+
setConnection(ARGV[0])
|
47
|
+
|
48
|
+
|
@@ -0,0 +1,48 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#Set Presence Script
|
3
|
+
#@author Aldo
|
4
|
+
|
5
|
+
require 'logger'
|
6
|
+
require 'rest_client'
|
7
|
+
|
8
|
+
path = "/var/log/ejabberd/scripts.log"
|
9
|
+
file = File.open(path, File::WRONLY | File::APPEND | File::CREAT)
|
10
|
+
file.sync = true
|
11
|
+
$logger = Logger.new(file)
|
12
|
+
$logger.level = Logger::DEBUG
|
13
|
+
|
14
|
+
def getOption(option)
|
15
|
+
File.open('/etc/ejabberd/ssconfig.cfg', 'r') do |f1|
|
16
|
+
while line = f1.gets
|
17
|
+
line = line.gsub(/\n/,'')
|
18
|
+
if line.match(/^#/)
|
19
|
+
#Comments
|
20
|
+
elsif line.match(/^#{option}/)
|
21
|
+
return line.gsub(/#{option}/,'')
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
return "Undefined"
|
26
|
+
end
|
27
|
+
|
28
|
+
$url = getOption("set_presence_api=")
|
29
|
+
$pass = getOption("ejabberd_password=")
|
30
|
+
|
31
|
+
|
32
|
+
def log(text)
|
33
|
+
$logger.info "Set Presence Script: " + text
|
34
|
+
end
|
35
|
+
|
36
|
+
def setPresence(username,status)
|
37
|
+
log("setPresence(#{username},#{status})")
|
38
|
+
RestClient.post($url, :name => username, :status => status, :password => $pass)
|
39
|
+
return true
|
40
|
+
|
41
|
+
rescue RestClient::Exception
|
42
|
+
log("RestClient::Exception with setPresence(#{username})")
|
43
|
+
end
|
44
|
+
|
45
|
+
|
46
|
+
setPresence(ARGV[0],ARGV[1])
|
47
|
+
|
48
|
+
|
@@ -0,0 +1,30 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
def getOption(option)
|
4
|
+
File.open('/etc/ejabberd/ssconfig.cfg', 'r') do |f1|
|
5
|
+
while line = f1.gets
|
6
|
+
line = line.gsub(/\n/,'')
|
7
|
+
if line.match(/^#/)
|
8
|
+
#Comments
|
9
|
+
elsif line.match(/^#{option}/)
|
10
|
+
return line.gsub(/#{option}/,'')
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
return "Undefined"
|
15
|
+
end
|
16
|
+
|
17
|
+
puts ""
|
18
|
+
puts "############### Ejabberd Configuration ###############"
|
19
|
+
puts "Config file for Social Stream Presence: /etc/ejabberd/ssconfig.cfg"
|
20
|
+
puts "Scripts Path: #{getOption("scripts_path=")}"
|
21
|
+
puts "mod_sspresence Path: #{getOption("source_path=")}"
|
22
|
+
puts "API REST URLs"
|
23
|
+
puts "Authentication: #{getOption("auth_api=")}"
|
24
|
+
puts "onRegisterConnection: #{getOption("set_connection_api=")}"
|
25
|
+
puts "onRemoveConnection: #{getOption("unset_connection_api=")}"
|
26
|
+
puts "onPresence: #{getOption("set_presence_api=")}"
|
27
|
+
puts "onUnsetPresence: #{getOption("unset_presence_api=")}"
|
28
|
+
puts "Social Stream Presence logs in var/log/ejabberd/"
|
29
|
+
puts "######################################################"
|
30
|
+
puts ""
|
@@ -0,0 +1,68 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
|
3
|
+
echo "Stopping ejabberd server"
|
4
|
+
sudo ejabberdctl stop
|
5
|
+
|
6
|
+
if [ $# -lt 1 ]; then
|
7
|
+
command="start"
|
8
|
+
echo "Starting ejabberd server"
|
9
|
+
else
|
10
|
+
|
11
|
+
param=$1
|
12
|
+
logs=true
|
13
|
+
|
14
|
+
while getopts ":l" opt; do
|
15
|
+
case $opt in
|
16
|
+
l)
|
17
|
+
#-l option
|
18
|
+
logs=false
|
19
|
+
|
20
|
+
if [ $# -lt 2 ]; then
|
21
|
+
param="start"
|
22
|
+
else
|
23
|
+
param=$2
|
24
|
+
fi
|
25
|
+
;;
|
26
|
+
\?)
|
27
|
+
echo "Invalid option: -$OPTARG" >&2
|
28
|
+
echo "Use \"$0 help\" to view help"
|
29
|
+
exit
|
30
|
+
;;
|
31
|
+
esac
|
32
|
+
done
|
33
|
+
|
34
|
+
|
35
|
+
|
36
|
+
if [ $param == "live" ]; then
|
37
|
+
command="live"
|
38
|
+
echo "Starting ejabberd server in Live mode"
|
39
|
+
elif [ $param == "start" ]; then
|
40
|
+
command="start"
|
41
|
+
echo "Starting ejabberd server"
|
42
|
+
else
|
43
|
+
#Show HELP
|
44
|
+
echo "Use \"$0 start\" to Start ejabberd server in normal mode"
|
45
|
+
echo "Use \"$0 live\" to Start ejabberd server in live mode"
|
46
|
+
echo "Use -l option to keep log files"
|
47
|
+
exit
|
48
|
+
fi
|
49
|
+
fi
|
50
|
+
|
51
|
+
|
52
|
+
echo ""
|
53
|
+
./kill_authentication_script.sh
|
54
|
+
if $logs; then
|
55
|
+
./reset_logs.sh
|
56
|
+
fi
|
57
|
+
./compile_module
|
58
|
+
./reset_connection_script
|
59
|
+
./show_config.sh
|
60
|
+
|
61
|
+
sudo ejabberdctl $command
|
62
|
+
echo "ejabberd server started"
|
63
|
+
|
64
|
+
|
65
|
+
|
66
|
+
|
67
|
+
|
68
|
+
|
@@ -0,0 +1,57 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#Presence Script
|
3
|
+
#@author Aldo
|
4
|
+
|
5
|
+
require 'logger'
|
6
|
+
require 'rest_client'
|
7
|
+
|
8
|
+
path = "/var/log/ejabberd/scripts.log"
|
9
|
+
file = File.open(path, File::WRONLY | File::APPEND | File::CREAT)
|
10
|
+
file.sync = true
|
11
|
+
$logger = Logger.new(file)
|
12
|
+
$logger.level = Logger::DEBUG
|
13
|
+
|
14
|
+
def getOption(option)
|
15
|
+
File.open('/etc/ejabberd/ssconfig.cfg', 'r') do |f1|
|
16
|
+
while line = f1.gets
|
17
|
+
line = line.gsub(/\n/,'')
|
18
|
+
if line.match(/^#/)
|
19
|
+
#Comments
|
20
|
+
elsif line.match(/^#{option}/)
|
21
|
+
return line.gsub(/#{option}/,'')
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
return "Undefined"
|
26
|
+
end
|
27
|
+
|
28
|
+
$url = getOption("synchronize_presence_api=")
|
29
|
+
$pass = getOption("ejabberd_password=")
|
30
|
+
|
31
|
+
|
32
|
+
def log(text)
|
33
|
+
$logger.info "Synchronize Presence Script: " + text
|
34
|
+
end
|
35
|
+
|
36
|
+
def synchronize()
|
37
|
+
log("Start Synchronize")
|
38
|
+
|
39
|
+
users = []
|
40
|
+
output = %x[ejabberdctl connected-users]
|
41
|
+
sessions = output.split("\n")
|
42
|
+
|
43
|
+
sessions.each do |session|
|
44
|
+
users << session.split("@")[0]
|
45
|
+
end
|
46
|
+
|
47
|
+
RestClient.post($url, :name => users, :password => $pass)
|
48
|
+
return true
|
49
|
+
|
50
|
+
rescue RestClient::Exception
|
51
|
+
log("RestClient::Exception")
|
52
|
+
end
|
53
|
+
|
54
|
+
|
55
|
+
synchronize()
|
56
|
+
|
57
|
+
|
@@ -0,0 +1,48 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#Unset Connection Script
|
3
|
+
#@author Aldo
|
4
|
+
|
5
|
+
require 'logger'
|
6
|
+
require 'rest_client'
|
7
|
+
|
8
|
+
path = "/var/log/ejabberd/scripts.log"
|
9
|
+
file = File.open(path, File::WRONLY | File::APPEND | File::CREAT)
|
10
|
+
file.sync = true
|
11
|
+
$logger = Logger.new(file)
|
12
|
+
$logger.level = Logger::DEBUG
|
13
|
+
|
14
|
+
def getOption(option)
|
15
|
+
File.open('/etc/ejabberd/ssconfig.cfg', 'r') do |f1|
|
16
|
+
while line = f1.gets
|
17
|
+
line = line.gsub(/\n/,'')
|
18
|
+
if line.match(/^#/)
|
19
|
+
#Comments
|
20
|
+
elsif line.match(/^#{option}/)
|
21
|
+
return line.gsub(/#{option}/,'')
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
return "Undefined"
|
26
|
+
end
|
27
|
+
|
28
|
+
$url = getOption("unset_connection_api=")
|
29
|
+
$pass = getOption("ejabberd_password=")
|
30
|
+
|
31
|
+
|
32
|
+
def log(text)
|
33
|
+
$logger.info "Unset Connection: " + text
|
34
|
+
end
|
35
|
+
|
36
|
+
def unsetConnection(username)
|
37
|
+
log("unsetConnection(#{username})")
|
38
|
+
RestClient.post($url, :name => username, :password => $pass)
|
39
|
+
return true
|
40
|
+
|
41
|
+
rescue RestClient::Exception
|
42
|
+
log("RestClient::Exception with unsetConnection(#{username})")
|
43
|
+
end
|
44
|
+
|
45
|
+
|
46
|
+
unsetConnection(ARGV[0])
|
47
|
+
|
48
|
+
|