hiratara / lambdabot-hipchat-plugins

A plugin to connect lambdabot to HipChat
BSD 3-Clause "New" or "Revised" License
3 stars 1 forks source link

Connection issues #1

Closed mxswd closed 10 years ago

mxswd commented 10 years ago

I'm starting it with:

hipchat API_KEY test-room 1234_12345@chat.hipchat.com testlambda PASSWORD 1234_test-room

Is this correct?

When I connect, it errors with:

[ERROR] Pontarius.Xmpp.Roster: getRoster: invalid query element
[ERROR] Pontarius.Xmpp: Server did not return a roster: 
[ERROR] Pontarius.Xmpp: pullUnpickle: Unpickle failed: Error while unpickling:
  -> xpRoot
  -> xpUnliftElems
  -> xpEither (Right)
  -> xpStanza
  -> xpAlt
  1)
    Entity not found: "{jabber:client}iq"
  2)
    Entity not found: "{jabber:client}iq"
  3)
    Entity not found: "{jabber:client}iq"
  4)
    Entity not found: "{jabber:client}message"
  5)
    Entity not found: "{jabber:client}message"
  6)
    -> xpWrap
    -> xpPresenceError
    -> xpWrap
    -> xpElem ("{jabber:client}presence")
    -> children
    -> xp2Tuple (1)
    -> xpStanzaError
    -> xpWrap
    -> xpElem ("{jabber:client}error")
    -> attrs
    Leftover Entities: [(Name {nameLocalName = "code", nameNamespace = Nothing, namePrefix = Nothing},[ContentText "400"])]
  7)
    -> xpWrap
    -> xpPresence
    -> xpWrap
    -> xpElem ("{jabber:client}presence")
    -> attrs
    -> xp5Tuple (5)
    -> xpWrap
    -> xpAttr ("type")
    -> xpPresenceType
    Could not parse presence type.

[ERROR] Pontarius.Xmpp: Read error: XmppOtherFailure

Thanks!

hiratara commented 10 years ago

Thanks for your feedback.

test-room might be a number, and 1234_test-room might be 1234_test-room@conf.hipchat.com. Visit hipchat web site and follow link Rooms -> [Your Room Name] and see API ID and XMPP JID fields.

There might be also a bug of pontarius-xmpp. I wrote a patch and it has already merged into the master. Though I haven't built hipchat-plugin with the master version of pontarius-xmpp yet. https://github.com/pontarius/pontarius-xmpp/commit/49edb2081107d0506a347d48bb3c78a5f70e212e

When pontarius-xmpp receives an unknown element, it tends to close the connection. To see what elements cause closing the connection, you can enable the debug mode of lambdabot to edit lambdabot/lambdabot-core/src/Lambdabot/Config.hs.

Cheers

mxswd commented 10 years ago

Thanks for the help!

I started lambdabot with lambdabot -l DEBUG and it is logging everything.

It seems the roster is sent correctly, but fails here: https://github.com/pontarius/pontarius-xmpp/blob/master/source/Network/Xmpp/IM/Roster.hs#L135

I am investigating why…

The XML is:

<iq to='123_12345@chat.hipchat.com/none' type='result' id='1'>
  <query xmlns='jabber:iq:roster' ver='2014-01-03T05:30:28Z'>
    <item mention_name='Max' jid='123_12346@chat.hipchat.com' name='Maxwell' subscription='both'/>
  </query>
</iq>

The XML Left e is:

Pontarius.Xmpp.Roster: getRoster: invalid query element:
TraceStep
  ("xpRoot","")
  (TraceStep ("xpUnliftElems","")
  (TraceStep ("xpWrap","")
  (TraceStep ("xpElem","\"{jabber:iq:roster}query\"")
  (TraceStep ("children","")
  (TraceStep ("xpWrap","")
  (TraceStep ("xpElems","\"{jabber:iq:roster}item\"")
  (TraceStep ("xpAll","")
  (TraceStep ("xpElem","\"{jabber:iq:roster}item\"")
  (TraceStep ("attrs","")
  (ErrorMessage "Leftover Entities: [(Name {nameLocalName = \"mention_name\", nameNamespace = Nothing, namePrefix = Nothing},[ContentText \"Maxwell\"])]"))))))))))

Oh! The mention_name field is a bonus HipChat field!

mxswd commented 10 years ago

I'm working on a fix here: https://github.com/maxpow4h/pontarius-xmpp/tree/hipchat

hiratara commented 10 years ago

I'm aware of errors of the roaster, but these don't cause any problems for me. (Of course I had better fix these errors.)

Here is my log when I start lambdabot with -l INFO.

[NOTICE] : Initialising plugins
[INFO] : Loading module "base"
..(snip)..
[INFO] : Loading module "hipChat"
[NOTICE] : Done loading plugins
Hello hip. MYAPIKEY 999999 99999_999999 "My Account Nick Name" password 99999_roomname@conf.hipchat.com
[WARNING] Pontariusm.Xmpp: Stream has no language tag
[INFO] Pontarius.Xmpp.Tls: Running StartTLS
[INFO] Pontarius.Xmpp.Tls: Stream Secured.
[WARNING] Pontariusm.Xmpp: Stream has no language tag
[WARNING] Pontariusm.Xmpp: Stream has no language tag
[INFO] Pontarius.Xmpp: Bound JID: parseJid "99999_999999@chat.hipchat.com/none-99999"
[ERROR] Pontarius.Xmpp.Roster: getRoster: invalid query element
[ERROR] Pontarius.Xmpp: Server did not return a roster

It seems that my bot receives any commands correctly after outputting this log.

mxswd commented 10 years ago

Ah yeah! It is working now! Thanks!

purefn commented 10 years ago

Sorry to resurrect a dead issue, but I'm running into this problem too. lambdabot shows up in the room, but after it tries to get the roster it fails and attempts a reconnect and enters into a loop. It's not clear to me how @maxpow4h fixed this. Mind a bit of elaboration?

mxswd commented 10 years ago

@purefn I think I had the room ID wrong. It should be in the format "1234_words@conf.hipchat.com".

purefn commented 10 years ago

I did finally get it working. I just needed to use the right version of pontarius-xmpp, specifically revision 0afba3f39a83bb4b0b95925eb8d08f9e088012d2