X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=src%2Fserver%2Fserver.c;h=98b032506ebb5254385ee30b619bf64d7446ea80;hb=5ecef433e71d124991201bf97feffd45cb23f8ff;hp=05ee547c2a3fe8999855a55ed9e3296c059ea8c6;hpb=da639e3f13ee62627f4e7b29eccfcac70aad681d;p=tpg%2Fopendispense2.git diff --git a/src/server/server.c b/src/server/server.c index 05ee547..98b0325 100644 --- a/src/server/server.c +++ b/src/server/server.c @@ -25,6 +25,8 @@ #define DEBUG_TRACE_CLIENT 0 #define HACK_NO_REFUNDS 1 +#define PIDFILE "/var/run/dispsrv.pid" + // Statistics #define MAX_CONNECTION_QUEUE 5 #define INPUT_BUFFER_SIZE 256 @@ -215,7 +217,7 @@ void Server_Start(void) // write pidfile { - FILE *fp = fopen("/var/run/dispsrv.pid", "w"); + FILE *fp = fopen(PIDFILE, "w"); if( fp ) { fprintf(fp, "%i", getpid()); fclose(fp); @@ -307,7 +309,7 @@ void Server_Cleanup(void) { printf("\nClose(%i)\n", giServer_Socket); close(giServer_Socket); - unlink("/var/run/dispsrv.pid"); + unlink(PIDFILE); } /** @@ -597,6 +599,7 @@ void Server_Cmd_AUTHIDENT(tClient *Client, char *Args) // Get username via IDENT username = ident_id(Client->Socket, ident_timeout); if( !username ) { + perror("AUTHIDENT - IDENT timed out"); sendf(Client->Socket, "403 Authentication failure: IDENT auth timed out\n"); return ; } @@ -730,7 +733,7 @@ void Server_int_SendItem(tClient *Client, tItem *Item) } } - if( Item->Price == 0 ) + if( !gbNoCostMode && Item->Price == 0 ) status = "error"; // KNOWN HACK: Naming a slot 'dead' disables it if( strcmp(Item->Name, "dead") == 0 ) @@ -810,6 +813,8 @@ tItem *_GetItemFromString(char *String) /** * \brief Fetch information on a specific item + * + * Usage: ITEMINFO */ void Server_Cmd_ITEMINFO(tClient *Client, char *Args) { @@ -830,6 +835,11 @@ void Server_Cmd_ITEMINFO(tClient *Client, char *Args) Server_int_SendItem( Client, item ); } +/** + * \brief Dispense an item + * + * Usage: DISPENSE + */ void Server_Cmd_DISPENSE(tClient *Client, char *Args) { tItem *item; @@ -871,6 +881,11 @@ void Server_Cmd_DISPENSE(tClient *Client, char *Args) } } +/** + * \brief Refund an item to a user + * + * Usage: REFUND [] + */ void Server_Cmd_REFUND(tClient *Client, char *Args) { tItem *item; @@ -919,6 +934,11 @@ void Server_Cmd_REFUND(tClient *Client, char *Args) } } +/** + * \brief Transfer money to another account + * + * Usage: GIVE + */ void Server_Cmd_GIVE(tClient *Client, char *Args) { char *recipient, *ammount, *reason;