'Join the specified room, requesting \'maxhistory\' lines of history.'

def joinMUC(self, room, nick, maxhistory='0', password='', wait=False, pstatus=None, pshow=None, pfrom=None):

    stanza = self.xmpp.makePresence(pto=('%s/%s' % (room, nick)), pstatus=pstatus, pshow=pshow, pfrom=pfrom)
    x = ET.Element('{http://jabber.org/protocol/muc}x')
    if password:
        passelement = ET.Element('{http://jabber.org/protocol/muc}password')
        passelement.text = password
        x.append(passelement)
    if maxhistory:
        history = ET.Element('{http://jabber.org/protocol/muc}history')
        if (maxhistory == '0'):
            history.attrib['maxchars'] = maxhistory
        else:
            history.attrib['maxstanzas'] = maxhistory
        x.append(history)
    stanza.append(x)
    if (not wait):
        self.xmpp.send(stanza)
    else:
        expect = ET.Element(('{%s}presence' % self.xmpp.default_ns), {'from': ('%s/%s' % (room, nick))})
        self.xmpp.send(stanza, expect)
    self.rooms[room] = {}
    self.ourNicks[room] = nick
