[srvx-commits] CVS: services/src opserv.c,1.318,1.319
Brought to you by:
entrope
|
From: Entrope <en...@us...> - 2003-07-08 01:55:35
|
Update of /cvsroot/srvx/services/src
In directory sc8-pr-cvs1:/tmp/cvs-serv12407/src
Modified Files:
opserv.c
Log Message:
make the massmodes commands work for other services
Index: opserv.c
===================================================================
RCS file: /cvsroot/srvx/services/src/opserv.c,v
retrieving revision 1.318
retrieving revision 1.319
diff -C2 -r1.318 -r1.319
*** opserv.c 7 Jul 2003 16:29:33 -0000 1.318
--- opserv.c 8 Jul 2003 01:55:32 -0000 1.319
***************
*** 242,251 ****
#define OPSERV_SYNTAX() svccmd_send_help(user, opserv, cmd)
#define OPSERV_NEED_CHANNEL() do { if (!channel) { \
! opserv_notice(user, MSG_INVALID_CHANNEL); \
OPSERV_SYNTAX(); \
return 0; } } while (0)
#define OPSERV_MIN_PARMS(N, NEED_CHANNEL) do { \
if (argc < N) { \
! opserv_notice(user, MSG_MISSING_PARAMS, argv[0]); \
OPSERV_SYNTAX(); \
return 0; } \
--- 242,251 ----
#define OPSERV_SYNTAX() svccmd_send_help(user, opserv, cmd)
#define OPSERV_NEED_CHANNEL() do { if (!channel) { \
! reply(MSG_INVALID_CHANNEL); \
OPSERV_SYNTAX(); \
return 0; } } while (0)
#define OPSERV_MIN_PARMS(N, NEED_CHANNEL) do { \
if (argc < N) { \
! reply(MSG_MISSING_PARAMS, argv[0]); \
OPSERV_SYNTAX(); \
return 0; } \
***************
*** 597,608 ****
list[count++] = mn->user;
if (count == ArrayLength(list)) {
! DelChannelOp(count, list, channel, opserv, 1);
count = 0;
}
}
if (count) {
! DelChannelOp(count, list, channel, opserv, 1);
}
! opserv_notice(user, OSMSG_DEOPALL_DONE, channel->name);
return 1;
}
--- 597,608 ----
list[count++] = mn->user;
if (count == ArrayLength(list)) {
! DelChannelOp(count, list, channel, cmd->parent->bot, 1);
count = 0;
}
}
if (count) {
! DelChannelOp(count, list, channel, cmd->parent->bot, 1);
}
! reply(OSMSG_DEOPALL_DONE, channel->name);
return 1;
}
***************
*** 977,991 ****
static OPSERV_FUNC(cmd_kickall)
{
! unsigned int limit;
! unsigned int n, inchan;
struct modeNode *mn;
char *reason;
OPSERV_NEED_CHANNEL();
/* ircu doesn't let servers KICK users, so if OpServ's not in the
* channel, we have to join it in temporarily. */
! if (!(inchan = GetUserMode(channel, opserv) ? 1 : 0)) {
! AddChannelUser(opserv, channel);
! AddChannelOp(1, &opserv, channel, opserv, 1);
}
if (argc < 2) {
--- 977,991 ----
static OPSERV_FUNC(cmd_kickall)
{
! unsigned int limit, n, inchan;
struct modeNode *mn;
char *reason;
+ struct userNode *bot = cmd->parent->bot;
OPSERV_NEED_CHANNEL();
/* ircu doesn't let servers KICK users, so if OpServ's not in the
* channel, we have to join it in temporarily. */
! if (!(inchan = GetUserMode(channel, bot) ? 1 : 0)) {
! AddChannelUser(bot, channel);
! AddChannelOp(1, &bot, channel, bot, 1);
}
if (argc < 2) {
***************
*** 1003,1012 ****
continue;
}
! KickChannelUser(mn->user, channel, opserv, reason);
}
if (!inchan) {
! DelChannelUser(opserv, channel, "My work here is done", 0);
}
! opserv_notice(user, OSMSG_KICKALL_DONE, channel->name);
return 1;
}
--- 1003,1012 ----
continue;
}
! KickChannelUser(mn->user, channel, bot, reason);
}
if (!inchan) {
! DelChannelUser(bot, channel, "My work here is done", 0);
}
! reply(OSMSG_KICKALL_DONE, channel->name);
return 1;
}
***************
*** 1043,1052 ****
static OPSERV_FUNC(cmd_kickbanall)
{
! unsigned int limit;
! int n;
struct modeNode *mn;
char *reason;
! OPSERV_NEED_CHANNEL(); (void)argc;
if (argc < 2) {
reason = alloca(strlen(OSMSG_KICK_REQUESTED)+strlen(user->nick)+1);
--- 1043,1058 ----
static OPSERV_FUNC(cmd_kickbanall)
{
! unsigned int limit, n, inchan;
struct modeNode *mn;
char *reason;
+ struct userNode *bot = cmd->parent->bot;
! OPSERV_NEED_CHANNEL();
! /* ircu doesn't let servers KICK users, so if OpServ's not in the
! * channel, we have to join it in temporarily. */
! if (!(inchan = GetUserMode(channel, bot) ? 1 : 0)) {
! AddChannelUser(bot, channel);
! AddChannelOp(1, &bot, channel, bot, 1);
! }
if (argc < 2) {
reason = alloca(strlen(OSMSG_KICK_REQUESTED)+strlen(user->nick)+1);
***************
*** 1058,1067 ****
if (channel->banlist.used < MAXBANS) {
char *ban = "*!*@*";
! AddChannelBan(1, (const char **)&ban, channel, opserv, now, 1);
}
/* now kick them */
limit = user->handle_info->opserv_level;
! for (n=channel->members.used-1; n>=0; n--) {
! mn = channel->members.list[n];
if (IsService(mn->user)
|| (mn->user->handle_info
--- 1064,1073 ----
if (channel->banlist.used < MAXBANS) {
char *ban = "*!*@*";
! AddChannelBan(1, (const char **)&ban, channel, bot, now, 1);
}
/* now kick them */
limit = user->handle_info->opserv_level;
! for (n=channel->members.used; n>0; ) {
! mn = channel->members.list[--n];
if (IsService(mn->user)
|| (mn->user->handle_info
***************
*** 1069,1075 ****
continue;
}
! KickChannelUser(mn->user, channel, opserv, reason);
}
! opserv_notice(user, OSMSG_KICKALL_DONE, channel->name);
return 1;
}
--- 1075,1084 ----
continue;
}
! KickChannelUser(mn->user, channel, bot, reason);
! }
! if (!inchan) {
! DelChannelUser(bot, channel, "My work here is done", 0);
}
! reply(OSMSG_KICKALL_DONE, channel->name);
return 1;
}
***************
*** 1159,1164 ****
unsigned int count, n;
! (void)argv;
! OPSERV_NEED_CHANNEL(); (void)argc;
for (count=n=0; n<channel->members.used; n++) {
mn = channel->members.list[n];
--- 1168,1172 ----
unsigned int count, n;
! OPSERV_NEED_CHANNEL(); (void)argc; (void)argv;
for (count=n=0; n<channel->members.used; n++) {
mn = channel->members.list[n];
***************
*** 1166,1177 ****
users[count++] = mn->user;
if (count == ArrayLength(users)) {
! AddChannelOp(count, users, channel, opserv, 1);
count = 0;
}
}
if (count) {
! AddChannelOp(count, users, channel, opserv, 1);
}
! opserv_notice(user, OSMSG_OPALL_DONE, channel->name);
return 1;
}
--- 1174,1185 ----
users[count++] = mn->user;
if (count == ArrayLength(users)) {
! AddChannelOp(count, users, channel, cmd->parent->bot, 1);
count = 0;
}
}
if (count) {
! AddChannelOp(count, users, channel, cmd->parent->bot, 1);
}
! reply(OSMSG_OPALL_DONE, channel->name);
return 1;
}
***************
*** 1251,1256 ****
struct modeNode *mn;
! (void)argv; (void)argc;
! OPSERV_NEED_CHANNEL();
for (count=n=0; n<channel->members.used; n++) {
mn = channel->members.list[n];
--- 1259,1263 ----
struct modeNode *mn;
! OPSERV_NEED_CHANNEL(); (void)argv; (void)argc;
for (count=n=0; n<channel->members.used; n++) {
mn = channel->members.list[n];
***************
*** 1258,1269 ****
users[count++] = mn->user;
if (count == ArrayLength(users)) {
! AddChannelVoice(count, users, channel, opserv, 1);
count = 0;
}
}
if (count) {
! AddChannelVoice(count, users, channel, opserv, 1);
}
! opserv_notice(user, OSMSG_CHANNEL_VOICED, channel->name);
return 1;
}
--- 1265,1276 ----
users[count++] = mn->user;
if (count == ArrayLength(users)) {
! AddChannelVoice(count, users, channel, cmd->parent->bot, 1);
count = 0;
}
}
if (count) {
! AddChannelVoice(count, users, channel, cmd->parent->bot, 1);
}
! reply(OSMSG_CHANNEL_VOICED, channel->name);
return 1;
}
***************
*** 1275,1280 ****
struct modeNode *mn;
! (void)argv; (void)argc;
! OPSERV_NEED_CHANNEL();
for (count=n=0; n<channel->members.used; n++) {
mn = channel->members.list[n];
--- 1282,1286 ----
struct modeNode *mn;
! OPSERV_NEED_CHANNEL(); (void)argv; (void)argc;
for (count=n=0; n<channel->members.used; n++) {
mn = channel->members.list[n];
***************
*** 1282,1293 ****
users[count++] = mn->user;
if (count == ArrayLength(users)) {
! DelChannelVoice(count, users, channel, opserv, 1);
count = 0;
}
}
if (count) {
! DelChannelVoice(count, users, channel, opserv, 1);
}
! opserv_notice(user, OSMSG_CHANNEL_DEVOICED, channel->name);
return 1;
}
--- 1288,1299 ----
users[count++] = mn->user;
if (count == ArrayLength(users)) {
! DelChannelVoice(count, users, channel, cmd->parent->bot, 1);
count = 0;
}
}
if (count) {
! DelChannelVoice(count, users, channel, cmd->parent->bot, 1);
}
! reply(OSMSG_CHANNEL_DEVOICED, channel->name);
return 1;
}
|