[srvx-commits] CVS: services/src chanserv.c,1.276,1.277
Brought to you by:
entrope
|
From: Entrope <en...@us...> - 2002-08-26 22:09:05
|
Update of /cvsroot/srvx/services/src
In directory usw-pr-cvs1:/tmp/cvs-serv9564/src
Modified Files:
chanserv.c
Log Message:
add !names command, showing account access for each user in the channel on the userlist
Index: chanserv.c
===================================================================
RCS file: /cvsroot/srvx/services/src/chanserv.c,v
retrieving revision 1.276
retrieving revision 1.277
diff -C2 -r1.276 -r1.277
*** chanserv.c 18 Aug 2002 16:04:33 -0000 1.276
--- chanserv.c 26 Aug 2002 22:09:01 -0000 1.277
***************
*** 113,118 ****
/* Administrative messages */
- #define CSMSG_WRITE_SUCCESS "Wrote $b$C$b database in "FMT_TIME_T".%03lu seconds."
- #define CSMSG_HELP_READ_SUCCESS "Read help database in "FMT_TIME_T".%03lu seconds."
#define CSMSG_CHANNELS_EXPIRED "%i channels expired."
--- 113,116 ----
***************
*** 307,310 ****
--- 305,312 ----
#define CSMSG_USER_PRESENT "%s is in the channel $bright now$b."
+ /* Names information */
+ #define CSMSG_CHANNEL_NAMES "Users in $b%s$b: %s"
+ #define CSMSG_END_NAMES "End of names in $b%s$b"
+
/* Channel information */
#define CSMSG_CHANNEL_INFO "$b%s$b Information:"
***************
*** 4409,4412 ****
--- 4411,4448 ----
}
+ static MODCMD_FUNC(cmd_names)
+ {
+ struct userNode *targ;
+ struct userData *targData;
+ unsigned int ii, pos, len;
+ char buf[400];
+
+ (void)argv;
+ for (ii=pos=0; ii<channel->members.used; ++ii) {
+ targ = channel->members.list[ii]->user;
+ targData = GetTrueChannelAccess(channel->channel_info, targ->handle_info);
+ if (!targData) continue;
+ if (pos + strlen(targ->nick) + strlen(targ->handle_info->handle) + 5 > sizeof(buf)) {
+ buf[pos] = 0;
+ send_message(user, cmd->parent->bot, CSMSG_CHANNEL_NAMES, channel->name, buf);
+ pos = 0;
+ }
+ if (IsUserSuspended(targData)) buf[pos++] = 's';
+ buf[pos++] = accessChars[targData->access];
+ len = strlen(targ->nick);
+ memcpy(buf+pos, targ->nick, len);
+ pos += len;
+ buf[pos++] = '(';
+ len = strlen(targ->handle_info->handle);
+ memcpy(buf+pos, targ->handle_info->handle, len);
+ pos += len;
+ buf[pos++] = ')';
+ }
+ buf[pos] = 0;
+ send_message(user, cmd->parent->bot, CSMSG_CHANNEL_NAMES, channel->name, buf);
+ send_message(user, cmd->parent->bot, CSMSG_END_NAMES, channel->name);
+ return 1;
+ }
+
static int
note_type_visible_to_user(struct chanData *channel, struct note_type *ntype, struct userNode *user)
***************
*** 6945,6948 ****
--- 6981,6985 ----
DEFINE_COMMAND(info, 1, MODCMD_REQUIRE_REGCHAN, "flags", "+nolog,+joinable", NULL);
DEFINE_COMMAND(seen, 2, MODCMD_REQUIRE_REGCHAN, "flags", "+nolog,+joinable", NULL);
+ DEFINE_COMMAND(names, 1, MODCMD_REQUIRE_REGCHAN, "flags", "+nolog,+joinable", NULL);
DEFINE_COMMAND(note, 1, MODCMD_REQUIRE_REGCHAN, "flags", "+joinable", NULL);
|