social_stream 0.11.7 → 0.11.8
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/{documents → base}/app/assets/images/lightbox-blank.gif +0 -0
- data/{documents → base}/app/assets/images/lightbox-btn-close.gif +0 -0
- data/{documents → base}/app/assets/images/lightbox-btn-next.gif +0 -0
- data/{documents → base}/app/assets/images/lightbox-btn-prev.gif +0 -0
- data/{documents → base}/app/assets/images/lightbox-ico-loading.gif +0 -0
- data/base/app/assets/javascripts/activities.js.erb +40 -5
- data/base/app/assets/javascripts/activities_security_chosen-modified.jquery.js +767 -0
- data/base/app/assets/javascripts/messages.js +1 -0
- data/base/app/assets/javascripts/social_stream-base.js +1 -0
- data/base/app/assets/stylesheets/base.css.scss +1 -1
- data/base/app/assets/stylesheets/messages.css.scss +1 -0
- data/base/app/controllers/contacts_controller.rb +11 -7
- data/base/app/controllers/groups_controller.rb +11 -2
- data/base/app/views/activities/_new.html.erb +16 -2
- data/base/app/views/activities/index.js.erb +2 -0
- data/base/app/views/comments/create.js.erb +2 -0
- data/base/app/views/conversations/_conversation_full.html.erb +62 -44
- data/base/app/views/conversations/show.html.erb +1 -1
- data/base/app/views/conversations/show.js.erb +1 -1
- data/base/app/views/home/index.js.erb +3 -0
- data/base/app/views/layouts/_header_signed_in.erb +1 -0
- data/base/app/views/messages/new.js.erb +1 -1
- data/base/app/views/settings/_destroy.html.erb +17 -0
- data/base/app/views/settings/_index.html.erb +3 -2
- data/base/app/views/subjects/_show.js.erb +3 -0
- data/base/config/locales/en.yml +5 -0
- data/base/config/locales/es.yml +6 -1
- data/base/lib/social_stream/base/version.rb +1 -1
- data/base/spec/controllers/contacts_controller_spec.rb +8 -1
- data/base/spec/controllers/groups_controller_spec.rb +8 -11
- data/base/vendor/assets/javascripts/jquery.ae.image.resize.js +69 -0
- data/{documents → base}/vendor/assets/javascripts/jquery.lightbox-with-resize-plugin.js +0 -0
- data/documents/app/assets/javascripts/social_stream-documents.js +1 -2
- data/documents/lib/social_stream/documents/version.rb +1 -1
- data/documents/lib/social_stream/toolbar_config/documents.rb +0 -18
- data/documents/social_stream-documents.gemspec +1 -1
- data/events/lib/social_stream/events/version.rb +1 -1
- data/events/lib/social_stream/toolbar_config/events.rb +0 -12
- data/events/social_stream-events.gemspec +1 -1
- data/events/vendor/assets/stylesheets/jquery.ad-gallery.css +1 -1
- data/lib/social_stream/version.rb +1 -1
- data/presence/Rakefile +7 -0
- data/presence/app/assets/javascripts/xmpp_client.js +8 -2
- data/presence/app/views/xmpp/_chat.html.erb +1 -0
- data/presence/app/views/xmpp/_chat_contacts.html.erb +1 -1
- data/presence/ejabberd/conf/ejabberd.cfg +2 -2
- data/presence/ejabberd/conf/ssconfig.cfg +3 -0
- data/presence/ejabberd/ejabberd_scripts/authentication_script +4 -4
- data/presence/ejabberd/ejabberd_scripts/emanagement +245 -0
- data/presence/ejabberd/mod_sspresence/mod_sspresence.beam +0 -0
- data/presence/ejabberd/mod_sspresence/mod_sspresence.erl +46 -19
- data/presence/lib/generators/social_stream/presence/install_generator.rb +28 -0
- data/presence/lib/generators/social_stream/presence/templates/initializer.rb +12 -0
- data/presence/lib/social_stream/presence/{config.rb → version.rb} +1 -1
- data/presence/lib/tasks/presence/synchronize.rake +1 -1
- data/presence/social_stream-presence.gemspec +1 -1
- data/social_stream.gemspec +3 -3
- metadata +27 -23
- data/base/app/views/settings/_contacts.html.erb +0 -16
- data/base/vendor/assets/javascripts/chosen.jquery.js +0 -755
- data/presence/ejabberd/conf/server.pem +0 -37
@@ -0,0 +1,69 @@
|
|
1
|
+
(function( $ ) {
|
2
|
+
|
3
|
+
$.fn.aeImageResize = function( params ) {
|
4
|
+
|
5
|
+
var aspectRatio = 0
|
6
|
+
// Nasty I know but it's done only once, so not too bad I guess
|
7
|
+
// Alternate suggestions welcome :)
|
8
|
+
, isIE6 = $.browser.msie && (6 == ~~ $.browser.version)
|
9
|
+
;
|
10
|
+
|
11
|
+
// We cannot do much unless we have one of these
|
12
|
+
if ( !params.height && !params.width ) {
|
13
|
+
return this;
|
14
|
+
}
|
15
|
+
|
16
|
+
// Calculate aspect ratio now, if possible
|
17
|
+
if ( params.height && params.width ) {
|
18
|
+
aspectRatio = params.width / params.height;
|
19
|
+
}
|
20
|
+
|
21
|
+
// Attach handler to load
|
22
|
+
// Handler is executed just once per element
|
23
|
+
// Load event required for Webkit browsers
|
24
|
+
return this.one( "load", function() {
|
25
|
+
|
26
|
+
// Remove all attributes and CSS rules
|
27
|
+
this.removeAttribute( "height" );
|
28
|
+
this.removeAttribute( "width" );
|
29
|
+
this.style.height = this.style.width = "";
|
30
|
+
|
31
|
+
var imgHeight = this.height
|
32
|
+
, imgWidth = this.width
|
33
|
+
, imgAspectRatio = imgWidth / imgHeight
|
34
|
+
, bxHeight = params.height
|
35
|
+
, bxWidth = params.width
|
36
|
+
, bxAspectRatio = aspectRatio;
|
37
|
+
|
38
|
+
// Work the magic!
|
39
|
+
// If one parameter is missing, we just force calculate it
|
40
|
+
if ( !bxAspectRatio ) {
|
41
|
+
if ( bxHeight ) {
|
42
|
+
bxAspectRatio = imgAspectRatio + 1;
|
43
|
+
} else {
|
44
|
+
bxAspectRatio = imgAspectRatio - 1;
|
45
|
+
}
|
46
|
+
}
|
47
|
+
|
48
|
+
// Only resize the images that need resizing
|
49
|
+
if ( (bxHeight && imgHeight > bxHeight) || (bxWidth && imgWidth > bxWidth) ) {
|
50
|
+
|
51
|
+
if ( imgAspectRatio > bxAspectRatio ) {
|
52
|
+
bxHeight = ~~ ( imgHeight / imgWidth * bxWidth );
|
53
|
+
} else {
|
54
|
+
bxWidth = ~~ ( imgWidth / imgHeight * bxHeight );
|
55
|
+
}
|
56
|
+
|
57
|
+
this.height = bxHeight;
|
58
|
+
this.width = bxWidth;
|
59
|
+
}
|
60
|
+
})
|
61
|
+
.each(function() {
|
62
|
+
|
63
|
+
// Trigger load event (for Gecko and MSIE)
|
64
|
+
if ( this.complete || isIE6 ) {
|
65
|
+
$( this ).trigger( "load" );
|
66
|
+
}
|
67
|
+
});
|
68
|
+
};
|
69
|
+
})( jQuery );
|
File without changes
|
@@ -1,24 +1,6 @@
|
|
1
1
|
module SocialStream
|
2
2
|
module ToolbarConfig
|
3
3
|
module Documents
|
4
|
-
def home_toolbar_items
|
5
|
-
items = super
|
6
|
-
|
7
|
-
# FIXME: insert
|
8
|
-
items << {
|
9
|
-
:key => :resources,
|
10
|
-
:name => image_tag("btn/btn_resource.png",:class =>"menu_icon")+t('resource.mine'),
|
11
|
-
:url => "#",
|
12
|
-
:options => {:link => {:id => "resources_menu"}},
|
13
|
-
:items => [
|
14
|
-
{:key => :resources_documents,:name => image_tag("btn/btn_document.png")+t('document.title'),:url => documents_path},
|
15
|
-
{:key => :resources_pictures,:name => image_tag("btn/btn_gallery.png")+t('picture.title'),:url => pictures_path},
|
16
|
-
{:key => :resources_videos,:name => image_tag("btn/btn_video.png")+t('video.title'),:url => videos_path},
|
17
|
-
{:key => :resources_audios,:name => image_tag("btn/btn_audio.png")+t('audio.title'),:url => audios_path}
|
18
|
-
]
|
19
|
-
}
|
20
|
-
end
|
21
|
-
|
22
4
|
def profile_toolbar_items(subject = current_subject)
|
23
5
|
items = super
|
24
6
|
|
@@ -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.9.
|
15
|
+
s.add_runtime_dependency('social_stream-base', '~> 0.9.22')
|
16
16
|
s.add_runtime_dependency('paperclip-ffmpeg', '~> 0.7.0')
|
17
17
|
s.add_runtime_dependency('paperclip','2.3.11')
|
18
18
|
s.add_runtime_dependency('delayed_paperclip','>= 0.7.2')
|
@@ -1,18 +1,6 @@
|
|
1
1
|
module SocialStream
|
2
2
|
module ToolbarConfig
|
3
3
|
module Events
|
4
|
-
def home_toolbar_items
|
5
|
-
items = super
|
6
|
-
|
7
|
-
items.find{ |i| i[:key] == :resources }[:items].unshift({
|
8
|
-
:key => :resources_events,
|
9
|
-
:name => image_tag("btn/btn_event.png")+t('conference.title'),
|
10
|
-
:url => events_path
|
11
|
-
})
|
12
|
-
|
13
|
-
items
|
14
|
-
end
|
15
|
-
|
16
4
|
def profile_toolbar_items(subject = current_subject)
|
17
5
|
items = super
|
18
6
|
|
@@ -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.9.
|
15
|
+
s.add_runtime_dependency('social_stream-base', '~> 0.9.22')
|
16
16
|
s.add_runtime_dependency('conference_manager-ruby', '~> 0.0.3')
|
17
17
|
|
18
18
|
# Development Gem dependencies
|
@@ -86,7 +86,7 @@
|
|
86
86
|
}
|
87
87
|
* html .ad-gallery .ad-image-wrapper .ad-image .ad-image-description {
|
88
88
|
background: none;
|
89
|
-
filter:progid:DXImageTransform.Microsoft.AlphaImageLoader
|
89
|
+
filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=scale, src='opa75.png');
|
90
90
|
}
|
91
91
|
.ad-gallery .ad-image-wrapper .ad-image .ad-image-description .ad-description-title {
|
92
92
|
display: block;
|
data/presence/Rakefile
CHANGED
@@ -241,6 +241,12 @@ function initAndPlaySound(sound){
|
|
241
241
|
//Chat view jquery
|
242
242
|
////////////////////
|
243
243
|
|
244
|
+
function initDelegates(){
|
245
|
+
$('.user_presence').delegate( '.user_presence a[title]', 'hover', function(){
|
246
|
+
e.preventDefault();
|
247
|
+
});
|
248
|
+
}
|
249
|
+
|
244
250
|
function setUserFunctions(){
|
245
251
|
|
246
252
|
$("div.user_presence").click(function(event, ui){
|
@@ -254,7 +260,6 @@ function setUserFunctions(){
|
|
254
260
|
};
|
255
261
|
});
|
256
262
|
|
257
|
-
|
258
263
|
//JQuery DropdwanStatus
|
259
264
|
|
260
265
|
$(".dropdown dt a").click(function(event) {
|
@@ -326,7 +331,8 @@ function refreshChatWindow(){
|
|
326
331
|
function updateChatWindow(){
|
327
332
|
timerCounter=0;
|
328
333
|
log("updateChatWindow()");
|
329
|
-
$.post("/chatWindow", { userConnected: userConnected }, function(data){
|
334
|
+
$.post("/chatWindow", { userConnected: userConnected }, function(data){
|
335
|
+
$(".tooltip").hide() //Prevent tooltips
|
330
336
|
$("#chat_partial").html(data);
|
331
337
|
if (userConnected) {
|
332
338
|
$(".user_presence a[title]").tooltip();
|
@@ -28,7 +28,7 @@
|
|
28
28
|
<%@contacts.each do |contact| %>
|
29
29
|
<div class="user_presence" name='<%=contact.name%>' slug='<%=contact.slug%>'>
|
30
30
|
<a title='<%=contact.name%>' class="presence_user_link" width="28">
|
31
|
-
<%=image_tag(contact.logo.url, :alt => contact.name , :
|
31
|
+
<%=image_tag(contact.logo.url, :alt => contact.name , :size => "28x28")%>
|
32
32
|
<% if contact.user.status %>
|
33
33
|
<%=image_tag("status/" + contact.user.status + ".png", :class => "presence_status") %></a>
|
34
34
|
<% end %>
|
@@ -88,7 +88,7 @@
|
|
88
88
|
%% You can define one or several, for example:
|
89
89
|
%% {hosts, ["example.net", "example.com", "example.org"]}.
|
90
90
|
%%
|
91
|
-
{hosts, ["
|
91
|
+
{hosts, ["localhost"]}.
|
92
92
|
|
93
93
|
%%
|
94
94
|
%% route_subdomains: Delegate subdomains to other XMPP servers.
|
@@ -376,7 +376,7 @@
|
|
376
376
|
%%
|
377
377
|
%%{acl, admin, {user, "aleksey", "localhost"}}.
|
378
378
|
%%{acl, admin, {user, "ermine", "example.org"}}.
|
379
|
-
{acl, admin, {user, "admin", "
|
379
|
+
{acl, admin, {user, "admin", "localhost"}}.
|
380
380
|
|
381
381
|
%%
|
382
382
|
%% Blocked users
|
@@ -37,12 +37,12 @@ $sspass = getOption("ss_password=")
|
|
37
37
|
def auth(username, password)
|
38
38
|
|
39
39
|
#[TEST ONLY] Allow everybody
|
40
|
-
return true
|
40
|
+
#return true
|
41
41
|
|
42
42
|
#[TEST] Admin password
|
43
|
-
if username == "admin" and password == "pass"
|
44
|
-
|
45
|
-
end
|
43
|
+
#if username == "admin" and password == "pass"
|
44
|
+
# return true
|
45
|
+
#end
|
46
46
|
|
47
47
|
#Social Stream password
|
48
48
|
if username == $sslogin and password == $sspass
|
@@ -0,0 +1,245 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
#Ejabberd Management script
|
4
|
+
#New features for management and maintenance ejabberd
|
5
|
+
#@author Aldo
|
6
|
+
|
7
|
+
require 'logger'
|
8
|
+
|
9
|
+
path = "/var/log/ejabberd/scripts.log"
|
10
|
+
file = File.open(path, File::WRONLY | File::APPEND | File::CREAT)
|
11
|
+
file.sync = true
|
12
|
+
$logger = Logger.new(file)
|
13
|
+
$logger.level = Logger::DEBUG
|
14
|
+
|
15
|
+
def getOption(option)
|
16
|
+
File.open('/etc/ejabberd/ssconfig.cfg', 'r') do |f1|
|
17
|
+
while line = f1.gets
|
18
|
+
line = line.gsub(/\n/,'')
|
19
|
+
if line.match(/^#/)
|
20
|
+
#Comments
|
21
|
+
elsif line.match(/^#{option}/)
|
22
|
+
return line.gsub(/#{option}/,'')
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
return "Undefined"
|
27
|
+
end
|
28
|
+
|
29
|
+
def ejabberdLog(text)
|
30
|
+
$logger.info "Ejabberd Management Script: " + text
|
31
|
+
end
|
32
|
+
|
33
|
+
#Configuration variables
|
34
|
+
$domain = getOption("server_domain=")
|
35
|
+
|
36
|
+
PARAMS_FOR_COMMANDS = {
|
37
|
+
'getRoster' => 1,
|
38
|
+
'removeBuddyFromRoster' => 2,
|
39
|
+
'addBuddyToRoster' => 5,
|
40
|
+
'removeRoster' => 1,
|
41
|
+
'getBuddysFromRoster' => 1,
|
42
|
+
'setBidireccionalBuddys' => 4,
|
43
|
+
'help' => 0,
|
44
|
+
'getUserResource' => 1,
|
45
|
+
'sendMessageToUser' => 3,
|
46
|
+
'sendPresence' => 2,
|
47
|
+
'unsetPresence' => 1,
|
48
|
+
'setPresence' => 1,
|
49
|
+
'removeAllRosters' => 0,
|
50
|
+
}
|
51
|
+
|
52
|
+
SYNTAX_FOR_COMMANDS = {
|
53
|
+
'getRoster' => "getRoster username",
|
54
|
+
'removeBuddyFromRoster' => "removeBuddyFromRoster username buddy",
|
55
|
+
'addBuddyToRoster' => "addBuddyToRoster username buddy buddyNick buddyGroup subscription_type",
|
56
|
+
'removeRoster' => "removeRoster username",
|
57
|
+
'getBuddysFromRoster' => "getBuddysFromRoster roster",
|
58
|
+
'setBidireccionalBuddys' => "setBidireccionalBuddys usernameA usernameB nickA nickB",
|
59
|
+
'getUserResource' => "getUserResource username",
|
60
|
+
'sendMessageToUser' => "sendMessageToUser from_name to_name msg",
|
61
|
+
'sendPresence' => 'sendPresence username show',
|
62
|
+
'unsetPresence' => 'unsetPresence username',
|
63
|
+
'setPresence' => 'setPresence username',
|
64
|
+
'removeAllRosters' => 'removeAllRosters'
|
65
|
+
}
|
66
|
+
|
67
|
+
def log(msg)
|
68
|
+
logWithTitle(msg,nil)
|
69
|
+
end
|
70
|
+
|
71
|
+
def logWithTitle(msg,title)
|
72
|
+
puts "------------------------"
|
73
|
+
if title
|
74
|
+
puts ("<<<" + title + ">>>")
|
75
|
+
end
|
76
|
+
puts msg
|
77
|
+
puts "------------------------"
|
78
|
+
end
|
79
|
+
|
80
|
+
|
81
|
+
def getRoster(username)
|
82
|
+
command = "ejabberdctl get_roster " + username + " " + $domain
|
83
|
+
%x[#{command}];
|
84
|
+
end
|
85
|
+
|
86
|
+
def removeBuddyFromRoster(username,buddy)
|
87
|
+
command = "ejabberdctl delete_rosteritem " + username + " " + $domain + " " + buddy + " " + $domain
|
88
|
+
%x[#{command}];
|
89
|
+
end
|
90
|
+
|
91
|
+
def addBuddyToRoster(username,buddy,buddyNick,buddyGroup,subscription_type)
|
92
|
+
command = "ejabberdctl add-rosteritem " + username + " " + $domain + " " + buddy + " " + $domain + " \\'" + buddyNick + "\\' " + buddyGroup + " " + subscription_type
|
93
|
+
%x[#{command}];
|
94
|
+
end
|
95
|
+
|
96
|
+
def removeRoster(username)
|
97
|
+
user_roster = getRoster(username);
|
98
|
+
user_buddys = getBuddysFromRoster(user_roster);
|
99
|
+
user_buddys.each do |buddy|
|
100
|
+
removeBuddyFromRoster(username,buddy)
|
101
|
+
end
|
102
|
+
return "Done"
|
103
|
+
end
|
104
|
+
|
105
|
+
def removeAllRosters()
|
106
|
+
command = "ejabberdctl process_rosteritems delete any any any any"
|
107
|
+
%x[#{command}];
|
108
|
+
return "Done";
|
109
|
+
end
|
110
|
+
|
111
|
+
def getBuddysFromRoster(roster)
|
112
|
+
buddys = []
|
113
|
+
lines = roster.split("\n")
|
114
|
+
lines.each do |line|
|
115
|
+
buddys << line.split("@")[0]
|
116
|
+
end
|
117
|
+
buddys
|
118
|
+
end
|
119
|
+
|
120
|
+
def setBidireccionalBuddys(usernameA,usernameB,nickA,nickB)
|
121
|
+
#addBuddyToRoster(username,buddy,buddyNick,buddyGroup,subscription_type)
|
122
|
+
addBuddyToRoster(usernameA,usernameB,nickB,"SocialStream","both")
|
123
|
+
addBuddyToRoster(usernameB,usernameA,nickA,"SocialStream","both")
|
124
|
+
sendPresence(usernameA,"chat")
|
125
|
+
sendPresence(usernameB,"chat")
|
126
|
+
return "Done"
|
127
|
+
end
|
128
|
+
|
129
|
+
def sendStanzaUserMessage(username,msg)
|
130
|
+
resource = getUserResource(username);
|
131
|
+
stanza = "\\<\\'message\\'\\>\\<\\'body\\'\\>\\'" + msg + "\\'\\<\\'/body\\'\\>\\<\\'/message\\'\\>"
|
132
|
+
command = "ejabberdctl send_stanza_c2s " + username + " " + $domain + " " + resource + " " + stanza
|
133
|
+
puts "Executing: " + command
|
134
|
+
%x[#{command}];
|
135
|
+
return "Done"
|
136
|
+
end
|
137
|
+
|
138
|
+
|
139
|
+
def sendPresence(username,show)
|
140
|
+
sendPresenceWithShow(username,username,show)
|
141
|
+
end
|
142
|
+
|
143
|
+
def unsetPresence(username)
|
144
|
+
sendPresenceStanzaWithType(username,username,"unavailable")
|
145
|
+
end
|
146
|
+
|
147
|
+
def setPresence(username)
|
148
|
+
sendPresenceStanzaWithType(username,username,"available")
|
149
|
+
end
|
150
|
+
|
151
|
+
def sendPresenceWithShow(from_name,to_name,show)
|
152
|
+
puts from_name
|
153
|
+
resource = getUserResource(from_name);
|
154
|
+
puts resource
|
155
|
+
from_sid = from_name + "@" + $domain;
|
156
|
+
to_sid = to_name + "@" + $domain;
|
157
|
+
pres_stanza = "\\<\\'presence from=\\'\\\"\\'" + from_sid + "\\'\\\"\\' to=\\'\\\"\\'" + to_sid + "\\'\\\"\\>\\<\\'show\\'\\>\\'" + show + "\\'\\<\\'/show\\'\\>\\<\\'/presence\\'\\>"
|
158
|
+
command = "ejabberdctl send_stanza_c2s " + from_name + " " + $domain + " " + resource + " " + pres_stanza
|
159
|
+
puts "Executing: " + command
|
160
|
+
%x[#{command}];
|
161
|
+
return "Done"
|
162
|
+
end
|
163
|
+
|
164
|
+
def sendPresenceStanzaWithType(from_name,to_name,presence_type)
|
165
|
+
resource = getUserResource(from_name);
|
166
|
+
from_sid = from_name + "@" + $domain;
|
167
|
+
to_sid = to_name + "@" + $domain;
|
168
|
+
pres_stanza = "\\<\\'presence type=\\'\\\"\\'" + presence_type + "\\'\\\"\\' from=\\'\\\"\\'" + from_sid + "\\'\\\"\\' to=\\'\\\"\\'" + to_sid + "\\'\\\"\\>\\<\\'/presence\\'\\>"
|
169
|
+
command = "ejabberdctl send_stanza_c2s " + from_name + " " + $domain + " " + resource + " " + pres_stanza
|
170
|
+
puts "Executing: " + command
|
171
|
+
%x[#{command}];
|
172
|
+
return "Done"
|
173
|
+
end
|
174
|
+
|
175
|
+
def sendMessageToUser(from_name,to_name,msg)
|
176
|
+
from_sid = from_name + "@" + $domain;
|
177
|
+
to_sid = to_name + "@" + $domain;
|
178
|
+
command = "ejabberdctl send_message_chat " + from_sid + " " + to_sid + " " + "\\'" + msg + "\\'";
|
179
|
+
puts "Executing: " + command
|
180
|
+
%x[#{command}];
|
181
|
+
return "Done"
|
182
|
+
end
|
183
|
+
|
184
|
+
def getUserResource(username)
|
185
|
+
command = "ejabberdctl connected-users"
|
186
|
+
output = %x[#{command}];
|
187
|
+
lines = output.split("\n");
|
188
|
+
lines.each do |line|
|
189
|
+
if line.split("@")[0] == username
|
190
|
+
#puts "Find " + username
|
191
|
+
s = line.split("@")[1];
|
192
|
+
resource = s.split("/")[1];
|
193
|
+
return resource;
|
194
|
+
end
|
195
|
+
end
|
196
|
+
return username + " no have any active session"
|
197
|
+
end
|
198
|
+
|
199
|
+
def help
|
200
|
+
log("Command list")
|
201
|
+
SYNTAX_FOR_COMMANDS.values.each do |command|
|
202
|
+
puts command
|
203
|
+
end
|
204
|
+
puts ""
|
205
|
+
end
|
206
|
+
|
207
|
+
log("Init Ejabberd Maintenance script")
|
208
|
+
|
209
|
+
begin
|
210
|
+
if ARGV[0] and PARAMS_FOR_COMMANDS.keys.include?(ARGV[0])
|
211
|
+
if (ARGV.length == (PARAMS_FOR_COMMANDS[ARGV[0]]+1))
|
212
|
+
|
213
|
+
ejabberdLog("Executing (#{ARGV[0]})")
|
214
|
+
|
215
|
+
length = ARGV.length;
|
216
|
+
case length
|
217
|
+
when 1
|
218
|
+
puts send(ARGV[0])
|
219
|
+
when 2
|
220
|
+
puts send(ARGV[0],ARGV[1])
|
221
|
+
when 3
|
222
|
+
puts send(ARGV[0],ARGV[1],ARGV[2])
|
223
|
+
when 4
|
224
|
+
puts send(ARGV[0],ARGV[1],ARGV[2],ARGV[3])
|
225
|
+
when 5
|
226
|
+
puts send(ARGV[0],ARGV[1],ARGV[2],ARGV[3],ARGV[4])
|
227
|
+
when 6
|
228
|
+
puts send(ARGV[0],ARGV[1],ARGV[2],ARGV[3],ARGV[4],ARGV[5])
|
229
|
+
else
|
230
|
+
puts send(ARGV[0],ARGV)
|
231
|
+
end
|
232
|
+
puts ""
|
233
|
+
else
|
234
|
+
log("Error: Params required for command " + (ARGV[0]).to_s() + ": " + (PARAMS_FOR_COMMANDS[ARGV[0]]).to_s())
|
235
|
+
log("Use 'help' to get information about command syntax")
|
236
|
+
end
|
237
|
+
else
|
238
|
+
|
239
|
+
log("Error: Command not recognized")
|
240
|
+
log("Use 'help' to get information about command syntax")
|
241
|
+
end
|
242
|
+
rescue
|
243
|
+
puts "Parametros incorrectos"
|
244
|
+
end
|
245
|
+
|