1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-11-26 05:52:06 +01:00

Change IQ.Type to enum

This commit is contained in:
Júlio Cesar Bueno Cotta 2014-06-05 21:20:45 -03:00
parent 944ac37fc3
commit 9be0c480e3
90 changed files with 284 additions and 299 deletions

View file

@ -62,7 +62,7 @@ public class IQTest extends SmackTestCase {
if (result == null) { if (result == null) {
fail("No response from server"); fail("No response from server");
} }
else if (result.getType() != IQ.Type.ERROR) { else if (result.getType() != IQ.Type.error) {
fail("The server didn't reply with an error packet"); fail("The server didn't reply with an error packet");
} }
else { else {
@ -77,7 +77,7 @@ public class IQTest extends SmackTestCase {
public void testFullJIDToOfflineUser() { public void testFullJIDToOfflineUser() {
// Request the version from the server. // Request the version from the server.
Version versionRequest = new Version(); Version versionRequest = new Version();
versionRequest.setType(IQ.Type.GET); versionRequest.setType(IQ.Type.get);
versionRequest.setFrom(getFullJID(0)); versionRequest.setFrom(getFullJID(0));
versionRequest.setTo(getBareJID(0) + "/Something"); versionRequest.setTo(getBareJID(0) + "/Something");
@ -92,7 +92,7 @@ public class IQTest extends SmackTestCase {
// Stop queuing results // Stop queuing results
collector.cancel(); collector.cancel();
assertNotNull("No response from server", result); assertNotNull("No response from server", result);
assertEquals("The server didn't reply with an error packet", IQ.Type.ERROR, result.getType()); assertEquals("The server didn't reply with an error packet", IQ.Type.error, result.getType());
assertEquals("Server answered an incorrect error code", 503, result.getError().getCode()); assertEquals("Server answered an incorrect error code", 503, result.getError().getCode());
} }

View file

@ -79,7 +79,7 @@ public class PacketReaderTest extends SmackTestCase {
} }
}; };
iqPacket.setTo(getFullJID(1)); iqPacket.setTo(getFullJID(1));
iqPacket.setType(IQ.Type.GET); iqPacket.setType(IQ.Type.get);
// Send the IQ and wait for the answer // Send the IQ and wait for the answer
PacketCollector collector = getConnection(0).createPacketCollector( PacketCollector collector = getConnection(0).createPacketCollector(
@ -89,7 +89,7 @@ public class PacketReaderTest extends SmackTestCase {
if (response == null) { if (response == null) {
fail("No response from the other user."); fail("No response from the other user.");
} }
assertEquals("The received IQ is not of type ERROR", IQ.Type.ERROR, response.getType()); assertEquals("The received IQ is not of type ERROR", IQ.Type.error, response.getType());
assertEquals("The error code is not 501", 501, response.getError().getCode()); assertEquals("The error code is not 501", 501, response.getError().getCode());
collector.cancel(); collector.cancel();
} }

View file

@ -102,7 +102,7 @@ public class AccountManager extends Manager {
// to discover if this feature is supported // to discover if this feature is supported
if (info == null) { if (info == null) {
getRegistrationInfo(); getRegistrationInfo();
accountCreationSupported = info.getType() != IQ.Type.ERROR; accountCreationSupported = info.getType() != IQ.Type.error;
} }
return accountCreationSupported; return accountCreationSupported;
} }
@ -220,7 +220,7 @@ public class AccountManager extends Manager {
public void createAccount(String username, String password, Map<String, String> attributes) public void createAccount(String username, String password, Map<String, String> attributes)
throws NoResponseException, XMPPErrorException, NotConnectedException { throws NoResponseException, XMPPErrorException, NotConnectedException {
Registration reg = new Registration(); Registration reg = new Registration();
reg.setType(IQ.Type.SET); reg.setType(IQ.Type.set);
reg.setTo(connection().getServiceName()); reg.setTo(connection().getServiceName());
attributes.put("username", username); attributes.put("username", username);
attributes.put("password", password); attributes.put("password", password);
@ -240,7 +240,7 @@ public class AccountManager extends Manager {
*/ */
public void changePassword(String newPassword) throws NoResponseException, XMPPErrorException, NotConnectedException { public void changePassword(String newPassword) throws NoResponseException, XMPPErrorException, NotConnectedException {
Registration reg = new Registration(); Registration reg = new Registration();
reg.setType(IQ.Type.SET); reg.setType(IQ.Type.set);
reg.setTo(connection().getServiceName()); reg.setTo(connection().getServiceName());
Map<String, String> map = new HashMap<String, String>(); Map<String, String> map = new HashMap<String, String>();
map.put("username",XmppStringUtils.parseLocalpart(connection().getUser())); map.put("username",XmppStringUtils.parseLocalpart(connection().getUser()));
@ -261,7 +261,7 @@ public class AccountManager extends Manager {
*/ */
public void deleteAccount() throws NoResponseException, XMPPErrorException, NotConnectedException { public void deleteAccount() throws NoResponseException, XMPPErrorException, NotConnectedException {
Registration reg = new Registration(); Registration reg = new Registration();
reg.setType(IQ.Type.SET); reg.setType(IQ.Type.set);
reg.setTo(connection().getServiceName()); reg.setTo(connection().getServiceName());
Map<String, String> attributes = new HashMap<String, String>(); Map<String, String> attributes = new HashMap<String, String>();
// To delete an account, we add a single attribute, "remove", that is blank. // To delete an account, we add a single attribute, "remove", that is blank.

View file

@ -303,7 +303,7 @@ public class Roster {
// Create and send roster entry creation packet. // Create and send roster entry creation packet.
RosterPacket rosterPacket = new RosterPacket(); RosterPacket rosterPacket = new RosterPacket();
rosterPacket.setType(IQ.Type.SET); rosterPacket.setType(IQ.Type.set);
RosterPacket.Item item = new RosterPacket.Item(user, name); RosterPacket.Item item = new RosterPacket.Item(user, name);
if (groups != null) { if (groups != null) {
for (String group : groups) { for (String group : groups) {
@ -348,7 +348,7 @@ public class Roster {
return; return;
} }
RosterPacket packet = new RosterPacket(); RosterPacket packet = new RosterPacket();
packet.setType(IQ.Type.SET); packet.setType(IQ.Type.set);
RosterPacket.Item item = RosterEntry.toRosterItem(entry); RosterPacket.Item item = RosterEntry.toRosterItem(entry);
// Set the item type as REMOVE so that the server will delete the entry // Set the item type as REMOVE so that the server will delete the entry
item.setItemType(RosterPacket.ItemType.remove); item.setItemType(RosterPacket.ItemType.remove);
@ -951,7 +951,7 @@ public class Roster {
connection.removePacketListener(this); connection.removePacketListener(this);
IQ result = (IQ)packet; IQ result = (IQ)packet;
if (!result.getType().equals(IQ.Type.RESULT)) { if (!result.getType().equals(IQ.Type.result)) {
LOGGER.severe("Roster result IQ not of type result. Packet: " + result.toXML()); LOGGER.severe("Roster result IQ not of type result. Packet: " + result.toXML());
return; return;
} }

View file

@ -88,7 +88,7 @@ public class RosterEntry {
} }
this.name = name; this.name = name;
RosterPacket packet = new RosterPacket(); RosterPacket packet = new RosterPacket();
packet.setType(IQ.Type.SET); packet.setType(IQ.Type.set);
packet.addRosterItem(toRosterItem(this)); packet.addRosterItem(toRosterItem(this));
connection.sendPacket(packet); connection.sendPacket(packet);
} }

View file

@ -77,7 +77,7 @@ public class RosterGroup {
synchronized (entries) { synchronized (entries) {
for (RosterEntry entry : entries) { for (RosterEntry entry : entries) {
RosterPacket packet = new RosterPacket(); RosterPacket packet = new RosterPacket();
packet.setType(IQ.Type.SET); packet.setType(IQ.Type.set);
RosterPacket.Item item = RosterEntry.toRosterItem(entry); RosterPacket.Item item = RosterEntry.toRosterItem(entry);
item.removeGroupName(this.name); item.removeGroupName(this.name);
item.addGroupName(name); item.addGroupName(name);
@ -173,7 +173,7 @@ public class RosterGroup {
synchronized (entries) { synchronized (entries) {
if (!entries.contains(entry)) { if (!entries.contains(entry)) {
RosterPacket packet = new RosterPacket(); RosterPacket packet = new RosterPacket();
packet.setType(IQ.Type.SET); packet.setType(IQ.Type.set);
RosterPacket.Item item = RosterEntry.toRosterItem(entry); RosterPacket.Item item = RosterEntry.toRosterItem(entry);
item.addGroupName(getName()); item.addGroupName(getName());
packet.addRosterItem(item); packet.addRosterItem(item);
@ -207,7 +207,7 @@ public class RosterGroup {
synchronized (entries) { synchronized (entries) {
if (entries.contains(entry)) { if (entries.contains(entry)) {
RosterPacket packet = new RosterPacket(); RosterPacket packet = new RosterPacket();
packet.setType(IQ.Type.SET); packet.setType(IQ.Type.set);
RosterPacket.Item item = RosterEntry.toRosterItem(entry); RosterPacket.Item item = RosterEntry.toRosterItem(entry);
item.removeGroupName(this.getName()); item.removeGroupName(this.getName());
packet.addRosterItem(item); packet.addRosterItem(item);

View file

@ -28,10 +28,10 @@ import org.jivesoftware.smack.packet.IQ.Type;
*/ */
public class IQTypeFilter extends FlexiblePacketTypeFilter<IQ> { public class IQTypeFilter extends FlexiblePacketTypeFilter<IQ> {
public static final PacketFilter GET = new IQTypeFilter(Type.GET); public static final PacketFilter GET = new IQTypeFilter(Type.get);
public static final PacketFilter SET = new IQTypeFilter(Type.SET); public static final PacketFilter SET = new IQTypeFilter(Type.set);
public static final PacketFilter RESULT = new IQTypeFilter(Type.RESULT); public static final PacketFilter RESULT = new IQTypeFilter(Type.result);
public static final PacketFilter ERROR = new IQTypeFilter(Type.ERROR); public static final PacketFilter ERROR = new IQTypeFilter(Type.error);
private final IQ.Type type; private final IQ.Type type;

View file

@ -36,7 +36,7 @@ public class Bind extends IQ {
private String jid = null; private String jid = null;
public Bind() { public Bind() {
setType(IQ.Type.SET); setType(IQ.Type.set);
} }
public String getResource() { public String getResource() {

View file

@ -18,6 +18,8 @@
package org.jivesoftware.smack.packet; package org.jivesoftware.smack.packet;
import java.util.Locale; import java.util.Locale;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.jivesoftware.smack.util.XmlStringBuilder; import org.jivesoftware.smack.util.XmlStringBuilder;
@ -39,8 +41,9 @@ import org.jivesoftware.smack.util.XmlStringBuilder;
* @author Matt Tucker * @author Matt Tucker
*/ */
public abstract class IQ extends Packet { public abstract class IQ extends Packet {
private static final Logger LOGGER = Logger.getLogger(IQ.class.getName());
private Type type = Type.GET; private Type type = Type.get;
public IQ() { public IQ() {
super(); super();
@ -66,7 +69,7 @@ public abstract class IQ extends Packet {
*/ */
public void setType(Type type) { public void setType(Type type) {
if (type == null) { if (type == null) {
this.type = Type.GET; this.type = Type.get;
} }
else { else {
this.type = type; this.type = type;
@ -107,23 +110,23 @@ public abstract class IQ extends Packet {
public abstract CharSequence getChildElementXML(); public abstract CharSequence getChildElementXML();
/** /**
* Convenience method to create a new empty {@link Type#RESULT IQ.Type.RESULT} * Convenience method to create a new empty {@link Type#result IQ.Type.result}
* IQ based on a {@link Type#GET IQ.Type.GET} or {@link Type#SET IQ.Type.SET} * IQ based on a {@link Type#get IQ.Type.get} or {@link Type#set IQ.Type.set}
* IQ. The new packet will be initialized with:<ul> * IQ. The new packet will be initialized with:<ul>
* <li>The sender set to the recipient of the originating IQ. * <li>The sender set to the recipient of the originating IQ.
* <li>The recipient set to the sender of the originating IQ. * <li>The recipient set to the sender of the originating IQ.
* <li>The type set to {@link Type#RESULT IQ.Type.RESULT}. * <li>The type set to {@link Type#result IQ.Type.result}.
* <li>The id set to the id of the originating IQ. * <li>The id set to the id of the originating IQ.
* <li>No child element of the IQ element. * <li>No child element of the IQ element.
* </ul> * </ul>
* *
* @param request the {@link Type#GET IQ.Type.GET} or {@link Type#SET IQ.Type.SET} IQ packet. * @param request the {@link Type#get IQ.Type.get} or {@link Type#set IQ.Type.set} IQ packet.
* @throws IllegalArgumentException if the IQ packet does not have a type of * @throws IllegalArgumentException if the IQ packet does not have a type of
* {@link Type#GET IQ.Type.GET} or {@link Type#SET IQ.Type.SET}. * {@link Type#get IQ.Type.get} or {@link Type#set IQ.Type.set}.
* @return a new {@link Type#RESULT IQ.Type.RESULT} IQ based on the originating IQ. * @return a new {@link Type#result IQ.Type.result} IQ based on the originating IQ.
*/ */
public static IQ createResultIQ(final IQ request) { public static IQ createResultIQ(final IQ request) {
if (!(request.getType() == Type.GET || request.getType() == Type.SET)) { if (!(request.getType() == Type.get || request.getType() == Type.set)) {
throw new IllegalArgumentException( throw new IllegalArgumentException(
"IQ must be of type 'set' or 'get'. Original IQ: " + request.toXML()); "IQ must be of type 'set' or 'get'. Original IQ: " + request.toXML());
} }
@ -132,7 +135,7 @@ public abstract class IQ extends Packet {
return null; return null;
} }
}; };
result.setType(Type.RESULT); result.setType(Type.result);
result.setPacketID(request.getPacketID()); result.setPacketID(request.getPacketID());
result.setFrom(request.getTo()); result.setFrom(request.getTo());
result.setTo(request.getFrom()); result.setTo(request.getFrom());
@ -140,25 +143,25 @@ public abstract class IQ extends Packet {
} }
/** /**
* Convenience method to create a new {@link Type#ERROR IQ.Type.ERROR} IQ * Convenience method to create a new {@link Type#error IQ.Type.error} IQ
* based on a {@link Type#GET IQ.Type.GET} or {@link Type#SET IQ.Type.SET} * based on a {@link Type#get IQ.Type.get} or {@link Type#set IQ.Type.set}
* IQ. The new packet will be initialized with:<ul> * IQ. The new packet will be initialized with:<ul>
* <li>The sender set to the recipient of the originating IQ. * <li>The sender set to the recipient of the originating IQ.
* <li>The recipient set to the sender of the originating IQ. * <li>The recipient set to the sender of the originating IQ.
* <li>The type set to {@link Type#ERROR IQ.Type.ERROR}. * <li>The type set to {@link Type#error IQ.Type.error}.
* <li>The id set to the id of the originating IQ. * <li>The id set to the id of the originating IQ.
* <li>The child element contained in the associated originating IQ. * <li>The child element contained in the associated originating IQ.
* <li>The provided {@link XMPPError XMPPError}. * <li>The provided {@link XMPPError XMPPError}.
* </ul> * </ul>
* *
* @param request the {@link Type#GET IQ.Type.GET} or {@link Type#SET IQ.Type.SET} IQ packet. * @param request the {@link Type#get IQ.Type.get} or {@link Type#set IQ.Type.set} IQ packet.
* @param error the error to associate with the created IQ packet. * @param error the error to associate with the created IQ packet.
* @throws IllegalArgumentException if the IQ packet does not have a type of * @throws IllegalArgumentException if the IQ packet does not have a type of
* {@link Type#GET IQ.Type.GET} or {@link Type#SET IQ.Type.SET}. * {@link Type#get IQ.Type.get} or {@link Type#set IQ.Type.set}.
* @return a new {@link Type#ERROR IQ.Type.ERROR} IQ based on the originating IQ. * @return a new {@link Type#error IQ.Type.error} IQ based on the originating IQ.
*/ */
public static IQ createErrorResponse(final IQ request, final XMPPError error) { public static IQ createErrorResponse(final IQ request, final XMPPError error) {
if (!(request.getType() == Type.GET || request.getType() == Type.SET)) { if (!(request.getType() == Type.get || request.getType() == Type.set)) {
throw new IllegalArgumentException( throw new IllegalArgumentException(
"IQ must be of type 'set' or 'get'. Original IQ: " + request.toXML()); "IQ must be of type 'set' or 'get'. Original IQ: " + request.toXML());
} }
@ -168,7 +171,7 @@ public abstract class IQ extends Packet {
return request.getChildElementXML(); return request.getChildElementXML();
} }
}; };
result.setType(Type.ERROR); result.setType(Type.error);
result.setPacketID(request.getPacketID()); result.setPacketID(request.getPacketID());
result.setFrom(request.getTo()); result.setFrom(request.getTo());
result.setTo(request.getFrom()); result.setTo(request.getFrom());
@ -177,59 +180,41 @@ public abstract class IQ extends Packet {
} }
/** /**
* A class to represent the type of the IQ packet. The types are: * A enum to represent the type of the IQ packet. The types are:
* *
* <ul> * <ul>
* <li>IQ.Type.GET * <li>IQ.Type.get
* <li>IQ.Type.SET * <li>IQ.Type.set
* <li>IQ.Type.RESULT * <li>IQ.Type.result
* <li>IQ.Type.ERROR * <li>IQ.Type.error
* </ul> * </ul>
*/ */
public static class Type { public enum Type {
public static final Type GET = new Type("get"); get,
public static final Type SET = new Type("set"); set,
public static final Type RESULT = new Type("result"); result,
public static final Type ERROR = new Type("error"); error;
/** /**
* Converts a String into the corresponding types. Valid String values * Converts a String into the corresponding types. Valid String values
* that can be converted to types are: "get", "set", "result", and "error". * that can be converted to types are: "get", "set", "result", and "error".
* *
* @param type the String value to covert. * @param string the String value to covert.
* @return the corresponding Type. * @return the corresponding Type.
* @throws IllegalArgumentException when not able to parse the string parameter
*/ */
public static Type fromString(String type) { public static Type fromString(String string) {
if (type == null) { Type type = null;
return null; try {
type = Type.valueOf(string.toLowerCase(Locale.US));
} }
type = type.toLowerCase(Locale.US); catch (Exception e) {
if (GET.toString().equals(type)) { final String msg = "Could not transform string '" + string + "' to IQ.Type";
return GET; LOGGER.log(Level.WARNING, msg, e);
throw new IllegalArgumentException(msg, e);
} }
else if (SET.toString().equals(type)) { return type;
return SET;
}
else if (ERROR.toString().equals(type)) {
return ERROR;
}
else if (RESULT.toString().equals(type)) {
return RESULT;
}
else {
return null;
}
}
private String value;
private Type(String value) {
this.value = value;
}
public String toString() {
return value;
} }
} }
} }

View file

@ -33,7 +33,7 @@ package org.jivesoftware.smack.packet;
public class Session extends IQ { public class Session extends IQ {
public Session() { public Session() {
setType(IQ.Type.SET); setType(IQ.Type.set);
} }
@Override @Override

View file

@ -381,7 +381,7 @@ public class PacketParserUtils {
} }
// Only handle unknown IQs of type result. Types of 'get' and 'set' which are not understood // Only handle unknown IQs of type result. Types of 'get' and 'set' which are not understood
// have to be answered with an IQ error response. See the code a few lines below // have to be answered with an IQ error response. See the code a few lines below
else if (IQ.Type.RESULT == type){ else if (IQ.Type.result == type){
// No Provider found for the IQ stanza, parse it to an UnparsedIQ instance // No Provider found for the IQ stanza, parse it to an UnparsedIQ instance
// so that the content of the IQ can be examined later on // so that the content of the IQ can be examined later on
iqPacket = new UnparsedResultIQ(parseContent(parser)); iqPacket = new UnparsedResultIQ(parseContent(parser));
@ -396,7 +396,7 @@ public class PacketParserUtils {
} }
// Decide what to do when an IQ packet was not understood // Decide what to do when an IQ packet was not understood
if (iqPacket == null) { if (iqPacket == null) {
if (connection != null && (IQ.Type.GET == type || IQ.Type.SET == type)) { if (connection != null && (IQ.Type.get == type || IQ.Type.set == type)) {
// If the IQ stanza is of type "get" or "set" containing a child element qualified // If the IQ stanza is of type "get" or "set" containing a child element qualified
// by a namespace with no registered Smack provider, then answer an IQ of type // by a namespace with no registered Smack provider, then answer an IQ of type
// "error" with code 501 ("feature-not-implemented") // "error" with code 501 ("feature-not-implemented")
@ -409,7 +409,7 @@ public class PacketParserUtils {
iqPacket.setPacketID(id); iqPacket.setPacketID(id);
iqPacket.setTo(from); iqPacket.setTo(from);
iqPacket.setFrom(to); iqPacket.setFrom(to);
iqPacket.setType(IQ.Type.ERROR); iqPacket.setType(IQ.Type.error);
iqPacket.setError(new XMPPError(XMPPError.Condition.feature_not_implemented)); iqPacket.setError(new XMPPError(XMPPError.Condition.feature_not_implemented));
connection.sendPacket(iqPacket); connection.sendPacket(iqPacket);
return null; return null;

View file

@ -360,7 +360,7 @@ public class RosterTest {
@Test(timeout=5000) @Test(timeout=5000)
public void testIgnoreInvalidFrom() { public void testIgnoreInvalidFrom() {
RosterPacket packet = new RosterPacket(); RosterPacket packet = new RosterPacket();
packet.setType(Type.SET); packet.setType(Type.set);
packet.setTo(connection.getUser()); packet.setTo(connection.getUser());
packet.setFrom("mallory@example.com"); packet.setFrom("mallory@example.com");
packet.addRosterItem(new Item("spam@example.com", "Cool products!")); packet.addRosterItem(new Item("spam@example.com", "Cool products!"));
@ -500,7 +500,7 @@ public class RosterTest {
for(RosterEntry entry : roster.getEntries()) { for(RosterEntry entry : roster.getEntries()) {
// prepare the roster push packet // prepare the roster push packet
final RosterPacket rosterPush= new RosterPacket(); final RosterPacket rosterPush= new RosterPacket();
rosterPush.setType(Type.SET); rosterPush.setType(Type.set);
rosterPush.setTo(connection.getUser()); rosterPush.setTo(connection.getUser());
// prepare the buddy's item entry which should be removed // prepare the buddy's item entry which should be removed
@ -526,7 +526,7 @@ public class RosterTest {
roster.reload(); roster.reload();
while (true) { while (true) {
final Packet sentPacket = connection.getSentPacket(); final Packet sentPacket = connection.getSentPacket();
if (sentPacket instanceof RosterPacket && ((IQ) sentPacket).getType() == Type.GET) { if (sentPacket instanceof RosterPacket && ((IQ) sentPacket).getType() == Type.get) {
// setup the roster get request // setup the roster get request
final RosterPacket rosterRequest = (RosterPacket) sentPacket; final RosterPacket rosterRequest = (RosterPacket) sentPacket;
assertSame("The <query/> element MUST NOT contain any <item/> child elements!", assertSame("The <query/> element MUST NOT contain any <item/> child elements!",
@ -536,7 +536,7 @@ public class RosterTest {
// prepare the roster result // prepare the roster result
final RosterPacket rosterResult = new RosterPacket(); final RosterPacket rosterResult = new RosterPacket();
rosterResult.setTo(connection.getUser()); rosterResult.setTo(connection.getUser());
rosterResult.setType(Type.RESULT); rosterResult.setType(Type.result);
rosterResult.setPacketID(rosterRequest.getPacketID()); rosterResult.setPacketID(rosterRequest.getPacketID());
// prepare romeo's roster entry // prepare romeo's roster entry
@ -642,7 +642,7 @@ public class RosterTest {
try { try {
while (true) { while (true) {
final Packet packet = connection.getSentPacket(); final Packet packet = connection.getSentPacket();
if (packet instanceof RosterPacket && ((IQ) packet).getType() == Type.SET) { if (packet instanceof RosterPacket && ((IQ) packet).getType() == Type.set) {
final RosterPacket rosterRequest = (RosterPacket) packet; final RosterPacket rosterRequest = (RosterPacket) packet;
// Prepare and process the roster push // Prepare and process the roster push
@ -651,7 +651,7 @@ public class RosterTest {
if (item.getItemType() != ItemType.remove) { if (item.getItemType() != ItemType.remove) {
item.setItemType(ItemType.none); item.setItemType(ItemType.none);
} }
rosterPush.setType(Type.SET); rosterPush.setType(Type.set);
rosterPush.setTo(connection.getUser()); rosterPush.setTo(connection.getUser());
rosterPush.addRosterItem(item); rosterPush.addRosterItem(item);
connection.processPacket(rosterPush); connection.processPacket(rosterPush);
@ -663,7 +663,7 @@ public class RosterTest {
} }
}; };
response.setPacketID(rosterRequest.getPacketID()); response.setPacketID(rosterRequest.getPacketID());
response.setType(Type.RESULT); response.setType(Type.result);
response.setTo(connection.getUser()); response.setTo(connection.getUser());
connection.processPacket(response); connection.processPacket(response);

View file

@ -134,7 +134,7 @@ public class RosterVersioningTest {
RosterPacket sentRP = (RosterPacket)sentPacket; RosterPacket sentRP = (RosterPacket)sentPacket;
RosterPacket answer = new RosterPacket(); RosterPacket answer = new RosterPacket();
answer.setPacketID(sentRP.getPacketID()); answer.setPacketID(sentRP.getPacketID());
answer.setType(Type.RESULT); answer.setType(Type.result);
answer.setTo(sentRP.getFrom()); answer.setTo(sentRP.getFrom());
answer.setVersion("newVersion"); answer.setVersion("newVersion");
@ -173,7 +173,7 @@ public class RosterVersioningTest {
{ {
RosterPacket rosterPush = new RosterPacket(); RosterPacket rosterPush = new RosterPacket();
rosterPush.setTo("rostertest@example.com/home"); rosterPush.setTo("rostertest@example.com/home");
rosterPush.setType(Type.SET); rosterPush.setType(Type.set);
rosterPush.setVersion("v97"); rosterPush.setVersion("v97");
Item pushedItem = vaglafItem(); Item pushedItem = vaglafItem();
@ -197,7 +197,7 @@ public class RosterVersioningTest {
{ {
RosterPacket rosterPush = new RosterPacket(); RosterPacket rosterPush = new RosterPacket();
rosterPush.setTo("rostertest@example.com/home"); rosterPush.setTo("rostertest@example.com/home");
rosterPush.setType(Type.SET); rosterPush.setType(Type.set);
rosterPush.setVersion("v98"); rosterPush.setVersion("v98");
Item item = new Item("vaglaf@example.com", "vaglaf the only"); Item item = new Item("vaglaf@example.com", "vaglaf the only");

View file

@ -59,7 +59,7 @@ public class ThreadedDummyConnection extends DummyConnection {
replyPacket.setPacketID(packet.getPacketID()); replyPacket.setPacketID(packet.getPacketID());
replyPacket.setFrom(packet.getTo()); replyPacket.setFrom(packet.getTo());
replyPacket.setTo(packet.getFrom()); replyPacket.setTo(packet.getFrom());
replyPacket.setType(Type.RESULT); replyPacket.setType(Type.result);
new ProcessQueue(replyQ).start(); new ProcessQueue(replyQ).start();
} }

View file

@ -49,7 +49,7 @@ public class IQResponseTest {
final IQ result = IQ.createResultIQ(request); final IQ result = IQ.createResultIQ(request);
assertEquals(IQ.Type.RESULT, result.getType()); assertEquals(IQ.Type.result, result.getType());
assertNotNull(result.getPacketID()); assertNotNull(result.getPacketID());
assertEquals(request.getPacketID(), result.getPacketID()); assertEquals(request.getPacketID(), result.getPacketID());
assertEquals(request.getFrom(), result.getTo()); assertEquals(request.getFrom(), result.getTo());
@ -68,13 +68,13 @@ public class IQResponseTest {
return childElement; return childElement;
} }
}; };
request.setType(IQ.Type.SET); request.setType(IQ.Type.set);
request.setFrom("sender@test/Smack"); request.setFrom("sender@test/Smack");
request.setTo("receiver@test/Smack"); request.setTo("receiver@test/Smack");
final IQ result = IQ.createErrorResponse(request, error); final IQ result = IQ.createErrorResponse(request, error);
assertEquals(IQ.Type.ERROR, result.getType()); assertEquals(IQ.Type.error, result.getType());
assertNotNull(result.getPacketID()); assertNotNull(result.getPacketID());
assertEquals(request.getPacketID(), result.getPacketID()); assertEquals(request.getPacketID(), result.getPacketID());
assertEquals(request.getFrom(), result.getTo()); assertEquals(request.getFrom(), result.getTo());
@ -93,7 +93,7 @@ public class IQResponseTest {
return childElement; return childElement;
} }
}; };
request.setType(IQ.Type.RESULT); request.setType(IQ.Type.result);
request.setFrom("sender@test/Smack"); request.setFrom("sender@test/Smack");
request.setTo("receiver@test/Smack"); request.setTo("receiver@test/Smack");
@ -119,7 +119,7 @@ public class IQResponseTest {
return childElement; return childElement;
} }
}; };
request.setType(IQ.Type.ERROR); request.setType(IQ.Type.error);
request.setFrom("sender@test/Smack"); request.setFrom("sender@test/Smack");
request.setTo("receiver@test/Smack"); request.setTo("receiver@test/Smack");
request.setError(error); request.setError(error);

View file

@ -92,7 +92,7 @@ public class CarbonManager extends Manager {
return "<" + (new_state? "enable" : "disable") + " xmlns='" + CarbonExtension.NAMESPACE + "'/>"; return "<" + (new_state? "enable" : "disable") + " xmlns='" + CarbonExtension.NAMESPACE + "'/>";
} }
}; };
setIQ.setType(IQ.Type.SET); setIQ.setType(IQ.Type.set);
return setIQ; return setIQ;
} }
@ -123,7 +123,7 @@ public class CarbonManager extends Manager {
connection().addPacketListener(new PacketListener() { connection().addPacketListener(new PacketListener() {
public void processPacket(Packet packet) { public void processPacket(Packet packet) {
IQ result = (IQ)packet; IQ result = (IQ)packet;
if (result.getType() == IQ.Type.RESULT) { if (result.getType() == IQ.Type.result) {
enabled_state = new_state; enabled_state = new_state;
} }
connection().removePacketListener(this); connection().removePacketListener(this);

View file

@ -55,7 +55,7 @@ public class CompressionTest extends SmackTestCase {
// Request the version of the server // Request the version of the server
Version version = new Version(); Version version = new Version();
version.setType(IQ.Type.GET); version.setType(IQ.Type.get);
version.setTo(getServiceName()); version.setTo(getServiceName());
// Create a packet collector to listen for a response. // Create a packet collector to listen for a response.
@ -69,7 +69,7 @@ public class CompressionTest extends SmackTestCase {
collector.cancel(); collector.cancel();
assertNotNull("No reply was received from the server", result); assertNotNull("No reply was received from the server", result);
assertEquals("Incorrect IQ type from server", IQ.Type.RESULT, result.getType()); assertEquals("Incorrect IQ type from server", IQ.Type.result, result.getType());
// Close connection // Close connection
connection.disconnect(); connection.disconnect();

View file

@ -41,7 +41,7 @@ public class VersionTest extends SmackTestCase {
*/ */
public void testGetServerVersion() { public void testGetServerVersion() {
Version version = new Version(); Version version = new Version();
version.setType(IQ.Type.GET); version.setType(IQ.Type.get);
version.setTo(getServiceName()); version.setTo(getServiceName());
// Create a packet collector to listen for a response. // Create a packet collector to listen for a response.
@ -56,7 +56,7 @@ public class VersionTest extends SmackTestCase {
assertNotNull("No result from the server", result); assertNotNull("No result from the server", result);
assertEquals("Incorrect result type", IQ.Type.RESULT, result.getType()); assertEquals("Incorrect result type", IQ.Type.result, result.getType());
assertNotNull("No name specified in the result", ((Version)result).getName()); assertNotNull("No name specified in the result", ((Version)result).getName());
assertNotNull("No version specified in the result", ((Version)result).getVersion()); assertNotNull("No version specified in the result", ((Version)result).getVersion());
} }

View file

@ -90,7 +90,7 @@ public class EntityCapsTest extends SmackTestCase {
discoInfoSend = true; discoInfoSend = true;
} }
}, new AndFilter(new PacketTypeFilter(DiscoverInfo.class), new IQTypeFilter(IQ.Type.GET))); }, new AndFilter(new PacketTypeFilter(DiscoverInfo.class), new IQTypeFilter(IQ.Type.get)));
// add a bogus feature so that con1 ver won't match con0's // add a bogus feature so that con1 ver won't match con0's
sdm1.addFeature(DISCOVER_TEST_FEATURE); sdm1.addFeature(DISCOVER_TEST_FEATURE);

View file

@ -484,7 +484,7 @@ public class MultiUserChatTest extends SmackTestCase {
.discoverInfo(room + "/testbot", null); .discoverInfo(room + "/testbot", null);
assertNotNull("No info was discovered from room occupant", info); assertNotNull("No info was discovered from room occupant", info);
assertEquals("Wrong IQ type", IQ.Type.RESULT, info.getType()); assertEquals("Wrong IQ type", IQ.Type.result, info.getType());
assertEquals("Wrong IQ sender", room + "/testbot", info.getFrom()); assertEquals("Wrong IQ sender", room + "/testbot", info.getFrom());
// User2 leaves the room // User2 leaves the room

View file

@ -39,7 +39,7 @@ public class Close extends IQ {
throw new IllegalArgumentException("Session ID must not be null or empty"); throw new IllegalArgumentException("Session ID must not be null or empty");
} }
this.sessionID = sessionID; this.sessionID = sessionID;
setType(Type.SET); setType(Type.set);
} }
/** /**

View file

@ -45,7 +45,7 @@ public class Data extends IQ {
* retrieved from IQ stanza and message stanza in the same way * retrieved from IQ stanza and message stanza in the same way
*/ */
addExtension(data); addExtension(data);
setType(IQ.Type.SET); setType(IQ.Type.set);
} }
/** /**

View file

@ -62,7 +62,7 @@ public class Open extends IQ {
this.sessionID = sessionID; this.sessionID = sessionID;
this.blockSize = blockSize; this.blockSize = blockSize;
this.stanza = stanza; this.stanza = stanza;
setType(Type.SET); setType(Type.set);
} }
/** /**

View file

@ -640,7 +640,7 @@ public final class Socks5BytestreamManager implements BytestreamManager {
*/ */
private Bytestream createStreamHostRequest(String proxy) { private Bytestream createStreamHostRequest(String proxy) {
Bytestream request = new Bytestream(); Bytestream request = new Bytestream();
request.setType(IQ.Type.GET); request.setType(IQ.Type.get);
request.setTo(proxy); request.setTo(proxy);
return request; return request;
} }
@ -695,7 +695,7 @@ public final class Socks5BytestreamManager implements BytestreamManager {
initiation.addStreamHost(streamHost); initiation.addStreamHost(streamHost);
} }
initiation.setType(IQ.Type.SET); initiation.setType(IQ.Type.set);
initiation.setTo(targetJID); initiation.setTo(targetJID);
return initiation; return initiation;

View file

@ -294,7 +294,7 @@ public class Socks5BytestreamRequest implements BytestreamRequest {
private Bytestream createUsedHostResponse(StreamHost selectedHost) { private Bytestream createUsedHostResponse(StreamHost selectedHost) {
Bytestream response = new Bytestream(this.bytestreamRequest.getSessionID()); Bytestream response = new Bytestream(this.bytestreamRequest.getSessionID());
response.setTo(this.bytestreamRequest.getFrom()); response.setTo(this.bytestreamRequest.getFrom());
response.setType(IQ.Type.RESULT); response.setType(IQ.Type.result);
response.setPacketID(this.bytestreamRequest.getPacketID()); response.setPacketID(this.bytestreamRequest.getPacketID());
response.setUsedHost(selectedHost.getJID()); response.setUsedHost(selectedHost.getJID());
return response; return response;

View file

@ -120,7 +120,7 @@ class Socks5ClientForInitiator extends Socks5Client {
private Bytestream createStreamHostActivation() { private Bytestream createStreamHostActivation() {
Bytestream activate = new Bytestream(this.sessionID); Bytestream activate = new Bytestream(this.sessionID);
activate.setMode(null); activate.setMode(null);
activate.setType(IQ.Type.SET); activate.setType(IQ.Type.set);
activate.setTo(this.streamHost.getJID()); activate.setTo(this.streamHost.getJID());
activate.setToActivate(this.target); activate.setToActivate(this.target);

View file

@ -217,7 +217,7 @@ public class Bytestream extends IQ {
StringBuilder buf = new StringBuilder(); StringBuilder buf = new StringBuilder();
buf.append("<query xmlns=\"http://jabber.org/protocol/bytestreams\""); buf.append("<query xmlns=\"http://jabber.org/protocol/bytestreams\"");
if (this.getType().equals(IQ.Type.SET)) { if (this.getType().equals(IQ.Type.set)) {
if (getSessionID() != null) { if (getSessionID() != null) {
buf.append(" sid=\"").append(getSessionID()).append("\""); buf.append(" sid=\"").append(getSessionID()).append("\"");
} }
@ -234,7 +234,7 @@ public class Bytestream extends IQ {
buf.append(getToActivate().toXML()); buf.append(getToActivate().toXML());
} }
} }
else if (this.getType().equals(IQ.Type.RESULT)) { else if (this.getType().equals(IQ.Type.result)) {
buf.append(">"); buf.append(">");
if (getUsedHost() != null) { if (getUsedHost() != null) {
buf.append(getUsedHost().toXML()); buf.append(getUsedHost().toXML());
@ -246,7 +246,7 @@ public class Bytestream extends IQ {
} }
} }
} }
else if (this.getType().equals(IQ.Type.GET)) { else if (this.getType().equals(IQ.Type.get)) {
return buf.append("/>").toString(); return buf.append("/>").toString();
} }
else { else {

View file

@ -435,7 +435,7 @@ public class EntityCapsManager extends Manager {
XMPPConnection connection = connection(); XMPPConnection connection = connection();
DiscoverInfo discoverInfo = new DiscoverInfo(); DiscoverInfo discoverInfo = new DiscoverInfo();
discoverInfo.setType(IQ.Type.RESULT); discoverInfo.setType(IQ.Type.result);
discoverInfo.setNode(getLocalNodeVer()); discoverInfo.setNode(getLocalNodeVer());
if (connection != null) if (connection != null)
discoverInfo.setFrom(connection.getUser()); discoverInfo.setFrom(connection.getUser());

View file

@ -332,7 +332,7 @@ public class AdHocCommandManager extends Manager {
*/ */
private void processAdHocCommand(AdHocCommandData requestData) throws SmackException { private void processAdHocCommand(AdHocCommandData requestData) throws SmackException {
// Only process requests of type SET // Only process requests of type SET
if (requestData.getType() != IQ.Type.SET) { if (requestData.getType() != IQ.Type.set) {
return; return;
} }
@ -364,7 +364,7 @@ public class AdHocCommandManager extends Manager {
// corresponding sessioid // corresponding sessioid
LocalCommand command = newInstanceOfCmd(commandNode, sessionId); LocalCommand command = newInstanceOfCmd(commandNode, sessionId);
response.setType(IQ.Type.RESULT); response.setType(IQ.Type.result);
command.setData(response); command.setData(response);
// Check that the requester has enough permission. // Check that the requester has enough permission.
@ -530,7 +530,7 @@ public class AdHocCommandManager extends Manager {
// Since all errors were passed, the response is now a // Since all errors were passed, the response is now a
// result // result
response.setType(IQ.Type.RESULT); response.setType(IQ.Type.result);
// Set the new data to the command. // Set the new data to the command.
command.setData(response); command.setData(response);
@ -623,7 +623,7 @@ public class AdHocCommandManager extends Manager {
* @throws NotConnectedException * @throws NotConnectedException
*/ */
private void respondError(AdHocCommandData response, XMPPError error) throws NotConnectedException { private void respondError(AdHocCommandData response, XMPPError error) throws NotConnectedException {
response.setType(IQ.Type.ERROR); response.setType(IQ.Type.error);
response.setError(error); response.setError(error);
connection().sendPacket(response); connection().sendPacket(response);
} }

View file

@ -130,7 +130,7 @@ public class RemoteCommand extends AdHocCommand {
// TODO: not throw the corresponding exeption. This will make a faster response, // TODO: not throw the corresponding exeption. This will make a faster response,
// TODO: since the request is stoped before it's sent. // TODO: since the request is stoped before it's sent.
AdHocCommandData data = new AdHocCommandData(); AdHocCommandData data = new AdHocCommandData();
data.setType(IQ.Type.SET); data.setType(IQ.Type.set);
data.setTo(getOwnerJID()); data.setTo(getOwnerJID());
data.setNode(getNode()); data.setNode(getNode());
data.setSessionID(sessionID); data.setSessionID(sessionID);

View file

@ -90,7 +90,7 @@ public class AdHocCommandData extends IQ {
} }
buf.append(">"); buf.append(">");
if (getType() == Type.RESULT) { if (getType() == Type.result) {
buf.append("<actions"); buf.append("<actions");
if (executeAction != null) { if (executeAction != null) {

View file

@ -120,9 +120,9 @@ public class ServiceDiscoveryManager extends Manager {
if (connection == null) return; if (connection == null) return;
DiscoverItems discoverItems = (DiscoverItems) packet; DiscoverItems discoverItems = (DiscoverItems) packet;
// Send back the items defined in the client if the request is of type GET // Send back the items defined in the client if the request is of type GET
if (discoverItems != null && discoverItems.getType() == IQ.Type.GET) { if (discoverItems != null && discoverItems.getType() == IQ.Type.get) {
DiscoverItems response = new DiscoverItems(); DiscoverItems response = new DiscoverItems();
response.setType(IQ.Type.RESULT); response.setType(IQ.Type.result);
response.setTo(discoverItems.getFrom()); response.setTo(discoverItems.getFrom());
response.setPacketID(discoverItems.getPacketID()); response.setPacketID(discoverItems.getPacketID());
response.setNode(discoverItems.getNode()); response.setNode(discoverItems.getNode());
@ -139,7 +139,7 @@ public class ServiceDiscoveryManager extends Manager {
} else if(discoverItems.getNode() != null) { } else if(discoverItems.getNode() != null) {
// Return <item-not-found/> error since client doesn't contain // Return <item-not-found/> error since client doesn't contain
// the specified node // the specified node
response.setType(IQ.Type.ERROR); response.setType(IQ.Type.error);
response.setError(new XMPPError(XMPPError.Condition.item_not_found)); response.setError(new XMPPError(XMPPError.Condition.item_not_found));
} }
connection.sendPacket(response); connection.sendPacket(response);
@ -157,9 +157,9 @@ public class ServiceDiscoveryManager extends Manager {
if (connection == null) return; if (connection == null) return;
DiscoverInfo discoverInfo = (DiscoverInfo) packet; DiscoverInfo discoverInfo = (DiscoverInfo) packet;
// Answer the client's supported features if the request is of the GET type // Answer the client's supported features if the request is of the GET type
if (discoverInfo != null && discoverInfo.getType() == IQ.Type.GET) { if (discoverInfo != null && discoverInfo.getType() == IQ.Type.get) {
DiscoverInfo response = new DiscoverInfo(); DiscoverInfo response = new DiscoverInfo();
response.setType(IQ.Type.RESULT); response.setType(IQ.Type.result);
response.setTo(discoverInfo.getFrom()); response.setTo(discoverInfo.getFrom());
response.setPacketID(discoverInfo.getPacketID()); response.setPacketID(discoverInfo.getPacketID());
response.setNode(discoverInfo.getNode()); response.setNode(discoverInfo.getNode());
@ -185,7 +185,7 @@ public class ServiceDiscoveryManager extends Manager {
} }
else { else {
// Return <item-not-found/> error since specified node was not found // Return <item-not-found/> error since specified node was not found
response.setType(IQ.Type.ERROR); response.setType(IQ.Type.error);
response.setError(new XMPPError(XMPPError.Condition.item_not_found)); response.setError(new XMPPError(XMPPError.Condition.item_not_found));
} }
} }
@ -552,7 +552,7 @@ public class ServiceDiscoveryManager extends Manager {
public DiscoverInfo discoverInfo(String entityID, String node) throws NoResponseException, XMPPErrorException, NotConnectedException { public DiscoverInfo discoverInfo(String entityID, String node) throws NoResponseException, XMPPErrorException, NotConnectedException {
// Discover the entity's info // Discover the entity's info
DiscoverInfo disco = new DiscoverInfo(); DiscoverInfo disco = new DiscoverInfo();
disco.setType(IQ.Type.GET); disco.setType(IQ.Type.get);
disco.setTo(entityID); disco.setTo(entityID);
disco.setNode(node); disco.setNode(node);
@ -589,7 +589,7 @@ public class ServiceDiscoveryManager extends Manager {
public DiscoverItems discoverItems(String entityID, String node) throws NoResponseException, XMPPErrorException, NotConnectedException { public DiscoverItems discoverItems(String entityID, String node) throws NoResponseException, XMPPErrorException, NotConnectedException {
// Discover the entity's items // Discover the entity's items
DiscoverItems disco = new DiscoverItems(); DiscoverItems disco = new DiscoverItems();
disco.setType(IQ.Type.GET); disco.setType(IQ.Type.get);
disco.setTo(entityID); disco.setTo(entityID);
disco.setNode(node); disco.setNode(node);
@ -658,7 +658,7 @@ public class ServiceDiscoveryManager extends Manager {
*/ */
public void publishItems(String entityID, String node, DiscoverItems discoverItems) throws NoResponseException, XMPPErrorException, NotConnectedException public void publishItems(String entityID, String node, DiscoverItems discoverItems) throws NoResponseException, XMPPErrorException, NotConnectedException
{ {
discoverItems.setType(IQ.Type.SET); discoverItems.setType(IQ.Type.set);
discoverItems.setTo(entityID); discoverItems.setTo(entityID);
discoverItems.setNode(node); discoverItems.setNode(node);

View file

@ -173,7 +173,7 @@ public class FileTransferManager {
IQ rejection = FileTransferNegotiator.createIQ( IQ rejection = FileTransferNegotiator.createIQ(
initiation.getPacketID(), initiation.getFrom(), initiation initiation.getPacketID(), initiation.getFrom(), initiation
.getTo(), IQ.Type.ERROR); .getTo(), IQ.Type.error);
rejection.setError(new XMPPError(XMPPError.Condition.no_acceptable)); rejection.setError(new XMPPError(XMPPError.Condition.no_acceptable));
connection.sendPacket(rejection); connection.sendPacket(rejection);
} }

View file

@ -253,7 +253,7 @@ public class FileTransferNegotiator {
String errorMessage = "No stream methods contained in packet."; String errorMessage = "No stream methods contained in packet.";
XMPPError error = new XMPPError(XMPPError.Condition.bad_request, errorMessage); XMPPError error = new XMPPError(XMPPError.Condition.bad_request, errorMessage);
IQ iqPacket = createIQ(si.getPacketID(), si.getFrom(), si.getTo(), IQ iqPacket = createIQ(si.getPacketID(), si.getFrom(), si.getTo(),
IQ.Type.ERROR); IQ.Type.error);
iqPacket.setError(error); iqPacket.setError(error);
connection.sendPacket(iqPacket); connection.sendPacket(iqPacket);
throw new XMPPErrorException(errorMessage, error); throw new XMPPErrorException(errorMessage, error);
@ -267,7 +267,7 @@ public class FileTransferNegotiator {
} }
catch (XMPPErrorException e) { catch (XMPPErrorException e) {
IQ iqPacket = createIQ(si.getPacketID(), si.getFrom(), si.getTo(), IQ iqPacket = createIQ(si.getPacketID(), si.getFrom(), si.getTo(),
IQ.Type.ERROR); IQ.Type.error);
iqPacket.setError(e.getXMPPError()); iqPacket.setError(e.getXMPPError());
connection.sendPacket(iqPacket); connection.sendPacket(iqPacket);
throw e; throw e;
@ -331,7 +331,7 @@ public class FileTransferNegotiator {
public void rejectStream(final StreamInitiation si) throws NotConnectedException { public void rejectStream(final StreamInitiation si) throws NotConnectedException {
XMPPError error = new XMPPError(XMPPError.Condition.forbidden, "Offer Declined"); XMPPError error = new XMPPError(XMPPError.Condition.forbidden, "Offer Declined");
IQ iqPacket = createIQ(si.getPacketID(), si.getFrom(), si.getTo(), IQ iqPacket = createIQ(si.getPacketID(), si.getFrom(), si.getTo(),
IQ.Type.ERROR); IQ.Type.error);
iqPacket.setError(error); iqPacket.setError(error);
connection.sendPacket(iqPacket); connection.sendPacket(iqPacket);
} }
@ -396,7 +396,7 @@ public class FileTransferNegotiator {
si.setFrom(connection.getUser()); si.setFrom(connection.getUser());
si.setTo(userID); si.setTo(userID);
si.setType(IQ.Type.SET); si.setType(IQ.Type.set);
PacketCollector collector = connection.createPacketCollectorAndSend(si); PacketCollector collector = connection.createPacketCollectorAndSend(si);
Packet siResponse = collector.nextResult(responseTimeout); Packet siResponse = collector.nextResult(responseTimeout);
@ -404,7 +404,7 @@ public class FileTransferNegotiator {
if (siResponse instanceof IQ) { if (siResponse instanceof IQ) {
IQ iqResponse = (IQ) siResponse; IQ iqResponse = (IQ) siResponse;
if (iqResponse.getType().equals(IQ.Type.RESULT)) { if (iqResponse.getType().equals(IQ.Type.result)) {
StreamInitiation response = (StreamInitiation) siResponse; StreamInitiation response = (StreamInitiation) siResponse;
return getOutgoingNegotiator(getStreamMethodField(response return getOutgoingNegotiator(getStreamMethodField(response
.getFeatureNegotiationForm())); .getFeatureNegotiationForm()));

View file

@ -131,7 +131,7 @@ public class IBBTransferNegotiator extends StreamNegotiator {
// packet must by of type SET and contains the given session ID // packet must by of type SET and contains the given session ID
return this.sessionID.equals(bytestream.getSessionID()) return this.sessionID.equals(bytestream.getSessionID())
&& IQ.Type.SET.equals(bytestream.getType()); && IQ.Type.set.equals(bytestream.getType());
} }
return false; return false;
} }

View file

@ -149,7 +149,7 @@ public class Socks5TransferNegotiator extends StreamNegotiator {
// packet must by of type SET and contains the given session ID // packet must by of type SET and contains the given session ID
return this.sessionID.equals(bytestream.getSessionID()) return this.sessionID.equals(bytestream.getSessionID())
&& IQ.Type.SET.equals(bytestream.getType()); && IQ.Type.set.equals(bytestream.getType());
} }
return false; return false;
} }

View file

@ -59,7 +59,7 @@ public abstract class StreamNegotiator {
StreamInitiation response = new StreamInitiation(); StreamInitiation response = new StreamInitiation();
response.setTo(streamInitiationOffer.getFrom()); response.setTo(streamInitiationOffer.getFrom());
response.setFrom(streamInitiationOffer.getTo()); response.setFrom(streamInitiationOffer.getTo());
response.setType(IQ.Type.RESULT); response.setType(IQ.Type.result);
response.setPacketID(streamInitiationOffer.getPacketID()); response.setPacketID(streamInitiationOffer.getPacketID());
DataForm form = new DataForm(Form.TYPE_SUBMIT); DataForm form = new DataForm(Form.TYPE_SUBMIT);
@ -76,7 +76,7 @@ public abstract class StreamNegotiator {
public IQ createError(String from, String to, String packetID, XMPPError xmppError) { public IQ createError(String from, String to, String packetID, XMPPError xmppError) {
IQ iq = FileTransferNegotiator.createIQ(packetID, to, from, IQ.Type.ERROR); IQ iq = FileTransferNegotiator.createIQ(packetID, to, from, IQ.Type.error);
iq.setError(xmppError); iq.setError(xmppError);
return iq; return iq;
} }

View file

@ -165,7 +165,7 @@ public class LastActivityManager extends Manager {
public void processPacket(Packet packet) throws NotConnectedException { public void processPacket(Packet packet) throws NotConnectedException {
if (!enabled) return; if (!enabled) return;
LastActivity message = new LastActivity(); LastActivity message = new LastActivity();
message.setType(IQ.Type.RESULT); message.setType(IQ.Type.result);
message.setTo(packet.getFrom()); message.setTo(packet.getFrom());
message.setFrom(packet.getTo()); message.setFrom(packet.getTo());
message.setPacketID(packet.getPacketID()); message.setPacketID(packet.getPacketID());

View file

@ -43,7 +43,7 @@ public class LastActivity extends IQ {
public String message; public String message;
public LastActivity() { public LastActivity() {
setType(IQ.Type.GET); setType(IQ.Type.get);
} }
public LastActivity(String to) { public LastActivity(String to) {

View file

@ -162,7 +162,7 @@ public class PrivateDataManager extends Manager {
return buf.toString(); return buf.toString();
} }
}; };
privateDataGet.setType(IQ.Type.GET); privateDataGet.setType(IQ.Type.get);
PrivateDataResult response = (PrivateDataResult) connection().createPacketCollectorAndSend( PrivateDataResult response = (PrivateDataResult) connection().createPacketCollectorAndSend(
privateDataGet).nextResultOrThrow(); privateDataGet).nextResultOrThrow();
@ -190,7 +190,7 @@ public class PrivateDataManager extends Manager {
return buf.toString(); return buf.toString();
} }
}; };
privateDataSet.setType(IQ.Type.SET); privateDataSet.setType(IQ.Type.set);
connection().createPacketCollectorAndSend(privateDataSet).nextResultOrThrow(); connection().createPacketCollectorAndSend(privateDataSet).nextResultOrThrow();
} }

View file

@ -29,7 +29,7 @@ import org.jivesoftware.smack.util.StringUtils;
* <pre> * <pre>
* // Request the version from the server. * // Request the version from the server.
* Version versionRequest = new Version(); * Version versionRequest = new Version();
* timeRequest.setType(IQ.Type.GET); * timeRequest.setType(IQ.Type.get);
* timeRequest.setTo("example.com"); * timeRequest.setTo("example.com");
* *
* // Create a packet collector to listen for a response. * // Create a packet collector to listen for a response.
@ -40,7 +40,7 @@ import org.jivesoftware.smack.util.StringUtils;
* *
* // Wait up to 5 seconds for a result. * // Wait up to 5 seconds for a result.
* IQ result = (IQ)collector.nextResult(5000); * IQ result = (IQ)collector.nextResult(5000);
* if (result != null && result.getType() == IQ.Type.RESULT) { * if (result != null && result.getType() == IQ.Type.result) {
* Version versionResult = (Version)result; * Version versionResult = (Version)result;
* // Do something with result... * // Do something with result...
* }</pre><p> * }</pre><p>
@ -62,7 +62,7 @@ public class Version extends IQ {
* @param os The operating system of the queried entity. This element is OPTIONAL. * @param os The operating system of the queried entity. This element is OPTIONAL.
*/ */
public Version(String name, String version, String os) { public Version(String name, String version, String os) {
this.setType(IQ.Type.RESULT); this.setType(IQ.Type.result);
this.name = name; this.name = name;
this.version = version; this.version = version;
this.os = os; this.os = os;

View file

@ -566,7 +566,7 @@ public class MultiUserChat {
public Form getConfigurationForm() throws NoResponseException, XMPPErrorException, NotConnectedException { public Form getConfigurationForm() throws NoResponseException, XMPPErrorException, NotConnectedException {
MUCOwner iq = new MUCOwner(); MUCOwner iq = new MUCOwner();
iq.setTo(room); iq.setTo(room);
iq.setType(IQ.Type.GET); iq.setType(IQ.Type.get);
IQ answer = (IQ) connection.createPacketCollectorAndSend(iq).nextResultOrThrow(); IQ answer = (IQ) connection.createPacketCollectorAndSend(iq).nextResultOrThrow();
return Form.getFormFrom(answer); return Form.getFormFrom(answer);
@ -585,7 +585,7 @@ public class MultiUserChat {
public void sendConfigurationForm(Form form) throws NoResponseException, XMPPErrorException, NotConnectedException { public void sendConfigurationForm(Form form) throws NoResponseException, XMPPErrorException, NotConnectedException {
MUCOwner iq = new MUCOwner(); MUCOwner iq = new MUCOwner();
iq.setTo(room); iq.setTo(room);
iq.setType(IQ.Type.SET); iq.setType(IQ.Type.set);
iq.addExtension(form.getDataFormToSend()); iq.addExtension(form.getDataFormToSend());
connection.createPacketCollectorAndSend(iq).nextResultOrThrow(); connection.createPacketCollectorAndSend(iq).nextResultOrThrow();
@ -609,7 +609,7 @@ public class MultiUserChat {
*/ */
public Form getRegistrationForm() throws NoResponseException, XMPPErrorException, NotConnectedException { public Form getRegistrationForm() throws NoResponseException, XMPPErrorException, NotConnectedException {
Registration reg = new Registration(); Registration reg = new Registration();
reg.setType(IQ.Type.GET); reg.setType(IQ.Type.get);
reg.setTo(room); reg.setTo(room);
IQ result = (IQ) connection.createPacketCollectorAndSend(reg).nextResultOrThrow(); IQ result = (IQ) connection.createPacketCollectorAndSend(reg).nextResultOrThrow();
@ -634,7 +634,7 @@ public class MultiUserChat {
*/ */
public void sendRegistrationForm(Form form) throws NoResponseException, XMPPErrorException, NotConnectedException { public void sendRegistrationForm(Form form) throws NoResponseException, XMPPErrorException, NotConnectedException {
Registration reg = new Registration(); Registration reg = new Registration();
reg.setType(IQ.Type.SET); reg.setType(IQ.Type.set);
reg.setTo(room); reg.setTo(room);
reg.addExtension(form.getDataFormToSend()); reg.addExtension(form.getDataFormToSend());
@ -658,7 +658,7 @@ public class MultiUserChat {
public void destroy(String reason, String alternateJID) throws NoResponseException, XMPPErrorException, NotConnectedException { public void destroy(String reason, String alternateJID) throws NoResponseException, XMPPErrorException, NotConnectedException {
MUCOwner iq = new MUCOwner(); MUCOwner iq = new MUCOwner();
iq.setTo(room); iq.setTo(room);
iq.setType(IQ.Type.SET); iq.setType(IQ.Type.set);
// Create the reason for the room destruction // Create the reason for the room destruction
MUCOwner.Destroy destroy = new MUCOwner.Destroy(); MUCOwner.Destroy destroy = new MUCOwner.Destroy();
@ -1369,7 +1369,7 @@ public class MultiUserChat {
throws XMPPErrorException, NoResponseException, NotConnectedException { throws XMPPErrorException, NoResponseException, NotConnectedException {
MUCOwner iq = new MUCOwner(); MUCOwner iq = new MUCOwner();
iq.setTo(room); iq.setTo(room);
iq.setType(IQ.Type.SET); iq.setType(IQ.Type.set);
// Set the new affiliation. // Set the new affiliation.
MUCOwner.Item item = new MUCOwner.Item(affiliation); MUCOwner.Item item = new MUCOwner.Item(affiliation);
item.setJid(jid); item.setJid(jid);
@ -1382,7 +1382,7 @@ public class MultiUserChat {
throws NoResponseException, XMPPErrorException, NotConnectedException { throws NoResponseException, XMPPErrorException, NotConnectedException {
MUCOwner iq = new MUCOwner(); MUCOwner iq = new MUCOwner();
iq.setTo(room); iq.setTo(room);
iq.setType(IQ.Type.SET); iq.setType(IQ.Type.set);
for (String jid : jids) { for (String jid : jids) {
// Set the new affiliation. // Set the new affiliation.
MUCOwner.Item item = new MUCOwner.Item(affiliation); MUCOwner.Item item = new MUCOwner.Item(affiliation);
@ -1407,7 +1407,7 @@ public class MultiUserChat {
{ {
MUCAdmin iq = new MUCAdmin(); MUCAdmin iq = new MUCAdmin();
iq.setTo(room); iq.setTo(room);
iq.setType(IQ.Type.SET); iq.setType(IQ.Type.set);
// Set the new affiliation. // Set the new affiliation.
MUCAdmin.Item item = new MUCAdmin.Item(affiliation, null); MUCAdmin.Item item = new MUCAdmin.Item(affiliation, null);
item.setJid(jid); item.setJid(jid);
@ -1421,7 +1421,7 @@ public class MultiUserChat {
throws NoResponseException, XMPPErrorException, NotConnectedException { throws NoResponseException, XMPPErrorException, NotConnectedException {
MUCAdmin iq = new MUCAdmin(); MUCAdmin iq = new MUCAdmin();
iq.setTo(room); iq.setTo(room);
iq.setType(IQ.Type.SET); iq.setType(IQ.Type.set);
for (String jid : jids) { for (String jid : jids) {
// Set the new affiliation. // Set the new affiliation.
MUCAdmin.Item item = new MUCAdmin.Item(affiliation, null); MUCAdmin.Item item = new MUCAdmin.Item(affiliation, null);
@ -1435,7 +1435,7 @@ public class MultiUserChat {
private void changeRole(String nickname, String role, String reason) throws NoResponseException, XMPPErrorException, NotConnectedException { private void changeRole(String nickname, String role, String reason) throws NoResponseException, XMPPErrorException, NotConnectedException {
MUCAdmin iq = new MUCAdmin(); MUCAdmin iq = new MUCAdmin();
iq.setTo(room); iq.setTo(room);
iq.setType(IQ.Type.SET); iq.setType(IQ.Type.set);
// Set the new role. // Set the new role.
MUCAdmin.Item item = new MUCAdmin.Item(null, role); MUCAdmin.Item item = new MUCAdmin.Item(null, role);
item.setNick(nickname); item.setNick(nickname);
@ -1448,7 +1448,7 @@ public class MultiUserChat {
private void changeRole(Collection<String> nicknames, String role) throws NoResponseException, XMPPErrorException, NotConnectedException { private void changeRole(Collection<String> nicknames, String role) throws NoResponseException, XMPPErrorException, NotConnectedException {
MUCAdmin iq = new MUCAdmin(); MUCAdmin iq = new MUCAdmin();
iq.setTo(room); iq.setTo(room);
iq.setType(IQ.Type.SET); iq.setType(IQ.Type.set);
for (String nickname : nicknames) { for (String nickname : nicknames) {
// Set the new role. // Set the new role.
MUCAdmin.Item item = new MUCAdmin.Item(null, role); MUCAdmin.Item item = new MUCAdmin.Item(null, role);
@ -1604,7 +1604,7 @@ public class MultiUserChat {
private Collection<Affiliate> getAffiliatesByAdmin(String affiliation) throws NoResponseException, XMPPErrorException, NotConnectedException { private Collection<Affiliate> getAffiliatesByAdmin(String affiliation) throws NoResponseException, XMPPErrorException, NotConnectedException {
MUCAdmin iq = new MUCAdmin(); MUCAdmin iq = new MUCAdmin();
iq.setTo(room); iq.setTo(room);
iq.setType(IQ.Type.GET); iq.setType(IQ.Type.get);
// Set the specified affiliation. This may request the list of owners/admins/members/outcasts. // Set the specified affiliation. This may request the list of owners/admins/members/outcasts.
MUCAdmin.Item item = new MUCAdmin.Item(affiliation, null); MUCAdmin.Item item = new MUCAdmin.Item(affiliation, null);
iq.addItem(item); iq.addItem(item);
@ -1656,7 +1656,7 @@ public class MultiUserChat {
private Collection<Occupant> getOccupants(String role) throws NoResponseException, XMPPErrorException, NotConnectedException { private Collection<Occupant> getOccupants(String role) throws NoResponseException, XMPPErrorException, NotConnectedException {
MUCAdmin iq = new MUCAdmin(); MUCAdmin iq = new MUCAdmin();
iq.setTo(room); iq.setTo(room);
iq.setType(IQ.Type.GET); iq.setType(IQ.Type.get);
// Set the specified role. This may request the list of moderators/participants. // Set the specified role. This may request the list of moderators/participants.
MUCAdmin.Item item = new MUCAdmin.Item(null, role); MUCAdmin.Item item = new MUCAdmin.Item(null, role);
iq.addItem(item); iq.addItem(item);

View file

@ -111,7 +111,7 @@ public class PEPManager {
public void publish(PEPItem item) throws NotConnectedException { public void publish(PEPItem item) throws NotConnectedException {
// Create a new message to publish the event. // Create a new message to publish the event.
PEPPubSub pubSub = new PEPPubSub(item); PEPPubSub pubSub = new PEPPubSub(item);
pubSub.setType(Type.SET); pubSub.setType(Type.set);
//pubSub.setFrom(connection.getUser()); //pubSub.setFrom(connection.getUser());
// Send the message that contains the roster // Send the message that contains the roster

View file

@ -28,7 +28,7 @@ public class Ping extends IQ {
public Ping(String to) { public Ping(String to) {
setTo(to); setTo(to);
setType(IQ.Type.GET); setType(IQ.Type.get);
} }
@Override @Override

View file

@ -28,7 +28,7 @@ public class Pong extends IQ {
* @param ping * @param ping
*/ */
public Pong(Packet ping) { public Pong(Packet ping) {
setType(IQ.Type.RESULT); setType(IQ.Type.result);
setFrom(ping.getTo()); setFrom(ping.getTo());
setTo(ping.getFrom()); setTo(ping.getFrom());
setPacketID(ping.getPacketID()); setPacketID(ping.getPacketID());

View file

@ -148,7 +148,7 @@ public class PrivacyListManager extends Manager {
*/ */
private Privacy getRequest(Privacy requestPrivacy) throws NoResponseException, XMPPErrorException, NotConnectedException { private Privacy getRequest(Privacy requestPrivacy) throws NoResponseException, XMPPErrorException, NotConnectedException {
// The request is a get iq type // The request is a get iq type
requestPrivacy.setType(Privacy.Type.GET); requestPrivacy.setType(Privacy.Type.get);
requestPrivacy.setFrom(this.getUser()); requestPrivacy.setFrom(this.getUser());
Privacy privacyAnswer = (Privacy) connection().createPacketCollectorAndSend(requestPrivacy).nextResultOrThrow(); Privacy privacyAnswer = (Privacy) connection().createPacketCollectorAndSend(requestPrivacy).nextResultOrThrow();
@ -168,7 +168,7 @@ public class PrivacyListManager extends Manager {
*/ */
private Packet setRequest(Privacy requestPrivacy) throws NoResponseException, XMPPErrorException, NotConnectedException { private Packet setRequest(Privacy requestPrivacy) throws NoResponseException, XMPPErrorException, NotConnectedException {
// The request is a get iq type // The request is a get iq type
requestPrivacy.setType(Privacy.Type.SET); requestPrivacy.setType(Privacy.Type.set);
requestPrivacy.setFrom(this.getUser()); requestPrivacy.setFrom(this.getUser());
return connection().createPacketCollectorAndSend(requestPrivacy).nextResultOrThrow(); return connection().createPacketCollectorAndSend(requestPrivacy).nextResultOrThrow();

View file

@ -71,7 +71,7 @@ public class LeafNode extends Node
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public <T extends Item> List<T> getItems() throws NoResponseException, XMPPErrorException, NotConnectedException public <T extends Item> List<T> getItems() throws NoResponseException, XMPPErrorException, NotConnectedException
{ {
PubSub request = createPubsubPacket(Type.GET, new GetItemsRequest(getId())); PubSub request = createPubsubPacket(Type.get, new GetItemsRequest(getId()));
PubSub result = (PubSub) con.createPacketCollectorAndSend(request).nextResultOrThrow(); PubSub result = (PubSub) con.createPacketCollectorAndSend(request).nextResultOrThrow();
ItemsExtension itemsElem = (ItemsExtension)result.getExtension(PubSubElementType.ITEMS); ItemsExtension itemsElem = (ItemsExtension)result.getExtension(PubSubElementType.ITEMS);
@ -93,7 +93,7 @@ public class LeafNode extends Node
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public <T extends Item> List<T> getItems(String subscriptionId) throws NoResponseException, XMPPErrorException, NotConnectedException public <T extends Item> List<T> getItems(String subscriptionId) throws NoResponseException, XMPPErrorException, NotConnectedException
{ {
PubSub request = createPubsubPacket(Type.GET, new GetItemsRequest(getId(), subscriptionId)); PubSub request = createPubsubPacket(Type.get, new GetItemsRequest(getId(), subscriptionId));
PubSub result = (PubSub) con.createPacketCollectorAndSend(request).nextResultOrThrow(); PubSub result = (PubSub) con.createPacketCollectorAndSend(request).nextResultOrThrow();
ItemsExtension itemsElem = (ItemsExtension)result.getExtension(PubSubElementType.ITEMS); ItemsExtension itemsElem = (ItemsExtension)result.getExtension(PubSubElementType.ITEMS);
@ -123,7 +123,7 @@ public class LeafNode extends Node
{ {
itemList.add(new Item(id)); itemList.add(new Item(id));
} }
PubSub request = createPubsubPacket(Type.GET, new ItemsExtension(ItemsExtension.ItemsElementType.items, getId(), itemList)); PubSub request = createPubsubPacket(Type.get, new ItemsExtension(ItemsExtension.ItemsElementType.items, getId(), itemList));
PubSub result = (PubSub) con.createPacketCollectorAndSend(request).nextResultOrThrow(); PubSub result = (PubSub) con.createPacketCollectorAndSend(request).nextResultOrThrow();
ItemsExtension itemsElem = (ItemsExtension)result.getExtension(PubSubElementType.ITEMS); ItemsExtension itemsElem = (ItemsExtension)result.getExtension(PubSubElementType.ITEMS);
@ -143,7 +143,7 @@ public class LeafNode extends Node
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public <T extends Item> List<T> getItems(int maxItems) throws NoResponseException, XMPPErrorException, NotConnectedException public <T extends Item> List<T> getItems(int maxItems) throws NoResponseException, XMPPErrorException, NotConnectedException
{ {
PubSub request = createPubsubPacket(Type.GET, new GetItemsRequest(getId(), maxItems)); PubSub request = createPubsubPacket(Type.get, new GetItemsRequest(getId(), maxItems));
PubSub result = (PubSub) con.createPacketCollectorAndSend(request).nextResultOrThrow(); PubSub result = (PubSub) con.createPacketCollectorAndSend(request).nextResultOrThrow();
ItemsExtension itemsElem = (ItemsExtension)result.getExtension(PubSubElementType.ITEMS); ItemsExtension itemsElem = (ItemsExtension)result.getExtension(PubSubElementType.ITEMS);
@ -166,7 +166,7 @@ public class LeafNode extends Node
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public <T extends Item> List<T> getItems(int maxItems, String subscriptionId) throws NoResponseException, XMPPErrorException, NotConnectedException public <T extends Item> List<T> getItems(int maxItems, String subscriptionId) throws NoResponseException, XMPPErrorException, NotConnectedException
{ {
PubSub request = createPubsubPacket(Type.GET, new GetItemsRequest(getId(), subscriptionId, maxItems)); PubSub request = createPubsubPacket(Type.get, new GetItemsRequest(getId(), subscriptionId, maxItems));
PubSub result = (PubSub) con.createPacketCollectorAndSend(request).nextResultOrThrow(); PubSub result = (PubSub) con.createPacketCollectorAndSend(request).nextResultOrThrow();
ItemsExtension itemsElem = (ItemsExtension)result.getExtension(PubSubElementType.ITEMS); ItemsExtension itemsElem = (ItemsExtension)result.getExtension(PubSubElementType.ITEMS);
@ -188,7 +188,7 @@ public class LeafNode extends Node
*/ */
public void publish() throws NotConnectedException public void publish() throws NotConnectedException
{ {
PubSub packet = createPubsubPacket(Type.SET, new NodeExtension(PubSubElementType.PUBLISH, getId())); PubSub packet = createPubsubPacket(Type.set, new NodeExtension(PubSubElementType.PUBLISH, getId()));
con.sendPacket(packet); con.sendPacket(packet);
} }
@ -233,7 +233,7 @@ public class LeafNode extends Node
*/ */
public <T extends Item> void publish(Collection<T> items) throws NotConnectedException public <T extends Item> void publish(Collection<T> items) throws NotConnectedException
{ {
PubSub packet = createPubsubPacket(Type.SET, new PublishItem<T>(getId(), items)); PubSub packet = createPubsubPacket(Type.set, new PublishItem<T>(getId(), items));
con.sendPacket(packet); con.sendPacket(packet);
} }
@ -256,7 +256,7 @@ public class LeafNode extends Node
*/ */
public void send() throws NoResponseException, XMPPErrorException, NotConnectedException public void send() throws NoResponseException, XMPPErrorException, NotConnectedException
{ {
PubSub packet = createPubsubPacket(Type.SET, new NodeExtension(PubSubElementType.PUBLISH, getId())); PubSub packet = createPubsubPacket(Type.set, new NodeExtension(PubSubElementType.PUBLISH, getId()));
con.createPacketCollectorAndSend(packet).nextResultOrThrow(); con.createPacketCollectorAndSend(packet).nextResultOrThrow();
} }
@ -311,7 +311,7 @@ public class LeafNode extends Node
*/ */
public <T extends Item> void send(Collection<T> items) throws NoResponseException, XMPPErrorException, NotConnectedException public <T extends Item> void send(Collection<T> items) throws NoResponseException, XMPPErrorException, NotConnectedException
{ {
PubSub packet = createPubsubPacket(Type.SET, new PublishItem<T>(getId(), items)); PubSub packet = createPubsubPacket(Type.set, new PublishItem<T>(getId(), items));
con.createPacketCollectorAndSend(packet).nextResultOrThrow(); con.createPacketCollectorAndSend(packet).nextResultOrThrow();
} }
@ -327,7 +327,7 @@ public class LeafNode extends Node
*/ */
public void deleteAllItems() throws NoResponseException, XMPPErrorException, NotConnectedException public void deleteAllItems() throws NoResponseException, XMPPErrorException, NotConnectedException
{ {
PubSub request = createPubsubPacket(Type.SET, new NodeExtension(PubSubElementType.PURGE_OWNER, getId()), PubSubElementType.PURGE_OWNER.getNamespace()); PubSub request = createPubsubPacket(Type.set, new NodeExtension(PubSubElementType.PURGE_OWNER, getId()), PubSubElementType.PURGE_OWNER.getNamespace());
con.createPacketCollectorAndSend(request).nextResultOrThrow(); con.createPacketCollectorAndSend(request).nextResultOrThrow();
} }
@ -363,7 +363,7 @@ public class LeafNode extends Node
{ {
items.add(new Item(id)); items.add(new Item(id));
} }
PubSub request = createPubsubPacket(Type.SET, new ItemsExtension(ItemsExtension.ItemsElementType.retract, getId(), items)); PubSub request = createPubsubPacket(Type.set, new ItemsExtension(ItemsExtension.ItemsElementType.retract, getId(), items));
con.createPacketCollectorAndSend(request).nextResultOrThrow(); con.createPacketCollectorAndSend(request).nextResultOrThrow();
} }
} }

View file

@ -98,7 +98,7 @@ abstract public class Node
*/ */
public ConfigureForm getNodeConfiguration() throws NoResponseException, XMPPErrorException, NotConnectedException public ConfigureForm getNodeConfiguration() throws NoResponseException, XMPPErrorException, NotConnectedException
{ {
Packet reply = sendPubsubPacket(Type.GET, new NodeExtension(PubSubElementType.CONFIGURE_OWNER, getId()), PubSubNamespace.OWNER); Packet reply = sendPubsubPacket(Type.get, new NodeExtension(PubSubElementType.CONFIGURE_OWNER, getId()), PubSubNamespace.OWNER);
return NodeUtils.getFormFromPacket(reply, PubSubElementType.CONFIGURE_OWNER); return NodeUtils.getFormFromPacket(reply, PubSubElementType.CONFIGURE_OWNER);
} }
@ -112,7 +112,7 @@ abstract public class Node
*/ */
public void sendConfigurationForm(Form submitForm) throws NoResponseException, XMPPErrorException, NotConnectedException public void sendConfigurationForm(Form submitForm) throws NoResponseException, XMPPErrorException, NotConnectedException
{ {
PubSub packet = createPubsubPacket(Type.SET, new FormNode(FormNodeType.CONFIGURE_OWNER, getId(), submitForm), PubSubNamespace.OWNER); PubSub packet = createPubsubPacket(Type.set, new FormNode(FormNodeType.CONFIGURE_OWNER, getId(), submitForm), PubSubNamespace.OWNER);
con.createPacketCollectorAndSend(packet).nextResultOrThrow(); con.createPacketCollectorAndSend(packet).nextResultOrThrow();
} }
@ -143,7 +143,7 @@ abstract public class Node
*/ */
public List<Subscription> getSubscriptions() throws NoResponseException, XMPPErrorException, NotConnectedException public List<Subscription> getSubscriptions() throws NoResponseException, XMPPErrorException, NotConnectedException
{ {
PubSub reply = (PubSub)sendPubsubPacket(Type.GET, new NodeExtension(PubSubElementType.SUBSCRIPTIONS, getId())); PubSub reply = (PubSub)sendPubsubPacket(Type.get, new NodeExtension(PubSubElementType.SUBSCRIPTIONS, getId()));
SubscriptionsExtension subElem = (SubscriptionsExtension)reply.getExtension(PubSubElementType.SUBSCRIPTIONS); SubscriptionsExtension subElem = (SubscriptionsExtension)reply.getExtension(PubSubElementType.SUBSCRIPTIONS);
return subElem.getSubscriptions(); return subElem.getSubscriptions();
} }
@ -167,7 +167,7 @@ abstract public class Node
*/ */
public Subscription subscribe(String jid) throws NoResponseException, XMPPErrorException, NotConnectedException public Subscription subscribe(String jid) throws NoResponseException, XMPPErrorException, NotConnectedException
{ {
PubSub reply = (PubSub)sendPubsubPacket(Type.SET, new SubscribeExtension(jid, getId())); PubSub reply = (PubSub)sendPubsubPacket(Type.set, new SubscribeExtension(jid, getId()));
return (Subscription)reply.getExtension(PubSubElementType.SUBSCRIPTION); return (Subscription)reply.getExtension(PubSubElementType.SUBSCRIPTION);
} }
@ -191,9 +191,9 @@ abstract public class Node
*/ */
public Subscription subscribe(String jid, SubscribeForm subForm) throws NoResponseException, XMPPErrorException, NotConnectedException public Subscription subscribe(String jid, SubscribeForm subForm) throws NoResponseException, XMPPErrorException, NotConnectedException
{ {
PubSub request = createPubsubPacket(Type.SET, new SubscribeExtension(jid, getId())); PubSub request = createPubsubPacket(Type.set, new SubscribeExtension(jid, getId()));
request.addExtension(new FormNode(FormNodeType.OPTIONS, subForm)); request.addExtension(new FormNode(FormNodeType.OPTIONS, subForm));
PubSub reply = (PubSub)PubSubManager.sendPubsubPacket(con, jid, Type.SET, request); PubSub reply = (PubSub)PubSubManager.sendPubsubPacket(con, jid, Type.set, request);
return (Subscription)reply.getExtension(PubSubElementType.SUBSCRIPTION); return (Subscription)reply.getExtension(PubSubElementType.SUBSCRIPTION);
} }
@ -224,7 +224,7 @@ abstract public class Node
*/ */
public void unsubscribe(String jid, String subscriptionId) throws NoResponseException, XMPPErrorException, NotConnectedException public void unsubscribe(String jid, String subscriptionId) throws NoResponseException, XMPPErrorException, NotConnectedException
{ {
sendPubsubPacket(Type.SET, new UnsubscribeExtension(jid, getId(), subscriptionId)); sendPubsubPacket(Type.set, new UnsubscribeExtension(jid, getId(), subscriptionId));
} }
/** /**
@ -256,7 +256,7 @@ abstract public class Node
*/ */
public SubscribeForm getSubscriptionOptions(String jid, String subscriptionId) throws NoResponseException, XMPPErrorException, NotConnectedException public SubscribeForm getSubscriptionOptions(String jid, String subscriptionId) throws NoResponseException, XMPPErrorException, NotConnectedException
{ {
PubSub packet = (PubSub)sendPubsubPacket(Type.GET, new OptionsExtension(jid, getId(), subscriptionId)); PubSub packet = (PubSub)sendPubsubPacket(Type.get, new OptionsExtension(jid, getId(), subscriptionId));
FormNode ext = (FormNode)packet.getExtension(PubSubElementType.OPTIONS); FormNode ext = (FormNode)packet.getExtension(PubSubElementType.OPTIONS);
return new SubscribeForm(ext.getForm()); return new SubscribeForm(ext.getForm());
} }

View file

@ -86,7 +86,7 @@ final public class PubSubManager
*/ */
public LeafNode createNode() throws NoResponseException, XMPPErrorException, NotConnectedException public LeafNode createNode() throws NoResponseException, XMPPErrorException, NotConnectedException
{ {
PubSub reply = (PubSub)sendPubsubPacket(Type.SET, new NodeExtension(PubSubElementType.CREATE)); PubSub reply = (PubSub)sendPubsubPacket(Type.set, new NodeExtension(PubSubElementType.CREATE));
NodeExtension elem = (NodeExtension)reply.getExtension("create", PubSubNamespace.BASIC.getXmlns()); NodeExtension elem = (NodeExtension)reply.getExtension("create", PubSubNamespace.BASIC.getXmlns());
LeafNode newNode = new LeafNode(con, elem.getNode()); LeafNode newNode = new LeafNode(con, elem.getNode());
@ -126,7 +126,7 @@ final public class PubSubManager
*/ */
public Node createNode(String name, Form config) throws NoResponseException, XMPPErrorException, NotConnectedException public Node createNode(String name, Form config) throws NoResponseException, XMPPErrorException, NotConnectedException
{ {
PubSub request = createPubsubPacket(to, Type.SET, new NodeExtension(PubSubElementType.CREATE, name)); PubSub request = createPubsubPacket(to, Type.set, new NodeExtension(PubSubElementType.CREATE, name));
boolean isLeafNode = true; boolean isLeafNode = true;
if (config != null) if (config != null)
@ -140,7 +140,7 @@ final public class PubSubManager
// Errors will cause exceptions in getReply, so it only returns // Errors will cause exceptions in getReply, so it only returns
// on success. // on success.
sendPubsubPacket(con, to, Type.SET, request); sendPubsubPacket(con, to, Type.set, request);
Node newNode = isLeafNode ? new LeafNode(con, name) : new CollectionNode(con, name); Node newNode = isLeafNode ? new LeafNode(con, name) : new CollectionNode(con, name);
newNode.setTo(to); newNode.setTo(to);
nodeMap.put(newNode.getId(), newNode); nodeMap.put(newNode.getId(), newNode);
@ -217,7 +217,7 @@ final public class PubSubManager
*/ */
public List<Subscription> getSubscriptions() throws NoResponseException, XMPPErrorException, NotConnectedException public List<Subscription> getSubscriptions() throws NoResponseException, XMPPErrorException, NotConnectedException
{ {
Packet reply = sendPubsubPacket(Type.GET, new NodeExtension(PubSubElementType.SUBSCRIPTIONS)); Packet reply = sendPubsubPacket(Type.get, new NodeExtension(PubSubElementType.SUBSCRIPTIONS));
SubscriptionsExtension subElem = (SubscriptionsExtension)reply.getExtension(PubSubElementType.SUBSCRIPTIONS.getElementName(), PubSubElementType.SUBSCRIPTIONS.getNamespace().getXmlns()); SubscriptionsExtension subElem = (SubscriptionsExtension)reply.getExtension(PubSubElementType.SUBSCRIPTIONS.getElementName(), PubSubElementType.SUBSCRIPTIONS.getNamespace().getXmlns());
return subElem.getSubscriptions(); return subElem.getSubscriptions();
} }
@ -233,7 +233,7 @@ final public class PubSubManager
*/ */
public List<Affiliation> getAffiliations() throws NoResponseException, XMPPErrorException, NotConnectedException public List<Affiliation> getAffiliations() throws NoResponseException, XMPPErrorException, NotConnectedException
{ {
PubSub reply = (PubSub)sendPubsubPacket(Type.GET, new NodeExtension(PubSubElementType.AFFILIATIONS)); PubSub reply = (PubSub)sendPubsubPacket(Type.get, new NodeExtension(PubSubElementType.AFFILIATIONS));
AffiliationsExtension listElem = (AffiliationsExtension)reply.getExtension(PubSubElementType.AFFILIATIONS); AffiliationsExtension listElem = (AffiliationsExtension)reply.getExtension(PubSubElementType.AFFILIATIONS);
return listElem.getAffiliations(); return listElem.getAffiliations();
} }
@ -248,7 +248,7 @@ final public class PubSubManager
*/ */
public void deleteNode(String nodeId) throws NoResponseException, XMPPErrorException, NotConnectedException public void deleteNode(String nodeId) throws NoResponseException, XMPPErrorException, NotConnectedException
{ {
sendPubsubPacket(Type.SET, new NodeExtension(PubSubElementType.DELETE, nodeId), PubSubElementType.DELETE.getNamespace()); sendPubsubPacket(Type.set, new NodeExtension(PubSubElementType.DELETE, nodeId), PubSubElementType.DELETE.getNamespace());
nodeMap.remove(nodeId); nodeMap.remove(nodeId);
} }
@ -264,7 +264,7 @@ final public class PubSubManager
{ {
// Errors will cause exceptions in getReply, so it only returns // Errors will cause exceptions in getReply, so it only returns
// on success. // on success.
PubSub reply = (PubSub)sendPubsubPacket(Type.GET, new NodeExtension(PubSubElementType.DEFAULT), PubSubElementType.DEFAULT.getNamespace()); PubSub reply = (PubSub)sendPubsubPacket(Type.get, new NodeExtension(PubSubElementType.DEFAULT), PubSubElementType.DEFAULT.getNamespace());
return NodeUtils.getFormFromPacket(reply, PubSubElementType.DEFAULT); return NodeUtils.getFormFromPacket(reply, PubSubElementType.DEFAULT);
} }

View file

@ -66,7 +66,7 @@ public class UserSearch extends IQ {
*/ */
public Form getSearchForm(XMPPConnection con, String searchService) throws NoResponseException, XMPPErrorException, NotConnectedException { public Form getSearchForm(XMPPConnection con, String searchService) throws NoResponseException, XMPPErrorException, NotConnectedException {
UserSearch search = new UserSearch(); UserSearch search = new UserSearch();
search.setType(IQ.Type.GET); search.setType(IQ.Type.get);
search.setTo(searchService); search.setTo(searchService);
IQ response = (IQ) con.createPacketCollectorAndSend(search).nextResultOrThrow(); IQ response = (IQ) con.createPacketCollectorAndSend(search).nextResultOrThrow();
@ -86,7 +86,7 @@ public class UserSearch extends IQ {
*/ */
public ReportedData sendSearchForm(XMPPConnection con, Form searchForm, String searchService) throws NoResponseException, XMPPErrorException, NotConnectedException { public ReportedData sendSearchForm(XMPPConnection con, Form searchForm, String searchService) throws NoResponseException, XMPPErrorException, NotConnectedException {
UserSearch search = new UserSearch(); UserSearch search = new UserSearch();
search.setType(IQ.Type.SET); search.setType(IQ.Type.set);
search.setTo(searchService); search.setTo(searchService);
search.addExtension(searchForm.getDataFormToSend()); search.addExtension(searchForm.getDataFormToSend());
@ -108,7 +108,7 @@ public class UserSearch extends IQ {
public ReportedData sendSimpleSearchForm(XMPPConnection con, Form searchForm, String searchService) throws NoResponseException, XMPPErrorException, NotConnectedException { public ReportedData sendSimpleSearchForm(XMPPConnection con, Form searchForm, String searchService) throws NoResponseException, XMPPErrorException, NotConnectedException {
SimpleUserSearch search = new SimpleUserSearch(); SimpleUserSearch search = new SimpleUserSearch();
search.setForm(searchForm); search.setForm(searchForm);
search.setType(IQ.Type.SET); search.setType(IQ.Type.set);
search.setTo(searchService); search.setTo(searchService);
SimpleUserSearch response = (SimpleUserSearch) con.createPacketCollectorAndSend(search).nextResultOrThrow(); SimpleUserSearch response = (SimpleUserSearch) con.createPacketCollectorAndSend(search).nextResultOrThrow();

View file

@ -48,7 +48,7 @@ public class SharedGroupManager {
public static List<String> getSharedGroups(XMPPConnection connection) throws NoResponseException, XMPPErrorException, NotConnectedException { public static List<String> getSharedGroups(XMPPConnection connection) throws NoResponseException, XMPPErrorException, NotConnectedException {
// Discover the shared groups of the logged user // Discover the shared groups of the logged user
SharedGroupsInfo info = new SharedGroupsInfo(); SharedGroupsInfo info = new SharedGroupsInfo();
info.setType(IQ.Type.GET); info.setType(IQ.Type.get);
SharedGroupsInfo result = (SharedGroupsInfo) connection.createPacketCollectorAndSend(info).nextResultOrThrow(); SharedGroupsInfo result = (SharedGroupsInfo) connection.createPacketCollectorAndSend(info).nextResultOrThrow();
return result.getGroups(); return result.getGroups();

View file

@ -134,7 +134,7 @@ public class StreamInitiation extends IQ {
*/ */
public String getChildElementXML() { public String getChildElementXML() {
StringBuilder buf = new StringBuilder(); StringBuilder buf = new StringBuilder();
if (this.getType().equals(IQ.Type.SET)) { if (this.getType().equals(IQ.Type.set)) {
buf.append("<si xmlns=\"http://jabber.org/protocol/si\" "); buf.append("<si xmlns=\"http://jabber.org/protocol/si\" ");
if (getSessionID() != null) { if (getSessionID() != null) {
buf.append("id=\"").append(getSessionID()).append("\" "); buf.append("id=\"").append(getSessionID()).append("\" ");
@ -151,7 +151,7 @@ public class StreamInitiation extends IQ {
buf.append(fileXML); buf.append(fileXML);
} }
} }
else if (this.getType().equals(IQ.Type.RESULT)) { else if (this.getType().equals(IQ.Type.result)) {
buf.append("<si xmlns=\"http://jabber.org/protocol/si\">"); buf.append("<si xmlns=\"http://jabber.org/protocol/si\">");
} }
else { else {

View file

@ -43,7 +43,7 @@ public class Time extends IQ {
private String tzo; private String tzo;
public Time() { public Time() {
setType(Type.GET); setType(Type.get);
} }
/** /**
@ -123,7 +123,7 @@ public class Time extends IQ {
public static Time createResponse(Packet request) { public static Time createResponse(Packet request) {
Time time = new Time(Calendar.getInstance()); Time time = new Time(Calendar.getInstance());
time.setType(Type.RESULT); time.setType(Type.result);
time.setTo(request.getFrom()); time.setTo(request.getFrom());
return time; return time;
} }

View file

@ -523,7 +523,7 @@ public class VCard extends IQ {
public void save(XMPPConnection connection) throws NoResponseException, XMPPErrorException, NotConnectedException { public void save(XMPPConnection connection) throws NoResponseException, XMPPErrorException, NotConnectedException {
checkAuthenticated(connection, true); checkAuthenticated(connection, true);
setType(IQ.Type.SET); setType(IQ.Type.set);
setFrom(connection.getUser()); setFrom(connection.getUser());
connection.createPacketCollectorAndSend(this).nextResultOrThrow(); connection.createPacketCollectorAndSend(this).nextResultOrThrow();
} }
@ -556,7 +556,7 @@ public class VCard extends IQ {
} }
private void doLoad(XMPPConnection connection, String user) throws NoResponseException, XMPPErrorException, NotConnectedException { private void doLoad(XMPPConnection connection, String user) throws NoResponseException, XMPPErrorException, NotConnectedException {
setType(Type.GET); setType(Type.get);
VCard result = (VCard) connection.createPacketCollectorAndSend(this).nextResultOrThrow(); VCard result = (VCard) connection.createPacketCollectorAndSend(this).nextResultOrThrow();
copyFieldsFrom(result); copyFieldsFrom(result);
} }

View file

@ -73,7 +73,7 @@ public class CloseListenerTest {
// assert that reply is the correct error packet // assert that reply is the correct error packet
assertEquals(initiatorJID, argument.getValue().getTo()); assertEquals(initiatorJID, argument.getValue().getTo());
assertEquals(IQ.Type.ERROR, argument.getValue().getType()); assertEquals(IQ.Type.error, argument.getValue().getType());
assertEquals(XMPPError.Condition.item_not_found.toString(), assertEquals(XMPPError.Condition.item_not_found.toString(),
argument.getValue().getError().getCondition()); argument.getValue().getError().getCondition());

View file

@ -75,7 +75,7 @@ public class DataListenerTest {
// assert that reply is the correct error packet // assert that reply is the correct error packet
assertEquals(initiatorJID, argument.getValue().getTo()); assertEquals(initiatorJID, argument.getValue().getTo());
assertEquals(IQ.Type.ERROR, argument.getValue().getType()); assertEquals(IQ.Type.error, argument.getValue().getType());
assertEquals(XMPPError.Condition.item_not_found.toString(), assertEquals(XMPPError.Condition.item_not_found.toString(),
argument.getValue().getError().getCondition()); argument.getValue().getError().getCondition());

View file

@ -42,7 +42,7 @@ public class IBBPacketUtils {
} }
}; };
errorIQ.setType(IQ.Type.ERROR); errorIQ.setType(IQ.Type.error);
errorIQ.setFrom(from); errorIQ.setFrom(from);
errorIQ.setTo(to); errorIQ.setTo(to);
errorIQ.setError(xmppError); errorIQ.setError(xmppError);
@ -64,7 +64,7 @@ public class IBBPacketUtils {
} }
}; };
result.setType(IQ.Type.RESULT); result.setType(IQ.Type.result);
result.setFrom(from); result.setFrom(from);
result.setTo(to); result.setTo(to);
return result; return result;

View file

@ -83,7 +83,7 @@ public class InBandBytestreamRequestTest {
// assert that reply is the correct error packet // assert that reply is the correct error packet
assertEquals(initiatorJID, argument.getValue().getTo()); assertEquals(initiatorJID, argument.getValue().getTo());
assertEquals(IQ.Type.ERROR, argument.getValue().getType()); assertEquals(IQ.Type.error, argument.getValue().getType());
assertEquals(XMPPError.Condition.no_acceptable.toString(), assertEquals(XMPPError.Condition.no_acceptable.toString(),
argument.getValue().getError().getCondition()); argument.getValue().getError().getCondition());
@ -108,7 +108,7 @@ public class InBandBytestreamRequestTest {
// assert that reply is the correct acknowledgment packet // assert that reply is the correct acknowledgment packet
assertEquals(initiatorJID, argument.getValue().getTo()); assertEquals(initiatorJID, argument.getValue().getTo());
assertEquals(IQ.Type.RESULT, argument.getValue().getType()); assertEquals(IQ.Type.result, argument.getValue().getType());
assertNotNull(session); assertNotNull(session);
assertNotNull(session.getInputStream()); assertNotNull(session.getInputStream());

View file

@ -91,7 +91,7 @@ public class InitiationListenerTest {
// assert that reply is the correct error packet // assert that reply is the correct error packet
assertEquals(initiatorJID, argument.getValue().getTo()); assertEquals(initiatorJID, argument.getValue().getTo());
assertEquals(IQ.Type.ERROR, argument.getValue().getType()); assertEquals(IQ.Type.error, argument.getValue().getType());
assertEquals(XMPPError.Condition.no_acceptable.toString(), assertEquals(XMPPError.Condition.no_acceptable.toString(),
argument.getValue().getError().getCondition()); argument.getValue().getError().getCondition());
@ -119,7 +119,7 @@ public class InitiationListenerTest {
// assert that reply is the correct error packet // assert that reply is the correct error packet
assertEquals(initiatorJID, argument.getValue().getTo()); assertEquals(initiatorJID, argument.getValue().getTo());
assertEquals(IQ.Type.ERROR, argument.getValue().getType()); assertEquals(IQ.Type.error, argument.getValue().getType());
assertEquals(XMPPError.Condition.resource_constraint.toString(), assertEquals(XMPPError.Condition.resource_constraint.toString(),
argument.getValue().getError().getCondition()); argument.getValue().getError().getCondition());
@ -209,7 +209,7 @@ public class InitiationListenerTest {
// assert that reply is the correct error packet // assert that reply is the correct error packet
assertEquals(initiatorJID, argument.getValue().getTo()); assertEquals(initiatorJID, argument.getValue().getTo());
assertEquals(IQ.Type.ERROR, argument.getValue().getType()); assertEquals(IQ.Type.error, argument.getValue().getType());
assertEquals(XMPPError.Condition.no_acceptable.toString(), assertEquals(XMPPError.Condition.no_acceptable.toString(),
argument.getValue().getError().getCondition()); argument.getValue().getError().getCondition());
} }

View file

@ -48,7 +48,7 @@ public class CloseTest {
@Test @Test
public void shouldBeOfIQTypeSET() { public void shouldBeOfIQTypeSET() {
Close close = new Close("sessionID"); Close close = new Close("sessionID");
assertEquals(IQ.Type.SET, close.getType()); assertEquals(IQ.Type.set, close.getType());
} }
@Test @Test

View file

@ -47,7 +47,7 @@ public class DataTest {
public void shouldBeOfIQTypeSET() { public void shouldBeOfIQTypeSET() {
DataPacketExtension dpe = mock(DataPacketExtension.class); DataPacketExtension dpe = mock(DataPacketExtension.class);
Data data = new Data(dpe); Data data = new Data(dpe);
assertEquals(IQ.Type.SET, data.getType()); assertEquals(IQ.Type.set, data.getType());
} }
private static Properties outputProperties = new Properties(); private static Properties outputProperties = new Properties();

View file

@ -65,7 +65,7 @@ public class OpenTest {
@Test @Test
public void shouldBeOfIQTypeSET() { public void shouldBeOfIQTypeSET() {
Open open = new Open("sessionID", 4096); Open open = new Open("sessionID", 4096);
assertEquals(IQ.Type.SET, open.getType()); assertEquals(IQ.Type.set, open.getType());
} }
@Test @Test

View file

@ -98,7 +98,7 @@ public class InitiationListenerTest {
// assert that reply is the correct error packet // assert that reply is the correct error packet
assertEquals(initiatorJID, argument.getValue().getTo()); assertEquals(initiatorJID, argument.getValue().getTo());
assertEquals(IQ.Type.ERROR, argument.getValue().getType()); assertEquals(IQ.Type.error, argument.getValue().getType());
assertEquals(XMPPError.Condition.no_acceptable.toString(), assertEquals(XMPPError.Condition.no_acceptable.toString(),
argument.getValue().getError().getCondition()); argument.getValue().getError().getCondition());
@ -188,7 +188,7 @@ public class InitiationListenerTest {
// assert that reply is the correct error packet // assert that reply is the correct error packet
assertEquals(initiatorJID, argument.getValue().getTo()); assertEquals(initiatorJID, argument.getValue().getTo());
assertEquals(IQ.Type.ERROR, argument.getValue().getType()); assertEquals(IQ.Type.error, argument.getValue().getType());
assertEquals(XMPPError.Condition.no_acceptable.toString(), assertEquals(XMPPError.Condition.no_acceptable.toString(),
argument.getValue().getError().getCondition()); argument.getValue().getError().getCondition());
} }

View file

@ -432,7 +432,7 @@ public class Socks5ByteStreamManagerTest {
} }
}; };
rejectPacket.setType(Type.ERROR); rejectPacket.setType(Type.error);
rejectPacket.setFrom(targetJID); rejectPacket.setFrom(targetJID);
rejectPacket.setTo(initiatorJID); rejectPacket.setTo(initiatorJID);
rejectPacket.setError(xmppError); rejectPacket.setError(xmppError);

View file

@ -111,7 +111,7 @@ public class Socks5ByteStreamRequestTest {
Packet targetResponse = protocol.getRequests().remove(0); Packet targetResponse = protocol.getRequests().remove(0);
assertTrue(IQ.class.isInstance(targetResponse)); assertTrue(IQ.class.isInstance(targetResponse));
assertEquals(initiatorJID, targetResponse.getTo()); assertEquals(initiatorJID, targetResponse.getTo());
assertEquals(IQ.Type.ERROR, ((IQ) targetResponse).getType()); assertEquals(IQ.Type.error, ((IQ) targetResponse).getType());
assertEquals(XMPPError.Condition.item_not_found.toString(), assertEquals(XMPPError.Condition.item_not_found.toString(),
((IQ) targetResponse).getError().getCondition()); ((IQ) targetResponse).getError().getCondition());
@ -155,7 +155,7 @@ public class Socks5ByteStreamRequestTest {
Packet targetResponse = protocol.getRequests().remove(0); Packet targetResponse = protocol.getRequests().remove(0);
assertTrue(IQ.class.isInstance(targetResponse)); assertTrue(IQ.class.isInstance(targetResponse));
assertEquals(initiatorJID, targetResponse.getTo()); assertEquals(initiatorJID, targetResponse.getTo());
assertEquals(IQ.Type.ERROR, ((IQ) targetResponse).getType()); assertEquals(IQ.Type.error, ((IQ) targetResponse).getType());
assertEquals(XMPPError.Condition.item_not_found.toString(), assertEquals(XMPPError.Condition.item_not_found.toString(),
((IQ) targetResponse).getError().getCondition()); ((IQ) targetResponse).getError().getCondition());
@ -203,7 +203,7 @@ public class Socks5ByteStreamRequestTest {
Packet targetResponse = protocol.getRequests().remove(0); Packet targetResponse = protocol.getRequests().remove(0);
assertTrue(IQ.class.isInstance(targetResponse)); assertTrue(IQ.class.isInstance(targetResponse));
assertEquals(initiatorJID, targetResponse.getTo()); assertEquals(initiatorJID, targetResponse.getTo());
assertEquals(IQ.Type.ERROR, ((IQ) targetResponse).getType()); assertEquals(IQ.Type.error, ((IQ) targetResponse).getType());
assertEquals(XMPPError.Condition.item_not_found.toString(), assertEquals(XMPPError.Condition.item_not_found.toString(),
((IQ) targetResponse).getError().getCondition()); ((IQ) targetResponse).getError().getCondition());
} }
@ -245,7 +245,7 @@ public class Socks5ByteStreamRequestTest {
Packet targetResponse = protocol.getRequests().remove(0); Packet targetResponse = protocol.getRequests().remove(0);
assertEquals(Bytestream.class, targetResponse.getClass()); assertEquals(Bytestream.class, targetResponse.getClass());
assertEquals(initiatorJID, targetResponse.getTo()); assertEquals(initiatorJID, targetResponse.getTo());
assertEquals(IQ.Type.RESULT, ((Bytestream) targetResponse).getType()); assertEquals(IQ.Type.result, ((Bytestream) targetResponse).getType());
assertEquals(proxyJID, ((Bytestream) targetResponse).getUsedHost().getJID()); assertEquals(proxyJID, ((Bytestream) targetResponse).getUsedHost().getJID());
} }
@ -295,7 +295,7 @@ public class Socks5ByteStreamRequestTest {
Packet targetResponse = protocol.getRequests().remove(0); Packet targetResponse = protocol.getRequests().remove(0);
assertTrue(IQ.class.isInstance(targetResponse)); assertTrue(IQ.class.isInstance(targetResponse));
assertEquals(initiatorJID, targetResponse.getTo()); assertEquals(initiatorJID, targetResponse.getTo());
assertEquals(IQ.Type.ERROR, ((IQ) targetResponse).getType()); assertEquals(IQ.Type.error, ((IQ) targetResponse).getType());
assertEquals(XMPPError.Condition.item_not_found.toString(), assertEquals(XMPPError.Condition.item_not_found.toString(),
((IQ) targetResponse).getError().getCondition()); ((IQ) targetResponse).getError().getCondition());
} }
@ -365,7 +365,7 @@ public class Socks5ByteStreamRequestTest {
Packet targetResponse = protocol.getRequests().remove(0); Packet targetResponse = protocol.getRequests().remove(0);
assertEquals(Bytestream.class, targetResponse.getClass()); assertEquals(Bytestream.class, targetResponse.getClass());
assertEquals(initiatorJID, targetResponse.getTo()); assertEquals(initiatorJID, targetResponse.getTo());
assertEquals(IQ.Type.RESULT, ((Bytestream) targetResponse).getType()); assertEquals(IQ.Type.result, ((Bytestream) targetResponse).getType());
assertEquals(proxyJID, ((Bytestream) targetResponse).getUsedHost().getJID()); assertEquals(proxyJID, ((Bytestream) targetResponse).getUsedHost().getJID());
serverSocket.close(); serverSocket.close();
@ -418,7 +418,7 @@ public class Socks5ByteStreamRequestTest {
Packet targetResponse = protocol.getRequests().remove(0); Packet targetResponse = protocol.getRequests().remove(0);
assertEquals(Bytestream.class, targetResponse.getClass()); assertEquals(Bytestream.class, targetResponse.getClass());
assertEquals(initiatorJID, targetResponse.getTo()); assertEquals(initiatorJID, targetResponse.getTo());
assertEquals(IQ.Type.RESULT, ((Bytestream) targetResponse).getType()); assertEquals(IQ.Type.result, ((Bytestream) targetResponse).getType());
assertEquals(proxyJID, ((Bytestream) targetResponse).getUsedHost().getJID()); assertEquals(proxyJID, ((Bytestream) targetResponse).getUsedHost().getJID());
} }

View file

@ -204,7 +204,7 @@ public class Socks5ClientForInitiatorTest {
} }
}; };
error.setType(Type.ERROR); error.setType(Type.error);
error.setFrom(proxyJID); error.setFrom(proxyJID);
error.setTo(initiatorJID); error.setTo(initiatorJID);
error.setError(xmppError); error.setError(xmppError);
@ -259,7 +259,7 @@ public class Socks5ClientForInitiatorTest {
}; };
activationResponse.setFrom(proxyJID); activationResponse.setFrom(proxyJID);
activationResponse.setTo(initiatorJID); activationResponse.setTo(initiatorJID);
activationResponse.setType(IQ.Type.RESULT); activationResponse.setType(IQ.Type.result);
protocol.addResponse(activationResponse, Verification.correspondingSenderReceiver, protocol.addResponse(activationResponse, Verification.correspondingSenderReceiver,
Verification.requestTypeSET, new Verification<Bytestream, IQ>() { Verification.requestTypeSET, new Verification<Bytestream, IQ>() {

View file

@ -43,7 +43,7 @@ public class Socks5PacketUtils {
bytestream.setFrom(from); bytestream.setFrom(from);
bytestream.setTo(to); bytestream.setTo(to);
bytestream.setSessionID(sessionID); bytestream.setSessionID(sessionID);
bytestream.setType(IQ.Type.SET); bytestream.setType(IQ.Type.set);
return bytestream; return bytestream;
} }
@ -60,7 +60,7 @@ public class Socks5PacketUtils {
streamHostInfo.getPacketID(); streamHostInfo.getPacketID();
streamHostInfo.setFrom(from); streamHostInfo.setFrom(from);
streamHostInfo.setTo(to); streamHostInfo.setTo(to);
streamHostInfo.setType(IQ.Type.RESULT); streamHostInfo.setType(IQ.Type.result);
return streamHostInfo; return streamHostInfo;
} }
@ -76,7 +76,7 @@ public class Socks5PacketUtils {
discoverItems.getPacketID(); discoverItems.getPacketID();
discoverItems.setFrom(from); discoverItems.setFrom(from);
discoverItems.setTo(to); discoverItems.setTo(to);
discoverItems.setType(IQ.Type.RESULT); discoverItems.setType(IQ.Type.result);
return discoverItems; return discoverItems;
} }
@ -92,7 +92,7 @@ public class Socks5PacketUtils {
discoverInfo.getPacketID(); discoverInfo.getPacketID();
discoverInfo.setFrom(from); discoverInfo.setFrom(from);
discoverInfo.setTo(to); discoverInfo.setTo(to);
discoverInfo.setType(IQ.Type.RESULT); discoverInfo.setType(IQ.Type.result);
return discoverInfo; return discoverInfo;
} }
@ -115,7 +115,7 @@ public class Socks5PacketUtils {
response.getPacketID(); response.getPacketID();
response.setFrom(from); response.setFrom(from);
response.setTo(to); response.setTo(to);
response.setType(IQ.Type.RESULT); response.setType(IQ.Type.result);
return response; return response;
} }

View file

@ -107,7 +107,7 @@ public class EntityCapsManagerTest extends InitExtensions {
di.setFrom("benvolio@capulet.lit/230193"); di.setFrom("benvolio@capulet.lit/230193");
di.setPacketID("disco1"); di.setPacketID("disco1");
di.setTo("juliet@capulet.lit/chamber"); di.setTo("juliet@capulet.lit/chamber");
di.setType(IQ.Type.RESULT); di.setType(IQ.Type.result);
Collection<DiscoverInfo.Identity> identities = new LinkedList<DiscoverInfo.Identity>(); Collection<DiscoverInfo.Identity> identities = new LinkedList<DiscoverInfo.Identity>();
DiscoverInfo.Identity i = new DiscoverInfo.Identity("client", "Psi 0.11", "pc"); DiscoverInfo.Identity i = new DiscoverInfo.Identity("client", "Psi 0.11", "pc");
@ -160,7 +160,7 @@ public class EntityCapsManagerTest extends InitExtensions {
di.setFrom("benvolio@capulet.lit/230193"); di.setFrom("benvolio@capulet.lit/230193");
di.setPacketID("disco1"); di.setPacketID("disco1");
di.setTo(")juliet@capulet.lit/chamber"); di.setTo(")juliet@capulet.lit/chamber");
di.setType(IQ.Type.RESULT); di.setType(IQ.Type.result);
Collection<DiscoverInfo.Identity> identities = new LinkedList<DiscoverInfo.Identity>(); Collection<DiscoverInfo.Identity> identities = new LinkedList<DiscoverInfo.Identity>();
DiscoverInfo.Identity i = new DiscoverInfo.Identity("client", "Psi 0.11", "pc"); DiscoverInfo.Identity i = new DiscoverInfo.Identity("client", "Psi 0.11", "pc");

View file

@ -50,6 +50,6 @@ public class LastActivityTest extends InitExtensions {
assertTrue(reply instanceof LastActivity); assertTrue(reply instanceof LastActivity);
LastActivity l = (LastActivity) reply; LastActivity l = (LastActivity) reply;
assertEquals("last2", l.getPacketID()); assertEquals("last2", l.getPacketID());
assertEquals(IQ.Type.RESULT, l.getType()); assertEquals(IQ.Type.result, l.getType());
} }
} }

View file

@ -52,7 +52,7 @@ public class VersionTest {
//assertEquals("juliet@capulet.lit/balcony", reply.getFrom()); //assertEquals("juliet@capulet.lit/balcony", reply.getFrom());
assertEquals("capulet.lit", reply.getTo()); assertEquals("capulet.lit", reply.getTo());
assertEquals("s2c1", reply.getPacketID()); assertEquals("s2c1", reply.getPacketID());
assertEquals(IQ.Type.RESULT, reply.getType()); assertEquals(IQ.Type.result, reply.getType());
assertEquals("Test", reply.getName()); assertEquals("Test", reply.getName());
assertEquals("0.23", reply.getVersion()); assertEquals("0.23", reply.getVersion());
assertEquals("DummyOS", reply.getOs()); assertEquals("DummyOS", reply.getOs());

View file

@ -104,7 +104,7 @@
// public void processPacket(Packet packet) { // public void processPacket(Packet packet) {
// latch.countDown(); // latch.countDown();
// } // }
// }, new IQTypeFilter(IQ.Type.RESULT)); // }, new IQTypeFilter(IQ.Type.result));
// //
// // Time based testing kind of sucks, but this should be reliable on a DummyConnection since there // // Time based testing kind of sucks, but this should be reliable on a DummyConnection since there
// // is no actual server involved. This will provide enough time to ping and wait for the lack of response. // // is no actual server involved. This will provide enough time to ping and wait for the lack of response.

View file

@ -68,7 +68,7 @@ public class PingTest extends InitExtensions {
IQ pong = (IQ) pongPacket; IQ pong = (IQ) pongPacket;
assertEquals("capulet.lit", pong.getTo()); assertEquals("capulet.lit", pong.getTo());
assertEquals("s2c1", pong.getPacketID()); assertEquals("s2c1", pong.getPacketID());
assertEquals(IQ.Type.RESULT, pong.getType()); assertEquals(IQ.Type.result, pong.getType());
} }
@Test @Test

View file

@ -51,7 +51,7 @@ public interface Verification<T extends Packet, S extends Packet> {
public static Verification<IQ, Packet> requestTypeGET = new Verification<IQ, Packet>() { public static Verification<IQ, Packet> requestTypeGET = new Verification<IQ, Packet>() {
public void verify(IQ request, Packet response) { public void verify(IQ request, Packet response) {
assertEquals(IQ.Type.GET, request.getType()); assertEquals(IQ.Type.get, request.getType());
} }
}; };
@ -62,7 +62,7 @@ public interface Verification<T extends Packet, S extends Packet> {
public static Verification<IQ, Packet> requestTypeSET = new Verification<IQ, Packet>() { public static Verification<IQ, Packet> requestTypeSET = new Verification<IQ, Packet>() {
public void verify(IQ request, Packet response) { public void verify(IQ request, Packet response) {
assertEquals(IQ.Type.SET, request.getType()); assertEquals(IQ.Type.set, request.getType());
} }
}; };
@ -73,7 +73,7 @@ public interface Verification<T extends Packet, S extends Packet> {
public static Verification<IQ, Packet> requestTypeRESULT = new Verification<IQ, Packet>() { public static Verification<IQ, Packet> requestTypeRESULT = new Verification<IQ, Packet>() {
public void verify(IQ request, Packet response) { public void verify(IQ request, Packet response) {
assertEquals(IQ.Type.RESULT, request.getType()); assertEquals(IQ.Type.result, request.getType());
} }
}; };
@ -84,7 +84,7 @@ public interface Verification<T extends Packet, S extends Packet> {
public static Verification<IQ, Packet> requestTypeERROR = new Verification<IQ, Packet>() { public static Verification<IQ, Packet> requestTypeERROR = new Verification<IQ, Packet>() {
public void verify(IQ request, Packet response) { public void verify(IQ request, Packet response) {
assertEquals(IQ.Type.ERROR, request.getType()); assertEquals(IQ.Type.error, request.getType());
} }
}; };

View file

@ -143,7 +143,7 @@ public class JingleManagerTest extends SmackTestCase {
if (pin instanceof IQ) { if (pin instanceof IQ) {
System.out.println("packet: " + pin.toXML()); System.out.println("packet: " + pin.toXML());
IQ iq = (IQ) pin; IQ iq = (IQ) pin;
if (iq.getType().equals(IQ.Type.SET)) { if (iq.getType().equals(IQ.Type.set)) {
System.out.println("packet"); System.out.println("packet");
if (iq instanceof Jingle) { if (iq instanceof Jingle) {
Jingle jin = (Jingle) pin; Jingle jin = (Jingle) pin;
@ -172,7 +172,7 @@ public class JingleManagerTest extends SmackTestCase {
iqSent.setTo(getFullJID(0)); iqSent.setTo(getFullJID(0));
iqSent.setFrom(getFullJID(0)); iqSent.setFrom(getFullJID(0));
iqSent.setType(IQ.Type.SET); iqSent.setType(IQ.Type.set);
System.out.println("Sending packet and waiting... "); System.out.println("Sending packet and waiting... ");
getConnection(1).sendPacket(iqSent); getConnection(1).sendPacket(iqSent);

View file

@ -66,7 +66,7 @@ public class JingleProviderTest extends SmackTestCase {
iqSent.setTo(getFullJID(0)); iqSent.setTo(getFullJID(0));
iqSent.setFrom(getFullJID(0)); iqSent.setFrom(getFullJID(0));
iqSent.setType(IQ.Type.GET); iqSent.setType(IQ.Type.get);
// Create a filter and a collector... // Create a filter and a collector...
PacketFilter filter = new PacketTypeFilter(IQ.class); PacketFilter filter = new PacketTypeFilter(IQ.class);
@ -86,7 +86,7 @@ public class JingleProviderTest extends SmackTestCase {
if (iqReceived == null) { if (iqReceived == null) {
fail("No response from server"); fail("No response from server");
} }
else if (iqReceived.getType() == IQ.Type.ERROR) { else if (iqReceived.getType() == IQ.Type.error) {
fail("The server did reply with an error packet: " + iqReceived.getError().getCode()); fail("The server did reply with an error packet: " + iqReceived.getError().getCode());
} }
else { else {

View file

@ -65,10 +65,10 @@ public class ContentNegotiator extends JingleNegotiator {
// match this media manager. // match this media manager.
if (iq != null) { if (iq != null) {
if (iq.getType().equals(IQ.Type.ERROR)) { if (iq.getType().equals(IQ.Type.error)) {
// Process errors // Process errors
// TODO getState().eventError(iq); // TODO getState().eventError(iq);
} else if (iq.getType().equals(IQ.Type.RESULT)) { } else if (iq.getType().equals(IQ.Type.result)) {
// Process ACKs // Process ACKs
if (isExpectedId(iq.getPacketID())) { if (isExpectedId(iq.getPacketID())) {
removeExpectedId(iq.getPacketID()); removeExpectedId(iq.getPacketID());

View file

@ -445,7 +445,7 @@ public class JingleManager implements JingleSessionListener {
public boolean accept(Packet pin) { public boolean accept(Packet pin) {
if (pin instanceof IQ) { if (pin instanceof IQ) {
IQ iq = (IQ) pin; IQ iq = (IQ) pin;
if (iq.getType().equals(IQ.Type.SET)) { if (iq.getType().equals(IQ.Type.set)) {
if (iq instanceof Jingle) { if (iq instanceof Jingle) {
Jingle jin = (Jingle) pin; Jingle jin = (Jingle) pin;
if (jin.getAction().equals(JingleActionEnum.SESSION_INITIATE)) { if (jin.getAction().equals(JingleActionEnum.SESSION_INITIATE)) {

View file

@ -325,7 +325,7 @@ public class JingleSession extends JingleNegotiator implements MediaReceivedList
} }
// // If the response is anything other than a RESULT then send it now. // // If the response is anything other than a RESULT then send it now.
// if ((response != null) && (!response.getType().equals(IQ.Type.RESULT))) { // if ((response != null) && (!response.getType().equals(IQ.Type.result))) {
// getConnection().sendPacket(response); // getConnection().sendPacket(response);
// } // }
@ -351,10 +351,10 @@ public class JingleSession extends JingleNegotiator implements MediaReceivedList
IQ response = null; IQ response = null;
if (iq != null) { if (iq != null) {
if (iq.getType().equals(IQ.Type.ERROR)) { if (iq.getType().equals(IQ.Type.error)) {
// Process errors // Process errors
// TODO getState().eventError(iq); // TODO getState().eventError(iq);
} else if (iq.getType().equals(IQ.Type.RESULT)) { } else if (iq.getType().equals(IQ.Type.result)) {
// Process ACKs // Process ACKs
if (isExpectedId(iq.getPacketID())) { if (isExpectedId(iq.getPacketID())) {
@ -504,8 +504,8 @@ public class JingleSession extends JingleNegotiator implements MediaReceivedList
if (iq != null) { if (iq != null) {
// Don't acknowledge ACKs, errors... // Don't acknowledge ACKs, errors...
if (iq.getType().equals(IQ.Type.SET)) { if (iq.getType().equals(IQ.Type.set)) {
IQ ack = createIQ(iq.getPacketID(), iq.getFrom(), iq.getTo(), IQ.Type.RESULT); IQ ack = createIQ(iq.getPacketID(), iq.getFrom(), iq.getTo(), IQ.Type.result);
// No! Don't send it. Let it flow to the normal way IQ results get processed and sent. // No! Don't send it. Let it flow to the normal way IQ results get processed and sent.
// getConnection().sendPacket(ack); // getConnection().sendPacket(ack);
@ -715,10 +715,10 @@ public class JingleSession extends JingleNegotiator implements MediaReceivedList
} }
} else { } else {
// We accept some non-Jingle IQ packets: ERRORs and ACKs // We accept some non-Jingle IQ packets: ERRORs and ACKs
if (iq.getType().equals(IQ.Type.SET)) { if (iq.getType().equals(IQ.Type.set)) {
LOGGER.fine("Ignored Jingle(TYPE): " + iq.toXML()); LOGGER.fine("Ignored Jingle(TYPE): " + iq.toXML());
return false; return false;
} else if (iq.getType().equals(IQ.Type.GET)) { } else if (iq.getType().equals(IQ.Type.get)) {
LOGGER.fine("Ignored Jingle(TYPE): " + iq.toXML()); LOGGER.fine("Ignored Jingle(TYPE): " + iq.toXML());
return false; return false;
} }
@ -979,7 +979,7 @@ public class JingleSession extends JingleNegotiator implements MediaReceivedList
return; return;
LOGGER.fine("Terminate " + reason); LOGGER.fine("Terminate " + reason);
Jingle jout = new Jingle(JingleActionEnum.SESSION_TERMINATE); Jingle jout = new Jingle(JingleActionEnum.SESSION_TERMINATE);
jout.setType(IQ.Type.SET); jout.setType(IQ.Type.set);
sendPacket(jout); sendPacket(jout);
triggerSessionClosed(reason); triggerSessionClosed(reason);
} }
@ -1062,7 +1062,7 @@ public class JingleSession extends JingleNegotiator implements MediaReceivedList
*/ */
public static IQ createError(String ID, String to, String from, int errCode, XMPPError error) { public static IQ createError(String ID, String to, String from, int errCode, XMPPError error) {
IQ iqError = createIQ(ID, to, from, IQ.Type.ERROR); IQ iqError = createIQ(ID, to, from, IQ.Type.error);
iqError.setError(error); iqError.setError(error);
LOGGER.fine("Created Error Packet:" + iqError.toXML()); LOGGER.fine("Created Error Packet:" + iqError.toXML());
@ -1083,7 +1083,7 @@ public class JingleSession extends JingleNegotiator implements MediaReceivedList
public IQ createJingleError(IQ iq, JingleError jingleError) { public IQ createJingleError(IQ iq, JingleError jingleError) {
IQ errorPacket = null; IQ errorPacket = null;
if (jingleError != null) { if (jingleError != null) {
errorPacket = createIQ(getSid(), iq.getFrom(), iq.getTo(), IQ.Type.ERROR); errorPacket = createIQ(getSid(), iq.getFrom(), iq.getTo(), IQ.Type.error);
List<PacketExtension> extList = new ArrayList<PacketExtension>(); List<PacketExtension> extList = new ArrayList<PacketExtension>();
extList.add(jingleError); extList.add(jingleError);

View file

@ -108,13 +108,13 @@ public class MediaNegotiator extends JingleNegotiator {
List<IQ> responses = new ArrayList<IQ>(); List<IQ> responses = new ArrayList<IQ>();
IQ response = null; IQ response = null;
if (iq.getType().equals(IQ.Type.ERROR)) { if (iq.getType().equals(IQ.Type.error)) {
// Process errors // Process errors
setNegotiatorState(JingleNegotiatorState.FAILED); setNegotiatorState(JingleNegotiatorState.FAILED);
triggerMediaClosed(getBestCommonAudioPt()); triggerMediaClosed(getBestCommonAudioPt());
// This next line seems wrong, and may subvert the normal closing process. // This next line seems wrong, and may subvert the normal closing process.
throw new JingleException(iq.getError().getMessage()); throw new JingleException(iq.getError().getMessage());
} else if (iq.getType().equals(IQ.Type.RESULT)) { } else if (iq.getType().equals(IQ.Type.result)) {
// Process ACKs // Process ACKs
if (isExpectedId(iq.getPacketID())) { if (isExpectedId(iq.getPacketID())) {
receiveResult(iq); receiveResult(iq);

View file

@ -458,7 +458,7 @@ public class RTPBridge extends IQ {
RTPBridge rtpPacket = new RTPBridge(sessionID, RTPBridge.BridgeAction.change); RTPBridge rtpPacket = new RTPBridge(sessionID, RTPBridge.BridgeAction.change);
rtpPacket.setTo(RTPBridge.NAME + "." + connection.getServiceName()); rtpPacket.setTo(RTPBridge.NAME + "." + connection.getServiceName());
rtpPacket.setType(Type.SET); rtpPacket.setType(Type.set);
rtpPacket.setPass(pass); rtpPacket.setPass(pass);
rtpPacket.setPortA(localCandidate.getPort()); rtpPacket.setPortA(localCandidate.getPort());
@ -493,7 +493,7 @@ public class RTPBridge extends IQ {
RTPBridge rtpPacket = new RTPBridge(RTPBridge.BridgeAction.publicip); RTPBridge rtpPacket = new RTPBridge(RTPBridge.BridgeAction.publicip);
rtpPacket.setTo(RTPBridge.NAME + "." + xmppConnection.getServiceName()); rtpPacket.setTo(RTPBridge.NAME + "." + xmppConnection.getServiceName());
rtpPacket.setType(Type.SET); rtpPacket.setType(Type.set);
// LOGGER.debug("Relayed to: " + candidate.getIp() + ":" + candidate.getPort()); // LOGGER.debug("Relayed to: " + candidate.getIp() + ":" + candidate.getPort());

View file

@ -598,13 +598,13 @@ public abstract class TransportNegotiator extends JingleNegotiator {
IQ response = null; IQ response = null;
if (iq != null) { if (iq != null) {
if (iq.getType().equals(IQ.Type.ERROR)) { if (iq.getType().equals(IQ.Type.error)) {
// Process errors // Process errors
setNegotiatorState(JingleNegotiatorState.FAILED); setNegotiatorState(JingleNegotiatorState.FAILED);
triggerTransportClosed(null); triggerTransportClosed(null);
// This next line seems wrong, and may subvert the normal closing process. // This next line seems wrong, and may subvert the normal closing process.
throw new JingleException(iq.getError().getMessage()); throw new JingleException(iq.getError().getMessage());
} else if (iq.getType().equals(IQ.Type.RESULT)) { } else if (iq.getType().equals(IQ.Type.result)) {
// Process ACKs // Process ACKs
if (isExpectedId(iq.getPacketID())) { if (isExpectedId(iq.getPacketID())) {
response = receiveResult(iq); response = receiveResult(iq);

View file

@ -97,7 +97,7 @@ public class Jingle extends IQ {
// Some default values for the most common situation... // Some default values for the most common situation...
action = JingleActionEnum.UNKNOWN; action = JingleActionEnum.UNKNOWN;
this.setType(IQ.Type.SET); this.setType(IQ.Type.set);
} }
/** /**
@ -116,7 +116,7 @@ public class Jingle extends IQ {
// Some default values for the most common situation... // Some default values for the most common situation...
action = JingleActionEnum.UNKNOWN; action = JingleActionEnum.UNKNOWN;
this.setType(IQ.Type.SET); this.setType(IQ.Type.set);
} }
/** /**
@ -129,7 +129,7 @@ public class Jingle extends IQ {
this.action = action; this.action = action;
// In general, a Jingle with an action is used in a SET packet... // In general, a Jingle with an action is used in a SET packet...
this.setType(IQ.Type.SET); this.setType(IQ.Type.set);
} }
/** /**

View file

@ -70,7 +70,7 @@ public class Agent {
*/ */
public String getName() throws NoResponseException, XMPPErrorException, NotConnectedException { public String getName() throws NoResponseException, XMPPErrorException, NotConnectedException {
AgentInfo agentInfo = new AgentInfo(); AgentInfo agentInfo = new AgentInfo();
agentInfo.setType(IQ.Type.GET); agentInfo.setType(IQ.Type.get);
agentInfo.setTo(workgroupJID); agentInfo.setTo(workgroupJID);
agentInfo.setFrom(getUser()); agentInfo.setFrom(getUser());
AgentInfo response = (AgentInfo) connection.createPacketCollectorAndSend(agentInfo).nextResultOrThrow(); AgentInfo response = (AgentInfo) connection.createPacketCollectorAndSend(agentInfo).nextResultOrThrow();
@ -90,7 +90,7 @@ public class Agent {
*/ */
public void setName(String newName) throws NoResponseException, XMPPErrorException, NotConnectedException { public void setName(String newName) throws NoResponseException, XMPPErrorException, NotConnectedException {
AgentInfo agentInfo = new AgentInfo(); AgentInfo agentInfo = new AgentInfo();
agentInfo.setType(IQ.Type.SET); agentInfo.setType(IQ.Type.set);
agentInfo.setTo(workgroupJID); agentInfo.setTo(workgroupJID);
agentInfo.setFrom(getUser()); agentInfo.setFrom(getUser());
agentInfo.setName(newName); agentInfo.setName(newName);

View file

@ -509,7 +509,7 @@ public class AgentSession {
*/ */
public OccupantsInfo getOccupantsInfo(String roomID) throws NoResponseException, XMPPErrorException, NotConnectedException { public OccupantsInfo getOccupantsInfo(String roomID) throws NoResponseException, XMPPErrorException, NotConnectedException {
OccupantsInfo request = new OccupantsInfo(roomID); OccupantsInfo request = new OccupantsInfo(roomID);
request.setType(IQ.Type.GET); request.setType(IQ.Type.get);
request.setTo(workgroupJID); request.setTo(workgroupJID);
OccupantsInfo response = (OccupantsInfo) connection.createPacketCollectorAndSend(request).nextResultOrThrow(); OccupantsInfo response = (OccupantsInfo) connection.createPacketCollectorAndSend(request).nextResultOrThrow();
@ -674,7 +674,7 @@ public class AgentSession {
}; };
reply.setPacketID(packet.getPacketID()); reply.setPacketID(packet.getPacketID());
reply.setTo(packet.getFrom()); reply.setTo(packet.getFrom());
reply.setType(IQ.Type.RESULT); reply.setType(IQ.Type.result);
connection.sendPacket(reply); connection.sendPacket(reply);
fireOfferRequestEvent((OfferRequestProvider.OfferRequestPacket)packet); fireOfferRequestEvent((OfferRequestProvider.OfferRequestPacket)packet);
@ -769,7 +769,7 @@ public class AgentSession {
} }
}; };
reply.setPacketID(packet.getPacketID()); reply.setPacketID(packet.getPacketID());
reply.setType(IQ.Type.RESULT); reply.setType(IQ.Type.result);
connection.sendPacket(reply); connection.sendPacket(reply);
fireOfferRevokeEvent((OfferRevokeProvider.OfferRevokePacket)packet); fireOfferRevokeEvent((OfferRevokeProvider.OfferRevokePacket)packet);
@ -787,7 +787,7 @@ public class AgentSession {
*/ */
public void setNote(String sessionID, String note) throws NoResponseException, XMPPErrorException, NotConnectedException { public void setNote(String sessionID, String note) throws NoResponseException, XMPPErrorException, NotConnectedException {
ChatNotes notes = new ChatNotes(); ChatNotes notes = new ChatNotes();
notes.setType(IQ.Type.SET); notes.setType(IQ.Type.set);
notes.setTo(workgroupJID); notes.setTo(workgroupJID);
notes.setSessionID(sessionID); notes.setSessionID(sessionID);
notes.setNotes(note); notes.setNotes(note);
@ -805,7 +805,7 @@ public class AgentSession {
*/ */
public ChatNotes getNote(String sessionID) throws NoResponseException, XMPPErrorException, NotConnectedException { public ChatNotes getNote(String sessionID) throws NoResponseException, XMPPErrorException, NotConnectedException {
ChatNotes request = new ChatNotes(); ChatNotes request = new ChatNotes();
request.setType(IQ.Type.GET); request.setType(IQ.Type.get);
request.setTo(workgroupJID); request.setTo(workgroupJID);
request.setSessionID(sessionID); request.setSessionID(sessionID);
@ -831,7 +831,7 @@ public class AgentSession {
request = new AgentChatHistory(jid, maxSessions); request = new AgentChatHistory(jid, maxSessions);
} }
request.setType(IQ.Type.GET); request.setType(IQ.Type.get);
request.setTo(workgroupJID); request.setTo(workgroupJID);
AgentChatHistory response = (AgentChatHistory) connection.createPacketCollectorAndSend( AgentChatHistory response = (AgentChatHistory) connection.createPacketCollectorAndSend(
@ -850,7 +850,7 @@ public class AgentSession {
*/ */
public SearchSettings getSearchSettings() throws NoResponseException, XMPPErrorException, NotConnectedException { public SearchSettings getSearchSettings() throws NoResponseException, XMPPErrorException, NotConnectedException {
SearchSettings request = new SearchSettings(); SearchSettings request = new SearchSettings();
request.setType(IQ.Type.GET); request.setType(IQ.Type.get);
request.setTo(workgroupJID); request.setTo(workgroupJID);
SearchSettings response = (SearchSettings) connection.createPacketCollectorAndSend(request).nextResultOrThrow(); SearchSettings response = (SearchSettings) connection.createPacketCollectorAndSend(request).nextResultOrThrow();
@ -868,7 +868,7 @@ public class AgentSession {
*/ */
public MacroGroup getMacros(boolean global) throws NoResponseException, XMPPErrorException, NotConnectedException { public MacroGroup getMacros(boolean global) throws NoResponseException, XMPPErrorException, NotConnectedException {
Macros request = new Macros(); Macros request = new Macros();
request.setType(IQ.Type.GET); request.setType(IQ.Type.get);
request.setTo(workgroupJID); request.setTo(workgroupJID);
request.setPersonal(!global); request.setPersonal(!global);
@ -886,7 +886,7 @@ public class AgentSession {
*/ */
public void saveMacros(MacroGroup group) throws NoResponseException, XMPPErrorException, NotConnectedException { public void saveMacros(MacroGroup group) throws NoResponseException, XMPPErrorException, NotConnectedException {
Macros request = new Macros(); Macros request = new Macros();
request.setType(IQ.Type.SET); request.setType(IQ.Type.set);
request.setTo(workgroupJID); request.setTo(workgroupJID);
request.setPersonal(true); request.setPersonal(true);
request.setPersonalMacroGroup(group); request.setPersonalMacroGroup(group);
@ -904,7 +904,7 @@ public class AgentSession {
*/ */
public Map<String, List<String>> getChatMetadata(String sessionID) throws XMPPException, NotConnectedException { public Map<String, List<String>> getChatMetadata(String sessionID) throws XMPPException, NotConnectedException {
ChatMetadata request = new ChatMetadata(); ChatMetadata request = new ChatMetadata();
request.setType(IQ.Type.GET); request.setType(IQ.Type.get);
request.setTo(workgroupJID); request.setTo(workgroupJID);
request.setSessionID(sessionID); request.setSessionID(sessionID);
@ -950,7 +950,7 @@ public class AgentSession {
return invitation.toXML(); return invitation.toXML();
} }
}; };
iq.setType(IQ.Type.SET); iq.setType(IQ.Type.set);
iq.setTo(workgroupJID); iq.setTo(workgroupJID);
iq.setFrom(connection.getUser()); iq.setFrom(connection.getUser());
@ -992,7 +992,7 @@ public class AgentSession {
return transfer.toXML(); return transfer.toXML();
} }
}; };
iq.setType(IQ.Type.SET); iq.setType(IQ.Type.set);
iq.setTo(workgroupJID); iq.setTo(workgroupJID);
iq.setFrom(connection.getUser()); iq.setFrom(connection.getUser());
@ -1011,7 +1011,7 @@ public class AgentSession {
*/ */
public GenericSettings getGenericSettings(XMPPConnection con, String query) throws NoResponseException, XMPPErrorException, NotConnectedException { public GenericSettings getGenericSettings(XMPPConnection con, String query) throws NoResponseException, XMPPErrorException, NotConnectedException {
GenericSettings setting = new GenericSettings(); GenericSettings setting = new GenericSettings();
setting.setType(IQ.Type.GET); setting.setType(IQ.Type.get);
setting.setTo(workgroupJID); setting.setTo(workgroupJID);
GenericSettings response = (GenericSettings) connection.createPacketCollectorAndSend( GenericSettings response = (GenericSettings) connection.createPacketCollectorAndSend(
@ -1021,7 +1021,7 @@ public class AgentSession {
public boolean hasMonitorPrivileges(XMPPConnection con) throws NoResponseException, XMPPErrorException, NotConnectedException { public boolean hasMonitorPrivileges(XMPPConnection con) throws NoResponseException, XMPPErrorException, NotConnectedException {
MonitorPacket request = new MonitorPacket(); MonitorPacket request = new MonitorPacket();
request.setType(IQ.Type.GET); request.setType(IQ.Type.get);
request.setTo(workgroupJID); request.setTo(workgroupJID);
MonitorPacket response = (MonitorPacket) connection.createPacketCollectorAndSend(request).nextResultOrThrow(); MonitorPacket response = (MonitorPacket) connection.createPacketCollectorAndSend(request).nextResultOrThrow();
@ -1030,7 +1030,7 @@ public class AgentSession {
public void makeRoomOwner(XMPPConnection con, String sessionID) throws NoResponseException, XMPPErrorException, NotConnectedException { public void makeRoomOwner(XMPPConnection con, String sessionID) throws NoResponseException, XMPPErrorException, NotConnectedException {
MonitorPacket request = new MonitorPacket(); MonitorPacket request = new MonitorPacket();
request.setType(IQ.Type.SET); request.setType(IQ.Type.set);
request.setTo(workgroupJID); request.setTo(workgroupJID);
request.setSessionID(sessionID); request.setSessionID(sessionID);

View file

@ -195,7 +195,7 @@ public class Offer {
RejectPacket(String workgroup) { RejectPacket(String workgroup) {
this.setTo(workgroup); this.setTo(workgroup);
this.setType(IQ.Type.SET); this.setType(IQ.Type.set);
} }
public String getChildElementXML() { public String getChildElementXML() {
@ -211,7 +211,7 @@ public class Offer {
AcceptPacket(String workgroup) { AcceptPacket(String workgroup) {
this.setTo(workgroup); this.setTo(workgroup);
this.setType(IQ.Type.SET); this.setType(IQ.Type.set);
} }
public String getChildElementXML() { public String getChildElementXML() {

View file

@ -99,7 +99,7 @@ public class OfferConfirmation extends IQ {
NotifyServicePacket(String workgroup, String roomName) { NotifyServicePacket(String workgroup, String roomName) {
this.setTo(workgroup); this.setTo(workgroup);
this.setType(IQ.Type.RESULT); this.setType(IQ.Type.result);
this.roomName = roomName; this.roomName = roomName;
} }

View file

@ -53,7 +53,7 @@ public class TranscriptSearchManager {
*/ */
public Form getSearchForm(String serviceJID) throws NoResponseException, XMPPErrorException, NotConnectedException { public Form getSearchForm(String serviceJID) throws NoResponseException, XMPPErrorException, NotConnectedException {
TranscriptSearch search = new TranscriptSearch(); TranscriptSearch search = new TranscriptSearch();
search.setType(IQ.Type.GET); search.setType(IQ.Type.get);
search.setTo(serviceJID); search.setTo(serviceJID);
TranscriptSearch response = (TranscriptSearch) connection.createPacketCollectorAndSend( TranscriptSearch response = (TranscriptSearch) connection.createPacketCollectorAndSend(
@ -75,7 +75,7 @@ public class TranscriptSearchManager {
*/ */
public ReportedData submitSearch(String serviceJID, Form completedForm) throws NoResponseException, XMPPErrorException, NotConnectedException { public ReportedData submitSearch(String serviceJID, Form completedForm) throws NoResponseException, XMPPErrorException, NotConnectedException {
TranscriptSearch search = new TranscriptSearch(); TranscriptSearch search = new TranscriptSearch();
search.setType(IQ.Type.GET); search.setType(IQ.Type.get);
search.setTo(serviceJID); search.setTo(serviceJID);
search.addExtension(completedForm.getDataFormToSend()); search.addExtension(completedForm.getDataFormToSend());

View file

@ -54,7 +54,7 @@ public class DepartQueuePacket extends IQ {
this.user = user; this.user = user;
setTo(workgroup); setTo(workgroup);
setType(IQ.Type.SET); setType(IQ.Type.set);
setFrom(user); setFrom(user);
} }

View file

@ -100,7 +100,7 @@ public class OfferRequestProvider implements IQProvider {
OfferRequestPacket offerRequest = OfferRequestPacket offerRequest =
new OfferRequestPacket(userJID, userID, timeout, metaData, sessionID, content); new OfferRequestPacket(userJID, userID, timeout, metaData, sessionID, content);
offerRequest.setType(IQ.Type.SET); offerRequest.setType(IQ.Type.set);
return offerRequest; return offerRequest;
} }

View file

@ -567,7 +567,7 @@ public class Workgroup {
this.userID = userID; this.userID = userID;
setTo(workgroup); setTo(workgroup);
setType(IQ.Type.SET); setType(IQ.Type.set);
form = answerForm.getDataFormToSend(); form = answerForm.getDataFormToSend();
addExtension(form); addExtension(form);
@ -645,7 +645,7 @@ public class Workgroup {
if (type != -1) { if (type != -1) {
request.setType(type); request.setType(type);
} }
request.setType(IQ.Type.GET); request.setType(IQ.Type.get);
request.setTo(workgroupJID); request.setTo(workgroupJID);
ChatSettings response = (ChatSettings) connection.createPacketCollectorAndSend(request).nextResultOrThrow(); ChatSettings response = (ChatSettings) connection.createPacketCollectorAndSend(request).nextResultOrThrow();
@ -683,7 +683,7 @@ public class Workgroup {
*/ */
public OfflineSettings getOfflineSettings() throws NoResponseException, XMPPErrorException, NotConnectedException { public OfflineSettings getOfflineSettings() throws NoResponseException, XMPPErrorException, NotConnectedException {
OfflineSettings request = new OfflineSettings(); OfflineSettings request = new OfflineSettings();
request.setType(IQ.Type.GET); request.setType(IQ.Type.get);
request.setTo(workgroupJID); request.setTo(workgroupJID);
OfflineSettings response = (OfflineSettings) connection.createPacketCollectorAndSend( OfflineSettings response = (OfflineSettings) connection.createPacketCollectorAndSend(
@ -701,7 +701,7 @@ public class Workgroup {
*/ */
public SoundSettings getSoundSettings() throws NoResponseException, XMPPErrorException, NotConnectedException { public SoundSettings getSoundSettings() throws NoResponseException, XMPPErrorException, NotConnectedException {
SoundSettings request = new SoundSettings(); SoundSettings request = new SoundSettings();
request.setType(IQ.Type.GET); request.setType(IQ.Type.get);
request.setTo(workgroupJID); request.setTo(workgroupJID);
SoundSettings response = (SoundSettings) connection.createPacketCollectorAndSend(request).nextResultOrThrow(); SoundSettings response = (SoundSettings) connection.createPacketCollectorAndSend(request).nextResultOrThrow();
@ -718,7 +718,7 @@ public class Workgroup {
*/ */
public WorkgroupProperties getWorkgroupProperties() throws NoResponseException, XMPPErrorException, NotConnectedException { public WorkgroupProperties getWorkgroupProperties() throws NoResponseException, XMPPErrorException, NotConnectedException {
WorkgroupProperties request = new WorkgroupProperties(); WorkgroupProperties request = new WorkgroupProperties();
request.setType(IQ.Type.GET); request.setType(IQ.Type.get);
request.setTo(workgroupJID); request.setTo(workgroupJID);
WorkgroupProperties response = (WorkgroupProperties) connection.createPacketCollectorAndSend( WorkgroupProperties response = (WorkgroupProperties) connection.createPacketCollectorAndSend(
@ -738,7 +738,7 @@ public class Workgroup {
public WorkgroupProperties getWorkgroupProperties(String jid) throws NoResponseException, XMPPErrorException, NotConnectedException { public WorkgroupProperties getWorkgroupProperties(String jid) throws NoResponseException, XMPPErrorException, NotConnectedException {
WorkgroupProperties request = new WorkgroupProperties(); WorkgroupProperties request = new WorkgroupProperties();
request.setJid(jid); request.setJid(jid);
request.setType(IQ.Type.GET); request.setType(IQ.Type.get);
request.setTo(workgroupJID); request.setTo(workgroupJID);
WorkgroupProperties response = (WorkgroupProperties) connection.createPacketCollectorAndSend( WorkgroupProperties response = (WorkgroupProperties) connection.createPacketCollectorAndSend(
@ -759,7 +759,7 @@ public class Workgroup {
*/ */
public Form getWorkgroupForm() throws NoResponseException, XMPPErrorException, NotConnectedException { public Form getWorkgroupForm() throws NoResponseException, XMPPErrorException, NotConnectedException {
WorkgroupForm workgroupForm = new WorkgroupForm(); WorkgroupForm workgroupForm = new WorkgroupForm();
workgroupForm.setType(IQ.Type.GET); workgroupForm.setType(IQ.Type.get);
workgroupForm.setTo(workgroupJID); workgroupForm.setTo(workgroupJID);
WorkgroupForm response = (WorkgroupForm) connection.createPacketCollectorAndSend( WorkgroupForm response = (WorkgroupForm) connection.createPacketCollectorAndSend(