Hi everybody,
I'm playing with the JML here, and I wrote a code using netbeans that do some basic things, I was trying to learn how to use JML, I confess that it's not a simple thing because I can't find a good documentation even here in the project site.
This is my msn class:
package msn; import net.sf.jml.Email; import net.sf.jml.MsnContact; import net.sf.jml.MsnList; import net.sf.jml.MsnMessenger; import net.sf.jml.MsnProtocol; import net.sf.jml.MsnUserStatus; import net.sf.jml.event.MsnAdapter; import net.sf.jml.impl.MsnMessengerFactory; /** * * @author Andre */ public class Msn extends MsnAdapter { public MsnMessenger messenger; public void efetuarLogin(String email, String senha) { MsnUserStatus msnUserStatus = MsnUserStatus.HIDE; messenger = MsnMessengerFactory.createMsnMessenger(email, senha); messenger.setSupportedProtocol(new MsnProtocol[]{MsnProtocol.MSNP15}); messenger.getOwner().setInitStatus(msnUserStatus); // messenger.setLogIncoming(true); // messenger.setLogOutgoing(true); messenger.login(); } public void efetuarLogout() { messenger.logout(); } public void alterarStatus(String status) { if (status.equals("ocupado")) { messenger.getOwner().setStatus(MsnUserStatus.BUSY); } else if (status.equals("ausente")) { messenger.getOwner().setStatus(MsnUserStatus.AWAY); } else if (status.equals("invisivel")) { messenger.getOwner().setStatus(MsnUserStatus.HIDE); } else if (status.equals("online")) { messenger.getOwner().setStatus(MsnUserStatus.ONLINE); } //Default ;) else { messenger.getOwner().setStatus(MsnUserStatus.ONLINE); } } public void alterarNick(String nick) { messenger.getOwner().setDisplayName(nick); } public void alterarMensagemPessoal(String mensagemPessoal) { messenger.getOwner().setPersonalMessage(mensagemPessoal); } public MsnContact[] listarContatos() { MsnContact[] contactList = messenger.getContactList().getContactsInList(MsnList.AL); return contactList; } public void enviarMensagem(Email email, String mensagem) { messenger.sendText(email, mensagem); } @Override public void contactListSyncCompleted(MsnMessenger messenger) { messenger.retreiveOfflineMessages(); } }
Things that I would like to do is to send off-line messages and Reiceve Messages from other contacts.
Does anybody have a sample code that does it, or would like to help me?
Regards, w4lly
In order to receive income message, you need to add corresponding listener, something like that:
messenger.addMessengerListener(myMsnListener); messenger.addMessageListener(myMsnListener);
please refer the sample code for detail. for sending offline message issue, you may take a look on the below page: https://sourceforge.net/projects/java-jml/forums/forum/405891/topic/4625447
Log in to post a comment.
Hi everybody,
I'm playing with the JML here, and I wrote a code using netbeans that do some basic things, I was trying to learn how to use JML, I confess that it's not a simple thing because I can't find a good documentation even here in the project site.
This is my msn class:
Things that I would like to do is to send off-line messages and Reiceve Messages from other contacts.
Does anybody have a sample code that does it, or would like to help me?
Regards,
w4lly
In order to receive income message, you need to add corresponding listener,
something like that:
please refer the sample code for detail.
for sending offline message issue, you may take a look on the below page:
https://sourceforge.net/projects/java-jml/forums/forum/405891/topic/4625447