summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorshennetsind <ind@henn.et>2013-04-24 10:54:37 -0300
committershennetsind <ind@henn.et>2013-04-24 10:54:37 -0300
commit5a74f3f57a671e7729d8f48cdcc1d6f9454f504b (patch)
treeb7de83d6cef4fa13380ccfb820efda1d10dd3bd1 /src
parent7ef89df2da4b688fabe6362f13c2f1583dcdf60f (diff)
downloadhercules-5a74f3f57a671e7729d8f48cdcc1d6f9454f504b.tar.gz
hercules-5a74f3f57a671e7729d8f48cdcc1d6f9454f504b.tar.bz2
hercules-5a74f3f57a671e7729d8f48cdcc1d6f9454f504b.tar.xz
hercules-5a74f3f57a671e7729d8f48cdcc1d6f9454f504b.zip
Fixed msvc warning on irc-bot
Special Thanks to Zopokx! Signed-off-by: shennetsind <ind@henn.et>
Diffstat (limited to 'src')
-rw-r--r--src/map/irc-bot.c16
-rw-r--r--src/map/irc-bot.h2
2 files changed, 10 insertions, 8 deletions
diff --git a/src/map/irc-bot.c b/src/map/irc-bot.c
index 3e7d7eb06..28224244d 100644
--- a/src/map/irc-bot.c
+++ b/src/map/irc-bot.c
@@ -22,7 +22,7 @@
char send_string[200];
int irc_connect_timer(int tid, unsigned int tick, int id, intptr_t data) {
- if( ircbot->fd != -1 || session[ircbot->fd] || ++ircbot->fails >= 3 )
+ if( ircbot->isOn || ++ircbot->fails >= 3 )
return 0;
ircbot->last_try = gettick();
@@ -35,7 +35,7 @@ int irc_connect_timer(int tid, unsigned int tick, int id, intptr_t data) {
}
int irc_identify_timer(int tid, unsigned int tick, int id, intptr_t data) {
- if( ircbot->fd == -1 )
+ if( !ircbot->isOn )
return 0;
sprintf(send_string, "USER HerculesWS%d 8 * : Hercules IRC Bridge",rand()%777);
@@ -49,7 +49,7 @@ int irc_identify_timer(int tid, unsigned int tick, int id, intptr_t data) {
}
int irc_join_timer(int tid, unsigned int tick, int id, intptr_t data) {
- if( ircbot->fd == -1 )
+ if( !ircbot->isOn )
return 0;
if( hChSys.irc_nick_pw[0] != '\0' ) {
@@ -79,7 +79,8 @@ int irc_parse(int fd) {
if (session[fd]->flag.eof) {
do_close(fd);
- ircbot->fd = -1;
+ ircbot->fd = 0;
+ ircbot->isOn = false;
ircbot->isIn = false;
ircbot->fails = 0;
ircbot->ip = host2ip(hChSys.irc_server);
@@ -225,8 +226,9 @@ void irc_bot_init(void) {
}
ircbot->fails = 0;
- ircbot->fd = -1;
- ircbot->isIn = true;
+ ircbot->fd = 0;
+ ircbot->isIn = false;
+ ircbot->isOn = false;
add_timer_func_list(ircbot->connect_timer, "irc_connect_timer");
add_timer(gettick() + 7000, ircbot->connect_timer, 0, 0);
@@ -237,7 +239,7 @@ void irc_bot_final(void) {
if( !hChSys.irc )
return;
- if( ircbot->fd != -1 ) {
+ if( ircbot->isOn ) {
ircbot->send("QUIT :Hercules is shutting down");
do_close(ircbot->fd);
}
diff --git a/src/map/irc-bot.h b/src/map/irc-bot.h
index d1bf0866d..f4244e024 100644
--- a/src/map/irc-bot.h
+++ b/src/map/irc-bot.h
@@ -17,7 +17,7 @@ struct irc_func {
struct irc_bot_interface {
int fd;
- bool isIn;
+ bool isIn, isOn;
unsigned int last_try;
unsigned char fails;
unsigned long ip;