diff options
Diffstat (limited to 'protocols/jabber/jabber_util.c')
-rw-r--r-- | protocols/jabber/jabber_util.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/protocols/jabber/jabber_util.c b/protocols/jabber/jabber_util.c index 779d502b..38daaa26 100644 --- a/protocols/jabber/jabber_util.c +++ b/protocols/jabber/jabber_util.c @@ -819,3 +819,19 @@ gboolean jabber_set_me(struct im_connection *ic, const char *me) return TRUE; } + +/* Returns new reference! g_free() afterwards. */ +char *jabber_get_bare_jid(char *jid) +{ + char *s = NULL; + + if (jid == NULL) { + return NULL; + } + + if ((s = strchr(jid, '/'))) { + return g_strndup(jid, s - jid); + } else { + return g_strdup(jid); + } +} |