public void connect() {
    myCon = MsnMessengerFactory.createMsnMessenger(theAS.getUsername(), theAS.getPassword());

    // turn off logging
    myCon.setLogIncoming(false);
    myCon.setLogOutgoing(false);

    // add ourselves to the listener lists we care about
    myCon.addMessageListener(this);
    myCon.addMessengerListener(this);
    myCon.addContactListListener(this);

    // log in
    myCon.login();
  }
  protected void initMessenger(MsnMessenger messenger) {
    messenger.addMessageListener(
        new MsnMessageAdapter() {

          public void instantMessageReceived(
              MsnSwitchboard switchboard, MsnInstantMessage message, MsnContact contact) {
            // text message received
            switchboard.sendMessage(message);
          }

          public void controlMessageReceived(
              MsnSwitchboard switchboard, MsnControlMessage message, MsnContact contact) {
            // such as typing message and recording message
            switchboard.sendMessage(message);
          }

          public void datacastMessageReceived(
              MsnSwitchboard switchboard, MsnDatacastMessage message, MsnContact contact) {
            // such as Nudge
            switchboard.sendMessage(message);
          }
        });
  }