diff options
author | skotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2006-06-13 17:02:03 +0000 |
---|---|---|
committer | skotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2006-06-13 17:02:03 +0000 |
commit | 7c88cfdb659578ce7d79c6a2bda33d2907d6e246 (patch) | |
tree | ebc509736121e531efed03340183c84212375a07 | |
parent | 2f97445eb2d2a7e46e1cfd54285cddde0fbc10b2 (diff) | |
download | hercules-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
-rw-r--r-- | Changelog-Trunk.txt | 2 | ||||
-rw-r--r-- | conf-tmpl/irc_athena.conf | 3 | ||||
-rw-r--r-- | src/map/irc.c | 13 |
3 files changed, 16 insertions, 2 deletions
diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt index 64ee5f55b..fa09a7bce 100644 --- a/Changelog-Trunk.txt +++ b/Changelog-Trunk.txt @@ -4,6 +4,8 @@ AS OF SVN REV. 5091, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
2006/06/13
+ * Added irc_channel_pass setting and prevent crashing when irc server
+ lookup by host fails. Thanks to Trancid for the details. [Skotlex]
* [Fixed]:
- clif_parse_GetCharNameRequest displaying false alarm for legitimate GM snooping.
[Lance]
diff --git a/conf-tmpl/irc_athena.conf b/conf-tmpl/irc_athena.conf index 25c687720..2929966d9 100644 --- a/conf-tmpl/irc_athena.conf +++ b/conf-tmpl/irc_athena.conf @@ -29,6 +29,9 @@ irc_autojoin: 0 //IRC Channel
irc_channel: #
+//IRC Channel password (set if required)
+//irc_channel_pass:
+
//IRC Trade Channel
irc_trade_channel: #
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)
|