Mercurial > libervia-backend
annotate sat/core/constants.py @ 2862:b2e898384c25
quick_frontend (app): progress callbacks handling:
in addition to listeners, a frontend can now register progression callback and errback which are called when the given progressing action is finished.
Those callbacks can be registered using registerProgressCbs or specified in actionManager.
author | Goffi <goffi@goffi.org> |
---|---|
date | Wed, 20 Mar 2019 09:08:47 +0100 |
parents | 4e875d9eea48 |
children | 9241f9d1f9e5 |
rev | line source |
---|---|
1934
2daf7b4c6756
use of /usr/bin/env instead of /usr/bin/python in shebang
Goffi <goffi@goffi.org>
parents:
1825
diff
changeset
|
1 #!/usr/bin/env python2 |
914
1a3ba959f0ab
core (memory): moved Params in its own module + introduced a new core/constants module, and moved some constants there
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
2 # -*- coding: utf-8 -*- |
1a3ba959f0ab
core (memory): moved Params in its own module + introduced a new core/constants module, and moved some constants there
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
3 |
1a3ba959f0ab
core (memory): moved Params in its own module + introduced a new core/constants module, and moved some constants there
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
4 # SàT: a XMPP client |
2771 | 5 # Copyright (C) 2009-2019 Jérôme Poisson (goffi@goffi.org) |
914
1a3ba959f0ab
core (memory): moved Params in its own module + introduced a new core/constants module, and moved some constants there
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
6 |
1a3ba959f0ab
core (memory): moved Params in its own module + introduced a new core/constants module, and moved some constants there
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
7 # This program is free software: you can redistribute it and/or modify |
1a3ba959f0ab
core (memory): moved Params in its own module + introduced a new core/constants module, and moved some constants there
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
8 # it under the terms of the GNU Affero General Public License as published by |
1a3ba959f0ab
core (memory): moved Params in its own module + introduced a new core/constants module, and moved some constants there
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
9 # the Free Software Foundation, either version 3 of the License, or |
1a3ba959f0ab
core (memory): moved Params in its own module + introduced a new core/constants module, and moved some constants there
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
10 # (at your option) any later version. |
1a3ba959f0ab
core (memory): moved Params in its own module + introduced a new core/constants module, and moved some constants there
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
11 |
1a3ba959f0ab
core (memory): moved Params in its own module + introduced a new core/constants module, and moved some constants there
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
12 # This program is distributed in the hope that it will be useful, |
1a3ba959f0ab
core (memory): moved Params in its own module + introduced a new core/constants module, and moved some constants there
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
1a3ba959f0ab
core (memory): moved Params in its own module + introduced a new core/constants module, and moved some constants there
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1a3ba959f0ab
core (memory): moved Params in its own module + introduced a new core/constants module, and moved some constants there
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
15 # GNU Affero General Public License for more details. |
1a3ba959f0ab
core (memory): moved Params in its own module + introduced a new core/constants module, and moved some constants there
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
16 |
1a3ba959f0ab
core (memory): moved Params in its own module + introduced a new core/constants module, and moved some constants there
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
17 # You should have received a copy of the GNU Affero General Public License |
1a3ba959f0ab
core (memory): moved Params in its own module + introduced a new core/constants module, and moved some constants there
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
18 # along with this program. If not, see <http://www.gnu.org/licenses/>. |
1a3ba959f0ab
core (memory): moved Params in its own module + introduced a new core/constants module, and moved some constants there
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
19 |
1112
e51e69b7732d
core (constants): better management of xdg import
Goffi <goffi@goffi.org>
parents:
1111
diff
changeset
|
20 try: |
e51e69b7732d
core (constants): better management of xdg import
Goffi <goffi@goffi.org>
parents:
1111
diff
changeset
|
21 from xdg import BaseDirectory |
1004
191f440d11b4
core (constants): use realpath instead of abspath + do not import it when building libervia
souliane <souliane@mailoo.org>
parents:
1003
diff
changeset
|
22 from os.path import expanduser, realpath |
1112
e51e69b7732d
core (constants): better management of xdg import
Goffi <goffi@goffi.org>
parents:
1111
diff
changeset
|
23 except ImportError: |
e51e69b7732d
core (constants): better management of xdg import
Goffi <goffi@goffi.org>
parents:
1111
diff
changeset
|
24 BaseDirectory = None |
2571
4aca060075b7
setup: version is now set in SAT/VERSION, sat is not imported anymore in setup
Goffi <goffi@goffi.org>
parents:
2565
diff
changeset
|
25 import sat |
930
cbf4122baae7
core, memory: use XDG recommended paths as the defaults for the config and local directories
souliane <souliane@mailoo.org>
parents:
926
diff
changeset
|
26 |
914
1a3ba959f0ab
core (memory): moved Params in its own module + introduced a new core/constants module, and moved some constants there
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
27 |
1a3ba959f0ab
core (memory): moved Params in its own module + introduced a new core/constants module, and moved some constants there
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
28 class Const(object): |
942
598fc223cf59
core: more organisation in constants.py
Goffi <goffi@goffi.org>
parents:
930
diff
changeset
|
29 |
598fc223cf59
core: more organisation in constants.py
Goffi <goffi@goffi.org>
parents:
930
diff
changeset
|
30 ## Application ## |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
31 APP_NAME = u"Salut à Toi" |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
32 APP_NAME_SHORT = u"SàT" |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
33 APP_NAME_FILE = u"sat" |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
34 APP_NAME_FULL = u"{name_short} ({name})".format( |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
35 name_short=APP_NAME_SHORT, name=APP_NAME |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
36 ) |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
37 APP_VERSION = ( |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
38 sat.__version__ |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
39 ) # Please add 'D' at the end of version in sat/VERSION for dev versions |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
40 APP_RELEASE_NAME = u"La Commune" |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
41 APP_URL = u"https://salut-a-toi.org" |
994
652c01ca69b1
core (log): configuration and environment variables are now checked for log level and colors:
Goffi <goffi@goffi.org>
parents:
991
diff
changeset
|
42 |
2105
c96fe007ca41
core(constants): added a constant for profile extension (PLUGIN_EXT):
Goffi <goffi@goffi.org>
parents:
2089
diff
changeset
|
43 ## Runtime ## |
c96fe007ca41
core(constants): added a constant for profile extension (PLUGIN_EXT):
Goffi <goffi@goffi.org>
parents:
2089
diff
changeset
|
44 PLUGIN_EXT = "py" |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
45 HISTORY_SKIP = u"skip" |
2105
c96fe007ca41
core(constants): added a constant for profile extension (PLUGIN_EXT):
Goffi <goffi@goffi.org>
parents:
2089
diff
changeset
|
46 |
c96fe007ca41
core(constants): added a constant for profile extension (PLUGIN_EXT):
Goffi <goffi@goffi.org>
parents:
2089
diff
changeset
|
47 ## Main config ## |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
48 DEFAULT_BRIDGE = "dbus" |
2088
c02f96756d5c
core: bridge can now be changed in conf
Goffi <goffi@goffi.org>
parents:
2035
diff
changeset
|
49 |
2105
c96fe007ca41
core(constants): added a constant for profile extension (PLUGIN_EXT):
Goffi <goffi@goffi.org>
parents:
2089
diff
changeset
|
50 ## Protocol ## |
1089
8e0072754413
core, plugins, stdui, frontends: fixes handling of "Force server" and "Force port" parameters:
souliane <souliane@mailoo.org>
parents:
1088
diff
changeset
|
51 XMPP_C2S_PORT = 5222 |
2691
1ecceac3df96
plugin XEP-0198: Stream Management implementation:
Goffi <goffi@goffi.org>
parents:
2684
diff
changeset
|
52 XMPP_MAX_RETRIES = None |
2144
1d3f73e065e1
core, jp: component handling + client handling refactoring:
Goffi <goffi@goffi.org>
parents:
2132
diff
changeset
|
53 # default port used on Prosody, may differ on other servers |
1d3f73e065e1
core, jp: component handling + client handling refactoring:
Goffi <goffi@goffi.org>
parents:
2132
diff
changeset
|
54 XMPP_COMPONENT_PORT = 5347 |
1089
8e0072754413
core, plugins, stdui, frontends: fixes handling of "Force server" and "Force port" parameters:
souliane <souliane@mailoo.org>
parents:
1088
diff
changeset
|
55 |
942
598fc223cf59
core: more organisation in constants.py
Goffi <goffi@goffi.org>
parents:
930
diff
changeset
|
56 ## Parameters ## |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
57 NO_SECURITY_LIMIT = -1 # FIXME: to rename |
2126 | 58 SECURITY_LIMIT_MAX = 0 |
942
598fc223cf59
core: more organisation in constants.py
Goffi <goffi@goffi.org>
parents:
930
diff
changeset
|
59 INDIVIDUAL = "individual" |
598fc223cf59
core: more organisation in constants.py
Goffi <goffi@goffi.org>
parents:
930
diff
changeset
|
60 GENERAL = "general" |
1222
e6e0ea4dc835
memory: add Parameter "Chat history limit"
souliane <souliane@mailoo.org>
parents:
1211
diff
changeset
|
61 # General parameters |
e6e0ea4dc835
memory: add Parameter "Chat history limit"
souliane <souliane@mailoo.org>
parents:
1211
diff
changeset
|
62 HISTORY_LIMIT = "History" |
1227
4da2e4d58bd0
memory (params): add parameters "Show offline contacts" and "Show empty groups"
souliane <souliane@mailoo.org>
parents:
1222
diff
changeset
|
63 SHOW_OFFLINE_CONTACTS = "Offline contacts" |
4da2e4d58bd0
memory (params): add parameters "Show offline contacts" and "Show empty groups"
souliane <souliane@mailoo.org>
parents:
1222
diff
changeset
|
64 SHOW_EMPTY_GROUPS = "Empty groups" |
1088
b29452cab50b
core, memory, plugins, stdui, frontends: look for DNS SRV records when server is not specified:
souliane <souliane@mailoo.org>
parents:
1043
diff
changeset
|
65 # Parameters related to connection |
b29452cab50b
core, memory, plugins, stdui, frontends: look for DNS SRV records when server is not specified:
souliane <souliane@mailoo.org>
parents:
1043
diff
changeset
|
66 FORCE_SERVER_PARAM = "Force server" |
b29452cab50b
core, memory, plugins, stdui, frontends: look for DNS SRV records when server is not specified:
souliane <souliane@mailoo.org>
parents:
1043
diff
changeset
|
67 FORCE_PORT_PARAM = "Force port" |
1030
15f43b54d697
core, memory, bridge: added profile password + password encryption:
souliane <souliane@mailoo.org>
parents:
1020
diff
changeset
|
68 # Parameters related to encryption |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
69 PROFILE_PASS_PATH = ("General", "Password") |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
70 MEMORY_CRYPTO_NAMESPACE = "crypto" # for the private persistent binary dict |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
71 MEMORY_CRYPTO_KEY = "personal_key" |
1020
adbde4a3a52f
plugin misc_static_blog: renamed from tmp_blog_banner, now also with page's title, meta keywords and description
souliane <souliane@mailoo.org>
parents:
1017
diff
changeset
|
72 # Parameters for static blog pages |
2126 | 73 # FIXME: blog constants should not be in core constants |
1020
adbde4a3a52f
plugin misc_static_blog: renamed from tmp_blog_banner, now also with page's title, meta keywords and description
souliane <souliane@mailoo.org>
parents:
1017
diff
changeset
|
74 STATIC_BLOG_KEY = "Blog page" |
adbde4a3a52f
plugin misc_static_blog: renamed from tmp_blog_banner, now also with page's title, meta keywords and description
souliane <souliane@mailoo.org>
parents:
1017
diff
changeset
|
75 STATIC_BLOG_PARAM_TITLE = "Title" |
adbde4a3a52f
plugin misc_static_blog: renamed from tmp_blog_banner, now also with page's title, meta keywords and description
souliane <souliane@mailoo.org>
parents:
1017
diff
changeset
|
76 STATIC_BLOG_PARAM_BANNER = "Banner" |
adbde4a3a52f
plugin misc_static_blog: renamed from tmp_blog_banner, now also with page's title, meta keywords and description
souliane <souliane@mailoo.org>
parents:
1017
diff
changeset
|
77 STATIC_BLOG_PARAM_KEYWORDS = "Keywords" |
adbde4a3a52f
plugin misc_static_blog: renamed from tmp_blog_banner, now also with page's title, meta keywords and description
souliane <souliane@mailoo.org>
parents:
1017
diff
changeset
|
78 STATIC_BLOG_PARAM_DESCRIPTION = "Description" |
942
598fc223cf59
core: more organisation in constants.py
Goffi <goffi@goffi.org>
parents:
930
diff
changeset
|
79 |
1092
0eefc74c346b
core (menus): constants are used for menu types
Goffi <goffi@goffi.org>
parents:
1089
diff
changeset
|
80 ## Menus ## |
0eefc74c346b
core (menus): constants are used for menu types
Goffi <goffi@goffi.org>
parents:
1089
diff
changeset
|
81 MENU_GLOBAL = "GLOBAL" |
0eefc74c346b
core (menus): constants are used for menu types
Goffi <goffi@goffi.org>
parents:
1089
diff
changeset
|
82 MENU_ROOM = "ROOM" |
0eefc74c346b
core (menus): constants are used for menu types
Goffi <goffi@goffi.org>
parents:
1089
diff
changeset
|
83 MENU_SINGLE = "SINGLE" |
0eefc74c346b
core (menus): constants are used for menu types
Goffi <goffi@goffi.org>
parents:
1089
diff
changeset
|
84 MENU_JID_CONTEXT = "JID_CONTEXT" |
0eefc74c346b
core (menus): constants are used for menu types
Goffi <goffi@goffi.org>
parents:
1089
diff
changeset
|
85 MENU_ROSTER_JID_CONTEXT = "ROSTER_JID_CONTEXT" |
0eefc74c346b
core (menus): constants are used for menu types
Goffi <goffi@goffi.org>
parents:
1089
diff
changeset
|
86 MENU_ROSTER_GROUP_CONTEXT = "MENU_ROSTER_GROUP_CONTEXT" |
1357
f296a54af386
core (constants): add menu type MENU_ROOM_OCCUPANT_CONTEXT
souliane <souliane@mailoo.org>
parents:
1298
diff
changeset
|
87 MENU_ROOM_OCCUPANT_CONTEXT = "MENU_ROOM_OCCUPANT_CONTEXT" |
1092
0eefc74c346b
core (menus): constants are used for menu types
Goffi <goffi@goffi.org>
parents:
1089
diff
changeset
|
88 |
942
598fc223cf59
core: more organisation in constants.py
Goffi <goffi@goffi.org>
parents:
930
diff
changeset
|
89 ## Profile and entities ## |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
90 PROF_KEY_NONE = "@NONE@" |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
91 PROF_KEY_DEFAULT = "@DEFAULT@" |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
92 PROF_KEY_ALL = "@ALL@" |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
93 ENTITY_ALL = "@ALL@" |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
94 ENTITY_ALL_RESOURCES = "@ALL_RESOURCES@" |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
95 ENTITY_MAIN_RESOURCE = "@MAIN_RESOURCE@" |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
96 ENTITY_CAP_HASH = "CAP_HASH" |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
97 ENTITY_TYPE = "TYPE" |
1520
9667103a0c10
core (contants): added PROF_KEY_ALL en PLUG_TYPE_* constants
Goffi <goffi@goffi.org>
parents:
1459
diff
changeset
|
98 |
1450
7797dda847ae
plugins xep-0277, groupblog: added subscriteToMany to replace massiveSubscribeGroupBlogs + added SatRosterProtocol.getJidsSet
Goffi <goffi@goffi.org>
parents:
1448
diff
changeset
|
99 ## Roster jids selection ## |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
100 PUBLIC = "PUBLIC" |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
101 ALL = ( |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
102 "ALL" |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
103 ) # ALL means all known contacts, while PUBLIC means everybody, known or not |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
104 GROUP = "GROUP" |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
105 JID = "JID" |
994
652c01ca69b1
core (log): configuration and environment variables are now checked for log level and colors:
Goffi <goffi@goffi.org>
parents:
991
diff
changeset
|
106 |
1171
0abce7f17782
core: a new "info" type is used in newMessage for system messages (not comming from outside)
Goffi <goffi@goffi.org>
parents:
1143
diff
changeset
|
107 ## Messages ## |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
108 MESS_TYPE_INFO = "info" |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
109 MESS_TYPE_CHAT = "chat" |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
110 MESS_TYPE_ERROR = "error" |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
111 MESS_TYPE_GROUPCHAT = "groupchat" |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
112 MESS_TYPE_HEADLINE = "headline" |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
113 MESS_TYPE_NORMAL = "normal" |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
114 MESS_TYPE_AUTO = "auto" # magic value to let the backend guess the type |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
115 MESS_TYPE_STANDARD = ( |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
116 MESS_TYPE_CHAT, |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
117 MESS_TYPE_ERROR, |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
118 MESS_TYPE_GROUPCHAT, |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
119 MESS_TYPE_HEADLINE, |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
120 MESS_TYPE_NORMAL, |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
121 ) |
1963
a2bc5089c2eb
backend, frontends: message refactoring (huge commit):
Goffi <goffi@goffi.org>
parents:
1959
diff
changeset
|
122 MESS_TYPE_ALL = MESS_TYPE_STANDARD + (MESS_TYPE_INFO, MESS_TYPE_AUTO) |
a2bc5089c2eb
backend, frontends: message refactoring (huge commit):
Goffi <goffi@goffi.org>
parents:
1959
diff
changeset
|
123 |
2752
1fa615faec8b
core (constants): added a constant for "encrypted"
Goffi <goffi@goffi.org>
parents:
2694
diff
changeset
|
124 MESS_EXTRA_INFO = u"info_type" |
1fa615faec8b
core (constants): added a constant for "encrypted"
Goffi <goffi@goffi.org>
parents:
2694
diff
changeset
|
125 EXTRA_INFO_DECR_ERR = u"DECRYPTION_ERROR" |
2859
4e875d9eea48
plugin XEP-0384: give feedback to client when encryption failed
Goffi <goffi@goffi.org>
parents:
2771
diff
changeset
|
126 EXTRA_INFO_ENCR_ERR = u"ENCRYPTION_ERROR" |
1263 | 127 |
2752
1fa615faec8b
core (constants): added a constant for "encrypted"
Goffi <goffi@goffi.org>
parents:
2694
diff
changeset
|
128 # encryption is a key for plugins |
1fa615faec8b
core (constants): added a constant for "encrypted"
Goffi <goffi@goffi.org>
parents:
2694
diff
changeset
|
129 MESS_KEY_ENCRYPTION = u"ENCRYPTION" |
1fa615faec8b
core (constants): added a constant for "encrypted"
Goffi <goffi@goffi.org>
parents:
2694
diff
changeset
|
130 # encrypted is a key for frontends |
1fa615faec8b
core (constants): added a constant for "encrypted"
Goffi <goffi@goffi.org>
parents:
2694
diff
changeset
|
131 MESS_KEY_ENCRYPTED = u"encrypted" |
1fa615faec8b
core (constants): added a constant for "encrypted"
Goffi <goffi@goffi.org>
parents:
2694
diff
changeset
|
132 MESS_KEY_TRUSTED = u"trusted" |
2646
712cb4ff3e13
core: new EncryptionHandler class which manage encrypted session as a core feature:
Goffi <goffi@goffi.org>
parents:
2628
diff
changeset
|
133 |
2460
feaacc462fef
core: moved CHAT_* constants from frontends to core constants + uses constants for MESS_TYPE_* in sendMessage
Goffi <goffi@goffi.org>
parents:
2414
diff
changeset
|
134 ## Chat ## |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
135 CHAT_ONE2ONE = "one2one" |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
136 CHAT_GROUP = "group" |
2460
feaacc462fef
core: moved CHAT_* constants from frontends to core constants + uses constants for MESS_TYPE_* in sendMessage
Goffi <goffi@goffi.org>
parents:
2414
diff
changeset
|
137 |
1776
4fc1bf1af48f
plugin XEP-0313: cleaning and improvments:
Goffi <goffi@goffi.org>
parents:
1766
diff
changeset
|
138 ## Presence ## |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
139 PRESENCE_UNAVAILABLE = "unavailable" |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
140 PRESENCE_SHOW_AWAY = "away" |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
141 PRESENCE_SHOW_CHAT = "chat" |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
142 PRESENCE_SHOW_DND = "dnd" |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
143 PRESENCE_SHOW_XA = "xa" |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
144 PRESENCE_SHOW = "show" |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
145 PRESENCE_STATUSES = "statuses" |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
146 PRESENCE_STATUSES_DEFAULT = "default" |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
147 PRESENCE_PRIORITY = "priority" |
1171
0abce7f17782
core: a new "info" type is used in newMessage for system messages (not comming from outside)
Goffi <goffi@goffi.org>
parents:
1143
diff
changeset
|
148 |
1776
4fc1bf1af48f
plugin XEP-0313: cleaning and improvments:
Goffi <goffi@goffi.org>
parents:
1766
diff
changeset
|
149 ## Common namespaces ## |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
150 NS_XML = "http://www.w3.org/XML/1998/namespace" |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
151 NS_CLIENT = "jabber:client" |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
152 NS_FORWARD = "urn:xmpp:forward:0" |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
153 NS_DELAY = "urn:xmpp:delay" |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
154 NS_XHTML = "http://www.w3.org/1999/xhtml" |
1776
4fc1bf1af48f
plugin XEP-0313: cleaning and improvments:
Goffi <goffi@goffi.org>
parents:
1766
diff
changeset
|
155 |
2494
d1df08c79a5d
core (constants): new constants to handle files, progress, component, permissions (will be used in the upcoming patches)
Goffi <goffi@goffi.org>
parents:
2483
diff
changeset
|
156 ## Common XPath ## |
d1df08c79a5d
core (constants): new constants to handle files, progress, component, permissions (will be used in the upcoming patches)
Goffi <goffi@goffi.org>
parents:
2483
diff
changeset
|
157 |
d1df08c79a5d
core (constants): new constants to handle files, progress, component, permissions (will be used in the upcoming patches)
Goffi <goffi@goffi.org>
parents:
2483
diff
changeset
|
158 IQ_GET = '/iq[@type="get"]' |
d1df08c79a5d
core (constants): new constants to handle files, progress, component, permissions (will be used in the upcoming patches)
Goffi <goffi@goffi.org>
parents:
2483
diff
changeset
|
159 IQ_SET = '/iq[@type="set"]' |
d1df08c79a5d
core (constants): new constants to handle files, progress, component, permissions (will be used in the upcoming patches)
Goffi <goffi@goffi.org>
parents:
2483
diff
changeset
|
160 |
2109
85f3e12e984d
core (memory/cache): file caching handling, first draft:
Goffi <goffi@goffi.org>
parents:
2105
diff
changeset
|
161 ## Directories ## |
2494
d1df08c79a5d
core (constants): new constants to handle files, progress, component, permissions (will be used in the upcoming patches)
Goffi <goffi@goffi.org>
parents:
2483
diff
changeset
|
162 |
d1df08c79a5d
core (constants): new constants to handle files, progress, component, permissions (will be used in the upcoming patches)
Goffi <goffi@goffi.org>
parents:
2483
diff
changeset
|
163 # directory for components specific data |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
164 COMPONENTS_DIR = u"components" |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
165 CACHE_DIR = u"cache" |
2494
d1df08c79a5d
core (constants): new constants to handle files, progress, component, permissions (will be used in the upcoming patches)
Goffi <goffi@goffi.org>
parents:
2483
diff
changeset
|
166 # files in file dir are stored for long term |
d1df08c79a5d
core (constants): new constants to handle files, progress, component, permissions (will be used in the upcoming patches)
Goffi <goffi@goffi.org>
parents:
2483
diff
changeset
|
167 # files dir is global, i.e. for all profiles |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
168 FILES_DIR = u"files" |
2494
d1df08c79a5d
core (constants): new constants to handle files, progress, component, permissions (will be used in the upcoming patches)
Goffi <goffi@goffi.org>
parents:
2483
diff
changeset
|
169 # FILES_LINKS_DIR is a directory where files owned by a specific profile |
d1df08c79a5d
core (constants): new constants to handle files, progress, component, permissions (will be used in the upcoming patches)
Goffi <goffi@goffi.org>
parents:
2483
diff
changeset
|
170 # are linked to the global files directory. This way the directory can be |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
171 # shared per profiles while keeping global directory where identical files |
2494
d1df08c79a5d
core (constants): new constants to handle files, progress, component, permissions (will be used in the upcoming patches)
Goffi <goffi@goffi.org>
parents:
2483
diff
changeset
|
172 # shared between different profiles are not duplicated. |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
173 FILES_LINKS_DIR = u"files_links" |
2494
d1df08c79a5d
core (constants): new constants to handle files, progress, component, permissions (will be used in the upcoming patches)
Goffi <goffi@goffi.org>
parents:
2483
diff
changeset
|
174 # FILES_TMP_DIR is where profile's partially transfered files are put. |
d1df08c79a5d
core (constants): new constants to handle files, progress, component, permissions (will be used in the upcoming patches)
Goffi <goffi@goffi.org>
parents:
2483
diff
changeset
|
175 # Once transfer is completed, they are moved to FILES_DIR |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
176 FILES_TMP_DIR = u"files_tmp" |
1776
4fc1bf1af48f
plugin XEP-0313: cleaning and improvments:
Goffi <goffi@goffi.org>
parents:
1766
diff
changeset
|
177 |
994
652c01ca69b1
core (log): configuration and environment variables are now checked for log level and colors:
Goffi <goffi@goffi.org>
parents:
991
diff
changeset
|
178 ## Configuration ## |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
179 if ( |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
180 BaseDirectory |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
181 ): # skipped when xdg module is not available (should not happen in backend) |
2684
a7529543bbb1
core: fixed package name for Android
Goffi <goffi@goffi.org>
parents:
2671
diff
changeset
|
182 if "org.salutatoi.cagou" in BaseDirectory.__file__: |
2089
0931b5a6213c
core, quick_frontends: android compatibility hacks:
Goffi <goffi@goffi.org>
parents:
2088
diff
changeset
|
183 # FIXME: hack to make config read from the right location on Android |
0931b5a6213c
core, quick_frontends: android compatibility hacks:
Goffi <goffi@goffi.org>
parents:
2088
diff
changeset
|
184 # TODO: fix it in a more proper way |
2591
86e57108bd50
core (constants): new downloads_dir config option (default path where files can be downloaded):
Goffi <goffi@goffi.org>
parents:
2578
diff
changeset
|
185 |
86e57108bd50
core (constants): new downloads_dir config option (default path where files can be downloaded):
Goffi <goffi@goffi.org>
parents:
2578
diff
changeset
|
186 # we need to use Android API to get downloads directory |
86e57108bd50
core (constants): new downloads_dir config option (default path where files can be downloaded):
Goffi <goffi@goffi.org>
parents:
2578
diff
changeset
|
187 import os.path |
86e57108bd50
core (constants): new downloads_dir config option (default path where files can be downloaded):
Goffi <goffi@goffi.org>
parents:
2578
diff
changeset
|
188 from jnius import autoclass |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
189 |
2591
86e57108bd50
core (constants): new downloads_dir config option (default path where files can be downloaded):
Goffi <goffi@goffi.org>
parents:
2578
diff
changeset
|
190 Environment = autoclass("android.os.Environment") |
86e57108bd50
core (constants): new downloads_dir config option (default path where files can be downloaded):
Goffi <goffi@goffi.org>
parents:
2578
diff
changeset
|
191 |
2089
0931b5a6213c
core, quick_frontends: android compatibility hacks:
Goffi <goffi@goffi.org>
parents:
2088
diff
changeset
|
192 BaseDirectory = None |
0931b5a6213c
core, quick_frontends: android compatibility hacks:
Goffi <goffi@goffi.org>
parents:
2088
diff
changeset
|
193 DEFAULT_CONFIG = { |
2684
a7529543bbb1
core: fixed package name for Android
Goffi <goffi@goffi.org>
parents:
2671
diff
changeset
|
194 "local_dir": "/data/data/org.salutatoi.cagou/app", |
a7529543bbb1
core: fixed package name for Android
Goffi <goffi@goffi.org>
parents:
2671
diff
changeset
|
195 "media_dir": "/data/data/org.salutatoi.cagou/files/app/media", |
2591
86e57108bd50
core (constants): new downloads_dir config option (default path where files can be downloaded):
Goffi <goffi@goffi.org>
parents:
2578
diff
changeset
|
196 # FIXME: temporary location for downloads, need to call API properly |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
197 "downloads_dir": os.path.join( |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
198 Environment.getExternalStoragePublicDirectory( |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
199 Environment.DIRECTORY_DOWNLOADS |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
200 ).getAbsolutePath(), |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
201 APP_NAME_FILE, |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
202 ), |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
203 "pid_dir": "%(local_dir)s", |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
204 "log_dir": "%(local_dir)s", |
2089
0931b5a6213c
core, quick_frontends: android compatibility hacks:
Goffi <goffi@goffi.org>
parents:
2088
diff
changeset
|
205 } |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
206 CONFIG_FILES = [ |
2684
a7529543bbb1
core: fixed package name for Android
Goffi <goffi@goffi.org>
parents:
2671
diff
changeset
|
207 "/data/data/org.salutatoi.cagou/files/app/android/" |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
208 + APP_NAME_FILE |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
209 + ".conf" |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
210 ] |
2089
0931b5a6213c
core, quick_frontends: android compatibility hacks:
Goffi <goffi@goffi.org>
parents:
2088
diff
changeset
|
211 else: |
942
598fc223cf59
core: more organisation in constants.py
Goffi <goffi@goffi.org>
parents:
930
diff
changeset
|
212 |
2089
0931b5a6213c
core, quick_frontends: android compatibility hacks:
Goffi <goffi@goffi.org>
parents:
2088
diff
changeset
|
213 ## Configuration ## |
0931b5a6213c
core, quick_frontends: android compatibility hacks:
Goffi <goffi@goffi.org>
parents:
2088
diff
changeset
|
214 DEFAULT_CONFIG = { |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
215 "media_dir": "/usr/share/" + APP_NAME_FILE + "/media", |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
216 "local_dir": BaseDirectory.save_data_path(APP_NAME_FILE), |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
217 "downloads_dir": "~/Downloads/" + APP_NAME_FILE, |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
218 "pid_dir": "%(local_dir)s", |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
219 "log_dir": "%(local_dir)s", |
2089
0931b5a6213c
core, quick_frontends: android compatibility hacks:
Goffi <goffi@goffi.org>
parents:
2088
diff
changeset
|
220 } |
923 | 221 |
2089
0931b5a6213c
core, quick_frontends: android compatibility hacks:
Goffi <goffi@goffi.org>
parents:
2088
diff
changeset
|
222 # List of the configuration filenames sorted by ascending priority |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
223 CONFIG_FILES = [ |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
224 realpath(expanduser(path) + APP_NAME_FILE + ".conf") |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
225 for path in ["/etc/", "~/", "~/.", "", "."] |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
226 + [ |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
227 "%s/" % path |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
228 for path in list(BaseDirectory.load_config_paths(APP_NAME_FILE)) |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
229 ] |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
230 ] |
994
652c01ca69b1
core (log): configuration and environment variables are now checked for log level and colors:
Goffi <goffi@goffi.org>
parents:
991
diff
changeset
|
231 |
2169
f472179305a1
tools(templates): workflow improvments:
Goffi <goffi@goffi.org>
parents:
2154
diff
changeset
|
232 ## Templates ## |
2671
0fa217fafabf
tools (common/template), jp: refactoring to handle multiple sites:
Goffi <goffi@goffi.org>
parents:
2646
diff
changeset
|
233 TEMPLATE_TPL_DIR = u"templates" |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
234 TEMPLATE_THEME_DEFAULT = u"default" |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
235 TEMPLATE_STATIC_DIR = u"static" |
926
d609581bf74a
plugin text commands: refactoring, text now only contain main commands, and other plugin can add commands themselve:
Goffi <goffi@goffi.org>
parents:
923
diff
changeset
|
236 |
942
598fc223cf59
core: more organisation in constants.py
Goffi <goffi@goffi.org>
parents:
930
diff
changeset
|
237 ## Plugins ## |
1520
9667103a0c10
core (contants): added PROF_KEY_ALL en PLUG_TYPE_* constants
Goffi <goffi@goffi.org>
parents:
1459
diff
changeset
|
238 |
2144
1d3f73e065e1
core, jp: component handling + client handling refactoring:
Goffi <goffi@goffi.org>
parents:
2132
diff
changeset
|
239 # PLUGIN_INFO keys |
1d3f73e065e1
core, jp: component handling + client handling refactoring:
Goffi <goffi@goffi.org>
parents:
2132
diff
changeset
|
240 # XXX: we use PI instead of PLUG_INFO which would normally be used |
1d3f73e065e1
core, jp: component handling + client handling refactoring:
Goffi <goffi@goffi.org>
parents:
2132
diff
changeset
|
241 # to make the header more readable |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
242 PI_NAME = u"name" |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
243 PI_IMPORT_NAME = u"import_name" |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
244 PI_MAIN = u"main" |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
245 PI_HANDLER = u"handler" |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
246 PI_TYPE = ( |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
247 u"type" |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
248 ) # FIXME: should be types, and should handle single unicode type or tuple of types (e.g. "blog" and "import") |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
249 PI_MODES = u"modes" |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
250 PI_PROTOCOLS = u"protocols" |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
251 PI_DEPENDENCIES = u"dependencies" |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
252 PI_RECOMMENDATIONS = u"recommendations" |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
253 PI_DESCRIPTION = u"description" |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
254 PI_USAGE = u"usage" |
2144
1d3f73e065e1
core, jp: component handling + client handling refactoring:
Goffi <goffi@goffi.org>
parents:
2132
diff
changeset
|
255 |
1520
9667103a0c10
core (contants): added PROF_KEY_ALL en PLUG_TYPE_* constants
Goffi <goffi@goffi.org>
parents:
1459
diff
changeset
|
256 # Types |
9667103a0c10
core (contants): added PROF_KEY_ALL en PLUG_TYPE_* constants
Goffi <goffi@goffi.org>
parents:
1459
diff
changeset
|
257 PLUG_TYPE_XEP = "XEP" |
9667103a0c10
core (contants): added PROF_KEY_ALL en PLUG_TYPE_* constants
Goffi <goffi@goffi.org>
parents:
1459
diff
changeset
|
258 PLUG_TYPE_MISC = "MISC" |
9667103a0c10
core (contants): added PROF_KEY_ALL en PLUG_TYPE_* constants
Goffi <goffi@goffi.org>
parents:
1459
diff
changeset
|
259 PLUG_TYPE_EXP = "EXP" |
9667103a0c10
core (contants): added PROF_KEY_ALL en PLUG_TYPE_* constants
Goffi <goffi@goffi.org>
parents:
1459
diff
changeset
|
260 PLUG_TYPE_SEC = "SEC" |
1806
fd788d24277a
plugin syntax dc_wiki: first draft:
Goffi <goffi@goffi.org>
parents:
1776
diff
changeset
|
261 PLUG_TYPE_SYNTAXE = "SYNTAXE" |
1825
4e51f21c687f
plugin blog import: this plugin is the base handling blog importers:
Goffi <goffi@goffi.org>
parents:
1822
diff
changeset
|
262 PLUG_TYPE_BLOG = "BLOG" |
2369
cdaa58e14553
plugin import: generic data import plugin:
Goffi <goffi@goffi.org>
parents:
2305
diff
changeset
|
263 PLUG_TYPE_IMPORT = "IMPORT" |
2144
1d3f73e065e1
core, jp: component handling + client handling refactoring:
Goffi <goffi@goffi.org>
parents:
2132
diff
changeset
|
264 PLUG_TYPE_ENTRY_POINT = "ENTRY_POINT" |
1520
9667103a0c10
core (contants): added PROF_KEY_ALL en PLUG_TYPE_* constants
Goffi <goffi@goffi.org>
parents:
1459
diff
changeset
|
265 |
2144
1d3f73e065e1
core, jp: component handling + client handling refactoring:
Goffi <goffi@goffi.org>
parents:
2132
diff
changeset
|
266 # Modes |
1d3f73e065e1
core, jp: component handling + client handling refactoring:
Goffi <goffi@goffi.org>
parents:
2132
diff
changeset
|
267 PLUG_MODE_CLIENT = "client" |
1d3f73e065e1
core, jp: component handling + client handling refactoring:
Goffi <goffi@goffi.org>
parents:
2132
diff
changeset
|
268 PLUG_MODE_COMPONENT = "component" |
1d3f73e065e1
core, jp: component handling + client handling refactoring:
Goffi <goffi@goffi.org>
parents:
2132
diff
changeset
|
269 PLUG_MODE_DEFAULT = (PLUG_MODE_CLIENT,) |
2494
d1df08c79a5d
core (constants): new constants to handle files, progress, component, permissions (will be used in the upcoming patches)
Goffi <goffi@goffi.org>
parents:
2483
diff
changeset
|
270 PLUG_MODE_BOTH = (PLUG_MODE_CLIENT, PLUG_MODE_COMPONENT) |
1520
9667103a0c10
core (contants): added PROF_KEY_ALL en PLUG_TYPE_* constants
Goffi <goffi@goffi.org>
parents:
1459
diff
changeset
|
271 |
926
d609581bf74a
plugin text commands: refactoring, text now only contain main commands, and other plugin can add commands themselve:
Goffi <goffi@goffi.org>
parents:
923
diff
changeset
|
272 # names of widely used plugins |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
273 TEXT_CMDS = "TEXT-COMMANDS" |
942
598fc223cf59
core: more organisation in constants.py
Goffi <goffi@goffi.org>
parents:
930
diff
changeset
|
274 |
1459
4c4f88d7b156
plugins xep-0060, xep-0163, xep-0277, groupblog: bloging improvments (huge patch, sorry):
Goffi <goffi@goffi.org>
parents:
1454
diff
changeset
|
275 # PubSub event categories |
4c4f88d7b156
plugins xep-0060, xep-0163, xep-0277, groupblog: bloging improvments (huge patch, sorry):
Goffi <goffi@goffi.org>
parents:
1454
diff
changeset
|
276 PS_PEP = "PEP" |
4c4f88d7b156
plugins xep-0060, xep-0163, xep-0277, groupblog: bloging improvments (huge patch, sorry):
Goffi <goffi@goffi.org>
parents:
1454
diff
changeset
|
277 PS_MICROBLOG = "MICROBLOG" |
4c4f88d7b156
plugins xep-0060, xep-0163, xep-0277, groupblog: bloging improvments (huge patch, sorry):
Goffi <goffi@goffi.org>
parents:
1454
diff
changeset
|
278 |
4c4f88d7b156
plugins xep-0060, xep-0163, xep-0277, groupblog: bloging improvments (huge patch, sorry):
Goffi <goffi@goffi.org>
parents:
1454
diff
changeset
|
279 # PubSub |
4c4f88d7b156
plugins xep-0060, xep-0163, xep-0277, groupblog: bloging improvments (huge patch, sorry):
Goffi <goffi@goffi.org>
parents:
1454
diff
changeset
|
280 PS_PUBLISH = "publish" |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
281 PS_RETRACT = "retract" # used for items |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
282 PS_DELETE = "delete" # used for nodes |
1459
4c4f88d7b156
plugins xep-0060, xep-0163, xep-0277, groupblog: bloging improvments (huge patch, sorry):
Goffi <goffi@goffi.org>
parents:
1454
diff
changeset
|
283 PS_ITEM = "item" |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
284 PS_ITEMS = "items" # Can contain publish and retract items |
1459
4c4f88d7b156
plugins xep-0060, xep-0163, xep-0277, groupblog: bloging improvments (huge patch, sorry):
Goffi <goffi@goffi.org>
parents:
1454
diff
changeset
|
285 PS_EVENTS = (PS_ITEMS, PS_DELETE) |
4c4f88d7b156
plugins xep-0060, xep-0163, xep-0277, groupblog: bloging improvments (huge patch, sorry):
Goffi <goffi@goffi.org>
parents:
1454
diff
changeset
|
286 |
1104
490a8a4536b6
core (constants): added constants mainly used in XMLUI
Goffi <goffi@goffi.org>
parents:
1092
diff
changeset
|
287 ## XMLUI ## |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
288 XMLUI_WINDOW = "window" |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
289 XMLUI_POPUP = "popup" |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
290 XMLUI_FORM = "form" |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
291 XMLUI_PARAM = "param" |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
292 XMLUI_DIALOG = "dialog" |
1104
490a8a4536b6
core (constants): added constants mainly used in XMLUI
Goffi <goffi@goffi.org>
parents:
1092
diff
changeset
|
293 XMLUI_DIALOG_CONFIRM = "confirm" |
490a8a4536b6
core (constants): added constants mainly used in XMLUI
Goffi <goffi@goffi.org>
parents:
1092
diff
changeset
|
294 XMLUI_DIALOG_MESSAGE = "message" |
490a8a4536b6
core (constants): added constants mainly used in XMLUI
Goffi <goffi@goffi.org>
parents:
1092
diff
changeset
|
295 XMLUI_DIALOG_NOTE = "note" |
490a8a4536b6
core (constants): added constants mainly used in XMLUI
Goffi <goffi@goffi.org>
parents:
1092
diff
changeset
|
296 XMLUI_DIALOG_FILE = "file" |
490a8a4536b6
core (constants): added constants mainly used in XMLUI
Goffi <goffi@goffi.org>
parents:
1092
diff
changeset
|
297 XMLUI_DATA_ANSWER = "answer" |
490a8a4536b6
core (constants): added constants mainly used in XMLUI
Goffi <goffi@goffi.org>
parents:
1092
diff
changeset
|
298 XMLUI_DATA_CANCELLED = "cancelled" |
490a8a4536b6
core (constants): added constants mainly used in XMLUI
Goffi <goffi@goffi.org>
parents:
1092
diff
changeset
|
299 XMLUI_DATA_TYPE = "type" |
490a8a4536b6
core (constants): added constants mainly used in XMLUI
Goffi <goffi@goffi.org>
parents:
1092
diff
changeset
|
300 XMLUI_DATA_MESS = "message" |
490a8a4536b6
core (constants): added constants mainly used in XMLUI
Goffi <goffi@goffi.org>
parents:
1092
diff
changeset
|
301 XMLUI_DATA_LVL = "level" |
490a8a4536b6
core (constants): added constants mainly used in XMLUI
Goffi <goffi@goffi.org>
parents:
1092
diff
changeset
|
302 XMLUI_DATA_LVL_INFO = "info" |
1108
6bdcaeafca11
core (constants): fixed bad XMLUI level constants
Goffi <goffi@goffi.org>
parents:
1104
diff
changeset
|
303 XMLUI_DATA_LVL_WARNING = "warning" |
6bdcaeafca11
core (constants): fixed bad XMLUI level constants
Goffi <goffi@goffi.org>
parents:
1104
diff
changeset
|
304 XMLUI_DATA_LVL_ERROR = "error" |
1104
490a8a4536b6
core (constants): added constants mainly used in XMLUI
Goffi <goffi@goffi.org>
parents:
1092
diff
changeset
|
305 XMLUI_DATA_LVL_DEFAULT = XMLUI_DATA_LVL_INFO |
2035
5c6db4329288
core (constants): added XMLUI_DATA_LVLS constants which group all available levels
Goffi <goffi@goffi.org>
parents:
2004
diff
changeset
|
306 XMLUI_DATA_LVLS = (XMLUI_DATA_LVL_INFO, XMLUI_DATA_LVL_WARNING, XMLUI_DATA_LVL_ERROR) |
1104
490a8a4536b6
core (constants): added constants mainly used in XMLUI
Goffi <goffi@goffi.org>
parents:
1092
diff
changeset
|
307 XMLUI_DATA_BTNS_SET = "buttons_set" |
490a8a4536b6
core (constants): added constants mainly used in XMLUI
Goffi <goffi@goffi.org>
parents:
1092
diff
changeset
|
308 XMLUI_DATA_BTNS_SET_OKCANCEL = "ok/cancel" |
490a8a4536b6
core (constants): added constants mainly used in XMLUI
Goffi <goffi@goffi.org>
parents:
1092
diff
changeset
|
309 XMLUI_DATA_BTNS_SET_YESNO = "yes/no" |
490a8a4536b6
core (constants): added constants mainly used in XMLUI
Goffi <goffi@goffi.org>
parents:
1092
diff
changeset
|
310 XMLUI_DATA_BTNS_SET_DEFAULT = XMLUI_DATA_BTNS_SET_OKCANCEL |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
311 XMLUI_DATA_FILETYPE = "filetype" |
1104
490a8a4536b6
core (constants): added constants mainly used in XMLUI
Goffi <goffi@goffi.org>
parents:
1092
diff
changeset
|
312 XMLUI_DATA_FILETYPE_FILE = "file" |
490a8a4536b6
core (constants): added constants mainly used in XMLUI
Goffi <goffi@goffi.org>
parents:
1092
diff
changeset
|
313 XMLUI_DATA_FILETYPE_DIR = "dir" |
490a8a4536b6
core (constants): added constants mainly used in XMLUI
Goffi <goffi@goffi.org>
parents:
1092
diff
changeset
|
314 XMLUI_DATA_FILETYPE_DEFAULT = XMLUI_DATA_FILETYPE_FILE |
490a8a4536b6
core (constants): added constants mainly used in XMLUI
Goffi <goffi@goffi.org>
parents:
1092
diff
changeset
|
315 |
991
05e02f8b7eb4
core: logging refactoring, first step:
Goffi <goffi@goffi.org>
parents:
990
diff
changeset
|
316 ## Logging ## |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
317 LOG_LVL_DEBUG = "DEBUG" |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
318 LOG_LVL_INFO = "INFO" |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
319 LOG_LVL_WARNING = "WARNING" |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
320 LOG_LVL_ERROR = "ERROR" |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
321 LOG_LVL_CRITICAL = "CRITICAL" |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
322 LOG_LEVELS = ( |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
323 LOG_LVL_DEBUG, |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
324 LOG_LVL_INFO, |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
325 LOG_LVL_WARNING, |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
326 LOG_LVL_ERROR, |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
327 LOG_LVL_CRITICAL, |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
328 ) |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
329 LOG_BACKEND_STANDARD = "standard" |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
330 LOG_BACKEND_TWISTED = "twisted" |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
331 LOG_BACKEND_BASIC = "basic" |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
332 LOG_BACKEND_CUSTOM = "custom" |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
333 LOG_BASE_LOGGER = "root" |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
334 LOG_TWISTED_LOGGER = "twisted" |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
335 LOG_OPT_SECTION = "DEFAULT" # section of sat.conf where log options should be |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
336 LOG_OPT_PREFIX = "log_" |
994
652c01ca69b1
core (log): configuration and environment variables are now checked for log level and colors:
Goffi <goffi@goffi.org>
parents:
991
diff
changeset
|
337 # (option_name, default_value) tuples |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
338 LOG_OPT_COLORS = ( |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
339 "colors", |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
340 "true", |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
341 ) # true for auto colors, force to have colors even if stdout is not a tty, false for no color |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
342 LOG_OPT_TAINTS_DICT = ( |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
343 "levels_taints_dict", |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
344 { |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
345 LOG_LVL_DEBUG: ("cyan",), |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
346 LOG_LVL_INFO: (), |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
347 LOG_LVL_WARNING: ("yellow",), |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
348 LOG_LVL_ERROR: ("red", "blink", r"/!\ ", "blink_off"), |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
349 LOG_LVL_CRITICAL: ("bold", "red", "Guru Meditation ", "normal_weight"), |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
350 }, |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
351 ) |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
352 LOG_OPT_LEVEL = ("level", "info") |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
353 LOG_OPT_FORMAT = ("fmt", "%(message)s") # similar to logging format. |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
354 LOG_OPT_LOGGER = ("logger", "") # regex to filter logger name |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
355 LOG_OPT_OUTPUT_SEP = "//" |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
356 LOG_OPT_OUTPUT_DEFAULT = "default" |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
357 LOG_OPT_OUTPUT_MEMORY = "memory" |
1005
b4af31a8a4f2
core (logs): added formatting, name filter and outputs management:
Goffi <goffi@goffi.org>
parents:
1004
diff
changeset
|
358 LOG_OPT_OUTPUT_MEMORY_LIMIT = 50 |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
359 LOG_OPT_OUTPUT_FILE = "file" # file is implicit if only output |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
360 LOG_OPT_OUTPUT = ( |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
361 "output", |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
362 LOG_OPT_OUTPUT_SEP + LOG_OPT_OUTPUT_DEFAULT, |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
363 ) # //default = normal output (stderr or a file with twistd), path/to/file for a file (must be the first if used), //memory for memory (options can be put in parenthesis, e.g.: //memory(500) for a 500 lines memory) |
991
05e02f8b7eb4
core: logging refactoring, first step:
Goffi <goffi@goffi.org>
parents:
990
diff
changeset
|
364 |
1599
e2ed8009e66e
backend, bridge, frontends: actionNew has now a security_limit argument + added some docstring to explain data argument
Goffi <goffi@goffi.org>
parents:
1520
diff
changeset
|
365 ## action constants ## |
e2ed8009e66e
backend, bridge, frontends: actionNew has now a security_limit argument + added some docstring to explain data argument
Goffi <goffi@goffi.org>
parents:
1520
diff
changeset
|
366 META_TYPE_FILE = "file" |
e2ed8009e66e
backend, bridge, frontends: actionNew has now a security_limit argument + added some docstring to explain data argument
Goffi <goffi@goffi.org>
parents:
1520
diff
changeset
|
367 META_TYPE_OVERWRITE = "overwrite" |
e2ed8009e66e
backend, bridge, frontends: actionNew has now a security_limit argument + added some docstring to explain data argument
Goffi <goffi@goffi.org>
parents:
1520
diff
changeset
|
368 |
1104
490a8a4536b6
core (constants): added constants mainly used in XMLUI
Goffi <goffi@goffi.org>
parents:
1092
diff
changeset
|
369 ## HARD-CODED ACTIONS IDS (generated with uuid.uuid4) ## |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
370 AUTHENTICATE_PROFILE_ID = u"b03bbfa8-a4ae-4734-a248-06ce6c7cf562" |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
371 CHANGE_XMPP_PASSWD_ID = u"878b9387-de2b-413b-950f-e424a147bcd0" |
1032
b262ae6d53af
stdui: add ui_profile_manager to interact with frontends when profile authentication is needed
souliane <souliane@mailoo.org>
parents:
1030
diff
changeset
|
372 |
1104
490a8a4536b6
core (constants): added constants mainly used in XMLUI
Goffi <goffi@goffi.org>
parents:
1092
diff
changeset
|
373 ## Text values ## |
490a8a4536b6
core (constants): added constants mainly used in XMLUI
Goffi <goffi@goffi.org>
parents:
1092
diff
changeset
|
374 BOOL_TRUE = "true" |
490a8a4536b6
core (constants): added constants mainly used in XMLUI
Goffi <goffi@goffi.org>
parents:
1092
diff
changeset
|
375 BOOL_FALSE = "false" |
490a8a4536b6
core (constants): added constants mainly used in XMLUI
Goffi <goffi@goffi.org>
parents:
1092
diff
changeset
|
376 |
1222
e6e0ea4dc835
memory: add Parameter "Chat history limit"
souliane <souliane@mailoo.org>
parents:
1211
diff
changeset
|
377 ## Special values used in bridge methods calls ## |
e6e0ea4dc835
memory: add Parameter "Chat history limit"
souliane <souliane@mailoo.org>
parents:
1211
diff
changeset
|
378 HISTORY_LIMIT_DEFAULT = -1 |
e6e0ea4dc835
memory: add Parameter "Chat history limit"
souliane <souliane@mailoo.org>
parents:
1211
diff
changeset
|
379 HISTORY_LIMIT_NONE = -2 |
e6e0ea4dc835
memory: add Parameter "Chat history limit"
souliane <souliane@mailoo.org>
parents:
1211
diff
changeset
|
380 |
2494
d1df08c79a5d
core (constants): new constants to handle files, progress, component, permissions (will be used in the upcoming patches)
Goffi <goffi@goffi.org>
parents:
2483
diff
changeset
|
381 ## Progress error special values ## |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
382 PROGRESS_ERROR_DECLINED = u"declined" # session has been declined by peer user |
2494
d1df08c79a5d
core (constants): new constants to handle files, progress, component, permissions (will be used in the upcoming patches)
Goffi <goffi@goffi.org>
parents:
2483
diff
changeset
|
383 |
d1df08c79a5d
core (constants): new constants to handle files, progress, component, permissions (will be used in the upcoming patches)
Goffi <goffi@goffi.org>
parents:
2483
diff
changeset
|
384 ## Files ## |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
385 FILE_TYPE_DIRECTORY = "directory" |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
386 FILE_TYPE_FILE = "file" |
2494
d1df08c79a5d
core (constants): new constants to handle files, progress, component, permissions (will be used in the upcoming patches)
Goffi <goffi@goffi.org>
parents:
2483
diff
changeset
|
387 |
d1df08c79a5d
core (constants): new constants to handle files, progress, component, permissions (will be used in the upcoming patches)
Goffi <goffi@goffi.org>
parents:
2483
diff
changeset
|
388 ## Permissions management ## |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
389 ACCESS_PERM_READ = u"read" |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
390 ACCESS_PERM_WRITE = u"write" |
2494
d1df08c79a5d
core (constants): new constants to handle files, progress, component, permissions (will be used in the upcoming patches)
Goffi <goffi@goffi.org>
parents:
2483
diff
changeset
|
391 ACCESS_PERMS = {ACCESS_PERM_READ, ACCESS_PERM_WRITE} |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
392 ACCESS_TYPE_PUBLIC = u"public" |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
393 ACCESS_TYPE_WHITELIST = u"whitelist" |
2494
d1df08c79a5d
core (constants): new constants to handle files, progress, component, permissions (will be used in the upcoming patches)
Goffi <goffi@goffi.org>
parents:
2483
diff
changeset
|
394 ACCESS_TYPES = (ACCESS_TYPE_PUBLIC, ACCESS_TYPE_WHITELIST) |
d1df08c79a5d
core (constants): new constants to handle files, progress, component, permissions (will be used in the upcoming patches)
Goffi <goffi@goffi.org>
parents:
2483
diff
changeset
|
395 |
2513
2d3c9dcec384
plugin XEP-0264: thumbnails handling implementation
Goffi <goffi@goffi.org>
parents:
2494
diff
changeset
|
396 ## Common data keys ## |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
397 KEY_THUMBNAILS = u"thumbnails" |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
398 KEY_PROGRESS_ID = u"progress_id" |
2513
2d3c9dcec384
plugin XEP-0264: thumbnails handling implementation
Goffi <goffi@goffi.org>
parents:
2494
diff
changeset
|
399 |
2760
3480d4fdf83a
plugins XEP-0060, XEP-0313: implemented Order-By protoXEP:
Goffi <goffi@goffi.org>
parents:
2752
diff
changeset
|
400 ## Common extra keys/values ## |
3480d4fdf83a
plugins XEP-0060, XEP-0313: implemented Order-By protoXEP:
Goffi <goffi@goffi.org>
parents:
2752
diff
changeset
|
401 KEY_ORDER_BY = u"order_by" |
3480d4fdf83a
plugins XEP-0060, XEP-0313: implemented Order-By protoXEP:
Goffi <goffi@goffi.org>
parents:
2752
diff
changeset
|
402 |
3480d4fdf83a
plugins XEP-0060, XEP-0313: implemented Order-By protoXEP:
Goffi <goffi@goffi.org>
parents:
2752
diff
changeset
|
403 ORDER_BY_CREATION = u'creation' |
3480d4fdf83a
plugins XEP-0060, XEP-0313: implemented Order-By protoXEP:
Goffi <goffi@goffi.org>
parents:
2752
diff
changeset
|
404 ORDER_BY_MODIFICATION = u'modification' |
3480d4fdf83a
plugins XEP-0060, XEP-0313: implemented Order-By protoXEP:
Goffi <goffi@goffi.org>
parents:
2752
diff
changeset
|
405 |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
406 # internationalisation |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
407 DEFAULT_LOCALE = u"en_GB" |
2599
5b26033c49a8
tools (common): moved date_fmt function from template filters to new date_utils module, so it can be used everywhere.
Goffi <goffi@goffi.org>
parents:
2591
diff
changeset
|
408 |
942
598fc223cf59
core: more organisation in constants.py
Goffi <goffi@goffi.org>
parents:
930
diff
changeset
|
409 ## Misc ## |
1003
52ec79aa5bbe
memory: fixes the method fixLocalDir for pid_dir and log_dir to use local_dir as default
souliane <souliane@mailoo.org>
parents:
1001
diff
changeset
|
410 SAVEFILE_DATABASE = APP_NAME_FILE + ".db" |
942
598fc223cf59
core: more organisation in constants.py
Goffi <goffi@goffi.org>
parents:
930
diff
changeset
|
411 IQ_SET = '/iq[@type="set"]' |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
412 ENV_PREFIX = "SAT_" # Prefix used for environment variables |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
413 IGNORE = "ignore" |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
414 NO_LIMIT = -1 # used in bridge when a integer value is expected |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
415 DEFAULT_MAX_AGE = 1209600 # default max age of cached files, in seconds |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
416 HASH_SHA1_EMPTY = "da39a3ee5e6b4b0d3255bfef95601890afd80709" |
2691
1ecceac3df96
plugin XEP-0198: Stream Management implementation:
Goffi <goffi@goffi.org>
parents:
2684
diff
changeset
|
417 STANZA_NAMES = (u"iq", u"message", u"presence") |
1ecceac3df96
plugin XEP-0198: Stream Management implementation:
Goffi <goffi@goffi.org>
parents:
2684
diff
changeset
|
418 |
1ecceac3df96
plugin XEP-0198: Stream Management implementation:
Goffi <goffi@goffi.org>
parents:
2684
diff
changeset
|
419 # Stream Hooks |
1ecceac3df96
plugin XEP-0198: Stream Management implementation:
Goffi <goffi@goffi.org>
parents:
2684
diff
changeset
|
420 STREAM_HOOK_SEND = u"send" |
1ecceac3df96
plugin XEP-0198: Stream Management implementation:
Goffi <goffi@goffi.org>
parents:
2684
diff
changeset
|
421 STREAM_HOOK_RECEIVE = u"receive" |
994
652c01ca69b1
core (log): configuration and environment variables are now checked for log level and colors:
Goffi <goffi@goffi.org>
parents:
991
diff
changeset
|
422 |
1010
73a0b7f94674
primitivus: use of new logging system:
Goffi <goffi@goffi.org>
parents:
1007
diff
changeset
|
423 @classmethod |
73a0b7f94674
primitivus: use of new logging system:
Goffi <goffi@goffi.org>
parents:
1007
diff
changeset
|
424 def LOG_OPTIONS(cls): |
73a0b7f94674
primitivus: use of new logging system:
Goffi <goffi@goffi.org>
parents:
1007
diff
changeset
|
425 """Return options checked for logs""" |
73a0b7f94674
primitivus: use of new logging system:
Goffi <goffi@goffi.org>
parents:
1007
diff
changeset
|
426 # XXX: we use a classmethod so we can use Const inheritance to change default options |
2624
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
427 return ( |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
428 cls.LOG_OPT_COLORS, |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
429 cls.LOG_OPT_TAINTS_DICT, |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
430 cls.LOG_OPT_LEVEL, |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
431 cls.LOG_OPT_FORMAT, |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
432 cls.LOG_OPT_LOGGER, |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
433 cls.LOG_OPT_OUTPUT, |
56f94936df1e
code style reformatting using black
Goffi <goffi@goffi.org>
parents:
2599
diff
changeset
|
434 ) |
1010
73a0b7f94674
primitivus: use of new logging system:
Goffi <goffi@goffi.org>
parents:
1007
diff
changeset
|
435 |
1143
3164b509bc99
core (constants): Bool method allow to convert from python bool to string constant for true/false (in both directions)
Goffi <goffi@goffi.org>
parents:
1113
diff
changeset
|
436 @classmethod |
3164b509bc99
core (constants): Bool method allow to convert from python bool to string constant for true/false (in both directions)
Goffi <goffi@goffi.org>
parents:
1113
diff
changeset
|
437 def bool(cls, value): |
1298
e2f71b715708
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
Goffi <goffi@goffi.org>
parents:
1290
diff
changeset
|
438 """@return (bool): bool value for associated constant""" |
e2f71b715708
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
Goffi <goffi@goffi.org>
parents:
1290
diff
changeset
|
439 assert isinstance(value, basestring) |
2524
e96076cdf74c
core (constants): accept "yes" as a True value in bool()
Goffi <goffi@goffi.org>
parents:
2513
diff
changeset
|
440 return value.lower() in (cls.BOOL_TRUE, "1", "yes") |
1228
2e1b4e7c8eb8
constants: split C.bool in C.bool and C.str so:
souliane <souliane@mailoo.org>
parents:
1227
diff
changeset
|
441 |
2e1b4e7c8eb8
constants: split C.bool in C.bool and C.str so:
souliane <souliane@mailoo.org>
parents:
1227
diff
changeset
|
442 @classmethod |
1298
e2f71b715708
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
Goffi <goffi@goffi.org>
parents:
1290
diff
changeset
|
443 def boolConst(cls, value): |
e2f71b715708
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
Goffi <goffi@goffi.org>
parents:
1290
diff
changeset
|
444 """@return (str): constant associated to bool value""" |
e2f71b715708
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
Goffi <goffi@goffi.org>
parents:
1290
diff
changeset
|
445 assert isinstance(value, bool) |
e2f71b715708
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
Goffi <goffi@goffi.org>
parents:
1290
diff
changeset
|
446 return cls.BOOL_TRUE if value else cls.BOOL_FALSE |