Search in sources :

Example 6 with Email

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);
}
Also used : Email(net.sf.jml.Email) NotFoundException(org.jivesoftware.util.NotFoundException) UserNotFoundException(org.jivesoftware.openfire.user.UserNotFoundException)

Example 7 with Email

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);
            }
        }
    }
}
Also used : Email(net.sf.jml.Email) MsnControlMessage(net.sf.jml.message.MsnControlMessage) MsnSwitchboard(net.sf.jml.MsnSwitchboard)

Example 8 with Email

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);
}
Also used : Email(net.sf.jml.Email)

Aggregations

Email (net.sf.jml.Email)8 UserNotFoundException (org.jivesoftware.openfire.user.UserNotFoundException)4 MsnSwitchboard (net.sf.jml.MsnSwitchboard)2 Roster (org.jivesoftware.openfire.roster.Roster)2 RosterItem (org.jivesoftware.openfire.roster.RosterItem)2 NotFoundException (org.jivesoftware.util.NotFoundException)2 JID (org.xmpp.packet.JID)2 MsnContact (net.sf.jml.MsnContact)1 MsnControlMessage (net.sf.jml.message.MsnControlMessage)1 MsnDatacastMessage (net.sf.jml.message.MsnDatacastMessage)1