mirror of
https://github.com/irssi/irssi.git
synced 2024-12-04 14:46:39 -05:00
Removed whois_coming-flag which was used to figure out if 301 event
should be printed as whois-message or normal "nick is away" message. Server redirections are used for that now. Some servers also send 301 event in /WHOWAS reply, this works now as well. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@2104 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
parent
725a66df7f
commit
1efdf062c6
@ -261,7 +261,7 @@ static void event_channel_created(IRC_SERVER_REC *server, const char *data)
|
|||||||
g_free(params);
|
g_free(params);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void event_away(IRC_SERVER_REC *server, const char *data)
|
static void event_nowaway(IRC_SERVER_REC *server, const char *data)
|
||||||
{
|
{
|
||||||
printformat(server, NULL, MSGLEVEL_CRAP, IRCTXT_AWAY);
|
printformat(server, NULL, MSGLEVEL_CRAP, IRCTXT_AWAY);
|
||||||
}
|
}
|
||||||
@ -271,6 +271,29 @@ static void event_unaway(IRC_SERVER_REC *server, const char *data)
|
|||||||
printformat(server, NULL, MSGLEVEL_CRAP, IRCTXT_UNAWAY);
|
printformat(server, NULL, MSGLEVEL_CRAP, IRCTXT_UNAWAY);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void event_away(IRC_SERVER_REC *server, const char *data)
|
||||||
|
{
|
||||||
|
char *params, *nick, *awaymsg;
|
||||||
|
|
||||||
|
g_return_if_fail(data != NULL);
|
||||||
|
|
||||||
|
params = event_get_params(data, 3, NULL, &nick, &awaymsg);
|
||||||
|
if (!settings_get_bool("show_away_once") ||
|
||||||
|
last_away_nick == NULL || g_strcasecmp(last_away_nick, nick) != 0 ||
|
||||||
|
last_away_msg == NULL || g_strcasecmp(last_away_msg, awaymsg) != 0) {
|
||||||
|
/* don't show the same away message
|
||||||
|
from the same nick all the time */
|
||||||
|
g_free_not_null(last_away_nick);
|
||||||
|
g_free_not_null(last_away_msg);
|
||||||
|
last_away_nick = g_strdup(nick);
|
||||||
|
last_away_msg = g_strdup(awaymsg);
|
||||||
|
|
||||||
|
printformat(server, nick, MSGLEVEL_CRAP,
|
||||||
|
IRCTXT_NICK_AWAY, nick, awaymsg);
|
||||||
|
}
|
||||||
|
g_free(params);
|
||||||
|
}
|
||||||
|
|
||||||
static void event_userhost(IRC_SERVER_REC *server, const char *data)
|
static void event_userhost(IRC_SERVER_REC *server, const char *data)
|
||||||
{
|
{
|
||||||
char *params, *hosts;
|
char *params, *hosts;
|
||||||
@ -479,20 +502,8 @@ static void event_whois_away(IRC_SERVER_REC *server, const char *data)
|
|||||||
g_return_if_fail(data != NULL);
|
g_return_if_fail(data != NULL);
|
||||||
|
|
||||||
params = event_get_params(data, 3, NULL, &nick, &awaymsg);
|
params = event_get_params(data, 3, NULL, &nick, &awaymsg);
|
||||||
if (server->whois_coming || !settings_get_bool("show_away_once") ||
|
printformat(server, nick, MSGLEVEL_CRAP,
|
||||||
last_away_nick == NULL || g_strcasecmp(last_away_nick, nick) != 0 ||
|
IRCTXT_WHOIS_AWAY, nick, awaymsg);
|
||||||
last_away_msg == NULL || g_strcasecmp(last_away_msg, awaymsg) != 0) {
|
|
||||||
/* don't show the same away message
|
|
||||||
from the same nick all the time */
|
|
||||||
g_free_not_null(last_away_nick);
|
|
||||||
g_free_not_null(last_away_msg);
|
|
||||||
last_away_nick = g_strdup(nick);
|
|
||||||
last_away_msg = g_strdup(awaymsg);
|
|
||||||
|
|
||||||
printformat(server, nick, MSGLEVEL_CRAP,
|
|
||||||
server->whois_coming ? IRCTXT_WHOIS_AWAY :
|
|
||||||
IRCTXT_NICK_AWAY, nick, awaymsg);
|
|
||||||
}
|
|
||||||
g_free(params);
|
g_free(params);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -734,10 +745,12 @@ void fe_events_numeric_init(void)
|
|||||||
signal_add("event 333", (SIGNAL_FUNC) event_topic_info);
|
signal_add("event 333", (SIGNAL_FUNC) event_topic_info);
|
||||||
signal_add("event 324", (SIGNAL_FUNC) event_channel_mode);
|
signal_add("event 324", (SIGNAL_FUNC) event_channel_mode);
|
||||||
signal_add("event 329", (SIGNAL_FUNC) event_channel_created);
|
signal_add("event 329", (SIGNAL_FUNC) event_channel_created);
|
||||||
signal_add("event 306", (SIGNAL_FUNC) event_away);
|
signal_add("event 306", (SIGNAL_FUNC) event_nowaway);
|
||||||
signal_add("event 305", (SIGNAL_FUNC) event_unaway);
|
signal_add("event 305", (SIGNAL_FUNC) event_unaway);
|
||||||
|
signal_add("event 301", (SIGNAL_FUNC) event_away);
|
||||||
signal_add("event 311", (SIGNAL_FUNC) event_whois);
|
signal_add("event 311", (SIGNAL_FUNC) event_whois);
|
||||||
signal_add("event 301", (SIGNAL_FUNC) event_whois_away);
|
signal_add("whois away", (SIGNAL_FUNC) event_whois_away);
|
||||||
|
signal_add("whowas away", (SIGNAL_FUNC) event_whois_away);
|
||||||
signal_add("event 312", (SIGNAL_FUNC) event_whois_server);
|
signal_add("event 312", (SIGNAL_FUNC) event_whois_server);
|
||||||
signal_add("event 313", (SIGNAL_FUNC) event_whois_oper);
|
signal_add("event 313", (SIGNAL_FUNC) event_whois_oper);
|
||||||
signal_add("event 307", (SIGNAL_FUNC) event_whois_registered);
|
signal_add("event 307", (SIGNAL_FUNC) event_whois_registered);
|
||||||
@ -807,10 +820,12 @@ void fe_events_numeric_deinit(void)
|
|||||||
signal_remove("event 333", (SIGNAL_FUNC) event_topic_info);
|
signal_remove("event 333", (SIGNAL_FUNC) event_topic_info);
|
||||||
signal_remove("event 324", (SIGNAL_FUNC) event_channel_mode);
|
signal_remove("event 324", (SIGNAL_FUNC) event_channel_mode);
|
||||||
signal_remove("event 329", (SIGNAL_FUNC) event_channel_created);
|
signal_remove("event 329", (SIGNAL_FUNC) event_channel_created);
|
||||||
signal_remove("event 306", (SIGNAL_FUNC) event_away);
|
signal_remove("event 306", (SIGNAL_FUNC) event_nowaway);
|
||||||
signal_remove("event 305", (SIGNAL_FUNC) event_unaway);
|
signal_remove("event 305", (SIGNAL_FUNC) event_unaway);
|
||||||
|
signal_remove("event 301", (SIGNAL_FUNC) event_away);
|
||||||
signal_remove("event 311", (SIGNAL_FUNC) event_whois);
|
signal_remove("event 311", (SIGNAL_FUNC) event_whois);
|
||||||
signal_remove("event 301", (SIGNAL_FUNC) event_whois_away);
|
signal_remove("whois away", (SIGNAL_FUNC) event_whois_away);
|
||||||
|
signal_remove("whowas away", (SIGNAL_FUNC) event_whois_away);
|
||||||
signal_remove("event 312", (SIGNAL_FUNC) event_whois_server);
|
signal_remove("event 312", (SIGNAL_FUNC) event_whois_server);
|
||||||
signal_remove("event 313", (SIGNAL_FUNC) event_whois_oper);
|
signal_remove("event 313", (SIGNAL_FUNC) event_whois_oper);
|
||||||
signal_remove("event 307", (SIGNAL_FUNC) event_whois_registered);
|
signal_remove("event 307", (SIGNAL_FUNC) event_whois_registered);
|
||||||
|
@ -388,6 +388,7 @@ static void cmd_whois(const char *data, IRC_SERVER_REC *server,
|
|||||||
NULL,
|
NULL,
|
||||||
"event 318", "whois end",
|
"event 318", "whois end",
|
||||||
"event 402", event_402,
|
"event 402", event_402,
|
||||||
|
"event 301", "whois away", /* 301 can come as a reply to /MSG, /WHOIS or /WHOWAS */
|
||||||
"event 401", "whois not found",
|
"event 401", "whois not found",
|
||||||
"event 311", "whois event", NULL);
|
"event 311", "whois event", NULL);
|
||||||
g_free(str);
|
g_free(str);
|
||||||
@ -453,6 +454,7 @@ static void cmd_whowas(const char *data, IRC_SERVER_REC *server)
|
|||||||
|
|
||||||
nicks_redir = get_redirect_nicklist(nicks, &free_nick);
|
nicks_redir = get_redirect_nicklist(nicks, &free_nick);
|
||||||
server_redirect_event(server, "whowas", 1, nicks_redir, -1, NULL,
|
server_redirect_event(server, "whowas", 1, nicks_redir, -1, NULL,
|
||||||
|
"event 301", "whowas away", /* 301 can come as a reply to /MSG, /WHOIS or /WHOWAS */
|
||||||
"event 314", "whowas event", NULL);
|
"event 314", "whowas event", NULL);
|
||||||
if (free_nick) g_free(nicks_redir);
|
if (free_nick) g_free(nicks_redir);
|
||||||
|
|
||||||
|
@ -196,8 +196,6 @@ static void event_whois(IRC_SERVER_REC *server, const char *data)
|
|||||||
|
|
||||||
g_return_if_fail(data != NULL);
|
g_return_if_fail(data != NULL);
|
||||||
|
|
||||||
server->whois_coming = TRUE;
|
|
||||||
|
|
||||||
/* first remove the gone-flag, if user is gone
|
/* first remove the gone-flag, if user is gone
|
||||||
it will be set later.. */
|
it will be set later.. */
|
||||||
params = event_get_params(data, 6, NULL, &nick, NULL,
|
params = event_get_params(data, 6, NULL, &nick, NULL,
|
||||||
@ -242,11 +240,6 @@ static void event_whois_ircop(SERVER_REC *server, const char *data)
|
|||||||
g_free(params);
|
g_free(params);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void event_end_of_whois(IRC_SERVER_REC *server, const char *data)
|
|
||||||
{
|
|
||||||
server->whois_coming = FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void event_nick_in_use(IRC_SERVER_REC *server, const char *data)
|
static void event_nick_in_use(IRC_SERVER_REC *server, const char *data)
|
||||||
{
|
{
|
||||||
char *str;
|
char *str;
|
||||||
@ -373,7 +366,6 @@ void irc_nicklist_init(void)
|
|||||||
signal_add_first("event 311", (SIGNAL_FUNC) event_whois);
|
signal_add_first("event 311", (SIGNAL_FUNC) event_whois);
|
||||||
signal_add_first("event 301", (SIGNAL_FUNC) event_whois_away);
|
signal_add_first("event 301", (SIGNAL_FUNC) event_whois_away);
|
||||||
signal_add_first("event 313", (SIGNAL_FUNC) event_whois_ircop);
|
signal_add_first("event 313", (SIGNAL_FUNC) event_whois_ircop);
|
||||||
signal_add("event 318", (SIGNAL_FUNC) event_end_of_whois);
|
|
||||||
signal_add("event 353", (SIGNAL_FUNC) event_names_list);
|
signal_add("event 353", (SIGNAL_FUNC) event_names_list);
|
||||||
signal_add("event 366", (SIGNAL_FUNC) event_end_of_names);
|
signal_add("event 366", (SIGNAL_FUNC) event_end_of_names);
|
||||||
signal_add("event 433", (SIGNAL_FUNC) event_nick_in_use);
|
signal_add("event 433", (SIGNAL_FUNC) event_nick_in_use);
|
||||||
@ -393,7 +385,6 @@ void irc_nicklist_deinit(void)
|
|||||||
signal_remove("event 311", (SIGNAL_FUNC) event_whois);
|
signal_remove("event 311", (SIGNAL_FUNC) event_whois);
|
||||||
signal_remove("event 301", (SIGNAL_FUNC) event_whois_away);
|
signal_remove("event 301", (SIGNAL_FUNC) event_whois_away);
|
||||||
signal_remove("event 313", (SIGNAL_FUNC) event_whois_ircop);
|
signal_remove("event 313", (SIGNAL_FUNC) event_whois_ircop);
|
||||||
signal_remove("event 318", (SIGNAL_FUNC) event_end_of_whois);
|
|
||||||
signal_remove("event 353", (SIGNAL_FUNC) event_names_list);
|
signal_remove("event 353", (SIGNAL_FUNC) event_names_list);
|
||||||
signal_remove("event 366", (SIGNAL_FUNC) event_end_of_names);
|
signal_remove("event 366", (SIGNAL_FUNC) event_end_of_names);
|
||||||
signal_remove("event 433", (SIGNAL_FUNC) event_nick_in_use);
|
signal_remove("event 433", (SIGNAL_FUNC) event_nick_in_use);
|
||||||
|
@ -48,7 +48,6 @@ struct _IRC_SERVER_REC {
|
|||||||
char *userhost; /* /USERHOST <nick> - set when joined to first channel */
|
char *userhost; /* /USERHOST <nick> - set when joined to first channel */
|
||||||
int channels_formed; /* channels formed in irc network */
|
int channels_formed; /* channels formed in irc network */
|
||||||
|
|
||||||
unsigned int whois_coming:1; /* Mostly just to display away message right.. */
|
|
||||||
unsigned int whois_found:1; /* Did WHOIS return any entries? */
|
unsigned int whois_found:1; /* Did WHOIS return any entries? */
|
||||||
unsigned int whowas_found:1; /* Did WHOWAS return any entries? */
|
unsigned int whowas_found:1; /* Did WHOWAS return any entries? */
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user