Mercurial > pidgin.yaz
diff libpurple/protocols/jabber/jabber.c @ 25097:43055addf135
Grab only the "short" hostname on systems (like Fedora/RedHat, but others too)
which put the FQDN in the hostname. Fixes #8419.
committer: John Bailey <rekkanoryo@rekkanoryo.org>
author | mcepl@redhat.com |
---|---|
date | Sun, 15 Feb 2009 20:22:30 +0000 |
parents | 256fbe98f6be |
children | b90c26f391b0 |
line wrap: on
line diff
--- a/libpurple/protocols/jabber/jabber.c Sun Feb 15 19:01:58 2009 +0000 +++ b/libpurple/protocols/jabber/jabber.c Sun Feb 15 20:22:30 2009 +0000 @@ -148,7 +148,8 @@ } static char *jabber_prep_resource(char *input) { - char hostname[256]; /* current hostname */ + char hostname[256], /* current hostname */ + *dot = NULL; /* Empty resource == don't send any */ if (input == NULL || *input == '\0') @@ -170,6 +171,12 @@ } hostname[sizeof(hostname) - 1] = '\0'; + /* We want only the short hostname, not the FQDN - this will prevent the + * resource string from being unreasonably long on systems which stuff the + * whole FQDN in the hostname */ + if((dot = strchr(hostname, '.'))) + dot = '\0'; + return purple_strreplace(input, "__HOSTNAME__", hostname); }