* @param jid
* @param msg
*/
public static final void sendMessage(JID jid, String msg){
XMPPService xmpp = XMPPServiceFactory.getXMPPService();
Presence presence = xmpp.getPresence(jid , new JID("talkfeed@appspot.com"));
Logger log = Logger.getLogger(TalkService.class.getName());
log.info(" send message to : " + jid.getId()
+ ". Presence : " + presence.isAvailable()
+ ". presence show : " + presence.getPresenceShow()
+ ". presence type : "+ presence.getPresenceType());
//
boolean isAvailable = UserPresence.isUserAvailable(jid.getId());
if (isAvailable){
MessageBuilder mb = new MessageBuilder();
Message reply = mb.withRecipientJids(jid)
.withMessageType(MessageType.CHAT)
.withBody(msg)
.withFromJid(new JID("talkfeed@appspot.com"))
.build();
xmpp.sendMessage(reply);
}
}