view idavoll/disco.py @ 159:6fe78048baf9

Rework error handling, depend on Twisted Words 0.4.0. Twisted Words 0.4.0 introduced support for stanza error handling, much better than the custom error handling in Idavoll. Also, all protocol-level errors were examined and brought up to date with version 1.8 of JEP-0060. As a result of the error examination, the retrieval of default configuration options using <default/> is now supported properly.
author Ralph Meijer <ralphm@ik.nu>
date Wed, 06 Sep 2006 12:38:47 +0000
parents 5191ba7c4df8
children
line wrap: on
line source

# Copyright (c) 2003-2006 Ralph Meijer
# See LICENSE for details.

from twisted.words.xish import domish

NS = 'http://jabber.org/protocol/disco'
NS_INFO = NS + '#info'
NS_ITEMS = NS + '#items'

class Feature(domish.Element):
    def __init__(self, feature):
        domish.Element.__init__(self, (NS_INFO, 'feature'),
                                attribs={'var': feature})
class Identity(domish.Element):
    def __init__(self, category, type, name = None):
        domish.Element.__init__(self, (NS_INFO, 'identity'),
                                attribs={'category': category,
                                         'type': type})
        if name:
            self['name'] = name

class Item(domish.Element):
    def __init__(self, jid, node = None, name = None):
        domish.Element.__init__(self, (NS_ITEMS, 'item'),
                                attribs={'jid': jid})
        if node:
            self['node'] = node

        if name:
            self['name'] = name