Ignore:
Location:
wokkel
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • wokkel/muc.py

    r204 r219  
    13131313            user = User(nick, presence.entity)
    13141314
    1315         # Update user status
     1315        # Update user data
     1316        user.role = presence.role
     1317        user.affiliation = presence.affiliation
    13161318        user.status = presence.status
    13171319        user.show = presence.show
  • wokkel/test/test_muc.py

    r204 r219  
    14941494
    14951495
     1496    def test_availableReceivedSetsUserRole(self):
     1497        """
     1498        The role received in a presence update is stored on the user.
     1499        """
     1500        room = self._createRoom()
     1501        user = muc.User(self.nick)
     1502        room.addUser(user)
     1503        self.assertEquals('none', user.role)
     1504
     1505        xml = u"""
     1506            <presence to='%s' from='%s'>
     1507              <x xmlns='http://jabber.org/protocol/muc#user'>
     1508                <item affiliation='member' role='participant'/>
     1509              </x>
     1510            </presence>
     1511        """ % (self.userJID, self.occupantJID)
     1512        self.stub.send(parseXml(xml))
     1513
     1514        self.assertEquals('participant', user.role)
     1515
     1516
     1517    def test_availableReceivedSetsUserAffiliation(self):
     1518        """
     1519        The affiliation received in a presence update is stored on the user.
     1520        """
     1521        room = self._createRoom()
     1522        user = muc.User(self.nick)
     1523        room.addUser(user)
     1524        self.assertEquals('none', user.affiliation)
     1525
     1526        xml = u"""
     1527            <presence to='%s' from='%s'>
     1528              <x xmlns='http://jabber.org/protocol/muc#user'>
     1529                <item affiliation='member' role='participant'/>
     1530              </x>
     1531            </presence>
     1532        """ % (self.userJID, self.occupantJID)
     1533        self.stub.send(parseXml(xml))
     1534        self.assertEquals('member', user.affiliation)
     1535
     1536
    14961537    def test_unavailableReceivedEmptySender(self):
    14971538        """
Note: See TracChangeset for help on using the changeset viewer.