social_stream 0.21.4 → 0.22.0
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/README.rdoc +11 -5
- data/base/app/assets/stylesheets/cheesecake.css.scss +1 -0
- data/base/app/views/cheesecake/_cheesecake.html.erb +3 -0
- data/base/app/views/cheesecake/_index.html.erb +88 -41
- data/base/app/views/cheesecake/_sector_form.html.erb +12 -12
- data/base/lib/social_stream/base/version.rb +1 -1
- data/base/lib/social_stream/test_helpers/controllers.rb +19 -2
- data/base/lib/tasks/db/populate.rake +190 -165
- data/base/social_stream-base.gemspec +1 -1
- data/base/spec/controllers/posts_controller_spec.rb +19 -1
- data/lib/social_stream/version.rb +1 -1
- data/presence/app/assets/images/status/chat.png +0 -0
- data/presence/app/assets/javascripts/chat_interface_manager.js.erb +42 -45
- data/presence/app/assets/javascripts/chat_parser.js +5 -5
- data/presence/app/assets/javascripts/chat_persistence.js +25 -26
- data/presence/app/assets/javascripts/chat_utilities.js +15 -11
- data/presence/app/assets/javascripts/chat_window_manager.js +129 -26
- data/presence/app/assets/javascripts/jquery.ui.chatbox.sstreampresence.js +22 -3
- data/presence/app/assets/javascripts/social_stream-presence.js +1 -0
- data/presence/app/assets/javascripts/videochat.js.erb +459 -0
- data/presence/app/assets/javascripts/xmpp_client_management.js.erb +303 -65
- data/presence/app/assets/stylesheets/chat.css.scss +42 -1
- data/presence/app/controllers/xmpp_controller.rb +20 -3
- data/presence/app/views/chat/_index.html.erb +7 -2
- data/presence/app/views/xmpp/getOpenTokSessionIDAndToken.xml.builder +6 -0
- data/presence/config/locales/en.yml +22 -1
- data/presence/config/locales/es.yml +23 -2
- data/presence/config/routes.rb +2 -0
- data/presence/ejabberd/conf/ssconfig_example.cfg +4 -3
- data/presence/ejabberd/ejabberd_files.zip +0 -0
- data/presence/ejabberd/ejabberd_scripts/authentication_script +22 -12
- data/presence/ejabberd/ejabberd_scripts/development_scripts/show_config.sh +9 -10
- data/presence/ejabberd/ejabberd_scripts/emanagement +275 -178
- data/presence/ejabberd/ejabberd_scripts/manageWebDomains +164 -0
- data/presence/ejabberd/ejabberd_scripts/rest_api_client_script +75 -32
- data/presence/ejabberd/ejabberd_scripts/synchronize_presence_script +81 -34
- data/presence/ejabberd/mod_sspresence/mod_sspresence.beam +0 -0
- data/presence/ejabberd/mod_sspresence/mod_sspresence.erl +27 -23
- data/presence/lib/OpenTok/Exceptions.rb +11 -0
- data/presence/lib/OpenTok/OpenTokSDK.rb +184 -0
- data/presence/lib/OpenTok/Session.rb +27 -0
- data/presence/lib/generators/social_stream/presence/templates/initializer.rb +8 -2
- data/presence/lib/open_tok.rb +31 -0
- data/presence/lib/opentok.rb +29 -0
- data/presence/lib/social_stream-presence.rb +4 -0
- data/presence/lib/social_stream/presence/models/buddy_manager.rb +1 -1
- data/presence/lib/social_stream/presence/version.rb +1 -1
- data/presence/lib/social_stream/presence/xmpp_server_order.rb +96 -76
- data/presence/lib/social_stream/presence/xmpp_ssclient.rb +54 -0
- data/presence/lib/tasks/presence/multidomain.rake +45 -0
- data/presence/lib/tasks/presence/synchronize.rake +18 -4
- data/presence/vendor/assets/javascripts/TB.min.js +4329 -0
- data/social_stream.gemspec +2 -2
- metadata +40 -30
- data/presence/ejabberd/ejabberd_scripts/reset_connection_script +0 -300
- data/presence/ejabberd/ejabberd_scripts/set_script_header.sh +0 -112
@@ -80,12 +80,48 @@
|
|
80
80
|
div.ui-videobox{
|
81
81
|
height: 0px;
|
82
82
|
border-bottom: 1px solid $separation-color;
|
83
|
+
max-width: 230px;
|
83
84
|
}
|
84
85
|
|
85
86
|
div.ui-videobox-icon{
|
86
87
|
|
87
88
|
}
|
88
89
|
|
90
|
+
div.ui-videobox-icon-change{
|
91
|
+
width: 100px;
|
92
|
+
height: 100px;
|
93
|
+
}
|
94
|
+
|
95
|
+
|
96
|
+
p.video-info{
|
97
|
+
padding-top: 25%;
|
98
|
+
text-align: center;
|
99
|
+
}
|
100
|
+
|
101
|
+
p.video-request{
|
102
|
+
padding-top: 20%;
|
103
|
+
text-align: center;
|
104
|
+
font-size: 130%;
|
105
|
+
font-weight: bolder;
|
106
|
+
color: $main-color;
|
107
|
+
}
|
108
|
+
|
109
|
+
.videoChatButton {
|
110
|
+
cursor: pointer;
|
111
|
+
font-size: 100%;
|
112
|
+
}
|
113
|
+
|
114
|
+
.stream_publish_videochat {
|
115
|
+
z-index: -1;
|
116
|
+
position: absolute;
|
117
|
+
top: 177px;
|
118
|
+
}
|
119
|
+
|
120
|
+
.stream_videochat{
|
121
|
+
width: 60%;
|
122
|
+
height: 60%;
|
123
|
+
}
|
124
|
+
|
89
125
|
/* notifications style sheet */
|
90
126
|
|
91
127
|
div.ui-chatbox-notify{
|
@@ -135,9 +171,14 @@ p.ui-chatbox-notify-text{
|
|
135
171
|
}
|
136
172
|
|
137
173
|
.chat-videothick{
|
138
|
-
display: none;
|
174
|
+
/* display: none; */
|
175
|
+
padding: 1px;
|
139
176
|
}
|
140
177
|
|
178
|
+
.chat-videoPublisherthick{
|
179
|
+
display: none;
|
180
|
+
padding: 0px 9px 0px 9px;
|
181
|
+
}
|
141
182
|
|
142
183
|
/* Presence Partial */
|
143
184
|
|
@@ -1,3 +1,6 @@
|
|
1
|
+
require 'opentok'
|
2
|
+
|
3
|
+
|
1
4
|
class XmppController < ApplicationController
|
2
5
|
|
3
6
|
before_filter :authorization, :only => [:setConnection, :unsetConecction, :setPresence, :unsetPresence, :resetConnection, :synchronizePresence ]
|
@@ -95,9 +98,9 @@ class XmppController < ApplicationController
|
|
95
98
|
return
|
96
99
|
end
|
97
100
|
|
98
|
-
#Actual connected
|
99
|
-
|
100
|
-
SocialStream::Presence::XmppServerOrder::
|
101
|
+
#Actual connected jids
|
102
|
+
user_jids = params[:name].split(",")
|
103
|
+
SocialStream::Presence::XmppServerOrder::synchronizePresenceForJids(user_jids)
|
101
104
|
render :text => "Ok"
|
102
105
|
end
|
103
106
|
|
@@ -157,6 +160,20 @@ class XmppController < ApplicationController
|
|
157
160
|
end
|
158
161
|
|
159
162
|
|
163
|
+
def getOpenTokSessionIDAndToken
|
164
|
+
if current_user
|
165
|
+
opentok = OpenTok::OpenTokSDK.new SocialStream::Presence.opentok_api_key, SocialStream::Presence.opentok_api_secret
|
166
|
+
@session = opentok.create_session request.remote_addr
|
167
|
+
@user_token = opentok.generate_token :session_id => @session
|
168
|
+
@guest_token = opentok.generate_token :session_id => @session
|
169
|
+
|
170
|
+
respond_to do |format|
|
171
|
+
format.xml
|
172
|
+
end
|
173
|
+
end
|
174
|
+
end
|
175
|
+
|
176
|
+
|
160
177
|
private
|
161
178
|
|
162
179
|
def setStatus(user,status)
|
@@ -68,6 +68,10 @@
|
|
68
68
|
</div>
|
69
69
|
</div>
|
70
70
|
|
71
|
+
<div>
|
72
|
+
<div id="publisherID"></div>
|
73
|
+
</div>
|
74
|
+
|
71
75
|
</div>
|
72
76
|
|
73
77
|
|
@@ -94,13 +98,14 @@
|
|
94
98
|
connectToChat(user_jid,null,null);
|
95
99
|
}
|
96
100
|
|
97
|
-
initialTimer = setTimeout("updateChatWindow()",
|
101
|
+
initialTimer = setTimeout("updateChatWindow()", 10000);
|
98
102
|
} else {
|
99
|
-
|
103
|
+
updateChatWindow();
|
100
104
|
}
|
101
105
|
|
102
106
|
initAudio();
|
103
107
|
initFocusListeners();
|
108
|
+
checkVideocallFeature();
|
104
109
|
});
|
105
110
|
|
106
111
|
</script>
|
@@ -21,4 +21,25 @@ en:
|
|
21
21
|
update: "Update Settings"
|
22
22
|
notify:
|
23
23
|
offline: "You are offline"
|
24
|
-
guestOffline: "is offline"
|
24
|
+
guestOffline: "{{name}} is offline"
|
25
|
+
videochat:
|
26
|
+
disconnected: Videochat disconnected
|
27
|
+
disconnecting: Videochat disconnecting...
|
28
|
+
negotiating: Negotiating...
|
29
|
+
connectingWait: Connecting...
|
30
|
+
connecting: Connecting to the server...
|
31
|
+
waiting: Waiting for response...
|
32
|
+
establishing: Establishing...
|
33
|
+
connnected: Videochat connected.
|
34
|
+
unable: Unable to init videochat.
|
35
|
+
serverIssue: "Server Error: Invalid response"
|
36
|
+
call: "{{name}} wants to start a video call"
|
37
|
+
rejected: "{{name}} has rejected your call"
|
38
|
+
rejectedBusy: "{{name}} is busy"
|
39
|
+
accept: Accept
|
40
|
+
deny: Deny
|
41
|
+
clientIssue: "{{name}}'s client not support videochat"
|
42
|
+
guestOffline: "Unable to connect. {{name}} is offline"
|
43
|
+
offline: "Unable to connect. You are offline"
|
44
|
+
cancel: "{{name}} cancel the videocall"
|
45
|
+
requirements: You don't have the minimum requirements to run videocall application. Please upgrade to the latest version of Flash.
|
@@ -20,5 +20,26 @@ es:
|
|
20
20
|
checkbox: "Activar o desactivar chat"
|
21
21
|
update: "Guardar configuración"
|
22
22
|
notify:
|
23
|
-
offline: "
|
24
|
-
guestOffline: "está desconectado"
|
23
|
+
offline: "Estás desconectado"
|
24
|
+
guestOffline: "{{name}} está desconectado"
|
25
|
+
videochat:
|
26
|
+
disconnected: Videochat desconectado
|
27
|
+
disconnecting: Videochat desconectando...
|
28
|
+
negotiating: Negociando...
|
29
|
+
connectingWait: Conectando...
|
30
|
+
connecting: Conectando con el servidor...
|
31
|
+
waiting: Esperando respuesta...
|
32
|
+
establishing: Estableciendo conexión...
|
33
|
+
connnected: Videochat conectado
|
34
|
+
unable: Imposible iniciar videochat
|
35
|
+
serverIssue: "Error del servidor: Respuesta inválida"
|
36
|
+
call: "{{name}} quiere iniciar una videollamada"
|
37
|
+
rejected: "{{name}} ha rechazado tu llamada"
|
38
|
+
rejectedBusy: "{{name}} está ocupado"
|
39
|
+
accept: Aceptar
|
40
|
+
deny: Rechazar
|
41
|
+
clientIssue: "El cliente de {{name}} no soporta videochat"
|
42
|
+
guestOffline: "Imposible conectar. {{name}} está desconectado"
|
43
|
+
offline: "Imposible conectar. Estás desconectado"
|
44
|
+
cancel: "{{name}} canceló la videollamada"
|
45
|
+
requirements: No tienes los requisitos minimos para iniciar la aplicación de videoconferencia. Por favor, actualiza a la última versión de Flash.
|
data/presence/config/routes.rb
CHANGED
@@ -7,7 +7,9 @@ Rails.application.routes.draw do
|
|
7
7
|
match '/xmpp/unsetPresence' => "Xmpp#unsetPresence"
|
8
8
|
match '/xmpp/resetConnection' => "Xmpp#resetConnection"
|
9
9
|
match '/xmpp/synchronizePresence' => "Xmpp#synchronizePresence"
|
10
|
+
|
10
11
|
match '/xmpp/updateSettings'=> "Xmpp#updateSettings"
|
11
12
|
match '/chatWindow'=> "Xmpp#chatWindow"
|
13
|
+
match '/requestVideoChat'=> "Xmpp#getOpenTokSessionIDAndToken"
|
12
14
|
|
13
15
|
end
|
@@ -13,15 +13,16 @@ scripts_path=/my_scripts_path
|
|
13
13
|
#Source path: uncomment to compile ejabberd social stream module
|
14
14
|
#source_path=/.../ejabberd_source/src
|
15
15
|
|
16
|
+
#Web Domains for REST API
|
17
|
+
web_domains=[webDomain1,webDomain2,...,webDomainN]
|
16
18
|
|
17
|
-
#Web
|
18
|
-
|
19
|
+
#Specify Web Domains URL
|
20
|
+
web_domain_name=ssdomain.example.com
|
19
21
|
|
20
22
|
#Rails Web Server Cookie name
|
21
23
|
#Check this line in your app/config/initializers/session_store.rb: Global::Application.config.session_store :cookie_store, :key => '_rails_server_cookie'
|
22
24
|
cookie_name=_rails_server_cookie
|
23
25
|
|
24
|
-
|
25
26
|
#Ejabberd Server Password
|
26
27
|
ejabberd_password=password
|
27
28
|
#True to enable REST API Security
|
Binary file
|
@@ -31,12 +31,10 @@ def getOption(option)
|
|
31
31
|
return "Undefined"
|
32
32
|
end
|
33
33
|
|
34
|
-
$accessByPasswordUrl = "http://" + getOption("web_domain=") + "/users/sign_in"
|
35
|
-
$accessByCookieUrl = "http://" + getOption("web_domain=") + "/api/me"
|
36
34
|
$cookie_name = getOption("cookie_name=")
|
37
35
|
|
38
36
|
|
39
|
-
def auth(username,
|
37
|
+
def auth(username,domain,password)
|
40
38
|
|
41
39
|
#[TEST ONLY] Allow everybody
|
42
40
|
#return true
|
@@ -46,9 +44,10 @@ def auth(username, password)
|
|
46
44
|
# return true
|
47
45
|
#end
|
48
46
|
|
47
|
+
accessByPasswordUrl = "http://" + getWebDomainUrlFromDomain(domain) + "/users/sign_in"
|
49
48
|
|
50
49
|
begin
|
51
|
-
response = RestClient.post
|
50
|
+
response = RestClient.post accessByPasswordUrl, :user => { :email => username , :password => password }
|
52
51
|
|
53
52
|
if response.code == 201
|
54
53
|
return true
|
@@ -69,9 +68,10 @@ def auth(username, password)
|
|
69
68
|
end
|
70
69
|
|
71
70
|
|
72
|
-
def authByCookie(username, cookie)
|
71
|
+
def authByCookie(username, domain, cookie)
|
73
72
|
begin
|
74
|
-
|
73
|
+
accessByCookieUrl = "http://" + getWebDomainUrlFromDomain(domain) + "/api/me"
|
74
|
+
response = RestClient.get accessByCookieUrl, :cookies => {:"#{$cookie_name}" => cookie}
|
75
75
|
doc = REXML::Document.new(response.body)
|
76
76
|
|
77
77
|
slug = ""
|
@@ -108,6 +108,16 @@ def validateParameters(username,domain,password)
|
|
108
108
|
end
|
109
109
|
|
110
110
|
|
111
|
+
def getWebDomainUrlFromDomain(domain)
|
112
|
+
web_domain = getOption(domain + "=");
|
113
|
+
if (web_domain != "Undefined")
|
114
|
+
return web_domain
|
115
|
+
else
|
116
|
+
return domain
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
|
111
121
|
loop do
|
112
122
|
begin
|
113
123
|
$stdin.eof? # wait for input
|
@@ -136,17 +146,17 @@ loop do
|
|
136
146
|
password = data[2]
|
137
147
|
if password.split(">>")[0]=="AuthenticationByCookie"
|
138
148
|
cookie = password.split(">>")[1]
|
139
|
-
$logger.info "#{Process.pid}: With
|
140
|
-
authByCookie(data[0], cookie)
|
149
|
+
$logger.info "#{Process.pid}: With userJid #{data[0]}@#{data[1]} and cookie #{cookie}"
|
150
|
+
authByCookie(data[0], data[1], cookie)
|
141
151
|
else
|
142
|
-
$logger.info "#{Process.pid}: With
|
143
|
-
#$logger.info "#{Process.pid}: With
|
144
|
-
auth(data[0], data[2])
|
152
|
+
$logger.info "#{Process.pid}: With userJid #{data[0]}@#{data[1]} and password ******"
|
153
|
+
#$logger.info "#{Process.pid}: With userJid #{data[0]}@#{data[1]} and password #{data[2]}"
|
154
|
+
auth(data[0], data[1], data[2])
|
145
155
|
end
|
146
156
|
|
147
157
|
when "isuser"
|
148
158
|
|
149
|
-
$logger.info "#{Process.pid}: Isuser #{data[0]}@#{data[1]}"
|
159
|
+
$logger.info "#{Process.pid}: Isuser with userJid: #{data[0]}@#{data[1]}"
|
150
160
|
|
151
161
|
#Authorization condition for ISUSER (Add buddys)
|
152
162
|
true
|
@@ -17,20 +17,19 @@ end
|
|
17
17
|
puts ""
|
18
18
|
puts "############### Ejabberd Configuration ###############"
|
19
19
|
puts "Config file for Social Stream Presence: /etc/ejabberd/ssconfig.cfg"
|
20
|
-
puts "Xmpp Server domain: #{getOption("server_domain=")}"
|
21
20
|
puts "Scripts Path: #{getOption("scripts_path=")}"
|
22
21
|
puts "mod_sspresence Path: #{getOption("source_path=")}"
|
23
|
-
puts "Web
|
22
|
+
puts "Web Server domains: #{getOption("web_domains=")}"
|
24
23
|
puts "##############################"
|
25
24
|
puts "REST API"
|
26
|
-
puts "Authentication by password: http
|
27
|
-
puts "Authentication by cookie: http
|
28
|
-
puts "onRegisterConnection: http
|
29
|
-
puts "onRemoveConnection: http
|
30
|
-
puts "onPresence: http
|
31
|
-
puts "onUnsetPresence: http
|
32
|
-
puts "ResetConnection: http
|
33
|
-
puts "SynchronizePresence: http
|
25
|
+
puts "Authentication by password: http://domainURL/users/sign_in"
|
26
|
+
puts "Authentication by cookie: http://domainURL/api/me"
|
27
|
+
puts "onRegisterConnection: http://domainURL/xmpp/setConnection"
|
28
|
+
puts "onRemoveConnection: http://domainURL/xmpp/unsetConnection"
|
29
|
+
puts "onPresence: http://domainURL/xmpp/setPresence"
|
30
|
+
puts "onUnsetPresence: http://domainURL/xmpp/unsetPresence"
|
31
|
+
puts "ResetConnection: http://domainURL/xmpp/resetConnection"
|
32
|
+
puts "SynchronizePresence: http://domainURL/xmpp/synchronizePresence"
|
34
33
|
puts "##############################"
|
35
34
|
puts "Social Stream Presence logs in var/log/ejabberd/"
|
36
35
|
puts "######################################################"
|
@@ -1,8 +1,12 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
|
3
|
+
####################################
|
4
|
+
# EMANAGEMENT
|
5
|
+
#Ejabberd Management script
|
4
6
|
#New features for management and maintenance ejabberd
|
5
|
-
#@author Aldo
|
7
|
+
#@author Aldo Gordillo < agordillos@gmail.com >
|
8
|
+
#@version 2.0 - 24-2-2012
|
9
|
+
####################################
|
6
10
|
|
7
11
|
require 'logger'
|
8
12
|
|
@@ -27,9 +31,7 @@ def getOption(option)
|
|
27
31
|
end
|
28
32
|
|
29
33
|
|
30
|
-
|
31
34
|
#Configuration variables
|
32
|
-
$domain = getOption("server_domain=")
|
33
35
|
$verbose = (getOption("verbose=")=="true")
|
34
36
|
$ejabberd_user = getOption("ejabberd_server_user=")
|
35
37
|
$checkEjabberdctlQuotedString = false
|
@@ -42,11 +44,12 @@ PARAMS_FOR_COMMANDS = {
|
|
42
44
|
'unsetBidireccionalBuddys' => 4,
|
43
45
|
'getRoster' => 1,
|
44
46
|
'removeRoster' => 1,
|
47
|
+
'removeAllRostersByDomain' => 1,
|
45
48
|
'removeAllRosters' => 0,
|
46
|
-
'
|
47
|
-
'
|
48
|
-
'
|
49
|
-
'
|
49
|
+
'getAllUserJidsWithRosterByDomain' => 1,
|
50
|
+
'printAllRostersByDomain' => 1,
|
51
|
+
'printAllBidirecctionalBuddysByDomain' => 1,
|
52
|
+
'checkUserJid' => 1,
|
50
53
|
'checkBidirecctionalBuddys' => 2,
|
51
54
|
'sendPresence' => 2,
|
52
55
|
'setPresence' => 1,
|
@@ -55,39 +58,45 @@ PARAMS_FOR_COMMANDS = {
|
|
55
58
|
'getUserResource' => 1,
|
56
59
|
'isEjabberdNodeStarted' => 0,
|
57
60
|
'broadcast' => 3,
|
58
|
-
'
|
59
|
-
'
|
61
|
+
'broadcastToConnectedUsers' => 3,
|
62
|
+
'getConnectedJidsByDomain' => 1,
|
63
|
+
'getConnectedJids' => 0,
|
64
|
+
'kickUserJid' => 1,
|
60
65
|
'help' => 0,
|
61
66
|
}
|
62
67
|
|
63
68
|
SYNTAX_FOR_COMMANDS = {
|
64
|
-
'addBuddyToRoster' => 'addBuddyToRoster
|
65
|
-
'removeBuddyFromRoster' => 'removeBuddyFromRoster
|
66
|
-
'setBidireccionalBuddys' => 'setBidireccionalBuddys
|
67
|
-
'unsetBidireccionalBuddys' => 'unsetBidireccionalBuddys
|
68
|
-
'getRoster' => 'getRoster
|
69
|
-
'removeRoster' => 'removeRoster
|
69
|
+
'addBuddyToRoster' => 'addBuddyToRoster userJid buddyJid buddyNick buddyGroup subscription_type',
|
70
|
+
'removeBuddyFromRoster' => 'removeBuddyFromRoster userJid buddyJid',
|
71
|
+
'setBidireccionalBuddys' => 'setBidireccionalBuddys userAJid userBJid userANick userBNick groupForA groupForB',
|
72
|
+
'unsetBidireccionalBuddys' => 'unsetBidireccionalBuddys userJid oldFriendJid oldFriendNick groupForOldFriend',
|
73
|
+
'getRoster' => 'getRoster userJid',
|
74
|
+
'removeRoster' => 'removeRoster userJid',
|
75
|
+
'removeAllRostersByDomain' => 'removeAllRostersByDomain domain',
|
70
76
|
'removeAllRosters' => 'removeAllRosters',
|
71
|
-
'
|
72
|
-
'
|
73
|
-
'
|
74
|
-
'
|
75
|
-
'checkBidirecctionalBuddys' => 'checkBidirecctionalBuddys
|
76
|
-
'sendPresence' => 'sendPresence
|
77
|
-
'setPresence' => 'setPresence
|
78
|
-
'unsetPresence' => 'unsetPresence
|
79
|
-
'sendMessageToUser' => 'sendMessageToUser
|
80
|
-
'getUserResource' => 'getUserResource
|
77
|
+
'getAllUserJidsWithRosterByDomain' => 'getAllUserJidsWithRosterByDomain domain',
|
78
|
+
'printAllRostersByDomain' => 'printAllRostersByDomain domain',
|
79
|
+
'printAllBidirecctionalBuddysByDomain' => 'printAllBidirecctionalBuddysByDomain domain',
|
80
|
+
'checkUserJid' => 'checkUserJid userJid',
|
81
|
+
'checkBidirecctionalBuddys' => 'checkBidirecctionalBuddys userAJid userBJid',
|
82
|
+
'sendPresence' => 'sendPresence userJid show',
|
83
|
+
'setPresence' => 'setPresence userJid',
|
84
|
+
'unsetPresence' => 'unsetPresence userJid',
|
85
|
+
'sendMessageToUser' => 'sendMessageToUser fromJid toJid msg',
|
86
|
+
'getUserResource' => 'getUserResource userJid',
|
81
87
|
'isEjabberdNodeStarted' => 'isEjabberdNodeStarted',
|
82
|
-
'broadcast' => 'broadcast admin
|
83
|
-
'
|
84
|
-
'
|
88
|
+
'broadcast' => 'broadcast admin userJids msg ',
|
89
|
+
'broadcastToConnectedUsers' => 'broadcastToConnectedUsers admin userJids msg (userJids value: "all" or jids array [jid1,jid2,...,jidN])',
|
90
|
+
'getConnectedJidsByDomain' => 'getConnectedJidsByDomain domain',
|
91
|
+
'getConnectedJids' => 'getConnectedJids',
|
92
|
+
'kickUserJid' => 'kickUserJid(userJid)',
|
85
93
|
'help' => 'help',
|
86
94
|
}
|
87
95
|
|
88
96
|
|
89
|
-
|
97
|
+
#########################
|
90
98
|
#Debug methods
|
99
|
+
#########################
|
91
100
|
def ejabberdLog(text)
|
92
101
|
$logger.info "Ejabberd Management Script: " + text
|
93
102
|
if $verbose
|
@@ -109,93 +118,99 @@ def logWithTitle(msg,title)
|
|
109
118
|
end
|
110
119
|
|
111
120
|
|
112
|
-
|
121
|
+
#########################
|
113
122
|
#Methods to manage rosters from Social Stream Rails App
|
114
|
-
|
115
|
-
def setBidireccionalBuddys(
|
116
|
-
addBuddyToRoster(
|
117
|
-
addBuddyToRoster(
|
123
|
+
#########################
|
124
|
+
def setBidireccionalBuddys(userAJid,userBJid,userANick,userBNick,groupForA,groupForB)
|
125
|
+
addBuddyToRoster(userAJid,userBJid,userBNick,groupForB,"both")
|
126
|
+
addBuddyToRoster(userBJid,userAJid,userANick,groupForA,"both")
|
118
127
|
return "Done"
|
119
128
|
end
|
120
129
|
|
121
|
-
def unsetBidireccionalBuddys(
|
122
|
-
if checkBidirecctionalBuddys(
|
123
|
-
removeBuddyFromRoster(
|
124
|
-
removeBuddyFromRoster(
|
125
|
-
addBuddyToRoster(
|
130
|
+
def unsetBidireccionalBuddys(userJid,oldFriendJid,oldFriendNick,groupForOldFriend)
|
131
|
+
if checkBidirecctionalBuddys(userJid,oldFriendJid)
|
132
|
+
removeBuddyFromRoster(userJid,oldFriendJid)
|
133
|
+
removeBuddyFromRoster(oldFriendJid,userJid)
|
134
|
+
addBuddyToRoster(userJid,oldFriendJid,oldFriendNick,groupForOldFriend,"to")
|
126
135
|
return "Done"
|
127
136
|
else
|
128
|
-
return
|
137
|
+
return userJid + " and " + oldFriendJid + " aren't bidireccional buddys"
|
129
138
|
end
|
130
139
|
end
|
131
140
|
|
132
|
-
def addBuddyToRoster(
|
133
|
-
user =
|
134
|
-
buddy =
|
135
|
-
userDomain =
|
136
|
-
buddyDomain =
|
141
|
+
def addBuddyToRoster(userJid,buddyJid,buddyNick,buddyGroup,subscription_type)
|
142
|
+
user = getUsernameFromJid(userJid)
|
143
|
+
buddy = getUsernameFromJid(buddyJid)
|
144
|
+
userDomain = getDomainFromJid(userJid)
|
145
|
+
buddyDomain = getDomainFromJid(buddyJid)
|
137
146
|
executeCommand("ejabberdctl add-rosteritem " + user + " " + userDomain + " " + buddy + " " + buddyDomain + " " + buddyNick + " " + buddyGroup + " " + subscription_type)
|
138
147
|
return "Done"
|
139
148
|
end
|
140
149
|
|
141
|
-
def removeBuddyFromRoster(
|
142
|
-
user =
|
143
|
-
buddy =
|
144
|
-
userDomain =
|
145
|
-
buddyDomain =
|
146
|
-
if
|
150
|
+
def removeBuddyFromRoster(userJid,buddyJid)
|
151
|
+
user = getUsernameFromJid(userJid)
|
152
|
+
buddy = getUsernameFromJid(buddyJid)
|
153
|
+
userDomain = getDomainFromJid(userJid)
|
154
|
+
buddyDomain = getDomainFromJid(buddyJid)
|
155
|
+
if checkUserJidInRoster(buddyJid,getRoster(userJid))
|
147
156
|
executeCommand("ejabberdctl delete_rosteritem " + user + " " + userDomain + " " + buddy + " " + buddyDomain)
|
148
157
|
return "Done"
|
149
158
|
else
|
150
|
-
return "User " +
|
159
|
+
return "User " + buddyJid + " not found in " + userJid + " roster."
|
151
160
|
end
|
152
161
|
end
|
153
162
|
|
154
163
|
|
164
|
+
#########################
|
155
165
|
#Roster Utilities
|
156
|
-
|
157
|
-
def getRoster(
|
158
|
-
if
|
159
|
-
executeCommand("ejabberdctl get_roster " +
|
166
|
+
#########################
|
167
|
+
def getRoster(userJid)
|
168
|
+
if checkUserJid(userJid)
|
169
|
+
executeCommand("ejabberdctl get_roster " + getUsernameFromJid(userJid) + " " + getDomainFromJid(userJid))
|
160
170
|
else
|
161
|
-
return "Roster not found for user " +
|
171
|
+
return "Roster not found for user " + userJid
|
162
172
|
end
|
163
173
|
end
|
164
174
|
|
165
|
-
def
|
166
|
-
|
175
|
+
def getBuddyJidsFromRoster(roster)
|
176
|
+
buddyJids = []
|
167
177
|
lines = roster.split("\n")
|
168
178
|
lines.each do |line|
|
169
|
-
|
179
|
+
buddyJids << line.split(" ")[0]
|
170
180
|
end
|
171
|
-
|
181
|
+
buddyJids
|
172
182
|
end
|
173
183
|
|
174
|
-
def removeRoster(
|
175
|
-
if
|
176
|
-
|
177
|
-
user_roster = getRoster(username);
|
178
|
-
user_buddys = getBuddysFromRoster(user_roster);
|
179
|
-
user_buddys.each do |buddy|
|
180
|
-
buddy_sid = buddy + "@" + $domain
|
181
|
-
removeBuddyFromRoster(user_sid,buddy_sid)
|
182
|
-
end
|
184
|
+
def removeRoster(userJid)
|
185
|
+
if checkUserJid(userJid)
|
186
|
+
executeCommand("ejabberdctl process_rosteritems delete any any " + userJid + " any")
|
183
187
|
return "Done"
|
184
188
|
else
|
185
|
-
return "Roster not found for
|
189
|
+
return "Roster not found for userJid " + userJid
|
186
190
|
end
|
187
191
|
end
|
188
192
|
|
189
|
-
def
|
190
|
-
|
193
|
+
def removeAllRostersByDomain(domain)
|
194
|
+
if(domain=="all")
|
195
|
+
executeCommand("ejabberdctl process_rosteritems delete any any any any")
|
196
|
+
else
|
197
|
+
executeCommand("ejabberdctl process_rosteritems delete any any *@" + domain + " any")
|
198
|
+
end
|
191
199
|
return "Done";
|
192
200
|
end
|
193
201
|
|
194
|
-
def
|
195
|
-
|
202
|
+
def removeAllRosters()
|
203
|
+
return removeAllRostersByDomain("all")
|
204
|
+
end
|
196
205
|
|
197
|
-
|
206
|
+
def getAllUserJidsWithRosterByDomain(domain)
|
207
|
+
if(domain=="all")
|
208
|
+
output = executeCommand("ejabberdctl process_rosteritems list any any any any")
|
209
|
+
else
|
210
|
+
output = executeCommand("ejabberdctl process_rosteritems list any any *@" + domain + " any")
|
211
|
+
end
|
198
212
|
|
213
|
+
userJids = []
|
199
214
|
lines = output.split("\n");
|
200
215
|
items = lines[0].split(" ")[2]
|
201
216
|
|
@@ -204,180 +219,178 @@ def getAllUsersWithRoster()
|
|
204
219
|
if items.to_i > 0
|
205
220
|
lines.each do |line|
|
206
221
|
if line.split(":")[0]=="Matches"
|
207
|
-
|
208
|
-
#puts
|
209
|
-
unless
|
210
|
-
|
222
|
+
userJid = line.split(" ")[1]
|
223
|
+
#puts "Line:" + line
|
224
|
+
unless userJids.include?(userJid)
|
225
|
+
userJids << userJid
|
211
226
|
end
|
212
227
|
end
|
213
228
|
end
|
214
229
|
end
|
215
230
|
end
|
216
231
|
|
217
|
-
return
|
232
|
+
return userJids;
|
218
233
|
end
|
219
234
|
|
220
|
-
def
|
235
|
+
def getAllUserJidsWithRoster()
|
236
|
+
return getAllUserJidsWithRosterByDomain("all")
|
237
|
+
end
|
238
|
+
|
239
|
+
def getAllRostersByDomain(domain)
|
221
240
|
rosterList = { }
|
222
241
|
|
223
|
-
|
242
|
+
userJids = getAllUserJidsWithRosterByDomain(domain)
|
224
243
|
|
225
|
-
|
226
|
-
roster = getRoster(
|
227
|
-
rosterList.store(
|
244
|
+
userJids.each do |userJid|
|
245
|
+
roster = getRoster(userJid)
|
246
|
+
rosterList.store(userJid,roster)
|
228
247
|
end
|
229
248
|
return rosterList
|
230
249
|
end
|
231
250
|
|
232
|
-
def
|
233
|
-
|
234
|
-
|
251
|
+
def getAllRosters()
|
252
|
+
return getAllRostersByDomain("all");
|
253
|
+
end
|
254
|
+
|
255
|
+
def printAllRostersByDomain(domain)
|
256
|
+
rosterList = getAllRostersByDomain(domain)
|
257
|
+
rosterList.keys.each do |userJid|
|
235
258
|
puts "\n"
|
236
259
|
puts "-------------------------------------"
|
237
|
-
puts
|
260
|
+
puts userJid + " Roster"
|
238
261
|
puts "-------------------------------------"
|
239
|
-
puts rosterList[
|
262
|
+
puts rosterList[userJid]
|
240
263
|
puts "-------------------------------------"
|
241
264
|
puts "\n"
|
242
265
|
end
|
243
266
|
return "Done"
|
244
267
|
end
|
245
268
|
|
246
|
-
def
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
269
|
+
def printAllRosters()
|
270
|
+
return printAllRostersByDomain("all")
|
271
|
+
end
|
272
|
+
|
273
|
+
def getAllBidirecctionalBuddysByDomain(domain)
|
274
|
+
b_buddyJids = []
|
275
|
+
userJids = getAllUserJidsWithRosterByDomain(domain)
|
276
|
+
nonCheckedUsers = userJids
|
277
|
+
userJids.each do |userJid|
|
278
|
+
nonCheckedUsers.delete(userJid)
|
279
|
+
nonCheckedUsers.each do |checkUserJid|
|
280
|
+
if checkBidirecctionalBuddys(userJid,checkUserJid)
|
281
|
+
b_buddyJids << [userJid,checkUserJid]
|
255
282
|
end
|
256
283
|
end
|
257
284
|
end
|
258
|
-
return
|
285
|
+
return b_buddyJids
|
259
286
|
end
|
260
287
|
|
261
|
-
def
|
288
|
+
def getAllBidirecctionalBuddys()
|
289
|
+
return getAllBidirecctionalBuddysByDomain("all")
|
290
|
+
end
|
291
|
+
|
292
|
+
def printAllBidirecctionalBuddysByDomain(domain)
|
262
293
|
puts "This may take a while..."
|
263
|
-
b_buddys =
|
294
|
+
b_buddys = getAllBidirecctionalBuddysByDomain(domain)
|
264
295
|
b_buddys.each do |contact|
|
265
296
|
puts "[" + contact[0] + "," + contact[1] + "]"
|
266
297
|
end
|
267
298
|
return "Done"
|
268
299
|
end
|
269
300
|
|
270
|
-
|
271
|
-
|
272
|
-
return getAllUsersWithRoster().include?(user)
|
301
|
+
def printAllBidirecctionalBuddys()
|
302
|
+
return printAllBidirecctionalBuddysByDomain("all")
|
273
303
|
end
|
274
304
|
|
275
|
-
|
276
|
-
|
305
|
+
#Check if the user have a roster in his domain
|
306
|
+
def checkUserJid(userJid)
|
307
|
+
domain = getDomainFromJid(userJid)
|
308
|
+
return getAllUserJidsWithRosterByDomain(domain).include?(userJid)
|
277
309
|
end
|
278
310
|
|
279
|
-
def
|
280
|
-
|
281
|
-
userB = userBSid.split("@")[0]
|
282
|
-
rosterA = getRoster(userA)
|
283
|
-
rosterB = getRoster(userB)
|
284
|
-
return (checkUserInRoster(userA,rosterB) and checkUserInRoster(userB,rosterA))
|
311
|
+
def checkUserJidInRoster(userJid,roster)
|
312
|
+
return getBuddyJidsFromRoster(roster).include?(userJid)
|
285
313
|
end
|
286
314
|
|
315
|
+
def checkBidirecctionalBuddys(userAJid,userBJid)
|
316
|
+
rosterA = getRoster(userAJid)
|
317
|
+
rosterB = getRoster(userBJid)
|
318
|
+
return (checkUserJidInRoster(userAJid,rosterB) and checkUserJidInRoster(userBJid,rosterA))
|
319
|
+
end
|
287
320
|
|
288
|
-
#Manage stanzas Utilities
|
289
321
|
|
290
|
-
|
291
|
-
|
322
|
+
#########################
|
323
|
+
#Manage stanzas Utilities
|
324
|
+
#########################
|
325
|
+
def setPresence(userJid)
|
326
|
+
sendPresenceStanzaWithType(userJid,userJid,"available")
|
292
327
|
end
|
293
328
|
|
294
|
-
def unsetPresence(
|
295
|
-
sendPresenceStanzaWithType(
|
329
|
+
def unsetPresence(userJid)
|
330
|
+
sendPresenceStanzaWithType(userJid,userJid,"unavailable")
|
296
331
|
end
|
297
332
|
|
298
333
|
def sendPresence(username,show)
|
299
334
|
sendPresenceWithShow(username,username,show)
|
300
335
|
end
|
301
336
|
|
302
|
-
def sendPresenceWithShow(
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
pres_stanza = "\\<" + buildQuotedString("presence from=") + "\\\"" + buildQuotedString(from_sid) + "\\\"" + buildQuotedString(" to=") + "\\\"" +
|
309
|
-
buildQuotedString(to_sid) + "\\\"\\>\\<" + buildQuotedString("show") + "\\>" + buildQuotedString(show) + "\\<" +
|
337
|
+
def sendPresenceWithShow(fromJid,toJid,show)
|
338
|
+
resource = getUserResource(fromJid);
|
339
|
+
from_name = getUsernameFromJid(fromJid)
|
340
|
+
domain = getDomainFromJid(fromJid)
|
341
|
+
pres_stanza = "\\<" + buildQuotedString("presence from=") + "\\\"" + buildQuotedString(fromJid) + "\\\"" + buildQuotedString(" to=") + "\\\"" +
|
342
|
+
buildQuotedString(toJid) + "\\\"\\>\\<" + buildQuotedString("show") + "\\>" + buildQuotedString(show) + "\\<" +
|
310
343
|
buildQuotedString("/show") + "\\>\\<" + buildQuotedString("/presence") + "\\>"
|
311
|
-
executeCommand("ejabberdctl send_stanza_c2s " + from_name + " " +
|
344
|
+
executeCommand("ejabberdctl send_stanza_c2s " + from_name + " " + domain + " " + resource + " " + pres_stanza)
|
312
345
|
return "Done"
|
313
346
|
end
|
314
347
|
|
315
|
-
def sendPresenceStanzaWithType(
|
316
|
-
resource = getUserResource(
|
317
|
-
|
318
|
-
|
348
|
+
def sendPresenceStanzaWithType(fromJid,toJid,presence_type)
|
349
|
+
resource = getUserResource(fromJid);
|
350
|
+
from_name = getUsernameFromJid(fromJid)
|
351
|
+
domain = getDomainFromJid(fromJid)
|
319
352
|
pres_stanza = "\\<" + buildQuotedString("presence type=") + "\\\"" + buildQuotedString(presence_type) + "\\\"" + buildQuotedString(" from=") + "\\\"" +
|
320
|
-
buildQuotedString(
|
321
|
-
executeCommand("ejabberdctl send_stanza_c2s " + from_name + " " +
|
353
|
+
buildQuotedString(fromJid) + "\\\"" + buildQuotedString(" to=") + "\\\"" + buildQuotedString(toJid) + "\\\"\\>\\<" + buildQuotedString("/presence") + "\\>"
|
354
|
+
executeCommand("ejabberdctl send_stanza_c2s " + from_name + " " + domain + " " + resource + " " + pres_stanza)
|
322
355
|
return "Done"
|
323
356
|
end
|
324
357
|
|
325
|
-
def sendMessageToUser(
|
326
|
-
|
327
|
-
to_sid = to_name + "@" + $domain;
|
328
|
-
executeCommand("ejabberdctl send_message_chat " + from_sid + " " + to_sid + " " + buildQuotedString(msg))
|
358
|
+
def sendMessageToUser(fromJid,toJid,msg)
|
359
|
+
executeCommand("ejabberdctl send_message_chat " + fromJid + " " + toJid + " " + buildQuotedString(msg))
|
329
360
|
return "Done"
|
330
361
|
end
|
331
362
|
|
332
|
-
def getUserResource(
|
363
|
+
def getUserResource(userJid)
|
333
364
|
output = executeCommand("ejabberdctl connected-users")
|
334
365
|
lines = output.split("\n");
|
335
366
|
lines.each do |line|
|
336
|
-
if line.split("
|
337
|
-
#puts "Find " +
|
338
|
-
|
339
|
-
resource = s.split("/")[1];
|
367
|
+
if line.split("/")[0] == userJid
|
368
|
+
#puts "Find " + userJid
|
369
|
+
resource = line.split("/")[1];
|
340
370
|
return resource;
|
341
371
|
end
|
342
372
|
end
|
343
|
-
return
|
373
|
+
return userJid + " no have any active session"
|
344
374
|
end
|
345
375
|
|
346
376
|
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
return ((firstLine.split(":")[1]).strip()=="started")
|
353
|
-
end
|
354
|
-
return false
|
377
|
+
#########################
|
378
|
+
#Utilities
|
379
|
+
#########################
|
380
|
+
def getUsernameFromJid(jid)
|
381
|
+
return jid.split("@")[0];
|
355
382
|
end
|
356
383
|
|
357
|
-
def
|
358
|
-
|
359
|
-
output = executeCommand("ejabberdctl connected-users")
|
360
|
-
sessions = output.split("\n")
|
361
|
-
sessions.each do |session|
|
362
|
-
users << session.split("@")[0]
|
363
|
-
end
|
364
|
-
return users
|
384
|
+
def getDomainFromJid(jid)
|
385
|
+
return jid.split("@")[1];
|
365
386
|
end
|
366
387
|
|
367
|
-
def
|
368
|
-
|
369
|
-
|
370
|
-
lines.each do |line|
|
371
|
-
username = line.split("@")[0]
|
372
|
-
if (users == "all") or (users.length > 1 and users.include?(username))
|
373
|
-
s = line.split("@")[1];
|
374
|
-
resource = s.split("/")[1];
|
375
|
-
sendMessageToUser(admin,username,msg)
|
376
|
-
end
|
377
|
-
end
|
378
|
-
return "Done"
|
388
|
+
def getElementsFromStringArray(stringArray)
|
389
|
+
stringArray=stringArray[1,stringArray.length-2]
|
390
|
+
return stringArray.split(",")
|
379
391
|
end
|
380
392
|
|
393
|
+
|
381
394
|
#Determine how to scape characters for build quoted strings
|
382
395
|
def checkEjabberdctlQuotedString
|
383
396
|
puts "checkForSimpleSlash: " + checkForSimpleSlash.to_s()
|
@@ -461,8 +474,84 @@ def buildQuotedString(msg)
|
|
461
474
|
end
|
462
475
|
|
463
476
|
|
464
|
-
|
477
|
+
#########################
|
478
|
+
#Connection Info
|
479
|
+
#########################
|
480
|
+
def isEjabberdNodeStarted
|
481
|
+
output = executeCommand("ejabberdctl status")
|
482
|
+
if firstLine = output.split("\n")[0]
|
483
|
+
return ((firstLine.split(":")[1]).strip()=="started")
|
484
|
+
end
|
485
|
+
return false
|
486
|
+
end
|
465
487
|
|
488
|
+
def getConnectedJidsByDomain(domain)
|
489
|
+
jids = []
|
490
|
+
if(domain=="all")
|
491
|
+
output = executeCommand("ejabberdctl connected-users")
|
492
|
+
else
|
493
|
+
output = executeCommand("ejabberdctl connected-users | grep @" + domain + "/")
|
494
|
+
end
|
495
|
+
sessions = output.split("\n")
|
496
|
+
sessions.each do |session|
|
497
|
+
jids << session.split("/")[0]
|
498
|
+
end
|
499
|
+
return jids
|
500
|
+
end
|
501
|
+
|
502
|
+
def getConnectedJids()
|
503
|
+
return getConnectedJidsByDomain("all")
|
504
|
+
end
|
505
|
+
|
506
|
+
|
507
|
+
#########################
|
508
|
+
#Advanced features
|
509
|
+
#########################
|
510
|
+
def broadcast(admin,userJids,msg)
|
511
|
+
getElementsFromStringArray(userJids).each do |userJid|
|
512
|
+
sendMessageToUser(admin,userJid,msg)
|
513
|
+
end
|
514
|
+
return "Done"
|
515
|
+
end
|
516
|
+
|
517
|
+
def broadcastToConnectedUsers(admin,userJids,msg)
|
518
|
+
connectedJids = getConnectedJids()
|
519
|
+
if(userJids=="all")
|
520
|
+
connectedJids.each do |userJid|
|
521
|
+
sendMessageToUser(admin,userJid,msg)
|
522
|
+
end
|
523
|
+
else
|
524
|
+
getElementsFromStringArray(userJids).each do |userJid|
|
525
|
+
if (connectedJids.include?(userJid))
|
526
|
+
sendMessageToUser(admin,userJid,msg)
|
527
|
+
end
|
528
|
+
end
|
529
|
+
end
|
530
|
+
return "Done"
|
531
|
+
end
|
532
|
+
|
533
|
+
def kickUserJid(userJid)
|
534
|
+
user = getUsernameFromJid(userJid)
|
535
|
+
userDomain = getDomainFromJid(userJid)
|
536
|
+
resource = getUserResource(userJid);
|
537
|
+
reason = "0"
|
538
|
+
executeCommand("ejabberdctl kick_session " + user + " " + userDomain + " " + resource + " " + reason)
|
539
|
+
return "Done"
|
540
|
+
end
|
541
|
+
|
542
|
+
def banUserJid(userJid)
|
543
|
+
kickUserJid(userJid)
|
544
|
+
#Notify Web server to ban user permanently
|
545
|
+
end
|
546
|
+
|
547
|
+
|
548
|
+
|
549
|
+
|
550
|
+
|
551
|
+
|
552
|
+
#########################
|
553
|
+
#Execution commands methods
|
554
|
+
#########################
|
466
555
|
def executeCommand(command)
|
467
556
|
#Building...
|
468
557
|
command = buildCommand(command)
|
@@ -499,6 +588,10 @@ def execute_as_sudo
|
|
499
588
|
end
|
500
589
|
end
|
501
590
|
|
591
|
+
|
592
|
+
#########################
|
593
|
+
#Support
|
594
|
+
#########################
|
502
595
|
def help
|
503
596
|
log("Command list")
|
504
597
|
SYNTAX_FOR_COMMANDS.values.each do |command|
|
@@ -509,8 +602,9 @@ end
|
|
509
602
|
|
510
603
|
|
511
604
|
|
605
|
+
#########################
|
512
606
|
#Main thread
|
513
|
-
|
607
|
+
#########################
|
514
608
|
#log("Init Ejabberd Maintenance script")
|
515
609
|
|
516
610
|
begin
|
@@ -545,11 +639,14 @@ begin
|
|
545
639
|
puts "Use 'help' to get information about command syntax"
|
546
640
|
end
|
547
641
|
else
|
548
|
-
|
549
|
-
|
642
|
+
if (ARGV.length==0)
|
643
|
+
help
|
644
|
+
else
|
645
|
+
puts "Error: Command not recognized"
|
646
|
+
puts "Use 'help' to get information about command syntax"
|
647
|
+
end
|
550
648
|
end
|
551
649
|
rescue
|
552
650
|
puts "Syntax error"
|
553
651
|
puts "Use 'help' to get information about command syntax"
|
554
652
|
end
|
555
|
-
|