Created
May 13, 2014 16:15
-
-
Save shizeeg/5da41ca482c27a2aaafc to your computer and use it in GitHub Desktop.
"show_room_occupants_count" option for mcabber
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff -r 0355be54e3a9 mcabber/mcabber/commands.c | |
--- a/mcabber/mcabber/commands.c Sun May 11 18:02:41 2014 +0200 | |
+++ b/mcabber/mcabber/commands.c Tue May 13 20:02:43 2014 +0400 | |
@@ -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,12 @@ | |
} | |
g_free(p_res->data); | |
} | |
+ | |
+ if (settings_opt_get_int("show_room_occupants_count")) { | |
+ snprintf(buffer, 4095, "Total: %d", cnt); | |
+ scr_WriteIncomingMessage(bjid, buffer, 0, HBB_PREFIX_INFO, 0); | |
+ } | |
+ | |
g_slist_free(resources); | |
g_free(buffer); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment