XMPP结果智商问题解析智商、结果、问题、XMPP

由网友(我冷血薄情你功不可没)分享简介:我使用Eclipse,Java和asmack一个XMPP聊天客户端应用程序。使用教程和许多许多的谷歌搜索我设法好友列表的工作,实际也聊着工作正常。 我的问题是寻找更多的哥们添加到我的联系人列表中。发送XML在这里举例说明: http://xmpp.org/extensions/xep-0055.html  我的要求是:...

我使用Eclipse,Java和asmack一个XMPP聊天客户端应用程序。使用教程和许多许多的谷歌搜索我设法好友列表的工作,实际也聊着工作正常。 我的问题是寻找更多的哥们添加到我的联系人列表中。发送XML在这里举例说明: http://xmpp.org/extensions/xep-0055.html  我的要求是:

I am building a XMPP chat client app with eclipse, java and asmack. Using tutorials and many many google searches I managed to get the buddy list working, actual chatting also works fine. My problem is with searching for more buddies to add to my contacts list. The XML to send is exemplified here : http://xmpp.org/extensions/xep-0055.html My request is :

<iq
id="search123"
from="name3@webserv.xxx.com/name3"
to="search.xxx.zzz.com"
type="set" >
<query xmlns="jabber:iq:search" >
    <nick>
android
    </nick>
</query>
</iq>

我想我得到了/回应是这样的:

the response I thought I was getting was/is this:

<iq
id="search123"
from="search.xxx.zzz.com"
to="name3@webserv.telebroad.com/Smack"
type="result" >
</iq>

但使用    connConfig.setDebuggerEnabled(真); (和在线Telnet客户端)我设法找到了该服务器实际上是正常工作,它的发送请求的结果,但我只是让你看到了什么上面。 我一直在这4天,我的自尊是相当低的:P 这里是我的关于智商的请求和响应code:

But using connConfig.setDebuggerEnabled(true); (and an online Telnet Client) I managed to find out that the server IS actually working correctly and it's sending the requested results, but I'm just getting what you see above. I have been at this for 4 days and my self esteem is quite low :P Here is my code concerning the IQ request and response:

Packet asdf = new Packet() {
                    @Override
                    public String toXML() {
                        return    "<iq type='set'"+
                                " from='name3@webserv.xxx.com/name3'"+
                                " to='search.xxx.zzz.com'"+
                                " id='search2'"+
                                " xml:lang='en'>"+
                              " <query xmlns='jabber:iq:search'>"+
                                " <nick>Android</nick>"+
                              " </query>"+
                            " </iq>";
                    }
                };


ChatList.connection.sendPacket(asdf);
                Log.e("packet", "request = "+ asdf.toXML());
                PacketFilter filter = new IQTypeFilter(IQ.Type.RESULT);
                ChatList.connection.addPacketListener(new PacketListener() {
                    public void processPacket(Packet packet) {
                        IQ iq = (IQ)packet;


                        Log.e("response","incoming packet : "+ packet.toXML());
                        Log.e("response","incoming packet2 : "+ packet.toString());

                    }
                }, filter);  

我试过很多TypeFilters无济于事。我很为难!

I've tried lots of TypeFilters to no avail. I'm stumped!!

底线:

1.request正在被服务器接受正确;

1.request is being accepted correctly by server;

2.server反应是正确的(所以说,调试器);

2.server response is correct(so says the debugger);

3.any response.toString toxml用于或打印出由上述类型的结果XML(无型后的实际项目='结果'>

3.any response.toString or toXML prints out the type result XML from above(without the actual items after type='result'>.

4,我上午约过期一周对我的最终版本为这个应用程序...帮助! :)

4.I am about a week overdue on my final build for this app...help! :)

推荐答案

http://stackoverflow.com/a/14214622/1688731 这...只是工作!!!!我不知道为什么。也许迭代器迭代器= row.getValues​​(JID); 的伎俩。但一切,我已经试过多次!!很多

http://stackoverflow.com/a/14214622/1688731 This...just works!!!! I have no idea why. maybe Iterator iterator = row.getValues("jid"); does the trick. But everything else, I've tried a LOT of times!!

阅读全文

相关推荐

最新文章