diff libpurple/protocols/jabber/jabber.c @ 24568:6b9552b09de0

Avoid needlessly calling gethostname() if __HOSTNAME__ doesn't appear in the resource string.
author John Bailey <rekkanoryo@rekkanoryo.org>
date Sat, 29 Nov 2008 23:53:50 +0000
parents 5cd0188892f6
children fb5a11ec8be6 6f94b4a27372 b4a2ce33b3d5 aa1fe87558d8 89b95d143116
line wrap: on
line diff
--- a/libpurple/protocols/jabber/jabber.c	Sat Nov 29 23:35:12 2008 +0000
+++ b/libpurple/protocols/jabber/jabber.c	Sat Nov 29 23:53:50 2008 +0000
@@ -153,6 +153,9 @@
 	if (*input == '\0')
 		return NULL;
 
+	if (strstr(input, "__HOSTNAME__") == NULL)
+		return input;
+
 	/* Replace __HOSTNAME__ with hostname */
 	if (gethostname(hostname, sizeof(hostname) - 1)) {
 		purple_debug_warning("jabber", "gethostname: %s\n", g_strerror(errno));