core: a new "info" type is used in newMessage for system messages (not comming from outside)

This commit is contained in:
Goffi 2014-09-05 19:29:30 +02:00
commit a20e3e2cb8
2 changed files with 16 additions and 12 deletions

View file

@ -168,7 +168,7 @@ class TextCommands(object):
else:
_from = self.host.getJidNStream(profile)[0]
self.host.bridge.newMessage(unicode(mess_data["to"]), message, mess_data['type'], unicode(_from), {}, profile=profile)
self.host.bridge.newMessage(unicode(mess_data["to"]), message, C.MESS_TYPE_INFO, unicode(_from), {}, profile=profile)
def feedBackWrongContext(self, command, types, mess_data, profile):
"""Give a generic message to the user when a command has been used in a wrong context.

View file

@ -106,10 +106,9 @@ class Context(potr.context.Context):
return
client = self.user.client
# FIXME: newMessage should manage system message, so they don't appear as coming from the contact
self.host.bridge.newMessage(client.jid.full(),
feedback,
mess_type="headline",
mess_type=C.MESS_TYPE_INFO,
to_jid=self.peer.full(),
extra={},
profile=client.profile)
@ -413,7 +412,7 @@ class OTR(object):
client = self.host.getClient(profile)
self.host.bridge.newMessage(from_jid.full(),
_(u"WARNING: received unencrypted data in a supposedly encrypted context"),
mess_type="headline", # FIXME: add message type for internal informations
mess_type=C.MESS_TYPE_INFO,
to_jid=client.jid.full(),
extra={},
profile=client.profile)
@ -454,7 +453,7 @@ class OTR(object):
client = self.host.getClient(profile)
self.host.bridge.newMessage(to_jid.full(),
feedback,
mess_type="headline",
mess_type=C.MESS_TYPE_INFO,
to_jid=client.jid.full(),
extra={},
profile=client.profile)