# HG changeset patch # User Goffi # Date 1387241221 -3600 # Node ID e99f578c71795785a024f1bb4e4e54cb127f0b1b # Parent 19bcd39c77f63c692096aa771307d51c079b0cb3 browser side: sendMessage alert on error diff -r 19bcd39c77f6 -r e99f578c7179 libervia.py --- a/libervia.py Tue Dec 17 01:36:57 2013 +0100 +++ b/libervia.py Tue Dec 17 01:47:01 2013 +0100 @@ -747,6 +747,11 @@ def _newAlert(self, message, title, alert_type): dialog.InfoDialog(title, message).show() + def sendError(self, errorData): + dialog.InfoDialog("Error while sending message", + "Your message can't be sent", Width="400px").center() + print "sendError: %s" % str(errorData) + def send(self, targets, text, extra={}): """Send a message to any target type. @param targets: list of tuples (type, entities, addr) with: @@ -772,10 +777,10 @@ print "ERROR: Unknown target type" if addresses: if len(addresses) == 1 and addresses[0][0] == 'to': - self.bridge.call('sendMessage', None, addresses[0][1], text, '', type_, extra) + self.bridge.call('sendMessage', (None, self.sendError), addresses[0][1], text, '', type_, extra) else: extra.update({'address': '\n'.join([('%s:%s' % entry) for entry in addresses])}) - self.bridge.call('sendMessage', None, self.whoami.domain, text, '', type_, extra) + self.bridge.call('sendMessage', (None, self.sendError), self.whoami.domain, text, '', type_, extra) if __name__ == '__main__':