|
@ -3,6 +3,8 @@ |
|
|
#include "daemon/log.h" |
|
|
#include "daemon/log.h" |
|
|
|
|
|
|
|
|
void (*irc_privmsg_cb)(struct ircstate *, const struct privmsg *) = NULL; |
|
|
void (*irc_privmsg_cb)(struct ircstate *, const struct privmsg *) = NULL; |
|
|
|
|
|
void (*irc_command_cb)(struct ircstate *, const struct irccommand *) = NULL; |
|
|
|
|
|
void (*irc_connect_cb)(struct ircstate *) = NULL; |
|
|
void (*irc_disconnect_cb)(struct ircstate *) = NULL; |
|
|
void (*irc_disconnect_cb)(struct ircstate *) = NULL; |
|
|
|
|
|
|
|
|
static struct io_plan *irc_connected(struct io_conn *conn, struct lightningd_state *dstate, struct ircstate *state); |
|
|
static struct io_plan *irc_connected(struct io_conn *conn, struct lightningd_state *dstate, struct ircstate *state); |
|
@ -94,6 +96,10 @@ static void handle_irc_command(struct ircstate *state, const char *line) |
|
|
pm->msg = tal_strjoin(m, splits + 2, " ", STR_NO_TRAIL); |
|
|
pm->msg = tal_strjoin(m, splits + 2, " ", STR_NO_TRAIL); |
|
|
irc_privmsg_cb(state, pm); |
|
|
irc_privmsg_cb(state, pm); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (irc_command_cb != NULL) |
|
|
|
|
|
irc_command_cb(state, m); |
|
|
|
|
|
|
|
|
tal_free(m); |
|
|
tal_free(m); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -168,7 +174,9 @@ static struct io_plan *irc_connected(struct io_conn *conn, struct lightningd_sta |
|
|
state->connected = true; |
|
|
state->connected = true; |
|
|
irc_send(state, "USER", "%s 0 * :A lightning node", state->nick); |
|
|
irc_send(state, "USER", "%s 0 * :A lightning node", state->nick); |
|
|
irc_send(state, "NICK", "%s", state->nick); |
|
|
irc_send(state, "NICK", "%s", state->nick); |
|
|
irc_send(state, "JOIN", "#lightning-nodes"); |
|
|
|
|
|
|
|
|
if (irc_connect_cb != NULL) |
|
|
|
|
|
irc_connect_cb(state); |
|
|
|
|
|
|
|
|
return io_duplex(conn, |
|
|
return io_duplex(conn, |
|
|
io_read_partial(conn, |
|
|
io_read_partial(conn, |
|
|