summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2013-08-06 21:34:31 +0200
committerHaru <haru@dotalux.com>2013-08-12 17:14:51 +0200
commitde6602f25485d0ba4c02426ab982fa8ff8a224ae (patch)
tree6b085227221b551215a15bee287bdcffba8610f5
parentca1f74fcd9974a8c06dee91b78a49fcb8d2b5095 (diff)
downloadhercules-de6602f25485d0ba4c02426ab982fa8ff8a224ae.tar.gz
hercules-de6602f25485d0ba4c02426ab982fa8ff8a224ae.tar.bz2
hercules-de6602f25485d0ba4c02426ab982fa8ff8a224ae.tar.xz
hercules-de6602f25485d0ba4c02426ab982fa8ff8a224ae.zip
Added support for Nick Server GHOST command
Credits to Yommy for the idea Signed-off-by: Haru <haru@dotalux.com>
-rw-r--r--conf/channels.conf3
-rw-r--r--src/map/clif.c6
-rw-r--r--src/map/clif.h1
-rw-r--r--src/map/irc-bot.c3
4 files changed, 11 insertions, 2 deletions
diff --git a/conf/channels.conf b/conf/channels.conf
index f17d2aed1..9700f626c 100644
--- a/conf/channels.conf
+++ b/conf/channels.conf
@@ -59,5 +59,6 @@ chsys: (
irc_channel_channel: "#Hercules" /* channel in the network above to join */
irc_channel_nick: "Hercules_chSysBot" /* nick the bot will use */
irc_channel_nick_pw: "" /* password to this nick (if any) to identify to nick server on the irc network */
+ irc_channel_use_ghost: false /* whether to send a GHOST command to the nick server (requires irc_channel_nick_pw to be defined) */
}
-) \ No newline at end of file
+)
diff --git a/src/map/clif.c b/src/map/clif.c
index d42dc4748..0d78ca488 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -2700,6 +2700,7 @@ void read_channels_config(void) {
if( hChSys.irc ) {
const char *irc_server, *irc_channel,
*irc_nick, *irc_nick_pw;
+ int irc_use_ghost = 0;
if( config_setting_lookup_string(settings, "irc_channel_network", &irc_server) ) {
if( !strstr(irc_server,":") ) {
hChSys.irc = false;
@@ -2739,8 +2740,11 @@ void read_channels_config(void) {
hChSys.irc = false;
ShowWarning("channels.conf : irc channel enabled but irc_channel_nick wasn't found, disabling irc channel...\n");
}
- if( config_setting_lookup_string(settings, "irc_channel_nick_pw", &irc_nick_pw) )
+ if( config_setting_lookup_string(settings, "irc_channel_nick_pw", &irc_nick_pw) ) {
safestrncpy(hChSys.irc_nick_pw, irc_nick_pw, 30);
+ config_setting_lookup_bool(settings, "irc_channel_use_ghost", &irc_use_ghost);
+ hChSys.irc_use_ghost = irc_use_ghost;
+ }
}
diff --git a/src/map/clif.h b/src/map/clif.h
index fc2755372..1161b3b6a 100644
--- a/src/map/clif.h
+++ b/src/map/clif.h
@@ -417,6 +417,7 @@ struct {
bool allow_user_channel_creation;
char irc_server[40], irc_channel[50], irc_nick[40], irc_nick_pw[30];
unsigned short irc_server_port;
+ bool irc_use_ghost;
} hChSys;
struct hChSysBanEntry {
diff --git a/src/map/irc-bot.c b/src/map/irc-bot.c
index fe7bf4bd4..b17015b66 100644
--- a/src/map/irc-bot.c
+++ b/src/map/irc-bot.c
@@ -77,6 +77,9 @@ int irc_join_timer(int tid, unsigned int tick, int id, intptr_t data) {
if( hChSys.irc_nick_pw[0] != '\0' ) {
sprintf(send_string, "PRIVMSG NICKSERV : IDENTIFY %s", hChSys.irc_nick_pw);
ircbot->send(send_string);
+ if( hChSys.irc_use_ghost ) {
+ sprintf(send_string, "PRIVMSG NICKSERV : GHOST %s %s", hChSys.irc_nick, hChSys.irc_nick_pw);
+ }
}
sprintf(send_string, "JOIN %s", hChSys.irc_channel);