1
0
mirror of https://github.com/unrealircd/unrealircd.git synced 2026-07-07 23:03:12 +02:00

- Fixed a bug in mode-skipping (eg '+qk a b' if not +q) and error msgs, reported by brain2

(#0002372).
This commit is contained in:
Bram Matthys
2005-02-26 17:42:24 +00:00
parent c8a4857452
commit 4af12d14ea
3 changed files with 30 additions and 7 deletions
+2
View File
@@ -660,3 +660,5 @@
Rob_.
- Fixed a bug where SAJOIN would list channels multiple times in the notices (#0002325)
reported by vonitsanet.
- Fixed a bug in mode-skipping (eg '+qk a b' if not +q) and error msgs, reported by brain2
(#0002372).
+1 -1
View File
@@ -574,7 +574,7 @@ A table of all possible choices:<br>
<tr><td>italian</td><td>Italian characters</td><td>iso8859-1 (latin1)</td></tr>
<tr><td>spanish</td><td>Spanish characters</td><td>iso8859-1 (latin1)</td></tr>
<tr><td>swedish</td><td>Swedish characters</td><td>iso8859-1 (latin1)</td></tr>
<tr><td><b>latin1</b></td><td>dutch, french, german, swiss-german, spanish, icelandic, italian, swedish</td><td>iso8859-1 (latin1)</td></tr>
<tr><td><b>latin1</b></td><td>cataln, dutch, french, german, swiss-german, spanish, icelandic, italian, swedish</td><td>iso8859-1 (latin1)</td></tr>
<tr><td>hungarian</td><td>Hungarian characters</td><td>iso8859-2 (latin2)</td></tr>
<tr><td>polish</td><td>Polish characters</td><td>iso8859-2 (latin2)</td></tr>
<tr><td><b>latin2</b></td><td>hungarian, polish</td><td>iso8859-2 (latin2)</td></tr>
+27 -6
View File
@@ -67,6 +67,7 @@ void make_mode_str(aChannel *chptr, long oldm, Cmode_t oldem, long oldl, int pco
void make_mode_str(aChannel *chptr, long oldm, long oldl, int pcount,
char pvar[MAXMODEPARAMS][MODEBUFLEN + 3], char *mode_buf, char *para_buf, char bounce);
#endif
static void mode_cutoff(char *s);
#define MSG_MODE "MODE"
#define TOK_MODE "G"
@@ -332,6 +333,11 @@ CMD_FUNC(m_mode)
}
}
*/
/* This is to prevent excess +<whatever> modes. -- Syzop */
if (MyClient(sptr) && parv[2])
mode_cutoff(parv[2]);
/* Filter out the unprivileged FIRST. *
* Now, we can actually do the mode. */
@@ -340,6 +346,22 @@ CMD_FUNC(m_mode)
return 0;
}
/** Cut off mode string (eg: +abcdfjkdsgfgs) at MAXMODEPARAMS modes.
* @param s The mode string (modes only, no parameters)
* @notes Should only used on local clients
* @author Syzop
*/
static void mode_cutoff(char *s)
{
unsigned short modesleft = MAXMODEPARAMS;
for (; *s && modesleft; s++)
if ((*s != '-') && (*s != '+'))
modesleft--;
*s = '\0';
}
/* bounce_mode -- written by binary
* User or server is NOT authorized to change the mode. This takes care
* of making the bounce string and bounce it. Because of the 1 for the bounce
@@ -676,6 +698,8 @@ void make_mode_str(aChannel *chptr, long oldm, long oldl, int pcount,
* modified for Unreal by stskeeps..
*/
#define REQUIRE_PARAMETER() { if (!param || *pcount >= MAXMODEPARAMS) { retval = 0; break; } retval = 1; }
int do_mode_char(aChannel *chptr, long modetype, char modechar, char *param,
u_int what, aClient *cptr,
u_int *pcount, char pvar[MAXMODEPARAMS][MODEBUFLEN + 3], char bounce)
@@ -870,6 +894,7 @@ int do_mode_char(aChannel *chptr, long modetype, char modechar, char *param,
/* do pro-opping here (popping) */
case MODE_CHANOWNER:
REQUIRE_PARAMETER()
if (!IsULine(cptr) && !IsServer(cptr)
&& !is_chanowner(cptr, chptr))
{
@@ -886,6 +911,7 @@ int do_mode_char(aChannel *chptr, long modetype, char modechar, char *param,
}
}
case MODE_CHANPROT:
REQUIRE_PARAMETER()
if (!IsULine(cptr) && !IsServer(cptr)
&& !is_chanowner(cptr, chptr))
{
@@ -906,12 +932,7 @@ int do_mode_char(aChannel *chptr, long modetype, char modechar, char *param,
case MODE_HALFOP:
case MODE_CHANOP:
case MODE_VOICE:
if (!param || *pcount >= MAXMODEPARAMS)
{
retval = 0;
break;
}
retval = 1;
REQUIRE_PARAMETER()
if (!(who = find_chasing(cptr, param, &chasing)))
break;
if (!who->user)