Mercurial > libervia-backend
annotate src/core/constants.py @ 2413:70399d1acb47
tmp: removed sat.tmp hierarchy and fixed references to it as it is now an independant sat_tmp repository
author | Goffi <goffi@goffi.org> |
---|---|
date | Fri, 03 Nov 2017 14:19:10 +0100 |
parents | cdaa58e14553 |
children | 8b37a62336c3 |
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 |
1766 | 5 # Copyright (C) 2009-2016 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 |
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
|
25 |
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
|
26 |
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 class Const(object): |
942
598fc223cf59
core: more organisation in constants.py
Goffi <goffi@goffi.org>
parents:
930
diff
changeset
|
28 |
598fc223cf59
core: more organisation in constants.py
Goffi <goffi@goffi.org>
parents:
930
diff
changeset
|
29 ## Application ## |
923 | 30 APP_NAME = u'Salut à Toi' |
31 APP_NAME_SHORT = u'SàT' | |
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
|
32 APP_NAME_FILE = u'sat' |
923 | 33 APP_NAME_FULL = u'%s (%s)' % (APP_NAME_SHORT, APP_NAME) |
1959 | 34 APP_VERSION = u'0.7.0D' # Please add 'D' at the end for dev versions |
2147
bca699faf416
core: added release name in constants + full version
Goffi <goffi@goffi.org>
parents:
2145
diff
changeset
|
35 APP_RELEASE_NAME = u'La Commune' |
1384
73f8582c7c99
plugins XEP-0045, XEP-0249: allow to join / invite without specifying the JID's host part (use client's values)
souliane <souliane@mailoo.org>
parents:
1357
diff
changeset
|
36 APP_URL = u'http://salut-a-toi.org' |
942
598fc223cf59
core: more organisation in constants.py
Goffi <goffi@goffi.org>
parents:
930
diff
changeset
|
37 |
994
652c01ca69b1
core (log): configuration and environment variables are now checked for log level and colors:
Goffi <goffi@goffi.org>
parents:
991
diff
changeset
|
38 |
2105
c96fe007ca41
core(constants): added a constant for profile extension (PLUGIN_EXT):
Goffi <goffi@goffi.org>
parents:
2089
diff
changeset
|
39 ## Runtime ## |
c96fe007ca41
core(constants): added a constant for profile extension (PLUGIN_EXT):
Goffi <goffi@goffi.org>
parents:
2089
diff
changeset
|
40 PLUGIN_EXT = "py" |
2132
c0577837680a
core: replaced SkipHistory exception by a key in mess_data:
Goffi <goffi@goffi.org>
parents:
2127
diff
changeset
|
41 HISTORY_SKIP = u'skip' |
2105
c96fe007ca41
core(constants): added a constant for profile extension (PLUGIN_EXT):
Goffi <goffi@goffi.org>
parents:
2089
diff
changeset
|
42 |
c96fe007ca41
core(constants): added a constant for profile extension (PLUGIN_EXT):
Goffi <goffi@goffi.org>
parents:
2089
diff
changeset
|
43 ## Main config ## |
2088
c02f96756d5c
core: bridge can now be changed in conf
Goffi <goffi@goffi.org>
parents:
2035
diff
changeset
|
44 DEFAULT_BRIDGE = 'dbus' |
c02f96756d5c
core: bridge can now be changed in conf
Goffi <goffi@goffi.org>
parents:
2035
diff
changeset
|
45 |
c02f96756d5c
core: bridge can now be changed in conf
Goffi <goffi@goffi.org>
parents:
2035
diff
changeset
|
46 |
2105
c96fe007ca41
core(constants): added a constant for profile extension (PLUGIN_EXT):
Goffi <goffi@goffi.org>
parents:
2089
diff
changeset
|
47 ## Protocol ## |
1089
8e0072754413
core, plugins, stdui, frontends: fixes handling of "Force server" and "Force port" parameters:
souliane <souliane@mailoo.org>
parents:
1088
diff
changeset
|
48 XMPP_C2S_PORT = 5222 |
1211
9355f48f979e
core: move XMPP keep-alife value to the constants
souliane <souliane@mailoo.org>
parents:
1210
diff
changeset
|
49 XMPP_KEEP_ALIFE = 180 |
1725
c1be6363bfab
core, plugin misc_account: set XMPP connection max retries to 0 when checking if an external account exists
souliane <souliane@mailoo.org>
parents:
1721
diff
changeset
|
50 XMPP_MAX_RETRIES = 2 |
2144
1d3f73e065e1
core, jp: component handling + client handling refactoring:
Goffi <goffi@goffi.org>
parents:
2132
diff
changeset
|
51 # 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
|
52 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
|
53 |
8e0072754413
core, plugins, stdui, frontends: fixes handling of "Force server" and "Force port" parameters:
souliane <souliane@mailoo.org>
parents:
1088
diff
changeset
|
54 |
942
598fc223cf59
core: more organisation in constants.py
Goffi <goffi@goffi.org>
parents:
930
diff
changeset
|
55 ## Parameters ## |
2126 | 56 NO_SECURITY_LIMIT = -1 # FIXME: to rename |
57 SECURITY_LIMIT_MAX = 0 | |
942
598fc223cf59
core: more organisation in constants.py
Goffi <goffi@goffi.org>
parents:
930
diff
changeset
|
58 INDIVIDUAL = "individual" |
598fc223cf59
core: more organisation in constants.py
Goffi <goffi@goffi.org>
parents:
930
diff
changeset
|
59 GENERAL = "general" |
1222
e6e0ea4dc835
memory: add Parameter "Chat history limit"
souliane <souliane@mailoo.org>
parents:
1211
diff
changeset
|
60 # General parameters |
e6e0ea4dc835
memory: add Parameter "Chat history limit"
souliane <souliane@mailoo.org>
parents:
1211
diff
changeset
|
61 HISTORY_LIMIT = "History" |
1227
4da2e4d58bd0
memory (params): add parameters "Show offline contacts" and "Show empty groups"
souliane <souliane@mailoo.org>
parents:
1222
diff
changeset
|
62 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
|
63 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
|
64 # 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
|
65 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
|
66 FORCE_PORT_PARAM = "Force port" |
1030
15f43b54d697
core, memory, bridge: added profile password + password encryption:
souliane <souliane@mailoo.org>
parents:
1020
diff
changeset
|
67 # Parameters related to encryption |
15f43b54d697
core, memory, bridge: added profile password + password encryption:
souliane <souliane@mailoo.org>
parents:
1020
diff
changeset
|
68 PROFILE_PASS_PATH = ('General', 'Password') |
15f43b54d697
core, memory, bridge: added profile password + password encryption:
souliane <souliane@mailoo.org>
parents:
1020
diff
changeset
|
69 MEMORY_CRYPTO_NAMESPACE = 'crypto' # for the private persistent binary dict |
15f43b54d697
core, memory, bridge: added profile password + password encryption:
souliane <souliane@mailoo.org>
parents:
1020
diff
changeset
|
70 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
|
71 # Parameters for static blog pages |
2126 | 72 # 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
|
73 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
|
74 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
|
75 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
|
76 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
|
77 STATIC_BLOG_PARAM_DESCRIPTION = "Description" |
942
598fc223cf59
core: more organisation in constants.py
Goffi <goffi@goffi.org>
parents:
930
diff
changeset
|
78 |
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
|
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 |
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
|
89 |
942
598fc223cf59
core: more organisation in constants.py
Goffi <goffi@goffi.org>
parents:
930
diff
changeset
|
90 ## Profile and entities ## |
598fc223cf59
core: more organisation in constants.py
Goffi <goffi@goffi.org>
parents:
930
diff
changeset
|
91 PROF_KEY_NONE = '@NONE@' |
598fc223cf59
core: more organisation in constants.py
Goffi <goffi@goffi.org>
parents:
930
diff
changeset
|
92 PROF_KEY_DEFAULT = '@DEFAULT@' |
1520
9667103a0c10
core (contants): added PROF_KEY_ALL en PLUG_TYPE_* constants
Goffi <goffi@goffi.org>
parents:
1459
diff
changeset
|
93 PROF_KEY_ALL = '@ALL@' |
942
598fc223cf59
core: more organisation in constants.py
Goffi <goffi@goffi.org>
parents:
930
diff
changeset
|
94 ENTITY_ALL = '@ALL@' |
1290
faa1129559b8
core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents:
1263
diff
changeset
|
95 ENTITY_ALL_RESOURCES = '@ALL_RESOURCES@' |
faa1129559b8
core, frontends: refactoring to base Libervia on QuickFrontend (big mixed commit):
Goffi <goffi@goffi.org>
parents:
1263
diff
changeset
|
96 ENTITY_MAIN_RESOURCE = '@MAIN_RESOURCE@' |
944
e1842ebcb2f3
core, plugin XEP-0115: discovery refactoring:
Goffi <goffi@goffi.org>
parents:
943
diff
changeset
|
97 ENTITY_CAP_HASH = 'CAP_HASH' |
1963
a2bc5089c2eb
backend, frontends: message refactoring (huge commit):
Goffi <goffi@goffi.org>
parents:
1959
diff
changeset
|
98 ENTITY_TYPE = 'TYPE' |
942
598fc223cf59
core: more organisation in constants.py
Goffi <goffi@goffi.org>
parents:
930
diff
changeset
|
99 |
1520
9667103a0c10
core (contants): added PROF_KEY_ALL en PLUG_TYPE_* constants
Goffi <goffi@goffi.org>
parents:
1459
diff
changeset
|
100 |
1450
7797dda847ae
plugins xep-0277, groupblog: added subscriteToMany to replace massiveSubscribeGroupBlogs + added SatRosterProtocol.getJidsSet
Goffi <goffi@goffi.org>
parents:
1448
diff
changeset
|
101 ## Roster jids selection ## |
1459
4c4f88d7b156
plugins xep-0060, xep-0163, xep-0277, groupblog: bloging improvments (huge patch, sorry):
Goffi <goffi@goffi.org>
parents:
1454
diff
changeset
|
102 PUBLIC = 'PUBLIC' |
4c4f88d7b156
plugins xep-0060, xep-0163, xep-0277, groupblog: bloging improvments (huge patch, sorry):
Goffi <goffi@goffi.org>
parents:
1454
diff
changeset
|
103 ALL = 'ALL' # ALL means all known contacts, while PUBLIC means everybody, known or not |
1450
7797dda847ae
plugins xep-0277, groupblog: added subscriteToMany to replace massiveSubscribeGroupBlogs + added SatRosterProtocol.getJidsSet
Goffi <goffi@goffi.org>
parents:
1448
diff
changeset
|
104 GROUP = 'GROUP' |
7797dda847ae
plugins xep-0277, groupblog: added subscriteToMany to replace massiveSubscribeGroupBlogs + added SatRosterProtocol.getJidsSet
Goffi <goffi@goffi.org>
parents:
1448
diff
changeset
|
105 JID = 'JID' |
7797dda847ae
plugins xep-0277, groupblog: added subscriteToMany to replace massiveSubscribeGroupBlogs + added SatRosterProtocol.getJidsSet
Goffi <goffi@goffi.org>
parents:
1448
diff
changeset
|
106 |
994
652c01ca69b1
core (log): configuration and environment variables are now checked for log level and colors:
Goffi <goffi@goffi.org>
parents:
991
diff
changeset
|
107 |
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
|
108 ## Messages ## |
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
|
109 MESS_TYPE_INFO = 'info' |
1263 | 110 MESS_TYPE_CHAT = 'chat' |
111 MESS_TYPE_ERROR = 'error' | |
112 MESS_TYPE_GROUPCHAT = 'groupchat' | |
113 MESS_TYPE_HEADLINE = 'headline' | |
114 MESS_TYPE_NORMAL = 'normal' | |
1963
a2bc5089c2eb
backend, frontends: message refactoring (huge commit):
Goffi <goffi@goffi.org>
parents:
1959
diff
changeset
|
115 MESS_TYPE_AUTO = 'auto' # magic value to let the backend guess the type |
a2bc5089c2eb
backend, frontends: message refactoring (huge commit):
Goffi <goffi@goffi.org>
parents:
1959
diff
changeset
|
116 MESS_TYPE_STANDARD = (MESS_TYPE_CHAT, MESS_TYPE_ERROR, MESS_TYPE_GROUPCHAT, MESS_TYPE_HEADLINE, MESS_TYPE_NORMAL) |
a2bc5089c2eb
backend, frontends: message refactoring (huge commit):
Goffi <goffi@goffi.org>
parents:
1959
diff
changeset
|
117 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
|
118 |
a2bc5089c2eb
backend, frontends: message refactoring (huge commit):
Goffi <goffi@goffi.org>
parents:
1959
diff
changeset
|
119 MESS_EXTRA_INFO = "info_type" |
1263 | 120 |
1520
9667103a0c10
core (contants): added PROF_KEY_ALL en PLUG_TYPE_* constants
Goffi <goffi@goffi.org>
parents:
1459
diff
changeset
|
121 |
1776
4fc1bf1af48f
plugin XEP-0313: cleaning and improvments:
Goffi <goffi@goffi.org>
parents:
1766
diff
changeset
|
122 ## Presence ## |
1263 | 123 PRESENCE_UNAVAILABLE = 'unavailable' |
124 PRESENCE_SHOW_AWAY = 'away' | |
125 PRESENCE_SHOW_CHAT = 'chat' | |
126 PRESENCE_SHOW_DND = 'dnd' | |
127 PRESENCE_SHOW_XA = 'xa' | |
128 PRESENCE_SHOW = 'show' | |
129 PRESENCE_STATUSES = 'statuses' | |
1417
176de79c8c39
core, plugin XEP-0045, frontends: change frontend method "setStatusOnline" for "setPresenceStatus":
souliane <souliane@mailoo.org>
parents:
1396
diff
changeset
|
130 PRESENCE_STATUSES_DEFAULT = 'default' |
1263 | 131 PRESENCE_PRIORITY = 'priority' |
132 | |
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
|
133 |
1776
4fc1bf1af48f
plugin XEP-0313: cleaning and improvments:
Goffi <goffi@goffi.org>
parents:
1766
diff
changeset
|
134 ## Common namespaces ## |
1963
a2bc5089c2eb
backend, frontends: message refactoring (huge commit):
Goffi <goffi@goffi.org>
parents:
1959
diff
changeset
|
135 NS_XML = 'http://www.w3.org/XML/1998/namespace' |
1776
4fc1bf1af48f
plugin XEP-0313: cleaning and improvments:
Goffi <goffi@goffi.org>
parents:
1766
diff
changeset
|
136 NS_CLIENT = 'jabber:client' |
4fc1bf1af48f
plugin XEP-0313: cleaning and improvments:
Goffi <goffi@goffi.org>
parents:
1766
diff
changeset
|
137 NS_FORWARD = 'urn:xmpp:forward:0' |
4fc1bf1af48f
plugin XEP-0313: cleaning and improvments:
Goffi <goffi@goffi.org>
parents:
1766
diff
changeset
|
138 NS_DELAY = 'urn:xmpp:delay' |
1822
aaf034bc6f7a
plugin XEP-0277: moved NS_XHTML namespace to constants + adapted parsing to new behaviour of ElementParser
Goffi <goffi@goffi.org>
parents:
1806
diff
changeset
|
139 NS_XHTML = 'http://www.w3.org/1999/xhtml' |
1776
4fc1bf1af48f
plugin XEP-0313: cleaning and improvments:
Goffi <goffi@goffi.org>
parents:
1766
diff
changeset
|
140 |
2109
85f3e12e984d
core (memory/cache): file caching handling, first draft:
Goffi <goffi@goffi.org>
parents:
2105
diff
changeset
|
141 ## Directories ## |
85f3e12e984d
core (memory/cache): file caching handling, first draft:
Goffi <goffi@goffi.org>
parents:
2105
diff
changeset
|
142 CACHE_DIR = u'cache' |
85f3e12e984d
core (memory/cache): file caching handling, first draft:
Goffi <goffi@goffi.org>
parents:
2105
diff
changeset
|
143 |
1776
4fc1bf1af48f
plugin XEP-0313: cleaning and improvments:
Goffi <goffi@goffi.org>
parents:
1766
diff
changeset
|
144 |
994
652c01ca69b1
core (log): configuration and environment variables are now checked for log level and colors:
Goffi <goffi@goffi.org>
parents:
991
diff
changeset
|
145 ## Configuration ## |
1113
edd3fc4b4aaf
core (constants): minor comment change
Goffi <goffi@goffi.org>
parents:
1112
diff
changeset
|
146 if BaseDirectory: # skipped when xdg module is not available (should not happen in backend) |
2089
0931b5a6213c
core, quick_frontends: android compatibility hacks:
Goffi <goffi@goffi.org>
parents:
2088
diff
changeset
|
147 if "org.goffi.cagou.cagou" in BaseDirectory.__file__: |
0931b5a6213c
core, quick_frontends: android compatibility hacks:
Goffi <goffi@goffi.org>
parents:
2088
diff
changeset
|
148 # 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
|
149 # TODO: fix it in a more proper way |
0931b5a6213c
core, quick_frontends: android compatibility hacks:
Goffi <goffi@goffi.org>
parents:
2088
diff
changeset
|
150 BaseDirectory = None |
0931b5a6213c
core, quick_frontends: android compatibility hacks:
Goffi <goffi@goffi.org>
parents:
2088
diff
changeset
|
151 DEFAULT_CONFIG = { |
0931b5a6213c
core, quick_frontends: android compatibility hacks:
Goffi <goffi@goffi.org>
parents:
2088
diff
changeset
|
152 'local_dir': '/data/data/org.goffi.cagou.cagou/', |
0931b5a6213c
core, quick_frontends: android compatibility hacks:
Goffi <goffi@goffi.org>
parents:
2088
diff
changeset
|
153 'media_dir': '/data/data/org.goffi.cagou.cagou/files/media', |
0931b5a6213c
core, quick_frontends: android compatibility hacks:
Goffi <goffi@goffi.org>
parents:
2088
diff
changeset
|
154 'pid_dir': '%(local_dir)s', |
0931b5a6213c
core, quick_frontends: android compatibility hacks:
Goffi <goffi@goffi.org>
parents:
2088
diff
changeset
|
155 'log_dir': '%(local_dir)s', |
0931b5a6213c
core, quick_frontends: android compatibility hacks:
Goffi <goffi@goffi.org>
parents:
2088
diff
changeset
|
156 } |
2127
8717e9cc95c0
core (constant): on android sat.conf is now in /data/data/org.goffi.cagou.cagou/files/platform/android/
Goffi <goffi@goffi.org>
parents:
2126
diff
changeset
|
157 CONFIG_FILES = ['/data/data/org.goffi.cagou.cagou/files/platform/android/' + APP_NAME_FILE + '.conf'] |
2089
0931b5a6213c
core, quick_frontends: android compatibility hacks:
Goffi <goffi@goffi.org>
parents:
2088
diff
changeset
|
158 else: |
942
598fc223cf59
core: more organisation in constants.py
Goffi <goffi@goffi.org>
parents:
930
diff
changeset
|
159 |
2089
0931b5a6213c
core, quick_frontends: android compatibility hacks:
Goffi <goffi@goffi.org>
parents:
2088
diff
changeset
|
160 ## Configuration ## |
0931b5a6213c
core, quick_frontends: android compatibility hacks:
Goffi <goffi@goffi.org>
parents:
2088
diff
changeset
|
161 DEFAULT_CONFIG = { |
0931b5a6213c
core, quick_frontends: android compatibility hacks:
Goffi <goffi@goffi.org>
parents:
2088
diff
changeset
|
162 'media_dir': '/usr/share/' + APP_NAME_FILE + '/media', |
0931b5a6213c
core, quick_frontends: android compatibility hacks:
Goffi <goffi@goffi.org>
parents:
2088
diff
changeset
|
163 'local_dir': BaseDirectory.save_data_path(APP_NAME_FILE), |
0931b5a6213c
core, quick_frontends: android compatibility hacks:
Goffi <goffi@goffi.org>
parents:
2088
diff
changeset
|
164 'pid_dir': '%(local_dir)s', |
0931b5a6213c
core, quick_frontends: android compatibility hacks:
Goffi <goffi@goffi.org>
parents:
2088
diff
changeset
|
165 'log_dir': '%(local_dir)s', |
0931b5a6213c
core, quick_frontends: android compatibility hacks:
Goffi <goffi@goffi.org>
parents:
2088
diff
changeset
|
166 } |
923 | 167 |
2089
0931b5a6213c
core, quick_frontends: android compatibility hacks:
Goffi <goffi@goffi.org>
parents:
2088
diff
changeset
|
168 # List of the configuration filenames sorted by ascending priority |
0931b5a6213c
core, quick_frontends: android compatibility hacks:
Goffi <goffi@goffi.org>
parents:
2088
diff
changeset
|
169 CONFIG_FILES = [realpath(expanduser(path) + APP_NAME_FILE + '.conf') for path in |
0931b5a6213c
core, quick_frontends: android compatibility hacks:
Goffi <goffi@goffi.org>
parents:
2088
diff
changeset
|
170 ['/etc/', '~/', '~/.', '', '.'] + |
0931b5a6213c
core, quick_frontends: android compatibility hacks:
Goffi <goffi@goffi.org>
parents:
2088
diff
changeset
|
171 ['%s/' % path for path in list(BaseDirectory.load_config_paths(APP_NAME_FILE))] |
0931b5a6213c
core, quick_frontends: android compatibility hacks:
Goffi <goffi@goffi.org>
parents:
2088
diff
changeset
|
172 ] |
994
652c01ca69b1
core (log): configuration and environment variables are now checked for log level and colors:
Goffi <goffi@goffi.org>
parents:
991
diff
changeset
|
173 |
2169
f472179305a1
tools(templates): workflow improvments:
Goffi <goffi@goffi.org>
parents:
2154
diff
changeset
|
174 ## Templates ## |
f472179305a1
tools(templates): workflow improvments:
Goffi <goffi@goffi.org>
parents:
2154
diff
changeset
|
175 TEMPLATE_THEME_DEFAULT = u'default' |
f472179305a1
tools(templates): workflow improvments:
Goffi <goffi@goffi.org>
parents:
2154
diff
changeset
|
176 TEMPLATE_STATIC_DIR = u'static' |
f472179305a1
tools(templates): workflow improvments:
Goffi <goffi@goffi.org>
parents:
2154
diff
changeset
|
177 |
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
|
178 |
942
598fc223cf59
core: more organisation in constants.py
Goffi <goffi@goffi.org>
parents:
930
diff
changeset
|
179 ## Plugins ## |
1520
9667103a0c10
core (contants): added PROF_KEY_ALL en PLUG_TYPE_* constants
Goffi <goffi@goffi.org>
parents:
1459
diff
changeset
|
180 |
2144
1d3f73e065e1
core, jp: component handling + client handling refactoring:
Goffi <goffi@goffi.org>
parents:
2132
diff
changeset
|
181 # PLUGIN_INFO keys |
1d3f73e065e1
core, jp: component handling + client handling refactoring:
Goffi <goffi@goffi.org>
parents:
2132
diff
changeset
|
182 # 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
|
183 # to make the header more readable |
2145
33c8c4973743
core (plugins): added missing contants + use of new constants in PLUGIN_INFO
Goffi <goffi@goffi.org>
parents:
2144
diff
changeset
|
184 PI_NAME = u'name' |
2144
1d3f73e065e1
core, jp: component handling + client handling refactoring:
Goffi <goffi@goffi.org>
parents:
2132
diff
changeset
|
185 PI_IMPORT_NAME = u'import_name' |
2145
33c8c4973743
core (plugins): added missing contants + use of new constants in PLUGIN_INFO
Goffi <goffi@goffi.org>
parents:
2144
diff
changeset
|
186 PI_MAIN = u'main' |
33c8c4973743
core (plugins): added missing contants + use of new constants in PLUGIN_INFO
Goffi <goffi@goffi.org>
parents:
2144
diff
changeset
|
187 PI_HANDLER = u'handler' |
2369
cdaa58e14553
plugin import: generic data import plugin:
Goffi <goffi@goffi.org>
parents:
2305
diff
changeset
|
188 PI_TYPE = u'type' # FIXME: should be types, and should handle single unicode type or tuple of types (e.g. "blog" and "import") |
2145
33c8c4973743
core (plugins): added missing contants + use of new constants in PLUGIN_INFO
Goffi <goffi@goffi.org>
parents:
2144
diff
changeset
|
189 PI_MODES = u'modes' |
33c8c4973743
core (plugins): added missing contants + use of new constants in PLUGIN_INFO
Goffi <goffi@goffi.org>
parents:
2144
diff
changeset
|
190 PI_PROTOCOLS = u'protocols' |
2144
1d3f73e065e1
core, jp: component handling + client handling refactoring:
Goffi <goffi@goffi.org>
parents:
2132
diff
changeset
|
191 PI_DEPENDENCIES = u'dependencies' |
1d3f73e065e1
core, jp: component handling + client handling refactoring:
Goffi <goffi@goffi.org>
parents:
2132
diff
changeset
|
192 PI_RECOMMENDATIONS = u'recommendations' |
2145
33c8c4973743
core (plugins): added missing contants + use of new constants in PLUGIN_INFO
Goffi <goffi@goffi.org>
parents:
2144
diff
changeset
|
193 PI_DESCRIPTION = u'description' |
33c8c4973743
core (plugins): added missing contants + use of new constants in PLUGIN_INFO
Goffi <goffi@goffi.org>
parents:
2144
diff
changeset
|
194 PI_USAGE = u'usage' |
2144
1d3f73e065e1
core, jp: component handling + client handling refactoring:
Goffi <goffi@goffi.org>
parents:
2132
diff
changeset
|
195 |
1520
9667103a0c10
core (contants): added PROF_KEY_ALL en PLUG_TYPE_* constants
Goffi <goffi@goffi.org>
parents:
1459
diff
changeset
|
196 # Types |
9667103a0c10
core (contants): added PROF_KEY_ALL en PLUG_TYPE_* constants
Goffi <goffi@goffi.org>
parents:
1459
diff
changeset
|
197 PLUG_TYPE_XEP = "XEP" |
9667103a0c10
core (contants): added PROF_KEY_ALL en PLUG_TYPE_* constants
Goffi <goffi@goffi.org>
parents:
1459
diff
changeset
|
198 PLUG_TYPE_MISC = "MISC" |
9667103a0c10
core (contants): added PROF_KEY_ALL en PLUG_TYPE_* constants
Goffi <goffi@goffi.org>
parents:
1459
diff
changeset
|
199 PLUG_TYPE_EXP = "EXP" |
9667103a0c10
core (contants): added PROF_KEY_ALL en PLUG_TYPE_* constants
Goffi <goffi@goffi.org>
parents:
1459
diff
changeset
|
200 PLUG_TYPE_SEC = "SEC" |
1806
fd788d24277a
plugin syntax dc_wiki: first draft:
Goffi <goffi@goffi.org>
parents:
1776
diff
changeset
|
201 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
|
202 PLUG_TYPE_BLOG = "BLOG" |
2369
cdaa58e14553
plugin import: generic data import plugin:
Goffi <goffi@goffi.org>
parents:
2305
diff
changeset
|
203 PLUG_TYPE_IMPORT = "IMPORT" |
2144
1d3f73e065e1
core, jp: component handling + client handling refactoring:
Goffi <goffi@goffi.org>
parents:
2132
diff
changeset
|
204 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
|
205 |
2144
1d3f73e065e1
core, jp: component handling + client handling refactoring:
Goffi <goffi@goffi.org>
parents:
2132
diff
changeset
|
206 # Modes |
1d3f73e065e1
core, jp: component handling + client handling refactoring:
Goffi <goffi@goffi.org>
parents:
2132
diff
changeset
|
207 PLUG_MODE_CLIENT = "client" |
1d3f73e065e1
core, jp: component handling + client handling refactoring:
Goffi <goffi@goffi.org>
parents:
2132
diff
changeset
|
208 PLUG_MODE_COMPONENT = "component" |
1d3f73e065e1
core, jp: component handling + client handling refactoring:
Goffi <goffi@goffi.org>
parents:
2132
diff
changeset
|
209 PLUG_MODE_DEFAULT = (PLUG_MODE_CLIENT,) |
1520
9667103a0c10
core (contants): added PROF_KEY_ALL en PLUG_TYPE_* constants
Goffi <goffi@goffi.org>
parents:
1459
diff
changeset
|
210 |
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
|
211 # names of widely used plugins |
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
|
212 TEXT_CMDS = 'TEXT-COMMANDS' |
942
598fc223cf59
core: more organisation in constants.py
Goffi <goffi@goffi.org>
parents:
930
diff
changeset
|
213 |
1459
4c4f88d7b156
plugins xep-0060, xep-0163, xep-0277, groupblog: bloging improvments (huge patch, sorry):
Goffi <goffi@goffi.org>
parents:
1454
diff
changeset
|
214 # 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
|
215 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
|
216 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
|
217 |
4c4f88d7b156
plugins xep-0060, xep-0163, xep-0277, groupblog: bloging improvments (huge patch, sorry):
Goffi <goffi@goffi.org>
parents:
1454
diff
changeset
|
218 # PubSub |
4c4f88d7b156
plugins xep-0060, xep-0163, xep-0277, groupblog: bloging improvments (huge patch, sorry):
Goffi <goffi@goffi.org>
parents:
1454
diff
changeset
|
219 PS_PUBLISH = "publish" |
4c4f88d7b156
plugins xep-0060, xep-0163, xep-0277, groupblog: bloging improvments (huge patch, sorry):
Goffi <goffi@goffi.org>
parents:
1454
diff
changeset
|
220 PS_RETRACT = "retract" # used for items |
2305
972e33507609
plugin XEP-0060: addManagedNode callbacks now use client syntax instead of profile
Goffi <goffi@goffi.org>
parents:
2169
diff
changeset
|
221 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
|
222 PS_ITEM = "item" |
4c4f88d7b156
plugins xep-0060, xep-0163, xep-0277, groupblog: bloging improvments (huge patch, sorry):
Goffi <goffi@goffi.org>
parents:
1454
diff
changeset
|
223 PS_ITEMS = "items" # Can contain publish and retract items |
4c4f88d7b156
plugins xep-0060, xep-0163, xep-0277, groupblog: bloging improvments (huge patch, sorry):
Goffi <goffi@goffi.org>
parents:
1454
diff
changeset
|
224 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
|
225 |
994
652c01ca69b1
core (log): configuration and environment variables are now checked for log level and colors:
Goffi <goffi@goffi.org>
parents:
991
diff
changeset
|
226 |
1104
490a8a4536b6
core (constants): added constants mainly used in XMLUI
Goffi <goffi@goffi.org>
parents:
1092
diff
changeset
|
227 ## XMLUI ## |
490a8a4536b6
core (constants): added constants mainly used in XMLUI
Goffi <goffi@goffi.org>
parents:
1092
diff
changeset
|
228 XMLUI_WINDOW = 'window' |
490a8a4536b6
core (constants): added constants mainly used in XMLUI
Goffi <goffi@goffi.org>
parents:
1092
diff
changeset
|
229 XMLUI_POPUP = 'popup' |
490a8a4536b6
core (constants): added constants mainly used in XMLUI
Goffi <goffi@goffi.org>
parents:
1092
diff
changeset
|
230 XMLUI_FORM = 'form' |
490a8a4536b6
core (constants): added constants mainly used in XMLUI
Goffi <goffi@goffi.org>
parents:
1092
diff
changeset
|
231 XMLUI_PARAM = 'param' |
490a8a4536b6
core (constants): added constants mainly used in XMLUI
Goffi <goffi@goffi.org>
parents:
1092
diff
changeset
|
232 XMLUI_DIALOG = 'dialog' |
490a8a4536b6
core (constants): added constants mainly used in XMLUI
Goffi <goffi@goffi.org>
parents:
1092
diff
changeset
|
233 XMLUI_DIALOG_CONFIRM = "confirm" |
490a8a4536b6
core (constants): added constants mainly used in XMLUI
Goffi <goffi@goffi.org>
parents:
1092
diff
changeset
|
234 XMLUI_DIALOG_MESSAGE = "message" |
490a8a4536b6
core (constants): added constants mainly used in XMLUI
Goffi <goffi@goffi.org>
parents:
1092
diff
changeset
|
235 XMLUI_DIALOG_NOTE = "note" |
490a8a4536b6
core (constants): added constants mainly used in XMLUI
Goffi <goffi@goffi.org>
parents:
1092
diff
changeset
|
236 XMLUI_DIALOG_FILE = "file" |
490a8a4536b6
core (constants): added constants mainly used in XMLUI
Goffi <goffi@goffi.org>
parents:
1092
diff
changeset
|
237 XMLUI_DATA_ANSWER = "answer" |
490a8a4536b6
core (constants): added constants mainly used in XMLUI
Goffi <goffi@goffi.org>
parents:
1092
diff
changeset
|
238 XMLUI_DATA_CANCELLED = "cancelled" |
490a8a4536b6
core (constants): added constants mainly used in XMLUI
Goffi <goffi@goffi.org>
parents:
1092
diff
changeset
|
239 XMLUI_DATA_TYPE = "type" |
490a8a4536b6
core (constants): added constants mainly used in XMLUI
Goffi <goffi@goffi.org>
parents:
1092
diff
changeset
|
240 XMLUI_DATA_MESS = "message" |
490a8a4536b6
core (constants): added constants mainly used in XMLUI
Goffi <goffi@goffi.org>
parents:
1092
diff
changeset
|
241 XMLUI_DATA_LVL = "level" |
490a8a4536b6
core (constants): added constants mainly used in XMLUI
Goffi <goffi@goffi.org>
parents:
1092
diff
changeset
|
242 XMLUI_DATA_LVL_INFO = "info" |
1108
6bdcaeafca11
core (constants): fixed bad XMLUI level constants
Goffi <goffi@goffi.org>
parents:
1104
diff
changeset
|
243 XMLUI_DATA_LVL_WARNING = "warning" |
6bdcaeafca11
core (constants): fixed bad XMLUI level constants
Goffi <goffi@goffi.org>
parents:
1104
diff
changeset
|
244 XMLUI_DATA_LVL_ERROR = "error" |
1104
490a8a4536b6
core (constants): added constants mainly used in XMLUI
Goffi <goffi@goffi.org>
parents:
1092
diff
changeset
|
245 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
|
246 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
|
247 XMLUI_DATA_BTNS_SET = "buttons_set" |
490a8a4536b6
core (constants): added constants mainly used in XMLUI
Goffi <goffi@goffi.org>
parents:
1092
diff
changeset
|
248 XMLUI_DATA_BTNS_SET_OKCANCEL = "ok/cancel" |
490a8a4536b6
core (constants): added constants mainly used in XMLUI
Goffi <goffi@goffi.org>
parents:
1092
diff
changeset
|
249 XMLUI_DATA_BTNS_SET_YESNO = "yes/no" |
490a8a4536b6
core (constants): added constants mainly used in XMLUI
Goffi <goffi@goffi.org>
parents:
1092
diff
changeset
|
250 XMLUI_DATA_BTNS_SET_DEFAULT = XMLUI_DATA_BTNS_SET_OKCANCEL |
490a8a4536b6
core (constants): added constants mainly used in XMLUI
Goffi <goffi@goffi.org>
parents:
1092
diff
changeset
|
251 XMLUI_DATA_FILETYPE = 'filetype' |
490a8a4536b6
core (constants): added constants mainly used in XMLUI
Goffi <goffi@goffi.org>
parents:
1092
diff
changeset
|
252 XMLUI_DATA_FILETYPE_FILE = "file" |
490a8a4536b6
core (constants): added constants mainly used in XMLUI
Goffi <goffi@goffi.org>
parents:
1092
diff
changeset
|
253 XMLUI_DATA_FILETYPE_DIR = "dir" |
490a8a4536b6
core (constants): added constants mainly used in XMLUI
Goffi <goffi@goffi.org>
parents:
1092
diff
changeset
|
254 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
|
255 |
490a8a4536b6
core (constants): added constants mainly used in XMLUI
Goffi <goffi@goffi.org>
parents:
1092
diff
changeset
|
256 |
991
05e02f8b7eb4
core: logging refactoring, first step:
Goffi <goffi@goffi.org>
parents:
990
diff
changeset
|
257 ## Logging ## |
1942 | 258 LOG_LVL_DEBUG = 'DEBUG' |
259 LOG_LVL_INFO = 'INFO' | |
260 LOG_LVL_WARNING = 'WARNING' | |
261 LOG_LVL_ERROR = 'ERROR' | |
262 LOG_LVL_CRITICAL = 'CRITICAL' | |
263 LOG_LEVELS = (LOG_LVL_DEBUG, LOG_LVL_INFO, LOG_LVL_WARNING, LOG_LVL_ERROR, LOG_LVL_CRITICAL) | |
991
05e02f8b7eb4
core: logging refactoring, first step:
Goffi <goffi@goffi.org>
parents:
990
diff
changeset
|
264 LOG_BACKEND_STANDARD = 'standard' |
05e02f8b7eb4
core: logging refactoring, first step:
Goffi <goffi@goffi.org>
parents:
990
diff
changeset
|
265 LOG_BACKEND_TWISTED = 'twisted' |
05e02f8b7eb4
core: logging refactoring, first step:
Goffi <goffi@goffi.org>
parents:
990
diff
changeset
|
266 LOG_BACKEND_BASIC = 'basic' |
1017
0ea97f483464
core (log): added "custom" backend
Goffi <goffi@goffi.org>
parents:
1010
diff
changeset
|
267 LOG_BACKEND_CUSTOM = 'custom' |
991
05e02f8b7eb4
core: logging refactoring, first step:
Goffi <goffi@goffi.org>
parents:
990
diff
changeset
|
268 LOG_BASE_LOGGER = 'root' |
1007
a7d33c7a8277
core (log): refactoring + twisted backend:
Goffi <goffi@goffi.org>
parents:
1005
diff
changeset
|
269 LOG_TWISTED_LOGGER = 'twisted' |
1010
73a0b7f94674
primitivus: use of new logging system:
Goffi <goffi@goffi.org>
parents:
1007
diff
changeset
|
270 LOG_OPT_SECTION = 'DEFAULT' # section of sat.conf where log options should be |
994
652c01ca69b1
core (log): configuration and environment variables are now checked for log level and colors:
Goffi <goffi@goffi.org>
parents:
991
diff
changeset
|
271 LOG_OPT_PREFIX = 'log_' |
652c01ca69b1
core (log): configuration and environment variables are now checked for log level and colors:
Goffi <goffi@goffi.org>
parents:
991
diff
changeset
|
272 # (option_name, default_value) tuples |
1005
b4af31a8a4f2
core (logs): added formatting, name filter and outputs management:
Goffi <goffi@goffi.org>
parents:
1004
diff
changeset
|
273 LOG_OPT_COLORS = ('colors', 'true') # true for auto colors, force to have colors even if stdout is not a tty, false for no color |
1942 | 274 LOG_OPT_TAINTS_DICT = ('levels_taints_dict', { |
275 LOG_LVL_DEBUG: ('cyan',), | |
276 LOG_LVL_INFO: (), | |
277 LOG_LVL_WARNING: ('yellow',), | |
278 LOG_LVL_ERROR: ('red', 'blink', r'/!\ ', 'blink_off'), | |
279 LOG_LVL_CRITICAL: ('bold', 'red', 'Guru Meditation ', 'normal_weight') | |
280 }) | |
994
652c01ca69b1
core (log): configuration and environment variables are now checked for log level and colors:
Goffi <goffi@goffi.org>
parents:
991
diff
changeset
|
281 LOG_OPT_LEVEL = ('level', 'info') |
1005
b4af31a8a4f2
core (logs): added formatting, name filter and outputs management:
Goffi <goffi@goffi.org>
parents:
1004
diff
changeset
|
282 LOG_OPT_FORMAT = ('fmt', '%(message)s') # similar to logging format. |
b4af31a8a4f2
core (logs): added formatting, name filter and outputs management:
Goffi <goffi@goffi.org>
parents:
1004
diff
changeset
|
283 LOG_OPT_LOGGER = ('logger', '') # regex to filter logger name |
b4af31a8a4f2
core (logs): added formatting, name filter and outputs management:
Goffi <goffi@goffi.org>
parents:
1004
diff
changeset
|
284 LOG_OPT_OUTPUT_SEP = '//' |
b4af31a8a4f2
core (logs): added formatting, name filter and outputs management:
Goffi <goffi@goffi.org>
parents:
1004
diff
changeset
|
285 LOG_OPT_OUTPUT_DEFAULT = 'default' |
b4af31a8a4f2
core (logs): added formatting, name filter and outputs management:
Goffi <goffi@goffi.org>
parents:
1004
diff
changeset
|
286 LOG_OPT_OUTPUT_MEMORY = 'memory' |
b4af31a8a4f2
core (logs): added formatting, name filter and outputs management:
Goffi <goffi@goffi.org>
parents:
1004
diff
changeset
|
287 LOG_OPT_OUTPUT_MEMORY_LIMIT = 50 |
b4af31a8a4f2
core (logs): added formatting, name filter and outputs management:
Goffi <goffi@goffi.org>
parents:
1004
diff
changeset
|
288 LOG_OPT_OUTPUT_FILE = 'file' # file is implicit if only output |
b4af31a8a4f2
core (logs): added formatting, name filter and outputs management:
Goffi <goffi@goffi.org>
parents:
1004
diff
changeset
|
289 LOG_OPT_OUTPUT = ('output', LOG_OPT_OUTPUT_SEP + LOG_OPT_OUTPUT_DEFAULT) # //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) |
994
652c01ca69b1
core (log): configuration and environment variables are now checked for log level and colors:
Goffi <goffi@goffi.org>
parents:
991
diff
changeset
|
290 |
991
05e02f8b7eb4
core: logging refactoring, first step:
Goffi <goffi@goffi.org>
parents:
990
diff
changeset
|
291 |
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
|
292 ## 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
|
293 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
|
294 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
|
295 |
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
|
296 |
1104
490a8a4536b6
core (constants): added constants mainly used in XMLUI
Goffi <goffi@goffi.org>
parents:
1092
diff
changeset
|
297 ## HARD-CODED ACTIONS IDS (generated with uuid.uuid4) ## |
1032
b262ae6d53af
stdui: add ui_profile_manager to interact with frontends when profile authentication is needed
souliane <souliane@mailoo.org>
parents:
1030
diff
changeset
|
298 AUTHENTICATE_PROFILE_ID = u'b03bbfa8-a4ae-4734-a248-06ce6c7cf562' |
1043
066308706dc6
core, stdui (profile manager), quick_app: ask for another XMPP password when profile authentication succeed but XMPP connection fails
souliane <souliane@mailoo.org>
parents:
1032
diff
changeset
|
299 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
|
300 |
b262ae6d53af
stdui: add ui_profile_manager to interact with frontends when profile authentication is needed
souliane <souliane@mailoo.org>
parents:
1030
diff
changeset
|
301 |
1104
490a8a4536b6
core (constants): added constants mainly used in XMLUI
Goffi <goffi@goffi.org>
parents:
1092
diff
changeset
|
302 ## Text values ## |
490a8a4536b6
core (constants): added constants mainly used in XMLUI
Goffi <goffi@goffi.org>
parents:
1092
diff
changeset
|
303 BOOL_TRUE = "true" |
490a8a4536b6
core (constants): added constants mainly used in XMLUI
Goffi <goffi@goffi.org>
parents:
1092
diff
changeset
|
304 BOOL_FALSE = "false" |
490a8a4536b6
core (constants): added constants mainly used in XMLUI
Goffi <goffi@goffi.org>
parents:
1092
diff
changeset
|
305 |
490a8a4536b6
core (constants): added constants mainly used in XMLUI
Goffi <goffi@goffi.org>
parents:
1092
diff
changeset
|
306 |
1222
e6e0ea4dc835
memory: add Parameter "Chat history limit"
souliane <souliane@mailoo.org>
parents:
1211
diff
changeset
|
307 ## Special values used in bridge methods calls ## |
e6e0ea4dc835
memory: add Parameter "Chat history limit"
souliane <souliane@mailoo.org>
parents:
1211
diff
changeset
|
308 HISTORY_LIMIT_DEFAULT = -1 |
e6e0ea4dc835
memory: add Parameter "Chat history limit"
souliane <souliane@mailoo.org>
parents:
1211
diff
changeset
|
309 HISTORY_LIMIT_NONE = -2 |
e6e0ea4dc835
memory: add Parameter "Chat history limit"
souliane <souliane@mailoo.org>
parents:
1211
diff
changeset
|
310 |
e6e0ea4dc835
memory: add Parameter "Chat history limit"
souliane <souliane@mailoo.org>
parents:
1211
diff
changeset
|
311 |
942
598fc223cf59
core: more organisation in constants.py
Goffi <goffi@goffi.org>
parents:
930
diff
changeset
|
312 ## 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
|
313 SAVEFILE_DATABASE = APP_NAME_FILE + ".db" |
942
598fc223cf59
core: more organisation in constants.py
Goffi <goffi@goffi.org>
parents:
930
diff
changeset
|
314 IQ_SET = '/iq[@type="set"]' |
994
652c01ca69b1
core (log): configuration and environment variables are now checked for log level and colors:
Goffi <goffi@goffi.org>
parents:
991
diff
changeset
|
315 ENV_PREFIX = 'SAT_' # Prefix used for environment variables |
1448
227856b13d7a
core: new tools.sat_defer module, and implementation of RTDeferredSessions:
Goffi <goffi@goffi.org>
parents:
1417
diff
changeset
|
316 IGNORE = 'ignore' |
1454
4e2fab4de195
plugin XEP-0277: added mBGetFromManyWithComments to have items + comments in one method call
Goffi <goffi@goffi.org>
parents:
1450
diff
changeset
|
317 NO_LIMIT = -1 # used in bridge when a integer value is expected |
2109
85f3e12e984d
core (memory/cache): file caching handling, first draft:
Goffi <goffi@goffi.org>
parents:
2105
diff
changeset
|
318 DEFAULT_MAX_AGE = 1209600 # default max age of cached files, in seconds |
2123
c42aab22c2c0
plugin XEP-0054, quick frontend(app): various improvments:
Goffi <goffi@goffi.org>
parents:
2109
diff
changeset
|
319 HASH_SHA1_EMPTY = 'da39a3ee5e6b4b0d3255bfef95601890afd80709' |
994
652c01ca69b1
core (log): configuration and environment variables are now checked for log level and colors:
Goffi <goffi@goffi.org>
parents:
991
diff
changeset
|
320 |
1010
73a0b7f94674
primitivus: use of new logging system:
Goffi <goffi@goffi.org>
parents:
1007
diff
changeset
|
321 @classmethod |
73a0b7f94674
primitivus: use of new logging system:
Goffi <goffi@goffi.org>
parents:
1007
diff
changeset
|
322 def LOG_OPTIONS(cls): |
73a0b7f94674
primitivus: use of new logging system:
Goffi <goffi@goffi.org>
parents:
1007
diff
changeset
|
323 """Return options checked for logs""" |
73a0b7f94674
primitivus: use of new logging system:
Goffi <goffi@goffi.org>
parents:
1007
diff
changeset
|
324 # XXX: we use a classmethod so we can use Const inheritance to change default options |
1942 | 325 return(cls.LOG_OPT_COLORS, cls.LOG_OPT_TAINTS_DICT, cls.LOG_OPT_LEVEL, cls.LOG_OPT_FORMAT, cls.LOG_OPT_LOGGER, cls.LOG_OPT_OUTPUT) |
1010
73a0b7f94674
primitivus: use of new logging system:
Goffi <goffi@goffi.org>
parents:
1007
diff
changeset
|
326 |
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
|
327 @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
|
328 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
|
329 """@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
|
330 assert isinstance(value, basestring) |
1459
4c4f88d7b156
plugins xep-0060, xep-0163, xep-0277, groupblog: bloging improvments (huge patch, sorry):
Goffi <goffi@goffi.org>
parents:
1454
diff
changeset
|
331 return value.lower() in (cls.BOOL_TRUE, "1") |
1228
2e1b4e7c8eb8
constants: split C.bool in C.bool and C.str so:
souliane <souliane@mailoo.org>
parents:
1227
diff
changeset
|
332 |
2e1b4e7c8eb8
constants: split C.bool in C.bool and C.str so:
souliane <souliane@mailoo.org>
parents:
1227
diff
changeset
|
333 @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
|
334 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
|
335 """@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
|
336 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
|
337 return cls.BOOL_TRUE if value else cls.BOOL_FALSE |