sprsquish / blather
- Source
- Commits
- Network (13)
- Issues (5)
- Downloads (15)
- Wiki (8)
- Graphs
-
Branch:
master
-
Hey,
I am seing this error with Nokogiri 1.4:
/Library/Ruby/Gems/1.8/gems/nokogiri-1.4.0/lib/nokogiri/xml/sax/push_parser.rb:47:in `native_write': undefined method `xmldecl' for #<Blather::Stream::Parser:0x10106f520> (NoMethodError) from /Library/Ruby/Gems/1.8/gems/nokogiri-1.4.0/lib/nokogiri/xml/sax/push_parser.rb:47:in `<<' from /Library/Ruby/Gems/1.8/gems/blather-0.4.6/lib/blather/stream/parser.rb:23:in `<<' from /Library/Ruby/Gems/1.8/gems/blather-0.4.6/lib/blather/stream.rb:84:in `receive_data' from /Library/Ruby/Gems/1.8/gems/eventmachine-0.12.10/lib/eventmachine.rb:256:in `run_machine' from /Library/Ruby/Gems/1.8/gems/eventmachine-0.12.10/lib/eventmachine.rb:256:in `run' from test/example.rb:5This is the code:
client = Blather::Client.setup 'julien@superfeedr.com', 'password' client.register_handler(:ready) { puts "Connected ! send messages to #{client.jid.stripped}." } client.register_handler :message, :chat?, :body do |m| puts m.to_xml end client.connectHope it's an easy fix :)
PS: I use blather-0.4.6
Comments
-
XPath guards with custom namespaces don't appear to work
1 comment Created 6 months ago by gcampbellI tried to do:
message "/message/bar:foo", :bar => "http://bar.com"and it doesn't catch a message like:
<message><foo xmlns="http://bar.com"></message>Should that work? I can commit a failing test to my fork if that would be helpful.
Comments
-
Comments
nevermind.. just realized this is a difference between Regexp and Oniguruma
-
When I'm trying to get status updates from contacts in my roster, I get this:
/var/www/planary/releases/current/vendor/gems/blather-0.4.2/lib/blather/stanza/presence/status.rb:101:in `to_sym': interning empty string (ArgumentError)Comments
-
1 comment Created 6 months ago by sprsquishCheck "from" attribute on outgoing stanzas for client connectionsbugx -
1 comment Created 6 months ago by sprsquishError when adding/removing from the rosterbugx -
I have various blocks of code like:
message(:to => jid, :body => "help" do |m|
endthroughout my component.
These are now failing after I upgraded to the latest head. I removed all but the :body matcher and isolated that as the failing case. Otherwise, I can intercept messages, but any attempts to match a body fail.
Comments
hm.. I'm not having that problem at all. I run the echo.rb example with every iteration and it's been working flawlessly.
What's the incoming XML you're trying to match?
I just pushed a fix. Lemme know if it's working for you.
-
Chat state notifications cause exceptions
3 comments Created 7 months ago by thewordnerdIf Blather receives a message containing a chat state notification, it throws an exception about the XML not being well-formed. At least, so it does with Pidgin. Here's a log of an example active message, but I've seen the same behavior with composing events as well:
Comments
This should also be fixed in the most recent set of changes.
thewordnerd
Thu Jun 04 20:42:03 -0700 2009
| link
This isn't fixed, but the XML is a red herring.
Actually, what happened is an exception was raised in my message handler, but instead of throwing the exception, I guess something somewhere is catching the exception, trying to close the stream and maybe doing something that throws another exception? In any case, I wasn't getting my exception and must have instead gotten something from Nokogiri. That's my story and I'm sticking to it, anyway. :P
In any case, fixing the exception in my code made chat states work, but there should probably be better exception handling in handlers. Here's the traceback generated by me introducing code that throws an exception into a message handler:
-
There doesn't appear to be a Client#temporary_handler method, so the discover DSL helper fails. Not sure if this represents a missing commit or an unimplemented feature.
Comments
Yea.. discover is half implemented now. I think it snuck itself in a commit somewhere. I have a fix in the pubsub branch. I'm planning on finishing up the pubsub branch along with some other big changes and releasing this week.
-
Yea, this should have been supported long ago.
Comments
brianmario
Tue Jun 02 11:55:54 -0700 2009
| link
The next version of EventMachine is supposed to have an async dns client baked right in the gem. Just FYI
Yea.. In the meantime, unfortunately, I'll need to use the built in support.
-
3 comments Created 7 months ago by thewordnerdwhen_ready fails for clients under ProsodybugxNot sure if this happens everywhere, but where I happen to be testing is a Prosody server. If I try initiating a client connection, my when_ready handler fails to run. It works fine for components, though. It looks as if the client successfully connects, but the handler just never gets run. I also tested with one of the examples, ping_pong, and it exhibited the same behavior.
Here's a bit of test code. Uncomment the client line and it hangs. Comment that and uncomment the component and it works.
require "rubygems"
require "blather/client"module Test
extend Blather::DSL#setup("user@localhost/test", "secret", "localhost", 5222) #setup("component.localhost", "secret", "localhost", 5347)
when_ready do
puts "Ready"end
def self.run
client.runend end
EM.run do
Test.run endComments
thewordnerd
Mon Jun 01 09:55:03 -0700 2009
| link
Actually, aha, I did in fact file the right issue. Brain not entirely broken. :) Here's a gist for this one, including both code and a log:
Okay, the most recent set of changes should fix this.
Can you test it? I wanna make sure it's done before releasing 0.4.0
thewordnerd
Thu Jun 04 20:22:51 -0700 2009
| link
Yup, works for me now. Thanks!
-
2 comments Created 7 months ago by thewordnerdClient and component fails in same processbugxI was trying to test another XMPP server using Blather, so I did something fairly similar to the PingPong example, except I created Client and Component rather than two clients. Here's my code:
require "rubygems"
require "blather/client"module Component
extend Blather::DSLsetup("component.localhost", "secret", "localhost", 5347)
subscription(:request?) do |subs|
write(subs.approve!) write(subs.request!)end
def self.run
client.runend end
module Client
extend Blather::DSLsetup("client@localhost", "secret", "localhost", 5222)
subscription(:request?) do
puts "Pass"end
def self.run
client.run subs = Blather::Stanza::Presence::Subscription.new("component.localhost", :subscribe) write(subs)end end
EM.run do
Component.run Client.run endAnd the error:
/var/lib/gems/1.8/gems/blather-0.3.4/lib/blather/stream/parser.rb:87:in `error': Namespace prefix stream on error is not defined (Blather::ParseError)
from /var/lib/gems/1.8/gems/nokogiri-1.3.0/lib/nokogiri/xml/sax/push_parser.rb:47:in `native_write' from /var/lib/gems/1.8/gems/nokogiri-1.3.0/lib/nokogiri/xml/sax/push_parser.rb:47:in `write' from /var/lib/gems/1.8/gems/blather-0.3.4/lib/blather/stream/parser.rb:23:in `receive_data' from /var/lib/gems/1.8/gems/blather-0.3.4/lib/blather/stream.rb:79:in `receive_data' from /var/lib/gems/1.8/gems/eventmachine-0.12.8/lib/eventmachine.rb:242:in `run_machine' from /var/lib/gems/1.8/gems/eventmachine-0.12.8/lib/eventmachine.rb:242:in `run' from test.rb:35Comments
The formatting is making this very hard to read. Can you throw this in a gist and link it here. Also, turn on debugging and link the data coming over the wire. I think I know what's happening here, but I need to be sure.
thewordnerd
Mon Jun 01 09:51:31 -0700 2009
| link
Actually, damnit, I filed the wrong issue. I had two tabs open and later realized that there are several problems with that code, so I wrote a simpler testcase and thought I'd filed a different issue, only I apparently didn't. :(
Filing the correct issue in a bit, then taking a break. Trying to fix bugs in three, possibly four separate libraries and technologies simultaneously is breaking my brain. :)
-
Client and component fails in same process
0 comments Created 7 months ago by thewordnerdI was trying to test another XMPP server using Blather, so I did something fairly similar to the PingPong example, except I created Client and Component rather than two clients. Here's my code:
require "rubygems"
require "blather/client"module Component
extend Blather::DSLsetup("component.localhost", "secret", "localhost", 5347)
subscription(:request?) do |subs|
write(subs.approve!) write(subs.request!)end
def self.run
client.runend end
module Client
extend Blather::DSLsetup("client@localhost", "secret", "localhost", 5222)
subscription(:request?) do
puts "Pass"end
def self.run
client.run subs = Blather::Stanza::Presence::Subscription.new("component.localhost", :subscribe) write(subs)end end
EM.run do
Component.run Client.run endAnd the error:
/var/lib/gems/1.8/gems/blather-0.3.4/lib/blather/stream/parser.rb:87:in `error': Namespace prefix stream on error is not defined (Blather::ParseError)
from /var/lib/gems/1.8/gems/nokogiri-1.3.0/lib/nokogiri/xml/sax/push_parser.rb:47:in `native_write' from /var/lib/gems/1.8/gems/nokogiri-1.3.0/lib/nokogiri/xml/sax/push_parser.rb:47:in `write' from /var/lib/gems/1.8/gems/blather-0.3.4/lib/blather/stream/parser.rb:23:in `receive_data' from /var/lib/gems/1.8/gems/blather-0.3.4/lib/blather/stream.rb:79:in `receive_data' from /var/lib/gems/1.8/gems/eventmachine-0.12.8/lib/eventmachine.rb:242:in `run_machine' from /var/lib/gems/1.8/gems/eventmachine-0.12.8/lib/eventmachine.rb:242:in `run' from test.rb:35Comments
-
I have the following code in one of my methods that responds to subscription requests:
write(presence.approve!)
write(presence.request!)There's a spec in place that ensures the functionality of this sort of chaining. It seems to fail, though, when stanzas are passed over the wire. Specifically, I can chain actions successfully just fine, but as soon as I write the stanza and chain another action, it's as if the reversed_endpoints instance variable gets forgotten, stanza.to gets overridden by stanza.from and all sorts of chaos breaks loose. Here's a gist of a ruby-debug session where I manually approve a subscription, write the stanza then try to make it a subscription request, at which point the component tries subscribing to itself:
Is a copy of the stanza being made before write? Though that wouldn't explain how my copy is being modified in place. very confused
Comments
Can you dig into the object and see what's going on with the @reversed_endpoints instance variable at each step?
thewordnerd
Thu May 28 12:12:16 -0700 2009
| link
What's happening with it is that it's not being set at all because, uh, there's an old version of the code in RUBYLIB. Could've sworn I re-installed after making the change.
In any case, don't mind me.
-
If I call subscription.cancel! and subscription.unsubscribe!, I would expect Blather to know that it already correctly assign the from and to attributes after the first action and doesn't need to do so again. It should also do so in a way that preserves the attributes of the stanza it was given, rather than assuming the stanza is from itself and setting :from to nil. This spec illustrates the problem and expected outcome:
it "successfully routes chained actions" do
from = JID.new("foo@bar.com") to = JID.new("baz@quux.com") sub = Stanza::Presence::Subscription.new sub.from = from sub.to = to sub.cancel! sub.unsubscribe! sub.type.must_equal :unsubscribe sub.to.must_equal from sub.from.must_equal toend
I've committed this latest spec to my branch, http://github.com/thewordnerd/blather, so if it didn't make it through the paste then it should be there.
Comments
thewordnerd
Tue May 26 08:46:14 -0700 2009
| link
This is now fixed in the previously-linked branch. I made the morph_to_reply a more generic reply_if_needed! on Stanza, figuring that same logic might be useful in custom reply! or other action helper methods.
Feedback appreciated. This is another bug that caused me a bit of grief so I'm hoping this and my other patches can land soon. :)
-
First, cool project!
But, I'm getting lots of errors running the examples.
ruby(27068) malloc: *** error for object 0x274780: incorrect checksum for freed object - object was probably modified after being freed.Saw your March bug report against libxml-ruby regarding these errors:
http://rubyforge.org/tracker/index.php?func=detail&aid=25366&group_id=494&atid=1971
Should I be concerned about this?
my env:
- OSX 10.5.6
- ruby 1.8.6 (2008-03-03 patchlevel 114) [universal-darwin9.0]
- blather (0.3.4)
- libxml-ruby (1.1.3)
- eventmachine (0.12.8)
Comments
Hopefully, not for much longer.
There's a branch that has Blather rewritten to be based on Nokogiri. It's based on Nokogiri 1.3.0 which isn't officially out yet, but you can clone the source and build and install the gem yourself.
The same for Blather. You'll need to pull the latest version of Blather's nokogiri branch. Then build and install it from source.
-
The following packet sent by Gajim reliably (or unreliably, depending on your perspective) crashes my Blather component:
D, [2009-05-21T13:30:30.752695 #31770] DEBUG -- :
D, [2009-05-21T13:30:30.752998 #31770] DEBUG -- : <<
D, [2009-05-21T13:30:30.753270 #31770] DEBUG -- : PARSING: ()
D, [2009-05-21T13:30:30.753872 #31770] DEBUG -- : START ELEM: ({:uri=>"jabber:client", :attrs=>{"from"=>"nolan@localhost/Gajim", "id"=>"2268", "to"=>"utterance.localhost", "type"=>"get"}, :ns=>{nil=>"jabber:client"}, :elem=>"iq", :prefix=>nil})
D, [2009-05-21T13:30:30.754819 #31770] DEBUG -- : SENDING: (/var/lib/gems/1.8/gems/blather-0.3.3/lib/blather/stream.rb:82:in `receive_data') </stream:stream>I don't get a helpful error, other than:
/var/lib/gems/1.8/gems/blather-0.3.3/lib/blather/stream/parser.rb:23:in
receive': undefined methodon_error' for false:FalseClass (NoMethodError)from /var/lib/gems/1.8/gems/blather-0.3.3/lib/blather/stream/parser.rb:23:in `receive_data' from /var/lib/gems/1.8/gems/blather-0.3.3/lib/blather/stream.rb:78:in `receive_data' from /var/lib/gems/1.8/gems/eventmachine-0.12.6/lib/eventmachine.rb:240:in `run_machine' from /var/lib/gems/1.8/gems/eventmachine-0.12.6/lib/eventmachine.rb:240:in `run' from /home/nolan/Projects/Utterance/bin/utterance:14 from /var/lib/gems/1.8/gems/daemons-1.0.10/lib/daemons/application.rb:215:in `call' from /var/lib/gems/1.8/gems/daemons-1.0.10/lib/daemons/application.rb:215:in `start_proc' from /var/lib/gems/1.8/gems/daemons-1.0.10/lib/daemons/application.rb:225:in `call' from /var/lib/gems/1.8/gems/daemons-1.0.10/lib/daemons/application.rb:225:in `start_proc' from /var/lib/gems/1.8/gems/daemons-1.0.10/lib/daemons/application.rb:255:in `start' from /var/lib/gems/1.8/gems/daemons-1.0.10/lib/daemons/controller.rb:72:in `run' from /var/lib/gems/1.8/gems/daemons-1.0.10/lib/daemons.rb:188:in `run_proc' from /var/lib/gems/1.8/gems/daemons-1.0.10/lib/daemons/cmdline.rb:105:in `call' from /var/lib/gems/1.8/gems/daemons-1.0.10/lib/daemons/cmdline.rb:105:in `catch_exceptions' from /var/lib/gems/1.8/gems/daemons-1.0.10/lib/daemons.rb:187:in `run_proc' from /home/nolan/Projects/Utterance/bin/utterance:11which I guess is consistent with a stream not expecting to be disconnected losing connection.
Comments
Can you re-paste that into a gist and link it here? The original XML coming in seems to have vanished.
thewordnerd
Thu May 21 15:56:27 -0700 2009
| link
Sure, here's a gist of the last stanza gajim sends:
Running this through the regular LibXML parser I get:
Warning: xmlns: URI vcard-temp is not absolute at :2.Obviously this is annoying but shouldn't be a fatal error. I'm tracking down the documentation for how to handle this in the SAX parser.
-
[~] irb irb(main):001:0> require 'rubygems'
=> true irb(main):002:0> require 'blather'
LoadError: no such file to load -- ext/push_parser
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_require' from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require' from /Library/Ruby/Gems/1.8/gems/blather-0.3.2/lib/blather.rb:43 from /Library/Ruby/Gems/1.8/gems/blather-0.3.2/lib/blather.rb:4:in `each' from /Library/Ruby/Gems/1.8/gems/blather-0.3.2/lib/blather.rb:4 from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:36:in `gem_original_require' from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:36:in `require' from (irb):2 from :0Comments
tracker didn't pick up the commit, but this closed in this commit:
http://github.com/sprsquish/blather/tree/0b27a5ef9eb0700a9680d1edd0e805915b8d3465The gem should show up in a few minutes.
-
Attach reply handlers to IQ set/get stanzas
Comments
-
Create a CLI interface that handles the JID, PW, host, and port automatically
Comments
-
Need to add daemonization support.
Comments
-
0 comments Created 8 months ago by sprsquishUpdate README to show GitHub as the issue trackerdocsxSorry Lighthouse.
Comments






This has actually been fixed in the repo. I haven't pushed out a new gem yet. If you need it right away, clone the repo and run "rake install"
Ha... thx. Just wanted to make sure you knew :) Please let me know when 4.7 is out :)