@Override public void processStanza(Stanza packet) throws NotConnectedException { Message message = (Message) packet; for (MessageListener listener : messageListeners) { listener.processMessage(message); } } };
void sendMessage(Chat chat, Message message) throws NotConnectedException, InterruptedException { for (Map.Entry<MessageListener, StanzaFilter> interceptor : interceptors.entrySet()) { StanzaFilter filter = interceptor.getValue(); if (filter != null && filter.accept(message)) { interceptor.getKey().processMessage(message); } } connection().sendStanza(message); }
@Override public void processStanza(Stanza packet) throws NotConnectedException { Message message = (Message) packet; for (MessageListener listener : messageListeners) { listener.processMessage(message); } } };
private void notifyListeners() { log.info("Notifying global listeners"); synchronized (messageListeners) { if (messageListeners.isEmpty()) { log.info("No message listeners to forward to"); } for (final MessageListener ml : messageListeners) { ml.processMessage(null, msg); } } }
private void notifyListeners() { log.info("Notifying global listeners"); synchronized (messageListeners) { if (messageListeners.isEmpty()) { log.info("No message listeners to forward to"); } for (final MessageListener ml : messageListeners) { ml.processMessage(null, msg); } } }
/** * Delivers a message directly to this chat, which will add the message * to the collector and deliver it to all listeners registered with the * Chat. This is used by the Connection class to deliver messages * without a thread ID. * * @param message the message. */ void deliver(Message message) { // Because the collector and listeners are expecting a thread ID with // a specific value, set the thread ID on the message even though it // probably never had one. message.setThread(threadID); for (MessageListener listener : listeners) { listener.processMessage(this, message); } }
/** * Delivers a message directly to this chat, which will add the message * to the collector and deliver it to all listeners registered with the * Chat. This is used by the Connection class to deliver messages * without a thread ID. * * @param message the message. */ void deliver(Message message) { // Because the collector and listeners are expecting a thread ID with // a specific value, set the thread ID on the message even though it // probably never had one. message.setThread(threadID); for (MessageListener listener : listeners) { listener.processMessage(this, message); } }
/** * Delivers a message directly to this chat, which will add the message * to the collector and deliver it to all listeners registered with the * Chat. This is used by the Connection class to deliver messages * without a thread ID. * * @param message the message. */ void deliver(Message message) { // Because the collector and listeners are expecting a thread ID with // a specific value, set the thread ID on the message even though it // probably never had one. message.setThread(threadID); for (MessageListener listener : listeners) { listener.processMessage(this, message); } }
void sendMessage(Chat chat, Message message) throws NotConnectedException, InterruptedException { for (Map.Entry<MessageListener, StanzaFilter> interceptor : interceptors.entrySet()) { StanzaFilter filter = interceptor.getValue(); if (filter != null && filter.accept(message)) { interceptor.getKey().processMessage(message); } } connection().sendStanza(message); }