Package xmpp :: Module roster :: Class Roster

[hide private]
[frames] | no frames]

# Class Roster

source code

    client.PlugIn --+
                    |
                   Roster

Defines a plenty of methods that will allow you to manage roster. Also automatically track presences from remote JIDs taking into account that every JID can have multiple resources connected. Does not currently support 'error' presences. You can also use mapping interface for access to the internal representation of contacts in roster.

Instance Methods | [hide private]

__init__(self) Init internal variables. | source code

plugin(self, owner, request=1) Register presence and subscription trackers in the owner's dispatcher. | source code

Request(self, force=0) Request roster from server if it were not yet requested (or if the 'force' argument is set). | source code

getRoster(self) Requests roster from server if neccessary and returns self. | source code

RosterIqHandler(self, dis, stanza) Subscription tracker. | source code

PresenceHandler(self, dis, pres) Presence tracker. | source code

_getItemData(self, jid, dataname) Return specific jid's representation in internal format. | source code

_getResourceData(self, jid, dataname) Return specific jid's resource representation in internal format. | source code

delItem(self, jid) Delete contact 'jid' from roster. | source code

getAsk(self, jid) Returns 'ask' value of contact 'jid'. | source code

getGroups(self, jid) Returns groups list that contact 'jid' belongs to. | source code

getName(self, jid) Returns name of contact 'jid'. | source code

getPriority(self, jid) Returns priority of contact 'jid'. | source code

getRawRoster(self) Returns roster representation in internal format. | source code

getRawItem(self, jid) Returns roster item 'jid' representation in internal format. | source code

getShow(self, jid) Returns 'show' value of contact 'jid'. | source code

getStatus(self, jid) Returns 'status' value of contact 'jid'. | source code

getSubscription(self, jid) Returns 'subscription' value of contact 'jid'. | source code

getResources(self, jid) Returns list of connected resources of contact 'jid'. | source code

setItem(self, jid, name=None, groups=`[``]`) Creates/renames contact 'jid' and sets the groups list that it now belongs to. | source code

getItems(self) Return list of all [bare] JIDs that the roster is currently tracks. | source code

keys(self) Same as getItems. | source code

__getitem__(self, item) Get the contact in the internal format. | source code

getItem(self, item) Get the contact in the internal format (or None if JID 'item' is not in roster). | source code

Subscribe(self, jid) Send subscription request to JID 'jid'. | source code

Unsubscribe(self, jid) Ask for removing our subscription for JID 'jid'. | source code

Authorize(self, jid) Authorise JID 'jid'. | source code

Unauthorize(self, jid) Unauthorise JID 'jid'. | source code

Inherited from `client.PlugIn`: `DEBUG`, `PlugIn`, `PlugOut`

Method Details | [hide private]

### __init__(self)
(Constructor)

source code

Init internal variables.

Overrides: client.PlugIn.__init__

### plugin(self, owner, request=1)

source code

Register presence and subscription trackers in the owner's dispatcher. Also request roster from server if the 'request' argument is set. Used internally.

### RosterIqHandler(self, dis, stanza)

source code

Subscription tracker. Used internally for setting items state in internal roster representation.

### PresenceHandler(self, dis, pres)

source code

Presence tracker. Used internally for setting items' resources state in internal roster representation.

### _getItemData(self, jid, dataname)

source code

Return specific jid's representation in internal format. Used internally.

### _getResourceData(self, jid, dataname)

source code

Return specific jid's resource representation in internal format. Used internally.

### getPriority(self, jid)

source code

Returns priority of contact 'jid'. 'jid' should be a full (not bare) JID.

### getShow(self, jid)

source code

Returns 'show' value of contact 'jid'. 'jid' should be a full (not bare) JID.

### getStatus(self, jid)

source code

Returns 'status' value of contact 'jid'. 'jid' should be a full (not bare) JID.

### keys(self)

source code

Same as getItems. Provided for the sake of dictionary interface.

### __getitem__(self, item)
(Indexing operator)

source code

Get the contact in the internal format. Raises KeyError if JID 'item' is not in roster.

### Authorize(self, jid)

source code

Authorise JID 'jid'. Works only if these JID requested auth previously.

### Unauthorize(self, jid)

source code

Unauthorise JID 'jid'. Use for declining authorisation request or for removing existing authorization.