comparison libpurple/protocols/jabber/jutil.c @ 28405:2c85f44113b4

jabber: Strip the '/' off of a JID in jabber_normalize. This is what Pidgin did pre-2.6.0 and breaks the log directories for accounts with no resource. Closes #9959.
author Paul Aurich <paul@darkrain42.org>
date Sat, 22 Aug 2009 06:00:18 +0000
parents c585572e80dd
children 22c65c1090a8
comparison
equal deleted inserted replaced
28404:15833e4f2e09 28405:2c85f44113b4
504 { 504 {
505 PurpleConnection *gc = account ? account->gc : NULL; 505 PurpleConnection *gc = account ? account->gc : NULL;
506 JabberStream *js = gc ? gc->proto_data : NULL; 506 JabberStream *js = gc ? gc->proto_data : NULL;
507 static char buf[3072]; /* maximum legal length of a jabber jid */ 507 static char buf[3072]; /* maximum legal length of a jabber jid */
508 JabberID *jid; 508 JabberID *jid;
509 509 char *tmp;
510 jid = jabber_id_new(in); 510 size_t len = strlen(in);
511
512 /*
513 * If the JID ends with a '/', jabber_id_new is going to throw it away as
514 * invalid. However, this is what the UI generates for a JID with no
515 * resource. Deal with that by dropping away the '/'...
516 */
517 if (in[len - 1] == '/')
518 tmp = g_strndup(in, len - 1);
519 else
520 tmp = (gchar *)in;
521
522 jid = jabber_id_new(tmp);
523
524 if (tmp != in)
525 g_free(tmp);
511 526
512 if(!jid) 527 if(!jid)
513 return NULL; 528 return NULL;
514 529
515 if(js && jid->node && jid->resource && 530 if(js && jid->node && jid->resource &&