Presence joinPresence = new Presence(Presence.Type.available);joinPresence.setTo(mThreadId);joinPresence.addExtension(new MUCInitialPresence());
XMPPConnection conx = Application.getInstance().getXMPPConection();PacketFilter responseFilter = new AndFilter(new FromMatchesFilter(mThreadId), new PacketTypeFilter(Presence.class));
PacketCollector response = conx.createPacketCollector(responseFilter);conx.sendPacket(joinPresence);
Presence presence = (Presence) response.nextResult(SmackConfiguration.getPacketReplyTimeout());response.cancel();
if (presence == null) { Log.e("XMPP", "No response from server.");} else if (presence.getError() != null) { Log.e("XMPP", presence.getError().toString());}Out of connection options, can't connect to <mThreadId>
Sending error replies for 1 queued stanzas because of failed outgoing connection to <mThreadId>
I searched for this message in the forum and I found that when you try to log with an user without the @my-server.com it happens. So I added the @my-server.com at the thread. The errors stopped to happen, but the chat didn't work.
To send a message, I use the following code:
org.jivesoftware.smack.packet.Message message = new org.jivesoftware.smack.packet.Message();
message.setType(org.jivesoftware.smack.packet.Message.Type.groupchat);
message.setBody(body);message.setThread(mThreadId + "@my-server.com");
boolean messageSent = true;
XMPPConnection conx = Application.getInstance().getXMPPConection();if (conx != null) conx.sendPacket(message);else messageSent = false;} catch (IllegalStateException e) { if (e.getMessage().compareTo("Not connected to server.") == 0) { messageSent = false; }}
Sorry for the long post, but I tried to add as much information as I can.
Someone knows why my muc doesn't work?