/** * @file deck_share_utils.h * @ingroup DeckShareWidgets */ //! \todo Document this file. #ifndef DECK_SHARE_UTILS_H #define DECK_SHARE_UTILS_H #include #include class AbstractClient; class Response; /** * @brief Shared helpers for creating temporary deck shares. */ namespace DeckShareUtils { /** * @brief The outcome of a successful share-create response. */ struct ShareResponse { QString link; ///< The share link that was copied to the clipboard. QDateTime expiry; ///< When the share expires (UTC). }; /** * @brief Builds the cockatrice:// link for a freshly created deck share. * @param client Used to embed the target server's hostname and port. * @param token The share token from Response_DeckShareCreate. */ QString buildShareLink(const AbstractClient *client, const QString &token); /** * @brief Copies the share link to the clipboard. * @return The link that was copied. */ QString copyShareLinkToClipboard(const QString &link); /** * @brief Formats the expiration timestamp for a share. */ QString formatShareExpiry(const QDateTime &expiry); /** * @brief Handles a successful Response_DeckShareCreate: builds the share link, * copies it to the clipboard, and derives the share expiry. * @param client Used to embed the target server's hostname and port. * @param response The successful response carrying the share token and expiry. */ ShareResponse handleShareResponse(const AbstractClient *client, const Response &response); } // namespace DeckShareUtils #endif // DECK_SHARE_UTILS_H