diff --git a/Changelog b/Changelog index 2696126..cb2277c 100644 --- a/Changelog +++ b/Changelog @@ -1,5 +1,8 @@ [Changes 1.2.2] +* Fix $myservers(1) to only return registered server refnums, so it now + works the way EPIC does which was always the intention. (caf) + * Fix CHANGE_NICK_ON_KILL feature. (caf) * Improve error handling in /READLOG. (caf) diff --git a/source/functions.c b/source/functions.c index 8dc507f..5c60c6c 100644 --- a/source/functions.c +++ b/source/functions.c @@ -1903,7 +1903,7 @@ BUILT_IN_FUNCTION(function_channels, input) BUILT_IN_FUNCTION(function_servers, input) { - return create_server_list(input); /* DONT USE RETURN_STR HERE! */ + RETURN_MSTR(create_server_list(input)); /* DONT USE RETURN_STR HERE! */ } BUILT_IN_FUNCTION(function_pid, input) diff --git a/source/server.c b/source/server.c index e0f5f2f..1d1022b 100644 --- a/source/server.c +++ b/source/server.c @@ -2622,32 +2622,24 @@ extern char *BX_create_server_list (char *input) { int i; int do_read = 0; - char *value = NULL; - char buffer[BIG_BUFFER_SIZE + 1]; - if (input && *input && *input == '1') + char *value = NULL; + + if (input && *input == '1') do_read = 1; - *buffer = '\0'; + for (i = 0; i < number_of_servers; i++) { - if (server_list[i].read != -1) + if (do_read) { - if (do_read) - { - strncat(buffer, ltoa(i), BIG_BUFFER_SIZE); - strncat(buffer, space, BIG_BUFFER_SIZE); - continue; - } - if (server_list[i].itsname) - { - strncat(buffer, server_list[i].itsname, BIG_BUFFER_SIZE); - strncat(buffer, space, BIG_BUFFER_SIZE); - } - else - yell("Warning: server_list[%d].itsname is null and it shouldnt be", i); - + if (is_server_connected(i)) + m_s3cat(&value, " ", ltoa(i)); + } + else + { + if (is_server_open(i)) + m_s3cat(&value, " ", get_server_itsname(i)); } } - malloc_strcpy(&value, buffer); return value; }