public void contactListSyncCompleted(MsnMessenger arg0) {
   // we don't need both contactListInitCompleted and this firing.
   // System.out.println("Sync");
   // if (haveDispatched) return;
   // System.out.println("Sync");
   // haveDispatched = true;
   this.dispatchContactList(arg0.getContactList(), false);
 }
 public void contactListInitCompleted(MsnMessenger arg0) {
   // this is the inital contact list
   // System.out.println("Init");
   // if (haveDispatched) return;
   // System.out.println("Init");
   // haveDispatched = true;
   this.dispatchContactList(arg0.getContactList(), false);
 }
  @Override
  protected void messageReceived(MsnSession session) {
    super.messageReceived(session);

    MsnSwitchboard switchboard = session.getSwitchboard();
    if (switchboard != null) {
      MsnMessenger messenger = session.getMessenger();
      MsnContactImpl contact =
          (MsnContactImpl) messenger.getContactList().getContactByEmail(getEmail());
      if (contact == null) {
        contact = new MsnContactImpl(messenger.getContactList());
        contact.setEmail(getEmail());
      }

      ((AbstractSwitchboard) switchboard).removeContact(contact);
      ((AbstractMessenger) messenger).fireContactLeaveSwitchboard(switchboard, contact);

      if (switchboard.getAllContacts().length == 0) {
        switchboard.close();
      }
    }
  }
Beispiel #4
0
 // 打印联系人
 private void listContacts() {
   MsnContact[] cons = messenger.getContactList().getContactsInList(MsnList.AL);
   if (cons.length == 0) {
     msg("空");
   } else {
     msg("你现在有" + cons.length + "个联系人");
   }
   for (int i = 0; i < cons.length; i++) {
     String personal =
         ((MsnContactImpl) cons[i]).getPersonalMessage().equals("")
             ? "空"
             : ((MsnContactImpl) cons[i]).getPersonalMessage();
     msg(
         cons[i].getDisplayName()
             + " "
             + cons[i].getEmail()
             + " "
             + cons[i].getStatus()
             + " "
             + personal);
   }
 }