author
int64 658
755k
| date
stringlengths 19
19
| timezone
int64 -46,800
43.2k
| hash
stringlengths 40
40
| message
stringlengths 5
490
| mods
list | language
stringclasses 20
values | license
stringclasses 3
values | repo
stringlengths 5
68
| original_message
stringlengths 12
491
|
---|---|---|---|---|---|---|---|---|---|
299,323 | 19.06.2017 10:11:08 | -7,200 | b14aca744f85fa40aef98170527462628362bc0e | Add Jingle SOCKS5Bytestream transport method | [
{
"change_type": "MODIFY",
"old_path": "smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/element/JingleContentTransport.java",
"new_path": "smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/element/JingleContentTransport.java",
"diff": "@@ -74,7 +74,7 @@ public abstract class JingleContentTransport implements ExtensionElement {\nXmlStringBuilder xml = new XmlStringBuilder(this);\naddExtraAttributes(xml);\n- if (candidates.isEmpty()) {\n+ if (candidates.isEmpty() && infos.isEmpty()) {\nxml.closeEmptyElement();\n} else {\n@@ -87,5 +87,4 @@ public abstract class JingleContentTransport implements ExtensionElement {\nreturn xml;\n}\n-\n}\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/transports/jingle_s5b/elements/JingleS5BTransport.java",
"diff": "+/**\n+ *\n+ * Copyright 2017 Paul Schaub\n+ *\n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * You may obtain a copy of the License at\n+ *\n+ * http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+package org.jivesoftware.smackx.jingle.transports.jingle_s5b.elements;\n+\n+import java.util.ArrayList;\n+import java.util.List;\n+\n+import org.jivesoftware.smack.util.StringUtils;\n+import org.jivesoftware.smack.util.XmlStringBuilder;\n+import org.jivesoftware.smackx.bytestreams.socks5.packet.Bytestream;\n+import org.jivesoftware.smackx.jingle.element.JingleContentTransport;\n+import org.jivesoftware.smackx.jingle.element.JingleContentTransportCandidate;\n+import org.jivesoftware.smackx.jingle.element.JingleContentTransportInfo;\n+\n+/**\n+ * Socks5Bytestream transport element.\n+ */\n+public class JingleS5BTransport extends JingleContentTransport {\n+ public static final String NAMESPACE_V1 = \"urn:xmpp:jingle:transports:s5b:1\";\n+ public static final String ATTR_DSTADDR = \"dstaddr\";\n+ public static final String ATTR_MODE = \"mode\";\n+ public static final String ATTR_SID = \"sid\";\n+\n+ private final String streamId;\n+ private final String dstAddr;\n+ private final Bytestream.Mode mode;\n+\n+ protected JingleS5BTransport(List<JingleContentTransportCandidate> candidates, List<JingleContentTransportInfo> infos, String streamId, String dstAddr, Bytestream.Mode mode) {\n+ super(candidates, infos);\n+ StringUtils.requireNotNullOrEmpty(streamId, \"sid MUST be neither null, nor empty.\");\n+ this.streamId = streamId;\n+ this.dstAddr = dstAddr;\n+ this.mode = mode;\n+ }\n+\n+ public String getStreamId() {\n+ return streamId;\n+ }\n+\n+ public String getDestinationAddress() {\n+ return dstAddr;\n+ }\n+\n+ public Bytestream.Mode getMode() {\n+ return mode == null ? Bytestream.Mode.tcp : mode;\n+ }\n+\n+ @Override\n+ public String getNamespace() {\n+ return NAMESPACE_V1;\n+ }\n+\n+ @Override\n+ protected void addExtraAttributes(XmlStringBuilder xml) {\n+ xml.optAttribute(ATTR_DSTADDR, dstAddr);\n+ xml.optAttribute(ATTR_MODE, mode);\n+ xml.attribute(ATTR_SID, streamId);\n+ }\n+\n+ public boolean hasCandidate(String candidateId) {\n+ return getCandidate(candidateId) != null;\n+ }\n+\n+ public JingleS5BTransportCandidate getCandidate(String candidateId) {\n+ for (JingleContentTransportCandidate c : candidates) {\n+ JingleS5BTransportCandidate candidate = (JingleS5BTransportCandidate) c;\n+ if (candidate.getCandidateId().equals(candidateId)) {\n+ return candidate;\n+ }\n+ }\n+ return null;\n+ }\n+\n+ public static Builder getBuilder() {\n+ return new Builder();\n+ }\n+\n+ public static class Builder {\n+ private String streamId;\n+ private String dstAddr;\n+ private Bytestream.Mode mode;\n+ private ArrayList<JingleContentTransportCandidate> candidates = new ArrayList<>();\n+ private ArrayList<JingleContentTransportInfo> infos = new ArrayList<>();\n+\n+ public Builder setStreamId(String sid) {\n+ this.streamId = sid;\n+ return this;\n+ }\n+\n+ public Builder setDestinationAddress(String dstAddr) {\n+ this.dstAddr = dstAddr;\n+ return this;\n+ }\n+\n+ public Builder setMode(Bytestream.Mode mode) {\n+ this.mode = mode;\n+ return this;\n+ }\n+\n+ public Builder addTransportCandidate(JingleS5BTransportCandidate candidate) {\n+ this.candidates.add(candidate);\n+ return this;\n+ }\n+\n+ public Builder addTransportInfo(JingleContentTransportInfo info) {\n+ this.infos.add(info);\n+ return this;\n+ }\n+\n+ public Builder setCandidateUsed(String candidateId) {\n+ return addTransportInfo(JingleS5BTransportInfo.CandidateUsed(candidateId));\n+ }\n+\n+ public Builder setCandidateActivated(String candidateId) {\n+ return addTransportInfo(JingleS5BTransportInfo.CandidateActivated(candidateId));\n+ }\n+\n+ public Builder setCandidateError() {\n+ return addTransportInfo(JingleS5BTransportInfo.CandidateError());\n+ }\n+\n+ public Builder setProxyError() {\n+ return addTransportInfo(JingleS5BTransportInfo.ProxyError());\n+ }\n+\n+ public JingleS5BTransport build() {\n+ return new JingleS5BTransport(candidates, infos, streamId, dstAddr, mode);\n+ }\n+ }\n+}\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/transports/jingle_s5b/elements/JingleS5BTransportCandidate.java",
"diff": "+/**\n+ *\n+ * Copyright 2017 Paul Schaub\n+ *\n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * You may obtain a copy of the License at\n+ *\n+ * http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+package org.jivesoftware.smackx.jingle.transports.jingle_s5b.elements;\n+\n+import java.util.logging.Logger;\n+\n+import org.jivesoftware.smack.util.Objects;\n+import org.jivesoftware.smack.util.StringUtils;\n+import org.jivesoftware.smack.util.XmlStringBuilder;\n+import org.jivesoftware.smackx.bytestreams.socks5.packet.Bytestream;\n+import org.jivesoftware.smackx.jingle.element.JingleContentTransportCandidate;\n+\n+import org.jxmpp.jid.Jid;\n+import org.jxmpp.jid.impl.JidCreate;\n+import org.jxmpp.stringprep.XmppStringprepException;\n+\n+/**\n+ * TransportCandidate for Jingle Socks5Bytestream transports.\n+ */\n+public final class JingleS5BTransportCandidate extends JingleContentTransportCandidate {\n+\n+ private static final Logger LOGGER = Logger.getLogger(JingleS5BTransportCandidate.class.getName());\n+\n+ public static final String ATTR_CID = \"cid\";\n+ public static final String ATTR_HOST = \"host\";\n+ public static final String ATTR_JID = \"jid\";\n+ public static final String ATTR_PORT = \"port\";\n+ public static final String ATTR_PRIORITY = \"priority\";\n+ public static final String ATTR_TYPE = \"type\";\n+\n+ private final String cid;\n+ private final String host;\n+ private final Jid jid;\n+ private final int port;\n+ private final int priority;\n+ private final Type type;\n+\n+ public JingleS5BTransportCandidate(String candidateId, String host, Jid jid, int port, int priority, Type type) {\n+\n+ Objects.requireNonNull(candidateId);\n+ Objects.requireNonNull(host);\n+ Objects.requireNonNull(jid);\n+ if (priority < 0) {\n+ throw new IllegalArgumentException(\"Priority MUST be present and NOT less than 0.\");\n+ }\n+\n+ this.cid = candidateId;\n+ this.host = host;\n+ this.jid = jid;\n+ this.port = port;\n+ this.priority = priority;\n+ this.type = type;\n+ }\n+\n+ public JingleS5BTransportCandidate(Bytestream.StreamHost streamHost, int priority) {\n+ this(StringUtils.randomString(24), streamHost.getAddress(), streamHost.getJID(), streamHost.getPort(), priority, Type.proxy);\n+ }\n+\n+ public enum Type {\n+ assisted (120),\n+ direct (126),\n+ proxy (10),\n+ tunnel (110),\n+ ;\n+\n+ private final int weight;\n+\n+ public int getWeight() {\n+ return weight;\n+ }\n+\n+ Type(int weight) {\n+ this.weight = weight;\n+ }\n+\n+ public static Type fromString(String name) {\n+ for (Type t : Type.values()) {\n+ if (t.toString().equals(name)) {\n+ return t;\n+ }\n+ }\n+ throw new IllegalArgumentException(\"Illegal type: \" + name);\n+ }\n+ }\n+\n+ public String getCandidateId() {\n+ return cid;\n+ }\n+\n+ public String getHost() {\n+ return host;\n+ }\n+\n+ public Jid getJid() {\n+ return jid;\n+ }\n+\n+ public int getPort() {\n+ return port;\n+ }\n+\n+ public int getPriority() {\n+ return priority;\n+ }\n+\n+ public Type getType() {\n+ return type;\n+ }\n+\n+ public Bytestream.StreamHost getStreamHost() {\n+ return new Bytestream.StreamHost(jid, host, port);\n+ }\n+\n+ @Override\n+ public CharSequence toXML() {\n+ XmlStringBuilder xml = new XmlStringBuilder();\n+ xml.halfOpenElement(this);\n+ xml.attribute(ATTR_CID, cid);\n+ xml.attribute(ATTR_HOST, host);\n+ xml.attribute(ATTR_JID, jid);\n+ if (port >= 0) {\n+ xml.attribute(ATTR_PORT, port);\n+ }\n+ xml.attribute(ATTR_PRIORITY, priority);\n+ xml.optAttribute(ATTR_TYPE, type);\n+\n+ xml.closeEmptyElement();\n+ return xml;\n+ }\n+\n+ public static Builder getBuilder() {\n+ return new Builder();\n+ }\n+\n+ public static final class Builder {\n+ private String cid;\n+ private String host;\n+ private Jid jid;\n+ private int port = -1;\n+ private int priority = -1;\n+ private Type type;\n+\n+ private Builder() {\n+ }\n+\n+ public Builder setCandidateId(String cid) {\n+ this.cid = cid;\n+ return this;\n+ }\n+\n+ public Builder setHost(String host) {\n+ this.host = host;\n+ return this;\n+ }\n+\n+ public Builder setJid(String jid) throws XmppStringprepException {\n+ this.jid = JidCreate.from(jid);\n+ return this;\n+ }\n+\n+ public Builder setPort(int port) {\n+ if (port < 0) {\n+ throw new IllegalArgumentException(\"Port MUST NOT be less than 0.\");\n+ }\n+ this.port = port;\n+ return this;\n+ }\n+\n+ public Builder setPriority(int priority) {\n+ if (priority < 0) {\n+ throw new IllegalArgumentException(\"Priority MUST NOT be less than 0.\");\n+ }\n+ this.priority = priority;\n+ return this;\n+ }\n+\n+ public Builder setType(Type type) {\n+ this.type = type;\n+ return this;\n+ }\n+\n+ public JingleS5BTransportCandidate build() {\n+ return new JingleS5BTransportCandidate(cid, host, jid, port, priority, type);\n+ }\n+ }\n+}\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/transports/jingle_s5b/elements/JingleS5BTransportInfo.java",
"diff": "+/**\n+ *\n+ * Copyright 2017 Paul Schaub\n+ *\n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * You may obtain a copy of the License at\n+ *\n+ * http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+package org.jivesoftware.smackx.jingle.transports.jingle_s5b.elements;\n+\n+import org.jivesoftware.smack.util.XmlStringBuilder;\n+import org.jivesoftware.smackx.jingle.element.JingleContentTransportInfo;\n+\n+/**\n+ * Class representing possible SOCKS5 TransportInfo elements.\n+ */\n+public abstract class JingleS5BTransportInfo extends JingleContentTransportInfo {\n+\n+ private static CandidateError CEI;\n+ private static ProxyError PEI;\n+\n+ public static CandidateUsed CandidateUsed(String candidateId) {\n+ return new CandidateUsed(candidateId);\n+ }\n+\n+ public static CandidateActivated CandidateActivated(String candidateId) {\n+ return new CandidateActivated(candidateId);\n+ }\n+\n+ public static CandidateError CandidateError() {\n+ if (CEI == null) {\n+ CEI = new CandidateError();\n+ }\n+ return CEI;\n+ }\n+\n+ public static ProxyError ProxyError() {\n+ if (PEI == null) {\n+ PEI = new ProxyError();\n+ }\n+ return PEI;\n+ }\n+\n+ public static final class CandidateActivated extends JingleS5BTransportInfo {\n+ public static final String ELEMENT = \"candidate-activated\";\n+ public static final String ATTR_CID = \"cid\";\n+\n+ private final String candidateId;\n+\n+ public CandidateActivated(String candidateId) {\n+ this.candidateId = candidateId;\n+ }\n+\n+ public String getCandidateId() {\n+ return candidateId;\n+ }\n+\n+ @Override\n+ public String getElementName() {\n+ return ELEMENT;\n+ }\n+\n+ @Override\n+ public CharSequence toXML() {\n+ XmlStringBuilder xml = new XmlStringBuilder();\n+ xml.halfOpenElement(this);\n+ xml.attribute(ATTR_CID, candidateId);\n+ xml.closeEmptyElement();\n+ return xml;\n+ }\n+\n+ @Override\n+ public boolean equals(Object other) {\n+ return other instanceof CandidateActivated &&\n+ ((CandidateActivated) other).getCandidateId().equals(candidateId);\n+ }\n+\n+ @Override\n+ public int hashCode() {\n+ return toXML().toString().hashCode();\n+ }\n+ }\n+\n+ public static final class CandidateUsed extends JingleS5BTransportInfo {\n+ public static final String ELEMENT = \"candidate-used\";\n+ public static final String ATTR_CID = \"cid\";\n+\n+ private final String candidateId;\n+\n+ public CandidateUsed(String candidateId) {\n+ this.candidateId = candidateId;\n+ }\n+\n+ public String getCandidateId() {\n+ return candidateId;\n+ }\n+\n+ @Override\n+ public String getElementName() {\n+ return ELEMENT;\n+ }\n+\n+ @Override\n+ public CharSequence toXML() {\n+ XmlStringBuilder xml = new XmlStringBuilder();\n+ xml.halfOpenElement(this);\n+ xml.attribute(ATTR_CID, candidateId);\n+ xml.closeEmptyElement();\n+ return xml;\n+ }\n+\n+ @Override\n+ public boolean equals(Object other) {\n+ return other instanceof CandidateUsed &&\n+ ((CandidateUsed) other).getCandidateId().equals(candidateId);\n+ }\n+\n+ @Override\n+ public int hashCode() {\n+ return toXML().toString().hashCode();\n+ }\n+ }\n+\n+ public static final class CandidateError extends JingleS5BTransportInfo {\n+ public static final String ELEMENT = \"candidate-error\";\n+\n+ private CandidateError() {\n+\n+ }\n+\n+ @Override\n+ public String getElementName() {\n+ return ELEMENT;\n+ }\n+\n+ @Override\n+ public CharSequence toXML() {\n+ XmlStringBuilder xml = new XmlStringBuilder();\n+ xml.halfOpenElement(this);\n+ xml.closeEmptyElement();\n+ return xml;\n+ }\n+\n+ @Override\n+ public boolean equals(Object other) {\n+ return other instanceof CandidateError;\n+ }\n+\n+ @Override\n+ public int hashCode() {\n+ return toXML().toString().hashCode();\n+ }\n+ }\n+\n+ public static final class ProxyError extends JingleS5BTransportInfo {\n+ public static final String ELEMENT = \"proxy-error\";\n+\n+ private ProxyError() {\n+\n+ }\n+\n+ @Override\n+ public String getElementName() {\n+ return ELEMENT;\n+ }\n+\n+ @Override\n+ public CharSequence toXML() {\n+ XmlStringBuilder xml = new XmlStringBuilder();\n+ xml.halfOpenElement(this);\n+ xml.closeEmptyElement();\n+ return xml;\n+ }\n+\n+ @Override\n+ public boolean equals(Object other) {\n+ return other instanceof ProxyError;\n+ }\n+\n+ @Override\n+ public int hashCode() {\n+ return toXML().toString().hashCode();\n+ }\n+ }\n+}\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/transports/jingle_s5b/elements/package-info.java",
"diff": "+/**\n+ *\n+ * Copyright 2017 Paul Schaub\n+ *\n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * You may obtain a copy of the License at\n+ *\n+ * http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+\n+/**\n+ * Smack's API for <a href=\"https://xmpp.org/extensions/xep-0261.html\">XEP-0260: Jingle SOCKS5 Bytestreams</a>.\n+ * Element classes.\n+ */\n+package org.jivesoftware.smackx.jingle.transports.jingle_s5b.elements;\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/transports/jingle_s5b/package-info.java",
"diff": "+/**\n+ *\n+ * Copyright 2017 Paul Schaub\n+ *\n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * You may obtain a copy of the License at\n+ *\n+ * http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+\n+/**\n+ * Smack's API for <a href=\"https://xmpp.org/extensions/xep-0261.html\">XEP-0260: Jingle SOCKS5 Bytestreams</a>.\n+ */\n+package org.jivesoftware.smackx.jingle.transports.jingle_s5b;\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/transports/jingle_s5b/provider/JingleS5BTransportProvider.java",
"diff": "+/**\n+ *\n+ * Copyright 2017 Paul Schaub\n+ *\n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * You may obtain a copy of the License at\n+ *\n+ * http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+package org.jivesoftware.smackx.jingle.transports.jingle_s5b.provider;\n+\n+import static org.jivesoftware.smackx.bytestreams.socks5.packet.Bytestream.Mode.tcp;\n+import static org.jivesoftware.smackx.bytestreams.socks5.packet.Bytestream.Mode.udp;\n+import static org.jivesoftware.smackx.jingle.transports.jingle_s5b.elements.JingleS5BTransportCandidate.ATTR_CID;\n+import static org.jivesoftware.smackx.jingle.transports.jingle_s5b.elements.JingleS5BTransportCandidate.ATTR_HOST;\n+import static org.jivesoftware.smackx.jingle.transports.jingle_s5b.elements.JingleS5BTransportCandidate.ATTR_JID;\n+import static org.jivesoftware.smackx.jingle.transports.jingle_s5b.elements.JingleS5BTransportCandidate.ATTR_PORT;\n+import static org.jivesoftware.smackx.jingle.transports.jingle_s5b.elements.JingleS5BTransportCandidate.ATTR_PRIORITY;\n+import static org.jivesoftware.smackx.jingle.transports.jingle_s5b.elements.JingleS5BTransportCandidate.ATTR_TYPE;\n+import static org.xmlpull.v1.XmlPullParser.END_TAG;\n+import static org.xmlpull.v1.XmlPullParser.START_TAG;\n+\n+import org.jivesoftware.smackx.jingle.element.JingleContentTransport;\n+import org.jivesoftware.smackx.jingle.provider.JingleContentTransportProvider;\n+import org.jivesoftware.smackx.jingle.transports.jingle_s5b.elements.JingleS5BTransport;\n+import org.jivesoftware.smackx.jingle.transports.jingle_s5b.elements.JingleS5BTransportCandidate;\n+import org.jivesoftware.smackx.jingle.transports.jingle_s5b.elements.JingleS5BTransportInfo;\n+\n+import org.xmlpull.v1.XmlPullParser;\n+\n+/**\n+ * Provider for JingleSocks5BytestreamTransport elements.\n+ */\n+public class JingleS5BTransportProvider extends JingleContentTransportProvider<JingleS5BTransport> {\n+\n+ @Override\n+ public JingleS5BTransport parse(XmlPullParser parser, int initialDepth) throws Exception {\n+ JingleS5BTransport.Builder builder = JingleS5BTransport.getBuilder();\n+\n+ String streamId = parser.getAttributeValue(null, JingleS5BTransport.ATTR_SID);\n+ builder.setStreamId(streamId);\n+\n+ String dstAddr = parser.getAttributeValue(null, JingleS5BTransport.ATTR_DSTADDR);\n+ builder.setDestinationAddress(dstAddr);\n+\n+ String mode = parser.getAttributeValue(null, JingleS5BTransport.ATTR_MODE);\n+ if (mode != null) {\n+ builder.setMode(mode.equals(udp.toString()) ? udp : tcp);\n+ }\n+\n+ JingleS5BTransportCandidate.Builder cb;\n+ outerloop: while (true) {\n+ int tag = parser.nextTag();\n+ String name = parser.getName();\n+ switch (tag) {\n+ case START_TAG: {\n+ switch (name) {\n+\n+ case JingleS5BTransportCandidate.ELEMENT:\n+ cb = JingleS5BTransportCandidate.getBuilder();\n+ cb.setCandidateId(parser.getAttributeValue(null, ATTR_CID));\n+ cb.setHost(parser.getAttributeValue(null, ATTR_HOST));\n+ cb.setJid(parser.getAttributeValue(null, ATTR_JID));\n+ cb.setPriority(Integer.parseInt(parser.getAttributeValue(null, ATTR_PRIORITY)));\n+\n+ String portString = parser.getAttributeValue(null, ATTR_PORT);\n+ if (portString != null) {\n+ cb.setPort(Integer.parseInt(portString));\n+ }\n+\n+ String typeString = parser.getAttributeValue(null, ATTR_TYPE);\n+ if (typeString != null) {\n+ cb.setType(JingleS5BTransportCandidate.Type.fromString(typeString));\n+ }\n+ builder.addTransportCandidate(cb.build());\n+ break;\n+\n+ case JingleS5BTransportInfo.CandidateActivated.ELEMENT:\n+ builder.addTransportInfo(JingleS5BTransportInfo.CandidateActivated(\n+ parser.getAttributeValue(null,\n+ JingleS5BTransportInfo.CandidateActivated.ATTR_CID)));\n+ break;\n+\n+ case JingleS5BTransportInfo.CandidateUsed.ELEMENT:\n+ builder.addTransportInfo(JingleS5BTransportInfo.CandidateUsed(\n+ parser.getAttributeValue(null,\n+ JingleS5BTransportInfo.CandidateUsed.ATTR_CID)));\n+ break;\n+\n+ case JingleS5BTransportInfo.CandidateError.ELEMENT:\n+ builder.addTransportInfo(JingleS5BTransportInfo.CandidateError());\n+ break;\n+\n+ case JingleS5BTransportInfo.ProxyError.ELEMENT:\n+ builder.addTransportInfo(JingleS5BTransportInfo.ProxyError());\n+ break;\n+ }\n+ }\n+ break;\n+\n+ case END_TAG: {\n+ switch (name) {\n+ case JingleContentTransport.ELEMENT:\n+ break outerloop;\n+ }\n+ }\n+ }\n+ }\n+ return builder.build();\n+ }\n+}\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/transports/jingle_s5b/provider/package-info.java",
"diff": "+/**\n+ *\n+ * Copyright 2017 Paul Schaub\n+ *\n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * You may obtain a copy of the License at\n+ *\n+ * http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+\n+/**\n+ * Smack's API for <a href=\"https://xmpp.org/extensions/xep-0261.html\">XEP-0260: Jingle SOCKS5 Bytestreams</a>.\n+ * Provider classes.\n+ */\n+package org.jivesoftware.smackx.jingle.transports.jingle_s5b.provider;\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "smack-extensions/src/test/java/org/jivesoftware/smackx/jingle/transports/jingle_s5b/JingleS5BTransportTest.java",
"diff": "+/**\n+ *\n+ * Copyright 2017 Paul Schaub\n+ *\n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * You may obtain a copy of the License at\n+ *\n+ * http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+package org.jivesoftware.smackx.jingle.transports.jingle_s5b;\n+\n+import static junit.framework.TestCase.assertNull;\n+import static org.junit.Assert.assertEquals;\n+\n+import org.jivesoftware.smack.test.util.SmackTestSuite;\n+import org.jivesoftware.smack.test.util.TestUtils;\n+import org.jivesoftware.smackx.bytestreams.socks5.packet.Bytestream;\n+import org.jivesoftware.smackx.jingle.transports.jingle_s5b.elements.JingleS5BTransport;\n+import org.jivesoftware.smackx.jingle.transports.jingle_s5b.elements.JingleS5BTransportCandidate;\n+import org.jivesoftware.smackx.jingle.transports.jingle_s5b.elements.JingleS5BTransportInfo;\n+import org.jivesoftware.smackx.jingle.transports.jingle_s5b.provider.JingleS5BTransportProvider;\n+\n+import org.junit.Test;\n+import org.jxmpp.jid.impl.JidCreate;\n+\n+/**\n+ * Test Provider and serialization.\n+ */\n+public class JingleS5BTransportTest extends SmackTestSuite {\n+\n+ @Test\n+ public void candidatesProviderTest() throws Exception {\n+ String xml =\n+ \"<transport \" +\n+ \"xmlns='urn:xmpp:jingle:transports:s5b:1' \" +\n+ \"dstaddr='972b7bf47291ca609517f67f86b5081086052dad' \" +\n+ \"mode='tcp' \" +\n+ \"sid='vj3hs98y'>\" +\n+\n+ \"<candidate \" +\n+ \"cid='hft54dqy' \" +\n+ \"host='192.168.4.1' \" +\n+ \"jid='[email protected]/orchard' \" +\n+ \"port='5086' \" +\n+ \"priority='8257636' \" +\n+ \"type='direct'/>\" +\n+\n+ \"<candidate \" +\n+ \"cid='hutr46fe' \" +\n+ \"host='24.24.24.1' \" +\n+ \"jid='[email protected]/orchard' \" +\n+ \"port='5087' \" +\n+ \"priority='8258636' \" +\n+ \"type='direct'/>\" +\n+\n+ \"<candidate \" +\n+ \"cid='xmdh4b7i' \" +\n+ \"host='123.456.7.8' \" +\n+ \"jid='streamer.shakespeare.lit' \" +\n+ \"port='7625' \" +\n+ \"priority='7878787' \" +\n+ \"type='proxy'/>\" +\n+\n+ \"</transport>\";\n+ JingleS5BTransport transport = new JingleS5BTransportProvider().parse(TestUtils.getParser(xml));\n+ assertEquals(\"972b7bf47291ca609517f67f86b5081086052dad\", transport.getDestinationAddress());\n+ assertEquals(\"vj3hs98y\", transport.getStreamId());\n+ assertEquals(Bytestream.Mode.tcp, transport.getMode());\n+ assertEquals(3, transport.getCandidates().size());\n+\n+ JingleS5BTransportCandidate candidate1 =\n+ (JingleS5BTransportCandidate) transport.getCandidates().get(0);\n+ assertEquals(\"hft54dqy\", candidate1.getCandidateId());\n+ assertEquals(\"192.168.4.1\", candidate1.getHost());\n+ assertEquals(JidCreate.from(\"[email protected]/orchard\"), candidate1.getJid());\n+ assertEquals(5086, candidate1.getPort());\n+ assertEquals(8257636, candidate1.getPriority());\n+ assertEquals(JingleS5BTransportCandidate.Type.direct, candidate1.getType());\n+\n+ JingleS5BTransportCandidate candidate2 =\n+ (JingleS5BTransportCandidate) transport.getCandidates().get(1);\n+ assertEquals(\"hutr46fe\", candidate2.getCandidateId());\n+ assertEquals(\"24.24.24.1\", candidate2.getHost());\n+ assertEquals(JidCreate.from(\"[email protected]/orchard\"), candidate2.getJid());\n+ assertEquals(5087, candidate2.getPort());\n+ assertEquals(8258636, candidate2.getPriority());\n+ assertEquals(JingleS5BTransportCandidate.Type.direct, candidate2.getType());\n+\n+ JingleS5BTransportCandidate candidate3 =\n+ (JingleS5BTransportCandidate) transport.getCandidates().get(2);\n+ assertEquals(\"xmdh4b7i\", candidate3.getCandidateId());\n+ assertEquals(\"123.456.7.8\", candidate3.getHost());\n+ assertEquals(JidCreate.domainBareFrom(\"streamer.shakespeare.lit\"), candidate3.getJid());\n+ assertEquals(7625, candidate3.getPort());\n+ assertEquals(7878787, candidate3.getPriority());\n+ assertEquals(JingleS5BTransportCandidate.Type.proxy, candidate3.getType());\n+\n+ assertEquals(xml, transport.toXML().toString());\n+ }\n+\n+ @Test\n+ public void infoProviderTest() throws Exception {\n+ String candidateError =\n+ \"<transport xmlns='urn:xmpp:jingle:transports:s5b:1' sid='vj3hs98y'>\" +\n+ \"<candidate-error/>\" +\n+ \"</transport>\";\n+ JingleS5BTransport candidateErrorTransport = new JingleS5BTransportProvider()\n+ .parse(TestUtils.getParser(candidateError));\n+ assertNull(candidateErrorTransport.getDestinationAddress());\n+ assertEquals(1, candidateErrorTransport.getInfos().size());\n+ assertEquals(\"vj3hs98y\", candidateErrorTransport.getStreamId());\n+ assertEquals(JingleS5BTransportInfo.CandidateError(),\n+ candidateErrorTransport.getInfos().get(0));\n+ assertEquals(candidateError, candidateErrorTransport.toXML().toString());\n+\n+ String proxyError =\n+ \"<transport xmlns='urn:xmpp:jingle:transports:s5b:1' sid='vj3hs98y'>\" +\n+ \"<proxy-error/>\" +\n+ \"</transport>\";\n+ JingleS5BTransport proxyErrorTransport = new JingleS5BTransportProvider()\n+ .parse(TestUtils.getParser(proxyError));\n+ assertNull(proxyErrorTransport.getDestinationAddress());\n+ assertEquals(1, proxyErrorTransport.getInfos().size());\n+ assertEquals(\"vj3hs98y\", proxyErrorTransport.getStreamId());\n+ assertEquals(JingleS5BTransportInfo.ProxyError(),\n+ proxyErrorTransport.getInfos().get(0));\n+ assertEquals(proxyError, proxyErrorTransport.toXML().toString());\n+\n+ String candidateUsed =\n+ \"<transport xmlns='urn:xmpp:jingle:transports:s5b:1' sid='vj3hs98y'>\" +\n+ \"<candidate-used cid='hr65dqyd'/>\" +\n+ \"</transport>\";\n+ JingleS5BTransport candidateUsedTransport = new JingleS5BTransportProvider()\n+ .parse(TestUtils.getParser(candidateUsed));\n+ assertEquals(1, candidateUsedTransport.getInfos().size());\n+ assertEquals(JingleS5BTransportInfo.CandidateUsed(\"hr65dqyd\"),\n+ candidateUsedTransport.getInfos().get(0));\n+ assertEquals(\"hr65dqyd\",\n+ ((JingleS5BTransportInfo.CandidateUsed)\n+ candidateUsedTransport.getInfos().get(0)).getCandidateId());\n+ assertEquals(candidateUsed, candidateUsedTransport.toXML().toString());\n+\n+ String candidateActivated =\n+ \"<transport xmlns='urn:xmpp:jingle:transports:s5b:1' sid='vj3hs98y'>\" +\n+ \"<candidate-activated cid='hr65dqyd'/>\" +\n+ \"</transport>\";\n+ JingleS5BTransport candidateActivatedTransport = new JingleS5BTransportProvider()\n+ .parse(TestUtils.getParser(candidateActivated));\n+ assertEquals(1, candidateActivatedTransport.getInfos().size());\n+ assertEquals(JingleS5BTransportInfo.CandidateActivated(\"hr65dqyd\"),\n+ candidateActivatedTransport.getInfos().get(0));\n+ assertEquals(\"hr65dqyd\",\n+ ((JingleS5BTransportInfo.CandidateActivated)\n+ candidateActivatedTransport.getInfos().get(0)).getCandidateId());\n+ assertEquals(candidateActivated, candidateActivatedTransport.toXML().toString());\n+ }\n+}\n"
}
] | Java | Apache License 2.0 | igniterealtime/smack | Add Jingle SOCKS5Bytestream transport method |
299,323 | 21.06.2017 13:42:02 | -7,200 | e2b8ffdf225d121d1c33be0274201790b83db0b2 | Switch to single transport instead of list | [
{
"change_type": "MODIFY",
"old_path": "smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/element/JingleContent.java",
"new_path": "smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/element/JingleContent.java",
"diff": "*/\npackage org.jivesoftware.smackx.jingle.element;\n-import java.util.ArrayList;\n-import java.util.Collections;\n-import java.util.List;\n-\nimport org.jivesoftware.smack.packet.NamedElement;\nimport org.jivesoftware.smack.util.Objects;\nimport org.jivesoftware.smack.util.StringUtils;\n@@ -70,24 +66,19 @@ public final class JingleContent implements NamedElement {\nprivate final JingleContentDescription description;\n- private final List<JingleContentTransport> transports;\n+ private final JingleContentTransport transport;\n/**\n* Creates a content description..\n*/\nprivate JingleContent(Creator creator, String disposition, String name, Senders senders,\n- JingleContentDescription description, List<JingleContentTransport> transports) {\n+ JingleContentDescription description, JingleContentTransport transport) {\nthis.creator = Objects.requireNonNull(creator, \"Jingle content creator must not be null\");\nthis.disposition = disposition;\nthis.name = StringUtils.requireNotNullOrEmpty(name, \"Jingle content name must not be null or empty\");\nthis.senders = senders;\nthis.description = description;\n- if (transports != null) {\n- this.transports = Collections.unmodifiableList(transports);\n- }\n- else {\n- this.transports = Collections.emptyList();\n- }\n+ this.transport = transport;\n}\npublic Creator getCreator() {\n@@ -120,17 +111,8 @@ public final class JingleContent implements NamedElement {\n*\n* @return an Iterator for the JingleTransports in the packet.\n*/\n- public List<JingleContentTransport> getJingleTransports() {\n- return transports;\n- }\n-\n- /**\n- * Returns a count of the JingleTransports in the Jingle packet.\n- *\n- * @return the number of the JingleTransports in the Jingle packet.\n- */\n- public int getJingleTransportsCount() {\n- return transports.size();\n+ public JingleContentTransport getJingleTransport() {\n+ return transport;\n}\n@Override\n@@ -148,8 +130,7 @@ public final class JingleContent implements NamedElement {\nxml.rightAngleBracket();\nxml.optAppend(description);\n-\n- xml.append(transports);\n+ xml.optElement(transport);\nxml.closeElement(this);\nreturn xml;\n@@ -170,7 +151,7 @@ public final class JingleContent implements NamedElement {\nprivate JingleContentDescription description;\n- private List<JingleContentTransport> transports;\n+ private JingleContentTransport transport;\nprivate Builder() {\n}\n@@ -203,16 +184,13 @@ public final class JingleContent implements NamedElement {\nreturn this;\n}\n- public Builder addTransport(JingleContentTransport transport) {\n- if (transports == null) {\n- transports = new ArrayList<>(4);\n- }\n- transports.add(transport);\n+ public Builder setTransport(JingleContentTransport transport) {\n+ this.transport = transport;\nreturn this;\n}\npublic JingleContent build() {\n- return new JingleContent(creator, disposition, name, senders, description, transports);\n+ return new JingleContent(creator, disposition, name, senders, description, transport);\n}\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/provider/JingleProvider.java",
"new_path": "smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/provider/JingleProvider.java",
"diff": "@@ -131,7 +131,7 @@ public class JingleProvider extends IQProvider<Jingle> {\nbreak;\n}\nJingleContentTransport transport = provider.parse(parser);\n- builder.addTransport(transport);\n+ builder.setTransport(transport);\nbreak;\n}\ndefault:\n"
},
{
"change_type": "MODIFY",
"old_path": "smack-extensions/src/test/java/org/jivesoftware/smackx/jingle/JingleActionTest.java",
"new_path": "smack-extensions/src/test/java/org/jivesoftware/smackx/jingle/JingleActionTest.java",
"diff": "@@ -40,7 +40,7 @@ public class JingleActionTest extends SmackTestSuite {\n}\n@Test(expected = IllegalArgumentException.class)\n- public void nonExistendEnumTest() {\n+ public void nonExistentEnumTest() {\nJingleAction.fromString(\"inexistent-action\");\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "smack-extensions/src/test/java/org/jivesoftware/smackx/jingle/JingleContentTest.java",
"new_path": "smack-extensions/src/test/java/org/jivesoftware/smackx/jingle/JingleContentTest.java",
"diff": "@@ -69,9 +69,6 @@ public class JingleContentTest extends SmackTestSuite {\nassertNotSame(content.toXML().toString(), content1.toXML().toString());\nassertEquals(content1.toXML().toString(), builder.build().toXML().toString());\n- assertEquals(0, content.getJingleTransportsCount());\n- assertNotNull(content.getJingleTransports());\n-\nString xml =\n\"<content creator='initiator' disposition='session' name='A name' senders='both'>\" +\n\"</content>\";\n"
}
] | Java | Apache License 2.0 | igniterealtime/smack | Switch to single transport instead of list |
299,323 | 26.06.2017 15:04:22 | -7,200 | 20eabca1b3e55ad8af27aea154d7c7abc759d724 | Also replace list with single transport-info info | [
{
"change_type": "MODIFY",
"old_path": "smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/element/JingleContentTransport.java",
"new_path": "smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/element/JingleContentTransport.java",
"diff": "@@ -31,13 +31,13 @@ public abstract class JingleContentTransport implements ExtensionElement {\npublic static final String ELEMENT = \"transport\";\nprotected final List<JingleContentTransportCandidate> candidates;\n- protected final List<JingleContentTransportInfo> infos;\n+ protected final JingleContentTransportInfo info;\nprotected JingleContentTransport(List<JingleContentTransportCandidate> candidates) {\nthis(candidates, null);\n}\n- protected JingleContentTransport(List<JingleContentTransportCandidate> candidates, List<JingleContentTransportInfo> infos) {\n+ protected JingleContentTransport(List<JingleContentTransportCandidate> candidates, JingleContentTransportInfo info) {\nif (candidates != null) {\nthis.candidates = Collections.unmodifiableList(candidates);\n}\n@@ -45,19 +45,15 @@ public abstract class JingleContentTransport implements ExtensionElement {\nthis.candidates = Collections.emptyList();\n}\n- if (infos != null) {\n- this.infos = infos;\n- } else {\n- this.infos = Collections.emptyList();\n- }\n+ this.info = info;\n}\npublic List<JingleContentTransportCandidate> getCandidates() {\nreturn candidates;\n}\n- public List<JingleContentTransportInfo> getInfos() {\n- return infos;\n+ public JingleContentTransportInfo getInfo() {\n+ return info;\n}\n@Override\n@@ -81,7 +77,7 @@ public abstract class JingleContentTransport implements ExtensionElement {\nxml.rightAngleBracket();\nxml.append(candidates);\n- xml.append(infos);\n+ xml.optElement(info);\nxml.closeElement(this);\n}\n"
}
] | Java | Apache License 2.0 | igniterealtime/smack | Also replace list with single transport-info info |
299,323 | 30.06.2017 14:30:19 | -7,200 | 248e76ff469585ecd339ef79d95ad51eb6855da0 | Fix receiving OMEMO MUC messages
The method OmemoManager.getSender() was faulty and returned null for MUC
occupants, which lead to NPEs when receiving MUC messages with OMEMO. | [
{
"change_type": "MODIFY",
"old_path": "smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/OmemoService.java",
"new_path": "smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/OmemoService.java",
"diff": "@@ -39,7 +39,6 @@ import java.util.Random;\nimport java.util.Set;\nimport java.util.logging.Level;\nimport java.util.logging.Logger;\n-\nimport javax.crypto.BadPaddingException;\nimport javax.crypto.IllegalBlockSizeException;\nimport javax.crypto.NoSuchPaddingException;\n@@ -51,7 +50,6 @@ import org.jivesoftware.smack.filter.StanzaFilter;\nimport org.jivesoftware.smack.packet.Message;\nimport org.jivesoftware.smack.packet.Stanza;\nimport org.jivesoftware.smack.packet.XMPPError;\n-\nimport org.jivesoftware.smackx.carbons.CarbonCopyReceivedListener;\nimport org.jivesoftware.smackx.carbons.CarbonManager;\nimport org.jivesoftware.smackx.carbons.packet.CarbonExtension;\n@@ -88,6 +86,7 @@ import org.jivesoftware.smackx.pubsub.PubSubManager;\nimport org.bouncycastle.jce.provider.BouncyCastleProvider;\nimport org.jxmpp.jid.BareJid;\n+import org.jxmpp.jid.Jid;\n/**\n* This class contains OMEMO related logic and registers listeners etc.\n@@ -1177,7 +1176,7 @@ public abstract class OmemoService<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey,\n*/\nprivate static OmemoDevice getSender(OmemoManager omemoManager, Stanza stanza) {\nOmemoElement omemoElement = stanza.getExtension(OmemoElement.ENCRYPTED, OMEMO_NAMESPACE_V_AXOLOTL);\n- BareJid sender = stanza.getFrom().asBareJid();\n+ Jid sender = stanza.getFrom();\nif (isMucMessage(omemoManager, stanza)) {\nMultiUserChatManager mucm = MultiUserChatManager.getInstanceFor(omemoManager.getConnection());\nMultiUserChat muc = mucm.getMultiUserChat(sender.asEntityBareJidIfPossible());\n@@ -1186,7 +1185,7 @@ public abstract class OmemoService<T_IdKeyPair, T_IdKey, T_PreKey, T_SigPreKey,\nif (sender == null) {\nthrow new AssertionError(\"Sender is null.\");\n}\n- return new OmemoDevice(sender, omemoElement.getHeader().getSid());\n+ return new OmemoDevice(sender.asBareJid(), omemoElement.getHeader().getSid());\n}\n/**\n"
}
] | Java | Apache License 2.0 | igniterealtime/smack | Fix receiving OMEMO MUC messages
The method OmemoManager.getSender() was faulty and returned null for MUC
occupants, which lead to NPEs when receiving MUC messages with OMEMO. |
299,323 | 30.06.2017 15:36:02 | -7,200 | bae840ebf77f95c0e3ed4be8144866f7844554a0 | Enforce jingle s5b transport invariants.
There can only either be one info element or
multiple candidates, but not both.
Enforced this in the JingleS5BTransportBuilder | [
{
"change_type": "MODIFY",
"old_path": "smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/transports/jingle_s5b/elements/JingleS5BTransport.java",
"new_path": "smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/transports/jingle_s5b/elements/JingleS5BTransport.java",
"diff": "@@ -93,7 +93,7 @@ public class JingleS5BTransport extends JingleContentTransport {\nprivate String streamId;\nprivate String dstAddr;\nprivate Bytestream.Mode mode;\n- private ArrayList<JingleContentTransportCandidate> candidates = new ArrayList<>();\n+ private final ArrayList<JingleContentTransportCandidate> candidates = new ArrayList<>();\nprivate JingleContentTransportInfo info;\npublic Builder setStreamId(String sid) {\n@@ -112,11 +112,22 @@ public class JingleS5BTransport extends JingleContentTransport {\n}\npublic Builder addTransportCandidate(JingleS5BTransportCandidate candidate) {\n+ if (info != null) {\n+ throw new IllegalStateException(\"Builder has already an info set. \" +\n+ \"The transport can only have either an info or transport candidates, not both.\");\n+ }\nthis.candidates.add(candidate);\nreturn this;\n}\npublic Builder setTransportInfo(JingleContentTransportInfo info) {\n+ if (!candidates.isEmpty()) {\n+ throw new IllegalStateException(\"Builder has already at least one candidate set. \" +\n+ \"The transport can only have either an info or transport candidates, not both.\");\n+ }\n+ if (this.info != null) {\n+ throw new IllegalStateException(\"Builder has already an info set.\");\n+ }\nthis.info = info;\nreturn this;\n}\n"
}
] | Java | Apache License 2.0 | igniterealtime/smack | Enforce jingle s5b transport invariants.
There can only either be one info element or
multiple candidates, but not both.
Enforced this in the JingleS5BTransportBuilder |
299,323 | 06.07.2017 14:01:28 | -7,200 | 8bd3856fa1613721aee1f32a004c8a9b79b9a7b8 | Fix typos in filetransfer package | [
{
"change_type": "MODIFY",
"old_path": "smack-extensions/src/main/java/org/jivesoftware/smackx/filetransfer/FaultTolerantNegotiator.java",
"new_path": "smack-extensions/src/main/java/org/jivesoftware/smackx/filetransfer/FaultTolerantNegotiator.java",
"diff": "@@ -35,7 +35,7 @@ import org.jxmpp.jid.Jid;\n/**\n* The fault tolerant negotiator takes two stream negotiators, the primary and the secondary\n- * negotiator. If the primary negotiator fails during the stream negotiaton process, the second\n+ * negotiator. If the primary negotiator fails during the stream negotiation process, the second\n* negotiator is used.\n*/\npublic class FaultTolerantNegotiator extends StreamNegotiator {\n@@ -78,7 +78,7 @@ public class FaultTolerantNegotiator extends StreamNegotiator {\n} else if (streamInitiation instanceof Open) {\nreturn secondaryNegotiator;\n} else {\n- throw new IllegalStateException(\"Unknown stream initation type\");\n+ throw new IllegalStateException(\"Unknown stream initiation type\");\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "smack-extensions/src/main/java/org/jivesoftware/smackx/filetransfer/FileTransfer.java",
"new_path": "smack-extensions/src/main/java/org/jivesoftware/smackx/filetransfer/FileTransfer.java",
"diff": "@@ -77,18 +77,18 @@ public abstract class FileTransfer {\n}\n/**\n- * Returns the size of the file being transfered.\n+ * Returns the size of the file being transferred.\n*\n- * @return Returns the size of the file being transfered.\n+ * @return Returns the size of the file being transferred.\n*/\npublic long getFileSize() {\nreturn fileSize;\n}\n/**\n- * Returns the name of the file being transfered.\n+ * Returns the name of the file being transferred.\n*\n- * @return Returns the name of the file being transfered.\n+ * @return Returns the name of the file being transferred.\n*/\npublic String getFileName() {\nreturn fileName;\n@@ -247,7 +247,7 @@ public abstract class FileTransfer {\n* The file transfer is being negotiated with the peer. The party\n* Receiving the file has the option to accept or refuse a file transfer\n* request. If they accept, then the process of stream negotiation will\n- * begin. If they refuse the file will not be transfered.\n+ * begin. If they refuse the file will not be transferred.\n*\n* @see #negotiating_stream\n*/\n@@ -294,7 +294,7 @@ public abstract class FileTransfer {\nprivate final String status;\n- private Status(String status) {\n+ Status(String status) {\nthis.status = status;\n}\n@@ -337,16 +337,16 @@ public abstract class FileTransfer {\n/**\n* An error occurred over the socket connected to send the file.\n*/\n- connection(\"An error occured over the socket connected to send the file.\"),\n+ connection(\"An error occurred over the socket connected to send the file.\"),\n/**\n* An error occurred while sending or receiving the file.\n*/\n- stream(\"An error occured while sending or recieving the file.\");\n+ stream(\"An error occurred while sending or receiving the file.\");\nprivate final String msg;\n- private Error(String msg) {\n+ Error(String msg) {\nthis.msg = msg;\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "smack-extensions/src/main/java/org/jivesoftware/smackx/filetransfer/FileTransferListener.java",
"new_path": "smack-extensions/src/main/java/org/jivesoftware/smackx/filetransfer/FileTransferListener.java",
"diff": "@@ -24,10 +24,10 @@ package org.jivesoftware.smackx.filetransfer;\n*/\npublic interface FileTransferListener {\n/**\n- * A request to send a file has been recieved from another user.\n+ * A request to send a file has been received from another user.\n*\n* @param request\n* The request from the other user.\n*/\n- public void fileTransferRequest(final FileTransferRequest request);\n+ void fileTransferRequest(final FileTransferRequest request);\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "smack-extensions/src/main/java/org/jivesoftware/smackx/filetransfer/FileTransferManager.java",
"new_path": "smack-extensions/src/main/java/org/jivesoftware/smackx/filetransfer/FileTransferManager.java",
"diff": "@@ -34,10 +34,10 @@ import org.jivesoftware.smackx.si.packet.StreamInitiation;\nimport org.jxmpp.jid.EntityFullJid;\n/**\n- * The file transfer manager class handles the sending and recieving of files.\n+ * The file transfer manager class handles the sending and receiving of files.\n* To send a file invoke the {@link #createOutgoingFileTransfer(EntityFullJid)} method.\n* <p>\n- * And to recieve a file add a file transfer listener to the manager. The\n+ * And to receive a file add a file transfer listener to the manager. The\n* listener will notify you when there is a new file transfer request. To create\n* the {@link IncomingFileTransfer} object accept the transfer, or, if the\n* transfer is not desirable reject it.\n@@ -135,7 +135,7 @@ public final class FileTransferManager extends Manager {\n/**\n* When the file transfer request is acceptable, this method should be\n* invoked. It will create an IncomingFileTransfer which allows the\n- * transmission of the file to procede.\n+ * transmission of the file to proceed.\n*\n* @param request\n* The remote request that is being accepted.\n@@ -145,7 +145,7 @@ public final class FileTransferManager extends Manager {\nprotected IncomingFileTransfer createIncomingFileTransfer(\nFileTransferRequest request) {\nif (request == null) {\n- throw new NullPointerException(\"RecieveRequest cannot be null\");\n+ throw new NullPointerException(\"ReceiveRequest cannot be null\");\n}\nIncomingFileTransfer transfer = new IncomingFileTransfer(request,\n"
},
{
"change_type": "MODIFY",
"old_path": "smack-extensions/src/main/java/org/jivesoftware/smackx/filetransfer/FileTransferRequest.java",
"new_path": "smack-extensions/src/main/java/org/jivesoftware/smackx/filetransfer/FileTransferRequest.java",
"diff": "@@ -23,7 +23,7 @@ import org.jivesoftware.smackx.si.packet.StreamInitiation;\nimport org.jxmpp.jid.Jid;\n/**\n- * A request to send a file recieved from another user.\n+ * A request to send a file received from another user.\n*\n* @author Alexander Wenckus\n*\n@@ -34,14 +34,14 @@ public class FileTransferRequest {\nprivate final FileTransferManager manager;\n/**\n- * A recieve request is constructed from the Stream Initiation request\n- * received from the initator.\n+ * A receive request is constructed from the Stream Initiation request\n+ * received from the initiator.\n*\n* @param manager\n* The manager handling this file transfer\n*\n* @param si\n- * The Stream initiaton recieved from the initiator.\n+ * The Stream initiation received from the initiator.\n*/\npublic FileTransferRequest(FileTransferManager manager, StreamInitiation si) {\nthis.streamInitiation = si;\n@@ -67,9 +67,9 @@ public class FileTransferRequest {\n}\n/**\n- * Returns the description of the file provided by the requestor.\n+ * Returns the description of the file provided by the requester.\n*\n- * @return Returns the description of the file provided by the requestor.\n+ * @return Returns the description of the file provided by the requester.\n*/\npublic String getDescription() {\nreturn streamInitiation.getFile().getDesc();\n@@ -106,12 +106,12 @@ public class FileTransferRequest {\n}\n/**\n- * Returns the stream initiation stanza(/packet) that was sent by the requestor which\n+ * Returns the stream initiation stanza(/packet) that was sent by the requester which\n* contains the parameters of the file transfer being transfer and also the\n* methods available to transfer the file.\n*\n* @return Returns the stream initiation stanza(/packet) that was sent by the\n- * requestor which contains the parameters of the file transfer\n+ * requester which contains the parameters of the file transfer\n* being transfer and also the methods available to transfer the\n* file.\n*/\n"
},
{
"change_type": "MODIFY",
"old_path": "smack-extensions/src/main/java/org/jivesoftware/smackx/filetransfer/IncomingFileTransfer.java",
"new_path": "smack-extensions/src/main/java/org/jivesoftware/smackx/filetransfer/IncomingFileTransfer.java",
"diff": "@@ -43,13 +43,13 @@ import org.jivesoftware.smack.XMPPException.XMPPErrorException;\n* concerned with and they can be handled in different ways depending upon the\n* method that is invoked on this class.\n* <p/>\n- * The first way that a file is recieved is by calling the\n- * {@link #recieveFile()} method. This method, negotiates the appropriate stream\n+ * The first way that a file is received is by calling the\n+ * {@link #receiveFile()} method. This method, negotiates the appropriate stream\n* method and then returns the <b><i>InputStream</b></i> to read the file\n* data from.\n* <p/>\n- * The second way that a file can be recieved through this class is by invoking\n- * the {@link #recieveFile(File)} method. This method returns immediatly and\n+ * The second way that a file can be received through this class is by invoking\n+ * the {@link #receiveFile(File)} method. This method returns immediately and\n* takes as its parameter a file on the local file system where the file\n* recieved from the transfer will be put.\n*\n@@ -59,14 +59,14 @@ public class IncomingFileTransfer extends FileTransfer {\nprivate static final Logger LOGGER = Logger.getLogger(IncomingFileTransfer.class.getName());\n- private FileTransferRequest recieveRequest;\n+ private FileTransferRequest receiveRequest;\nprivate InputStream inputStream;\nprotected IncomingFileTransfer(FileTransferRequest request,\nFileTransferNegotiator transferNegotiator) {\nsuper(request.getRequestor(), request.getStreamID(), transferNegotiator);\n- this.recieveRequest = request;\n+ this.receiveRequest = request;\n}\n/**\n@@ -79,7 +79,7 @@ public class IncomingFileTransfer extends FileTransfer {\n* is thrown.\n* @throws InterruptedException\n*/\n- public InputStream recieveFile() throws SmackException, XMPPErrorException, InterruptedException {\n+ public InputStream receiveFile() throws SmackException, XMPPErrorException, InterruptedException {\nif (inputStream != null) {\nthrow new IllegalStateException(\"Transfer already negotiated!\");\n}\n@@ -96,10 +96,10 @@ public class IncomingFileTransfer extends FileTransfer {\n}\n/**\n- * This method negotitates the stream and then transfer's the file over the negotiated stream.\n- * The transfered file will be saved at the provided location.\n+ * This method negotiates the stream and then transfer's the file over the negotiated stream.\n+ * The transferred file will be saved at the provided location.\n* <p/>\n- * This method will return immedialtly, file transfer progress can be monitored through several\n+ * This method will return immediately, file transfer progress can be monitored through several\n* methods:\n* <p/>\n* <UL>\n@@ -114,7 +114,7 @@ public class IncomingFileTransfer extends FileTransfer {\n* @throws IllegalArgumentException This exception is thrown when the the provided file is\n* either null, or cannot be written to.\n*/\n- public void recieveFile(final File file) throws SmackException, IOException {\n+ public void receiveFile(final File file) throws SmackException, IOException {\nif (file == null) {\nthrow new IllegalArgumentException(\"File cannot be null\");\n}\n@@ -180,7 +180,7 @@ public class IncomingFileTransfer extends FileTransfer {\nprivate InputStream negotiateStream() throws SmackException, XMPPErrorException, InterruptedException {\nsetStatus(Status.negotiating_transfer);\nfinal StreamNegotiator streamNegotiator = negotiator\n- .selectStreamNegotiator(recieveRequest);\n+ .selectStreamNegotiator(receiveRequest);\nsetStatus(Status.negotiating_stream);\nFutureTask<InputStream> streamNegotiatorTask = new FutureTask<InputStream>(\nnew Callable<InputStream>() {\n@@ -188,7 +188,7 @@ public class IncomingFileTransfer extends FileTransfer {\n@Override\npublic InputStream call() throws Exception {\nreturn streamNegotiator\n- .createIncomingStream(recieveRequest.getStreamInitiation());\n+ .createIncomingStream(receiveRequest.getStreamInitiation());\n}\n});\nstreamNegotiatorTask.run();\n"
},
{
"change_type": "MODIFY",
"old_path": "smack-extensions/src/main/java/org/jivesoftware/smackx/filetransfer/OutgoingFileTransfer.java",
"new_path": "smack-extensions/src/main/java/org/jivesoftware/smackx/filetransfer/OutgoingFileTransfer.java",
"diff": "@@ -128,7 +128,7 @@ public class OutgoingFileTransfer extends FileTransfer {\nString description) throws XMPPException, SmackException, InterruptedException {\nif (isDone() || outputStream != null) {\nthrow new IllegalStateException(\n- \"The negotation process has already\"\n+ \"The negotiation process has already\"\n+ \" been attempted on this file transfer\");\n}\ntry {\n@@ -169,7 +169,7 @@ public class OutgoingFileTransfer extends FileTransfer {\ncheckTransferThread();\nif (isDone() || outputStream != null) {\nthrow new IllegalStateException(\n- \"The negotation process has already\"\n+ \"The negotiation process has already\"\n+ \" been attempted for this file transfer\");\n}\nsetFileInfo(fileName, fileSize);\n"
},
{
"change_type": "MODIFY",
"old_path": "smack-integration-test/src/main/java/org/jivesoftware/smackx/filetransfer/FileTransferIntegrationTest.java",
"new_path": "smack-integration-test/src/main/java/org/jivesoftware/smackx/filetransfer/FileTransferIntegrationTest.java",
"diff": "@@ -76,7 +76,7 @@ public class FileTransferIntegrationTest extends AbstractSmackIntegrationTest {\nbyte[] dataReceived = null;\nIncomingFileTransfer ift = request.accept();\ntry {\n- InputStream is = ift.recieveFile();\n+ InputStream is = ift.receiveFile();\nByteArrayOutputStream os = new ByteArrayOutputStream();\nint nRead;\nbyte[] buf = new byte[1024];\n"
}
] | Java | Apache License 2.0 | igniterealtime/smack | Fix typos in filetransfer package |
299,323 | 06.07.2017 16:55:12 | -7,200 | 58c32639b5921dc2b3a7c9c686938b7382d3f30f | Allow parsing of JingleReason.AlternativeSession
The JingleReasonProvider was faulty and ignored the
<alternative-session> element. | [
{
"change_type": "MODIFY",
"old_path": "smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/element/JingleReason.java",
"new_path": "smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/element/JingleReason.java",
"diff": "@@ -156,5 +156,9 @@ public class JingleReason implements NamedElement {\nxml.closeElement(this);\nreturn xml;\n}\n+\n+ public String getAlternativeSessionId() {\n+ return sessionId;\n+ }\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/provider/JingleProvider.java",
"new_path": "smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/provider/JingleProvider.java",
"diff": "@@ -69,7 +69,14 @@ public class JingleProvider extends IQProvider<Jingle> {\ncase JingleReason.ELEMENT:\nparser.next();\nString reasonString = parser.getName();\n- Reason reason = Reason.fromString(reasonString);\n+ JingleReason reason;\n+ if (reasonString.equals(\"alternative-session\")) {\n+ parser.next();\n+ String sid = parser.nextText();\n+ reason = new JingleReason.AlternativeSession(sid);\n+ } else {\n+ reason = new JingleReason(Reason.fromString(reasonString));\n+ }\nbuilder.setReason(reason);\nbreak;\ndefault:\n"
}
] | Java | Apache License 2.0 | igniterealtime/smack | Allow parsing of JingleReason.AlternativeSession
The JingleReasonProvider was faulty and ignored the
<alternative-session> element. |
299,323 | 14.07.2017 16:09:37 | -7,200 | 419f6a336e24ca4effbde09b24f6c74122cd9fb9 | Correct method name to getUndecidedDevices | [
{
"change_type": "MODIFY",
"old_path": "smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/exceptions/UndecidedOmemoIdentityException.java",
"new_path": "smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/exceptions/UndecidedOmemoIdentityException.java",
"diff": "@@ -35,20 +35,20 @@ public class UndecidedOmemoIdentityException extends Exception {\n}\n/**\n- * Return the HashSet of untrusted devices.\n+ * Return the HashSet of undecided devices.\n*\n- * @return untrusted devices\n+ * @return undecided devices\n*/\n- public HashSet<OmemoDevice> getUntrustedDevices() {\n+ public HashSet<OmemoDevice> getUndecidedDevices() {\nreturn this.devices;\n}\n/**\n- * Add all untrusted devices of another Exception to this Exceptions HashSet of untrusted devices.\n+ * Add all undecided devices of another Exception to this Exceptions HashSet of undecided devices.\n*\n* @param other other Exception\n*/\npublic void join(UndecidedOmemoIdentityException other) {\n- this.devices.addAll(other.getUntrustedDevices());\n+ this.devices.addAll(other.getUndecidedDevices());\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "smack-omemo/src/test/java/org/jivesoftware/smack/omemo/OmemoExceptionsTest.java",
"new_path": "smack-omemo/src/test/java/org/jivesoftware/smack/omemo/OmemoExceptionsTest.java",
"diff": "@@ -45,18 +45,18 @@ public class OmemoExceptionsTest {\nOmemoDevice mallory = new OmemoDevice(JidCreate.bareFrom(\"[email protected]\"), 9876);\nUndecidedOmemoIdentityException u = new UndecidedOmemoIdentityException(alice);\n- assertTrue(u.getUntrustedDevices().contains(alice));\n- assertTrue(u.getUntrustedDevices().size() == 1);\n+ assertTrue(u.getUndecidedDevices().contains(alice));\n+ assertTrue(u.getUndecidedDevices().size() == 1);\nUndecidedOmemoIdentityException v = new UndecidedOmemoIdentityException(bob);\n- v.getUntrustedDevices().add(mallory);\n- assertTrue(v.getUntrustedDevices().size() == 2);\n- assertTrue(v.getUntrustedDevices().contains(bob));\n- assertTrue(v.getUntrustedDevices().contains(mallory));\n+ v.getUndecidedDevices().add(mallory);\n+ assertTrue(v.getUndecidedDevices().size() == 2);\n+ assertTrue(v.getUndecidedDevices().contains(bob));\n+ assertTrue(v.getUndecidedDevices().contains(mallory));\n- u.getUntrustedDevices().add(bob);\n+ u.getUndecidedDevices().add(bob);\nu.join(v);\n- assertTrue(u.getUntrustedDevices().size() == 3);\n+ assertTrue(u.getUndecidedDevices().size() == 3);\n}\n@Test\n"
}
] | Java | Apache License 2.0 | igniterealtime/smack | Correct method name to getUndecidedDevices |
299,309 | 20.07.2017 22:50:34 | -7,200 | 0b8788a9fc52b060ac302970a3261ca5ab734036 | Fix parameter ordering in BoBHash construction | [
{
"change_type": "MODIFY",
"old_path": "smack-extensions/src/main/java/org/jivesoftware/smackx/bob/BoBManager.java",
"new_path": "smack-extensions/src/main/java/org/jivesoftware/smackx/bob/BoBManager.java",
"diff": "@@ -159,7 +159,7 @@ public final class BoBManager extends Manager {\npublic BoBInfo addBoB(BoBData bobData) {\n// We only support SHA-1 for now.\n- BoBHash bobHash = new BoBHash(\"sha1\", SHA1.hex(bobData.getContent()));\n+ BoBHash bobHash = new BoBHash(SHA1.hex(bobData.getContent()), \"sha1\");\nSet<BoBHash> bobHashes = Collections.singleton(bobHash);\nbobHashes = Collections.unmodifiableSet(bobHashes);\n"
}
] | Java | Apache License 2.0 | igniterealtime/smack | Fix parameter ordering in BoBHash construction |
299,309 | 15.07.2017 13:40:40 | -7,200 | fc17cf4e2d76b319e1a3c96e46e2a7a63960f341 | Fix link to OMEMO extension | [
{
"change_type": "MODIFY",
"old_path": "documentation/extensions/index.md",
"new_path": "documentation/extensions/index.md",
"diff": "@@ -94,7 +94,7 @@ Experimental Smack Extensions and currently supported XEPs of smack-experimental\n| [Push Notifications](pushnotifications.md) | [XEP-0357](http://xmpp.org/extensions/xep-0357.html) | Defines a way to manage push notifications from an XMPP Server. |\n| HTTP File Upload | [XEP-0363](http://xmpp.org/extensions/xep-0363.html) | Protocol to request permissions to upload a file to an HTTP server and get a shareable URL. |\n| [Multi-User Chat Light](muclight.md) | [XEP-xxxx](http://mongooseim.readthedocs.io/en/latest/open-extensions/xeps/xep-muc-light.html) | Multi-User Chats for mobile XMPP applications and specific enviroment. |\n-| [OMEMO End Encryption (omemo.md) | [XEP-0384](http://xmpp.org/extensions/xep-0384.html) | Encrypt messages using OMEMO encryption (currently only with smack-omemo-signal -> GPLv3). |\n+| [OMEMO End Encryption](omemo.md) | [XEP-0384](http://xmpp.org/extensions/xep-0384.html) | Encrypt messages using OMEMO encryption (currently only with smack-omemo-signal -> GPLv3). |\n| Google GCM JSON payload | n/a | Semantically the same as XEP-0335: JSON Containers |\n"
}
] | Java | Apache License 2.0 | igniterealtime/smack | Fix link to OMEMO extension |
299,309 | 01.08.2017 16:17:35 | -7,200 | c9b9558cd428e8a899c4ef44c99b9782a43434ee | Make add/remove for presence interceptors consistent | [
{
"change_type": "MODIFY",
"old_path": "smack-extensions/src/main/java/org/jivesoftware/smackx/muc/MultiUserChat.java",
"new_path": "smack-extensions/src/main/java/org/jivesoftware/smackx/muc/MultiUserChat.java",
"diff": "@@ -1011,7 +1011,7 @@ public class MultiUserChat {\n*\n* @param presenceInterceptor the stanza(/packet) interceptor to remove.\n*/\n- public void removePresenceInterceptor(StanzaListener presenceInterceptor) {\n+ public void removePresenceInterceptor(PresenceListener presenceInterceptor) {\npresenceInterceptors.remove(presenceInterceptor);\n}\n"
}
] | Java | Apache License 2.0 | igniterealtime/smack | Make add/remove for presence interceptors consistent |
299,295 | 11.08.2017 10:30:05 | -7,200 | b70e80b1ad9a581ac4daeec874949e90f2db2c0a | Keep 4.1.9 chat.sendMessage(String) behavior
chat2.Chat.send(String) should have the same behavior as chat.Chat.sendMessage(String) | [
{
"change_type": "MODIFY",
"old_path": "smack-extensions/src/main/java/org/jivesoftware/smack/chat2/Chat.java",
"new_path": "smack-extensions/src/main/java/org/jivesoftware/smack/chat2/Chat.java",
"diff": "@@ -42,6 +42,7 @@ public final class Chat extends Manager {\npublic void send(CharSequence message) throws NotConnectedException, InterruptedException {\nMessage stanza = new Message();\nstanza.setBody(message);\n+ stanza.setType(Message.Type.chat);\nsend(stanza);\n}\n"
}
] | Java | Apache License 2.0 | igniterealtime/smack | Keep 4.1.9 chat.sendMessage(String) behavior
chat2.Chat.send(String) should have the same behavior as chat.Chat.sendMessage(String) |
299,323 | 09.08.2017 21:00:01 | -7,200 | 8052ee752b16cd5faad962fa126d1c2c6beb41ce | Add missing cleanup in Omemo integrationtest | [
{
"change_type": "MODIFY",
"old_path": "smack-integration-test/src/main/java/org/jivesoftware/smackx/omemo/OmemoStoreTest.java",
"new_path": "smack-integration-test/src/main/java/org/jivesoftware/smackx/omemo/OmemoStoreTest.java",
"diff": "@@ -22,6 +22,7 @@ import static junit.framework.TestCase.assertNotNull;\nimport static junit.framework.TestCase.assertNotSame;\nimport static junit.framework.TestCase.assertNull;\nimport static junit.framework.TestCase.assertTrue;\n+import static org.jivesoftware.smackx.omemo.OmemoIntegrationTestHelper.cleanServerSideTraces;\nimport static org.jivesoftware.smackx.omemo.OmemoIntegrationTestHelper.deletePath;\nimport static org.jivesoftware.smackx.omemo.OmemoIntegrationTestHelper.setUpOmemoManager;\n@@ -154,6 +155,8 @@ public class OmemoStoreTest extends AbstractOmemoIntegrationTest {\n@Override\npublic void after() {\n+ cleanServerSideTraces(alice);\n+ cleanServerSideTraces(bob);\nalice.shutdown();\nbob.shutdown();\n}\n"
}
] | Java | Apache License 2.0 | igniterealtime/smack | Add missing cleanup in Omemo integrationtest |
299,309 | 05.08.2017 17:05:40 | -7,200 | 199311eda16b7b6a3457129fe0f1585bb6289293 | Fix error Condition to Type mappings to match RFC 6120
Synchronize the Javadoc table to match the actual implementation. | [
{
"change_type": "MODIFY",
"old_path": "smack-core/src/main/java/org/jivesoftware/smack/packet/XMPPError.java",
"new_path": "smack-core/src/main/java/org/jivesoftware/smack/packet/XMPPError.java",
"diff": "@@ -39,14 +39,14 @@ import org.jivesoftware.smack.util.XmlStringBuilder;\n* <tr><td>conflict</td><td>CANCEL</td><td>8.3.3.2</td></tr>\n* <tr><td>feature-not-implemented</td><td>CANCEL</td><td>8.3.3.3</td></tr>\n* <tr><td>forbidden</td><td>AUTH</td><td>8.3.3.4</td></tr>\n- * <tr><td>gone</td><td>MODIFY</td><td>8.3.3.5</td></tr>\n+ * <tr><td>gone</td><td>CANCEL</td><td>8.3.3.5</td></tr>\n* <tr><td>internal-server-error</td><td>WAIT</td><td>8.3.3.6</td></tr>\n* <tr><td>item-not-found</td><td>CANCEL</td><td>8.3.3.7</td></tr>\n* <tr><td>jid-malformed</td><td>MODIFY</td><td>8.3.3.8</td></tr>\n* <tr><td>not-acceptable</td><td>MODIFY</td><td>8.3.3.9</td></tr>\n* <tr><td>not-allowed</td><td>CANCEL</td><td>8.3.3.10</td></tr>\n* <tr><td>not-authorized</td><td>AUTH</td><td>8.3.3.11</td></tr>\n- * <tr><td>policy-violation</td><td>AUTH</td><td>8.3.3.12</td></tr>\n+ * <tr><td>policy-violation</td><td>MODIFY</td><td>8.3.3.12</td></tr>\n* <tr><td>recipient-unavailable</td><td>WAIT</td><td>8.3.3.13</td></tr>\n* <tr><td>redirect</td><td>MODIFY</td><td>8.3.3.14</td></tr>\n* <tr><td>registration-required</td><td>AUTH</td><td>8.3.3.15</td></tr>\n@@ -55,7 +55,7 @@ import org.jivesoftware.smack.util.XmlStringBuilder;\n* <tr><td>resource-constraint</td><td>WAIT</td><td>8.3.3.18</td></tr>\n* <tr><td>service-unavailable</td><td>CANCEL</td><td>8.3.3.19</td></tr>\n* <tr><td>subscription-required</td><td>AUTH</td><td>8.3.3.20</td></tr>\n- * <tr><td>undefined-condition</td><td>WAIT</td><td>8.3.3.21</td></tr>\n+ * <tr><td>undefined-condition</td><td>MODIFY</td><td>8.3.3.21</td></tr>\n* <tr><td>unexpected-request</td><td>WAIT</td><td>8.3.3.22</td></tr>\n* </table>\n*\n@@ -91,9 +91,10 @@ public class XMPPError extends AbstractError {\nCONDITION_TO_TYPE.put(Condition.remote_server_not_found, Type.CANCEL);\nCONDITION_TO_TYPE.put(Condition.remote_server_timeout, Type.WAIT);\nCONDITION_TO_TYPE.put(Condition.resource_constraint, Type.WAIT);\n- CONDITION_TO_TYPE.put(Condition.service_unavailable, Type.WAIT);\n- CONDITION_TO_TYPE.put(Condition.subscription_required, Type.WAIT);\n- CONDITION_TO_TYPE.put(Condition.unexpected_request, Type.MODIFY);\n+ CONDITION_TO_TYPE.put(Condition.service_unavailable, Type.CANCEL);\n+ CONDITION_TO_TYPE.put(Condition.subscription_required, Type.AUTH);\n+ CONDITION_TO_TYPE.put(Condition.undefined_condition, Type.MODIFY);\n+ CONDITION_TO_TYPE.put(Condition.unexpected_request, Type.WAIT);\n}\nprivate final Condition condition;\n"
}
] | Java | Apache License 2.0 | igniterealtime/smack | Fix error Condition to Type mappings to match RFC 6120
Synchronize the Javadoc table to match the actual implementation. |
299,309 | 06.08.2017 14:25:57 | -7,200 | 47c936e50861da3bc50c173cf0c8fde23cc6820a | Make UnknownIqRequestReplyMode public
If it is not made public, then (g|s)etUnknownIqRequestReplyMode cannot
be used. | [
{
"change_type": "MODIFY",
"old_path": "smack-core/src/main/java/org/jivesoftware/smack/SmackConfiguration.java",
"new_path": "smack-core/src/main/java/org/jivesoftware/smack/SmackConfiguration.java",
"diff": "@@ -371,7 +371,7 @@ public final class SmackConfiguration {\nreturn defaultHostnameVerififer;\n}\n- enum UnknownIqRequestReplyMode {\n+ public enum UnknownIqRequestReplyMode {\ndoNotReply,\nreplyFeatureNotImplemented,\nreplyServiceUnavailable,\n"
}
] | Java | Apache License 2.0 | igniterealtime/smack | Make UnknownIqRequestReplyMode public
If it is not made public, then (g|s)etUnknownIqRequestReplyMode cannot
be used. |
299,309 | 05.08.2017 17:06:13 | -7,200 | 25114b3fc1b3510a734524139080e970eb8b45ee | Add a test to ensure all Conditions have a Type mapping | [
{
"change_type": "MODIFY",
"old_path": "smack-core/src/main/java/org/jivesoftware/smack/packet/XMPPError.java",
"new_path": "smack-core/src/main/java/org/jivesoftware/smack/packet/XMPPError.java",
"diff": "@@ -70,7 +70,7 @@ public class XMPPError extends AbstractError {\npublic static final String ERROR = \"error\";\nprivate static final Logger LOGGER = Logger.getLogger(XMPPError.class.getName());\n- private static final Map<Condition, Type> CONDITION_TO_TYPE = new HashMap<Condition, Type>();\n+ static final Map<Condition, Type> CONDITION_TO_TYPE = new HashMap<Condition, Type>();\nstatic {\nCONDITION_TO_TYPE.put(Condition.bad_request, Type.MODIFY);\n"
}
] | Java | Apache License 2.0 | igniterealtime/smack | Add a test to ensure all Conditions have a Type mapping |
299,305 | 26.08.2017 12:16:07 | 18,000 | c92a95136faa4f227cbffe3431bb3c80bbca0a48 | Updated comments to indicate that reject_all is default SubscriptionMode | [
{
"change_type": "MODIFY",
"old_path": "smack-im/src/main/java/org/jivesoftware/smack/roster/Roster.java",
"new_path": "smack-im/src/main/java/org/jivesoftware/smack/roster/Roster.java",
"diff": "@@ -213,7 +213,7 @@ public final class Roster extends Manager {\n* Returns the default subscription processing mode to use when a new Roster is created. The\n* subscription processing mode dictates what action Smack will take when subscription\n* requests from other users are made. The default subscription mode\n- * is {@link SubscriptionMode#accept_all}.\n+ * is {@link SubscriptionMode#reject_all}.\n*\n* @return the default subscription mode to use for new Rosters\n*/\n@@ -225,7 +225,7 @@ public final class Roster extends Manager {\n* Sets the default subscription processing mode to use when a new Roster is created. The\n* subscription processing mode dictates what action Smack will take when subscription\n* requests from other users are made. The default subscription mode\n- * is {@link SubscriptionMode#accept_all}.\n+ * is {@link SubscriptionMode#reject_all}.\n*\n* @param subscriptionMode the default subscription mode to use for new Rosters.\n*/\n@@ -383,7 +383,7 @@ public final class Roster extends Manager {\n/**\n* Returns the subscription processing mode, which dictates what action\n* Smack will take when subscription requests from other users are made.\n- * The default subscription mode is {@link SubscriptionMode#accept_all}.\n+ * The default subscription mode is {@link SubscriptionMode#reject_all}.\n* <p>\n* If using the manual mode, a PacketListener should be registered that\n* listens for Presence packets that have a type of\n@@ -399,7 +399,7 @@ public final class Roster extends Manager {\n/**\n* Sets the subscription processing mode, which dictates what action\n* Smack will take when subscription requests from other users are made.\n- * The default subscription mode is {@link SubscriptionMode#accept_all}.\n+ * The default subscription mode is {@link SubscriptionMode#reject_all}.\n* <p>\n* If using the manual mode, a PacketListener should be registered that\n* listens for Presence packets that have a type of\n@@ -1402,14 +1402,14 @@ public final class Roster extends Manager {\npublic enum SubscriptionMode {\n/**\n- * Automatically accept all subscription and unsubscription requests. This is\n- * the default mode and is suitable for simple client. More complex client will\n+ * Automatically accept all subscription and unsubscription requests.\n+ * This is suitable for simple clients. More complex clients will\n* likely wish to handle subscription requests manually.\n*/\naccept_all,\n/**\n- * Automatically reject all subscription requests.\n+ * Automatically reject all subscription requests. This is the default mode.\n*/\nreject_all,\n"
}
] | Java | Apache License 2.0 | igniterealtime/smack | Updated comments to indicate that reject_all is default SubscriptionMode |
299,302 | 27.10.2017 13:14:50 | 18,000 | a0b0b5a63b7aafd034aa215e7174653a59f8d7c8 | Makes xmpperror descriptive text optional as said in the rfc. | [
{
"change_type": "MODIFY",
"old_path": "smack-core/src/main/java/org/jivesoftware/smack/packet/XMPPError.java",
"new_path": "smack-core/src/main/java/org/jivesoftware/smack/packet/XMPPError.java",
"diff": "@@ -271,9 +271,13 @@ public class XMPPError extends AbstractError {\n}\npublic static XMPPError.Builder from(Condition condition, String descriptiveText) {\n- Map<String, String> descriptiveTexts = new HashMap<String, String>();\n+ XMPPError.Builder builder = getBuilder().setCondition(condition);\n+ if (descriptiveText != null) {\n+ Map<String, String> descriptiveTexts = new HashMap<>();\ndescriptiveTexts.put(\"en\", descriptiveText);\n- return getBuilder().setCondition(condition).setDescriptiveTexts(descriptiveTexts);\n+ builder.setDescriptiveTexts(descriptiveTexts);\n+ }\n+ return builder;\n}\npublic static Builder getBuilder() {\n"
}
] | Java | Apache License 2.0 | igniterealtime/smack | Makes xmpperror descriptive text optional as said in the rfc. |
299,302 | 06.11.2017 17:24:22 | 21,600 | 44e4607259fddf0c3d6b75ea78cb01ef4583e3ed | Fix memory leak in MutliUserChat.removeConnectionCallback().
Fix memory leak by removing subject listener
in MutliUserChat.removeConnectionCallback().
Fixes | [
{
"change_type": "MODIFY",
"old_path": "smack-extensions/src/main/java/org/jivesoftware/smackx/muc/MultiUserChat.java",
"new_path": "smack-extensions/src/main/java/org/jivesoftware/smackx/muc/MultiUserChat.java",
"diff": "@@ -2011,6 +2011,7 @@ public class MultiUserChat {\nprivate void removeConnectionCallbacks() {\nconnection.removeSyncStanzaListener(messageListener);\nconnection.removeSyncStanzaListener(presenceListener);\n+ connection.removeSyncStanzaListener(subjectListener);\nconnection.removeSyncStanzaListener(declinesListener);\nconnection.removePacketInterceptor(presenceInterceptor);\nif (messageCollector != null) {\n"
}
] | Java | Apache License 2.0 | igniterealtime/smack | Fix memory leak in MutliUserChat.removeConnectionCallback().
Fix memory leak by removing subject listener
in MutliUserChat.removeConnectionCallback().
Fixes SMACK-782. |
299,291 | 16.11.2017 16:18:15 | -10,800 | 4f11dc5b14ebe9b686a4c23a8b1d1fc9cc3c82a7 | Drop stream management state on StreamManagementException | [
{
"change_type": "MODIFY",
"old_path": "smack-tcp/src/main/java/org/jivesoftware/smack/tcp/XMPPTCPConnection.java",
"new_path": "smack-tcp/src/main/java/org/jivesoftware/smack/tcp/XMPPTCPConnection.java",
"diff": "@@ -310,7 +310,7 @@ public class XMPPTCPConnection extends AbstractXMPPConnection {\naddConnectionListener(new AbstractConnectionListener() {\n@Override\npublic void connectionClosedOnError(Exception e) {\n- if (e instanceof XMPPException.StreamErrorException) {\n+ if (e instanceof XMPPException.StreamErrorException || e instanceof StreamManagementException) {\ndropSmState();\n}\n}\n"
}
] | Java | Apache License 2.0 | igniterealtime/smack | Drop stream management state on StreamManagementException |
299,291 | 16.11.2017 17:30:16 | -10,800 | 230a226424e4219f07cffe3f0130ce67fa830b0e | Prevent race condition after stream resumption
New stanzas sent directly after stream resumption might have been added
to unacknowledgedStanzas before the old unacknowledged stanzas
are resent. This caused new stanzas to be sent twice and later led
to a StreamManagementCounterError.
Fixes | [
{
"change_type": "MODIFY",
"old_path": "smack-tcp/src/main/java/org/jivesoftware/smack/tcp/XMPPTCPConnection.java",
"new_path": "smack-tcp/src/main/java/org/jivesoftware/smack/tcp/XMPPTCPConnection.java",
"diff": "@@ -1155,8 +1155,7 @@ public class XMPPTCPConnection extends AbstractXMPPConnection {\nif (!smSessionId.equals(resumed.getPrevId())) {\nthrow new StreamIdDoesNotMatchException(smSessionId, resumed.getPrevId());\n}\n- // Mark SM as enabled and resumption as successful.\n- smResumedSyncPoint.reportSuccess();\n+ // Mark SM as enabled\nsmEnabledSyncPoint.reportSuccess();\n// First, drop the stanzas already handled by the server\nprocessHandledCount(resumed.getHandledCount());\n@@ -1172,6 +1171,8 @@ public class XMPPTCPConnection extends AbstractXMPPConnection {\nif (!stanzasToResend.isEmpty()) {\nrequestSmAcknowledgementInternal();\n}\n+ // Mark SM resumption as successful\n+ smResumedSyncPoint.reportSuccess();\nLOGGER.fine(\"Stream Management (XEP-198): Stream resumed\");\nbreak;\ncase AckAnswer.ELEMENT:\n"
}
] | Java | Apache License 2.0 | igniterealtime/smack | Prevent race condition after stream resumption
New stanzas sent directly after stream resumption might have been added
to unacknowledgedStanzas before the old unacknowledged stanzas
are resent. This caused new stanzas to be sent twice and later led
to a StreamManagementCounterError.
Fixes SMACK-786 |
299,323 | 20.11.2017 16:16:55 | -3,600 | cc94cb8ea280c6d3a73c800660b2f2f4eb18ed61 | Fix comment checkstyle rule description | [
{
"change_type": "MODIFY",
"old_path": "config/checkstyle.xml",
"new_path": "config/checkstyle.xml",
"diff": "</module>\n<module name=\"RegexpSingleline\">\n<property name=\"format\" value=\"^\\s*//[^\\s]\"/>\n- <property name=\"message\" value=\"Comment start ('\\\\') followed by non-space character. You would not continue after a punctuation without a space, would you?\"/>\n+ <property name=\"message\" value=\"Comment start ('//') followed by non-space character. You would not continue after a punctuation without a space, would you?\"/>\n</module>\n<module name=\"JavadocPackage\"/>\n<module name=\"TreeWalker\">\n"
}
] | Java | Apache License 2.0 | igniterealtime/smack | Fix comment checkstyle rule description |
299,301 | 02.01.2018 15:42:33 | 0 | ae46f653fddb3813a1b94c44115a10261286e52e | Fix for extra quote in workgroup IQs
At some point IQChildElementXmlStringBuilder was modified to add the
closing quote around the namespace. this was not reflected in these
element extensions | [
{
"change_type": "MODIFY",
"old_path": "smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/packet/OccupantsInfo.java",
"new_path": "smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/packet/OccupantsInfo.java",
"diff": "@@ -80,7 +80,7 @@ public class OccupantsInfo extends IQ {\n@Override\nprotected IQChildElementXmlStringBuilder getIQChildElementBuilder(IQChildElementXmlStringBuilder buf) {\n- buf.append(\"\\\" roomID=\\\"\").append(roomID).append(\"\\\">\");\n+ buf.append(\" roomID=\\\"\").append(roomID).append(\"\\\">\");\nsynchronized (occupants) {\nfor (OccupantInfo occupant : occupants) {\nbuf.append(\"<occupant>\");\n"
},
{
"change_type": "MODIFY",
"old_path": "smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/packet/RoomInvitation.java",
"new_path": "smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/packet/RoomInvitation.java",
"diff": "@@ -115,7 +115,7 @@ public class RoomInvitation implements ExtensionElement {\n}\npublic IQ.IQChildElementXmlStringBuilder getIQChildElementBuilder(IQChildElementXmlStringBuilder buf) {\n- buf.append(\"\\\" type=\\\"\").append(type.name()).append(\"\\\">\");\n+ buf.append(\" type=\\\"\").append(type.name()).append(\"\\\">\");\nbuf.append(\"<session xmlns=\\\"http://jivesoftware.com/protocol/workgroup\\\" id=\\\"\").append(sessionID).append(\"\\\"></session>\");\nif (invitee != null) {\nbuf.append(\"<invitee>\").append(invitee).append(\"</invitee>\");\n"
},
{
"change_type": "MODIFY",
"old_path": "smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/packet/RoomTransfer.java",
"new_path": "smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/packet/RoomTransfer.java",
"diff": "@@ -115,7 +115,7 @@ public class RoomTransfer implements ExtensionElement {\n}\npublic IQ.IQChildElementXmlStringBuilder getIQChildElementBuilder(IQChildElementXmlStringBuilder buf) {\n- buf.append(\"\\\" type=\\\"\").append(type.name()).append(\"\\\">\");\n+ buf.append(\" type=\\\"\").append(type.name()).append(\"\\\">\");\nbuf.append(\"<session xmlns=\\\"http://jivesoftware.com/protocol/workgroup\\\" id=\\\"\").append(sessionID).append(\"\\\"></session>\");\nif (invitee != null) {\nbuf.append(\"<invitee>\").append(invitee).append(\"</invitee>\");\n"
}
] | Java | Apache License 2.0 | igniterealtime/smack | Fix for extra quote in workgroup IQs
At some point IQChildElementXmlStringBuilder was modified to add the
closing quote around the namespace. this was not reflected in these
element extensions |
299,311 | 19.01.2018 11:38:17 | -3,600 | 93683389e325621d5135d20bd267ecdaa2aa8fbb | Bugfix in SOCKS5 authentication
Read password bytes from the correct field.
Fixes introduced with | [
{
"change_type": "MODIFY",
"old_path": "smack-core/src/main/java/org/jivesoftware/smack/proxy/Socks5ProxySocketConnection.java",
"new_path": "smack-core/src/main/java/org/jivesoftware/smack/proxy/Socks5ProxySocketConnection.java",
"diff": "@@ -137,7 +137,7 @@ public class Socks5ProxySocketConnection implements ProxySocketConnection {\nSystem.arraycopy(userBytes, 0, buf, index,\nuser.length());\nindex += user.length();\n- byte[] passwordBytes = user.getBytes(StringUtils.UTF8);\n+ byte[] passwordBytes = passwd.getBytes(StringUtils.UTF8);\nbuf[index++] = (byte) (passwordBytes.length);\nSystem.arraycopy(passwordBytes, 0, buf, index,\npasswd.length());\n"
}
] | Java | Apache License 2.0 | igniterealtime/smack | Bugfix in SOCKS5 authentication
Read password bytes from the correct field.
Fixes SMACK-796, introduced with 4c64643 |
299,319 | 07.02.2018 10:43:31 | -19,080 | 8e3d3a7d14e2f817c59f955848444294859e8c13 | Fix copy and paste issue in processing.md | [
{
"change_type": "MODIFY",
"old_path": "documentation/processing.md",
"new_path": "documentation/processing.md",
"diff": "@@ -49,7 +49,7 @@ filters includes:\n* `StanzaIdFilter` -- filters for packets with a particular packet ID.\n* `ThreadFilter` -- filters for message packets with a particular thread ID.\n* `ToContainsFilter` -- filters for packets that are sent to a particular address.\n- * `FromContainsFilter` -- filters for packets that are sent to a particular address.\n+ * `FromContainsFilter` -- filters for packets that are sent from a particular address.\n* `StanzaExtensionFilter` -- filters for packets that have a particular packet extension.\n* `AndFilter` -- implements the logical AND operation over two filters.\n* `OrFilter` -- implements the logical OR operation over two filters.\n"
}
] | Java | Apache License 2.0 | igniterealtime/smack | Fix copy and paste issue in processing.md |
299,296 | 26.02.2018 08:18:43 | 21,600 | 32262a9c5476436318c0cdf295167e86c543f783 | Proofread Getting Started documentation | [
{
"change_type": "MODIFY",
"old_path": "documentation/gettingstarted.md",
"new_path": "documentation/gettingstarted.md",
"diff": "@@ -14,7 +14,7 @@ library ships as several modulesto provide more flexibility over which\nfeatures applications require:\n* `smack-core` -- provides core XMPP functionality. All XMPP features that are part of the XMPP RFCs are included.\n- * `smack-im` -- provides functinoality defined in RFC 6121 (XMPP-IM), like the Roster.\n+ * `smack-im` -- provides functionality defined in RFC 6121 (XMPP-IM), like the Roster.\n* `smack-tcp` -- support for XMPP over TCP. Includes XMPPTCPConnection class, which you usually want to use\n* `smack-extensions` -- support for many of the extensions (XEPs) defined by the XMPP Standards Foundation, including multi-user chat, file transfer, user search, etc. The extensions are documented in the [extensions manual](extensions/index.md).\n* `smack-experimental` -- support for experimental extensions (XEPs) defined by the XMPP Standards Foundation. The API and functionality of those extensions should be considered as unstable.\n@@ -30,7 +30,7 @@ Configuration\nSmack has an initialization process that involves 2 phases.\n- * Initializing system properties - Initializing all the system properties accessible through the class **SmackConfiguration**. These properties are retrieve by the _getXXX_ methods on that class.\n+ * Initializing system properties - Initializing all the system properties accessible through the class **SmackConfiguration**. These properties are retrieved by the _getXXX_ methods on that class.\n* Initializing startup classes - Initializing any classes meant to be active at startup by instantiating the class, and then calling the _initialize_ method on that class if it extends **SmackInitializer**. If it does not extend this interface, then initialization will have to take place in a static block of code which is automatically executed when the class is loaded.\nInitialization is accomplished via a configuration file. By default, Smack\n@@ -73,7 +73,7 @@ created, such as the ability to disable or require encryption. See\n[XMPPConnection Management](connections.md) for full details.\nOnce you've created a connection, you should login with the\n-`XMPPConnection.login()` method. Once you've logged in, you can being\n+`XMPPConnection.login()` method. Once you've logged in, you can begin\nchatting with other users by creating new `Chat` or `MultiUserChat`\nobjects.\n"
}
] | Java | Apache License 2.0 | igniterealtime/smack | Proofread Getting Started documentation |
299,292 | 28.02.2018 07:30:18 | 21,600 | 7791e53454a7e8f2b1275fd53c30c93e24f5dc50 | Fix found typos
Fix found typos in the documentation -Jesus | [
{
"change_type": "MODIFY",
"old_path": "documentation/extensions/iot.md",
"new_path": "documentation/extensions/iot.md",
"diff": "Internet of Things (XEP-0323, -0324, -0325, -0347)\n==================================================\n-The Internet of Things (IoT) XEPs are an experimental open standard how XMPP can be used for IoT. They currently consists of\n+The Internet of Things (IoT) XEPs are an experimental open standard on how XMPP can be used for IoT. They currently consist of\n- XEP-0323 Sensor Data\n- XEP-0324 Provisioning\n- XEP-0325 Control\n@@ -13,7 +13,7 @@ Smack only supports a subset of the functionality described by the XEPs!\nThing Builder\n-------------\n-The `org.jivesoftware.smackx.iot.Thing` class acts as basic entity representing a single \"Thing\" which can used to retrieve data from or to send control commands to. `Things` are constructed using a builder API.\n+The `org.jivesoftware.smackx.iot.Thing` class acts as basic entity representing a single \"Thing\" which can be used to retrieve data from or to send control commands to. `Things` are constructed using a builder API.\nReading data from things\n@@ -32,9 +32,9 @@ Thing dataThing = Thing.builder().setKey(key).setSerialNumber(sn).setMomentaryRe\n}).build();\n```\n-While not strictly required, most things are identified via a key and serial number. We also build the thing with a \"momentary read out request handler\" which when triggered, retrieved the current temperature and reports it back to the requestor.\n+While not strictly required, most things are identified via a key and serial number. We also build the thing with a \"momentary read out request handler\" which when triggered, retrieves the current temperature and reports it back to the requestor.\n-After the `Thing` is build, it needs to be made available so that other entities within the federated XMPP network can use it. Right now, we only intall the Thing in the `IoTDataManager`, which means the thing will act on read out requests but not be managed by a provisioning server.\n+After the `Thing` is built, it needs to be made available so that other entities within the federated XMPP network can use it. Right now we only install the Thing in the `IoTDataManager`, which means the thing will act on read out requests but not be managed by a provisioning server.\n```java\nIoTDataManager iotDataManager = IoTDataManager.getInstanceFor(connection);\n@@ -53,7 +53,7 @@ Now you have to unwrap the `IoTDataField` instances from the `IoTFieldsExtension\nControlling a thing\n-------------------\n-Things can also be controlled, e.g. to turn on a light. Let's create thing which can be used to turn the light on and off.\n+Things can also be controlled, e.g. to turn on a light. Let's create a thing which can be used to turn the light on and off.\n```java\nThing controlThing = Thing.builder().setKey(key).setSerialNumber(sn).setControlRequestHandler(new ThingControlRequest() {\n@@ -69,7 +69,7 @@ Thing controlThing = Thing.builder().setKey(key).setSerialNumber(sn).setControlR\n}).build();\n```\n-No we have to install this thing into the `IoTControlManager`:\n+Now we have to install this thing into the `IoTControlManager`:\n```java\nIoTControlManager iotControlManager = IoTControlManager.getInstanceFor(connection);\n@@ -89,9 +89,9 @@ Smack currently only supports a subset of the possible data types for set data.\nDiscovery\n---------\n-You may wondered how a full JIDs of things can be determined. One approach is using the discovery mechanisms specified in XEP-0347. Smack provides the `IoTDiscoveryManager` as API for this.\n+You may have wondered how a full JIDs of things can be determined. One approach is using the discovery mechanisms specified in XEP-0347. Smack provides the `IoTDiscoveryManager` as an API for this.\n-For example, instead of just installing the previous things in the `IoTDataManager` and/or `IoTControlManager`, we could also use the `IoTDiscoveryManger` to register the thing with a registry. Doing thing also installs the thing in the `IoTDataManager` and the `IoTControlManager`.\n+For example, instead of just installing the previous things in the `IoTDataManager` and/or `IoTControlManager`, we could also use the `IoTDiscoveryManger` to register the thing with a registry. Doing this also installs the thing in the `IoTDataManager` and the `IoTControlManager`.\n```java\nIoTDiscoveryManager iotDiscoveryManager = IoTDiscoveryManager.getInstanceFor(connection);\n@@ -105,7 +105,7 @@ The `IoTDiscoveryManager` can also be used to claim, disown, remove and unregist\nProvisioning\n------------\n-Things can usually only be used by other things if they are friends. Since a thing normally can't decide on its own if an incoming friendship request should be granted or not, we can delegate this decission to a provisioning service. Smack provides the `IoTProvisinoManager` to deal with friendship and provisioning.\n+Things can usually only be used by other things if they are friends. Since a thing normally can't decide on its own if an incoming friendship request should be granted or not, we can delegate this decision to a provisioning service. Smack provides the `IoTProvisinoManager` to deal with friendship and provisioning.\nFor example, if you want to befriend another thing:\n"
}
] | Java | Apache License 2.0 | igniterealtime/smack | Fix found typos
Fix found typos in the documentation -Jesus |
299,292 | 09.03.2018 07:15:46 | 21,600 | 903f90e1c17bb450384fa135c4cb9e5c2c803fa3 | Update/fix javadocs | [
{
"change_type": "MODIFY",
"old_path": "smack-core/src/main/java/org/jivesoftware/smack/XMPPConnection.java",
"new_path": "smack-core/src/main/java/org/jivesoftware/smack/XMPPConnection.java",
"diff": "@@ -43,13 +43,15 @@ import org.jxmpp.jid.EntityFullJid;\n* // Most servers require you to login before performing other tasks.\n* con.login(\"jsmith\", \"mypass\");\n* // Start a new conversation with John Doe and send him a message.\n- * Chat chat = ChatManager.getInstanceFor(con).createChat(\"[email protected]\", new MessageListener() {\n- * public void processMessage(Chat chat, Message message) {\n+ * ChatManager chatManager = ChatManager.getInstanceFor(con);\n+ * chatManager.addIncomingListener(new IncomingChatMessageListener() {\n+ * public void newIncomingMessage(EntityBareJid from, Message message, Chat chat) {\n* // Print out any messages we get back to standard out.\n* System.out.println(\"Received message: \" + message);\n* }\n* });\n- * chat.sendMessage(\"Howdy!\");\n+ * Chat chat = chatManager.chatWith(\"[email protected]\");\n+ * chat.send(\"Howdy!\");\n* // Disconnect from the server\n* con.disconnect();\n* </pre>\n"
},
{
"change_type": "MODIFY",
"old_path": "smack-im/src/main/java/org/jivesoftware/smack/roster/Roster.java",
"new_path": "smack-im/src/main/java/org/jivesoftware/smack/roster/Roster.java",
"diff": "@@ -78,7 +78,7 @@ import org.jxmpp.util.cache.LruCache;\n* Represents a user's roster, which is the collection of users a person receives\n* presence updates for. Roster items are categorized into groups for easier management.\n*\n- * Others users may attempt to subscribe to this user using a subscription request. Three\n+ * Other users may attempt to subscribe to this user using a subscription request. Three\n* modes are supported for handling these requests: <ul>\n* <li>{@link SubscriptionMode#accept_all accept_all} -- accept all subscription requests.</li>\n* <li>{@link SubscriptionMode#reject_all reject_all} -- reject all subscription requests.</li>\n"
},
{
"change_type": "MODIFY",
"old_path": "smack-tcp/src/main/java/org/jivesoftware/smack/tcp/XMPPTCPConnection.java",
"new_path": "smack-tcp/src/main/java/org/jivesoftware/smack/tcp/XMPPTCPConnection.java",
"diff": "@@ -272,7 +272,7 @@ public class XMPPTCPConnection extends AbstractXMPPConnection {\n/**\n* This listeners are invoked for every stanza that got acknowledged.\n* <p>\n- * We use a {@link ConccurrentLinkedQueue} here in order to allow the listeners to remove\n+ * We use a {@link ConcurrentLinkedQueue} here in order to allow the listeners to remove\n* themselves after they have been invoked.\n* </p>\n*/\n"
}
] | Java | Apache License 2.0 | igniterealtime/smack | Update/fix javadocs |
299,299 | 14.03.2018 16:40:14 | -3,600 | 713f0438df49c83da400975a054d384701da6e16 | Fix the Jingle IQ action attribute in jingle-old | [
{
"change_type": "MODIFY",
"old_path": "smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/packet/Jingle.java",
"new_path": "smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/packet/Jingle.java",
"diff": "@@ -354,7 +354,7 @@ public class Jingle extends IQ {\nbuf.append(\" responder=\\\"\").append(getResponder()).append('\"');\n}\nif (getAction() != null) {\n- buf.append(\" action=\\\"\").append(getAction().name()).append('\"');\n+ buf.append(\" action=\\\"\").append(getAction().toString()).append('\"');\n}\nif (getSid() != null) {\nbuf.append(\" sid=\\\"\").append(getSid()).append('\"');\n"
}
] | Java | Apache License 2.0 | igniterealtime/smack | Fix the Jingle IQ action attribute in jingle-old |
299,292 | 28.02.2018 08:02:55 | 21,600 | a70063dc893ee158ee50b462032ce2ec253c89a5 | Rename and deprecate XMPPConnection methods
Rename and deprecate XMPPConnections methods as described in | [
{
"change_type": "MODIFY",
"old_path": "smack-bosh/src/main/java/org/jivesoftware/smack/bosh/XMPPBOSHConnection.java",
"new_path": "smack-bosh/src/main/java/org/jivesoftware/smack/bosh/XMPPBOSHConnection.java",
"diff": "@@ -168,7 +168,7 @@ public class XMPPBOSHConnection extends AbstractXMPPConnection {\naddAsyncStanzaListener(debugger.getReaderListener(), null);\n}\nif (debugger.getWriterListener() != null) {\n- addPacketSendingListener(debugger.getWriterListener(), null);\n+ addStanzaSendingListener(debugger.getWriterListener(), null);\n}\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "smack-core/src/main/java/org/jivesoftware/smack/AbstractXMPPConnection.java",
"new_path": "smack-core/src/main/java/org/jivesoftware/smack/AbstractXMPPConnection.java",
"diff": "@@ -840,8 +840,14 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {\n}\n}\n+ @Deprecated\n@Override\npublic void addPacketSendingListener(StanzaListener packetListener, StanzaFilter packetFilter) {\n+ addStanzaSendingListener(packetListener, packetFilter);\n+ }\n+\n+ @Override\n+ public void addStanzaSendingListener(StanzaListener packetListener, StanzaFilter packetFilter) {\nif (packetListener == null) {\nthrow new NullPointerException(\"Packet listener is null.\");\n}\n@@ -851,8 +857,14 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {\n}\n}\n+ @Deprecated\n@Override\npublic void removePacketSendingListener(StanzaListener packetListener) {\n+ removeStanzaSendingListener(packetListener);\n+ }\n+\n+ @Override\n+ public void removeStanzaSendingListener(StanzaListener packetListener) {\nsynchronized (sendListeners) {\nsendListeners.remove(packetListener);\n}\n@@ -896,9 +908,16 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {\n});\n}\n+ @Deprecated\n@Override\npublic void addPacketInterceptor(StanzaListener packetInterceptor,\nStanzaFilter packetFilter) {\n+ addStanzaInterceptor(packetInterceptor, packetFilter);\n+ }\n+\n+ @Override\n+ public void addStanzaInterceptor(StanzaListener packetInterceptor,\n+ StanzaFilter packetFilter) {\nif (packetInterceptor == null) {\nthrow new NullPointerException(\"Packet interceptor is null.\");\n}\n@@ -908,8 +927,14 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {\n}\n}\n+ @Deprecated\n@Override\npublic void removePacketInterceptor(StanzaListener packetInterceptor) {\n+ removeStanzaInterceptor(packetInterceptor);\n+ }\n+\n+ @Override\n+ public void removeStanzaInterceptor(StanzaListener packetInterceptor) {\nsynchronized (interceptors) {\ninterceptors.remove(packetInterceptor);\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "smack-core/src/main/java/org/jivesoftware/smack/StanzaListener.java",
"new_path": "smack-core/src/main/java/org/jivesoftware/smack/StanzaListener.java",
"diff": "@@ -30,7 +30,7 @@ import org.jivesoftware.smack.packet.Stanza;\n* <p>\n* Additionally you are able to intercept Packets that are going to be send and\n* make modifications to them. You can register a PacketListener as interceptor\n- * by using {@link XMPPConnection#addPacketInterceptor(StanzaListener,\n+ * by using {@link XMPPConnection#addStanzaInterceptor(StanzaListener,\n* org.jivesoftware.smack.filter.StanzaFilter)}\n* </p>\n*\n"
},
{
"change_type": "MODIFY",
"old_path": "smack-core/src/main/java/org/jivesoftware/smack/XMPPConnection.java",
"new_path": "smack-core/src/main/java/org/jivesoftware/smack/XMPPConnection.java",
"diff": "@@ -319,7 +319,7 @@ public interface XMPPConnection {\n*\n* @param packetListener the stanza(/packet) listener to notify of new received packets.\n* @param packetFilter the stanza(/packet) filter to use.\n- * @see #addPacketInterceptor(StanzaListener, StanzaFilter)\n+ * @see #addStanzaInterceptor(StanzaListener, StanzaFilter)\n* @since 4.1\n*/\npublic void addSyncStanzaListener(StanzaListener packetListener, StanzaFilter packetFilter);\n@@ -345,7 +345,7 @@ public interface XMPPConnection {\n*\n* @param packetListener the stanza(/packet) listener to notify of new received packets.\n* @param packetFilter the stanza(/packet) filter to use.\n- * @see #addPacketInterceptor(StanzaListener, StanzaFilter)\n+ * @see #addStanzaInterceptor(StanzaListener, StanzaFilter)\n* @since 4.1\n*/\npublic void addAsyncStanzaListener(StanzaListener packetListener, StanzaFilter packetFilter);\n@@ -369,16 +369,42 @@ public interface XMPPConnection {\n*\n* @param packetListener the stanza(/packet) listener to notify of sent packets.\n* @param packetFilter the stanza(/packet) filter to use.\n+ * @deprecated use {@link #addStanzaSendingListener} instead\n*/\n+ // TODO Remove in Smack 4.4\n+ @Deprecated\npublic void addPacketSendingListener(StanzaListener packetListener, StanzaFilter packetFilter);\n+ /**\n+ * Registers a stanza(/packet) listener with this connection. The listener will be\n+ * notified of every stanza(/packet) that this connection sends. A stanza(/packet) filter determines\n+ * which packets will be delivered to the listener. Note that the thread\n+ * that writes packets will be used to invoke the listeners. Therefore, each\n+ * stanza(/packet) listener should complete all operations quickly or use a different\n+ * thread for processing.\n+ *\n+ * @param packetListener the stanza(/packet) listener to notify of sent packets.\n+ * @param packetFilter the stanza(/packet) filter to use.\n+ */\n+ public void addStanzaSendingListener(StanzaListener packetListener, StanzaFilter packetFilter);\n+\n/**\n* Removes a stanza(/packet) listener for sending packets from this connection.\n*\n* @param packetListener the stanza(/packet) listener to remove.\n+ * @deprecated use {@link #removeStanzaSendingListener} instead\n*/\n+ // TODO Remove in Smack 4.4\n+ @Deprecated\npublic void removePacketSendingListener(StanzaListener packetListener);\n+ /**\n+ * Removes a stanza(/packet) listener for sending packets from this connection.\n+ *\n+ * @param packetListener the stanza(/packet) listener to remove.\n+ */\n+ public void removeStanzaSendingListener(StanzaListener packetListener);\n+\n/**\n* Registers a stanza(/packet) interceptor with this connection. The interceptor will be\n* invoked every time a stanza(/packet) is about to be sent by this connection. Interceptors\n@@ -387,19 +413,48 @@ public interface XMPPConnection {\n*\n* <p>\n* NOTE: For a similar functionality on incoming packets, see {@link #addAsyncStanzaListener(StanzaListener, StanzaFilter)}.\n+ * </p>\n*\n* @param packetInterceptor the stanza(/packet) interceptor to notify of packets about to be sent.\n* @param packetFilter the stanza(/packet) filter to use.\n+ * @deprecated use {@link #addStanzaInterceptor} instead\n*/\n+ // TODO Remove in Smack 4.4\n+ @Deprecated\npublic void addPacketInterceptor(StanzaListener packetInterceptor, StanzaFilter packetFilter);\n+ /**\n+ * Registers a stanza(/packet) interceptor with this connection. The interceptor will be\n+ * invoked every time a stanza(/packet) is about to be sent by this connection. Interceptors\n+ * may modify the stanza(/packet) to be sent. A stanza(/packet) filter determines which packets\n+ * will be delivered to the interceptor.\n+ *\n+ * <p>\n+ * NOTE: For a similar functionality on incoming packets, see {@link #addAsyncStanzaListener(StanzaListener, StanzaFilter)}.\n+ * </p>\n+ *\n+ * @param packetInterceptor the stanza(/packet) interceptor to notify of packets about to be sent.\n+ * @param packetFilter the stanza(/packet) filter to use.\n+ */\n+ public void addStanzaInterceptor(StanzaListener packetInterceptor, StanzaFilter packetFilter);\n+\n/**\n* Removes a stanza(/packet) interceptor.\n*\n* @param packetInterceptor the stanza(/packet) interceptor to remove.\n+ * @deprecated user {@link #removeStanzaInterceptor} instead\n*/\n+ // TODO Remove in Smack 4.4\n+ @Deprecated\npublic void removePacketInterceptor(StanzaListener packetInterceptor);\n+ /**\n+ * Removes a stanza(/packet) interceptor.\n+ *\n+ * @param packetInterceptor the stanza(/packet) interceptor to remove.\n+ */\n+ public void removeStanzaInterceptor(StanzaListener packetInterceptor);\n+\n/**\n* Returns the current value of the reply timeout in milliseconds for request for this\n* XMPPConnection instance.\n"
},
{
"change_type": "MODIFY",
"old_path": "smack-debug/src/main/java/org/jivesoftware/smackx/debugger/EnhancedDebugger.java",
"new_path": "smack-debug/src/main/java/org/jivesoftware/smackx/debugger/EnhancedDebugger.java",
"diff": "@@ -1013,7 +1013,7 @@ public class EnhancedDebugger implements SmackDebugger {\nvoid cancel() {\nconnection.removeConnectionListener(connListener);\nconnection.removeAsyncStanzaListener(packetReaderListener);\n- connection.removePacketSendingListener(packetWriterListener);\n+ connection.removeStanzaSendingListener(packetWriterListener);\n((ObservableReader) reader).removeReaderListener(readerListener);\n((ObservableWriter) writer).removeWriterListener(writerListener);\nmessagesTable = null;\n"
},
{
"change_type": "MODIFY",
"old_path": "smack-experimental/src/main/java/org/jivesoftware/smackx/sid/StableUniqueStanzaIdManager.java",
"new_path": "smack-experimental/src/main/java/org/jivesoftware/smackx/sid/StableUniqueStanzaIdManager.java",
"diff": "@@ -95,7 +95,7 @@ public final class StableUniqueStanzaIdManager extends Manager {\npublic synchronized void enable() {\nServiceDiscoveryManager.getInstanceFor(connection()).addFeature(NAMESPACE);\nStanzaFilter filter = new AndFilter(OUTGOING_FILTER, new NotFilter(OUTGOING_FILTER));\n- connection().addPacketInterceptor(stanzaListener, filter);\n+ connection().addStanzaInterceptor(stanzaListener, filter);\n}\n/**\n@@ -103,7 +103,7 @@ public final class StableUniqueStanzaIdManager extends Manager {\n*/\npublic synchronized void disable() {\nServiceDiscoveryManager.getInstanceFor(connection()).removeFeature(NAMESPACE);\n- connection().removePacketInterceptor(stanzaListener);\n+ connection().removeStanzaInterceptor(stanzaListener);\n}\n/**\n"
},
{
"change_type": "MODIFY",
"old_path": "smack-extensions/src/main/java/org/jivesoftware/smack/chat2/ChatManager.java",
"new_path": "smack-extensions/src/main/java/org/jivesoftware/smack/chat2/ChatManager.java",
"diff": "@@ -116,7 +116,7 @@ public final class ChatManager extends Manager {\n}\n}, INCOMING_MESSAGE_FILTER);\n- connection.addPacketInterceptor(new StanzaListener() {\n+ connection.addStanzaInterceptor(new StanzaListener() {\n@Override\npublic void processStanza(Stanza stanza) throws NotConnectedException, InterruptedException {\nMessage message = (Message) stanza;\n"
},
{
"change_type": "MODIFY",
"old_path": "smack-extensions/src/main/java/org/jivesoftware/smackx/caps/EntityCapsManager.java",
"new_path": "smack-extensions/src/main/java/org/jivesoftware/smackx/caps/EntityCapsManager.java",
"diff": "@@ -339,7 +339,7 @@ public final class EntityCapsManager extends Manager {\n}\n});\n- connection.addPacketSendingListener(new StanzaListener() {\n+ connection.addStanzaSendingListener(new StanzaListener() {\n@Override\npublic void processStanza(Stanza packet) {\npresenceSend = (Presence) packet;\n@@ -362,7 +362,7 @@ public final class EntityCapsManager extends Manager {\npacket.overrideExtension(caps);\n}\n};\n- connection.addPacketInterceptor(packetInterceptor, PresenceTypeFilter.AVAILABLE);\n+ connection.addStanzaInterceptor(packetInterceptor, PresenceTypeFilter.AVAILABLE);\n// It's important to do this as last action. Since it changes the\n// behavior of the SDM in some ways\nsdm.setEntityCapsManager(this);\n"
},
{
"change_type": "MODIFY",
"old_path": "smack-extensions/src/main/java/org/jivesoftware/smackx/iqlast/LastActivityManager.java",
"new_path": "smack-extensions/src/main/java/org/jivesoftware/smackx/iqlast/LastActivityManager.java",
"diff": "@@ -134,7 +134,7 @@ public final class LastActivityManager extends Manager {\nsuper(connection);\n// Listen to all the sent messages to reset the idle time on each one\n- connection.addPacketSendingListener(new StanzaListener() {\n+ connection.addStanzaSendingListener(new StanzaListener() {\n@Override\npublic void processStanza(Stanza packet) {\nPresence presence = (Presence) packet;\n@@ -153,7 +153,7 @@ public final class LastActivityManager extends Manager {\n}\n}, StanzaTypeFilter.PRESENCE);\n- connection.addPacketSendingListener(new StanzaListener() {\n+ connection.addStanzaSendingListener(new StanzaListener() {\n@Override\npublic void processStanza(Stanza packet) {\nMessage message = (Message) packet;\n"
},
{
"change_type": "MODIFY",
"old_path": "smack-extensions/src/main/java/org/jivesoftware/smackx/muc/MultiUserChat.java",
"new_path": "smack-extensions/src/main/java/org/jivesoftware/smackx/muc/MultiUserChat.java",
"diff": "@@ -334,7 +334,7 @@ public class MultiUserChat {\n);\n// @formatter:on\nconnection.addSyncStanzaListener(declinesListener, new AndFilter(fromRoomFilter, DECLINE_FILTER));\n- connection.addPacketInterceptor(presenceInterceptor, new AndFilter(ToMatchesFilter.create(room),\n+ connection.addStanzaInterceptor(presenceInterceptor, new AndFilter(ToMatchesFilter.create(room),\nStanzaTypeFilter.PRESENCE));\nmessageCollector = connection.createStanzaCollector(fromRoomGroupchatFilter);\n@@ -2021,7 +2021,7 @@ public class MultiUserChat {\nconnection.removeSyncStanzaListener(presenceListener);\nconnection.removeSyncStanzaListener(subjectListener);\nconnection.removeSyncStanzaListener(declinesListener);\n- connection.removePacketInterceptor(presenceInterceptor);\n+ connection.removeStanzaInterceptor(presenceInterceptor);\nif (messageCollector != null) {\nmessageCollector.cancel();\nmessageCollector = null;\n"
},
{
"change_type": "MODIFY",
"old_path": "smack-extensions/src/main/java/org/jivesoftware/smackx/privacy/PrivacyListManager.java",
"new_path": "smack-extensions/src/main/java/org/jivesoftware/smackx/privacy/PrivacyListManager.java",
"diff": "@@ -126,7 +126,7 @@ public final class PrivacyListManager extends Manager {\n});\n// cached(Active|Default)ListName handling\n- connection.addPacketSendingListener(new StanzaListener() {\n+ connection.addStanzaSendingListener(new StanzaListener() {\n@Override\npublic void processStanza(Stanza packet) throws NotConnectedException {\nXMPPConnection connection = connection();\n@@ -148,7 +148,7 @@ public final class PrivacyListManager extends Manager {\n}, iqResultReplyFilter);\n}\n}, SetActiveListFilter.INSTANCE);\n- connection.addPacketSendingListener(new StanzaListener() {\n+ connection.addStanzaSendingListener(new StanzaListener() {\n@Override\npublic void processStanza(Stanza packet) throws NotConnectedException {\nXMPPConnection connection = connection();\n"
},
{
"change_type": "MODIFY",
"old_path": "smack-extensions/src/main/java/org/jivesoftware/smackx/receipts/DeliveryReceiptManager.java",
"new_path": "smack-extensions/src/main/java/org/jivesoftware/smackx/receipts/DeliveryReceiptManager.java",
"diff": "@@ -279,7 +279,7 @@ public final class DeliveryReceiptManager extends Manager {\n* @see #dontAutoAddDeliveryReceiptRequests()\n*/\npublic void autoAddDeliveryReceiptRequests() {\n- connection().addPacketInterceptor(AUTO_ADD_DELIVERY_RECEIPT_REQUESTS_LISTENER,\n+ connection().addStanzaInterceptor(AUTO_ADD_DELIVERY_RECEIPT_REQUESTS_LISTENER,\nMESSAGES_TO_REQUEST_RECEIPTS_FOR);\n}\n@@ -290,7 +290,7 @@ public final class DeliveryReceiptManager extends Manager {\n* @see #autoAddDeliveryReceiptRequests()\n*/\npublic void dontAutoAddDeliveryReceiptRequests() {\n- connection().removePacketInterceptor(AUTO_ADD_DELIVERY_RECEIPT_REQUESTS_LISTENER);\n+ connection().removeStanzaInterceptor(AUTO_ADD_DELIVERY_RECEIPT_REQUESTS_LISTENER);\n}\n/**\n"
},
{
"change_type": "MODIFY",
"old_path": "smack-im/src/main/java/org/jivesoftware/smack/roster/Roster.java",
"new_path": "smack-im/src/main/java/org/jivesoftware/smack/roster/Roster.java",
"diff": "@@ -335,7 +335,7 @@ public final class Roster extends Manager {\n});\n- connection.addPacketSendingListener(new StanzaListener() {\n+ connection.addStanzaSendingListener(new StanzaListener() {\n@Override\npublic void processStanza(Stanza stanzav) throws NotConnectedException, InterruptedException {\n// Once we send an unavailable presence, the server is allowed to suppress sending presence status\n"
},
{
"change_type": "MODIFY",
"old_path": "smack-integration-test/src/main/java/org/jivesoftware/smackx/caps/EntityCapsTest.java",
"new_path": "smack-integration-test/src/main/java/org/jivesoftware/smackx/caps/EntityCapsTest.java",
"diff": "@@ -134,7 +134,7 @@ public class EntityCapsTest extends AbstractSmackIntegrationTest {\n@SmackIntegrationTest\npublic void testPreventDiscoInfo() throws Exception {\nfinal String dummyFeature = getNewDummyFeature();\n- conOne.addPacketSendingListener(new StanzaListener() {\n+ conOne.addStanzaSendingListener(new StanzaListener() {\n@Override\npublic void processStanza(Stanza stanza) {\n"
},
{
"change_type": "MODIFY",
"old_path": "smack-tcp/src/main/java/org/jivesoftware/smack/tcp/XMPPTCPConnection.java",
"new_path": "smack-tcp/src/main/java/org/jivesoftware/smack/tcp/XMPPTCPConnection.java",
"diff": "@@ -643,7 +643,7 @@ public class XMPPTCPConnection extends AbstractXMPPConnection {\nif (config.isDebuggerEnabled()) {\naddAsyncStanzaListener(debugger.getReaderListener(), null);\nif (debugger.getWriterListener() != null) {\n- addPacketSendingListener(debugger.getWriterListener(), null);\n+ addStanzaSendingListener(debugger.getWriterListener(), null);\n}\n}\n}\n"
}
] | Java | Apache License 2.0 | igniterealtime/smack | Rename and deprecate XMPPConnection methods
Rename and deprecate XMPPConnections methods as described in SMACK-802 |
299,317 | 04.04.2018 15:02:23 | -7,200 | 632c172f6d4f7de42dc7ef30bba7f3acce1b4de6 | Add pubsub publishing and altaccuracy parameter to geoloc | [
{
"change_type": "MODIFY",
"old_path": "smack-extensions/src/main/java/org/jivesoftware/smackx/geoloc/GeoLocationManager.java",
"new_path": "smack-extensions/src/main/java/org/jivesoftware/smackx/geoloc/GeoLocationManager.java",
"diff": "/**\n*\n- * Copyright 2015-2016 Ishan Khanna\n+ * Copyright 2015-2017 Ishan Khanna, Fernando Ramirez\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n@@ -21,12 +21,18 @@ import java.util.WeakHashMap;\nimport org.jivesoftware.smack.ConnectionCreationListener;\nimport org.jivesoftware.smack.Manager;\n+import org.jivesoftware.smack.SmackException.NoResponseException;\nimport org.jivesoftware.smack.SmackException.NotConnectedException;\nimport org.jivesoftware.smack.XMPPConnection;\nimport org.jivesoftware.smack.XMPPConnectionRegistry;\n+import org.jivesoftware.smack.XMPPException.XMPPErrorException;\nimport org.jivesoftware.smack.packet.Message;\nimport org.jivesoftware.smackx.geoloc.packet.GeoLocation;\n+import org.jivesoftware.smackx.pubsub.LeafNode;\n+import org.jivesoftware.smackx.pubsub.PayloadItem;\n+import org.jivesoftware.smackx.pubsub.PubSubException.NotALeafNodeException;\n+import org.jivesoftware.smackx.pubsub.PubSubManager;\nimport org.jxmpp.jid.Jid;\n@@ -86,4 +92,39 @@ public final class GeoLocationManager extends Manager {\nreturn GeoLocation.from(message) != null;\n}\n+ /**\n+ * Send geolocation through the PubSub node.\n+ *\n+ * @param geoLocation\n+ * @throws InterruptedException\n+ * @throws NotConnectedException\n+ * @throws XMPPErrorException\n+ * @throws NoResponseException\n+ * @throws NotALeafNodeException\n+ */\n+ public void sendGeolocation(GeoLocation geoLocation)\n+ throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException, NotALeafNodeException {\n+ getNode().publish(new PayloadItem<GeoLocation>(geoLocation));\n+ }\n+\n+ /**\n+ * Send empty geolocation through the PubSub node.\n+ *\n+ * @throws InterruptedException\n+ * @throws NotConnectedException\n+ * @throws XMPPErrorException\n+ * @throws NoResponseException\n+ * @throws NotALeafNodeException\n+ */\n+ public void stopPublishingGeolocation()\n+ throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException, NotALeafNodeException {\n+ GeoLocation emptyGeolocation = new GeoLocation.Builder().build();\n+ getNode().publish(new PayloadItem<GeoLocation>(emptyGeolocation));\n+ }\n+\n+ private LeafNode getNode()\n+ throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException, NotALeafNodeException {\n+ return PubSubManager.getInstance(connection()).getOrCreateLeafNode(GeoLocation.NAMESPACE);\n+ }\n+\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "smack-extensions/src/main/java/org/jivesoftware/smackx/geoloc/packet/GeoLocation.java",
"new_path": "smack-extensions/src/main/java/org/jivesoftware/smackx/geoloc/packet/GeoLocation.java",
"diff": "/**\n*\n- * Copyright 2015-2016 Ishan Khanna\n+ * Copyright 2015-2017 Ishan Khanna, Fernando Ramirez\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n@@ -43,6 +43,7 @@ public final class GeoLocation implements Serializable, ExtensionElement {\nprivate final Double accuracy;\nprivate final Double alt;\n+ private final Double altAccuracy;\nprivate final String area;\nprivate final Double bearing;\nprivate final String building;\n@@ -65,12 +66,13 @@ public final class GeoLocation implements Serializable, ExtensionElement {\nprivate final String tzo;\nprivate final URI uri;\n- private GeoLocation(Double accuracy, Double alt, String area, Double bearing, String building, String country,\n+ private GeoLocation(Double accuracy, Double alt, Double altAccuracy, String area, Double bearing, String building, String country,\nString countryCode, String datum, String description, Double error, String floor, Double lat,\nString locality, Double lon, String postalcode, String region, String room, Double speed,\nString street, String text, Date timestamp, String tzo, URI uri) {\nthis.accuracy = accuracy;\nthis.alt = alt;\n+ this.altAccuracy = altAccuracy;\nthis.area = area;\nthis.bearing = bearing;\nthis.building = building;\n@@ -118,6 +120,10 @@ public final class GeoLocation implements Serializable, ExtensionElement {\nreturn alt;\n}\n+ public Double getAltAccuracy() {\n+ return altAccuracy;\n+ }\n+\npublic String getArea() {\nreturn area;\n}\n@@ -213,6 +219,7 @@ public final class GeoLocation implements Serializable, ExtensionElement {\nxml.rightAngleBracket();\nxml.optElement(\"accuracy\", accuracy);\nxml.optElement(\"alt\", alt);\n+ xml.optElement(\"altaccuracy\", altAccuracy);\nxml.optElement(\"area\", area);\nxml.optElement(\"bearing\", bearing);\nxml.optElement(\"building\", building);\n@@ -255,6 +262,7 @@ public final class GeoLocation implements Serializable, ExtensionElement {\nprivate Double accuracy;\nprivate Double alt;\n+ private Double altAccuracy;\nprivate String area;\nprivate Double bearing;\nprivate String building;\n@@ -287,6 +295,11 @@ public final class GeoLocation implements Serializable, ExtensionElement {\nreturn this;\n}\n+ public Builder setAltAccuracy(Double altAccuracy) {\n+ this.altAccuracy = altAccuracy;\n+ return this;\n+ }\n+\npublic Builder setArea(String area) {\nthis.area = area;\nreturn this;\n@@ -394,7 +407,7 @@ public final class GeoLocation implements Serializable, ExtensionElement {\npublic GeoLocation build() {\n- return new GeoLocation(accuracy, alt, area, bearing, building, country, countryCode, datum, description,\n+ return new GeoLocation(accuracy, alt, altAccuracy, area, bearing, building, country, countryCode, datum, description,\nerror, floor, lat, locality, lon, postalcode, region, room, speed, street, text, timestamp,\ntzo, uri);\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "smack-extensions/src/main/java/org/jivesoftware/smackx/geoloc/provider/GeoLocationProvider.java",
"new_path": "smack-extensions/src/main/java/org/jivesoftware/smackx/geoloc/provider/GeoLocationProvider.java",
"diff": "/**\n*\n- * Copyright 2015-2016 Ishan Khanna\n+ * Copyright 2015-2017 Ishan Khanna, Fernando Ramirez\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n@@ -48,6 +48,9 @@ public class GeoLocationProvider extends ExtensionElementProvider<GeoLocation> {\ncase \"alt\":\nbuilder.setAlt(ParserUtils.getDoubleFromNextText(parser));\nbreak;\n+ case \"altaccuracy\":\n+ builder.setAltAccuracy(ParserUtils.getDoubleFromNextText(parser));\n+ break;\ncase \"area\":\nbuilder.setArea(parser.nextText());\nbreak;\n"
},
{
"change_type": "MODIFY",
"old_path": "smack-extensions/src/test/java/org/jivesoftware/smackx/geoloc/packet/GeoLocationTest.java",
"new_path": "smack-extensions/src/test/java/org/jivesoftware/smackx/geoloc/packet/GeoLocationTest.java",
"diff": "/**\n*\n- * Copyright 2015-2016 Ishan Khanna\n+ * Copyright 2015-2017 Ishan Khanna, Fernando Ramirez\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n@@ -72,6 +72,14 @@ public class GeoLocationTest extends InitExtensions {\nassertEquals((Double) 1.34, geoLocation.getAccuracy());\n}\n+ @Test\n+ public void altAccuracyTest() {\n+\n+ GeoLocation geoLocation = new GeoLocation.Builder().setAltAccuracy(1.52d).build();\n+\n+ assertEquals((Double) 1.52, geoLocation.getAltAccuracy());\n+ }\n+\n@Test\npublic void toXMLMethodTest() throws Exception {\n@@ -81,6 +89,7 @@ public class GeoLocationTest extends InitExtensions {\n+ \"<geoloc xmlns='http://jabber.org/protocol/geoloc'>\"\n+ \"<accuracy>23</accuracy>\"\n+ \"<alt>1000</alt>\"\n+ + \"<altaccuracy>10</altaccuracy>\"\n+ \"<area>Delhi</area>\"\n+ \"<bearing>10</bearing>\"\n+ \"<building>Small Building</building>\"\n@@ -113,7 +122,7 @@ public class GeoLocationTest extends InitExtensions {\nassertNotNull(geoLocation);\nassertNotNull(geoLocation.toXML());\n- GeoLocation constructedGeoLocation = GeoLocation.builder().setAccuracy(23d).setAlt(1000d).setArea(\"Delhi\").setBearing(\n+ GeoLocation constructedGeoLocation = GeoLocation.builder().setAccuracy(23d).setAlt(1000d).setAltAccuracy(10d).setArea(\"Delhi\").setBearing(\n10d).setBuilding(\"Small Building\").setCountry(\"India\").setCountryCode(\"IN\").setDescription(\n\"My Description\").setError(90d).setFloor(\"top\").setLat(25.098345d).setLocality(\"awesome\").setLon(\n77.992034).setPostalcode(\"110085\").setRegion(\"North\").setRoom(\"small\").setSpeed(250.0d).setStreet(\n"
},
{
"change_type": "MODIFY",
"old_path": "smack-extensions/src/test/java/org/jivesoftware/smackx/geoloc/provider/GeoLocationProviderTest.java",
"new_path": "smack-extensions/src/test/java/org/jivesoftware/smackx/geoloc/provider/GeoLocationProviderTest.java",
"diff": "/**\n*\n- * Copyright 2015-2016 Ishan Khanna\n+ * Copyright 2015-2017 Ishan Khanna, Fernando Ramirez\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n@@ -41,6 +41,7 @@ public class GeoLocationProviderTest extends InitExtensions {\n+ \"<geoloc xmlns='http://jabber.org/protocol/geoloc'>\"\n+ \"<accuracy>23</accuracy>\"\n+ \"<alt>1000</alt>\"\n+ + \"<altaccuracy>10</altaccuracy>\"\n+ \"<area>Delhi</area>\"\n+ \"<bearing>10</bearing>\"\n+ \"<building>Small Building</building>\"\n@@ -74,6 +75,7 @@ public class GeoLocationProviderTest extends InitExtensions {\nassertEquals((Double) 23d, geoLocation.getAccuracy());\nassertEquals((Double) 1000d, geoLocation.getAlt());\n+ assertEquals((Double) 10d, geoLocation.getAltAccuracy());\nassertEquals(\"Delhi\", geoLocation.getArea());\nassertEquals((Double) 10d, geoLocation.getBearing());\nassertEquals(\"Small Building\", geoLocation.getBuilding());\n@@ -107,6 +109,7 @@ public class GeoLocationProviderTest extends InitExtensions {\n+ \"<geoloc xmlns='http://jabber.org/protocol/geoloc'>\"\n+ \"<accuracy>23</accuracy>\"\n+ \"<alt>1000</alt>\"\n+ + \"<altaccuracy>10</altaccuracy>\"\n+ \"<area>Delhi</area>\"\n+ \"<bearing>10</bearing>\"\n+ \"<building>Small Building</building>\"\n@@ -141,6 +144,7 @@ public class GeoLocationProviderTest extends InitExtensions {\nassertEquals((Double) 23d, geoLocation.getAccuracy());\nassertEquals((Double) 1000d, geoLocation.getAlt());\n+ assertEquals((Double) 10d, geoLocation.getAltAccuracy());\nassertEquals(\"Delhi\", geoLocation.getArea());\nassertEquals((Double) 10d, geoLocation.getBearing());\nassertEquals(\"Small Building\", geoLocation.getBuilding());\n"
}
] | Java | Apache License 2.0 | igniterealtime/smack | Add pubsub publishing and altaccuracy parameter to geoloc |
299,321 | 20.03.2018 11:49:32 | -3,600 | 832c0a92aa798cba0bb9f35dc59b7e00a67092ac | Added pubsub Node.modifySubscriptionsAsOwner with test | [
{
"change_type": "MODIFY",
"old_path": "smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/Subscription.java",
"new_path": "smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/Subscription.java",
"diff": "@@ -56,6 +56,16 @@ public class Subscription extends NodeExtension {\nthis(subscriptionJid, nodeId, null, null);\n}\n+ /**\n+ * Construct a subscription change request to the specified state.\n+ *\n+ * @param subscriptionJid The subscriber JID\n+ * @param state The requested new state\n+ */\n+ public Subscription(Jid subscriptionJid, State state) {\n+ this(subscriptionJid, null, null, state);\n+ }\n+\n/**\n* Constructs a representation of a subscription reply to the specified node\n* and JID. The server will have supplied the subscription id and current state.\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "smack-extensions/src/test/java/org/jivesoftware/smackx/pubsub/PubSubNodeTest.java",
"diff": "+/**\n+ *\n+ * Copyright 2018 Timothy Pitt\n+ *\n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * You may obtain a copy of the License at\n+ *\n+ * http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+package org.jivesoftware.smackx.pubsub;\n+\n+import static org.junit.Assert.assertEquals;\n+\n+import java.io.IOException;\n+import java.util.Arrays;\n+import java.util.List;\n+\n+import org.jivesoftware.smack.SmackException;\n+import org.jivesoftware.smack.ThreadedDummyConnection;\n+import org.jivesoftware.smack.XMPPException;\n+import org.jivesoftware.smack.test.util.TestUtils;\n+import org.jivesoftware.smack.util.PacketParserUtils;\n+import org.jivesoftware.smackx.pubsub.packet.PubSub;\n+\n+import org.junit.Test;\n+import org.jxmpp.jid.JidTestUtil;\n+import org.jxmpp.jid.impl.JidCreate;\n+import org.xmlpull.v1.XmlPullParser;\n+\n+public class PubSubNodeTest {\n+\n+ @Test\n+ public void modifySubscriptionsAsOwnerTest() throws InterruptedException, SmackException, IOException, XMPPException, Exception {\n+ ThreadedDummyConnection con = ThreadedDummyConnection.newInstance();\n+ PubSubManager mgr = new PubSubManager(con, JidTestUtil.PUBSUB_EXAMPLE_ORG);\n+ Node testNode = new LeafNode(mgr, \"princely_musings\");\n+\n+ List<Subscription> ChangeSubs = Arrays.asList(\n+ new Subscription(JidCreate.from(\"[email protected]\"), Subscription.State.subscribed),\n+ new Subscription(JidCreate.from(\"[email protected]\"), Subscription.State.none)\n+ );\n+ testNode.modifySubscriptionsAsOwner(ChangeSubs);\n+\n+ PubSub request = con.getSentPacket();\n+\n+ assertEquals(\"http://jabber.org/protocol/pubsub#owner\", request.getChildElementNamespace());\n+ assertEquals(\"pubsub\", request.getChildElementName());\n+\n+ XmlPullParser parser = TestUtils.getIQParser(request.toXML().toString());\n+ PubSub pubsubResult = (PubSub) PacketParserUtils.parseIQ(parser);\n+ SubscriptionsExtension subElem = pubsubResult.getExtension(PubSubElementType.SUBSCRIPTIONS);\n+ List<Subscription> subscriptions = subElem.getSubscriptions();\n+ assertEquals(2, subscriptions.size());\n+\n+ Subscription sub1 = subscriptions.get(0);\n+ assertEquals(\"[email protected]\", sub1.getJid().toString());\n+ assertEquals(Subscription.State.subscribed, sub1.getState());\n+\n+ Subscription sub2 = subscriptions.get(1);\n+ assertEquals(\"[email protected]\", sub2.getJid().toString());\n+ assertEquals(Subscription.State.none, sub2.getState());\n+ }\n+}\n"
}
] | Java | Apache License 2.0 | igniterealtime/smack | Added pubsub Node.modifySubscriptionsAsOwner with test |
299,321 | 16.04.2018 16:03:02 | -7,200 | d5aaf8fdabb0a1b7b72e69654f821238014ba7e7 | Notification type for pubsub node config | [
{
"change_type": "MODIFY",
"old_path": "smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/ConfigureForm.java",
"new_path": "smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/ConfigureForm.java",
"diff": "@@ -406,6 +406,30 @@ public class ConfigureForm extends Form {\nsetAnswer(ConfigureNodeFields.notify_retract.getFieldName(), notify);\n}\n+ /**\n+ * Determines the type of notifications which are sent.\n+ *\n+ * @return NotificationType for the node configuration\n+ * @since 4.3\n+ */\n+ public NotificationType getNotificationType() {\n+ String value = getFieldValue(ConfigureNodeFields.notification_type);\n+ if (value == null)\n+ return null;\n+ return NotificationType.valueOf(value);\n+ }\n+\n+ /**\n+ * Sets the NotificationType for the node.\n+ *\n+ * @param notificationType The enum representing the possible options\n+ * @since 4.3\n+ */\n+ public void setNotificationType(NotificationType notificationType) {\n+ addField(ConfigureNodeFields.notification_type, FormField.Type.list_single);\n+ setAnswer(ConfigureNodeFields.notification_type.getFieldName(), getListSingle(notificationType.toString()));\n+ }\n+\n/**\n* Determines whether items should be persisted in the node.\n*\n"
},
{
"change_type": "MODIFY",
"old_path": "smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/ConfigureNodeFields.java",
"new_path": "smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/ConfigureNodeFields.java",
"diff": "@@ -147,6 +147,13 @@ public enum ConfigureNodeFields {\n*/\nnotify_retract,\n+ /**\n+ * The type of notification that the nodes sends.\n+ *\n+ * <p><b>Value: {@link NotificationType}</b></p>\n+ */\n+ notification_type,\n+\n/**\n* Whether to persist items to storage. This is required to have. multiple\n* items in the node.\n@@ -205,7 +212,7 @@ public enum ConfigureNodeFields {\ntitle,\n/**\n- * The type of node data, ussually specified by the namespace\n+ * The type of node data, usually specified by the namespace\n* of the payload(if any);MAY be a list-single rather than a\n* text single.\n*\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/NotificationType.java",
"diff": "+/**\n+ *\n+ * Copyright the original author or authors\n+ *\n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * You may obtain a copy of the License at\n+ *\n+ * http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+package org.jivesoftware.smackx.pubsub;\n+\n+/**\n+ * Specify the delivery style for event notifications. Denotes possible values\n+ * for {@link ConfigureForm#setNotificationType(NotificationType)}.\n+ *\n+ * @author Timothy Pitt\n+ */\n+public enum NotificationType {\n+ normal,\n+ headline\n+}\n"
},
{
"change_type": "MODIFY",
"old_path": "smack-extensions/src/test/java/org/jivesoftware/smackx/pubsub/ConfigureFormTest.java",
"new_path": "smack-extensions/src/test/java/org/jivesoftware/smackx/pubsub/ConfigureFormTest.java",
"diff": "@@ -97,4 +97,14 @@ public class ConfigureFormTest extends InitExtensions {\nnode.getNodeConfiguration();\n}\n+\n+ @Test\n+ public void checkNotificationType() {\n+ ConfigureForm form = new ConfigureForm(DataForm.Type.submit);\n+ form.setNotificationType(NotificationType.normal);\n+ assertEquals(NotificationType.normal, form.getNotificationType());\n+ form.setNotificationType(NotificationType.headline);\n+ assertEquals(NotificationType.headline, form.getNotificationType());\n+ }\n+\n}\n"
}
] | Java | Apache License 2.0 | igniterealtime/smack | Notification type for pubsub node config |
299,312 | 21.05.2018 14:44:23 | 18,000 | fd5e86ce5af8d72de60ba6caf71a159dcce8b223 | fix: Cleans the multiUserChats map. | [
{
"change_type": "ADD",
"old_path": null,
"new_path": "smack-core/src/main/java/org/jivesoftware/smack/util/CleaningWeakReferenceMap.java",
"diff": "+/**\n+ *\n+ * Copyright the original author or authors\n+ *\n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * You may obtain a copy of the License at\n+ *\n+ * http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+package org.jivesoftware.smack.util;\n+\n+import java.lang.ref.WeakReference;\n+import java.util.HashMap;\n+import java.util.Iterator;\n+\n+/**\n+ * Extends a {@link HashMap} with {@link WeakReference} values, so that\n+ * weak references which have been cleared are periodically removed from\n+ * the map. The cleaning occurs as part of {@link #put}, after a specific\n+ * number ({@link #cleanInterval}) of calls to {@link #put}.\n+ *\n+ * @param <K> The key type.\n+ * @param <V> The value type.\n+ *\n+ * @author Boris Grozev\n+ */\n+public class CleaningWeakReferenceMap<K, V>\n+ extends HashMap<K, WeakReference<V>> {\n+ private static final long serialVersionUID = 0L;\n+\n+ /**\n+ * The number of calls to {@link #put} after which to clean this map\n+ * (i.e. remove cleared {@link WeakReference}s from it).\n+ */\n+ private final int cleanInterval;\n+\n+ /**\n+ * The number of times {@link #put} has been called on this instance\n+ * since the last time it was {@link #clean}ed.\n+ */\n+ private int numberOfInsertsSinceLastClean = 0;\n+\n+ /**\n+ * Initializes a new {@link CleaningWeakReferenceMap} instance with the\n+ * default clean interval.\n+ */\n+ public CleaningWeakReferenceMap() {\n+ this(50);\n+ }\n+\n+ /**\n+ * Initializes a new {@link CleaningWeakReferenceMap} instance with a given\n+ * clean interval.\n+ * @param cleanInterval the number of calls to {@link #put} after which the\n+ * map will clean itself.\n+ */\n+ public CleaningWeakReferenceMap(int cleanInterval) {\n+ this.cleanInterval = cleanInterval;\n+ }\n+\n+ @Override\n+ public WeakReference<V> put(K key, WeakReference<V> value) {\n+ WeakReference<V> ret = super.put(key, value);\n+\n+ if (numberOfInsertsSinceLastClean++ > cleanInterval) {\n+ numberOfInsertsSinceLastClean = 0;\n+ clean();\n+ }\n+\n+ return ret;\n+ }\n+\n+ /**\n+ * Removes all cleared entries from this map (i.e. entries whose value\n+ * is a cleared {@link WeakReference}).\n+ */\n+ private void clean() {\n+ Iterator<Entry<K, WeakReference<V>>> iter = entrySet().iterator();\n+ while (iter.hasNext()) {\n+ Entry<K, WeakReference<V>> e = iter.next();\n+ if (e != null && e.getValue() != null\n+ && e.getValue().get() == null) {\n+ iter.remove();\n+ }\n+ }\n+ }\n+}\n"
},
{
"change_type": "MODIFY",
"old_path": "smack-extensions/src/main/java/org/jivesoftware/smackx/muc/MultiUserChatManager.java",
"new_path": "smack-extensions/src/main/java/org/jivesoftware/smackx/muc/MultiUserChatManager.java",
"diff": "@@ -19,7 +19,6 @@ package org.jivesoftware.smackx.muc;\nimport java.lang.ref.WeakReference;\nimport java.util.ArrayList;\nimport java.util.Collections;\n-import java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Set;\n@@ -46,6 +45,7 @@ import org.jivesoftware.smack.filter.StanzaTypeFilter;\nimport org.jivesoftware.smack.packet.Message;\nimport org.jivesoftware.smack.packet.Stanza;\nimport org.jivesoftware.smack.util.Async;\n+import org.jivesoftware.smack.util.CleaningWeakReferenceMap;\nimport org.jivesoftware.smackx.disco.AbstractNodeInformationProvider;\nimport org.jivesoftware.smackx.disco.ServiceDiscoveryManager;\n@@ -144,7 +144,7 @@ public final class MultiUserChatManager extends Manager {\n* those instances to get garbage collected. Note that MultiUserChat instances can not get garbage collected while\n* the user is joined, because then the MUC will have PacketListeners added to the XMPPConnection.\n*/\n- private final Map<EntityBareJid, WeakReference<MultiUserChat>> multiUserChats = new HashMap<>();\n+ private final Map<EntityBareJid, WeakReference<MultiUserChat>> multiUserChats = new CleaningWeakReferenceMap<>();\nprivate boolean autoJoinOnReconnect;\n"
}
] | Java | Apache License 2.0 | igniterealtime/smack | fix: Cleans the multiUserChats map. |
299,282 | 02.07.2018 11:50:58 | -7,200 | 33221c57f9bf46484612f49ccbb1c375a4a13bf2 | Fix missing body namespace in BOSH messages
The body's "jabber:client" namespace was missing
in BOSH messages. | [
{
"change_type": "MODIFY",
"old_path": "smack-bosh/src/main/java/org/jivesoftware/smack/bosh/XMPPBOSHConnection.java",
"new_path": "smack-bosh/src/main/java/org/jivesoftware/smack/bosh/XMPPBOSHConnection.java",
"diff": "@@ -39,7 +39,6 @@ import org.jivesoftware.smack.packet.Nonza;\nimport org.jivesoftware.smack.packet.Presence;\nimport org.jivesoftware.smack.packet.Stanza;\nimport org.jivesoftware.smack.packet.StanzaError;\n-import org.jivesoftware.smack.packet.StreamOpen;\nimport org.jivesoftware.smack.sasl.packet.SaslStreamElements.SASLFailure;\nimport org.jivesoftware.smack.sasl.packet.SaslStreamElements.Success;\nimport org.jivesoftware.smack.util.PacketParserUtils;\n@@ -235,7 +234,7 @@ public class XMPPBOSHConnection extends AbstractXMPPConnection {\nprivate void sendElement(Element element) {\ntry {\n- send(ComposableBody.builder().setPayloadXML(element.toXML(StreamOpen.CLIENT_NAMESPACE).toString()).build());\n+ send(ComposableBody.builder().setPayloadXML(element.toXML(BOSH_URI).toString()).build());\nif (element instanceof Stanza) {\nfirePacketSendingListeners((Stanza) element);\n}\n"
}
] | Java | Apache License 2.0 | igniterealtime/smack | Fix missing body namespace in BOSH messages
The body's "jabber:client" namespace was missing
in BOSH messages. |
299,302 | 23.08.2018 16:22:25 | 18,000 | 3ffdb9befd59cabee51b94a11312034685447671 | Clears bosh client instance on shutdown. Fixes | [
{
"change_type": "MODIFY",
"old_path": "smack-bosh/src/main/java/org/jivesoftware/smack/bosh/XMPPBOSHConnection.java",
"new_path": "smack-bosh/src/main/java/org/jivesoftware/smack/bosh/XMPPBOSHConnection.java",
"diff": "@@ -253,6 +253,16 @@ public class XMPPBOSHConnection extends AbstractXMPPConnection {\n*/\n@Override\nprotected void shutdown() {\n+\n+ if (client != null) {\n+ try {\n+ client.disconnect();\n+ } catch (Exception e) {\n+ LOGGER.log(Level.WARNING, \"shutdown\", e);\n+ }\n+ client = null;\n+ }\n+\nsetWasAuthenticated();\nsessionID = null;\ndone = true;\n"
}
] | Java | Apache License 2.0 | igniterealtime/smack | Clears bosh client instance on shutdown. Fixes SMACK-829. |
299,289 | 09.09.2018 20:49:30 | -7,200 | f23f27aa755456ba174fca46c9111524f11d402b | Typo in CarbonManager.java
The listeners "were" registered... | [
{
"change_type": "MODIFY",
"old_path": "smack-experimental/src/main/java/org/jivesoftware/smackx/carbons/CarbonManager.java",
"new_path": "smack-experimental/src/main/java/org/jivesoftware/smackx/carbons/CarbonManager.java",
"diff": "@@ -62,7 +62,7 @@ import org.jxmpp.jid.EntityFullJid;\n* <p>\n* Note that <b>it is important to match the 'from' attribute of the message wrapping a carbon copy</b>, as otherwise it would\n* may be possible for others to impersonate users. Smack's CarbonManager takes care of that in\n- * {@link CarbonCopyReceivedListener}s which where registered with\n+ * {@link CarbonCopyReceivedListener}s which were registered with\n* {@link #addCarbonCopyReceivedListener(CarbonCopyReceivedListener)}.\n* </p>\n* <p>\n"
}
] | Java | Apache License 2.0 | igniterealtime/smack | Typo in CarbonManager.java
The listeners "were" registered... |
299,289 | 10.09.2018 11:49:51 | -7,200 | dcd0fd87b35bd6c78719246f95f5e491ebb4142c | Documentation: debugging: The debugging jar is now named smack-debug.jar
The documentation states that the debugging jar is called
smackx-debug.jar. However, according to maven central, that name was
only used until 3.2.1, newer releases (including 4.4.0-alpha1) only
distribute smack-debug.jar, which contains the debugger as advertised. | [
{
"change_type": "MODIFY",
"old_path": "documentation/debugging.md",
"new_path": "documentation/debugging.md",
"diff": "@@ -29,7 +29,7 @@ Smack uses the following logic to decide the debugger console to use:\n`java -Dsmack.debuggerClass=my.company.com.MyDebugger SomeApp `\n- 2. If step 1 fails then Smack will try to use the enhanced debugger. The file `smackx-debug.jar` contains the enhanced debugger. Therefore you will need to place the jar file in the classpath. For situations where space is an issue you may want to only deploy `smack-core.jar` in which case the enhanced and lite debugger won't be available, but only the console debugger.\n+ 2. If step 1 fails then Smack will try to use the enhanced debugger. The file `smack-debug.jar` contains the enhanced debugger. Therefore you will need to place the jar file in the classpath. For situations where space is an issue you may want to only deploy `smack-core.jar` in which case the enhanced and lite debugger won't be available, but only the console debugger.\n3. The last option if the previous two steps fail is to use the console debugger. The console debugger is a very good option for situations where you need to have low memory footprint.\n"
}
] | Java | Apache License 2.0 | igniterealtime/smack | Documentation: debugging: The debugging jar is now named smack-debug.jar
The documentation states that the debugging jar is called
smackx-debug.jar. However, according to maven central, that name was
only used until 3.2.1, newer releases (including 4.4.0-alpha1) only
distribute smack-debug.jar, which contains the debugger as advertised. |
299,310 | 02.10.2018 11:13:17 | -7,200 | 864cc0050c4959533029908c72abf610cc3f7ee4 | Fix example for Establishing a Connection | [
{
"change_type": "MODIFY",
"old_path": "documentation/gettingstarted.md",
"new_path": "documentation/gettingstarted.md",
"diff": "@@ -47,7 +47,7 @@ server. Below are code examples for making a connection:\n```\n// Create a connection and login to the example.org XMPP service.\n-AbstractXMPPConnection connection = new XMPPTCPConnection(\"username\", \"password\", \"example.org\");\n+AbstractXMPPConnection conn1 = new XMPPTCPConnection(\"username\", \"password\", \"example.org\");\nconn1.connect().login();\n```\n"
}
] | Java | Apache License 2.0 | igniterealtime/smack | Fix example for Establishing a Connection |
299,325 | 08.11.2018 13:36:45 | -3,600 | 1ea10831b6e0041825f4467ed48d31e499c3a9b9 | Enables the HTTP compression in JBOSH
Adds an extra parameter "compressionEnabled" to ConnectionConfiguration
that is used to set the setCompressionEnabled() of BOSHClientConfig | [
{
"change_type": "MODIFY",
"old_path": "smack-bosh/src/main/java/org/jivesoftware/smack/bosh/XMPPBOSHConnection.java",
"new_path": "smack-bosh/src/main/java/org/jivesoftware/smack/bosh/XMPPBOSHConnection.java",
"diff": "@@ -157,6 +157,8 @@ public class XMPPBOSHConnection extends AbstractXMPPConnection {\nif (config.isProxyEnabled()) {\ncfgBuilder.setProxy(config.getProxyAddress(), config.getProxyPort());\n}\n+ cfgBuilder.setCompressionEnabled(config.isCompressionEnabled());\n+\nclient = BOSHClient.create(cfgBuilder.build());\nclient.addBOSHClientConnListener(new BOSHConnectionListener());\n"
},
{
"change_type": "MODIFY",
"old_path": "smack-core/src/main/java/org/jivesoftware/smack/ConnectionConfiguration.java",
"new_path": "smack-core/src/main/java/org/jivesoftware/smack/ConnectionConfiguration.java",
"diff": "@@ -125,6 +125,8 @@ public abstract class ConnectionConfiguration {\nprivate final Set<String> enabledSaslMechanisms;\n+ private final boolean compressionEnabled;\n+\nprotected ConnectionConfiguration(Builder<?,?> builder) {\nauthzid = builder.authzid;\nusername = builder.username;\n@@ -162,6 +164,8 @@ public abstract class ConnectionConfiguration {\nallowNullOrEmptyUsername = builder.allowEmptyOrNullUsername;\nenabledSaslMechanisms = builder.enabledSaslMechanisms;\n+ compressionEnabled = builder.compressionEnabled;\n+\n// If the enabledSaslmechanisms are set, then they must not be empty\nassert (enabledSaslMechanisms != null ? !enabledSaslMechanisms.isEmpty() : true);\n@@ -440,8 +444,7 @@ public abstract class ConnectionConfiguration {\n* @return true if the connection is going to use stream compression.\n*/\npublic boolean isCompressionEnabled() {\n- // Compression for non-TCP connections is always disabled\n- return false;\n+ return compressionEnabled;\n}\n/**\n@@ -513,6 +516,7 @@ public abstract class ConnectionConfiguration {\nprivate boolean saslMechanismsSealed;\nprivate Set<String> enabledSaslMechanisms;\nprivate X509TrustManager customX509TrustManager;\n+ private boolean compressionEnabled = false;\nprotected Builder() {\nif (SmackConfiguration.DEBUG) {\n@@ -946,6 +950,21 @@ public abstract class ConnectionConfiguration {\nreturn getThis();\n}\n+ /**\n+ * Sets if the connection is going to use compression (default false).\n+ *\n+ * Compression is only activated if the server offers compression. With compression network\n+ * traffic can be reduced up to 90%. By default compression is disabled.\n+ *\n+ * @param compressionEnabled if the connection is going to use compression on the HTTP level.\n+ * @return a reference to this object.\n+ */\n+ public B setCompressionEnabled(boolean compressionEnabled) {\n+ this.compressionEnabled = compressionEnabled;\n+ return getThis();\n+ }\n+\n+\npublic abstract C build();\nprotected abstract B getThis();\n"
},
{
"change_type": "MODIFY",
"old_path": "smack-tcp/src/main/java/org/jivesoftware/smack/tcp/XMPPTCPConnectionConfiguration.java",
"new_path": "smack-tcp/src/main/java/org/jivesoftware/smack/tcp/XMPPTCPConnectionConfiguration.java",
"diff": "@@ -41,8 +41,6 @@ public final class XMPPTCPConnectionConfiguration extends ConnectionConfiguratio\n*/\npublic static int DEFAULT_CONNECT_TIMEOUT = 30000;\n- private final boolean compressionEnabled;\n-\n/**\n* How long the socket will wait until a TCP connection is established (in milliseconds).\n*/\n@@ -50,23 +48,9 @@ public final class XMPPTCPConnectionConfiguration extends ConnectionConfiguratio\nprivate XMPPTCPConnectionConfiguration(Builder builder) {\nsuper(builder);\n- compressionEnabled = builder.compressionEnabled;\nconnectTimeout = builder.connectTimeout;\n}\n- /**\n- * Returns true if the connection is going to use stream compression. Stream compression\n- * will be requested after TLS was established (if TLS was enabled) and only if the server\n- * offered stream compression. With stream compression network traffic can be reduced\n- * up to 90%. By default compression is disabled.\n- *\n- * @return true if the connection is going to use stream compression.\n- */\n- @Override\n- public boolean isCompressionEnabled() {\n- return compressionEnabled;\n- }\n-\n/**\n* How long the socket will wait until a TCP connection is established (in milliseconds). Defaults to {@link #DEFAULT_CONNECT_TIMEOUT}.\n*\n@@ -91,20 +75,6 @@ public final class XMPPTCPConnectionConfiguration extends ConnectionConfiguratio\nprivate Builder() {\n}\n- /**\n- * Sets if the connection is going to use stream compression. Stream compression\n- * will be requested after TLS was established (if TLS was enabled) and only if the server\n- * offered stream compression. With stream compression network traffic can be reduced\n- * up to 90%. By default compression is disabled.\n- *\n- * @param compressionEnabled if the connection is going to use stream compression.\n- * @return a reference to this object.\n- */\n- public Builder setCompressionEnabled(boolean compressionEnabled) {\n- this.compressionEnabled = compressionEnabled;\n- return this;\n- }\n-\n/**\n* Set how long the socket will wait until a TCP connection is established (in milliseconds).\n*\n"
}
] | Java | Apache License 2.0 | igniterealtime/smack | Enables the HTTP compression in JBOSH
Adds an extra parameter "compressionEnabled" to ConnectionConfiguration
that is used to set the setCompressionEnabled() of BOSHClientConfig |
299,327 | 14.11.2018 13:36:10 | -10,800 | 2900c5ae234345160e197835545c6cdfc3c4a215 | Move xml-not-well-formed (RFC 3920) condition handling to StreamError
Fixes | [
{
"change_type": "MODIFY",
"old_path": "smack-core/src/main/java/org/jivesoftware/smack/packet/StanzaError.java",
"new_path": "smack-core/src/main/java/org/jivesoftware/smack/packet/StanzaError.java",
"diff": "@@ -385,11 +385,6 @@ public class StanzaError extends AbstractError implements ExtensionElement {\n}\npublic static Condition fromString(String string) {\n- // Backwards compatibility for older implementations still using RFC 3920. RFC 6120\n- // changed 'xml-not-well-formed' to 'not-well-formed'.\n- if (\"xml-not-well-formed\".equals(string)) {\n- string = \"not-well-formed\";\n- }\nstring = string.replace('-', '_');\nCondition condition = null;\ntry {\n"
},
{
"change_type": "MODIFY",
"old_path": "smack-core/src/main/java/org/jivesoftware/smack/packet/StreamError.java",
"new_path": "smack-core/src/main/java/org/jivesoftware/smack/packet/StreamError.java",
"diff": "@@ -186,6 +186,11 @@ public class StreamError extends AbstractError implements Nonza {\n}\npublic static Condition fromString(String string) {\n+ // Backwards compatibility for older implementations still using RFC 3920. RFC 6120\n+ // changed 'xml-not-well-formed' to 'not-well-formed'.\n+ if (\"xml-not-well-formed\".equals(string)) {\n+ string = \"not-well-formed\";\n+ }\nstring = string.replace('-', '_');\nCondition condition = null;\ntry {\n"
},
{
"change_type": "MODIFY",
"old_path": "smack-core/src/test/java/org/jivesoftware/smack/packet/StreamErrorTest.java",
"new_path": "smack-core/src/test/java/org/jivesoftware/smack/packet/StreamErrorTest.java",
"diff": "@@ -104,4 +104,22 @@ public class StreamErrorTest {\nassertNotNull(appSpecificElement);\n}\n+ @Test\n+ public void testStreamErrorXmlNotWellFormed() {\n+ StreamError error = null;\n+ final String xml =\n+ // Usually the stream:stream element has more attributes (to, version, ...)\n+ // We omit those, since they are not relevant for testing\n+ \"<stream:stream from='im.example.com' id='++TR84Sm6A3hnt3Q065SnAbbk3Y=' xmlns:stream='http://etherx.jabber.org/streams'>\" +\n+ \"<stream:error><xml-not-well-formed xmlns='urn:ietf:params:xml:ns:xmpp-streams'/></stream:error>\" +\n+ \"</stream:stream>\";\n+ try {\n+ XmlPullParser parser = PacketParserUtils.getParserFor(xml, \"error\");\n+ error = PacketParserUtils.parseStreamError(parser);\n+ } catch (Exception e) {\n+ fail(e.getMessage());\n+ }\n+ assertNotNull(error);\n+ assertEquals(Condition.not_well_formed, error.getCondition());\n+ }\n}\n"
}
] | Java | Apache License 2.0 | igniterealtime/smack | Move xml-not-well-formed (RFC 3920) condition handling to StreamError
Fixes SMACK-842. |
299,326 | 27.11.2018 18:27:10 | -3,600 | 229653af3017e32141dcbe0a53abe6573b0c2df9 | ParserUtils: fix boolean parser
How could this even happen? | [
{
"change_type": "MODIFY",
"old_path": "smack-core/src/main/java/org/jivesoftware/smack/util/ParserUtils.java",
"new_path": "smack-core/src/main/java/org/jivesoftware/smack/util/ParserUtils.java",
"diff": "@@ -141,7 +141,7 @@ public class ParserUtils {\nif (valueString == null)\nreturn null;\nvalueString = valueString.toLowerCase(Locale.US);\n- return valueString.equals(\"true\") || valueString.equals(\"0\");\n+ return valueString.equals(\"true\") || valueString.equals(\"1\");\n}\npublic static boolean getBooleanAttribute(XmlPullParser parser, String name,\n"
}
] | Java | Apache License 2.0 | igniterealtime/smack | ParserUtils: fix boolean parser
How could this even happen?
Signed-off-by: Georg Lukas <[email protected]> |
299,326 | 27.11.2018 18:33:39 | -3,600 | 8b88f9cb20b86f302c91684d8cd73823599b703d | Bookmarks: use proper boolean parser for `autojoin`
Some clients (read: Gajim) store boolean values as `0` and `1` instead
of `false` and `true`, which is legal for the XML boolean type. | [
{
"change_type": "MODIFY",
"old_path": "smack-extensions/src/main/java/org/jivesoftware/smackx/bookmarks/Bookmarks.java",
"new_path": "smack-extensions/src/main/java/org/jivesoftware/smackx/bookmarks/Bookmarks.java",
"diff": "@@ -269,12 +269,12 @@ public class Bookmarks implements PrivateData {\nprivate static BookmarkedConference getConferenceStorage(XmlPullParser parser) throws XmlPullParserException, IOException {\nString name = parser.getAttributeValue(\"\", \"name\");\n- String autojoin = parser.getAttributeValue(\"\", \"autojoin\");\n+ boolean autojoin = ParserUtils.getBooleanAttribute(parser, \"autojoin\", false);\nEntityBareJid jid = ParserUtils.getBareJidAttribute(parser);\nBookmarkedConference conf = new BookmarkedConference(jid);\nconf.setName(name);\n- conf.setAutoJoin(Boolean.valueOf(autojoin));\n+ conf.setAutoJoin(autojoin);\n// Check for nickname\nboolean done = false;\n"
}
] | Java | Apache License 2.0 | igniterealtime/smack | Bookmarks: use proper boolean parser for `autojoin`
Some clients (read: Gajim) store boolean values as `0` and `1` instead
of `false` and `true`, which is legal for the XML boolean type.
Signed-off-by: Georg Lukas <[email protected]> |
299,326 | 27.11.2018 18:33:39 | -3,600 | b8bd10b0562810b8abc14a92c8aa8cb01abc9dc7 | RoomInfo: use proper boolean parser for `muc#roominfo_subjectmod`
XML allows both false/true and 0/1 syntax for booleans. | [
{
"change_type": "MODIFY",
"old_path": "smack-extensions/src/main/java/org/jivesoftware/smackx/muc/RoomInfo.java",
"new_path": "smack-extensions/src/main/java/org/jivesoftware/smackx/muc/RoomInfo.java",
"diff": "@@ -207,7 +207,8 @@ public class RoomInfo {\nFormField subjectmodField = form.getField(\"muc#roominfo_subjectmod\");\nif (subjectmodField != null && !subjectmodField.getValues().isEmpty()) {\n- subjectmod = Boolean.valueOf(subjectmodField.getFirstValue());\n+ String firstValue = subjectmodField.getFirstValue();\n+ subjectmod = (\"true\".equals(firstValue) || \"1\".equals(firstValue));\n}\nFormField urlField = form.getField(\"muc#roominfo_logs\");\n"
}
] | Java | Apache License 2.0 | igniterealtime/smack | RoomInfo: use proper boolean parser for `muc#roominfo_subjectmod`
XML allows both false/true and 0/1 syntax for booleans.
Signed-off-by: Georg Lukas <[email protected]> |
299,328 | 15.11.2018 15:18:17 | -7,200 | 0332fa54d10ff357e40ebd979364ca4da6181fb8 | Fix previous archive page requested incorrectly in MamManager
Previous page should be before the first message in the previous
result set, not the last.
Fixes | [
{
"change_type": "MODIFY",
"old_path": "smack-experimental/src/main/java/org/jivesoftware/smackx/mam/MamManager.java",
"new_path": "smack-experimental/src/main/java/org/jivesoftware/smackx/mam/MamManager.java",
"diff": "@@ -995,7 +995,7 @@ public final class MamManager extends Manager {\npublic List<Message> pagePrevious(int count) throws NoResponseException, XMPPErrorException,\nNotConnectedException, NotLoggedInException, InterruptedException {\nRSMSet previousResultRsmSet = getPreviousRsmSet();\n- RSMSet requestRsmSet = new RSMSet(count, previousResultRsmSet.getLast(), RSMSet.PageDirection.before);\n+ RSMSet requestRsmSet = new RSMSet(count, previousResultRsmSet.getFirst(), RSMSet.PageDirection.before);\nreturn page(requestRsmSet);\n}\n"
}
] | Java | Apache License 2.0 | igniterealtime/smack | Fix previous archive page requested incorrectly in MamManager
Previous page should be before the first message in the previous
result set, not the last.
Fixes SMACK-843. |
299,324 | 19.03.2019 08:59:42 | 0 | b1cd5066f64c7c3e68320abf217939c8c7b422d1 | Minor fix to integrationtest.md formatting
The preceding paragraph was being treated as part of the header. | [
{
"change_type": "MODIFY",
"old_path": "documentation/developer/integrationtest.md",
"new_path": "documentation/developer/integrationtest.md",
"diff": "@@ -80,6 +80,7 @@ debugger=console\n### Where to place the properties file\nThe framework will first load the properties file from `~/.config/smack-integration-test/properties`\n+\nOverview of the components\n--------------------------\n"
}
] | Java | Apache License 2.0 | igniterealtime/smack | Minor fix to integrationtest.md formatting
The preceding paragraph was being treated as part of the header. |
299,282 | 27.06.2018 11:18:50 | -7,200 | c83d717a26544eb9c355a0ca932a3cca2867c88f | Allow adding custom HTTP headers to bosh communications | [
{
"change_type": "MODIFY",
"old_path": "smack-bosh/build.gradle",
"new_path": "smack-bosh/build.gradle",
"diff": "@@ -4,5 +4,5 @@ This API is considered beta quality.\"\"\"\ndependencies {\ncompile project(':smack-core')\n- compile 'org.igniterealtime.jbosh:jbosh:[0.9,0.10)'\n+ compile 'org.igniterealtime.jbosh:jbosh:[0.9.1,0.10)'\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "smack-bosh/src/main/java/org/jivesoftware/smack/bosh/BOSHConfiguration.java",
"new_path": "smack-bosh/src/main/java/org/jivesoftware/smack/bosh/BOSHConfiguration.java",
"diff": "@@ -19,6 +19,8 @@ package org.jivesoftware.smack.bosh;\nimport java.net.URI;\nimport java.net.URISyntaxException;\n+import java.util.HashMap;\n+import java.util.Map;\nimport org.jivesoftware.smack.ConnectionConfiguration;\nimport org.jivesoftware.smack.proxy.ProxyInfo;\n@@ -34,6 +36,7 @@ public final class BOSHConfiguration extends ConnectionConfiguration {\nprivate final boolean https;\nprivate final String file;\n+ private Map<String, String> httpHeaders;\nprivate BOSHConfiguration(Builder builder) {\nsuper(builder);\n@@ -49,6 +52,7 @@ public final class BOSHConfiguration extends ConnectionConfiguration {\n} else {\nfile = builder.file;\n}\n+ httpHeaders = builder.httpHeaders;\n}\npublic boolean isProxyEnabled() {\n@@ -76,6 +80,10 @@ public final class BOSHConfiguration extends ConnectionConfiguration {\nreturn new URI((https ? \"https://\" : \"http://\") + this.host + \":\" + this.port + file);\n}\n+ public Map<String, String> getHttpHeaders() {\n+ return httpHeaders;\n+ }\n+\npublic static Builder builder() {\nreturn new Builder();\n}\n@@ -83,6 +91,7 @@ public final class BOSHConfiguration extends ConnectionConfiguration {\npublic static final class Builder extends ConnectionConfiguration.Builder<Builder, BOSHConfiguration> {\nprivate boolean https;\nprivate String file;\n+ private Map<String, String> httpHeaders = new HashMap<>();\nprivate Builder() {\n}\n@@ -101,6 +110,11 @@ public final class BOSHConfiguration extends ConnectionConfiguration {\nreturn this;\n}\n+ public Builder addHttpHeader(String name, String value) {\n+ httpHeaders.put(name, value);\n+ return this;\n+ }\n+\n@Override\npublic BOSHConfiguration build() {\nreturn new BOSHConfiguration(this);\n"
},
{
"change_type": "MODIFY",
"old_path": "smack-bosh/src/main/java/org/jivesoftware/smack/bosh/XMPPBOSHConnection.java",
"new_path": "smack-bosh/src/main/java/org/jivesoftware/smack/bosh/XMPPBOSHConnection.java",
"diff": "@@ -22,6 +22,7 @@ import java.io.PipedReader;\nimport java.io.PipedWriter;\nimport java.io.StringReader;\nimport java.io.Writer;\n+import java.util.Map;\nimport java.util.logging.Level;\nimport java.util.logging.Logger;\n@@ -156,6 +157,9 @@ public class XMPPBOSHConnection extends AbstractXMPPConnection {\nif (config.isProxyEnabled()) {\ncfgBuilder.setProxy(config.getProxyAddress(), config.getProxyPort());\n}\n+ for (Map.Entry<String, String> h : config.getHttpHeaders().entrySet()) {\n+ cfgBuilder.addHttpHeader(h.getKey(), h.getValue());\n+ }\nclient = BOSHClient.create(cfgBuilder.build());\nclient.addBOSHClientConnListener(new BOSHConnectionListener());\n"
}
] | Java | Apache License 2.0 | igniterealtime/smack | Allow adding custom HTTP headers to bosh communications |
299,316 | 18.03.2019 10:34:49 | -3,600 | 3450ffad2b8ea4ae1015c81146f6efe23515852a | Do not use "CONNECT" in the Host header field. | [
{
"change_type": "MODIFY",
"old_path": "smack-core/src/main/java/org/jivesoftware/smack/proxy/HTTPProxySocketConnection.java",
"new_path": "smack-core/src/main/java/org/jivesoftware/smack/proxy/HTTPProxySocketConnection.java",
"diff": "@@ -58,7 +58,7 @@ class HTTPProxySocketConnection implements ProxySocketConnection {\nproxyLine = \"\\r\\nProxy-Authorization: Basic \" + Base64.encode(username + \":\" + password);\n}\nsocket.getOutputStream().write((hostport + \" HTTP/1.1\\r\\nHost: \"\n- + hostport + proxyLine + \"\\r\\n\\r\\n\").getBytes(\"UTF-8\"));\n+ + host + \":\" + port + proxyLine + \"\\r\\n\\r\\n\").getBytes(\"UTF-8\"));\nInputStream in = socket.getInputStream();\nStringBuilder got = new StringBuilder(100);\n"
}
] | Java | Apache License 2.0 | igniterealtime/smack | Do not use "CONNECT" in the Host header field. |
299,326 | 12.03.2019 11:33:38 | -3,600 | 8e88cd2e31a744bf9c5d8e599d38796b927c0413 | Proxy mode: add failed address on error | [
{
"change_type": "MODIFY",
"old_path": "smack-tcp/src/main/java/org/jivesoftware/smack/tcp/XMPPTCPConnection.java",
"new_path": "smack-tcp/src/main/java/org/jivesoftware/smack/tcp/XMPPTCPConnection.java",
"diff": "@@ -647,6 +647,7 @@ public class XMPPTCPConnection extends AbstractXMPPConnection {\nproxyInfo.getProxySocketConnection().connect(socket, host, port, timeout);\n} catch (IOException e) {\nhostAddress.setException(e);\n+ failedAddresses.add(hostAddress);\ncontinue;\n}\nLOGGER.finer(\"Established TCP connection to \" + hostAndPort);\n"
}
] | Java | Apache License 2.0 | igniterealtime/smack | Proxy mode: add failed address on error |
299,316 | 18.03.2019 10:28:50 | -3,600 | 007a04c4fe599bbea04fdd4bc6cf03e45ae8db36 | Better error messages when using a Proxy to connect to the XMPP server. | [
{
"change_type": "MODIFY",
"old_path": "smack-core/src/main/java/org/jivesoftware/smack/proxy/HTTPProxySocketConnection.java",
"new_path": "smack-core/src/main/java/org/jivesoftware/smack/proxy/HTTPProxySocketConnection.java",
"diff": "@@ -115,7 +115,8 @@ class HTTPProxySocketConnection implements ProxySocketConnection {\nint code = Integer.parseInt(m.group(1));\nif (code != HttpURLConnection.HTTP_OK) {\n- throw new ProxyException(ProxyInfo.ProxyType.HTTP);\n+ throw new ProxyException(ProxyInfo.ProxyType.HTTP,\n+ \"Error code in proxy response: \" + code);\n}\n}\n"
}
] | Java | Apache License 2.0 | igniterealtime/smack | Better error messages when using a Proxy to connect to the XMPP server. |
299,293 | 27.03.2019 00:12:58 | -3,600 | 7f542e403ff66c8c257fa2a8a2a455ab96da8b23 | Adjust in documentation StanzaTypeFilter to uppercase as in code | [
{
"change_type": "MODIFY",
"old_path": "documentation/processing.md",
"new_path": "documentation/processing.md",
"diff": "@@ -20,7 +20,7 @@ and a stanza listener:\n```\n// Create a stanza filter to listen for new messages from a particular\n// user. We use an AndFilter to combine two other filters._\n-StanzaFilter filter = new AndFilter(StanzaTypeFilter.Message, FromMatchesFilter.create(\"[email protected]\"));\n+StanzaFilter filter = new AndFilter(StanzaTypeFilter.MESSAGE, FromMatchesFilter.create(\"[email protected]\"));\n// Assume we've created an XMPPConnection named \"connection\".\n// First, register a stanza collector using the filter we created.\n"
}
] | Java | Apache License 2.0 | igniterealtime/smack | Adjust in documentation StanzaTypeFilter to uppercase as in code |
299,318 | 19.01.2019 13:36:38 | 28,800 | f1fb03d08cbe2aaf99e4fbc18930d0c2e6c353e7 | Add a success callback for auto-join on reconnect.
When auto-join on reconnection is success, invoke a callback.
Conform to the proper copyright format. | [
{
"change_type": "ADD",
"old_path": null,
"new_path": "smack-extensions/src/main/java/org/jivesoftware/smackx/muc/AutoJoinSuccessCallback.java",
"diff": "+/**\n+ *\n+ * Copyright 2019 Vincent Lau\n+ *\n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * You may obtain a copy of the License at\n+ *\n+ * http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+package org.jivesoftware.smackx.muc;\n+\n+import org.jxmpp.jid.parts.Resourcepart;\n+\n+public interface AutoJoinSuccessCallback {\n+\n+ /**\n+ * Invoked after the automatic rejoin rooms on reconnect success.\n+ *\n+ * @param muc the joined MultiUserChat.\n+ * @param nickname nickname used by participant to join the room.\n+ */\n+ void autoJoinSuccess(MultiUserChat muc, Resourcepart nickname);\n+\n+}\n"
},
{
"change_type": "MODIFY",
"old_path": "smack-extensions/src/main/java/org/jivesoftware/smackx/muc/MultiUserChatManager.java",
"new_path": "smack-extensions/src/main/java/org/jivesoftware/smackx/muc/MultiUserChatManager.java",
"diff": "@@ -152,6 +152,8 @@ public final class MultiUserChatManager extends Manager {\nprivate AutoJoinFailedCallback autoJoinFailedCallback;\n+ private AutoJoinSuccessCallback autoJoinSuccessCallback;\n+\nprivate final ServiceDiscoveryManager serviceDiscoveryManager;\nprivate MultiUserChatManager(XMPPConnection connection) {\n@@ -200,6 +202,7 @@ public final class MultiUserChatManager extends Manager {\n@Override\npublic void run() {\nfinal AutoJoinFailedCallback failedCallback = autoJoinFailedCallback;\n+ final AutoJoinSuccessCallback successCallback = autoJoinSuccessCallback;\nfor (EntityBareJid mucJid : mucs) {\nMultiUserChat muc = getMultiUserChat(mucJid);\n@@ -221,6 +224,9 @@ public final class MultiUserChatManager extends Manager {\n}\ntry {\nmuc.join(nickname);\n+ if (successCallback != null) {\n+ successCallback.autoJoinSuccess(muc, nickname);\n+ }\n} catch (NotAMucServiceException | NoResponseException | XMPPErrorException\n| NotConnectedException | InterruptedException e) {\nif (failedCallback != null) {\n@@ -481,6 +487,21 @@ public final class MultiUserChatManager extends Manager {\n}\n}\n+ /**\n+ * Set a callback invoked by this manager when automatic join on reconnect success.\n+ * If successCallback is not <code>null</code>, automatic rejoin will also\n+ * be enabled.\n+ *\n+ * @param successCallback the callback\n+ */\n+ public void setAutoJoinSuccessCallback(AutoJoinSuccessCallback successCallback) {\n+ autoJoinSuccessCallback = successCallback;\n+ if (successCallback != null) {\n+ setAutoJoinOnReconnect(true);\n+ }\n+ }\n+\n+\nvoid addJoinedRoom(EntityBareJid room) {\njoinedRooms.add(room);\n}\n"
}
] | Java | Apache License 2.0 | igniterealtime/smack | Add a success callback for auto-join on reconnect.
When auto-join on reconnection is success, invoke a callback.
Conform to the proper copyright format. |
299,286 | 06.05.2019 00:38:22 | -7,200 | dd903bec95b3ab24b12ab8013a64cdbddfe4a312 | Fix XHTMLText producing invalid XML | [
{
"change_type": "MODIFY",
"old_path": "smack-extensions/src/main/java/org/jivesoftware/smackx/xhtmlim/XHTMLText.java",
"new_path": "smack-extensions/src/main/java/org/jivesoftware/smackx/xhtmlim/XHTMLText.java",
"diff": "@@ -105,7 +105,7 @@ public class XHTMLText {\nprivate XHTMLText appendOpenBodyTag(String style, String lang) {\ntext.halfOpenElement(Message.BODY);\ntext.xmlnsAttribute(NAMESPACE);\n- text.optElement(STYLE, style);\n+ text.optAttribute(STYLE, style);\ntext.xmllangAttribute(lang);\ntext.rightAngleBracket();\nreturn this;\n"
}
] | Java | Apache License 2.0 | igniterealtime/smack | SMACK-868: Fix XHTMLText producing invalid XML |
299,329 | 22.04.2019 14:18:44 | -3,600 | 07c069e1a15e7c2fee6c0f8d0bfa1353905d29a6 | Use the default integration test packages if the supplied list is empty | [
{
"change_type": "MODIFY",
"old_path": "smack-integration-test/src/main/java/org/igniterealtime/smack/inttest/SmackIntegrationTestFramework.java",
"new_path": "smack-integration-test/src/main/java/org/igniterealtime/smack/inttest/SmackIntegrationTestFramework.java",
"diff": "@@ -174,7 +174,7 @@ public class SmackIntegrationTestFramework<DC extends AbstractXMPPConnection> {\n// TODO print effective configuration\nString[] testPackages;\n- if (config.testPackages == null) {\n+ if (config.testPackages == null || config.testPackages.isEmpty()) {\ntestPackages = new String[] { \"org.jivesoftware.smackx\", \"org.jivesoftware.smack\" };\n}\nelse {\n"
}
] | Java | Apache License 2.0 | igniterealtime/smack | Use the default integration test packages if the supplied list is empty |
299,326 | 30.07.2019 15:33:38 | -7,200 | 093b576e0d97d13b6aa71ac5d8ca1e80d996ee39 | Errors: language selection for error description | [
{
"change_type": "MODIFY",
"old_path": "smack-core/src/main/java/org/jivesoftware/smack/packet/AbstractError.java",
"new_path": "smack-core/src/main/java/org/jivesoftware/smack/packet/AbstractError.java",
"diff": "@@ -66,16 +66,24 @@ public class AbstractError {\n* @return the descriptive text or null.\n*/\npublic String getDescriptiveText() {\n- String defaultLocale = Locale.getDefault().getLanguage();\n- String descriptiveText = getDescriptiveText(defaultLocale);\n- if (descriptiveText == null) {\n- descriptiveText = getDescriptiveText(\"en\");\n- if (descriptiveText == null) {\n- descriptiveText = getDescriptiveText(\"\");\n- }\n- }\n+ if (descriptiveTexts.isEmpty())\n+ return null;\n+ // attempt to obtain the text in the user's locale, the English text, or the \"\" default\n+ Locale l = Locale.getDefault();\n+ String[] tags = new String[] {\n+ l.getLanguage() + \"-\" + l.getCountry() + \"-\" + l.getVariant(),\n+ l.getLanguage() + \"-\" + l.getCountry(),\n+ l.getLanguage(),\n+ \"en\",\n+ \"\"\n+ };\n+ for (String tag : tags) {\n+ String descriptiveText = getDescriptiveText(tag);\n+ if (descriptiveText != null)\nreturn descriptiveText;\n}\n+ return descriptiveTexts.values().iterator().next();\n+ }\n/**\n* Get the descriptive test of this SASLFailure.\n"
}
] | Java | Apache License 2.0 | igniterealtime/smack | Errors: language selection for error description |
299,290 | 28.08.2019 17:53:04 | -7,200 | 563dad08e8e19e22f0aeeb09660ff0db3f433126 | Remove trailing semicolon in the header used in HttpFileUploadManager | [
{
"change_type": "MODIFY",
"old_path": "smack-experimental/src/main/java/org/jivesoftware/smackx/httpfileupload/HttpFileUploadManager.java",
"new_path": "smack-experimental/src/main/java/org/jivesoftware/smackx/httpfileupload/HttpFileUploadManager.java",
"diff": "@@ -399,7 +399,7 @@ public final class HttpFileUploadManager extends Manager {\nurlConnection.setUseCaches(false);\nurlConnection.setDoOutput(true);\nurlConnection.setFixedLengthStreamingMode(fileSize);\n- urlConnection.setRequestProperty(\"Content-Type\", \"application/octet-stream;\");\n+ urlConnection.setRequestProperty(\"Content-Type\", \"application/octet-stream\");\nfor (Entry<String, String> header : slot.getHeaders().entrySet()) {\nurlConnection.setRequestProperty(header.getKey(), header.getValue());\n}\n"
}
] | Java | Apache License 2.0 | igniterealtime/smack | Remove trailing semicolon in the header used in HttpFileUploadManager |
299,292 | 16.03.2020 21:51:05 | 18,000 | cec312fe64c6167d31a4aa77120cc08da5f1c260 | Help With Documentation
Add missed word for clearer instruction -Jesus Fuentes | [
{
"change_type": "MODIFY",
"old_path": "README.md",
"new_path": "README.md",
"diff": "@@ -18,7 +18,7 @@ Getting started\nStart with having a look at the **[Documentation]** and the **[Javadoc]**.\n-Instructions how to use Smack in your Java or Android project are provided in the [Smack Readme and Upgrade Guide](https://igniterealtime.org/projects/smack/readme).\n+Instructions on how to use Smack in your Java or Android project are provided in the [Smack Readme and Upgrade Guide](https://igniterealtime.org/projects/smack/readme).\nProfessional Services\n---------------------\n"
}
] | Java | Apache License 2.0 | igniterealtime/smack | Help With Documentation
Add missed word for clearer instruction -Jesus Fuentes |
299,331 | 11.04.2020 12:17:42 | 18,000 | c07f41c1194a66879ed26cae56721117e85458da | debug: show active tab on Smack debugger startup
Enhanced Debugger Window showed Smack Info tab, now shows active
connection. Fixes | [
{
"change_type": "MODIFY",
"old_path": "smack-debug/src/main/java/org/jivesoftware/smackx/debugger/EnhancedDebuggerWindow.java",
"new_path": "smack-debug/src/main/java/org/jivesoftware/smackx/debugger/EnhancedDebuggerWindow.java",
"diff": "@@ -143,6 +143,7 @@ public final class EnhancedDebuggerWindow {\ndebugger.tabbedPane.setName(\"XMPPConnection_\" + tabbedPane.getComponentCount());\ntabbedPane.add(debugger.tabbedPane, tabbedPane.getComponentCount() - 1);\ntabbedPane.setIconAt(tabbedPane.indexOfComponent(debugger.tabbedPane), connectionCreatedIcon);\n+ tabbedPane.setSelectedIndex(tabbedPane.indexOfComponent(debugger.tabbedPane));\nframe.setTitle(\n\"Smack Debug Window -- Total connections: \" + (tabbedPane.getComponentCount() - 1));\n// Keep the added debugger for later access\n"
}
] | Java | Apache License 2.0 | igniterealtime/smack | debug: show active tab on Smack debugger startup
Enhanced Debugger Window showed Smack Info tab, now shows active
connection. Fixes SMACK-367. |
299,284 | 14.05.2020 16:36:07 | -19,080 | 17ca4c541be15866a485b7abe9b1fd639cff7ce2 | Add support for Software Information
By making use of an extended data format, service discovery responses
can be used to constitute software information.
Solves | [
{
"change_type": "MODIFY",
"old_path": "documentation/extensions/index.md",
"new_path": "documentation/extensions/index.md",
"diff": "@@ -82,6 +82,7 @@ Smack Extensions and currently supported XEPs of smack-extensions\n| Data Forms Media Element | [XEP-0221](https://xmpp.org/extensions/xep-0221.html) | n/a | Allows to include media data in XEP-0004 data forms. |\n| Attention | [XEP-0224](https://xmpp.org/extensions/xep-0224.html) | n/a | Getting attention of another user. |\n| Bits of Binary | [XEP-0231](https://xmpp.org/extensions/xep-0231.html) | n/a | Including or referring to small bits of binary data in an XML stanza. |\n+| Software Information | [XEP-0232](https://xmpp.org/extensions/xep-0232.html) | 0.3 | Allows an entity to provide detailed data about itself in Service Discovery responses. |\n| Best Practices for Resource Locking | [XEP-0296](https://xmpp.org/extensions/xep-0296.html) | n/a | Specifies best practices to be followed by Jabber/XMPP clients about when to lock into, and unlock away from, resources. |\n| Stanza Forwarding | [XEP-0297](https://xmpp.org/extensions/xep-0297.html) | n/a | Allows forwarding of Stanzas. |\n| Last Message Correction | [XEP-0308](https://xmpp.org/extensions/xep-0308.html) | n/a | Provides a method for indicating that a message is a correction of the last sent message. |\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "smack-extensions/src/main/java/org/jivesoftware/smackx/softwareinfo/SoftwareInfoManager.java",
"diff": "+/**\n+ *\n+ * Copyright 2020 Aditya Borikar\n+ *\n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * You may obtain a copy of the License at\n+ *\n+ * http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+package org.jivesoftware.smackx.softwareinfo;\n+\n+import java.io.IOException;\n+import java.util.Map;\n+import java.util.WeakHashMap;\n+\n+import org.jivesoftware.smack.Manager;\n+import org.jivesoftware.smack.SmackException.FeatureNotSupportedException;\n+import org.jivesoftware.smack.SmackException.NoResponseException;\n+import org.jivesoftware.smack.SmackException.NotConnectedException;\n+import org.jivesoftware.smack.XMPPConnection;\n+import org.jivesoftware.smack.XMPPException.XMPPErrorException;\n+import org.jivesoftware.smack.parsing.SmackParsingException;\n+import org.jivesoftware.smack.xml.XmlPullParserException;\n+import org.jivesoftware.smackx.disco.ServiceDiscoveryManager;\n+import org.jivesoftware.smackx.disco.packet.DiscoverInfo;\n+import org.jivesoftware.smackx.softwareinfo.form.SoftwareInfoForm;\n+import org.jivesoftware.smackx.xdata.packet.DataForm;\n+\n+import org.jxmpp.jid.Jid;\n+\n+/**\n+* Entry point for Smack's API for XEP-0232: Software Information.\n+* <br>\n+* @see <a href=\"https://xmpp.org/extensions/xep-0232.html\">\n+* XEP-0232 : Software Information.\n+* </a>\n+*/\n+public final class SoftwareInfoManager extends Manager {\n+\n+ private static final String FEATURE = \"http://jabber.org/protocol/disco\";\n+ private static final Map<XMPPConnection, SoftwareInfoManager> INSTANCES = new WeakHashMap<>();\n+ private final ServiceDiscoveryManager serviceDiscoveryManager;\n+\n+ public static synchronized SoftwareInfoManager getInstanceFor (XMPPConnection connection) throws IOException, XmlPullParserException, SmackParsingException {\n+ SoftwareInfoManager manager = INSTANCES.get(connection);\n+ if (manager == null) {\n+ manager = new SoftwareInfoManager(connection);\n+ INSTANCES.put(connection, manager);\n+ }\n+ return manager;\n+ }\n+\n+ private SoftwareInfoManager(XMPPConnection connection) throws IOException, XmlPullParserException, SmackParsingException {\n+ super(connection);\n+ serviceDiscoveryManager = ServiceDiscoveryManager.getInstanceFor(connection);\n+ }\n+\n+ /**\n+ * Returns true if the feature is supported by the Jid.\n+ * <br>\n+ * @param jid Jid to be checked for support\n+ * @return boolean\n+ * @throws NoResponseException if there was no response from the remote entity\n+ * @throws XMPPErrorException if there was an XMPP error returned\n+ * @throws NotConnectedException if the XMPP connection is not connected\n+ * @throws InterruptedException if the calling thread was interrupted\n+ */\n+ public boolean isSupported(Jid jid) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {\n+ return serviceDiscoveryManager.supportsFeatures(jid, FEATURE);\n+ }\n+\n+ /**\n+ * Publishes the provided {@link SoftwareInfoForm} as an extended info.\n+ * <br>\n+ * @param softwareInfoForm form to be added as an extended info\n+ */\n+ public void publishSoftwareInformationForm(SoftwareInfoForm softwareInfoForm) {\n+ serviceDiscoveryManager.addExtendedInfo(softwareInfoForm.getDataForm());\n+ }\n+\n+ /**\n+ * Get SoftwareInfoForm from Jid provided.\n+ * <br>\n+ * @param jid jid to get software information from\n+ * @return {@link SoftwareInfoForm} Form containing software information\n+ * @throws NoResponseException if there was no response from the remote entity\n+ * @throws XMPPErrorException if there was an XMPP error returned\n+ * @throws NotConnectedException if the XMPP connection is not connected\n+ * @throws InterruptedException if the calling thread was interrupted\n+ * @throws FeatureNotSupportedException if the feature is not supported\n+ */\n+ public SoftwareInfoForm fromJid(Jid jid) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException, FeatureNotSupportedException {\n+ if (!isSupported(jid)) {\n+ throw new FeatureNotSupportedException(SoftwareInfoForm.FORM_TYPE, jid);\n+ }\n+ DiscoverInfo discoverInfo = serviceDiscoveryManager.discoverInfo(jid);\n+ DataForm dataForm = DataForm.from(discoverInfo, SoftwareInfoForm.FORM_TYPE);\n+ if (dataForm == null) {\n+ return null;\n+ }\n+ return SoftwareInfoForm.getBuilder()\n+ .setDataForm(dataForm)\n+ .build();\n+ }\n+}\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "smack-extensions/src/main/java/org/jivesoftware/smackx/softwareinfo/form/SoftwareInfoForm.java",
"diff": "+/**\n+ *\n+ * Copyright 2020 Aditya Borikar\n+ *\n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * You may obtain a copy of the License at\n+ *\n+ * http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+package org.jivesoftware.smackx.softwareinfo.form;\n+\n+import java.util.List;\n+\n+import org.jivesoftware.smack.util.EqualsUtil;\n+import org.jivesoftware.smack.util.HashCode;\n+import org.jivesoftware.smackx.mediaelement.element.MediaElement;\n+import org.jivesoftware.smackx.xdata.FormField;\n+import org.jivesoftware.smackx.xdata.FormFieldChildElement;\n+import org.jivesoftware.smackx.xdata.TextSingleFormField;\n+import org.jivesoftware.smackx.xdata.form.FilledForm;\n+import org.jivesoftware.smackx.xdata.form.Form;\n+import org.jivesoftware.smackx.xdata.packet.DataForm;\n+import org.jivesoftware.smackx.xdata.packet.DataForm.Type;\n+\n+/**\n+ * {@link Form} that contains the software information.\n+ * <br>\n+ * Instance of {@link SoftwareInfoForm} can be created using {@link Builder#build()} method.\n+ * <br>\n+ * To obtain an instance of {@link Builder}, use {@link SoftwareInfoForm#getBuilder()} method.\n+ * <br>\n+ * An example to illustrate is provided inside SoftwareInfoFormTest inside the test package.\n+ */\n+public final class SoftwareInfoForm extends FilledForm {\n+\n+ public static final String FORM_TYPE = \"urn:xmpp:dataforms:softwareinfo\";\n+ public static final String OS = \"os\";\n+ public static final String OS_VERSION = \"os_version\";\n+ public static final String SOFTWARE = \"software\";\n+ public static final String SOFTWARE_VERSION = \"software_version\";\n+ public static final String ICON = \"icon\";\n+\n+ private SoftwareInfoForm(DataForm dataForm) {\n+ super(dataForm);\n+ }\n+\n+ /**\n+ * Returns name of the OS used by client.\n+ * <br>\n+ * @return os\n+ */\n+ public String getOS() {\n+ return readFirstValue(OS);\n+ }\n+\n+ /**\n+ * Returns version of the OS used by client.\n+ * <br>\n+ * @return os_version\n+ */\n+ public String getOSVersion() {\n+ return readFirstValue(OS_VERSION);\n+ }\n+\n+ /**\n+ * Returns name of the software used by client.\n+ * <br>\n+ * @return software\n+ */\n+ public String getSoftwareName() {\n+ return readFirstValue(SOFTWARE);\n+ }\n+\n+ /**\n+ * Returns version of the software used by client.\n+ * <br>\n+ * @return software_version\n+ */\n+ public String getSoftwareVersion () {\n+ return readFirstValue(SOFTWARE_VERSION);\n+ }\n+\n+ /**\n+ * Returns the software icon if used by client.\n+ * <br>\n+ * @return {@link MediaElement} MediaElement or null\n+ */\n+ public MediaElement getIcon () {\n+ FormField field = getField(ICON);\n+ if (field == null) {\n+ return null;\n+ }\n+ FormFieldChildElement media = field.getFormFieldChildElement(MediaElement.QNAME);\n+ if (media == null) {\n+ return null;\n+ }\n+ return (MediaElement) media;\n+ }\n+\n+ @Override\n+ public boolean equals(Object obj) {\n+ return EqualsUtil.equals(this, obj, (equalsBuilder, otherObj) -> {\n+ equalsBuilder.append(getDataForm().getType(), otherObj.getDataForm().getType())\n+ .append(getDataForm().getTitle(), otherObj.getDataForm().getTitle())\n+ .append(getDataForm().getReportedData(), otherObj.getDataForm().getReportedData())\n+ .append(getDataForm().getItems(), otherObj.getDataForm().getItems())\n+ .append(getDataForm().getFields(), otherObj.getDataForm().getFields())\n+ .append(getDataForm().getExtensionElements(), otherObj.getDataForm().getExtensionElements());\n+ });\n+ }\n+\n+ @Override\n+ public int hashCode() {\n+ HashCode.Builder builder = HashCode.builder();\n+ builder.append(getDataForm().getFields());\n+ builder.append(getDataForm().getItems());\n+ builder.append(getDataForm().getExtensionElements());\n+ return builder.build();\n+ }\n+\n+ /**\n+ * Returns a new instance of {@link Builder}.\n+ * <br>\n+ * @return Builder\n+ */\n+ public static Builder getBuilder() {\n+ return new Builder();\n+ }\n+\n+ /**\n+ * Builder class for {@link SoftwareInfoForm}.\n+ * <br>\n+ * To obtain an instance of {@link Builder}, use {@link SoftwareInfoForm#getBuilder()} method.\n+ * <br>\n+ * Use appropriate setters to include information inside SoftwareInfoForms.\n+ */\n+ public static final class Builder {\n+ DataForm.Builder dataFormBuilder;\n+\n+ private Builder() {\n+ dataFormBuilder = DataForm.builder(Type.result);\n+ TextSingleFormField formField = FormField.buildHiddenFormType(FORM_TYPE);\n+ dataFormBuilder.addField(formField);\n+ }\n+\n+ /**\n+ * This will allow to include Icon using height, width and Uri's as a\n+ * {@link FormField}.\n+ * <br>\n+ * @param height Height of the image\n+ * @param width Width of the image\n+ * @param uriList List of URIs\n+ * @return Builder\n+ */\n+ public Builder setIcon(int height, int width, List<MediaElement.Uri> uriList) {\n+ MediaElement.Builder mediaBuilder = MediaElement.builder();\n+ for (MediaElement.Uri uri : uriList) {\n+ mediaBuilder.addUri(uri);\n+ }\n+ MediaElement mediaElement = mediaBuilder.setHeightAndWidth(height, width).build();\n+ return setIcon(mediaElement);\n+ }\n+\n+ /**\n+ * This will allow to include {@link MediaElement} directly as a\n+ * {@link FormField}.\n+ * <br>\n+ * @param mediaElement MediaElement to be included\n+ * @return Builder\n+ */\n+ public Builder setIcon(MediaElement mediaElement) {\n+ FormField.Builder<?, ?> builder = FormField.builder(ICON);\n+ builder.addFormFieldChildElement(mediaElement);\n+ dataFormBuilder.addField(builder.build());\n+ return this;\n+ }\n+\n+ /**\n+ * Include Operating System's name as a {@link FormField}.\n+ * <br>\n+ * @param os Name of the OS\n+ * @return Builder\n+ */\n+ public Builder setOS(String os) {\n+ TextSingleFormField.Builder builder = FormField.builder(OS);\n+ builder.setValue(os);\n+ dataFormBuilder.addField(builder.build());\n+ return this;\n+ }\n+\n+ /**\n+ * Include Operating System's version as a {@link FormField}.\n+ * <br>\n+ * @param os_version Version of OS\n+ * @return Builder\n+ */\n+ public Builder setOSVersion(String os_version) {\n+ TextSingleFormField.Builder builder = FormField.builder(OS_VERSION);\n+ builder.setValue(os_version);\n+ dataFormBuilder.addField(builder.build());\n+ return this;\n+ }\n+\n+ /**\n+ * Include Software name as a {@link FormField}.\n+ * <br>\n+ * @param software Name of the software\n+ * @return Builder\n+ */\n+ public Builder setSoftware(String software) {\n+ TextSingleFormField.Builder builder = FormField.builder(SOFTWARE);\n+ builder.setValue(software);\n+ dataFormBuilder.addField(builder.build());\n+ return this;\n+ }\n+\n+ /**\n+ * Include Software Version as a {@link FormField}.\n+ * <br>\n+ * @param softwareVersion Version of the Software in use\n+ * @return Builder\n+ */\n+ public Builder setSoftwareVersion(String softwareVersion) {\n+ TextSingleFormField.Builder builder = FormField.builder(SOFTWARE_VERSION);\n+ builder.setValue(softwareVersion);\n+ dataFormBuilder.addField(builder.build());\n+ return this;\n+ }\n+\n+ /**\n+ * Include {@link DataForm} to be encapsulated under SoftwareInfoForm.\n+ * <br>\n+ * @param dataForm The dataform containing Software Information\n+ * @return Builder\n+ */\n+ public Builder setDataForm(DataForm dataForm) {\n+ if (dataForm.getTitle() != null || !dataForm.getItems().isEmpty()\n+ || dataForm.getReportedData() != null || !dataForm.getInstructions().isEmpty()) {\n+ throw new IllegalArgumentException(\"Illegal Arguements for SoftwareInformation\");\n+ }\n+ String formTypeValue = dataForm.getFormType();\n+ if (formTypeValue == null) {\n+ throw new IllegalArgumentException(\"FORM_TYPE Formfield missing\");\n+ }\n+ if (!formTypeValue.equals(SoftwareInfoForm.FORM_TYPE)) {\n+ throw new IllegalArgumentException(\"Malformed FORM_TYPE Formfield encountered\");\n+ }\n+ this.dataFormBuilder = dataForm.asBuilder();\n+ return this;\n+ }\n+\n+ /**\n+ * This method is called to build a {@link SoftwareInfoForm}.\n+ * <br>\n+ * @return Builder\n+ */\n+ public SoftwareInfoForm build() {\n+ return new SoftwareInfoForm(dataFormBuilder.build());\n+ }\n+ }\n+}\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "smack-extensions/src/main/java/org/jivesoftware/smackx/softwareinfo/form/package-info.java",
"diff": "+/**\n+ *\n+ * Copyright 2020 Aditya Borikar\n+ *\n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * You may obtain a copy of the License at\n+ *\n+ * http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+\n+/**\n+ * Form class needed for <a href=\"https://xmpp.org/extensions/xep-0232.html\"> XEP-0232: Software Information</a>.\n+ */\n+package org.jivesoftware.smackx.softwareinfo.form;\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "smack-extensions/src/main/java/org/jivesoftware/smackx/softwareinfo/package-info.java",
"diff": "+/**\n+ *\n+ * Copyright 2020 Aditya Borikar\n+ *\n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * You may obtain a copy of the License at\n+ *\n+ * http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+\n+/**\n+ * Smacks implementation of XEP-0232: Software Information.\n+ */\n+package org.jivesoftware.smackx.softwareinfo;\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "smack-extensions/src/test/java/org/jivesoftware/smackx/softwareinfo/SoftwareInfoFormTest.java",
"diff": "+/**\n+ *\n+ * Copyright 2020 Aditya Borikar\n+ *\n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * You may obtain a copy of the License at\n+ *\n+ * http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+package org.jivesoftware.smackx.softwareinfo;\n+\n+import static org.jivesoftware.smack.test.util.XmlUnitUtils.assertXmlSimilar;\n+import static org.junit.jupiter.api.Assertions.assertEquals;\n+import static org.junit.jupiter.api.Assertions.assertThrows;\n+\n+import java.net.URI;\n+import java.net.URISyntaxException;\n+\n+import org.jivesoftware.smack.test.util.SmackTestSuite;\n+import org.jivesoftware.smackx.mediaelement.element.MediaElement;\n+import org.jivesoftware.smackx.softwareinfo.form.SoftwareInfoForm;\n+import org.jivesoftware.smackx.xdata.FormField;\n+import org.jivesoftware.smackx.xdata.TextSingleFormField;\n+import org.jivesoftware.smackx.xdata.packet.DataForm;\n+import org.jivesoftware.smackx.xdata.packet.DataForm.Type;\n+\n+import org.junit.jupiter.api.Test;\n+\n+public class SoftwareInfoFormTest extends SmackTestSuite {\n+\n+ private final String xml =\n+ \"<x xmlns='jabber:x:data' type='result'>\" +\n+ \"<field var='FORM_TYPE' type='hidden'>\" +\n+ \"<value>urn:xmpp:dataforms:softwareinfo</value>\" +\n+ \"</field>\" +\n+ \"<field var='icon'>\" +\n+ \"<media xmlns='urn:xmpp:media-element' height='80' width='290'>\" +\n+ \"<uri type='image/jpeg'>\" +\n+ \"http://www.shakespeare.lit/clients/exodus.jpg\" +\n+ \"</uri>\" +\n+ \"<uri type='image/jpeg'>\" +\n+ \"cid:[email protected]\" +\n+ \"</uri>\" +\n+ \"</media>\" +\n+ \"</field>\" +\n+ \"<field var='os'>\" +\n+ \"<value>Windows</value>\" +\n+ \"</field>\" +\n+ \"<field var='os_version'>\" +\n+ \"<value>XP</value>\" +\n+ \"</field>\" +\n+ \"<field var='software'>\" +\n+ \"<value>Exodus</value>\" +\n+ \"</field>\" +\n+ \"<field var='software_version'>\" +\n+ \"<value>0.9.1</value>\" +\n+ \"</field>\" +\n+ \"</x>\";\n+\n+ @Test\n+ public void softwareInfoBuilderTest() throws URISyntaxException {\n+ SoftwareInfoForm softwareInfoForm = createSoftwareInfoForm();\n+ assertXmlSimilar(xml, softwareInfoForm.getDataForm().toXML());\n+\n+ softwareInfoForm = createSoftwareInfoFormUsingDataForm();\n+ assertXmlSimilar(xml, softwareInfoForm.getDataForm().toXML());\n+ }\n+\n+ @Test\n+ public void getInfoFromSoftwareInfoFormTest() throws URISyntaxException {\n+ SoftwareInfoForm softwareInfoForm = createSoftwareInfoForm();\n+ assertEquals(\"Windows\", softwareInfoForm.getOS());\n+ assertEquals(\"XP\", softwareInfoForm.getOSVersion());\n+ assertEquals(\"Exodus\", softwareInfoForm.getSoftwareName());\n+ assertEquals(\"0.9.1\", softwareInfoForm.getSoftwareVersion());\n+ assertXmlSimilar(createMediaElement().toXML(), softwareInfoForm.getIcon().toXML());\n+ }\n+\n+ @Test\n+ public void faultySoftwareInfoFormsTest() {\n+ DataForm.Builder dataFormbuilder = DataForm.builder(Type.result);\n+ TextSingleFormField formField = FormField.buildHiddenFormType(\"faulty_formtype\");\n+ dataFormbuilder.addField(formField);\n+ assertThrows(IllegalArgumentException.class, () -> {\n+ SoftwareInfoForm.getBuilder().setDataForm(dataFormbuilder.build()).build();\n+ });\n+\n+ DataForm.Builder builderWithoutFormType = DataForm.builder(Type.result);\n+ assertThrows(IllegalArgumentException.class, () -> {\n+ SoftwareInfoForm.getBuilder().setDataForm(builderWithoutFormType.build()).build();\n+ });\n+ }\n+\n+ public static SoftwareInfoForm createSoftwareInfoFormUsingDataForm() throws URISyntaxException {\n+ DataForm.Builder dataFormBuilder = DataForm.builder(Type.result);\n+ TextSingleFormField formField = FormField.buildHiddenFormType(SoftwareInfoForm.FORM_TYPE);\n+ dataFormBuilder.addField(formField);\n+\n+ dataFormBuilder.addField(FormField.builder(\"icon\")\n+ .addFormFieldChildElement(createMediaElement())\n+ .build());\n+ dataFormBuilder.addField(FormField.builder(\"os\")\n+ .setValue(\"Windows\")\n+ .build());\n+ dataFormBuilder.addField(FormField.builder(\"os_version\")\n+ .setValue(\"XP\")\n+ .build());\n+ dataFormBuilder.addField(FormField.builder(\"software\")\n+ .setValue(\"Exodus\")\n+ .build());\n+ dataFormBuilder.addField(FormField.builder(\"software_version\")\n+ .setValue(\"0.9.1\")\n+ .build());\n+\n+ SoftwareInfoForm softwareInfoForm = SoftwareInfoForm.getBuilder().setDataForm(dataFormBuilder.build()).build();\n+ return softwareInfoForm;\n+ }\n+\n+ public static SoftwareInfoForm createSoftwareInfoForm() throws URISyntaxException {\n+ return SoftwareInfoForm.getBuilder()\n+ .setIcon(createMediaElement())\n+ .setOS(\"Windows\")\n+ .setOSVersion(\"XP\")\n+ .setSoftware(\"Exodus\")\n+ .setSoftwareVersion(\"0.9.1\")\n+ .build();\n+ }\n+\n+ public static MediaElement createMediaElement() throws URISyntaxException {\n+ return MediaElement.builder()\n+ .addUri(new URI(\"http://www.shakespeare.lit/clients/exodus.jpg\"), \"image/jpeg\")\n+ .addUri(new URI(\"cid:[email protected]\"), \"image/jpeg\")\n+ .setHeightAndWidth(80, 290)\n+ .build();\n+ }\n+}\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "smack-extensions/src/test/java/org/jivesoftware/smackx/softwareinfo/SoftwareInfoManagerTest.java",
"diff": "+/**\n+ *\n+ * Copyright 2020 Aditya Borikar\n+ *\n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * You may obtain a copy of the License at\n+ *\n+ * http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+package org.jivesoftware.smackx.softwareinfo;\n+\n+import java.io.IOException;\n+import java.net.URI;\n+import java.net.URISyntaxException;\n+\n+import org.jivesoftware.smack.SmackException;\n+import org.jivesoftware.smack.XMPPConnection;\n+import org.jivesoftware.smack.XMPPException;\n+import org.jivesoftware.smack.parsing.SmackParsingException;\n+import org.jivesoftware.smack.xml.XmlPullParserException;\n+\n+import org.jivesoftware.smackx.mediaelement.element.MediaElement;\n+import org.jivesoftware.smackx.softwareinfo.form.SoftwareInfoForm;\n+import org.jivesoftware.smackx.xdata.FormField;\n+import org.jivesoftware.smackx.xdata.packet.DataForm;\n+import org.jivesoftware.smackx.xdata.packet.DataForm.Type;\n+\n+import org.jivesoftware.util.ConnectionUtils;\n+import org.jivesoftware.util.Protocol;\n+import org.junit.jupiter.api.BeforeEach;\n+import org.junit.jupiter.api.Test;\n+import org.jxmpp.jid.EntityFullJid;\n+import org.jxmpp.jid.JidTestUtil;\n+\n+public class SoftwareInfoManagerTest {\n+\n+ private static final EntityFullJid initiatorJID = JidTestUtil.DUMMY_AT_EXAMPLE_ORG_SLASH_DUMMYRESOURCE;\n+ private XMPPConnection connection;\n+ private Protocol protocol;\n+\n+ @BeforeEach\n+ public void setup() throws XMPPException, SmackException, InterruptedException {\n+ protocol = new Protocol();\n+ connection = ConnectionUtils.createMockedConnection(protocol, initiatorJID);\n+ }\n+\n+ @Test\n+ public void softwareInfoManagerTest() throws IOException, XmlPullParserException, SmackParsingException, URISyntaxException {\n+ SoftwareInfoManager manager = SoftwareInfoManager.getInstanceFor(connection);\n+ manager.publishSoftwareInformationForm(buildSoftwareInfoFormUsingBuilder());\n+ manager.publishSoftwareInformationForm(buildSoftwareInfoFromDataForm());\n+ }\n+\n+ public static SoftwareInfoForm buildSoftwareInfoFormUsingBuilder() throws URISyntaxException {\n+ SoftwareInfoForm.Builder builder = SoftwareInfoForm.getBuilder();\n+ MediaElement mediaElement = createMediaElement();\n+ builder.setIcon(mediaElement);\n+ builder.setOS(\"Windows\");\n+ builder.setOSVersion(\"XP\");\n+ builder.setSoftware(\"Exodus\");\n+ builder.setSoftwareVersion(\"0.9.1\");\n+ return builder.build();\n+ }\n+\n+ public static SoftwareInfoForm buildSoftwareInfoFromDataForm() throws URISyntaxException {\n+ DataForm.Builder dataFormBuilder = DataForm.builder(Type.result);\n+ dataFormBuilder.addField(FormField.buildHiddenFormType(SoftwareInfoForm.FORM_TYPE));\n+ dataFormBuilder.addField(FormField.builder(\"icon\")\n+ .addFormFieldChildElement(createMediaElement())\n+ .build());\n+ dataFormBuilder.addField(FormField.builder(\"os\")\n+ .setValue(\"Windows\")\n+ .build());\n+ dataFormBuilder.addField(FormField.builder(\"os_version\")\n+ .setValue(\"XP\")\n+ .build());\n+ dataFormBuilder.addField(FormField.builder(\"software\")\n+ .setValue(\"Exodus\")\n+ .build());\n+ dataFormBuilder.addField(FormField.builder(\"software_version\")\n+ .setValue(\"0.9.1\")\n+ .build());\n+ SoftwareInfoForm softwareInfoForm = SoftwareInfoForm.getBuilder()\n+ .setDataForm(dataFormBuilder.build())\n+ .build();\n+ return softwareInfoForm;\n+ }\n+\n+ public static MediaElement createMediaElement() throws URISyntaxException {\n+ return MediaElement.builder()\n+ .addUri(new MediaElement.Uri(new URI(\"http://example.org\"), \"test-type\"))\n+ .setHeightAndWidth(16, 16)\n+ .build();\n+ }\n+}\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "smack-integration-test/src/main/java/org/jivesoftware/smackx/softwareInfo/SoftwareInfoIntegrationTest.java",
"diff": "+/**\n+ *\n+ * Copyright 2020 Aditya Borikar\n+ *\n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * You may obtain a copy of the License at\n+ *\n+ * http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+package org.jivesoftware.smackx.softwareInfo;\n+\n+import static org.junit.jupiter.api.Assertions.assertTrue;\n+\n+import java.io.IOException;\n+import java.net.URI;\n+import java.net.URISyntaxException;\n+\n+import org.jivesoftware.smack.parsing.SmackParsingException;\n+import org.jivesoftware.smack.xml.XmlPullParserException;\n+import org.jivesoftware.smackx.mediaelement.element.MediaElement;\n+import org.jivesoftware.smackx.softwareinfo.SoftwareInfoManager;\n+import org.jivesoftware.smackx.softwareinfo.form.SoftwareInfoForm;\n+\n+import org.igniterealtime.smack.inttest.AbstractSmackIntegrationTest;\n+import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment;\n+import org.igniterealtime.smack.inttest.annotations.BeforeClass;\n+import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest;\n+import org.igniterealtime.smack.inttest.util.IntegrationTestRosterUtil;\n+\n+public class SoftwareInfoIntegrationTest extends AbstractSmackIntegrationTest {\n+\n+ public final SoftwareInfoManager sim1;\n+ public final SoftwareInfoManager sim2;\n+\n+ public SoftwareInfoIntegrationTest(SmackIntegrationTestEnvironment environment)\n+ throws IOException, XmlPullParserException, SmackParsingException {\n+ super(environment);\n+ sim1 = SoftwareInfoManager.getInstanceFor(conOne);\n+ sim2 = SoftwareInfoManager.getInstanceFor(conTwo);\n+ }\n+\n+ @BeforeClass\n+ public void setUp() throws Exception {\n+ IntegrationTestRosterUtil.ensureBothAccountsAreSubscribedToEachOther(conOne, conTwo, timeout);\n+ }\n+\n+ @SmackIntegrationTest\n+ public void test() throws Exception {\n+ SoftwareInfoForm softwareInfoSent = createSoftwareInfoForm();\n+ sim1.publishSoftwareInformationForm(softwareInfoSent);\n+ SoftwareInfoForm softwareInfoFormReceived = sim2.fromJid(conOne.getUser());\n+ assertTrue(softwareInfoFormReceived.equals(softwareInfoSent));\n+ }\n+\n+ private static SoftwareInfoForm createSoftwareInfoForm() throws URISyntaxException {\n+ SoftwareInfoForm.Builder builder = SoftwareInfoForm.getBuilder();\n+ MediaElement mediaElement = MediaElement.builder()\n+ .addUri(new MediaElement.Uri(new URI(\"http://example.org\"), \"test-type\"))\n+ .setHeightAndWidth(16, 16)\n+ .build();\n+\n+ SoftwareInfoForm softwareInfoForm = builder.setIcon(mediaElement)\n+ .setOS(\"Windows\")\n+ .setOSVersion(\"XP\")\n+ .setSoftware(\"Exodus\")\n+ .setSoftwareVersion(\"0.9.1\")\n+ .build();\n+ return softwareInfoForm;\n+ }\n+}\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "smack-integration-test/src/main/java/org/jivesoftware/smackx/softwareInfo/package-info.java",
"diff": "+/**\n+ *\n+ * Copyright 2020 Aditya Borikar\n+ *\n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * You may obtain a copy of the License at\n+ *\n+ * http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+package org.jivesoftware.smackx.softwareInfo;\n"
}
] | Java | Apache License 2.0 | igniterealtime/smack | Add support for XEP-0232: Software Information
By making use of an extended data format, service discovery responses
can be used to constitute software information.
Solves SMACK-853. |
299,284 | 28.05.2020 03:17:37 | -19,080 | 223d58527b053d606b8980766c0aedd749c58663 | Use correct class name in docs
XMPPConnectionConfiguration/XMPPTCPConnectionConfiguration | [
{
"change_type": "MODIFY",
"old_path": "smack-tcp/src/main/java/org/jivesoftware/smack/tcp/XMPPTCPConnectionConfiguration.java",
"new_path": "smack-tcp/src/main/java/org/jivesoftware/smack/tcp/XMPPTCPConnectionConfiguration.java",
"diff": "@@ -26,7 +26,7 @@ import org.jivesoftware.smack.ConnectionConfiguration;\n* </p>\n* <pre>\n* {@code\n- * XMPPTCPConnectionConfiguration conf = XMPPConnectionConfiguration.builder()\n+ * XMPPTCPConnectionConfiguration conf = XMPPTCPConnectionConfiguration.builder()\n* .setXmppDomain(\"example.org\").setUsernameAndPassword(\"user\", \"password\")\n* .setCompressionEnabled(false).build();\n* XMPPTCPConnection connection = new XMPPTCPConnection(conf);\n"
}
] | Java | Apache License 2.0 | igniterealtime/smack | Use correct class name in docs
XMPPConnectionConfiguration/XMPPTCPConnectionConfiguration |
299,284 | 31.05.2020 00:58:29 | -19,080 | d639e0bc4c345a59c8356c47df84d95d24b7aaec | Some more docFix es | [
{
"change_type": "MODIFY",
"old_path": "smack-core/src/main/java/org/jivesoftware/smack/c2s/ModularXmppClientToServerConnection.java",
"new_path": "smack-core/src/main/java/org/jivesoftware/smack/c2s/ModularXmppClientToServerConnection.java",
"diff": "@@ -353,7 +353,7 @@ public final class ModularXmppClientToServerConnection extends AbstractXMPPConne\n}\n/**\n- * Attempt to enter a state. Note that this method may return <code>null</code> if this state can be safely ignored ignored.\n+ * Attempt to enter a state. Note that this method may return <code>null</code> if this state can be safely ignored.\n*\n* @param successorStateVertex the successor state vertex.\n* @param walkStateGraphContext the \"walk state graph\" context.\n"
},
{
"change_type": "MODIFY",
"old_path": "smack-core/src/main/java/org/jivesoftware/smack/fsm/StateDescriptor.java",
"new_path": "smack-core/src/main/java/org/jivesoftware/smack/fsm/StateDescriptor.java",
"diff": "@@ -212,7 +212,7 @@ public abstract class StateDescriptor {\nprotected State constructState(ModularXmppClientToServerConnectionInternal connectionInternal) {\nModularXmppClientToServerConnection connection = connectionInternal.connection;\ntry {\n- // If stateClassConstructor is null here, then you probably forgot to override the the\n+ // If stateClassConstructor is null here, then you probably forgot to override the\n// StateDescriptor.constructState() method?\nreturn stateClassConstructor.newInstance(connection, this, connectionInternal);\n} catch (InstantiationException | IllegalAccessException | IllegalArgumentException\n"
},
{
"change_type": "MODIFY",
"old_path": "smack-tcp/src/main/java/org/jivesoftware/smack/tcp/XmppTcpTransportModule.java",
"new_path": "smack-tcp/src/main/java/org/jivesoftware/smack/tcp/XmppTcpTransportModule.java",
"diff": "@@ -591,7 +591,7 @@ public class XmppTcpTransportModule extends ModularXmppClientToServerConnectionM\n@Override\nprotected List<SmackFuture<LookupConnectionEndpointsResult, Exception>> lookupConnectionEndpoints() {\n- // Assert that there are no stale discovred endpoints prior performing the lookup.\n+ // Assert that there are no stale discovered endpoints prior performing the lookup.\nassert discoveredTcpEndpoints == null;\nList<SmackFuture<LookupConnectionEndpointsResult, Exception>> futures = new ArrayList<>(2);\n"
}
] | Java | Apache License 2.0 | igniterealtime/smack | Some more docFix es |
299,302 | 11.06.2020 13:12:13 | 18,000 | 8e337d7810bbfb5d4a4bd1b5a68e471f865a4ea1 | [muc] Make providesMucService() use the KNOWN_MUC_SERVICES cache
This reduces the number of disco#info queries on MUC join in some
situations. | [
{
"change_type": "MODIFY",
"old_path": "smack-extensions/src/main/java/org/jivesoftware/smackx/muc/MultiUserChat.java",
"new_path": "smack-extensions/src/main/java/org/jivesoftware/smackx/muc/MultiUserChat.java",
"diff": "@@ -88,7 +88,6 @@ import org.jxmpp.jid.EntityJid;\nimport org.jxmpp.jid.Jid;\nimport org.jxmpp.jid.impl.JidCreate;\nimport org.jxmpp.jid.parts.Resourcepart;\n-import org.jxmpp.util.cache.ExpirationCache;\n/**\n* A MultiUserChat room (XEP-45), created with {@link MultiUserChatManager#getMultiUserChat(EntityBareJid)}.\n@@ -112,9 +111,6 @@ import org.jxmpp.util.cache.ExpirationCache;\npublic class MultiUserChat {\nprivate static final Logger LOGGER = Logger.getLogger(MultiUserChat.class.getName());\n- private static final ExpirationCache<DomainBareJid, Void> KNOWN_MUC_SERVICES = new ExpirationCache<>(\n- 100, 1000 * 60 * 60 * 24);\n-\nprivate final XMPPConnection connection;\nprivate final EntityBareJid room;\nprivate final MultiUserChatManager multiUserChatManager;\n@@ -340,13 +336,9 @@ public class MultiUserChat {\nprivate Presence enter(MucEnterConfiguration conf) throws NotConnectedException, NoResponseException,\nXMPPErrorException, InterruptedException, NotAMucServiceException {\nfinal DomainBareJid mucService = room.asDomainBareJid();\n- if (!KNOWN_MUC_SERVICES.containsKey(mucService)) {\n- if (multiUserChatManager.providesMucService(mucService)) {\n- KNOWN_MUC_SERVICES.put(mucService, null);\n- } else {\n+ if (!multiUserChatManager.providesMucService(mucService)) {\nthrow new NotAMucServiceException(this);\n}\n- }\n// We enter a room by sending a presence packet where the \"to\"\n// field is in the form \"roomName@service/nickname\"\nPresence joinPresence = conf.getJoinPresence(this);\n"
},
{
"change_type": "MODIFY",
"old_path": "smack-extensions/src/main/java/org/jivesoftware/smackx/muc/MultiUserChatManager.java",
"new_path": "smack-extensions/src/main/java/org/jivesoftware/smackx/muc/MultiUserChatManager.java",
"diff": "@@ -64,6 +64,7 @@ import org.jxmpp.jid.EntityFullJid;\nimport org.jxmpp.jid.EntityJid;\nimport org.jxmpp.jid.Jid;\nimport org.jxmpp.jid.parts.Resourcepart;\n+import org.jxmpp.util.cache.ExpirationCache;\n/**\n* A manager for Multi-User Chat rooms.\n@@ -136,6 +137,9 @@ public final class MultiUserChatManager extends Manager {\nprivate static final StanzaFilter INVITATION_FILTER = new AndFilter(StanzaTypeFilter.MESSAGE, new StanzaExtensionFilter(new MUCUser()),\nnew NotFilter(MessageTypeFilter.ERROR));\n+ private static final ExpirationCache<DomainBareJid, Void> KNOWN_MUC_SERVICES = new ExpirationCache<>(\n+ 100, 1000 * 60 * 60 * 24);\n+\nprivate final Set<InvitationListener> invitationsListeners = new CopyOnWriteArraySet<InvitationListener>();\n/**\n@@ -392,8 +396,16 @@ public final class MultiUserChatManager extends Manager {\n*/\npublic boolean providesMucService(DomainBareJid domainBareJid) throws NoResponseException,\nXMPPErrorException, NotConnectedException, InterruptedException {\n- return serviceDiscoveryManager.supportsFeature(domainBareJid,\n- MUCInitialPresence.NAMESPACE);\n+ boolean contains = KNOWN_MUC_SERVICES.containsKey(domainBareJid);\n+ if (!contains) {\n+ if (serviceDiscoveryManager.supportsFeature(domainBareJid,\n+ MUCInitialPresence.NAMESPACE)) {\n+ KNOWN_MUC_SERVICES.put(domainBareJid, null);\n+ return true;\n+ }\n+ }\n+\n+ return contains;\n}\n/**\n"
}
] | Java | Apache License 2.0 | igniterealtime/smack | [muc] Make providesMucService() use the KNOWN_MUC_SERVICES cache
This reduces the number of disco#info queries on MUC join in some
situations. |
299,284 | 19.06.2020 05:00:03 | -19,080 | dcb66eef592bf3959a3aaafae0802e0b35500e2d | Add support for HTTP lookup method through xep-0156 | [
{
"change_type": "MODIFY",
"old_path": "documentation/extensions/index.md",
"new_path": "documentation/extensions/index.md",
"diff": "@@ -14,6 +14,7 @@ Currently supported XEPs of Smack (all sub-projects)\n| Name | XEP | Version | Description |\n|---------------------------------------------|--------------------------------------------------------|-----------|----------------------------------------------------------------------------------------------------------|\n+| Discovering Alternative XMPP Connection Methods | [XEP-0156](https://xmpp.org/extensions/xep-0156.html) | 1.3.0 | Defines ways to discover alternative connection methods. |\n| Nonzas | [XEP-0360](https://xmpp.org/extensions/xep-0360.html) | n/a | Defines the term \"Nonza\", describing every top level stream element that is not a Stanza. |\nCurrently supported XEPs of smack-tcp\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "smack-core/src/main/java/org/jivesoftware/smack/altconnections/HttpLookupMethod.java",
"diff": "+/**\n+ *\n+ * Copyright 2020 Aditya Borikar.\n+ *\n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * You may obtain a copy of the License at\n+ *\n+ * http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+package org.jivesoftware.smack.altconnections;\n+\n+import java.io.FileNotFoundException;\n+import java.io.IOException;\n+import java.io.InputStream;\n+import java.net.URI;\n+import java.net.URISyntaxException;\n+import java.net.URL;\n+import java.net.URLConnection;\n+import java.util.ArrayList;\n+import java.util.List;\n+\n+import org.jivesoftware.smack.util.PacketParserUtils;\n+import org.jivesoftware.smack.xml.XmlPullParser;\n+import org.jivesoftware.smack.xml.XmlPullParserException;\n+\n+import org.jxmpp.jid.DomainBareJid;\n+\n+/**\n+ * The HTTP lookup method uses web host metadata to list the URIs of alternative connection methods.\n+ *\n+ * <p>In order to obtain host-meta XRD element from the host in the form of an <i>InputStream</i>,\n+ * use {@link #getXrdStream(DomainBareJid)} method. To obtain endpoints for Bosh or Websocket\n+ * connection endpoints from host, use {@link LinkRelation#BOSH} and {@link LinkRelation#WEBSOCKET}\n+ * respectively with the {@link #lookup(DomainBareJid, LinkRelation)} method. In case one is looking\n+ * for endpoints described by other than BOSH or Websocket LinkRelation, use the more flexible\n+ * {@link #lookup(DomainBareJid, String)} method.</p>\n+ * Example:<br>\n+ * <pre>\n+ * {@code\n+ * DomainBareJid xmppServerAddress = JidCreate.domainBareFrom(\"example.org\");\n+ * List<URI> endpoints = HttpLookupMethod.lookup(xmppServiceAddress, LinkRelation.WEBSOCKET);\n+ * }\n+ * </pre>\n+ * @see <a href=\"https://xmpp.org/extensions/xep-0156.html#http\">\n+ * HTTP Lookup Method from XEP-0156.\n+ * </a>\n+ */\n+public final class HttpLookupMethod {\n+ private static final String XRD_NAMESPACE = \"http://docs.oasis-open.org/ns/xri/xrd-1.0\";\n+\n+ /**\n+ * Specifies a link relation for the selected type of connection.\n+ */\n+ public enum LinkRelation {\n+ /**\n+ * Selects link relation attribute as \"urn:xmpp:alt-connections:xbosh\".\n+ */\n+ BOSH(\"urn:xmpp:alt-connections:xbosh\"),\n+ /**\n+ * Selects link relation attribute as \"urn:xmpp:alt-connections:websocket\".\n+ */\n+ WEBSOCKET(\"urn:xmpp:alt-connections:websocket\");\n+ private final String attribute;\n+ LinkRelation(String relAttribute) {\n+ this.attribute = relAttribute;\n+ }\n+ }\n+\n+ /**\n+ * Get remote endpoints for the given LinkRelation from host.\n+ *\n+ * @param xmppServiceAddress address of host\n+ * @param relation LinkRelation as a string specifying type of connection\n+ * @return list of endpoints\n+ * @throws IOException exception due to input/output operations\n+ * @throws XmlPullParserException exception encountered during XML parsing\n+ * @throws URISyntaxException exception to indicate that a string could not be parsed as a URI reference\n+ */\n+ public static List<URI> lookup(DomainBareJid xmppServiceAddress, String relation) throws IOException, XmlPullParserException, URISyntaxException {\n+ try (InputStream inputStream = getXrdStream(xmppServiceAddress)) {\n+ XmlPullParser xmlPullParser = PacketParserUtils.getParserFor(inputStream);\n+ List<URI> endpoints = parseXrdLinkReferencesFor(xmlPullParser, relation);\n+ return endpoints;\n+ }\n+ }\n+\n+ /**\n+ * Get remote endpoints for the given LinkRelation from host.\n+ *\n+ * @param xmppServiceAddress address of host\n+ * @param relation {@link LinkRelation} specifying type of connection\n+ * @return list of endpoints\n+ * @throws IOException exception due to input/output operations\n+ * @throws XmlPullParserException exception encountered during XML parsing\n+ * @throws URISyntaxException exception to indicate that a string could not be parsed as a URI reference\n+ */\n+ public static List<URI> lookup(DomainBareJid xmppServiceAddress, LinkRelation relation) throws IOException, XmlPullParserException, URISyntaxException {\n+ return lookup(xmppServiceAddress, relation.attribute);\n+ }\n+\n+ /**\n+ * Constructs a HTTP connection with the host specified by the DomainBareJid\n+ * and retrieves XRD element in the form of an InputStream. The method will\n+ * throw a {@link FileNotFoundException} if host-meta isn't published.\n+ *\n+ * @param xmppServiceAddress address of host\n+ * @return InputStream containing XRD element\n+ * @throws IOException exception due to input/output operations\n+ */\n+ public static InputStream getXrdStream(DomainBareJid xmppServiceAddress) throws IOException {\n+ final String metadataUrl = \"https://\" + xmppServiceAddress + \"/.well-known/host-meta\";\n+ final URL putUrl = new URL(metadataUrl);\n+ final URLConnection urlConnection = putUrl.openConnection();\n+ return urlConnection.getInputStream();\n+ }\n+\n+ /**\n+ * Get remote endpoints for the provided LinkRelation from provided XmlPullParser.\n+ *\n+ * @param parser XmlPullParser that contains LinkRelations\n+ * @param relation type of endpoints specified by the given LinkRelation\n+ * @return list of endpoints\n+ * @throws IOException exception due to input/output operations\n+ * @throws XmlPullParserException exception encountered during XML parsing\n+ * @throws URISyntaxException exception to indicate that a string could not be parsed as a URI reference\n+ */\n+ public static List<URI> parseXrdLinkReferencesFor(XmlPullParser parser, String relation) throws IOException, XmlPullParserException, URISyntaxException {\n+ List<URI> uriList = new ArrayList<>();\n+ int initialDepth = parser.getDepth();\n+\n+ loop: while (true) {\n+ XmlPullParser.TagEvent tag = parser.nextTag();\n+ switch (tag) {\n+ case START_ELEMENT:\n+ String name = parser.getName();\n+ String namespace = parser.getNamespace();\n+ String rel = parser.getAttributeValue(\"rel\");\n+\n+ if (!namespace.equals(XRD_NAMESPACE) || !name.equals(\"Link\") || !rel.equals(relation)) {\n+ continue loop;\n+ }\n+ String endpointUri = parser.getAttributeValue(\"href\");\n+ URI uri = new URI(endpointUri);\n+ uriList.add(uri);\n+ break;\n+ case END_ELEMENT:\n+ if (parser.getDepth() == initialDepth) {\n+ break loop;\n+ }\n+ break;\n+ }\n+ }\n+ return uriList;\n+ }\n+\n+ /**\n+ * Get remote endpoints for the provided LinkRelation from provided XmlPullParser.\n+ *\n+ * @param parser XmlPullParser that contains LinkRelations\n+ * @param relation type of endpoints specified by the given LinkRelation\n+ * @return list of endpoints\n+ * @throws IOException exception due to input/output operations\n+ * @throws XmlPullParserException exception encountered during XML parsing\n+ * @throws URISyntaxException exception to indicate that a string could not be parsed as a URI reference\n+ */\n+ public static List<URI> parseXrdLinkReferencesFor(XmlPullParser parser, LinkRelation relation) throws IOException, XmlPullParserException, URISyntaxException {\n+ return parseXrdLinkReferencesFor(parser, relation.attribute);\n+ }\n+}\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "smack-core/src/main/java/org/jivesoftware/smack/altconnections/package-info.java",
"diff": "+/**\n+ *\n+ * Copyright 2020 Aditya Borikar.\n+ *\n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * You may obtain a copy of the License at\n+ *\n+ * http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+/**\n+ * Smack's API for <a href=\"https://xmpp.org/extensions/xep-0156.html\"> XEP-0156: Discovering Alternative XMPP Connection Methods</a>.\n+ * <br>\n+ * XEP is partially supported as HTTP lookup is supported but DNS lookup isn't.\n+ */\n+package org.jivesoftware.smack.altconnections;\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "smack-core/src/test/java/org/jivesoftware/smack/altconnections/HttpLookupMethodTest.java",
"diff": "+/**\n+ *\n+ * Copyright 2020 Aditya Borikar.\n+ *\n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * You may obtain a copy of the License at\n+ *\n+ * http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+package org.jivesoftware.smack.altconnections;\n+\n+import static org.junit.jupiter.api.Assertions.assertEquals;\n+\n+import java.io.IOException;\n+import java.net.URI;\n+import java.net.URISyntaxException;\n+import java.util.ArrayList;\n+import java.util.List;\n+\n+import org.jivesoftware.smack.altconnections.HttpLookupMethod.LinkRelation;\n+import org.jivesoftware.smack.util.PacketParserUtils;\n+import org.jivesoftware.smack.xml.XmlPullParserException;\n+\n+import org.junit.jupiter.api.Test;\n+import org.jxmpp.stringprep.XmppStringprepException;\n+\n+public class HttpLookupMethodTest {\n+ private static final String XRD_XML = \"<XRD xmlns='http://docs.oasis-open.org/ns/xri/xrd-1.0'>\" +\n+ \"<Link rel='urn:xmpp:alt-connections:xbosh' href='https://igniterealtime.org:443/http-bind/'/>\" +\n+ \"<Link rel='urn:xmpp:alt-connections:websocket' href='wss://xmpp.igniterealtime.org:7483/ws/'/>\" +\n+ \"<Link rel='urn:xmpp:alt-connections:websocket' href='ws://xmpp.igniterealtime.org:7070/ws/'/>\" +\n+ \"</XRD>\";\n+\n+ @Test\n+ public void parseXrdLinkReferencesForWebsockets() throws XmppStringprepException, IOException, XmlPullParserException, URISyntaxException {\n+ List<URI> endpoints = new ArrayList<>();\n+ endpoints.add(new URI(\"wss://xmpp.igniterealtime.org:7483/ws/\"));\n+ endpoints.add(new URI(\"ws://xmpp.igniterealtime.org:7070/ws/\"));\n+ List<URI> expectedEndpoints = HttpLookupMethod.parseXrdLinkReferencesFor(PacketParserUtils.getParserFor(XRD_XML), LinkRelation.WEBSOCKET);\n+ assertEquals(expectedEndpoints, endpoints);\n+ }\n+\n+ @Test\n+ public void parseXrdLinkReferencesForBosh() throws URISyntaxException, IOException, XmlPullParserException {\n+ List<URI> endpoints = new ArrayList<>();\n+ endpoints.add(new URI(\"https://igniterealtime.org:443/http-bind/\"));\n+ List<URI> expectedEndpoints = HttpLookupMethod.parseXrdLinkReferencesFor(PacketParserUtils.getParserFor(XRD_XML), LinkRelation.BOSH);\n+ assertEquals(expectedEndpoints, endpoints);\n+ }\n+}\n"
}
] | Java | Apache License 2.0 | igniterealtime/smack | Add support for HTTP lookup method through xep-0156 |
299,284 | 22.07.2020 06:46:23 | -19,080 | fcaeca48ec0eb3848c51ee778ce3626b06c9b7db | Add SimpleXmppConnectionIntegrationTest | [
{
"change_type": "ADD",
"old_path": null,
"new_path": "smack-integration-test/src/main/java/org/jivesoftware/smack/c2s/SimpleXmppConnectionIntegrationTest.java",
"diff": "+/**\n+ *\n+ * Copyright 2020 Aditya Borikar\n+ *\n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * You may obtain a copy of the License at\n+ *\n+ * http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+package org.jivesoftware.smack.c2s;\n+\n+import java.util.concurrent.TimeoutException;\n+\n+import org.jivesoftware.smack.StanzaListener;\n+import org.jivesoftware.smack.filter.MessageWithBodiesFilter;\n+import org.jivesoftware.smack.packet.Message;\n+import org.jivesoftware.smack.packet.Stanza;\n+\n+import org.igniterealtime.smack.inttest.AbstractSmackIntegrationTest;\n+import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment;\n+import org.igniterealtime.smack.inttest.annotations.SmackIntegrationTest;\n+import org.igniterealtime.smack.inttest.util.SimpleResultSyncPoint;\n+\n+import org.jxmpp.jid.EntityFullJid;\n+\n+public class SimpleXmppConnectionIntegrationTest extends AbstractSmackIntegrationTest {\n+\n+ public SimpleXmppConnectionIntegrationTest(SmackIntegrationTestEnvironment environment) {\n+ super(environment);\n+ }\n+\n+ @SmackIntegrationTest\n+ public void createConnectionTest() throws TimeoutException, Exception {\n+ EntityFullJid userTwo = conTwo.getUser();\n+\n+ final String messageBody = testRunId + \": Hello from the other side!\";\n+ Message message = conTwo.getStanzaFactory().buildMessageStanza()\n+ .to(userTwo)\n+ .setBody(messageBody)\n+ .build();\n+\n+ final SimpleResultSyncPoint messageReceived = new SimpleResultSyncPoint();\n+\n+ final StanzaListener stanzaListener = (Stanza stanza) -> {\n+ if (((Message) stanza).getBody().equals(messageBody)) {\n+ messageReceived.signal();\n+ }\n+ };\n+\n+ conTwo.addAsyncStanzaListener(stanzaListener, MessageWithBodiesFilter.INSTANCE);\n+\n+ try {\n+ conOne.sendStanza(message);\n+\n+ messageReceived.waitForResult(timeout);\n+ } finally {\n+ conTwo.removeAsyncStanzaListener(stanzaListener);\n+ }\n+ }\n+}\n"
}
] | Java | Apache License 2.0 | igniterealtime/smack | Add SimpleXmppConnectionIntegrationTest |
299,284 | 08.08.2020 20:02:39 | -19,080 | c9cf4f15419be5a20bb7a046facfb664b0141f38 | XmlEnvironment: Use correct method to obatain effective namespace. | [
{
"change_type": "MODIFY",
"old_path": "smack-core/src/main/java/org/jivesoftware/smack/packet/XmlEnvironment.java",
"new_path": "smack-core/src/main/java/org/jivesoftware/smack/packet/XmlEnvironment.java",
"diff": "@@ -71,7 +71,7 @@ public class XmlEnvironment {\n}\npublic String getEffectiveNamespaceOrUse(String namespace) {\n- String effectiveNamespace = getEffectiveLanguage();\n+ String effectiveNamespace = getEffectiveNamespace();\nif (StringUtils.isNullOrEmpty(effectiveNamespace)) {\nreturn namespace;\n}\n"
}
] | Java | Apache License 2.0 | igniterealtime/smack | XmlEnvironment: Use correct method to obatain effective namespace. |
299,284 | 18.08.2020 10:23:22 | -19,080 | 9fcc97836bf5bb8fb788dc44675bf4e5f50e6f25 | Introduce AbstractStreamOpen and AbstractStreamClose
Inherit StreamOpen and StreamClose from AbstractStream classes | [
{
"change_type": "ADD",
"old_path": null,
"new_path": "smack-core/src/main/java/org/jivesoftware/smack/packet/AbstractStreamClose.java",
"diff": "+/**\n+ *\n+ * Copyright 2020 Aditya Borikar\n+ *\n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * You may obtain a copy of the License at\n+ *\n+ * http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+package org.jivesoftware.smack.packet;\n+\n+public abstract class AbstractStreamClose implements Nonza {\n+}\n"
},
{
"change_type": "MODIFY",
"old_path": "smack-core/src/main/java/org/jivesoftware/smack/packet/StreamClose.java",
"new_path": "smack-core/src/main/java/org/jivesoftware/smack/packet/StreamClose.java",
"diff": "*/\npackage org.jivesoftware.smack.packet;\n-public final class StreamClose implements Nonza {\n+public final class StreamClose extends AbstractStreamClose {\npublic static final StreamClose INSTANCE = new StreamClose();\n"
}
] | Java | Apache License 2.0 | igniterealtime/smack | Introduce AbstractStreamOpen and AbstractStreamClose
- Inherit StreamOpen and StreamClose from AbstractStream classes |
299,284 | 18.08.2020 11:00:56 | -19,080 | 0e49adff1d4d88359c3a0c2c2d60efdfc31677e8 | Introduce StreamOpenAndCloseFactory for modular architecture | [
{
"change_type": "MODIFY",
"old_path": "smack-core/src/main/java/org/jivesoftware/smack/AbstractXMPPConnection.java",
"new_path": "smack-core/src/main/java/org/jivesoftware/smack/AbstractXMPPConnection.java",
"diff": "@@ -2243,7 +2243,10 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {\nStreamOpen streamOpen = new StreamOpen(to, from, id, config.getXmlLang(), StreamOpen.StreamContentNamespace.client);\nsendNonza(streamOpen);\n+ updateOutgoingStreamXmlEnvironmentOnStreamOpen(streamOpen);\n+ }\n+ protected void updateOutgoingStreamXmlEnvironmentOnStreamOpen(StreamOpen streamOpen) {\nXmlEnvironment.Builder xmlEnvironmentBuilder = XmlEnvironment.builder();\nxmlEnvironmentBuilder.with(streamOpen);\noutgoingStreamXmlEnvironment = xmlEnvironmentBuilder.build();\n"
},
{
"change_type": "MODIFY",
"old_path": "smack-core/src/main/java/org/jivesoftware/smack/c2s/ModularXmppClientToServerConnection.java",
"new_path": "smack-core/src/main/java/org/jivesoftware/smack/c2s/ModularXmppClientToServerConnection.java",
"diff": "@@ -68,6 +68,7 @@ import org.jivesoftware.smack.packet.Presence;\nimport org.jivesoftware.smack.packet.Stanza;\nimport org.jivesoftware.smack.packet.StreamClose;\nimport org.jivesoftware.smack.packet.StreamError;\n+import org.jivesoftware.smack.packet.StreamOpen;\nimport org.jivesoftware.smack.packet.TopLevelStreamElement;\nimport org.jivesoftware.smack.packet.XmlEnvironment;\nimport org.jivesoftware.smack.parsing.SmackParsingException;\n@@ -81,7 +82,9 @@ import org.jivesoftware.smack.util.Supplier;\nimport org.jivesoftware.smack.xml.XmlPullParser;\nimport org.jivesoftware.smack.xml.XmlPullParserException;\n+import org.jxmpp.jid.DomainBareJid;\nimport org.jxmpp.jid.parts.Resourcepart;\n+import org.jxmpp.util.XmppStringUtils;\npublic final class ModularXmppClientToServerConnection extends AbstractXMPPConnection {\n@@ -560,10 +563,26 @@ public final class ModularXmppClientToServerConnection extends AbstractXMPPConne\nprotected void newStreamOpenWaitForFeaturesSequence(String waitFor) throws InterruptedException,\nSmackException, XMPPException {\nprepareToWaitForFeaturesReceived();\n- sendStreamOpen();\n+\n+ // Create StreamOpen from StreamOpenAndCloseFactory via underlying transport.\n+ StreamOpenAndCloseFactory streamOpenAndCloseFactory = activeTransport.getStreamOpenAndCloseFactory();\n+ CharSequence from = null;\n+ CharSequence localpart = connectionInternal.connection.getConfiguration().getUsername();\n+ DomainBareJid xmppServiceDomain = getXMPPServiceDomain();\n+ if (localpart != null) {\n+ from = XmppStringUtils.completeJidFrom(localpart, xmppServiceDomain);\n+ }\n+ StreamOpen streamOpen = streamOpenAndCloseFactory.createStreamOpen(xmppServiceDomain, from, getStreamId(), getConfiguration().getXmlLang());\n+ sendStreamOpen(streamOpen);\n+\nwaitForFeaturesReceived(waitFor);\n}\n+ private void sendStreamOpen(StreamOpen streamOpen) throws NotConnectedException, InterruptedException {\n+ sendNonza(streamOpen);\n+ updateOutgoingStreamXmlEnvironmentOnStreamOpen(streamOpen);\n+ }\n+\npublic static class DisconnectedStateDescriptor extends StateDescriptor {\nprotected DisconnectedStateDescriptor() {\nsuper(DisconnectedState.class, StateDescriptor.Property.finalState);\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "smack-core/src/main/java/org/jivesoftware/smack/c2s/StreamOpenAndCloseFactory.java",
"diff": "+/**\n+ *\n+ * Copyright 2020 Aditya Borikar.\n+ *\n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * You may obtain a copy of the License at\n+ *\n+ * http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+package org.jivesoftware.smack.c2s;\n+\n+import org.jivesoftware.smack.packet.StreamClose;\n+import org.jivesoftware.smack.packet.StreamOpen;\n+\n+public interface StreamOpenAndCloseFactory {\n+ StreamOpen createStreamOpen(CharSequence to, CharSequence from, String id, String lang);\n+\n+ StreamClose createStreamClose();\n+}\n"
},
{
"change_type": "MODIFY",
"old_path": "smack-core/src/main/java/org/jivesoftware/smack/c2s/XmppClientToServerTransport.java",
"new_path": "smack-core/src/main/java/org/jivesoftware/smack/c2s/XmppClientToServerTransport.java",
"diff": "@@ -58,6 +58,8 @@ public abstract class XmppClientToServerTransport {\nreturn getSslSession() != null;\n}\n+ public abstract StreamOpenAndCloseFactory getStreamOpenAndCloseFactory();\n+\npublic abstract Stats getStats();\npublic abstract static class Stats {\n"
},
{
"change_type": "MODIFY",
"old_path": "smack-tcp/src/main/java/org/jivesoftware/smack/tcp/XmppTcpTransportModule.java",
"new_path": "smack-tcp/src/main/java/org/jivesoftware/smack/tcp/XmppTcpTransportModule.java",
"diff": "@@ -58,6 +58,7 @@ import org.jivesoftware.smack.XmppInputOutputFilter;\nimport org.jivesoftware.smack.c2s.ModularXmppClientToServerConnection.ConnectedButUnauthenticatedStateDescriptor;\nimport org.jivesoftware.smack.c2s.ModularXmppClientToServerConnection.LookupRemoteConnectionEndpointsStateDescriptor;\nimport org.jivesoftware.smack.c2s.ModularXmppClientToServerConnectionModule;\n+import org.jivesoftware.smack.c2s.StreamOpenAndCloseFactory;\nimport org.jivesoftware.smack.c2s.XmppClientToServerTransport;\nimport org.jivesoftware.smack.c2s.internal.ModularXmppClientToServerConnectionInternal;\nimport org.jivesoftware.smack.c2s.internal.WalkStateGraphContext;\n@@ -68,6 +69,7 @@ import org.jivesoftware.smack.fsm.StateTransitionResult;\nimport org.jivesoftware.smack.internal.SmackTlsContext;\nimport org.jivesoftware.smack.packet.Stanza;\nimport org.jivesoftware.smack.packet.StartTls;\n+import org.jivesoftware.smack.packet.StreamClose;\nimport org.jivesoftware.smack.packet.StreamOpen;\nimport org.jivesoftware.smack.packet.TlsFailure;\nimport org.jivesoftware.smack.packet.TlsProceed;\n@@ -580,6 +582,22 @@ public class XmppTcpTransportModule extends ModularXmppClientToServerConnectionM\nsuper(connectionInternal);\n}\n+ @Override\n+ public StreamOpenAndCloseFactory getStreamOpenAndCloseFactory() {\n+ return new StreamOpenAndCloseFactory() {\n+ @Override\n+ public StreamOpen createStreamOpen(CharSequence to, CharSequence from, String id, String lang) {\n+ String xmlLang = connectionInternal.connection.getConfiguration().getXmlLang();\n+ StreamOpen streamOpen = new StreamOpen(to, from, id, xmlLang, StreamOpen.StreamContentNamespace.client);\n+ return streamOpen;\n+ }\n+ @Override\n+ public StreamClose createStreamClose() {\n+ return StreamClose.INSTANCE;\n+ }\n+ };\n+ }\n+\n@Override\nprotected void resetDiscoveredConnectionEndpoints() {\ndiscoveredTcpEndpoints = null;\n"
}
] | Java | Apache License 2.0 | igniterealtime/smack | Introduce StreamOpenAndCloseFactory for modular architecture |
299,284 | 19.08.2020 11:20:50 | -19,080 | db385e6595d02b95ce0c221e718780a8ee59fc89 | Make ModularXmppClientToServerConnectionConfiguration.addModule() public
This commit will allow users to plug their module descriptors inside
modular architecture. | [
{
"change_type": "MODIFY",
"old_path": "smack-core/src/main/java/org/jivesoftware/smack/c2s/ModularXmppClientToServerConnectionConfiguration.java",
"new_path": "smack-core/src/main/java/org/jivesoftware/smack/c2s/ModularXmppClientToServerConnectionConfiguration.java",
"diff": "@@ -96,7 +96,7 @@ public final class ModularXmppClientToServerConnectionConfiguration extends Conn\nreturn new ModularXmppClientToServerConnectionConfiguration(this);\n}\n- void addModule(ModularXmppClientToServerConnectionModuleDescriptor connectionModule) {\n+ public void addModule(ModularXmppClientToServerConnectionModuleDescriptor connectionModule) {\nClass<? extends ModularXmppClientToServerConnectionModuleDescriptor> moduleDescriptorClass = connectionModule.getClass();\nif (modulesDescriptors.containsKey(moduleDescriptorClass)) {\nthrow new IllegalArgumentException(\"A connection module for \" + moduleDescriptorClass + \" is already configured\");\n"
}
] | Java | Apache License 2.0 | igniterealtime/smack | Make ModularXmppClientToServerConnectionConfiguration.addModule() public
This commit will allow users to plug their module descriptors inside
modular architecture. |
299,284 | 23.08.2020 13:13:18 | -19,080 | 0bb0884512023df92b68f73b3427881ac20c683b | XMPPTCPConnection: Add missing `to` in comment | [
{
"change_type": "MODIFY",
"old_path": "smack-tcp/src/main/java/org/jivesoftware/smack/tcp/XMPPTCPConnection.java",
"new_path": "smack-tcp/src/main/java/org/jivesoftware/smack/tcp/XMPPTCPConnection.java",
"diff": "@@ -538,7 +538,7 @@ public class XMPPTCPConnection extends AbstractXMPPConnection {\n}\n// If we are able to resume the stream, then don't set\n- // connected/authenticated/usingTLS to false since we like behave like we are still\n+ // connected/authenticated/usingTLS to false since we like to behave like we are still\n// connected (e.g. sendStanza should not throw a NotConnectedException).\nif (isSmResumptionPossible() && instant) {\ndisconnectedButResumeable = true;\n"
}
] | Java | Apache License 2.0 | igniterealtime/smack | XMPPTCPConnection: Add missing `to` in comment |
299,284 | 02.09.2020 09:46:15 | -19,080 | 1df0763f92ce1775a1fb508701c3a9e5b91d2a1c | Remove AbstractWebsocketNonza since it is no longer needed | [
{
"change_type": "DELETE",
"old_path": "smack-websocket/src/main/java/org/jivesoftware/smack/websocket/elements/AbstractWebSocketNonza.java",
"new_path": null,
"diff": "-/**\n- *\n- * Copyright 2020 Aditya Borikar\n- *\n- * Licensed under the Apache License, Version 2.0 (the \"License\");\n- * you may not use this file except in compliance with the License.\n- * You may obtain a copy of the License at\n- *\n- * http://www.apache.org/licenses/LICENSE-2.0\n- *\n- * Unless required by applicable law or agreed to in writing, software\n- * distributed under the License is distributed on an \"AS IS\" BASIS,\n- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n- * See the License for the specific language governing permissions and\n- * limitations under the License.\n- */\n-package org.jivesoftware.smack.websocket.elements;\n-\n-import org.jivesoftware.smack.packet.Nonza;\n-import org.jivesoftware.smack.packet.XmlEnvironment;\n-import org.jivesoftware.smack.util.XmlStringBuilder;\n-\n-import org.jxmpp.jid.DomainBareJid;\n-\n-public abstract class AbstractWebSocketNonza implements Nonza {\n- public static final String NAMESPACE = \"urn:ietf:params:xml:ns:xmpp-framing\";\n- private static final String VERSION = \"1.0\";\n- private final DomainBareJid to;\n-\n- public AbstractWebSocketNonza(DomainBareJid jid) {\n- this.to = jid;\n- }\n-\n- @Override\n- public String getNamespace() {\n- return NAMESPACE;\n- }\n-\n- @Override\n- public XmlStringBuilder toXML(XmlEnvironment xmlEnvironment) {\n- XmlStringBuilder xml = new XmlStringBuilder(this, xmlEnvironment);\n- xml.attribute(\"to\", to.toString());\n- xml.attribute(\"version\", VERSION);\n- xml.closeEmptyElement();\n- return xml;\n- }\n-}\n"
}
] | Java | Apache License 2.0 | igniterealtime/smack | Remove AbstractWebsocketNonza since it is no longer needed |
299,322 | 29.03.2021 18:49:42 | -19,080 | 525db827a9ba01d4811bc5a258283ab4072a35e6 | Added support for Java's Proxy class in ProxyInfo | [
{
"change_type": "MODIFY",
"old_path": "smack-core/src/main/java/org/jivesoftware/smack/proxy/ProxyInfo.java",
"new_path": "smack-core/src/main/java/org/jivesoftware/smack/proxy/ProxyInfo.java",
"diff": "*/\npackage org.jivesoftware.smack.proxy;\n+import java.net.InetSocketAddress;\n+import java.net.Proxy;\n+import java.net.SocketAddress;\n+\n/**\n* Class which stores proxy information such as proxy type, host, port,\n* authentication etc.\n@@ -44,19 +48,10 @@ public class ProxyInfo {\nthis.proxyPort = pPort;\nthis.proxyUsername = pUser;\nthis.proxyPassword = pPass;\n- switch (proxyType) {\n- case HTTP:\n- proxySocketConnection = new HTTPProxySocketConnection(this);\n- break;\n- case SOCKS4:\n- proxySocketConnection = new Socks4ProxySocketConnection(this);\n- break;\n- case SOCKS5:\n- proxySocketConnection = new Socks5ProxySocketConnection(this);\n- break;\n- default:\n- throw new IllegalStateException();\n- }\n+ this.proxySocketConnection =\n+ ProxySocketConnection\n+ .forProxyType(proxyType)\n+ .apply(this);\n}\npublic static ProxyInfo forHttpProxy(String pHost, int pPort, String pUser,\n@@ -74,6 +69,18 @@ public class ProxyInfo {\nreturn new ProxyInfo(ProxyType.SOCKS5, pHost, pPort, pUser, pPass);\n}\n+ public Proxy.Type getJavaProxyType() {\n+ switch (proxyType) {\n+ case HTTP:\n+ return Proxy.Type.HTTP;\n+ case SOCKS4:\n+ case SOCKS5:\n+ return Proxy.Type.SOCKS;\n+ default:\n+ throw new AssertionError(\"Invalid proxy type: \" + proxyType);\n+ }\n+ }\n+\npublic ProxyType getProxyType() {\nreturn proxyType;\n}\n@@ -97,4 +104,11 @@ public class ProxyInfo {\npublic ProxySocketConnection getProxySocketConnection() {\nreturn proxySocketConnection;\n}\n+\n+ public Proxy toJavaProxy() {\n+ final SocketAddress proxySocketAddress = new InetSocketAddress(proxyAddress, proxyPort);\n+ final Proxy.Type type = getJavaProxyType();\n+ return new Proxy(type, proxySocketAddress);\n+ }\n+\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "smack-core/src/main/java/org/jivesoftware/smack/proxy/ProxySocketConnection.java",
"new_path": "smack-core/src/main/java/org/jivesoftware/smack/proxy/ProxySocketConnection.java",
"diff": "@@ -19,6 +19,8 @@ package org.jivesoftware.smack.proxy;\nimport java.io.IOException;\nimport java.net.Socket;\n+import org.jivesoftware.smack.util.Function;\n+\npublic interface ProxySocketConnection {\n/**\n@@ -34,4 +36,16 @@ public interface ProxySocketConnection {\nvoid connect(Socket socket, String host, int port, int timeout)\nthrows IOException;\n+ static Function<ProxySocketConnection, ProxyInfo> forProxyType(ProxyInfo.ProxyType proxyType) {\n+ switch (proxyType) {\n+ case HTTP:\n+ return HTTPProxySocketConnection::new;\n+ case SOCKS4:\n+ return Socks4ProxySocketConnection::new;\n+ case SOCKS5:\n+ return Socks5ProxySocketConnection::new;\n+ default:\n+ throw new AssertionError(\"Unknown proxy type: \" + proxyType);\n+ }\n+ }\n}\n"
}
] | Java | Apache License 2.0 | igniterealtime/smack | Added support for Java's Proxy class in ProxyInfo |
299,322 | 29.03.2021 18:49:58 | -19,080 | 4736d080a1c5d6d3a26d436ecf3d271da248bd35 | Added proxy support for | [
{
"change_type": "MODIFY",
"old_path": "smack-experimental/src/main/java/org/jivesoftware/smackx/httpfileupload/HttpFileUploadManager.java",
"new_path": "smack-experimental/src/main/java/org/jivesoftware/smackx/httpfileupload/HttpFileUploadManager.java",
"diff": "@@ -27,7 +27,6 @@ import java.net.HttpURLConnection;\nimport java.net.URL;\nimport java.util.List;\nimport java.util.Map;\n-import java.util.Map.Entry;\nimport java.util.Objects;\nimport java.util.WeakHashMap;\nimport java.util.logging.Level;\n@@ -37,6 +36,7 @@ import javax.net.ssl.HttpsURLConnection;\nimport javax.net.ssl.SSLContext;\nimport javax.net.ssl.SSLSocketFactory;\n+import org.jivesoftware.smack.AbstractXMPPConnection;\nimport org.jivesoftware.smack.ConnectionCreationListener;\nimport org.jivesoftware.smack.ConnectionListener;\nimport org.jivesoftware.smack.Manager;\n@@ -46,6 +46,7 @@ import org.jivesoftware.smack.XMPPConnectionRegistry;\nimport org.jivesoftware.smack.XMPPException;\nimport org.jivesoftware.smack.XMPPException.XMPPErrorException;\n+import org.jivesoftware.smack.proxy.ProxyInfo;\nimport org.jivesoftware.smackx.disco.ServiceDiscoveryManager;\nimport org.jivesoftware.smackx.disco.packet.DiscoverInfo;\nimport org.jivesoftware.smackx.httpfileupload.UploadService.Version;\n@@ -429,15 +430,15 @@ public final class HttpFileUploadManager extends Manager {\nprivate void upload(InputStream iStream, long fileSize, Slot slot, UploadProgressListener listener) throws IOException {\nfinal URL putUrl = slot.getPutUrl();\n-\n- final HttpURLConnection urlConnection = (HttpURLConnection) putUrl.openConnection();\n+ final XMPPConnection connection = connection();\n+ final HttpURLConnection urlConnection = createURLConnection(connection, putUrl);\nurlConnection.setRequestMethod(\"PUT\");\nurlConnection.setUseCaches(false);\nurlConnection.setDoOutput(true);\nurlConnection.setFixedLengthStreamingMode(fileSize);\nurlConnection.setRequestProperty(\"Content-Type\", \"application/octet-stream\");\n- for (Entry<String, String> header : slot.getHeaders().entrySet()) {\n+ for (Map.Entry<String, String> header : slot.getHeaders().entrySet()) {\nurlConnection.setRequestProperty(header.getKey(), header.getValue());\n}\n@@ -503,6 +504,30 @@ public final class HttpFileUploadManager extends Manager {\n}\n}\n+ private static HttpURLConnection createURLConnection(XMPPConnection connection, URL putUrl) throws IOException {\n+ Objects.requireNonNull(connection);\n+ Objects.requireNonNull(putUrl);\n+ ProxyInfo proxyInfo = fetchProxyInfo(connection);\n+ if (proxyInfo != null) {\n+ return createProxiedURLConnection(proxyInfo, putUrl);\n+ }\n+ return (HttpURLConnection) putUrl.openConnection();\n+ }\n+\n+ private static HttpURLConnection createProxiedURLConnection(ProxyInfo proxyInfo, URL putUrl) throws IOException {\n+ Objects.requireNonNull(proxyInfo);\n+ Objects.requireNonNull(putUrl);\n+ return (HttpURLConnection) putUrl.openConnection(proxyInfo.toJavaProxy());\n+ }\n+\n+ private static ProxyInfo fetchProxyInfo(XMPPConnection connection) {\n+ if (!(connection instanceof AbstractXMPPConnection)) {\n+ return null;\n+ }\n+ AbstractXMPPConnection xmppConnection = (AbstractXMPPConnection) connection;\n+ return xmppConnection.getConfiguration().getProxyInfo();\n+ }\n+\npublic static UploadService.Version namespaceToVersion(String namespace) {\nUploadService.Version version;\nswitch (namespace) {\n"
}
] | Java | Apache License 2.0 | igniterealtime/smack | Added proxy support for XEP-0363 |
299,302 | 12.10.2021 13:06:05 | 25,200 | 820adf88653e6fe3d6b1e59489379966dfbf5dee | [muc] Also process destory message if it contains <status/>
Fixes | [
{
"change_type": "MODIFY",
"old_path": "smack-extensions/src/main/java/org/jivesoftware/smackx/muc/MultiUserChat.java",
"new_path": "smack-extensions/src/main/java/org/jivesoftware/smackx/muc/MultiUserChat.java",
"diff": "@@ -259,6 +259,7 @@ public class MultiUserChat {\nlistener.left(from);\n}\n}\n+ }\nDestroy destroy = mucUser.getDestroy();\n// The room has been destroyed.\n@@ -275,7 +276,7 @@ public class MultiUserChat {\nlistener.roomDestroyed(alternateMuc, destroy.getReason());\n}\n}\n- }\n+\nif (isUserStatusModification) {\nfor (UserStatusListener listener : userStatusListeners) {\nlistener.removed(mucUser, presence);\n"
}
] | Java | Apache License 2.0 | igniterealtime/smack | [muc] Also process destory message if it contains <status/>
Fixes SMACK-915 |
299,309 | 16.10.2021 21:09:01 | -7,200 | 9b339efbc1cff33326f0284c23a3860074ae9457 | Prevent password enforcement for SASL anonymous
requirePassword from
already excludes SASL external, but missed SASL anonymous. | [
{
"change_type": "MODIFY",
"old_path": "smack-core/src/main/java/org/jivesoftware/smack/sasl/core/SASLAnonymous.java",
"new_path": "smack-core/src/main/java/org/jivesoftware/smack/sasl/core/SASLAnonymous.java",
"diff": "@@ -60,4 +60,8 @@ public class SASLAnonymous extends SASLMechanism {\n// SASL Anonymous is always successful :)\n}\n+ @Override\n+ public boolean requiresPassword() {\n+ return false;\n+ }\n}\n"
}
] | Java | Apache License 2.0 | igniterealtime/smack | Prevent password enforcement for SASL anonymous
requirePassword from 92f4aadfdc45c144763c2e2a1921c2fa9a6db90b
already excludes SASL external, but missed SASL anonymous. |
299,309 | 16.10.2021 21:22:42 | -7,200 | 8074ddd60a0abe77ea257af4a113e558e69a8c8f | Fix BOSH connection establishment
AbstractXMPPConnection waits for the flag lastFeaturesReceived since
but it is never set from
BOSH connections. Use parseFeaturesAndNotify instead of
parseFeatures to set the signal.
Similarly the XmlEnvironment is not set from bosh, but required in
ParserUtils.getXmlLang. | [
{
"change_type": "MODIFY",
"old_path": "smack-bosh/src/main/java/org/jivesoftware/smack/bosh/XMPPBOSHConnection.java",
"new_path": "smack-bosh/src/main/java/org/jivesoftware/smack/bosh/XMPPBOSHConnection.java",
"diff": "@@ -43,6 +43,7 @@ import org.jivesoftware.smack.packet.StanzaError;\nimport org.jivesoftware.smack.util.CloseableUtil;\nimport org.jivesoftware.smack.util.PacketParserUtils;\nimport org.jivesoftware.smack.xml.XmlPullParser;\n+import org.jivesoftware.smack.xml.XmlPullParserException;\nimport org.igniterealtime.jbosh.AbstractBody;\nimport org.igniterealtime.jbosh.BOSHClient;\n@@ -200,6 +201,13 @@ public class XMPPBOSHConnection extends AbstractXMPPConnection {\n+ getHost() + \":\" + getPort() + \".\";\nthrow new SmackException.SmackMessageException(errorMessage);\n}\n+\n+ try {\n+ XmlPullParser parser = PacketParserUtils.getParserFor(\"<stream:stream xmlns='jabber:client'/>\");\n+ onStreamOpen(parser);\n+ } catch (XmlPullParserException | IOException e) {\n+ throw new AssertionError(\"Failed to setup stream environment\", e);\n+ }\n}\n@Override\n@@ -511,7 +519,7 @@ public class XMPPBOSHConnection extends AbstractXMPPConnection {\nparseAndProcessStanza(parser);\nbreak;\ncase \"features\":\n- parseFeatures(parser);\n+ parseFeaturesAndNotify(parser);\nbreak;\ncase \"error\":\n// Some BOSH error isn't stream error.\n"
}
] | Java | Apache License 2.0 | igniterealtime/smack | Fix BOSH connection establishment
AbstractXMPPConnection waits for the flag lastFeaturesReceived since
57961a8cc1f2df6ecc1afa8c4f8460794d8d2dce, but it is never set from
BOSH connections. Use parseFeaturesAndNotify instead of
parseFeatures to set the signal.
Similarly the XmlEnvironment is not set from bosh, but required in
ParserUtils.getXmlLang. |
299,309 | 17.10.2021 15:57:48 | -7,200 | b675aac81b6d4a78b744dbd744baab938d782fdc | Make Smack jars OSGi bundles
Fixes by using bnd instead of the deprecated Gradle
plugin that was previously used and removed in commit | [
{
"change_type": "MODIFY",
"old_path": "build.gradle",
"new_path": "build.gradle",
"diff": "@@ -7,6 +7,7 @@ buildscript {\ndependencies {\nclasspath 'org.kordamp.gradle:clirr-gradle-plugin:0.2.2'\nclasspath \"org.kt3k.gradle.plugin:coveralls-gradle-plugin:2.3.1\"\n+ classpath \"biz.aQute.bnd:biz.aQute.bnd.gradle:6.0.0\"\n}\n}\n@@ -413,6 +414,7 @@ subprojects {\napply plugin: 'signing'\napply plugin: 'checkstyle'\napply plugin: 'org.kordamp.gradle.clirr'\n+ apply plugin: 'biz.aQute.bnd.builder'\ncheckstyle {\ntoolVersion = '8.27'\n@@ -578,6 +580,12 @@ subprojects*.jar {\nmanifest {\nfrom sharedManifest\n}\n+ bundle {\n+ bnd(\n+ '-removeheaders': 'Tool, Bnd-*',\n+ '-exportcontents': '*',\n+ )\n+ }\n}\nconfigure(subprojects - gplLicensedProjects) {\n"
},
{
"change_type": "MODIFY",
"old_path": "smack-core/build.gradle",
"new_path": "smack-core/build.gradle",
"diff": "+// Note that this is also declared in the main build.gradle for\n+// subprojects, but since evaluationDependsOnChildren is enabled we\n+// need to declare it here too to have bundle{bnd{...}} available\n+apply plugin: 'biz.aQute.bnd.builder'\n+\ndescription = \"\"\"\\\nSmack core components.\"\"\"\n@@ -55,3 +60,11 @@ task createVersionResource(type: CreateFileTask) {\n}\ncompileJava.dependsOn(createVersionResource)\n+\n+jar {\n+ bundle {\n+ bnd(\n+ 'DynamicImport-Package': '*',\n+ )\n+ }\n+}\n"
},
{
"change_type": "MODIFY",
"old_path": "smack-xmlparser-stax/build.gradle",
"new_path": "smack-xmlparser-stax/build.gradle",
"diff": "+// Note that this is also declared in the main build.gradle for\n+// subprojects, but since evaluationDependsOnChildren is enabled we\n+// need to declare it here too to have bundle{bnd{...}} available\n+apply plugin: 'biz.aQute.bnd.builder'\n+\ndescription = \"\"\"\\\nSmack XML parser using Stax.\"\"\"\n@@ -5,3 +10,13 @@ dependencies {\ncompile project(':smack-xmlparser')\n//testCompile project(path: \":smack-xmlparser\", configuration: \"testRuntime\")\n}\n+\n+jar {\n+ bundle {\n+ bnd(\n+ // see http://docs.osgi.org/specification/osgi.cmpn/7.0.0/service.loader.html\n+ 'Require-Capability': 'osgi.extender;filter:=\"(osgi.extender=osgi.serviceloader.registrar)\"',\n+ 'Provide-Capability': \"osgi.serviceloader;osgi.serviceloader=org.jivesoftware.smack.xml.XmlPullParserFactory;register:=org.jivesoftware.smack.xml.stax.StaxXmlPullParserFactory\",\n+ )\n+ }\n+}\n"
},
{
"change_type": "MODIFY",
"old_path": "smack-xmlparser-xpp3/build.gradle",
"new_path": "smack-xmlparser-xpp3/build.gradle",
"diff": "+// Note that this is also declared in the main build.gradle for\n+// subprojects, but since evaluationDependsOnChildren is enabled we\n+// need to declare it here too to have bundle{bnd{...}} available\n+apply plugin: 'biz.aQute.bnd.builder'\n+\ndescription = \"\"\"\\\nSmack XML parser using XPP3.\"\"\"\n@@ -11,3 +16,13 @@ dependencies {\napi project(':smack-xmlparser')\n//testCompile project(path: \":smack-xmlparser\", configuration: \"testRuntime\")\n}\n+\n+jar {\n+ bundle {\n+ bnd(\n+ // see http://docs.osgi.org/specification/osgi.cmpn/7.0.0/service.loader.html\n+ 'Require-Capability': 'osgi.extender;filter:=\"(osgi.extender=osgi.serviceloader.registrar)\"',\n+ 'Provide-Capability': \"osgi.serviceloader;osgi.serviceloader=org.jivesoftware.smack.xml.XmlPullParserFactory;register:=org.jivesoftware.smack.xml.xpp3.Xpp3XmlPullParserFactory\",\n+ )\n+ }\n+}\n"
},
{
"change_type": "MODIFY",
"old_path": "smack-xmlparser/build.gradle",
"new_path": "smack-xmlparser/build.gradle",
"diff": "+// Note that this is also declared in the main build.gradle for\n+// subprojects, but since evaluationDependsOnChildren is enabled we\n+// need to declare it here too to have bundle{bnd{...}} available\n+apply plugin: 'biz.aQute.bnd.builder'\n+\ndescription = \"\"\"\\\nSmack XML parser fundamentals\"\"\"\n+\n+jar {\n+ bundle {\n+ bnd(\n+ // see http://docs.osgi.org/specification/osgi.cmpn/7.0.0/service.loader.html\n+ 'Require-Capability': 'osgi.extender;filter:=\"(osgi.extender=osgi.serviceloader.processor)\"',\n+ )\n+ }\n+}\n"
}
] | Java | Apache License 2.0 | igniterealtime/smack | Make Smack jars OSGi bundles
Fixes SMACK-343 by using bnd instead of the deprecated Gradle
plugin that was previously used and removed in commit
d06f533bb975f41a5e86c990e1bb830b7e7dc923. |
299,309 | 17.10.2021 16:06:41 | -7,200 | 27ff37fa98d82203b9bf2a9e7404b5967990bf9d | Add getter for the stanza associated with the exception
Fixes | [
{
"change_type": "MODIFY",
"old_path": "smack-core/src/main/java/org/jivesoftware/smack/XMPPException.java",
"new_path": "smack-core/src/main/java/org/jivesoftware/smack/XMPPException.java",
"diff": "@@ -120,6 +120,16 @@ public abstract class XMPPException extends Exception {\nreturn error;\n}\n+ /**\n+ * Gets the stanza associated with this exception.\n+ *\n+ * @return the stanza from which this exception was created or {@code null} if the exception is not from a\n+ * stanza.\n+ */\n+ public Stanza getStanza() {\n+ return stanza;\n+ }\n+\n/**\n* Get the request which triggered the error response causing this exception.\n*\n"
}
] | Java | Apache License 2.0 | igniterealtime/smack | Add getter for the stanza associated with the exception
Fixes SMACK-916 |
299,309 | 20.10.2021 22:24:41 | -7,200 | d8ce2d335bc50d2738b6b4759b54cdedb6aa61bc | Add missing stream namespace to xml declaration
Fixes | [
{
"change_type": "MODIFY",
"old_path": "smack-bosh/src/main/java/org/jivesoftware/smack/bosh/XMPPBOSHConnection.java",
"new_path": "smack-bosh/src/main/java/org/jivesoftware/smack/bosh/XMPPBOSHConnection.java",
"diff": "@@ -203,7 +203,8 @@ public class XMPPBOSHConnection extends AbstractXMPPConnection {\n}\ntry {\n- XmlPullParser parser = PacketParserUtils.getParserFor(\"<stream:stream xmlns='jabber:client'/>\");\n+ XmlPullParser parser = PacketParserUtils.getParserFor(\n+ \"<stream:stream xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams'/>\");\nonStreamOpen(parser);\n} catch (XmlPullParserException | IOException e) {\nthrow new AssertionError(\"Failed to setup stream environment\", e);\n"
}
] | Java | Apache License 2.0 | igniterealtime/smack | Add missing stream namespace to xml declaration
Fixes 7199003f98a924f11a3cea550cbde852f215c764 |
299,286 | 24.01.2022 08:12:12 | -28,800 | 4cdb4acf260e9f9a2a16309d0942785d37a3121b | [core] Fix IQProvider javadoc
It is IqProvider that should be used instead. | [
{
"change_type": "MODIFY",
"old_path": "smack-core/src/main/java/org/jivesoftware/smack/provider/IQProvider.java",
"new_path": "smack-core/src/main/java/org/jivesoftware/smack/provider/IQProvider.java",
"diff": "@@ -29,7 +29,7 @@ import org.jivesoftware.smack.xml.XmlPullParserException;\n/**\n* <p>\n- * <b>Deprecation Notice:</b> This class is deprecated, use {@link IQProvider} instead.\n+ * <b>Deprecation Notice:</b> This class is deprecated, use {@link IqProvider} instead.\n* </p>\n* An abstract class for parsing custom IQ packets. Each IQProvider must be registered with\n* the ProviderManager class for it to be used. Every implementation of this\n"
}
] | Java | Apache License 2.0 | igniterealtime/smack | [core] Fix IQProvider javadoc
It is IqProvider that should be used instead. |
299,312 | 04.02.2022 12:29:38 | 21,600 | 67a5c3a41a285f1dbcaf97a6cd4f2580036d525b | [core] Correctly handle due time of '0' in SmackReactor
Scheduled actions that are due in 0 milliseconds are due
immediately. Otherwise we would invoke select() with 0.
Fixes | [
{
"change_type": "MODIFY",
"old_path": "smack-core/src/main/java/org/jivesoftware/smack/SmackReactor.java",
"new_path": "smack-core/src/main/java/org/jivesoftware/smack/SmackReactor.java",
"diff": "@@ -221,12 +221,11 @@ public class SmackReactor {\nselectWait = 0;\n} else {\nselectWait = nextScheduledAction.getTimeToDueMillis();\n- }\n-\n- if (selectWait < 0) {\n+ if (selectWait <= 0) {\n// A scheduled action was just released and became ready to execute.\nreturn;\n}\n+ }\n// Before we call select, we handle the pending the interest Ops. This will not block since no other\n// thread is currently in select() at this time.\n"
}
] | Java | Apache License 2.0 | igniterealtime/smack | [core] Correctly handle due time of '0' in SmackReactor
Scheduled actions that are due in 0 milliseconds are due
immediately. Otherwise we would invoke select() with 0.
Fixes SMACK-923. |
299,315 | 09.02.2022 18:32:46 | -3,600 | 1b0e19f699a7e7d4f543b482bccd6be353cd91a6 | Add custom HttpUploadExceptions for more information in case of IOExceptions | [
{
"change_type": "ADD",
"old_path": null,
"new_path": "smack-experimental/src/main/java/org/jivesoftware/smackx/httpfileupload/AbstractHttpUploadException.java",
"diff": "+/**\n+ *\n+ * Copyright 2022 Micha Kurvers\n+ *\n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * You may obtain a copy of the License at\n+ *\n+ * http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+package org.jivesoftware.smackx.httpfileupload;\n+\n+import java.io.IOException;\n+import java.net.URL;\n+\n+import org.jivesoftware.smackx.httpfileupload.element.Slot;\n+/**\n+ * An exception class to provide additional information in case of exceptions during file uploading.\n+ *\n+ */\n+public abstract class AbstractHttpUploadException extends IOException {\n+\n+ private static final long serialVersionUID = 1L;\n+ private final long fileSize;\n+ private final Slot slot;\n+\n+ protected AbstractHttpUploadException(long fileSize, Slot slot, String message) {\n+ this(fileSize, slot, message, null);\n+ }\n+\n+ protected AbstractHttpUploadException(long fileSize, Slot slot, String message, Throwable wrappedThrowable) {\n+ super(message, wrappedThrowable);\n+ this.fileSize = fileSize;\n+ this.slot = slot;\n+ }\n+\n+ public long getFileSize() {\n+ return fileSize;\n+ }\n+\n+ public URL getPutUrl() {\n+ return slot.getPutUrl();\n+ }\n+\n+ public Slot getSlot() {\n+ return slot;\n+ }\n+\n+ /**\n+ * Exception thrown when http response returned after upload is not 200.\n+ */\n+ public static class HttpUploadErrorException extends AbstractHttpUploadException {\n+\n+ private static final long serialVersionUID = 8494356028399474995L;\n+ private final int httpStatus;\n+ private final String responseMsg;\n+\n+ public HttpUploadErrorException(int httpStatus, String responseMsg, long fileSize, Slot slot) {\n+ super(fileSize, slot, \"Error response \" + httpStatus + \" from server during file upload: \"\n+ + responseMsg + \", file size: \" + fileSize + \", put URL: \"\n+ + slot.getPutUrl());\n+ this.httpStatus = httpStatus;\n+ this.responseMsg = responseMsg;\n+ }\n+\n+ public int getHttpStatus() {\n+ return httpStatus;\n+ }\n+\n+ public String getResponseMsg() {\n+ return responseMsg;\n+ }\n+\n+ }\n+\n+ /**\n+ * Exception thrown when an unexpected exception occurred during the upload.\n+ */\n+ public static class HttpUploadIOException extends AbstractHttpUploadException {\n+\n+ private static final long serialVersionUID = 5940866318073349451L;\n+ private final IOException wrappedIOException;\n+\n+ public HttpUploadIOException(long fileSize, Slot slot, IOException cause) {\n+ super(fileSize, slot, \"Unexpected error occurred during file upload, file size: \" + fileSize\n+ + \", put Url: \" + slot.getPutUrl(), cause);\n+ this.wrappedIOException = cause;\n+ }\n+\n+ public IOException getCausingIOException() {\n+ return this.wrappedIOException;\n+ }\n+\n+ }\n+}\n"
},
{
"change_type": "MODIFY",
"old_path": "smack-experimental/src/main/java/org/jivesoftware/smackx/httpfileupload/HttpFileUploadManager.java",
"new_path": "smack-experimental/src/main/java/org/jivesoftware/smackx/httpfileupload/HttpFileUploadManager.java",
"diff": "@@ -49,6 +49,8 @@ import org.jivesoftware.smack.proxy.ProxyInfo;\nimport org.jivesoftware.smackx.disco.ServiceDiscoveryManager;\nimport org.jivesoftware.smackx.disco.packet.DiscoverInfo;\n+import org.jivesoftware.smackx.httpfileupload.AbstractHttpUploadException.HttpUploadErrorException;\n+import org.jivesoftware.smackx.httpfileupload.AbstractHttpUploadException.HttpUploadIOException;\nimport org.jivesoftware.smackx.httpfileupload.UploadService.Version;\nimport org.jivesoftware.smackx.httpfileupload.element.Slot;\nimport org.jivesoftware.smackx.httpfileupload.element.SlotRequest;\n@@ -494,11 +496,12 @@ public final class HttpFileUploadManager extends Manager {\ncase HttpURLConnection.HTTP_NO_CONTENT:\nbreak;\ndefault:\n- throw new IOException(\"Error response \" + status + \" from server during file upload: \"\n- + urlConnection.getResponseMessage() + \", file size: \" + fileSize + \", put URL: \"\n- + putUrl);\n+ throw new HttpUploadErrorException(status, urlConnection.getResponseMessage(), fileSize, slot);\n}\n}\n+ catch (IOException e) {\n+ throw new HttpUploadIOException(fileSize, slot, e);\n+ }\nfinally {\nurlConnection.disconnect();\n}\n"
}
] | Java | Apache License 2.0 | igniterealtime/smack | Add custom HttpUploadExceptions for more information in case of IOExceptions |
299,285 | 07.02.2022 14:36:45 | -3,600 | aafc24a96669d51cb5e3ac9968b5690e8ed73d78 | Conditionally reduce severity of roster reload error logging
If the roster feature is not supported by the server, there's no need to
log this at SEVERE log level. | [
{
"change_type": "MODIFY",
"old_path": "smack-im/src/main/java/org/jivesoftware/smack/roster/Roster.java",
"new_path": "smack-im/src/main/java/org/jivesoftware/smack/roster/Roster.java",
"diff": "@@ -469,11 +469,14 @@ public final class Roster extends Manager {\n@Override\npublic void processException(Exception exception) {\nrosterState = RosterState.uninitialized;\n- Level logLevel;\n+ Level logLevel = Level.SEVERE;\nif (exception instanceof NotConnectedException) {\nlogLevel = Level.FINE;\n- } else {\n- logLevel = Level.SEVERE;\n+ } else if (exception instanceof XMPPErrorException) {\n+ Condition condition = ((XMPPErrorException) exception).getStanzaError().getCondition();\n+ if (condition == Condition.feature_not_implemented || condition == Condition.service_unavailable) {\n+ logLevel = Level.FINE;\n+ }\n}\nLOGGER.log(logLevel, \"Exception reloading roster\", exception);\nfor (RosterLoadedListener listener : rosterLoadedListeners) {\n"
}
] | Java | Apache License 2.0 | igniterealtime/smack | Conditionally reduce severity of roster reload error logging
If the roster feature is not supported by the server, there's no need to
log this at SEVERE log level. |
299,286 | 13.02.2022 15:58:37 | -28,800 | 4d026d8ae84819184a8cad93f65630fe6e2dca8c | [jingle] Add element and text to JingleReason's XML | [
{
"change_type": "MODIFY",
"old_path": "smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/element/JingleReason.java",
"new_path": "smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/element/JingleReason.java",
"diff": "@@ -35,6 +35,7 @@ public class JingleReason implements FullyQualifiedElement {\npublic static final String ELEMENT = \"reason\";\npublic static final String NAMESPACE = Jingle.NAMESPACE;\n+ public static final String TEXT_ELEMENT = \"text\";\npublic static AlternativeSession AlternativeSession(String sessionId) {\nreturn new AlternativeSession(sessionId);\n@@ -142,7 +143,7 @@ public class JingleReason implements FullyQualifiedElement {\n/**\n* An optional element that provides more detailed machine-readable information about the reason for the action.\n*\n- * @return an elemnet with machine-readable information about this reason or <code>null</code>.\n+ * @return an element with machine-readable information about this reason or <code>null</code>.\n* @since 4.4.5\n*/\npublic ExtensionElement getElement() {\n@@ -155,6 +156,8 @@ public class JingleReason implements FullyQualifiedElement {\nxml.rightAngleBracket();\nxml.emptyElement(reason);\n+ xml.optElement(TEXT_ELEMENT, text);\n+ xml.optAppend(element);\nxml.closeElement(this);\nreturn xml;\n"
}
] | Java | Apache License 2.0 | igniterealtime/smack | [jingle] Add element and text to JingleReason's XML |
299,302 | 18.05.2022 08:08:47 | 18,000 | d0db485c2496c8889d174da386621b523c876080 | fix: Bosh configuration when bosh URI contains IP address. | [
{
"change_type": "MODIFY",
"old_path": "smack-bosh/src/main/java/org/jivesoftware/smack/bosh/BOSHConfiguration.java",
"new_path": "smack-bosh/src/main/java/org/jivesoftware/smack/bosh/BOSHConfiguration.java",
"diff": "@@ -77,7 +77,9 @@ public final class BOSHConfiguration extends ConnectionConfiguration {\n}\npublic URI getURI() throws URISyntaxException {\n- return new URI((https ? \"https://\" : \"http://\") + this.host + \":\" + this.port + file);\n+ return new URI((https ? \"https://\" : \"http://\")\n+ + (this.host != null ? this.host : this.hostAddress)\n+ + \":\" + this.port + file);\n}\npublic Map<String, String> getHttpHeaders() {\n"
}
] | Java | Apache License 2.0 | igniterealtime/smack | fix: Bosh configuration when bosh URI contains IP address. |
299,300 | 30.08.2022 07:05:16 | 0 | fbd576129681fe8eb75367c30470bba401801263 | [muc] Fix removal of the MUC's main presence interceptor
On dinamically remove the last existed presence interceptor
we also should to remove the MUC's main presence interceptor from the connection.
Fixes: ("[muc] Fix Presence interceptors") | [
{
"change_type": "MODIFY",
"old_path": "smack-extensions/src/main/java/org/jivesoftware/smackx/muc/MultiUserChat.java",
"new_path": "smack-extensions/src/main/java/org/jivesoftware/smackx/muc/MultiUserChat.java",
"diff": "@@ -1133,7 +1133,7 @@ public class MultiUserChat {\nif (!removed) return;\nint currentCount = presenceInterceptorCount.decrementAndGet();\nif (currentCount == 0) {\n- connection.removePresenceInterceptor(presenceInterceptor);\n+ connection.removePresenceInterceptor(this.presenceInterceptor);\n}\n}\n"
}
] | Java | Apache License 2.0 | igniterealtime/smack | [muc] Fix removal of the MUC's main presence interceptor
On dinamically remove the last existed presence interceptor
we also should to remove the MUC's main presence interceptor from the connection.
Fixes: 60fee7b ("[muc] Fix Presence interceptors") |
532,331 | 28.01.2020 12:35:56 | 18,000 | 5bde25d5b583fbad6059bc8f3a7ae2290c8da23a | Fixes stuck Go-routine
Fixes
Credit goes to | [
{
"change_type": "MODIFY",
"old_path": "websocket.go",
"new_path": "websocket.go",
"diff": "@@ -187,17 +187,13 @@ func (rt *Router) routeWebsocket(w http.ResponseWriter, r *http.Request, ps http\n// Listen for different events emitted by the server and respond to them appropriately.\ngo func() {\n- for {\n- select {\n- case d := <-eventChannel:\n+ for d := range eventChannel {\nhandler.SendJson(&WebsocketMessage{\nEvent: d.Topic,\nArgs: []string{d.Data},\n})\n}\n- }\n}()\n-\n// Sit here and check the time to expiration on the JWT every 30 seconds until\n// the token has expired. If we are within 3 minutes of the token expiring, send\n// a notice over the socket that it is expiring soon. If it has expired, send that\n"
}
] | Go | MIT License | pterodactyl/wings | Fixes stuck Go-routine
Fixes https://github.com/pterodactyl/panel/issues/1816
Credit goes to https://github.com/matthewpi |
532,310 | 12.04.2020 17:07:41 | 14,400 | fd28db4a689fb2df89d868576c689498689bc22f | alpine specific changes
This resolves issues on alpine where lsb_release doesn't exist.
Also correct the addgroup command | [
{
"change_type": "MODIFY",
"old_path": "config/config.go",
"new_path": "config/config.go",
"diff": "@@ -67,7 +67,7 @@ type Configuration struct {\n// The amount of time that should lapse between data output throttle\n// checks. This should be defined in milliseconds.\n- CheckInterval int `defauly:\"100\" yaml:\"check_interval\"`\n+ CheckInterval int `default:\"100\" yaml:\"check_interval\"`\n}\n// The location where the panel is running that this daemon should connect to\n@@ -302,7 +302,7 @@ func (c *Configuration) EnsurePterodactylUser() (*user.User, error) {\n// We have to create the group first on Alpine, so do that here before continuing on\n// to the user creation process.\n- if _, err := exec.Command(\"addgroup\", \"-s\", c.System.Username).Output(); err != nil {\n+ if _, err := exec.Command(\"addgroup\", \"-S\", c.System.Username).Output(); err != nil {\nreturn nil, err\n}\n}\n@@ -365,7 +365,7 @@ func (c *Configuration) EnsureFilePermissions() error {\n// the item is not a folder, or is not a folder that matches the expected UUIDv4 format\n// skip over it.\n//\n- // If we do have a positive match, run a chown aganist the directory.\n+ // If we do have a positive match, run a chown against the directory.\ngo func(f os.FileInfo) {\ndefer wg.Done()\n@@ -416,6 +416,10 @@ func (c *Configuration) WriteToDisk() error {\n// Gets the system release name.\nfunc getSystemName() (string, error) {\n+ // alpine doesn't have lsb_release\n+ _, err := os.Stat(\"/etc/alpine-release\")\n+ if os.IsNotExist(err) {\n+ // if the alpine release file doesn't exist. run lsb_release\ncmd := exec.Command(\"lsb_release\", \"-is\")\nb, err := cmd.Output()\n@@ -424,4 +428,8 @@ func getSystemName() (string, error) {\n}\nreturn string(b), nil\n+ } else {\n+ // if the alpine release file does exist return string\n+ return \"Alpine\", err\n+ }\n}\n"
}
] | Go | MIT License | pterodactyl/wings | alpine specific changes
This resolves issues on alpine where lsb_release doesn't exist.
Also correct the addgroup command |
532,310 | 13.04.2020 13:12:49 | 14,400 | 12c97c41b0f0354cec29585dc09c3c701b2eac75 | fixes distro matching
Adds osrelease to get distro name | [
{
"change_type": "MODIFY",
"old_path": "config/config.go",
"new_path": "config/config.go",
"diff": "@@ -2,6 +2,7 @@ package config\nimport (\n\"fmt\"\n+ \"github.com/cobaugh/osrelease\"\n\"github.com/creasty/defaults\"\n\"github.com/gbrlsnchs/jwt/v3\"\n\"go.uber.org/zap\"\n@@ -294,7 +295,7 @@ func (c *Configuration) EnsurePterodactylUser() (*user.User, error) {\n// Alpine Linux is the only OS we currently support that doesn't work with the useradd command, so\n// in those cases we just modify the command a bit to work as expected.\n- if strings.HasPrefix(sysName, \"Alpine\") {\n+ if strings.HasPrefix(sysName, \"alpine\") {\ncommand = fmt.Sprintf(\"adduser -S -D -H -G %[1]s -s /bin/false %[1]s\", c.System.Username)\n// We have to create the group first on Alpine, so do that here before continuing on\n@@ -413,20 +414,10 @@ func (c *Configuration) WriteToDisk() error {\n// Gets the system release name.\nfunc getSystemName() (string, error) {\n- // alpine doesn't have lsb_release\n- _, err := os.Stat(\"/etc/alpine-release\")\n- if os.IsNotExist(err) {\n- // if the alpine release file doesn't exist. run lsb_release\n- cmd := exec.Command(\"lsb_release\", \"-is\")\n-\n- b, err := cmd.Output()\n- if err != nil {\n+ // use osrelease to get release version and ID\n+ if release, err := osrelease.Read(); err != nil {\nreturn \"\", err\n- }\n-\n- return string(b), nil\n} else {\n- // if the alpine release file does exist return string\n- return \"Alpine\", err\n+ return release[\"ID\"], nil\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "go.mod",
"new_path": "go.mod",
"diff": "@@ -19,6 +19,7 @@ require (\ngithub.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a\ngithub.com/beevik/etree v1.1.0\ngithub.com/buger/jsonparser v0.0.0-20191204142016-1a29609e0929\n+ github.com/cobaugh/osrelease v0.0.0-20181218015638-a93a0a55a249\ngithub.com/containerd/fifo v0.0.0-20190226154929-a9fb20d87448 // indirect\ngithub.com/creasty/defaults v1.3.0\ngithub.com/docker/distribution v2.7.1+incompatible // indirect\n"
},
{
"change_type": "MODIFY",
"old_path": "go.sum",
"new_path": "go.sum",
"diff": "@@ -29,6 +29,8 @@ github.com/buger/jsonparser v0.0.0-20191204142016-1a29609e0929 h1:MW/JDk68Rny52y\ngithub.com/buger/jsonparser v0.0.0-20191204142016-1a29609e0929/go.mod h1:tgcrVJ81GPSF0mz+0nu1Xaz0fazGPrmmJfJtxjbHhUQ=\ngithub.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc=\ngithub.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=\n+github.com/cobaugh/osrelease v0.0.0-20181218015638-a93a0a55a249 h1:R0IDH8daQ3lODvu8YtxnIqqth5qMGCJyADoUQvmLx4o=\n+github.com/cobaugh/osrelease v0.0.0-20181218015638-a93a0a55a249/go.mod h1:EHKW9yNEYSBpTKzuu7Y9oOrft/UlzH57rMIB03oev6M=\ngithub.com/containerd/fifo v0.0.0-20190226154929-a9fb20d87448 h1:PUD50EuOMkXVcpBIA/R95d56duJR9VxhwncsFbNnxW4=\ngithub.com/containerd/fifo v0.0.0-20190226154929-a9fb20d87448/go.mod h1:ODA38xgv3Kuk8dQz2ZQXpnv/UZZUHUCL7pnLehbXgQI=\ngithub.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk=\n"
}
] | Go | MIT License | pterodactyl/wings | fixes distro matching
Adds osrelease to get distro name |
532,310 | 13.04.2020 18:16:44 | 14,400 | 65102966a1be407d78a4ca718c09fd3d521e7291 | add data folder on startup
Instead of making users create the data folder create it for them on startup if it doesn't exist. | [
{
"change_type": "MODIFY",
"old_path": "config/config.go",
"new_path": "config/config.go",
"diff": "@@ -344,6 +344,28 @@ func (c *Configuration) EnsureFilePermissions() error {\nr := regexp.MustCompile(\"^[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}$\")\n+ // add trailing slash on data directory is no trailing slash exists\n+ if ! strings.HasSuffix(c.System.Data, \"/\") {\n+ c.System.Data = c.System.Data + \"/\"\n+ }\n+\n+ // create the daemon-data dir if it doesn't exist\n+ p, file := path.Split(c.System.Data)\n+\n+ if _, err := os.Stat(c.System.Data); err != nil {\n+ // if file doesn't exist\n+ if os.IsNotExist(err) {\n+ //\n+ if _, err = os.Stat(c.System.Data); err != nil {\n+ if file == \"\" {\n+ if err = os.Mkdir(p, 0755); err != nil {\n+ }\n+ zap.S().Debugf(\"created %s folder\", c.System.Data)\n+ }\n+ }\n+ }\n+ }\n+\nfiles, err := ioutil.ReadDir(c.System.Data)\nif err != nil {\nreturn err\n"
}
] | Go | MIT License | pterodactyl/wings | add data folder on startup
Instead of making users create the data folder create it for them on startup if it doesn't exist. |
532,310 | 14.04.2020 00:03:16 | 14,400 | df9c4835c41b41b4d151deca4900c345c2011031 | fix folder adding
Sorry dane I missed that I nested those. | [
{
"change_type": "MODIFY",
"old_path": "config/config.go",
"new_path": "config/config.go",
"diff": "@@ -350,21 +350,17 @@ func (c *Configuration) EnsureFilePermissions() error {\n}\n// create the daemon-data dir if it doesn't exist\n- p, file := path.Split(c.System.Data)\n+ p, _ := path.Split(c.System.Data)\nif _, err := os.Stat(c.System.Data); err != nil {\n// if file doesn't exist\nif os.IsNotExist(err) {\n//\n- if _, err = os.Stat(c.System.Data); err != nil {\n- if file == \"\" {\nif err = os.Mkdir(p, 0755); err != nil {\n}\nzap.S().Debugf(\"created %s folder\", c.System.Data)\n}\n}\n- }\n- }\nfiles, err := ioutil.ReadDir(c.System.Data)\nif err != nil {\n"
}
] | Go | MIT License | pterodactyl/wings | fix folder adding
Sorry dane I missed that I nested those. |
532,310 | 14.04.2020 22:06:19 | 14,400 | 9c5855663c701832726f6a59ebdf2257a84c56a9 | return errors
Actually return errors for stat and mkdir. | [
{
"change_type": "MODIFY",
"old_path": "config/config.go",
"new_path": "config/config.go",
"diff": "@@ -357,7 +357,12 @@ func (c *Configuration) EnsureFilePermissions() error {\nif os.IsNotExist(err) {\n//\nif err = os.Mkdir(p, 0755); err != nil {\n+ // of we can't make the directory return error\n+ return err\n}\n+ } else {\n+ // if the error is anything but IsNotExist\n+ return err\n}\n}\n"
}
] | Go | MIT License | pterodactyl/wings | return errors
Actually return errors for stat and mkdir. |
532,310 | 18.04.2020 15:23:56 | 14,400 | a60e261a49dee257cd545b2ce18d1e4073b1e073 | fixes tmp dir building
adds a / to the tmp directory | [
{
"change_type": "MODIFY",
"old_path": "server/install.go",
"new_path": "server/install.go",
"diff": "@@ -131,7 +131,7 @@ func (ip *InstallationProcess) Run() error {\n// Writes the installation script to a temporary file on the host machine so that it\n// can be properly mounted into the installation container and then executed.\nfunc (ip *InstallationProcess) writeScriptToDisk() (string, error) {\n- d, err := ioutil.TempDir(\"\", \"pterodactyl\")\n+ d, err := ioutil.TempDir(\"\", \"pterodactyl/\")\nif err != nil {\nreturn \"\", errors.WithStack(err)\n}\n"
}
] | Go | MIT License | pterodactyl/wings | fixes tmp dir building
adds a / to the tmp directory |
532,310 | 19.04.2020 22:35:05 | 14,400 | 377cae4d4807245ebd762964d639616079e98a71 | Add docker files
Add Dockerfile
Add docker-compose.yml | [
{
"change_type": "ADD",
"old_path": null,
"new_path": "Dockerfile",
"diff": "+# ----------------------------------\n+# Pterodactyl Panel Dockerfile\n+# ----------------------------------\n+\n+FROM golang:1.14-alpine\n+COPY . /go/wings/\n+WORKDIR /go/wings/\n+RUN go build\n+\n+FROM alpine:latest\n+COPY --from=0 /go/wings/wings /usr/bin/\n+CMD [\"wings\",\"--config\", \"/srv/daemon/config.yml\"]\n\\ No newline at end of file\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "docker-compose.example.yml",
"diff": "+version: '3'\n+services:\n+ daemon:\n+ build: .\n+ restart: always\n+ hostname: daemon\n+ ports:\n+ - \"8080:8080\"\n+ - \"2022:2022\"\n+ tty: true\n+ environment:\n+ - \"DEBUG=false\"\n+ volumes:\n+ - \"/var/run/docker.sock:/var/run/docker.sock\"\n+ - \"/var/lib/docker/containers:/var/lib/docker/containers\"\n+ - \"/srv/daemon/:/srv/daemon/\"\n+ - \"/srv/daemon-data/:/srv/daemon-data/\"\n+ - \"/tmp/pterodactyl/:/tmp/pterodactyl/\"\n+ - \"/etc/timezone:/etc/timezone:ro\"\n+ ## Required for ssl if you user let's encrypt. uncomment to use.\n+ ## - \"/etc/letsencrypt/:/etc/letsencrypt/\"\n+networks:\n+ default:\n+ ipam:\n+ config:\n+ - subnet: 172.21.0.0/16\n"
}
] | Go | MIT License | pterodactyl/wings | Add docker files
Add Dockerfile
Add docker-compose.yml |
532,310 | 19.04.2020 22:36:34 | 14,400 | 00ed6f3985dddb3e8e17c1f10111a2f24b44f65b | update for new defaults. | [
{
"change_type": "MODIFY",
"old_path": "Dockerfile",
"new_path": "Dockerfile",
"diff": "@@ -9,4 +9,4 @@ RUN go build\nFROM alpine:latest\nCOPY --from=0 /go/wings/wings /usr/bin/\n-CMD [\"wings\",\"--config\", \"/srv/daemon/config.yml\"]\n\\ No newline at end of file\n+CMD [\"wings\",\"--config\", \"/var/lib/pterodactyl/config.yml\"]\n\\ No newline at end of file\n"
},
{
"change_type": "MODIFY",
"old_path": "docker-compose.example.yml",
"new_path": "docker-compose.example.yml",
"diff": "@@ -13,7 +13,7 @@ services:\nvolumes:\n- \"/var/run/docker.sock:/var/run/docker.sock\"\n- \"/var/lib/docker/containers:/var/lib/docker/containers\"\n- - \"/srv/daemon/:/srv/daemon/\"\n+ - \"/var/lib/pterodactyl/:/var/lib/pterodactyl/\"\n- \"/srv/daemon-data/:/srv/daemon-data/\"\n- \"/tmp/pterodactyl/:/tmp/pterodactyl/\"\n- \"/etc/timezone:/etc/timezone:ro\"\n"
}
] | Go | MIT License | pterodactyl/wings | update for new defaults. |
532,310 | 25.04.2020 22:38:18 | 14,400 | 12d43a9f491f159efc1cb06c65679b786cd7a397 | add trailing /
add trailing to signify a folder. | [
{
"change_type": "MODIFY",
"old_path": "docker-compose.example.yml",
"new_path": "docker-compose.example.yml",
"diff": "@@ -12,7 +12,7 @@ services:\n- \"DEBUG=false\"\nvolumes:\n- \"/var/run/docker.sock:/var/run/docker.sock\"\n- - \"/var/lib/docker/containers:/var/lib/docker/containers\"\n+ - \"/var/lib/docker/containers/:/var/lib/docker/containers/\"\n- \"/var/lib/pterodactyl/:/var/lib/pterodactyl/\"\n- \"/srv/daemon-data/:/srv/daemon-data/\"\n- \"/tmp/pterodactyl/:/tmp/pterodactyl/\"\n"
}
] | Go | MIT License | pterodactyl/wings | add trailing /
add trailing to signify a folder. |
532,310 | 26.04.2020 18:12:01 | 14,400 | 2828eaed32968523d136b1942e56526f7d8bbdce | update dockerfile
add build flags
add upx for application compression | [
{
"change_type": "MODIFY",
"old_path": "Dockerfile",
"new_path": "Dockerfile",
"diff": "FROM golang:1.14-alpine\nCOPY . /go/wings/\nWORKDIR /go/wings/\n-RUN go build\n+RUN apk add --no-cache upx \\\n+ && go build -ldflags=\"-s -w\" \\\n+ && upx --brute wings\nFROM alpine:latest\nCOPY --from=0 /go/wings/wings /usr/bin/\n"
}
] | Go | MIT License | pterodactyl/wings | update dockerfile
add build flags
add upx for application compression |
532,329 | 10.05.2020 03:29:56 | -7,200 | cfca0d7f070e63adb9fd2c0e2299783f3955c200 | Added network option to docker configuration | [
{
"change_type": "MODIFY",
"old_path": "config/config_docker.go",
"new_path": "config/config_docker.go",
"diff": "@@ -26,6 +26,7 @@ type DockerNetworkConfiguration struct {\nName string `default:\"pterodactyl_nw\"`\nISPN bool `default:\"false\" yaml:\"ispn\"`\nDriver string `default:\"bridge\"`\n+ Mode string `default:\"pterodactyl_nw\" yaml:\"network_mode\"`\nIsInternal bool `default:\"false\" yaml:\"is_internal\"`\nEnableICC bool `default:\"true\" yaml:\"enable_icc\"`\nInterfaces dockerNetworkInterfaces `yaml:\"interfaces\"`\n"
},
{
"change_type": "MODIFY",
"old_path": "server/environment_docker.go",
"new_path": "server/environment_docker.go",
"diff": "@@ -665,7 +665,7 @@ func (d *DockerEnvironment) Create() error {\n\"setpcap\", \"mknod\", \"audit_write\", \"net_raw\", \"dac_override\",\n\"fowner\", \"fsetid\", \"net_bind_service\", \"sys_chroot\", \"setfcap\",\n},\n- NetworkMode: \"pterodactyl_nw\",\n+ NetworkMode: container.NetworkMode(config.Get().Docker.Network.Mode),\n}\nif _, err := cli.ContainerCreate(ctx, conf, hostConf, nil, d.Server.Uuid); err != nil {\n"
}
] | Go | MIT License | pterodactyl/wings | Added network option to docker configuration |
532,330 | 29.05.2020 17:44:49 | -7,200 | 359564bd9174c312d2adbd04e9d16901295638b3 | fix BindJSON calls | [
{
"change_type": "MODIFY",
"old_path": "router/router_server.go",
"new_path": "router/router_server.go",
"diff": "@@ -46,7 +46,10 @@ func postServerPower(c *gin.Context) {\ns := GetServer(c.Param(\"server\"))\nvar data server.PowerAction\n- c.BindJSON(&data)\n+ // BindJSON sends 400 if the request fails, all we need to do is return\n+ if err := c.BindJSON(&data); err != nil {\n+ return\n+ }\nif !data.IsValid() {\nc.AbortWithStatusJSON(http.StatusUnprocessableEntity, gin.H{\n@@ -98,8 +101,13 @@ func postServerCommands(c *gin.Context) {\nreturn\n}\n- var data struct{ Commands []string `json:\"commands\"` }\n- c.BindJSON(&data)\n+ var data struct {\n+ Commands []string `json:\"commands\"`\n+ }\n+ // BindJSON sends 400 if the request fails, all we need to do is return\n+ if err := c.BindJSON(&data); err != nil {\n+ return\n+ }\nfor _, command := range data.Commands {\nif err := s.Environment.SendCommand(command); err != nil {\n"
},
{
"change_type": "MODIFY",
"old_path": "router/router_server_backup.go",
"new_path": "router/router_server_backup.go",
"diff": "@@ -15,7 +15,10 @@ func postServerBackup(c *gin.Context) {\ns := GetServer(c.Param(\"server\"))\ndata := &backup.Request{}\n- c.BindJSON(&data)\n+ // BindJSON sends 400 if the request fails, all we need to do is return\n+ if err := c.BindJSON(&data); err != nil {\n+ return\n+ }\nvar adapter backup.BackupInterface\nvar err error\n@@ -41,7 +44,6 @@ func postServerBackup(c *gin.Context) {\n}\n}(adapter, s)\n-\nc.Status(http.StatusAccepted)\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "router/router_server_files.go",
"new_path": "router/router_server_files.go",
"diff": "@@ -89,7 +89,10 @@ func putServerRenameFile(c *gin.Context) {\nRenameFrom string `json:\"rename_from\"`\nRenameTo string `json:\"rename_to\"`\n}\n- c.BindJSON(&data)\n+ // BindJSON sends 400 if the request fails, all we need to do is return\n+ if err := c.BindJSON(&data); err != nil {\n+ return\n+ }\nif data.RenameFrom == \"\" || data.RenameTo == \"\" {\nc.AbortWithStatusJSON(http.StatusUnprocessableEntity, gin.H{\n@@ -113,7 +116,10 @@ func postServerCopyFile(c *gin.Context) {\nvar data struct {\nLocation string `json:\"location\"`\n}\n- c.BindJSON(&data)\n+ // BindJSON sends 400 if the request fails, all we need to do is return\n+ if err := c.BindJSON(&data); err != nil {\n+ return\n+ }\nif err := s.Filesystem.Copy(data.Location); err != nil {\nTrackedServerError(err, s).AbortWithServerError(c)\n@@ -130,7 +136,10 @@ func postServerDeleteFile(c *gin.Context) {\nvar data struct {\nLocation string `json:\"location\"`\n}\n- c.BindJSON(&data)\n+ // BindJSON sends 400 if the request fails, all we need to do is return\n+ if err := c.BindJSON(&data); err != nil {\n+ return\n+ }\nif err := s.Filesystem.Delete(data.Location); err != nil {\nTrackedServerError(err, s).AbortWithServerError(c)\n@@ -167,7 +176,10 @@ func postServerCreateDirectory(c *gin.Context) {\nName string `json:\"name\"`\nPath string `json:\"path\"`\n}\n- c.BindJSON(&data)\n+ // BindJSON sends 400 if the request fails, all we need to do is return\n+ if err := c.BindJSON(&data); err != nil {\n+ return\n+ }\nif err := s.Filesystem.CreateDirectory(data.Name, data.Path); err != nil {\nTrackedServerError(err, s).AbortWithServerError(c)\n"
},
{
"change_type": "MODIFY",
"old_path": "router/router_system.go",
"new_path": "router/router_system.go",
"diff": "@@ -77,7 +77,10 @@ func postUpdateConfiguration(c *gin.Context) {\n// A copy of the configuration we're using to bind the data recevied into.\ncfg := *config.Get()\n- c.BindJSON(&cfg)\n+ // BindJSON sends 400 if the request fails, all we need to do is return\n+ if err := c.BindJSON(&cfg); err != nil {\n+ return\n+ }\nconfig.Set(&cfg)\nif err := config.Get().WriteToDisk(); err != nil {\n"
}
] | Go | MIT License | pterodactyl/wings | #2078 - fix BindJSON calls |
532,336 | 04.07.2020 20:57:48 | 0 | c5f4c3cfcbc5d7393f6dae6efe3b2bee4d0e284b | update github.com/docker/docker | [
{
"change_type": "MODIFY",
"old_path": "go.mod",
"new_path": "go.mod",
"diff": "@@ -22,11 +22,14 @@ require (\ngithub.com/beevik/etree v1.1.0\ngithub.com/buger/jsonparser v0.0.0-20191204142016-1a29609e0929\ngithub.com/cobaugh/osrelease v0.0.0-20181218015638-a93a0a55a249\n+ github.com/containerd/containerd v1.3.6 // indirect\ngithub.com/containerd/fifo v0.0.0-20190226154929-a9fb20d87448 // indirect\ngithub.com/creasty/defaults v1.3.0\n+ github.com/docker/cli v17.12.1-ce-rc2+incompatible\ngithub.com/docker/distribution v2.7.1+incompatible // indirect\n- github.com/docker/docker v0.0.0-20180422163414-57142e89befe\n+ github.com/docker/docker v17.12.0-ce-rc1.0.20200618181300-9dc6525e6118+incompatible\ngithub.com/docker/go-connections v0.4.0\n+ github.com/docker/go-metrics v0.0.1 // indirect\ngithub.com/docker/go-units v0.3.3 // indirect\ngithub.com/fatih/color v1.9.0\ngithub.com/gabriel-vasile/mimetype v0.1.4\n@@ -49,6 +52,7 @@ require (\ngithub.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db\ngithub.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect\ngithub.com/modern-go/reflect2 v1.0.1 // indirect\n+ github.com/morikuni/aec v1.0.0 // indirect\ngithub.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e // indirect\ngithub.com/opencontainers/go-digest v1.0.0-rc1 // indirect\ngithub.com/opencontainers/image-spec v1.0.1 // indirect\n"
},
{
"change_type": "MODIFY",
"old_path": "go.sum",
"new_path": "go.sum",
"diff": "@@ -35,12 +35,16 @@ github.com/beevik/etree v1.1.0 h1:T0xke/WvNtMoCqgzPhkX2r4rjY3GDZFi+FjpRZY2Jbs=\ngithub.com/beevik/etree v1.1.0/go.mod h1:r8Aw8JqVegEf0w2fDnATrX9VpkMcyFeM0FhwO62wh+A=\ngithub.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=\ngithub.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=\n+github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=\n+github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=\ngithub.com/buger/jsonparser v0.0.0-20191204142016-1a29609e0929 h1:MW/JDk68Rny52yI0M0N+P8lySNgB+NhpI/uAmhgOhUM=\ngithub.com/buger/jsonparser v0.0.0-20191204142016-1a29609e0929/go.mod h1:tgcrVJ81GPSF0mz+0nu1Xaz0fazGPrmmJfJtxjbHhUQ=\ngithub.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc=\ngithub.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=\ngithub.com/cobaugh/osrelease v0.0.0-20181218015638-a93a0a55a249 h1:R0IDH8daQ3lODvu8YtxnIqqth5qMGCJyADoUQvmLx4o=\ngithub.com/cobaugh/osrelease v0.0.0-20181218015638-a93a0a55a249/go.mod h1:EHKW9yNEYSBpTKzuu7Y9oOrft/UlzH57rMIB03oev6M=\n+github.com/containerd/containerd v1.3.6 h1:SMfcKoQyWhaRsYq7290ioC6XFcHDNcHvcEMjF6ORpac=\n+github.com/containerd/containerd v1.3.6/go.mod h1:bC6axHOhabU15QhwfG7w5PipXdVtMXFTttgp+kVtyUA=\ngithub.com/containerd/fifo v0.0.0-20190226154929-a9fb20d87448 h1:PUD50EuOMkXVcpBIA/R95d56duJR9VxhwncsFbNnxW4=\ngithub.com/containerd/fifo v0.0.0-20190226154929-a9fb20d87448/go.mod h1:ODA38xgv3Kuk8dQz2ZQXpnv/UZZUHUCL7pnLehbXgQI=\ngithub.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk=\n@@ -56,12 +60,19 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c\ngithub.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=\ngithub.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=\ngithub.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no=\n+github.com/docker/cli v17.12.1-ce-rc2+incompatible h1:ESUycEAqvFuLglAHkUW66rCc2djYtd3i1x231svLq9o=\n+github.com/docker/cli v17.12.1-ce-rc2+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8=\ngithub.com/docker/distribution v2.7.1+incompatible h1:a5mlkVzth6W5A4fOsS3D2EO5BUmsJpcB+cRlLU7cSug=\ngithub.com/docker/distribution v2.7.1+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w=\ngithub.com/docker/docker v0.0.0-20180422163414-57142e89befe h1:VW8TnWi0CZgg7oCv0wH6evNwkzcJg/emnw4HrVIWws4=\ngithub.com/docker/docker v0.0.0-20180422163414-57142e89befe/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=\n+github.com/docker/docker v1.13.1 h1:IkZjBSIc8hBjLpqeAbeE5mca5mNgeatLHBy3GO78BWo=\n+github.com/docker/docker v17.12.0-ce-rc1.0.20200618181300-9dc6525e6118+incompatible h1:iWPIG7pWIsCwT6ZtHnTUpoVMnete7O/pzd9HFE3+tn8=\n+github.com/docker/docker v17.12.0-ce-rc1.0.20200618181300-9dc6525e6118+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=\ngithub.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ=\ngithub.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec=\n+github.com/docker/go-metrics v0.0.1 h1:AgB/0SvBxihN0X8OR4SjsblXkbMvalQ8cjmtKQ2rQV8=\n+github.com/docker/go-metrics v0.0.1/go.mod h1:cG1hvH2utMXtqgqqYE9plW6lDxS3/5ayHzueweSI3Vw=\ngithub.com/docker/go-units v0.3.3 h1:Xk8S3Xj5sLGlG5g67hJmYMmUgXv5N4PhkjJHHqrwnTk=\ngithub.com/docker/go-units v0.3.3/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk=\ngithub.com/dsnet/compress v0.0.1 h1:PlZu0n3Tuv04TzpfPbrnI0HW/YwodEXDS+oPKahKF0Q=\n@@ -112,6 +123,7 @@ github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfb\ngithub.com/golang/protobuf v1.2.0 h1:P3YflyNX/ehuJFLhxviNdFxQPkGK5cDcApsge1SqnvM=\ngithub.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=\ngithub.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=\n+github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=\ngithub.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw=\ngithub.com/golang/protobuf v1.3.5 h1:F768QJ1E9tib+q5Sc8MkdJi1RxLTbRcTf8LJV56aRls=\ngithub.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk=\n@@ -152,6 +164,8 @@ github.com/jmespath/go-jmespath v0.3.0 h1:OS12ieG61fsCg5+qLJ+SsW9NicxNkg3b25OyT2\ngithub.com/jmespath/go-jmespath v0.3.0/go.mod h1:9QtRXoHjLGCJ5IBSaohpXITPlowMeeYCZ7fLUTSywik=\ngithub.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo=\ngithub.com/jpillora/backoff v0.0.0-20180909062703-3050d21c67d7/go.mod h1:2iMrUgbbvHEiQClaW2NsSzMyGHqN+rDFqY705q49KG0=\n+github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=\n+github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=\ngithub.com/json-iterator/go v1.1.9 h1:9yzud/Ht36ygwatGx56VwCZtlI/2AD15T1X2sjSuGns=\ngithub.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=\ngithub.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo=\n@@ -202,6 +216,7 @@ github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHX\ngithub.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=\ngithub.com/mattn/go-shellwords v1.0.10 h1:Y7Xqm8piKOO3v10Thp7Z36h4FYFjt5xB//6XvOrs2Gw=\ngithub.com/mattn/go-shellwords v1.0.10/go.mod h1:EZzvwXDESEeg03EKmM+RmDnNOPKG4lLtQsUlTZDWQ8Y=\n+github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU=\ngithub.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=\ngithub.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b h1:j7+1HpAFS1zy5+Q4qx1fWh90gTKwiN4QCGoY9TWyyO4=\ngithub.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b/go.mod h1:01TrycV0kFyexm33Z7vhZRXopbI8J3TDReVlkTgMUxE=\n@@ -217,6 +232,8 @@ github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJ\ngithub.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=\ngithub.com/modern-go/reflect2 v1.0.1 h1:9f412s+6RmYXLWZSEzVVgPGK7C2PphHj5RJrvfx9AWI=\ngithub.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=\n+github.com/morikuni/aec v1.0.0 h1:nP9CBfwrvYnBRgY6qfDQkygYDmYwOilePFkwzv4dU8A=\n+github.com/morikuni/aec v1.0.0/go.mod h1:BbKIizmSmc5MMPqRYbxO4ZU0S0+P200+tUnFx7PXmsc=\ngithub.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=\ngithub.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs=\ngithub.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=\n@@ -252,12 +269,22 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb\ngithub.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=\ngithub.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=\ngithub.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso=\n+github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo=\n+github.com/prometheus/client_golang v1.1.0 h1:BQ53HtBmfOitExawJ6LokA4x8ov/z0SYYb0+HxJfRI8=\n+github.com/prometheus/client_golang v1.1.0/go.mod h1:I1FGZT9+L76gKKOs5djB6ezCbFQP1xR9D75/vuwEF3g=\ngithub.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=\n+github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90 h1:S/YWwWx/RA8rT8tKFRuGUZhuA90OyIBpPCXkcbwU8DE=\ngithub.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=\ngithub.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro=\ngithub.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4=\n+github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4=\n+github.com/prometheus/common v0.6.0 h1:kRhiuYSXR3+uv2IbVbZhUxK5zVD/2pp3Gd2PpvPkpEo=\n+github.com/prometheus/common v0.6.0/go.mod h1:eBmuwkDJBwy6iBfxCBob6t6dR6ENT/y+J+Zk0j9GMYc=\ngithub.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=\ngithub.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA=\n+github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA=\n+github.com/prometheus/procfs v0.0.3 h1:CTwfnzjQ+8dS6MhHHu4YswVAD99sL2wjPqP+VkURmKE=\n+github.com/prometheus/procfs v0.0.3/go.mod h1:4A/X28fw3Fc593LaREMrKMqOKvUAntwMDaekg4FpcdQ=\ngithub.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU=\ngithub.com/pterodactyl/sftp-server v1.1.1 h1:IjuOy21BNZxfejKnXG1RgLxXAYylDqBVpbKZ6+fG5FQ=\ngithub.com/pterodactyl/sftp-server v1.1.1/go.mod h1:b1VVWYv0RF9rxSZQqaD/rYXriiRMNPsbV//CKMXR4ag=\n@@ -383,6 +410,7 @@ golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73r\ngolang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=\ngolang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=\ngolang.org/x/net v0.0.0-20190522155817-f3200d17e092/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks=\n+golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=\ngolang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=\ngolang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=\ngolang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=\n@@ -409,6 +437,7 @@ golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5h\ngolang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=\ngolang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=\ngolang.org/x/sys v0.0.0-20190530182044-ad28b68e88f1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=\n+golang.org/x/sys v0.0.0-20190801041406-cbf593c0f2f3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=\ngolang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=\ngolang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=\ngolang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=\n@@ -450,8 +479,10 @@ golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8T\ngolang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=\ngolang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=\ngoogle.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=\n+google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8 h1:Nw54tB0rB7hY/N0NQvRW8DG4Yk3Q6T9cu9RcFQDu1tc=\ngoogle.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=\ngoogle.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=\n+google.golang.org/grpc v1.21.0 h1:G+97AoqBnmZIT91cLG/EkCoK9NSelj64P8bOHHNmGn0=\ngoogle.golang.org/grpc v1.21.0/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM=\ngopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=\ngopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=\n"
}
] | Go | MIT License | pterodactyl/wings | update github.com/docker/docker |
532,336 | 04.07.2020 20:57:54 | 0 | deb9305f5658fd0796bd4ceffc2f997ce79e6529 | add diagnostics command | [
{
"change_type": "ADD",
"old_path": null,
"new_path": "cmd/diagnostics.go",
"diff": "+package cmd\n+\n+import (\n+ \"context\"\n+ \"encoding/json\"\n+ \"errors\"\n+ \"fmt\"\n+ \"io\"\n+ \"io/ioutil\"\n+ \"net/http\"\n+ \"net/url\"\n+ \"os/exec\"\n+ \"path\"\n+ \"strings\"\n+\n+ \"github.com/AlecAivazis/survey/v2\"\n+ \"github.com/AlecAivazis/survey/v2/terminal\"\n+ \"github.com/docker/cli/components/engine/pkg/parsers/operatingsystem\"\n+ \"github.com/docker/docker/api/types\"\n+ \"github.com/docker/docker/client\"\n+ \"github.com/docker/docker/pkg/parsers/kernel\"\n+ \"github.com/pterodactyl/wings/config\"\n+ \"github.com/pterodactyl/wings/system\"\n+ \"github.com/spf13/cobra\"\n+)\n+\n+const DefaultHastebinUrl = \"https://hastebin.com\"\n+\n+var (\n+ diagnosticsArgs struct {\n+ IncludeEndpoints bool\n+ IncludeLogs bool\n+ ReviewBeforeUpload bool\n+ HastebinURL string\n+ }\n+)\n+\n+var diagnosticsCmd = &cobra.Command{\n+ Use: \"diagnostics\",\n+ Short: \"Collect diagnostics information.\",\n+ Run: diagnosticsCmdRun,\n+}\n+\n+func init() {\n+ diagnosticsCmd.PersistentFlags().StringVar(&diagnosticsArgs.HastebinURL, \"hastebin-url\", DefaultHastebinUrl, \"The url of the hastebin instance to use.\")\n+}\n+\n+// diagnosticsCmdRun collects diagnostics about wings, it's configuration and the node.\n+// We collect:\n+// - wings and docker versions\n+// - relevant parts of daemon configuration\n+// - the docker debug output\n+// - running docker containers\n+// - logs\n+func diagnosticsCmdRun(cmd *cobra.Command, args []string) {\n+ questions := []*survey.Question{\n+ {\n+ Name: \"IncludeEndpoints\",\n+ Prompt: &survey.Confirm{Message: \"Do you want to include endpoints (i.e. the FQDN/IP of your panel)?\", Default: false},\n+ },\n+ {\n+ Name: \"IncludeLogs\",\n+ Prompt: &survey.Confirm{Message: \"Do you want to include the latest logs?\", Default: true},\n+ },\n+ {\n+ Name: \"ReviewBeforeUpload\",\n+ Prompt: &survey.Confirm{\n+ Message: \"Do you want to review the collected data before uploading to hastebin.com?\",\n+ Help: \"The data, especially the logs, might contain sensitive information, so you should review it. You will be asked again if you want to uplaod.\",\n+ Default: true,\n+ },\n+ },\n+ }\n+ if err := survey.Ask(questions, &diagnosticsArgs); err != nil {\n+ if err == terminal.InterruptErr {\n+ return\n+ }\n+ panic(err)\n+ }\n+\n+ dockerVersion, dockerInfo, dockerErr := getDockerInfo()\n+ _ = dockerInfo\n+\n+ output := &strings.Builder{}\n+ fmt.Fprintln(output, \"Pterodactly Wings - Diagnostics Report\")\n+ printHeader(output, \"Versions\")\n+ fmt.Fprintln(output, \"wings:\", system.Version)\n+ if dockerErr == nil {\n+ fmt.Fprintln(output, \"Docker\", dockerVersion.Version)\n+ }\n+ if v, err := kernel.GetKernelVersion(); err == nil {\n+ fmt.Fprintln(output, \"Kernel:\", v)\n+ }\n+ if os, err := operatingsystem.GetOperatingSystem(); err == nil {\n+ fmt.Fprintln(output, \"OS:\", os)\n+ }\n+\n+ printHeader(output, \"Wings Configuration\")\n+ if cfg, err := config.ReadConfiguration(config.DefaultLocation); cfg != nil {\n+ fmt.Fprintln(output, \"Panel Location:\", redact(cfg.PanelLocation))\n+ fmt.Fprintln(output, \"Api Host:\", redact(cfg.Api.Host))\n+ fmt.Fprintln(output, \"Api Port:\", cfg.Api.Port)\n+ fmt.Fprintln(output, \"Api Ssl Enabled:\", cfg.Api.Ssl.Enabled)\n+ fmt.Fprintln(output, \"Api Ssl Certificate:\", redact(cfg.Api.Ssl.CertificateFile))\n+ fmt.Fprintln(output, \"Api Ssl Key:\", redact(cfg.Api.Ssl.KeyFile))\n+ fmt.Fprintln(output, \"Sftp Address:\", redact(cfg.System.Sftp.Address))\n+ fmt.Fprintln(output, \"Sftp Port:\", cfg.System.Sftp.Port)\n+ fmt.Fprintln(output, \"Sftp Read Only:\", cfg.System.Sftp.ReadOnly)\n+ fmt.Fprintln(output, \"Sftp Diskchecking Disabled:\", cfg.System.Sftp.DisableDiskChecking)\n+ fmt.Fprintln(output, \"System Root Directory:\", cfg.System.RootDirectory)\n+ fmt.Fprintln(output, \"System Logs Directory:\", cfg.System.LogDirectory)\n+ fmt.Fprintln(output, \"System Data Directory:\", cfg.System.Data)\n+ fmt.Fprintln(output, \"System Archive Directory:\", cfg.System.ArchiveDirectory)\n+ fmt.Fprintln(output, \"System Backup Directory:\", cfg.System.BackupDirectory)\n+ fmt.Fprintln(output, \"System Username:\", cfg.System.Username)\n+ fmt.Fprintln(output, \"Debug Enabled:\", cfg.Debug)\n+ } else {\n+ fmt.Println(\"Failed to load configuration.\", err)\n+ }\n+\n+ printHeader(output, \"Docker: Info\")\n+ fmt.Fprintln(output, \"Server Version:\", dockerInfo.ServerVersion)\n+ fmt.Fprintln(output, \"Storage Driver:\", dockerInfo.Driver)\n+ if dockerInfo.DriverStatus != nil {\n+ for _, pair := range dockerInfo.DriverStatus {\n+ fmt.Fprintf(output, \" %s: %s\\n\", pair[0], pair[1])\n+ }\n+ }\n+ if dockerInfo.SystemStatus != nil {\n+ for _, pair := range dockerInfo.SystemStatus {\n+ fmt.Fprintf(output, \" %s: %s\\n\", pair[0], pair[1])\n+ }\n+ }\n+ fmt.Fprintln(output, \"LoggingDriver:\", dockerInfo.LoggingDriver)\n+ fmt.Fprintln(output, \"CgroupDriver:\", dockerInfo.CgroupDriver)\n+ if len(dockerInfo.Warnings) > 0 {\n+ for _, w := range dockerInfo.Warnings {\n+ fmt.Fprintln(output, w)\n+ }\n+ }\n+\n+ printHeader(output, \"Docker: Running Containers\")\n+ c := exec.Command(\"docker\", \"ps\")\n+ if co, err := c.Output(); err == nil {\n+ output.Write(co)\n+ } else {\n+ fmt.Fprint(output, \"Couldn't list containers: \", err)\n+ }\n+\n+ printHeader(output, \"Latest Wings Logs\")\n+ if diagnosticsArgs.IncludeLogs {\n+ fmt.Fprintln(output, \"No logs found. Probably because nobody implemented logging to files yet :(\")\n+ } else {\n+ fmt.Fprintln(output, \"Logs redacted.\")\n+ }\n+\n+ fmt.Println(\"\\n--------------- generated report ---------------\")\n+ fmt.Println(output.String())\n+ fmt.Print(\"--------------- end of report ---------------\\n\\n\")\n+\n+ upload := !diagnosticsArgs.ReviewBeforeUpload\n+ if !upload {\n+ survey.AskOne(&survey.Confirm{Message: \"Upload to \" + diagnosticsArgs.HastebinURL + \"?\", Default: false}, &upload)\n+ }\n+ if upload {\n+ url, err := uploadToHastebin(diagnosticsArgs.HastebinURL, output.String())\n+ if err == nil {\n+ fmt.Println(\"Your report is available here: \", url)\n+ }\n+ }\n+}\n+\n+func getDockerInfo() (types.Version, types.Info, error) {\n+ cli, err := client.NewClientWithOpts(client.FromEnv)\n+ if err != nil {\n+ return types.Version{}, types.Info{}, err\n+ }\n+ dockerVersion, err := cli.ServerVersion(context.Background())\n+ if err != nil {\n+ return types.Version{}, types.Info{}, err\n+ }\n+ dockerInfo, err := cli.Info(context.Background())\n+ if err != nil {\n+ return types.Version{}, types.Info{}, err\n+ }\n+ return dockerVersion, dockerInfo, nil\n+}\n+\n+func uploadToHastebin(hbUrl, content string) (string, error) {\n+ r := strings.NewReader(content)\n+ u, err := url.Parse(hbUrl)\n+ if err != nil {\n+ return \"\", err\n+ }\n+ u.Path = path.Join(u.Path, \"documents\")\n+ res, err := http.Post(u.String(), \"plain/text\", r)\n+ if err != nil || res.StatusCode != 200 {\n+ fmt.Println(\"Failed to upload report to \", u.String(), err)\n+ return \"\", err\n+ }\n+ pres := make(map[string]interface{})\n+ body, err := ioutil.ReadAll(res.Body)\n+ if err != nil {\n+ fmt.Println(\"Failed to parse response.\", err)\n+ return \"\", err\n+ }\n+ json.Unmarshal(body, &pres)\n+ if key, ok := pres[\"key\"].(string); ok {\n+ u, _ := url.Parse(hbUrl)\n+ u.Path = path.Join(u.Path, key)\n+ return u.String(), nil\n+ }\n+ return \"\", errors.New(\"Couldn't find key in response\")\n+}\n+\n+func redact(s string) string {\n+ if !diagnosticsArgs.IncludeEndpoints {\n+ return \"{redacted}\"\n+ }\n+ return s\n+}\n+\n+func printHeader(w io.Writer, title string) {\n+ fmt.Fprintln(w, \"\\n|\\n|\", title)\n+ fmt.Fprintln(w, \"| ------------------------------\")\n+}\n"
},
{
"change_type": "MODIFY",
"old_path": "cmd/root.go",
"new_path": "cmd/root.go",
"diff": "@@ -3,15 +3,16 @@ package cmd\nimport (\n\"crypto/tls\"\n\"fmt\"\n- \"github.com/apex/log\"\n- \"github.com/mitchellh/colorstring\"\n- \"github.com/pterodactyl/wings/loggers/cli\"\n- \"golang.org/x/crypto/acme/autocert\"\n\"net/http\"\n\"os\"\n\"path\"\n\"strings\"\n+ \"github.com/apex/log\"\n+ \"github.com/mitchellh/colorstring\"\n+ \"github.com/pterodactyl/wings/loggers/cli\"\n+ \"golang.org/x/crypto/acme/autocert\"\n+\n\"github.com/pkg/errors\"\n\"github.com/pkg/profile\"\n\"github.com/pterodactyl/wings/config\"\n@@ -52,6 +53,7 @@ func init() {\nroot.PersistentFlags().StringVar(&tlsHostname, \"tls-hostname\", \"\", \"required with --auto-tls, the FQDN for the generated SSL certificate\")\nroot.AddCommand(configureCmd)\n+ root.AddCommand(diagnosticsCmd)\n}\n// Get the configuration path based on the arguments provided.\n"
}
] | Go | MIT License | pterodactyl/wings | add diagnostics command |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.