campaignd: Use utils::lowercase() instead of a direct call to libc tolower()

Note that the next loop in the same chunk of code already uses
utils::lowercase() even though both strings are really of the same
nature.

(Backported 33503f2f57b757d60edee2d5d6ecb616cd4fbd78 from master.)
campaignd: Rename and refactor campaign_server class into campaignd::server

This is the first refactoring step.

This moves the class declaration to a separate header file and switches
around some implementation details. Included in this commit are a few
minor documentation changes, a lot of whitespace and placement changes,
and the following API and behavior changes:

 * Reordered server class fields, keeping net_manager_ and
   server_manager_ as the last to initialize.
 * The campaignd hooks configuration (which hasn't been used in ages) is
   now done in the load_config() method rather than directly in the
   constructor.
 * Both read-only mode configuration and control socket set-up are now
   done in load_config() rather than the run() method.

Included as well are a few Doxygen documentation changes of varying
scope. Most notably, the description for the fire() method's return
value is gone since the method was made to not return a value some time
after its inception.

I also took the liberty to spatially-reorganize some of the involved
code except for the fire() method's body (which is massive and had to be
reindented anyway), in order to make the code more fluid and clean to
read.

Overall, there are deliberately no behavior changes in this step other
than the aforementioned minor bits, in order to make the next steps
easier to plan, perform, and debug.

(Backported 23ce3f8574f8888ff84e88e81a5b105f189fc712 from master.)

Conflicts:
	src/campaign_server/campaign_server.cpp
campaignd: Rename a server class field and some scoped_ostream objects

The file_ field is now cfg_file_ to avoid ambiguity ("what file and for
what?"). Since there are a lot of scoped_ostream instantiations around
named cfgfile which are used to write to the cfg_file_ path, those are
now renamed to simply out, also to avoid ambiguity -- just an
intermediate step before refactoring those into a separate method.

(Backported 796b77d44023d0fa555dcca0856d596887d89205 from master.)
campaignd: Refactor config commit boilerplate into a separate method

(Backported ada5a7ca60a3280044d201ad5e33c8dbaed4c56f from master.)
campaignd: Make input_ a boost::scoped_ptr

(Backported deea32f9a5fd4bb4d2b365945ebc35e2e7a90585 from master.)
campaignd: Replace write_config() scheduling mechanism

Check time() deltas instead of incrementing a counter variable forever.
This should allow to extract a bit of the run() logic into a separate
method later.

(Backported a8ea4796a0db6ef344da0259f2758048ac6997ce from master.)
campaignd: Refactor request handling blocks into separate methods

These methods are tried and run in sequence by looking them up from a
request handler registry maintained as part of the server object. Since
every campaignd request is a single WML node with an identifying name, I
feel this approach makes things more readable than the previous massive
deeply-nested if-else-if chain approach, but that might be just me.

(Backported c164cb22b04601a1329274ab65934d02a83ec143 from master.)

Conflicts:
	src/campaign_server/campaign_server.cpp
campaignd: Refactor construct_message/error() functions and boilerplate

This replaces them with two methods that are part of the server class
itself.

These functions were always used in conjunction with
network::send_data() to send the generated WML object to a network
client. Because the config was created within the functions and not on
the callsite, this resulted in a call to the config copy constructor
that could be avoided by grouping the network::send_data() call together
with the WML generation.

(Backported e5354435b185dd4e4b02823de972d0630c3af59d from master.)

Conflicts:
	src/campaign_server/campaign_server.cpp
campaignd: Move several anonymous namespace members to a new file

This step covers the markup char check function and the add-on feedback
URL formatter.

(Backported 0d81fae45ba767a8127cec896f9c0f5d16d1bb82 from master.)
campaignd: Move and document more ancillary functions

Since the move is between two files, I took this opportunity to rename
a "campaign" parameter to "addon" and tweak the code style for
consistency.

(Backported 42ee57c91934fff7f5920ce56eb413dff84963a8 from master.)
campaignd: Wrap request handler registration statements in macros

This should make it easier to add new handlers or change their API at a
later point.

(Backported 7535b916a3f03191bba3cf48b8d97a64e5930031 from master.)
campaignd: Drop pointless use of lexical_cast to set WML attributes

Since 1.9.x, using lexical_cast to set config attributes is no longer
required and the engine will automatically try to cast string values to
a more "natural" type.

Thus, this commit incurs in no real behavior changes.

(Backported dff480bb0765beb34ed9192c5e2ca284ed522a2c from master.)
campaignd: Use empty C strings instead of t_strings to clear out attributes

(Backported 9b1fd86016d09fdc9d4999d04a7bff38cdaeec05 from master.)
campaignd: Show RO mode warning in load_config() rather than in run()

(Backported 603c06d1e7793f62e201df09dd5bfe3c46e84c5b from master.)
campaignd: Code indentation and spacing style changes for consistency

No functional changes.

(Backported e13570954a1abfec49df6d263cbe5b69130bc43f from master.)

Conflicts:
	src/campaign_server/campaign_server.cpp
campaignd: Use const references or values where applicable

Some old code used copies or read-write refererences for strings that
are never deliberately modified afterwards; and a bit of my own code
gets a (arguably tiny) WML config by value from a method that always
returns a read-only reference, missing out on a tiny optimization
opportunity by avoiding a config copy.

There was also a once-written int variable in handle_request_campaign().

(Backported fb5c5abeffc853665d68495085bdaf2014f6da13 from master.)
campaignd: Write config to disk every ten minutes, not 60 seconds

The 60 seconds value was just intended for internal testing and it
slipped into production by accident.

(Backported 6558bdc785bb31eae0973ff9e1c246c06ea9db0d from master.)
campaignd: Don't use GUI1 markup in [upload] response

Wesnoth 1.7.x and later use a GUI2 code path to display the [upload]
response message, which means GUI1 markup won't work with it. They do
not enable Pango markup either, and in any case, formatting messages
properly should be the client's responsibility, not the server's.

Perhaps later we should allow including a secondary message in the
response or something like that.

(Backported 610070e4e4a8d45bfeccacf518aa5a450f00ffa3 from master.)
campaignd: A few style consistency fixes I missed before

Spacing, unary & positioning, and static functions vs. anonymous
namespace functions.

(Backported e057cd3b817a07e4c3b845749098c56e4e6fc485 from master.)
campaignd: Replace vector<pair<k,v>> with map<k,v> for the handlers table

std::vector<std::pair<k,v>> has worse look-up performance than
std::map<k,v> in general, not that the difference is too noticeable for
such a small dataset like campaignd's handlers table, that is built in
such a way its items are arranged in descending order of usage
frequency.

It still feels like this is the best thing to do to keep future
maintainers sane.

(Backported 65570f5cb9e92f73a96d76c48654511dc1860b00 from master.)