diff --git a/fteqtv/control.c b/fteqtv/control.c
index c6e3ccfe2..74033aabe 100644
--- a/fteqtv/control.c
+++ b/fteqtv/control.c
@@ -435,6 +435,7 @@ int main(int argc, char **argv)
cluster.allownqclients = true;
strcpy(cluster.hostname, DEFAULT_HOSTNAME);
cluster.buildnumber = build_number();
+ cluster.maxproxies = -1;
Sys_Printf(&cluster, "QTV Build %i.\n", cluster.buildnumber);
diff --git a/fteqtv/forward.c b/fteqtv/forward.c
index 41890ac93..b69f8357c 100644
--- a/fteqtv/forward.c
+++ b/fteqtv/forward.c
@@ -70,7 +70,7 @@ void SV_FindProxies(SOCKET sock, cluster_t *cluster, sv_t *defaultqtv)
if (sock == INVALID_SOCKET)
return;
- if (cluster->numproxies >= cluster->maxproxies && cluster->maxproxies)
+ if (cluster->maxproxies >= 0 && cluster->numproxies >= cluster->maxproxies)
{
const char buffer[] = {dem_all, 1, 'P','r','o','x','y',' ','i','s',' ','f','u','l','l','.'};
send(sock, buffer, strlen(buffer), 0);
@@ -437,6 +437,100 @@ void SV_ForwardStream(sv_t *qtv, char *buffer, int length)
}
}
+static const char qfont_table[256] = {
+ '\0', '#', '#', '#', '#', '.', '#', '#',
+ '#', 9, 10, '#', ' ', 13, '.', '.',
+ '[', ']', '0', '1', '2', '3', '4', '5',
+ '6', '7', '8', '9', '.', '<', '=', '>',
+ ' ', '!', '"', '#', '$', '%', '&', '\'',
+ '(', ')', '*', '+', ',', '-', '.', '/',
+ '0', '1', '2', '3', '4', '5', '6', '7',
+ '8', '9', ':', ';', '<', '=', '>', '?',
+ '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G',
+ 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O',
+ 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W',
+ 'X', 'Y', 'Z', '[', '\\', ']', '^', '_',
+ '`', 'a', 'b', 'c', 'd', 'e', 'f', 'g',
+ 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o',
+ 'p', 'q', 'r', 's', 't', 'u', 'v', 'w',
+ 'x', 'y', 'z', '{', '|', '}', '~', '<',
+
+ '<', '=', '>', '#', '#', '.', '#', '#',
+ '#', '#', ' ', '#', ' ', '>', '.', '.',
+ '[', ']', '0', '1', '2', '3', '4', '5',
+ '6', '7', '8', '9', '.', '<', '=', '>',
+ ' ', '!', '"', '#', '$', '%', '&', '\'',
+ '(', ')', '*', '+', ',', '-', '.', '/',
+ '0', '1', '2', '3', '4', '5', '6', '7',
+ '8', '9', ':', ';', '<', '=', '>', '?',
+ '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G',
+ 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O',
+ 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W',
+ 'X', 'Y', 'Z', '[', '\\', ']', '^', '_',
+ '`', 'a', 'b', 'c', 'd', 'e', 'f', 'g',
+ 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o',
+ 'p', 'q', 'r', 's', 't', 'u', 'v', 'w',
+ 'x', 'y', 'z', '{', '|', '}', '~', '<'
+};
+
+void HTMLprintf(char *outb, int outl, char *fmt, ...)
+{
+ va_list val;
+ char qfmt[8192*4];
+ char *inb = qfmt;
+
+ va_start(val, fmt);
+ vsnprintf(qfmt, sizeof(qfmt), fmt, val);
+ va_end(val);
+ qfmt[sizeof(qfmt)-1] = 0;
+
+ outl--;
+ outl -= 5;
+ while (outl > 0 && *inb)
+ {
+ if (*inb == '<')
+ {
+ *outb++ = '&';
+ *outb++ = 'l';
+ *outb++ = 't';
+ *outb++ = ';';
+ outl -= 4;
+ }
+ else if (*inb == '>')
+ {
+ *outb++ = '&';
+ *outb++ = 'g';
+ *outb++ = 't';
+ *outb++ = ';';
+ outl -= 4;
+ }
+ else if (*inb == '\n')
+ {
+ *outb++ = '<';
+ *outb++ = 'b';
+ *outb++ = 'r';
+ *outb++ = '/';
+ *outb++ = '>';
+ outl -= 5;
+ }
+ else if (*inb == '&')
+ {
+ *outb++ = '&';
+ *outb++ = 'a';
+ *outb++ = 'm';
+ *outb++ = 'p';
+ *outb++ = ';';
+ outl -= 5;
+ }
+ else
+ {
+ *outb++ = qfont_table[*(unsigned char*)inb];
+ }
+ inb++;
+ }
+ *outb++ = 0;
+}
+
void SV_GenerateNowPlayingHTTP(cluster_t *cluster, oproxy_t *dest)
{
int player;
@@ -462,28 +556,41 @@ void SV_GenerateNowPlayingHTTP(cluster_t *cluster, oproxy_t *dest)
for (streams = cluster->servers; streams; streams = streams->next)
{
- sprintf(buffer, "%s (%s: %s)
", streams->streamid, streams->server, streams->gamedir, streams->mapname);
+ sprintf(buffer, "", streams->streamid);
Net_ProxySend(cluster, dest, buffer, strlen(buffer));
+ HTMLprintf(buffer, sizeof(buffer), "%s (%s: %s)", streams->server, streams->gamedir, streams->mapname);
+ Net_ProxySend(cluster, dest, buffer, strlen(buffer));
+ s = "
";
+ Net_ProxySend(cluster, dest, s, strlen(s));
for (player = 0; player < MAX_CLIENTS; player++)
{
if (*streams->players[player].userinfo)
{
Info_ValueForKey(streams->players[player].userinfo, "name", plname, sizeof(plname));
- sprintf(buffer, " %s
", plname);
+
+ s = " ";
+ Net_ProxySend(cluster, dest, s, strlen(s));
+ HTMLprintf(buffer, sizeof(buffer), "%s", plname);
Net_ProxySend(cluster, dest, buffer, strlen(buffer));
+ s = "
";
+ Net_ProxySend(cluster, dest, s, strlen(s));
}
}
}
if (!cluster->servers)
{
-
s = "No streams are currently being played
";
Net_ProxySend(cluster, dest, s, strlen(s));
}
- s = "
Available Demos";
+ s = "
Available Demos
";
Net_ProxySend(cluster, dest, s, strlen(s));
+ s = "Admin
";
+ Net_ProxySend(cluster, dest, s, strlen(s));
+
+ sprintf(buffer, "
QTV Version: %i www.fteqw.com
", cluster->buildnumber);
+ Net_ProxySend(cluster, dest, buffer, strlen(buffer));
sprintf(buffer, "