summaryrefslogtreecommitdiff
path: root/poezio/core
diff options
context:
space:
mode:
Diffstat (limited to 'poezio/core')
-rw-r--r--poezio/core/commands.py13
-rw-r--r--poezio/core/completions.py4
-rw-r--r--poezio/core/core.py21
-rw-r--r--poezio/core/tabs.py9
4 files changed, 28 insertions, 19 deletions
diff --git a/poezio/core/commands.py b/poezio/core/commands.py
index 48042a29..f6794092 100644
--- a/poezio/core/commands.py
+++ b/poezio/core/commands.py
@@ -1011,7 +1011,7 @@ class CommandCore:
jid = None
if args:
try:
- jid = JID(args[0]).full
+ jid = JID(args[0])
except InvalidJID:
self.core.information('Invalid JID %s' % args, 'Error')
return
@@ -1027,7 +1027,7 @@ class CommandCore:
if isinstance(item, Contact):
jid = item.bare_jid
elif isinstance(item, Resource):
- jid = item.jid
+ jid = JID(item.jid)
chattabs = (
tabs.ConversationTab,
@@ -1035,7 +1035,7 @@ class CommandCore:
tabs.DynamicConversationTab,
)
if isinstance(current_tab, chattabs):
- jid = current_tab.jid.bare
+ jid = JID(current_tab.jid.bare)
if jid is None:
self.core.information('No specified JID to block', 'Error')
@@ -1066,7 +1066,7 @@ class CommandCore:
jid = None
if args:
try:
- jid = JID(args[0]).full
+ jid = JID(args[0])
except InvalidJID:
self.core.information('Invalid JID %s' % args, 'Error')
return
@@ -1082,7 +1082,7 @@ class CommandCore:
if isinstance(item, Contact):
jid = item.bare_jid
elif isinstance(item, Resource):
- jid = item.jid
+ jid = JID(item.jid)
chattabs = (
tabs.ConversationTab,
@@ -1090,7 +1090,7 @@ class CommandCore:
tabs.DynamicConversationTab,
)
if isinstance(current_tab, chattabs):
- jid = current_tab.jid.bare
+ jid = JID(current_tab.jid.bare)
if jid is not None:
asyncio.ensure_future(
@@ -1158,6 +1158,7 @@ class CommandCore:
else:
self.core.information('Room %s destroyed' % room, 'Info')
+ room: Optional[JID]
if not args[0] and isinstance(self.core.tabs.current_tab, tabs.MucTab):
room = self.core.tabs.current_tab.general_jid
else:
diff --git a/poezio/core/completions.py b/poezio/core/completions.py
index af71de66..084910a2 100644
--- a/poezio/core/completions.py
+++ b/poezio/core/completions.py
@@ -466,11 +466,11 @@ class CompletionCore:
tabs.StaticConversationTab,
tabs.DynamicConversationTab,
)
- tabjid: List[JID] = []
+ tabjid: List[str] = []
if isinstance(current_tab, chattabs):
tabjid = [current_tab.jid.bare]
- jids = roster.jids()
+ jids = [str(i) for i in roster.jids()]
jids += tabjid
return Completion(
the_input.new_completion, jids, 1, '', quotify=False)
diff --git a/poezio/core/core.py b/poezio/core/core.py
index 2af292f1..81ac6e8a 100644
--- a/poezio/core/core.py
+++ b/poezio/core/core.py
@@ -930,14 +930,17 @@ class Core:
pass
supports_direct = 'jabber:x:conference' in features
if supports_direct:
- invite = self.xmpp.plugin['xep_0249'].send_invitation
+ self.xmpp.plugin['xep_0249'].send_invitation(
+ jid=jid,
+ roomjid=room,
+ reason=reason
+ )
else: # fallback
- invite = self.xmpp.plugin['xep_0045'].invite
- invite(
- jid=jid,
- room=room,
- reason=reason
- )
+ self.xmpp.plugin['xep_0045'].invite(
+ jid=jid,
+ room=room,
+ reason=reason or '',
+ )
return True
def _impromptu_room_form(self, room):
@@ -1259,7 +1262,7 @@ class Core:
return tab
def open_new_room(self,
- room: str,
+ room: JID,
nick: str,
*,
password: Optional[str] = None,
@@ -1773,7 +1776,7 @@ class Core:
remote_bookmarks = self.bookmarks.remote()
self.join_initial_rooms(remote_bookmarks)
- def room_error(self, error: IqError, room_name: str) -> None:
+ def room_error(self, error, room_name: str) -> None:
"""
Display the error in the tab
"""
diff --git a/poezio/core/tabs.py b/poezio/core/tabs.py
index 1e0a035d..6d0589ba 100644
--- a/poezio/core/tabs.py
+++ b/poezio/core/tabs.py
@@ -171,12 +171,17 @@ class Tabs:
return any_matched, candidate
- def by_name_and_class(self, name: str,
+ def by_name_and_class(self, name: Union[str, JID],
cls: Type[T]) -> Optional[T]:
"""Get a tab with its name and class"""
+ if isinstance(name, JID):
+ str_name = name.full
+ else:
+ str_name = name
+ str
cls_tabs = self._tab_types.get(cls, [])
for tab in cls_tabs:
- if tab.name == name:
+ if tab.name == str_name:
return cast(T, tab)
return None