social_stream 0.12.2 → 0.12.3
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/app/models/contact.rb +0 -3
- data/base/lib/social_stream/base/version.rb +1 -1
- data/base/vendor/assets/javascripts/jquery.screw.js +0 -2
- data/lib/social_stream/version.rb +1 -1
- data/presence/lib/generators/social_stream/presence/templates/initializer.rb +1 -0
- data/presence/lib/social_stream/presence/models/buddy_manager.rb +45 -32
- data/presence/lib/social_stream/presence/version.rb +1 -1
- data/presence/lib/social_stream/presence/xmpp_server_order.rb +39 -61
- data/social_stream.gemspec +1 -1
- metadata +6 -6
data/base/app/models/contact.rb
CHANGED
@@ -126,9 +126,6 @@ class Contact < ActiveRecord::Base
|
|
126
126
|
# We need to update that status here
|
127
127
|
def relation_ids=(ids)
|
128
128
|
remove_follower(ids)
|
129
|
-
if defined?(SocialStream::Presence) and SocialStream::Presence.enable
|
130
|
-
SocialStream::Presence::XmppServerOrder::removeBuddy(self)
|
131
|
-
end
|
132
129
|
association(:relations).ids_writer(ids)
|
133
130
|
end
|
134
131
|
|
@@ -18,6 +18,7 @@ SocialStream::Presence.setup do |config|
|
|
18
18
|
#SSH Login
|
19
19
|
#config.ssh_domain = "domain"
|
20
20
|
#config.ssh_user = "login"
|
21
|
+
#Comment to allow SSH authentication with key instead of password
|
21
22
|
#config.ssh_password= "password"
|
22
23
|
|
23
24
|
#Configure to use a Xmpp Client on Rails App
|
@@ -42,6 +42,16 @@ module SocialStream
|
|
42
42
|
subscription_type = "to"
|
43
43
|
SocialStream::Presence::XmppServerOrder::addBuddyToRoster(user_sid,buddy_sid,buddy_name,"SocialStream",subscription_type)
|
44
44
|
else
|
45
|
+
#Negative Tie
|
46
|
+
|
47
|
+
if self.contact.positive_replied?
|
48
|
+
#Bidirectional contacts
|
49
|
+
#Execute unsetRosterForBidirectionalTie(user_sid,oldfriend_sid,oldfriendNick,oldfriendGroup)
|
50
|
+
SocialStream::Presence::XmppServerOrder::unsetRosterForBidirectionalTie(buddy_sid,user_sid,user_name,"SocialStream")
|
51
|
+
else
|
52
|
+
SocialStream::Presence::XmppServerOrder::removeBuddyFromRoster(user_sid,buddy_sid)
|
53
|
+
end
|
54
|
+
|
45
55
|
return
|
46
56
|
end
|
47
57
|
|
@@ -49,38 +59,41 @@ module SocialStream
|
|
49
59
|
|
50
60
|
|
51
61
|
def remove_buddy
|
52
|
-
|
53
|
-
unless SocialStream::Presence.enable
|
54
|
-
return
|
55
|
-
end
|
56
|
-
|
57
|
-
unless self.receiver and self.sender
|
58
|
-
return
|
59
|
-
end
|
60
|
-
|
61
|
-
unless self.receiver.subject_type == "User" and self.sender.subject_type == "User"
|
62
|
-
return
|
63
|
-
end
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
#
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
62
|
+
#
|
63
|
+
# unless SocialStream::Presence.enable
|
64
|
+
# return
|
65
|
+
# end
|
66
|
+
#
|
67
|
+
# unless self.receiver and self.sender
|
68
|
+
# return
|
69
|
+
# end
|
70
|
+
#
|
71
|
+
# unless self.receiver.subject_type == "User" and self.sender.subject_type == "User"
|
72
|
+
# return
|
73
|
+
# end
|
74
|
+
#
|
75
|
+
# if self.contact.established?
|
76
|
+
# return
|
77
|
+
# end
|
78
|
+
#
|
79
|
+
# #XMPP DOMAIN
|
80
|
+
# domain = SocialStream::Presence.domain
|
81
|
+
# user_sid = self.sender.slug + "@" + domain
|
82
|
+
# user_name = self.sender.name
|
83
|
+
# buddy_sid = self.receiver.slug + "@" + domain
|
84
|
+
#
|
85
|
+
# #Check if is a positive and replied tie
|
86
|
+
# if self.bidirectional?
|
87
|
+
# #Execute unsetRosterForBidirectionalTie(user_sid,oldfriend_sid,oldfriendNick,oldfriendGroup)
|
88
|
+
# SocialStream::Presence::XmppServerOrder::unsetRosterForBidirectionalTie(buddy_sid,user_sid,user_name,"SocialStream")
|
89
|
+
# elsif self.positive?
|
90
|
+
# #Case: Possitive tie unidirectional
|
91
|
+
# #Execute removeBuddyFromRoster(user_sid,buddy_sid)
|
92
|
+
# SocialStream::Presence::XmppServerOrder::removeBuddyFromRoster(user_sid,buddy_sid)
|
93
|
+
# else
|
94
|
+
# return
|
95
|
+
# end
|
96
|
+
#
|
84
97
|
end
|
85
98
|
|
86
99
|
end
|
@@ -28,43 +28,7 @@ module SocialStream
|
|
28
28
|
|
29
29
|
def removeBuddyFromRoster(userSid,buddySid)
|
30
30
|
executeEmanagementCommand("removeBuddyFromRoster",[userSid,buddySid])
|
31
|
-
end
|
32
|
-
|
33
|
-
|
34
|
-
#Before delete contact (destroy ties) callback
|
35
|
-
def removeBuddy(contact)
|
36
|
-
|
37
|
-
unless SocialStream::Presence.enable
|
38
|
-
return
|
39
|
-
end
|
40
|
-
|
41
|
-
unless contact.receiver and contact.sender
|
42
|
-
return
|
43
|
-
end
|
44
|
-
|
45
|
-
unless contact.receiver.subject_type == "User" and contact.sender.subject_type == "User"
|
46
|
-
return
|
47
|
-
end
|
48
|
-
|
49
|
-
#XMPP DOMAIN
|
50
|
-
domain = SocialStream::Presence.domain
|
51
|
-
user_sid = contact.sender.slug + "@" + domain
|
52
|
-
user_name = contact.sender.name
|
53
|
-
buddy_sid = contact.receiver.slug + "@" + domain
|
54
|
-
buddy_name = contact.receiver.name
|
55
|
-
|
56
|
-
#Check for bidirecctional
|
57
|
-
|
58
|
-
if contact.sender.contact_actors(:type=>:user).include?(contact.receiver)
|
59
|
-
#Bidirectional contacts
|
60
|
-
#Execute unsetRosterForBidirectionalTie(user_sid,oldfriend_sid,oldfriendNick,oldfriendGroup)
|
61
|
-
unsetRosterForBidirectionalTie(buddy_sid,user_sid,user_name,"SocialStream")
|
62
|
-
elsif contact.sender.contact_actors(:type=>:user, :direction=>:sent).include?(contact.receiver)
|
63
|
-
#Unidirectional contacts
|
64
|
-
removeBuddyFromRoster(user_sid,buddy_sid)
|
65
|
-
end
|
66
|
-
|
67
|
-
end
|
31
|
+
end
|
68
32
|
|
69
33
|
|
70
34
|
def synchronizePresence
|
@@ -176,22 +140,24 @@ module SocialStream
|
|
176
140
|
end
|
177
141
|
|
178
142
|
def executeCommand(command)
|
179
|
-
|
180
|
-
if SocialStream::Presence.remote_xmpp_server
|
181
|
-
output = executeRemoteCommand(command)
|
182
|
-
else
|
183
|
-
#SocialStream::Presence.remote_xmpp_server=false
|
184
|
-
output = executeLocalCommand(command)
|
185
|
-
end
|
143
|
+
output = executeCommands([command])
|
186
144
|
return output
|
187
145
|
end
|
188
146
|
|
189
147
|
def executeCommands(commands)
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
148
|
+
if commands.length > 1
|
149
|
+
puts "Executing the following commands:"
|
150
|
+
commands.each do |command|
|
151
|
+
puts command
|
152
|
+
end
|
153
|
+
puts "Command list finish"
|
154
|
+
elsif commands.length == 1
|
155
|
+
puts "Executing " + commands[0]
|
156
|
+
else
|
157
|
+
puts "No command to execute"
|
158
|
+
return
|
159
|
+
end
|
160
|
+
|
195
161
|
if SocialStream::Presence.remote_xmpp_server
|
196
162
|
output = executeRemoteCommands(commands)
|
197
163
|
else
|
@@ -200,10 +166,6 @@ module SocialStream
|
|
200
166
|
end
|
201
167
|
return output
|
202
168
|
end
|
203
|
-
|
204
|
-
def executeLocalCommand(command)
|
205
|
-
return executeLocalCommands([command])
|
206
|
-
end
|
207
169
|
|
208
170
|
def executeLocalCommands(commands)
|
209
171
|
output="No command received";
|
@@ -213,17 +175,33 @@ module SocialStream
|
|
213
175
|
return output
|
214
176
|
end
|
215
177
|
|
216
|
-
def executeRemoteCommand(command)
|
217
|
-
return executeRemoteCommands([command])
|
218
|
-
end
|
219
|
-
|
220
178
|
def executeRemoteCommands(commands)
|
221
179
|
output="No command received";
|
222
|
-
|
223
|
-
|
224
|
-
|
180
|
+
|
181
|
+
begin
|
182
|
+
if SocialStream::Presence.ssh_password
|
183
|
+
Net::SSH.start( SocialStream::Presence.ssh_domain, SocialStream::Presence.ssh_user, :password => SocialStream::Presence.ssh_password, :auth_methods => ["password"]) do |session|
|
184
|
+
commands.each do |command|
|
185
|
+
output = session.exec!(command)
|
186
|
+
end
|
187
|
+
end
|
188
|
+
else
|
189
|
+
#SSH with authentication key instead of password
|
190
|
+
Net::SSH.start( SocialStream::Presence.ssh_domain, SocialStream::Presence.ssh_user) do |session|
|
191
|
+
commands.each do |command|
|
192
|
+
output = session.exec!(command)
|
193
|
+
end
|
194
|
+
end
|
225
195
|
end
|
226
|
-
|
196
|
+
rescue Exception => e
|
197
|
+
case e
|
198
|
+
when Net::SSH::AuthenticationFailed
|
199
|
+
output = "AuthenticationFailed on remote access"
|
200
|
+
else
|
201
|
+
output = "Unknown exception in executeRemoteCommands method: #{e.to_s}"
|
202
|
+
end
|
203
|
+
end
|
204
|
+
|
227
205
|
return output
|
228
206
|
end
|
229
207
|
|
data/social_stream.gemspec
CHANGED
@@ -11,7 +11,7 @@ Gem::Specification.new do |s|
|
|
11
11
|
s.files = `git ls-files`.split("\n")
|
12
12
|
|
13
13
|
# Gem dependencies
|
14
|
-
s.add_runtime_dependency('social_stream-base', '~> 0.9.
|
14
|
+
s.add_runtime_dependency('social_stream-base', '~> 0.9.26')
|
15
15
|
s.add_runtime_dependency('social_stream-documents', '~> 0.4.2')
|
16
16
|
s.add_runtime_dependency('social_stream-events', '~> 0.0.17')
|
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
|
- 12
|
9
|
-
-
|
10
|
-
version: 0.12.
|
9
|
+
- 3
|
10
|
+
version: 0.12.3
|
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: 15
|
31
31
|
segments:
|
32
32
|
- 0
|
33
33
|
- 9
|
34
|
-
-
|
35
|
-
version: 0.9.
|
34
|
+
- 26
|
35
|
+
version: 0.9.26
|
36
36
|
type: :runtime
|
37
37
|
version_requirements: *id001
|
38
38
|
- !ruby/object:Gem::Dependency
|