diff options
author | Haru <haru@dotalux.com> | 2013-08-05 15:32:35 +0200 |
---|---|---|
committer | Haru <haru@dotalux.com> | 2013-08-12 17:14:51 +0200 |
commit | d20596083a12a8ab797614121be51d2a914abe58 (patch) | |
tree | 85381bfec7e42eda0af7219f0b6b041c107921d2 | |
parent | 3fb307be68de6026df138b2d48f2f6b94dbec64f (diff) | |
download | hercules-d20596083a12a8ab797614121be51d2a914abe58.tar.gz hercules-d20596083a12a8ab797614121be51d2a914abe58.tar.bz2 hercules-d20596083a12a8ab797614121be51d2a914abe58.tar.xz hercules-d20596083a12a8ab797614121be51d2a914abe58.zip |
Added support for target-less commands in the IRC bridge
Needed for future updates (such as receiving "QUIT" commands
Signed-off-by: Haru <haru@dotalux.com>
-rw-r--r-- | src/map/clif.c | 4 | ||||
-rw-r--r-- | src/map/clif.h | 2 | ||||
-rw-r--r-- | src/map/irc-bot.c | 13 | ||||
-rw-r--r-- | src/map/irc-bot.h | 2 |
4 files changed, 13 insertions, 8 deletions
diff --git a/src/map/clif.c b/src/map/clif.c index 7171a48be..d42dc4748 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -3711,7 +3711,7 @@ void clif_useitemack(struct map_session_data *sd,int index,int amount,bool ok) } } -void clif_hercules_chsys_send(struct hChSysCh *channel, struct map_session_data *sd, char *msg) { +void clif_hercules_chsys_send(struct hChSysCh *channel, struct map_session_data *sd, const char *msg) { if( channel->msg_delay != 0 && DIFF_TICK(sd->hchsysch_tick + ( channel->msg_delay * 1000 ), iTimer->gettick()) > 0 && !pc->has_permission(sd, PC_PERM_HCHSYS_ADMIN) ) { clif->colormes(sd->fd,COLOR_RED,msg_txt(1455)); return; @@ -5715,7 +5715,7 @@ void clif_broadcast(struct block_list* bl, const char* mes, int len, int type, e * Used by npc_globalmessage *------------------------------------------*/ void clif_GlobalMessage(struct block_list* bl, const char* message) { - char buf[100]; + char buf[256]; int len; nullpo_retv(bl); diff --git a/src/map/clif.h b/src/map/clif.h index 47c2cc776..fc2755372 100644 --- a/src/map/clif.h +++ b/src/map/clif.h @@ -930,7 +930,7 @@ struct clif_interface { void (*chsys_create) (struct hChSysCh *channel, char *name, char *pass, unsigned char color); void (*chsys_msg) (struct hChSysCh *channel, struct map_session_data *sd, char *msg); void (*chsys_msg2) (struct hChSysCh *channel, char *msg); - void (*chsys_send) (struct hChSysCh *channel, struct map_session_data *sd, char *msg); + void (*chsys_send) (struct hChSysCh *channel, struct map_session_data *sd, const char *msg); void (*chsys_join) (struct hChSysCh *channel, struct map_session_data *sd); void (*chsys_left) (struct hChSysCh *channel, struct map_session_data *sd); void (*chsys_delete) (struct hChSysCh *channel); diff --git a/src/map/irc-bot.c b/src/map/irc-bot.c index d3782bd9b..d8aa59440 100644 --- a/src/map/irc-bot.c +++ b/src/map/irc-bot.c @@ -131,15 +131,20 @@ void irc_parse_source(char *source, char *nick, char *ident, char *host) { } } void irc_parse_sub(int fd, char *str) { - char source[180], command[60], target[60], message[200]; + char source[180], command[60], buf1[500], buf2[500]; + char *target = buf1, *message = buf2; struct irc_func *func; - source[0] = command[0] = target[0] = message[0] = '\0'; + source[0] = command[0] = buf1[0] = buf2[0] = '\0'; if( str[0] == ':' ) str++; - sscanf(str, "%179s %59s %59s :%199[^\r\n]", source, command, target, message); + if (sscanf(str, "%179s %59s %499s :%499[^\r\n]", source, command, buf1, buf2) == 3 && buf1[0] == ':') { + // source command :message (i.e. QUIT) + message = buf1+1; + target = buf2; + } if( command[0] == '\0' ) return; @@ -202,7 +207,7 @@ void irc_privmsg(int fd, char *cmd, char *source, char *target, char *msg) { } } -void irc_relay (char *name, char *msg) { +void irc_relay (char *name, const char *msg) { if( !ircbot->isIn ) return; sprintf(send_string,"PRIVMSG %s :[ %s ] : %s",hChSys.irc_channel,name,msg); diff --git a/src/map/irc-bot.h b/src/map/irc-bot.h index 1fd4b58ab..0fd84bd5f 100644 --- a/src/map/irc-bot.h +++ b/src/map/irc-bot.h @@ -47,7 +47,7 @@ struct irc_bot_interface { int (*join_timer) (int tid, unsigned int tick, int id, intptr_t data); /* */ void (*send)(char *str); - void (*relay) (char *name, char *msg); + void (*relay) (char *name, const char *msg); /* */ void (*pong) (int fd, char *cmd, char *source, char *target, char *msg); void (*join) (int fd, char *cmd, char *source, char *target, char *msg); |