5ba @verb #7407:"transfer_bytes transfer_objects transfer_dbytes" this none this rxdo #7407 @program #7407:"transfer_bytes transfer_objects transfer_dbytes" this none this if (!caller_perms():controls(this)) raise(E_PERM) endif {who, amt} = args type = `verb[10..$] ! ANY => raise(E_TYPE, "Invalid type of quota")' typei = type in $quota.types if (amt == 0) return 0 elseif (amt > 0) "Giving quota..." amt = min(this:("free_" + type)(), amt) if ((i = listiassoc(who, this.contribs)) && this.contribs[i][typei + 1]) "Giving Quota Back..." amt = min(this.contribs[i][typei + 1], amt) this.contribs[i][typei + 1] = this.contribs[i][typei + 1] - amt if (this.contribs[i][2..$] == $list_utils:make(length($quota.types))) "Gave all the quota back..." this.contribs[i..i] = {} who.contribs = setremove(who.contribs, this) endif else "Actually giving away quota..." if (!(who in this.contribs)) this.contribs = {@this.contribs, who} endif if (!(i = listiassoc(this, who.contribs))) who.contribs = {@who.contribs, {this, @$list_utils:make(length($quota.types))}} i = length(who.contribs) elseif (length(who.contribs[i]) != length($quota.types) + 1) who.contribs[i][2..$] = $list_utils:make(length($quota.types)) endif who.contribs[i][typei + 1] = who.contribs[i][typei + 1] + amt endif else "Taking quota back..." endif return amt . 0