better use sleekxmpp in muc.py

This commit is contained in:
louiz@4325f9fc-e183-4c21-96ce-0ab188b42d13 2010-11-19 03:44:43 +00:00
parent eb2663c2db
commit 61cc03b3d2

View file

@ -26,26 +26,19 @@ def send_private_message(xmpp, jid, line):
""" """
Send a private message Send a private message
""" """
msg = xmpp.makeMessage(jid) xmpp.send_message(mto=jid, mbody=line, mtype='chat')
msg['to'] = jid
msg['type'] = 'chat'
msg['body'] = line
msg.send()
def send_groupchat_message(xmpp, jid, line): def send_groupchat_message(xmpp, jid, line):
""" """
Send a message to the groupchat Send a message to the groupchat
""" """
msg = xmpp.makeMessage(jid) xmpp.send_message(mto=jid, mbody=line, mtype='groupchat')
msg['type'] = 'groupchat'
msg['body'] = line
msg.send()
def change_show(xmpp, jid, own_nick, show, status): def change_show(xmpp, jid, own_nick, show, status):
""" """
Change our 'Show' Change our 'Show'
""" """
pres = xmpp.makePresence(pto='%s/%s' % (jid, own_nick)) pres = xmpp.make_presence(pto='%s/%s' % (jid, own_nick))
if show: # if show is None, don't put a <show /> tag. It means "available" if show: # if show is None, don't put a <show /> tag. It means "available"
pres['type'] = show pres['type'] = show
if status: if status:
@ -56,7 +49,7 @@ def change_subject(xmpp, jid, subject):
""" """
Change the room subject Change the room subject
""" """
msg = xmpp.makeMessage(jid) msg = xmpp.make_message(jid)
msg['type'] = 'groupchat' msg['type'] = 'groupchat'
msg['subject'] = subject msg['subject'] = subject
msg.send() msg.send()
@ -65,7 +58,7 @@ def change_nick(xmpp, jid, nick):
""" """
Change our own nick in a room Change our own nick in a room
""" """
xmpp.makePresence(pto='%s/%s' % (jid, nick)).send() xmpp.make_presence(pto='%s/%s' % (jid, nick)).send()
def join_groupchat(xmpp, jid, nick, passwd=''): def join_groupchat(xmpp, jid, nick, passwd=''):
""" """