return 1;
}
- status = rr_client_join (game.client, args.game);
- if (status == RR_STATUS_NO_GAME) {
- status = rr_client_new (game.client, args.game);
+ if (args.watch) {
+ status = rr_client_watch (game.client, args.game);
+ if (status == RR_STATUS_NO_GAME) {
+ fprintf (stderr, "No game %s to watch\n", args.game);
+ }
+ } else {
+ status = rr_client_join (game.client, args.game);
+ if (status == RR_STATUS_NO_GAME) {
+ status = rr_client_new (game.client, args.game);
+ }
}
game.board = rr_board_create (16, 16);
while (rr_client_notice_pending (game->client)) {
status = rr_client_next_notice (game->client, ¬ice);
if (status) {
- fprintf (stderr, "Error during rr_client_next_notice: %s\n",
- rr_status_str (status));
- exit (1);
+ if (status == RR_STATUS_EOF)
+ fprintf (stderr, "The server has disconnected, exiting.\n");
+ else
+ fprintf (stderr, "Error during rr_client_next_notice: %s\n",
+ rr_status_str (status));
+ gtk_exit (1);
}
if (!notice) {
fprintf (stderr, "Missing notice\n");