mirror of
https://github.com/irssi/irssi.git
synced 2024-12-04 14:46:39 -05:00
Merge pull request #1093 from ailin-nemui/cap-setname
request the setname capability
This commit is contained in:
commit
c87919235a
@ -1045,6 +1045,7 @@ void irc_commands_init(void)
|
||||
command_bind_irc("wallops", NULL, (SIGNAL_FUNC) command_1self);
|
||||
command_bind_irc("kickban", NULL, (SIGNAL_FUNC) cmd_kickban);
|
||||
command_bind_irc("knockout", NULL, (SIGNAL_FUNC) cmd_knockout);
|
||||
command_bind_irc("setname", NULL, (SIGNAL_FUNC) command_1self);
|
||||
command_bind_irc("server purge", NULL, (SIGNAL_FUNC) cmd_server_purge);
|
||||
|
||||
signal_add("channel destroyed", (SIGNAL_FUNC) sig_channel_destroyed);
|
||||
@ -1111,6 +1112,7 @@ void irc_commands_deinit(void)
|
||||
command_unbind("wait", (SIGNAL_FUNC) cmd_wait);
|
||||
command_unbind("wallops", (SIGNAL_FUNC) command_1self);
|
||||
command_unbind("kickban", (SIGNAL_FUNC) cmd_kickban);
|
||||
command_unbind("setname", (SIGNAL_FUNC) command_1self);
|
||||
command_unbind("knockout", (SIGNAL_FUNC) cmd_knockout);
|
||||
command_unbind("server purge", (SIGNAL_FUNC) cmd_server_purge);
|
||||
|
||||
|
@ -446,6 +446,27 @@ static void event_userhost(SERVER_REC *server, const char *data)
|
||||
g_free(params);
|
||||
}
|
||||
|
||||
static void event_setname(SERVER_REC *server, const char *data, const char *nick, const char *address)
|
||||
{
|
||||
GSList *nicks, *tmp;
|
||||
NICK_REC *rec;
|
||||
|
||||
if (!IS_IRC_SERVER(server))
|
||||
return;
|
||||
|
||||
g_return_if_fail(data != NULL);
|
||||
if (*data == ':') data++;
|
||||
|
||||
nicks = nicklist_get_same(server, nick);
|
||||
for (tmp = nicks; tmp != NULL; tmp = tmp->next->next) {
|
||||
rec = tmp->next->data;
|
||||
|
||||
g_free(rec->realname);
|
||||
rec->realname = g_strdup(data);
|
||||
}
|
||||
g_slist_free(nicks);
|
||||
}
|
||||
|
||||
static void sig_usermode(SERVER_REC *server)
|
||||
{
|
||||
g_return_if_fail(IS_SERVER(server));
|
||||
@ -487,6 +508,7 @@ void irc_nicklist_init(void)
|
||||
signal_add_first("event 437", (SIGNAL_FUNC) event_target_unavailable);
|
||||
signal_add_first("event 302", (SIGNAL_FUNC) event_userhost);
|
||||
signal_add("userhost event", (SIGNAL_FUNC) event_userhost);
|
||||
signal_add("event setname", (SIGNAL_FUNC) event_setname);
|
||||
signal_add("user mode changed", (SIGNAL_FUNC) sig_usermode);
|
||||
signal_add("server connected", (SIGNAL_FUNC) sig_connected);
|
||||
}
|
||||
@ -509,6 +531,7 @@ void irc_nicklist_deinit(void)
|
||||
signal_remove("event 437", (SIGNAL_FUNC) event_target_unavailable);
|
||||
signal_remove("event 302", (SIGNAL_FUNC) event_userhost);
|
||||
signal_remove("userhost event", (SIGNAL_FUNC) event_userhost);
|
||||
signal_remove("event setname", (SIGNAL_FUNC) event_setname);
|
||||
signal_remove("user mode changed", (SIGNAL_FUNC) sig_usermode);
|
||||
signal_remove("server connected", (SIGNAL_FUNC) sig_connected);
|
||||
}
|
||||
|
@ -229,11 +229,13 @@ static void server_init(IRC_SERVER_REC *server)
|
||||
g_free(cmd);
|
||||
}
|
||||
|
||||
if (conn->sasl_mechanism != SASL_MECHANISM_NONE)
|
||||
if (conn->sasl_mechanism != SASL_MECHANISM_NONE) {
|
||||
irc_cap_toggle(server, CAP_SASL, TRUE);
|
||||
}
|
||||
|
||||
irc_cap_toggle(server, CAP_MULTI_PREFIX, TRUE);
|
||||
irc_cap_toggle(server, CAP_EXTENDED_JOIN, TRUE);
|
||||
irc_cap_toggle(server, CAP_SETNAME, TRUE);
|
||||
|
||||
irc_send_cmd_now(server, "CAP LS " CAP_LS_VERSION);
|
||||
|
||||
|
@ -18,6 +18,7 @@
|
||||
#define CAP_SASL "sasl"
|
||||
#define CAP_MULTI_PREFIX "multi-prefix"
|
||||
#define CAP_EXTENDED_JOIN "extended-join"
|
||||
#define CAP_SETNAME "draft/setname"
|
||||
|
||||
/* returns IRC_SERVER_REC if it's IRC server, NULL if it isn't */
|
||||
#define IRC_SERVER(server) \
|
||||
|
Loading…
Reference in New Issue
Block a user