summaryrefslogtreecommitdiff
path: root/src/map/irc-bot.c
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2015-06-18 01:52:38 +0200
committerHaru <haru@dotalux.com>2015-08-15 00:51:38 +0200
commit1034bfb7a390cb21623c3892f4d2304e2458af79 (patch)
tree236ce246af0d248cff51bb85725a735c5aeccb06 /src/map/irc-bot.c
parent747d3b7d5c6056470b1c9d3f41e09e0ed92af6d6 (diff)
downloadhercules-1034bfb7a390cb21623c3892f4d2304e2458af79.tar.gz
hercules-1034bfb7a390cb21623c3892f4d2304e2458af79.tar.bz2
hercules-1034bfb7a390cb21623c3892f4d2304e2458af79.tar.xz
hercules-1034bfb7a390cb21623c3892f4d2304e2458af79.zip
Cleaned up socket interface
- Replaced some macro calls with the proper interface syntax - Removed useless macros and workarounds API changes summary: - WFIFOSET() can now be safely used both inside and outside socket.c - RFIFOSKIP() can now be safely used both inside and outside socket.c - do_close() is now sockt->close() - flush_fifo() is now sockt->flush() - flush_fifos() is now sockt->flush_fifos() - getips() is now sockt->getips() - host2ip() is now sockt->host2ip() - ip2str() is now sockt->ip2str() - ntows() is now sockt->ntows() - make_connection() is now sockt->make_connection() - make_listen_bind() is now sockt->make_listen_bind() - realloc_fifo() is now sockt->realloc_fifo() - realloc_writefifo() is now sockt->realloc_writefifo() - session_isActive() is now sockt->session_is_active() - session_isValid() is now sockt->session_is_valid() - set_defaultparse() is now sockt->set_defaultparse() - set_eof() is now sockt->eof() - set_noblocking() is now sockt->set_noblocking() - str2ip() is now sockt->str2ip() Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src/map/irc-bot.c')
-rw-r--r--src/map/irc-bot.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/map/irc-bot.c b/src/map/irc-bot.c
index b0f687c0d..451d224fd 100644
--- a/src/map/irc-bot.c
+++ b/src/map/irc-bot.c
@@ -41,7 +41,7 @@ int irc_connect_timer(int tid, int64 tick, int id, intptr_t data) {
ircbot->last_try = timer->gettick();
- if ((ircbot->fd = make_connection(ircbot->ip, channel->config->irc_server_port, &opt)) > 0) {
+ if ((ircbot->fd = sockt->make_connection(ircbot->ip, channel->config->irc_server_port, &opt)) > 0) {
session[ircbot->fd]->func_parse = ircbot->parse;
session[ircbot->fd]->flag.server = 1;
timer->add(timer->gettick() + 3000, ircbot->identify_timer, 0, 0);
@@ -115,12 +115,12 @@ int irc_parse(int fd) {
char *parse_string = NULL, *str_safe = NULL;
if (session[fd]->flag.eof) {
- do_close(fd);
+ sockt->close(fd);
ircbot->fd = 0;
ircbot->isOn = false;
ircbot->isIn = false;
ircbot->fails = 0;
- ircbot->ip = host2ip(channel->config->irc_server);
+ ircbot->ip = sockt->host2ip(channel->config->irc_server);
timer->add(timer->gettick() + 120000, ircbot->connect_timer, 0, 0);
return 0;
}
@@ -415,7 +415,7 @@ void irc_bot_init(bool minimal) {
if (!channel->config->irc)
return;
- if (!(ircbot->ip = host2ip(channel->config->irc_server))) {
+ if (!(ircbot->ip = sockt->host2ip(channel->config->irc_server))) {
ShowError("Unable to resolve '%s' (irc server), disabling irc channel...\n", channel->config->irc_server);
channel->config->irc = false;
return;
@@ -454,7 +454,7 @@ void irc_bot_final(void) {
return;
if( ircbot->isOn ) {
ircbot->send("QUIT :Hercules is shutting down");
- do_close(ircbot->fd);
+ sockt->close(ircbot->fd);
}
for( i = 0; i < ircbot->funcs.size; i++ ) {