2012-03-26 14:55:36 +00:00
|
|
|
#ifndef __WMUD_CONFIGURATION_H__
|
|
|
|
#define __WMUD_CONFIGURATION_H__
|
|
|
|
|
|
|
|
#include <glib.h>
|
|
|
|
|
2012-03-30 15:43:45 +00:00
|
|
|
#define WMUD_CONFIG_ERROR wmud_config_error_quark()
|
|
|
|
GQuark wmud_config_error_quark();
|
|
|
|
|
2012-03-26 14:55:36 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* wmudConfigError:
|
|
|
|
* @WMUD_CONFIG_ERROR_NOGLOBAL: Indicates that the config file read doesn't
|
|
|
|
* contain a [global] section
|
|
|
|
* @WMUD_CONFIG_ERROR_BADPORT: Indicates that the config file contains and
|
|
|
|
* invalid port number
|
|
|
|
* @WMUD_CONFIG_ERROR_NOWORLD: Indicates that the config file doesn't contain a
|
|
|
|
* world database file
|
|
|
|
* @WMUD_CONFIG_ERROR_NOEMAIL: Indicates that the config file doesn't contain
|
|
|
|
* an administrator e-mail address
|
|
|
|
* @WMUD_CONFIG_ERROR_REUSE: configuration data is reused (non-NULL)
|
|
|
|
*
|
|
|
|
* Error codes returned by configuration file parsing functions.
|
|
|
|
*/
|
|
|
|
typedef enum {
|
|
|
|
WMUD_CONFIG_ERROR_NOGLOBAL,
|
|
|
|
WMUD_CONFIG_ERROR_BADPORT,
|
|
|
|
WMUD_CONFIG_ERROR_NOWORLD,
|
|
|
|
WMUD_CONFIG_ERROR_NOEMAIL,
|
2012-05-17 21:05:23 +00:00
|
|
|
WMUD_CONFIG_ERROR_REUSE,
|
|
|
|
WMUD_CONFIG_ERROR_NOSMTP,
|
|
|
|
WMUD_CONFIG_ERROR_NOSMTPSERVER,
|
|
|
|
WMUD_CONFIG_ERROR_NOSMTPSENDER
|
2012-03-26 14:55:36 +00:00
|
|
|
} wmudConfigError;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* ConfigData:
|
|
|
|
* @port: the port number of the game interface to listen on
|
|
|
|
* @database_file: the database file of the world associated with this
|
|
|
|
* configuration
|
|
|
|
* @admin_email: the world administrator's e-mail address
|
|
|
|
*/
|
|
|
|
typedef struct _ConfigData {
|
|
|
|
guint port;
|
|
|
|
gchar *database_file;
|
|
|
|
gchar *admin_email;
|
2012-05-17 21:05:23 +00:00
|
|
|
gchar *smtp_server;
|
|
|
|
gboolean smtp_tls;
|
|
|
|
gchar *smtp_username;
|
|
|
|
gchar *smtp_password;
|
|
|
|
gchar *smtp_sender;
|
2012-03-26 14:55:36 +00:00
|
|
|
} ConfigData;
|
|
|
|
|
|
|
|
extern ConfigData *active_config;
|
|
|
|
|
|
|
|
gboolean wmud_config_init(ConfigData **config_data, GError **err);
|
|
|
|
|
|
|
|
#endif /* __WMUD_CONFIGURATION_H__ */
|
|
|
|
|