Changeset 160

Show
Ignore:
Timestamp:
05/21/05 12:12:28 (4 years ago)
Author:
jajcus
Message:

- AWAY message handling

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/jjigw/component.py

    r157 r160  
    282282 
    283283    def presence_available(self,stanza): 
    284         nick=None 
    285         to=stanza.get_to() 
    286         fr=stanza.get_from() 
    287         status=stanza.get_status() 
     284        nick = None 
     285        to = stanza.get_to() 
     286        fr = stanza.get_from() 
     287        status = stanza.get_status() 
     288        show = stanza.get_show() 
    288289        if not status: 
    289             status="Unknown" 
     290            if not show: 
     291                status = "Unknown" 
     292            else: 
     293                status = show 
    290294        if to.node and not to.resource: 
    291295            p=stanza.make_error_response("bad-request") 
     
    298302                self.send(p) 
    299303                return 1 
     304            if show in ("away", "xa", "dnd"): 
     305                sess.set_away() 
     306            else: 
     307                sess.set_back() 
    300308        else: 
    301309            nick=to.resource 
  • trunk/jjigw/ircsession.py

    r159 r160  
    305305        self.cond.notify() 
    306306 
     307    def set_away(self,status): 
     308        self.send("AWAY :%s" % (status)) 
     309 
     310    def set_back(self): 
     311        self.send("AWAY") 
     312 
    307313    def _send(self,str): 
    308314        if self.socket and not self.exited: