annotate libervia/frontends/quick_frontend/constants.py @ 4118:07370d2a9bde

plugin XEP-0167: keep media order when starting a call: media content order is relevant when building Jingle contents/SDP notably for bundling. This patch fixes the previous behaviour of always using the same order by keeping the order of the data (i.e. order of original SDP offer). Previous behaviour could lead to call failure. rel 424
author Goffi <goffi@goffi.org>
date Tue, 03 Oct 2023 15:15:24 +0200
parents 26b7ed2817da
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3137
559a625a236b fixed shebangs
Goffi <goffi@goffi.org>
parents: 3136
diff changeset
1 #!/usr/bin/env python3
559a625a236b fixed shebangs
Goffi <goffi@goffi.org>
parents: 3136
diff changeset
2
510
886754295efe quick frontend, primitivus, wix: MUC private messages management
Goffi <goffi@goffi.org>
parents:
diff changeset
3
609
84a6e83157c2 fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents: 572
diff changeset
4 # Primitivus: a SAT frontend
3479
be6d91572633 date update
Goffi <goffi@goffi.org>
parents: 3254
diff changeset
5 # Copyright (C) 2009-2021 Jérôme Poisson (goffi@goffi.org)
510
886754295efe quick frontend, primitivus, wix: MUC private messages management
Goffi <goffi@goffi.org>
parents:
diff changeset
6
609
84a6e83157c2 fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents: 572
diff changeset
7 # This program is free software: you can redistribute it and/or modify
84a6e83157c2 fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents: 572
diff changeset
8 # it under the terms of the GNU Affero General Public License as published by
84a6e83157c2 fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents: 572
diff changeset
9 # the Free Software Foundation, either version 3 of the License, or
84a6e83157c2 fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents: 572
diff changeset
10 # (at your option) any later version.
510
886754295efe quick frontend, primitivus, wix: MUC private messages management
Goffi <goffi@goffi.org>
parents:
diff changeset
11
609
84a6e83157c2 fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents: 572
diff changeset
12 # This program is distributed in the hope that it will be useful,
84a6e83157c2 fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents: 572
diff changeset
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
84a6e83157c2 fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents: 572
diff changeset
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
84a6e83157c2 fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents: 572
diff changeset
15 # GNU Affero General Public License for more details.
510
886754295efe quick frontend, primitivus, wix: MUC private messages management
Goffi <goffi@goffi.org>
parents:
diff changeset
16
609
84a6e83157c2 fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents: 572
diff changeset
17 # You should have received a copy of the GNU Affero General Public License
84a6e83157c2 fixed licences in docstrings (they are now in comments)
Goffi <goffi@goffi.org>
parents: 572
diff changeset
18 # along with this program. If not, see <http://www.gnu.org/licenses/>.
736
6246eb6d64a0 frontends: define the constants with classes and inheritance instance of using __builtin__
souliane <souliane@mailoo.org>
parents: 609
diff changeset
19
4071
4b842c1fb686 refactoring: renamed `sat` package to `libervia.backend`
Goffi <goffi@goffi.org>
parents: 4037
diff changeset
20 from libervia.backend.core import constants
4b842c1fb686 refactoring: renamed `sat` package to `libervia.backend`
Goffi <goffi@goffi.org>
parents: 4037
diff changeset
21 from libervia.backend.core.i18n import _
1327
89dc29afe01c frontends: merge sat_frontends.constants to sat_frontends.quick_frontend.constants
souliane <souliane@mailoo.org>
parents: 1318
diff changeset
22 from collections import OrderedDict # only available from python 2.7
736
6246eb6d64a0 frontends: define the constants with classes and inheritance instance of using __builtin__
souliane <souliane@mailoo.org>
parents: 609
diff changeset
23
510
886754295efe quick frontend, primitivus, wix: MUC private messages management
Goffi <goffi@goffi.org>
parents:
diff changeset
24
736
6246eb6d64a0 frontends: define the constants with classes and inheritance instance of using __builtin__
souliane <souliane@mailoo.org>
parents: 609
diff changeset
25 class Const(constants.Const):
6246eb6d64a0 frontends: define the constants with classes and inheritance instance of using __builtin__
souliane <souliane@mailoo.org>
parents: 609
diff changeset
26
2624
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2618
diff changeset
27 PRESENCE = OrderedDict(
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2618
diff changeset
28 [
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2618
diff changeset
29 ("", _("Online")),
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2618
diff changeset
30 ("chat", _("Free for chat")),
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2618
diff changeset
31 ("away", _("Away from keyboard")),
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2618
diff changeset
32 ("dnd", _("Do not disturb")),
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2618
diff changeset
33 ("xa", _("Extended away")),
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2618
diff changeset
34 ]
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2618
diff changeset
35 )
1327
89dc29afe01c frontends: merge sat_frontends.constants to sat_frontends.quick_frontend.constants
souliane <souliane@mailoo.org>
parents: 1318
diff changeset
36
89dc29afe01c frontends: merge sat_frontends.constants to sat_frontends.quick_frontend.constants
souliane <souliane@mailoo.org>
parents: 1318
diff changeset
37 # from plugin_misc_text_syntaxes
89dc29afe01c frontends: merge sat_frontends.constants to sat_frontends.quick_frontend.constants
souliane <souliane@mailoo.org>
parents: 1318
diff changeset
38 SYNTAX_XHTML = "XHTML"
89dc29afe01c frontends: merge sat_frontends.constants to sat_frontends.quick_frontend.constants
souliane <souliane@mailoo.org>
parents: 1318
diff changeset
39 SYNTAX_CURRENT = "@CURRENT@"
89dc29afe01c frontends: merge sat_frontends.constants to sat_frontends.quick_frontend.constants
souliane <souliane@mailoo.org>
parents: 1318
diff changeset
40 SYNTAX_TEXT = "text"
89dc29afe01c frontends: merge sat_frontends.constants to sat_frontends.quick_frontend.constants
souliane <souliane@mailoo.org>
parents: 1318
diff changeset
41
89dc29afe01c frontends: merge sat_frontends.constants to sat_frontends.quick_frontend.constants
souliane <souliane@mailoo.org>
parents: 1318
diff changeset
42 # XMLUI
89dc29afe01c frontends: merge sat_frontends.constants to sat_frontends.quick_frontend.constants
souliane <souliane@mailoo.org>
parents: 1318
diff changeset
43 SAT_FORM_PREFIX = "SAT_FORM_"
89dc29afe01c frontends: merge sat_frontends.constants to sat_frontends.quick_frontend.constants
souliane <souliane@mailoo.org>
parents: 1318
diff changeset
44 SAT_PARAM_SEPARATOR = "_XMLUI_PARAM_" # used to have unique elements names
89dc29afe01c frontends: merge sat_frontends.constants to sat_frontends.quick_frontend.constants
souliane <souliane@mailoo.org>
parents: 1318
diff changeset
45 XMLUI_STATUS_VALIDATED = "validated"
89dc29afe01c frontends: merge sat_frontends.constants to sat_frontends.quick_frontend.constants
souliane <souliane@mailoo.org>
parents: 1318
diff changeset
46 XMLUI_STATUS_CANCELLED = constants.Const.XMLUI_DATA_CANCELLED
89dc29afe01c frontends: merge sat_frontends.constants to sat_frontends.quick_frontend.constants
souliane <souliane@mailoo.org>
parents: 1318
diff changeset
47
89dc29afe01c frontends: merge sat_frontends.constants to sat_frontends.quick_frontend.constants
souliane <souliane@mailoo.org>
parents: 1318
diff changeset
48 # Roster
2624
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2618
diff changeset
49 CONTACT_GROUPS = "groups"
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2618
diff changeset
50 CONTACT_RESOURCES = "resources"
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2618
diff changeset
51 CONTACT_MAIN_RESOURCE = "main_resource"
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2618
diff changeset
52 CONTACT_SPECIAL = "special"
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2618
diff changeset
53 CONTACT_SPECIAL_GROUP = "group" # group chat special entity
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2618
diff changeset
54 CONTACT_SELECTED = "selected"
2618
fe9888d3fcb6 quick app: added missing docstring in showDialog
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
55 # used in handler to track where the contact is coming from
2624
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2618
diff changeset
56 CONTACT_PROFILE = "profile"
1938
011eff37e21d quick frontend, primitivus: quickContactList refactored to handle several profiles at once
Goffi <goffi@goffi.org>
parents: 1934
diff changeset
57 CONTACT_SPECIAL_ALLOWED = (CONTACT_SPECIAL_GROUP,) # allowed values for special flag
2618
fe9888d3fcb6 quick app: added missing docstring in showDialog
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
58 # set of forbidden names for contact data
2624
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2618
diff changeset
59 CONTACT_DATA_FORBIDDEN = {
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2618
diff changeset
60 CONTACT_GROUPS,
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2618
diff changeset
61 CONTACT_RESOURCES,
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2618
diff changeset
62 CONTACT_MAIN_RESOURCE,
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2618
diff changeset
63 CONTACT_SELECTED,
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2618
diff changeset
64 CONTACT_PROFILE,
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2618
diff changeset
65 }
1327
89dc29afe01c frontends: merge sat_frontends.constants to sat_frontends.quick_frontend.constants
souliane <souliane@mailoo.org>
parents: 1318
diff changeset
66
89dc29afe01c frontends: merge sat_frontends.constants to sat_frontends.quick_frontend.constants
souliane <souliane@mailoo.org>
parents: 1318
diff changeset
67 # Chats
2007
19b9d3f8a6c7 plugin XEP-0085, quick_frontends, primitivus: chat states are working again
Goffi <goffi@goffi.org>
parents: 1972
diff changeset
68 CHAT_STATE_ICON = {
3028
ab2696e34d29 Python 3 port:
Goffi <goffi@goffi.org>
parents: 2771
diff changeset
69 "": " ",
ab2696e34d29 Python 3 port:
Goffi <goffi@goffi.org>
parents: 2771
diff changeset
70 "active": "✔",
ab2696e34d29 Python 3 port:
Goffi <goffi@goffi.org>
parents: 2771
diff changeset
71 "inactive": "☄",
ab2696e34d29 Python 3 port:
Goffi <goffi@goffi.org>
parents: 2771
diff changeset
72 "gone": "✈",
ab2696e34d29 Python 3 port:
Goffi <goffi@goffi.org>
parents: 2771
diff changeset
73 "composing": "✎",
ab2696e34d29 Python 3 port:
Goffi <goffi@goffi.org>
parents: 2771
diff changeset
74 "paused": "…",
1385
0dca4f9b264d primitivus: prefill "Join MUC" dialog with only the JID's node part when in debug version + display error directly from the DBus object
souliane <souliane@mailoo.org>
parents: 1378
diff changeset
75 }
1327
89dc29afe01c frontends: merge sat_frontends.constants to sat_frontends.quick_frontend.constants
souliane <souliane@mailoo.org>
parents: 1318
diff changeset
76
1461
9fce331ba0fd quick_frontend (constants, quick_app, quick_contact_list): blogging refactoring (not finished):
Goffi <goffi@goffi.org>
parents: 1407
diff changeset
77 # Blogs
9fce331ba0fd quick_frontend (constants, quick_app, quick_contact_list): blogging refactoring (not finished):
Goffi <goffi@goffi.org>
parents: 1407
diff changeset
78 ENTRY_MODE_TEXT = "text"
9fce331ba0fd quick_frontend (constants, quick_app, quick_contact_list): blogging refactoring (not finished):
Goffi <goffi@goffi.org>
parents: 1407
diff changeset
79 ENTRY_MODE_RICH = "rich"
9fce331ba0fd quick_frontend (constants, quick_app, quick_contact_list): blogging refactoring (not finished):
Goffi <goffi@goffi.org>
parents: 1407
diff changeset
80 ENTRY_MODE_XHTML = "xhtml"
9fce331ba0fd quick_frontend (constants, quick_app, quick_contact_list): blogging refactoring (not finished):
Goffi <goffi@goffi.org>
parents: 1407
diff changeset
81
1327
89dc29afe01c frontends: merge sat_frontends.constants to sat_frontends.quick_frontend.constants
souliane <souliane@mailoo.org>
parents: 1318
diff changeset
82 # Widgets management
89dc29afe01c frontends: merge sat_frontends.constants to sat_frontends.quick_frontend.constants
souliane <souliane@mailoo.org>
parents: 1318
diff changeset
83 # FIXME: should be in quick_frontend.constant, but Libervia doesn't inherit from it
2624
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2618
diff changeset
84 WIDGET_NEW = "NEW"
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2618
diff changeset
85 WIDGET_KEEP = "KEEP"
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2618
diff changeset
86 WIDGET_RAISE = "RAISE"
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2618
diff changeset
87 WIDGET_RECREATE = "RECREATE"
1318
6c7d89843f1b frontends (quick frontend): use of new getEntitiesData to get cached values for avatars on profile connection.
Goffi <goffi@goffi.org>
parents: 1290
diff changeset
88
1938
011eff37e21d quick frontend, primitivus: quickContactList refactored to handle several profiles at once
Goffi <goffi@goffi.org>
parents: 1934
diff changeset
89 # Updates (generic)
2624
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2618
diff changeset
90 UPDATE_DELETE = "DELETE"
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2618
diff changeset
91 UPDATE_MODIFY = "MODIFY"
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2618
diff changeset
92 UPDATE_ADD = "ADD"
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2618
diff changeset
93 UPDATE_SELECTION = "SELECTION"
2618
fe9888d3fcb6 quick app: added missing docstring in showDialog
Goffi <goffi@goffi.org>
parents: 2562
diff changeset
94 # high level update (i.e. not item level but organisation of items)
2624
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2618
diff changeset
95 UPDATE_STRUCTURE = "STRUCTURE"
1938
011eff37e21d quick frontend, primitivus: quickContactList refactored to handle several profiles at once
Goffi <goffi@goffi.org>
parents: 1934
diff changeset
96
2624
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2618
diff changeset
97 LISTENERS = {
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2618
diff changeset
98 "avatar",
3254
6cf4bd6972c2 core, frontends: avatar refactoring:
Goffi <goffi@goffi.org>
parents: 3168
diff changeset
99 "nicknames",
2624
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2618
diff changeset
100 "presence",
3164
9dc170635bee quick frontend(app): added listener for selected widget
Goffi <goffi@goffi.org>
parents: 3137
diff changeset
101 "selected",
3168
1cb232c9e845 quick frontends (widgets): added widgetNew and widgetDelete listeners:
Goffi <goffi@goffi.org>
parents: 3164
diff changeset
102 "notification",
1cb232c9e845 quick frontends (widgets): added widgetNew and widgetDelete listeners:
Goffi <goffi@goffi.org>
parents: 3164
diff changeset
103 "notificationsClear",
1cb232c9e845 quick frontends (widgets): added widgetNew and widgetDelete listeners:
Goffi <goffi@goffi.org>
parents: 3164
diff changeset
104 "widgetNew",
1cb232c9e845 quick frontends (widgets): added widgetNew and widgetDelete listeners:
Goffi <goffi@goffi.org>
parents: 3164
diff changeset
105 "widgetDeleted",
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3479
diff changeset
106 "profile_plugged",
3065
f8e3789912d0 quick frontend (contact list): added "contactsFilled" event
Goffi <goffi@goffi.org>
parents: 3028
diff changeset
107 "contactsFilled",
2624
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2618
diff changeset
108 "disconnect",
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2618
diff changeset
109 "gotMenus",
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2618
diff changeset
110 "menu",
4037
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3479
diff changeset
111 "progress_finished",
524856bd7b19 massive refactoring to switch from camelCase to snake_case:
Goffi <goffi@goffi.org>
parents: 3479
diff changeset
112 "progress_error",
2624
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2618
diff changeset
113 }
1972
02d21a589be2 quick_frontend, primitivus: notifications refactoring
Goffi <goffi@goffi.org>
parents: 1938
diff changeset
114
02d21a589be2 quick_frontend, primitivus: notifications refactoring
Goffi <goffi@goffi.org>
parents: 1938
diff changeset
115 # Notifications
2624
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2618
diff changeset
116 NOTIFY_MESSAGE = "MESSAGE" # a message has been received
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2618
diff changeset
117 NOTIFY_MENTION = "MENTION" # user has been mentionned
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2618
diff changeset
118 NOTIFY_PROGRESS_END = "PROGRESS_END" # a progression has finised
56f94936df1e code style reformatting using black
Goffi <goffi@goffi.org>
parents: 2618
diff changeset
119 NOTIFY_GENERIC = "GENERIC" # a notification which has not its own type
2135
4e67d6ffea66 quick app: check type in notify
Goffi <goffi@goffi.org>
parents: 2103
diff changeset
120 NOTIFY_ALL = (NOTIFY_MESSAGE, NOTIFY_MENTION, NOTIFY_PROGRESS_END, NOTIFY_GENERIC)