Example #1
0
  public void updateData(
      MessageInfo[] messages,
      FriendInfo[] friends,
      FriendInfo[] unApprovedFriends,
      String userKey) {
    this.setUserKey(userKey);
    // FriendController.
    MessageController.setMessagesInfo(messages);
    // Log.i("MESSAGEIMSERVICE","messages.length="+messages.length);

    int i = 0;
    while (i < messages.length) {
      messageReceived(messages[i].userid, messages[i].messagetext);
      // appManager.messageReceived(messages[i].userid,messages[i].messagetext);
      i++;
    }

    FriendController.setFriendsInfo(friends);
    FriendController.setUnapprovedFriendsInfo(unApprovedFriends);
  }
Example #2
0
  public void messageReceived(String username, String message) {

    // FriendInfo friend = FriendController.getFriendInfo(username);
    MessageInfo msg = MessageController.checkMessage(username);
    if (msg != null) {
      Intent i = new Intent(TAKE_MESSAGE);

      i.putExtra(MessageInfo.USERID, msg.userid);
      i.putExtra(MessageInfo.MESSAGETEXT, msg.messagetext);
      sendBroadcast(i);
      String activeFriend = FriendController.getActiveFriend();
      if (activeFriend == null || activeFriend.equals(username) == false) {
        localstoragehandler.insert(username, this.getUsername(), message.toString());
        showNotification(username, message);
      }

      Log.i("TAKE_MESSAGE broadcast sent by im service", "");
    }
  }