Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
poezio
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
199
Issues
199
List
Boards
Labels
Service Desk
Milestones
Merge Requests
8
Merge Requests
8
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
poezio
poezio
Commits
341c770b
Commit
341c770b
authored
Jan 30, 2021
by
mathieui
Committed by
Link Mauve
Feb 03, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
invite: remove callback and force impromptu rooms to use mediated
parent
048f3d5f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
17 deletions
+29
-17
poezio/core/commands.py
poezio/core/commands.py
+4
-3
poezio/core/core.py
poezio/core/core.py
+25
-14
No files found.
poezio/core/commands.py
View file @
341c770b
...
...
@@ -996,7 +996,7 @@ class CommandCore:
name
=
name
,
server_address
=
address
,
callback
=
dumb_callback
)
@
command_args_parser
.
quoted
(
2
,
1
,
[
None
])
def
invite
(
self
,
args
):
async
def
invite
(
self
,
args
):
"""/invite <to> <room> [reason]"""
if
args
is
None
:
...
...
@@ -1013,8 +1013,9 @@ class CommandCore:
except
InvalidJID
:
self
.
core
.
information
(
'Invalid room JID specified to invite: %s'
%
args
[
1
],
'Error'
)
return
None
self
.
core
.
invite
(
to
.
full
,
room
,
reason
=
reason
)
self
.
core
.
information
(
'Invited %s to %s'
%
(
to
.
bare
,
room
),
'Info'
)
result
=
await
self
.
core
.
invite
(
to
.
full
,
room
,
reason
=
reason
)
if
result
:
self
.
core
.
information
(
'Invited %s to %s'
%
(
to
.
bare
,
room
),
'Info'
)
@
command_args_parser
.
quoted
(
1
,
0
)
def
impromptu
(
self
,
args
:
str
)
->
None
:
...
...
poezio/core/core.py
View file @
341c770b
...
...
@@ -885,25 +885,36 @@ class Core:
self
.
tabs
.
current_tab
.
command_say
(
msg
)
return
True
def
invite
(
self
,
jid
:
JID
,
room
:
JID
,
reason
:
Optional
[
str
]
=
None
)
->
None
:
async
def
invite
(
self
,
jid
:
JID
,
room
:
JID
,
reason
:
Optional
[
str
]
=
None
,
force_mediated
:
bool
=
False
)
->
bool
:
"""
Checks if the sender supports XEP-0249, then send an invitation,
or a mediated one if it does not.
TODO: allow passwords
"""
features
=
set
()
def
callback
(
iq
):
if
not
iq
:
return
if
'jabber:x:conference'
in
iq
[
'disco_info'
].
get_features
():
self
.
xmpp
.
plugin
[
'xep_0249'
].
send_invitation
(
jid
,
room
,
reason
=
reason
)
else
:
# fallback
self
.
xmpp
.
plugin
[
'xep_0045'
].
invite
(
room
,
jid
,
reason
=
reason
or
''
)
self
.
xmpp
.
plugin
[
'xep_0030'
].
get_info
(
jid
=
jid
,
timeout
=
5
,
callback
=
callback
)
# force mediated: act as if the other entity does not
# support direct invites
if
not
force_mediated
:
try
:
iq
=
await
self
.
xmpp
.
plugin
[
'xep_0030'
].
get_info
(
jid
=
jid
,
timeout
=
5
,
)
features
=
iq
[
'disco_info'
].
get_features
()
except
(
IqError
,
IqTimeout
):
pass
supports_direct
=
'jabber:x:conference'
in
features
if
supports_direct
:
invite
=
self
.
xmpp
.
plugin
[
'xep_0249'
].
send_invitation
else
:
# fallback
invite
=
self
.
xmpp
.
plugin
[
'xep_0045'
].
invite
invite
(
jid
=
jid
,
room
=
room
,
reason
=
reason
)
return
True
def
_impromptu_room_form
(
self
,
room
):
fields
=
[
...
...
@@ -990,7 +1001,7 @@ class Core:
self
.
information
(
'Room %s created'
%
room
,
'Info'
)
for
jid
in
jids
:
self
.
invite
(
jid
,
room
)
await
self
.
invite
(
jid
,
room
,
force_mediated
=
True
)
####################### Tab logic-related things ##############################
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment