summaryrefslogtreecommitdiff
path: root/poezio/core
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2019-02-24 15:47:51 +0100
committermathieui <mathieui@mathieui.net>2019-02-24 15:47:51 +0100
commitcc104f10802721d0a9728f5e55989619c3a4eb1b (patch)
tree32a47235b071462c35e68a419b202c02527929f1 /poezio/core
parentd6952f675b1aed39a2e1c505613392fd36f0e13a (diff)
downloadpoezio-cc104f10802721d0a9728f5e55989619c3a4eb1b.tar.gz
poezio-cc104f10802721d0a9728f5e55989619c3a4eb1b.tar.bz2
poezio-cc104f10802721d0a9728f5e55989619c3a4eb1b.tar.xz
poezio-cc104f10802721d0a9728f5e55989619c3a4eb1b.zip
Only server-cycle on exact server matches (#3412)
Diffstat (limited to 'poezio/core')
-rw-r--r--poezio/core/commands.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/poezio/core/commands.py b/poezio/core/commands.py
index 2cb2b291..fd6279ec 100644
--- a/poezio/core/commands.py
+++ b/poezio/core/commands.py
@@ -9,6 +9,7 @@ log = logging.getLogger(__name__)
import asyncio
from xml.etree import cElementTree as ET
+from slixmpp import JID, InvalidJID
from slixmpp.exceptions import XMPPError
from slixmpp.xmlstream.xmlstream import NotConnectedError
from slixmpp.xmlstream.stanzabase import StanzaBase
@@ -632,12 +633,18 @@ class CommandCore:
def server_cycle(self, args):
"""
Do a /cycle on each room of the given server.
- If none, do it on the current tab
+ If none, do it on the server of the current tab
"""
tab = self.core.tabs.current_tab
message = ""
if args:
- domain = args[0]
+ try:
+ domain = JID(args[0]).domain
+ except InvalidJID:
+ return self.core.information(
+ "Invalid server domain: %s" % args[0],
+ "Error"
+ )
if len(args) == 2:
message = args[1]
else:
@@ -646,7 +653,7 @@ class CommandCore:
else:
return self.core.information("No server specified", "Error")
for tab in self.core.get_tabs(tabs.MucTab):
- if tab.name.endswith(domain):
+ if JID(tab.name).domain == domain:
tab.leave_room(message)
tab.join()