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
178
Issues
178
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
Package Registry
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
b00d2fd2
Commit
b00d2fd2
authored
Aug 26, 2016
by
mathieui
3
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix #3204 (write a /server_part plugin)
parent
a6c4db6c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
74 additions
and
0 deletions
+74
-0
doc/source/plugins/index.rst
doc/source/plugins/index.rst
+6
-0
doc/source/plugins/server_part.rst
doc/source/plugins/server_part.rst
+6
-0
plugins/server_part.py
plugins/server_part.py
+62
-0
No files found.
doc/source/plugins/index.rst
View file @
b00d2fd2
...
...
@@ -271,6 +271,11 @@ Plugin index
Reproduce the behavior of the ``<marquee/>`` html tag.
Server Part
:ref:`Documentation <serverpart-plugin>`
Add a ``/server_part`` command.
Dice
:ref:`Documentation <dice-plugin>`
...
...
@@ -320,3 +325,4 @@ Plugin index
csi
dice
marquee
server_part
doc/source/plugins/server_part.rst
0 → 100644
View file @
b00d2fd2
.. _serverpart-plugin:
Server Part
===========
.. automodule:: server_part
plugins/server_part.py
0 → 100644
View file @
b00d2fd2
"""
This plugin adds a ``/server_part`` command to leave all rooms
on a server.
Command
-------
.. glossary::
/server_part
**Usage:** ``/server_part [<server> [message]]``
Leave all rooms on ``<server>``, if not provided and the current
tab is a MUC tab, it will leave all rooms on the current server.
``[message]`` can indicate a quit message.
"""
from
poezio.plugin
import
BasePlugin
from
poezio.tabs
import
MucTab
from
poezio.decorators
import
command_args_parser
from
poezio.common
import
safeJID
from
poezio.core.structs
import
Completion
class
Plugin
(
BasePlugin
):
def
init
(
self
):
self
.
api
.
add_command
(
'server_part'
,
self
.
command_server_part
,
usage
=
'[<server> [message]]'
,
short
=
'Leave all the rooms on a server'
,
help
=
'Leave all the rooms on a sever.'
,
completion
=
self
.
completion_server_part
)
@
command_args_parser
.
quoted
(
0
,
2
,
defaults
=
[])
def
command_server_part
(
self
,
args
):
current_tab
=
self
.
api
.
current_tab
()
if
not
args
and
not
isinstance
(
current_tab
,
MucTab
):
return
self
.
core
.
command_help
(
'server_part'
)
elif
not
args
:
jid
=
safeJID
(
current_tab
.
name
).
bare
message
=
None
elif
len
(
args
)
==
1
:
jid
=
safeJID
(
args
[
0
]).
domain
if
not
jid
:
return
self
.
core
.
command_help
(
'server_part'
)
message
=
None
else
:
jid
=
safeJID
(
args
[
0
]).
domain
if
not
jid
:
return
self
.
core
.
command_help
(
'server_part'
)
message
=
args
[
1
]
for
tab
in
self
.
core
.
get_tabs
(
MucTab
):
if
tab
.
name
.
endswith
(
jid
):
tab
.
command_part
(
message
)
def
completion_server_part
(
self
,
the_input
):
serv_list
=
set
()
for
tab
in
self
.
core
.
get_tabs
(
MucTab
):
if
tab
.
joined
:
serv
=
safeJID
(
tab
.
name
).
server
serv_list
.
add
(
serv
)
return
Completion
(
the_input
.
new_completion
,
sorted
(
serv_list
),
1
,
' '
)
Link Mauve
@linkmauve
mentioned in issue
#1691 (closed)
·
Aug 21, 2018
mentioned in issue
#1691 (closed)
mentioned in issue #1691
Toggle commit list
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