channel: Stop pretending to support per-mode server capabilities.

After a change for dynamic server capabilities, the code to send out mode
changes was changed to use the capabilities belonging to the last mode
being sent out. This does not make sense; therefore, just use no
capabilities and remove supporting infrastructure.
This commit is contained in:
Jilles Tjoelker 2014-05-29 16:07:45 +02:00
parent d0c2fc8266
commit 51452a370b
3 changed files with 2 additions and 61 deletions

View file

@ -113,19 +113,10 @@ struct ChModeChange
const char *arg;
const char *id;
int dir;
int caps;
int nocaps;
int mems;
struct Client *client;
};
struct ChCapCombo
{
int count;
int cap_yes;
int cap_no;
};
typedef void (*ChannelModeFunc)(struct Client *source_p, struct Channel *chptr,
int alevel, int parc, int *parn,
const char **parv, int *errors, int dir, char c, long mode_type);

View file

@ -1219,8 +1219,6 @@ send_cap_mode_changes(struct Client *client_p, struct Client *source_p,
int i, mbl, pbl, nc, mc, preflen, len;
char *pbuf;
const char *arg;
int cap;
int nocap;
int dir;
int arglen;
@ -1246,9 +1244,6 @@ send_cap_mode_changes(struct Client *client_p, struct Client *source_p,
if (mode_changes[i].letter == 0)
continue;
cap = mode_changes[i].caps;
nocap = mode_changes[i].nocaps;
if (!EmptyString(mode_changes[i].id))
arg = mode_changes[i].id;
else
@ -1274,7 +1269,7 @@ send_cap_mode_changes(struct Client *client_p, struct Client *source_p,
((mbl + pbl + arglen + 4) > (BUFSIZE - 3))))
{
if(nc != 0)
sendto_server(client_p, chptr, cap, nocap,
sendto_server(client_p, chptr, NOCAPS, NOCAPS,
"%s %s", modebuf, parabuf);
nc = 0;
mc = 0;
@ -1309,7 +1304,7 @@ send_cap_mode_changes(struct Client *client_p, struct Client *source_p,
parabuf[pbl - 1] = 0;
if(nc != 0)
sendto_server(client_p, chptr, cap, nocap, "%s %s", modebuf, parabuf);
sendto_server(client_p, chptr, NOCAPS, NOCAPS, "%s %s", modebuf, parabuf);
}
void

View file

@ -631,8 +631,6 @@ chm_simple(struct Client *source_p, struct Channel *chptr,
mode_changes[mode_count].letter = c;
mode_changes[mode_count].dir = MODE_ADD;
mode_changes[mode_count].caps = 0;
mode_changes[mode_count].nocaps = 0;
mode_changes[mode_count].id = NULL;
mode_changes[mode_count].mems = ALL_MEMBERS;
mode_changes[mode_count++].arg = NULL;
@ -643,8 +641,6 @@ chm_simple(struct Client *source_p, struct Channel *chptr,
mode_changes[mode_count].letter = c;
mode_changes[mode_count].dir = MODE_DEL;
mode_changes[mode_count].caps = 0;
mode_changes[mode_count].nocaps = 0;
mode_changes[mode_count].mems = ALL_MEMBERS;
mode_changes[mode_count].id = NULL;
mode_changes[mode_count++].arg = NULL;
@ -665,8 +661,6 @@ chm_orphaned(struct Client *source_p, struct Channel *chptr,
mode_changes[mode_count].letter = c;
mode_changes[mode_count].dir = MODE_ADD;
mode_changes[mode_count].caps = 0;
mode_changes[mode_count].nocaps = 0;
mode_changes[mode_count].id = NULL;
mode_changes[mode_count].mems = ALL_MEMBERS;
mode_changes[mode_count++].arg = NULL;
@ -677,8 +671,6 @@ chm_orphaned(struct Client *source_p, struct Channel *chptr,
mode_changes[mode_count].letter = c;
mode_changes[mode_count].dir = MODE_DEL;
mode_changes[mode_count].caps = 0;
mode_changes[mode_count].nocaps = 0;
mode_changes[mode_count].mems = ALL_MEMBERS;
mode_changes[mode_count].id = NULL;
mode_changes[mode_count++].arg = NULL;
@ -716,8 +708,6 @@ chm_staff(struct Client *source_p, struct Channel *chptr,
mode_changes[mode_count].letter = c;
mode_changes[mode_count].dir = MODE_ADD;
mode_changes[mode_count].caps = 0;
mode_changes[mode_count].nocaps = 0;
mode_changes[mode_count].id = NULL;
mode_changes[mode_count].mems = ALL_MEMBERS;
mode_changes[mode_count++].arg = NULL;
@ -728,8 +718,6 @@ chm_staff(struct Client *source_p, struct Channel *chptr,
mode_changes[mode_count].letter = c;
mode_changes[mode_count].dir = MODE_DEL;
mode_changes[mode_count].caps = 0;
mode_changes[mode_count].nocaps = 0;
mode_changes[mode_count].mems = ALL_MEMBERS;
mode_changes[mode_count].id = NULL;
mode_changes[mode_count++].arg = NULL;
@ -749,7 +737,6 @@ chm_ban(struct Client *source_p, struct Channel *chptr,
int errorval;
const char *rpl_list_p;
const char *rpl_endlist_p;
int caps;
int mems;
switch (mode_type)
@ -760,7 +747,6 @@ chm_ban(struct Client *source_p, struct Channel *chptr,
rpl_list_p = form_str(RPL_BANLIST);
rpl_endlist_p = form_str(RPL_ENDOFBANLIST);
mems = ALL_MEMBERS;
caps = 0;
break;
case CHFL_EXCEPTION:
@ -773,7 +759,6 @@ chm_ban(struct Client *source_p, struct Channel *chptr,
errorval = SM_ERR_RPL_E;
rpl_list_p = form_str(RPL_EXCEPTLIST);
rpl_endlist_p = form_str(RPL_ENDOFEXCEPTLIST);
caps = CAP_EX;
if(ConfigChannel.use_except || (dir == MODE_DEL))
mems = ONLY_CHANOPS;
@ -791,7 +776,6 @@ chm_ban(struct Client *source_p, struct Channel *chptr,
errorval = SM_ERR_RPL_I;
rpl_list_p = form_str(RPL_INVITELIST);
rpl_endlist_p = form_str(RPL_ENDOFINVITELIST);
caps = CAP_IE;
if(ConfigChannel.use_invex || (dir == MODE_DEL))
mems = ONLY_CHANOPS;
@ -805,7 +789,6 @@ chm_ban(struct Client *source_p, struct Channel *chptr,
rpl_list_p = form_str(RPL_QUIETLIST);
rpl_endlist_p = form_str(RPL_ENDOFQUIETLIST);
mems = ALL_MEMBERS;
caps = 0;
break;
default:
@ -950,8 +933,6 @@ chm_ban(struct Client *source_p, struct Channel *chptr,
mode_changes[mode_count].letter = c;
mode_changes[mode_count].dir = MODE_ADD;
mode_changes[mode_count].caps = caps;
mode_changes[mode_count].nocaps = 0;
mode_changes[mode_count].mems = mems;
mode_changes[mode_count].id = NULL;
mode_changes[mode_count++].arg = mask;
@ -980,8 +961,6 @@ chm_ban(struct Client *source_p, struct Channel *chptr,
mode_changes[mode_count].letter = c;
mode_changes[mode_count].dir = MODE_DEL;
mode_changes[mode_count].caps = caps;
mode_changes[mode_count].nocaps = 0;
mode_changes[mode_count].mems = mems;
mode_changes[mode_count].id = NULL;
mode_changes[mode_count++].arg = buf + old_removed_mask_pos;
@ -1039,8 +1018,6 @@ chm_op(struct Client *source_p, struct Channel *chptr,
mode_changes[mode_count].letter = c;
mode_changes[mode_count].dir = MODE_ADD;
mode_changes[mode_count].caps = 0;
mode_changes[mode_count].nocaps = 0;
mode_changes[mode_count].mems = ALL_MEMBERS;
mode_changes[mode_count].id = targ_p->id;
mode_changes[mode_count].arg = targ_p->name;
@ -1059,8 +1036,6 @@ chm_op(struct Client *source_p, struct Channel *chptr,
mode_changes[mode_count].letter = c;
mode_changes[mode_count].dir = MODE_DEL;
mode_changes[mode_count].caps = 0;
mode_changes[mode_count].nocaps = 0;
mode_changes[mode_count].mems = ALL_MEMBERS;
mode_changes[mode_count].id = targ_p->id;
mode_changes[mode_count].arg = targ_p->name;
@ -1118,8 +1093,6 @@ chm_voice(struct Client *source_p, struct Channel *chptr,
{
mode_changes[mode_count].letter = c;
mode_changes[mode_count].dir = MODE_ADD;
mode_changes[mode_count].caps = 0;
mode_changes[mode_count].nocaps = 0;
mode_changes[mode_count].mems = ALL_MEMBERS;
mode_changes[mode_count].id = targ_p->id;
mode_changes[mode_count].arg = targ_p->name;
@ -1131,8 +1104,6 @@ chm_voice(struct Client *source_p, struct Channel *chptr,
{
mode_changes[mode_count].letter = 'v';
mode_changes[mode_count].dir = MODE_DEL;
mode_changes[mode_count].caps = 0;
mode_changes[mode_count].nocaps = 0;
mode_changes[mode_count].mems = ALL_MEMBERS;
mode_changes[mode_count].id = targ_p->id;
mode_changes[mode_count].arg = targ_p->name;
@ -1172,8 +1143,6 @@ chm_limit(struct Client *source_p, struct Channel *chptr,
mode_changes[mode_count].letter = c;
mode_changes[mode_count].dir = MODE_ADD;
mode_changes[mode_count].caps = 0;
mode_changes[mode_count].nocaps = 0;
mode_changes[mode_count].mems = ALL_MEMBERS;
mode_changes[mode_count].id = NULL;
mode_changes[mode_count++].arg = limitstr;
@ -1189,8 +1158,6 @@ chm_limit(struct Client *source_p, struct Channel *chptr,
mode_changes[mode_count].letter = c;
mode_changes[mode_count].dir = MODE_DEL;
mode_changes[mode_count].caps = 0;
mode_changes[mode_count].nocaps = 0;
mode_changes[mode_count].mems = ALL_MEMBERS;
mode_changes[mode_count].id = NULL;
mode_changes[mode_count++].arg = NULL;
@ -1222,8 +1189,6 @@ chm_throttle(struct Client *source_p, struct Channel *chptr,
mode_changes[mode_count].letter = c;
mode_changes[mode_count].dir = MODE_ADD;
mode_changes[mode_count].caps = 0;
mode_changes[mode_count].nocaps = 0;
mode_changes[mode_count].mems = ALL_MEMBERS;
mode_changes[mode_count].id = NULL;
mode_changes[mode_count++].arg = parv[(*parn)];
@ -1245,8 +1210,6 @@ chm_throttle(struct Client *source_p, struct Channel *chptr,
mode_changes[mode_count].letter = c;
mode_changes[mode_count].dir = MODE_DEL;
mode_changes[mode_count].caps = 0;
mode_changes[mode_count].nocaps = 0;
mode_changes[mode_count].mems = ALL_MEMBERS;
mode_changes[mode_count].id = NULL;
mode_changes[mode_count++].arg = NULL;
@ -1309,8 +1272,6 @@ chm_forward(struct Client *source_p, struct Channel *chptr,
mode_changes[mode_count].letter = c;
mode_changes[mode_count].dir = MODE_ADD;
mode_changes[mode_count].caps = 0;
mode_changes[mode_count].nocaps = 0;
mode_changes[mode_count].mems =
ConfigChannel.use_forward ? ALL_MEMBERS : ONLY_SERVERS;
mode_changes[mode_count].id = NULL;
@ -1325,8 +1286,6 @@ chm_forward(struct Client *source_p, struct Channel *chptr,
mode_changes[mode_count].letter = c;
mode_changes[mode_count].dir = MODE_DEL;
mode_changes[mode_count].caps = 0;
mode_changes[mode_count].nocaps = 0;
mode_changes[mode_count].mems = ALL_MEMBERS;
mode_changes[mode_count].id = NULL;
mode_changes[mode_count++].arg = NULL;
@ -1367,8 +1326,6 @@ chm_key(struct Client *source_p, struct Channel *chptr,
mode_changes[mode_count].letter = c;
mode_changes[mode_count].dir = MODE_ADD;
mode_changes[mode_count].caps = 0;
mode_changes[mode_count].nocaps = 0;
mode_changes[mode_count].mems = ALL_MEMBERS;
mode_changes[mode_count].id = NULL;
mode_changes[mode_count++].arg = chptr->mode.key;
@ -1398,8 +1355,6 @@ chm_key(struct Client *source_p, struct Channel *chptr,
mode_changes[mode_count].letter = c;
mode_changes[mode_count].dir = MODE_DEL;
mode_changes[mode_count].caps = 0;
mode_changes[mode_count].nocaps = 0;
mode_changes[mode_count].mems = ALL_MEMBERS;
mode_changes[mode_count].id = NULL;
mode_changes[mode_count++].arg = "*";