mirror of
https://github.com/correl/SleekXMPP.git
synced 2024-12-24 11:50:53 +00:00
fixed some unicode problems for 2.6
This commit is contained in:
parent
7d41d68293
commit
e06cdec81a
3 changed files with 16 additions and 1 deletions
|
@ -1,8 +1,13 @@
|
|||
# coding=utf8
|
||||
|
||||
import sleekxmpp
|
||||
import logging
|
||||
from optparse import OptionParser
|
||||
import time
|
||||
|
||||
reload(sys)
|
||||
sys.setdefaultencoding('utf8')
|
||||
|
||||
class Example(sleekxmpp.ClientXMPP):
|
||||
|
||||
def __init__(self, jid, password):
|
||||
|
|
|
@ -39,6 +39,13 @@ from . stanza.error import Error
|
|||
import logging
|
||||
import threading
|
||||
|
||||
import sys
|
||||
|
||||
if sys.version_info < (3,0):
|
||||
reload(sys)
|
||||
sys.setdefaultencoding('utf8')
|
||||
|
||||
|
||||
def stanzaPlugin(stanza, plugin):
|
||||
stanza.plugin_attrib_map[plugin.plugin_attrib] = plugin
|
||||
stanza.plugin_tag_map["{%s}%s" % (plugin.namespace, plugin.name)] = plugin
|
||||
|
|
|
@ -18,7 +18,10 @@ class JID(object):
|
|||
if name == 'resource':
|
||||
return self.jid.split('/', 1)[-1]
|
||||
elif name == 'user':
|
||||
return self.jid.split('@', 1)[0]
|
||||
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':
|
||||
|
|
Loading…
Reference in a new issue