social_stream-presence 0.8.2 → 0.8.3

Sign up to get free protection for your applications and to get access to all the features.
Binary file
@@ -19,16 +19,10 @@ def log(text)
19
19
  $logger.info "SetWebDomain Script: " + text
20
20
  end
21
21
 
22
- $debug = true
23
22
 
24
23
  #Config files
25
- if($debug)
26
- $ssconfig = '/etc/ejabberd/test/ssconfig.cfg'
27
- $ejabberd = '/etc/ejabberd/test/ejabberd.cfg'
28
- else
29
- $ssconfig = '/etc/ejabberd/ssconfig.cfg'
30
- $ejabberd = '/etc/ejabberd/ejabberd.cfg'
31
- end
24
+ $ssconfig = '/etc/ejabberd/ssconfig.cfg'
25
+ $ejabberd = '/etc/ejabberd/ejabberd.cfg'
32
26
 
33
27
  $domain_not_exists = "Domain don't exists"
34
28
  $domain_exists = "Domain already exists"
@@ -23,7 +23,7 @@ module SocialStream
23
23
  return
24
24
  end
25
25
 
26
- #XMPP DOMAIN
26
+ #WEB DOMAIN
27
27
  domain = SocialStream::Presence.domain
28
28
  user_sid = self.sender.slug + "@" + domain
29
29
  user_name = self.sender.name
@@ -1,5 +1,5 @@
1
1
  module SocialStream
2
2
  module Presence
3
- VERSION = "0.8.2"
3
+ VERSION = "0.8.3"
4
4
  end
5
5
  end
@@ -1,8 +1,3 @@
1
- require 'xmpp4r'
2
- require 'xmpp4r/muc'
3
- require 'xmpp4r/roster'
4
- require 'xmpp4r/client'
5
- require 'xmpp4r/message'
6
1
  require 'net/ssh'
7
2
  require 'net/sftp'
8
3
 
@@ -218,7 +213,7 @@ module SocialStream
218
213
  autoconf.push("ejabberd_password=" + SocialStream::Presence.xmpp_server_password)
219
214
  autoconf.push("secure_rest_api=" + SocialStream::Presence.secure_rest_api.to_s)
220
215
  autoconf.push("cookie_name=" + Rails.application.config.session_options[:key])
221
- autoconf.push("web_domains=[" + SocialStream::Presence.config.domain + "]")
216
+ autoconf.push("web_domains=[" + SocialStream::Presence.domain + "]")
222
217
 
223
218
  #Param options
224
219
  if options
@@ -540,8 +535,7 @@ module SocialStream
540
535
  return hash
541
536
  end
542
537
 
543
-
544
-
538
+
545
539
  #Multidomain tasks
546
540
  def addWebDomain(domain,url)
547
541
  commands = []
@@ -568,45 +562,7 @@ module SocialStream
568
562
  end
569
563
  return executeCommands(commands)
570
564
  end
571
-
572
-
573
- #Xmpp client manage methods
574
-
575
- def getSocialStreamUserSid
576
- #WEB DOMAIN
577
- domain = SocialStream::Presence.domain
578
- #SS Username
579
- ss_name = SocialStream::Presence.social_stream_presence_username
580
- return ss_name + "@" + domain
581
- end
582
-
583
-
584
- def openXmppClientForSocialStreamUser
585
- begin
586
- password= SocialStream::Presence.password
587
- client = Jabber::Client.new(Jabber::JID.new(getSocialStreamUserSid))
588
- client.connect
589
- client.auth(password)
590
- return client
591
- rescue Exception => e
592
- case e
593
- when Errno::ECONNREFUSED
594
- puts "Connection to XMPP Server refused"
595
- return nil
596
- else
597
- puts "Unknown exception: #{e.to_s}"
598
- return nil
599
- end
600
- end
601
- end
602
-
603
-
604
- def sendXmppChatMessage(client,dest_sid,body)
605
- msg = Jabber::Message::new(dest_sid, body)
606
- msg.type=:chat
607
- client.send(msg)
608
- end
609
-
565
+
610
566
  end
611
567
  end
612
568
  end
@@ -0,0 +1,54 @@
1
+ require 'xmpp4r'
2
+ require 'xmpp4r/muc'
3
+ require 'xmpp4r/roster'
4
+ require 'xmpp4r/client'
5
+ require 'xmpp4r/message'
6
+
7
+
8
+ module SocialStream
9
+ module Presence
10
+ class XmppSsclient
11
+
12
+ class << self
13
+
14
+ #Xmpp client manage methods
15
+
16
+ def getSocialStreamUserSid
17
+ #WEB DOMAIN
18
+ domain = SocialStream::Presence.domain
19
+ #SS Username
20
+ ss_name = SocialStream::Presence.social_stream_presence_username
21
+ return ss_name + "@" + domain
22
+ end
23
+
24
+
25
+ def openXmppClientForSocialStreamUser
26
+ begin
27
+ password= SocialStream::Presence.password
28
+ client = Jabber::Client.new(Jabber::JID.new(getSocialStreamUserSid))
29
+ client.connect
30
+ client.auth(password)
31
+ return client
32
+ rescue Exception => e
33
+ case e
34
+ when Errno::ECONNREFUSED
35
+ puts "Connection to XMPP Server refused"
36
+ return nil
37
+ else
38
+ puts "Unknown exception: #{e.to_s}"
39
+ return nil
40
+ end
41
+ end
42
+ end
43
+
44
+
45
+ def sendXmppChatMessage(client,dest_sid,body)
46
+ msg = Jabber::Message::new(dest_sid, body)
47
+ msg.type=:chat
48
+ client.send(msg)
49
+ end
50
+
51
+ end
52
+ end
53
+ end
54
+ end
metadata CHANGED
@@ -1,8 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: social_stream-presence
3
3
  version: !ruby/object:Gem::Version
4
- prerelease:
5
- version: 0.8.2
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 8
8
+ - 3
9
+ version: 0.8.3
6
10
  platform: ruby
7
11
  authors:
8
12
  - Aldo Gordillo
@@ -10,7 +14,7 @@ autorequire:
10
14
  bindir: bin
11
15
  cert_chain: []
12
16
 
13
- date: 2012-02-27 00:00:00 +01:00
17
+ date: 2012-02-28 00:00:00 +01:00
14
18
  default_executable:
15
19
  dependencies:
16
20
  - !ruby/object:Gem::Dependency
@@ -21,6 +25,10 @@ dependencies:
21
25
  requirements:
22
26
  - - ~>
23
27
  - !ruby/object:Gem::Version
28
+ segments:
29
+ - 0
30
+ - 16
31
+ - 2
24
32
  version: 0.16.2
25
33
  type: :runtime
26
34
  version_requirements: *id001
@@ -32,6 +40,8 @@ dependencies:
32
40
  requirements:
33
41
  - - ">="
34
42
  - !ruby/object:Gem::Version
43
+ segments:
44
+ - 0
35
45
  version: "0"
36
46
  type: :runtime
37
47
  version_requirements: *id002
@@ -43,6 +53,8 @@ dependencies:
43
53
  requirements:
44
54
  - - ">="
45
55
  - !ruby/object:Gem::Version
56
+ segments:
57
+ - 0
46
58
  version: "0"
47
59
  type: :runtime
48
60
  version_requirements: *id003
@@ -54,6 +66,8 @@ dependencies:
54
66
  requirements:
55
67
  - - ">="
56
68
  - !ruby/object:Gem::Version
69
+ segments:
70
+ - 0
57
71
  version: "0"
58
72
  type: :runtime
59
73
  version_requirements: *id004
@@ -65,6 +79,8 @@ dependencies:
65
79
  requirements:
66
80
  - - ">="
67
81
  - !ruby/object:Gem::Version
82
+ segments:
83
+ - 0
68
84
  version: "0"
69
85
  type: :development
70
86
  version_requirements: *id005
@@ -162,6 +178,7 @@ files:
162
178
  - lib/social_stream/presence/models/buddy_manager.rb
163
179
  - lib/social_stream/presence/version.rb
164
180
  - lib/social_stream/presence/xmpp_server_order.rb
181
+ - lib/social_stream/presence/xmpp_ssclient.rb
165
182
  - lib/social_stream/views/settings/presence.rb
166
183
  - lib/tasks/presence/installer.rake
167
184
  - lib/tasks/presence/multidomain.rake
@@ -238,17 +255,21 @@ required_ruby_version: !ruby/object:Gem::Requirement
238
255
  requirements:
239
256
  - - ">="
240
257
  - !ruby/object:Gem::Version
258
+ segments:
259
+ - 0
241
260
  version: "0"
242
261
  required_rubygems_version: !ruby/object:Gem::Requirement
243
262
  none: false
244
263
  requirements:
245
264
  - - ">="
246
265
  - !ruby/object:Gem::Version
266
+ segments:
267
+ - 0
247
268
  version: "0"
248
269
  requirements: []
249
270
 
250
271
  rubyforge_project: social_stream-presence
251
- rubygems_version: 1.6.1
272
+ rubygems_version: 1.3.7
252
273
  signing_key:
253
274
  specification_version: 3
254
275
  summary: Presence capabilities for Social Stream, the core for building social network websites