XMPP即时通讯协议使用(十)——好友关系状态

sub  ask  recv
订阅 询问 接受

含义
substatus
-1—  应该删除这个好友
         Indicates that the roster item should be removed.
0—  没有建立好友关系
        No subscription is established.
1—  用户已经发出好友请求
        The roster owner has a subscription to the roster item’s presence.
2—  收到好友请求并且加对方好友
       The roster item has a subscription to the roster owner’s presence.
3—  好友已经相互添加
       The roster item and the owner have a mutual subscription.

字段的具体分析:
askstatus
-1—  没有挂起的添加好友请求。
     The roster item has no pending subscription requests.
 0— 有挂起的添加好友请求。
     The roster item has been asked for permission to subscribe to its presence but no response has been received.
1— 估计是有没有回复的删除请求吧
      The roster owner has asked the roster item to be unsubscribed from its presence notifications but hasn't yet received confi rmation.

recvstatus
-1— 已经回复添加好友请求
       There are no subscriptions that have been received but not presented to the user.
1— 接收到好友请求但是没有给好友回复
       The server has received a subscribe request, but has not forwarded it to the user.
2— 估计是没有回复删除请求吧
      The server has received an unsubscribe request, but has not forwarded it to the user.

sub订阅:
-1  remove  发送删除用户请求
0    none     用户没有建立好友关系
1    to          发送订阅请求且请求被接受
2    from      接受好友订阅请求
3    both      双方互为好友关系


ask是否有发送订阅请求:
-1    null      没有发送好友请求
0    subscribe  发送好友订阅请求但没回复
1    unsubscribe  发送取消订阅好友请求


rec是否有接受订阅请求:
-1    null      没有收到好友订阅请求
1     sub      收到好友订阅请求但没回复
2    unsub   收到好友取消订阅请求

对方拒绝好友请求 不变 0 0 -1
对方接受好友请求 1 -1 1。
对方接受后会发好友请求  同意则 3 -1  -1

收到好友申请  0 -1  1
如果 拒绝添加,则删除数据库记录
如果 接受添加,2 0 -1 。接受同时会发送好友添加请求,3  -1 -1

1申请 加2好友(2在线状态)
1 2@xxx    0 0 -1
2 1@xxx    0 -1 1

2 接受
1 2@xxx    1 -1 1
2 1@xxx    2 0 -1

2申请加1好友

1同意
1 2@xxx    3 -1 -1
2 1@xxx    3 -1 -1

1申请 加2好友(2未登录)
1 2@xxx    0 0 -1
2 1@xxx    0 -1 1

2登录
1 2@xxx    1 -1 -1
2 1@xxx    2 -1 -1

2 接受
1 2@xxx    3 -1 -1
2 1@xxx    3 -1 -1
 

JID:

一个XMPP实体的地址称为Jabber Identifier或JID,作用类似于IP地址。一个合法的JID包括节点名,域名资源名,其格式为:jid=[node'@']domain['/'resource]

XMPP协议的命名空间:

jabber:iq:private -- 私有数据存储,用于本地用户私人设置信息,比如用户备注等。

jabber:iq:conference -- 一般会议,用于多个用户之间的信息共享

jabber:x:encrypted -- 加密的消息,用于发送加密消息

jabber:x:expire -- 消息终止

jabber:iq:time -- 客户端时间

jabber:iq:auth -- 简单用户认证,一般用于服务器之间或者服务器和客户端之间的认证

jabber:x:roster -- 内部花名册

jabber:x:signed -- 标记的在线状态

jabber:iq:search -- 用户数据库查询,用于向服务器发送查询请求

jabber:iq:register -- 注册请求,用于用户注册相关信息

jabber:x:iq:roster -- 花名册管理

jabber:x:conference -- 会议邀请,用于向参加会议用户发送开会通知

jabber:x:event -- 消息事件

vcard-temp -- 临时的vCard,用于设置用户的头像以及昵称等

原文地址:https://www.cnblogs.com/gmhappy/p/11864083.html