mirror of
https://github.com/correl/SleekXMPP.git
synced 2024-11-24 03:00:15 +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 sleekxmpp
|
||||||
import logging
|
import logging
|
||||||
from optparse import OptionParser
|
from optparse import OptionParser
|
||||||
import time
|
import time
|
||||||
|
|
||||||
|
reload(sys)
|
||||||
|
sys.setdefaultencoding('utf8')
|
||||||
|
|
||||||
class Example(sleekxmpp.ClientXMPP):
|
class Example(sleekxmpp.ClientXMPP):
|
||||||
|
|
||||||
def __init__(self, jid, password):
|
def __init__(self, jid, password):
|
||||||
|
|
|
@ -39,6 +39,13 @@ from . stanza.error import Error
|
||||||
import logging
|
import logging
|
||||||
import threading
|
import threading
|
||||||
|
|
||||||
|
import sys
|
||||||
|
|
||||||
|
if sys.version_info < (3,0):
|
||||||
|
reload(sys)
|
||||||
|
sys.setdefaultencoding('utf8')
|
||||||
|
|
||||||
|
|
||||||
def stanzaPlugin(stanza, plugin):
|
def stanzaPlugin(stanza, plugin):
|
||||||
stanza.plugin_attrib_map[plugin.plugin_attrib] = plugin
|
stanza.plugin_attrib_map[plugin.plugin_attrib] = plugin
|
||||||
stanza.plugin_tag_map["{%s}%s" % (plugin.namespace, plugin.name)] = plugin
|
stanza.plugin_tag_map["{%s}%s" % (plugin.namespace, plugin.name)] = plugin
|
||||||
|
|
|
@ -18,7 +18,10 @@ class JID(object):
|
||||||
if name == 'resource':
|
if name == 'resource':
|
||||||
return self.jid.split('/', 1)[-1]
|
return self.jid.split('/', 1)[-1]
|
||||||
elif name == 'user':
|
elif name == 'user':
|
||||||
|
if '@' in self.jid:
|
||||||
return self.jid.split('@', 1)[0]
|
return self.jid.split('@', 1)[0]
|
||||||
|
else:
|
||||||
|
return ''
|
||||||
elif name == 'server':
|
elif name == 'server':
|
||||||
return self.jid.split('@', 1)[-1].split('/', 1)[0]
|
return self.jid.split('@', 1)[-1].split('/', 1)[0]
|
||||||
elif name == 'full':
|
elif name == 'full':
|
||||||
|
|
Loading…
Reference in a new issue