payload=IrcMessage(verb='PRIVMSG', params=(target, msg)))
+class _PrivmsgPromptWidget(_ClientPromptWidget):
+
+ def enter(self) -> str:
+ to_return = super().enter()
+ if (not to_return) or to_return[0:1] == '/':
+ return to_return
+ return f'/window.chat {to_return}'
+
+
+class _PrivmsgWindow(_ClientWindow):
+ prompt: _PrivmsgPromptWidget
+
+ def cmd__chat(self, msg: str) -> None:
+ 'PRIVMSG to .chat.'
+ self.cmd__privmsg(self.chat, msg)
+
+
class ClientTui(BaseTui):
'TUI expanded towards Client features.'
def _new_client_window(self, client_id: UUID, chat: str = ''
) -> _ClientWindow:
new_idx = len(self.windows)
- win = _ClientWindow(idx=new_idx, term=self.term, q_out=self.q_out,
- client_id=client_id, chat=chat)
+ win_class = (_PrivmsgWindow if (chat and chat[0].isalpha())
+ else _ClientWindow)
+ win = win_class(idx=new_idx, term=self.term, q_out=self.q_out,
+ client_id=client_id, chat=chat)
self.windows += [win]
self._switch_window(new_idx)
return win