mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-11-25 21:42:07 +01:00
Remove all tabs and add checkstyle rule that enforces no-tabs
Fixes SMACK-866.
This commit is contained in:
parent
575364cc1f
commit
68d7d738b6
10 changed files with 104 additions and 158 deletions
|
@ -40,10 +40,8 @@
|
||||||
<property name="message" value="Line containing only whitespace character(s)"/>
|
<property name="message" value="Line containing only whitespace character(s)"/>
|
||||||
</module>
|
</module>
|
||||||
<module name="RegexpSingleline">
|
<module name="RegexpSingleline">
|
||||||
<!-- We use {2,} instead of + here to address the typical case where a file was written
|
<property name="format" value="\t+"/>
|
||||||
with tabs but javadoc is causing '\t *' -->
|
<property name="message" value="Line containing tab character(s)"/>
|
||||||
<property name="format" value="^\t+ {2,}"/>
|
|
||||||
<property name="message" value="Line containing space(s) after tab(s)"/>
|
|
||||||
</module>
|
</module>
|
||||||
<module name="RegexpSingleline">
|
<module name="RegexpSingleline">
|
||||||
<!--
|
<!--
|
||||||
|
|
|
@ -440,9 +440,7 @@ public class PacketParserUtils {
|
||||||
|
|
||||||
String language = ParserUtils.getXmlLang(parser);
|
String language = ParserUtils.getXmlLang(parser);
|
||||||
if (language != null && !"".equals(language.trim())) {
|
if (language != null && !"".equals(language.trim())) {
|
||||||
// CHECKSTYLE:OFF
|
presence.setLanguage(language);
|
||||||
presence.setLanguage(language);
|
|
||||||
// CHECKSTYLE:ON
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Parse sub-elements
|
// Parse sub-elements
|
||||||
|
|
|
@ -781,44 +781,38 @@ public class PacketParserUtilsTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void validateSimplePresence() throws Exception {
|
public void validateSimplePresence() throws Exception {
|
||||||
// CHECKSTYLE:OFF
|
String stanza = "<presence from='juliet@example.com/balcony' to='romeo@example.net'/>";
|
||||||
String stanza = "<presence from='juliet@example.com/balcony' to='romeo@example.net'/>";
|
|
||||||
|
|
||||||
Presence presence = PacketParserUtils.parsePresence(PacketParserUtils.getParserFor(stanza));
|
Presence presence = PacketParserUtils.parsePresence(PacketParserUtils.getParserFor(stanza));
|
||||||
|
|
||||||
assertXmlSimilar(stanza, presence.toXML(StreamOpen.CLIENT_NAMESPACE).toString());
|
assertXmlSimilar(stanza, presence.toXML(StreamOpen.CLIENT_NAMESPACE).toString());
|
||||||
// CHECKSTYLE:ON
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void validatePresenceProbe() throws Exception {
|
public void validatePresenceProbe() throws Exception {
|
||||||
// CHECKSTYLE:OFF
|
String stanza = "<presence from='mercutio@example.com' id='xv291f38' to='juliet@example.com' type='unsubscribed'/>";
|
||||||
String stanza = "<presence from='mercutio@example.com' id='xv291f38' to='juliet@example.com' type='unsubscribed'/>";
|
|
||||||
|
|
||||||
Presence presence = PacketParserUtils.parsePresence(PacketParserUtils.getParserFor(stanza));
|
Presence presence = PacketParserUtils.parsePresence(PacketParserUtils.getParserFor(stanza));
|
||||||
|
|
||||||
assertXmlSimilar(stanza, presence.toXML(StreamOpen.CLIENT_NAMESPACE).toString());
|
assertXmlSimilar(stanza, presence.toXML(StreamOpen.CLIENT_NAMESPACE).toString());
|
||||||
assertEquals(Presence.Type.unsubscribed, presence.getType());
|
assertEquals(Presence.Type.unsubscribed, presence.getType());
|
||||||
// CHECKSTYLE:ON
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void validatePresenceOptionalElements() throws Exception {
|
public void validatePresenceOptionalElements() throws Exception {
|
||||||
// CHECKSTYLE:OFF
|
String stanza = "<presence xml:lang='en' type='unsubscribed'>"
|
||||||
String stanza = "<presence xml:lang='en' type='unsubscribed'>"
|
+ "<show>dnd</show>"
|
||||||
+ "<show>dnd</show>"
|
+ "<status>Wooing Juliet</status>"
|
||||||
+ "<status>Wooing Juliet</status>"
|
+ "<priority>1</priority>"
|
||||||
+ "<priority>1</priority>"
|
+ "</presence>";
|
||||||
+ "</presence>";
|
|
||||||
|
|
||||||
Presence presence = PacketParserUtils.parsePresence(PacketParserUtils.getParserFor(stanza));
|
Presence presence = PacketParserUtils.parsePresence(PacketParserUtils.getParserFor(stanza));
|
||||||
assertXmlSimilar(stanza, presence.toXML(StreamOpen.CLIENT_NAMESPACE).toString());
|
assertXmlSimilar(stanza, presence.toXML(StreamOpen.CLIENT_NAMESPACE).toString());
|
||||||
assertEquals(Presence.Type.unsubscribed, presence.getType());
|
assertEquals(Presence.Type.unsubscribed, presence.getType());
|
||||||
assertEquals("dnd", presence.getMode().name());
|
assertEquals("dnd", presence.getMode().name());
|
||||||
assertEquals("en", presence.getLanguage());
|
assertEquals("en", presence.getLanguage());
|
||||||
assertEquals("Wooing Juliet", presence.getStatus());
|
assertEquals("Wooing Juliet", presence.getStatus());
|
||||||
assertEquals(1, presence.getPriority());
|
assertEquals(1, presence.getPriority());
|
||||||
// CHECKSTYLE:ON
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Test
|
// @Test
|
||||||
|
|
|
@ -257,11 +257,9 @@ public class EnhancedDebugger extends SmackDebugger {
|
||||||
new DefaultTableModel(
|
new DefaultTableModel(
|
||||||
new Object[] {"Hide", "Timestamp", "", "", "Message", "Id", "Type", "To", "From"},
|
new Object[] {"Hide", "Timestamp", "", "", "Message", "Id", "Type", "To", "From"},
|
||||||
0) {
|
0) {
|
||||||
// CHECKSTYLE:OFF
|
private static final long serialVersionUID = 8136121224474217264L;
|
||||||
private static final long serialVersionUID = 8136121224474217264L;
|
@Override
|
||||||
@Override
|
|
||||||
public boolean isCellEditable(int rowIndex, int mColIndex) {
|
public boolean isCellEditable(int rowIndex, int mColIndex) {
|
||||||
// CHECKSTYLE:ON
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -689,11 +687,9 @@ public class EnhancedDebugger extends SmackDebugger {
|
||||||
new DefaultTableModel(new Object[][] { {"IQ", 0, 0}, {"Message", 0, 0},
|
new DefaultTableModel(new Object[][] { {"IQ", 0, 0}, {"Message", 0, 0},
|
||||||
{"Presence", 0, 0}, {"Other", 0, 0}, {"Total", 0, 0}},
|
{"Presence", 0, 0}, {"Other", 0, 0}, {"Total", 0, 0}},
|
||||||
new Object[] {"Type", "Received", "Sent"}) {
|
new Object[] {"Type", "Received", "Sent"}) {
|
||||||
// CHECKSTYLE:OFF
|
private static final long serialVersionUID = -6793886085109589269L;
|
||||||
private static final long serialVersionUID = -6793886085109589269L;
|
@Override
|
||||||
@Override
|
|
||||||
public boolean isCellEditable(int rowIndex, int mColIndex) {
|
public boolean isCellEditable(int rowIndex, int mColIndex) {
|
||||||
// CHECKSTYLE:ON
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -131,10 +131,8 @@ public class PrivacyItem {
|
||||||
* @return the allow communication status.
|
* @return the allow communication status.
|
||||||
*/
|
*/
|
||||||
public boolean isAllow() {
|
public boolean isAllow() {
|
||||||
// CHECKSTYLE:OFF
|
return allow;
|
||||||
return allow;
|
}
|
||||||
}
|
|
||||||
// CHECKSTYLE:ON
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns whether the receiver allow or deny incoming IQ stanzas or not.
|
* Returns whether the receiver allow or deny incoming IQ stanzas or not.
|
||||||
|
@ -142,10 +140,8 @@ public class PrivacyItem {
|
||||||
* @return the iq filtering status.
|
* @return the iq filtering status.
|
||||||
*/
|
*/
|
||||||
public boolean isFilterIQ() {
|
public boolean isFilterIQ() {
|
||||||
// CHECKSTYLE:OFF
|
return filterIQ;
|
||||||
return filterIQ;
|
}
|
||||||
}
|
|
||||||
// CHECKSTYLE:ON
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets whether the receiver allows or denies incoming IQ stanzas or not.
|
* Sets whether the receiver allows or denies incoming IQ stanzas or not.
|
||||||
|
@ -153,11 +149,8 @@ public class PrivacyItem {
|
||||||
* @param filterIQ indicates if the receiver allows or denies incoming IQ stanzas.
|
* @param filterIQ indicates if the receiver allows or denies incoming IQ stanzas.
|
||||||
*/
|
*/
|
||||||
public void setFilterIQ(boolean filterIQ) {
|
public void setFilterIQ(boolean filterIQ) {
|
||||||
// CHECKSTYLE:OFF
|
this.filterIQ = filterIQ;
|
||||||
|
}
|
||||||
this.filterIQ = filterIQ;
|
|
||||||
}
|
|
||||||
// CHECKSTYLE:ON
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns whether the receiver allows or denies incoming messages or not.
|
* Returns whether the receiver allows or denies incoming messages or not.
|
||||||
|
@ -165,10 +158,8 @@ public class PrivacyItem {
|
||||||
* @return the message filtering status.
|
* @return the message filtering status.
|
||||||
*/
|
*/
|
||||||
public boolean isFilterMessage() {
|
public boolean isFilterMessage() {
|
||||||
// CHECKSTYLE:OFF
|
return filterMessage;
|
||||||
return filterMessage;
|
}
|
||||||
}
|
|
||||||
// CHECKSTYLE:ON
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets wheather the receiver allows or denies incoming messages or not.
|
* Sets wheather the receiver allows or denies incoming messages or not.
|
||||||
|
@ -176,10 +167,8 @@ public class PrivacyItem {
|
||||||
* @param filterMessage indicates if the receiver allows or denies incoming messages or not.
|
* @param filterMessage indicates if the receiver allows or denies incoming messages or not.
|
||||||
*/
|
*/
|
||||||
public void setFilterMessage(boolean filterMessage) {
|
public void setFilterMessage(boolean filterMessage) {
|
||||||
// CHECKSTYLE:OFF
|
this.filterMessage = filterMessage;
|
||||||
this.filterMessage = filterMessage;
|
}
|
||||||
}
|
|
||||||
// CHECKSTYLE:ON
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns whether the receiver allows or denies incoming presence or not.
|
* Returns whether the receiver allows or denies incoming presence or not.
|
||||||
|
@ -187,10 +176,8 @@ public class PrivacyItem {
|
||||||
* @return the iq filtering incoming presence status.
|
* @return the iq filtering incoming presence status.
|
||||||
*/
|
*/
|
||||||
public boolean isFilterPresenceIn() {
|
public boolean isFilterPresenceIn() {
|
||||||
// CHECKSTYLE:OFF
|
return filterPresenceIn;
|
||||||
return filterPresenceIn;
|
}
|
||||||
}
|
|
||||||
// CHECKSTYLE:ON
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets whether the receiver allows or denies incoming presence or not.
|
* Sets whether the receiver allows or denies incoming presence or not.
|
||||||
|
@ -198,10 +185,8 @@ public class PrivacyItem {
|
||||||
* @param filterPresenceIn indicates if the receiver allows or denies filtering incoming presence.
|
* @param filterPresenceIn indicates if the receiver allows or denies filtering incoming presence.
|
||||||
*/
|
*/
|
||||||
public void setFilterPresenceIn(boolean filterPresenceIn) {
|
public void setFilterPresenceIn(boolean filterPresenceIn) {
|
||||||
// CHECKSTYLE:OFF
|
this.filterPresenceIn = filterPresenceIn;
|
||||||
this.filterPresenceIn = filterPresenceIn;
|
}
|
||||||
}
|
|
||||||
// CHECKSTYLE:ON
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns whether the receiver allows or denies incoming presence or not.
|
* Returns whether the receiver allows or denies incoming presence or not.
|
||||||
|
@ -209,10 +194,8 @@ public class PrivacyItem {
|
||||||
* @return the iq filtering incoming presence status.
|
* @return the iq filtering incoming presence status.
|
||||||
*/
|
*/
|
||||||
public boolean isFilterPresenceOut() {
|
public boolean isFilterPresenceOut() {
|
||||||
// CHECKSTYLE:OFF
|
return filterPresenceOut;
|
||||||
return filterPresenceOut;
|
}
|
||||||
}
|
|
||||||
// CHECKSTYLE:ON
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets whether the receiver allows or denies outgoing presence or not.
|
* Sets whether the receiver allows or denies outgoing presence or not.
|
||||||
|
@ -220,10 +203,8 @@ public class PrivacyItem {
|
||||||
* @param filterPresenceOut indicates if the receiver allows or denies filtering outgoing presence
|
* @param filterPresenceOut indicates if the receiver allows or denies filtering outgoing presence
|
||||||
*/
|
*/
|
||||||
public void setFilterPresenceOut(boolean filterPresenceOut) {
|
public void setFilterPresenceOut(boolean filterPresenceOut) {
|
||||||
// CHECKSTYLE:OFF
|
this.filterPresenceOut = filterPresenceOut;
|
||||||
this.filterPresenceOut = filterPresenceOut;
|
}
|
||||||
}
|
|
||||||
// CHECKSTYLE:ON
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the order where the receiver is processed. List items are processed in
|
* Returns the order where the receiver is processed. List items are processed in
|
||||||
|
@ -235,10 +216,8 @@ public class PrivacyItem {
|
||||||
* @return the order number.
|
* @return the order number.
|
||||||
*/
|
*/
|
||||||
public long getOrder() {
|
public long getOrder() {
|
||||||
// CHECKSTYLE:OFF
|
return order;
|
||||||
return order;
|
}
|
||||||
}
|
|
||||||
// CHECKSTYLE:ON
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the type hold the kind of communication it will allow or block.
|
* Returns the type hold the kind of communication it will allow or block.
|
||||||
|
@ -248,9 +227,7 @@ public class PrivacyItem {
|
||||||
*/
|
*/
|
||||||
public Type getType() {
|
public Type getType() {
|
||||||
return type;
|
return type;
|
||||||
// CHECKSTYLE:OFF
|
}
|
||||||
}
|
|
||||||
// CHECKSTYLE:ON
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the element identifier to apply the action.
|
* Returns the element identifier to apply the action.
|
||||||
|
@ -265,9 +242,7 @@ public class PrivacyItem {
|
||||||
*/
|
*/
|
||||||
public String getValue() {
|
public String getValue() {
|
||||||
return value;
|
return value;
|
||||||
// CHECKSTYLE:OFF
|
}
|
||||||
}
|
|
||||||
// CHECKSTYLE:ON
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns whether the receiver allows or denies every kind of communication.
|
* Returns whether the receiver allows or denies every kind of communication.
|
||||||
|
@ -278,23 +253,22 @@ public class PrivacyItem {
|
||||||
* @return the all communications status.
|
* @return the all communications status.
|
||||||
*/
|
*/
|
||||||
public boolean isFilterEverything() {
|
public boolean isFilterEverything() {
|
||||||
// CHECKSTYLE:OFF
|
return !(this.isFilterIQ() || this.isFilterMessage() || this.isFilterPresenceIn()
|
||||||
return !(this.isFilterIQ() || this.isFilterMessage() || this.isFilterPresenceIn()
|
|| this.isFilterPresenceOut());
|
||||||
|| this.isFilterPresenceOut());
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Answer an xml representation of the receiver according to the RFC 3921.
|
* Answer an xml representation of the receiver according to the RFC 3921.
|
||||||
*
|
*
|
||||||
* @return the text xml representation.
|
* @return the text xml representation.
|
||||||
*/
|
*/
|
||||||
public String toXML() {
|
public String toXML() {
|
||||||
StringBuilder buf = new StringBuilder();
|
StringBuilder buf = new StringBuilder();
|
||||||
buf.append("<item");
|
buf.append("<item");
|
||||||
if (this.isAllow()) {
|
if (this.isAllow()) {
|
||||||
buf.append(" action=\"allow\"");
|
buf.append(" action=\"allow\"");
|
||||||
} else {
|
} else {
|
||||||
buf.append(" action=\"deny\"");
|
buf.append(" action=\"deny\"");
|
||||||
}
|
}
|
||||||
buf.append(" order=\"").append(getOrder()).append('"');
|
buf.append(" order=\"").append(getOrder()).append('"');
|
||||||
if (getType() != null) {
|
if (getType() != null) {
|
||||||
|
@ -304,24 +278,23 @@ public class PrivacyItem {
|
||||||
buf.append(" value=\"").append(getValue()).append('"');
|
buf.append(" value=\"").append(getValue()).append('"');
|
||||||
}
|
}
|
||||||
if (isFilterEverything()) {
|
if (isFilterEverything()) {
|
||||||
buf.append("/>");
|
buf.append("/>");
|
||||||
} else {
|
} else {
|
||||||
buf.append('>');
|
buf.append('>');
|
||||||
if (this.isFilterIQ()) {
|
if (this.isFilterIQ()) {
|
||||||
buf.append("<iq/>");
|
buf.append("<iq/>");
|
||||||
}
|
}
|
||||||
if (this.isFilterMessage()) {
|
if (this.isFilterMessage()) {
|
||||||
buf.append("<message/>");
|
buf.append("<message/>");
|
||||||
}
|
}
|
||||||
if (this.isFilterPresenceIn()) {
|
if (this.isFilterPresenceIn()) {
|
||||||
buf.append("<presence-in/>");
|
buf.append("<presence-in/>");
|
||||||
}
|
}
|
||||||
if (this.isFilterPresenceOut()) {
|
if (this.isFilterPresenceOut()) {
|
||||||
buf.append("<presence-out/>");
|
buf.append("<presence-out/>");
|
||||||
}
|
}
|
||||||
buf.append("</item>");
|
buf.append("</item>");
|
||||||
}
|
}
|
||||||
// CHECKSTYLE:ON
|
|
||||||
return buf.toString();
|
return buf.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -155,9 +155,7 @@ public final class ChatManager extends Manager{
|
||||||
Message message = (Message) packet;
|
Message message = (Message) packet;
|
||||||
Chat chat;
|
Chat chat;
|
||||||
if (message.getThread() == null) {
|
if (message.getThread() == null) {
|
||||||
// CHECKSTYLE:OFF
|
chat = getUserChat(message.getFrom());
|
||||||
chat = getUserChat(message.getFrom());
|
|
||||||
// CHECKSTYLE:ON
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
chat = getThreadChat(message.getThread());
|
chat = getThreadChat(message.getThread());
|
||||||
|
|
|
@ -113,31 +113,28 @@ public class MacroGroup {
|
||||||
}
|
}
|
||||||
|
|
||||||
public String toXML() {
|
public String toXML() {
|
||||||
// CHECKSTYLE:OFF
|
StringBuilder buf = new StringBuilder();
|
||||||
StringBuilder buf = new StringBuilder();
|
buf.append("<macrogroup>");
|
||||||
buf.append("<macrogroup>");
|
buf.append("<title>" + getTitle() + "</title>");
|
||||||
buf.append("<title>" + getTitle() + "</title>");
|
buf.append("<macros>");
|
||||||
buf.append("<macros>");
|
for (Macro macro : getMacros()) {
|
||||||
for (Macro macro : getMacros())
|
buf.append("<macro>");
|
||||||
{
|
buf.append("<title>" + macro.getTitle() + "</title>");
|
||||||
buf.append("<macro>");
|
buf.append("<type>" + macro.getType() + "</type>");
|
||||||
buf.append("<title>" + macro.getTitle() + "</title>");
|
buf.append("<description>" + macro.getDescription() + "</description>");
|
||||||
buf.append("<type>" + macro.getType() + "</type>");
|
buf.append("<response>" + macro.getResponse() + "</response>");
|
||||||
buf.append("<description>" + macro.getDescription() + "</description>");
|
buf.append("</macro>");
|
||||||
buf.append("<response>" + macro.getResponse() + "</response>");
|
}
|
||||||
buf.append("</macro>");
|
buf.append("</macros>");
|
||||||
}
|
|
||||||
buf.append("</macros>");
|
|
||||||
|
|
||||||
if (getMacroGroups().size() > 0) {
|
if (getMacroGroups().size() > 0) {
|
||||||
buf.append("<macroGroups>");
|
buf.append("<macroGroups>");
|
||||||
for (MacroGroup groups : getMacroGroups()) {
|
for (MacroGroup groups : getMacroGroups()) {
|
||||||
buf.append(groups.toXML());
|
buf.append(groups.toXML());
|
||||||
}
|
}
|
||||||
buf.append("</macroGroups>");
|
buf.append("</macroGroups>");
|
||||||
}
|
}
|
||||||
buf.append("</macrogroup>");
|
buf.append("</macrogroup>");
|
||||||
return buf.toString();
|
return buf.toString();
|
||||||
// CHECKSTYLE:ON
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,11 +83,9 @@ public class Macros extends IQ {
|
||||||
buf.append("<personal>true</personal>");
|
buf.append("<personal>true</personal>");
|
||||||
}
|
}
|
||||||
if (getPersonalMacroGroup() != null) {
|
if (getPersonalMacroGroup() != null) {
|
||||||
// CHECKSTYLE:OFF
|
buf.append("<personalMacro>");
|
||||||
buf.append("<personalMacro>");
|
buf.append(StringUtils.escapeForXmlText(getPersonalMacroGroup().toXML()));
|
||||||
buf.append(StringUtils.escapeForXmlText(getPersonalMacroGroup().toXML()));
|
buf.append("</personalMacro>");
|
||||||
buf.append("</personalMacro>");
|
|
||||||
// CHECKSTYLE:ON
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return buf;
|
return buf;
|
||||||
|
|
|
@ -478,17 +478,13 @@ public class Workgroup {
|
||||||
|
|
||||||
private void fireInvitationEvent(WorkgroupInvitation invitation) {
|
private void fireInvitationEvent(WorkgroupInvitation invitation) {
|
||||||
for (WorkgroupInvitationListener listener : invitationListeners) {
|
for (WorkgroupInvitationListener listener : invitationListeners) {
|
||||||
// CHECKSTYLE:OFF
|
listener.invitationReceived(invitation);
|
||||||
listener.invitationReceived(invitation);
|
|
||||||
// CHECKSTYLE:ON
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void fireQueueJoinedEvent() {
|
private void fireQueueJoinedEvent() {
|
||||||
for (QueueListener listener : queueListeners) {
|
for (QueueListener listener : queueListeners) {
|
||||||
// CHECKSTYLE:OFF
|
listener.joinedQueue();
|
||||||
listener.joinedQueue();
|
|
||||||
// CHECKSTYLE:ON
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -50,30 +50,29 @@ public class RosterExchangeProvider extends ExtensionElementProvider<RosterExcha
|
||||||
@Override
|
@Override
|
||||||
public RosterExchange parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment)
|
public RosterExchange parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment)
|
||||||
throws XmlPullParserException, IOException {
|
throws XmlPullParserException, IOException {
|
||||||
// CHECKSTYLE:OFF
|
|
||||||
RosterExchange rosterExchange = new RosterExchange();
|
RosterExchange rosterExchange = new RosterExchange();
|
||||||
boolean done = false;
|
boolean done = false;
|
||||||
RemoteRosterEntry remoteRosterEntry;
|
RemoteRosterEntry remoteRosterEntry;
|
||||||
Jid jid = null;
|
Jid jid = null;
|
||||||
String name = "";
|
String name = "";
|
||||||
ArrayList<String> groupsName = new ArrayList<>();
|
ArrayList<String> groupsName = new ArrayList<>();
|
||||||
while (!done) {
|
while (!done) {
|
||||||
XmlPullParser.Event eventType = parser.next();
|
XmlPullParser.Event eventType = parser.next();
|
||||||
if (eventType == XmlPullParser.Event.START_ELEMENT) {
|
if (eventType == XmlPullParser.Event.START_ELEMENT) {
|
||||||
if (parser.getName().equals("item")) {
|
if (parser.getName().equals("item")) {
|
||||||
// Reset this variable since they are optional for each item
|
// Reset this variable since they are optional for each item
|
||||||
groupsName = new ArrayList<>();
|
groupsName = new ArrayList<>();
|
||||||
// Initialize the variables from the parsed XML
|
// Initialize the variables from the parsed XML
|
||||||
jid = ParserUtils.getJidAttribute(parser);
|
jid = ParserUtils.getJidAttribute(parser);
|
||||||
name = parser.getAttributeValue("", "name");
|
name = parser.getAttributeValue("", "name");
|
||||||
}
|
}
|
||||||
if (parser.getName().equals("group")) {
|
if (parser.getName().equals("group")) {
|
||||||
groupsName.add(parser.nextText());
|
groupsName.add(parser.nextText());
|
||||||
}
|
}
|
||||||
} else if (eventType == XmlPullParser.Event.END_ELEMENT) {
|
} else if (eventType == XmlPullParser.Event.END_ELEMENT) {
|
||||||
if (parser.getName().equals("item")) {
|
if (parser.getName().equals("item")) {
|
||||||
// Create packet.
|
// Create packet.
|
||||||
remoteRosterEntry = new RemoteRosterEntry(jid, name, groupsName.toArray(new String[groupsName.size()]));
|
remoteRosterEntry = new RemoteRosterEntry(jid, name, groupsName.toArray(new String[groupsName.size()]));
|
||||||
rosterExchange.addRosterEntry(remoteRosterEntry);
|
rosterExchange.addRosterEntry(remoteRosterEntry);
|
||||||
}
|
}
|
||||||
if (parser.getName().equals("x")) {
|
if (parser.getName().equals("x")) {
|
||||||
|
@ -81,7 +80,6 @@ public class RosterExchangeProvider extends ExtensionElementProvider<RosterExcha
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// CHECKSTYLE:ON
|
|
||||||
return rosterExchange;
|
return rosterExchange;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue