summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sleekxmpp/basexmpp.py11
-rwxr-xr-xsleekxmpp/componentxmpp.py2
-rw-r--r--sleekxmpp/xmlstream/xmlstream.py2
3 files changed, 10 insertions, 5 deletions
diff --git a/sleekxmpp/basexmpp.py b/sleekxmpp/basexmpp.py
index e120a71a..965570ed 100644
--- a/sleekxmpp/basexmpp.py
+++ b/sleekxmpp/basexmpp.py
@@ -264,7 +264,7 @@ class basexmpp(object):
with self.lock:
self.event_handlers[name].pop(self.event_handlers[name].index(handler))
- def makeMessage(self, mto, mbody='', msubject=None, mtype=None, mhtml=None, mfrom=None):
+ def makeMessage(self, mto, mbody='', msubject=None, mtype=None, mhtml=None, mfrom=None, mnick=None):
message = ET.Element('{%s}message' % self.default_ns)
if mfrom is None:
message.attrib['from'] = self.fulljid
@@ -289,6 +289,11 @@ class basexmpp(object):
subject = ET.Element('subject')
subject.text = msubject
message.append(subject)
+ if mnick:
+ print("generating nick")
+ nick = ET.Element("{http://jabber.org/protocol/nick}nick")
+ nick.text = mnick
+ message.append(nick)
return message
def makePresence(self, pshow=None, pstatus=None, ppriority=None, pto=None, ptype=None, pfrom=None):
@@ -315,8 +320,8 @@ class basexmpp(object):
presence.attrib['from'] = pfrom
return presence
- def sendMessage(self, mto, mbody, msubject=None, mtype=None, mhtml=None, mfrom=None):
- self.send(self.makeMessage(mto,mbody,msubject,mtype,mhtml,mfrom))
+ def sendMessage(self, mto, mbody, msubject=None, mtype=None, mhtml=None, mfrom=None, mnick=None):
+ self.send(self.makeMessage(mto,mbody,msubject,mtype,mhtml,mfrom,mnick))
def sendPresence(self, pshow=None, pstatus=None, ppriority=None, pto=None, pfrom=None):
self.send(self.makePresence(pshow,pstatus,ppriority,pto, pfrom=pfrom))
diff --git a/sleekxmpp/componentxmpp.py b/sleekxmpp/componentxmpp.py
index 7f952413..ad897586 100755
--- a/sleekxmpp/componentxmpp.py
+++ b/sleekxmpp/componentxmpp.py
@@ -96,7 +96,7 @@ class ComponentXMPP(basexmpp, XMLStream):
def start_stream_handler(self, xml):
sid = xml.get('id', '')
handshake = ET.Element('{jabber:component:accept}handshake')
- handshake.text = hashlib.sha1.new(b"%s%s" % (sid, self.secret)).hexdigest().lower()
+ handshake.text = hashlib.sha1(bytes("%s%s" % (sid, self.secret), 'utf-8')).hexdigest().lower()
self.send(handshake)
def _handleHandshake(self, xml):
diff --git a/sleekxmpp/xmlstream/xmlstream.py b/sleekxmpp/xmlstream/xmlstream.py
index 198aba0b..bfad7cd9 100644
--- a/sleekxmpp/xmlstream/xmlstream.py
+++ b/sleekxmpp/xmlstream/xmlstream.py
@@ -248,8 +248,8 @@ class XMLStream(object):
def __spawnEvent(self, xmlobj):
"watching xmlOut and processes handlers"
#convert XML into Stanza
+ logging.debug("RECV: %s" % cElementTree.tostring(xmlobj))
xmlobj = self.incoming_filter(xmlobj)
- logging.debug("PROCESSING: %s" % xmlobj.tag)
stanza = None
for stanza_class in self.__root_stanza:
if self.__root_stanza[stanza_class].match(xmlobj):