servatrice/cockatrice/src/user_context_menu.h
ebbit1q 1e995cd97c
add option to delete a user's messages (#4362)
* add option to delete a user's messages

add optional parameter remove_messages to the ban and warn commands
add event for clients to redact messages
implement server side command and message handling
implement server history removal
todo: client side implementation

add option to remove messages to moderator action dialogs

add storage of message beginnings to chatview

add redactMessage command
handle Event_RemoveMessages on rooms

this approach is favored over parsing the chatroom after the fact but
will use additional memory to store the block indexes

this also leaves a problem in that user messages from the chat backlog
are not removed in the same way because they don't have a user
associated with them

add workaround for old qt versions

add action for users to remove messages from users in chats

add chat history to userMessagePositions with regex

proper const usage for userName

allow removing the messages of unregistered users

add menus to usernames in chat history

this allows you to remove user messages on chat history as well
this also allows moderators to take actions on users in chat history

Apply suggestions from code review

* readd missing call to handler
2021-09-14 16:05:20 -04:00

69 lines
2.3 KiB
C++

#ifndef USER_CONTEXT_MENU_H
#define USER_CONTEXT_MENU_H
#include "user_level.h"
#include <QObject>
class AbstractClient;
class ChatView;
class CommandContainer;
class QAction;
class QMenu;
class QPoint;
class Response;
class ServerInfo_User;
class TabGame;
class TabSupervisor;
class UserContextMenu : public QObject
{
Q_OBJECT
private:
AbstractClient *client;
const TabSupervisor *tabSupervisor;
TabGame *game;
QAction *aUserName;
QAction *aDetails;
QAction *aShowGames;
QAction *aChat;
QAction *aAddToBuddyList, *aRemoveFromBuddyList;
QAction *aAddToIgnoreList, *aRemoveFromIgnoreList;
QAction *aKick;
QAction *aBan, *aBanHistory;
QAction *aPromoteToMod, *aDemoteFromMod;
QAction *aPromoteToJudge, *aDemoteFromJudge;
QAction *aWarnUser, *aWarnHistory;
signals:
void openMessageDialog(const QString &userName, bool focus);
private slots:
void banUser_processUserInfoResponse(const Response &resp);
void warnUser_processGetWarningsListResponse(const Response &r);
void warnUser_processUserInfoResponse(const Response &resp);
void banUserHistory_processResponse(const Response &resp);
void warnUserHistory_processResponse(const Response &resp);
void adjustMod_processUserResponse(const Response &resp, const CommandContainer &commandContainer);
void banUser_dialogFinished();
void warnUser_dialogFinished();
void gamesOfUserReceived(const Response &resp, const CommandContainer &commandContainer);
public:
UserContextMenu(const TabSupervisor *_tabSupervisor, QWidget *_parent, TabGame *_game = 0);
void retranslateUi();
void showContextMenu(const QPoint &pos,
const QString &userName,
UserLevelFlags userLevel,
bool online = true,
int playerId = -1);
void showContextMenu(const QPoint &pos, const QString &userName, UserLevelFlags userLevel, ChatView *chatView);
void showContextMenu(const QPoint &pos,
const QString &userName,
UserLevelFlags userLevel,
bool online,
int playerId,
const QString &deckHash,
ChatView *chatView = nullptr);
};
#endif