认识smack中的基本对象 - Registration

来源:互联网 发布:java 1.7.0 openjdk 编辑:程序博客网 时间:2024/05/18 10:57

一 Registration类的介绍

Registration是信息查询包IQ的子类,所以它也包含表示操作类型的四个属性:GET/SET等,当其类型属性为GET时,表示从服务器获取注册对象的信息;而SET类型则表示创建用户,或者是更新已有用户的账户资料。当创建一个新账户时,XMPP服务器会需要一系列的其他属性值,标准的账户属性值列表如下:

name: 用户名称

first: 用户的姓

last: 用户的名称

email: Email地址

city: 所在城市

state: 所在的州

zip: 邮编

phone: 手机号

url: 用户的个人主页

date: 注册日期

misc: 相关的文字信息

remove: 账户是否停用的标志

 

Represents registration packets. An empty GET query will cause the server to return information about it's registration support. SET queries can be used to create accounts or update existing account information. XMPP servers may require a number of attributes to be set when creating a new account. The standard account attributes are as follows:
•name -- the user's name.
•first -- the user's first name.
•last -- the user's last name.
•email -- the user's email address.
•city -- the user's city.
•state -- the user's state.
•zip -- the user's ZIP code.
•phone -- the user's phone number.
•url -- the user's website.
•date -- the date the registration took place.
•misc -- other miscellaneous information to associate with the account.
•text -- textual information to associate with the account.
•remove -- empty flag to remove account.

 

二 常用方法

设置、获取注册账户的键值对。

getAttributes
 public Map<String,String> getAttributes() Returns the map of String key/value pairs of account attributes.

Returns:the account attributes.
--------------------------------------------------------------------------------

setAttributes
 public void setAttributes(Map<String,String> attributes) Sets the account attributes. The map must only contain String key/value pairs.

Parameters:attributes - the account attributes.
--------------------------------------------------------------------------------

原创粉丝点击