+ if( !ammount ) {
+ sendf(Client->Socket, "407 Invalid Argument, expected 3 parameters, 1 encountered\n");
+ return ;
+ }
+ *ammount = '\0';
+ ammount ++;
+
+ reason = strchr(ammount, ' ');
+ if( !reason ) {
+ sendf(Client->Socket, "407 Invalid Argument, expected 3 parameters, 2 encountered\n");
+ return ;
+ }
+ *reason = '\0';
+ reason ++;
+
+ // Get recipient
+ uid = Bank_GetAcctByName(recipient);
+ if( uid == -1 ) {
+ sendf(Client->Socket, "404 Invalid target user\n");
+ return ;
+ }
+
+ // You can't alter an internal account
+ if( Bank_GetFlags(uid) & USER_FLAG_INTERNAL ) {
+ sendf(Client->Socket, "404 Invalid target user\n");
+ return ;
+ }
+
+ // Parse ammount
+ iAmmount = atoi(ammount);
+ if( iAmmount <= 0 ) {
+ sendf(Client->Socket, "407 Invalid Argument, ammount must be > zero\n");
+ return ;
+ }
+
+ if( Client->EffectiveUID != -1 ) {
+ thisUid = Client->EffectiveUID;
+ }
+ else {
+ thisUid = Client->UID;
+ }
+
+ // Do give
+ switch( DispenseGive(Client->UID, thisUid, uid, iAmmount, reason) )
+ {
+ case 0:
+ sendf(Client->Socket, "200 Give OK\n");
+ return ;
+ case 2:
+ sendf(Client->Socket, "402 Poor You\n");
+ return ;
+ default:
+ sendf(Client->Socket, "500 Unknown error\n");
+ return ;
+ }
+}
+
+void Server_Cmd_DONATE(tClient *Client, char *Args)
+{
+ char *ammount, *reason;
+ int iAmmount;
+ int thisUid;
+
+ if( !Client->bIsAuthed ) {
+ sendf(Client->Socket, "401 Not Authenticated\n");
+ return ;
+ }
+
+ ammount = Args;
+
+ // Get the start of the reason
+ reason = strchr(Args, ' ');
+ if( !ammount ) {
+ sendf(Client->Socket, "407 Invalid Argument, expected 2 parameters, 1 encountered\n");
+ return ;
+ }
+ *reason = '\0';
+ reason ++;
+
+ // Check the end of the reason
+ if( strchr(reason, ' ') ) {
+ sendf(Client->Socket, "407 Invalid Argument, expected 2 parameters, more encountered\n");
+ return ;
+ }
+
+ // Parse ammount
+ iAmmount = atoi(ammount);
+ if( iAmmount <= 0 ) {
+ sendf(Client->Socket, "407 Invalid Argument, ammount must be > zero\n");
+ return ;
+ }
+
+ // Handle effective users
+ if( Client->EffectiveUID != -1 ) {
+ thisUid = Client->EffectiveUID;
+ }
+ else {
+ thisUid = Client->UID;
+ }
+
+ // Do give
+ switch( DispenseDonate(Client->UID, thisUid, iAmmount, reason) )
+ {
+ case 0:
+ sendf(Client->Socket, "200 Give OK\n");
+ return ;
+ case 2:
+ sendf(Client->Socket, "402 Poor You\n");
+ return ;
+ default:
+ sendf(Client->Socket, "500 Unknown error\n");
+ return ;
+ }
+}
+
+void Server_Cmd_ADD(tClient *Client, char *Args)
+{
+ char *user, *ammount, *reason;
+ int uid, iAmmount;
+
+ if( !Client->bIsAuthed ) {
+ sendf(Client->Socket, "401 Not Authenticated\n");
+ return ;
+ }
+
+ user = Args;
+
+ ammount = strchr(Args, ' ');
+ if( !ammount ) {
+ sendf(Client->Socket, "407 Invalid Argument, expected 3 parameters, 1 encountered\n");
+ return ;
+ }