Add command handling to module control.
commite1cbdcb8c2294accb0f5b1758404a0a5b6e55d78
authorDavid Brodsky <trekie@sinister.cz>
Thu, 21 Jun 2007 11:18:38 +0000 (21 13:18 +0200)
committerDavid Brodsky <trekie@sinister.cz>
Thu, 21 Jun 2007 11:18:38 +0000 (21 13:18 +0200)
tree793aa0a501569fdfa52b1b0b0c6fed5734fb6c65
parentaf90251149c4ea0ab5d13398f09726be1b270917
Add command handling to module control.

Each command that is sent to the server must have request field with command
name. If the command was successful then it returns "status" field set to "ok";
otherwise it is set to "failed".

There is implemented only one command "torrent list" at the moment. It returns
dictionary with following fields:
info hash - 20 byte string with SHA1 hash of
the info part of metainfo file
metainfo - content of the metainfo file
file - name of the metainfo file
bitfield - bit array with completed pieces
remaining - number of pieces to download

Failed response has a field "response" set to string describing the error:
malformed request - request is not proper bencoded dictionary; additional field
"reason" specifies the error
unknown request - server know nothing about sent command
src/control/connection.cpp
src/control/connection.h
src/control/controlmodule.cpp