Hey, I stumbled upon your question several times, trying to do the same. Here is my answer:
Using http://pyxmpp.jajcus.net/svn/pyxmpp/trunk/examples/echobot.py as a quick start, all you have to do is import the muc-stuff
from pyxmpp.jabber.muc import MucRoomState, MucRoomManager
And once your client is connected, you can connect to your room:
def session_started(self): """Handle session started event. May be overriden in derived classes. This one requests the user roster and sends the initial presence.""" print u'SESSION STARTED' self.request_roster() p=Presence() self.stream.send(p) print u'ConnectToParty' self.connectToMUC() def connectToMUC(self): self.roomManager = MucRoomManager(self.stream); self.roomHandler = MucRoomHandler() self.roomState = self.roomManager.join( room=JID(' room@conference.server.domain '), nick='PartyBot', handler=self.roomHandler, history_maxchars=0, password = None) self.roomManager.set_handlers()
To send a message, all you have to do is call self.roomState.send_message ("Sending this message")
Make material, inherit from MucRoomHandler and respond to events. Note the "set_handlers ()" on the roomManager, although this is important, otherwise callbacks will not be called.
Richy
source share