c3s 0.4.5 → 0.4.6

Sign up to get free protection for your applications and to get access to all the features.
data/Manifest CHANGED
@@ -1,6 +1,5 @@
1
1
  README.rdoc
2
2
  Rakefile
3
- c3s.gemspec
4
3
  lib/c3s.rb
5
4
  lib/c3s_logger.rb
6
5
  lib/component.rb
data/Rakefile CHANGED
@@ -2,7 +2,7 @@ require 'rubygems'
2
2
  require 'rake'
3
3
  require 'echoe'
4
4
 
5
- Echoe.new('c3s', '0.4.5') do |p|
5
+ Echoe.new('c3s', '0.4.6') do |p|
6
6
  p.description = "C3s library gem."
7
7
  p.url = "http://github.com/rikas/c3s"
8
8
  p.author = "Ricardo Otero"
data/c3s.gemspec CHANGED
@@ -2,15 +2,15 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{c3s}
5
- s.version = "0.4.5"
5
+ s.version = "0.4.6"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Ricardo Otero"]
9
- s.date = %q{2010-11-10}
9
+ s.date = %q{2010-11-22}
10
10
  s.description = %q{C3s library gem.}
11
11
  s.email = %q{oterosantos@gmail.com}
12
12
  s.extra_rdoc_files = ["README.rdoc", "lib/c3s.rb", "lib/c3s_logger.rb", "lib/component.rb", "lib/component_connection.rb", "lib/configreader.rb", "lib/databaseadapter.rb", "lib/model.rb", "lib/pubsub/node.rb", "lib/pubsub/nodetracker.rb", "lib/pubsub/publisher.rb", "lib/pubsub/subscriber.rb", "lib/republisher.rb"]
13
- s.files = ["README.rdoc", "Rakefile", "lib/c3s.rb", "lib/c3s_logger.rb", "lib/component.rb", "lib/component_connection.rb", "lib/configreader.rb", "lib/databaseadapter.rb", "lib/model.rb", "lib/pubsub/node.rb", "lib/pubsub/nodetracker.rb", "lib/pubsub/publisher.rb", "lib/pubsub/subscriber.rb", "lib/republisher.rb", "Manifest", "c3s.gemspec"]
13
+ s.files = ["README.rdoc", "Rakefile", "c3s.gemspec", "lib/c3s.rb", "lib/c3s_logger.rb", "lib/component.rb", "lib/component_connection.rb", "lib/configreader.rb", "lib/databaseadapter.rb", "lib/model.rb", "lib/pubsub/node.rb", "lib/pubsub/nodetracker.rb", "lib/pubsub/publisher.rb", "lib/pubsub/subscriber.rb", "lib/republisher.rb", "Manifest"]
14
14
  s.homepage = %q{http://github.com/rikas/c3s}
15
15
  s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "C3s", "--main", "README.rdoc"]
16
16
  s.require_paths = ["lib"]
data/lib/c3s.rb CHANGED
@@ -27,7 +27,7 @@ rescue Exception => e
27
27
  end
28
28
 
29
29
  module C3s
30
- VERSION = "0.4.5"
30
+ VERSION = "0.4.6"
31
31
 
32
32
  def self.included(base)
33
33
  base.extend ClassMethods
data/lib/component.rb CHANGED
@@ -107,6 +107,7 @@ module C3s
107
107
  # iq:: [Jabber::IQ] the received IQ packet
108
108
  def handle_set(iq)
109
109
  stanza = iq.query.first_element(config['name']) # TODO assuming that pubsubnode = xml root
110
+ root_node = stanza
110
111
  data = {}
111
112
 
112
113
  # It's admin setting the information for someone
@@ -140,7 +141,7 @@ module C3s
140
141
  if object.errors.count == 0
141
142
  $LOG.info "Publishing data to node #{config['name']}:#{data[:jid]} (data changed: #{changed})"
142
143
  c3snode = C3s::Node.new("#{config['name']}:#{data[:jid]}")
143
- self.publish_to_pubsub(c3snode, stanza, changed)
144
+ self.publish_to_pubsub(c3snode, object.to_xml, changed)
144
145
  send_ok(iq)
145
146
  end
146
147
 
data/lib/model.rb CHANGED
@@ -69,6 +69,7 @@ module C3sModel
69
69
  # options:: [Hash] options
70
70
  def to_xml(options={})
71
71
  xml = first_element(options)
72
+ xml.add_attribute('xmlns', self.xmlns)
72
73
  self.attributes.each do |key, val|
73
74
  # Don't include ignored attributes or foreign keys
74
75
  if !IGNORE_ATTR.include?(key) && !key.match(/.+_id/)
data/lib/republisher.rb CHANGED
@@ -17,7 +17,9 @@ module C3s
17
17
  # will receive context.
18
18
  def connect
19
19
  super
20
- #subscribe_nodes()
20
+ if config['subscribe_nodes']
21
+ subscribe_nodes()
22
+ end
21
23
  end
22
24
 
23
25
  ##
@@ -56,13 +58,13 @@ module C3s
56
58
  event.each_element("//items/") do |items|
57
59
  c3snode = C3s::Node.new(items.attributes['node'])
58
60
  next unless c3snode
59
- handle_items_publication(items)
61
+ handle_items_publication(c3snode, items)
60
62
  end
61
63
  end
62
64
 
63
65
  ##
64
66
  # Handles the publicated items and the republishing on new node(s)
65
- def handle_items_publication(items)
67
+ def handle_items_publication(c3snode, items)
66
68
  items.each_element("//item/") do |item|
67
69
  begin
68
70
  c3snode.provider = config['name'] # TODO - assuming that provider_name.eql?(pubsub_root_nodes)
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: c3s
3
3
  version: !ruby/object:Gem::Version
4
- hash: 5
4
+ hash: 3
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 4
9
- - 5
10
- version: 0.4.5
9
+ - 6
10
+ version: 0.4.6
11
11
  platform: ruby
12
12
  authors:
13
13
  - Ricardo Otero
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-11-10 00:00:00 +00:00
18
+ date: 2010-11-22 00:00:00 +00:00
19
19
  default_executable:
20
20
  dependencies: []
21
21
 
@@ -42,6 +42,7 @@ extra_rdoc_files:
42
42
  files:
43
43
  - README.rdoc
44
44
  - Rakefile
45
+ - c3s.gemspec
45
46
  - lib/c3s.rb
46
47
  - lib/c3s_logger.rb
47
48
  - lib/component.rb
@@ -55,7 +56,6 @@ files:
55
56
  - lib/pubsub/subscriber.rb
56
57
  - lib/republisher.rb
57
58
  - Manifest
58
- - c3s.gemspec
59
59
  has_rdoc: true
60
60
  homepage: http://github.com/rikas/c3s
61
61
  licenses: []