Commit graph libervia-backend/src/core/constants.py
Author SHA1 Message Date
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
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
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
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
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
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
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
Goffi
a37b57e7ad core(constants): added a constant for profile extension (PLUGIN_EXT):
this constant may be modified if needed, which is the case on Android (it's modified by Cagou service's main.py), so platform detection is not needed anymore in sat_main.py.
2016-12-25 16:43:56 +01:00
Goffi
2618d48e7b core, quick_frontends: android compatibility hacks:
a couple of hacks have been used so backend can be launched on android using kivy
    - config file (sat.conf) is been read on a specific dir, using a detection of Cagou domains in constants.py
    - fixed crash when using sys.stdout.isatty in log_config.py
    - Q&D fix for logging encoding issue on android
    - when android is detected, the path/pattern to load plugins is modified
    - SRV is not working at the moment on android. If the platform is detected, the host is used directly with default port. A hosts_dir configuration can be used in [android] section to map a specific ip to a host
    - getRepositoryData in tools/utils return constant string on android. Proper repository data need to be copied during package building.
    - [quick app] more robust failure handling on asyncConnect error
    - [quick chat] default to utf-8 when getlocale doesn't return the actual locale.
2016-12-04 18:16:48 +01:00
Goffi
9ce91cf534 core: bridge can now be changed in conf
by default DBus bridge is used, but this can be changed in sat.conf's DEFAULT section using "bridge" option.
    bridge can be "dbus" (or equivalent "dbus_bridge") or embedded at the moment.
    Bridge name used is saved in SAT.bridge_name, and load_bridge method can be used by frontends.
2016-12-04 18:16:37 +01:00
Goffi
a1d5ee167c core (constants): added XMLUI_DATA_LVLS constants which group all available levels 2016-08-21 12:03:34 +02:00
Goffi
a7de473107 backend, frontends: message refactoring (huge commit):
/!\ several features are temporarily disabled, like notifications in frontends

next step in refactoring, with the following changes:
    - jp: updated jp message to follow changes in backend/bridge
    - jp: added --lang, --subject, --subject_lang, and --type options to jp message + fixed unicode handling for jid
    - quick_frontend (QuickApp, QuickChat):
        - follow backend changes
        - refactored chat, message are now handled in OrderedDict and uid are kept so they can be updated
        - Message and Occupant classes handle metadata, so frontend just have to display them
    - Primitivus (Chat):
        - follow backend/QuickFrontend changes
        - info & standard messages are handled in the same MessageWidget class
        - improved/simplified handling of messages, removed update() method
        - user joined/left messages are merged when next to each other
        - a separator is shown when message is received while widget is out of focus, so user can quickly see the new messages
        - affiliation/role are shown (in a basic way for now) in occupants panel
        - removed "/me" messages handling, as it will be done by a backend plugin
        - message language is displayed when available (only one language per message for now)
        - fixed :history and :search commands
    - core (constants): new constants for messages type, XML namespace, entity type
    - core: *Message methods renamed to follow new code sytle (e.g. sendMessageToBridge => messageSendToBridge)
    - core (messages handling): fixed handling of language
    - core (messages handling): mes_data['from'] and ['to'] are now jid.JID
    - core (core.xmpp): reorganised message methods, added getNick() method to client.roster
    - plugin text commands: fixed plugin and adapted to new messages behaviour. client is now used in arguments instead of profile
    - plugins: added information for cancellation reason in CancelError calls
    - plugin XEP-0045: various improvments, but this plugin still need work:
        - trigger is used to avoid message already handled by the plugin to be handled a second time
        - changed the way to handle history, the last message from DB is checked and we request only messages since this one, in seconds (thanks Poezio folks :))
        - subject reception is waited before sending the roomJoined signal, this way we are sure that everything including history is ready
        - cmd_* method now follow the new convention with client instead of profile
        - roomUserJoined and roomUserLeft messages are removed, the events are now handled with info message with a "ROOM_USER_JOINED" info subtype
    - probably other forgotten stuffs :p
2016-06-20 18:41:53 +02:00
Goffi
6d67db84ea core: changed versioning schema:
before the "D" was meaning "version + modifications", so 0.6.0D was meaning "after the version 0.6.0".
    Now SàT will follow a more traditional way, so it move to 0.7.0D to say "it's the preparation of the version 0.7.0".
2016-06-19 22:22:04 +02:00
Goffi
1e05785e83 core (logs): taints:
log taints can be specified using log_levels_taints_dict in sat.conf, where key is a level name, and value is a list of color or code names. For instance, the following conf would taint INFO level in bold/green and DEBUG in default color:

    log_levels_taints_dict = {"debug": [], "info": ["green", "bold"]}

Unknown names are copied as raw strings.
2016-04-18 18:35:17 +02:00
Goffi
6bbcbaf522 use of /usr/bin/env instead of /usr/bin/python in shebang 2016-04-17 14:45:26 +02:00
Goffi
c641953ebf plugin blog import: this plugin is the base handling blog importers:
- blog importers are plugin which register to this one with the "register" method
    - blog import manage uploading the given blog data to a PubSub server
    - filters can be used.
    - current filters fixe the <img> src without host, and upload images to XMPP server
2016-01-22 20:24:17 +01:00
Goffi
dff93495b3 plugin XEP-0277: moved NS_XHTML namespace to constants + adapted parsing to new behaviour of ElementParser 2016-01-22 20:24:17 +01:00
Goffi
098e66c4a2 plugin syntax dc_wiki: first draft:
handle dotclear wiki syntax
    /!\ only dc_wiki -> XHTML is handled for now
2016-01-17 20:39:20 +01:00
Goffi
c5320bb949 plugin XEP-0313: cleaning and improvments:
- moved common namespaces to core.constants
    - removed useless dependencies and recommendations
    - removed all bride methods as they where there only for testing purpose
    - don't use a plugin dict to store MAM clients, put them in profiles' clients instead
    - removed message trigger in favor of an observer which is triggered only when specific queryid is used
    - new getArchives method which grab all result and return them all at once
2016-01-05 23:20:22 +01:00
Goffi
348be27934 copyright update 2016-01-03 16:28:30 +01:00
souliane
f3a5cb2a96 core, plugin misc_account: set XMPP connection max retries to 0 when checking if an external account exists 2015-12-07 19:56:12 +01:00
Goffi
73aa1d1f79 we are in dev version again 2015-12-07 13:10:44 +01:00
Goffi
db77e3358a update version to 0.6.0 2015-12-02 13:05:54 +01:00
Goffi
fbbb081425 backend, bridge, frontends: actionNew has now a security_limit argument + added some docstring to explain data argument 2015-11-14 19:21:56 +01:00
Goffi
ea2a3e584d core (contants): added PROF_KEY_ALL en PLUG_TYPE_* constants 2015-09-25 19:19:12 +02:00
Goffi
b7409e0488 plugins xep-0060, xep-0163, xep-0277, groupblog: bloging improvments (huge patch, sorry):
/!\ not everything is working yet, and specially groupblogs are broken /!\
    - renamed bridge api to use prefixed methods (e.g. psSubscribeToMany instead of subscribeToMany in PubSub)
    - (xep-0060): try to find a default PubSub service, and put it in client.pubsub_service
    - (xep-0060): extra dictionary can be used in bridge method for RSM and other options
    - (xep-0060): XEP_0060.addManagedNode and XEP_0060.removeManagedNode allow to easily catch notifications for a specific node
    - (xep-0060): retractItem manage "notify" attribute
    - (xep-0060): new signal psEvent will be used to transmit notifications to frontends
    - (xep-0060, constants): added a bunch of useful constants
    - (xep-0163): removed personalEvent in favor of psEvent
    - (xep-0163): addPEPEvent now filter non PEP events for in_callback
    - (xep-0277): use of new XEP-0060 plugin's addManagedNode
    - (xep-0277): fixed author handling for incoming blogs: author is the human readable name, author_jid it jid, and author_jid_verified is set to True is the jid is checked
    - (xep-0277): reworked data2entry with Twisted instead of feed, item_id can now be specified, <content/> is changed to  <title/> if there is only content
    - (xep-0277): comments are now managed here (core removed from groupblog)
    - (xep-0277): (comments) node is created if needed, default pubsub service is used if available, else PEP
    - (xep-0277): retract is managed
2015-08-16 00:39:44 +02:00
Goffi
1e21730bfe plugin XEP-0277: added mBGetFromManyWithComments to have items + comments in one method call 2015-08-15 22:24:38 +02:00
Goffi
2b20bff614 plugins xep-0277, groupblog: added subscriteToMany to replace massiveSubscribeGroupBlogs + added SatRosterProtocol.getJidsSet 2015-08-15 22:20:43 +02:00
Goffi
975e4ac51f core: new tools.sat_defer module, and implementation of RTDeferredSessions:
The real-time deferred session is a class which manage session of several deferreds at once (pretty much like a DeferredList), with the ability to get intermediate results.
2015-08-15 22:13:27 +02:00
souliane
41b549f7ae core, plugin XEP-0045, frontends: change frontend method "setStatusOnline" for "setPresenceStatus":
- remove parameter "online" (can be guess from "presence" value)
    - process "statuses" dict in quick_frontend, so this method can get a simple unicode "status"
    - add C.PRESENCE_STATUSES_DEFAULT to define the key to use for fallback status
2015-04-20 16:39:38 +02:00
Goffi
fbec02d396 2015 copyright dates update 2015-03-30 10:26:26 +02:00
souliane
d4c627d71f plugins XEP-0045, XEP-0249: allow to join / invite without specifying the JID's host part (use client's values) 2015-03-24 07:34:32 +01:00
souliane
2a7bf77142 core (constants): add menu type MENU_ROOM_OCCUPANT_CONTEXT 2015-03-09 16:37:15 +01:00
Goffi
983dcf926e core: better use of C.bool: C.bool only accept basestring subclasses and return the associated constant, C.boolConst return the associated constant for a boolean value 2015-02-06 18:46:26 +01:00
Goffi
8ce5c1862b core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
/!\ not finished, everything is still instable !
    - bridge: DBus bridge has been modified to allow blocking call to be called in the same way as asynchronous calls
    - bridge: calls with a callback and no errback are now possible, default errback log the error
    - constants: removed hack to manage presence without OrderedDict, as an OrderedDict like class has been implemented in Libervia
    - core: getLastResource has been removed and replaced by getMainResource (there is a global better management of resources)
    - various style improvments: use of constants when possible, fixed variable overlaps, import of module instead of direct class import
    - frontends: printInfo and printMessage methods in (Quick)Chat are more generic (use of extra instead of timestamp)
    - frontends: bridge creation and option parsing (command line arguments) are now specified by the frontend in QuickApp __init__
    - frontends: ProfileManager manage a more complete plug sequence (some stuff formerly manage in contact_list have moved to ProfileManager)
    - quick_frontend (quick_widgets): QuickWidgetsManager is now iterable (all widgets are then returned), or can return an iterator on a specific class (return all widgets of this class) with getWidgets
    - frontends: tools.jid can now be used in Pyjamas, with some care
    - frontends (XMLUI): profile is now managed
    - core (memory): big improvment on entities cache management (and specially resource management)
    - core (params/exceptions): added PermissionError
    - various fixes and improvments, check diff for more details
2015-01-24 01:00:29 +01:00
Goffi
05e5e1448b core: misc improvments:
- added some constants for message types and presence
    - removed profile authentification specific methods in favor of a more generic "validated" key
2014-12-10 18:36:11 +01:00
souliane
176512b013 constants: split C.bool in C.bool and C.str so:
- you can use them without caring about the input type
    - you always know the output type
2014-10-06 12:22:14 +02:00
souliane
136395eb6d memory (params): add parameters "Show offline contacts" and "Show empty groups" 2014-10-06 11:20:43 +02:00
souliane
4f339272b7 memory: add Parameter "Chat history limit" 2014-09-24 13:49:43 +02:00
souliane
a67c8094f5 core: move XMPP keep-alife value to the constants 2014-09-21 13:06:53 +02:00
souliane
a3a6e48797 we are in dev version again 2014-09-18 11:43:21 +02:00
souliane
37d1cd6c22 version update 2014-09-18 11:41:52 +02:00
Goffi
e17274e0b4 we are in dev version again 2014-09-15 12:07:40 +02:00
Goffi
606fd8cdf3 version update 2014-09-09 08:15:19 +02:00
Goffi
a20e3e2cb8 core: a new "info" type is used in newMessage for system messages (not comming from outside) 2014-09-05 19:29:30 +02:00