diff options
| author | oroborus <oroborus@0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e> | 2008-08-03 14:17:06 +0000 |
|---|---|---|
| committer | oroborus <oroborus@0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e> | 2008-08-03 14:17:06 +0000 |
| commit | 00c9cebac684c42741e924d11038d5591e87dacd (patch) | |
| tree | a2056cbbf8ae0512ff15e9eb8868ceab29877073 /src/base/proto.c | |
| parent | 1a592767c6e34bdeb7f30fa063b5e24c57d45894 (diff) | |
- trochu rozsirena konfiguracvia, viz http://www.tuxanci.org/server/howto
- moznost logovat so suboru
git-svn-id: http://opensvn.csie.org/tuxanci_ng@188 0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e
Diffstat (limited to 'src/base/proto.c')
| -rw-r--r-- | src/base/proto.c | 62 |
1 files changed, 58 insertions, 4 deletions
diff --git a/src/base/proto.c b/src/base/proto.c index e95ca4e..25bcb61 100644 --- a/src/base/proto.c +++ b/src/base/proto.c @@ -18,6 +18,7 @@ #include "idManager.h" #include "modules.h" #include "protect.h" +#include "serverSendMsg.h" #ifndef PUBLIC_SERVER #include "language.h" @@ -83,20 +84,73 @@ void proto_send_hello_client(char *name) #endif +static void sendInfoCreateClient(client_t *client) +{ + list_t *listClient; + client_t *thisClient; + tux_t *thisTux; + item_t *thisItem; + int i; + + assert( client != NULL ); + + listClient = getListServerClient(); + + proto_send_init_server(PROTO_SEND_ONE, client, client); + +#ifndef PUBLIC_SERVER + proto_send_newtux_server(PROTO_SEND_ONE, client, getControlTux(TUX_CONTROL_KEYBOARD_RIGHT) ); +#endif + + for( i = 0 ; i < listClient->count; i++) + { + thisClient = (client_t *) listClient->list[i]; + thisTux = thisClient->tux; + + if( thisTux != NULL && thisTux != client->tux ) + { + proto_send_newtux_server(PROTO_SEND_ONE, thisClient, client->tux); + proto_send_newtux_server(PROTO_SEND_ONE, client, thisTux); + } + } + + for( i = 0 ; i < getCurrentArena()->spaceItem->list->count; i++) + { + thisItem = (item_t *) getCurrentArena()->spaceItem->list->list[i]; + proto_send_additem_server(PROTO_SEND_ONE, client, thisItem); + } +} + void proto_recv_hello_server(client_t *client, char *msg) { + static char *supportVersion = NULL; char cmd[STR_PROTO_SIZE]; char version[STR_NAME_SIZE]; char name[STR_NAME_SIZE]; - + assert( client != NULL ); strcpy(version, ""); strcpy(name, ""); +#ifdef PUBLIC_SERVER + if( supportVersion == NULL ) + { + supportVersion = getSetting("SUPPORT_CLIENTS", "--support-clients", TUXANCI_VERSION); + } +#endif + +#ifndef PUBLIC_SERVER + if( supportVersion == NULL ) + { + supportVersion = TUXANCI_VERSION; + } +#endif + sscanf(msg, "%s %s %s", cmd, version, name); - - if( strncmp(version, TUXANCI_VERSION, strlen(TUXANCI_VERSION)) != 0 ) + + + if( strstr(supportVersion, version ) == NULL ) { proto_send_error_server(PROTO_SEND_ONE, client, PROTO_ERROR_CODE_BAD_VERSION); eventMsgInCheckFront(client); @@ -134,7 +188,7 @@ void proto_send_status_server(int type, client_t *client) #endif #ifdef PUBLIC_SERVER - name = getServerConfigFileValue("NAME", "noname"); + name = getSetting("NAME", "--name", "noname"); #endif version = TUXANCI_VERSION; |