powered by Jive Software

Problem with gtalk and offline messages

I have the following problem:

I am testing with smack and gtalk and I try to get messages offline in the following way:

import java.util.Iterator;
import org.jivesoftware.smack.ConnectionConfiguration;
import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smack.packet.Message;
import org.jivesoftware.smackx.OfflineMessageManager;
public class SmackGTalkTest { public static void main( String[] args ) {
      ConnectionConfiguration connConfig = new ConnectionConfiguration("talk.google.com", 5222, "gmail.com");
    connConfig.setSendPresence(false);
        XMPPConnection connection = new XMPPConnection(connConfig);
    try {
      connection.connect();
      System.out.println("Connect to talk.google.com:5222 - gmail.com");
    } catch (XMPPException ex) {
      ex.printStackTrace();
      System.out.println("ERROR Connection");
    }
    if(null != connection){
      Boolean isLogin = Boolean.TRUE;
      try {
        connection.login("USER", "PASSWORD");
        System.out.println("User:" + connection.getUser());
      } catch (XMPPException e) {
        isLogin = Boolean.FALSE;
      }
      if(isLogin.booleanValue()){
        try {
          OfflineMessageManager offlineMessageManager = new OfflineMessageManager(connection);
          if (offlineMessageManager.supportsFlexibleRetrieval()){
            Iterator<Message> i = offlineMessageManager.getMessages();
            while (i.hasNext()) {
              Message msg = i.next();
              System.out.println("Got text [" + msg.getBody() + "] from [" + msg.getFrom() + "]");
            }                      offlineMessageManager.deleteMessages();
          }
        } catch (XMPPException e) {
          System.out.println("Error Offline Message.");
          e.printStackTrace();
        }
      }     }
  }
}

running the following exception in offlineMessageManager.supportsFlexibleRetrieval() :

No response from the server.: at org.jivesoftware.smackx.ServiceDiscoveryManager.discoverInfo(ServiceDiscoveryManager.java:445) at org.jivesoftware.smackx.ServiceDiscoveryManager.discoverInfo(ServiceDiscoveryManager.java:414) at org.jivesoftware.smackx.OfflineMessageManager.supportsFlexibleRetrieval(OfflineMessageManager.java:80) at SmackGTalkTest.main(SmackGTalkTest.java:39)

It seems as if the server does not support offline messages. In fact, using the statement ServiceDiscoveryManager.getInstanceFor(connection) returns only the following features:

http://jabber.org/protocol/xhtml-im,

http://jabber.org/protocol/muc,

http://jabber.org/protocol/bytestreams,

http://jabber.org/protocol/commands

but does not return:

http://jabber.org/protocol/offline

but I think gtalk supports this feature.

does anyone know what is happening?

thanks.

IIRC gtalk does not support XEP-13, but I could be wrong. What makes you think that it does?