1
0
mirror of https://github.com/irssi/irssi.git synced 2024-12-04 14:46:39 -05:00

show invites of other users when provided

This commit is contained in:
ailin-nemui 2019-08-13 01:05:57 +02:00
parent c87919235a
commit e62e55c0ab
8 changed files with 47 additions and 6 deletions

View File

@ -98,6 +98,14 @@ static void sig_message_invite(SERVER_REC *server, const char *channel,
signal_stop(); signal_stop();
} }
static void sig_message_invite_other(SERVER_REC *server, const char *channel,
const char *invited, const char *nick, const char *address)
{
if (ignore_check(server, nick, address,
channel, invited, MSGLEVEL_INVITES))
signal_stop();
}
static void sig_message_topic(SERVER_REC *server, const char *channel, static void sig_message_topic(SERVER_REC *server, const char *channel,
const char *topic, const char *topic,
const char *nick, const char *address) const char *nick, const char *address)
@ -118,6 +126,7 @@ void fe_ignore_messages_init(void)
signal_add_first("message nick", (SIGNAL_FUNC) sig_message_nick); signal_add_first("message nick", (SIGNAL_FUNC) sig_message_nick);
signal_add_first("message own_nick", (SIGNAL_FUNC) sig_message_own_nick); signal_add_first("message own_nick", (SIGNAL_FUNC) sig_message_own_nick);
signal_add_first("message invite", (SIGNAL_FUNC) sig_message_invite); signal_add_first("message invite", (SIGNAL_FUNC) sig_message_invite);
signal_add_first("message invite_other", (SIGNAL_FUNC) sig_message_invite_other);
signal_add_first("message topic", (SIGNAL_FUNC) sig_message_topic); signal_add_first("message topic", (SIGNAL_FUNC) sig_message_topic);
} }
@ -132,5 +141,6 @@ void fe_ignore_messages_deinit(void)
signal_remove("message nick", (SIGNAL_FUNC) sig_message_nick); signal_remove("message nick", (SIGNAL_FUNC) sig_message_nick);
signal_remove("message own_nick", (SIGNAL_FUNC) sig_message_own_nick); signal_remove("message own_nick", (SIGNAL_FUNC) sig_message_own_nick);
signal_remove("message invite", (SIGNAL_FUNC) sig_message_invite); signal_remove("message invite", (SIGNAL_FUNC) sig_message_invite);
signal_remove("message invite_other", (SIGNAL_FUNC) sig_message_invite_other);
signal_remove("message topic", (SIGNAL_FUNC) sig_message_topic); signal_remove("message topic", (SIGNAL_FUNC) sig_message_topic);
} }

View File

@ -538,6 +538,20 @@ static void sig_message_invite(SERVER_REC *server, const char *channel,
g_free(str); g_free(str);
} }
static void sig_message_invite_other(SERVER_REC *server, const char *channel,
const char *invited, const char *nick, const char *address)
{
char *str;
int level = MSGLEVEL_INVITES;
ignore_check_plus(server, nick, address, channel, invited, &level, FALSE);
str = show_lowascii(channel);
printformat(server, channel, level,
TXT_INVITE_OTHER, invited, nick, str, address);
g_free(str);
}
static void sig_message_topic(SERVER_REC *server, const char *channel, static void sig_message_topic(SERVER_REC *server, const char *channel,
const char *topic, const char *topic,
const char *nick, const char *address) const char *nick, const char *address)
@ -706,6 +720,7 @@ void fe_messages_init(void)
signal_add_last("message nick", (SIGNAL_FUNC) sig_message_nick); signal_add_last("message nick", (SIGNAL_FUNC) sig_message_nick);
signal_add_last("message own_nick", (SIGNAL_FUNC) sig_message_own_nick); signal_add_last("message own_nick", (SIGNAL_FUNC) sig_message_own_nick);
signal_add_last("message invite", (SIGNAL_FUNC) sig_message_invite); signal_add_last("message invite", (SIGNAL_FUNC) sig_message_invite);
signal_add_last("message invite_other", (SIGNAL_FUNC) sig_message_invite_other);
signal_add_last("message topic", (SIGNAL_FUNC) sig_message_topic); signal_add_last("message topic", (SIGNAL_FUNC) sig_message_topic);
signal_add("nicklist new", (SIGNAL_FUNC) sig_nicklist_new); signal_add("nicklist new", (SIGNAL_FUNC) sig_nicklist_new);
@ -730,6 +745,7 @@ void fe_messages_deinit(void)
signal_remove("message kick", (SIGNAL_FUNC) sig_message_kick); signal_remove("message kick", (SIGNAL_FUNC) sig_message_kick);
signal_remove("message nick", (SIGNAL_FUNC) sig_message_nick); signal_remove("message nick", (SIGNAL_FUNC) sig_message_nick);
signal_remove("message own_nick", (SIGNAL_FUNC) sig_message_own_nick); signal_remove("message own_nick", (SIGNAL_FUNC) sig_message_own_nick);
signal_remove("message invite_other", (SIGNAL_FUNC) sig_message_invite_other);
signal_remove("message invite", (SIGNAL_FUNC) sig_message_invite); signal_remove("message invite", (SIGNAL_FUNC) sig_message_invite);
signal_remove("message topic", (SIGNAL_FUNC) sig_message_topic); signal_remove("message topic", (SIGNAL_FUNC) sig_message_topic);

View File

@ -101,6 +101,7 @@ FORMAT_REC fecommon_core_formats[] = {
{ "quit_once", "{channel $3} {channick $0} {chanhost $1} has quit {reason $2}", 4, { 0, 0, 0, 0 } }, { "quit_once", "{channel $3} {channick $0} {chanhost $1} has quit {reason $2}", 4, { 0, 0, 0, 0 } },
{ "invite", "{nick $0} invites you to {channel $1}", 3, { 0, 0, 0 } }, { "invite", "{nick $0} invites you to {channel $1}", 3, { 0, 0, 0 } },
{ "not_invited", "You have not been invited to a channel!", 0 }, { "not_invited", "You have not been invited to a channel!", 0 },
{ "invite_other", "{nick $0} has been invited to {channel $2} by {channick_hilight $1}", 4, { 0, 0, 0, 0 } },
{ "new_topic", "{nick $0} changed the topic of {channel $1} to: $2", 4, { 0, 0, 0, 0 } }, { "new_topic", "{nick $0} changed the topic of {channel $1} to: $2", 4, { 0, 0, 0, 0 } },
{ "topic_unset", "Topic unset by {nick $0} on {channel $1}", 4, { 0, 0, 0, 0 } }, { "topic_unset", "Topic unset by {nick $0} on {channel $1}", 4, { 0, 0, 0, 0 } },
{ "your_nick_changed", "You're now known as {nick $1}", 4, { 0, 0, 0, 0 } }, { "your_nick_changed", "You're now known as {nick $1}", 4, { 0, 0, 0, 0 } },

View File

@ -77,6 +77,7 @@ enum {
TXT_QUIT_ONCE, TXT_QUIT_ONCE,
TXT_INVITE, TXT_INVITE,
TXT_NOT_INVITED, TXT_NOT_INVITED,
TXT_INVITE_OTHER,
TXT_NEW_TOPIC, TXT_NEW_TOPIC,
TXT_TOPIC_UNSET, TXT_TOPIC_UNSET,
TXT_YOUR_NICK_CHANGED, TXT_YOUR_NICK_CHANGED,

View File

@ -252,13 +252,18 @@ static void event_pong(IRC_SERVER_REC *server, const char *data, const char *nic
static void event_invite(IRC_SERVER_REC *server, const char *data, static void event_invite(IRC_SERVER_REC *server, const char *data,
const char *nick, const char *addr) const char *nick, const char *addr)
{ {
char *params, *channel; char *params, *invited, *channel;
g_return_if_fail(data != NULL); g_return_if_fail(data != NULL);
params = event_get_params(data, 2, NULL, &channel); params = event_get_params(data, 2, &invited, &channel);
signal_emit("message invite", 4, if (server->nick_comp_func(invited, server->nick) == 0) {
server, get_visible_target(server, channel), nick, addr); signal_emit("message invite", 4,
server, get_visible_target(server, channel), nick, addr);
} else {
signal_emit("message invite_other", 5,
server, get_visible_target(server, channel), invited, nick, addr);
}
g_free(params); g_free(params);
} }

View File

@ -336,11 +336,17 @@ static void event_kick(IRC_SERVER_REC *server, const char *data)
static void event_invite(IRC_SERVER_REC *server, const char *data) static void event_invite(IRC_SERVER_REC *server, const char *data)
{ {
char *params, *channel, *shortchan; char *params, *nick, *channel, *shortchan;
g_return_if_fail(data != NULL); g_return_if_fail(data != NULL);
params = event_get_params(data, 2, NULL, &channel); params = event_get_params(data, 2, &nick, &channel);
if (server->nick_comp_func(nick, server->nick) != 0) {
/* someone else was invited, no need to do anything */
g_free(params);
return;
}
if (irc_channel_find(server, channel) == NULL) { if (irc_channel_find(server, channel) == NULL) {
/* check if we're supposed to autojoin this channel */ /* check if we're supposed to autojoin this channel */

View File

@ -236,6 +236,7 @@ static void server_init(IRC_SERVER_REC *server)
irc_cap_toggle(server, CAP_MULTI_PREFIX, TRUE); irc_cap_toggle(server, CAP_MULTI_PREFIX, TRUE);
irc_cap_toggle(server, CAP_EXTENDED_JOIN, TRUE); irc_cap_toggle(server, CAP_EXTENDED_JOIN, TRUE);
irc_cap_toggle(server, CAP_SETNAME, TRUE); irc_cap_toggle(server, CAP_SETNAME, TRUE);
irc_cap_toggle(server, CAP_INVITE_NOTIFY, TRUE);
irc_send_cmd_now(server, "CAP LS " CAP_LS_VERSION); irc_send_cmd_now(server, "CAP LS " CAP_LS_VERSION);

View File

@ -19,6 +19,7 @@
#define CAP_MULTI_PREFIX "multi-prefix" #define CAP_MULTI_PREFIX "multi-prefix"
#define CAP_EXTENDED_JOIN "extended-join" #define CAP_EXTENDED_JOIN "extended-join"
#define CAP_SETNAME "draft/setname" #define CAP_SETNAME "draft/setname"
#define CAP_INVITE_NOTIFY "invite-notify"
/* returns IRC_SERVER_REC if it's IRC server, NULL if it isn't */ /* returns IRC_SERVER_REC if it's IRC server, NULL if it isn't */
#define IRC_SERVER(server) \ #define IRC_SERVER(server) \