I've been having trouble using xmpp4r to do in-band registration following the SO thread here:
XMPP transport to another protocol
The problem comes down to that I get a NoMethodError Exception error for new_register when I run the following code:
require "xmpp4r"
require "xmpp4r/client"
require "xmpp4r/iq"
def in_band_reg
chat_name = 'testChatName'
password = 'pword'
reg = Jabber::Iq.new_register(chat_name, password)
end
NoMethodError Exception: undefined method `new_register' for Jabber::Iq:Class
In the xmpp4r gem in the file iq.rb I can see the new_register method defined as:
def Iq.new_register(username=nil, password=nil)
...
end
but when I examine the class's methods I'm not able to see the new_register method. I.E.
Jabber::Iq.singleton_methods(false)
["new_authset", "new_rosterget", "new_vcard", "new_rosterset", "import", "new_authset_digest", "new_query", "add_elementclass", "new_browseget"]
Jabber::Iq.public_instance_methods(false)
["query=", "queryns", "set_type", "type", "typed_add", "type=", "query", "vcard"]
Jabber::Iq.respond_to?("new_register")
false
Any idea why I can't access the new_register method in 'xmpp4r/iq' ?
I got this working by just coding it up myself. First connect a client that can in-band register new users:
then have that client register a new user by sending an in-band message