Mercurial > libervia-backend
comparison src/plugins/plugin_xep_0054.py @ 365:efbfccfed623
core: local_dir moved to config file
- ~/.sat.conf added to potential config file location
- removed useless profile param from getConfig
author | Goffi <goffi@goffi.org> |
---|---|
date | Sat, 18 Jun 2011 17:56:59 +0200 |
parents | 7c79d4a8c9e6 |
children | f964dcec1611 |
comparison
equal
deleted
inserted
replaced
364:312ca6f9d84a | 365:efbfccfed623 |
---|---|
39 try: | 39 try: |
40 from twisted.words.protocols.xmlstream import XMPPHandler | 40 from twisted.words.protocols.xmlstream import XMPPHandler |
41 except ImportError: | 41 except ImportError: |
42 from wokkel.subprotocols import XMPPHandler | 42 from wokkel.subprotocols import XMPPHandler |
43 | 43 |
44 AVATAR_PATH = "/avatars" | 44 AVATAR_PATH = "avatars" |
45 | 45 |
46 IQ_GET = '/iq[@type="get"]' | 46 IQ_GET = '/iq[@type="get"]' |
47 NS_VCARD = 'vcard-temp' | 47 NS_VCARD = 'vcard-temp' |
48 VCARD_REQUEST = IQ_GET + '/vCard[@xmlns="' + NS_VCARD + '"]' #TODO: manage requests | 48 VCARD_REQUEST = IQ_GET + '/vCard[@xmlns="' + NS_VCARD + '"]' #TODO: manage requests |
49 | 49 |
65 class XEP_0054(): | 65 class XEP_0054(): |
66 | 66 |
67 def __init__(self, host): | 67 def __init__(self, host): |
68 info(_("Plugin XEP_0054 initialization")) | 68 info(_("Plugin XEP_0054 initialization")) |
69 self.host = host | 69 self.host = host |
70 self.avatar_path = os.path.expanduser(self.host.get_const('local_dir') + AVATAR_PATH) | 70 self.avatar_path = os.path.join(self.host.memory.getConfig('', 'local_dir'), AVATAR_PATH) |
71 self.vcard_cache = host.memory.getPrivate("vcard_cache") or {} #used to store nicknames and avatar, key = jid | 71 self.vcard_cache = host.memory.getPrivate("vcard_cache") or {} #used to store nicknames and avatar, key = jid |
72 if not os.path.exists(self.avatar_path): | 72 if not os.path.exists(self.avatar_path): |
73 os.makedirs(self.avatar_path) | 73 os.makedirs(self.avatar_path) |
74 host.bridge.addMethod("getCard", ".communication", in_sign='ss', out_sign='s', method=self.getCard) | 74 host.bridge.addMethod("getCard", ".communication", in_sign='ss', out_sign='s', method=self.getCard) |
75 host.bridge.addMethod("getAvatarFile", ".communication", in_sign='s', out_sign='s', method=self.getAvatarFile) | 75 host.bridge.addMethod("getAvatarFile", ".communication", in_sign='s', out_sign='s', method=self.getAvatarFile) |