Monday, November 08, 2010 at 12:06 AM.
system.verbs.builtins.tcp.im.server
on server (driverName, screenname, message) { <<Changes <<9/21/02; 6:08:35 PM by JES <<If no responder handles the message, don't send a return message to the sender. Prevents infinite loops when talking to another implementation of tcp.im. <<8/11/02; 7:58:43 PM by JES <<Follow addresses when finding responder tables. Allows for easy installation of drivers by a Tool, for example. local (fldebug = false); if fldebug { if not defined (workspace.message) or string (workspace.message) == "" { wp.newTextObject (message, @workspace.message)}}; local (startticks = clock.ticks (), adr); tcp.im.init (); for adr in @user.im.responders { try { while typeOf (adr^) == addressType { adr = adr^}; if adr^.enabled { if adr^.condition (screenname, message) { try { local (response = adr^.script (driverName, screenname, message)); if user.im.prefs.flLog { tcp.im.log.add ("Response to \"" + screenname + "\": \"" + response + "\", by responder " + nameof (adr^) + ".", startticks)}; return} else { if user.im.prefs.flLog { tcp.im.log.add ("Error response to \"" + screenname + "\": " + tryError + " by responder " + nameof (adr^) + ".", startticks)}; return tcp.im.send (driverName, screenName, "Can't complete your request because an error occurred: \"" + tcp.im.utilities.cleanError (tryerror) + "\"")}}}}}; if user.im.prefs.flLog { tcp.im.log.add ("Error response to \"" + screenname + "\": No responder accepted the message.", startticks)}} <<tcp.im.send (driverName, screenName, user.im.prefs.sorryMessage) <<bundle //test code <<dialog.alert (server ("aim", "xxx", "news"))
This listing is for code that runs in the OPML Editor environment. I created these listings because I wanted the search engines to index it, so that when I want to look up something in my codebase I don't have to use the much slower search functionality in my object database. Dave Winer.