--- a/libpurple/util.c Fri Aug 01 22:57:11 2008 +0000 +++ b/libpurple/util.c Wed Aug 06 02:39:40 2008 +0000 @@ -4660,3 +4660,21 @@ return g_string_free(string, FALSE); } +const gchar * +purple_get_host_name(void) +{ +#if GLIB_CHECK_VERSION(2,8,0) + return g_get_host_name(); +#else + static char hostname[256]; + int ret = gethostname(hostname, sizeof(hostname)); + hostname[sizeof(hostname) - 1] = '\0'; + + if (ret == -1 || hostname[0] == '\0') { + purple_debug_info("purple_get_host_name: ", "could not find host name"); + return "localhost"; + } else { + return hostname; + } +#endif +}