[srvx-commits] CVS: services/src proto_ircu_p10.c,1.16,1.17 proto_bahamut.c,1.6,1.7 opserv.c,1.206,1
Brought to you by:
entrope
From: Entrope <en...@us...> - 2001-08-11 17:47:47
|
Update of /cvsroot/srvx/services/src In directory usw-pr-cvs1:/tmp/cvs-serv4263/src Modified Files: proto_ircu_p10.c proto_bahamut.c opserv.c chanserv.c Log Message: Bahamut only lets clients on U-lined servers hack modes (ircu only lets the server do it), so we have to provide the client driving the mode change to the protocol layer and let the protocol layer decide the source Index: proto_ircu_p10.c =================================================================== RCS file: /cvsroot/srvx/services/src/proto_ircu_p10.c,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -r1.16 -r1.17 *** proto_ircu_p10.c 2001/08/11 16:37:36 1.16 --- proto_ircu_p10.c 2001/08/11 17:47:43 1.17 *************** *** 577,581 **** irc_mode(struct userNode *from, struct chanNode *target, const char *modes) { ! putsock("%s %s %s %s "FMT_TIME_T, from ? from->proto.numeric : self->proto.numeric, CMD_MODE, target->name, modes, target->timestamp); } --- 577,584 ---- irc_mode(struct userNode *from, struct chanNode *target, const char *modes) { ! struct userMode *mn; ! const char *src; ! src = ((mn = GetUserMode(target)) && (mn->modes & MODE_CHANOP)) ? from->proto.numeric : self->proto.numeric; ! putsock("%s %s %s %s "FMT_TIME_T, src, CMD_MODE, target->name, modes, target->timestamp); } Index: proto_bahamut.c =================================================================== RCS file: /cvsroot/srvx/services/src/proto_bahamut.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -r1.6 -r1.7 *** proto_bahamut.c 2001/08/11 16:37:36 1.6 --- proto_bahamut.c 2001/08/11 17:47:43 1.7 *************** *** 407,411 **** irc_mode(struct userNode *from, struct chanNode *target, const char *modes) { ! putsock("%s %s %s %s", (from ? from->nick : self->name), CMD_MODE, target->name, modes); } --- 407,411 ---- irc_mode(struct userNode *from, struct chanNode *target, const char *modes) { ! putsock(":%s %s %s %s", from->nick, CMD_MODE, target->name, modes); } *************** *** 413,417 **** irc_invite(struct userNode *from, struct userNode *who, struct chanNode *to) { ! putsock("%s %s %s %s", from->nick, CMD_INVITE, who->nick, to->name); } --- 413,417 ---- irc_invite(struct userNode *from, struct userNode *who, struct chanNode *to) { ! putsock(":%s %s %s %s", from->nick, CMD_INVITE, who->nick, to->name); } *************** *** 1072,1088 **** static struct chanNode *cn; ! if (!argv[1]) return 0; ! if (argv[3]) { ! cn = GetChannel(argv[3]); ! if (!cn) { ! log(MAIN_LOG, LOG_ERROR, "Unable to find channel %s in topic reply\n", argv[3]); ! return 0; ! } ! } else return 0; ! switch (atoi(argv[1])) { ! case 331: cn->topic_time = 0; ! break; /* no topic */ case 332: if (argc < 5) return 0; --- 1072,1085 ---- static struct chanNode *cn; ! if (argc < 3) return 0; ! if (!(cn = GetChannel(argv[2]))) { ! log(MAIN_LOG, LOG_ERROR, "Unable to find channel %s in topic reply\n", argv[3]); ! return 0; ! } ! switch (atoi(argv[0])) { ! case 331: /* no topic */ cn->topic_time = 0; ! break; case 332: if (argc < 5) return 0; Index: opserv.c =================================================================== RCS file: /cvsroot/srvx/services/src/opserv.c,v retrieving revision 1.206 retrieving revision 1.207 diff -C2 -r1.206 -r1.207 *** opserv.c 2001/08/11 16:37:36 1.206 --- opserv.c 2001/08/11 17:47:43 1.207 *************** *** 503,516 **** } - static struct userNode * - opserv_actor(struct chanNode *channel) - { - struct modeNode *mn; - return (channel - && (mn = GetUserMode(channel, opserv)) - && (mn->modes & MODE_CHANOP)) - ? opserv : NULL; - } - static OPSERV_FUNC(cmd_ban) { --- 503,506 ---- *************** *** 522,526 **** return 0; } ! AddChannelBan(1, &mask, channel, opserv_actor(channel), time(0), 1); opserv_notice(user, OSMSG_ADDED_BAN, mask, channel->name); return 1; --- 512,516 ---- return 0; } ! AddChannelBan(1, &mask, channel, opserv, time(0), 1); opserv_notice(user, OSMSG_ADDED_BAN, mask, channel->name); return 1; *************** *** 656,672 **** char *list[256]; unsigned int count, n; - struct userNode *actor; OPSERV_NEED_CHANNEL(); (void)argc; - actor = opserv_actor(channel); for (count=n=0; n<channel->banlist.used; n++) { list[count] = channel->banlist.list[n]->ban; if (count == ArrayLength(list)) { ! DelChannelBan(count, list, channel, actor, 1); count = 0; } } if (count) { ! DelChannelBan(count, list, channel, actor, 1); } opserv_notice(user, OSMSG_CLEARBANS_DONE, channel->name); --- 646,660 ---- char *list[256]; unsigned int count, n; OPSERV_NEED_CHANNEL(); (void)argc; for (count=n=0; n<channel->banlist.used; n++) { list[count] = channel->banlist.list[n]->ban; if (count == ArrayLength(list)) { ! DelChannelBan(count, list, channel, opserv, 1); count = 0; } } if (count) { ! DelChannelBan(count, list, channel, opserv, 1); } opserv_notice(user, OSMSG_CLEARBANS_DONE, channel->name); *************** *** 682,686 **** channel->modes = 0; buffer[0] = '-'; ! irc_mode(opserv_actor(channel), channel, buffer); opserv_notice(user, OSMSG_CLEARMODES_DONE, channel->name); return 1; --- 670,674 ---- channel->modes = 0; buffer[0] = '-'; ! irc_mode(opserv, channel, buffer); opserv_notice(user, OSMSG_CLEARMODES_DONE, channel->name); return 1; *************** *** 696,703 **** struct modeNode *mn; unsigned int count, next; - struct userNode *actor; OPSERV_MIN_PARMS(2, true); - actor = opserv_actor(channel); for (count=0, next=1; next<argc; next++) { if (!(list[count] = GetUser(argv[next]))) continue; --- 684,689 ---- *************** *** 707,716 **** count++; if (count == ArrayLength(list)) { ! DelChannelOp(count, list, channel, actor, 1); count = 0; } } if (count) { ! DelChannelOp(count, list, channel, actor, 1); } opserv_notice(user, OSMSG_DEOP_DONE); --- 693,702 ---- count++; if (count == ArrayLength(list)) { ! DelChannelOp(count, list, channel, opserv, 1); count = 0; } } if (count) { ! DelChannelOp(count, list, channel, opserv, 1); } opserv_notice(user, OSMSG_DEOP_DONE); *************** *** 723,730 **** struct userNode *list[256]; unsigned int count, n; - struct userNode *actor; OPSERV_NEED_CHANNEL(); (void)argc; - actor = opserv_actor(channel); for (count=n=0; n<channel->members.used; n++) { mn = channel->members.list[n]; --- 709,714 ---- *************** *** 733,742 **** list[count++] = mn->user; if (count == ArrayLength(list)) { ! DelChannelOp(count, list, channel, actor, 1); count = 0; } } if (count) { ! DelChannelOp(count, list, channel, actor, 1); } opserv_notice(user, OSMSG_DEOPALL_DONE, channel->name); --- 717,726 ---- 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); *************** *** 1082,1086 **** } mask = generate_hostmask(target, false, true); ! AddChannelBan(1, &mask, channel, opserv_actor(channel), time(0), 1); free(mask); KickChannelUser(target, channel, opserv, reason); --- 1066,1070 ---- } mask = generate_hostmask(target, false, true); ! AddChannelBan(1, &mask, channel, opserv, time(0), 1); free(mask); KickChannelUser(target, channel, opserv, reason); *************** *** 1135,1139 **** } if (count) { ! AddChannelBan(count, list, channel, opserv_actor(channel), time(0), 1); } /* now kick them */ --- 1119,1123 ---- } if (count) { ! AddChannelBan(count, list, channel, opserv, time(0), 1); } /* now kick them */ *************** *** 1161,1176 **** static OPSERV_FUNC(cmd_mode) { - struct userNode *actor; - OPSERV_MIN_PARMS(2, true); unsplit_string(argv+1, argc-1); - actor = opserv_actor(channel); if (channel->key[0]) { char *mc = alloca(strlen(channel->key)+4); sprintf(mc, "-k %s", channel->key); ! irc_mode(actor, channel, mc); } mod_chanmode(channel, argv[1], NULL, 0); ! irc_mode(actor, channel, argv[1]); opserv_notice(user, OSMSG_MODE_SET, channel->name); return 1; --- 1145,1157 ---- static OPSERV_FUNC(cmd_mode) { OPSERV_MIN_PARMS(2, true); unsplit_string(argv+1, argc-1); if (channel->key[0]) { char *mc = alloca(strlen(channel->key)+4); sprintf(mc, "-k %s", channel->key); ! irc_mode(opserv, channel, mc); } mod_chanmode(channel, argv[1], NULL, 0); ! irc_mode(opserv, channel, argv[1]); opserv_notice(user, OSMSG_MODE_SET, channel->name); return 1; *************** *** 1188,1192 **** } usermask = generate_hostmask(target, false, true); ! AddChannelBan(1, &usermask, channel, opserv_actor(channel), now, 1); free(usermask); opserv_notice(user, OSMSG_ADDED_BAN, usermask, channel->name); --- 1169,1173 ---- } usermask = generate_hostmask(target, false, true); ! AddChannelBan(1, &usermask, channel, opserv, now, 1); free(usermask); opserv_notice(user, OSMSG_ADDED_BAN, usermask, channel->name); *************** *** 1198,1206 **** struct userNode *list[256]; struct modeNode *mn; - struct userNode *actor; unsigned int count, next; OPSERV_MIN_PARMS(2, true); - actor = opserv_actor(channel); for (count=0, next=1; next<argc; next++) { if (!(list[count] = GetUser(argv[next]))) continue; --- 1179,1185 ---- *************** *** 1209,1218 **** count++; if (count == ArrayLength(list)) { ! AddChannelOp(count, list, channel, actor, 1); count = 0; } } if (count) { ! AddChannelOp(count, list, channel, actor, 1); } opserv_notice(user, OSMSG_OP_DONE, channel->name); --- 1188,1197 ---- count++; if (count == ArrayLength(list)) { ! AddChannelOp(count, list, channel, opserv, 1); count = 0; } } if (count) { ! AddChannelOp(count, list, channel, opserv, 1); } opserv_notice(user, OSMSG_OP_DONE, channel->name); *************** *** 1225,1233 **** struct modeNode *mn; unsigned int count, n; - struct userNode *actor; (void)argv; OPSERV_NEED_CHANNEL(); (void)argc; - actor = opserv_actor(channel); for (count=n=0; n<channel->members.used; n++) { mn = channel->members.list[n]; --- 1204,1210 ---- *************** *** 1235,1244 **** users[count++] = mn->user; if (count == ArrayLength(users)) { ! AddChannelOp(count, users, channel, actor, 1); count = 0; } } if (count) { ! AddChannelOp(count, users, channel, actor, 1); } opserv_notice(user, OSMSG_OP_DONE, channel->name); --- 1212,1221 ---- 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_OP_DONE, channel->name); *************** *** 1294,1298 **** { OPSERV_MIN_PARMS(2, true); ! DelChannelBan(argc-1, (char**)argv+1, channel, opserv_actor(channel), 1); opserv_notice(user, OSMSG_UNBAN_DONE, channel->name); return 1; --- 1271,1275 ---- { OPSERV_MIN_PARMS(2, true); ! DelChannelBan(argc-1, (char**)argv+1, channel, opserv, 1); opserv_notice(user, OSMSG_UNBAN_DONE, channel->name); return 1; *************** *** 1304,1308 **** unsigned int n, count; struct modeNode *mn; - struct userNode *actor; (void)argv; OPSERV_NEED_CHANNEL(); (void)argc; --- 1281,1284 ---- *************** *** 1311,1315 **** return 0; } - actor = opserv_actor(channel); for (count=n=0; n<channel->members.used; n++) { mn = channel->members.list[n]; --- 1287,1290 ---- *************** *** 1317,1328 **** users[count++] = mn->user; if (count == ArrayLength(users)) { ! AddChannelVoice(count, users, channel, actor, 1); count = 0; } } if (count) { ! AddChannelVoice(count, users, channel, actor, 1); } ! irc_mode(actor, channel, "+m"); channel->modes |= MODE_MODERATED; opserv_notice(user, OSMSG_CHANNEL_MODERATED, channel->name); --- 1292,1303 ---- users[count++] = mn->user; if (count == ArrayLength(users)) { ! AddChannelVoice(count, users, channel, opserv, 1); count = 0; } } if (count) { ! AddChannelVoice(count, users, channel, opserv, 1); } ! irc_mode(opserv, channel, "+m"); channel->modes |= MODE_MODERATED; opserv_notice(user, OSMSG_CHANNEL_MODERATED, channel->name); *************** *** 1338,1342 **** return 0; } ! irc_mode(opserv_actor(channel), channel, "-m"); channel->modes &= ~MODE_MODERATED; opserv_notice(user, OSMSG_CHANNEL_UNMODERATED, channel->name); --- 1313,1317 ---- return 0; } ! irc_mode(opserv, channel, "-m"); channel->modes &= ~MODE_MODERATED; opserv_notice(user, OSMSG_CHANNEL_UNMODERATED, channel->name); *************** *** 2155,2159 **** return 0; } ! AddChannelOp(1, &clone, channel, opserv_actor(channel), true); opserv_notice(user, OSMSG_OPS_GIVEN, channel->name, clone->nick); return 1; --- 2130,2134 ---- return 0; } ! AddChannelOp(1, &clone, channel, opserv, true); opserv_notice(user, OSMSG_OPS_GIVEN, channel->name, clone->nick); return 1; Index: chanserv.c =================================================================== RCS file: /cvsroot/srvx/services/src/chanserv.c,v retrieving revision 1.177 retrieving revision 1.178 diff -C2 -r1.177 -r1.178 *** chanserv.c 2001/08/01 22:14:34 1.177 --- chanserv.c 2001/08/11 17:47:43 1.178 *************** *** 1152,1156 **** { AddChannelUser(cData->bot, cData->channel, 0); ! AddChannelOp(1, &cData->bot, cData->channel, NULL, 1); } --- 1152,1156 ---- { AddChannelUser(cData->bot, cData->channel, 0); ! AddChannelOp(1, &cData->bot, cData->channel, cData->bot, 1); } *************** *** 1700,1706 **** static CHANSERV_FUNC(cmd_opchan) { (void)user; (void)argc; (void)argv; ! if (channel->channel_info && GetUserMode(channel, channel->channel_info->bot)) { ! AddChannelOp(1, &channel->channel_info->bot, channel, NULL, 1); } else { chanserv_notice(user, CSMSG_UNREGISTERED, channel->name); --- 1700,1708 ---- static CHANSERV_FUNC(cmd_opchan) { + struct chanData *cData; (void)user; (void)argc; (void)argv; ! cData = channel->channel_info; ! if (cData && GetUserMode(channel, cData->bot)) { ! AddChannelOp(1, &cData->bot, channel, cData->bot, 1); } else { chanserv_notice(user, CSMSG_UNREGISTERED, channel->name); *************** *** 4227,4231 **** if (!mn) return; if (mn->modes & MODE_CHANOP) return; ! AddChannelOp(1, &chanserv, channel, NULL, 1); if (cData->mode_on || cData->mode_off) --- 4229,4233 ---- if (!mn) return; if (mn->modes & MODE_CHANOP) return; ! AddChannelOp(1, &cData->bot, channel, cData->bot, 1); if (cData->mode_on || cData->mode_off) *************** *** 4235,4244 **** mod_chanmode(channel, modes, NULL, 0); ! irc_mode(channel->channel_info->bot, channel, modes); } if(cData->topic[0]) { ! SetChannelTopic(channel, channel->channel_info->bot, cData->topic, 1); } } --- 4237,4246 ---- mod_chanmode(channel, modes, NULL, 0); ! irc_mode(cData->bot, channel, modes); } if(cData->topic[0]) { ! SetChannelTopic(channel, cData->bot, cData->topic, 1); } } |