- Changed ENUM_USERS to return a list of USER_INFO responses.
- Adding stub support for reading user flags from cokebank (TODO:
standardise the flag values)
> Also TODO: Common header for the cokebank (shared between it and the
server)
s 202 Item <item_id> <price> <description>\n
--- Get Users' Balances ---
c ENUM_USERS[ <max balance>]\n
-s 201 Users <count> <username>:<balance>:<flags> <username>:<balance>:<flags> ...\n
+s 201 Users <count>\n
+s 202 User <username> <balance> <flags>\n
+ ...
+s 200 List End
--- Get a User's Balance ---
c USER_INFO\n
s 202 User <username> <balance> <flags>\n
return gaBank_Users[ID].Balance;
}
+int Bank_GetUserFlags(int ID)
+{
+ if( ID < 0 || ID >= giBank_NumUsers )
+ return INT_MIN;
+
+ return gaBank_Users[ID].Flags;
+}
+
int Bank_AlterUserBalance(int ID, int Delta)
{
// Sanity
if( ID < 0 || ID >= giBank_NumUsers )
return 0;
+// printf("gaBank_Users[%i].Flags = 0x%x\n", ID, gaBank_Users[ID].Flags);
+
switch( gaBank_Users[ID].Flags & FLAG_TYPEMASK )
{
case USER_TYPE_NORMAL: return 0;
extern int Bank_GetUserBalance(int ID);
extern int Bank_AlterUserBalance(int ID, int Delta);
extern char *Bank_GetUserName(int ID);
+extern int Bank_GetUserFlags(int ID);
extern int Bank_GetUserByName(const char *Username);
extern int Bank_AddUser(const char *Username);
extern FILE *gBank_File;
return 0;
}
+int GetFlags(int User)
+{
+ return Bank_GetUserFlags(User);
+}
+
/**
* \brief Get the balance of the passed user
*/
// Parse ammount
iAmmount = atoi(ammount);
- if( iAmmount == 0 && ammount[0] != '0' ) return strdup("407 Invalid Argument, ammount must be > zero\n");
+ if( iAmmount == 0 && ammount[0] != '0' )
+ return strdup("407 Invalid Argument\n");
// Do give
switch( DispenseAdd(uid, Client->UID, iAmmount, reason) )