powered by Jive Software

OX Issue with announceSupportAndPublish

Hi,
Am trying OX on Smack 4.4.0 alpha2 (Since I cannot login with alpha3) and Openfire 4.5.1 (if that is relevant).

I have faced a problem that I cannot understand. I have tried to get as much information as I can. The error happens on openPgpManager.announceSupportAndPublish() (see below code) and am not sure how node stuff actually works.

Do I need to configure anything on the server?

Here is the code I use to test

private fun setupOpenPGP(conn: XMPPTCPConnection) {
        val openPgpManager: OpenPgpManager = OpenPgpManager.getInstanceFor(connection)
        val store = FileBasedOpenPgpStore(filesDir)
        val provider: OpenPgpProvider = PainlessOpenPgpProvider(connection, store)
        openPgpManager.openPgpProvider = provider

        if (!openPgpManager.hasSecretKeysAvailable()) {
            openPgpManager.generateAndImportKeyPair(conn.user.asBareJid())
        }
        openPgpManager.announceSupportAndPublish()

        val instantManager = OXInstantMessagingManager.getInstanceFor(conn)
        instantManager.addOxMessageListener { contact, _, decryptedPayload, _ ->
            val body = decryptedPayload.getExtension<Message.Body>(
                Message.Body.ELEMENT,
                Message.Body.NAMESPACE
            )
            Toast.makeText(this, body.message, Toast.LENGTH_LONG).show()
            Toast.makeText(this, contact.jid.toString(), Toast.LENGTH_LONG).show()
        }

        //announce I support OpenGPG messages
        instantManager.announceSupportForOxInstantMessaging()
   }

I get an error item-not-found
Here is the XMPP Log

2020-06-08 16:38:49.323 9378-21020/com.example.app D/SMACK: SENT (9): 
    <iq id='8P33H-408' type='set'>
      <pubsub xmlns='http://jabber.org/protocol/pubsub'>
        <create node='urn:xmpp:openpgp:0:public-keys:CDC71633EA022AD61C7AC18F9D4449CD36D24741'/>
      </pubsub>
    </iq>
2020-06-08 16:38:49.505 9378-21021/com.example.app D/SMACK: RECV (9): 
    <iq type="error" id="8P33H-408" from="2547445443433@192.168.1.101" to="2547445443433@192.168.1.101/Tulonge">
      <pubsub xmlns="http://jabber.org/protocol/pubsub">
        <create node="urn:xmpp:openpgp:0:public-keys:CDC71633EA022AD61C7AC18F9D4449CD36D24741"/>
      </pubsub>
      <error code="409" type="cancel">
        <conflict xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/>
      </error>
    </iq>
    <r xmlns='urn:xmpp:sm:3' />
2020-06-08 16:38:49.658 9378-21020/com.example.app D/SMACK: SENT (9): 
    <a xmlns='urn:xmpp:sm:3' h='20'/>
    <iq id='8P33H-410' type='get'>
      <query xmlns='http://jabber.org/protocol/disco#info' node='urn:xmpp:openpgp:0:public-keys:CDC71633EA022AD61C7AC18F9D4449CD36D24741'>
      </query>
    </iq>
2020-06-08 16:38:49.799 9378-21021/com.example.app D/SMACK: RECV (9): 
    <iq type="error" id="8P33H-410" to="2547445443433@192.168.1.101/Tulonge">
      <query xmlns="http://jabber.org/protocol/disco#info" node="urn:xmpp:openpgp:0:public-keys:CDC71633EA022AD61C7AC18F9D4449CD36D24741">
      </query>
      <error code="404" type="cancel">
        <item-not-found xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/>
      </error>
    </iq>

I have traced down the exception and found that it occurs here:

Hm, this is strange…

This error probably means that the node cannot be created because it already exists (see https://xmpp.org/extensions/xep-0060.html#table-8).
However…

This error means that the node cannot be queried because it (or the specified item) does not exist…
Maybe this is a server error?

2 Likes

Is there any test I can do to clear things out.
The exception caught is the not found. Does it work for you?

For me it works. You may want to try to run Smack’s integration tests on your local server for further debugging. Those tests do succeed most of the time on my ejabberd server.

@guus also did some major improvements to Openfire’s PubSub code in Openfire 4.6. Maybe its worth compiling and trying out the current master branch of Openfire?

1 Like

I will do that. Is there a documentation on running them? Wanted to upgrade but someone reported is not working on Mac High Sierra.

I will try it out. Which server are you using?

I just stealthily added a link to the integration tests to my reply :stuck_out_tongue:

I’m running ejabberd 20.04.

1 Like

Thanks. I will try upgrade and see if it works and also test on ejabberd.

Just unrelated question, did you try with alpha3 and succeeded or was this alpha2. Am asking because my alpha3 don’t work and am not sure if it is my code or the library

I did not run the integration tests from some time, but I’d assume that they should still pass, as there were no changes to the OX code that I’m aware of.

I might re-run them at some point though :stuck_out_tongue:

1 Like

Thank you again. Let me work on this and see

This topic was automatically closed 62 days after the last reply. New replies are no longer allowed.