mojodna-switchboard 0.0.6 → 0.0.7

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/README.markdown CHANGED
@@ -9,6 +9,12 @@ Install it:
9
9
 
10
10
  $ sudo gem install mojodna-switchboard -s http://gems.github.com
11
11
 
12
+ Install optional dependencies for additional functionality:
13
+
14
+ $ sudo gem install oauth # (for OAuth PubSub support)
15
+ $ sudo gem install fire-hydrant # (for User Location support)
16
+ $ sudo gem install rb-appscript # (for User Tune support)
17
+
12
18
  Configure it:
13
19
 
14
20
  $ switchboard config jid jid@example.com
data/Rakefile CHANGED
@@ -3,6 +3,7 @@ require File.join("lib", "switchboard", "version")
3
3
  desc "Generate the gemspec"
4
4
  task :gemspec do
5
5
  gemspec =<<-EOF
6
+ # this file is automatically generated
6
7
  Gem::Specification.new do |s|
7
8
  s.name = "switchboard"
8
9
  s.version = "#{Switchboard::VERSION * "."}"
@@ -16,9 +17,6 @@ Gem::Specification.new do |s|
16
17
  s.require_paths = ["lib"]
17
18
 
18
19
  s.add_dependency("xmpp4r")
19
- s.add_dependency("oauth")
20
- s.add_dependency("rb-appscript")
21
-
22
20
  end
23
21
  EOF
24
22
 
@@ -24,29 +24,9 @@ module Switchboard
24
24
  end
25
25
  end
26
26
 
27
- def on_roster_presence(&block)
28
- register_hook(:roster_presence, &block)
29
- end
30
-
31
- def on_roster_query(&block)
32
- register_hook(:roster_query, &block)
33
- end
34
-
35
- def on_roster_subscription(&block)
36
- register_hook(:roster_subscription, &block)
37
- end
38
-
39
- def on_roster_subscription_request(&block)
40
- register_hook(:roster_subscription_request, &block)
41
- end
42
-
43
- def on_roster_loaded(&block)
44
- register_hook(:roster_loaded, &block)
45
- end
46
-
47
- def on_roster_update(&block)
48
- register_hook(:roster_update, &block)
49
- end
27
+ hook \
28
+ :roster_presence, :roster_query, :roster_subscription,
29
+ :roster_subscription_request, :roster_loaded, :roster_update
50
30
 
51
31
  protected
52
32
 
@@ -66,7 +46,7 @@ module Switchboard
66
46
 
67
47
  def disconnect!
68
48
  presence(:unavailable)
69
- client.close
49
+ super
70
50
  end
71
51
 
72
52
  def presence(status = nil, to = nil)
@@ -0,0 +1,96 @@
1
+ require 'rubygems'
2
+ require 'xmpp4r/location'
3
+
4
+ module Switchboard
5
+ module Commands
6
+ class PEP
7
+ class Location < Switchboard::Command
8
+ description "Broadcasting UserLocation (XEP-0080)"
9
+
10
+ def self.run!
11
+ begin
12
+ require 'fire_hydrant'
13
+ rescue LoadError => e
14
+ gem = e.message.split("--").last.strip
15
+ puts "The #{gem} gem is required for this command to work."
16
+ exit 1
17
+ end
18
+
19
+ switchboard = Switchboard::Client.new
20
+ switchboard.plug!(AutoAcceptJack, FireEagleJack)
21
+
22
+ switchboard.on_startup do
23
+ @location_helper = Jabber::UserLocation::Helper.new(client, nil)
24
+ end
25
+
26
+ switchboard.on_location_update do |user|
27
+ # for some reason the Fire Eagle gem doesn't work when I access #name directly
28
+ name = user.locations[0].instance_eval { @doc.at("//name").innerText }
29
+ timestamp = Time.parse(user.locations[0].instance_eval { @doc.at("//located-at").innerText })
30
+
31
+ area, postalcode, locality, region, country = nil
32
+
33
+ user.locations.each do |loc|
34
+ level = loc.instance_eval { @doc.at("//level-name").innerText }
35
+ normal_name = loc.instance_eval { @doc.at("//normal-name").innerText }
36
+ case level
37
+ when "exact"
38
+ street = normal_name
39
+ when "postal"
40
+ postalcode = normal_name
41
+ when "neighborhood"
42
+ area = normal_name
43
+ when "city"
44
+ locality = normal_name
45
+ when "state"
46
+ region = normal_name
47
+ when "country"
48
+ country = normal_name
49
+ end
50
+ puts "level: #{level}"
51
+ end
52
+
53
+ puts "Current location: #{name}."
54
+
55
+ geom = user.locations[0].geom
56
+ if geom.is_a?(GeoRuby::SimpleFeatures::Envelope)
57
+ pt = geom.center
58
+ accuracy = geom.upper_corner.spherical_distance(geom.lower_corner) / 2
59
+ else
60
+ pt = geom
61
+ accuracy = 0
62
+ end
63
+
64
+ location = Jabber::UserLocation::Location.new \
65
+ "accuracy" => accuracy,
66
+ "area" => area,
67
+ "country" => country,
68
+ "description" => name,
69
+ "lat" => pt.lat,
70
+ "locality" => locality,
71
+ "lon" => pt.lon,
72
+ "postalcode" => postalcode,
73
+ "region" => region,
74
+ "street" => street,
75
+ "timestamp" => timestamp
76
+
77
+ # parsing thread is still running, so the send needs to be deferred
78
+ defer :location_sent do
79
+ @location_helper.current_location(location)
80
+ end
81
+ end
82
+
83
+ switchboard.on_shutdown do
84
+ begin
85
+ @location_helper.stop_publishing
86
+ rescue Jabber::ServerError => e
87
+ puts e
88
+ end
89
+ end
90
+
91
+ switchboard.run!
92
+ end
93
+ end
94
+ end
95
+ end
96
+ end
@@ -1,10 +1,4 @@
1
- begin
2
- require 'appscript'
3
- rescue LoadError => e
4
- gem = e.message.split("--").last.strip
5
- puts "The #{gem} gem is required."
6
- exit 1
7
- end
1
+ require 'rubygems'
8
2
  require 'xmpp4r/tune'
9
3
 
10
4
  module Switchboard
@@ -14,6 +8,14 @@ module Switchboard
14
8
  description "Broadcasting UserTune (XEP-0118)"
15
9
 
16
10
  def self.run!
11
+ begin
12
+ require 'appscript'
13
+ rescue LoadError => e
14
+ gem = e.message.split("--").last.strip
15
+ puts "The #{gem} gem is required for this command to work."
16
+ exit 1
17
+ end
18
+
17
19
  switchboard = Switchboard::Client.new do
18
20
  @tune_helper = Jabber::UserTune::Helper.new(client, nil)
19
21
 
@@ -1,2 +1,3 @@
1
1
  require 'switchboard/commands/pep/pep'
2
+ require 'switchboard/commands/pep/location'
2
3
  require 'switchboard/commands/pep/tune'
@@ -21,7 +21,7 @@ module Switchboard
21
21
  end
22
22
  end
23
23
 
24
- if OPTIONS["oauth"]
24
+ if defined?(OAuth) && OPTIONS["oauth"]
25
25
  switchboard.plug!(OAuthPubSubJack)
26
26
  else
27
27
  switchboard.plug!(PubSubJack)
@@ -29,7 +29,7 @@ module Switchboard
29
29
  end
30
30
  end
31
31
 
32
- if OPTIONS["oauth"]
32
+ if defined?(OAuth) && OPTIONS["oauth"]
33
33
  switchboard.plug!(OAuthPubSubJack)
34
34
  else
35
35
  switchboard.plug!(PubSubJack)
@@ -28,7 +28,7 @@ module Switchboard
28
28
  end
29
29
  end
30
30
 
31
- if OPTIONS["oauth"]
31
+ if defined?(OAuth) && OPTIONS["oauth"]
32
32
  switchboard.plug!(OAuthPubSubJack)
33
33
  else
34
34
  switchboard.plug!(PubSubJack)
@@ -19,7 +19,7 @@ module Switchboard
19
19
  end
20
20
  end
21
21
 
22
- if OPTIONS["oauth"]
22
+ if defined?(OAuth) && OPTIONS["oauth"]
23
23
  switchboard.plug!(OAuthPubSubJack)
24
24
  else
25
25
  switchboard.plug!(PubSubJack)
@@ -35,7 +35,7 @@ module Switchboard
35
35
  end
36
36
  end
37
37
 
38
- if OPTIONS["oauth"]
38
+ if defined?(OAuth) && OPTIONS["oauth"]
39
39
  switchboard.plug!(OAuthPubSubJack)
40
40
  else
41
41
  switchboard.plug!(PubSubJack)
@@ -27,7 +27,7 @@ module Switchboard
27
27
  end
28
28
  end
29
29
 
30
- if OPTIONS["oauth"]
30
+ if defined?(OAuth) && OPTIONS["oauth"]
31
31
  switchboard.plug!(OAuthPubSubJack)
32
32
  else
33
33
  switchboard.plug!(PubSubJack)
@@ -24,7 +24,7 @@ module Switchboard
24
24
  end
25
25
  end
26
26
 
27
- if OPTIONS["oauth"]
27
+ if defined?(OAuth) && OPTIONS["oauth"]
28
28
  switchboard.plug!(OAuthPubSubJack)
29
29
  else
30
30
  switchboard.plug!(PubSubJack)
@@ -27,7 +27,7 @@ module Switchboard
27
27
  end
28
28
  end
29
29
 
30
- if OPTIONS["oauth"]
30
+ if defined?(OAuth) && OPTIONS["oauth"]
31
31
  switchboard.plug!(OAuthPubSubJack)
32
32
  else
33
33
  switchboard.plug!(PubSubJack)
@@ -30,7 +30,7 @@ module Switchboard
30
30
  end
31
31
  end
32
32
 
33
- if OPTIONS["oauth"]
33
+ if defined?(OAuth) && OPTIONS["oauth"]
34
34
  switchboard.plug!(OAuthPubSubJack)
35
35
  else
36
36
  switchboard.plug!(PubSubJack)
@@ -11,11 +11,13 @@ module Switchboard
11
11
  super(opts)
12
12
  opts.on("--node=node", String, "Specifies the PubSub node to use.") { |v| OPTIONS["pubsub.node"] = v }
13
13
  opts.on("--server=server", String, "Specifies the PubSub server to use.") { |v| OPTIONS["pubsub.server"] = v }
14
- opts.on("--oauth", "Sign requests using OAuth.") { OPTIONS["oauth"] = true }
15
- opts.on("--oauth-consumer-key=key", String, "Specifies the OAuth consumer key to use.") { |v| OPTIONS["oauth.consumer_key"] = v }
16
- opts.on("--oauth-consumer-secret=secret", String, "Specifies the OAuth consumer secret to use.") { |v| OPTIONS["oauth.consumer_secret"] = v }
17
- opts.on("--oauth-token =oken", String, "Specifies the OAuth token to use.") { |v| OPTIONS["oauth.token"] = v }
18
- opts.on("--oauth-token-secret=secret", String, "Specifies the OAuth token secret to use.") { |v| OPTIONS["oauth.token_secret"] = v }
14
+ if defined?(OAuth)
15
+ opts.on("--oauth", "Sign requests using OAuth.") { OPTIONS["oauth"] = true }
16
+ opts.on("--oauth-consumer-key=key", String, "Specifies the OAuth consumer key to use.") { |v| OPTIONS["oauth.consumer_key"] = v }
17
+ opts.on("--oauth-consumer-secret=secret", String, "Specifies the OAuth consumer secret to use.") { |v| OPTIONS["oauth.consumer_secret"] = v }
18
+ opts.on("--oauth-token =oken", String, "Specifies the OAuth token to use.") { |v| OPTIONS["oauth.token"] = v }
19
+ opts.on("--oauth-token-secret=secret", String, "Specifies the OAuth token secret to use.") { |v| OPTIONS["oauth.token_secret"] = v }
20
+ end
19
21
  end
20
22
  end
21
23
  end
@@ -19,7 +19,7 @@ module Switchboard
19
19
  end
20
20
  end
21
21
 
22
- if OPTIONS["oauth"]
22
+ if defined?(OAuth) && OPTIONS["oauth"]
23
23
  switchboard.plug!(OAuthPubSubJack)
24
24
  else
25
25
  switchboard.plug!(PubSubJack)
@@ -21,7 +21,7 @@ module Switchboard
21
21
  end
22
22
  end
23
23
 
24
- if OPTIONS["oauth"]
24
+ if defined?(OAuth) && OPTIONS["oauth"]
25
25
  switchboard.plug!(OAuthPubSubJack)
26
26
  else
27
27
  switchboard.plug!(PubSubJack)
@@ -22,7 +22,7 @@ module Switchboard
22
22
  end
23
23
  end
24
24
 
25
- if OPTIONS["oauth"]
25
+ if defined?(OAuth) && OPTIONS["oauth"]
26
26
  switchboard.plug!(OAuthPubSubJack)
27
27
  else
28
28
  switchboard.plug!(PubSubJack)
@@ -17,7 +17,7 @@ module Switchboard
17
17
  end
18
18
  end
19
19
 
20
- if OPTIONS["oauth"]
20
+ if defined?(OAuth) && OPTIONS["oauth"]
21
21
  switchboard.plug!(OAuthPubSubJack)
22
22
  else
23
23
  switchboard.plug!(PubSubJack)
@@ -0,0 +1,36 @@
1
+ module Switchboard
2
+ class Component < Core
3
+ attr_reader :component
4
+
5
+ def initialize(settings = Switchboard::Settings.new, spin = true)
6
+ super(settings, spin)
7
+
8
+ @component = Jabber::Component.new(settings["component.domain"])
9
+ end
10
+
11
+ protected
12
+
13
+ def auth!
14
+ component.auth(settings["component.secret"])
15
+ rescue Jabber::AuthenticationFailure
16
+ puts "Component authentication failed. Check your secret."
17
+ shutdown(false)
18
+ exit 1
19
+ end
20
+
21
+ def connect!
22
+ component.connect(settings["component.host"], settings["component.port"])
23
+ auth!
24
+ puts "Component connected." if debug?
25
+ rescue Errno::ECONNREFUSED, Errno::ETIMEDOUT
26
+ puts "Couldn't connect to Jabber server at #{settings["component.host"]}:#{settings["component.host"]}.
27
+ That may mean the Jabber server isn't running or listening on that port,
28
+ or there might be firewall issues. Exiting."
29
+ exit 1
30
+ end
31
+
32
+ def stream
33
+ component
34
+ end
35
+ end
36
+ end
@@ -20,6 +20,21 @@ module Switchboard
20
20
 
21
21
  attr_reader :jacks, :settings
22
22
 
23
+ # Register a hook
24
+ def self.hook(*events)
25
+ events.each do |event|
26
+ module_eval(<<-EOS, __FILE__, __LINE__)
27
+ def on_#{event}(method = nil, &block)
28
+ if block_given?
29
+ register_hook(:#{event}, &block)
30
+ elsif method
31
+ register_hook(:#{event}, method)
32
+ end
33
+ end
34
+ EOS
35
+ end
36
+ end
37
+
23
38
  def initialize(settings = Switchboard::Settings.new, spin = true, &block)
24
39
  # register a handler for SIGINTs
25
40
  trap(:INT) do
@@ -87,6 +102,10 @@ module Switchboard
87
102
  end
88
103
  end
89
104
 
105
+ def hook(*events)
106
+ self.class.hook(*events)
107
+ end
108
+
90
109
  # Connect a jack to the switchboard
91
110
  def plug!(*jacks)
92
111
  @jacks ||= []
@@ -101,39 +120,7 @@ module Switchboard
101
120
  end
102
121
  end
103
122
 
104
- # Register a hook to run when the Jabber::Stream encounters an exception.
105
- def on_exception(&block)
106
- register_hook(:exception, &block)
107
- end
108
-
109
- # Register a hook to run when iq stanzas are received.
110
- def on_iq(&block)
111
- register_hook(:iq, &block)
112
- end
113
-
114
- # Register a hook to run when message stanzas are received.
115
- def on_message(&block)
116
- register_hook(:message, &block)
117
- end
118
-
119
- # Register a hook to run when presence stanzas are received.
120
- def on_presence(&block)
121
- register_hook(:presence, &block)
122
- end
123
-
124
- # Register a startup hook.
125
- def on_startup(&block)
126
- register_hook(:startup, &block)
127
- end
128
-
129
- def on_stream_connected(&block)
130
- register_hook(:stream_connected, &block)
131
- end
132
-
133
- # Register a shutdown hook.
134
- def on_shutdown(&block)
135
- register_hook(:shutdown, &block)
136
- end
123
+ hook(:exception, :iq, :message, :presence, :startup, :stream_connected, :shutdown)
137
124
 
138
125
  protected
139
126
 
@@ -150,21 +137,29 @@ module Switchboard
150
137
  end
151
138
 
152
139
  def disconnect!
153
- raise NotImplementedError, "subclasses of Switchboard::Core must implement disconnect!"
140
+ stream.close
154
141
  end
155
142
 
156
- def register_hook(name, &block)
143
+ def register_hook(name, method = nil, &block)
157
144
  @hooks ||= {}
158
- @hooks[name.to_sym] ||= []
145
+ name = name.to_sym
146
+ @hooks[name] ||= []
159
147
 
160
148
  puts "Registering #{name} hook" if debug?
161
- @hooks[name.to_sym] << block
149
+ if block_given?
150
+ @hooks[name] << block
151
+ else
152
+ @hooks[name] << lambda do |*args|
153
+ send(method.to_sym, *args)
154
+ end
155
+ end
162
156
  end
163
157
 
164
158
  def on(name, *args)
165
159
  @hooks ||= {}
166
160
  @hooks[name.to_sym] ||= []
167
161
  @hooks[name.to_sym].each do |hook|
162
+ puts "Executing hook '#{name}'" if debug?
168
163
  execute_hook(hook, *args)
169
164
  end
170
165
  end
@@ -192,7 +187,11 @@ module Switchboard
192
187
  on(:exception, e, stream, where)
193
188
 
194
189
  case where
195
- when :something
190
+ when :disconnected
191
+ puts "Jabber service disconnected. Shutting down."
192
+ exit 1
193
+ when :exit
194
+ puts "Shutting down."
196
195
  else
197
196
  puts "Caught #{e.inspect} on #{stream} at #{where}. You might want to consider handling this."
198
197
  raise e
@@ -215,10 +214,11 @@ module Switchboard
215
214
  def startup
216
215
  begin
217
216
  timeout(30) do
217
+ register_default_callbacks
218
+
218
219
  connect!
219
220
  @connected = true
220
221
 
221
- register_default_callbacks
222
222
  on(:stream_connected)
223
223
  end
224
224
  rescue Timeout::Error
@@ -12,9 +12,7 @@ module Switchboard
12
12
  :publish_item_with_id_to, :purge_items_from, :set_config_for,
13
13
  :subscribe_to, :unsubscribe_from, :to => :pubsub
14
14
 
15
- def on_pubsub_event(&block)
16
- register_hook(:pubsub_event, &block)
17
- end
15
+ Switchboard::Core.hook(:pubsub_event)
18
16
 
19
17
  def subscriptions(node = nil)
20
18
  # NOTE: node-specific subscriptions do not appear to work in ejabberd 2.0.2
@@ -1,8 +1,7 @@
1
- require 'switchboard/helpers/oauth_pubsub'
2
-
3
- # TODO subclass PubSubJack
4
1
  class OAuthPubSubJack
5
2
  def self.connect(switchboard, settings)
3
+ require 'switchboard/helpers/oauth_pubsub'
4
+
6
5
  # TODO generalize this pattern for required settings
7
6
  unless settings["pubsub.server"]
8
7
  puts "A pubsub server must be specified."
@@ -1,5 +1,6 @@
1
1
  require 'switchboard/core'
2
2
  require 'switchboard/client'
3
+ require 'switchboard/component'
3
4
  require 'switchboard/commands'
4
5
  require 'switchboard/jacks'
5
6
  require 'switchboard/settings'
@@ -1,3 +1,3 @@
1
1
  module Switchboard
2
- VERSION = [0, 0, 6]
2
+ VERSION = [0, 0, 7]
3
3
  end
@@ -0,0 +1,56 @@
1
+ # =XMPP4R - XMPP Library for Ruby
2
+ # License:: Ruby's license (see the LICENSE file) or GNU GPL, at your option.
3
+ # Website::http://home.gna.org/xmpp4r/
4
+
5
+ require 'xmpp4r'
6
+ require 'xmpp4r/pubsub'
7
+ require 'xmpp4r/location/location'
8
+
9
+ module Jabber
10
+ module UserLocation
11
+ ##
12
+ # A Helper for XEP-0080 User Location
13
+ #
14
+ # Use this helper to send a user's location, or receive them from a
15
+ # specified jid. Described at http://www.xmpp.org/extensions/xep-0080.html
16
+ #
17
+ # For example:
18
+ # <pre>
19
+ # h = UserLocation::Helper( @client, 'radio1@hug.hellomatty.com' )
20
+ # h.add_userlocation_callback do |location|
21
+ # puts "Now in: #{location.locality}"
22
+ # end
23
+ # </pre>
24
+ class Helper < PubSub::ServiceHelper
25
+ ##
26
+ # Send out the current location.
27
+ #
28
+ # location:: [Jabber::UserLocation::Location] current_location
29
+ def current_location(location)
30
+ item = Jabber::PubSub::Item.new()
31
+ item.add(location)
32
+
33
+ publish_item_to(NS_USERLOCATION, item)
34
+ end
35
+
36
+ ##
37
+ # Use this method to indicate that you wish to stop publishing
38
+ # a location.
39
+ def stop_publishing
40
+ current_location(Jabber::UserLocation::Location.new())
41
+ end
42
+
43
+ ##
44
+ # Add a callback that will be invoked when a location is received
45
+ # from the jid specified when you constructed the Helper.
46
+ def add_userlocation_callback(prio = 200, ref = nil, &block)
47
+ add_event_callback(prio, ref) do |event|
48
+ location = event.first_element('items/item/location')
49
+ if location
50
+ block.call(location)
51
+ end
52
+ end
53
+ end
54
+ end
55
+ end
56
+ end
@@ -0,0 +1,179 @@
1
+ # =XMPP4R - XMPP Library for Ruby
2
+ # License:: Ruby's license (see the LICENSE file) or GNU GPL, at your option.
3
+ # Website::http://home.gna.org/xmpp4r/
4
+
5
+ require 'time'
6
+ require 'xmpp4r/xmppelement'
7
+ require 'rexml/element'
8
+
9
+ module Jabber
10
+ module UserLocation
11
+ NS_USERLOCATION = 'http://jabber.org/protocol/geoloc'
12
+ ALLOWABLE_ATTRIBUTES = %w(accuracy alt area bearing building country
13
+ datum description floor lat locality lon postalcode region room
14
+ speed street text timestamp uri)
15
+
16
+ ##
17
+ # The <geoloc> XMPP element, as defined in XEP-0080 User Location
18
+ #
19
+ # See http://xmpp.org/extensions/xep-0080.html - this element
20
+ # encapsulates data about a user's current location. These are
21
+ # expressed as child elements such as <locality>, <lat>, etc.
22
+ # which are also managed by this class.
23
+ #
24
+ # If the element has no children then it indicates that the user
25
+ # has stopped publishing their location.
26
+ class Location < XMPPElement
27
+ name_xmlns 'geoloc', NS_USERLOCATION
28
+ force_xmlns true
29
+
30
+ ##
31
+ # Construct a new <location> element.
32
+ #
33
+ # Supply no arguments to make an empty element to indicate that
34
+ # location is no longer being published.
35
+ #
36
+ # attributes:: [Hash] location attributes
37
+ def initialize(attributes = {})
38
+ super()
39
+
40
+ # validate attributes
41
+ attributes = attributes.select do |k,v|
42
+ ALLOWABLE_ATTRIBUTES.include?(k) && !v.nil?
43
+ end
44
+
45
+ attributes.each do |k,v|
46
+ v = x.xmlschema if v.is_a?(Time)
47
+ add_element(REXML::Element.new(k)).text = v.to_s
48
+ end
49
+ end
50
+
51
+
52
+ ##
53
+ # Returns true if a location is currently being published, otherwise false.
54
+ def published?
55
+ (elements.size > 0)
56
+ end
57
+
58
+ ##
59
+ # Get the accuracy attribute of this location.
60
+ def accuracy
61
+ first_element('accuracy').text if first_element('accuracy')
62
+ end
63
+
64
+ ##
65
+ # Get the alt attribute of this location.
66
+ def alt
67
+ first_element('alt').text if first_element('alt')
68
+ end
69
+
70
+ ##
71
+ # Get the area attribute of this location.
72
+ def area
73
+ first_element('area').text if first_element('area')
74
+ end
75
+
76
+ ##
77
+ # Get the bearing attribute of this location.
78
+ def bearing
79
+ first_element('bearing').text if first_element('bearing')
80
+ end
81
+
82
+ ##
83
+ # Get the building attribute of this location.
84
+ def building
85
+ first_element('building').text if first_element('building')
86
+ end
87
+
88
+ ##
89
+ # Get the country attribute of this location.
90
+ def country
91
+ first_element('country').text if first_element('country')
92
+ end
93
+
94
+ ##
95
+ # Get the datum attribute of this location.
96
+ def datum
97
+ first_element('datum').text if first_element('datum')
98
+ end
99
+
100
+ ##
101
+ # Get the description attribute of this location.
102
+ def description
103
+ first_element('description').text if first_element('description')
104
+ end
105
+
106
+ ##
107
+ # Get the floor attribute of this location.
108
+ def floor
109
+ first_element('floor').text if first_element('floor')
110
+ end
111
+
112
+ ##
113
+ # Get the lat attribute of this location.
114
+ def lat
115
+ first_element('lat').text if first_element('lat')
116
+ end
117
+
118
+ ##
119
+ # Get the locality attribute of this location.
120
+ def locality
121
+ first_element('locality').text if first_element('locality')
122
+ end
123
+
124
+ ##
125
+ # Get the lon attribute of this location.
126
+ def lon
127
+ first_element('lon').text if first_element('lon')
128
+ end
129
+
130
+ ##
131
+ # Get the postalcode attribute of this location.
132
+ def postalcode
133
+ first_element('postalcode').text if first_element('postalcode')
134
+ end
135
+
136
+ ##
137
+ # Get the region attribute of this location.
138
+ def region
139
+ first_element('region').text if first_element('region')
140
+ end
141
+
142
+ ##
143
+ # Get the room attribute of this location.
144
+ def room
145
+ first_element('room').text if first_element('room')
146
+ end
147
+
148
+ ##
149
+ # Get the speed attribute of this location.
150
+ def speed
151
+ first_element('speed').text if first_element('speed')
152
+ end
153
+
154
+ ##
155
+ # Get the street attribute of this location.
156
+ def street
157
+ first_element('street').text if first_element('street')
158
+ end
159
+
160
+ ##
161
+ # Get the text attribute of this location.
162
+ def text
163
+ first_element('text').text if first_element('text')
164
+ end
165
+
166
+ ##
167
+ # Get the timestamp attribute of this location.
168
+ def timestamp
169
+ first_element('timestamp').text if first_element('timestamp')
170
+ end
171
+
172
+ ##
173
+ # Get the uri attribute of this location.
174
+ def uri
175
+ first_element('uri').text if first_element('uri')
176
+ end
177
+ end
178
+ end
179
+ end
@@ -0,0 +1,2 @@
1
+ require 'xmpp4r/location/location'
2
+ require 'xmpp4r/location/helper/helper'
data/switchboard.gemspec CHANGED
@@ -1,17 +1,15 @@
1
+ # this file is automatically generated
1
2
  Gem::Specification.new do |s|
2
3
  s.name = "switchboard"
3
- s.version = "0.0.6"
4
+ s.version = "0.0.7"
4
5
  s.summary = "XMPP toolkit."
5
6
  s.description = "A toolkit for assembling XMPP clients and interacting with XMPP servers."
6
7
  s.authors = ["Seth Fitzsimmons"]
7
8
  s.email = ["seth@mojodna.net"]
8
9
 
9
- s.files = ["bin/switchboard", "examples/election_results.rb", "lib/switchboard/client.rb", "lib/switchboard/colors.rb", "lib/switchboard/commands/command.rb", "lib/switchboard/commands/config/config.rb", "lib/switchboard/commands/config.rb", "lib/switchboard/commands/default.rb", "lib/switchboard/commands/help/help.rb", "lib/switchboard/commands/help.rb", "lib/switchboard/commands/pep/pep.rb", "lib/switchboard/commands/pep/tune.rb", "lib/switchboard/commands/pep.rb", "lib/switchboard/commands/pubsub/affiliations.rb", "lib/switchboard/commands/pubsub/config.rb", "lib/switchboard/commands/pubsub/create.rb", "lib/switchboard/commands/pubsub/delete.rb", "lib/switchboard/commands/pubsub/info.rb", "lib/switchboard/commands/pubsub/items.rb", "lib/switchboard/commands/pubsub/listen.rb", "lib/switchboard/commands/pubsub/nodes.rb", "lib/switchboard/commands/pubsub/options.rb", "lib/switchboard/commands/pubsub/publish.rb", "lib/switchboard/commands/pubsub/pubsub.rb", "lib/switchboard/commands/pubsub/purge.rb", "lib/switchboard/commands/pubsub/subscribe.rb", "lib/switchboard/commands/pubsub/subscriptions.rb", "lib/switchboard/commands/pubsub/unsubscribe.rb", "lib/switchboard/commands/pubsub.rb", "lib/switchboard/commands/register.rb", "lib/switchboard/commands/roster/add.rb", "lib/switchboard/commands/roster/list.rb", "lib/switchboard/commands/roster/remove.rb", "lib/switchboard/commands/roster/roster.rb", "lib/switchboard/commands/roster.rb", "lib/switchboard/commands/unregister.rb", "lib/switchboard/commands.rb", "lib/switchboard/core.rb", "lib/switchboard/ext/delegate.rb", "lib/switchboard/ext/instance_exec.rb", "lib/switchboard/helpers/oauth_pubsub.rb", "lib/switchboard/helpers/pubsub.rb", "lib/switchboard/jacks/auto_accept.rb", "lib/switchboard/jacks/debug.rb", "lib/switchboard/jacks/notify.rb", "lib/switchboard/jacks/oauth_pubsub.rb", "lib/switchboard/jacks/pubsub.rb", "lib/switchboard/jacks/roster_debug.rb", "lib/switchboard/jacks.rb", "lib/switchboard/oauth/request_proxy/mock_request.rb", "lib/switchboard/settings.rb", "lib/switchboard/switchboard.rb", "lib/switchboard/version.rb", "lib/switchboard/xmpp4r/pubsub/helper/oauth_service_helper.rb", "lib/switchboard.rb", "Rakefile", "README.markdown", "switchboard.gemspec"]
10
+ s.files = ["bin/switchboard", "examples/election_results.rb", "lib/switchboard/client.rb", "lib/switchboard/colors.rb", "lib/switchboard/commands/command.rb", "lib/switchboard/commands/config/config.rb", "lib/switchboard/commands/config.rb", "lib/switchboard/commands/default.rb", "lib/switchboard/commands/help/help.rb", "lib/switchboard/commands/help.rb", "lib/switchboard/commands/pep/location.rb", "lib/switchboard/commands/pep/pep.rb", "lib/switchboard/commands/pep/tune.rb", "lib/switchboard/commands/pep.rb", "lib/switchboard/commands/pubsub/affiliations.rb", "lib/switchboard/commands/pubsub/config.rb", "lib/switchboard/commands/pubsub/create.rb", "lib/switchboard/commands/pubsub/delete.rb", "lib/switchboard/commands/pubsub/info.rb", "lib/switchboard/commands/pubsub/items.rb", "lib/switchboard/commands/pubsub/listen.rb", "lib/switchboard/commands/pubsub/nodes.rb", "lib/switchboard/commands/pubsub/options.rb", "lib/switchboard/commands/pubsub/publish.rb", "lib/switchboard/commands/pubsub/pubsub.rb", "lib/switchboard/commands/pubsub/purge.rb", "lib/switchboard/commands/pubsub/subscribe.rb", "lib/switchboard/commands/pubsub/subscriptions.rb", "lib/switchboard/commands/pubsub/unsubscribe.rb", "lib/switchboard/commands/pubsub.rb", "lib/switchboard/commands/register.rb", "lib/switchboard/commands/roster/add.rb", "lib/switchboard/commands/roster/list.rb", "lib/switchboard/commands/roster/remove.rb", "lib/switchboard/commands/roster/roster.rb", "lib/switchboard/commands/roster.rb", "lib/switchboard/commands/unregister.rb", "lib/switchboard/commands.rb", "lib/switchboard/component.rb", "lib/switchboard/core.rb", "lib/switchboard/ext/delegate.rb", "lib/switchboard/ext/instance_exec.rb", "lib/switchboard/helpers/oauth_pubsub.rb", "lib/switchboard/helpers/pubsub.rb", "lib/switchboard/jacks/auto_accept.rb", "lib/switchboard/jacks/debug.rb", "lib/switchboard/jacks/notify.rb", "lib/switchboard/jacks/oauth_pubsub.rb", "lib/switchboard/jacks/pubsub.rb", "lib/switchboard/jacks/roster_debug.rb", "lib/switchboard/jacks.rb", "lib/switchboard/oauth/request_proxy/mock_request.rb", "lib/switchboard/settings.rb", "lib/switchboard/switchboard.rb", "lib/switchboard/version.rb", "lib/switchboard/xmpp4r/location/helper/helper.rb", "lib/switchboard/xmpp4r/location/location.rb", "lib/switchboard/xmpp4r/location.rb", "lib/switchboard/xmpp4r/pubsub/helper/oauth_service_helper.rb", "lib/switchboard.rb", "Rakefile", "README.markdown", "switchboard.gemspec"]
10
11
  s.executables = ["switchboard"]
11
12
  s.require_paths = ["lib"]
12
13
 
13
14
  s.add_dependency("xmpp4r")
14
- s.add_dependency("oauth")
15
- s.add_dependency("rb-appscript")
16
-
17
15
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mojodna-switchboard
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Seth Fitzsimmons
@@ -21,24 +21,6 @@ dependencies:
21
21
  - !ruby/object:Gem::Version
22
22
  version: "0"
23
23
  version:
24
- - !ruby/object:Gem::Dependency
25
- name: oauth
26
- version_requirement:
27
- version_requirements: !ruby/object:Gem::Requirement
28
- requirements:
29
- - - ">="
30
- - !ruby/object:Gem::Version
31
- version: "0"
32
- version:
33
- - !ruby/object:Gem::Dependency
34
- name: rb-appscript
35
- version_requirement:
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - ">="
39
- - !ruby/object:Gem::Version
40
- version: "0"
41
- version:
42
24
  description: A toolkit for assembling XMPP clients and interacting with XMPP servers.
43
25
  email:
44
26
  - seth@mojodna.net
@@ -59,6 +41,7 @@ files:
59
41
  - lib/switchboard/commands/default.rb
60
42
  - lib/switchboard/commands/help/help.rb
61
43
  - lib/switchboard/commands/help.rb
44
+ - lib/switchboard/commands/pep/location.rb
62
45
  - lib/switchboard/commands/pep/pep.rb
63
46
  - lib/switchboard/commands/pep/tune.rb
64
47
  - lib/switchboard/commands/pep.rb
@@ -86,6 +69,7 @@ files:
86
69
  - lib/switchboard/commands/roster.rb
87
70
  - lib/switchboard/commands/unregister.rb
88
71
  - lib/switchboard/commands.rb
72
+ - lib/switchboard/component.rb
89
73
  - lib/switchboard/core.rb
90
74
  - lib/switchboard/ext/delegate.rb
91
75
  - lib/switchboard/ext/instance_exec.rb
@@ -102,6 +86,9 @@ files:
102
86
  - lib/switchboard/settings.rb
103
87
  - lib/switchboard/switchboard.rb
104
88
  - lib/switchboard/version.rb
89
+ - lib/switchboard/xmpp4r/location/helper/helper.rb
90
+ - lib/switchboard/xmpp4r/location/location.rb
91
+ - lib/switchboard/xmpp4r/location.rb
105
92
  - lib/switchboard/xmpp4r/pubsub/helper/oauth_service_helper.rb
106
93
  - lib/switchboard.rb
107
94
  - Rakefile