summaryrefslogtreecommitdiff
path: root/plugins/server_part.py
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/server_part.py')
-rw-r--r--plugins/server_part.py16
1 files changed, 9 insertions, 7 deletions
diff --git a/plugins/server_part.py b/plugins/server_part.py
index 7a71d94b..cae2248e 100644
--- a/plugins/server_part.py
+++ b/plugins/server_part.py
@@ -16,10 +16,10 @@ Command
"""
+from slixmpp import JID, InvalidJID
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
@@ -39,16 +39,18 @@ class Plugin(BasePlugin):
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
+ jid = current_tab.jid.bare
message = None
elif len(args) == 1:
- jid = safeJID(args[0]).domain
- if not jid:
+ try:
+ jid = JID(args[0]).domain
+ except InvalidJID:
return self.core.command_help('server_part')
message = None
else:
- jid = safeJID(args[0]).domain
- if not jid:
+ try:
+ jid = JID(args[0]).domain
+ except InvalidJID:
return self.core.command_help('server_part')
message = args[1]
@@ -60,6 +62,6 @@ class Plugin(BasePlugin):
serv_list = set()
for tab in self.core.get_tabs(MucTab):
if tab.joined:
- serv = safeJID(tab.name).server
+ serv = tab.jid.server
serv_list.add(serv)
return Completion(the_input.new_completion, sorted(serv_list), 1, ' ')