Mercurial > libervia-backend
comparison src/plugins/plugin_sec_otr.py @ 1171:0abce7f17782
core: a new "info" type is used in newMessage for system messages (not comming from outside)
author | Goffi <goffi@goffi.org> |
---|---|
date | Fri, 05 Sep 2014 19:29:30 +0200 |
parents | 2df6427a5299 |
children | bc811915a96a |
comparison
equal
deleted
inserted
replaced
1170:2df6427a5299 | 1171:0abce7f17782 |
---|---|
104 else: | 104 else: |
105 log.error(_(u"Unknown OTR state")) | 105 log.error(_(u"Unknown OTR state")) |
106 return | 106 return |
107 | 107 |
108 client = self.user.client | 108 client = self.user.client |
109 # FIXME: newMessage should manage system message, so they don't appear as coming from the contact | |
110 self.host.bridge.newMessage(client.jid.full(), | 109 self.host.bridge.newMessage(client.jid.full(), |
111 feedback, | 110 feedback, |
112 mess_type="headline", | 111 mess_type=C.MESS_TYPE_INFO, |
113 to_jid=self.peer.full(), | 112 to_jid=self.peer.full(), |
114 extra={}, | 113 extra={}, |
115 profile=client.profile) | 114 profile=client.profile) |
116 # TODO: send signal to frontends | 115 # TODO: send signal to frontends |
117 | 116 |
411 if otrctx.state == potr.context.STATE_ENCRYPTED: | 410 if otrctx.state == potr.context.STATE_ENCRYPTED: |
412 log.warning(u"Received unencrypted message in an encrypted context (from %(jid)s)" % {'jid': from_jid.full()}) | 411 log.warning(u"Received unencrypted message in an encrypted context (from %(jid)s)" % {'jid': from_jid.full()}) |
413 client = self.host.getClient(profile) | 412 client = self.host.getClient(profile) |
414 self.host.bridge.newMessage(from_jid.full(), | 413 self.host.bridge.newMessage(from_jid.full(), |
415 _(u"WARNING: received unencrypted data in a supposedly encrypted context"), | 414 _(u"WARNING: received unencrypted data in a supposedly encrypted context"), |
416 mess_type="headline", # FIXME: add message type for internal informations | 415 mess_type=C.MESS_TYPE_INFO, |
417 to_jid=client.jid.full(), | 416 to_jid=client.jid.full(), |
418 extra={}, | 417 extra={}, |
419 profile=client.profile) | 418 profile=client.profile) |
420 encrypted = False | 419 encrypted = False |
421 | 420 |
452 else: | 451 else: |
453 feedback = D_("Your message was not sent because your correspondent closed the encrypted conversation on his/her side. Either close your own side, or refresh the session.") | 452 feedback = D_("Your message was not sent because your correspondent closed the encrypted conversation on his/her side. Either close your own side, or refresh the session.") |
454 client = self.host.getClient(profile) | 453 client = self.host.getClient(profile) |
455 self.host.bridge.newMessage(to_jid.full(), | 454 self.host.bridge.newMessage(to_jid.full(), |
456 feedback, | 455 feedback, |
457 mess_type="headline", | 456 mess_type=C.MESS_TYPE_INFO, |
458 to_jid=client.jid.full(), | 457 to_jid=client.jid.full(), |
459 extra={}, | 458 extra={}, |
460 profile=client.profile) | 459 profile=client.profile) |
461 return False | 460 return False |
462 else: | 461 else: |