Mercurial > libervia-backend
comparison src/core/constants.py @ 2144:1d3f73e065e1
core, jp: component handling + client handling refactoring:
- SàT can now handle components
- plugin have now a "modes" key in PLUGIN_INFO where they declare if they can be used with clients and or components. They default to be client only.
- components are really similar to clients, but with some changes in behaviour:
* component has "entry point", which is a special plugin with a componentStart method, which is called just after component is connected
* trigger end with a different suffixes (e.g. profileConnected vs profileConnectedComponent), so a plugin which manage both clients and components can have different workflow
* for clients, only triggers of plugins handling client mode are launched
* for components, only triggers of plugins needed in dependencies are launched. They all must handle component mode.
* component have a sendHistory attribute (False by default) which can be set to True to allow saving sent messages into history
* for convenience, "client" is still used in method even if it can now be a component
* a new "component" boolean attribute tells if we have a component or a client
* components have to add themselve Message protocol
* roster and presence protocols are not added for components
* component default port is 5347 (which is Prosody's default port)
- asyncCreateProfile has been renamed for profileCreate, both to follow new naming convention and to prepare the transition to fully asynchronous bridge
- createProfile has a new "component" attribute. When used to create a component, it must be set to a component entry point
- jp: added --component argument to profile/create
- disconnect bridge method is now asynchronous, this way frontends can know when disconnection is finished
- new PI_* constants for PLUGIN_INFO values (not used everywhere yet)
- client/component connection workflow has been moved to their classes instead of being a host methods
- host.messageSend is now client.sendMessage, and former client.sendMessage is now client.sendMessageData.
- identities are now handled in client.identities list, so it can be updated dynamically by plugins (in the future, frontends should be able to update them too through bridge)
- profileConnecting* profileConnected* profileDisconnected* and getHandler now all use client instead of profile
author | Goffi <goffi@goffi.org> |
---|---|
date | Sun, 12 Feb 2017 17:55:43 +0100 |
parents | c0577837680a |
children | 33c8c4973743 |
comparison
equal
deleted
inserted
replaced
2143:c3cac21157d4 | 2144:1d3f73e065e1 |
---|---|
45 | 45 |
46 ## Protocol ## | 46 ## Protocol ## |
47 XMPP_C2S_PORT = 5222 | 47 XMPP_C2S_PORT = 5222 |
48 XMPP_KEEP_ALIFE = 180 | 48 XMPP_KEEP_ALIFE = 180 |
49 XMPP_MAX_RETRIES = 2 | 49 XMPP_MAX_RETRIES = 2 |
50 # default port used on Prosody, may differ on other servers | |
51 XMPP_COMPONENT_PORT = 5347 | |
50 | 52 |
51 | 53 |
52 ## Parameters ## | 54 ## Parameters ## |
53 NO_SECURITY_LIMIT = -1 # FIXME: to rename | 55 NO_SECURITY_LIMIT = -1 # FIXME: to rename |
54 SECURITY_LIMIT_MAX = 0 | 56 SECURITY_LIMIT_MAX = 0 |
169 ] | 171 ] |
170 | 172 |
171 | 173 |
172 ## Plugins ## | 174 ## Plugins ## |
173 | 175 |
176 # PLUGIN_INFO keys | |
177 # XXX: we use PI instead of PLUG_INFO which would normally be used | |
178 # to make the header more readable | |
179 PI_IMPORT_NAME = u'import_name' | |
180 PI_DEPENDENCIES = u'dependencies' | |
181 PI_RECOMMENDATIONS = u'recommendations' | |
182 | |
174 # Types | 183 # Types |
175 PLUG_TYPE_XEP = "XEP" | 184 PLUG_TYPE_XEP = "XEP" |
176 PLUG_TYPE_MISC = "MISC" | 185 PLUG_TYPE_MISC = "MISC" |
177 PLUG_TYPE_EXP = "EXP" | 186 PLUG_TYPE_EXP = "EXP" |
178 PLUG_TYPE_SEC = "SEC" | 187 PLUG_TYPE_SEC = "SEC" |
179 PLUG_TYPE_SYNTAXE = "SYNTAXE" | 188 PLUG_TYPE_SYNTAXE = "SYNTAXE" |
180 PLUG_TYPE_BLOG = "BLOG" | 189 PLUG_TYPE_BLOG = "BLOG" |
181 | 190 PLUG_TYPE_ENTRY_POINT = "ENTRY_POINT" |
191 | |
192 # Modes | |
193 PLUG_MODE_CLIENT = "client" | |
194 PLUG_MODE_COMPONENT = "component" | |
195 PLUG_MODE_DEFAULT = (PLUG_MODE_CLIENT,) | |
182 | 196 |
183 # names of widely used plugins | 197 # names of widely used plugins |
184 TEXT_CMDS = 'TEXT-COMMANDS' | 198 TEXT_CMDS = 'TEXT-COMMANDS' |
185 | 199 |
186 # PubSub event categories | 200 # PubSub event categories |