Changeset 140

Show
Ignore:
Timestamp:
04/26/08 16:35:13 (2 years ago)
Author:
thib
Message:

Modification pour la présence

Location:
adventure
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • adventure/movable.py

    r135 r140  
    8484            oldplace.player_leaved(self) 
    8585                               
    86     def fix_presence(self, role=None, affiliation=None): 
     86    def fix_presence(self, role=None, affiliation=None, to_self=False): 
    8787        """ 
    8888        Fix presence: Remove double presence tag and set 
     
    9191        pres = Presence(node=self.presence) 
    9292        tag_x = pres.getTag(NS_MUC_USER + ' x') 
     93         
    9394        if not tag_x: 
    9495            tag_x = pres.setTag(NS_MUC_USER + ' x') 
     
    9697        if not tag_item: 
    9798            tag_item = tag_x.setTag(NS_MUC_USER + ' item') 
     99         
    98100        tag_item.setAttr('affiliation', affiliation) 
    99101        tag_item.setAttr('role', role) 
     102         
     103        if to_self: 
     104            tag_status = tag_x.getTag(NS_MUC_USER + ' status') 
     105            if not tag_status: 
     106                tag_status = tag_x.setTag(NS_MUC_USER + ' status') 
     107            tag_status.setAttr('code', 110) 
    100108        return pres 
    101109 
  • adventure/place.py

    r138 r140  
    103103                    player.send_presence(visitor.name, pres) 
    104104             
    105             pres = player.fix_presence() 
    106             pres.setStatus(110) 
     105            pres = player.fix_presence(to_self=True) 
    107106            player.send_presence(player.name, pres) 
    108107