Ignore:
Timestamp:
Oct 21, 2008, 12:57:32 AM (14 years ago)
Author:
Christopher Zorn <tofu@…>
Branch:
wokkel-muc-client-support-24
Convert:
svn:b33ecbfc-034c-dc11-8662-000475d9059e/branches/wokkel-muc-client-support-24@122
Message:

make sure we change status and add a test

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wokkel/muc.py

    r125 r126  
    639639            # not in the room yet
    640640            return
    641 
    642         # check if user is in roster
    643         user = room.getUser(room_jid.resource)
    644         if user is None: # create a user that does not exist
    645             user = User(room_jid.resource)
    646            
    647        
     641        user = self._changeUserStatus(room, room_jid, status, show)
     642
    648643        if room.inRoster(user):
    649644            # we changed status or nick
     
    930925        return d
    931926   
     927    def _changeUserStatus(self, r, room_jid, status, show):
     928        # check if user is in roster
     929        user = r.getUser(room_jid.resource)
     930        if user is None: # create a user that does not exist
     931            user = User(room_jid.resource)
     932
     933        if status is not None:
     934            user.status = str(status)
     935        if show is not None:
     936            user.show   = str(show)
     937
     938        return user
     939
    932940    def _changed(self, d, room_jid, prs):
    933941        """Callback for changing the nick and status.
    934942        """
    935943
     944        status = getattr(prs, 'status', None)
     945        show   = getattr(prs, 'show', None)
     946
    936947        r = self._getRoom(room_jid)
     948
     949        user = self._changeUserStatus(r, room_jid, status, show)
    937950
    938951        d.callback(r)
Note: See TracChangeset for help on using the changeset viewer.