Mercurial > libervia-backend
comparison sat/memory/memory.py @ 3206:ae09989e9feb
core, bridge: new `devicesInfosGet` method to get infos on known devices of an entity
author | Goffi <goffi@goffi.org> |
---|---|
date | Fri, 06 Mar 2020 18:19:03 +0100 |
parents | 39d7327583e1 |
children | 6cf4bd6972c2 |
comparison
equal
deleted
inserted
replaced
3205:2c0628f3927e | 3206:ae09989e9feb |
---|---|
15 # GNU Affero General Public License for more details. | 15 # GNU Affero General Public License for more details. |
16 | 16 |
17 # You should have received a copy of the GNU Affero General Public License | 17 # You should have received a copy of the GNU Affero General Public License |
18 # along with this program. If not, see <http://www.gnu.org/licenses/>. | 18 # along with this program. If not, see <http://www.gnu.org/licenses/>. |
19 | 19 |
20 from sat.core.i18n import _ | |
21 | |
22 from sat.core.log import getLogger | |
23 | |
24 log = getLogger(__name__) | |
25 | |
26 import os.path | 20 import os.path |
27 import copy | 21 import copy |
22 import shortuuid | |
23 import mimetypes | |
24 import time | |
25 from uuid import uuid4 | |
28 from collections import namedtuple | 26 from collections import namedtuple |
29 from uuid import uuid4 | |
30 from twisted.python import failure | 27 from twisted.python import failure |
31 from twisted.internet import defer, reactor, error | 28 from twisted.internet import defer, reactor, error |
32 from twisted.words.protocols.jabber import jid | 29 from twisted.words.protocols.jabber import jid |
30 from sat.core.i18n import _ | |
31 from sat.core.log import getLogger | |
33 from sat.core import exceptions | 32 from sat.core import exceptions |
34 from sat.core.constants import Const as C | 33 from sat.core.constants import Const as C |
35 from sat.memory.sqlite import SqliteStorage | 34 from sat.memory.sqlite import SqliteStorage |
36 from sat.memory.persistent import PersistentDict | 35 from sat.memory.persistent import PersistentDict |
37 from sat.memory.params import Params | 36 from sat.memory.params import Params |
38 from sat.memory.disco import Discovery | 37 from sat.memory.disco import Discovery |
39 from sat.memory.crypto import BlockCipher | 38 from sat.memory.crypto import BlockCipher |
40 from sat.memory.crypto import PasswordHasher | 39 from sat.memory.crypto import PasswordHasher |
41 from sat.tools import config as tools_config | 40 from sat.tools import config as tools_config |
42 from sat.tools.common import data_format | 41 from sat.tools.common import data_format |
43 import shortuuid | 42 |
44 import mimetypes | 43 |
45 import time | 44 log = getLogger(__name__) |
46 | 45 |
47 | 46 |
48 PresenceTuple = namedtuple("PresenceTuple", ("show", "priority", "statuses")) | 47 PresenceTuple = namedtuple("PresenceTuple", ("show", "priority", "statuses")) |
49 MSG_NO_SESSION = "Session id doesn't exist or is finished" | 48 MSG_NO_SESSION = "Session id doesn't exist or is finished" |
50 | 49 |
688 | 687 |
689 def getAllResources(self, client, entity_jid): | 688 def getAllResources(self, client, entity_jid): |
690 """Return all resource from jid for which we have had data in this session | 689 """Return all resource from jid for which we have had data in this session |
691 | 690 |
692 @param entity_jid: bare jid of the entity | 691 @param entity_jid: bare jid of the entity |
693 return (list[unicode]): list of resources | 692 return (set[unicode]): set of resources |
694 | 693 |
695 @raise exceptions.UnknownEntityError: if entity is not in cache | 694 @raise exceptions.UnknownEntityError: if entity is not in cache |
696 @raise ValueError: entity_jid has a resource | 695 @raise ValueError: entity_jid has a resource |
697 """ | 696 """ |
698 # FIXME: is there a need to keep cache data for resources which are not connected anymore? | 697 # FIXME: is there a need to keep cache data for resources which are not connected anymore? |