1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2025-12-08 22:21:08 +01:00

Merge remote-tracking branch 'my/master'

This commit is contained in:
Florian Schmaus 2016-12-07 21:20:02 +01:00
commit b558a128c3
30 changed files with 203 additions and 136 deletions

View file

@ -169,7 +169,7 @@ public final class BlockingCommandManager extends Manager {
BlockListIQ blockListIQ = new BlockListIQ();
BlockListIQ blockListIQResult = connection().createPacketCollectorAndSend(blockListIQ).nextResultOrThrow();
blockListCached = blockListIQResult.getJids();
blockListCached = blockListIQResult.getBlockedJidsCopy();
return Collections.unmodifiableList(blockListCached);
}

View file

@ -16,6 +16,7 @@
*/
package org.jivesoftware.smackx.blocking.element;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@ -52,9 +53,10 @@ public class BlockListIQ extends IQ {
public BlockListIQ(List<Jid> jids) {
super(ELEMENT, NAMESPACE);
if (jids == null) {
jids = Collections.emptyList();
this.jids = Collections.emptyList();
} else {
this.jids = Collections.unmodifiableList(jids);
}
this.jids = jids;
}
/**
@ -65,14 +67,23 @@ public class BlockListIQ extends IQ {
}
/**
* Get the JIDs.
* Get the JIDs as unmodifiable list.
*
* @return the JIDs
* @return the blocked JIDs
*/
public List<Jid> getJids() {
public List<Jid> getBlockedJids() {
return jids;
}
/**
* Get a copy of the blocked list JIDs. This copy is modifiable.
*
* @return the blocked JIDs
*/
public List<Jid> getBlockedJidsCopy() {
return new ArrayList<>(getBlockedJids());
}
@Override
protected IQChildElementXmlStringBuilder getIQChildElementBuilder(IQChildElementXmlStringBuilder xml) {
if (jids.isEmpty()) {

View file

@ -280,7 +280,7 @@ public class Socks5BytestreamRequest implements BytestreamRequest {
XMPPError.Builder error = XMPPError.from(XMPPError.Condition.item_not_found, errorMessage);
IQ errorIQ = IQ.createErrorResponse(this.bytestreamRequest, error);
this.manager.getConnection().sendStanza(errorIQ);
throw new XMPPErrorException(error);
throw new XMPPErrorException(errorIQ, error.build());
}
/**

View file

@ -615,6 +615,7 @@ public final class AdHocCommandManager extends Manager {
* @return the command instance to execute.
* @throws XMPPErrorException if there is problem creating the new instance.
*/
@SuppressWarnings("deprecation")
private LocalCommand newInstanceOfCmd(String commandNode, String sessionID) throws XMPPErrorException
{
AdHocCommandInfo commandInfo = commands.get(commandNode);

View file

@ -95,8 +95,14 @@ public class AdHocCommandDataProvider extends IQProvider<AdHocCommandData> {
adHocCommandData.setForm(dataFormProvider.parse(parser));
}
else if (parser.getName().equals("note")) {
AdHocCommandNote.Type type = AdHocCommandNote.Type.valueOf(
parser.getAttributeValue("", "type"));
String typeString = parser.getAttributeValue("", "type");
AdHocCommandNote.Type type;
if (typeString != null) {
type = AdHocCommandNote.Type.valueOf(typeString);
} else {
// Type is optional and 'info' if not present.
type = AdHocCommandNote.Type.info;
}
String value = parser.nextText();
adHocCommandData.addNote(new AdHocCommandNote(type, value));
}

View file

@ -327,7 +327,7 @@ public final class FileTransferNegotiator extends Manager {
}
else {
throw new XMPPErrorException(iqResponse.getError());
throw new XMPPErrorException(iqResponse, iqResponse.getError());
}
}
else {

View file

@ -36,6 +36,6 @@ public class ValidationConsistencyException extends IllegalArgumentException {
* @param message
*/
public ValidationConsistencyException(String message) {
super( message);
super(message);
}
}