X-Git-Url: https://git.distorted.org.uk/~mdw/disorder/blobdiff_plain/ffac51d73ab97c4c9c1e6c43b18d54d716000bf6..012c707d5c03631b365886904089d98f3747d308:/server/server.c diff --git a/server/server.c b/server/server.c index a7dee99..ea8c0ed 100644 --- a/server/server.c +++ b/server/server.c @@ -1,6 +1,6 @@ /* * This file is part of DisOrder. - * Copyright (C) 2004, 2005, 2006, 2007 Richard Kettlewell + * Copyright (C) 2004-2008 Richard Kettlewell * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -995,9 +995,18 @@ static int c_nop(struct conn *c, static int c_new(struct conn *c, char **vec, int nvec) { - char **tracks = trackdb_new(0, nvec > 0 ? atoi(vec[0]) : INT_MAX); + int max, n; + char **tracks; + if(nvec > 0) + max = atoi(vec[0]); + else + max = INT_MAX; + if(max <= 0 || max > config->new_max) + max = config->new_max; + tracks = trackdb_new(0, max); sink_printf(ev_writer_sink(c->w), "253 New track list follows\n"); + n = 0; while(*tracks) { sink_printf(ev_writer_sink(c->w), "%s%s\n", **tracks == '.' ? "." : "", *tracks);