Remove exported function create_server_list()

The guts of this function doesn't need to be in server.c - it only uses extern server functions so it
makes sense just to move it into the body of function_servers(), the only caller.

That means it's no longer accessible for loadable modules, but it isn't much use for them anyway.  They
can always directly access the server list if they need that info.

(Requires rolling the module table version).
This commit is contained in:
Kevin Easton
2017-07-17 12:59:49 +10:00
parent d2e576a774
commit 0fea2b97a4
7 changed files with 26 additions and 32 deletions

View File

@@ -1903,7 +1903,29 @@ BUILT_IN_FUNCTION(function_channels, input)
BUILT_IN_FUNCTION(function_servers, input)
{
RETURN_MSTR(create_server_list(input)); /* DONT USE RETURN_STR HERE! */
const int n_servers = server_list_size();
int i;
int do_read = 0;
char *value = NULL;
if (input && *input == '1')
do_read = 1;
for (i = 0; i < n_servers; i++)
{
if (do_read)
{
if (is_server_connected(i))
m_s3cat(&value, " ", ltoa(i));
}
else
{
if (is_server_open(i))
m_s3cat(&value, " ", get_server_itsname(i));
}
}
RETURN_MSTR(value);
}
BUILT_IN_FUNCTION(function_pid, input)

View File

@@ -248,7 +248,6 @@ static int already_done = 0;
global_table[ADD_TO_SERVER_LIST] = (Function_ptr) BX_add_to_server_list;
global_table[BUILD_SERVER_LIST] = (Function_ptr) BX_build_server_list;
global_table[DISPLAY_SERVER_LIST] = (Function_ptr) BX_display_server_list;
global_table[CREATE_SERVER_LIST] = (Function_ptr) BX_create_server_list;
global_table[PARSE_SERVER_INFO] = (Function_ptr) BX_parse_server_info;
global_table[SERVER_LIST_SIZE] = (Function_ptr) BX_server_list_size;
/* misc server/nickname functions */

View File

@@ -2618,32 +2618,6 @@ extern void BX_close_all_server (void)
}
}
extern char *BX_create_server_list (char *input)
{
int i;
int do_read = 0;
char *value = NULL;
if (input && *input == '1')
do_read = 1;
for (i = 0; i < number_of_servers; i++)
{
if (do_read)
{
if (is_server_connected(i))
m_s3cat(&value, " ", ltoa(i));
}
else
{
if (is_server_open(i))
m_s3cat(&value, " ", get_server_itsname(i));
}
}
return value;
}
void BX_server_disconnect(int i, char *args)
{
char *message;