mirror of
https://github.com/irssi/irssi.git
synced 2024-12-04 14:46:39 -05:00
Add "server cap req" signal, emitted before requesting caps
This commit is contained in:
parent
b2b1ac6708
commit
af5ee997e7
@ -133,6 +133,7 @@ irc-cap.c
|
|||||||
"server cap ack "<cmd>, SERVER_REC
|
"server cap ack "<cmd>, SERVER_REC
|
||||||
"server cap nak "<cmd>, SERVER_REC
|
"server cap nak "<cmd>, SERVER_REC
|
||||||
"server cap end", SERVER_REC
|
"server cap end", SERVER_REC
|
||||||
|
"server cap req", SERVER_REC, char *caps
|
||||||
|
|
||||||
sasl.c
|
sasl.c
|
||||||
"server sasl failure", SERVER_REC, char *reason
|
"server sasl failure", SERVER_REC, char *reason
|
||||||
|
@ -48,11 +48,17 @@ int cap_toggle (IRC_SERVER_REC *server, char *cap, int enable)
|
|||||||
if (!g_hash_table_lookup_extended(server->cap_supported, cap, NULL, NULL))
|
if (!g_hash_table_lookup_extended(server->cap_supported, cap, NULL, NULL))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
signal_emit("server cap req", 2, server, cap);
|
||||||
irc_send_cmdv(server, "CAP REQ %s", cap);
|
irc_send_cmdv(server, "CAP REQ %s", cap);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
else if (!enable && gslist_find_string(server->cap_active, cap)) {
|
else if (!enable && gslist_find_string(server->cap_active, cap)) {
|
||||||
irc_send_cmdv(server, "CAP REQ -%s", cap);
|
char *negcap = g_strdup_printf("-%s", cap);
|
||||||
|
|
||||||
|
signal_emit("server cap req", 2, server, negcap);
|
||||||
|
irc_send_cmdv(server, "CAP REQ %s", negcap);
|
||||||
|
|
||||||
|
g_free(negcap);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -194,10 +200,12 @@ static void event_cap (IRC_SERVER_REC *server, char *args, char *nick, char *add
|
|||||||
server->cap_queue = NULL;
|
server->cap_queue = NULL;
|
||||||
|
|
||||||
/* If the server doesn't support any cap we requested close the negotiation here */
|
/* If the server doesn't support any cap we requested close the negotiation here */
|
||||||
if (avail_caps > 0)
|
if (avail_caps > 0) {
|
||||||
|
signal_emit("server cap req", 2, server, cmd->str + sizeof("CAP REQ :") - 1);
|
||||||
irc_send_cmd_now(server, cmd->str);
|
irc_send_cmd_now(server, cmd->str);
|
||||||
else
|
} else {
|
||||||
cap_finish_negotiation(server);
|
cap_finish_negotiation(server);
|
||||||
|
}
|
||||||
|
|
||||||
g_string_free(cmd, TRUE);
|
g_string_free(cmd, TRUE);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user