use of org.jivesoftware.smackx.jingleold.listeners.JingleSessionRequestListener in project Smack by igniterealtime.
the class JingleManager method initJingleSessionRequestListeners.
/**
* Register the listenerJingles, waiting for a Jingle stanza(/packet) that tries to
* establish a new session.
*/
private void initJingleSessionRequestListeners() {
StanzaFilter initRequestFilter = new StanzaFilter() {
// Return true if we accept this packet
@Override
public boolean accept(Stanza pin) {
if (pin instanceof IQ) {
IQ iq = (IQ) pin;
if (iq.getType().equals(IQ.Type.set)) {
if (iq instanceof Jingle) {
Jingle jin = (Jingle) pin;
if (jin.getAction().equals(JingleActionEnum.SESSION_INITIATE)) {
return true;
}
}
}
}
return false;
}
};
jingleSessionRequestListeners = new ArrayList<JingleSessionRequestListener>();
// Start a packet listener for session initiation requests
connection.addAsyncStanzaListener(new StanzaListener() {
@Override
public void processStanza(Stanza packet) {
triggerSessionRequested((Jingle) packet);
}
}, initRequestFilter);
}
Aggregations