diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-11-10 22:01:15 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-11-10 22:01:15 +0300 |
commit | b21ac069afee7f6eeea4acec08710aceb9667919 (patch) | |
tree | eccbafee3a28439e8e284b5c197bcfdfa3a52c42 /src/login | |
parent | 8812bcce528883ac963bd848e91ddcf162a24fa0 (diff) | |
download | evol-hercules-b21ac069afee7f6eeea4acec08710aceb9667919.tar.gz evol-hercules-b21ac069afee7f6eeea4acec08710aceb9667919.tar.bz2 evol-hercules-b21ac069afee7f6eeea4acec08710aceb9667919.tar.xz evol-hercules-b21ac069afee7f6eeea4acec08710aceb9667919.zip |
login: send update host to client.
Diffstat (limited to 'src/login')
-rw-r--r-- | src/login/config.c | 2 | ||||
-rw-r--r-- | src/login/config.h | 2 | ||||
-rw-r--r-- | src/login/init.c | 2 | ||||
-rw-r--r-- | src/login/parse.c | 1 | ||||
-rw-r--r-- | src/login/send.c | 13 | ||||
-rw-r--r-- | src/login/send.h | 1 |
6 files changed, 19 insertions, 2 deletions
diff --git a/src/login/config.c b/src/login/config.c index 02d3d12..e6a1a42 100644 --- a/src/login/config.c +++ b/src/login/config.c @@ -17,5 +17,5 @@ char *update_server = NULL; void config_update_server(const char *val) { - update_server = val; + update_server = aStrdup(val); } diff --git a/src/login/config.h b/src/login/config.h index 6e76c54..1777a9b 100644 --- a/src/login/config.h +++ b/src/login/config.h @@ -6,4 +6,6 @@ void config_update_server(const char *val); +extern char *update_server; + #endif // EVOL_LOGIN_CONFIG diff --git a/src/login/init.c b/src/login/init.c index 9aab37d..2a2d295 100644 --- a/src/login/init.c +++ b/src/login/init.c @@ -27,7 +27,6 @@ HPExport struct hplugin_info pinfo = HPExport void plugin_init (void) { - iMalloc = GET_SYMBOL("iMalloc"); session = GET_SYMBOL("session"); sockt = GET_SYMBOL("sockt"); @@ -39,6 +38,7 @@ HPExport void plugin_init (void) HPExport void server_preinit (void) { + iMalloc = GET_SYMBOL("iMalloc"); addLoginConf("update_server", config_update_server); } diff --git a/src/login/parse.c b/src/login/parse.c index b8f25fe..49f7b14 100644 --- a/src/login/parse.c +++ b/src/login/parse.c @@ -31,6 +31,7 @@ void login_parse_version(int fd) return; } + send_update_host(fd); send_server_version(fd); } diff --git a/src/login/send.c b/src/login/send.c index 257376f..ebc2e4c 100644 --- a/src/login/send.c +++ b/src/login/send.c @@ -12,6 +12,7 @@ #include "../../../common/strlib.h" #include "../../../login/login.h" +#include "login/config.h" #include "login/send.h" void send_server_version(int fd) @@ -23,3 +24,15 @@ void send_server_version(int fd) WFIFOL(fd, 8) = 1; // server version WFIFOSET(fd, WFIFOW(fd,2)); } + +void send_update_host(int fd) +{ + if (!update_server) + return; + const int sz = 4 + strlen(update_server); + WFIFOHEAD(fd, sz); + WFIFOW(fd, 0) = 0x63; + WFIFOW(fd, 2) = sz; + memcpy(WFIFOP (fd, 4), update_server, sz); + WFIFOSET(fd, sz); +} diff --git a/src/login/send.h b/src/login/send.h index 20c184e..1c7ec27 100644 --- a/src/login/send.h +++ b/src/login/send.h @@ -5,5 +5,6 @@ #define EVOL_LOGIN_SEND void send_server_version(); +void send_update_host(int fd); #endif // EVOL_LOGIN_SEND |