mirror of
https://github.com/irssi/irssi.git
synced 2024-12-04 14:46:39 -05:00
add a "server outgoing modify" signal to intercept outgoing messages
This commit is contained in:
parent
3e08ac538d
commit
9e12890110
@ -151,6 +151,7 @@ irc.c:
|
||||
"whois default event", SERVER_REC, char *args, char *sender_nick, char *sender_address
|
||||
|
||||
"server incoming", SERVER_REC, char *data
|
||||
"server outgoing modify", SERVER_REC, GString *data
|
||||
|
||||
(for perl parser..)
|
||||
"redir "<cmd>, SERVER_REC, char *args, char *sender_nick, char *sender_address
|
||||
|
@ -734,9 +734,9 @@ static int server_cmd_timeout(IRC_SERVER_REC *server, gint64 now)
|
||||
{
|
||||
REDIRECT_REC *redirect;
|
||||
GSList *link;
|
||||
GString *str;
|
||||
long usecs;
|
||||
char *cmd;
|
||||
int len;
|
||||
|
||||
if (!IS_IRC_SERVER(server))
|
||||
return 0;
|
||||
@ -759,16 +759,20 @@ static int server_cmd_timeout(IRC_SERVER_REC *server, gint64 now)
|
||||
redirect = server->cmdqueue->next->data;
|
||||
|
||||
/* send command */
|
||||
len = strlen(cmd);
|
||||
irc_server_send_data(server, cmd, len);
|
||||
str = g_string_new(cmd);
|
||||
signal_emit("server outgoing modify", 2, server, str);
|
||||
if (str->len) {
|
||||
irc_server_send_data(server, str->str, str->len);
|
||||
|
||||
/* add to rawlog without [CR+]LF */
|
||||
if (len > 2 && cmd[len-2] == '\r')
|
||||
cmd[len-2] = '\0';
|
||||
else if (cmd[len-1] == '\n')
|
||||
cmd[len-1] = '\0';
|
||||
rawlog_output(server->rawlog, cmd);
|
||||
server_redirect_command(server, cmd, redirect);
|
||||
/* add to rawlog without [CR+]LF */
|
||||
if (str->len > 2 && str->str[str->len - 2] == '\r')
|
||||
str->str[str->len - 2] = '\0';
|
||||
else if (str->str[str->len - 1] == '\n')
|
||||
str->str[str->len - 1] = '\0';
|
||||
rawlog_output(server->rawlog, str->str);
|
||||
server_redirect_command(server, str->str, redirect);
|
||||
}
|
||||
g_string_free(str, TRUE);
|
||||
|
||||
/* remove from queue */
|
||||
server->cmdqueue = g_slist_remove(server->cmdqueue, cmd);
|
||||
|
@ -113,20 +113,25 @@ void irc_send_cmd_full(IRC_SERVER_REC *server, const char *cmd, int irc_send_whe
|
||||
g_string_append(str, cmd);
|
||||
}
|
||||
|
||||
if (irc_send_when == IRC_SEND_NOW) {
|
||||
rawlog_output(server->rawlog, str->str);
|
||||
server_redirect_command(server, str->str, server->redirect_next);
|
||||
server->redirect_next = NULL;
|
||||
}
|
||||
|
||||
if (!raw) {
|
||||
/* Add CR+LF to command */
|
||||
/* Add CR+LF to command */
|
||||
g_string_append_c(str, 13);
|
||||
g_string_append_c(str, 10);
|
||||
}
|
||||
|
||||
if (irc_send_when == IRC_SEND_NOW) {
|
||||
irc_server_send_data(server, str->str, str->len);
|
||||
signal_emit("server outgoing modify", 2, server, str);
|
||||
if (str->len) {
|
||||
irc_server_send_data(server, str->str, str->len);
|
||||
|
||||
/* add to rawlog without [CR+]LF */
|
||||
if (str->len > 2 && str->str[str->len - 2] == '\r')
|
||||
str->str[str->len - 2] = '\0';
|
||||
else if (str->str[str->len - 1] == '\n')
|
||||
str->str[str->len - 1] = '\0';
|
||||
rawlog_output(server->rawlog, str->str);
|
||||
server_redirect_command(server, str->str, server->redirect_next);
|
||||
}
|
||||
g_string_free(str, TRUE);
|
||||
} else if (irc_send_when == IRC_SEND_NEXT) {
|
||||
/* add to queue */
|
||||
|
Loading…
Reference in New Issue
Block a user