jid = Jabber::JID.new('....@jabber.ru')
j = Jabber::Client.new(jid)
j.connect
j.auth('12345')
如果我尝试通过传输发送消息,它会回复我
SENDING:
<message to='2....3@icq.proc.ru' xmlns='jabber:client'><body>hi!</body></message>
=> nil
ruby-1.9.2-p290 :106 > RECEIVED:
<message from='2...3@icq.proc.ru' to='....@jabber.ru/38185266013242853702144' type='error'><error code='401' type='auth'><not-authorized xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/><text xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'>Error. You must log into the transport before sending messages.</text></error><body>hi!</body></message>
PROCESSING:
<message from='2....3@icq.proc.ru' to='do-not-replay.perekup.net@jabber.ru/38185266013242853702144' type='error' xmlns='jabber:client'><error code='401' type='auth'><not-authorized xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/><text xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'>Error. You must log into the transport before sending messages.</text></error><body>hi!</body></message> (Jabber::Message)
但:
iq = Jabber::Iq.new(:set)
query = Jabber::IqQuery.new
query.add_namespace('jabber:iq:auth')
query.add(REXML::Element.new('username').add_text("6...6"))
query.add(REXML::Element.new('password').add_text('F...1'))
iq.add(query)
iq.to = 'icq.proc.ru'
iq
j.send iq
SENDING:
<iq to='icq.proc.ru' type='set' xmlns='jabber:client'><query xmlns='jabber:iq:authenticate'><username>6....6</username><password>F....1</password></query></iq>
=> nil
ruby-1.9.2-p290 :105 > RECEIVED:
<iq from='icq.proc.ru' to='...@jabber.ru/38185266013242853702144' type='error'><error code='501' type='cancel'><feature-not-implemented/></error></iq>
PROCESSING:
<iq from='icq.proc.ru' to='...@jabber.ru/38185266013242853702144' type='error' xmlns='jabber:client'><error code='501' type='cancel'><feature-not-implemented/></error></iq> (Jabber::Iq)
我无法使用 Iq.new_authset_digest(jid, session_id, password) 因为我无法获取 session_id 参数我做错了什么?