Commit graph libervia-backend/src/memory/memory.py
Author SHA1 Message Date
souliane
2f6b8ae771 memory: don't save last resource in entity data for the MUC jids 2014-10-17 20:26:01 +02:00
Goffi
6b20989ecc core: better management of default value in getConfig 2014-10-07 17:12:41 +02:00
souliane
767f3d50dc bridge, memory: add "search" attribute to getHistory (filter the results with a unix globbing pattern) 2014-10-04 10:25:32 +02:00
souliane
4f339272b7 memory: add Parameter "Chat history limit" 2014-09-24 13:49:43 +02:00
souliane
4c61bf8fad memory: getHistory with limit=0 now returns an empty list, use limit=None to return all messages 2014-10-03 12:43:59 +02:00
souliane
1388ff8fac memory: session timeout won't be reset on each access if the Sessions() is called with resettable_timeout=False 2014-09-22 19:24:07 +02:00
souliane
ef7035a3ca memory: profileSessions.profileGetUnique was not resetting the timer 2014-09-22 18:42:54 +02:00
souliane
ccaa5412c5 memory: handle the case where an existing session ID is re-used for creating a new session 2014-09-22 20:26:40 +02:00
souliane
830b6d8ef6 memory: Sessions.newSession can be called with a forced session ID 2014-09-21 13:10:55 +02:00
Matteo Cypriani
71e29f5c44 misc: fixed some typos 2014-09-15 14:18:25 +02:00
souliane
e0f8d09bf2 memory (memory): delete profile session on profile deletion 2014-06-27 20:05:31 +02:00
souliane
94d36a7d3e memory: add helper methods encryptValue and decryptValue 2014-06-25 19:01:00 +02:00
souliane
76413b3679 memory, tools (config): move special config retrieval from memory to tools 2014-06-09 20:40:13 +02:00
souliane
90115df6f1 tools: add missing file src/tools/config.py 2014-05-23 10:03:33 +02:00
souliane
c68b147398 memory: auto-update configuration file with libervia's passphrase when migrating the database 2014-05-23 09:59:15 +02:00
souliane
0d28c03d27 core, memory, bridge: added profile password + password encryption:
/!\ This changeset updates the database version to 2 and modify the database content!

Description:
    - new parameter General / Password to store the profile password
    - profile password is initialized with XMPP password value, it is stored hashed
    - bridge methods asyncCreateProfile/asyncConnect takes a new argument "password" (default = "")
    - bridge method asyncConnect returns a boolean (True = connection already established, False = connection initiated)
    - profile password is checked before initializing the XMPP connection

    - new private individual parameter to store the personal encryption key of each profile
    - personal key is randomly generated and encrypted with the profile password
    - personal key is decrypted after profile authentification and stored in a Sessions instance
    - personal key is used to encrypt/decrypt other passwords when they need to be retrieved/modified

    - modifying the profile password re-encrypt the personal key
    - Memory.setParam now returns a Deferred (the bridge method "setParam" is unchanged)
    - Memory.asyncGetParamA eventually decrypts the password, Memory.getParamA would fail on a password parameter

TODO:
    - if profile authentication is OK but XMPP authentication is KO, prompt the user for another XMPP password
    - fix the method "registerNewAccount" (and move it to a plugin)
    - remove bridge method "connect", sole "asyncConnect" should be used
2014-05-07 16:02:23 +02:00
souliane
c9f4397000 memory: add class ProfileSessions based on Sessions 2014-05-10 17:37:32 +02:00
souliane
2e6420fb49 memory, jp: added jp commands to load/save parameters template 2014-05-04 18:43:54 +02:00
Goffi
ba103161d5 core (log): refactoring + twisted backend:
- configuration is now done with classes, so inheritance is possible
    - twisted backend now use twisted log methods
    - log not produced by SàT directly in twisted backend are captured by an observer (twistedObserver) and sent back to SàT logging chain, with the "twisted" logger.
    - \\default output use normal twistd output, except in debug mode where it add an stdout output in addition to the log file.
    - when log_colors = True, colors are enabled only where it's possible (tty out), when log_colors=force colors are always enabled.
    - fixed some bad log.xxx calls
2014-05-05 18:58:34 +02:00
souliane
4b8ba7a6f4 memory: fixes the method fixLocalDir for pid_dir and log_dir to use local_dir as default 2014-04-30 19:54:21 +02:00
Goffi
501bc92528 core: use of the new core.log module:
/!\ this is a massive refactoring and was largely automated, it probably did bring some bugs /!\
2014-04-19 19:19:19 +02:00
Goffi
56ed5f13a5 core(memory): fixed last resource 2014-03-28 19:11:00 +01:00
Goffi
95678d7967 core, plugin XEP-0115: discovery refactoring:
- hashing algorithm of XEP-0115 has been including in core
    - our own hash is still calculated by XEP-0115 and can be regenerated with XEP_0115.recalculateHash
    - old discovery methods have been removed. Now the following methods are used:
        - hasFeature: tell if a feature is available for an entity
        - getDiscoInfos: self explaining
        - getDiscoItems: self explaining
        - findServiceEntities: return all available items of an entity which given (category, type)
        - findFeaturesSet: search for a set of features in entity + entity's items
      all these methods are asynchronous, and manage cache automatically
    - XEP-0115 manage in a better way hashes, and now use a trigger for presence instead of monkey patch
    - new FeatureNotFound exception, when we want to do something which is not available
    - refactored client initialisation sequence, removed client.initialized Deferred
    - added constant APP_URL
    - test_plugin_xep_0033.py has been temporarly deactivated, the time to adapt it
    - lot of cleaning
2014-03-28 18:07:22 +01:00
Goffi
382d49a628 core (memory): entities cache improvments:
- entities cache is no more limited to bare jid
    - resources are now automatically updated in bare jid cache
2014-03-28 18:07:17 +01:00
souliane
1066fdb4eb memory: bug fix the current local_dir after sat.conf is auto-updated 2014-03-24 16:43:08 +01:00
souliane
3075585d9d core, memory: use XDG recommended paths as the defaults for the config and local directories 2014-03-23 22:43:43 +01:00
Goffi
6d768028d1 core: removed default_config:
- constants in core.default_config moved to core.constants
    - removed unused host.getConst and host.setConst
    - APP_NAME* used where it make sense
2014-03-22 17:48:10 +01:00
Goffi
c67faecba1 core: added IQ_SET to core.constants + getLastResource now manage correctly jid.JID 2014-03-22 13:42:59 +01:00
Goffi
005ec59a8a core: use of Const for profile_key + replaced '@DEFAULT@' default profile_key by '@NONE@' 2014-03-21 16:27:09 +01:00
Goffi
e689f6bb34 core (memory): moved Params in its own module + introduced a new core/constants module, and moved some constants there 2014-03-21 16:08:11 +01:00
Goffi
9bd81494d1 core: minor docstring fixes 2014-03-21 15:03:51 +01:00
souliane
88baf0791b core (memory): asyncDeleteProfile can force the deletion of a profile, even if it's connected (when called from the backend only) 2014-03-03 15:37:49 +01:00
souliane
d158589881 core, frontends: add method asyncDeleteProfile, remove synchronous methods createProfile and deleteProfile 2014-03-03 09:59:10 +01:00
Goffi
7aaea47da8 core (memory): added 'no' value management in configuration's booleans 2014-02-25 23:03:13 +01:00
Goffi
a280080563 core (sqlite): automatic database update:
- new Updater class check database consistency (by calculating a hash on the .schema), and updates base if necessary
    - database now has a version (1 for current, 0 will be for 0.3's database), for each change this version will be increased
    - creation statements and update statements are in the form of dict of dict with tuples. There is a help text at the top of the module to explain how it works
    - if we are on a development version, the updater try to update the database automaticaly (without deleting table or columns). The Updater.generateUpdateData method can be used to ease the creation of update data (i.e. the dictionary at the top, see the one for the key 1 for an example).
    - if there is an inconsistency, an exception is raised, and a message indicate the SQL statements that should fix the situation.
    - well... this is rather complicated, a KISS method would maybe have been better. The future will say if we need to simplify it :-/
    - new DatabaseError exception
2014-02-23 23:30:32 +01:00
souliane
24beb81688 misc: fix unnamed arguments in format strings 2014-02-17 14:58:26 +01:00
souliane
7ea4dca1b0 memory: bug fix to not register twice frontends parameters + added some tests for param update 2014-02-07 17:10:24 +01:00
Goffi
eeff94469a core: registerNewAccount partial fix 2014-02-04 18:54:06 +01:00
Goffi
2ca6efd8cc dates update 2014-02-04 18:32:49 +01:00
Goffi
b3fb68cb63 core, frontends: XMLUI refactoring:
- XMLUI now use objects with 2 main classes: widgets (button, label, etc), and container which contain widgets according to a layout
    - widgets and containers classes are found through introspection, thereby it's really easy to add a new one
    - there is still the AddWidgetName helper, for example AddText('jid', 'test@example.net') will add a StringWidget with name "jid" and default value "test@example.net"
    - container can be inside other containers. changeContainer change the first parent container
2014-02-04 18:19:00 +01:00
souliane
78a3d845db memory: factorize the node checks in Params.__constructProfileXml 2014-01-05 07:26:41 +01:00
souliane
821f0b36ef memory: bug fix related to method paramsRegisterApp + getParams was not always returning a Deferred 2014-01-04 21:13:51 +01:00
souliane
409bbccebe memory: fixed wrong information in the docstrings for security_limit 2014-01-04 21:12:49 +01:00
souliane
4a0d8be8ec core, bridge: new method paramsRegisterApp to register frontend's specific parameters 2013-12-27 13:28:26 +01:00
Goffi
5a00dc9503 core: i18n refactoring:
- _() is no more installed in __builtin__
    - instead, there is a new sat.core.i18n module
    - added D_() method for deferred translation
    - languageSwitch method allow to dynamically change translation language
    - import gettext is tested against ImportError, and dummy methods are used when not available (mainly useful for Libervia)
2013-12-29 17:06:01 +01:00
Goffi
069a250b04 backend, frontends: callbacks refactoring:
- launchAction is now async, and return a dictionary for its result
    - no more action_id, actionResult* are deprecated
    - callback system is about to be unified
2013-12-24 15:19:08 +01:00
Goffi
3f236bbb32 core (memory): added optional profile checking in Sessions:
if profile is set in newSession, getProfile must be used instead of __getitem__, and it is checked to insure session is not used by the wrong profile
2013-12-24 15:19:08 +01:00
Goffi
1550d06922 core (memory): new Sessions management class (similar to dict) 2013-12-24 15:19:08 +01:00
Goffi
b6aaecc5c2 core, bridge: better GenericException handling 2013-12-17 00:56:39 +01:00
souliane
bbadfda25b core: bug fix for requestServerDisco in sat_main.py + added getAllServerIdentities method in memory.py 2013-12-16 14:35:26 +01:00