summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--setup.py2
-rw-r--r--sleekxmpp/basexmpp.py79
-rw-r--r--sleekxmpp/clientxmpp.py1
-rw-r--r--sleekxmpp/xmlstream/xmlstream.py4
4 files changed, 72 insertions, 14 deletions
diff --git a/setup.py b/setup.py
index ba61c84e..585a0eae 100644
--- a/setup.py
+++ b/setup.py
@@ -25,7 +25,7 @@ import sys
#
# from setuptools import setup, find_packages, Extension, Feature
-VERSION = '0.2.3.1'
+VERSION = '1.0.0.0'
DESCRIPTION = 'SleekXMPP is an elegant Python library for XMPP (aka Jabber, Google Talk, etc).'
LONG_DESCRIPTION = """
SleekXMPP is an elegant Python library for XMPP (aka Jabber, Google Talk, etc).
diff --git a/sleekxmpp/basexmpp.py b/sleekxmpp/basexmpp.py
index 6e619270..2b4df809 100644
--- a/sleekxmpp/basexmpp.py
+++ b/sleekxmpp/basexmpp.py
@@ -113,12 +113,7 @@ class BaseXMPP(XMLStream):
self.default_ns = default_ns
self.stream_ns = 'http://etherx.jabber.org/streams'
- self.jid = ''
- self.fulljid = ''
- self.resource = ''
- self.jid = ''
- self.username = ''
- self.server = ''
+ self.boundjid = JID("")
self.plugin = {}
self.roster = {}
@@ -440,13 +435,75 @@ class BaseXMPP(XMLStream):
presence.append(nick)
presence.send()
+ @property
+ def jid(self):
+ """
+ Attribute accessor for bare jid
+ """
+ logging.warning("jid property deprecated. Use boundjid.bare")
+ return self.boundjid.bare
+
+ @jid.setter
+ def jid(self, value):
+ logging.warning("jid property deprecated. Use boundjid.bare")
+ self.boundjid.bare = value
+
+ @property
+ def fulljid(self):
+ """
+ Attribute accessor for full jid
+ """
+ logging.warning("fulljid property deprecated. Use boundjid.full")
+ return self.boundjid.full
+
+ @fulljid.setter
+ def fulljid(self, value):
+ logging.warning("fulljid property deprecated. Use boundjid.full")
+ self.boundjid.full = value
+
+ @property
+ def resource(self):
+ """
+ Attribute accessor for jid resource
+ """
+ logging.warning("resource property deprecated. Use boundjid.resource")
+ return self.boundjid.resource
+
+ @resource.setter
+ def resource(self, value):
+ logging.warning("fulljid property deprecated. Use boundjid.full")
+ self.boundjid.resource = value
+
+ @property
+ def username(self):
+ """
+ Attribute accessor for jid usernode
+ """
+ logging.warning("username property deprecated. Use boundjid.user")
+ return self.boundjid.user
+
+ @username.setter
+ def username(self, value):
+ logging.warning("username property deprecated. Use boundjid.user")
+ self.boundjid.user = value
+
+ @property
+ def server(self):
+ """
+ Attribute accessor for jid host
+ """
+ logging.warning("server property deprecated. Use boundjid.host")
+ return self.boundjid.server
+
+ @server.setter
+ def server(self, value):
+ logging.warning("server property deprecated. Use boundjid.host")
+ self.boundjid.server = value
+
def set_jid(self, jid):
"""Rip a JID apart and claim it as our own."""
- self.fulljid = jid
- self.resource = self.getjidresource(jid)
- self.jid = self.getjidbare(jid)
- self.username = jid.split('@', 1)[0]
- self.server = jid.split('@', 1)[-1].split('/', 1)[0]
+ logging.debug("setting jid to %s" % jid)
+ self.boundjid.full = jid
def getjidresource(self, fulljid):
if '/' in fulljid:
diff --git a/sleekxmpp/clientxmpp.py b/sleekxmpp/clientxmpp.py
index 1816649a..73ab8075 100644
--- a/sleekxmpp/clientxmpp.py
+++ b/sleekxmpp/clientxmpp.py
@@ -175,6 +175,7 @@ class ClientXMPP(BaseXMPP):
if not address:
# If all else fails, use the server from the JID.
address = (self.server, 5222)
+ logging.debug("The server is %s" % self.server)
return XMLStream.connect(self, address[0], address[1], use_tls=True)
diff --git a/sleekxmpp/xmlstream/xmlstream.py b/sleekxmpp/xmlstream/xmlstream.py
index 97f71a22..bc79e1e8 100644
--- a/sleekxmpp/xmlstream/xmlstream.py
+++ b/sleekxmpp/xmlstream/xmlstream.py
@@ -266,8 +266,8 @@ class XMLStream(object):
self.event("connected", direct=True)
return True
except Socket.error as serr:
- error_msg = "Could not connect. Socket Error #%s: %s"
- logging.error(error_msg % (serr.errno, serr.strerror))
+ error_msg = "Could not connect to %s:%s. Socket Error #%s: %s"
+ logging.error(error_msg % (self.address[0], self.address[1], serr.errno, serr.strerror))
time.sleep(1)
return False