removed jid from stanzabase to external file

This commit is contained in:
Nathan Fritz 2010-07-26 18:13:34 -07:00
parent 2cb82afc2c
commit a349a2a317

View file

@ -11,6 +11,7 @@ import traceback
import sys import sys
import weakref import weakref
import copy import copy
from . jid import JID
if sys.version_info < (3,0): if sys.version_info < (3,0):
from . import tostring26 as tostring from . import tostring26 as tostring
@ -29,28 +30,6 @@ def registerStanzaPlugin(stanza, plugin):
stanza.plugin_tag_map[tag] = plugin stanza.plugin_tag_map[tag] = plugin
class JID(object):
def __init__(self, jid):
self.jid = jid
def __getattr__(self, name):
if name == 'resource':
return self.jid.split('/', 1)[-1]
elif name == 'user':
if '@' in self.jid:
return self.jid.split('@', 1)[0]
else:
return ''
elif name == 'server':
return self.jid.split('@', 1)[-1].split('/', 1)[0]
elif name == 'full':
return self.jid
elif name == 'bare':
return self.jid.split('/', 1)[0]
def __str__(self):
return self.jid
class ElementBase(tostring.ToString): class ElementBase(tostring.ToString):
name = 'stanza' name = 'stanza'
plugin_attrib = 'plugin' plugin_attrib = 'plugin'