天天看點

認識smack中的基本對象 - Registration

一 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.

--------------------------------------------------------------------------------