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.
@@ -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!
@@ -1,5 +1,5 @@
1
1
  module SocialStream
2
2
  module Base
3
- VERSION = "0.10.0".freeze
3
+ VERSION = "0.10.1".freeze
4
4
  end
5
5
  end
@@ -1,3 +1,3 @@
1
1
  module SocialStream
2
- VERSION = "0.13.0".freeze
2
+ VERSION = "0.13.1".freeze
3
3
  end
@@ -188,10 +188,11 @@ function refreshChatWindow(){
188
188
  function updateChatWindow(){
189
189
  timerCounter=0;
190
190
  log("updateChatWindow()");
191
- $.post("/chatWindow", { userConnected: userConnected }, function(data){
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 (userConnected) {
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
- log('Strophe connection attached');
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
- log('Strophe is connecting.');
116
- return;
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
- log('Strophe failed to connect.');
123
- userConnected = false;
124
- setTimeout ("onReconnect()", 3000);
147
+ log('Strophe failed to connect.');
148
+ reconnectTimer = setTimeout ("onReconnect()", 5000);
149
+ disconnectionFlag = true;
125
150
  } else if (status == Strophe.Status.AUTHFAIL) {
126
- log('Strophe authentication fail.');
127
- if ((window.sessionStorage)&&(sessionStorage.getItem("ss_user_pass") != null)){
128
- sessionStorage.setItem("ss_user_pass",null);
129
- }
130
- userConnected = false;
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
- log('Strophe error.');
133
- userConnected = false;
157
+ log('Strophe error.');
158
+ disconnectionFlag = true;
134
159
  } else if (status == Strophe.Status.DISCONNECTED) {
135
- log('Strophe is disconnected.');
136
- userConnected = false;
137
- clearTimeout(awayTimer);
138
- if(userStatus!="offline"){
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
- log('Strophe is connected.');
143
- log('Presenze stanza send for:' + connection.jid);
144
- connection.addHandler(onMessage, null, 'message', null, null, null);
145
- connection.addHandler(onPresence, null, 'presence', null, null, null);
146
- //addHandler:(callback, namespace to match, stanza name, stanza type, stanza id , stanza from, options)
147
- sendStatus(userStatus);
148
- userConnected = true;
149
- userStatus = "chat";
150
- awayTimer = setInterval("awayTimerFunction()", awayTimerPeriod);
151
- timer = setInterval("timerFunction()", timerPeriod);
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
- if ((connection != null)&&(!userConnected)) {
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
  ////////
@@ -1,7 +1,9 @@
1
1
  en:
2
2
  chat:
3
3
  connecting: "Chat Connecting"
4
+ reconnecting: "Chat Reconnecting"
4
5
  disconnected: "Chat Disconnected"
6
+ unableconnect: "Chat Disconnected"
5
7
  title: "Chat"
6
8
  password: "Password"
7
9
  status:
@@ -1,7 +1,9 @@
1
1
  es:
2
2
  chat:
3
3
  connecting: "Chat Conectando"
4
+ reconnecting: "Chat Reconectando"
4
5
  disconnected: "Chat Desconectado"
6
+ unableconnect: "Chat Desconectado"
5
7
  title: "Chat"
6
8
  password: "Contraseña"
7
9
  status:
@@ -1,5 +1,5 @@
1
1
  module Socialstream
2
2
  module Presence
3
- VERSION = "0.1.1"
3
+ VERSION = "0.1.2"
4
4
  end
5
5
  end
@@ -19,7 +19,7 @@ Gem::Specification.new do |s|
19
19
  s.require_paths = ["lib"]
20
20
 
21
21
  # Gem dependencies
22
- s.add_runtime_dependency('social_stream-base','~> 0.9.18')
22
+ s.add_runtime_dependency('social_stream-base','~> 0.10.0')
23
23
 
24
24
  s.add_runtime_dependency "xmpp4r"
25
25
 
@@ -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 = "Social networking features and activity streams for Ruby on Rails."
7
- s.description = "Ruby on Rails engine supporting social networking features and activity streams."
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.0')
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: 43
4
+ hash: 41
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 13
9
- - 0
10
- version: 0.13.0
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: 55
30
+ hash: 53
31
31
  segments:
32
32
  - 0
33
33
  - 10
34
- - 0
35
- version: 0.10.0
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 supporting social networking features and activity streams.
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: Social networking features and activity streams for Ruby on Rails.
1446
+ summary: A core for building social network websites
1447
1447
  test_files: []
1448
1448