social_stream 0.12.2 → 0.12.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -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
 
@@ -1,5 +1,5 @@
1
1
  module SocialStream
2
2
  module Base
3
- VERSION = "0.9.25".freeze
3
+ VERSION = "0.9.26".freeze
4
4
  end
5
5
  end
@@ -1,4 +1,3 @@
1
- <!--
2
1
  /*
3
2
  Screw - A jQuery plugin
4
3
  ==================================================================
@@ -185,4 +184,3 @@
185
184
  });
186
185
 
187
186
  })(jQuery);
188
- -->
@@ -1,3 +1,3 @@
1
1
  module SocialStream
2
- VERSION = "0.12.2".freeze
2
+ VERSION = "0.12.3".freeze
3
3
  end
@@ -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
- #XMPP DOMAIN
66
- domain = SocialStream::Presence.domain
67
- user_sid = self.sender.slug + "@" + domain
68
- user_name = self.sender.name
69
- buddy_sid = self.receiver.slug + "@" + domain
70
- buddy_name = self.receiver.name
71
-
72
- #Check if is a positive and replied tie
73
- if self.bidirectional?
74
- #Execute unsetRosterForBidirectionalTie(user_sid,oldfriend_sid,oldfriendNick,oldfriendGroup)
75
- SocialStream::Presence::XmppServerOrder::unsetRosterForBidirectionalTie(buddy_sid,user_sid,user_name,"SocialStream")
76
- elsif self.positive?
77
- #Case: Possitive tie unidirectional
78
- #Execute removeBuddyFromRoster(user_sid,buddy_sid)
79
- SocialStream::Presence::XmppServerOrder::removeBuddyFromRoster(user_sid,buddy_sid)
80
- else
81
- return
82
- end
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
@@ -1,5 +1,5 @@
1
1
  module Socialstream
2
2
  module Presence
3
- VERSION = "0.0.18"
3
+ VERSION = "0.0.20"
4
4
  end
5
5
  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
- puts "Executing " + command
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
- puts "Executing the following commands:"
191
- commands.each do |command|
192
- puts command
193
- end
194
- puts "Command list finish"
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
- Net::SSH.start( SocialStream::Presence.ssh_domain, SocialStream::Presence.ssh_user, :password => SocialStream::Presence.ssh_password, :auth_methods => ["password"]) do |session|
223
- commands.each do |command|
224
- output = session.exec!(command)
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
- end
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
 
@@ -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.25')
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: 43
4
+ hash: 41
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 12
9
- - 2
10
- version: 0.12.2
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: 9
30
+ hash: 15
31
31
  segments:
32
32
  - 0
33
33
  - 9
34
- - 25
35
- version: 0.9.25
34
+ - 26
35
+ version: 0.9.26
36
36
  type: :runtime
37
37
  version_requirements: *id001
38
38
  - !ruby/object:Gem::Dependency