summaryrefslogtreecommitdiff
path: root/src/map/irc-bot.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/map/irc-bot.c')
-rw-r--r--src/map/irc-bot.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/src/map/irc-bot.c b/src/map/irc-bot.c
index 5225672af..ff28082e7 100644
--- a/src/map/irc-bot.c
+++ b/src/map/irc-bot.c
@@ -29,7 +29,7 @@ char send_string[IRC_MESSAGE_LENGTH];
* Timer callback to (re-)connect to an IRC server
* @see timer->do_timer
*/
-int irc_connect_timer(int tid, unsigned int tick, int id, intptr_t data) {
+int irc_connect_timer(int tid, int64 tick, int id, intptr_t data) {
struct hSockOpt opt;
if( ircbot->isOn || ++ircbot->fails >= 3 )
return 0;
@@ -52,7 +52,7 @@ int irc_connect_timer(int tid, unsigned int tick, int id, intptr_t data) {
* Timer callback to send identification commands to an IRC server
* @see timer->do_timer
*/
-int irc_identify_timer(int tid, unsigned int tick, int id, intptr_t data) {
+int irc_identify_timer(int tid, int64 tick, int id, intptr_t data) {
if( !ircbot->isOn )
return 0;
@@ -70,7 +70,7 @@ int irc_identify_timer(int tid, unsigned int tick, int id, intptr_t data) {
* Timer callback to join channels (and optionally send NickServ commands)
* @see timer->do_timer
*/
-int irc_join_timer(int tid, unsigned int tick, int id, intptr_t data) {
+int irc_join_timer(int tid, int64 tick, int id, intptr_t data) {
if( !ircbot->isOn )
return 0;
@@ -152,7 +152,8 @@ int irc_parse(int fd) {
* NULL, needs to be able to fit an IRC_HOST_LENGTH long string)
*/
void irc_parse_source(char *source, char *nick, char *ident, char *host) {
- int i, len = strlen(source), pos = 0;
+ int i, pos = 0;
+ size_t len = strlen(source);
unsigned char stage = 0;
for(i = 0; i < len; i++) {
@@ -208,7 +209,7 @@ void irc_parse_sub(int fd, char *str) {
* @param str Command to send
*/
void irc_send(char *str) {
- int len = strlen(str) + 2;
+ size_t len = strlen(str) + 2;
if (len > IRC_MESSAGE_LENGTH-3)
len = IRC_MESSAGE_LENGTH-3;
WFIFOHEAD(ircbot->fd, len);
@@ -289,7 +290,7 @@ void irc_privmsg(int fd, char *cmd, char *source, char *target, char *msg) {
} else if( strcmpi(target,hChSys.irc_nick) == 0 ) {
ShowDebug("irc_privmsg: Received message from %s: '%s'\n", source ? source : "(null)", msg);
#endif // IRCBOT_DEBUG
- } else if( strcmpi(target,hChSys.irc_channel) == 0 ) {
+ } else if( msg && strcmpi(target,hChSys.irc_channel) == 0 ) {
char source_nick[IRC_NICK_LENGTH], source_ident[IRC_IDENT_LENGTH], source_host[IRC_HOST_LENGTH];
source_nick[0] = source_ident[0] = source_host[0] = '\0';
@@ -298,7 +299,7 @@ void irc_privmsg(int fd, char *cmd, char *source, char *target, char *msg) {
ircbot->parse_source(source,source_nick,source_ident,source_host);
if( ircbot->channel ) {
- int padding_len = strlen(ircbot->channel->name) + strlen(source_nick) + 13;
+ size_t padding_len = strlen(ircbot->channel->name) + strlen(source_nick) + 13;
while (1) {
snprintf(send_string, 150, "[ #%s ] IRC.%s : %s",ircbot->channel->name,source_nick,msg);
clif->chsys_msg2(ircbot->channel,send_string);
@@ -386,7 +387,7 @@ void irc_relay(char *name, const char *msg) {
/**
* IRC bot initializer
*/
-void irc_bot_init(void) {
+void irc_bot_init(bool minimal) {
/// Command handlers
const struct irc_func irc_func_base[] = {
{ "PING" , ircbot->pong },
@@ -399,6 +400,9 @@ void irc_bot_init(void) {
struct irc_func* function;
int i;
+ if (minimal)
+ return;
+
if( !hChSys.irc )
return;