mirror of
https://github.com/irssi/irssi.git
synced 2026-08-19 00:22:17 +02:00
bot & proxy plugins fixed for GIOChannel changes
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@965 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
parent
d1eaeca255
commit
4316840890
6 changed files with 28 additions and 30 deletions
|
|
@ -112,7 +112,7 @@ static void botuser_config_save(USER_REC *user)
|
|||
g_free_not_null(str);
|
||||
|
||||
config_node_set_str(userconfig, node, "password", user->password);
|
||||
iconfig_node_set_int(node, "last_modify", (int) user->last_modify);
|
||||
config_node_set_int(userconfig, node, "last_modify", (int) user->last_modify);
|
||||
|
||||
/* Save masks */
|
||||
if (user->masks == NULL)
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ static void sig_bot_read(BOT_REC *bot)
|
|||
|
||||
botnet = bot->botnet;
|
||||
for (;;) {
|
||||
recvlen = bot->handle == -1 ? -1 :
|
||||
recvlen = bot->handle == NULL ? -1 :
|
||||
net_receive(bot->handle, tmpbuf, sizeof(tmpbuf));
|
||||
ret = line_split(tmpbuf, recvlen, &str, (LINEBUF_REC **) &bot->buffer);
|
||||
|
||||
|
|
@ -80,7 +80,7 @@ static void sig_bot_read(BOT_REC *bot)
|
|||
}
|
||||
}
|
||||
|
||||
static void connect_downlink(BOTNET_REC *botnet, int handle,
|
||||
static void connect_downlink(BOTNET_REC *botnet, GIOChannel *handle,
|
||||
IPADDR *ip, const char *host)
|
||||
{
|
||||
BOT_DOWNLINK_REC *downlink;
|
||||
|
|
@ -110,7 +110,7 @@ static void connect_downlink(BOTNET_REC *botnet, int handle,
|
|||
typedef struct {
|
||||
char *botnet;
|
||||
IPADDR ip;
|
||||
int handle;
|
||||
GIOChannel *handle;
|
||||
} BOT_CONNECT_REC;
|
||||
|
||||
static void sig_host_got(RESOLVED_NAME_REC *name, BOT_CONNECT_REC *rec)
|
||||
|
|
@ -133,13 +133,13 @@ static void sig_botnet_listen(BOTNET_REC *botnet)
|
|||
{
|
||||
BOT_CONNECT_REC *rec;
|
||||
IPADDR ip;
|
||||
int handle;
|
||||
GIOChannel *handle;
|
||||
|
||||
g_return_if_fail(botnet != NULL);
|
||||
|
||||
/* accept connection */
|
||||
handle = net_accept(botnet->listen_handle, &ip, NULL);
|
||||
if (handle == -1)
|
||||
if (handle == NULL)
|
||||
return;
|
||||
|
||||
rec = g_new0(BOT_CONNECT_REC, 1);
|
||||
|
|
@ -173,7 +173,7 @@ static int botnet_listen(BOTNET_REC *botnet)
|
|||
botnet->listen_handle = net_listen(&addr, &port);
|
||||
}
|
||||
|
||||
if (botnet->listen_handle == -1) {
|
||||
if (botnet->listen_handle == NULL) {
|
||||
g_warning("Couldn't start listening botnet\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
|
@ -184,7 +184,7 @@ static int botnet_listen(BOTNET_REC *botnet)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
static void sig_botnet_connected(int handle, BOT_UPLINK_REC *uplink)
|
||||
static void sig_botnet_connected(GIOChannel *handle, BOT_UPLINK_REC *uplink)
|
||||
{
|
||||
BOTNET_REC *botnet;
|
||||
BOT_REC *bot;
|
||||
|
|
@ -193,7 +193,7 @@ static void sig_botnet_connected(int handle, BOT_UPLINK_REC *uplink)
|
|||
|
||||
botnet = uplink->botnet;
|
||||
|
||||
if (handle == -1) {
|
||||
if (handle == NULL) {
|
||||
/* error, try another bot */
|
||||
botnet_connect(botnet);
|
||||
return;
|
||||
|
|
@ -235,7 +235,6 @@ void botnet_connect(BOTNET_REC *botnet)
|
|||
bot->connected = TRUE;
|
||||
bot->master = TRUE;
|
||||
|
||||
bot->handle = -1;
|
||||
bot->read_tag = -1;
|
||||
|
||||
botnet->connected = TRUE;
|
||||
|
|
@ -244,7 +243,7 @@ void botnet_connect(BOTNET_REC *botnet)
|
|||
botnet->bots = g_node_new(bot);
|
||||
}
|
||||
|
||||
if (botnet->listen_handle == -1) {
|
||||
if (botnet->listen_handle == NULL) {
|
||||
/* start listening */
|
||||
botnet_listen(botnet);
|
||||
}
|
||||
|
|
@ -470,7 +469,6 @@ static BOT_REC *bot_add(BOTNET_REC *botnet, const char *nick, const char *parent
|
|||
rec->botnet = botnet;
|
||||
rec->nick = g_strdup(nick);
|
||||
|
||||
rec->handle = -1;
|
||||
rec->read_tag = -1;
|
||||
rec->connected = TRUE;
|
||||
|
||||
|
|
@ -527,7 +525,7 @@ static void sig_bot_disconnected(BOT_REC *bot)
|
|||
if (!bot->botnet->connected)
|
||||
return;
|
||||
|
||||
if (bot->connected && bot->handle != -1) {
|
||||
if (bot->connected && bot->handle != NULL) {
|
||||
/* send notice to rest of the botnet about quit */
|
||||
str = g_strdup_printf("BOTQUIT %s", bot->nick);
|
||||
botnet_broadcast(bot->botnet, bot, NULL, str);
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ static void botnet_broadcast_single(BOTNET_REC *botnet, BOT_REC *except_bot,
|
|||
for (node = botnet->bots->children; node != NULL; node = node->next) {
|
||||
BOT_REC *rec = node->data;
|
||||
|
||||
if (rec != except_bot && rec->handle != -1)
|
||||
if (rec != except_bot && rec->handle != NULL)
|
||||
bot_send_cmd(rec, str);
|
||||
}
|
||||
g_free(str);
|
||||
|
|
@ -402,9 +402,9 @@ void bot_disconnect(BOT_REC *bot)
|
|||
g_source_remove(bot->read_tag);
|
||||
bot->read_tag = -1;
|
||||
}
|
||||
if (bot->handle != -1) {
|
||||
if (bot->handle != NULL) {
|
||||
net_disconnect(bot->handle);
|
||||
bot->handle = -1;
|
||||
bot->handle = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -483,9 +483,9 @@ void botnet_disconnect(BOTNET_REC *botnet)
|
|||
g_source_remove(botnet->listen_tag);
|
||||
botnet->listen_tag = -1;
|
||||
}
|
||||
if (botnet->listen_handle != -1) {
|
||||
if (botnet->listen_handle != NULL) {
|
||||
net_disconnect(botnet->listen_handle);
|
||||
botnet->listen_handle = -1;
|
||||
botnet->listen_handle = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -730,7 +730,6 @@ static void botnet_config_read_botnet(CONFIG_NODE *node)
|
|||
botnet->addr = g_strdup(config_node_get_str(node, "listen_addr", NULL));
|
||||
botnet->port = config_node_get_int(node, "listen_port", DEFAULT_BOTNET_PORT);
|
||||
|
||||
botnet->listen_handle = -1;
|
||||
botnet->listen_tag = -1;
|
||||
|
||||
/* read uplinks */
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ typedef struct {
|
|||
char *nick; /* bot's unique nick in botnet */
|
||||
int priority;
|
||||
|
||||
int handle;
|
||||
GIOChannel *handle;
|
||||
int read_tag;
|
||||
void *buffer;
|
||||
|
||||
|
|
@ -82,7 +82,7 @@ struct _botnet_rec {
|
|||
char *addr; /* in what address we should listen, NULL = all */
|
||||
int port; /* what port we should listen, 0 = default, -1 = don't listen */
|
||||
|
||||
int listen_handle;
|
||||
GIOChannel *listen_handle;
|
||||
int listen_tag;
|
||||
|
||||
GSList *uplinks;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue