# OpenVerse URL Display Module # # Contains functions which are related to displaying # and clicking on URLS offered by people. # # Module Name - URL Module # Current Maintainter - Cruise # Sourced By - InitMain.tcl # # Copyright (C) 1999 David Gale # For more information visit http://OpenVerse.org/ # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, # USA. #NOTE # Now using curley braces around functiosn for greatest speeds # URL's use icons to identify them. We pre-create the photos of them at # startup. image create photo OpenVerse_Image_URL_UNKNOWN -file "$MV(icondir)/unknown.gif" image create photo OpenVerse_Image_URL_DCCFILE -file "$MV(icondir)/dccfile.gif" image create photo OpenVerse_Image_URL_OPENVERSE -file "$MV(icondir)/mv2.gif" image create photo OpenVerse_Image_URL_WEB -file "$MV(icondir)/wwwurl.gif" image create photo OpenVerse_Image_URL_EMAIL -file "$MV(icondir)/emailurl.gif" image create photo OpenVerse_Image_URL_FTP -file "$MV(icondir)/ftpurl.gif" proc ProcURL {who what} { global MV # Get a random screen position (allowing 50sq around it.) # This gives us a grid 16x12. set foundspot 0 set tries 0 while {$foundspot == 0 && $tries < 164} { set x [expr int(rand() * 15)] set y [expr int(rand() * 11)] if !$MV(URLS.$x.$y) { set MV(URLS.$x.$y) 1 set foundspot 1 } update idletasks incr tries } DebugIt "(URL) Using $x $y" other set display 0 set type [URLType $what] # # Process Plugins # foreach plugin $MV(plugin.traps.ProcURL) { if ![$MV(plugin.traps.ProcURL.$plugin) $who $what $type] {return} } switch -exact -- $type { "FILE" { set display 1 set img "OpenVerse_Image_URL_DCCFILE" } "OpenVerse" { set display 1 set img "OpenVerse_Image_URL_OPENVERSE" } "WEB" { set display 1 set img "OpenVerse_Image_URL_WEB" } "EMAIL" { set display 1 set img "OpenVerse_Image_URL_EMAIL" } "FTP" { set display 1 set img "OpenVerse_Image_URL_FTP" } default { set display 1 set img "OpenVerse_Image_URL_UNKNOWN" } } if $display { set MV(urlicon.$x.$y) [.top.c create image [lindex $MV(URLS.x) $x] [lindex $MV(URLS.y) $y] -image $img] if $MV(bell) {bell} InsertIntoChat 1 "\0030,4***\0030,12 URL \0030,4***\00399,99 [Trns from] $who $what" after [expr $MV(urltimeout) * 1000] "DeleteUrl $x $y" .top.c bind $MV(urlicon.$x.$y)