Freeciv21
Develop your civilization from humble roots to a global empire
meta.cpp File Reference
#include <fc_config.h>
#include <QEventLoop>
#include <QNetworkAccessManager>
#include <QNetworkReply>
#include <QNetworkRequest>
#include <QUrl>
#include <QUrlQuery>
#include "fcintl.h"
#include "fcthread.h"
#include "log.h"
#include "support.h"
#include "timing.h"
#include "capstr.h"
#include "connection.h"
#include "game.h"
#include "nation.h"
#include "version.h"
#include "console.h"
#include "plrhand.h"
#include "settings.h"
#include "srv_main.h"
#include "meta.h"
+ Include dependency graph for meta.cpp:

Go to the source code of this file.

Functions

 Q_GLOBAL_STATIC (fcThread, meta_srv_thread)
 
const char * default_meta_patches_string ()
 The default metaserver patches for this server. More...
 
const char * default_meta_message_string ()
 Return static string with default info line to send to metaserver. More...
 
const char * get_meta_patches_string ()
 The metaserver patches. More...
 
const char * get_meta_message_string ()
 The metaserver message. More...
 
static const char * get_meta_type_string ()
 The server metaserver type. More...
 
const char * get_user_meta_message_string ()
 The metaserver message set by user. More...
 
void maybe_automatic_meta_message (const char *automatic)
 Update meta message. More...
 
void set_meta_patches_string (const char *string)
 Set the metaserver patches string. More...
 
void set_meta_message_string (const char *string)
 Set the metaserver message string. More...
 
void set_user_meta_message_string (const char *string)
 Set user defined metaserver message string. More...
 
QString meta_addr_port ()
 Return string describing both metaserver name and port. More...
 
static void metaserver_failed ()
 We couldn't find or connect to the metaserver. More...
 
static bool meta_insert_setting (QUrlQuery *query, const char *set_name)
 Insert a setting in the metaserver message. More...
 
static void send_metaserver_post (void *arg)
 Send POST to metaserver. More...
 
static bool send_to_metaserver (enum meta_flag flag)
 Construct the POST message and send info to metaserver. More...
 
void server_close_meta ()
 Stop sending updates to metaserver. More...
 
bool server_open_meta (bool persistent)
 Lookup the correct address for the metaserver. More...
 
bool is_metaserver_open ()
 Are we sending info to the metaserver? More...
 
bool send_server_info_to_metaserver (enum meta_flag flag)
 Control when we send info to the metaserver. More...
 

Variables

static bool server_is_open = false
 
static bool persistent_meta_connection = false
 
static int meta_retry_wait = 0
 
static char meta_patches [256] = ""
 
static char meta_message [256] = ""
 

Function Documentation

◆ default_meta_message_string()

const char* default_meta_message_string ( )

Return static string with default info line to send to metaserver.

Definition at line 63 of file meta.cpp.

Referenced by establish_new_connection(), server_open_meta(), set_user_meta_message_string(), and write_init_script().

◆ default_meta_patches_string()

const char* default_meta_patches_string ( )

The default metaserver patches for this server.

Definition at line 58 of file meta.cpp.

Referenced by server_open_meta(), sg_load_game(), and write_init_script().

◆ get_meta_message_string()

const char* get_meta_message_string ( )

The metaserver message.

Definition at line 80 of file meta.cpp.

Referenced by send_lanserver_response(), send_to_metaserver(), and write_init_script().

◆ get_meta_patches_string()

const char* get_meta_patches_string ( )

The metaserver patches.

Definition at line 75 of file meta.cpp.

Referenced by send_to_metaserver(), sg_save_game(), and write_init_script().

◆ get_meta_type_string()

static const char* get_meta_type_string ( )
static

The server metaserver type.

Definition at line 85 of file meta.cpp.

Referenced by send_to_metaserver().

◆ get_user_meta_message_string()

const char* get_user_meta_message_string ( )

The metaserver message set by user.

Definition at line 97 of file meta.cpp.

Referenced by maybe_automatic_meta_message().

◆ is_metaserver_open()

bool is_metaserver_open ( )

Are we sending info to the metaserver?

Definition at line 464 of file meta.cpp.

Referenced by metaconnection_command(), metamessage_action(), metamessage_command(), and metapatches_command().

◆ maybe_automatic_meta_message()

void maybe_automatic_meta_message ( const char *  automatic)

Update meta message.

Set it to user meta message, if it is available. Otherwise use provided message. It is ok to call this with nullptr message. Then it only replaces current meta message with user meta message if available.

Definition at line 112 of file meta.cpp.

Referenced by establish_new_connection().

◆ meta_addr_port()

QString meta_addr_port ( )

Return string describing both metaserver name and port.

Definition at line 163 of file meta.cpp.

Referenced by close_metaserver_connection(), metaserver_command(), open_metaserver_connection(), sg_save_game(), and write_init_script().

◆ meta_insert_setting()

static bool meta_insert_setting ( QUrlQuery *  query,
const char *  set_name 
)
inlinestatic

Insert a setting in the metaserver message.

Return TRUE if it succeded.

Definition at line 185 of file meta.cpp.

Referenced by send_to_metaserver().

◆ metaserver_failed()

static void metaserver_failed ( )
static

We couldn't find or connect to the metaserver.

Definition at line 168 of file meta.cpp.

◆ Q_GLOBAL_STATIC()

Q_GLOBAL_STATIC ( fcThread  ,
meta_srv_thread   
)

◆ send_metaserver_post()

static void send_metaserver_post ( void *  arg)
static

Send POST to metaserver.

This runs in its own thread.

Definition at line 204 of file meta.cpp.

Referenced by send_to_metaserver().

◆ send_server_info_to_metaserver()

◆ send_to_metaserver()

static bool send_to_metaserver ( enum meta_flag  flag)
static

Construct the POST message and send info to metaserver.

Definition at line 244 of file meta.cpp.

Referenced by send_server_info_to_metaserver().

◆ server_close_meta()

void server_close_meta ( )

Stop sending updates to metaserver.

Definition at line 436 of file meta.cpp.

Referenced by close_connections_and_socket(), close_metaserver_connection(), and metaserver_failed().

◆ server_open_meta()

bool server_open_meta ( bool  persistent)

Lookup the correct address for the metaserver.

Definition at line 445 of file meta.cpp.

Referenced by open_metaserver_connection().

◆ set_meta_message_string()

void set_meta_message_string ( const char *  string)

◆ set_meta_patches_string()

void set_meta_patches_string ( const char *  string)

Set the metaserver patches string.

Definition at line 132 of file meta.cpp.

Referenced by metapatches_command(), server_open_meta(), and sg_load_game().

◆ set_user_meta_message_string()

void set_user_meta_message_string ( const char *  string)

Set user defined metaserver message string.

Definition at line 148 of file meta.cpp.

Referenced by metamessage_action(), and metamessage_command().

Variable Documentation

◆ meta_message

char meta_message[256] = ""
static

Definition at line 51 of file meta.cpp.

Referenced by get_meta_message_string(), server_open_meta(), and set_meta_message_string().

◆ meta_patches

char meta_patches[256] = ""
static

Definition at line 50 of file meta.cpp.

Referenced by get_meta_patches_string(), server_open_meta(), and set_meta_patches_string().

◆ meta_retry_wait

int meta_retry_wait = 0
static

Definition at line 48 of file meta.cpp.

Referenced by metaserver_failed(), send_server_info_to_metaserver(), and server_open_meta().

◆ persistent_meta_connection

bool persistent_meta_connection = false
static

Definition at line 47 of file meta.cpp.

Referenced by metaserver_failed(), server_close_meta(), and server_open_meta().

◆ server_is_open

bool server_is_open = false
static