def __init__(self, jid=None, node='', domain='', resource=''):
        """ Constructor. JID can be specified as string (jid argument) or as separate parts.
            Examples:
            JID('node@domain/resource')
            JID(node='node',domain='domain.org')
        """
        if not jid and not domain: raise ValueError('JID must contain at least domain name')
        elif type(jid)==type(self): self.node,self.domain,self.resource=jid.node,jid.domain,jid.resource
        elif domain: self.node,self.domain,self.resource=node,domain,resource
        else:
            if jid.find('@')+1: self.node,jid=jid.split('@',1)
            else: self.node=''
            if jid.find('/')+1: self.domain,self.resource=jid.split('/',1)
            else: self.domain,self.resource=jid,''
 Constructor. JID can be specified as string (jid argument) or as separate parts.
            Examples:
            JID('node@domain/resource')
            JID(node='node',domain='domain.org')
        
chrome-cordova/gcmServer/xmpp/protocol.py