示例#1
0
  /**
   * Initialises a new ChatHanlder with the given context and messaging protocol. Also starts
   * observing the chat model.
   *
   * <p>This class needs the network identifier of the current device. If the own network identifier
   * is not jet set in the model, this method will throw a null pointer exception.
   *
   * @param context the current application context
   * @param messagingProtocol the current messaging protocol
   */
  public ChatHandler(Context context, MessagingProtocol messagingProtocol) {
    this.context = context;
    chatHelper = HelperFactory.getChatHelper(context);
    contactHelper = HelperFactory.getContacHelper(context);
    chatHelper.addObserver(this);

    this.messagingProtocol = messagingProtocol;
    self = HelperFactory.getContacHelper(context).getSelf();
  }