Fix size hints for custom widgets

Make sure that ChannelTreeWidget and MetronomeBar give reasonable size
hints so that the default window size is right.

Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
Avoid User_Group::m_logfp close code duplication

Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
Print log message when archiving finishes

Also make User_Group::SetLogDir() semantics safer.  Close existing
m_logfp before opening new one.  This prevents leaks.

Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
Add qmake variables for qtclient branding

Make it easy to rebuild qtclient with custom application name, version,
organization name, and organization domain information.  Specify the
following variables on the qmake command-line:

  $ qmake VERSION=1.0.0 \
          APPNAME='Wahjam' \
          ORGNAME='Wahjam Project' \
          ORGDOMAIN='wahjam.org'

The application name, organization name, and organization domain are
used for Qt settings.  They determine the config file path or Windows
registry keys used by qtclient.

Downstream packagers can use these variables to clearly label their
builds.

Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
Add JammrLoginDialog for Jammr platform single sign-on

The Jammr platform uses single sign-on instead of logging in to each
jam session individually.  The LoginDialog allows the user to provide
log in details or go to a registration web page.  This dialog will be
the first thing displayed by the client.

Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
Factor out NINJAM-specific server browser

The NINJAM server browser parses a specific server list format and
displays Server, Tempo, and User information for each server.

Online jamming platforms use different formats and may present different
information in the server browser.  Therefore it's necessary to factor
out the common ServerBrowser abstract base class and derive specific
classes from it.

Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
Add JammrServerBrowser for Jammr REST API server list

The Jammr API returns a server list from http://<api-root>/livejams/.
We use XML format since Qt 4 does not ship with a JSON module.

Note that for Jammr we don't want to display the server connection
details since they are unlikely to interest the user.  Instead we
display the server's topic along with the usual tempo and user list
information.

Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
Add JammrConnectDialog

The Jammr platform has single sign-on and therefore doesn't require the
user to give a username/password for each server they connect to.  There
are also no anonymous users.

These differences to the NINJAM connection model make it worth having a
separate "Connect to server..." dialog for Jammr.

Note that ConnectDialog::loadServerList() takes a URL but
JammrConnectDialog takes the URL through its constructor.  This
difference is because JammrConnectDialog also needs the API URL in the
future for creating private jams.  This functionality is added in a
later patch.

Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
Add Jammr login mode to qtclient

When the jammr/apiUrl setting is present, the client will log in to the
Jammr platform instead of using the NINJAM server browser.

We currently hardcode a test server and there is no Jammr server browser
available yet.

Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
Add Jammr REST API token-based user info lookup

The Jammr platform uses centralized user accounts instead of defining
users in the server configuration file.  This patch adds the
JammrUserLookup class and implements the token REST API for
authentication.

The authentication flow works like this:

1. Client generates secret token and stores it in Jammr platform using
   REST API.  This step is SSL encrypted and uses HTTP Basic
   Authentication to log in as the user.

2. Server generates challenge (salt) and sents it to the client.

3. Client replies with hashed challenge, username, and token.  Note the
   password is never sent to the server.

4. Server fetches the token from the Jammr REST API and performs the
   same hash of challenge, username, and token.  If the result matches
   what the client sent, then the client has proved its ability to log
   in to the Jammr platform.

Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
Add JammrApi wahjamsrv config file option

The Jammr platform uses a centralized user database.  This requires a
REST API call to verify login details, instead of using user information
from the local configuration file.

The new "JammrApi" config file option turns on Jammr user lookup:

  JammrApi http://api.hostname/ username password servername

Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
Add "New Jam" button to JammrConnectDialog

The Jammr platform allows users to create private jams.  This is done
with a POST request to the livejams/ REST API URL.  The return value
contains the server connection details.  The client will then connect to
the server.

Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
Rename PROTO_VER_* to PROTO_NINJAM_VER_*

Make it clear which protocol is meant by renaming PROTO_VER_* related
macros to PROTO_NINJAM_VER_*.

Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
Add Jammr protocol version

The Jammr protocol is based on NINJAM but is incompatible because all
text is UTF-8 encoded whereas the encoding is undefined for NINJAM
clients.  Additional protocol extensions are being developed and make it
necessary to use a different protocol version number from NINJAM to
prevent collisions in the future.

The number 0x80000000 was chosen to give NINJAM and other variants
plenty of room.

Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
Move user privileges to common/UserPrivs.h

User privilege bits will be used by both the server and the client.
Move the code to a common location.

Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
Send user privileges from server to client

The Jammr protocol PRIVS chat message notifies the client of its
privileges.  This allows the client to display GUI widgets for actions
like setting the topic or kicking users.

Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
Enable Vote menu when user has PRIV_VOTE

Now that the client knows its user privileges, we can reflect the
privileges in the GUI.  If the user has PRIV_VOTE, then the vote menu is
enabled while connected to the server.

Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
Add Admin menu for topic, bpm, and bpi

There are several administrator commands available to privileged users.
This patch adds an Admin menu and enables the actions if the user has
sufficient privileges.  The dialogs are really just shortcuts for the
/topic, /bpm, and /bpi commands.

Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
Add Kick submenu to Admin menu

Users may have privileges to kick others.  The Kick submenu exposes the
/kick command in the GUI.

Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
Add JammrAccessControlDialog for managing ACLs

The Jammr platform allows users to control who may join their private
jams.  The JammrAccessControlDialog is a GUI for manipulating the access
control lists.

Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>