social_stream 0.26.1 → 0.26.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. data/README.rdoc +10 -0
  2. data/base/lib/social_stream/base/version.rb +1 -1
  3. data/base/social_stream-base.gemspec +1 -1
  4. data/lib/social_stream/release/component.rb +5 -0
  5. data/lib/social_stream/release/global.rb +8 -7
  6. data/lib/social_stream/release/kernel.rb +24 -0
  7. data/lib/social_stream/version.rb +1 -1
  8. data/presence/app/assets/javascripts/jquery.flexselect.sstreampresence.js +2 -2
  9. data/presence/app/assets/javascripts/jquery.ui.chatbox.sstreampresence.js +5 -5
  10. data/presence/app/assets/javascripts/presence.js.erb +6 -4
  11. data/presence/app/assets/javascripts/presence_XmppClient.js.erb +1146 -996
  12. data/presence/app/assets/javascripts/presence_audio.js.erb +74 -60
  13. data/presence/app/assets/javascripts/presence_game.js.erb +35 -22
  14. data/presence/app/assets/javascripts/presence_game_comunication.js.erb +22 -5
  15. data/presence/app/assets/javascripts/presence_game_factory.js.erb +1 -1
  16. data/presence/app/assets/javascripts/presence_game_interface.js.erb +33 -13
  17. data/presence/app/assets/javascripts/presence_notifications.js +206 -183
  18. data/presence/app/assets/javascripts/presence_parser.js +265 -247
  19. data/presence/app/assets/javascripts/presence_persistence.js +199 -188
  20. data/presence/app/assets/javascripts/presence_store.js +22 -11
  21. data/presence/app/assets/javascripts/presence_uiManager.js.erb +553 -530
  22. data/presence/app/assets/javascripts/presence_utilities.js +244 -219
  23. data/presence/app/assets/javascripts/presence_videochat.js.erb +436 -409
  24. data/presence/app/assets/javascripts/presence_windowManager.js +586 -532
  25. data/presence/app/views/chat/_index.html.erb +7 -13
  26. data/presence/config/locales/en.yml +2 -1
  27. data/presence/config/locales/es.yml +2 -1
  28. data/presence/ejabberd/ejabberd_files.zip +0 -0
  29. data/presence/ejabberd/ejabberd_scripts/authentication_script +9 -2
  30. data/presence/ejabberd/mod_sspresence/mod_sspresence.beam +0 -0
  31. data/presence/lib/generators/social_stream/presence/templates/initializer.rb +4 -0
  32. data/presence/lib/social_stream-presence.rb +3 -0
  33. data/presence/lib/social_stream/presence/version.rb +1 -1
  34. data/presence/lib/social_stream/presence/xmpp_server_order.rb +1 -0
  35. data/release.thor +33 -13
  36. data/social_stream.gemspec +2 -2
  37. metadata +90 -29
@@ -1,213 +1,224 @@
1
- ////////////////////
2
- // Store and restore conversations using session storage.
3
- ////////////////////
1
+ PRESENCE.PERSISTENCE = (function(P,$,undefined){
4
2
 
5
- function storeChatData(){
6
-
7
- //Check for Session Storage support
8
- if (! window.sessionStorage){
9
- return
10
- }
11
-
12
- storeChatStatus();
13
- storeUserChatStatus();
14
- storeConversations();
15
- }
3
+ var init = function(){ }
16
4
 
17
- function storeChatStatus(){
18
- //Status of the mainChatBoxWindow
19
- if(mainChatBox!=null){
20
- sessionStorage.setItem("chat_mainChatBox_status", $(mainChatBox).is(":visible"));
21
- } else {
22
- sessionStorage.setItem("chat_mainChatBox_status", null);
23
- }
24
- }
25
5
 
26
- function storeConversations() {
27
- var chatboxes = getAllChatBoxes();
28
- var visibleChatBoxes = getVisibleChatBoxes();
29
- var storedSlugs = [];
30
- var storedGroupSlugs = [];
31
- var visibleMaxSlugs = [];
32
- var visibleMinSlugs = [];
6
+ ////////////////////
7
+ // Store and restore conversations using session storage.
8
+ ////////////////////
33
9
 
34
- //Stored all conversations
35
- for (var i=0;i<chatboxes.length;i++){
36
- var slug = chatboxes[i].id
37
- if(isSlugGroup(slug)){
38
- if(visibleChatBoxes.indexOf(getChatBoxForSlug(slug))!=-1){
39
- storedGroupSlugs.push(slug)
40
- }
41
- } else {
42
- var log = $(chatboxes[i]).html()
43
- sessionStorage.setItem("chat_log_" + slug, log);
44
- storedSlugs.push(slug)
45
- }
10
+ var storeChatData = function(){
11
+
12
+ //Check for Session Storage support
13
+ if (! window.sessionStorage){
14
+ return
15
+ }
16
+
17
+ storeChatStatus();
18
+ storeUserChatStatus();
19
+ storeConversations();
46
20
  }
47
21
 
48
- if(storedSlugs.length>0){
49
- //Stored slugs with stored conversations
50
- sessionStorage.setItem("slugs_with_stored_log", storedSlugs.join(","));
51
- } else {
52
- sessionStorage.setItem("slugs_with_stored_log", null);
22
+ var storeChatStatus = function(){
23
+ //Status of the mainChatBoxWindow
24
+ var mainChatBox = PRESENCE.WINDOW.getMainChatBox();
25
+ if(mainChatBox!=null){
26
+ sessionStorage.setItem("chat_mainChatBox_status", $(mainChatBox).is(":visible"));
27
+ } else {
28
+ sessionStorage.setItem("chat_mainChatBox_status", null);
29
+ }
53
30
  }
54
31
 
55
- if(storedGroupSlugs.length>0){
56
- //Stored open groups slugs
57
- sessionStorage.setItem("open_group_slugs", storedGroupSlugs.join(","));
58
- } else {
59
- sessionStorage.setItem("open_group_slugs", null);
60
- }
32
+ var storeConversations = function() {
33
+ var chatboxes = PRESENCE.WINDOW.getAllChatBoxes();
34
+ var pvisibleChatBoxes = PRESENCE.WINDOW.getVisibleChatBoxes();
35
+ var storedSlugs = [];
36
+ var storedGroupSlugs = [];
37
+ var visibleMaxSlugs = [];
38
+ var visibleMinSlugs = [];
39
+
40
+ //Stored all conversations
41
+ for (var i=0;i<chatboxes.length;i++){
42
+ var slug = chatboxes[i].id
43
+ if(PRESENCE.WINDOW.isSlugGroup(slug)){
44
+ if(pvisibleChatBoxes.indexOf(PRESENCE.WINDOW.getChatBoxForSlug(slug))!=-1){
45
+ storedGroupSlugs.push(slug)
46
+ }
47
+ } else {
48
+ var log = $(chatboxes[i]).html()
49
+ sessionStorage.setItem("chat_log_" + slug, log);
50
+ storedSlugs.push(slug)
51
+ }
52
+ }
53
+
54
+ if(storedSlugs.length>0){
55
+ //Stored slugs with stored conversations
56
+ sessionStorage.setItem("slugs_with_stored_log", storedSlugs.join(","));
57
+ } else {
58
+ sessionStorage.setItem("slugs_with_stored_log", null);
59
+ }
60
+
61
+ if(storedGroupSlugs.length>0){
62
+ //Stored open groups slugs
63
+ sessionStorage.setItem("open_group_slugs", storedGroupSlugs.join(","));
64
+ } else {
65
+ sessionStorage.setItem("open_group_slugs", null);
66
+ }
67
+
68
+ //Stored slugs with visible chatbox
69
+ for (var j=0;j<pvisibleChatBoxes.length;j++){
70
+ if(pvisibleChatBoxes[j].is(":visible")){
71
+ visibleMaxSlugs.push($(pvisibleChatBoxes[j]).attr("id"))
72
+ } else {
73
+ visibleMinSlugs.push($(pvisibleChatBoxes[j]).attr("id"))
74
+ }
75
+ }
76
+
77
+ if (visibleMaxSlugs.length > 0) {
78
+ sessionStorage.setItem("slugs_with_visible_max_chatbox", visibleMaxSlugs.join(","));
79
+ } else {
80
+ sessionStorage.setItem("slugs_with_visible_max_chatbox", null);
81
+ }
82
+
83
+ if (visibleMinSlugs.length > 0) {
84
+ sessionStorage.setItem("slugs_with_visible_min_chatbox", visibleMinSlugs.join(","));
85
+ } else {
86
+ sessionStorage.setItem("slugs_with_visible_min_chatbox", null);
87
+ }
88
+ }
61
89
 
62
- //Stored slugs with visible chatbox
63
- for (var j=0;j<visibleChatBoxes.length;j++){
64
- if(visibleChatBoxes[j].is(":visible")){
65
- visibleMaxSlugs.push($(visibleChatBoxes[j]).attr("id"))
66
- } else {
67
- visibleMinSlugs.push($(visibleChatBoxes[j]).attr("id"))
68
- }
69
- }
90
+ var storeUserChatStatus = function(){
91
+ sessionStorage.setItem("chat_user_status", PRESENCE.XMPPClient.getUserStatus());
92
+ }
70
93
 
71
- if (visibleMaxSlugs.length > 0) {
72
- sessionStorage.setItem("slugs_with_visible_max_chatbox", visibleMaxSlugs.join(","));
73
- } else {
74
- sessionStorage.setItem("slugs_with_visible_max_chatbox", null);
94
+ var removeAllDataStored = function(){
95
+ sessionStorage.removeItem("chat_user_status");
96
+ sessionStorage.removeItem("chat_mainChatBox_status");
97
+
98
+ sessionStorage.removeItem("slugs_with_stored_log");
99
+ sessionStorage.removeItem("slugs_with_visible_max_chatbox");
100
+ sessionStorage.removeItem("slugs_with_visible_min_chatbox");
101
+ sessionStorage.removeItem("open_group_slugs");
75
102
  }
76
103
 
77
- if (visibleMinSlugs.length > 0) {
78
- sessionStorage.setItem("slugs_with_visible_min_chatbox", visibleMinSlugs.join(","));
79
- } else {
80
- sessionStorage.setItem("slugs_with_visible_min_chatbox", null);
81
- }
82
- }
83
-
84
- function storeUserChatStatus(){
85
- sessionStorage.setItem("chat_user_status", userStatus);
86
- }
87
-
88
- function removeAllDataStored(){
89
- sessionStorage.removeItem("chat_user_status");
90
- sessionStorage.removeItem("chat_mainChatBox_status");
104
+ var getRestoreUserChatStatus = function(){
105
+ if (!window.sessionStorage) {
106
+ return "available";
107
+ }
108
+
109
+ var restoreUserChatStatus = sessionStorage.getItem("chat_user_status");
110
+ if ((restoreUserChatStatus != null)&&((restoreUserChatStatus in PRESENCE.XMPPClient.getSStreamChatStatus())||(restoreUserChatStatus=="offline"))){
111
+ return restoreUserChatStatus;
112
+ } else {
113
+ return "available";
114
+ }
115
+ }
91
116
 
92
- sessionStorage.removeItem("slugs_with_stored_log");
93
- sessionStorage.removeItem("slugs_with_visible_max_chatbox");
94
- sessionStorage.removeItem("slugs_with_visible_min_chatbox");
95
- sessionStorage.removeItem("open_group_slugs");
96
- }
97
-
98
- function getRestoreUserChatStatus(){
99
- if (!window.sessionStorage) {
100
- return "available";
117
+ var restoreChatData = function(){
118
+
119
+ //Check for Session Storage support
120
+ if (! window.sessionStorage){
121
+ return
122
+ }
123
+
124
+ restoreChatBoxes();
101
125
  }
102
126
 
103
- var restoreUserChatStatus = sessionStorage.getItem("chat_user_status");
104
- if ((restoreUserChatStatus != null)&&((restoreUserChatStatus in sstreamChatStatus)||(restoreUserChatStatus=="offline"))){
105
- return restoreUserChatStatus;
106
- } else {
107
- return "available";
127
+ var getRestoreMainChatBoxStatus = function(){
128
+ if (!window.sessionStorage) {
129
+ return false;
130
+ } else {
131
+ if(sessionStorage.getItem("chat_mainChatBox_status") == "true"){
132
+ return true;
133
+ } else {
134
+ return false;
135
+ }
136
+ }
108
137
  }
109
- }
110
-
111
- function restoreChatData(){
112
138
 
113
- //Check for Session Storage support
114
- if (! window.sessionStorage){
115
- return
116
- }
117
-
118
- restoreChatBoxes();
119
- }
120
-
121
- function getRestoreMainChatBoxStatus(){
122
- if (!window.sessionStorage) {
123
- return false;
124
- } else {
125
- if(sessionStorage.getItem("chat_mainChatBox_status") == "true"){
126
- return true;
127
- } else {
128
- return false;
129
- }
139
+ var restoreChatBoxes = function(){
140
+
141
+ //Get slugs with visible chatbox
142
+ var visibleMaxSlugsString = sessionStorage.getItem("slugs_with_visible_max_chatbox");
143
+ var visibleMinSlugsString = sessionStorage.getItem("slugs_with_visible_min_chatbox");
144
+
145
+ if(visibleMaxSlugsString!=null){
146
+ var visibleMaxSlugs = visibleMaxSlugsString.split(",")
147
+ } else {
148
+ var visibleMaxSlugs = [];
149
+ }
150
+
151
+ if(visibleMinSlugsString!=null){
152
+ var visibleMinSlugs = visibleMinSlugsString.split(",")
153
+ } else {
154
+ var visibleMinSlugs = [];
155
+ }
156
+
157
+ restoreBuddyChatBoxes(visibleMaxSlugs,visibleMinSlugs);
158
+ restoreGroupsChatBoxes(visibleMaxSlugs,visibleMinSlugs);
130
159
  }
131
- }
132
-
133
- function restoreChatBoxes(){
134
160
 
135
- //Get slugs with visible chatbox
136
- var visibleMaxSlugsString = sessionStorage.getItem("slugs_with_visible_max_chatbox");
137
- var visibleMinSlugsString = sessionStorage.getItem("slugs_with_visible_min_chatbox");
138
-
139
- if(visibleMaxSlugsString!=null){
140
- var visibleMaxSlugs = visibleMaxSlugsString.split(",")
141
- } else {
142
- var visibleMaxSlugs = [];
143
- }
144
-
145
- if(visibleMinSlugsString!=null){
146
- var visibleMinSlugs = visibleMinSlugsString.split(",")
147
- } else {
148
- var visibleMinSlugs = [];
149
- }
150
-
151
- restoreBuddyChatBoxes(visibleMaxSlugs,visibleMinSlugs);
152
- restoreGroupsChatBoxes(visibleMaxSlugs,visibleMinSlugs);
153
- }
154
-
155
- function restoreGroupsChatBoxes(visibleMaxSlugs,visibleMinSlugs){
156
- var groupSlugsString = sessionStorage.getItem("open_group_slugs")
157
- if((groupSlugsString != null)&&(groupSlugsString != "null")){
158
- var groupSlugs=groupSlugsString.split(",")
159
-
160
- for (var i=0;i<groupSlugs.length;i++){
161
- var guest_slug = groupSlugs[i]
162
- var guest_name = getNameFromSlug(guest_slug)
163
- var open = (visibleMinSlugs.indexOf(guest_slug)==-1)
164
- accessRoom(guest_slug,open)
165
- }
161
+ var restoreGroupsChatBoxes = function(visibleMaxSlugs,visibleMinSlugs){
162
+ var groupSlugsString = sessionStorage.getItem("open_group_slugs")
163
+ if((groupSlugsString != null)&&(groupSlugsString != "null")){
164
+ var groupSlugs=groupSlugsString.split(",")
165
+
166
+ for (var i=0;i<groupSlugs.length;i++){
167
+ var guest_slug = groupSlugs[i]
168
+ var guest_name = PRESENCE.XMPPClient.getNameFromSlug(guest_slug)
169
+ var open = (visibleMinSlugs.indexOf(guest_slug)==-1)
170
+ PRESENCE.XMPPClient.accessRoom(guest_slug,open)
171
+ }
172
+ }
166
173
  }
167
- }
168
-
169
- function restoreBuddyChatBoxes(visibleMaxSlugs,visibleMinSlugs) {
170
- //Get Stored slugs
171
- var storedSlugsString = sessionStorage.getItem("slugs_with_stored_log");
172
174
 
173
- if (storedSlugsString != null){
174
- var storedSlugs=storedSlugsString.split(",")
175
-
176
- for (var i=0;i<storedSlugs.length;i++){
177
- var restoreLog = sessionStorage.getItem("chat_log_" + storedSlugs[i]);
178
-
179
- if (restoreLog != null){
175
+ var restoreBuddyChatBoxes = function(visibleMaxSlugs,visibleMinSlugs) {
176
+ //Get Stored slugs
177
+ var storedSlugsString = sessionStorage.getItem("slugs_with_stored_log");
178
+
179
+ if (storedSlugsString != null){
180
+ var storedSlugs=storedSlugsString.split(",")
181
+
182
+ for (var i=0;i<storedSlugs.length;i++){
183
+ var restoreLog = sessionStorage.getItem("chat_log_" + storedSlugs[i]);
184
+
185
+ if (restoreLog != null){
186
+
187
+ var guest_slug = storedSlugs[i];
188
+ var guest_name = PRESENCE.XMPPClient.getNameFromSlug(guest_slug)
189
+ var guest_jid = PRESENCE.XMPPClient.getJidFromSlug(guest_slug);
190
+ PRESENCE.WINDOW.createBuddyChatBox(guest_slug)
191
+
192
+ if ((visibleMinSlugs.indexOf(guest_slug)!=-1)){
193
+ //Minimize chatbox
194
+ PRESENCE.WINDOW.getChatBoxForSlug(guest_slug).parent().toggle(false);
195
+ }
196
+ if ((visibleMaxSlugs.indexOf(guest_slug)==-1)&&(visibleMinSlugs.indexOf(guest_slug)==-1)){
197
+ PRESENCE.WINDOW.closeChatBox(guest_slug);
198
+ }
199
+
200
+ PRESENCE.WINDOW.getChatBoxForSlug(guest_slug).html(restoreLog)
201
+
202
+ if (! PRESENCE.UIMANAGER.isSlugChatConnected(guest_slug)) {
203
+ PRESENCE.NOTIFICATIONS.showOfflineChatNotificationForSlug(guest_slug);
204
+ }
205
+
206
+ }
207
+ }
208
+ }
209
+ }
210
+
211
+
212
+ return {
213
+ init: init,
214
+ storeChatData : storeChatData,
215
+ restoreChatData : restoreChatData,
216
+ getRestoreUserChatStatus : getRestoreUserChatStatus,
217
+ getRestoreMainChatBoxStatus : getRestoreMainChatBoxStatus
218
+ };
219
+
220
+ }) (PRESENCE, jQuery);
180
221
 
181
- var guest_slug = storedSlugs[i];
182
- var guest_name = getNameFromSlug(guest_slug)
183
- var guest_jid = guest_slug + "@" + domain;
184
- createBuddyChatBox(guest_slug)
185
-
186
- if ((visibleMinSlugs.indexOf(guest_slug)!=-1)){
187
- //Minimize chatbox
188
- window[getChatVariableFromSlug(guest_slug)].parent().toggle(false);
189
- }
190
- if ((visibleMaxSlugs.indexOf(guest_slug)==-1)&&(visibleMinSlugs.indexOf(guest_slug)==-1)){
191
- closeChatBox(guest_slug);
192
- }
193
-
194
- getChatBoxForSlug(guest_slug).html(restoreLog)
195
-
196
- if (! isSlugChatConnected(guest_slug)) {
197
- showOfflineChatNotificationForSlug(guest_slug);
198
- }
199
-
200
- }
201
- }
202
- }
203
- }
204
222
 
205
223
 
206
- ////////////////////
207
- // Events
208
- ////////////////////
209
224
 
210
- $(window).unload(function() {
211
- storeChatData();
212
- disconnectStrophe();
213
- });
@@ -1,19 +1,30 @@
1
1
  ////////////////////
2
- //Store password with session storage
2
+ //STORE MODULE: Store password with session storage
3
3
  ////////////////////
4
4
 
5
- function storePassword() {
5
+ PRESENCE.STORE = (function(P,$,undefined){
6
+
7
+ var init = function(){ }
6
8
 
7
- //Dont store password if cookie authentication is enable
8
- if (authByCookie()) {
9
- return
10
- }
11
-
9
+ var storePassword = function() {
10
+
11
+ //Dont store password if cookie authentication is enable
12
+ if (PRESENCE.XMPPClient.authByCookie()) {
13
+ return
14
+ }
15
+
12
16
  if (window.sessionStorage) {
13
- if (($("#user_password").length==1)&&($("#user_password").val()!="")){
17
+ if (($("#user_password").length==1)&&($("#user_password").val()!="")){
14
18
  sessionStorage.setItem("ss_user_pass", $('#user_password').val());
15
19
  } else if (($("#password").length==1)&&($("#password").val()!="")){
16
- sessionStorage.setItem("ss_user_pass", $('#password').val());
17
- }
20
+ sessionStorage.setItem("ss_user_pass", $('#password').val());
21
+ }
18
22
  }
19
- }
23
+ }
24
+
25
+ return {
26
+ init: init,
27
+ storePassword: storePassword
28
+ };
29
+
30
+ }) (PRESENCE, jQuery);