social_stream 0.15.5 → 0.15.6

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.
Files changed (26) hide show
  1. data/base/app/assets/stylesheets/base.css.scss +1 -1
  2. data/base/app/models/activity.rb +1 -1
  3. data/base/app/models/actor.rb +24 -10
  4. data/base/app/views/layouts/application.html.erb +1 -0
  5. data/base/lib/social_stream/base/version.rb +1 -1
  6. data/lib/social_stream/version.rb +1 -1
  7. data/linkser/lib/social_stream/linkser/version.rb +1 -1
  8. data/linkser/social_stream-linkser.gemspec +2 -2
  9. data/presence/app/assets/javascripts/chat_interface_manager.js.erb +2 -1
  10. data/presence/app/assets/javascripts/chat_parser.js +14 -0
  11. data/presence/app/assets/javascripts/chat_window_manager.js +70 -22
  12. data/presence/app/assets/javascripts/xmpp_client_management.js.erb +2 -2
  13. data/presence/app/assets/stylesheets/{chat.css → chat.css.scss} +69 -48
  14. data/presence/ejabberd/ejabberd_files.zip +0 -0
  15. data/presence/ejabberd/ejabberd_scripts/emanagement +4 -4
  16. data/presence/ejabberd/ejabberd_scripts/reset_connection_script +6 -3
  17. data/presence/ejabberd/ejabberd_scripts/rest_api_client_script +5 -2
  18. data/presence/ejabberd/ejabberd_scripts/synchronize_presence_script +6 -3
  19. data/presence/ejabberd/mod_sspresence/mod_sspresence.beam +0 -0
  20. data/presence/lib/social_stream/presence/models/buddy_manager.rb +5 -4
  21. data/presence/lib/social_stream/presence/version.rb +1 -1
  22. data/presence/lib/social_stream/presence/xmpp_server_order.rb +14 -3
  23. data/presence/lib/tasks/presence/installer.rake +4 -2
  24. data/presence/vendor/assets/javascripts/jquery.ui.chatbox.js +72 -18
  25. data/social_stream.gemspec +2 -2
  26. metadata +86 -169
@@ -132,7 +132,7 @@ div.chzn-container ul.chzn-choices li.search-field input{ cursor:pointer;}
132
132
 
133
133
  /********* Menu header SECTION ************/
134
134
  .menu_list ul{list-style-type:none;}
135
- .menu_list li{display: inline;padding-right: 2px; padding-left: 2px; }
135
+ .menu_list li{display: inline;padding-right: 2px; padding-left: 2px; vertical-align: top; }
136
136
  .line{ display:block; margin:10px 2px 10px 10px;}
137
137
 
138
138
  /*************MENU ICON SECTION**********/
@@ -317,7 +317,7 @@ class Activity < ActiveRecord::Base
317
317
  receiver_name= receiver.name.truncate(30, :separator => ' ')
318
318
  case verb
319
319
  when 'like'
320
- if direct_object.is_a? Actor or direct_object.respond_to? :actor
320
+ if direct_object.acts_as_actor?
321
321
  I18n.t('notification.fan',
322
322
  :sender => sender_name,
323
323
  :whose => I18n.t('notification.whose.'+ receiver.subject.class.to_s.underscore,
@@ -207,16 +207,25 @@ class Actor < ActiveRecord::Base
207
207
  Relation::Reject.of(self)
208
208
  end
209
209
 
210
- # All the {Actor actors} this one has relation with
210
+ # All the {Actor Actors} this one has ties with:
211
+ #
212
+ # actor.contact_actors #=> array of actors that sent and receive ties from actor
211
213
  #
212
- # Options:
213
- # * type: Filter by the class of the contacts.
214
- # * direction: sent or received
215
- # * relations: Restrict the relations of considered ties. In the case of both directions,
216
- # only relations belonging to {Actor} are valid. It defaults to relations of
217
- # {Relation::Custom custom} and {Relation::Public public} types
218
- # * include_self: False by default, don't include this actor as subject even they have ties with themselves.
219
- # * load_subjects: True by default, make the queries for eager loading of contacts
214
+ #
215
+ #
216
+ # There are several options available to refine the query:
217
+ # type:: Filter by the class of the contacts ({User}, {Group}, etc.)
218
+ # actor.contact_actors(:type => :user) #=> array of user actors. Exclude groups, etc.
219
+ #
220
+ # direction:: +:sent+ leaves only the actors this one has ties to. +:received+ gets
221
+ # the actors sending ties to this actor, whether this actor added them or not
222
+ # actor.contact_actors(:direction => :sent) #=> all the receivers of ties from actor
223
+ # relations:: Restrict to ties made up with +relations+. In the case of both directions,
224
+ # only relations belonging to {Actor} are considered.
225
+ # It defaults to actor's {Relation::Custom custom relations}
226
+ # actor.contact_actors(:relations => [2]) #=> actors tied with relation #2
227
+ # include_self:: False by default, do not include this actor even they have ties with themselves.
228
+ # load_subjects:: True by default, make the queries for {http://api.rubyonrails.org/classes/ActiveRecord/Associations/ClassMethods.html#label-Eager+loading+of+associations eager loading} of {SocialStream::Models::Subject Subject}
220
229
  #
221
230
  def contact_actors(options = {})
222
231
  subject_types = Array(options[:type] || self.class.subtypes)
@@ -231,14 +240,19 @@ class Actor < ActiveRecord::Base
231
240
  as = as.includes(subject_types)
232
241
  end
233
242
 
234
- # Make another query for getting the actors in the other way
243
+ # A blank :direction means reciprocate contacts, there must be ties in both directions
244
+ #
245
+ # This is achieved by getting the id of all the contacts that are sending ties
246
+ # Then, we filter the sent contacts query to only those contacts
235
247
  if options[:direction].blank?
236
248
  rcv_opts = options.dup
237
249
  rcv_opts[:direction] = :received
238
250
  rcv_opts[:load_subjects] = false
239
251
 
252
+ # Get the id of actors that are sending to this one
240
253
  sender_ids = contact_actors(rcv_opts).map(&:id)
241
254
 
255
+ # Filter the sent query with these ids
242
256
  as = as.where(:id => sender_ids)
243
257
 
244
258
  options[:direction] = :sent
@@ -7,6 +7,7 @@
7
7
  <meta name="keywords" content="<%= t('profile.tags.default') %><%= yield(:keywords) %>" >
8
8
  <meta name="description" content= "<%= yield(:description).empty? ? t('frontpage.main_title') : yield(:description) %>" >
9
9
  <meta name="generator" content="SocialStream" />
10
+ <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=no" />
10
11
 
11
12
  <%= stylesheet_link_tag "application" %>
12
13
  <%= javascript_include_tag "application" %>
@@ -1,5 +1,5 @@
1
1
  module SocialStream
2
2
  module Base
3
- VERSION = "0.10.8".freeze
3
+ VERSION = "0.10.9".freeze
4
4
  end
5
5
  end
@@ -1,3 +1,3 @@
1
1
  module SocialStream
2
- VERSION = "0.15.5".freeze
2
+ VERSION = "0.15.6".freeze
3
3
  end
@@ -1,5 +1,5 @@
1
1
  module SocialStream
2
2
  module Linkser
3
- VERSION = "0.0.5".freeze
3
+ VERSION = "0.0.6".freeze
4
4
  end
5
5
  end
@@ -12,8 +12,8 @@ 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.10.8')
16
- s.add_runtime_dependency('linkser', '~> 0.0.7')
15
+ s.add_runtime_dependency('social_stream-base', '~> 0.10.9')
16
+ s.add_runtime_dependency('linkser', '~> 0.0.8')
17
17
  # Development Gem dependencies
18
18
  s.add_development_dependency('sqlite3-ruby')
19
19
  if RUBY_VERSION < '1.9'
@@ -278,9 +278,10 @@ function putReceivedMessageOnChatWindow(from_jid,from_slug,body,msgID){
278
278
 
279
279
  //Parse content before show it.
280
280
  var content = getParsedContent(Strophe.getText(body), false)
281
+ var headerMessage = getParsedName(from_name,false);
281
282
 
282
283
  //Show message to chatBox.
283
- $("#" + from_slug).chatbox("option", "boxManager").addMsg(from_name, content);
284
+ $("#" + from_slug).chatbox("option", "boxManager").addMsg(headerMessage, content);
284
285
 
285
286
  //Rotate chatBoxes priority.
286
287
  rotatePriority(from_slug);
@@ -241,3 +241,17 @@ function getUrlType(url){
241
241
  return "link"
242
242
  }
243
243
  }
244
+
245
+
246
+ ///////////////////////////////////////////////////////
247
+ // Parsing user titles
248
+ ///////////////////////////////////////////////////////
249
+
250
+ function getParsedName(name, fromUser){
251
+ if (fromUser){
252
+ var chatTextclass = "ownName"
253
+ } else {
254
+ var chatTextclass = "guestName"
255
+ }
256
+ return ("<span class=\"" + chatTextclass + "\">" + name + "</span>");
257
+ }
@@ -1,10 +1,12 @@
1
1
  ////////////////////
2
- //Chat functions
2
+ //Chat Window Manager functions
3
3
  ////////////////////
4
4
 
5
5
  var nBox = 0;
6
6
  var maxBox = 5;
7
7
  var chatBoxWidth = 230;
8
+ var chatBoxHeight = 170;
9
+ var videoBoxHeight = 150;
8
10
  var visibleChatBoxes = new Array();
9
11
  var chatBoxSeparation = chatBoxWidth+12;
10
12
 
@@ -19,8 +21,6 @@ function createChatBox(guest_slug,guest_name,guest_jid,user_name,user_jid){
19
21
 
20
22
  //Add div with id = guest_slug
21
23
  $("#chat_divs").append("<div id=" + guest_slug + " name=" + guest_name + "></div>")
22
-
23
- //Add CSS [...]
24
24
 
25
25
 
26
26
  //Offset Management for new box
@@ -34,6 +34,8 @@ function createChatBox(guest_slug,guest_name,guest_jid,user_name,user_jid){
34
34
  hidden: false,
35
35
  offset: offset, // relative to right edge of the browser window
36
36
  width: chatBoxWidth, // width of the chatbox
37
+ height: chatBoxHeight, // height of the chatbox
38
+ video: 0, //height of the videoBox
37
39
  title : guest_name,
38
40
  position: position,
39
41
  priority: visibleChatBoxes.length+1,
@@ -53,7 +55,8 @@ function createChatBox(guest_slug,guest_name,guest_jid,user_name,user_jid){
53
55
 
54
56
  messageSent : function(id, user, msg) {
55
57
  rotatePriority(guest_slug);
56
- $("#" + guest_slug).chatbox("option", "boxManager").addMsg(id, getParsedContent(msg,true));
58
+ var headerMessage = getParsedName(id,true);
59
+ $("#" + guest_slug).chatbox("option", "boxManager").addMsg(headerMessage, getParsedContent(msg,true));
57
60
  sendChatMessage(user_jid,guest_jid,msg);
58
61
  }});
59
62
 
@@ -102,37 +105,82 @@ function getBoxParams(){
102
105
  }
103
106
 
104
107
 
108
+ function getChatVariableFromSlug(slug){
109
+ return "slug_" + slug;
110
+ }
111
+
112
+
113
+ function getSlugFromChatVariable(variable){
114
+ return variable.split("_")[1];
115
+ }
116
+
117
+
118
+ ////////////////////
119
+ //Box replacement
120
+ ////////////////////
121
+
105
122
  function getBoxIndexToReplace(){
106
123
 
107
- tmp = visibleChatBoxes[0];
108
- for (i=0;i<visibleChatBoxes.length;i++){
124
+ tmp = visibleChatBoxes[0];
125
+ for (i=0;i<visibleChatBoxes.length;i++){
109
126
  if (visibleChatBoxes[i].chatbox("option", "priority") > tmp.chatbox("option", "priority")) {
110
- tmp = visibleChatBoxes[i];
111
- }
127
+ tmp = visibleChatBoxes[i];
128
+ }
112
129
  }
113
-
114
- return visibleChatBoxes.indexOf(tmp);
130
+
131
+ return visibleChatBoxes.indexOf(tmp);
115
132
  }
116
133
 
117
134
 
118
135
  function rotatePriority(guest_slug){
119
- priority = $("#" + guest_slug).chatbox("option", "priority")
120
- if(priority>1){
121
- for (i=0;i<visibleChatBoxes.length;i++){
136
+ priority = $("#" + guest_slug).chatbox("option", "priority")
137
+ if(priority>1){
138
+ for (i=0;i<visibleChatBoxes.length;i++){
122
139
  if(visibleChatBoxes[i].chatbox("option", "priority")<priority){
123
- visibleChatBoxes[i].chatbox("option", "priority",visibleChatBoxes[i].chatbox("option", "priority")+1);
124
- }
125
- }
126
- $("#" + guest_slug).chatbox("option", "priority", 1);
127
- }
140
+ visibleChatBoxes[i].chatbox("option", "priority",visibleChatBoxes[i].chatbox("option", "priority")+1);
141
+ }
142
+ }
143
+ $("#" + guest_slug).chatbox("option", "priority", 1);
144
+ }
128
145
  }
129
146
 
130
147
 
131
- function getChatVariableFromSlug(slug){
132
- return "slug_" + slug;
148
+ ////////////////////
149
+ //Video Window Manager functions
150
+ ////////////////////
151
+
152
+ function getVideoBoxFromSlug(slug){
153
+ return $("#" + slug).parent().find("div.ui-videobox")
133
154
  }
134
155
 
156
+ function showVideoBox(slug,embed){
157
+ var chatBox = window[getChatVariableFromSlug(slug)]
158
+ getVideoBoxFromSlug(slug).html(embed);
159
+ chatBox.chatbox("option", "video",videoBoxHeight);
160
+ }
135
161
 
136
- function getSlugFromChatVariable(variable){
137
- return variable.split("_")[1];
162
+
163
+ function hideVideoBox(slug){
164
+ var chatBox = window[getChatVariableFromSlug(slug)]
165
+ chatBox.chatbox("option", "video", 0);
166
+ }
167
+
168
+
169
+ //Function called from JQuery UI Plugin
170
+ function toogleVideoBox(uiElement){
171
+ var slug = $(uiElement.element).attr("id");
172
+ toogleVideoBoxForSlug(slug)
173
+ }
174
+
175
+ function toogleVideoBoxForSlug(slug){
176
+ var chatBox = window[getChatVariableFromSlug(slug)]
177
+ if (chatBox.chatbox("option", "video")==0){
178
+ showVideoBox(slug,getVideoEmbedForSlug(slug))
179
+ } else {
180
+ hideVideoBox(slug);
181
+ }
182
+ }
183
+
184
+ function getVideoEmbedForSlug(slug){
185
+ return "<img src=\"http://www.batiburrillo.net/wp-content/uploads/2011/03/Freemake.jpg?cda6c1\" width=\"" + (chatBoxWidth-20) + "\"/>"
138
186
  }
@@ -91,10 +91,10 @@ function ifCookie(){
91
91
 
92
92
  //Global variables
93
93
  var userStatus = "chat";
94
- var awayTimerPeriod = 16000;
94
+ var awayTimerPeriod = 60000;
95
95
  var timerPeriod = 5000;
96
96
  var refreshMinTime = 3*timerPeriod;
97
- var awayTime = 300000;
97
+ var awayTime = 20*60000; //20 minutes
98
98
  var awayCounter = 0;
99
99
  var timerCounter = 0;
100
100
  var connection = null;
@@ -1,21 +1,28 @@
1
+ @import "colors";
2
+
3
+
1
4
  /* Chatbox style sheet */
2
5
 
6
+ .ui-widget-content{
7
+ border: none;
8
+ }
9
+
3
10
  .ui-chatbox {
4
11
  position: fixed;
5
12
  bottom:0;
6
13
  padding: 2px 2px 2px 2px;
7
14
  padding: 2px 2px 2px 2px;
8
- background: #CCCCCC;
15
+ background: $separation-color;
9
16
  }
10
17
 
11
18
  .ui-state-highlight {
12
- background: #CCCCCC;
13
- background-color: #CCCCCC;
14
- border: 1px solid lightgrey;
19
+ background: $separation-color;
20
+ background-color: $separation-color;
21
+ border: 1px solid $separation-color;
15
22
  }
16
23
 
17
24
  .chatWindowhighlighted {
18
- color: #CAC8F4;
25
+ color: $fill-color;
19
26
  }
20
27
 
21
28
  .ui-chatbox-titlebar {
@@ -33,28 +40,28 @@
33
40
  padding: 3px 3px 3px 3px;
34
41
  height: 150px;
35
42
  overflow-y: auto;
36
- background: #FFFFFF;
43
+ background: $text-over-main;
37
44
  }
38
45
 
39
46
  .ui-chatbox-input {
40
47
  padding: 3px 3px 3px 3px;
41
- border-top: 1px solid grey;
48
+ border-top: 1px solid $separation-color;
42
49
  overflow: hidden;
43
- /* background: #FFFFFF; */
44
50
  }
45
51
 
46
52
  .ui-chatbox-input-box {
47
53
  margin: 5px 5px 5px 5px;
48
- border: 2px solid lightgrey;
54
+ border: 1px solid $separation-color;
49
55
  height: 35px;
50
56
  }
51
57
 
58
+
52
59
  .ui-chatbox-icon {
53
60
  float: right;
54
61
  }
55
62
 
56
63
  .ui-chatbox-input-focus {
57
- border-color: #6699FF;
64
+ border-color: $header-notification-color;
58
65
  }
59
66
 
60
67
  .ui-chatbox-msg {
@@ -62,10 +69,27 @@
62
69
  clear: both;
63
70
  }
64
71
 
72
+ .ui-chatbox-log {
73
+ border: none;
74
+ }
75
+
76
+
77
+ /* video window style */
78
+ div.ui-videobox{
79
+ height: 0px;
80
+ border-bottom: 1px solid $separation-color;
81
+ }
82
+
83
+ div.ui-videobox-icon{
84
+
85
+ }
86
+
87
+ /* notifications style sheet */
88
+
65
89
  div.ui-chatbox-notify{
66
90
  visibility: hidden;
67
- background: #E5E5E5;
68
- background-color: #E5E5E5;
91
+ background: $fill-color;
92
+ background-color: $fill-color;
69
93
  color: black;
70
94
  z-index: 1;
71
95
  position:absolute;
@@ -76,7 +100,7 @@ div.ui-chatbox-notify{
76
100
  text-align: center;
77
101
  border-style:solid;
78
102
  border-width:1px;
79
- border-color: #CCCCCC;
103
+ border-color: $fill-color;
80
104
  opacity:0.95;
81
105
  filter:alpha(opacity=95); /* For IE8 and earlier */
82
106
  }
@@ -87,6 +111,7 @@ p.ui-chatbox-notify-text{
87
111
  }
88
112
 
89
113
 
114
+
90
115
  /* Ticks */
91
116
 
92
117
  .chat-thick {
@@ -108,6 +133,10 @@ p.ui-chatbox-notify-text{
108
133
  background-position: -96px -128px;
109
134
  }
110
135
 
136
+ .chat-videothick{
137
+ display: none;
138
+ }
139
+
111
140
 
112
141
  /* Presence Partial */
113
142
 
@@ -147,7 +176,7 @@ div.user_presence {
147
176
 
148
177
  #passwordFormChat{
149
178
  width: 150px;
150
- background-color: #1F4A75;
179
+ background-color: $main-color;
151
180
  padding-top:3px;
152
181
  padding-bottom:1px;
153
182
  }
@@ -168,7 +197,7 @@ input.chat_password{
168
197
  input.connectChatButton{
169
198
  text-align: center;
170
199
  width: 150px;
171
- background-color: #1F4A75;
200
+ background-color: $main-color;
172
201
  border: 0 none;
173
202
  cursor: pointer;
174
203
  color: white;
@@ -189,28 +218,19 @@ input.connectChatButton{
189
218
  width:160px;
190
219
  padding: 18px 25px 15px 25px;
191
220
  margin: -15px 0px 0px 0px;
192
- color:#fff;
221
+ color: white;
193
222
  background:transparent url(black_arrow3.png);
194
223
  text-align: center;
195
- /* border: 5px solid red; */
196
224
  }
197
225
 
198
226
 
199
- /* Status style sheet */
200
227
 
228
+ /* Status style sheet */
201
229
 
202
230
  #status{
203
231
  z-index: 1;
204
232
  }
205
-
206
- .desc {
207
- color:#6b6b6b;
208
- }
209
-
210
- .desc a {
211
- color:#0092dd;
212
- }
213
-
233
+
214
234
  .dropdown dd, .dropdown dt, .dropdown ul {
215
235
  margin:0px;
216
236
  padding:0px;
@@ -221,29 +241,28 @@ input.connectChatButton{
221
241
  }
222
242
 
223
243
  .dropdown a, .dropdown a:visited {
224
- color:#1F4A75;
244
+ color: $main-color;
225
245
  text-decoration:none;
226
246
  outline:none;
227
247
  }
228
248
 
229
249
  .dropdown a:hover {
230
- color:#1F4A75;
250
+ color: $main-color;
231
251
  }
232
252
  .dropdown dt a:hover {
233
- color:#1F4A75;
234
- border: 1px solid #1F4A75;
253
+ color: $main-color;
254
+ border: 1px solid $main-color;
235
255
  }
236
256
 
237
257
  .dropdown dt a {
238
- background:#DFECF1 url(btn/arrowBlue.png) no-repeat scroll right center;
258
+ background:$secondary-color url(btn/arrowBlue.png) no-repeat scroll right center;
239
259
  display:block;
240
260
  padding-right:20px;
241
- border:1px solid #DFECF1;
261
+ border:1px solid $secondary-color;
242
262
  width:128px;
243
263
  }
244
264
 
245
265
 
246
-
247
266
  .dropdown dt a span {
248
267
  cursor:pointer;
249
268
  display:block;
@@ -251,8 +270,9 @@ input.connectChatButton{
251
270
  }
252
271
 
253
272
  .dropdown dd ul {
254
- background:#DFECF1 none repeat scroll 0 0;
255
- border:1px solid #DFECF1; color:#DFECF1;
273
+ background: $secondary-color none repeat scroll 0 0;
274
+ border:1px solid $secondary-color;
275
+ color: $secondary-color;
256
276
  display:none;
257
277
  left:0px;
258
278
  padding:5px 0px;
@@ -274,7 +294,7 @@ input.connectChatButton{
274
294
  }
275
295
 
276
296
  .dropdown dd ul li a:hover {
277
- background-color:#D4E5EF;
297
+ background-color: $separation-color;
278
298
  }
279
299
 
280
300
  .dropdown img.flag {
@@ -287,22 +307,23 @@ input.connectChatButton{
287
307
  display:none;
288
308
  }
289
309
 
290
- .input_select{
291
- width: 100%;
292
- background-color: #D0C9AF;
293
- margin-top:5px;
294
- margin-bottom:5px;
295
- }
296
-
297
310
 
298
311
  /* Chat text style */
299
312
 
300
313
  .ownChatText {
301
- color: #342E82;
314
+ color: $main-color;
302
315
  }
303
316
 
304
317
  .guestChatText {
305
- color: #342E82;
318
+ color: $sentence-color;
319
+ }
320
+
321
+ .ownName {
322
+ color: $main-color;
323
+ }
324
+
325
+ .guestName {
326
+ color: $sentence-color;
306
327
  }
307
328
 
308
329
  .chatImage {
@@ -321,9 +342,9 @@ input.connectChatButton{
321
342
  }
322
343
 
323
344
  a.chatLink:link, a.chatLink:visited {
324
- color: #1E726A;
345
+ color: $main-color;
325
346
  }
326
347
 
327
348
  a.chatImageLink:link, a.chatImageLink:visited {
328
- color: #1E726A;
349
+ color: $main-color;
329
350
  }
Binary file
@@ -54,7 +54,7 @@ PARAMS_FOR_COMMANDS = {
54
54
  'sendMessageToUser' => 3,
55
55
  'getUserResource' => 1,
56
56
  'isEjabberdNodeStarted' => 0,
57
- 'broadcast' => 2,
57
+ 'broadcast' => 3,
58
58
  'checkEjabberdctlQuotedString' => 0,
59
59
  'getConnectedUsers' => 0,
60
60
  'help' => 0,
@@ -79,7 +79,7 @@ SYNTAX_FOR_COMMANDS = {
79
79
  'sendMessageToUser' => 'sendMessageToUser from_name to_name msg',
80
80
  'getUserResource' => 'getUserResource username',
81
81
  'isEjabberdNodeStarted' => 'isEjabberdNodeStarted',
82
- 'broadcast' => 'broadcast users msg (users values: "all" or slugs array)',
82
+ 'broadcast' => 'broadcast admin users msg (users values: "all" or slugs array)',
83
83
  'checkEjabberdctlQuotedString' => 'checkEjabberdctlQuotedString',
84
84
  'getConnectedUsers' => 'getConnectedUsers',
85
85
  'help' => 'help',
@@ -364,7 +364,7 @@ def getConnectedUsers
364
364
  return users
365
365
  end
366
366
 
367
- def broadcast(users,msg)
367
+ def broadcast(admin,users,msg)
368
368
  output = executeCommand("ejabberdctl connected-users")
369
369
  lines = output.split("\n");
370
370
  lines.each do |line|
@@ -372,7 +372,7 @@ def broadcast(users,msg)
372
372
  if (users == "all") or (users.length > 1 and users.include?(username))
373
373
  s = line.split("@")[1];
374
374
  resource = s.split("/")[1];
375
- sendMessageToUser("SocialStream",username,msg)
375
+ sendMessageToUser(admin,username,msg)
376
376
  end
377
377
  end
378
378
  return "Done"
@@ -6,8 +6,6 @@
6
6
 
7
7
  require 'logger'
8
8
  require 'rest_client'
9
- require 'openssl'
10
- require 'digest/md5'
11
9
 
12
10
 
13
11
  path = "/var/log/ejabberd/scripts.log"
@@ -34,7 +32,7 @@ end
34
32
  $secure_rest_api = getOption("secure_rest_api=")
35
33
  $pass = getOption("ejabberd_password=")
36
34
  $scripts_path = getOption("scripts_path=")
37
- $script_title = "Reset Connection script"
35
+ $script_title = "Reset Connection Script"
38
36
 
39
37
 
40
38
  def log(title,text)
@@ -194,6 +192,9 @@ def sendHttpRequest(url,params,encrypted_params)
194
192
 
195
193
 
196
194
  if $secure_rest_api == "true"
195
+ #Require libraries
196
+ require 'openssl'
197
+
197
198
  xmpp_private_key_path = $scripts_path + "/rsa_keys/xmpp_rsa_key_private.pem";
198
199
  web_public_key_path = $scripts_path + "/rsa_keys/web_rsa_key_public.pem";
199
200
  xmpp_private_key = OpenSSL::PKey::RSA.new(File.read(xmpp_private_key_path))
@@ -241,6 +242,8 @@ end
241
242
 
242
243
 
243
244
  def calculateHash(request_params)
245
+ require 'digest/md5'
246
+
244
247
  unless request_params
245
248
  request_params = {};
246
249
  end