Added coke group check to ADD
authorJohn Hodge <[email protected]>
Thu, 6 Jan 2011 05:25:30 +0000 (13:25 +0800)
committerJohn Hodge <[email protected]>
Thu, 6 Jan 2011 05:25:30 +0000 (13:25 +0800)
- Also fixed a place where a newline was not sent to the client
- Added a "door" flag

src/cokebank.h
src/server/server.c

index 729d586..2771462 100644 (file)
@@ -20,7 +20,8 @@ enum eCokebank_Flags {
        USER_TYPE_WHEEL  = 0x02,
        USER_TYPE_GOD    = 0x03,
        
-       USER_FLAG_DISABLED = 0x80
+       USER_FLAG_DOORGROUP = 0x40,
+       USER_FLAG_DISABLED  = 0x80
 };
 
 // --- Cokebank Functions ---
index b072652..9cdee83 100644 (file)
@@ -516,7 +516,7 @@ void Server_Cmd_GIVE(tClient *Client, char *Args)
        // Get recipient
        uid = GetUserID(recipient);
        if( uid == -1 ) {
-               sendf(Client->Socket, "404 Invalid target user");
+               sendf(Client->Socket, "404 Invalid target user\n");
                return ;
        }
 
@@ -571,11 +571,15 @@ void Server_Cmd_ADD(tClient *Client, char *Args)
        reason ++;
 
        // TODO: Check if the current user is in coke/higher
+       if( (GetFlags(Client->UID) & USER_FLAG_TYPEMASK) < USER_TYPE_COKE ) {
+               sendf(Client->Socket, "403 Not in coke\n");
+               return ;
+       }
 
        // Get recipient
        uid = GetUserID(user);
        if( uid == -1 ) {
-               sendf(Client->Socket, "404 Invalid user");
+               sendf(Client->Socket, "404 Invalid user\n");
                return ;
        }
 

UCC git Repository :: git.ucc.asn.au