mirror of
https://github.com/irssi/irssi.git
synced 2024-12-04 14:46:39 -05:00
Merge pull request #43 from ailin-nemui/server-outgoing
remove newline from "server outgoing modify"
(cherry picked from commit ea961623f5
)
This commit is contained in:
parent
44298db814
commit
3bb8c619e2
@ -151,7 +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
|
||||
"server outgoing modify", SERVER_REC, GString *data, int crlf
|
||||
|
||||
(for perl parser..)
|
||||
"redir "<cmd>, SERVER_REC, char *args, char *sender_nick, char *sender_address
|
||||
|
@ -718,6 +718,7 @@ static int server_cmd_timeout(IRC_SERVER_REC *server, gint64 now)
|
||||
GString *str;
|
||||
long usecs;
|
||||
char *cmd;
|
||||
int crlf;
|
||||
|
||||
if (!IS_IRC_SERVER(server))
|
||||
return 0;
|
||||
@ -741,15 +742,29 @@ static int server_cmd_timeout(IRC_SERVER_REC *server, gint64 now)
|
||||
|
||||
/* send command */
|
||||
str = g_string_new(cmd);
|
||||
signal_emit("server outgoing modify", 2, server, str);
|
||||
|
||||
if (str->len > 2 && str->str[str->len - 2] == '\r')
|
||||
crlf = 2;
|
||||
else if (str->len > 1 && str->str[str->len - 1] == '\n')
|
||||
crlf = 1;
|
||||
else
|
||||
crlf = 0;
|
||||
|
||||
if (crlf)
|
||||
g_string_truncate(str, str->len - crlf);
|
||||
|
||||
signal_emit("server outgoing modify", 3, server, str, crlf);
|
||||
if (str->len) {
|
||||
if (crlf == 2)
|
||||
g_string_append(str, "\r\n");
|
||||
else if (crlf == 1)
|
||||
g_string_append(str, "\n");
|
||||
|
||||
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';
|
||||
if (crlf)
|
||||
g_string_truncate(str, str->len - crlf);
|
||||
rawlog_output(server->rawlog, str->str);
|
||||
server_redirect_command(server, str->str, redirect);
|
||||
}
|
||||
|
@ -115,20 +115,34 @@ void irc_send_cmd_full(IRC_SERVER_REC *server, const char *cmd, int irc_send_whe
|
||||
|
||||
if (!raw) {
|
||||
/* Add CR+LF to command */
|
||||
g_string_append_c(str, 13);
|
||||
g_string_append_c(str, 10);
|
||||
g_string_append(str, "\r\n");
|
||||
}
|
||||
|
||||
if (irc_send_when == IRC_SEND_NOW) {
|
||||
signal_emit("server outgoing modify", 2, server, str);
|
||||
int crlf;
|
||||
|
||||
if (str->len > 2 && str->str[str->len - 2] == '\r')
|
||||
crlf = 2;
|
||||
else if (str->len > 1 && str->str[str->len - 1] == '\n')
|
||||
crlf = 1;
|
||||
else
|
||||
crlf = 0;
|
||||
|
||||
if (crlf)
|
||||
g_string_truncate(str, str->len - crlf);
|
||||
|
||||
signal_emit("server outgoing modify", 3, server, str, crlf);
|
||||
if (str->len) {
|
||||
if (crlf == 2)
|
||||
g_string_append(str, "\r\n");
|
||||
else if (crlf == 1)
|
||||
g_string_append(str, "\n");
|
||||
|
||||
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';
|
||||
if (crlf)
|
||||
g_string_truncate(str, str->len - crlf);
|
||||
rawlog_output(server->rawlog, str->str);
|
||||
server_redirect_command(server, str->str, server->redirect_next);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user