use of net.sf.jml.Email in project Openfire by igniterealtime.
the class MSNSession method acceptAddContact.
/**
* @see net.sf.kraken.session.TransportSession#acceptAddContact(JID)
*/
@Override
public void acceptAddContact(JID jid) {
final String userID = getTransport().convertJIDToID(jid);
Log.debug("MSN: accept-adding " + userID);
// According to a packet dump made with Wireshark, 'accepting' a
// contact-add is done by adding the contact yourself (using an outgoing
// ADL).
final Email email = Email.parseStr(userID);
if (email == null) {
Log.warn("MSN: Unable to accept-add this illegal contact " + userID);
return;
}
final TransportBuddyManager<MSNBuddy> manager = this.getBuddyManager();
final String nickname;
if (manager.hasBuddy(jid)) {
try {
final MSNBuddy buddy = manager.getBuddy(jid);
nickname = buddy.getNickname();
} catch (NotFoundException ex) {
throw new RuntimeException("Buddy does not exist although manager.getBuddy() returns true: " + jid);
}
} else {
nickname = null;
}
msnMessenger.addFriend(email, nickname);
}
use of net.sf.jml.Email in project Openfire by igniterealtime.
the class MSNSession method sendChatState.
/**
* @see net.sf.kraken.session.TransportSession#sendChatState(org.xmpp.packet.JID,net.sf.kraken.type.ChatStateType)
*/
@Override
public void sendChatState(JID jid, ChatStateType chatState) {
if (chatState.equals(ChatStateType.composing)) {
Email jidEmail = Email.parseStr(getTransport().convertJIDToID(jid));
MsnControlMessage mcm = new MsnControlMessage();
mcm.setTypingUser(msnMessenger.getOwner().getEmail().getEmailAddress());
for (MsnSwitchboard sb : msnMessenger.getActiveSwitchboards()) {
if (sb.containContact(jidEmail)) {
sb.sendMessage(mcm, true);
}
}
}
}
use of net.sf.jml.Email in project Openfire by igniterealtime.
the class MSNSession method addContact.
/**
* @see net.sf.kraken.session.TransportSession#addContact(org.xmpp.packet.JID, String, java.util.ArrayList)
*/
@Override
public void addContact(JID jid, String nickname, ArrayList<String> groups) {
Email contact = Email.parseStr(getTransport().convertJIDToID(jid));
if (contact == null) {
Log.debug("MSN: Unable to add illegal contact " + jid);
return;
}
msnMessenger.addFriend(contact, nickname);
}
Aggregations