mirror of
https://github.com/irssi/irssi.git
synced 2026-08-11 04:43:34 +02: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
3 changed files with 42 additions and 13 deletions
|
|
@ -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…
Add table
Add a link
Reference in a new issue