summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
authorskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-06-13 17:02:03 +0000
committerskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-06-13 17:02:03 +0000
commit7c88cfdb659578ce7d79c6a2bda33d2907d6e246 (patch)
treeebc509736121e531efed03340183c84212375a07 /src/map
parent2f97445eb2d2a7e46e1cfd54285cddde0fbc10b2 (diff)
downloadhercules-7c88cfdb659578ce7d79c6a2bda33d2907d6e246.tar.gz
hercules-7c88cfdb659578ce7d79c6a2bda33d2907d6e246.tar.bz2
hercules-7c88cfdb659578ce7d79c6a2bda33d2907d6e246.tar.xz
hercules-7c88cfdb659578ce7d79c6a2bda33d2907d6e246.zip
- Added irc_channel_pass setting and prevent crashing when irc server lookup by host fails. Thanks to Trancid for the details.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@7133 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map')
-rw-r--r--src/map/irc.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/map/irc.c b/src/map/irc.c
index 1d1b41617..4c14d81d6 100644
--- a/src/map/irc.c
+++ b/src/map/irc.c
@@ -54,6 +54,7 @@ char irc_nick[30]="";
char irc_password[32]="";
char irc_channel[32]="";
+char irc_channel_pass[32]="";
char irc_trade_channel[32]="";
unsigned char irc_ip_str[128]="";
@@ -251,7 +252,7 @@ void irc_parse_sub(int fd, char *incoming_string)
ShowStatus("IRC: Connected to IRC.\n");
sprintf(send_string, "PRIVMSG nickserv :identify %s", irc_password);
irc_send(send_string);
- sprintf(send_string, "JOIN %s", irc_channel);
+ sprintf(send_string, "JOIN %s %s", irc_channel, irc_channel_pass);
irc_send(send_string);
sprintf(send_string,"NAMES %s",irc_channel);
irc_send(send_string);
@@ -319,7 +320,7 @@ void irc_parse_sub(int fd, char *incoming_string)
// Autojoin on kick [Zido]
else if((strcmpi(command,"kick")==0)&&(irc_autojoin==1)) {
- sprintf(send_string,"JOIN %s",target);
+ sprintf(send_string, "JOIN %s %s", target, irc_channel_pass);
irc_send(send_string);
}
}
@@ -363,6 +364,12 @@ void do_init_irc(void)
if (irc_ip_str[strlen(irc_ip_str)-1] == '\n')
irc_ip_str[strlen(irc_ip_str)-1] = '\0';
irc_hostname=gethostbyname(irc_ip_str);
+ if (!irc_hostname)
+ {
+ ShowError("Unable to resolve %s! Cannot connect to IRC server, disabling irc_bot.\n", irc_ip_str);
+ use_irc = 0;
+ return;
+ }
irc_ip_str[0]='\0';
sprintf(irc_ip_str, "%d.%d.%d.%d", (unsigned char)irc_hostname->h_addr[0], (unsigned char)irc_hostname->h_addr[1],
(unsigned char)irc_hostname->h_addr[2], (unsigned char)irc_hostname->h_addr[3]);
@@ -539,6 +546,8 @@ int irc_read_conf(char *file) {
irc_autojoin=atoi(w2);
else if(strcmpi(w1,"irc_channel")==0)
strcpy(irc_channel,w2);
+ else if(strcmpi(w1,"irc_channel_pass")==0)
+ strcpy(irc_channel_pass,w2);
else if(strcmpi(w1,"irc_trade_channel")==0)
strcpy(irc_trade_channel,w2);
else if(strcmpi(w1,"irc_nick")==0)