protected Buddy MSNContactToJimBuddy(MsnContact myMC) {
    Buddy b = new Buddy();

    b.setAccount(this);
    b.setScreename(myMC.getEmail().toString());
    b.setAlias(myMC.getFriendlyName());

    MsnUserStatus myStatus = myMC.getStatus();

    // we want to use status

    // System.out.println(myStatus.getDisplayStatus() + "|" + MsnUserStatus.OFFLINE);

    Status toSet = new Status();

    if (myStatus == MsnUserStatus.AWAY
        || myStatus == MsnUserStatus.BE_RIGHT_BACK
        || myStatus == MsnUserStatus.IDLE) {
      toSet.setStatus(Status.away);
    } else if (myStatus == MsnUserStatus.BUSY) {
      toSet.setStatus(Status.doNotDistrub);
    } else if (myStatus == MsnUserStatus.OUT_TO_LUNCH) {
      toSet.setStatus(Status.superAway);
    } else if (myStatus == MsnUserStatus.ONLINE) {
      toSet.setStatus(Status.available);
    } else if (myStatus == MsnUserStatus.OFFLINE) {
      toSet.setStatus(Status.offline);
    }

    b.setStatus(toSet);

    b.setGroupName(myMC.getBelongGroups()[0].getGroupName());

    return b;
  }
  protected void dispatchContactList(MsnContactList theList, boolean firstTime) {
    MsnContact[] theContacts = theList.getContacts();

    for (MsnContact myMC : theContacts) {
      // System.out.println(myMC);
      if (theStopper.checkBuddy(myMC.getId())) {
        theEvents.buddyStatusChange(this.MSNContactToJimBuddy(myMC), firstTime);
      }
    }
  }
예제 #3
0
 // 收到正常信息的时候发生
 @Override
 public void instantMessageReceived(
     MsnSwitchboard switchboard, MsnInstantMessage message, MsnContact contact) {
   msg(contact.getDisplayName() + "对我说:" + message.getContent());
   // 如果聊天内容为exit,退出
   if (message.getContent().trim().equalsIgnoreCase("exit")) {
     msg(contact.getDisplayName() + "对我发出退出指令。");
     messenger.logout();
     System.exit(0);
   }
   message.setContent("Hello,我是酷印通机器人!\n现在的时间是:" + new Date()); // 设置要发送消息内容
   message.setFontRGBColor((int) (Math.random() * 255 * 255 * 255)); // 设置消息的文本颜色
   switchboard.sendMessage(message); // 发送信息
 }
  public void instantMessageReceived(MsnSwitchboard arg0, MsnInstantMessage arg1, MsnContact arg2) {
    IM myIM = new IM();
    myIM.theAccount = this;
    myIM.from = arg2.getEmail().toString();
    myIM.message = arg1.getContent();

    theEvents.gotIM(myIM);
  }
예제 #5
0
 // 当在联系人聊天窗口获得光标并按下第一个键时发生
 @Override
 public void controlMessageReceived(
     MsnSwitchboard switchboard, MsnControlMessage message, MsnContact contact) {
   msg(contact.getFriendlyName() + "正在输入文字。");
 }