Changeset 213

Show
Ignore:
Timestamp:
07/08/04 21:46:24 (4 years ago)
Author:
asterix
Message:

support of error messages

Location:
trunk
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/core/core.py

    r210 r213  
    119119        def messageCB(self, con, msg): 
    120120                """Called when we recieve a message""" 
    121                 self.hub.sendPlugin('MSG', self.connexions[con], \ 
    122                         (str(msg.getFrom()), msg.getBody())) 
     121                if msg.getType() == 'error': 
     122                        self.hub.sendPlugin('MSGERROR', self.connexions[con], \ 
     123                                (str(msg.getFrom()), msg.getErrorCode(), msg.getError(), \ 
     124                                msg.getBody())) 
     125                else: 
     126                        self.hub.sendPlugin('MSG', self.connexions[con], \ 
     127                                (str(msg.getFrom()), msg.getBody())) 
    123128        # END messageCB 
    124129 
     
    523528                        gc.hub.register(mod, 'NOTIFY') 
    524529                        gc.hub.register(mod, 'MSG') 
     530                        gc.hub.register(mod, 'MSGERROR') 
    525531                        gc.hub.register(mod, 'MSGSENT') 
    526532                        gc.hub.register(mod, 'SUBSCRIBED') 
  • trunk/plugins/gtkgui/gtkgui.py

    r210 r213  
    15911591                self.roster.on_message(jid, array[1], account) 
    15921592                 
     1593        def handle_event_msgerror(self, account, array): 
     1594                #('MSG', account, (user, error_code, error_msg, msg)) 
     1595                jid = string.split(array[0], '/')[0] 
     1596                if string.find(jid, "@") <= 0: 
     1597                        jid = string.replace(jid, '@', '') 
     1598                self.roster.on_message(jid, _("error while sending") + " \"%s\" ( %s )"%\ 
     1599                        (array[3], array[2]), account) 
     1600                 
    15931601        def handle_event_subscribe(self, account, array): 
    15941602                #('SUBSCRIBE', account, (jid, text)) 
     
    16961704                        elif ev[0] == 'MSG': 
    16971705                                self.handle_event_msg(ev[1], ev[2]) 
     1706                        elif ev[0] == 'MSGERROR': 
     1707                                self.handle_event_msgerror(ev[1], ev[2]) 
    16981708                        elif ev[0] == 'SUBSCRIBE': 
    16991709                                self.handle_event_subscribe(ev[1], ev[2])