Package net.kano.joustsim.oscar

Examples of net.kano.joustsim.oscar.BuddyInfo


    }
  }

  public synchronized boolean isBuddyOnline(String buddyName) {
    boolean buddyOnline = false;
    BuddyInfo buddyInfo = _addBuddyIfNecessary(buddyName);
    if (buddyInfo != null) {
      buddyOnline = buddyInfo.isOnline();
    }
    return buddyOnline;
  }
View Full Code Here


    return buddyOnline;
  }

  public synchronized boolean isBuddyAway(String buddyName) {
    boolean buddyAway = false;
    BuddyInfo buddyInfo = _addBuddyIfNecessary(buddyName);
    if (buddyInfo != null) {
      buddyAway = buddyInfo.isAway();
    }
    return buddyAway;
  }
View Full Code Here

    return buddyAway;
  }

  public synchronized String getStatusMessage(String buddyName) {
    String statusMessage = null;
    BuddyInfo buddyInfo = _addBuddyIfNecessary(buddyName);
    if (buddyInfo != null) {
      statusMessage = buddyInfo.getStatusMessage();
    }
    return statusMessage;
  }
View Full Code Here

    return statusMessage;
  }

  public synchronized String getAwayMessage(String buddyName) {
    String awayMessage = null;
    BuddyInfo buddyInfo = _addBuddyIfNecessary(buddyName);
    if (buddyInfo != null) {
      awayMessage = buddyInfo.getAwayMessage();
    }
    return awayMessage;
  }
View Full Code Here

  public void addBuddy(String buddyName) {
    _addBuddyIfNecessary(buddyName);
  }

  public BuddyInfo _addBuddyIfNecessary(String buddyName) {
    BuddyInfo buddyInfo = null;
    if (_connected && _conn != null) {
      Screenname buddy = new Screenname(buddyName);
      BuddyInfoManager buddyInfoManager = _conn.getBuddyInfoManager();
      buddyInfo = buddyInfoManager.getBuddyInfo(buddy);
      boolean isOnBuddyList = false;
      if (buddyInfo != null) {
        isOnBuddyList = buddyInfo.isOnBuddyList();
      }
      if (!isOnBuddyList) {
        SsiService ssiService = _conn.getSsiService();
        MutableBuddyList buddyList = ssiService.getBuddyList();
        List groups = buddyList.getGroups();
        if (groups.size() == 0) {
          buddyList.addGroup("Buddies");
          groups = buddyList.getGroups();
        }
        MutableGroup group = (MutableGroup) groups.get(0);
        group.addBuddy(buddyName);

        for (int attempt = 0; attempt < 10 && !buddyInfo.isOnBuddyList(); attempt++) {
          try {
            Thread.sleep(100);
          }
          catch (Throwable t) {
            // ignore
View Full Code Here

    return _connected;
  }

  public synchronized void sendMessage(String buddyName, String message, boolean ignoreIfOffline) throws MessageException {
    if (message != null) {
      BuddyInfo buddyInfo = _addBuddyIfNecessary(buddyName);
      if (buddyInfo != null) {
        if (!buddyInfo.isOnline()) {
          if (!ignoreIfOffline) {
            throw new BuddyOfflineException("The buddy '" + buddyName + "' is not online.");
          }
        }
        else {
          if (message.length() > 2048) {
            message = message.substring(0, 2048);
          }
          Conversation conv = _conn.getIcbmService().getImConversation(buddyInfo.getScreenname());
          conv.open();
          conv.sendMessage(new SimpleMessage(message));
        }
      }
    }
View Full Code Here

TOP

Related Classes of net.kano.joustsim.oscar.BuddyInfo

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.