summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan Fritz <fritzy@netflint.net>2010-02-27 02:02:08 +0000
committerNathan Fritz <fritzy@netflint.net>2010-02-27 02:02:08 +0000
commit8d5dbfa691f17118173d4eaeca8222826e6a6dc5 (patch)
treec2e9ff325c65e00c35c57af1d4783a73bb01d0b6
parente06cdec81ae8732b496acdbb3e86ad8ef7afe640 (diff)
downloadslixmpp-8d5dbfa691f17118173d4eaeca8222826e6a6dc5.tar.gz
slixmpp-8d5dbfa691f17118173d4eaeca8222826e6a6dc5.tar.bz2
slixmpp-8d5dbfa691f17118173d4eaeca8222826e6a6dc5.tar.xz
slixmpp-8d5dbfa691f17118173d4eaeca8222826e6a6dc5.zip
fixed some presence bugs
-rw-r--r--example.py8
-rw-r--r--sleekxmpp/basexmpp.py4
-rw-r--r--sleekxmpp/stanza/presence.py2
-rw-r--r--sleekxmpp/xmlstream/xmlstream.py4
4 files changed, 11 insertions, 7 deletions
diff --git a/example.py b/example.py
index 71979c56..1ffe724a 100644
--- a/example.py
+++ b/example.py
@@ -5,8 +5,12 @@ import logging
from optparse import OptionParser
import time
-reload(sys)
-sys.setdefaultencoding('utf8')
+import sys
+
+if sys.version_info < (3,0):
+ reload(sys)
+ sys.setdefaultencoding('utf8')
+
class Example(sleekxmpp.ClientXMPP):
diff --git a/sleekxmpp/basexmpp.py b/sleekxmpp/basexmpp.py
index 92f1f9a6..91620731 100644
--- a/sleekxmpp/basexmpp.py
+++ b/sleekxmpp/basexmpp.py
@@ -279,15 +279,15 @@ class basexmpp(object):
self.roster[jid]['presence'][resource] = {'show': show, 'status': status}
self.roster[jid]['presence'][resource]['priority'] = priority
name = self.roster[jid].get('name', '')
- if wasoffline and show in ('available', 'away', 'xa', 'na', 'ffc'):
+ if wasoffline and (show == 'available' or show in presence.showtypes):
self.event("got_online", presence)
elif not wasoffline and show == 'unavailable':
- self.event("got_offline", presence)
logging.debug("%s %s got offline" % (jid, resource))
if len(self.roster[jid]['presence']) > 1:
del self.roster[jid]['presence'][resource]
else:
del self.roster[jid]
+ self.event("got_offline", presence)
elif oldroster != self.roster.get(jid, {'presence': {}})['presence'].get(resource, {}):
self.event("changed_status", presence)
name = ''
diff --git a/sleekxmpp/stanza/presence.py b/sleekxmpp/stanza/presence.py
index 2bf767d4..a6319820 100644
--- a/sleekxmpp/stanza/presence.py
+++ b/sleekxmpp/stanza/presence.py
@@ -6,7 +6,7 @@ from . rootstanza import RootStanza
class Presence(RootStanza):
interfaces = set(('type', 'to', 'from', 'id', 'status', 'priority'))
types = set(('available', 'unavailable', 'error', 'probe', 'subscribe', 'subscribed', 'unsubscribe', 'unsubscribed'))
- showtypes = set(('dnd', 'ffc', 'xa', 'away'))
+ showtypes = set(('dnd', 'chat', 'xa', 'away'))
sub_interfaces = set(('status', 'priority'))
name = 'presence'
namespace = 'jabber:client'
diff --git a/sleekxmpp/xmlstream/xmlstream.py b/sleekxmpp/xmlstream/xmlstream.py
index 44f83840..594583a8 100644
--- a/sleekxmpp/xmlstream/xmlstream.py
+++ b/sleekxmpp/xmlstream/xmlstream.py
@@ -154,7 +154,7 @@ class XMLStream(object):
def _process(self):
"Start processing the socket."
firstrun = True
- while firstrun or self.state['reconnect']:
+ while self.run and (firstrun or self.state['reconnect']):
self.state.set('processing', True)
firstrun = False
try:
@@ -229,7 +229,7 @@ class XMLStream(object):
edepth += 1
def _sendThread(self):
- while True:
+ while self.run:
data = self.sendqueue.get(True)
logging.debug("SEND: %s" % data)
try: