aboutsummaryrefslogtreecommitdiffstats
path: root/src/command.c
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2008-01-26 12:46:49 +0000
committerEric Wong <normalperson@yhbt.net>2008-01-26 12:46:49 +0000
commit2f0e5bfd8546f91bf0fed17d7ba68545fd4c43ef (patch)
tree00e2cfe5a8c4b903cdb95d149282c9fc04dad855 /src/command.c
parent2dafd9cd5693e3048dcf3050d102177226a0fda7 (diff)
downloadmpd-2f0e5bfd8546f91bf0fed17d7ba68545fd4c43ef.tar.gz
mpd-2f0e5bfd8546f91bf0fed17d7ba68545fd4c43ef.tar.xz
mpd-2f0e5bfd8546f91bf0fed17d7ba68545fd4c43ef.zip
addToPlaylist/addSongToPlaylist: printId argument changed to added_id
Instead of printing out the Id from playlist.c, instead set the integer that added_id poitns to if added_id is non-NULL. This makes the API cleaner and will allow us to use additional commands to manipulate the newly-added song_id. Callers (handleAddId) that relied on printId to print it to the given fd have now been modified to print the ID at a higher-level; making playlist.c less-dependent on protocol details. git-svn-id: https://svn.musicpd.org/mpd/trunk@7149 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to 'src/command.c')
-rw-r--r--src/command.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/command.c b/src/command.c
index ff171496c..79f2019c3 100644
--- a/src/command.c
+++ b/src/command.c
@@ -330,14 +330,19 @@ static int handleAdd(int fd, int *permission, int argc, char *argv[])
char *path = argv[1];
if (isRemoteUrl(path))
- return addToPlaylist(fd, path, 0);
+ return addToPlaylist(fd, path, NULL);
return addAllIn(fd, path);
}
static int handleAddId(int fd, int *permission, int argc, char *argv[])
{
- return addToPlaylist(fd, argv[1], 1);
+ int added_id;
+ int ret = addToPlaylist(fd, argv[1], &added_id);
+
+ if (!ret)
+ fdprintf(fd, "Id: %d\n", added_id);
+ return ret;
}
static int handleDelete(int fd, int *permission, int argc, char *argv[])