social_stream 0.13.0 → 0.13.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/base/db/migrate/20111124100618_object_actors.rb +3 -1
- data/base/lib/social_stream/base/version.rb +1 -1
- data/lib/social_stream/version.rb +1 -1
- data/presence/app/assets/javascripts/chat_interface_manager.js.erb +3 -2
- data/presence/app/assets/javascripts/xmpp_client_management.js.erb +67 -34
- data/presence/config/locales/en.yml +2 -0
- data/presence/config/locales/es.yml +2 -0
- data/presence/lib/social_stream/presence/version.rb +1 -1
- data/presence/social_stream-presence.gemspec +1 -1
- data/social_stream.gemspec +3 -3
- metadata +8 -8
@@ -29,9 +29,11 @@ class ObjectActors < ActiveRecord::Migration
|
|
29
29
|
a.author = author
|
30
30
|
a.user_author = user_author
|
31
31
|
else
|
32
|
+
next if a.post_activity.blank?
|
33
|
+
|
32
34
|
a.author = a.post_activity.sender
|
33
35
|
a.owner = a.post_activity.receiver
|
34
|
-
a.user_author = (a.author.is_a?(User) ? a.author : a.author.sent_ties.order(:created_at).first.receiver)
|
36
|
+
a.user_author = (a.author.subject.is_a?(User) ? a.author : a.author.sent_ties.order(:created_at).first.receiver)
|
35
37
|
end
|
36
38
|
|
37
39
|
a.save!
|
@@ -188,10 +188,11 @@ function refreshChatWindow(){
|
|
188
188
|
function updateChatWindow(){
|
189
189
|
timerCounter=0;
|
190
190
|
log("updateChatWindow()");
|
191
|
-
|
191
|
+
var stropheConnectedAndOnlineStatus = ((isStropheConnected()) && (userStatus!="offline") && (!disconnectionFlag));
|
192
|
+
$.post("/chatWindow", { userConnected: stropheConnectedAndOnlineStatus }, function(data){
|
192
193
|
$(".tooltip").hide() //Prevent tooltips
|
193
194
|
$("#chat_partial").html(data);
|
194
|
-
if (
|
195
|
+
if (isStropheConnected()) {
|
195
196
|
setStatusWidgetTitle(userStatus);
|
196
197
|
$(".user_presence a[title]").tooltip();
|
197
198
|
setUserFunctions();
|
@@ -14,7 +14,21 @@ statusMessage['dnd'] = "Busy";
|
|
14
14
|
//Connect functions
|
15
15
|
////////////////////
|
16
16
|
|
17
|
+
function isStropheConnected(){
|
18
|
+
if((connection!=null)&&(connection.connected)){
|
19
|
+
return true;
|
20
|
+
} else {
|
21
|
+
return false;
|
22
|
+
}
|
23
|
+
}
|
24
|
+
|
25
|
+
|
17
26
|
function connectToServerWithCookie(){
|
27
|
+
|
28
|
+
if (isStropheConnected()){
|
29
|
+
log("connectToServerWithCookie() returns: Strophe already connected");
|
30
|
+
}
|
31
|
+
log("connectToServerWithCookie() calls");
|
18
32
|
try {
|
19
33
|
connection = new Strophe.Connection(BOSH_SERVICE);
|
20
34
|
connection.connect(user_jid, cookie, onConnect);
|
@@ -24,9 +38,14 @@ function connectToServerWithCookie(){
|
|
24
38
|
}
|
25
39
|
}
|
26
40
|
|
41
|
+
|
27
42
|
//Password: Get from chatPassword param if exists, instead try to get from sessionStorage.
|
28
43
|
function connectToServerWithPassword(chatPassword){
|
29
44
|
|
45
|
+
if (isStropheConnected()){
|
46
|
+
log("connectToServerWithPassword() returns: Strophe already connected");
|
47
|
+
}
|
48
|
+
|
30
49
|
//Get Password
|
31
50
|
if ((chatPassword!=null)&&(chatPassword!="")){
|
32
51
|
var password = chatPassword;
|
@@ -79,10 +98,11 @@ var awayTime = 300000;
|
|
79
98
|
var awayCounter = 0;
|
80
99
|
var timerCounter = 0;
|
81
100
|
var connection = null;
|
82
|
-
var userConnected = false;
|
83
101
|
var reconnectAttempts = 3;
|
84
102
|
var awayTimer;
|
85
103
|
var timer;
|
104
|
+
var reconnectTimer;
|
105
|
+
var disconnectionFlag = true;
|
86
106
|
var requestContacts=false;
|
87
107
|
var cyclesToRefresh = (refreshMinTime/timerPeriod);
|
88
108
|
|
@@ -102,7 +122,7 @@ function onConnect(status) {
|
|
102
122
|
log('Strophe onConnect callback call with status ' + status);
|
103
123
|
|
104
124
|
if (status == Strophe.Status.ATTACHED){
|
105
|
-
|
125
|
+
log('Strophe connection attached');
|
106
126
|
return;
|
107
127
|
}
|
108
128
|
|
@@ -112,53 +132,61 @@ function onConnect(status) {
|
|
112
132
|
}
|
113
133
|
|
114
134
|
if (status == Strophe.Status.CONNECTING) {
|
115
|
-
|
116
|
-
|
135
|
+
log('Strophe is connecting.');
|
136
|
+
return;
|
137
|
+
}
|
138
|
+
|
139
|
+
if (status == Strophe.Status.DISCONNECTING) {
|
140
|
+
log('Strophe is disconnecting.');
|
141
|
+
return;
|
117
142
|
}
|
118
143
|
|
119
144
|
clearTimeout(initialTimer);
|
120
145
|
|
121
146
|
if (status == Strophe.Status.CONNFAIL) {
|
122
|
-
|
123
|
-
|
124
|
-
|
147
|
+
log('Strophe failed to connect.');
|
148
|
+
reconnectTimer = setTimeout ("onReconnect()", 5000);
|
149
|
+
disconnectionFlag = true;
|
125
150
|
} else if (status == Strophe.Status.AUTHFAIL) {
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
151
|
+
log('Strophe authentication fail.');
|
152
|
+
if ((window.sessionStorage)&&(sessionStorage.getItem("ss_user_pass") != null)){
|
153
|
+
sessionStorage.setItem("ss_user_pass",null);
|
154
|
+
}
|
155
|
+
disconnectionFlag = true;
|
131
156
|
} else if (status == Strophe.Status.ERROR) {
|
132
|
-
|
133
|
-
|
157
|
+
log('Strophe error.');
|
158
|
+
disconnectionFlag = true;
|
134
159
|
} else if (status == Strophe.Status.DISCONNECTED) {
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
setTimeout ("onReconnect()", 3000);
|
140
|
-
}
|
160
|
+
log('Strophe is disconnected.');
|
161
|
+
disconnectionFlag = true;
|
162
|
+
clearTimeout(awayTimer);
|
163
|
+
reconnectTimer = setTimeout ("onReconnect()", 5000);
|
141
164
|
} else if (status == Strophe.Status.CONNECTED) {
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
165
|
+
log('Strophe is connected.');
|
166
|
+
log('Presenze stanza send for:' + connection.jid);
|
167
|
+
clearTimeout(reconnectTimer);
|
168
|
+
connection.addHandler(onMessage, null, 'message', null, null, null);
|
169
|
+
connection.addHandler(onPresence, null, 'presence', null, null, null);
|
170
|
+
//addHandler:(callback, namespace to match, stanza name, stanza type, stanza id , stanza from, options)
|
171
|
+
disconnectionFlag = false;
|
172
|
+
userStatus = "chat";
|
173
|
+
sendStatus(userStatus);
|
174
|
+
awayTimer = setInterval("awayTimerFunction()", awayTimerPeriod);
|
175
|
+
timer = setInterval("timerFunction()", timerPeriod);
|
152
176
|
}
|
153
177
|
|
154
178
|
updateChatWindow();
|
155
179
|
}
|
156
180
|
|
157
181
|
function onReconnect(){
|
158
|
-
|
182
|
+
log("onReconnect!")
|
183
|
+
if ((!isStropheConnected())&&(userStatus!="offline")) {
|
184
|
+
|
159
185
|
if (reconnectAttempts>0) {
|
160
186
|
reconnectAttempts--;
|
161
187
|
|
188
|
+
$("#chat_header_title").html('<%=I18n.t('chat.reconnecting')%>')
|
189
|
+
|
162
190
|
if (authByCookie()){
|
163
191
|
//Authentication by cookie
|
164
192
|
connectToServerWithCookie();
|
@@ -166,18 +194,23 @@ function onReconnect(){
|
|
166
194
|
//Authentication by password
|
167
195
|
connectToServerWithPassword(null);
|
168
196
|
}
|
169
|
-
setTimeout ("onReconnect()", 9000);
|
197
|
+
reconnectTimer = setTimeout ("onReconnect()", 9000);
|
170
198
|
} else {
|
199
|
+
$("#chat_header_title").html('<%=I18n.t('chat.unableconnect')%>')
|
171
200
|
//Notify issue to Rails App Server?
|
172
201
|
}
|
202
|
+
|
173
203
|
}
|
174
204
|
}
|
175
205
|
|
176
206
|
function disconnectStrophe(){
|
177
207
|
userStatus = "offline";
|
178
|
-
connection.send($pres({type: "unavailable"}).tree());
|
179
|
-
connection.disconnect();
|
180
208
|
setStatusWidgetTitle("offline");
|
209
|
+
|
210
|
+
if(isStropheConnected()){
|
211
|
+
connection.send($pres({type: "unavailable"}).tree());
|
212
|
+
connection.disconnect();
|
213
|
+
}
|
181
214
|
}
|
182
215
|
|
183
216
|
////////
|
data/social_stream.gemspec
CHANGED
@@ -3,15 +3,15 @@ require File.join(File.dirname(__FILE__), 'lib', 'social_stream', 'version')
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = "social_stream"
|
5
5
|
s.version = SocialStream::VERSION.dup
|
6
|
-
s.summary = "
|
7
|
-
s.description = "Ruby on Rails engine
|
6
|
+
s.summary = "A core for building social network websites"
|
7
|
+
s.description = "Social Stream is a Ruby on Rails engine for building social network websites. It supports contacts, posts, file uploads, private messages and many more."
|
8
8
|
s.authors = [ "GING - DIT - UPM",
|
9
9
|
"CISE - ESPOL" ]
|
10
10
|
s.homepage = "http://social-stream.dit.upm.es/"
|
11
11
|
s.files = `git ls-files`.split("\n")
|
12
12
|
|
13
13
|
# Gem dependencies
|
14
|
-
s.add_runtime_dependency('social_stream-base', '~> 0.10.
|
14
|
+
s.add_runtime_dependency('social_stream-base', '~> 0.10.1')
|
15
15
|
s.add_runtime_dependency('social_stream-documents', '~> 0.5.0')
|
16
16
|
s.add_runtime_dependency('social_stream-events', '~> 0.1.0')
|
17
17
|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: social_stream
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 41
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 13
|
9
|
-
-
|
10
|
-
version: 0.13.
|
9
|
+
- 1
|
10
|
+
version: 0.13.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- GING - DIT - UPM
|
@@ -27,12 +27,12 @@ dependencies:
|
|
27
27
|
requirements:
|
28
28
|
- - ~>
|
29
29
|
- !ruby/object:Gem::Version
|
30
|
-
hash:
|
30
|
+
hash: 53
|
31
31
|
segments:
|
32
32
|
- 0
|
33
33
|
- 10
|
34
|
-
-
|
35
|
-
version: 0.10.
|
34
|
+
- 1
|
35
|
+
version: 0.10.1
|
36
36
|
type: :runtime
|
37
37
|
version_requirements: *id001
|
38
38
|
- !ruby/object:Gem::Dependency
|
@@ -177,7 +177,7 @@ dependencies:
|
|
177
177
|
version: 1.6.4
|
178
178
|
type: :development
|
179
179
|
version_requirements: *id010
|
180
|
-
description: Ruby on Rails engine
|
180
|
+
description: Social Stream is a Ruby on Rails engine for building social network websites. It supports contacts, posts, file uploads, private messages and many more.
|
181
181
|
email:
|
182
182
|
executables: []
|
183
183
|
|
@@ -1443,6 +1443,6 @@ rubyforge_project:
|
|
1443
1443
|
rubygems_version: 1.6.2
|
1444
1444
|
signing_key:
|
1445
1445
|
specification_version: 3
|
1446
|
-
summary:
|
1446
|
+
summary: A core for building social network websites
|
1447
1447
|
test_files: []
|
1448
1448
|
|