private boolean acceptMessage(Packet packet) {
   if (packet != null && packet instanceof Message) {
     for (PacketExtension pe : packet.getExtensions())
       if (pe instanceof LogPacketExtension) return true;
   }
   return false;
 }
  @Override
  public void processPacket(Packet packet) {
    if (smackXmpp == null) {
      logger.error("Not initialized");
      return;
    }

    if (packet instanceof ColibriConferenceIQ) {
      handleColibriIq((ColibriConferenceIQ) packet);
    } else if (packet instanceof MuteIq) {
      handleMuteIq((MuteIq) packet);
    } else if (packet instanceof RayoIqProvider.DialIq) {
      handleRayoIQ((RayoIqProvider.DialIq) packet);
    } else if (packet instanceof Message) {
      handleMessage((Message) packet);
    } else if (packet instanceof Presence) {
      handlePresence((Presence) packet);
    } else {
      logger.error("Unexpected packet: " + packet.toXML());
    }
  }
  /**
   * Implements {@link PacketListener}. Notifies this instance that a specific {@link Packet} (which
   * this instance has already expressed interest into by returning <tt>true</tt> from {@link
   * #accept(Packet)}) has been received.
   *
   * @param packet the <tt>Packet</tt> which has been received and which this instance is given a
   *     chance to process
   */
  public void processPacket(Packet packet) {
    /*
     * As we do elsewhere, acknowledge the receipt of the Packet first and
     * then go about our business with it.
     */
    IQ iq = (IQ) packet;

    if (iq.getType() == IQ.Type.SET)
      protocolProvider.getConnection().sendPacket(IQ.createResultIQ(iq));

    /*
     * Now that the acknowledging is out of the way, do go about our
     * business with the Packet.
     */
    ColibriConferenceIQ conferenceIQ = (ColibriConferenceIQ) iq;
    boolean interrupted = false;

    try {
      processColibriConferenceIQ(conferenceIQ);
    } catch (Throwable t) {
      logger.error(
          "An error occurred during the processing of a " + packet.getClass().getName() + " packet",
          t);

      if (t instanceof InterruptedException) {
        /*
         * We cleared the interrupted state of the current Thread by
         * catching the InterruptedException. However, we do not really
         * care whether the current Thread has been interrupted - we
         * caught the InterruptedException because we want to swallow
         * any Throwable. Consequently, we should better restore the
         * interrupted state.
         */
        interrupted = true;
      } else if (t instanceof ThreadDeath) throw (ThreadDeath) t;
    }
    if (interrupted) Thread.currentThread().interrupt();
  }