powered by Jive Software

How to change the login status

Hi all,

After call xmppConn.login(username, password, resource), the login user always appears to be online status. Is there a way to configure the default login status as ‘OFFLINE’ or ‘INVISABLE’?


Is this the way how I should do it?

xmppConn.login(username, password, resource);
xmppConn.sendPacket(new Presence(Presence.Type.unavailable));

But this still sends an unavailable IQ message to all the entries in my roster list. Is there a way we can absolutely stop acknolwdge people that this login info?


You can tell smack not to send an initial presence packet by doing the following:

xmppConn.login(username, password, resource, false);

Hope that helps,


Ryan, thanks for your response.

After tried to login using that way, I still received XMPP presence messages.

Is there a way that we can absolutely stop sending out this presence message to the entry in the roster when monitor logins to XMPP server?


Which version of smack are you using? When I tested it using 3.0.4 I didn’t see any presence packets being sent. Below is my sample code:

public class Login {
   private XMPPConnection connection;    public static void main(String[] args) {
      new Login();
   }    private Login() {
      XMPPConnection.DEBUG_ENABLED = true;
      connection = new XMPPConnection("");
      try {
         connection.login("jill", "1", "smack", false);
      catch (XMPPException e) {

and here is all the xml that is being sent:

<stream:stream to="" xmlns="jabber:client" xmlns:stream="http://etherx.jabber.org/streams" version="1.0">
<starttls xmlns="urn:ietf:params:xml:ns:xmpp-tls"/>
<stream:stream to="" xmlns="jabber:client" xmlns:stream="http://etherx.jabber.org/streams" version="1.0">
<auth mechanism="PLAIN" xmlns="urn:ietf:params:xml:ns:xmpp-sasl">AGppbGwAMQ==</auth>
<stream:stream to="" xmlns="jabber:client" xmlns:stream="http://etherx.jabber.org/streams" version="1.0">
<iq id="Tw8XR-0" type="set"><bind xmlns="urn:ietf:params:xml:ns:xmpp-bind"><resource>smack</resource></bind></iq>
<iq id="Tw8XR-1" type="set"><session xmlns="urn:ietf:params:xml:ns:xmpp-session"/></iq>
<iq id="Tw8XR-2" type="get"><query xmlns="jabber:iq:roster"></query></iq>



Ryan, I think you are right. The presence packets were forwarded by XMPP server, but not from the smack package.