webperimental: killstack decides stack protects.
[freeciv.git] / client / gui-stub / connectdlg.c
blob5a52dbe85c1fe1406e9f062558ad9b1a81d5e70f
1 /**********************************************************************
2 Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by
5 the Free Software Foundation; either version 2, or (at your option)
6 any later version.
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
12 ***********************************************************************/
14 #ifdef HAVE_CONFIG_H
15 #include <fc_config.h>
16 #endif
18 #include <errno.h>
20 /* utility */
21 #include "fcintl.h"
22 #include "log.h"
23 #include "support.h"
25 /* gui main header */
26 #include "gui_stub.h"
28 #include "connectdlg_g.h"
30 /* client */
31 #include "chatline_common.h" /* for append_output_window */
32 #include "client_main.h"
33 #include "connectdlg.h"
34 #include "packhand_gen.h"
36 /**************************************************************************
37 Really close and destroy the dialog.
38 **************************************************************************/
39 void really_close_connection_dialog(void)
41 /* PORTME */
44 /**************************************************************************
45 Close and destroy the dialog. But only if we don't have a local
46 server running (that we started).
47 **************************************************************************/
48 void gui_close_connection_dialog()
50 /* PORTME */
53 /**************************************************************************
54 Configure the dialog depending on what type of authentication request the
55 server is making.
56 **************************************************************************/
57 void handle_authentication_req(enum authentication_type type,
58 const char *message)
60 switch (type) {
61 case AUTH_NEWUSER_FIRST:
62 /* PORTME: switch configs if need be */
63 return;
64 case AUTH_NEWUSER_RETRY:
65 /* PORTME: switch configs if need be */
66 return;
67 case AUTH_LOGIN_FIRST:
68 /* if we magically have a password already present in 'password'
69 * then, use that and skip the password entry dialog */
70 if (password[0] != '\0') {
71 struct packet_authentication_reply reply;
73 sz_strlcpy(reply.password, password);
74 send_packet_authentication_reply(&client.conn, &reply);
75 return;
76 } else {
77 /* PORTME: switch configs if need be */
79 return;
80 case AUTH_LOGIN_RETRY:
81 /* PORTME: switch configs if need be */
82 return;
85 log_error("Unsupported authentication type %d: %s.", type, message);
88 /**************************************************************************
89 Provide a packet handler for packet_game_load.
91 This regenerates the player information from a loaded game on the
92 server.
93 **************************************************************************/
94 void handle_game_load(bool load_successful, const char *filename)
96 /* PORTME */
100 /**************************************************************************
101 Provide an interface for connecting to a Freeciv server.
102 **************************************************************************/
103 void gui_server_connect(void)
105 /* PORTME */