core: a new "info" type is used in newMessage for system messages (not comming from outside)
This commit is contained in:
parent
af2554a508
commit
a20e3e2cb8
4 changed files with 16 additions and 12 deletions
|
|
@ -40,7 +40,7 @@ sig_in=ssssa{ss}s
|
|||
doc=A message has been received
|
||||
doc_param_0=from_jid: JID where the message is comming from
|
||||
doc_param_1=message: Message itself
|
||||
doc_param_2=mess_type: Type of the message (cf RFC 3921 #2.1.1)
|
||||
doc_param_2=mess_type: Type of the message (cf RFC 6121 §5.2.2) + C.MESS_TYPE_INFO (system info)
|
||||
doc_param_3=to_jid: JID where the message must be sent
|
||||
doc_param_4=extra: extra message information
|
||||
doc_param_5=%(doc_profile)s
|
||||
|
|
@ -63,9 +63,9 @@ category=core
|
|||
sig_in=ssia{ss}s
|
||||
doc=Somebody changed his presence informations.
|
||||
doc_param_0=entity_jid: JID from which we have presence informations
|
||||
doc_param_1=show: availability status (see RFC 3921 #2.2.2.1)
|
||||
doc_param_2=priority: Priority level of the ressource (see RFC 3921 #2.2.2.3)
|
||||
doc_param_3=statuses: Natural language description of the availability status (see RFC 3921 #2.2.2.2)
|
||||
doc_param_1=show: availability status (see RFC 6121 §4.7.2.1)
|
||||
doc_param_2=priority: Priority level of the ressource (see RFC 6121 §4.7.2.3)
|
||||
doc_param_3=statuses: Natural language description of the availability status (see RFC 6121 §4.7.2.2)
|
||||
doc_param_4=%(doc_profile)s
|
||||
|
||||
[subscribe]
|
||||
|
|
@ -73,7 +73,7 @@ type=signal
|
|||
category=core
|
||||
sig_in=sss
|
||||
doc=Somebody wants to be added in roster
|
||||
doc_param_0=sub_type: Subscription states (see RFC 3921 #9)
|
||||
doc_param_0=sub_type: Subscription states (see RFC 6121 §3)
|
||||
doc_param_1=entity_jid: JID from which the subscription is coming
|
||||
doc_param_2=%(doc_profile)s
|
||||
|
||||
|
|
@ -334,7 +334,7 @@ doc=Send a message
|
|||
doc_param_0=to_jid: JID of the recipient
|
||||
doc_param_1=message: body of the message
|
||||
doc_param_2=subject: Subject of the message ('' if no subject)
|
||||
doc_param_3=mess_type: Type of the message (cf RFC 3921 #2.1.1) or "auto" for automatic type detection
|
||||
doc_param_3=mess_type: Type of the message (cf RFC 6121 §5.2.2) or "auto" for automatic type detection
|
||||
doc_param_4=extra: optional data that can be used by a plugin to build more specific messages
|
||||
doc_param_5=%(doc_profile_key)s
|
||||
|
||||
|
|
|
|||
|
|
@ -57,8 +57,8 @@ class Const(object):
|
|||
STATIC_BLOG_PARAM_KEYWORDS = "Keywords"
|
||||
STATIC_BLOG_PARAM_DESCRIPTION = "Description"
|
||||
|
||||
## Menus ##
|
||||
|
||||
## Menus ##
|
||||
MENU_GLOBAL = "GLOBAL"
|
||||
MENU_ROOM = "ROOM"
|
||||
MENU_SINGLE = "SINGLE"
|
||||
|
|
@ -66,6 +66,7 @@ class Const(object):
|
|||
MENU_ROSTER_JID_CONTEXT = "ROSTER_JID_CONTEXT"
|
||||
MENU_ROSTER_GROUP_CONTEXT = "MENU_ROSTER_GROUP_CONTEXT"
|
||||
|
||||
|
||||
## Profile and entities ##
|
||||
PROF_KEY_NONE = '@NONE@'
|
||||
PROF_KEY_DEFAULT = '@DEFAULT@'
|
||||
|
|
@ -74,6 +75,9 @@ class Const(object):
|
|||
ENTITY_CAP_HASH = 'CAP_HASH'
|
||||
|
||||
|
||||
## Messages ##
|
||||
MESS_TYPE_INFO = 'info'
|
||||
|
||||
## Configuration ##
|
||||
if BaseDirectory: # skipped when xdg module is not available (should not happen in backend)
|
||||
|
||||
|
|
@ -188,6 +192,7 @@ class Const(object):
|
|||
|
||||
@classmethod
|
||||
def bool(cls, value):
|
||||
"""retour str text value for bool, or bool value for str"""
|
||||
if isinstance(value, bool):
|
||||
return cls.BOOL_TRUE if value else cls.BOOL_FALSE
|
||||
return value.lower() == cls.BOOL_TRUE
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Reference in a new issue