mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-11-24 04:52:05 +01:00
Add missing jingle action, some comments
This commit is contained in:
parent
9d34cbc6f3
commit
1bf8cf9a12
2 changed files with 22 additions and 3 deletions
|
@ -50,6 +50,7 @@ import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.WeakHashMap;
|
import java.util.WeakHashMap;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
@ -68,6 +69,7 @@ public final class JingleFileTransferManager extends Manager implements JingleHa
|
||||||
|
|
||||||
private static final WeakHashMap<XMPPConnection, JingleFileTransferManager> INSTANCES = new WeakHashMap<>();
|
private static final WeakHashMap<XMPPConnection, JingleFileTransferManager> INSTANCES = new WeakHashMap<>();
|
||||||
private final HashSet<IncomingJingleFileTransferListener> incomingJingleFileTransferListeners = new HashSet<>();
|
private final HashSet<IncomingJingleFileTransferListener> incomingJingleFileTransferListeners = new HashSet<>();
|
||||||
|
private final HashMap<String, JingleFileTransferSession> sessions = new HashMap<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Private constructor. This registers a JingleContentDescriptionFileTransferProvider with the
|
* Private constructor. This registers a JingleContentDescriptionFileTransferProvider with the
|
||||||
|
@ -188,32 +190,47 @@ public final class JingleFileTransferManager extends Manager implements JingleHa
|
||||||
JingleContent content = jingle.getContents().get(i);
|
JingleContent content = jingle.getContents().get(i);
|
||||||
switch (jingle.getAction()) {
|
switch (jingle.getAction()) {
|
||||||
case content_accept:
|
case content_accept:
|
||||||
|
// Remote accepts our content-add request.
|
||||||
case content_add:
|
case content_add:
|
||||||
|
// Remote wants to add content to the session.
|
||||||
case content_modify:
|
case content_modify:
|
||||||
|
// Remote wants to change the directionality of the session
|
||||||
case content_reject:
|
case content_reject:
|
||||||
|
// Remote rejects our content-add request
|
||||||
case content_remove:
|
case content_remove:
|
||||||
|
// Remote wants to remove a content from the session/abort a single transfer
|
||||||
case description_info:
|
case description_info:
|
||||||
|
// Additional parameters of exchanged media
|
||||||
|
case security_info:
|
||||||
|
// Remote wants to exchange security information
|
||||||
case session_accept:
|
case session_accept:
|
||||||
|
// Remote accepts our session-initiate
|
||||||
case session_info:
|
case session_info:
|
||||||
|
// Remote sends session-info (eg. hash)
|
||||||
case session_initiate:
|
case session_initiate:
|
||||||
// File Offer
|
// Remote offers file
|
||||||
if (content.getSenders() == JingleContent.Senders.initiator) {
|
if (content.getSenders() == JingleContent.Senders.initiator) {
|
||||||
handleFileOffer(jingle);
|
handleFileOffer(jingle);
|
||||||
}
|
}
|
||||||
//File Request
|
// Remote requests file
|
||||||
else if (content.getSenders() == JingleContent.Senders.responder) {
|
else if (content.getSenders() == JingleContent.Senders.responder) {
|
||||||
return handleFileRequest(jingle);
|
return handleFileRequest(jingle);
|
||||||
}
|
}
|
||||||
//Both or none
|
//Both or none - illegal
|
||||||
else {
|
else {
|
||||||
throw new AssertionError("Undefined (see XEP-0234 §4.1)");
|
throw new AssertionError("Undefined (see XEP-0234 §4.1)");
|
||||||
}
|
}
|
||||||
//break;
|
//break;
|
||||||
case session_terminate:
|
case session_terminate:
|
||||||
|
// Remote wants to terminate our current session
|
||||||
case transport_accept:
|
case transport_accept:
|
||||||
|
// Remote accepts our transport-replace
|
||||||
case transport_info:
|
case transport_info:
|
||||||
|
// Remote exchanges transport methods
|
||||||
case transport_reject:
|
case transport_reject:
|
||||||
|
// Remote rejects our transport-replace
|
||||||
case transport_replace:
|
case transport_replace:
|
||||||
|
// Remote wants to replace the transport
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
@ -248,6 +265,7 @@ public final class JingleFileTransferManager extends Manager implements JingleHa
|
||||||
contentBuilder.addTransport(preferredTransport);
|
contentBuilder.addTransport(preferredTransport);
|
||||||
|
|
||||||
acceptBuilder.addJingleContent(contentBuilder.build());
|
acceptBuilder.addJingleContent(contentBuilder.build());
|
||||||
|
|
||||||
connection().sendStanza(acceptBuilder.build());
|
connection().sendStanza(acceptBuilder.build());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,6 +33,7 @@ public enum JingleAction {
|
||||||
content_reject,
|
content_reject,
|
||||||
content_remove,
|
content_remove,
|
||||||
description_info,
|
description_info,
|
||||||
|
security_info,
|
||||||
session_accept,
|
session_accept,
|
||||||
session_info,
|
session_info,
|
||||||
session_initiate,
|
session_initiate,
|
||||||
|
|
Loading…
Reference in a new issue