diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/map/clif.c | 4 | ||||
-rw-r--r-- | src/map/clif.h | 2 | ||||
-rw-r--r-- | src/map/irc-bot.c | 12 | ||||
-rw-r--r-- | src/map/irc-bot.h | 3 | ||||
-rw-r--r-- | src/map/script.c | 1 | ||||
-rw-r--r-- | src/map/script.h | 3 |
6 files changed, 14 insertions, 11 deletions
diff --git a/src/map/clif.c b/src/map/clif.c index f1aac302e..319be6b3e 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -2762,7 +2762,7 @@ void read_channels_config(void) { ShowWarning("channels.conf : irc channel enabled but irc_channel_network wasn't found, disabling irc channel...\n"); } if( config_setting_lookup_string(settings, "irc_channel_channel", &irc_channel) ) - safestrncpy(hChSys.irc_channel, irc_channel, 20); + safestrncpy(hChSys.irc_channel, irc_channel, 50); else { hChSys.irc = false; ShowWarning("channels.conf : irc channel enabled but irc_channel_channel wasn't found, disabling irc channel...\n"); @@ -2771,7 +2771,7 @@ void read_channels_config(void) { if( strcmpi(irc_nick,"Hercules_chSysBot") == 0 ) { sprintf(hChSys.irc_nick, "Hercules_chSysBot%d",rand()%777); } else - safestrncpy(hChSys.irc_nick, irc_nick, 30); + safestrncpy(hChSys.irc_nick, irc_nick, 40); } else { hChSys.irc = false; ShowWarning("channels.conf : irc channel enabled but irc_channel_nick wasn't found, disabling irc channel...\n"); diff --git a/src/map/clif.h b/src/map/clif.h index 94b29db9a..a0959f92a 100644 --- a/src/map/clif.h +++ b/src/map/clif.h @@ -412,7 +412,7 @@ struct { unsigned char local_color, ally_color, irc_color; bool closing; bool allow_user_channel_creation; - char irc_server[40], irc_channel[20], irc_nick[30], irc_nick_pw[30]; + char irc_server[40], irc_channel[50], irc_nick[40], irc_nick_pw[30]; unsigned short irc_server_port; } hChSys; diff --git a/src/map/irc-bot.c b/src/map/irc-bot.c index bfaf18af0..fea5f523a 100644 --- a/src/map/irc-bot.c +++ b/src/map/irc-bot.c @@ -118,14 +118,14 @@ void irc_parse_source(char *source, char *nick, char *ident, char *host) { for(i = 0; i < len; i++) { if( stage == 0 && source[i] == '!' ) { - memcpy(nick, &source[0], len - i); + memcpy(nick, &source[0], min(i,IRC_NICK_LENGTH)); nick[i] = '\0'; pos = i+1; stage = 1; } else if( stage == 1 && source[i] == '@' ) { - memcpy(ident, &source[pos], i - pos); + memcpy(ident, &source[pos], min(i - pos,IRC_IDENT_LENGTH)); ident[i-pos] = '\0'; - memcpy(host, &source[i+1], len); + memcpy(host, &source[i+1], min(len - i,IRC_HOST_LENGTH)); host[len] = '\0'; break; } @@ -177,7 +177,7 @@ void irc_privmsg(int fd, char *cmd, char *source, char *target, char *msg) { if( strcmpi(target,hChSys.irc_nick) == 0 ) { if( msg[0] == ':' ) msg++; if( strcmpi(msg,"VERSION") == 0 ) { - char source_nick[40], source_ident[40], source_host[100]; + 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'; @@ -189,13 +189,13 @@ void irc_privmsg(int fd, char *cmd, char *source, char *target, char *msg) { return; } } else if( strcmpi(target,hChSys.irc_channel) == 0 ) { - char source_nick[40], source_ident[40], source_host[100]; + 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'; if( source[0] != '\0' ) ircbot->parse_source(source,source_nick,source_ident,source_host); - + if( ircbot->channel ) { snprintf(send_string, 150, "[ #%s ] IRC.%s : %s",ircbot->channel->name,source_nick,msg); clif->chsys_msg2(ircbot->channel,send_string); diff --git a/src/map/irc-bot.h b/src/map/irc-bot.h index f4244e024..911a15b0e 100644 --- a/src/map/irc-bot.h +++ b/src/map/irc-bot.h @@ -6,6 +6,9 @@ #ifndef _IRC_BOT_H_ #define _IRC_BOT_H_ +#define IRC_NICK_LENGTH 40 +#define IRC_IDENT_LENGTH 40 +#define IRC_HOST_LENGTH 63 #define IRC_FUNC_LENGTH 30 struct hChSysCh; diff --git a/src/map/script.c b/src/map/script.c index a086c3f65..15b6fe788 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -17912,6 +17912,7 @@ void script_defaults(void) { script->addScript = script_hp_add; script->conv_num = conv_num; script->conv_str = conv_str; + script->rid2sd = script_rid2sd; script->queue = script_hqueue_get; script->queue_add = script_hqueue_add; diff --git a/src/map/script.h b/src/map/script.h index 83d6dd9ee..2e8dde5cf 100644 --- a/src/map/script.h +++ b/src/map/script.h @@ -214,8 +214,6 @@ int script_reload(void); // @commands (script based) void setd_sub(struct script_state *st, struct map_session_data *sd, const char *varname, int elem, void *value, struct DBMap **ref); -TBL_PC *script_rid2sd(struct script_state *st); - /////////////////////////////////////////////////////////////////////////////// //## TODO possible enhancements: [FlavioJS] // - 'callfunc' supporting labels in the current npc "::LabelName" @@ -339,6 +337,7 @@ struct script_interface { bool (*addScript) (char *name, char *args, bool (*func)(struct script_state *st)); int (*conv_num) (struct script_state *st,struct script_data *data); const char* (*conv_str) (struct script_state *st,struct script_data *data); + TBL_PC *(*rid2sd) (struct script_state *st); /* */ struct hQueue *(*queue) (int idx); bool (*queue_add) (int idx, int var); |