Commit graph libervia-backend/src/core
Author SHA1 Message Date
Goffi
2422d0a1d7 plugin XEP-0115: fixed caps initial check 2018-03-30 17:51:32 +02:00
Goffi
a9105242d0 core: added bare_jid and identities arguments to discoGetByFeatures:
- bare_jid indicate if we are looking for server implementation (True) of devices (False)
    - identities is an optional filter, only entities with this identities set will be kept
2018-03-26 08:01:06 +02:00
Goffi
b9e3707412 core: new discoFindFeatures method which return all server services/roster entities implementing a set of features. 2018-03-24 10:46:09 +01:00
Goffi
07fa89be84 component file sharing: comments handling first draft:
comments use a minimal pubsub service which create virtual nodes for each files. A pubsub request to org.salut-a-toi.file_comments/[FILE_ID] allow to handle comments in classic way.
Permissions are the same as for files (i.e. if an entity can see a file, she can comment it).
2018-03-16 17:06:35 +01:00
Goffi
50a7be4fe4 core: use C.bool to detect value of "handler" field in PLUGIN_INFO 2018-03-16 17:00:57 +01:00
Goffi
3b737b6fec core (constants): accept "yes" as a True value in bool() 2018-03-16 17:00:09 +01:00
Goffi
24fba151c4 plugin XEP-0264: thumbnails handling implementation 2018-03-02 17:53:31 +01:00
Goffi
7bc5b99ea1 core (memory/cache): common cache:
host has now a common_cache attribute for data which can be shared between profiles. client.cache is for private data
2018-03-02 17:40:09 +01:00
Goffi
b27f385511 core (client): component improvments:
- renamed component boolean to is_component for more clarity
- profileConnected/profileDisconnected don't use a suffix anymore, it's called for both client and component.
  To check for there, the is_component boolean is enough
- fixed dependencies handling
- componentStart is not mandatory anymore, as a component can just be used with its handler
2018-02-28 18:28:39 +01:00
Goffi
0d5b8b5a84 core (client): set default timeout of IQ to 60 seconds 2018-02-28 18:28:39 +01:00
Goffi
6aee4c07cf core: new getLocalPath method to retrieve a path in SàT local dir, which may be specific to a profile or component 2018-02-28 18:28:39 +01:00
Goffi
54e4d5d3a9 core (exceptions): added ClientTypeError to deal when a code should not be executed by a client or component profile. 2018-02-28 18:28:39 +01:00
Goffi
a89b5f0957 core (constants): new constants to handle files, progress, component, permissions (will be used in the upcoming patches) 2018-02-28 18:28:39 +01:00
Goffi
387c10cc0d dates update 2018-01-26 11:14:13 +01:00
Goffi
8cce1d1ba0 core: 'x-data' namespace is now registered 2018-01-19 17:39:38 +01:00
Goffi
a9fb2e568e core: moved CHAT_* constants from frontends to core constants + uses constants for MESS_TYPE_* in sendMessage 2018-01-03 00:13:48 +01:00
Goffi
913e3712d0 core: specify profile on NotFound exception 2017-11-30 20:27:22 +01:00
Goffi
da077485d2 core: added a mechanism to associate short names to namespaces:
- new internal registerNamespace can be used by a plugin to associate a short name to a namespace
- new NamespacesGet bridge method retrieve those associations
2017-11-19 16:46:07 +01:00
Goffi
30768ce305 memory (disco): added findServiceEntity helper method to get first service of a kind 2017-11-15 08:54:32 +01:00
Goffi
f5f25e8ab5 misc: date update (yes it's a bit late :p ) 2017-11-03 14:31:42 +01:00
Goffi
80eb458024 plugin import: generic data import plugin:
this plugin handle common task for importers. Specialized importers (e.g. blog import) use it as a basic, and specific importers (e.g. Dotclear) register to the specialized one.
Blog importer generic method have been moved to it.
2017-10-01 12:21:23 +02:00
Goffi
c56d3fc759 plugin XEP-0060: addManagedNode callbacks now use client syntax instead of profile 2017-07-05 15:04:43 +02:00
Goffi
e30f22ec4c core: check uncatched exceptions during plugin import and stdui init, log error and exit if any found 2017-06-21 19:40:13 +02:00
Goffi
ffdc55ce2e core: added hosts_dict handling in general config:
A way to force host was already available through hosts_dict, but for Android only in [android] section. It has now be moved in general conf as it can be useful in other cases, and improved to handle port too.

This way if something like this is present in sat.conf:

[DEFAULT]
hosts_dict = {"example.net": {"host": "127.0.0.1", "port": 7777}}

these values will be used and DNS check will be bypassed. A string can also be used for values, in this case only host is changed.
2017-06-19 09:36:55 +02:00
Goffi
a4b122094c core: fixed profile key detection in getClients + raise DataError on empty profile 2017-05-21 19:59:42 +02:00
Goffi
06be5a58aa plugin account: removed dependency to Prosody/prosodyctl and properly use in-band registration instead 2017-03-09 00:06:13 +01:00
Goffi
d1ba64c780 core, plugin XEP-0077: in-band registration fix and move:
in-band was partially in core for historical reason, it has been moved to XEP-0077, and fixed. It is still incomplete, but should work for basic accounts creation.
2017-03-08 20:59:31 +01:00
Goffi
a4934b1955 tools(templates): workflow improvments:
- template theme can be specified in parenthesis: (some_theme)path/to/template.html. Withtout parenthesis, "default" is used
    - static content are supposed to be in [theme]/static, error pages in [theme]/error/[err_code].html
    - default page are used in some case (2 for now): if error page with specified code doesn't exists, a base page is used, and if a page doesn't exist for a theme, the same one for default theme is looked for
    - CSS files are automatically found for HTML pages
    - CSS files can be split, the'll be added in the template according to the page requested.
    - theme CSS file is looked for, and if not found the default theme equivalent is looked for.
    - each element of a path can be associated to a CSS file, and styles.css is always there. For instance if blog/articles.html is requested, the following CSS can be included: "styles.css", "blog.css", "blog_article.css". They all must be in /static
    - if the automatic finding of CSS files is not wanted, css_files arguments can be used instead, with full relative path (i.e. including theme)
    - CSS files can be merged and included inline with css_inline argument
    - root_path can be specified, it will be used as a prefix for static files
    - requested theme (which may differ from actual theme, e.g. if the template is not found and default one is used instead) is available in template with "theme" variable
    - added getThemeAndRoot method to retrieve theme and theme root path from template
2017-03-05 23:41:10 +01:00
Goffi
085ed041e7 core, bridge: renamed getProfileName to profileNameGet according to new conventions 2017-03-05 21:36:01 +01:00
Goffi
9b0542fb46 core, frontends: various fixes for Libervia:
- quick_app: don't fail when we can't get autodisconnect parameter
    - bridge: removed useless BridgeFrontend parent class
    - use of TypeError, unicode and list to workaround Pyjamas incompatibilities
2017-02-26 18:23:01 +01:00
Goffi
bc5f57702f core (constants), tools (common/ansi): moved ANSI escape codes to a dedicated class, with helper methods 2017-02-16 00:44:54 +01:00
Goffi
a205ff4e90 core: added release name in constants + full version 2017-02-12 19:23:34 +01:00
Goffi
85f3bd5988 core, frontends: getProfilesList renamed to profilesGetList + behaviour change:
- profilesGetList now handles clients and components boolean arguments, to filter profiles
    - jp: added --clients and --components options to profile/list
    - profilesGetList now returns sorted profiles
2017-02-12 19:08:52 +01:00
Goffi
ac7d587c49 core (plugins): added missing contants + use of new constants in PLUGIN_INFO 2017-02-12 18:59:10 +01:00
Goffi
97337202cb 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
2017-02-12 17:55:43 +01:00
Goffi
b5f1e45d4e core, bridge, frontends: renamed asyncConnect to connect, and added options parameters (not used yet) 2017-02-06 22:54:43 +01:00
Goffi
7865ae7f99 core (roster): added isPresenceAuthorised to check if an entity is authorised to see our presence 2017-02-06 20:46:59 +01:00
Goffi
aeeb0c5635 plugin OTR, core; use of new sendMessage + OTR mini refactoring:
- new client.sendMessage method is used instead of sendMessageToStream
    - client.feedback is used in OTR
    - OTR now add message processing hints and carbon private element as recommanded by XEP-0364. Explicit Message Encryption is still TODO
    - OTR use the new sendMessageFinish trigger, this has a number of advantages:
        * there is little risk that OTR is skipped by other plugins (they have to use client.sendMessage as recommanded)
        * being at the end of the chain, OTR can check and remove any HTML or other leaking elements
        * OTR doesn't have to skip other plugins anymore, this means that things like delivery receipts are now working with OTR
          (but because there is not full stanza encryption, they can leak metadata)
        * OTR can decide to follow storage hint by letting or deleting "history" key
2017-02-05 15:00:01 +01:00
Goffi
a8bd66d31d core (client): added feedback and sendMessage methods:
- feedback method is a helper method to quickly display an info message to user
    - sendMessage is the method used to send a message in the stream, using message data dictionary.
    It inclure a trigger point which can't be cancelled, it is intended for e2e encryption method which don't do full stanza encryption.
    - "send" trigger point is disabled as it is not used at the moment
2017-02-05 14:55:54 +01:00
Goffi
503f8644ba core: replaced SkipHistory exception by a key in mess_data:
SkipHistory was skipping all remaining triggers just to skip history, which is not the intented behaviour.
    Now history can be skipped by setting mess_data[u'history'] = C.HISTORY_SKIP, this way we won't skip importants triggers.
    When history is skipped, mess_data[u'extra'][u'history'] will be set to C.HISTORY_SKIP for frontends, so they can inform user that the message is not stored locally.
2017-02-05 14:55:21 +01:00
Goffi
a2c151f9c6 plugin XEP-0334: fixed and improved message processing hints:
- wrong elements were used in this plugging, it could not work properly
    - use constants for hints
    - add addHint method so other plugins can add a hint easily
    - hints can be added by frontends in mess_data['extra']['hints'] (serialized dict) or by other plugins using addHint
    - if history is skipped on message reception, mess_data['extra']['history']['skipped'] is set
    - introduced PLUGIN_INFO['usage'] for usage information for developers
2017-02-05 14:55:19 +01:00
Goffi
13e2e50cb0 added "send" trigger point as the last one before sending, can be used for e2e encryption 2017-02-04 17:59:15 +01:00
Goffi
6467bdb3c3 core: replaced calls to client.xmlstream.send by client.send which is the right method to use. client.xmlstream should not be used directly 2017-02-04 17:59:13 +01:00
Goffi
115f5ae0e1 plugin otr: various improvments:
- messageSend trigger now use pre_xml_treatments so it doesn't block other triggers of higher priority
    - text commands now use a very high priority, as it is local command and should not be blocked in most of cases
    - new otrState signal, to send state change to frontends
    - history is not skipped anymore, a future option may change this behaviour
    - OTR trigger are skipped on groupchat messages
    - context_manager is now in client instead of being global to plugin
    - removed fixPotr as it is fixed upstream

note triggers should be improved for encryption methods, as skipping an encrypter may break security, but putting it in top priority may break nice features.

fix bug 170
2017-02-01 21:44:24 +01:00
Goffi
10adbb04a4 core (constant): on android sat.conf is now in /data/data/org.goffi.cagou.cagou/files/platform/android/ 2017-01-31 22:35:59 +01:00
Goffi
d8b9c85cc0 core (menus): improvments:
- use the new convention for bridge names (getMenus ==> menusGet, etc.)
    - menu now use canonical path, which is the untranslated path with each element stripped and lowercase, it must be unique by menu type
    - added menuLaunch method to manually launch a menu like an action, canonical path is used instead of id
    - added SECURITY_LIMIT_MAX constant
2017-01-26 20:29:48 +01:00
Goffi
4eaf5d626f plugin XEP-0054, quick frontend(app): various improvments:
- memory.cache is now used
    - getAvatar and setAvatar has been renamed to avatarGet and avatarSet to follow new convention
    - getAvatar now return (optionally) full path, and may request vCard or only return avatar in cache
    - getAvatarFile has been removed as it is not needed anymore (avatarGet can return full path)
    - getCard has been removed from bridge as it was only used to request avatar
    - new internal method getBareOfFull return jid to use depending of the jid being part of a MUC or not
    - cache is now set per profile in client, instead of a general one for all profiles
    - thanks to the use of memory.cache, correct extension is now used in saved file, according to MIME type
    - fixed and better cache handling
    - a warning message is shown if given avatar hash differs from computed one
    - empty hash value is now in a constant, and ignored if received
    - QuickApp has been updated to follow new behaviour
    - Primitivus has been fixed (it was not declaring not using avatars correclty)
    - jp has been updated to follow new methods name
2017-01-15 17:51:37 +01:00
Goffi
50194cde01 core: added sessionGetInfos bridge method to retrieve various data on current profile session + client.started keep start time 2017-01-05 22:22:13 +01:00
Goffi
d0c56aaadb plugin XEP-0231: Bits of Binary first draft:
The current implementation only retrieve data from Bits of Binary, it's not used yet for sending.
When an XHTML-IM message is received (XEP-0071), all <img> are checked and if a cid scheme is found in src attribute the file is retrieved and the src is changed with cached file.
2017-01-05 20:29:05 +01:00
Goffi
6872df4fd3 core (memory/cache): file caching handling, first draft:
instead of having file caching handled individually by plugins, a generic module has been added in memory.

    - Cache can be global or associated to a profile. In the later case, client.cache can be used.
    - Cache are managed with unique ids (which can be any unique unicode, hash uuid, or something else).
    - To know if a file is in cache, getFilePath is used: if the file is in cache, its absolute path is returned, else None is returned.
    - To cache a file, cacheData is used with at list the source of cache (most of time plugin import name), and unique id. The method return file opened in binary writing mode (so cacheData can - and should - be used with "with" statement).
    - 2 files will be created: a metadata file (named after the unique id), and the actual file.
    - each file has a end of life time, after it, the cache is invalidated and the file must be requested again.
2017-01-05 20:23:38 +01:00