libpurple/protocols/jabber/jabber.c

changeset 25600
251e085b3cfa
parent 25573
6937721bb0a1
child 25604
c963986ac373
equal deleted inserted replaced
25599:aee799d2188a 25600:251e085b3cfa
146 146
147 jabber_session_init(js); 147 jabber_session_init(js);
148 } 148 }
149 149
150 static char *jabber_prep_resource(char *input) { 150 static char *jabber_prep_resource(char *input) {
151 char hostname[256]; /* current hostname */ 151 char hostname[256], /* current hostname */
152 *dot = NULL;
152 153
153 /* Empty resource == don't send any */ 154 /* Empty resource == don't send any */
154 if (input == NULL || *input == '\0') 155 if (input == NULL || *input == '\0')
155 return NULL; 156 return NULL;
156 157
167 instead 168 instead
168 */ 169 */
169 strcpy(hostname, "localhost"); 170 strcpy(hostname, "localhost");
170 } 171 }
171 hostname[sizeof(hostname) - 1] = '\0'; 172 hostname[sizeof(hostname) - 1] = '\0';
173
174 /* We want only the short hostname, not the FQDN - this will prevent the
175 * resource string from being unreasonably long on systems which stuff the
176 * whole FQDN in the hostname */
177 if((dot = strchr(hostname, '.')))
178 dot = '\0';
172 179
173 return purple_strreplace(input, "__HOSTNAME__", hostname); 180 return purple_strreplace(input, "__HOSTNAME__", hostname);
174 } 181 }
175 182
176 static void jabber_stream_features_parse(JabberStream *js, xmlnode *packet) 183 static void jabber_stream_features_parse(JabberStream *js, xmlnode *packet)

mercurial