use newer api for some jingle actions

Daniel Gultsch created

Change summary

src/main/java/eu/siacs/conversations/xmpp/jingle/AbstractJingleConnection.java |  1 
src/main/java/eu/siacs/conversations/xmpp/jingle/JingleRtpConnection.java      | 27 
2 files changed, 8 insertions(+), 20 deletions(-)

Detailed changes

src/main/java/eu/siacs/conversations/xmpp/jingle/AbstractJingleConnection.java 🔗

@@ -20,6 +20,7 @@ import eu.siacs.conversations.entities.ServiceDiscoveryResult;
 import eu.siacs.conversations.services.XmppConnectionService;
 import eu.siacs.conversations.xmpp.Jid;
 import eu.siacs.conversations.xmpp.jingle.stanzas.Reason;
+
 import im.conversations.android.xmpp.model.jingle.Jingle;
 import im.conversations.android.xmpp.model.stanza.Iq;
 

src/main/java/eu/siacs/conversations/xmpp/jingle/JingleRtpConnection.java 🔗

@@ -239,20 +239,7 @@ public class JingleRtpConnection extends AbstractJingleConnection
             }
             receiveTransportInfo(jinglePacket, contentMap);
         } else {
-            if (isTerminated()) {
-                respondOk(jinglePacket);
-                Log.d(
-                        Config.LOGTAG,
-                        id.account.getJid().asBareJid()
-                                + ": ignoring out-of-order transport info; we where already terminated");
-            } else {
-                Log.d(
-                        Config.LOGTAG,
-                        id.account.getJid().asBareJid()
-                                + ": received transport info while in state="
-                                + this.state);
-                terminateWithOutOfOrder(jinglePacket);
-            }
+            receiveOutOfOrderAction(jinglePacket, Jingle.Action.TRANSPORT_INFO);
         }
     }
 
@@ -340,7 +327,7 @@ public class JingleRtpConnection extends AbstractJingleConnection
                     },
                     MoreExecutors.directExecutor());
         } else {
-            terminateWithOutOfOrder(iq);
+            receiveOutOfOrderAction(iq, Jingle.Action.CONTENT_ADD);
         }
     }
 
@@ -416,7 +403,7 @@ public class JingleRtpConnection extends AbstractJingleConnection
         final RtpContentMap outgoingContentAdd = this.outgoingContentAdd;
         if (outgoingContentAdd == null) {
             Log.d(Config.LOGTAG, "received content-accept when we had no outgoing content add");
-            terminateWithOutOfOrder(jinglePacket);
+            receiveOutOfOrderAction(jinglePacket, Jingle.Action.CONTENT_ACCEPT);
             return;
         }
         final Set<ContentAddition.Summary> ourSummary = ContentAddition.summary(outgoingContentAdd);
@@ -446,7 +433,7 @@ public class JingleRtpConnection extends AbstractJingleConnection
                     MoreExecutors.directExecutor());
         } else {
             Log.d(Config.LOGTAG, "received content-accept did not match our outgoing content-add");
-            terminateWithOutOfOrder(jinglePacket);
+            receiveOutOfOrderAction(jinglePacket, Jingle.Action.CONTENT_ACCEPT);
         }
     }
 
@@ -487,7 +474,7 @@ public class JingleRtpConnection extends AbstractJingleConnection
 
     private void receiveContentModify(final Iq jinglePacket, final Jingle jingle) {
         if (this.state != State.SESSION_ACCEPTED) {
-            terminateWithOutOfOrder(jinglePacket);
+            receiveOutOfOrderAction(jinglePacket, Jingle.Action.CONTENT_MODIFY);
             return;
         }
         final Map<String, Content.Senders> modification =
@@ -613,7 +600,7 @@ public class JingleRtpConnection extends AbstractJingleConnection
         final RtpContentMap outgoingContentAdd = this.outgoingContentAdd;
         if (outgoingContentAdd == null) {
             Log.d(Config.LOGTAG, "received content-reject when we had no outgoing content add");
-            terminateWithOutOfOrder(jinglePacket);
+            receiveOutOfOrderAction(jinglePacket, Jingle.Action.CONTENT_REJECT);
             return;
         }
         final Set<ContentAddition.Summary> ourSummary = ContentAddition.summary(outgoingContentAdd);
@@ -624,7 +611,7 @@ public class JingleRtpConnection extends AbstractJingleConnection
             receiveContentReject(ourSummary);
         } else {
             Log.d(Config.LOGTAG, "received content-reject did not match our outgoing content-add");
-            terminateWithOutOfOrder(jinglePacket);
+            receiveOutOfOrderAction(jinglePacket, Jingle.Action.CONTENT_REJECT);
         }
     }