aboutsummaryrefslogtreecommitdiffstats
path: root/src/command.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
...
* update: job ID must be positiveMax Kellermann2008-10-091-15/+11
| | | | | | | The documentation for directory_update_init() was incorrect: a job ID must be positive, not non-negative. If the update queue is full and no job was created, it makes more sense to return 0 instead of -1, because it is more consistent with the return value of isUpdatingDB().
* diretory: moved code to directory_save.c, directory_print.cMax Kellermann2008-10-091-0/+1
| | | | | | Remove clutter from directory.c. Everything which saves or loads to/from the hard disk goes to directory_save.c, and code which sends directory information to the client is moved into directory_print.c.
* Fix error code for "Playlist already exists"Qball Cow2008-10-091-1/+1
| | | | | | | With commit 6dcd7fea (if I am not mistaken) the error returned when you try to save to an existing playlist is wrong. Instead of MPD_ACK_ERROR_EXIST, MPD_ACK_ERROR_NO_EXIST is returned. This is obviously wrong and breaks gmpc.
* database: renamed functions, "db_" prefix and no CamelCaseMax Kellermann2008-10-081-1/+1
| | | | Yet another CamelCase removal patch.
* database: removed printDirectoryInfo()Max Kellermann2008-10-081-1/+5
| | | | The same can be achieved with directory_print(db_get_directory()).
* directory: moved code to database.cMax Kellermann2008-10-081-0/+1
| | | | | | Taming the directory.c monster, part II: move the database management stuff to database. directory.c should only contain code which works on directory objects.
* directory: moved code to update.cMax Kellermann2008-10-081-0/+1
| | | | | | The source directory.c mixes several libraries: directory object management, database management and database update, resulting in a 1000+ line monster. Move the whole database update code to update.c.
* command: fix return statusEric Wong2008-10-061-17/+8
| | | | | | This got broken when listHandlerFunc was removed. Since we no longer need it and it's confusing, remove processCommandInternal and just use process_command.
* command: get rid of specialized list handlersEric Wong2008-10-061-88/+67
| | | | | | | | commands should really not behave differently if they're issued inside a command list or not; so stop having special handler functions to deal with them. "update" was the only command that used this functionality and I changed that in the last commit to serialize access.
* directory: simplify list update handling logicEric Wong2008-10-061-61/+18
| | | | | | | | | | | | | | Now the "update" command can be issued multiple times regardless of whether the client is in list mode or not. We serialize the update tasks to prevent updates from trampling over each other and will spawn another update task once the current one is finished updating and reaped. Right now we cap the queue size to 32 which is probably enough (I bet most people usually run update with no argument anyways); but we can make it grow/shrink dynamically if needed. There'll still be a hard-coded limit to prevent DoS attacks, though.
* switch to C99 types, part IIMax Kellermann2008-09-291-3/+3
| | | | | Do full C99 integer type conversion in all modules which were not touched by Eric's merged patch.
* command: don't clobber next list value when preparsingEric Wong2008-09-291-3/+6
| | | | | | | This only breaks "update" under list command mode and no other commands. This can be done more optimally without the extra heap allocation via xstrdup(); but is uncommon enough to not matter.
* update: send proper response to the clientMax Kellermann2008-09-251-5/+8
| | | | | | Due to a merge error, I broke the function handleUpdate(). It did not do anything for the global update, and it did not send a proper response to the client. This patch fixes both bugs.
* command: fix command "addid"Max Kellermann2008-09-231-1/+1
| | | | | | With patch 8d2830b3, I broke "addid": it did not return the id of the new song, because of a typo in the return condition (== instead of !=).
* directory: update do its work inside a threadEric Wong2008-09-231-41/+6
| | | | | | | | | A lot of the preparation was needed (and done in previous months) in making update thread-safe, but here it is. This was the first thing I made work inside a thread when I started mpd-uclinux many years ago, and also the last thing I've done in mainline mpd to work inside a thread, go figure.
* playlist: return -1 after assert(0)Max Kellermann2008-09-071-0/+1
| | | | | | | print_playlist_result() had an assert(0) at the end, in case there was an invalid result value. With NDEBUG, this resulted in a function not returning a value - add a dummy "return -1" at the end to keep gcc quiet.
* command: use client_[gs]et_permission()Max Kellermann2008-09-071-78/+83
| | | | | | Don't pass a pointer to client->permission to processCommand(), better let the code in command.c use the new permission getter/setter functions.
* command: don't pass permission as pointer where appropriateMax Kellermann2008-09-071-6/+6
| | | | | Some functions don't want to modify a client's permission set. Pass the permissions to them by value, not by reference.
* audio: don't pass "fd" to printAudioDevices()Max Kellermann2008-09-071-1/+1
| | | | Pass the client struct instead.
* stats: don't pass "fd" to printStats()Max Kellermann2008-09-071-1/+1
| | | | Pass the client struct instead of the raw file descriptor.
* playlist: don't pass "fd" to showPlaylist(), playlistChangesPosId()Max Kellermann2008-09-071-2/+2
| | | | Pass the client struct instead of the raw file descriptor.
* ls: don't pass "fd" to lsPlaylists(), printRemoteUrlHandlers()Max Kellermann2008-09-071-2/+2
| | | | Pass the client struct instead of the raw file descriptor.
* command: concatenate strings at compile timeMax Kellermann2008-09-071-27/+27
| | | | | | String literals (including those defined in CPP macros) can be concatenated at compile time. This saves some CPU cycles in vsnprintf() at run time.
* command: removed commandError()Max Kellermann2008-09-071-25/+0
| | | | | commandError() has been superseded by command_error(), and is not being used anymore. Remove it.
* playlist: pass struct client to loadPlaylist()Max Kellermann2008-09-071-1/+1
| | | | | | | The function loadPlaylist() wants to report incremental errors to the client, for this reason we cannot remove its protocol dependency right now. Instead, make it use the client struct instead of the raw file descriptor.
* pass "struct client" to dbUtils.c, song.c, tag_print.cMax Kellermann2008-09-071-16/+16
| | | | | | Don't pass the raw file descriptor around. This migration patch is rather large, because all of the sources have inter dependencies - we have to change all of them at the same time.
* command: pass struct client to all commandsMax Kellermann2008-09-071-248/+259
| | | | | | | Pass the client struct to CommandHandlerFunction and CommandListHandlerFunction. Most commands cannot take real advantage of that yet, since most of them still work with the raw file descriptor.
* command: pass struct client to getCommandEntryAnd...()Max Kellermann2008-09-071-26/+21
| | | | | Instead of passing the file descriptor, pass the client struct to getCommandEntryAndCheckArgcAndPermission().
* command: added command_success() and command_error()Max Kellermann2008-09-071-0/+28
| | | | | | | These two functions take a client struct instead of the file descriptor. We will now begin passing the client struct around instead of a raw file descriptor (which needed a linear lookup in the client list to be useful).
* audio: don't pass "fd" to {en,dis}ableAudioDevice()Max Kellermann2008-09-071-4/+14
| | | | No protocol code in the audio output library.
* volume: don't pass "fd" to changeVolumeLevel()Max Kellermann2008-09-071-4/+16
| | | | | The "volume" library shouldn't talk to the client. Move error handling to command.c.
* directory: don't pass "fd" to updateInit()Max Kellermann2008-09-071-5/+43
| | | | Again, move error handling to command.c.
* directory: printDirectoryInfo() does not call commandError()Max Kellermann2008-09-071-1/+3
| | | | Move another ocurrence of error handling over to command.c.
* directory: don't pass fd to traverseAllIn()Max Kellermann2008-09-071-4/+43
| | | | | | | | This patch continues the work of the previous patch: don't pass a file descriptor at all to traverseAllIn(). Since this fd was only used to report "directory not found" errors, we can easily move that check to the caller. This is a great relief, since it removes the dependency on a client connection from a lot of enumeration functions.
* playlist: PlaylistInfo() does not call commandError()Max Kellermann2008-09-071-2/+14
| | | | | | Continuing the effort of removing protocol specific calls from the core libraries: let the command.c code call commandError() based on PlaylistInfo's return value.
* playlist: don't pass "fd" to storedPlaylist.c functionsMax Kellermann2008-09-071-8/+23
| | | | | Return an "enum playlist_result" value instead of calling commandError() in storedPlaylist.c.
* playlist: don't pass "fd" to playlist.c functionsMax Kellermann2008-09-071-36/+126
| | | | | | The playlist library shouldn't talk to the client if possible. Introduce the "enum playlist_result" type which the caller (i.e. command.c) may use to generate an error message.
* playlist: showPlaylist() and shufflePlaylist() cannot failMax Kellermann2008-09-071-2/+4
| | | | Make them both return void.
* playlist: moved "repeat" and "random" value checks to command.cMax Kellermann2008-09-071-2/+18
| | | | | | | | Client's input values should be validated by the command implementation, and the core libraries shouldn't talk to the client directly if possible. Thus, setPlaylistRepeatStatus() and setPlaylistRandomStatus() don't get the file descriptor, and cannot fail (return void).
* tag: moved code to tag_print.cMax Kellermann2008-09-071-0/+1
| | | | | Move everything which dumps a tag to a file descriptor to tag_print.c. This relaxes dependencies and splits the code into smaller parts.
* client: added client_write() and client_puts()Max Kellermann2008-09-071-2/+1
| | | | | | client_write() writes a buffer to the client and buffers it if required. client_puts() does the same for a C string. The next patch will add more tools which will replace fdprintf() later.
* include cleanupMax Kellermann2008-09-061-0/+1
| | | | As usual, include only headers which are really needed.
* tag: renamed functions, no CamelCaseMax Kellermann2008-08-291-1/+1
|
* export the function client_is_expired()Max Kellermann2008-08-291-2/+2
| | | | | | | Instead of passing the pointer to the "expired" flag to processListOfCommands(), this function should use the client API to check this flag. We can now remove the "global_expired" hack introduced recently.
* client: pass the client struct to processCommand()Max Kellermann2008-08-291-5/+9
| | | | | | | | Start exporting the client struct as an opaque struct. For now, pass it only to processCommand() and processListOfCommands(), and provide a function to extract the socket handle. Later, we will propagate the pointer to all command implementations, and of course to client_print() etc.
* include cleanupMax Kellermann2008-08-281-0/+1
| | | | Only include headers which are really needed.
* renamed player.c to player_control.cMax Kellermann2008-08-261-1/+1
| | | | | Give player.c a better name, meaning that the code is used to control the player thread.
* playlist: eliminate unused fd parametersMax Kellermann2008-08-261-8/+12
| | | | | Again, remove file descriptor parameters, which are not actually used. These functions can also be converted to return void.
* player: no "fd" and no return valueMax Kellermann2008-08-261-2/+5
| | | | | Most player*() functions do not actually use the file descriptor, and always return 0 (success). Eliminate them to get a leaner interface.
* moved struct AudioFormat to audio_format.hMax Kellermann2008-08-261-0/+1
| | | | | We want to expose the AudioFormat structure to plugins; remove some clutter by moving its declaration to a separate header file.