xmpp muc 群聊协议 2

xmpp muc 群聊协议 2

Roles and Affiliations

There are two dimensions along which we can measure a user's connection with or position in a room. One is the user's long-lived affiliation with a room -- e.g., a user's status as an owner or an outcast. The other is a user's role while an occupant of a room -- e.g., an occupant's position as a moderator with the ability to kick visitors and participants. These two dimensions are distinct from each other, since an affiliation lasts across visits, while a role lasts only for the duration of a visit. In addition, there is no one-to-one correspondence between roles and affiliations; for example, someone who is not affiliated with a room may be a (temporary) moderator, and a member may be a participant or a visitor in a moderated room.


一个用户和一个房间的联系,和在一个房间的地位。一个是和一个房间长期的地位的关系,比如,一个用户的状态是这个房间的创建者,或者是这个房间的被驱逐 者,也就是黑名单。 另外一种,就是在每个人都作为这个房间的一员来说,他们在房间的角色。比如是有着剔除游客和参与者的仲裁者。
这两种关系式彼 此不同的。 affiliation是一直维持的,一个角色是仅仅在其在这个房间的访问期间。另外, 在角色和affiliation之间是没有一对一的关系的。比如,有的人可能不是这个房间的人,但是他可以作为一个临时的仲裁者,还有,一个member 在一个被仲裁的房间内,或许是一个participant或者是一个visitor。

Table 2: Roles
Name Support
Moderator REQUIRED
None N/A (the absence of a role)
Participant REQUIRED
Visitor RECOMMENDED


角色有四种:
    moderator(仲裁者), none, participant(参与者), visitor(游客)

Roles are temporary in that they do not necessarily persist across a user's visits to the room and MAY change during the course of an occupant's visit to the room. An implementation MAY persist roles across visits and SHOULD do so for moderated rooms (since the distinction between visitor and participant is critical to the functioning of a moderated room).

角色是一个临时的,在这个用户和这个房间的长期关系中, 角色是不需要持久化的。角色可能在一次在这个房间中的访问中被改变。服务端也许会在一个被主持的房间里将其持久化,因为在一个被主持的房间里,visitor和participant的区别是有意义的。

 

There is no one-to-one mapping between roles and affiliations (e.g., a member could be a participant or a visitor).

在roles和affiliation之间,是没有一对一的关系映射的,比如一个member可能是一个participant或者是visitor



A moderator is the most powerful occupant within the context of the room, and can to some extent manage other occupants' roles in the room. A participant has fewer privileges than a moderator, although he or she always has the right to speak. A visitor is a more restricted role within the context of a moderated room, since visitors are not allowed to send messages to all occupants.


一个moderator在一个房间中,是最有权力的occupant,可以管理其他occupant的角色,一个participant相比之下就 有较少的权利,但是participant总是有说话聊天的权利。一个visitor在一个moderated的房间里面是最没有权利的,因为它不允许发 消息给其他的occupants


Roles are granted, revoked, and maintained based on the occupant's room nickname or full JID rather than bare JID. The privileges associated with these roles, as well as the actions that trigger changes in roles, are defined below.

Information about roles MUST be sent in all presence stanzas generated or reflected by the room and thus sent to occupants.


权利的授予,移除,维护时依据这个用户在这个房间昵称,或者是这个用户的full jid。
在一个房间中, roles的消息必须用presence 协议,由房间发送给所有的occupants

5.1.1 Privileges


For the most part, roles exist in a hierarchy. For instance, a participant can do anything a visitor can do, and a moderator can do anything a participant can do. Each role has privileges not possessed by the next-lowest role; these privileges are specified in the following table as defaults (an implementation MAY provide configuration options that override these defaults).


权利

通常情况下,角色本身是有层次性的,例如,一个participant可以做visitor可以做的任何事情,一个moderator可以做任何participant可以做的事情,每一个role有他下一个等级没有的权利


Privilege None Visitor Participant Moderator
Present in Room
No Yes Yes Yes
Receive Messages No Yes Yes Yes
Receive Occupant Presence No Yes Yes Yes
Presence Broadcasted to Room No Yes* Yes Yes
Change Availability Status No Yes Yes Yes
Change Room Nickname No Yes* Yes Yes
Send Private Messages No Yes* Yes Yes
Invite Other Users No Yes* Yes* Yes
Send Messages to All No No** Yes Yes
Modify Subject No No* Yes* Yes
Kick Participants and Visitors No No No Yes
Grant Voice No No No Yes
Revoke Voice No No No Yes***

* Default; configuration settings MAY modify this privilege.

** An implementation MAY grant voice by default to visitors in unmoderated rooms.

   服务器端可以实现   :  在没有moderated romm 赋予visitor发言的权限

*** A moderator MUST NOT be able to revoke voice privileges from an admin or owner.


    一个moderator不能移除admin和owner的发言权



5.1.2 Changing Roles、

改变roles

The ways in which an occupant's role changes are well-defined. Sometimes the change results from the occupant's own action (e.g., entering or exiting the room), whereas sometimes the change results from an action taken by a moderator, admin, or owner. If an occupant's role changes, a MUC service implementation MUST change the occupant's role to reflect the change and communicate the change to all occupants. Role changes and their triggering actions are specified in the following table.


一个occupant的角色的改变时定义好的,有些时候,角色的改变时由于occupant自己的动作产生的,可能是这个occupant自己进入 了一个房间,或者退出了一个房间。但是,有时候,这些改变时因为moderator,admin或者是owner产生的,如果一个occupant的 role发生了改变,服务器端自己必须实现把这个occupant的角色改变,并且把这个改变通知所有的occupants。


> None Visitor Participant Moderator
None -- Enter moderated room Enter unmoderated room Admin or owner enters room
Visitor Exit room or be kicked by a moderator -- Moderator grants voice Admin or owner grants moderator privileges
Participant Exit room or be kicked by a moderator Moderator revokes voice -- Admin or owner grants moderator privileges
Moderator Exit room Admin or owner changes role to visitor * Admin or owner changes role to participant or revokes moderator privileges * --

* A moderator MUST NOT be able to revoke moderator privileges from an occupant who is equal to or above the moderator in the hierarchy of affiliations.

一个moderator不能把这个房间的和他在affilation层面等级一样,或者比他高的人的moderator权限给干掉的。

Note: Certain roles are typically implicit in certain privileges. For example, an admin or owner is automatically a moderator, so if an occupant is granted admin status then the occupant will by that fact be granted moderator privileges; similarly, when an occupant is made a member in a moderated room, the occupant automatically has a role of participant. However, the loss of admin status does not necessarily mean that the occupant is no longer a moderator (since a "mere" participant can be a moderator). Therefore, the roles that are gained when an occupant is granted a certain affiliation are stable, whereas the roles that are lost when an occupant loses a certain affilitation are no hardcoded and are left up to the implementation. Since a client cannot predict what the role will be after revoking a certain affiliation, if it wants to remove both admin/owner privileges and the moderator role at the same time then it must specifically request the role change in addition to the affiliation change.、

注意:某一个角色代表某些权限,比如,一个admin或者owner默认的会成为一个moderator,所以,如果一个occupant被授予了 admin的地位,那么他自然也就是一个moderator了。类似的,当一个occupant在一个moderated的房间里,被授予了member 的affiliation的时候,这个occupant自动的拥有了participant这个角色。但是,如果一个用户失去了admin的 affiliation的时候,不代表他就不是moderator的角色了,因为起码一个participant可以很轻松地成为一个 moderator。所以,当一个用户的affilation是确定的时候,那么这个用户的角色是确定的。然而,一个用户失去了一个 affilitation的时候,他的角色是不确定的, 是决定于服务端的实现的,因为一个客户端不知道当一个用户的affiliation改变的时候,给她一个什么样的角色。如果一个客户端想同时移除这个用户 的admin/owner 的affiliation 和 moderator的role,客户端自己必须去特意的请求服务器,对其角色的改变和affiliation的改变。




5.2 Affiliations

affiliation

The following affiliations are defined:

  1. Owner
  2. Admin
  3. Member
  4. Outcast
  5. None (the absence of an affiliation)
有5种affiliation :

Support for the Owner affiliation is REQUIRED. Support for the Admin, Member, and Outcast affiliations is RECOMMENDED. (The "None" affiliation is the absence of an affiliation.)

owner这个affiliation是必须的,对于admin,member,outcast的affiliation的支持是可选的。

These affiliations are long-lived in that they persist across a user's visits to the room and are not affected by happenings in the room. In addition, there is no one-to-one mapping between these affiliations and an occupant's role within the room. Affiliations are granted, revoked, and maintained based on the user's bare JID.

这些affiliation在这个用户和这个房间的关系是常驻的,而且是不被房间中发生的事情所影响的,此外,一个role和一个 affiliation是没有一对一的对应关系的,一个affiliation的授予,移除和维护是对于一个用户的裸jid的,我理解是userid


If a user without a defined affiliation enters a room, the user's affiliation is defined as "none"; however, this affiliation does not persist across visits (i.e., a service does not maintain a "none list" across visits).

如果一个用户没有被定义affiliation进入一个房间的话,这个用户的affiliation默认是一个none,但是,这个affiliation是不被持久化的。

The member affiliation provides a way for a room owner or admin to specify a "whitelist" of users who are allowed to enter a members-only room. When a member enters a members-only room, his or her affiliation does not change, no matter what his or her role is. The member affiliation also provides a way for users to effectively register with an open room and thus be lastingly associated with that room in some way (one result may be that the user's nickname is reserved in the room).

member这个affiliation的产生方式是 : 一个房间的owner或者admin同意把这个用户加入这个房间的白名单用户 --- 被允许进入一个member-only的房间。当一个member进入一个member-only的房间的时候,他的affliation不会因为他的角 色的改变而改变,member affiliation 同样成员岗位也为用户提供一个方法来高效地注册一个开放的房间并在某种方式意义上保持和那个房间的联系(例如可能在房间里预留那个用户的昵称). 

An outcast is a user who has been banned from a room and who is not allowed to enter the room.

Information about affiliations MUST be sent in all presence stanzas generated or reflected by the room and sent to occupants.


一个黑名单用户,是一个被禁止进入房间的用户

一个关于用户的affiliation的信息必须 以房间的名义,发送presence协议给所有的这个房间的用户


 

5.2.1 Privileges

特权

For the most part, affiliations exist in a hierarchy. For instance, an owner can do anything an admin can do, and an admin can do anything a member can do. Each affiliation has privileges not possessed by the next-lowest affiliation; these privileges are specified in the following table.


通常来说, affiliation是一个有层级关系存在的,比如,一个owner可以做所有admin能做的事情,一个admin可以做一个member可以做的任何事情,每个affiliation拥有他下一个级别的人没有的权限


Privilege Outcast None Member Admin Owner
Enter Open Room No Yes* Yes Yes Yes
Register with Open Room No Yes N/A N/A N/A
Retrieve Member List No No** Yes Yes Yes
Enter Members-Only Room No No Yes* Yes Yes
Ban Members and Unaffiliated Users No No No Yes Yes
Edit Member List No No No Yes Yes
Edit Moderator List No No No Yes** Yes**
Edit Admin List No No No No Yes
Edit Owner List No No No No Yes
Change Room Definition No No No No Yes
Destroy Room No No No No Yes

* As a default, an unaffiliated user enters a moderated room as a visitor, and enters an open room as a participant. A member enters a room as a participant. An admin or owner enters a room as a moderator.

通常,一个没有被赋予affiliation的用户进入一个moderated的房间的时候,是一个visitor的角色。进入一个open room是一个participant的角色,进入一个member room是一个participant的角色,一个admin,owner进入房间的时候,是一个moderator的角色

** An admin or owner MUST NOT be able to revoke moderation privileges from another admin or owner.

一个admin或者一个owner不能被其他的admin或者owner移除moderation的权利。

5.2.2 Changing Affiliations

改变affiliation


The ways in which a user's affiliation changes are well-defined. Sometimes the change results from the user's own action (e.g., registering as a member of the room), whereas sometimes the change results from an action taken by an admin or owner. If a user's affiliation changes, a MUC service implementation MUST change the user's affiliation to reflect the change and communicate that to all occupants. Affiliation changes and their triggering actions are specified in the following table.

用户的affiliation的改变时定义好的,有时候affiliation的改变时因为一个用户自己的行为,比如注册了一个房间的member,但是有时候也会被admin,owner的行为改变,如果一个用户的affiliation改变了,服务器必须记录这个改变,而且通知所有的occupants。

Table 6: Affiliation State Chart

> Outcast None Member Admin Owner
Outcast -- Admin or owner removes ban Admin or owner adds user to member list Owner adds user to admin list Owner adds user to owner list
None Admin or owner applies ban -- Admin or owner adds user to member list, or user registers as member (if allowed) Owner adds user to admin list Owner adds user to owner list
Member Admin or owner applies ban Admin or owner changes affiliation to "none" -- Owner adds user to admin list Owner adds user to owner list
Admin Owner applies ban Owner changes affiliation to "none" Owner changes affiliation to "member" -- Owner adds user to owner list
Owner Owner applies ban Owner changes affiliation to "none" Owner changes affiliation to "member" Owner changes affiliation to "admin" --

 







你可能感兴趣的:(xmpp muc 群聊协议 2)