Add Windows installer using NSIS

Add a simple NSIS installer for Windows.  It includes the GPLv2 license
text and the Wahjam client executable.  A Start Menu link is created and
an uninstaller is also available.

Build using:

  $ makensis ninjam/qtclient/installer/windows/installer.nsi

Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
Use channel index instead of iterator value in MainWindow::UserInfoChanged()

The NJClient class usually deals with channel index values (from 0 to
31).  The exception is NJClient::EnumUserChannels() which iterates
sequentially over channel indices:

  /**
   * Return channel index for a given user or -1 if no more channels
   *
   * @useridx: remote user index
   * @i:       iterator value, use 0 on first call and then increment
   */
  int MainWindow::EnumUserChannels(int useridx, int i);

Normally a user with one channel looks like this:

  User: "Bob"
    Channel index 0: "Guitar"

But the channel index is arbitrary and not required to start at 0:

  User: "Jim"
    Channel index 12: "Guitar"

MainWindow::UserInfoChanged() incorrectly used the
NJClient::EnumUserChannels() iterator value instead of the channel
index.  When there is a 1:1 mapping between channels counts and their
indices this will not be noticed.

When the channel count does not map to the channel indices used, the
result is that MainWindow::UserInfoChanged() uses incorrect channel
indices.

This patch fixes a problem where the Mute checkbox does not work.

Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
Stop authentication timeout on login success

We forgot to stop the timer when authentication completes.  This caused
all users to be disconnected after 120 seconds.

Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
Switch wahjamsrv to qDebug() logging

Use qDebug(), qWarning(), qCritical(), and qDebug() consistently.  The
client already uses them and the common ninjam/ code might do so in the
future too.

There is one issue with qDebug(), the documentation says messages should
be in Latin-1 encoding.  I suspect we can use the local 8-bit encoding
again once we install a custom message handler function.  For now,
ensure we use Latin-1.

Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
Put wahjamsrv version information in project file

Move the VERSION #define from ninjamsrv.cpp into wahjamsrv.pro so the
build system has access to it.  We pass the VERSION and COMMIT_ID to all
source files during the build.

Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
Add COMMIT_ID to wahjamsrv startup banner

It is useful to know the git commit ID from which the binary was built.

Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
Install a log message handler for wahjamsrv

We need a log message handler that can log to file so that the LogFile
configuration option in wahjamsrv works.

Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
Add contributors to wahjamsrv copyright output

Significant changes have been made by the Wahjam community, so add
a copyright banner indicating this.

Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
Prefix log messages with user connection info

The logs are more useful when the current connection IP address, port,
and username are included.

Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
Consolidate user connect/disconnect logging

Move connect/disconnect logging into User_Connection and always use the
logging prefix (IP:port [username]).

Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
Drop unused Net_Connection::GetStatus() method

The client and server used to poll Net_Connection::GetStatus() to detect
state changes like disconnects or errors.  Since converting
Net_Connection to QObject the disconnected() signal has replaced this
function and we can remove the GetStatus() method.

Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
Drop ring of last messages in Net_Connection

Net_Connect kept the last 5 messages for debugging purposes.  Now that
logging has been implemented it would be better to use that or packet
captures using an external tool like tcpdump.

Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
Remove broken Net_Message refcount

Reference counting is easy to get wrong and the code does not use it
consistently.  Luckily reference counting is not necessary to manage
Net_Message memory allocation.  It can be replaced with a small change
to the Net_Connection::Send() prototype:

  int Send(Net_Message *msg, bool deleteAfterSend = true)

Callers wishing to broadcast or send a message without deleting it can
set deleteAfterSend to false.  This allows them to delete the message
manually later.  This is used in the server's usercon.cpp code.

With this change in place, it's possible to drop Net_Message reference
counting completely.

Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
Remove unused Net_Connection::status field

State transitions are now communicated using Qt signals.  It is no
longer necessary to store the current state.  The Net_Connection::status
field no longer serves a use and can be removed.

Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
Emit Net_Connection::disconnected() even on connection refused

Socket errors that happen before the connection is established are
silent because the Net_Connection::disconnected() signal is not being
emitted.

This patch fixes the missing connection refused behavior.  For example,
if a connection to the wrong IP address is attempted the client will now
display a connection refused error.

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