Mercurial > ~mikael > mcabber > hg
comparison mcabber/mcabber/commands.c @ 2131:a6b93960109e
Small (mostly cosmetic/stylistic) changes
author | Mikael Berthe <mikael@lilotux.net> |
---|---|
date | Tue, 24 Jun 2014 20:41:05 +0200 |
parents | 32f1bbf5917e |
children | fc7a758ebbde |
comparison
equal
deleted
inserted
replaced
2130:da426904eeda | 2131:a6b93960109e |
---|---|
2046 const char *bjid; | 2046 const char *bjid; |
2047 char *buffer; | 2047 char *buffer; |
2048 GSList *resources, *p_res; | 2048 GSList *resources, *p_res; |
2049 enum { style_normal = 0, style_detail, style_short, | 2049 enum { style_normal = 0, style_detail, style_short, |
2050 style_quiet, style_compact } style = 0; | 2050 style_quiet, style_compact } style = 0; |
2051 int cnt = 0; | |
2051 | 2052 |
2052 if (*arg) { | 2053 if (*arg) { |
2053 if (!strcasecmp(arg, "--short")) | 2054 if (!strcasecmp(arg, "--short")) |
2054 style = style_short; | 2055 style = style_short; |
2055 else if (!strcasecmp(arg, "--quiet")) | 2056 else if (!strcasecmp(arg, "--quiet")) |
2072 | 2073 |
2073 buffer = g_new(char, 4096); | 2074 buffer = g_new(char, 4096); |
2074 strncpy(buffer, "Room members:", 127); | 2075 strncpy(buffer, "Room members:", 127); |
2075 scr_WriteIncomingMessage(bjid, buffer, 0, HBB_PREFIX_INFO, 0); | 2076 scr_WriteIncomingMessage(bjid, buffer, 0, HBB_PREFIX_INFO, 0); |
2076 | 2077 |
2077 int cnt = 0; | |
2078 resources = buddy_getresources(bud); | 2078 resources = buddy_getresources(bud); |
2079 for (p_res = resources ; p_res ; p_res = g_slist_next(p_res)) { | 2079 for (p_res = resources ; p_res ; p_res = g_slist_next(p_res)) { |
2080 enum imstatus rstatus; | 2080 enum imstatus rstatus; |
2081 const char *rst_msg; | 2081 const char *rst_msg; |
2082 cnt++; | 2082 cnt++; |
2125 } | 2125 } |
2126 } | 2126 } |
2127 g_free(p_res->data); | 2127 g_free(p_res->data); |
2128 } | 2128 } |
2129 | 2129 |
2130 snprintf(buffer, 4095, "Total: %d", cnt); | 2130 snprintf(buffer, 4095, "Total: %d member%c", cnt, cnt > 1 ? 's' : '\0'); |
2131 scr_WriteIncomingMessage(bjid, buffer, 0, HBB_PREFIX_INFO, 0); | 2131 scr_WriteIncomingMessage(bjid, buffer, 0, HBB_PREFIX_INFO, 0); |
2132 | 2132 |
2133 g_slist_free(resources); | 2133 g_slist_free(resources); |
2134 g_free(buffer); | 2134 g_free(buffer); |
2135 } | 2135 } |