close
Warning:
Failed to sync with repository "(default)": [Errno 12] Cannot allocate memory; repository information may be out of date. Look in the Trac log for more information including mitigation strategies.
Ticket #741: 0001-Implement-group-info-command-to-list-members-of-a-gr.2.patch
File 0001-Implement-group-info-command-to-list-members-of-a-gr.2.patch, 1.5 KB (added by vmiklos@…, at 2011-01-05T01:54:50Z) |
v2: including documentation update
|
-
From c740ec11d522a219f2fc4fc678a8ea3ca8bd741d Mon Sep 17 00:00:00 2001
From: Miklos Vajna <vmiklos@frugalware.org>
Date: Wed, 5 Jan 2011 02:42:28 +0100
Subject: [PATCH] Implement 'group info' command to list members of a group
---
root_commands.c | 30 ++++++++++++++++++++++++++++++
1 files changed, 30 insertions(+), 0 deletions(-)
diff --git a/root_commands.c b/root_commands.c
index a7b626b..6e6c3b5 100644
a
|
b
|
static void cmd_group( irc_t *irc, char **cmd ) |
1252 | 1252 | } |
1253 | 1253 | irc_usermsg( irc, "End of group list" ); |
1254 | 1254 | } |
| 1255 | else if( g_strncasecmp( cmd[1], "info", len ) == 0 ) |
| 1256 | { |
| 1257 | bee_group_t *bg = NULL; |
| 1258 | int n = 0; |
| 1259 | |
| 1260 | MIN_ARGS( 2 ); |
| 1261 | |
| 1262 | for( l = irc->b->groups; l; l = l->next ) |
| 1263 | { |
| 1264 | if( !strcmp( ((bee_group_t *)l->data)->name, cmd[2] ) ) |
| 1265 | { |
| 1266 | bg = l->data; |
| 1267 | break; |
| 1268 | } |
| 1269 | } |
| 1270 | if (bg) |
| 1271 | { |
| 1272 | if( strchr( irc->umode, 'b' ) ) |
| 1273 | irc_usermsg( irc, "Members of %s:", cmd[2] ); |
| 1274 | for( l = irc->b->users; l; l = l->next ) |
| 1275 | { |
| 1276 | bee_user_t *bu = l->data; |
| 1277 | if( bu->group == bg ) |
| 1278 | irc_usermsg( irc, "%d. %s", n ++, bu->nick ? : bu->handle ); |
| 1279 | } |
| 1280 | irc_usermsg( irc, "End of member list" ); |
| 1281 | } |
| 1282 | else |
| 1283 | irc_usermsg( irc, "Unknown group: %s. Please use \x02group list\x02 to get a list of available groups.", cmd[2] ); |
| 1284 | } |
1255 | 1285 | else |
1256 | 1286 | { |
1257 | 1287 | irc_usermsg( irc, "Unknown command: %s %s. Please use \x02help commands\x02 to get a list of available commands.", "group", cmd[1] ); |
Download in other formats: