Mercurial > ~mikael > mcabber > hg
comparison mcabber/src/commands.c @ 1341:305f7a609545
Add "/room names --detail"
author | Mikael Berthe <mikael@lilotux.net> |
---|---|
date | Sat, 03 Nov 2007 15:57:39 +0100 |
parents | e30a9d907105 |
children | 07816313073b |
comparison
equal
deleted
inserted
replaced
1340:2031f4b2cced | 1341:305f7a609545 |
---|---|
1588 static void room_names(gpointer bud, char *arg) | 1588 static void room_names(gpointer bud, char *arg) |
1589 { | 1589 { |
1590 const char *bjid; | 1590 const char *bjid; |
1591 char *buffer; | 1591 char *buffer; |
1592 GSList *resources, *p_res; | 1592 GSList *resources, *p_res; |
1593 enum { style_normal = 0, style_short, style_quiet } style = 0; | 1593 enum { style_normal = 0, style_detail, style_short, style_quiet } style = 0; |
1594 | 1594 |
1595 if (*arg) { | 1595 if (*arg) { |
1596 if (!strcasecmp(arg, "--short")) | 1596 if (!strcasecmp(arg, "--short")) |
1597 style = style_short; | 1597 style = style_short; |
1598 else if (!strcasecmp(arg, "--quiet")) | 1598 else if (!strcasecmp(arg, "--quiet")) |
1599 style = style_quiet; | 1599 style = style_quiet; |
1600 else if (!strcasecmp(arg, "--detail")) | |
1601 style = style_detail; | |
1600 else { | 1602 else { |
1601 scr_LogPrint(LPRINT_NORMAL, "Unrecognized parameter!"); | 1603 scr_LogPrint(LPRINT_NORMAL, "Unrecognized parameter!"); |
1602 return; | 1604 return; |
1603 } | 1605 } |
1604 } | 1606 } |
1625 snprintf(buffer, 4095, "[%c] %s%s%s", imstatus2char[rstatus], | 1627 snprintf(buffer, 4095, "[%c] %s%s%s", imstatus2char[rstatus], |
1626 (char*)p_res->data, | 1628 (char*)p_res->data, |
1627 rst_msg ? " -- " : "", rst_msg ? rst_msg : ""); | 1629 rst_msg ? " -- " : "", rst_msg ? rst_msg : ""); |
1628 scr_WriteIncomingMessage(bjid, buffer, 0, HBB_PREFIX_INFO, 0); | 1630 scr_WriteIncomingMessage(bjid, buffer, 0, HBB_PREFIX_INFO, 0); |
1629 } else { | 1631 } else { |
1630 // (Style "normal" or "quiet") | 1632 // (Style "normal", "detail" or "quiet") |
1631 snprintf(buffer, 4095, "[%c] %s", imstatus2char[rstatus], | 1633 snprintf(buffer, 4095, "[%c] %s", imstatus2char[rstatus], |
1632 (char*)p_res->data); | 1634 (char*)p_res->data); |
1633 scr_WriteIncomingMessage(bjid, buffer, 0, HBB_PREFIX_INFO, 0); | 1635 scr_WriteIncomingMessage(bjid, buffer, 0, HBB_PREFIX_INFO, 0); |
1634 if (rst_msg && style == style_normal) { | 1636 if (rst_msg && style != style_quiet) { |
1635 snprintf(buffer, 4095, "Status message: %s", rst_msg); | 1637 snprintf(buffer, 4095, "Status message: %s", rst_msg); |
1636 scr_WriteIncomingMessage(bjid, buffer, | 1638 scr_WriteIncomingMessage(bjid, buffer, |
1637 0, HBB_PREFIX_INFO | HBB_PREFIX_CONT, 0); | 1639 0, HBB_PREFIX_INFO | HBB_PREFIX_CONT, 0); |
1640 } | |
1641 if (style == style_detail) { | |
1642 enum imrole role = buddy_getrole(bud, p_res->data); | |
1643 enum imaffiliation affil = buddy_getaffil(bud, p_res->data); | |
1644 | |
1645 snprintf(buffer, 4095, "Role: %s", strrole[role]); | |
1646 scr_WriteIncomingMessage(bjid, buffer, | |
1647 0, HBB_PREFIX_INFO | HBB_PREFIX_CONT, 0); | |
1648 if (affil != affil_none) { | |
1649 snprintf(buffer, 4095, "Affiliat.: %s", straffil[affil]); | |
1650 scr_WriteIncomingMessage(bjid, buffer, | |
1651 0, HBB_PREFIX_INFO | HBB_PREFIX_CONT, 0); | |
1652 } | |
1638 } | 1653 } |
1639 } | 1654 } |
1640 g_free(p_res->data); | 1655 g_free(p_res->data); |
1641 } | 1656 } |
1642 g_slist_free(resources); | 1657 g_slist_free(resources); |