Mercurial > hg
changeset 2126:36170c97a0b7
show actor's nick and jid on kick/ban if available
author | sh!zeeg <shizeeque@gmail.com> |
---|---|
date | Wed, 14 May 2014 17:57:20 +0400 |
parents | fef71336e429 |
children | 5d6838f40736 |
files | mcabber/mcabber/xmpp_muc.c |
diffstat | 1 files changed, 10 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/mcabber/mcabber/xmpp_muc.c Wed May 14 14:20:44 2014 +0400 +++ b/mcabber/mcabber/xmpp_muc.c Wed May 14 17:57:20 2014 +0400 @@ -307,7 +307,7 @@ const char **actorjid, const char **reason) { LmMessageNode *y, *z; - const char *p; + const char *p, *actornick; y = lm_message_node_find_child(xmldata, "item"); if (!y) @@ -337,10 +337,13 @@ // For kick/ban, there can be actor and reason tags z = lm_message_node_find_child(y, "actor"); if (z) { - // prefer nick over jid - *actorjid = lm_message_node_get_attribute(z, "nick"); - if (!*actorjid) - *actorjid = lm_message_node_get_attribute(z, "jid"); + actornick = lm_message_node_get_attribute(z, "nick"); + *actorjid = lm_message_node_get_attribute(z, "jid"); + if (*actorjid) { // we have actor's jid, check if we also have nick. + *actorjid = (!actornick) ? *actorjid : g_strdup_printf( + "%s <%s>", actornick, *actorjid + ); + } else if (actornick) *actorjid = actornick; // we have nick only. } *reason = lm_message_node_get_child_value(y, "reason"); @@ -627,11 +630,11 @@ gchar *reason_msg = NULL; // Forced leave if (actorjid) { - mbuf_end = g_strdup_printf("%s from %s by <%s>.", + mbuf_end = g_strdup_printf("%s from %s by %s", (how == ban ? "banned" : "kicked"), roomjid, actorjid); } else { - mbuf_end = g_strdup_printf("%s from %s.", + mbuf_end = g_strdup_printf("%s from %s", (how == ban ? "banned" : "kicked"), roomjid); }