diff options
author | dequis <dx@dxzone.com.ar> | 2014-07-24 07:41:47 -0300 |
---|---|---|
committer | dequis <dx@dxzone.com.ar> | 2015-05-28 01:10:55 -0300 |
commit | 3d31618b5f50552b71d8c6f1b3fa733a212ee89c (patch) | |
tree | 84dffdab1c8f7f5a69f1c5568ea222891e75fdf6 /protocols/jabber/jabber_util.c | |
parent | 24f113b01e1117ab031a1ede6d418030fc69d63d (diff) |
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
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); + } +} |