-- "NetOp" Parent Script -- @version 2.0 -- @History -- v.2.0.0 Added method of overriding the callback messages -- @Notes -- Ancestor of the various 'NetOp' scripts property myListeners property myCallbacks on new (me) myListeners = [] myCallbacks = [:] return me end on Destroy (this) myListeners.deleteAll() end on AddListener (this, obj) -- Any object that wants to receive callback messages from this -- widget needs to add itself as a listner object. if not(myListeners.getOne(obj)) then myListeners.add(obj) end if end on RemoveListener (this, obj) -- Any object that wants to stop receiving callback messages from -- this widget can remove itself from this widget's list of listeners. if myListeners.getOne(obj) then myListeners.deleteOne(obj) end if end on SetCallback (me, event, msg) myCallbacks.setAProp(event, msg) end on GenerateEventMessage(this, event, args) msg = myCallbacks.getAProp(event) if args[#errorcode] = "" then args[#errorcode] = 0 if symbolP(msg) then call (msg, myListeners, this, args) else call (event, myListeners, this, args) end on GetErrorDescription (me, errorCode) case errorCode of "OK", "", 0: e = "No error" 4: e = "Bad MOA class. The required Xtras are missing. " 5: e = "The required Xtras are improperly installed or not installed at all." 6: e = "Bad URL or the required Xtras are improperly installed. " 20: e = "Internal error. The browser detected a network or internal error." 4146: e = "Connection could not be established with the remote host." 4149: e = "Data supplied by the server was in an unexpected format." 4150: e = "Unexpected early closing of connection." 4154: e = "Operation could not be completed due to timeout." 4155: e = "Not enough memory available to complete the transaction." 4156: e = "Protocol reply to request indicates an error in the reply." 4157: e = "Transaction failed to be authenticated." 4159: e = "Invalid URL." 4164: e = "Could not create a socket." 4165: e = "Requested object could not be found (URL may be incorrect)." 4166: e = "Generic proxy failure." 4167: e = "Transfer was intentionally interrupted by client." 4242: e = "Download stopped by netAbort(url)." 4836: e = "Download stopped for an unknown reason, possibly a network \ error, or the download was abandoned." otherwise e = "Unknown error code" end case return e end