xmpp中 出席节 几种状态的切换及判断

来源:互联网 发布:下载淘宝网2015新版 编辑:程序博客网 时间:2024/06/01 09:06

几种各种状态切换

1,切换到在线。通过priority=1并且没有show则判断为 在线
发送在线

<presence id='presOnline_342d2e245376' xmlns='jabber:client'>    <status>在线</status>    <priority>1</priority></presence>

服务器会广播“我”的在线信息,“我”自己也能收到。后面各种状态也是一样的

<presence xmlns="jabber:client" id="presOnline_342d2e245376" from="lxy@user-20160421db/3n1yyjs701" to="lxy@user-20160421db/3n1yyjs701">    <status>在线</status>    <priority>1</priority></presence>

2,切换到空闲。通过show=chat 判断为空闲

<presence id='presChat_342d310b01889' xmlns='jabber:client'>    <status>空闲</status>    <show>chat</show>    <priority>1</priority></presence>
<presence xmlns="jabber:client" id="presChat_342d310b01889" from="lxy@user-20160421db/3n1yyjs701" to="lxy@user-20160421db/3n1yyjs701">    <status>空闲</status>    <show>chat</show>    <priority>1</priority></presence>

3,切换到正忙。通过show=dnd判断为正忙

<presence id='presDnd_342d31c702391' xmlns='jabber:client'>    <status>正忙</status>    <show>dnd</show>    <priority>0</priority></presence>
<presence xmlns="jabber:client" id="presDnd_342d31c702391" from="lxy@user-20160421db/3n1yyjs701" to="lxy@user-20160421db/3n1yyjs701">    <status>正忙</status>    <show>dnd</show>    <priority>0</priority></presence>

4,切换到离开,通过show=away判断为离开

<presence id='presAway_342d322f55629' xmlns='jabber:client'>    <status>离开</status>    <show>away</show>    <priority>0</priority></presence>
<presence xmlns="jabber:client" id="presAway_342d322f55629" from="lxy@user-20160421db/3n1yyjs701" to="lxy@user-20160421db/3n1yyjs701">    <status>离开</status>    <show>away</show>    <priority>0</priority></presence>

5,切换到隐身。通过 type=unavailable判断为隐身/离线

<presence id='presOffline_342d32a09a44' type='unavailable' xmlns='jabber:client'>    <status>Offline</status>    <priority>0</priority></presence>
<presence xmlns="jabber:client" id="presOffline_342d32a09a44" type="unavailable" from="lxy@user-20160421db/3n1yyjs701" to="lxy@user-20160421db/3n1yyjs701">    <status>Offline</status>    <priority>0</priority></presence>
0 0
原创粉丝点击