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

fix formatting

This commit is contained in:
Lukas Mai 2016-02-17 22:34:44 +01:00
parent 4650665ee4
commit 88e2449f83

View File

@ -48,7 +48,7 @@ static void remove_client(CLIENT_REC *rec)
signal_emit("proxy client disconnected", 1, rec); signal_emit("proxy client disconnected", 1, rec);
printtext(rec->server, NULL, MSGLEVEL_CLIENTNOTICE, printtext(rec->server, NULL, MSGLEVEL_CLIENTNOTICE,
"Proxy: Client %s:%d disconnected", rec->host, rec->port); "Proxy: Client %s:%d disconnected", rec->host, rec->port);
g_free(rec->proxy_address); g_free(rec->proxy_address);
net_sendbuffer_destroy(rec->handle, TRUE); net_sendbuffer_destroy(rec->handle, TRUE);
@ -59,7 +59,7 @@ static void remove_client(CLIENT_REC *rec)
} }
static void proxy_redirect_event(CLIENT_REC *client, const char *command, static void proxy_redirect_event(CLIENT_REC *client, const char *command,
int count, const char *arg, int remote) int count, const char *arg, int remote)
{ {
char *str; char *str;
@ -67,7 +67,7 @@ static void proxy_redirect_event(CLIENT_REC *client, const char *command,
str = g_strdup_printf("proxy %p", client); str = g_strdup_printf("proxy %p", client);
server_redirect_event(client->server, command, count, server_redirect_event(client->server, command, count,
arg, remote, NULL, "", str, NULL); arg, remote, NULL, "", str, NULL);
g_free(str); g_free(str);
} }
@ -94,15 +94,15 @@ static void grab_who(CLIENT_REC *client, const char *channel)
} }
proxy_redirect_event(client, "who", proxy_redirect_event(client, "who",
client->server->one_endofwho ? 1 : count, client->server->one_endofwho ? 1 : count,
arg->str, -1); arg->str, -1);
g_strfreev(list); g_strfreev(list);
g_string_free(arg, TRUE); g_string_free(arg, TRUE);
} }
static void handle_client_connect_cmd(CLIENT_REC *client, static void handle_client_connect_cmd(CLIENT_REC *client,
const char *cmd, const char *args) const char *cmd, const char *args)
{ {
const char *password; const char *password;
@ -114,7 +114,7 @@ static void handle_client_connect_cmd(CLIENT_REC *client,
else { else {
/* wrong password! */ /* wrong password! */
remove_client(client); remove_client(client);
return; return;
} }
} else if (g_strcmp0(cmd, "NICK") == 0) { } else if (g_strcmp0(cmd, "NICK") == 0) {
g_free_not_null(client->nick); g_free_not_null(client->nick);
@ -130,8 +130,8 @@ static void handle_client_connect_cmd(CLIENT_REC *client,
} else { } else {
signal_emit("proxy client connected", 1, client); signal_emit("proxy client connected", 1, client);
printtext(client->server, NULL, MSGLEVEL_CLIENTNOTICE, printtext(client->server, NULL, MSGLEVEL_CLIENTNOTICE,
"Proxy: Client %s:%d connected", "Proxy: Client %s:%d connected",
client->host, client->port); client->host, client->port);
client->connected = TRUE; client->connected = TRUE;
proxy_dump_data(client); proxy_dump_data(client);
} }
@ -139,7 +139,7 @@ static void handle_client_connect_cmd(CLIENT_REC *client,
} }
static void handle_client_cmd(CLIENT_REC *client, char *cmd, char *args, static void handle_client_cmd(CLIENT_REC *client, char *cmd, char *args,
const char *data) const char *data)
{ {
GSList *tmp; GSList *tmp;
if (!client->connected) { if (!client->connected) {
@ -162,8 +162,8 @@ static void handle_client_cmd(CLIENT_REC *client, char *cmd, char *args,
g_ascii_strcasecmp(target, client->proxy_address) == 0 || g_ascii_strcasecmp(target, client->proxy_address) == 0 ||
g_ascii_strcasecmp(target, client->nick) == 0) { g_ascii_strcasecmp(target, client->nick) == 0) {
proxy_outdata(client, ":%s PONG %s :%s\r\n", proxy_outdata(client, ":%s PONG %s :%s\r\n",
client->proxy_address, client->proxy_address,
client->proxy_address, origin); client->proxy_address, origin);
g_free(params); g_free(params);
return; return;
} }
@ -174,25 +174,25 @@ static void handle_client_cmd(CLIENT_REC *client, char *cmd, char *args,
if (g_ascii_strcasecmp(args, "CTCP ON") == 0) { if (g_ascii_strcasecmp(args, "CTCP ON") == 0) {
/* client wants all ctcps */ /* client wants all ctcps */
client->want_ctcp = 1; client->want_ctcp = 1;
for (tmp = proxy_clients; tmp != NULL; tmp = tmp->next) { for (tmp = proxy_clients; tmp != NULL; tmp = tmp->next) {
CLIENT_REC *rec = tmp->data; CLIENT_REC *rec = tmp->data;
if ((g_ascii_strcasecmp(client->listen->ircnet,rec->listen->ircnet) == 0) && if (g_ascii_strcasecmp(client->listen->ircnet, rec->listen->ircnet) == 0 &&
/* kludgy way to check if the clients aren't the same */ /* kludgy way to check if the clients aren't the same */
(client->recv_tag != rec->recv_tag)) { client->recv_tag != rec->recv_tag) {
if (rec->want_ctcp == 1) if (rec->want_ctcp == 1)
proxy_outdata(rec, ":%s NOTICE %s :Another client is now receiving CTCPs sent to %s\r\n", proxy_outdata(rec, ":%s NOTICE %s :Another client is now receiving CTCPs sent to %s\r\n",
rec->proxy_address, rec->nick, rec->listen->ircnet); rec->proxy_address, rec->nick, rec->listen->ircnet);
rec->want_ctcp = 0; rec->want_ctcp = 0;
} }
} }
proxy_outdata(client, ":%s NOTICE %s :You're now receiving CTCPs sent to %s\r\n", proxy_outdata(client, ":%s NOTICE %s :You're now receiving CTCPs sent to %s\r\n",
client->proxy_address, client->nick,client->listen->ircnet); client->proxy_address, client->nick, client->listen->ircnet);
} else if (g_ascii_strcasecmp(args, "CTCP OFF") == 0) { } else if (g_ascii_strcasecmp(args, "CTCP OFF") == 0) {
/* client wants proxy to handle all ctcps */ /* client wants proxy to handle all ctcps */
client->want_ctcp = 0; client->want_ctcp = 0;
proxy_outdata(client, ":%s NOTICE %s :Proxy is now handling itself CTCPs sent to %s\r\n", proxy_outdata(client, ":%s NOTICE %s :Proxy is now handling itself CTCPs sent to %s\r\n",
client->proxy_address, client->nick, client->listen->ircnet); client->proxy_address, client->nick, client->listen->ircnet);
} else { } else {
signal_emit("proxy client command", 3, client, args, data); signal_emit("proxy client command", 3, client, args, data);
} }
@ -201,11 +201,11 @@ static void handle_client_cmd(CLIENT_REC *client, char *cmd, char *args,
if (client->server == NULL || !client->server->connected) { if (client->server == NULL || !client->server->connected) {
proxy_outdata(client, ":%s NOTICE %s :Not connected to server\r\n", proxy_outdata(client, ":%s NOTICE %s :Not connected to server\r\n",
client->proxy_address, client->nick); client->proxy_address, client->nick);
return; return;
} }
/* check if the command could be redirected */ /* check if the command could be redirected */
if (g_strcmp0(cmd, "WHO") == 0) if (g_strcmp0(cmd, "WHO") == 0)
grab_who(client, args); grab_who(client, args);
else if (g_strcmp0(cmd, "WHOWAS") == 0) else if (g_strcmp0(cmd, "WHOWAS") == 0)
@ -263,29 +263,29 @@ static void handle_client_cmd(CLIENT_REC *client, char *cmd, char *args,
char *params, *target, *msg; char *params, *target, *msg;
params = event_get_params(args, 2 | PARAM_FLAG_GETREST, params = event_get_params(args, 2 | PARAM_FLAG_GETREST,
&target, &msg); &target, &msg);
proxy_outserver_all_except(client, "PRIVMSG %s", args); proxy_outserver_all_except(client, "PRIVMSG %s", args);
ignore_next = TRUE; ignore_next = TRUE;
if (*msg != '\001' || msg[strlen(msg)-1] != '\001') { if (*msg != '\001' || msg[strlen(msg)-1] != '\001') {
signal_emit(server_ischannel(SERVER(client->server), target) ? signal_emit(server_ischannel(SERVER(client->server), target) ?
"message own_public" : "message own_private", 4, "message own_public" : "message own_private", 4,
client->server, msg, target, target); client->server, msg, target, target);
} else if (strncmp(msg+1, "ACTION ", 7) == 0) { } else if (strncmp(msg+1, "ACTION ", 7) == 0) {
/* action */ /* action */
msg[strlen(msg)-1] = '\0'; msg[strlen(msg)-1] = '\0';
signal_emit("message irc own_action", 3, signal_emit("message irc own_action", 3,
client->server, msg+8, target); client->server, msg+8, target);
} else { } else {
/* CTCP */ /* CTCP */
char *p; char *p;
msg[strlen(msg)-1] = '\0'; msg[strlen(msg)-1] = '\0';
p = strchr(msg, ' '); p = strchr(msg, ' ');
if (p != NULL) *p++ = '\0'; else p = ""; if (p != NULL) *p++ = '\0'; else p = "";
signal_emit("message irc own_ctcp", 4, signal_emit("message irc own_ctcp", 4,
client->server, msg+1, p, target); client->server, msg+1, p, target);
} }
ignore_next = FALSE; ignore_next = FALSE;
g_free(params); g_free(params);