Question

I'am a new user on stack, but I have a problem with MultiUserChat in aSmack library 3.2.1 for android. I'm using "gtalk.google.com" server. It's a simple example and I'am only one in room:

 String room="myConference@conference.jabber.org";
 MultiUserChat muc = new MultiUserChat(connection,room);
 muc.join(userNameInRoom);

 muc.addMessageListener(new PacketListener()
 {
    @Override
    public void processPacket(Packet packet)
    {
         ...
    }
 });

After:

 muc.sendMessage("Text message");

In Log:

DEBUG/SMACK(281): 06:46:29 PM SENT (1140866576): <message id="gsMe7-18"
to="myConference@conference.jabber.org" type="groupchat"><body>Text message
</body></message>

DEBUG/SMACK(281): 06:46:29 PM RCV  (1140866576): <message
from="myConference@conference.jabber.org/userNameInRoom" to="userName"
type="groupchat"><body>Text message</body></message>

Result: "Text message" and it is right, but then:

I again recieved "Text message" with presences:

DEBUG/SMACK(281): 06:54:12 PM RCV  (1140866576): <presence 
from="myConference@conference.jabber.org/userNameInRoom" to="userName"><x xmlns=
"vcard-temp:x:update"><photo/></x><x xmlns="http://jabber.org/protocol/muc#user">
<item affiliation="owner" role="moderator"/><status code="110"/></x></presence>

DEBUG/SMACK(281): 06:54:12 PM RCV  (1140866576): <message 
from="myConference@conference.jabber.org/userNameInRoom" to="userName"
type="groupchat"><body>Text message</body><delay stamp="2012-02-15T17:46:31Z" 
from="myConference@conference.jabber.org" xmlns="urn:xmpp:delay"/><x 
stamp="20120215T17:46:31" from="myConference@conference.jabber.org" 
xmlns="jabber:x:delay"/></message>

And I recieved that again and again whenever server send presences to me. It continues infinitely with interval ~ 5 minutes. And Yes in 30 minutes I recieved ~6 messages "Text message". If I send more than 1 message all of these messages would been recieved without exceptions when presence send to me.

What problem with my MultiUserChat and what delayed delivery doing here?

Thanks for attention!

Was it helpful?

Solution

In case of "@conference.jabber.org" I didn't find solution and I decided that problem because of GTalk server and correct version of MultiUserChat is in case with "@groupchat.google.com".

I changed my code from:

room=roomName+"@conference.jabber.org";
MultiUserChat muc = new MultiUserChat(connection, room);

muc.create(userName);

muc.sendConfigurationForm(new Form(Form.TYPE_SUBMIT));

to:

room="private-chat-" + UUID.randomUUID().toString() + "@groupchat.google.com";
MultiUserChat muc = new MultiUserChat(connection, room);

muc.join(userName);

muc.sendConfigurationForm(new Form(Form.TYPE_SUBMIT));

And i tried it, but I got new problem- When user recieve invite message and accept it both clients crash with XmlPullException "END_TAG expected" and something like "< /stream:stream>" in last position in logcat.

I started to google this problem and found reason. I used asmack from beem client(by the way, before that i used asmack-7 from asmack developer) and how i know it is based on smack 3.1... I found that smack 3.2.0 decided this problem. I downloaded the Flow's version of asmack and I am pleased with this.

In conclusion I want to say "Thank you!!!" to Flow for correct version of aSmack, which works better than others.

OTHER TIPS

that is Not because of your Client, and thats Not an Error, Thats Because Your Server's GroupChat's History Settings Configured to Send particular Number of Chat History Upon Entering The Room

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top