KGB_protocol - specification of the client-server communication protocol
The protocol used by the KGB collaboration service is based on JSON-RPC (http://json-rpc.org/).
KGB service helps collaboration by relaying notifications about commits in a version control system to IRC. It consists of client, hooked to the version control system which sends information about changes to the server, and a server, listening for client's notifications and relaying them on configured IRC channels.
Message content is authenticated by using two HTTP headers. The X-KGB-Project header must contain the project ID, as defined in server's configuration. The X-KGB-Auth header must contain a SHA1 hash (in hexadecimal notation) calculated over the shared secret, the project ID and the JSON-encoded message.
Upon receiving the HTTP request the server calculates the hash using the supplied project ID, the server copy of the shared secret for that project and the content of the HTTP request. If the hash matches the one provided in the X-KGB-Auth header, the authentication succeeds and the request is processed. Otherwise an error is returned.
This method takes information about a single commit and relays it to IRC. arguments is a map with the members described below. Any additional members are ignored.
A string identifying the commit in the version control system. Git (short) hash, Subversion revision number, this kind of thing.
A string to prepend to the commit ID when displaying on IRC.
r is particularly useful for Subversion repositories.
A string representing the commit author.
A string representing the commit branch.
A string representing the commit module or sub-project.
The commit message.
List of changes files/directories in the commit.
Each string is a path,
optionaly prepended with
(A) for added paths,
(M) for modified paths and
(D) for deleted paths.
If no prefix is given modification is assumed.
An additional plus sign flags property changes (Specific to Subversion term),
A map with additional parameters. Currently supported members are:
This method takes only one string argument which is the message to relay to IRC. There are no restrictions or requirements to the message content, which is relayed verbatim to project's IRC channels.
Authentication errors use HTTP code
while other errors -- bad or missing headers and problems with the JSON data use HTTP code
The error text is in the reason phrase of the HTTP status line (see RFC 2616, section 6.1).
After successful authentication and decoding of the JSON request, all the errors are reported as mandated by the JSON-RPC specification.
Copyright (C) 2012 Damyan Ivanov
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 the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.