Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion src/game/client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1244,11 +1244,13 @@ namespace client
}
ICOMMAND(IDF_NAMECOMPLETE, kick, "ss", (char *s, char *m), addcontrol(s, -1, m));
ICOMMAND(IDF_NAMECOMPLETE, allow, "ss", (char *s, char *m), addcontrol(s, ipinfo::ALLOW, m));
ICOMMAND(IDF_NAMECOMPLETE, ban, "ss", (char *s, char *m), addcontrol(s, ipinfo::BAN, m));
ICOMMAND(IDF_NAMECOMPLETE, ban, "ss", (char *s, char *m), addcontrol(s, ipinfo::BAN, tempformatstring("%s [%s]", m, getname())));
ICOMMAND(IDF_NAMECOMPLETE, mute, "ss", (char *s, char *m), addcontrol(s, ipinfo::MUTE, m));
ICOMMAND(IDF_NAMECOMPLETE, limit, "ss", (char *s, char *m), addcontrol(s, ipinfo::LIMIT, m));
ICOMMAND(IDF_NAMECOMPLETE, except, "ss", (char *s, char *m), addcontrol(s, ipinfo::EXCEPT, m));

ICOMMAND(0, listbans, "", (), addmsg(N_LISTBANS, "r"));

ICOMMAND(0, clearallows, "", (), addmsg(N_CLRCONTROL, "ri", ipinfo::ALLOW));
ICOMMAND(0, clearbans, "", (), addmsg(N_CLRCONTROL, "ri", ipinfo::BAN));
ICOMMAND(0, clearmutes, "", (), addmsg(N_CLRCONTROL, "ri", ipinfo::MUTE));
Expand Down Expand Up @@ -3249,6 +3251,21 @@ namespace client
break;
}

case N_SENDBANLIST:
{
string ip = "";
int bans = getint(p);
if(bans <= 0) conoutft(CON_EVENT, "\fyBan list is empty");
else loopi(bans)
{
getstring(ip, p);
getstring(text, p);
if(p.overread()) break;
conoutft(CON_EVENT, "\fr%i: %s (reason: %s)", i+1, ip, text);
}
break;
}

case N_DEMOPLAYBACK:
{
bool wasdemopb = demoplayback;
Expand Down
2 changes: 2 additions & 0 deletions src/game/game.h
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,7 @@ enum
N_CLIENT, N_RELOAD, N_REGEN, N_INITAI, N_MAPCRC,
N_SETPLAYERINFO, N_SWITCHTEAM, N_AUTHTRY, N_AUTHCHAL, N_AUTHANS, N_QUEUEPOS,
N_STEAMCHAL, N_STEAMANS, N_STEAMFAIL,
N_LISTBANS, N_SENDBANLIST,
NUMMSG
};

Expand Down Expand Up @@ -430,6 +431,7 @@ char msgsizelookup(int msg)
N_CLIENT, 0, N_RELOAD, 0, N_REGEN, 0, N_INITAI, 0, N_MAPCRC, 0,
N_SETPLAYERINFO, 0, N_SWITCHTEAM, 0, N_AUTHTRY, 0, N_AUTHCHAL, 0, N_AUTHANS, 0, N_QUEUEPOS, 0,
N_STEAMCHAL, 0, N_STEAMANS, 0, N_STEAMFAIL, 0,
N_LISTBANS, 1, N_SENDBANLIST,
-1
};
static int sizetable[NUMMSG] = { -1 };
Expand Down
25 changes: 25 additions & 0 deletions src/game/server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2399,6 +2399,26 @@ namespace server
sendpacket(cn, 1, p.finalize());
}

void listbans(int cn)
{
packetbuf p(MAXTRANS, ENET_PACKET_FLAG_RELIABLE);
string ip = "";
int len = 0;
loopv(control) { if(control[i].type == ipinfo::BAN) len++; }
putint(p, N_SENDBANLIST);
putint(p, len);
loopv(control)
{
if(control[i].type == ipinfo::BAN)
{
printipinfo(control[i], ip);
sendstring(ip, p);
sendstring(control[i].reason, p);
}
}
sendpacket(cn, 1, p.finalize());
}

void cleardemos(int n)
{
if(!n)
Expand Down Expand Up @@ -7323,6 +7343,11 @@ namespace server
listdemos(sender);
break;

case N_LISTBANS:
if(!haspriv(ci, G(banlock), "list bans")) break;
listbans(sender);
break;

case N_GETDEMO:
{
int n = getint(p);
Expand Down