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
205
Issues
205
List
Boards
Labels
Service Desk
Milestones
Merge Requests
10
Merge Requests
10
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
4d7a19da
Commit
4d7a19da
authored
Nov 21, 2019
by
Maxime Buquet
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'safejid-foo' into 'master'
Safejid foo See merge request
!50
parents
d65ad614
f157a46b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
14 deletions
+18
-14
poezio/core/commands.py
poezio/core/commands.py
+18
-14
No files found.
poezio/core/commands.py
View file @
4d7a19da
...
...
@@ -2,13 +2,10 @@
Global commands which are to be linked to the Core class
"""
import
logging
log
=
logging
.
getLogger
(
__name__
)
import
asyncio
from
xml.etree
import
cElementTree
as
ET
from
typing
import
List
,
Optional
,
Tuple
import
logging
from
slixmpp
import
JID
,
InvalidJID
from
slixmpp.exceptions
import
XMPPError
...
...
@@ -25,15 +22,16 @@ from poezio.common import safeJID
from
poezio.config
import
config
,
DEFAULT_CONFIG
,
options
as
config_opts
from
poezio
import
multiuserchat
as
muc
from
poezio.contact
import
Contact
from
poezio
import
windows
from
poezio.plugin
import
PluginConfig
from
poezio.roster
import
roster
from
poezio.theming
import
dump_tuple
,
get_theme
from
poezio.decorators
import
command_args_parser
from
poezio.core.structs
import
Command
,
POSSIBLE_SHOW
log
=
logging
.
getLogger
(
__name__
)
class
CommandCore
:
def
__init__
(
self
,
core
):
self
.
core
=
core
...
...
@@ -940,19 +938,25 @@ class CommandCore:
"disconnected"
,
self
.
core
.
exit
,
disposable
=
True
)
@
command_args_parser
.
quoted
(
0
,
1
,
[
''
])
def
destroy_room
(
self
,
args
)
:
def
destroy_room
(
self
,
args
:
List
[
str
])
->
None
:
"""
/destroy_room [JID]
"""
room
=
safeJID
(
args
[
0
]).
bare
if
room
:
muc
.
destroy_room
(
self
.
core
.
xmpp
,
room
)
elif
isinstance
(
self
.
core
.
tabs
.
current_tab
,
tabs
.
MucTab
)
and
not
args
[
0
]:
if
not
args
[
0
]
and
isinstance
(
self
.
core
.
tabs
.
current_tab
,
tabs
.
MucTab
):
muc
.
destroy_room
(
self
.
core
.
xmpp
,
self
.
core
.
tabs
.
current_tab
.
general_jid
)
else
:
self
.
core
.
information
(
'Invalid JID: "%s"'
%
args
[
0
],
'Error'
)
return
None
try
:
room
=
JID
(
args
[
0
]).
bare
if
room
:
muc
.
destroy_room
(
self
.
core
.
xmpp
,
room
)
return
None
except
InvalidJID
:
pass
self
.
core
.
information
(
'Invalid JID: "%s"'
%
args
[
0
],
'Error'
)
return
None
@
command_args_parser
.
quoted
(
1
,
1
,
[
''
])
def
bind
(
self
,
args
):
...
...
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