social_stream-presence 0.7.0 → 0.7.1
Sign up to get free protection for your applications and to get access to all the features.
- data/app/assets/javascripts/chat_interface_manager.js.erb +24 -12
- data/app/assets/javascripts/chat_window_manager.js +4 -0
- data/app/assets/javascripts/xmpp_client_management.js.erb +80 -8
- data/app/assets/stylesheets/chat.css.scss +2 -3
- data/app/views/chat/_contacts.html.erb +9 -1
- data/config/locales/en.yml +1 -0
- data/config/locales/es.yml +1 -0
- data/lib/social_stream/presence/version.rb +1 -1
- data/social_stream-presence.gemspec +1 -1
- data/vendor/assets/javascripts/jquery.flexselect.js +28 -11
- metadata +12 -12
@@ -12,7 +12,7 @@ function connectButtonTimerFunction(){
|
|
12
12
|
connectButtonTimerCounter++;
|
13
13
|
if (connectButtonTimerCounter > (periodBetweenAttempts-1)) {
|
14
14
|
clearTimeout(connectButtonTimer);
|
15
|
-
|
15
|
+
changeChatHeaderTitle(I18n.t('chat.disconnected'))
|
16
16
|
}
|
17
17
|
}
|
18
18
|
|
@@ -20,7 +20,7 @@ function requestConnectToChat(){
|
|
20
20
|
if (connectButtonTimerCounter > (periodBetweenAttempts-1)) {
|
21
21
|
connectButtonTimerCounter=0;
|
22
22
|
connectButtonTimer = setInterval("connectButtonTimerFunction()", 1000)
|
23
|
-
|
23
|
+
changeChatHeaderTitle(I18n.t('chat.connecting'))
|
24
24
|
return true
|
25
25
|
} else {
|
26
26
|
return false
|
@@ -110,8 +110,11 @@ function setUserFunctions(){
|
|
110
110
|
//Search contacts enabling
|
111
111
|
///////////////
|
112
112
|
$("select.flexselect").flexselect({
|
113
|
-
allowMismatch: true
|
113
|
+
allowMismatch: true,
|
114
|
+
defaultmessage: I18n.t('chat.zerocontacts')
|
114
115
|
});
|
116
|
+
|
117
|
+
$("#search_chat_contact_flexselect").Watermark(I18n.t('chat.search'),"#666");
|
115
118
|
|
116
119
|
//Select contact function
|
117
120
|
//callback in changeSelectContactValue()
|
@@ -129,8 +132,9 @@ function setUserFunctions(){
|
|
129
132
|
|
130
133
|
|
131
134
|
function changeSelectContactValue(name,value){
|
132
|
-
|
133
|
-
|
135
|
+
|
136
|
+
$("#search_chat_contact_flexselect").blur();
|
137
|
+
|
134
138
|
if(value == "ZERO_CONTACTS"){
|
135
139
|
return;
|
136
140
|
}
|
@@ -209,7 +213,7 @@ function setStatusWidgetTitle(status){
|
|
209
213
|
}
|
210
214
|
|
211
215
|
if(status=="default"){
|
212
|
-
var defaultTitle =
|
216
|
+
var defaultTitle = I18n.t('chat.status.choose')
|
213
217
|
$(".dropdown dt a span").html(defaultTitle);
|
214
218
|
return;
|
215
219
|
}
|
@@ -329,7 +333,7 @@ function hideConnectionBoxFromSlug(slug){
|
|
329
333
|
if($(".users_connected p.zero_users_connected").length > 0){
|
330
334
|
$(".users_connected p.zero_users_connected").show();
|
331
335
|
} else {
|
332
|
-
var msg =
|
336
|
+
var msg = I18n.t('chat.zerousers');
|
333
337
|
$(".users_connected").append('<p class="zero_users_connected">' + msg + '</p>')
|
334
338
|
}
|
335
339
|
}
|
@@ -447,7 +451,7 @@ function showOfflineChatNotificationForSlug(slug){
|
|
447
451
|
var slug_chat_box = getChatBoxForSlug(slug);
|
448
452
|
if(slug_chat_box!=null){
|
449
453
|
var name = slug_chat_box.attr("name")
|
450
|
-
var msg = name + ' ' +
|
454
|
+
var msg = name + ' ' + I18n.t('chat.notify.guestOffline');
|
451
455
|
showChatNotificationForSlug(slug,msg);
|
452
456
|
}
|
453
457
|
}
|
@@ -464,7 +468,7 @@ function hideChatNotificationForSlug(slug){
|
|
464
468
|
|
465
469
|
function notifyWhenUsersDisconnect(){
|
466
470
|
var notification = $("div.ui-chatbox-notify");
|
467
|
-
var msg =
|
471
|
+
var msg = I18n.t('chat.notify.offline');
|
468
472
|
showChatNotification(notification,msg);
|
469
473
|
}
|
470
474
|
|
@@ -492,9 +496,17 @@ function updateAllNotifications(){
|
|
492
496
|
|
493
497
|
function updateConnectedUsersOfMainChatBox(){
|
494
498
|
if(mainChatBox!=null){
|
495
|
-
|
496
|
-
|
497
|
-
|
499
|
+
if(isStropheConnected()){
|
500
|
+
var connectedUsers = getAllConnectedSlugs().length;
|
501
|
+
changeMainChatBoxHeaderTitle( I18n.t('chat.title') + " (" + connectedUsers + ")");
|
502
|
+
changeMainChatBoxHeight(getChatBoxHeightRequiredForConnectionBoxes());
|
503
|
+
} else {
|
504
|
+
if(afterFirstConnectionFlag){
|
505
|
+
changeChatHeaderTitle(I18n.t('chat.connecting'))
|
506
|
+
} else {
|
507
|
+
changeChatHeaderTitle(I18n.t('chat.disconnected'))
|
508
|
+
}
|
509
|
+
}
|
498
510
|
}
|
499
511
|
}
|
500
512
|
|
@@ -266,12 +266,16 @@ function createMainChatBox(){
|
|
266
266
|
//Delete closeTick and video Tick
|
267
267
|
$(mainChatBox.parent().parent()).find(".ui-chatbox-titlebar").find(".ui-icon-closethick").remove();
|
268
268
|
$(mainChatBox.parent().parent()).find(".ui-videobox-icon").remove();
|
269
|
+
//Margin for minusthick
|
270
|
+
(mainChatBox.parent().parent()).find(".ui-chatbox-titlebar").find(".chat-minusthick").parent().css("margin-right","5px")
|
269
271
|
//Delete nofitications div
|
270
272
|
$(mainChatBox.parent()).find(".ui-chatbox-notify").remove();
|
271
273
|
//Delete video div
|
272
274
|
$(mainChatBox.parent()).find(".ui-videobox").remove();
|
273
275
|
//Delete input
|
274
276
|
$(mainChatBox.parent()).find(".ui-chatbox-input").remove();
|
277
|
+
//Background
|
278
|
+
$(mainChatBox).css("background-color",$(mainChatBox.parent().parent()).find(".ui-chatbox-titlebar").css("background-color"));
|
275
279
|
|
276
280
|
//Set height
|
277
281
|
changeMainChatBoxHeight(getChatBoxHeightRequiredForConnectionBoxes());
|
@@ -207,6 +207,8 @@ function onConnect(status) {
|
|
207
207
|
//addHandler:(callback, namespace to match, stanza name, stanza type, stanza id , stanza from, options)
|
208
208
|
connection.addHandler(onMessage, null, 'message', null, null, null);
|
209
209
|
connection.addHandler(onPresence, null, 'presence', null, null, null);
|
210
|
+
connection.addHandler(onIQStanza,null, "iq", null, null);
|
211
|
+
|
210
212
|
|
211
213
|
disconnectionFlag = false;
|
212
214
|
afterNewConnectionFlag = true;
|
@@ -232,20 +234,30 @@ function onReconnect(){
|
|
232
234
|
if (reconnectAttempts>0) {
|
233
235
|
reconnectAttempts--;
|
234
236
|
|
235
|
-
|
237
|
+
changeChatHeaderTitle(I18n.t('chat.reconnecting'))
|
236
238
|
|
237
239
|
connectToChat(user_jid,cookie,null);
|
238
240
|
|
239
241
|
reconnectTimer = setTimeout ("onReconnect()", 9000);
|
240
242
|
|
241
243
|
} else {
|
242
|
-
|
244
|
+
changeChatHeaderTitle(I18n.t('chat.unableconnect'))
|
243
245
|
//Notify issue to Rails App Server?
|
244
246
|
}
|
245
247
|
|
246
248
|
}
|
247
249
|
}
|
248
250
|
|
251
|
+
|
252
|
+
function changeChatHeaderTitle(msg){
|
253
|
+
if(mainChatBox==null){
|
254
|
+
$("#chat_header_title").html(msg)
|
255
|
+
} else {
|
256
|
+
changeMainChatBoxHeaderTitle(msg);
|
257
|
+
}
|
258
|
+
}
|
259
|
+
|
260
|
+
|
249
261
|
function disconnectStrophe(){
|
250
262
|
userStatus = "offline";
|
251
263
|
setStatusWidgetTitle("offline");
|
@@ -256,6 +268,7 @@ function disconnectStrophe(){
|
|
256
268
|
}
|
257
269
|
}
|
258
270
|
|
271
|
+
|
259
272
|
////////
|
260
273
|
//Manage Message stanzas
|
261
274
|
///////
|
@@ -287,7 +300,7 @@ function onPresence(presence) {
|
|
287
300
|
log(presence)
|
288
301
|
|
289
302
|
//Check presence stanza type
|
290
|
-
ptype = $(presence).attr('type');
|
303
|
+
var ptype = $(presence).attr('type');
|
291
304
|
|
292
305
|
switch (ptype){
|
293
306
|
case undefined:
|
@@ -309,12 +322,12 @@ function onPresence(presence) {
|
|
309
322
|
|
310
323
|
|
311
324
|
function processAvailablePresenceStanza(presence){
|
312
|
-
from = $(presence).attr('from');
|
313
|
-
slug = from.split("@")[0];
|
325
|
+
var from = $(presence).attr('from');
|
326
|
+
var slug = from.split("@")[0];
|
314
327
|
|
315
328
|
if (slug != user_slug) {
|
316
329
|
if (getConnectionBoxFromSlug(slug)!=null){
|
317
|
-
status = $(presence).find('show').text();
|
330
|
+
var status = $(presence).find('show').text();
|
318
331
|
setUserIconStatus(slug, status);
|
319
332
|
if (cacheConnectedUsers.indexOf(slug) != -1) {
|
320
333
|
showConnectionBoxFromSlug(slug);
|
@@ -328,8 +341,8 @@ function processAvailablePresenceStanza(presence){
|
|
328
341
|
}
|
329
342
|
|
330
343
|
function processUnavailablePresenceStanza(presence){
|
331
|
-
from = $(presence).attr('from');
|
332
|
-
slug = from.split("@")[0];
|
344
|
+
var from = $(presence).attr('from');
|
345
|
+
var slug = from.split("@")[0];
|
333
346
|
|
334
347
|
if (slug != user_slug) {
|
335
348
|
if (getConnectionBoxFromSlug(slug)!=null){
|
@@ -340,6 +353,65 @@ function processUnavailablePresenceStanza(presence){
|
|
340
353
|
}
|
341
354
|
}
|
342
355
|
|
356
|
+
|
357
|
+
////////
|
358
|
+
//Manage IQ stanzas
|
359
|
+
///////
|
360
|
+
function onIQStanza(iq){
|
361
|
+
|
362
|
+
var from = iq.getAttribute("from");
|
363
|
+
var slug = from.split("@")[0];
|
364
|
+
|
365
|
+
if (slug == user_slug) {
|
366
|
+
return;
|
367
|
+
}
|
368
|
+
|
369
|
+
var queryElements = iq.getElementsByTagName('query');
|
370
|
+
|
371
|
+
if (queryElements.length > 0) {
|
372
|
+
var query = queryElements[0];
|
373
|
+
var type = query.getAttribute("xmlns");
|
374
|
+
|
375
|
+
if( type == "jabber:iq:version"){
|
376
|
+
var iqID = iq.getAttribute("id");
|
377
|
+
|
378
|
+
//Response to client info request.
|
379
|
+
sendIQStanzaWithClientInfo(from,iqID);
|
380
|
+
}
|
381
|
+
}
|
382
|
+
|
383
|
+
return true;
|
384
|
+
}
|
385
|
+
|
386
|
+
|
387
|
+
function sendIQStanzaWithClientInfo(jid,iqID){
|
388
|
+
var client = "Social Stream XMPP Client"
|
389
|
+
var version = '<%=Socialstream::Presence::VERSION%>';
|
390
|
+
var iq = $iq({to: jid, type: "result", id: iqID})
|
391
|
+
.c("query", {xmlns: "jabber:iq:version"}).c("name").t(client).up().c("version").t(version);
|
392
|
+
connection.sendIQ(iq);
|
393
|
+
}
|
394
|
+
|
395
|
+
|
396
|
+
var iqIDNumber = 1000;
|
397
|
+
function sendIQStanzaForRequestClientInfo(jid){
|
398
|
+
//var client = "Social Stream XMPP Client"
|
399
|
+
//var version = '<%=Socialstream::Presence::VERSION%>';
|
400
|
+
//var iq = $iq({to: jid, type: "result", id: iqID})
|
401
|
+
//.c("query", {xmlns: "jabber:iq:version"}).c("name").t(client).up().c("version").t(version);
|
402
|
+
//connection.sendIQ(iq);
|
403
|
+
}
|
404
|
+
|
405
|
+
|
406
|
+
function iqSuccess(){
|
407
|
+
log("iq sucess")
|
408
|
+
}
|
409
|
+
|
410
|
+
function iqFail(){
|
411
|
+
log("iq fail")
|
412
|
+
}
|
413
|
+
|
414
|
+
|
343
415
|
////////
|
344
416
|
//Send Message stanzas
|
345
417
|
///////
|
@@ -357,7 +357,7 @@ a.chatImageLink:link, a.chatImageLink:visited {
|
|
357
357
|
|
358
358
|
|
359
359
|
|
360
|
-
/*
|
360
|
+
/* Search contacts stylesheet */
|
361
361
|
|
362
362
|
div.allContacts {
|
363
363
|
width: 100px;
|
@@ -388,5 +388,4 @@ div.allContacts {
|
|
388
388
|
|
389
389
|
#search_chat_contact_flexselect_dropdown li:hover {
|
390
390
|
background: $separation-color;
|
391
|
-
}
|
392
|
-
|
391
|
+
}
|
@@ -30,7 +30,15 @@
|
|
30
30
|
<option value=""></option>
|
31
31
|
<% unless @all_contacts.empty? %>
|
32
32
|
<%@all_contacts.each do |contact| %>
|
33
|
-
<option value="<%=contact.slug%>"
|
33
|
+
<option value="<%=contact.slug%>">
|
34
|
+
<%=contact.name%>
|
35
|
+
<a title='<%=contact.name%>' class="presence_user_link" width="28">
|
36
|
+
<%=image_tag(contact.logo.url, :alt => contact.name , :size => "28x28")%>
|
37
|
+
<% if contact.user.status %>
|
38
|
+
<%=image_tag("status/" + contact.user.status + ".png", :class => "presence_status") %></a>
|
39
|
+
<% end %>
|
40
|
+
</a>
|
41
|
+
</option>
|
34
42
|
<% end %>
|
35
43
|
<% else %>
|
36
44
|
<option value="ZERO_CONTACTS"> <%=t('chat.zerocontacts')%></option>
|
data/config/locales/en.yml
CHANGED
data/config/locales/es.yml
CHANGED
@@ -21,6 +21,7 @@
|
|
21
21
|
allowMismatch: false,
|
22
22
|
selectedClass: "flexselect_selected",
|
23
23
|
dropdownClass: "flexselect_dropdown",
|
24
|
+
defaultmessage: "No results",
|
24
25
|
inputIdTransform: function(id) { return id + "_flexselect"; },
|
25
26
|
inputNameTransform: function(name) { return; },
|
26
27
|
dropdownIdTransform: function(id) { return id + "_flexselect_dropdown"; }
|
@@ -46,9 +47,15 @@
|
|
46
47
|
this.wire();
|
47
48
|
},
|
48
49
|
|
49
|
-
preloadCache: function() {
|
50
|
+
//preloadCache: function() {
|
51
|
+
// this.cache = this.select.children("option").map(function() {
|
52
|
+
// return { name: $.trim($(this).text()), value: $(this).val(), score: 0.0 };
|
53
|
+
// });
|
54
|
+
//},
|
55
|
+
|
56
|
+
preloadCache: function() {
|
50
57
|
this.cache = this.select.children("option").map(function() {
|
51
|
-
return { name:
|
58
|
+
return { name: ($(this).html()), value: $(this).val(), score: 0.0 };
|
52
59
|
});
|
53
60
|
},
|
54
61
|
|
@@ -65,6 +72,7 @@
|
|
65
72
|
name: this.settings.inputNameTransform(this.select.attr("name")),
|
66
73
|
accesskey: this.select.attr("accesskey"),
|
67
74
|
tabindex: this.select.attr("tabindex"),
|
75
|
+
placeholder: this.select.attr("placeholder"),
|
68
76
|
style: this.select.attr("style")
|
69
77
|
}).addClass(this.select.attr("class")).val($.trim(selected.text()));
|
70
78
|
|
@@ -84,6 +92,7 @@
|
|
84
92
|
this.input.click(function() {
|
85
93
|
self.lastAbbreviation = null;
|
86
94
|
self.focus();
|
95
|
+
if (!self.picked) self.filterResults();
|
87
96
|
});
|
88
97
|
|
89
98
|
this.input.mouseup(function(event) {
|
@@ -94,7 +103,7 @@
|
|
94
103
|
this.input.focus(function() {
|
95
104
|
self.abbreviationBeforeFocus = self.input.val();
|
96
105
|
self.input.select();
|
97
|
-
if (!self.picked) self.filterResults();
|
106
|
+
//if (!self.picked) self.filterResults();
|
98
107
|
});
|
99
108
|
|
100
109
|
this.input.blur(function() {
|
@@ -185,8 +194,13 @@
|
|
185
194
|
this.score = LiquidMetal.score(this.name, abbreviation);
|
186
195
|
if (this.score > 0.0) results.push(this);
|
187
196
|
});
|
197
|
+
|
198
|
+
if (results.length==0){
|
199
|
+
var defaultOption = { name: this.settings.defaultmessage, value: "ZERO_CONTACTS", score: 9.9 };
|
200
|
+
results.push(defaultOption);
|
201
|
+
}
|
202
|
+
|
188
203
|
this.results = results;
|
189
|
-
|
190
204
|
this.sortResults();
|
191
205
|
this.renderDropdown();
|
192
206
|
this.markFirst();
|
@@ -208,10 +222,13 @@
|
|
208
222
|
});
|
209
223
|
|
210
224
|
var list = this.dropdownList.html("");
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
225
|
+
|
226
|
+
if (this.results.length > 0) {
|
227
|
+
$.each(this.results, function() {
|
228
|
+
list.append($("<li/>").html(this.name));
|
229
|
+
});
|
230
|
+
}
|
231
|
+
|
215
232
|
this.dropdown.show();
|
216
233
|
},
|
217
234
|
|
@@ -230,16 +247,16 @@
|
|
230
247
|
if (selected) {
|
231
248
|
//this.input.val(selected.name);
|
232
249
|
//this.picked = true;
|
250
|
+
this.hidden.val(selected.value);
|
251
|
+
this.input.val("");
|
233
252
|
if(typeof changeSelectContactValue == "function"){
|
234
|
-
changeSelectContactValue(selected.name,selected.value);
|
253
|
+
return changeSelectContactValue(selected.name,selected.value);
|
235
254
|
}
|
236
|
-
this.hidden.val(selected.value);
|
237
255
|
} else if (this.settings.allowMismatch) {
|
238
256
|
this.hidden.val("");
|
239
257
|
} else {
|
240
258
|
this.reset();
|
241
259
|
}
|
242
|
-
this.input.val("");
|
243
260
|
},
|
244
261
|
|
245
262
|
hide: function() {
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: social_stream-presence
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,18 +13,18 @@ date: 2012-02-16 00:00:00.000000000Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: social_stream-base
|
16
|
-
requirement: &
|
16
|
+
requirement: &85013850 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: 0.16.
|
21
|
+
version: 0.16.1
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *85013850
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: xmpp4r
|
27
|
-
requirement: &
|
27
|
+
requirement: &85013460 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *85013460
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: net-ssh
|
38
|
-
requirement: &
|
38
|
+
requirement: &85013170 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *85013170
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: net-sftp
|
49
|
-
requirement: &
|
49
|
+
requirement: &85012890 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: '0'
|
55
55
|
type: :runtime
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *85012890
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: ruby-debug19
|
60
|
-
requirement: &
|
60
|
+
requirement: &85012460 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ! '>='
|
@@ -65,7 +65,7 @@ dependencies:
|
|
65
65
|
version: '0'
|
66
66
|
type: :development
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *85012460
|
69
69
|
description: Social Stream is a Ruby on Rails engine providing your application with
|
70
70
|
social networking features and activity streams.
|
71
71
|
email:
|