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

Actions are now sent in "ctcp action" signal which is never ignored. "ctcp

msg action" doesn't work anymore nor does it show in "ctcp msg"s.


git-svn-id: http://svn.irssi.org/repos/irssi/trunk@2303 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
Timo Sirainen 2002-01-10 18:02:22 +00:00 committed by cras
parent 7131ceb909
commit 9fffa58c20
4 changed files with 37 additions and 24 deletions

View File

@ -117,6 +117,7 @@ ctcp.c:
"ctcp reply", SERVER_REC, char *args, char *nick, char *addr, char *target "ctcp reply", SERVER_REC, char *args, char *nick, char *addr, char *target
"ctcp reply "<cmd>, SERVER_REC, char *args, char *nick, char *addr, char *target "ctcp reply "<cmd>, SERVER_REC, char *args, char *nick, char *addr, char *target
"default ctcp reply", SERVER_REC, char *args, char *nick, char *addr, char *target "default ctcp reply", SERVER_REC, char *args, char *nick, char *addr, char *target
"ctcp action", SERVER_REC, char *args, char *nick, char *addr, char *target
irc-log.c: irc-log.c:
"awaylog show", LOG_REC, int away_msgs, int filepos "awaylog show", LOG_REC, int away_msgs, int filepos

View File

@ -66,18 +66,14 @@ static void event_privmsg(IRC_SERVER_REC *server, const char *data,
g_free(params); g_free(params);
} }
/* we use "ctcp msg" here because "ctcp msg action" can be ignored with static void ctcp_action(IRC_SERVER_REC *server, const char *data,
/IGNORE * CTCPS, and we don't want that.. */ const char *nick, const char *addr,
static void ctcp_msg_check_action(IRC_SERVER_REC *server, const char *data, const char *target)
const char *nick, const char *addr,
const char *target)
{ {
g_return_if_fail(data != NULL); g_return_if_fail(data != NULL);
if (g_strncasecmp(data, "ACTION ", 7) == 0) { signal_emit("message irc action", 5,
signal_emit("message irc action", 5, server, data, nick, addr, target);
server, data+7, nick, addr, target);
}
} }
static void event_notice(IRC_SERVER_REC *server, const char *data, static void event_notice(IRC_SERVER_REC *server, const char *data,
@ -414,15 +410,10 @@ static void event_received(IRC_SERVER_REC *server, const char *data,
g_free(params); g_free(params);
} }
static void sig_empty(void)
{
}
void fe_events_init(void) void fe_events_init(void)
{ {
signal_add("event privmsg", (SIGNAL_FUNC) event_privmsg); signal_add("event privmsg", (SIGNAL_FUNC) event_privmsg);
signal_add("ctcp msg", (SIGNAL_FUNC) ctcp_msg_check_action); signal_add("ctcp action", (SIGNAL_FUNC) ctcp_action);
signal_add("ctcp msg action", (SIGNAL_FUNC) sig_empty);
signal_add("event notice", (SIGNAL_FUNC) event_notice); signal_add("event notice", (SIGNAL_FUNC) event_notice);
signal_add("event join", (SIGNAL_FUNC) event_join); signal_add("event join", (SIGNAL_FUNC) event_join);
signal_add("event part", (SIGNAL_FUNC) event_part); signal_add("event part", (SIGNAL_FUNC) event_part);
@ -451,8 +442,7 @@ void fe_events_init(void)
void fe_events_deinit(void) void fe_events_deinit(void)
{ {
signal_remove("event privmsg", (SIGNAL_FUNC) event_privmsg); signal_remove("event privmsg", (SIGNAL_FUNC) event_privmsg);
signal_remove("ctcp msg", (SIGNAL_FUNC) ctcp_msg_check_action); signal_remove("ctcp action", (SIGNAL_FUNC) ctcp_action);
signal_remove("ctcp msg action", (SIGNAL_FUNC) sig_empty);
signal_remove("event notice", (SIGNAL_FUNC) event_notice); signal_remove("event notice", (SIGNAL_FUNC) event_notice);
signal_remove("event join", (SIGNAL_FUNC) event_join); signal_remove("event join", (SIGNAL_FUNC) event_join);
signal_remove("event part", (SIGNAL_FUNC) event_part); signal_remove("event part", (SIGNAL_FUNC) event_part);

View File

@ -224,6 +224,13 @@ static void ctcp_msg(IRC_SERVER_REC *server, const char *data,
{ {
char *args, *str; char *args, *str;
if (g_strncasecmp(data, "ACTION ", 7) == 0) {
/* special treatment for actions */
signal_emit("ctcp action", 5, server, data+7,
nick, addr, target);
return;
}
if (ignore_check(SERVER(server), nick, addr, target, data, MSGLEVEL_CTCPS)) if (ignore_check(SERVER(server), nick, addr, target, data, MSGLEVEL_CTCPS))
return; return;

View File

@ -40,15 +40,10 @@ QUERY_REC *irc_query_create(const char *server_tag,
return rec; return rec;
} }
static void event_privmsg(IRC_SERVER_REC *server, const char *data, static void check_address_change(IRC_SERVER_REC *server, const char *nick,
const char *nick, const char *address) const char *address, const char *target)
{ {
QUERY_REC *query; QUERY_REC *query;
char *params, *target, *msg;
g_return_if_fail(data != NULL);
params = event_get_params(data, 2 | PARAM_FLAG_GETREST, &target, &msg);
if (address != NULL && !ischannel(*target)) { if (address != NULL && !ischannel(*target)) {
/* save nick's address to query */ /* save nick's address to query */
@ -57,10 +52,28 @@ static void event_privmsg(IRC_SERVER_REC *server, const char *data,
strcmp(query->address, address) != 0)) strcmp(query->address, address) != 0))
query_change_address(query, address); query_change_address(query, address);
} }
}
static void event_privmsg(IRC_SERVER_REC *server, const char *data,
const char *nick, const char *address)
{
char *params, *target, *msg;
g_return_if_fail(data != NULL);
params = event_get_params(data, 2 | PARAM_FLAG_GETREST, &target, &msg);
check_address_change(server, nick, address, target);
g_free(params); g_free(params);
} }
static void ctcp_action(IRC_SERVER_REC *server, const char *msg,
const char *nick, const char *address,
const char *target)
{
check_address_change(server, nick, address, target);
}
static void event_nick(SERVER_REC *server, const char *data, static void event_nick(SERVER_REC *server, const char *data,
const char *orignick) const char *orignick)
{ {
@ -78,11 +91,13 @@ static void event_nick(SERVER_REC *server, const char *data,
void irc_queries_init(void) void irc_queries_init(void)
{ {
signal_add_last("event privmsg", (SIGNAL_FUNC) event_privmsg); signal_add_last("event privmsg", (SIGNAL_FUNC) event_privmsg);
signal_add_last("ctcp action", (SIGNAL_FUNC) ctcp_action);
signal_add("event nick", (SIGNAL_FUNC) event_nick); signal_add("event nick", (SIGNAL_FUNC) event_nick);
} }
void irc_queries_deinit(void) void irc_queries_deinit(void)
{ {
signal_remove("event privmsg", (SIGNAL_FUNC) event_privmsg); signal_remove("event privmsg", (SIGNAL_FUNC) event_privmsg);
signal_remove("ctcp action", (SIGNAL_FUNC) ctcp_action);
signal_remove("event nick", (SIGNAL_FUNC) event_nick); signal_remove("event nick", (SIGNAL_FUNC) event_nick);
} }