comparison mcabber/src/commands.c @ 1587:0a1f59dc503d

/room names --compact New parameter.
author sh!zeeg <shizeeg@yandex.ru>
date Wed, 29 Jul 2009 03:13:04 +0400
parents ece4f26bf9ff
children 5411897a1e7b
comparison
equal deleted inserted replaced
1582:b5861a0fcd30 1587:0a1f59dc503d
1815 static void room_names(gpointer bud, char *arg) 1815 static void room_names(gpointer bud, char *arg)
1816 { 1816 {
1817 const char *bjid; 1817 const char *bjid;
1818 char *buffer; 1818 char *buffer;
1819 GSList *resources, *p_res; 1819 GSList *resources, *p_res;
1820 enum { style_normal = 0, style_detail, style_short, style_quiet } style = 0; 1820 enum { style_normal = 0, style_detail, style_short,
1821 style_quiet, style_compact } style = 0;
1821 1822
1822 if (*arg) { 1823 if (*arg) {
1823 if (!strcasecmp(arg, "--short")) 1824 if (!strcasecmp(arg, "--short"))
1824 style = style_short; 1825 style = style_short;
1825 else if (!strcasecmp(arg, "--quiet")) 1826 else if (!strcasecmp(arg, "--quiet"))
1826 style = style_quiet; 1827 style = style_quiet;
1827 else if (!strcasecmp(arg, "--detail")) 1828 else if (!strcasecmp(arg, "--detail"))
1828 style = style_detail; 1829 style = style_detail;
1830 else if (!strcasecmp(arg, "--compact"))
1831 style = style_compact;
1829 else { 1832 else {
1830 scr_LogPrint(LPRINT_NORMAL, "Unrecognized parameter!"); 1833 scr_LogPrint(LPRINT_NORMAL, "Unrecognized parameter!");
1831 return; 1834 return;
1832 } 1835 }
1833 } 1836 }
1853 if (style == style_short) { 1856 if (style == style_short) {
1854 snprintf(buffer, 4095, "[%c] %s%s%s", imstatus2char[rstatus], 1857 snprintf(buffer, 4095, "[%c] %s%s%s", imstatus2char[rstatus],
1855 (char*)p_res->data, 1858 (char*)p_res->data,
1856 rst_msg ? " -- " : "", rst_msg ? rst_msg : ""); 1859 rst_msg ? " -- " : "", rst_msg ? rst_msg : "");
1857 scr_WriteIncomingMessage(bjid, buffer, 0, HBB_PREFIX_INFO, 0); 1860 scr_WriteIncomingMessage(bjid, buffer, 0, HBB_PREFIX_INFO, 0);
1858 } else { 1861 } else if (style == style_compact) {
1862 enum imrole role = buddy_getrole(bud, p_res->data);
1863 enum imaffiliation affil = buddy_getaffil(bud, p_res->data);
1864
1865 snprintf(buffer, 4095, "[%c] %s (", imstatus2char[rstatus],
1866 (char*)p_res->data);
1867
1868 if (affil != affil_none) {
1869 strcat(buffer, straffil[affil]);
1870 strcat(buffer, "/");
1871 }
1872 strcat(buffer, strrole[role]);
1873 strcat(buffer, ")");
1874
1875 scr_WriteIncomingMessage(bjid, buffer, 0, HBB_PREFIX_INFO, 0);
1876 } else {
1859 // (Style "normal", "detail" or "quiet") 1877 // (Style "normal", "detail" or "quiet")
1860 snprintf(buffer, 4095, "[%c] %s", imstatus2char[rstatus], 1878 snprintf(buffer, 4095, "[%c] %s", imstatus2char[rstatus],
1861 (char*)p_res->data); 1879 (char*)p_res->data);
1862 scr_WriteIncomingMessage(bjid, buffer, 0, HBB_PREFIX_INFO, 0); 1880 scr_WriteIncomingMessage(bjid, buffer, 0, HBB_PREFIX_INFO, 0);
1863 if (rst_msg && style != style_quiet) { 1881 if (rst_msg && style != style_quiet) {