Mercurial > hg
changeset 2128:adcff2d51ecb
Merge shizeeg's branch with main
author | Mikael Berthe <mikael@lilotux.net> |
---|---|
date | Tue, 24 Jun 2014 19:10:57 +0200 |
parents | 3b26f3a58cb9 (current diff) 5d6838f40736 (diff) |
children | 32f1bbf5917e |
files | mcabber/mcabber/commands.c |
diffstat | 2 files changed, 44 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/mcabber/mcabber/commands.c Tue Jun 24 18:56:24 2014 +0200 +++ b/mcabber/mcabber/commands.c Tue Jun 24 19:10:57 2014 +0200 @@ -2074,10 +2074,12 @@ strncpy(buffer, "Room members:", 127); scr_WriteIncomingMessage(bjid, buffer, 0, HBB_PREFIX_INFO, 0); + int cnt = 0; resources = buddy_getresources(bud); for (p_res = resources ; p_res ; p_res = g_slist_next(p_res)) { enum imstatus rstatus; const char *rst_msg; + cnt++; rstatus = buddy_getstatus(bud, p_res->data); rst_msg = buddy_getstatusmsg(bud, p_res->data); @@ -2124,6 +2126,10 @@ } g_free(p_res->data); } + + snprintf(buffer, 4095, "Total: %d", cnt); + scr_WriteIncomingMessage(bjid, buffer, 0, HBB_PREFIX_INFO, 0); + g_slist_free(resources); g_free(buffer); } @@ -2927,10 +2933,32 @@ } // If arg is "-", let's clear the topic - if (!strcmp(arg, "-")) + if (!g_strcmp0(arg, "-")) arg = NULL; arg = to_utf8(arg); + // If arg is not NULL & option is set, unescape it + if (arg) { + char *unescaped_topic = NULL; + + if (!strncmp(arg, "-u ", 3)) { + char *tmp; + tmp = g_strdup(arg + 3); + g_free(arg); + arg = tmp; + unescaped_topic = ut_unescape_tabs_cr(arg); + } + + // We must not free() if the original string was returned + if (unescaped_topic == arg) + unescaped_topic = NULL; + + if (unescaped_topic != NULL) { + g_free(arg); + arg = unescaped_topic; + } + } + // Set the topic xmpp_send_msg(buddy_getjid(bud), NULL, ROSTER_TYPE_ROOM, arg ? arg : "", FALSE, NULL, LM_MESSAGE_SUB_TYPE_NOT_SET, NULL);
--- a/mcabber/mcabber/xmpp_muc.c Tue Jun 24 18:56:24 2014 +0200 +++ b/mcabber/mcabber/xmpp_muc.c Tue Jun 24 19:10:57 2014 +0200 @@ -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) @@ -335,12 +335,20 @@ *mbjid = lm_message_node_get_attribute(y, "jid"); *mbnick = lm_message_node_get_attribute(y, "nick"); // For kick/ban, there can be actor and reason tags + z = lm_message_node_find_child(y, "actor"); + if (z) { + 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"); if (*reason && !**reason) *reason = NULL; - z = lm_message_node_find_child(y, "actor"); - if (z) - *actorjid = lm_message_node_get_attribute(z, "jid"); } // muc_handle_join(...) @@ -622,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); } @@ -710,7 +718,7 @@ if (printstatus == status_all && !nickchange) { const char *old_ustmsg = buddy_getstatusmsg(room_elt->data, rname); if (old_ust != ust || g_strcmp0(old_ustmsg, ustmsg)) { - mbuf = g_strdup_printf("Member status has changed: %s [%c] %s", rname, + mbuf = g_strdup_printf("%s [%c>%c] %s", rname, imstatus2char[old_ust], imstatus2char[ust], ((ustmsg) ? ustmsg : "")); scr_WriteIncomingMessage(roomjid, mbuf, usttime, HBB_PREFIX_INFO|HBB_PREFIX_NOFLAG, 0);