social_stream-presence 0.13.1 → 0.13.2
Sign up to get free protection for your applications and to get access to all the features.
- data/app/assets/javascripts/jquery.flexselect.sstreampresence.js +2 -2
- data/app/assets/javascripts/jquery.ui.chatbox.sstreampresence.js +5 -5
- data/app/assets/javascripts/presence.js.erb +6 -4
- data/app/assets/javascripts/presence_XmppClient.js.erb +1136 -996
- data/app/assets/javascripts/presence_audio.js.erb +74 -60
- data/app/assets/javascripts/presence_game.js.erb +35 -22
- data/app/assets/javascripts/presence_game_comunication.js.erb +22 -5
- data/app/assets/javascripts/presence_game_factory.js.erb +1 -1
- data/app/assets/javascripts/presence_game_interface.js.erb +33 -13
- data/app/assets/javascripts/presence_notifications.js +206 -183
- data/app/assets/javascripts/presence_parser.js +265 -247
- data/app/assets/javascripts/presence_persistence.js +199 -188
- data/app/assets/javascripts/presence_store.js +22 -11
- data/app/assets/javascripts/presence_uiManager.js.erb +553 -530
- data/app/assets/javascripts/presence_utilities.js +244 -219
- data/app/assets/javascripts/presence_videochat.js.erb +436 -409
- data/app/assets/javascripts/presence_windowManager.js +586 -532
- data/app/views/chat/_index.html.erb +7 -13
- data/config/locales/en.yml +2 -1
- data/config/locales/es.yml +2 -1
- data/ejabberd/ejabberd_files.zip +0 -0
- data/ejabberd/ejabberd_scripts/authentication_script +9 -2
- data/ejabberd/mod_sspresence/mod_sspresence.beam +0 -0
- data/lib/generators/social_stream/presence/templates/initializer.rb +4 -0
- data/lib/social_stream/presence/version.rb +1 -1
- data/lib/social_stream/presence/xmpp_server_order.rb +1 -0
- data/lib/social_stream-presence.rb +3 -0
- metadata +68 -63
@@ -1,545 +1,568 @@
|
|
1
1
|
////////////////////
|
2
|
-
//
|
2
|
+
//UI MANAGER
|
3
3
|
////////////////////
|
4
|
-
var connectButtonTimer;
|
5
|
-
var periodBetweenAttempts=15; //(seg)
|
6
|
-
var connectButtonTimerCounter=periodBetweenAttempts+1;
|
7
4
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
}
|
26
|
-
|
27
|
-
function changeChatHeaderTitle(msg){
|
28
|
-
if(mainChatBox==null){
|
29
|
-
$("#chat_header_title").html(msg)
|
30
|
-
} else {
|
31
|
-
changeMainChatBoxHeaderTitle(msg);
|
32
|
-
}
|
33
|
-
}
|
34
|
-
|
35
|
-
|
36
|
-
////////////////////
|
37
|
-
//Chat interface: Setting Functions
|
38
|
-
////////////////////
|
39
|
-
var focusSearchContactsFlag=false;
|
40
|
-
var changeSelectContactValueFlag = false;
|
41
|
-
|
42
|
-
function settingStatusSelector(){
|
43
|
-
//JQuery DropdwanStatus
|
44
|
-
$(".dropdown dt a").click(function(event) {
|
45
|
-
event.preventDefault();
|
46
|
-
$(".dropdown dd ul").toggle();
|
47
|
-
|
48
|
-
if($(".dropdown dd ul").is(":visible")){
|
49
|
-
setStatusWidgetTitle("default");
|
50
|
-
} else {
|
51
|
-
setStatusWidgetTitle(userStatus);
|
52
|
-
}
|
53
|
-
|
54
|
-
restartAwayTimer();
|
55
|
-
});
|
56
|
-
|
57
|
-
$(".dropdown dd ul li a.option").click(function(event) {
|
58
|
-
event.preventDefault();
|
59
|
-
userStatus = $(this).find("span.value").html();
|
60
|
-
if(userStatus == "offline"){
|
61
|
-
disconnectStrophe();
|
62
|
-
} else {
|
63
|
-
sendStatus(userStatus);
|
64
|
-
}
|
65
|
-
$(".dropdown dd ul").hide();
|
66
|
-
});
|
67
|
-
|
68
|
-
|
69
|
-
$(document).bind('click', function(e) {
|
70
|
-
var $clicked = $(e.target);
|
71
|
-
|
72
|
-
if (! $clicked.parents().hasClass("dropdown")){
|
73
|
-
//Click outside the select...
|
74
|
-
$(".dropdown dd ul").hide();
|
75
|
-
setStatusWidgetTitle(userStatus);
|
76
|
-
}
|
77
|
-
});
|
78
|
-
}
|
79
|
-
|
80
|
-
function settingChatBoxFunctions(){
|
81
|
-
|
82
|
-
$("div.user_presence").click(function(event, ui){
|
83
|
-
var guest_slug = $(this).attr("slug");
|
84
|
-
createBuddyChatBox(guest_slug)
|
85
|
-
});
|
86
|
-
|
87
|
-
//Hide tooltips on mouseleave
|
88
|
-
$("div.user_presence").mouseleave(function(e){
|
89
|
-
var div = $(this);
|
90
|
-
$.each($(".tooltip:visible"), function(index, value) {
|
91
|
-
if ( $($(".tooltip:visible")[0]).html() == $(div).attr("name") ){
|
92
|
-
$($(".tooltip:visible")[index]).hide();
|
93
|
-
}
|
94
|
-
});
|
95
|
-
});
|
96
|
-
|
97
|
-
}
|
98
|
-
|
99
|
-
function settingTooltips(){
|
100
|
-
if (mainChatBox == null) {
|
101
|
-
//Enabling default tooltips
|
102
|
-
$(".user_presence a[title]").tooltip();
|
103
|
-
} else {
|
104
|
-
//Enabling tooltips with center left position
|
105
|
-
|
106
|
-
//Changing Tooltip CSS class by JQuery
|
107
|
-
var ss = document.styleSheets;
|
108
|
-
for (var i=0; i<ss.length; i++) {
|
109
|
-
var rules = ss[i].cssRules || ss[i].rules;
|
110
|
-
for (var j=0; j<rules.length; j++) {
|
111
|
-
if (rules[j].selectorText === ".tooltip") {
|
112
|
-
rules[j].style.background = 'url("black_arrow9.png") repeat scroll 0% 0% transparent'
|
113
|
-
}
|
114
|
-
}
|
115
|
-
}
|
116
|
-
$(".user_presence a[title]").tooltip({
|
117
|
-
opacity: 0.95,
|
118
|
-
relative: false,
|
119
|
-
position: 'top left',
|
120
|
-
offset: [0,31]
|
121
|
-
});
|
122
|
-
}
|
123
|
-
}
|
124
|
-
|
125
|
-
function settingSearchContactFunctions(){
|
126
|
-
|
127
|
-
$("#chat_partial select.flexselect").flexselect({
|
128
|
-
allowMismatch: true,
|
129
|
-
defaultmessage: I18n.t('chat.zerocontacts')
|
130
|
-
});
|
131
|
-
|
132
|
-
$("#chat_partial #search_chat_contact_flexselect").watermark(I18n.t('chat.search'),"#666");
|
133
|
-
|
134
|
-
//Select contact function
|
135
|
-
//callback in changeSelectContactValue()
|
136
|
-
|
137
|
-
|
138
|
-
$("#chat_partial #search_chat_contact_flexselect").focus(function(e) {
|
139
|
-
changeContactListVisibility(true);
|
140
|
-
});
|
141
|
-
|
142
|
-
$("#chat_partial #search_chat_contact_flexselect").blur(function(e) {
|
143
|
-
changeContactListVisibility(false);
|
144
|
-
});
|
145
|
-
}
|
146
|
-
|
147
|
-
function setAllUserFunctions(){
|
148
|
-
settingStatusSelector();
|
149
|
-
settingChatBoxFunctions();
|
150
|
-
settingTooltips();
|
151
|
-
}
|
152
|
-
|
153
|
-
function changeSelectContactValue(name,valueSelectedInSearchContacts){
|
5
|
+
PRESENCE.UIMANAGER = (function(P,$,undefined){
|
6
|
+
|
7
|
+
//Keys: Xmpp status
|
8
|
+
//Value: Icon name (Same as Social Stream Status)
|
9
|
+
var statusIcons = new Array();
|
10
|
+
statusIcons[''] = "available";
|
11
|
+
statusIcons['chat'] = "available";
|
12
|
+
statusIcons['away'] = "away";
|
13
|
+
statusIcons['xa'] = "away";
|
14
|
+
statusIcons['dnd'] = "dnd";
|
15
|
+
|
16
|
+
|
17
|
+
var init = function(){
|
18
|
+
// Events
|
19
|
+
$(window).unload(function() {
|
20
|
+
PRESENCE.PERSISTENCE.storeChatData();
|
21
|
+
PRESENCE.XMPPClient.disconnect();
|
22
|
+
});
|
23
|
+
}
|
154
24
|
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
25
|
+
////////////////////
|
26
|
+
//Reconnect button interface functions
|
27
|
+
////////////////////
|
28
|
+
var connectButtonTimer;
|
29
|
+
var periodBetweenAttempts=15; //(seg)
|
30
|
+
var connectButtonTimerCounter=periodBetweenAttempts+1;
|
31
|
+
|
32
|
+
var connectButtonTimerFunction = function(){
|
33
|
+
connectButtonTimerCounter++;
|
34
|
+
if (connectButtonTimerCounter > (periodBetweenAttempts-1)) {
|
35
|
+
clearTimeout(connectButtonTimer);
|
36
|
+
if (! PRESENCE.XMPPClient.isUserConnected()) {
|
37
|
+
changeChatHeaderTitle(I18n.t('chat.disconnected'))
|
38
|
+
}
|
39
|
+
}
|
40
|
+
}
|
41
|
+
|
42
|
+
var requestConnectToChat = function(){
|
43
|
+
if (connectButtonTimerCounter > (periodBetweenAttempts-1)) {
|
44
|
+
connectButtonTimerCounter=0;
|
45
|
+
connectButtonTimer = setInterval("PRESENCE.UIMANAGER.connectButtonTimerFunction()", 1000)
|
46
|
+
changeChatHeaderTitle(I18n.t('chat.connecting'))
|
47
|
+
return true
|
48
|
+
} else {
|
49
|
+
return false
|
50
|
+
}
|
51
|
+
}
|
52
|
+
|
53
|
+
var changeChatHeaderTitle = function(msg){
|
54
|
+
if(PRESENCE.WINDOW.getMainChatBox()==null){
|
55
|
+
$("#chat_header_title").html(msg)
|
56
|
+
} else {
|
57
|
+
PRESENCE.WINDOW.changeMainChatBoxHeaderTitle(msg);
|
162
58
|
}
|
163
59
|
}
|
164
|
-
|
165
|
-
$("#chat_partial #search_chat_contact_flexselect").blur();
|
166
|
-
changeContactListVisibility(false);
|
167
|
-
}
|
168
|
-
|
169
|
-
function changeContactListVisibility(visible){
|
170
|
-
var nItems = getAllSlugsLength();
|
171
|
-
if (visible){
|
172
|
-
focusSearchContactsFlag=true;
|
173
|
-
if(nItems > 9){
|
174
|
-
changeMainChatBoxHeight(mainChatBoxHeightWhileSearchContacts);
|
175
|
-
} else {
|
176
|
-
var mainChatBoxMinRequiredHeight= mainChatBoxaddonsHeight + 20 + nItems * 19;
|
177
|
-
changeMainChatBoxHeight(mainChatBoxMinRequiredHeight);
|
178
|
-
}
|
179
|
-
$(".users_connected").hide();
|
180
|
-
} else {
|
181
|
-
changeMainChatBoxHeight(getChatBoxHeightRequiredForConnectionBoxes());
|
182
|
-
$(".users_connected").show();
|
183
|
-
}
|
184
|
-
}
|
185
|
-
|
186
|
-
function setStatusWidgetTitle(status){
|
187
|
-
|
188
|
-
if((status in sstreamChatStatus)){
|
189
|
-
status = sstreamChatStatus[status];
|
190
|
-
}
|
191
|
-
|
192
|
-
if ($(".dropdown dt a span").length == 0){
|
193
|
-
return;
|
194
|
-
}
|
195
|
-
|
196
|
-
if(status=="default"){
|
197
|
-
var defaultTitle = I18n.t('chat.status.choose')
|
198
|
-
$(".dropdown dt a span").html(defaultTitle);
|
199
|
-
return;
|
200
|
-
}
|
201
|
-
|
202
|
-
if(status=="offline"){
|
203
|
-
var text = $("#" + status).html();
|
204
|
-
$(".dropdown dt a span").html(text);
|
205
|
-
return;
|
206
|
-
}
|
207
|
-
|
208
|
-
if ((status in statusIcons)&&($("#" + statusIcons[status]).length > 0)) {
|
209
|
-
var text = $("#" + statusIcons[status]).html();
|
210
|
-
$(".dropdown dt a span").html(text);
|
211
|
-
}
|
212
|
-
|
213
|
-
}
|
214
|
-
|
215
|
-
|
216
|
-
////////////////////
|
217
|
-
//Away Timer Management
|
218
|
-
////////////////////
|
219
|
-
|
220
|
-
function awayTimerFunction(){
|
221
|
-
awayCounter++;
|
222
|
-
if (awayCounter > (awayTime/awayTimerPeriod)){
|
223
|
-
if ((userStatus != "dnd")&&(userStatus != "away")) {
|
224
|
-
userStatus = "autoaway";
|
225
|
-
sendStatus(userStatus);
|
226
|
-
}
|
227
|
-
clearTimeout(awayTimer);
|
228
|
-
}
|
229
|
-
}
|
230
|
-
|
231
|
-
function autochangeStatusIfAutoAway(){
|
232
|
-
if (userStatus == "autoaway"){
|
233
|
-
userStatus = "available";
|
234
|
-
sendStatus(userStatus);
|
235
|
-
}
|
236
|
-
}
|
237
|
-
|
238
|
-
function restartAwayTimer(){
|
239
|
-
if (awayCounter > (awayTime/awayTimerPeriod)){
|
240
|
-
awayTimer = setInterval("awayTimerFunction()", awayTimerPeriod);
|
241
|
-
autochangeStatusIfAutoAway();
|
242
|
-
}
|
243
|
-
awayCounter = 0;
|
244
|
-
}
|
245
|
-
|
246
|
-
|
247
|
-
////////////////////
|
248
|
-
//Update chatWindow Management
|
249
|
-
////////////////////
|
250
|
-
|
251
|
-
function updateChatWindow(){
|
252
|
-
timerCounter=0;
|
60
|
+
|
253
61
|
|
254
|
-
|
255
|
-
|
62
|
+
////////////////////
|
63
|
+
//Chat interface: Setting Functions
|
64
|
+
////////////////////
|
65
|
+
var focusSearchContactsFlag=false;
|
66
|
+
var changeSelectContactValueFlag = false;
|
256
67
|
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
68
|
+
var settingStatusSelector = function(){
|
69
|
+
//JQuery DropdwanStatus
|
70
|
+
$(".dropdown dt a").click(function(event) {
|
71
|
+
event.preventDefault();
|
72
|
+
$(".dropdown dd ul").toggle();
|
73
|
+
|
74
|
+
if($(".dropdown dd ul").is(":visible")){
|
75
|
+
setStatusWidgetTitle("default");
|
76
|
+
} else {
|
77
|
+
setStatusWidgetTitle(PRESENCE.XMPPClient.getUserStatus());
|
78
|
+
}
|
79
|
+
|
80
|
+
PRESENCE.XMPPClient.restartAwayTimer();
|
81
|
+
});
|
82
|
+
|
83
|
+
$(".dropdown dd ul li a.option").click(function(event) {
|
84
|
+
event.preventDefault();
|
85
|
+
PRESENCE.XMPPClient.setUserStatus($(this).find("span.value").html());
|
86
|
+
if(PRESENCE.XMPPClient.getUserStatus() == "offline"){
|
87
|
+
PRESENCE.XMPPClient.disconnect();
|
88
|
+
} else {
|
89
|
+
PRESENCE.XMPPClient.sendStatus();
|
90
|
+
}
|
91
|
+
$(".dropdown dd ul").hide();
|
92
|
+
});
|
93
|
+
|
94
|
+
|
95
|
+
$(document).bind('click', function(e) {
|
96
|
+
var $clicked = $(e.target);
|
97
|
+
|
98
|
+
if (! $clicked.parents().hasClass("dropdown")){
|
99
|
+
//Click outside the select...
|
100
|
+
$(".dropdown dd ul").hide();
|
101
|
+
setStatusWidgetTitle(PRESENCE.XMPPClient.getUserStatus());
|
102
|
+
}
|
103
|
+
});
|
261
104
|
}
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
105
|
+
|
106
|
+
var settingChatBoxFunctions = function(){
|
107
|
+
|
108
|
+
$("div.user_presence").click(function(event, ui){
|
109
|
+
var guest_slug = $(this).attr("slug");
|
110
|
+
PRESENCE.WINDOW.createBuddyChatBox(guest_slug)
|
111
|
+
});
|
112
|
+
|
113
|
+
//Hide tooltips on mouseleave
|
114
|
+
$("div.user_presence").mouseleave(function(e){
|
115
|
+
var div = $(this);
|
116
|
+
$.each($(".tooltip:visible"), function(index, value) {
|
117
|
+
if ( $($(".tooltip:visible")[0]).html() == $(div).attr("name") ){
|
118
|
+
$($(".tooltip:visible")[index]).hide();
|
119
|
+
}
|
120
|
+
});
|
121
|
+
});
|
122
|
+
|
123
|
+
}
|
124
|
+
|
125
|
+
var settingTooltips = function(){
|
126
|
+
if (PRESENCE.WINDOW.getMainChatBox() == null) {
|
127
|
+
//Enabling default tooltips
|
128
|
+
$(".user_presence a[title]").tooltip();
|
129
|
+
} else {
|
130
|
+
//Enabling tooltips with center left position
|
131
|
+
|
132
|
+
//Changing Tooltip CSS class by JQuery
|
133
|
+
var ss = document.styleSheets;
|
134
|
+
for (var i=0; i<ss.length; i++) {
|
135
|
+
var rules = ss[i].cssRules || ss[i].rules;
|
136
|
+
for (var j=0; j<rules.length; j++) {
|
137
|
+
if (rules[j].selectorText === ".tooltip") {
|
138
|
+
rules[j].style.background = 'url("black_arrow9.png") repeat scroll 0% 0% transparent'
|
139
|
+
}
|
140
|
+
}
|
141
|
+
}
|
142
|
+
$(".user_presence a[title]").tooltip({
|
143
|
+
opacity: 0.95,
|
144
|
+
relative: false,
|
145
|
+
position: 'top left',
|
146
|
+
offset: [0,31]
|
147
|
+
});
|
148
|
+
}
|
149
|
+
}
|
150
|
+
|
151
|
+
var settingSearchContactFunctions = function(){
|
152
|
+
|
153
|
+
$("#chat_partial select.flexselect").flexselect({
|
154
|
+
allowMismatch: true,
|
155
|
+
defaultmessage: I18n.t('chat.zerocontacts')
|
156
|
+
});
|
157
|
+
|
158
|
+
$("#chat_partial #search_chat_contact_flexselect").watermark(I18n.t('chat.search'),"#666");
|
159
|
+
|
160
|
+
//Select contact function
|
161
|
+
//callback in changeSelectContactValue()
|
162
|
+
|
163
|
+
|
164
|
+
$("#chat_partial #search_chat_contact_flexselect").focus(function(e) {
|
165
|
+
changeContactListVisibility(true);
|
166
|
+
});
|
167
|
+
|
168
|
+
$("#chat_partial #search_chat_contact_flexselect").blur(function(e) {
|
169
|
+
changeContactListVisibility(false);
|
170
|
+
});
|
171
|
+
}
|
172
|
+
|
173
|
+
var setAllUserFunctions = function(){
|
174
|
+
settingStatusSelector();
|
175
|
+
settingChatBoxFunctions();
|
176
|
+
settingTooltips();
|
177
|
+
}
|
178
|
+
|
179
|
+
|
180
|
+
var changeSelectContactValue = function (name,valueSelectedInSearchContacts){
|
181
|
+
|
182
|
+
if((valueSelectedInSearchContacts != "ZERO_CONTACTS")&&(valueSelectedInSearchContacts != "")){
|
183
|
+
var guest_slug = valueSelectedInSearchContacts;
|
184
|
+
PRESENCE.WINDOW.createBuddyChatBox(guest_slug)
|
185
|
+
|
186
|
+
//Check for online status and show notification
|
187
|
+
if (! isSlugChatConnected(guest_slug)) {
|
188
|
+
PRESENCE.NOTIFICATIONS.showOfflineChatNotificationForSlug(guest_slug);
|
189
|
+
}
|
190
|
+
}
|
191
|
+
|
192
|
+
$("#chat_partial #search_chat_contact_flexselect").blur();
|
193
|
+
changeContactListVisibility(false);
|
194
|
+
}
|
195
|
+
|
196
|
+
var changeContactListVisibility = function(visible){
|
197
|
+
var nItems = getAllSlugsLength();
|
198
|
+
if (visible){
|
199
|
+
focusSearchContactsFlag=true;
|
200
|
+
if(nItems > 9){
|
201
|
+
var mainChatBoxHeightWhileSearchContacts = PRESENCE.WINDOW.getMainchatBoxParams()[1];
|
202
|
+
PRESENCE.WINDOW.changeMainChatBoxHeight(mainChatBoxHeightWhileSearchContacts);
|
203
|
+
} else {
|
204
|
+
var mainChatBoxaddonsHeight = PRESENCE.WINDOW.getMainchatBoxParams()[0];
|
205
|
+
var mainChatBoxMinRequiredHeight= mainChatBoxaddonsHeight + 20 + nItems * 19;
|
206
|
+
PRESENCE.WINDOW.changeMainChatBoxHeight(mainChatBoxMinRequiredHeight);
|
207
|
+
}
|
208
|
+
$(".users_connected").hide();
|
209
|
+
} else {
|
210
|
+
PRESENCE.WINDOW.changeMainChatBoxHeight(PRESENCE.WINDOW.getChatBoxHeightRequiredForConnectionBoxes());
|
211
|
+
$(".users_connected").show();
|
212
|
+
}
|
213
|
+
}
|
214
|
+
|
215
|
+
var setStatusWidgetTitle = function (status){
|
216
|
+
|
217
|
+
if((status in PRESENCE.XMPPClient.getSStreamChatStatus())){
|
218
|
+
status = PRESENCE.XMPPClient.getSStreamChatStatus()[status];
|
219
|
+
}
|
220
|
+
|
221
|
+
if ($(".dropdown dt a span").length == 0){
|
222
|
+
return;
|
223
|
+
}
|
224
|
+
|
225
|
+
if(status=="default"){
|
226
|
+
var defaultTitle = I18n.t('chat.status.choose')
|
227
|
+
$(".dropdown dt a span").html(defaultTitle);
|
228
|
+
return;
|
229
|
+
}
|
230
|
+
|
231
|
+
if(status=="offline"){
|
232
|
+
var text = $("#" + status).html();
|
233
|
+
$(".dropdown dt a span").html(text);
|
234
|
+
return;
|
235
|
+
}
|
236
|
+
|
237
|
+
if ((status in statusIcons)&&($("#" + statusIcons[status]).length > 0)) {
|
238
|
+
var text = $("#" + statusIcons[status]).html();
|
239
|
+
$(".dropdown dt a span").html(text);
|
240
|
+
}
|
241
|
+
|
242
|
+
}
|
243
|
+
|
244
|
+
|
245
|
+
////////////////////
|
246
|
+
//Update chatWindow Management
|
247
|
+
////////////////////
|
248
|
+
|
249
|
+
var updateChatWindow = function(){
|
250
|
+
timerCounter=0;
|
251
|
+
|
252
|
+
PRESENCE.UTILITIES.log("updateChatWindow()");
|
253
|
+
PRESENCE.UTILITIES.log("Connected " + PRESENCE.XMPPClient.isUserConnected());
|
254
|
+
|
255
|
+
if(! PRESENCE.XMPPClient.isUserConnected()){
|
256
|
+
loadDisconnectionDiv();
|
257
|
+
updateConnectedUsersOfMainChatBox();
|
258
|
+
return;
|
259
|
+
}
|
260
|
+
|
261
|
+
$.post("/chatWindow", { }, function(data){
|
262
|
+
//Prevent tooltips
|
263
|
+
$(".tooltip").hide()
|
264
|
+
loadWidgetsDiv(data);
|
265
|
+
hideConnectionBoxesFromDisconnectedSlugs();
|
266
|
+
setAllUserFunctions();
|
267
|
+
updateConnectedUsersOfMainChatBox();
|
268
|
+
checkForZeroUsersConnected();
|
269
|
+
|
270
|
+
if (PRESENCE.XMPPClient.isStropheConnected()) {
|
271
|
+
if (PRESENCE.XMPPClient.isNewConnection()){
|
272
|
+
PRESENCE.XMPPClient.setNewConnection(false)
|
273
|
+
if(PRESENCE.XMPPClient.isFirstConnection()){
|
274
|
+
PRESENCE.PERSISTENCE.restoreChatData();
|
275
|
+
if(typeof current_group_slug != 'undefined') {
|
276
|
+
PRESENCE.XMPPClient.accessRoom(current_group_slug,false);
|
277
|
+
}
|
278
|
+
PRESENCE.XMPPClient.setFirstConnection(false);
|
279
|
+
} else {
|
280
|
+
PRESENCE.NOTIFICATIONS.updateAllNotifications();
|
281
|
+
//Rejoin rooms
|
282
|
+
$.each(PRESENCE.WINDOW.getAllSlugsWithVisibleGroupBoxes(), function(index, value) {
|
283
|
+
PRESENCE.XMPPClient.accessRoom(value,$(value).is(":visible"))
|
284
|
+
});
|
285
|
+
}
|
286
|
+
}
|
287
|
+
}
|
288
|
+
|
289
|
+
},'html');
|
290
|
+
|
291
|
+
}
|
292
|
+
|
293
|
+
|
294
|
+
//////////////
|
295
|
+
//Divs Load
|
296
|
+
//////////////
|
297
|
+
|
298
|
+
var loadConnectingDiv = function(){
|
299
|
+
$("#chat_partial").html($("#chat_connecting").html());
|
300
|
+
}
|
301
|
+
|
302
|
+
var loadDisconnectionDiv = function(){
|
303
|
+
$("#chat_partial").html(PRESENCE.WINDOW.modifyChatPartialIfMainBox($("#chat_connection_off").html()));
|
304
|
+
|
305
|
+
$('.connectChatButton').bind('click', function () {
|
306
|
+
if (requestConnectToChat()){
|
307
|
+
if (PRESENCE.XMPPClient.authByCookie()) {
|
308
|
+
PRESENCE.XMPPClient.connectToChat(user_jid,cookie);
|
309
|
+
} else {
|
310
|
+
PRESENCE.XMPPClient.connectToChat(user_jid,$('#user_password').val());
|
311
|
+
}
|
312
|
+
}
|
313
|
+
});
|
314
|
+
|
315
|
+
if (PRESENCE.XMPPClient.authByCookie()){
|
316
|
+
$("#chat_partial #passwordFormChat").hide();
|
317
|
+
} else {
|
318
|
+
//Authentication by password
|
319
|
+
|
320
|
+
$('.storePass').bind('click', function () {
|
321
|
+
PRESENCE.STORE.storePassword();
|
322
|
+
});
|
323
|
+
|
324
|
+
if ((window.sessionStorage) && (sessionStorage.getItem("ss_user_pass") != null)) {
|
325
|
+
$("#chat_partial #passwordFormChat").hide()
|
326
|
+
} else {
|
327
|
+
$("#chat_partial #passwordFormChat").show();
|
328
|
+
}
|
329
|
+
}
|
330
|
+
}
|
331
|
+
|
332
|
+
var loadWidgetsDiv = function(data){
|
333
|
+
$("#chat_partial").html(PRESENCE.WINDOW.modifyChatPartialIfMainBox($("#chat_widgets").html()));
|
334
|
+
$("#chat_partial").append(data);
|
335
|
+
fillSearchContactSelect();
|
336
|
+
settingSearchContactFunctions();
|
337
|
+
}
|
338
|
+
|
339
|
+
var fillSearchContactSelect = function(){
|
340
|
+
$("#chat_partial #search_chat_contact").children().remove()
|
341
|
+
$("#chat_partial #search_chat_contact").append('<option value=""></option>')
|
342
|
+
$.each(getAllSlugs(), function(index, value) {
|
343
|
+
$("#chat_partial #search_chat_contact").append('<option value=' + value + '>' + PRESENCE.XMPPClient.getNameFromSlug(value) + '</option>')
|
344
|
+
});
|
345
|
+
}
|
346
|
+
|
347
|
+
var updateInterfaceAfterUserDisconnect = function(){
|
348
|
+
PRESENCE.NOTIFICATIONS.updateNotificationsAfterUserDisconnect();
|
349
|
+
$.each(PRESENCE.WINDOW.getAllSlugsWithVisibleVideoBoxes(), function(index, value) {
|
350
|
+
PRESENCE.VIDEOCHAT.closeVideoSession(value);
|
351
|
+
});
|
352
|
+
}
|
353
|
+
|
354
|
+
/////////////////////
|
355
|
+
// Connection Box Management
|
356
|
+
/////////////////////
|
357
|
+
|
358
|
+
var hideConnectionBoxesFromDisconnectedSlugs = function(){
|
359
|
+
$('div.user_presence[slug][connected="false"]').hide();
|
360
|
+
}
|
361
|
+
|
362
|
+
var hideConnectionBoxFromSlug = function(slug){
|
363
|
+
$('div.user_presence[slug=' + slug + ']').attr("connected","false");
|
364
|
+
$('div.user_presence[slug=' + slug + ']').hide();
|
365
|
+
}
|
366
|
+
|
367
|
+
var showConnectionBoxFromSlug = function(slug){
|
368
|
+
$('div.user_presence[slug=' + slug + ']').attr("connected","true");
|
369
|
+
$('div.user_presence[slug=' + slug + ']').show();
|
370
|
+
}
|
371
|
+
|
372
|
+
var updateInterfaceAfterPresenceStanza = function(slug,available){
|
373
|
+
if(available){
|
374
|
+
showConnectionBoxFromSlug(slug);
|
375
|
+
PRESENCE.NOTIFICATIONS.hideChatNotificationForSlug(slug);
|
376
|
+
} else {
|
377
|
+
hideConnectionBoxFromSlug(slug);
|
378
|
+
PRESENCE.NOTIFICATIONS.showOfflineChatNotificationForSlug(slug);
|
379
|
+
PRESENCE.VIDEOCHAT.closeVideoSession(slug);
|
380
|
+
}
|
381
|
+
updateMainChatBoxAfterConnectionBoxChanges();
|
382
|
+
checkForZeroUsersConnected();
|
383
|
+
}
|
384
|
+
|
385
|
+
var checkForZeroUsersConnected = function(){
|
386
|
+
if (getConnectedSlugsLength() == 0){
|
387
|
+
if($(".users_connected p.zero_users_connected").length > 0){
|
388
|
+
$(".users_connected p.zero_users_connected").show();
|
389
|
+
} else {
|
390
|
+
var msg = I18n.t('chat.zerousers');
|
391
|
+
$(".users_connected").append('<p class="zero_users_connected">' + msg + '</p>')
|
392
|
+
}
|
393
|
+
} else {
|
394
|
+
$(".users_connected p.zero_users_connected").hide();
|
395
|
+
}
|
396
|
+
}
|
397
|
+
|
398
|
+
|
399
|
+
////////////////////
|
400
|
+
// Set Status Interface
|
401
|
+
////////////////////
|
402
|
+
|
403
|
+
var setUserIconStatus = function (slug, status){
|
404
|
+
if (status in statusIcons) {
|
405
|
+
var iconName = statusIcons[status];
|
406
|
+
var $img_status = $('img.presence_status');
|
407
|
+
var path = '<%=image_path("status")%>';
|
408
|
+
var connectionBox = getConnectionBoxFromSlug(slug);
|
409
|
+
$(connectionBox).find($img_status).attr("src", path + "/" + iconName + ".png")
|
410
|
+
}
|
411
|
+
}
|
412
|
+
|
413
|
+
|
414
|
+
//////////////////////
|
415
|
+
//Getters and Setters
|
416
|
+
//////////////////////
|
417
|
+
|
418
|
+
var getConnectionBoxFromSlug = function (slug){
|
419
|
+
if ($('div.user_presence[slug=' + slug + ']').length > 0){
|
420
|
+
return ($('div.user_presence[slug=' + slug + ']'))[0];
|
421
|
+
} else {
|
422
|
+
return null;
|
423
|
+
}
|
424
|
+
}
|
425
|
+
|
426
|
+
var isSlugChatConnected = function(slug){
|
427
|
+
return $('div.user_presence[slug=' + slug + ']').attr("connected")=="true";
|
428
|
+
}
|
429
|
+
|
430
|
+
var existsSlugChatBox = function(slug){
|
431
|
+
return PRESENCE.WINDOW.getChatBoxForSlug(slug)!=null;
|
432
|
+
}
|
433
|
+
|
434
|
+
var getConnectedSlugsLength = function(){
|
435
|
+
return $('div.user_presence[slug][connected="true"]').length;
|
436
|
+
}
|
437
|
+
|
438
|
+
var getAllSlugsLength = function(){
|
439
|
+
return $('div.user_presence[slug]').length;
|
440
|
+
}
|
441
|
+
|
442
|
+
var getDisconnectedSlugsLength = function(){
|
443
|
+
return $('div.user_presence[slug][connected="false"]').length;
|
444
|
+
}
|
445
|
+
|
446
|
+
var getAllSlugs = function(){
|
447
|
+
return getAllSlugsByChatConnectedState()[2];
|
448
|
+
}
|
449
|
+
|
450
|
+
var getAllConnectedSlugs = function(){
|
451
|
+
return getAllSlugsByChatConnectedState()[0];
|
452
|
+
}
|
453
|
+
|
454
|
+
var getAllDisconnectedSlugs = function(){
|
455
|
+
return getAllSlugsByChatConnectedState()[1];
|
456
|
+
}
|
457
|
+
|
458
|
+
var getAllSlugsByChatConnectedState = function(){
|
459
|
+
var onlineSlugs=[];
|
460
|
+
var offlineSlugs=[];
|
461
|
+
var allSlugs=[];
|
462
|
+
var connectionBoxes = $('div.user_presence[slug]');
|
463
|
+
$.each(connectionBoxes, function(index, value) {
|
464
|
+
if($(value).attr("connected")=="true"){
|
465
|
+
onlineSlugs.push($(value).attr("slug"))
|
466
|
+
} else {
|
467
|
+
offlineSlugs.push($(value).attr("slug"))
|
468
|
+
}
|
469
|
+
allSlugs.push($(value).attr("slug"))
|
470
|
+
});
|
471
|
+
return [onlineSlugs,offlineSlugs,allSlugs]
|
472
|
+
}
|
473
|
+
|
474
|
+
|
475
|
+
////////////////////
|
476
|
+
//Insert received message in chatbox
|
477
|
+
////////////////////
|
478
|
+
|
479
|
+
var afterReceivedChatMessage = function(from_slug,msg,msgID){
|
319
480
|
|
320
|
-
|
321
|
-
|
322
|
-
|
481
|
+
//Antiflood control
|
482
|
+
if (PRESENCE.UTILITIES.antifloodControl(from_slug,msg,msgID)){
|
483
|
+
return;
|
484
|
+
}
|
485
|
+
var from_name = PRESENCE.XMPPClient.getNameFromSlug(from_slug)
|
486
|
+
PRESENCE.WINDOW.createBuddyChatBox(from_slug)
|
487
|
+
writeReceivedMessageOnChatWindow(from_name,from_slug,msg)
|
488
|
+
}
|
489
|
+
|
490
|
+
var afterReceivedGroupChatMessage = function(room_nick_jid,msg){
|
491
|
+
var from_slug = PRESENCE.XMPPClient.getSlugFromJid(room_nick_jid)
|
492
|
+
var from_name = PRESENCE.XMPPClient.getNickFromChatRoomJid(room_nick_jid)
|
493
|
+
|
494
|
+
if(!(existsSlugChatBox(from_slug))){
|
495
|
+
PRESENCE.WINDOW.createGroupChatBox(from_slug,true)
|
496
|
+
}
|
497
|
+
writeReceivedMessageOnChatWindow(from_name,from_slug,msg)
|
498
|
+
}
|
499
|
+
|
500
|
+
var writeReceivedMessageOnChatWindow = function(from_name,from_slug,msg){
|
323
501
|
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
$.each(getAllSlugs(), function(index, value) {
|
343
|
-
$("#chat_partial #search_chat_contact").append('<option value=' + value + '>' + getNameFromSlug(value) + '</option>')
|
344
|
-
});
|
345
|
-
}
|
346
|
-
|
347
|
-
function updateInterfaceAfterUserDisconnect(){
|
348
|
-
updateNotificationsAfterUserDisconnect();
|
349
|
-
$.each(getAllSlugsWithVisibleVideoBoxes(), function(index, value) {
|
350
|
-
closeVideoSession(value);
|
351
|
-
});
|
502
|
+
//Parse content before show it.
|
503
|
+
var content = PRESENCE.PARSER.getParsedContent(msg, false)
|
504
|
+
var headerMessage = PRESENCE.PARSER.getParsedName(from_name,false);
|
505
|
+
|
506
|
+
//Write message in chatBox.
|
507
|
+
PRESENCE.WINDOW.getChatBoxForSlug(from_slug).chatbox("option", "boxManager").addMsg(headerMessage, content);
|
508
|
+
|
509
|
+
//Rotate chatBoxes priority.
|
510
|
+
PRESENCE.WINDOW.rotatePriority(from_slug);
|
511
|
+
|
512
|
+
//Check for start blinkTitle.
|
513
|
+
PRESENCE.UTILITIES.blinkTitleOnMessage(from_name);
|
514
|
+
|
515
|
+
//Check for play sound
|
516
|
+
if (PRESENCE.AUDIO.mustPlaySoundForChatWindow(PRESENCE.WINDOW.getChatBoxForSlug(from_slug))) {
|
517
|
+
PRESENCE.AUDIO.playSound("onMessageAudio");
|
518
|
+
}
|
519
|
+
}
|
352
520
|
|
353
|
-
}
|
354
|
-
|
355
|
-
/////////////////////
|
356
|
-
// Connection Box Management
|
357
|
-
/////////////////////
|
358
|
-
|
359
|
-
function hideConnectionBoxesFromDisconnectedSlugs(){
|
360
|
-
$('div.user_presence[slug][connected="false"]').hide();
|
361
|
-
}
|
362
|
-
|
363
|
-
function hideConnectionBoxFromSlug(slug){
|
364
|
-
$('div.user_presence[slug=' + slug + ']').attr("connected","false");
|
365
|
-
$('div.user_presence[slug=' + slug + ']').hide();
|
366
|
-
}
|
367
|
-
|
368
|
-
function showConnectionBoxFromSlug(slug){
|
369
|
-
$('div.user_presence[slug=' + slug + ']').attr("connected","true");
|
370
|
-
$('div.user_presence[slug=' + slug + ']').show();
|
371
|
-
}
|
372
|
-
|
373
|
-
function updateInterfaceAfterPresenceStanza(slug,available){
|
374
|
-
if(available){
|
375
|
-
showConnectionBoxFromSlug(slug);
|
376
|
-
hideChatNotificationForSlug(slug);
|
377
|
-
} else {
|
378
|
-
hideConnectionBoxFromSlug(slug);
|
379
|
-
showOfflineChatNotificationForSlug(slug);
|
380
|
-
closeVideoSession(slug);
|
381
|
-
}
|
382
|
-
updateMainChatBoxAfterConnectionBoxChanges();
|
383
|
-
checkForZeroUsersConnected();
|
384
|
-
}
|
385
|
-
|
386
|
-
function checkForZeroUsersConnected(){
|
387
|
-
if (getConnectedSlugsLength() == 0){
|
388
|
-
if($(".users_connected p.zero_users_connected").length > 0){
|
389
|
-
$(".users_connected p.zero_users_connected").show();
|
390
|
-
} else {
|
391
|
-
var msg = I18n.t('chat.zerousers');
|
392
|
-
$(".users_connected").append('<p class="zero_users_connected">' + msg + '</p>')
|
393
|
-
}
|
394
|
-
} else {
|
395
|
-
$(".users_connected p.zero_users_connected").hide();
|
396
|
-
}
|
397
|
-
}
|
398
|
-
|
399
|
-
|
400
|
-
////////////////////
|
401
|
-
// Set Status Interface
|
402
|
-
////////////////////
|
403
|
-
|
404
|
-
function setUserIconStatus(slug, status){
|
405
|
-
if (status in statusIcons) {
|
406
|
-
var iconName = statusIcons[status];
|
407
|
-
var $img_status = $('img.presence_status');
|
408
|
-
var path = '<%=image_path("status")%>';
|
409
|
-
var connectionBox = getConnectionBoxFromSlug(slug);
|
410
|
-
$(connectionBox).find($img_status).attr("src", path + "/" + iconName + ".png")
|
411
|
-
}
|
412
|
-
}
|
413
|
-
|
414
|
-
|
415
|
-
//////////////////////
|
416
|
-
//Getters and Setters
|
417
|
-
//////////////////////
|
418
|
-
|
419
|
-
function getConnectionBoxFromSlug(slug){
|
420
|
-
if ($('div.user_presence[slug=' + slug + ']').length > 0){
|
421
|
-
return ($('div.user_presence[slug=' + slug + ']'))[0];
|
422
|
-
} else {
|
423
|
-
return null;
|
424
|
-
}
|
425
|
-
}
|
426
|
-
|
427
|
-
function isSlugChatConnected(slug){
|
428
|
-
return $('div.user_presence[slug=' + slug + ']').attr("connected")=="true";
|
429
|
-
}
|
430
|
-
|
431
|
-
function existsSlugChatBox(slug){
|
432
|
-
return getChatBoxForSlug(slug)!=null;
|
433
|
-
}
|
434
|
-
|
435
|
-
function getConnectedSlugsLength(){
|
436
|
-
return $('div.user_presence[slug][connected="true"]').length;
|
437
|
-
}
|
438
|
-
|
439
|
-
function getAllSlugsLength(){
|
440
|
-
return $('div.user_presence[slug]').length;
|
441
|
-
}
|
442
|
-
|
443
|
-
function getDisconnectedSlugsLength(){
|
444
|
-
return $('div.user_presence[slug][connected="false"]').length;
|
445
|
-
}
|
446
|
-
|
447
|
-
function getAllSlugs(){
|
448
|
-
return getAllSlugsByChatConnectedState()[2];
|
449
|
-
}
|
450
|
-
|
451
|
-
function getAllConnectedSlugs(){
|
452
|
-
return getAllSlugsByChatConnectedState()[0];
|
453
|
-
}
|
454
|
-
|
455
|
-
function getAllDisconnectedSlugs(){
|
456
|
-
return getAllSlugsByChatConnectedState()[1];
|
457
|
-
}
|
458
|
-
|
459
|
-
function getAllSlugsByChatConnectedState(){
|
460
|
-
var onlineSlugs=[];
|
461
|
-
var offlineSlugs=[];
|
462
|
-
var allSlugs=[];
|
463
|
-
var connectionBoxes = $('div.user_presence[slug]');
|
464
|
-
$.each(connectionBoxes, function(index, value) {
|
465
|
-
if($(value).attr("connected")=="true"){
|
466
|
-
onlineSlugs.push($(value).attr("slug"))
|
467
|
-
} else {
|
468
|
-
offlineSlugs.push($(value).attr("slug"))
|
469
|
-
}
|
470
|
-
allSlugs.push($(value).attr("slug"))
|
471
|
-
});
|
472
|
-
return [onlineSlugs,offlineSlugs,allSlugs]
|
473
|
-
}
|
474
|
-
|
475
|
-
|
476
|
-
|
477
|
-
////////////////////
|
478
|
-
//Insert received message in chatbox
|
479
|
-
////////////////////
|
480
|
-
|
481
|
-
function afterReceivedChatMessage(from_slug,msg,msgID){
|
482
|
-
//Antiflood control
|
483
|
-
if (antifloodControl(from_slug,msg,msgID)){
|
484
|
-
return;
|
485
|
-
}
|
486
|
-
var from_name = getNameFromSlug(from_slug)
|
487
|
-
createBuddyChatBox(from_slug)
|
488
|
-
writeReceivedMessageOnChatWindow(from_name,from_slug,msg)
|
489
|
-
}
|
490
|
-
|
491
|
-
function afterReceivedGroupChatMessage(room_nick_jid,msg){
|
492
|
-
var from_slug = getSlugFromJid(room_nick_jid)
|
493
|
-
var from_name = getNickFromChatRoomJid(room_nick_jid)
|
494
521
|
|
495
|
-
|
496
|
-
|
522
|
+
////////////////////
|
523
|
+
//Update connected users of MainChatBox
|
524
|
+
////////////////////
|
525
|
+
|
526
|
+
var updateConnectedUsersOfMainChatBox = function(){
|
527
|
+
if(PRESENCE.WINDOW.getMainChatBox()!=null){
|
528
|
+
if(PRESENCE.XMPPClient.isUserConnected()){
|
529
|
+
var connectedUsers = getConnectedSlugsLength();
|
530
|
+
PRESENCE.WINDOW.changeMainChatBoxHeaderTitle( I18n.t('chat.title') + " (" + connectedUsers + ")");
|
531
|
+
PRESENCE.WINDOW.changeMainChatBoxHeight(PRESENCE.WINDOW.getChatBoxHeightRequiredForConnectionBoxes());
|
532
|
+
} else {
|
533
|
+
if(PRESENCE.XMPPClient.isFirstConnection()){
|
534
|
+
changeChatHeaderTitle(I18n.t('chat.connecting'))
|
535
|
+
} else {
|
536
|
+
changeChatHeaderTitle(I18n.t('chat.disconnected'))
|
537
|
+
}
|
538
|
+
}
|
539
|
+
}
|
497
540
|
}
|
498
|
-
|
499
|
-
|
500
|
-
|
501
|
-
|
502
|
-
|
503
|
-
|
504
|
-
var headerMessage = getParsedName(from_name,false);
|
505
|
-
|
506
|
-
//Write message in chatBox.
|
507
|
-
getChatBoxForSlug(from_slug).chatbox("option", "boxManager").addMsg(headerMessage, content);
|
508
|
-
|
509
|
-
//Rotate chatBoxes priority.
|
510
|
-
rotatePriority(from_slug);
|
511
|
-
|
512
|
-
//Check for start blinkTitle.
|
513
|
-
blinkTitleOnMessage(from_name);
|
514
|
-
|
515
|
-
//Check for play sound
|
516
|
-
if (mustPlaySoundForChatWindow(getChatBoxForSlug(from_slug))) {
|
517
|
-
playSound("onMessageAudio");
|
518
|
-
}
|
519
|
-
}
|
520
|
-
|
521
|
-
|
522
|
-
////////////////////
|
523
|
-
//Update connected users of MainChatBox
|
524
|
-
////////////////////
|
525
|
-
|
526
|
-
function updateConnectedUsersOfMainChatBox(){
|
527
|
-
if(mainChatBox!=null){
|
528
|
-
if(isUserConnected()){
|
529
|
-
var connectedUsers = getConnectedSlugsLength();
|
530
|
-
changeMainChatBoxHeaderTitle( I18n.t('chat.title') + " (" + connectedUsers + ")");
|
531
|
-
changeMainChatBoxHeight(getChatBoxHeightRequiredForConnectionBoxes());
|
532
|
-
} else {
|
533
|
-
if(afterFirstConnectionFlag){
|
534
|
-
changeChatHeaderTitle(I18n.t('chat.connecting'))
|
535
|
-
} else {
|
536
|
-
changeChatHeaderTitle(I18n.t('chat.disconnected'))
|
537
|
-
}
|
538
|
-
}
|
539
|
-
}
|
540
|
-
}
|
541
|
+
|
542
|
+
var updateMainChatBoxAfterConnectionBoxChanges = function(){
|
543
|
+
PRESENCE.WINDOW.changeMainChatBoxHeight(PRESENCE.WINDOW.getChatBoxHeightRequiredForConnectionBoxes());
|
544
|
+
updateConnectedUsersOfMainChatBox();
|
545
|
+
}
|
546
|
+
|
541
547
|
|
542
|
-
|
543
|
-
|
544
|
-
|
545
|
-
|
548
|
+
return {
|
549
|
+
init: init,
|
550
|
+
changeChatHeaderTitle : changeChatHeaderTitle,
|
551
|
+
changeSelectContactValue : changeSelectContactValue,
|
552
|
+
setStatusWidgetTitle : setStatusWidgetTitle,
|
553
|
+
updateChatWindow : updateChatWindow,
|
554
|
+
updateInterfaceAfterUserDisconnect : updateInterfaceAfterUserDisconnect,
|
555
|
+
updateInterfaceAfterPresenceStanza : updateInterfaceAfterPresenceStanza,
|
556
|
+
setUserIconStatus : setUserIconStatus,
|
557
|
+
connectButtonTimerFunction : connectButtonTimerFunction,
|
558
|
+
getConnectionBoxFromSlug : getConnectionBoxFromSlug,
|
559
|
+
isSlugChatConnected : isSlugChatConnected,
|
560
|
+
existsSlugChatBox : existsSlugChatBox,
|
561
|
+
getAllConnectedSlugs : getAllConnectedSlugs,
|
562
|
+
afterReceivedChatMessage : afterReceivedChatMessage,
|
563
|
+
afterReceivedGroupChatMessage : afterReceivedGroupChatMessage,
|
564
|
+
writeReceivedMessageOnChatWindow : writeReceivedMessageOnChatWindow,
|
565
|
+
updateConnectedUsersOfMainChatBox : updateConnectedUsersOfMainChatBox
|
566
|
+
};
|
567
|
+
|
568
|
+
}) (PRESENCE, jQuery);
|