[CLIENTHACK] Remove xchat's + and - on each msg
This patch drops CAPAB setting in 005 message from server to client. Doing this xchat does not start the mode that prepends a + or a - at the beginning of PRIVMSGS.
This commit is contained in:
parent
c4fb1b140a
commit
eef2fd180d
@ -412,6 +412,12 @@ int irc_dispatch_server(bip_t *bip, struct link_server *server,
|
||||
|
||||
} else if (LINK(server)->s_state == IRCS_CONNECTING) {
|
||||
ret = OK_FORGET;
|
||||
if (irc_line_elem_equals(line, 0, "005")) {
|
||||
int i;
|
||||
for (i = 0; i < irc_line_count(line); i++)
|
||||
if (irc_line_elem_equals(line, i, "CAPAB"))
|
||||
irc_line_drop(line, i);
|
||||
}
|
||||
if (irc_line_elem_equals(line, 0, "NOTICE")) {
|
||||
} else if (irc_line_elem_equals(line, 0, "376")) {
|
||||
/* end of motd */
|
||||
|
@ -130,6 +130,11 @@ const char *irc_line_elem(struct line *line, int elem)
|
||||
return array_get(&line->words, elem);
|
||||
}
|
||||
|
||||
void irc_line_drop(struct line *line, int elem)
|
||||
{
|
||||
free(array_drop(&line->words, elem));
|
||||
}
|
||||
|
||||
int irc_line_elem_equals(struct line *line, int elem, const char *cmp)
|
||||
{
|
||||
return !strcmp(irc_line_elem(line, elem), cmp);
|
||||
|
@ -100,5 +100,6 @@ char *irc_line_pop(struct line *l);
|
||||
int irc_line_elem_equals(struct line *line, int elem, const char *cmp);
|
||||
int irc_line_elem_case_equals(struct line *line, int elem, const char *cmp);
|
||||
void irc_line_free_args(char **elemv, int elemc);
|
||||
void irc_line_drop(struct line *line, int elem);
|
||||
|
||||
#endif
|
||||
|
14
src/util.c
14
src/util.c
@ -771,6 +771,20 @@ void array_ensure(array_t *a, int index)
|
||||
a->elemc = index + 1;
|
||||
}
|
||||
|
||||
void *array_drop(array_t *a, int index)
|
||||
{
|
||||
int i;
|
||||
void *ret;
|
||||
|
||||
assert(a && array_includes(a, index));
|
||||
|
||||
ret = a->elemv[index];
|
||||
for (i = index; i < array_count(a) - 1; i++)
|
||||
a->elemv[i] = a->elemv[i + 1];
|
||||
a->elemc--;
|
||||
return ret;
|
||||
}
|
||||
|
||||
array_t *array_extract(array_t *a, int index, int upto)
|
||||
{
|
||||
array_t *ret;
|
||||
|
@ -185,6 +185,7 @@ void array_ensure(array_t *a, int index);
|
||||
array_t *array_extract(array_t *a, int index, int upto);
|
||||
void array_deinit(array_t *a);
|
||||
void array_free(array_t *a);
|
||||
void *array_drop(array_t *a, int index);
|
||||
static inline int array_count(array_t *a)
|
||||
{
|
||||
assert(a);
|
||||
|
Loading…
x
Reference in New Issue
Block a user