mirror of
https://github.com/vanitasvitae/Smack.git
synced 2025-09-10 09:39:39 +02:00
Work on file transfer listeners
This commit is contained in:
parent
980c324f27
commit
5ce12974c8
12 changed files with 109 additions and 45 deletions
|
@ -4,7 +4,6 @@ package org.jivesoftware.smackx.jingle;
|
|||
* Created by vanitas on 27.07.17.
|
||||
*/
|
||||
public interface JingleDescriptionController {
|
||||
|
||||
enum State {
|
||||
pending, //Not yet accepted by us/peer
|
||||
negotiating, //Accepted, but still negotiating transports etc.
|
||||
|
|
|
@ -1,27 +0,0 @@
|
|||
/**
|
||||
*
|
||||
* Copyright 2017 Paul Schaub
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.jivesoftware.smackx.jingle.callbacks;
|
||||
|
||||
/**
|
||||
* Callback that gets called when the user accepts a content-add request.
|
||||
*/
|
||||
public interface ContentAddCallback {
|
||||
|
||||
void acceptContentAdd();
|
||||
|
||||
void rejectContentAdd();
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
package org.jivesoftware.smackx.jingle.callbacks;
|
||||
|
||||
import org.jivesoftware.smackx.jingle.JingleDescriptionController;
|
||||
|
||||
/**
|
||||
* Created by vanitas on 27.07.17.
|
||||
*/
|
||||
public interface JingleCallback<P extends JingleCallback.Parameters> {
|
||||
|
||||
JingleDescriptionController accept(P parameters);
|
||||
|
||||
void decline();
|
||||
|
||||
class Parameters {
|
||||
|
||||
}
|
||||
}
|
|
@ -260,7 +260,7 @@ public class JingleContent {
|
|||
connection.createStanzaCollectorAndSend(transportReplace).nextResultOrThrow();
|
||||
}
|
||||
|
||||
public void onContentAccept(XMPPConnection connection, )
|
||||
public void onContentAccept(XMPPConnection connection)
|
||||
throws SmackException.NotConnectedException, InterruptedException {
|
||||
//Establish transport
|
||||
if (isReceiving()) {
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
package org.jivesoftware.smackx.jingle.components;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.jivesoftware.smackx.bytestreams.BytestreamSession;
|
||||
|
||||
/**
|
||||
* Created by vanitas on 27.07.17.
|
||||
*/
|
||||
public abstract class JingleSecurityBytestreamSession implements BytestreamSession {
|
||||
|
||||
protected BytestreamSession wrapped;
|
||||
|
||||
@Override
|
||||
public int getReadTimeout() throws IOException {
|
||||
return wrapped.getReadTimeout();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setReadTimeout(int timeout) throws IOException {
|
||||
wrapped.setReadTimeout(timeout);
|
||||
}
|
||||
|
||||
public JingleSecurityBytestreamSession(BytestreamSession session) {
|
||||
this.wrapped = session;
|
||||
}
|
||||
}
|
|
@ -81,6 +81,26 @@ public class JingleSession {
|
|||
addContent(JingleContent.fromElement(content));
|
||||
}
|
||||
|
||||
public ConcurrentHashMap<String, JingleContent> getContents() {
|
||||
return contents;
|
||||
}
|
||||
|
||||
public JingleContent getContent(String name) {
|
||||
return contents.get(name);
|
||||
}
|
||||
|
||||
public JingleContent getSoleContentOrThrow() {
|
||||
if (contents.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (contents.size() > 1) {
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
return contents.values().iterator().next();
|
||||
}
|
||||
|
||||
public static JingleSession fromSessionInitiate(JingleManager manager, JingleElement initiate)
|
||||
throws UnsupportedSecurityException, UnsupportedDescriptionException, UnsupportedTransportException {
|
||||
if (initiate.getAction() != JingleAction.session_initiate) {
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
package org.jivesoftware.smackx.jingle.controller;
|
||||
|
||||
/**
|
||||
* Created by vanitas on 27.07.17.
|
||||
*/
|
||||
public interface JingleDescriptionController {
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue