누구든지이 코드를 수정하는 데 도움이 될 수 있습니까? 실제로 필요하지만 다음에 무엇을해야할지 모를 수 있습니다. groupchat을 만들어 초대 된 사람에게 messega를 보내야합니다. 이제 [email protected]이 되겠지만, 그렇지 않습니다.
실수가 있습니까?python xmpppy를 사용하여 gtalk에서 MUC를 생성하는 방법
#!/usr/bin/python
import sys,os,xmpp,time
jid = '[email protected]'
psw = 'psw'
jid=xmpp.protocol.JID(jid)
cl=xmpp.Client(jid.getDomain(),debug=[])
cl.connect()
cl.auth(jid.getNode(),psw)
node = jid.getNode()
domain = 'talk.google.com'
room = node + '@' + domain
nroom = room + '/' + 'Maria'
mes = xmpp.Presence(to=nroom)
cl.sendInitPresence()
cl.send(mes)
NS_MUCUSER = 'http://jabber.org/protocol/muc#user'
invite = xmpp.simplexml.Node('invite')
invite.setAttr('to', '[email protected]')
invite.setTagData('reason', 'I really need it!')
mess = xmpp.Message(to=room)
mess.setTag('x', namespace=NS_MUCUSER).addChild(node=invite)
cl.send(mess)
msg = xmpp.protocol.Message(body="Hello there!")
msg.setTo(room)
msg.setType('groupchat')
cl.send(msg)
time.sleep(1) # some older servers will not send the message if you disconnect immediately after sending
cl.disconnect()
print "Done"
안녕하세요 마리아, 당신이 지금까지 해 온 것을 보여 주면 더 좋은 품질의 답변을 얻을 수 있습니다 - 혼란 스러움을 보여주는 코드 스 니펫. – aychedee
여기에 실수가 있다는 것을 알지만, 할 수있는 것은 모두 ... – Maria