public void NewGame(SimpleMessage message, List<Action> actions)
 {
     string address = message.From;
     string name = "";
     Action joinAction = null;
     foreach (Action action in actions)
     {
         if (action.Type == ActionEnum.JoinAs) joinAction = action;
     }
     name = joinAction.Text;
     Player player = new Player(name, address);
     if (String.IsNullOrEmpty(name))
     {
         HandleBadAction(null, player, joinAction, "You didn't specify the name you wished to join the game as. To do this send a new email with \"Join as <i>name</i>\" where <i>name</i> is your name.");
         return;
     }
     Game game = GetGameByPlayer(player);
     if (game != null)
     {
         HandleBadAction(null, player, joinAction, "You are already playing in " + game + " , you may only play one game at a time.");
         return;
     }
     game = new Game(GetNextGameId(), player);
     Games.Add(game);
     Gmail.MessagePlayer(player, game, game.Title + " has been started, you are the <b>Overlord</b>."
         + "<br /><br />Have your friends join by sending a message with the subject \"" + game.Title + "\" and body \"Join as <i>name</i>\" where <i>name</i> is their name.<br />"
         + game.Help(player)
         + "<br /><hr><br />" + Program.License.Replace('\n'.ToString(), "<br />")
         + "<br /><br />Download this program on " + Program.GitHub);
     gameLog.Info("Started new game: " + game);
 }
 /// <summary>
 /// Join game request is valid, process it.
 /// </summary>
 /// <param name="player"></param>
 /// <param name="action"></param>
 /// <param name="game"></param>
 private void ProcessJoinAction(Player player, Action action, Game game)
 {
     game.AddPlayer(player);
     Gmail.MessagePlayer(player, game, "Successfully added you to the game, <b>" + game.Overlord + "</b> is the Overlord.<br />"
         + "I will notify you when the game has started."
         + "<br /><br />"
         + game.Help(player));
     Gmail.MessagePlayer(game.Overlord, game, "<b>" + player + "</b> has joined " + game.Title);
     gameLog.Info("Added player " + player + " to " + game);
 }
 public void Help(Player player, Action action, Game game)
 {
     gameLog.Info("Sending Help message for " + game + " to " + player.Address);
     Gmail.MessagePlayer(player, game, game.Help(player));
 }