+ case UserRemove:
+ target = NULL;
+ /* Only admin can issue this */
+ if (!client->isAdmin) {
+ sendPermissionDenied(client, "Permission denied");
+ break;
+ }
+ while (Client_iterate(&target) != NULL) {
+ if (target->sessionId == msg->payload.userRemove->session)
+ break;
+ }
+ if (target == NULL) {
+ Log_warn("Client with sessionId %d not found", msg->payload.userRemove->session);
+ break;
+ }
+ msg->payload.userRemove->session = target->sessionId;
+ msg->payload.userRemove->has_actor = true;
+ msg->payload.userRemove->actor = client->sessionId;
+
+ if (msg->payload.userRemove->has_ban && msg->payload.userRemove->ban) {
+ if (!getBoolConf(ENABLE_BAN))
+ sendPermissionDenied(client, "Permission denied");
+ else
+ Ban_UserBan(target, msg->payload.userRemove->reason);
+ } else {
+ Log_info_client(target, "User kicked. Reason: '%s'",
+ strlen(msg->payload.userRemove->reason) == 0 ? "N/A" : msg->payload.userRemove->reason);
+ }
+ /* Re-use message */
+ Msg_inc_ref(msg);
+
+ Client_send_message_except(NULL, msg);
+ Client_close(target);
+ break;
+ case BanList:
+ /* Only admin can issue this */
+ if (!client->isAdmin) {
+ sendPermissionDenied(client, "Permission denied");
+ break;
+ }
+ if (!getBoolConf(ENABLE_BAN)) {
+ sendPermissionDenied(client, "Permission denied");
+ break;
+ }
+ if (msg->payload.banList->has_query && msg->payload.banList->query) {
+ /* Create banlist message and add banentrys */
+ sendmsg = Ban_getBanList();
+ Client_send_message(client, sendmsg);
+ } else {
+ /* Clear banlist and set the new one */
+ Ban_clearBanList();
+ Ban_putBanList(msg, msg->payload.banList->n_bans);
+ }
+ break;
+