powered by Jive Software

About offline message sending

First,i create a user .

Than ,i wanna send an offline message to this user. my code :

createUser(username,password,"…",null,null);

Message message = new Message();

message.setTo(new JID("…"));

message.setBody("…");

//OfflineMessageStore.getInstance().addMessage(message); --------------1

XMPPServer.getInstance().getOfflineMessageStrategy().storeOffline(message); --------------2

but when i logon server with spark,i didn’t recerved any messages. (this is the first logon.)

1 and 2 all failed .

Openfire version: 3.6.4 (Windows XP)

Spark version: 2.5.8 (Windows XP)

Any help would be greatly appreciated!!

this problem has been resolved.

code:

Message message = new Message();

message.setTo(new JID(tempname+"@domain"));

message.setBody(“your username:”+username+"your password: "+password);

message.setType(Message.Type.chat);

message.setFrom(new JID(“XXXXXXX”));

message.setThread(“xxxx”);

message.setID(“xxxx”);

PacketExtension pe = new PacketExtension(“x”,“jabber:x:event”);

pe.getElement().addElement(“offline”);

pe.getElement().addElement(“composing”);

message.addExtension(pe);

XMPPServer.getInstance().getOfflineMessageStore().addMessage(message);

maybe it is a simple problem and it only trouble me…