大家好,我正在使用这些代码行使用 smack 获取对话列表
@Override
protected Void doInBackground(String... strings) {
final ArrayList<UsersData> users
= UsersManager.getInstance().getUsers();
int count = 0;
while(count < users.size()) {
try {
Thread.sleep(500);
final String jid
= users.get(count).getUserJID();
IQ iq = new IQ() {
@Override
public String getChildElementXML() {
String list = "<list xmlns='urn:xmpp:archive'"+
"with='"+jid+"'>"+
"<set xmlns='http://jabber.org/protocol/rsm'>"+
"<max>30</max></set></list>";
return list;
}
};
iq.setType(IQ.Type.GET);
iq.setPacketID(jid+System.currentTimeMillis());
service.getXmppConnection().sendPacket(iq);
Log.v("XmppAsyncHistory", "IQ List sent!");
} catch (InterruptedException e) {
e.printStackTrace();
}
count++;
}
return null;
}
我已经添加了我的智商提供者。
provider.addIQProvider("list", "urn:xmpp:archive", new ListIQProvider());
我得到这节来回复。
D/SMACK(11130): 10:34:30 PM RCV (1096010080):
<iq type="result"
id="24@suitmedia1375112070174"
to="17@suitmedia/Smack"><list xmlns="urn:xmpp:archive">
chat with="24@suitmedia"
start="2013-07-25T09:57:04.121Z"/>
<chat with="24@suitmedia"
start="2013-07-25T11:08:28.997Z"/>
<chat with="24@suitmedia"
start="2013-07-29T09:29:18.295Z"/>
<chat with="24@suitmedia"
start="2013-07-29T07:47:29.841Z"/>
<set xmlns="http://jabber.org/protocol/rsm">
<first index="0">184</first><last>216</last>
<count>4</count></set></list></iq>
如您所见,它返回的不是最新的对话,而是分别从 25/07 到 29/07 的最旧对话
我想问的是这些标签是什么意思?184216 我怎样才能得到最近时间的对话列表顺序?
谢谢!