Possible bug in MultiUserChat.java

Hello all,

I’m developing an android app using smack-android:4.2.0-alpha1 and currently want to get a specific occupant and check whether the user is a mod or not.

After some time I noticed muc.getOccupant(string) ALWAYS returns null, so i checked it with my debugger and noticed this:

Okay, notice the full Jid, now I copy paste it and call this:

Gives null.

Then I checked the HashMap declaration, the key type is LocalDomainAndResourcePartJid so map.get(Object) will work for a string, but will always return null

Is this a confirmed bug or am I missing something?

The file I’m refering to is this one

https://github.com/igniterealtime/Smack/blob/master/smack-extensions/src/main/ja va/org/jivesoftware/smackx/muc/MultiUser…

Thanks for the detailed bug report. Addressed with Use EntityFullJid in MUC’s getOccupant(Presence) API · Flowdalic/Smack@d711cae · GitHub

Could you try 4.2.0-alpha2-SNAPSHOT, which is now available from maven central’s snapshot repository, and report back?

Just changing my dependencies to

compile 'org.igniterealtime.smack:smack-android:4.2.0-alpha2-SNAPSHOT’
compile ‘org.igniterealtime.smack:smack-android-extensions:4.2.0-alpha2-SNAPSHOT’

didn’t work (neither of those two are found), so I assume the snapshots are on a custom repository that I didn’t add yet?

Yes, as I said, it’s available from Maven Central’s/OSSRH by Sonatype Snapshot repo:

Hmm… works now, but I can’t compile it because connection.loginAnonymously dissapeared! Was this deprecated before? conn.login(null, null) doesnt work either, so I can’t login as guest anymore?

Use “git log (-p) -S loginAnonymously” to see what happened.

An anonymous loginis not much different from a non-anonymous login, it just uses the SASL ANONYMOUS mechanism. The loginAnonymously was removed to slim down the XMPPConnection API in favor of a ConnectionConfiguration option: Smack/ConnectionConfiguration.java at master · igniterealtime/Smack · GitHub

Only one more question (sorry this isn’t about the original topic, but I recently upgraded from an, apparently, quite old version of the smack library, I feel like you turned the API upside down haha)

In the old version of my app, I just called .registerSASLMechanism(string, class) and .supportSASLMechanism(string), but now It’s quite different and I can’t find any example of this?

What I’m asking is, how do I register and support SASLAnonymous?

Tried a few aproaches on my own but they all resulted in an exception thrown on login (not-authorized)

ADD: Randomly trying everything that came into my mind, I got it working, but now I can’t join a muc!

When I create the MUC instance with

MultiUserChat chat = MultiUserChatManager.getInstanceFor(connection)


I start receiving presences and messages in my debug log (screenshot: http://prntscr.com/83zj4v)

But when I call chat.join(), I get a timeout exception! Any idea what could be the reason for that? It was all working fine on the previous version.

And on another xmpp client, I can see that I joined, and instantly left the muc,

Please open a new thread in the Smack Users forum about this different issue. Also have a look at How to ask for help or report an issue · igniterealtime/Smack Wiki · GitHub.

Especially the part about not providing textual information as screenshot. Thank you.

And while I welcome anyone willing to try alpha versions - Smack really needs alpha and beta testers - I’d like to point out that the API of such versions may change. Smack only guarantees as stable API between release candidates and patchlevel releases.