Mercurial > pidgin
diff src/protocols/jabber/jutil.c @ 7322:ab828b8c3f22
[gaim-migrate @ 7908]
all sorts of stuff including tweaks to logging so it mostly works again
for jabber.
committer: Tailor Script <tailor@pidgin.im>
author | Nathan Walp <nwalp@pidgin.im> |
---|---|
date | Fri, 24 Oct 2003 05:46:01 +0000 |
parents | dd4b4a187171 |
children | 82dfe392a773 |
line wrap: on
line diff
--- a/src/protocols/jabber/jutil.c Thu Oct 23 21:56:16 2003 +0000 +++ b/src/protocols/jabber/jutil.c Fri Oct 24 05:46:01 2003 +0000 @@ -21,6 +21,7 @@ #include "internal.h" #include "server.h" +#include "chat.h" #include "presence.h" #include "jutil.h" @@ -260,24 +261,33 @@ if(!jid) return NULL; - out = g_strdup_printf("%s@%s", jid->node, jid->domain); + out = g_strdup_printf("%s%s%s", jid->node ? jid->node : "", + jid->node ? "@" : "", jid->domain); jabber_id_free(jid); return out; } -const char *jabber_normalize(const char *in) +const char *jabber_normalize(const GaimAccount *account, const char *in) { - static char buf[2048]; /* maximum legal length of a jabber jid */ - char *tmp; + GaimConnection *gc = account ? account->gc : NULL; + JabberStream *js = gc ? gc->proto_data : NULL; + static char buf[3072]; /* maximum legal length of a jabber jid */ + JabberID *jid; - tmp = jabber_get_bare_jid(in); + jid = jabber_id_new(in); - if(!tmp) + if(!jid) return NULL; - g_snprintf(buf, sizeof(buf), "%s", tmp); - g_free(tmp); + if(js && jid->node && jid->resource && + jabber_chat_find(js, jid->node, jid->domain)) + g_snprintf(buf, sizeof(buf), "%s@%s/%s", jid->node, jid->domain, + jid->resource); + else + g_snprintf(buf, sizeof(buf), "%s%s%s", jid->node ? jid->node : "", + jid->node ? "@" : "", jid->domain); + return buf; }