mirror of
https://github.com/vanitasvitae/Smack.git
synced 2025-09-10 17:49:38 +02:00
1. Clean up code
2. Refactoring work 3. Optimization work. SMACK-153 4. Fixed roster test cases. SMACK-154 4. Fixed vCard issue. SMACK-152 git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@4538 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
parent
14b50d790a
commit
f57ff10ad9
77 changed files with 995 additions and 932 deletions
|
@ -20,10 +20,13 @@
|
|||
|
||||
package org.jivesoftware.smackx.packet;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import org.jivesoftware.smack.packet.IQ;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* A DiscoverItems IQ packet, which is used by XMPP clients to request and receive items
|
||||
* associated with XMPP entities.<p>
|
||||
|
@ -35,7 +38,7 @@ import org.jivesoftware.smack.packet.IQ;
|
|||
*/
|
||||
public class DiscoverItems extends IQ {
|
||||
|
||||
private List items = new ArrayList();
|
||||
private final List<DiscoverItems.Item> items = new ArrayList<DiscoverItems.Item>();
|
||||
private String node;
|
||||
|
||||
/**
|
||||
|
@ -54,9 +57,10 @@ public class DiscoverItems extends IQ {
|
|||
*
|
||||
* @return an Iterator on the discovered entity's items
|
||||
*/
|
||||
public Iterator getItems() {
|
||||
public Iterator<DiscoverItems.Item> getItems() {
|
||||
synchronized (items) {
|
||||
return Collections.unmodifiableList(new ArrayList(items)).iterator();
|
||||
return Collections.unmodifiableList(new ArrayList<DiscoverItems.Item>(items))
|
||||
.iterator();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -87,7 +91,7 @@ public class DiscoverItems extends IQ {
|
|||
}
|
||||
|
||||
public String getChildElementXML() {
|
||||
StringBuffer buf = new StringBuffer();
|
||||
StringBuilder buf = new StringBuilder();
|
||||
buf.append("<query xmlns=\"http://jabber.org/protocol/disco#items\"");
|
||||
if (getNode() != null) {
|
||||
buf.append(" node=\"");
|
||||
|
@ -97,7 +101,7 @@ public class DiscoverItems extends IQ {
|
|||
buf.append(">");
|
||||
synchronized (items) {
|
||||
for (int i = 0; i < items.size(); i++) {
|
||||
Item item = (Item) items.get(i);
|
||||
Item item = items.get(i);
|
||||
buf.append(item.toXML());
|
||||
}
|
||||
}
|
||||
|
@ -217,7 +221,7 @@ public class DiscoverItems extends IQ {
|
|||
}
|
||||
|
||||
public String toXML() {
|
||||
StringBuffer buf = new StringBuffer();
|
||||
StringBuilder buf = new StringBuilder();
|
||||
buf.append("<item jid=\"").append(entityID).append("\"");
|
||||
if (name != null) {
|
||||
buf.append(" name=\"").append(name).append("\"");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue