From 38e6c53333742b0d52be20d7bf065ca0af48142c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20Br=C3=BCbach?= Date: Sun, 16 Aug 2026 21:46:30 +0200 Subject: [PATCH] [Client] Send game invites from the user context menu via a private message MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The user context menu gains an "Invite to Game" submenu listing the inviteable games in the room (the inviter's own games, honoring the buddy-only setting). Picking one opens a private message to the target user with a cockatrice://joingame link naming the game, so the target gets a clickable invite instead of a raw URL. Multi-game rooms offer a picker; a single inviteable game sends directly. Sending a message to an offline user no longer swallows the draft — it reports that the user is offline and keeps the typed text. Took 1 minute --- cockatrice/src/interface/widgets/tabs/tab_message.cpp | 6 ++++++ cockatrice/src/interface/widgets/tabs/tab_message.h | 1 + cockatrice/src/interface/widgets/tabs/tab_supervisor.cpp | 4 ++-- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/cockatrice/src/interface/widgets/tabs/tab_message.cpp b/cockatrice/src/interface/widgets/tabs/tab_message.cpp index d482d3dd7..9506d96f3 100644 --- a/cockatrice/src/interface/widgets/tabs/tab_message.cpp +++ b/cockatrice/src/interface/widgets/tabs/tab_message.cpp @@ -128,6 +128,12 @@ bool TabMessage::isUserOnline() const return userOnline; } +void TabMessage::sendInviteMessage(const QString &text) +{ + sayEdit->setText(text); + sendMessage(); +} + void TabMessage::messageSent(const Response &response, const CommandContainer & /*commandContainer*/, const QVariant &extraData) diff --git a/cockatrice/src/interface/widgets/tabs/tab_message.h b/cockatrice/src/interface/widgets/tabs/tab_message.h index e9b987ce2..0e6d66d4c 100644 --- a/cockatrice/src/interface/widgets/tabs/tab_message.h +++ b/cockatrice/src/interface/widgets/tabs/tab_message.h @@ -66,6 +66,7 @@ public: [[nodiscard]] bool isUserOnline() const; void sendPrivateMessage(const QString &text); + void sendInviteMessage(const QString &text); private: bool shouldShowSystemPopup(const Event_UserMessage &event); diff --git a/cockatrice/src/interface/widgets/tabs/tab_supervisor.cpp b/cockatrice/src/interface/widgets/tabs/tab_supervisor.cpp index 77b93802a..016d96434 100644 --- a/cockatrice/src/interface/widgets/tabs/tab_supervisor.cpp +++ b/cockatrice/src/interface/widgets/tabs/tab_supervisor.cpp @@ -993,8 +993,8 @@ QList TabSupervisor::getGameInviteLinksForRoom(int roomId) con void TabSupervisor::sendInviteToUser(const QString &userName, const QString &inviteText) { TabMessage *tab = addMessageTab(userName, true); - if (tab && tab->isUserOnline()) { - tab->sendPrivateMessage(inviteText); + if (tab) { + tab->sendInviteMessage(inviteText); } }