From 3d31618b5f50552b71d8c6f1b3fa733a212ee89c Mon Sep 17 00:00:00 2001 From: dequis Date: Thu, 24 Jul 2014 07:41:47 -0300 Subject: jabber: Refactor conference message handling - Improve handling of "unknown 'from'" - Try a bit harder to detect the source of the message, and fall back to messages sent from a fake temporary user. - Fix receiving topic when it was set by someone who left the room. - Add jabber_get_bare_jid() utility function --- protocols/jabber/jabber_util.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'protocols/jabber/jabber_util.c') 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); + } +} -- cgit v1.2.3