powered by Jive Software

Unable to get joined chat rooms - android asmack

i am using asmack-android-16 library for android , and had set openfire 3.8.2 server on the local machine. My problem is when i try to get the joined rooms it gives me item-not-found error . what can be the possible problem . The user is alreay join in the room as i can see that at admin console but still it gives me error this is how am using getJoinedRooms function

hail is the username , and 192.168.1.3 is the ip of hosted server.

Iterator RoomsIterator=MultiUserChat.getJoinedRooms(Connection,"hail@192.168.1.3/Smack") ;

i also tried using:

Iterator RoomsIterator=MultiUserChat.getJoinedRooms(Connection,"hail@192.168.1.3");

but this give me no response from server . and when i try to debug it i recieve error with remote server not found.

Moreover initially my getHostedRooms function wasn’t working but then able to get it working by changing

ServiceDiscoveryManager.getInstanceFor(connection).discoverItems(connection);

to:

ServiceDiscoveryManager discoManager = new ServiceDiscoveryManager(connection);

but same trick didnt work to get joined rooms. what could be the possible problem is it with server or with the library or with the code. is there anyother way to get joined rooms. did anyone tried doing same thing with openfire 3.8.2 and asmack and get the results?

Please help me with this, i am stuck on this since 5 days

I am sorry I can’t give you a solution with the information provided. But you have all the tools you need to investigate the problem and maybe even solve it (or at least get an idea about what’s going wrong). (a)Smack is open source, you can easily attach a debugger an comprehend what’s going on there. It has a Debug (SmackConfiguration.DEBUG) option that will log all send and received stanzas, so you can compare the stanzas with the protocol specification (XEP-0045 in this case), which is also publicly available…

BTW, you didn’t say which aSmack verison you are using. I recommend to always use the latest.

Thanks for the reply. yes i have seen XEP-0045

in xep 0045 the stanza is like



where we query other user’s joined rooms . i wonder if it would work for our own or not, beacse in that case the “to” and “from” attributes would be same. and i get four stanza (sent, recieve, sent , recieve) as the sender and the reciever are the same i wonder if it support for quering our own joined rooms or not.

if not is there any other way to get joined rooms ?

and yes i did use asmack debug and the stanza i was getting is this :

**Sent **

recieve

**sent **

recieve

Once again thank you for the reply

Did you run the static initializers like aSmack’s README told you to do?

sorry i did not . now i have run it thanks for indicating .

But now the problem is that i recieve the joined rooms in stanza but getJoinedRooms function returns the empty list. i notice that it is problem with the discoverItems(user, discoNode)(In ServiceDiscoveryManager)

as it returns the very first stanza it collects (whatever is the type of packet). so in my case the reciever and sender are the same therefore the procedure goes like this:

  1. user send stanza of type=get
  2. user recieve the get stanza (same user) (and at this point the PacketCollector in discoverItems function think of it as packet recieve save it as a result and got returned)
  3. returned from getJoinedRoom function with empty iterator
  4. user sents stanza of type=result
  5. user sents stanza of type=error(not sure why which says item-not-found)
  6. user recieve stanza of type=result(user recieve result but the getjoinedRooms function already executed and returned with empty iterator)
  7. user recieve stanza of type=error

how could i solve this problem. i try change the code but i am not good enough to do so. is it a kinda bug? or i am saying someting wrong.

Thanks for the help. you are so good

i upload my log at** http://speedy.sh/K3RDW/log1.txt**