mirror of
https://github.com/irssi/irssi.git
synced 2024-12-04 14:46:39 -05:00
Merge pull request #766 from horgh/horgh/mode-parsing
Fix MODE parameter parsing
This commit is contained in:
commit
48e909dde7
@ -40,6 +40,8 @@ static int signal_server_incoming;
|
|||||||
# define MAX_SOCKET_READS 5
|
# define MAX_SOCKET_READS 5
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static void strip_params_colon(char *const);
|
||||||
|
|
||||||
/* The core of the irc_send_cmd* functions. If `raw' is TRUE, the `cmd'
|
/* The core of the irc_send_cmd* functions. If `raw' is TRUE, the `cmd'
|
||||||
won't be checked at all if it's 512 bytes or not, or if it contains
|
won't be checked at all if it's 512 bytes or not, or if it contains
|
||||||
line feeds or not. Use with extreme caution! */
|
line feeds or not. Use with extreme caution! */
|
||||||
@ -269,8 +271,9 @@ char *event_get_params(const char *data, int count, ...)
|
|||||||
while (count-- > 0) {
|
while (count-- > 0) {
|
||||||
str = (char **) va_arg(args, char **);
|
str = (char **) va_arg(args, char **);
|
||||||
if (count == 0 && rest) {
|
if (count == 0 && rest) {
|
||||||
/* put the rest to last parameter */
|
/* Put the rest into the last parameter. */
|
||||||
tmp = *datad == ':' ? datad+1 : datad;
|
strip_params_colon(datad);
|
||||||
|
tmp = datad;
|
||||||
} else {
|
} else {
|
||||||
tmp = event_get_param(&datad);
|
tmp = event_get_param(&datad);
|
||||||
}
|
}
|
||||||
@ -281,6 +284,33 @@ char *event_get_params(const char *data, int count, ...)
|
|||||||
return duprec;
|
return duprec;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Given a string containing <params>, strip any colon prefixing <trailing>. */
|
||||||
|
static void strip_params_colon(char *const params)
|
||||||
|
{
|
||||||
|
char *s;
|
||||||
|
|
||||||
|
if (params == NULL) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
s = params;
|
||||||
|
while (*s != '\0') {
|
||||||
|
if (*s == ':') {
|
||||||
|
memmove(s, s+1, strlen(s+1)+1);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
s = strchr(s, ' ');
|
||||||
|
if (s == NULL) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
while (*s == ' ') {
|
||||||
|
s++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void irc_server_event(IRC_SERVER_REC *server, const char *line,
|
static void irc_server_event(IRC_SERVER_REC *server, const char *line,
|
||||||
const char *nick, const char *address)
|
const char *nick, const char *address)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user