jftp-1.52.orig/0000700000175000017500000000000011264335556012413 5ustar varunvarunjftp-1.52.orig/CHANGELOG0000700000175000017500000011636211264336747013644 0ustar varunvarun- 1.52-pre3 D. readme updates - 1.52-pre3 D. removed broken what's next and visit hp menu items - 1.52-pre3 D. added command line support for sftp urls - 1.52-pre2 D. fixed progressbar int overflow bug - 1.52-pre2 D. fixed frame inset gui glitches - 1.52-pre2 D. made minor modifications to readme - 1.52-pre2 D. fixed StatusPanel resize UI glitch - 1.52-pre2 D. fixed imports for doc/*.java - 1.52-pre1 D. added JFileChooser for file://-connection in remote tab - 1.52-pre1 D. added hover-effect and hand cursor for directory selector - 1.52-pre1 D. started api cleanup, introduced parameterized types - 1.51-pre6 D. fixed applet System.exit()-bug - 1.51-pre5 D. added fix for >2g ftp transfer bug reported by vasily - 1.51-pre4 D. fixed ftp directory listing bug (freeze when listing too long) - 1.51-pre4 D. fixed missing filesize in download manager - 1.51-pre4 D. improved download manager, added progressbars - 1.51-pre3 D. added gnome icon theme for debian compliance (copy src/images/gnome/* in src/images/current/ and rebuild to use) - 1.51-pre2 D. updated jcifs api to v1.2.7 - 1.51-pre1 D. reintroduced JTable-sorting - this requires java 6 or later - 1.50-pre5 D. removed buggy JTable sorting (will reintroduce it and drop 1.5-compatibility soon) - 1.50-pre4 D. added support for jsch as a j2ssh replacement - 1.50-pre4 D. fixed j2ssh-keyfile-auth on multithreading - thx@Uwe again ;) - 1.50-pre3 D. changed displayer font to monospaced - 1.50-pre3 D. added ftp remote shell (as an option instead of remote cmd) - 1.50-pre3 D. fixed textfield-size bug (proxy+ adv. options) reported by Uwe - 1.50-pre2 D. removed WebDav per default, it shouldn't be usable anyway (I don't know if it makes sense to support it anyway) - 1.50-pre2 D. changed default configuration to disable status animation - the ui responds much faster this way, please take a look at the view menu if you don't already have as this does not affect existing jftp.properties - 1.50-pre2 D. added some rollover buttons and made icons configurable - 1.50-pre2 D. changed icon theme to silk icons (icon selection is far from perfect, please make suggestions if you have any ideas) - 1.50-pre2 D. changed Settings so the API uses safe resuming options per default - 1.50-pre2 D. added wjyangs fix for active ftp port commands - 1.50-pre1 D. started to implement new gui container using a JTable - sorting by clicking on a table header column is enabled in 1.6.0+ per default, the checkboxes will not show up then. 1.5.x does not have this feature (but still the boxes) - 1.50-pre1 D. added option to hide local dot-files - 1.50-pre1 D. added a popup for FTP upload resuming (thx@Uwe Dippel for testing) - 1.50-pre1 D. added Safraz' fix for failed sftp deletes - 1.49-pre6 D. attempt to fix OS/2 parser bug - 1.49-pre5 D. fixed a bug which led to a closed DataConnection.getInputStream() - 1.49-pre5 D. changed FtpConnection.list() from file-based to direct (this changes the BasicConnection-interface, too but the API should now be fully threadsafe even on massive multithreaded io) - 1.49-pre4 D. fixed SFTP close()-exception - 1.49-pre3 D. fixed FTP updatePWD() bug - 1.49-pre3 D. added a possible fix for the sftp upload bug - 1.49-pre2 D. positions of internal frames are now saved and restored - 1.49-pre2 D. fixed an sftp subconnection bug - 1.49-pre2 D. removed old sftp constructors - 1.49-pre1 D. added functionality to launch local (console+gui) applications - 1.49-pre1 D. note: future releases may work on 1.5 only - 1.49-pre1 D. switched to eclipse and did some refactoring - 1.49-pre1 D. repositioned some windows - 1.48-pre4 D. made some performance improvents in the FTP API - 1.48-pre4 D. applied Yang's multiple file download fix - 1.48-pre3 D. more work on the MVS parser - 1.48-pre3 D. changes in the way the FTP API handles return codes - 1.48-pre2 D. fixed SFTP support (bug #1366256) - 1.48-pre2 D. added support for parsing different FTP server newline styles (needed for MVS, enable option in ftp menu. dataconnection will convert line breaks in binary mode then.) - 1.48-pre2 D. streams should now be closed correctly on failed transfers - 1.48-pre2 D. fixed more MVS path bugs - 1.48-pre1 D. implemented ssh shell command history - 1.48-pre1 D. added sftp keyfile authentication support - 1.48-pre1 D. added another small MVS fix - 1.48-pre1 D. removed old insomniac code - 1.48-pre1 D. improved ssh shell gui - 1.47-pre8 D. added remote file renaming support (for file, ftp, sftp and smb) - 1.47-pre8 D. added some small UI fixes - 1.47-pre8 D. added host key verification option for sftp to the menu and some other options to SftpHostChooser (you'll probably need to set up a host.xml in your jre to use this option, though) - 1.47-pre8 D. added a (very basic) ssh shell utility - 1.47-pre8 D. more MVSs work - 1.47-pre7 D. finally updated j2ssh api to v0.2.7 - 1.47-pre7 D. updated jcifs api to v1.2.6 - 1.47-pre7 D. some small bugfixes and enhancements - 1.47-pre7 D. OS/2 should use plain LIST command per default now - 1.47-pre7 D. more MVS debugging and bugfixes - 1.47-pre7 D. made RSS-feed disabled by default - 1.47-pre7 D. added a small log flushing bug - 1.47-pre6 D. added a MVC code fix - 1.47-pre5 D. applied michaels mkdirs()-fix for DataConnection - 1.47-pre5 D. added initial MVS support - 1.47-pre4 D. changed Calendar.compareTo() to Date.compareTo() for jdk1.4-support - 1.47-pre3 D. fixed multithreading for active ftp - 1.47-pre3 D. added small StatusCanvas UI fix - 1.47-pre3 D. changed *HostChooser to use pack() instead of fixed w/h - 1.47-pre3 D. added SMB default option (again) - 1.47-pre3 D. added RSS initialization delay to prevent ui glitches - 1.47-pre2 D. fixed initial ftp sort-by-date code - 1.47-pre2 D. added sorting by date for FilesystemConnections - 1.47-pre2 D. added small image viewer for .gif+.jpg (local dir -> double click) - 1.47-pre2 D. updated jcifs api to v1.2.1 - 1.47-pre1 D. added more RSS fedds and option to select a custom feed - 1.47-pre1 D. added next RSS item button - 1.46-pre5 D. added RSS feed bar (you can disable it using the view menu, or, if you want another one set the jftp.customRSSFeed property to the full URL of the RSS feed. please note that the parser is very basic and might not work with every feed.) - 1.46-pre5 D. fixed some StatusCanvas UI glitches - 1.46-pre4 D. initial date parsing support for unix-style ftp connections (a remote directory sort option is only present for servers using "2005-04-13 23:00" style listings yet) - 1.46-pre3 D. added more delay to FtpConnection as an attempt to fix 1101591 - 1.46-pre3 J. added patch for bug 1143622 (create dir problem) - 1.46-pre2 D. added Dan's NullPointer fix for ui refreshes without using mainframe - 1.46-pre2 D. connections should accept passwords starting/ending with spaces now - 1.46-pre2 D. local copy of file is no longer deleted if a remote file is viewed - 1.46-pre2 D. fixed a sftp upload data corruption bug (BUG 1093305) - 1.46-pre1 D. some code cleanup and javadoc improvement (Local/RemoteDir+StringUtils) - 1.45-pre4 D. added support for another ftp server date listing style - while "Aug 30" was recognized, date formats like "2004-11-18" were not successfully parsed and led to a "not a directory" message and empty remote dir before. - 1.45-pre4 D. fixed some hostchooser bugs introduced in pre3 - 1.45-pre4 D. added d.j.'s SftpConnection bugfix (connections are now closed correctly) - 1.45-pre4 D. local zipfiles can now be unpacked and browsed via doubleclick - 1.45-pre4 D. set Settings.smallSize and smallSizeUp to zero which results in slower communication for multiple small files, but prevents the app from freezing because of too much use of the control connection during upload of multiple selected files via a fast connection - 1.45-pre4 D. using repaint() plus revalidate() from other threads than the EDT without SwingUtilities.invokeLater() now, which seems to fix most of the UI glitches described below - 1.45-pre3 D. moved from paintImmediately() to repaint() again, with the result that the ui is a lot more responsive again. unfortunately this seems to lead to some other kinds of glitches and stability issues like: - missing scrollbars - missing ui unlock after a transfer or delete action - occasional app freeze (maybe related to multiple selections) This will take some time to investigate, help of an UI expert is always welcome :) - 1.45-pre3 D. added gui option to not save cleartext passwords anymore and improved the password management system, some notes: - all stored passwords are still saved in cleartext - passwords are no longer saved per default - passwords in the bookmarks file can be replaced using Settings.hiddenPassword (currently: <%hidden%>), JFtp will ask for a password then - 1.45-pre2 D. initial drag and drop support (tested only with firefox 1.0pr / linux) - drop targets are (for now) the desktop background and the remotedir - only single files can be dropped - files are stored to the current path of the remote connection - 1.45-pre1 D. added workaround for a small ftp upload resuming bug - 1.45-pre1 D. fixed some stability issues when uploading multiple files - 1.45-pre1 D. added an threaded ui refresh daemon for better responsiveness - 1.44-pre3 D. added Klaus' FtpTransfer bugfix - 1.44-pre3 J. added gui dialog for adding bookmarks - 1.44-pre3 J. added cdup button to Local/RemoteDir - 1.44-pre2 D. added small bugfix for bug 961895 - 1.44-pre2 D. initial directory sorting support - 1.44-pre2 J. some code cleanups and small gui improvements - 1.44-pre2 J. advanced options can be saved now - 1.44-pre1 D. bookmarks can be stored in folders now (take a look at doc/bookmarks.txt for format changes) - 1.44-pre1 D. semantic warning messages are no longer displayed - 1.44-pre1 D. catch IOException instead of SocketTimeOutException in DataConnection now - 1.43-pre8 D. added FTP API download(remoteFileName, localFileName) method (FR 943586) - 1.43-pre7 D. smb broadcast ip shows a useful value as default now - 1.43-pre6 D. fixed a FTP total filesize display bug - 1.43-pre6 D. fixed some log autoscrolling bugs - 1.43-pre6 D. made some small socket timeout changes - 1.43-pre6 D. added Peter's patch for bug 935736 - cleanup failed passive ftp transfers - 1.43-pre5 D. added dialog to edit bookmark file - 1.43-pre5 D. initial bookmark menu support - 1.43-pre5 D. removed shift key accellerators because text-edit must be possible now - 1.43-pre4 D. fix-attempt for small new directory upload bug introduced in pre3 - 1.43-pre3 D. fixed a FTP directory upload bug investigated by Richard (upload failed if target directory did already exist, client+api) - 1.43-pre2 D. fixed a FTP API transfer status bug for failed DataConnections (thx for debugging @ Richard Krutisch) - 1.43-pre1 D. more webdav work - 1.43-pre1 D. fixes a small OS/2 manual dirchange refresh bug - 1.42-pre6 D. another (final?) OS/2 parser fix - thx to Mark Hale for debugging! :) - 1.42-pre6 D. fixed two minor command line ftp url bugs - 1.42-pre5 D. re-enabled background image and added new image (created using madonion's (kasten.m@gmx.de) StrangeAttractor image generation code) - 1.42-pre5 D. more OS/2 parsing fixes - 1.42-pre4 D. added log-flushing background thread - 1.42-pre4 D. initial OS/2 FTP parsing support (bug 891346, needs testing) - 1.42-pre4 D. added compatibility LIST support option to HostChooser (needed for OS/2) - 1.42-pre3 D. disabled background image per default - 1.42-pre3 D. changed default window size to 840x640 - 1.42-pre3 D. changed default theme to metouiae - 1.42-pre3 D. fixed StatusPanel appearance bug when switching to metouia - 1.42-pre2 D. initial (readonly) WebDAV support using the slide webdav API - downloading and browsing using the (unauthenticated) testserver works, but there is much work left. - 1.42-pre1 D. added field to specify a WINS server IP to SMBHostChooser as an attempt to fix SMB problems (bug 799534) you may need it to access hosts on different subnets where broadcast fails - 1.42-pre1 D. fixed bug 741640, JConnection closes sockets now - 1.42-pre1 D. added method to change the default "LIST -laL" command to the advanced options (test for bug 891346) - 1.42-pre1 D. added new advanced options menu item - 1.42-pre1 J. fixed password parsing bug (bug 866724) - 1.41-pre1 D. improved http recursive download utility - 1.41-pre1 D. changed http tools to use internal frames - 1.41-pre1 D. minor readme updates - 1.41-pre1 D. improved internal frame management - 1.41-pre1 D. added close button to local and remote connection frames which appear when more than one tab is open - clicking on it closes the current active tab (the fsconnections and the frame itself can not be closed) - 1.41-pre1 D. added SMBHostChooser broadcast ip field and added small insets - 1.41-pre1 D. removed SMB "sortLs: trying" debug message - 1.40-pre6 D. enabled new symlink removal code for FilesystemConnection - 1.40-pre6 D. added SFTP port option - 1.40-pre6 J. added SMB connection remembering fix - 1.40-pre5 D. attempt to fix a local parsing bug for solaris - 1.40-pre4 J. added connection remembering functionality to menubar - 1.40-pre4 J. refactored *HostChooser classes - 1.40-pre4 J. added missing tooltips to queue and download manager - 1.40-pre3 D. added getTransferStatus-method to FtpTransfer - 1.40-pre2 D. disabled upload resuming by default (may lead to corrupted files otherwise occasionally) - 1.40-pre2 D. merged with recent ftp api code, FtpTransfer can store with different name now - 1.40-pre1 D. added applet-support - try using doc/applet.html - 1.39-pre1 D. completely disabled symlink removal. this fixes at least some (mine) and hopefully all of the reported dataloss bugs. even though i still don't know how file deletion can start itself on an appcrash the deletion of symlinks pointing to other directories leads to the deletion of those. what happened to me is that a symlink in a directory i wanted to delete pointed to my homedir and i lost half of my personal data, including the latest prerelease sourcecode. i'll release this version now as a bugfix-only release. if you encounter any dataloss bugs with this version, please report them immediately. - 1.39-pre1 D. added Herve's build.xml properties bugfix - 1.38-pre5 D. removed virus infected file "RPC*.exe" from the build directory. note that this file got there while i was using it as a test file for transfers while implementing local connections. unfortunately, until the local paths were fixed for the connections some of the test files were transfered in the build directory which i didn't notice. NOTE: This file was *never* executed by the code and should not have been there! - 1.38-pre5 D. applied Jake's keyboard shortcuts and AppMenuBar improvements - 1.38-pre5 D. fixed a *harmless* SFTP recursive deletion bug while investigating a bug report. somebody reported sftp would have deleted his root and /usr/local dirs and, if anybody has noticed the deletion of *any* file which was not previously selected to be deleted, please tell us *immediately*. i did not find any harmful code and received no other bug report yet. - 1.38-pre5 D. fixed new ftp connection bug introduced in pre-4 - 1.38-pre4 D. improved insomniac client - 1.38-pre4 D. tabs are no longer created if a login failed - 1.38-pre3 D. added ability to start up as insomniac client - 1.38-pre2 D. added insomniac threading and downloadmanager support - 1.38-pre2 D. new connection dialog is now longer modal - 1.38-pre1 D. initial insomniac support - 1.37-pre5 D. updated readme - 1.37-pre5 D. improved sftp, nfs and smb connection linking support - 1.37-pre4 D. added upload(String file, InputStream in) and getDownloadInputStream(String file) to BasicConnection - 1.37-pre4 D. more connection linking work - 1.37-pre3 D. fixed file deletion abort bug where ui stays locked - 1.37-pre3 D. fixed desktop background resize bug (bug 809992) - 1.37-pre3 D. fixed ftp multi line answer parsing bug - 1.37-pre2 D. attempt to fix smb problems (bug 799534) - 1.37-pre2 D. fixed some disconnects when creating new connections - 1.37-pre2 D. ftp connections can now transfer files between each other, too - 1.37-pre1 D. inital: ftpconnections can now be in the local tab, too (does only work with remote file connection yet) - 1.37-pre1 D. added methods to upload from / download to InputStreams to the ftp API - 1.36-pre2 D. added file view (local only) and properties to popup menu. - 1.36-pre2 D. added popup menus for local and remote dir entries - 1.36-pre2 D. proxy options and url contents are now displayed in internal frames - 1.36-pre2 D. improved desktop background (uses j-ftp/src/images/back.jpg, can be turned off in view menu) - 1.36-pre2 D. added multiple parallel remote connection support - 1.36-pre1 D. applied walluck's theme-listing bugfix for metuoia theme - 1.36-pre1 D. applied walluck's signjar build.xml patch - 1.35-pre5 D. updated j2ssh api to v0.2.5 - 1.35-pre5 D. applied walluck's theme-bugfix patches - 1.35-pre5 D. applied walluck's .jftp-directory path patch - 1.35-pre4 D. fixed ftp wrong login nullpointer exception - 1.35-pre3 D. fixed ftp recursive deletion bug - 1.35-pre2 D. merged api changes - 1.35-api D. added ability to get/abort the last spawned transfer - 1.35-pre1 D. initial upload resuming support (enabled per default) - 1.34pre3 D. initial socks proxy support - 1.34pre3 D. added jeffdahl's FtpConnection.rename method - 1.34pre2 D. fixed a SFTP directory transfer bug - 1.34pre1 D. updated jcifs SMB api to v0.7.11 - 1.33pre2 D. api-backport: fixed upload under different name, ist now upload(String file, String realName) - 1.33pre2 D. api-backport: added exists()-method in FtpConnection - 1.33pre1 D. improved the connection chooser to show a busy cursor while connecting (request 737502) - 1.33pre1 D. fixed ui bug for host, user and pass textfield in ftp hostchooser - 1.33pre1 D. added anonymous login checkbox for ftp (request 737482) - 1.33pre1 D. added more tooltips (request 741624) - 1.32pre2 D. added new "metouia" theme - check it out, it's really nice! - 1.32pre2 D. added multithreading and enhanced download tool url parsing - 1.32pre2 D. fixed connection problems for download tool - 1.32pre1 D. initial HTTP recursive download support - 1.31 D. merged api changes with the main source tree - 1.31-api D. added/improved return codes for up/download/remove methods, BasicConnection interface changes - 1.31-api D. improved documentation code, some code cleanups - 1.31-api D. fixed a log4j initialisation bug - 1.31-api D. improved ftp api javadoc, especially for the FtpConnection class - 1.31-api D. created a separate commercial branch of the ftp api for a customer - 1.30pre3 D. made bottom toolbar non-floatable (bug 741635) - 1.30pre2 DP. DownloadQueue does no longer reconnect if the next file is on the same server - 1.30pre2 DP. removed some obsolete debug messages - 1.30pre1 D. fixed crash on filezilla ftp server response code parsing for mkdir command - 1.29pre1 D. improved interface guessing for smb connections and changed the JTextField to a JComboBox - 1.29pre1 DP. daniele's download queue system has landed (!) - 1.28pre4 D. changed Displayer to use a JInternalFrame in most cases - 1.28pre4 D. made downloadDir() private, use download()/handleDownload() for both files and dirs now if you embed the api - 1.28pre4 D. fixed filesize for uploads - 1.28pre3 D. changed buttons to standard ones - 1.28pre2 D. improved raw tcp/ip connection tool a little bit - 1.28pre2 D. fixed SFTP directory removal bug - 1.28pre2 D. fixed a SFTP connection bug which caused the directory listing not to be displayed after connect - 1.28pre2 D. applied patch for standalone/dispose mode - 1.28pre2 D. fixed raw QUIT command bug - 1.28pre2 D. moved status bar to the bottom of the frame - 1.28pre2 D. more nfs support work - 1.28pre2 D. debug messages from log are now in console debug, too - 1.28pre1 D. added initial NFS support using sun webnfs api - 1.27pre3 D. added raw tcp/ip connection tool - 1.27pre3 D. added visit homepage menu option - 1.27pre3 D. updated readme - 1.27pre3 D. added small html browser and download tool (using html 3.2 compatible JEditorPane) - 1.27pre3 D. fixed unix parser bug (used backup parser for first line if ls output sends a total x info and failed) - 1.27pre3 D. fixed name parsing for files containing spaces - 1.27pre3 D. address bar opens a connection window now if a ftp url represents a directory - 1.27pre2 D. added background image to desktop (replace src/images/stdback.gif and recompile for a custom image) - 1.27pre1 D. added new address bar to directly download urls using the standard java api - 1.27pre1 D. added http download tool and implemented initial downloadmanager functionality - 1.27pre1 D. added some more keyboard shortcuts - 1.26pre3 D. enhanced GUI, added a desktop, internal frames and customizeable toolbars - 1.26pre2 D. made remote filesize listing safer - 1.26pre2 DP. added ftp port field bugfix (is also saved now) - 1.26pre1 D. added notes for use of the ftp api in commercial applications - 1.25pre2 D. fixed windows server support - 1.25pre2 D. added detailed debug console messages for parsing of directory listing - 1.25pre1 D. ftp resume and overwrite now follow thread spawning rules, too - 1.25pre1 D. log can now be disabled - 1.25pre1 D. added debug mode and messages - 1.25pre1 D. ensure logging on important events - 1.24pre2 D. fixed documentation code and added comments - 1.24pre1 D. improved ui responsiveness and removed log spamming - 1.24pre1 D. removed some obsolete mode calls and dir refreshes for better performance ------------------------------------------------------------------------------------------------------ - 1.23pre4 D. fixed ftp link parsing bug - 1.23pre4 D. remote filesystem dir does work now if a connection has failed to login before - 1.23pre4 D. window no longer disappears if ftp login failes - 1.23pre4 D. app no longer asks for each file to delete - 1.23pre4 D. fixed no dir refresh bug for SMB, SFTP threaded transfers - 1.23pre4 D. changed gui refresh code a little bit again - 1.23pre4 D. added .iso icon extension - 1.23pre3 D. added multithreading options for SMB and SFTP to the JMenuBar - 1.23pre2 D. removed obslote awt stuff for SFTP authentication - 1.23pre2 D. SMB and SFTP are now multithreaded, too - 1.23pre1 D. changed SMB error message if master not found ------------------------------------------------------------------------------------------------------ - 1.22 D. use space to cycle between local and remote dir - 1.22 D. implemented remote file viewing - 1.22 D. cursor is now busy when refreshing directories - 1.22 D. enter does now open a selected directory - 1.22 D. try to fix a windows/dos ftp parsing bug - 1.22 D. fixed classloader bug bug for UIManager - 1.22 D. show path change dialog the connection:path label is clicked - 1.22 D. added dialog to confirm deletion of files and option in the menu - 1.22 D. added Kunststoff theme and made it default - looks quite nice! - 1.22 D. try to fix a loop forever bug on SMB connections for people with firewalls quietly dropping connections - 1.22 D. fixed link parsing bug for ftp directory listings (tru64 bug) - 1.22 D. changed the backgroundcolor of some components - 1.22 D. changed font to Arial for most components - 1.22 D. fixed NullPointer for remoteDir, too - 1.21 D. fixed file specific downloadmanager icons - 1.21 D. fixed a NullPointer when when deleting the last listed file - 1.21 D. safe menu options are now saved - 1.21 D. added menu options to change the look and feel - 1.21 D. clear log with alt-1 now - 1.21 D. doubleclick now opens html, rtf and plain files in a JEditorPane instead of transferring them (local dir only) - 1.21 D. made Transfer an interface - 1.21 D. fixed an ui refresh bug - 1.21 D. made FilesystemConnection show transfers in the downloadmanager, too - 1.20 D. remove some debug messages - 1.20 D. stripped down included j2ssh version - 1.20 D. selected files are now reselected if the listing has not changed but was refreshed - 1.20 D. fixed NullPointers for resume, pause and stop on other connections than ftp - 1.20 D. implemented filesizes and parts of permissions permissions for SFTp connections - 1.20 D. SFTP connect bugfix - 1.19 D. fixed some SFTP bugs and added debug messages, improved performance - 1.19 D. fixed an ArrayIndexOutOfBoundsException in the downloadmanager - 1.19 D. improved ui refreshing - 1.19 D. stripped down included log4j version - 1.19 D. added initial SFTP support - 1.18 D. SMB connections do now use the download manager, too - 1.18 D. changed display style for SMB connections - 1.18 D. ftp specific buttons are now hidden for other connections - 1.18 D. fixed chdir-bug, no longer entering denied directories in SMB and file connections - 1.18 D. added multiple interface support for SMB connections - 1.18 D. fixed SMB authentication support - 1.17 D. removing classes dir per default to save space - 1.17 D. added "clear log" to menu - 1.17 D. improved performance of log display JTextArea - 1.17 D. added debugRaw for Logger to support "fake" progress bars in log JTextArea - 1.17 D. blocking for file and SMB io - 1.17 D. fixed ".ls_out" transfer not hidden on windows - 1.17 D. disable remote commands for non-ftp connections - 1.17 D. added LAN browsing feature for SmbConnection - 1.17 D. added full SMB (windows share) support (using jcifs.samba.org api) - 1.17 D. fixed possible cdup() api bug - 1.16 D. added icons for the downloadmanager - 1.16 D. added status animation and did some ui polishing - 1.16 D. implemented local to local directory transfer - 1.16 D. remove obsolete pwd updates - 1.16 D. fixed a parsing bug in StringUtils.isRelative() - 1.16 D. changed labels to show current type of connection - 1.16 D. added disconnect option so you can toggle between ftp- and fsconnections - 1.16 D. added JMenuBar to have more space to add functionality - 1.16 D. made the app 40px higher per default and changed icon arrangement a little bit - 1.16 D. moved remote listing and transfer type to RemoteDir - 1.15 D. added version information to window title - 1.15 D. made windows version stable, too - 1.15 GD. added enhanced run.bat and updated readme file - 1.15 D. fixed a possible ls output parsing problem - 1.15 D. java web start support - 1.14 D. listing message is hidden now - 1.14 D. moved AutoRemover functionality into local/remote dirs - 1.14 D. fixed local remove selected bug on multiple selected files - 1.14 D. fixed documentation code - 1.13 D. fixed ZipEntry bug on no permission - 1.13 D. fixed refresh spamming and NullPointers - 1.13 D. fixed NullPointer when copy is called without a file selected - 1.13 D. move more methods to util/StringUtils.java - 1.13 D. app has now 2 local dirs at startup - 1.13 D. no need to establish a connection at startup anymore - 1.13 D. local dir(s) are now using a FilesystemConnection for io - 1.13 D. made an interface BasicConnection to replace FtpConnection and allow other connection types - 1.12 D. disabled update feature per default (stalls too often) - 1.12 D. added copy method to local dir - 1.12 D. added ability to create zipfiles in local dir - 1.12 D. changed icon type and arrangement for local and remote Dir - 1.12 D. the first transfer is selected per default again - 1.12 D. deleting of paused transfers is now possible again - 1.12 D. changed refresh code and fixed ui glitches in the downloadmanager - 1.12 D. added ConnectionListener localDir - 1.12 D. FtpConnection does now support multiple ConnectionListeners - 1.12 D. use default dir checkbox is now remembered, too. - 1.12 D. made downloadmanager a little bit bigger - 1.12 D. changed filesize type to long, added filesize for uploads - 1.12 D. some gui code cleanups and reorganisation - 1.12 D. split up DirPanel in LocalDir and RemoteDir - 1.11 D. changed downloadmanager from JTextArea to nicer looking JList - 1.11 D. event handling is now separate from the downloadmanager - 1.11 D. added debug messages for update check, to see if the client stalls (happens occasionately) - 1.11 D. fixed connection remove problem when transferring directories - 1.11 D. added Grapher.java (just a toy, but it could be modified to show how classes interact) - 1.10 D. added actionFinished() to ConnectionListener - 1.10 D. fixed no local refresh on download bug - 1.10 D. more api cleanups - 1.10 D. directory transfers can now be stopped - 1.10 D. directory transfers are now shown a a single item in downloadmanager - 1.09 D. fixed download manager pause, resume and delete bugs - 1.09 D. beginning to change everything not needed by other classes to private access - 1.09 D. implemented better bidirectional communication between application and connection - 1.09 D. ConnectionHandler is no longer static, so a handler per connection can be used - 1.09 D. FtpConnection does event triggering directly now an no longer via ConnectionHandler - 1.08 D. tried to fix ui NullPointer bugs (please look for them in the console and report them) - 1.08 D. fixed remote directory creation bug (affected windows only) - 1.07 D. fixed client crash bug when doing something while a connection was starting - 1.07 D. updated TODO and documentation code - 1.07 D. fixed icon for .tgz files - 1.07 D. fixed some remote directory refreshing bugs - 1.07 D. fixed local windows pathname recognition - 1.06 D. cleaned up the tranfer handling code in FtpConnection - 1.06 D. added multithread support for directories, too - 1.06 D. some DownloadManager fixes - 1.06 D. fixed local directory refresh bug - 1.06 D. single files are now uploaded multithreaded, too - 1.05 D. fixed relative path name recognition for FtpConnection.upload() and FtpConnection.download() - 1.05 D. changed offending debug message in FtpConnection and message in DataConnection - 1.04 D. applied loen's remote directory deletion bugfix - 1.04 D. fixed documentation code and added FtpUpload.java - 1.04 D. added auto-update-download-routine (please check manually from time to time, it might be buggy) - 1.03 D. add smart download routine - files smaller than Settings.smallSize (100kb default) are now downloaded without a new connection - 1.03 D. downloadmanager no longer refuses to resume downloads after queue is full (paused item included) - 1.03 D. fixed some bugs for pause, resume and delete (sometimes wrong items were selected) - 1.03 D. client no longer hangs when queueing more than 1 item - 1.03 D. writable files are colored now, too - 1.03 D. to be able to view selections now the font is colored, not the background - 1.03 D. fixed window location bug (window was moved some pixels after each restart) - 1.02 D. added delay for DownloadList.updateList to increase performance and prevent bugs - 1.02 D. fixed client crash when no permission to upload is granted - 1.02 D. changed finished to failed for failed transfers - 1.02 D. removing directories is fixed now - 1.02 D. made some dirty bugfixes to prevent DirPanel NullPointers - 1.01 D. fixed transfer multiple selected files bug (again) - 1.01 D. fixed non-closeable info-window bug - 1.00 D. made new connection and type toggle no longer work while app is blocked to prevent bugs - 1.00 D. window size and position are now remembered correctly when closing via exit button - 1.00 D. added "background reconnection" mode - if a server is busy the user can select to hide the windows and infinitely try to relogin - 1.00 D. added console-message if property file is not found - 1.0pre4 D. recursive download blocks again to prevent errors with local path change - 1.0pre4 D. auto-reconnect to servers which are full - turn off Settings.reconnect if you don't like this - 1.0pre4 D. fixed another DirPanel-NullPointer - 1.0pre4 D. filesizes are now correct after changing cwd, too - 1.0pre3 D. fixed possible crash on delete of queued items - 1.0pre3 D. users can't try to download a single file twice a time any more - 1.0pre3 D. fixed transferred byte count when resuming - 1.0pre3 D. fixed ArrayIndexOutOfBoundsException when doing a cd .. - 1.0pre3 D. implemented pause and resume in downloadmanager - 1.0pre3 D. fixed put instead of get message when resuming - 1.0pre2 D. disabled safeMode pre default, this should bring a small performance improvement (view readme) - 1.0pre2 D. fixed some ui-nullpointers in DirPanel - 1.0pre2 D. minor documentation updates - 1.0pre2 D. disabled autoresuming in the api to prevent bugs (this does not affect the gui client, see 3.3 in the readme) - 1.0pre2 D. fixed resuming bug reported by sandy - existing files are not auto-resumed any more to prevent resuming the wrong file, added ResumeDialog class which asks for the desired action if a file does already exist - 1.0pre2 D. renamed FtpConnection.setRemotePath() to chdir(), unparsed chdir is now chdirRaw() - 1.0pre1 D. add log window if a connection fails - 1.0pre1 D. fixed a few JConnection/FtpConnection NullPointers - 1.0pre1 D. split DirPanel and made it extend a base class TransferComponent - 1.0pre1 D. cleaned DirPanel a little bit - 1.0pre1 S. if multiple files were selected only the first was downloaded due to DirPanel refresh, fixed now - 1.0pre1 S. fixed HostChooser-UI bug - 0.99 D. fixed example code and added build target "compiledoc" - 0.98 D. added queuing instead of blocking for multithreaded mode - 0.98 D. updated readme - 0.98 D. changed "cancel transfer" to just close the socket - 0.98 D. simplified clear and selection-method of downloadmanager - 0.98 D. made getPasvPort() like the rfc wants it - 0.98 D. made multiple parallel downloads default - 0.98 D. fixed url-support - 0.98 G. starts to add sftp support - 0.97 D. added rotate-method to toglle downloads - 0.97 D. moved clear downloads button into new created download toolbar - 0.97 D. downloads can now be cancelled in threaded mode - 0.96 D. added some delays to prevent ui-nullpointers - very strange bugs - 0.96 D. added command output window - 0.96 D. changed queueing code and merged it with threading support - 0.96 D. fixed serious multiple download bug - 0.96 G. improved commandline client - 0.95 D. added active mode fallback for servers not implementing pasv mode - 0.95 D. added type L 8 mode to switching method - 0.95 D. increased socket timeout - 0.95 D. fixed bug which prevented the properties to be saved - 0.95 D. added download output - 0.94 D. added experimental multithreading support - 0.94 D. local permissions are now colored, too - 0.94 D. fixed a ls -laL parsing bug - 0.93 D. support for VMS servers (directory listing style) - 0.93 D. files the user has no permissions to download are marked red now - 0.93 D. links are now resolved correctly - 0.93 D. cleaned up the listing methods a little bit - 0.92 D. small ui improvements for Creator, PathChanger and RemoteCommand - 0.92 D. user can now change transfer mode - 0.92 D. it is now possible to descend into directories represented by links - 0.92 D. improved link detection - 0.92 D. no longer freezes on a permission denied response - 0.91 D. hitting enter in JPasswordField connects to server now - 0.91 D. made some gui improvements - 0.91 D. made passive ftp default again - 0.91 D. fixed serious timeout bug in DataConnection - 0.90 D. removed experimental status of active ftp - 0.89 G. print out ftp commands being executed - 0.89 G. initial checkin of simple ftp server (implements LANG rfc 2640) - 0.89 G. fix JSplitPane to work better under Java 1.4 - 0.88 D. client may exit if no connection is wanted - 0.88 B. gui improvements - 0.88 B. clients no longer hangs after successful PORT cmd - 0.87 D. made local setPath no longer get obsolete remote pwd - 0.87 D. use JFileChooser for local directory changing - 0.87 D. do remoteUpdate after remoteCmd - 0.87 D. made size-logging timebased, doing better progress output - 0.87 D. gathering better information about transferred bytes now - 0.87 D. improved IO for uploading - 0.87 D. fixed missing filesize-update for non-resumed downloads - 0.87 D. made ui refresh while up/downloading - 0.86 D. changed FtpConnection.up/download to be blocking, some servers didn't work if commands were sent while a DataConnection was open... (affected only downloads which took > a few seconds) - 0.85 D. client does not open HostChooser again if login fails - 0.85 D. login() in FtpConnection now returns a status message - 0.85 D. added bashscript run for task below - 0.85 D. jar can now take an URL as argument and launches this immediately - 0.85 R. userdata is now in $HOME - 0.85 R. improved FtpConnection - 0.85 G. getOsType now uses SYST - 0.85 G. added FtpURLConnection - 0.84 D. changed LayoutManager for DirPanel, resizes now better - 0.84 D. fixed refresh-problem - 0.84 D. files are now sorted alphabetically in DirPanel - 0.84 D. (re)implemented filesizes in ListModel - 0.84 D. added image for cmdButton in DirPanel - 0.84 D. set ftpPasvMode default to false (active mode testing) - 0.83 D. fixed active mode ftp and added checkbox + property - 0.83 D. some cleanups and documentation - 0.83 D. created GUIDefaults, core api now no longer needs X - 0.83 D. put localPath in FtpConnection - 0.83 D. more net layer restructuring, can now be used standalone - 0.83 D. moved control options to FtpConnection instead of Resource - 0.83 D. restructuring of the net layer, introducing ConnectionHandler - 0.83 T. added a new and nicer hostlist - 0.83 D. fixed small setLocation() bug, changed JSplitPane sizes - 0.83 G. config values can now be stored in a property file - 0.83 G. reimplemented second JSplitPane - 0.83 G. remember last window size and location - 0.82 D. Displayer shows now the top of the file, not the end - 0.82 D. reimplemented StatusCanvas - 0.82 D. app now disconnects on exit or new connection - 0.82 D. added "use default dirs" option to hostchooser - 0.82 D. fixed nullpointerexception due to mousewheel-scrolling in dirpanel - 0.82 D. speed improvement on file deletion - 0.82 D. fixed paths for files in jar-file as Paul suggested - 0.82 P. added invokeLater() jesktop-bugfix - 0.82 D. fixed JSplitPane-resize-bug - 0.82 D. do link parsing when deleting files, too - 0.82 D. fixed delete selected bug - 0.82 G. added JSplitPane - 0.82 G. remembers window size - 0.81 D. single delete button now removes all selected files/dirs - 0.81 D. failed download no longer leaves a 0 byte file - 0.81 D. FtpConnection can now use server-default as startup dir - 0.81 D. put 2 options from net/Resource in config/Settings, minor cleanups - 0.81 G. speed improvements for icon loading - 0.81 G. io-improvements - 0.81 G. buffersize in Settings, File.seperator is now used - 0.81 D. removed jesktop-frimble.jar from cvs - 0.81 D. put string methods from net/Resource to util/StringUtils - 0.81 D. packaging (net.sf.jftp.*;) - 0.81 D. (re)enabled hostlist on clean builds - 0.81 D. changed default build to "jars", deprecation off - 0.81 D. added real changelog - 0.81 P. now using cvs - 0.81 P. now using ant as build method - 0.80 D. parse symlinks correctly if downloading - 0.80 D. ability to view remote dir listings - 0.80 D. fixed recursive permission denied bug - 0.79 D. fixed relayout while loading - 0.79 D. give output on console while loading - 0.79 D. fixed nasty upload-bug - 0.78 D. fixed nasty mp3-icon-crash bug - 0.78 D. gui is now 100% swing - 0.78 D. dataconnection uses now separate thread correctly - 0.77 D. fixed some gui-bugs - 0.77 D. jesktop-compatibility - 0.77 D. uses now jar-file, getResource-updates jftp-1.52.orig/readme0000700000175000017500000003175111264340524013574 0ustar varunvarunLast update: 10/11/2009 13:30 CET --- >1.52< -------------------------------------------------------------------------------- >>> Contents <<< 1. Setup 1.1 How do i run JFtp? 1.2 What about compiling? 1.3 Updates 1.4 Compatibility 1.5 Why do you use so many other APIs? 1.6 What about those themes? 1.7 Using JFtp as an applet or via webstart 2. Features 2.1 General features 2.2 Multiple parallel downloads 2.3 You do not support the ??? command! 2.4 SMB specific info 3. Tweaking / Bugs 3.1 Changing options in Settings.java 3.2 I found a bug! 3.3 I see no icons! 3.4 Tips and tricks 4. The team 4.1 Wo is involved in this project? 4.2 Submitting patches 4.3 Hompage 5. API License 5.1 Using the API in your own applications 5.2 Use in commercial products -------------------------------------------------------------------------------- --- NOTICE --- Updates are released quickly after coding, so please report bugs to j-ftp-devel@lists.sourceforge.net if you encounter them... :) -------------------------------------------------------------------------------- 1.1 How do i run JFtp? Unpack the .tar.gz to a java conform path (no exclamation mark, tab etc) To start JFtp just call "run" (*nix) or "run.bat" (Windows/DOS). Alternatively type "java -jar jftp.jar" in build/jars/ You can also add a command-line url, for example: java -jar jftp.jar "ftp://anonymous:test@ftp.kernel.org/pub" or run.bat "ftp://anonymous:test@ftp.kernel.org/pub" This works for SFTP now, too if you replace ftp:// with sftp:// 1.2 What about compiling? JFtp is already compiled if you have downloaded it in a .tar.gz. Recompile using "ant clean" and "ant" in j-ftp/ - of course you'll need the ant tools installed. 1.3 Updates If we have important changes we usually release immendiately. Sometimes we release a few versions a week, sometimes the developement stalls for some time. If you have created patches or want to code on JFtp, please send a mail to me or directly to the mailing list. Binary prereleases are available via Java Web Start. You can also load the jar directly: http://j-ftp.sourceforge.net/jftp.jar If you found a critical bug, please mail it (see 3.2 for instructions). We'll try to fix it asap. 1.4 Compatibility JFtp should work with all platforms. However, i'm not able to test it under different platforms often, so it may run less stable there than with linux. If you encounter a java.lang.UnsupportedClassVersionError please make sure to either recompile it with your java version or update you JRE. 1.5 Embedded APIs All APIs used by JFtp that are not written by myself and the other project members have a free (GPL/LGPL) license. These include: - jcifs for the SMB protocol, very nice API. - j2ssh for SFTP, a rather big but very good API. - webnfs for NFS, downloaded from Sun Microsystems, it took me a while to get things working because there was just a small subset of NFS info in the javadoc and not that much demos. But the API itselfs rocks, too - it is fast, stable and more than just a NFS API, but a replacement for the File class with network support. - apache.org: commons, log4j, webdav ... 1.6 The themes... ...come from http://www.incors.org/ and http://mlf.sourceforge.net Much better even than swing in my opinion... :) And finally there are those neat litte Icons: - http://www.famfamfam.com/lab/icons/silk/ - http://art.gnome.org/themes/icon/1352 - The jayalobby icons are copyrighted by Dean S. Jones 1.7 Integration JFtp If you want to use JFtp as an applet or launch it via webstart please look at doc/applet.html and doc/jftp.jnlp for examples. -------------------------------------------------------------------------------- 2.1 General features JFtp is a multi-platform, multi-protocol network browser. It started as a ftp client with its own api and has grown to support file, ftp, smb, http, sftp, nfs and raw tcp/ip connections using standard or 3rd-party apis. Some words about the ftp features: It can up- and download directories recursively, resume ftp up- and downloads automatically, has a download manager and a nice swing ui. Active and passive mode ftp are supported and the parsing of the directory listings is very robust. You can also ftp mutithreaded, which means that you can browse the server and transfer files/dirs at the same time (see "Multiple parallel transfers" below). 2.2 Multiple parallel transfers Use multiple connections parallel to save time, for example if a server has a bandwith limit. If a server allows only one connection at a time you'll have to uncheck "Multiple Conenctions", though. You can increase the number of parallel connections manually when initiating a connection. Passive ftp is recommended because multiple connections do not work with active ftp. 2.3 You do not support the ??? command! Use "Execute remote command" if you have to use commands not implemented directly in JFtp, such as changing permissions of files. If it would make sense to add support directly, send a mail to the mailing list and/or write a feature request on our sourceforge-site. :-) 2.4 SMB specific info Note that if you have multiple network cards and get an error messag containing MSBROWSE when browsing the lan this probably happens because the wrong adapter is chosen. You have to temporaryly disable the other card and restart to use this feature atm, since there is no fix yet. -------------------------------------------------------------------------------- 3.1 Changing options in Settings.java If you want to activate some other options just edit src/Settings.java and recompile using "ant" in j-ftp/ Notes: There are some interesting options you can manually tweak in Settings.java. You need to recompile, of course... >>> uiRefresh minimal amount of time between ui refreshes caused by JFtp.log(). 500 milliseconds seem like a safe default, but if you recompile you probably want to play with this. >>> enableMultiThreading uses different threads and connections so you can browse the server while up- and/or downloading (single files, not directories). Does not work on servers with a limit of connections per user, but for servers supporting it you should set this to true (can be set via gui, too). >>> noUploadMultiThreading do not use different connections for uploads. >>> maxConnections use up to this many connections to up- and download. >>> smallSize if file is smaller than this it will be downloaded using the normal control connection, this results in a faster transfer blocking, but most times even faster than the initial blocking when forking a download. >>> smallSizeUp same as above for uploads. >>> enableResuming false for the API (overwrite default), overridden to true by JFtp. >>> enableUploadResuming default: true >>> askToResume change this to false if you don't want any messages, but note that if you have an older but smaller file you probably don't want it to be autoresumed >>> connectionTimeout timeout for a connection to a server, default should be ok. >>> hideStatus if true some unimportant messages are hidden, default is false. >>> cachePass set this to false if you do not want your passwords to be saved. >>> safeMode sends some NOOPs to clear buffers, should be obsolete. >>> autoUpdate checks for new versions, but might not work sometimes. >>> defaultFtpPasvMode leave this true if you do not need active FTP. Passive FTP is more firewall-friedly, and if it is not supported by the server switches the app automatically. >>> bufferSize every n bytes recieved data is written on disk and a statusmessage is sent to the downloadmanager. If you set this too high and have a slow connection you'll get outdated status in the downloadmanager, if you set it too low you'll waste cpu power. >>> refreshDelay time in milliseconds bettween downloadmanager UI refreshes. Increase this if the JList flickers often (default 500). 3.2 I found a bug! We need your help to improve JFtp. We cannot test every type of server around with every option turned on/off every time we do a release. So if you find an error, please mail me (hansmann.d@debitel.net) and/or the mailing list (j-ftp-devel@lists.sourceforge.net) and tell us about it. Please include the server ip you we're trying to access and the stacktrace of the exception (if you got one). Please visit the sourceforge project page and fill out a bug report, too. 3.3 I see no icons! If the application starts, but you cannot see any icons, you probably installed JFtp in a path that is not java conform. Remove all special characters like exclamation mark, tab, etc. and try again. 3.4 Tips and tricks - Check the shortcuts already present, if you are annoyed by log messages and finished transfers. Just press "Alt-1" and "Alt-2" to clear log and download manager. - Check the address bar. If you put a FTP-URL pointing to a file it will be downloaded instantly using the (minimalistic) Java FTP protocol implementation, mostly because I want to have an alternative if some code is broken in the API. If a URL pointing to a directory is given it will be opened in a remote window using the JFtp API. - Check the queueing system. It resumes aborted downloads automatically and does work really good if you want to download huge files without haveing to check wheter they have been aborted by the server every ten minutes. Tip: Add files to the queue, disconnect and then start the queued downloads if the server does not support multiple connections. -------------------------------------------------------------------------------- 4.1 Who is involved in this project? All new Contributors are appended at the end, please check the changelog if you want to know who did what exactly. If your name is missing and you want to be listed here because you contributed code, made documentation or similar - please don't take that personal and just write a short email to me :) People involved: Active developers: - David Hansmann - Jake Kasprzak Other people that have spent time working on the project: - Ron Broberg - Paul Hammant - Gary Wong - Ricardo Kustner - Bas Cancrinus - Daniele Panozzo - Sandy McGuffog - Leon Stringer - Mark Hale - Richard Krutisch - Bruno Brueckmann Icons: - Copyright(C) 1998 by Dean S. Jones - Source: jfa.javalobby.com - Author: dean@gallant.com 4.2 Submitting patches If you are using JFtp and are able to fix bugs you find yourself, please consider to do this. A patch is applied quickly, and often i am not able to even find the bugs reported. If you want you can have a cvs access and modify whatever you want. This is a free project... but if you contribute code to the FTP API you have to accept that i may sell commercial licenses / support for it. And yes, the project will remain GPL/open source! 4.3 Homepage Visit us at http://j-ftp.sourceforge.net -> Homepage, Java Web Start link http://www.sourceforge.net/projects/j-ftp -> Sourceforge project page -------------------------------------------------------------------------------- 5.1 Using the API in your own applications You can use the API in your own applications. Simply add jftp.jar to your classpath and import the packages net.sf.jftp.net, .util and .config and use the FtpConnection class to transfer files. Note that the license is GPL per default, but I may grant you a less restrictive license (see below). Take a look at doc/FtpDownload.java. Please note that resuming is *disabled* per default (in the api) and local files are overwritten if they exist. This behaviour is necessary since there is no proof the part of the file is equal to the remote file. You can change Setting.enableResuming to enable it, but you need to check the files manually (if they are smaller than the remote file). If you want to use advanced features of the API, such as progress updates for example, you'll have to read the source (it's very difficult to maintain a lot of documentation code if you still change to API, so there's not much doc) or to mail us your questions. 5.2 Commercial use of the FTP API The JFtp API is GPL, if you want to get another license, please contact me via mail or the mailing list. This will cost you money, but you'll get support, bugfixes and new features implemented if you want. There is already a commerical API package which is threatened more conservatively and much smaller in size. Have a lot of fun... David Hansmann, JFtp project maintainer hansmann.d@debitel.net jftp-1.52.orig/.project0000700000175000017500000000057511155275523014070 0ustar varunvarun j-ftp org.eclipse.jdt.core.javabuilder org.eclipse.jdt.core.javanature jftp-1.52.orig/run.bat0000700000175000017500000000146111112500006013664 0ustar varunvarun@echo off rem Please remember to use java-conform paths (no ! etc) rem put "rem" in front of "goto jar" if you want to compile the source and run a patched version goto jar rem goto compile :jar echo === running from jar ==== cd .\build\jars if "%1" == "" java -jar jftp.jar if not "%1" == "" java -jar jftp.jar %1 cd.. cd.. goto end :compile cd .\src\java echo === compiling ==== javac net\sf\jftp\JFtp.java echo === starting from new classes (remember: not all classes will be rebuilt!) ==== rem ressources like images have to be included, jar is easiest way if "%1" == "" java -cp %classpath%;..\..\build\jars\jftp.jar net.sf.jftp.JFtp if not "%1" == "" java -cp %classpath%;..\..\build\jars\jftp.jar net.sf.jftp.JFtp cd.. cd.. goto end :endjftp-1.52.orig/lib/0000700000175000017500000000000011155274771013161 5ustar varunvarunjftp-1.52.orig/dist/0000700000175000017500000000000011264340545013350 5ustar varunvarunjftp-1.52.orig/jalopy0000700000175000017500000000015411112500006013607 0ustar varunvarun#!/bin/bash export JAVA_HOME=/usr/lib/java /home/cdemon/tmp/jalopy/bin/jalopy.sh -r src/java/net/sf/jftp jftp-1.52.orig/src/0000700000175000017500000000000011155274771013202 5ustar varunvarunjftp-1.52.orig/src/resources/0000700000175000017500000000000011155274771015214 5ustar varunvarunjftp-1.52.orig/src/resources/responses_en_US.properties0000700000175000017500000000133511112477774022452 0ustar varunvarun220motd=220 FTP Server ready.\r\n 331user=331 User name OK, need password.\r\n 230pass=230 User logged in.\r\n 215syst=215 UNIX Type: L8\r\n 500=500 Syntax error, command unrecognized.\r\n 502=502 {0} command not implemented.\r\n 200=200 {0} command successful.\r\n 250cwd=250 CWD command successful.\r\n 257pwd=257 "{0}" is current directory\r\n 227pasv=227 Entering Passive Mode ({0}) 150list=150 Opening ASCII mode data connection for directory listing.\r\n 150nlst=150 Opening ASCII mode data connection for file list.\r\n 226=226 Transfer complete\r\n 200type=200 Type set to {0}.\r\n 200ok=200 {0} ok.\r\n 257mkd=257 "{0}" new directory created.\r\n 550mkd=550 {0}: Permission denied.\r\n 521mkd=521 "{0}" directory exists\r\n jftp-1.52.orig/src/meta-inf/0000700000175000017500000000000011155274771014702 5ustar varunvarunjftp-1.52.orig/src/meta-inf/manifest.mf0000700000175000017500000000014311112477774017036 0ustar varunvarunManifest-Version: 1.0 Main-Class: net.sf.jftp.JFtp Created-By: 1.4.0-beta (Sun Microsystems Inc.) jftp-1.52.orig/src/xml/0000700000175000017500000000000011155274771014002 5ustar varunvarunjftp-1.52.orig/src/xml/applications.xml0000700000175000017500000000021111112477774017210 0ustar varunvarun jftp-1.52.orig/src/xml/JFtp.xml0000700000175000017500000000022711112477774015374 0ustar varunvarun JFtp net.sf.jftp.JFtp jftp-1.52.orig/src/images/0000700000175000017500000000000011155274771014447 5ustar varunvarunjftp-1.52.orig/src/images/back.jpg0000700000175000017500000013000111112477774016050 0ustar varunvarunÿØÿàJFIFHHÿÛC    $.' ",#(7),01444'9=82<.342ÿÛC  2!!22222222222222222222222222222222222222222222222222ÿÀ"ÿÄÿÄ:!1AQaq"2B‘3¡±#RÁbrÑCð$4‚áñ’SÿÄÿÄ1A!QÿÚ ?úˆ[´¨T¬ý+^€diN…J¾Ø¶ºìwÒàéÓ̽Rît6’.&¸aþžß¾ivFÑà¨-S—–k)%äqµ¯Ô \=ÿ®?(B—ÿò‡ÿåß§±Q‡¢ÿõÇá. ‹Ñ5á ÿÓÿ² óákSÖ7]VOX‡R î&ExÀzÓ¾è§Üå©Àß4¥~̃Œ œ% ZQi÷$(.)Õ•¡Ô¸(C5=O¦Ãà S¨í¶tÃý>oß%Ë'r²ÂVK¡EÃ\Ñàh­y¥åš.Œmý8üäÔ–ô*2©N”V)Cÿò…ô¨»'N7ì¬U\¯(š~©øF}RÿÅ ýN³Ù²* rºqøEÎJÍtFNWÈ£–·(;ÓõC÷G3M;5cÕŒözncV)O–I5µÀàª|,Z|’³Z¦sΜ©»IX*@éá¸WW×,Cù3áèºÕRûVYë$’²VH²%f¸jJ6úqü|O ô×<=»®‡¢&“M5tˈñ׈¥ôj¸íªðde  6ì²ÏK†á4§5yôè—Á^Ó«…´N»¨úb¬–ˆ©èg{´[ðRžs¨¥--© Ýp“ÏÁ47§†Uì¾Yˆ*ï °EÚHMÙ¥ØI^X(Ü™MGÏ@r±‹~¦[Q£nIßCŸ³6ZçÁ”­;¼ô"„ú\Ò-ß.£Ù$.y=ÙÔã‘´ãuÝu¸½T×G©¢“j÷e¬“³eÔy­4ìÕ˜V¥*|D}JÒ٣ϭÃ΋ʼz 2 é¡Â:‹žwŒ?vkÃp–J¥UTN‰È N0J0VŠè5#+ݱ§†4iw~¦¦Õ.Æ·´nXUIÙøFš˜Ôy—àT‚Y„|1ÅrÓβc¦¹¡l rõcb*dû·t¬S³¶> Þ„U_%µõ ºÇø2Næ”ågpŒ£.iK½ÃžñiéÑÃ’½¶¹šÜ)K†SW¦ìÿµœòŒ¡+I4ûv•É«/©NòWiÈ8Û+(’€Û…¥õk¤ôY`w𴾕uêyfÌH\ËÁ¦CºË›?°üèG¶¢èAKž:Yðy§¶Ò”Zz4xÓ‹„åªvb@Šíá(%j“ZûWù×…á•4§,ÍþÇP èi ] Q«Í™Wµòf¬@¦ýCmYêKjú2* ò¬ #lØmzþBÌÇ)(,{˜Ý¢œŸÂ0m·w©FÑwƒ7î¹tý®ìÊrÍ–„©ô1ª­.ã‹ÆS*áY\5º,Zà5+"“"ר5Œìi~xìßG¹Ï’ã+d# Ü-Ó•-µC”õ%•ÏIjŒjP¹¡eSöe 9EÆMIY­„ü' ¢•Z‹:¤gÂpüßÕšô­Sµ»Ù„9Kcårõ2PÖ‚ `7AZÃf“Ä”cJ¾ÒÎ"ÖQÏ'é~MÓôüró5÷‘­%ý<îK”-ûµ‹#žQnùLQMFK2N2wíå2åj‘ks# »—Eö3ìZö<îU=Tã-Ö¦-ÚlÞ›ºqz3 ]Tië¸ »E“{Æ^/jÎÅ;h7Ê$wü”HYK]zÓŅÁÓútyž²ÏÁÁBŸÕ­í¿ƒÔz[H¡J§ö¡sß²!ÍGHÜ_U=`4kkbøØ«>^æpqšµþjûêQQÒÇÇC–²—÷#ÑXlæãáÍAKûXñh T"ç5êÀ׆£õgÍ/duîw'z‹b\U*q§½Ø©;Ôú„tEß§ê45Ósö§ðjÈq½Ñš¬.'îcx¸}ÌŠªzGßs8l\¤ãe»‰ËšO¢Ð”®'«k'ÈUÆI§Ð™`"ö ^J’¼‰oÚÀÎÊÚ‰¾‰ ™½XìÚ]…ØÅ`)K6h¤Óx"ÛÝÀÖ2åbšåjq±1wÔÑÛ3º-Ir½”ákÂYA\€Tàá+=6d””):ÕTvßÀ| /«%—ˆoQIòE$´5Ò*2¨­7ù!áU÷'Ôɼv3B¸KP–‚è-E³¢—¹xoqT½ßT»›EñRö…Gh•ËÅKUs^#(¼?5=ìêpVvèrÔN3w3bˆæ-\WÍŸl7ª}u"¥aØuuæêæÏào*QßP36œTz˜îiW€9eïk¸'”]uj­õÉ ýJýì‚æí7ђЮÀžªØjjÞZx³Ð™+xÜ-j¿âŒ\䢵nDZ*T£²±bU6‘›¨Á®¶üÕ´%¢þ£Ž^Q~š‘êŽ}ý9Û6bS:VNÙŽÝŒbùZgb’ÔÎ¥,àÀé;É®™6"”#K5æññµtÿ¹§ú„}—Gc€ÍX(4£©U'¦¯À4!ôèßîž~ “´ŸàµyTXÐ9bµ•ßb#);„%iÁwMš(Áö¦”ÓWÔ*êþ Rv’ü²õ§û•¯Ù—ÔtÉ]XŽ÷FÉÝ'ÔÊjÒo©iW‹DÛÕÙ.¶"¯§_ìA-óNàžmØ4»5"¥¼ ?iQvQî&—-Ø“m_£Âe&Lµ¹Qép3Ÿ»¡µoäQ̤—mÀ•ÚëPs¦´N^AVWÐ`+ê-lÚ2ÿù`'AÞãpÆ–5¬Å©.W¿òd5 Kô»X§ëûê+®†BvxZSM<ÿƒšpp•™×5gÌ´d¸ª‘åzìúÈ”\$ÓY@§ÁÑút¹šõK? KëVQÙež³,JŠšÅì]îä¿iÚD¢ªéÐÚY¦û2P¿è}AOT.€ðƒtM/¹öGš«{ £¤b¬D2[ÉFMú™j4Lά/í¿ýŽ2½Â2Í™4rÚ×WÈ/r]MªÃøÁ„°Ó2§v µ$uúäO®áJK–nÚj†¶ðÍ4ú`_h º¼­£0Z&uIsS’Ý£•w(U=ß‹Øu5^°)z—q†žÂK£'¸ïùeWØF¯Ûc ¤ÛIjÀëà)sMÔzG ÉÕZ¼);;·ÑFš¥J0[käá¯':Ò}ì^#eÅżÓiuLÙJ24Öç¹têJœ¹–z®¤rVðD´4MN7Z=;ö"ª”þÖó±Ô´8ˆ¢KêJL½bÑ [×S4SðÌ¢ò^xƒð‹R4rO6‹¼S0•¯¡¥+Ù¡ U"Ü®gwÏg¶N‰_•ÛS,sæÂŒ$­&:oTúÊš}ASŒSnNÞåæWÙ ålSª’\‘ßVdêJZÉi7ÆÏ/¢3Srš¿á“±7jIáZÑ¡D¬ó4EÝÀÒJñ0VZ³g£9Þ¶ÛKa97ÿèZçpòÀ.RdhR{€­kŒ5ZÐ k‚ã6¿èÎå­”•Ðâö&q“O·CMr²Nð“]Ê‹YM]=GU^*}0ÈO`!§ 5ШÉ_eMsBéæ:ø2¾m¨½;¯©ÿ%þNs®œó“ô¾œ¯kÓ·bŒ€ïà)Ú¨÷ÂðpÆ.RQZ·cØ„U:j ebÄ¥9_ÒÊ©»^ äý É(ÚüÑWÝd†¬¬(¿é¾ÎåâQo9÷7§‰i{‘BÔ§¡+Q¿höÔÒ„yª_¡ŸÜuч$;¼²Ä­Ò5tÑÉGL幓՗&¯bdÓHŠ…îB½ÑKܬÉk,|!=Sê-еÐ1Ïð`´:(æŠù9Öèµ"ä´cRäQò ^ß‚%+ɽ‘Q›ÄšaB\Ôìö*~˜ó[(Ò’ŒtËØå甤ܞJæõݽDÕ¤ßb*%f‰H§¡+B)Îø!ßr¥ª#p5Ï:Ú“x‹ {²ŠÍ|Iz°m)¬w ­“ÅÀ›ØjíVWÔWÞàRþkhlØh^ ]@wÉq—. Ö¥jöOÃG3N3ktm }¬U£t¤¼0&/?³2”\&ã²Ñ—øEx]kÝšÆ.i )§ û_ìbŠ*tæâÿ=I:ÚU©ò¿rÑÿƒ‘«;=J:¸|Õ¹Þ‘_¹è6cÂCéðéÛ2Ë4oÝ ˆyÁ•L$hïÌE_~˜±•žZ¾¨Ò›õy1¦ùjGÉk·ÀCŽ&c5iÉw7~ôú˜UÅIy-ŠdªŒyêöZ†taËO»É¡¸ÍOa’ñ0«YÝhÉO(éœyâ×àåXVèf¬kSE#žÜ“µ÷:5…™„Ö/ºÃc†Ðý²BÝ>Ö̊™®Y¼”›M ¢ºL#¢ ÊÒ·s3~%{_Ts”4íà@X‡~ÀïÔ–¬1¬« oÂRúµ“~Øå˜¯ KéÑ]^X‰[=R&¤¹iÊ]¶Ìx¹ZŠ]Y¤q<1[t+´?=bBÔ¨±5gb…£¾Ãê'¥ÃP;(¾z ¶–¢áªQê¿ræ¬È!lͨT囋ј¦ Ù¦mFœìsW\ÜìîmJQ›\Ü4×fTy êQ‡Óáà­›]žu(}J±Vzu%°F2d½-ЧÛ°­}%~ÄTe”ó+9kð› j„²²ª‡éü™iQ«nkCØü™ÍZ«ò[ÄSvƒ{£Ÿ{Ôö(ü˜Úò Ú“åyÐÚJ飖r·¥jõ:)Kž ª,+šJÍöe%Ï÷±u£f¤‘õkª Ë ´4š³] •LX—©U6%k0L©lɰh*bZ—ªºLè ”R '¦¢í¨Þšñ`¶q¯@&À´Ð°†²í*÷6‡®./SI,Ùþ ‹³¸´âÚeÅÿü*¬y’šÜÉ<‡,ÚýŹ­UÍ%¬LïØf:ðçÔŽ«Ýÿd¬£HJÀr­j|’¼}¯NÆEt¡õ*ÆY_T§ÑYwŒŠVªâ 5§A÷'F^º’×+UÓYmœ-MãEz‘N¿M nàUû±ÙK\¾¤¥Ô¤—p¬œ^SјJ6gRʱHæÝr‚3‹OM %Y8ô6ÑŽ¤n”—€¬4-<«‹•¬)EÅèÿc’Qp“‹Õ1{hsÇ™{£û 9OS†‡Ó¡»õ3Î¥©V1êÏ[DÊ„ÞYœ™W¾¦rxŽ%pLKGà¤Rk)õ aÍ Ùöû$º4À«ÚÌšêÒ^ ûQ5ò¢ûM}J–YÜgF”û¼³Cq?c(ŠŽÑ^Eé “ ƒšÓhšá°"/f¢Ðº¸2ŽjÑå©}žFŸ§Á¥XóBû£(«ÍY_£±-Ùß©¬ÖtbÚúk³ $9û¯Ô™e\§˜'Ð)®§$ãË9.Œê0⦟T@PÀ1ÀC wê 5fj‰6á©ýJ·~Øå˜´ãôé(ýÏ,ªzJ]pRÌüôAG¢hßR²s—-9K¢<¼=Îþ*V¡n®Çð*ÂÑîKE_]È¡hRy¶Ä!ĸ¿ì¸¬ë ù¨Ê=E¡ÑÃ?]º«Ø-JÍ®‚Z]7iýÉÿ´Æ8›¿+îÅÅ«q2ïf`tñ«ú±}bŽb€€5ááÏÄB=ÉN1þØ™»lÍ*ÊØ9ùÅH™O9 Š{ e5ò ƒÎWÁ+RßIZÑÃ?S]Šâ4‰?Sà¾!Úûšñ=eM^&U_5NÛ7ØÉìeFæ‹Ø»™îh½‰y„Ý9§¶çn%hÑçÈèájë‰JQi÷BšæŠfÕ£u̶3VjÃ4ö%hiZ-4g¹âýH¥e"ïr߸°Ú*Yˆ·Àßµ†à&² ¡î,¶@ÿ”¸ôwVð†ƒÕ¬ü´W,h$'„ä—pRzà›e`¤žøÔ“ÆåÉsCºÉ•ÒÚæ›½˜F2‹OB£âÔ•“5–.³sv¥¿ä åK¿ºþÔUIY©+äžtõýÐQË<Îú I= W@(¨×u–Çfo'hŽ”mOK_$KKtE@¿Á .¥·h™êÈ¢Þ–ö&;ß¡÷dèhÖk°¥î°×»Ê`j4Œ9ù/¢Ô™ÑN<°IêX•@iSbÉ’¸¢c¨§«wu²Ú3âªëRe¨©âE0اfSº¹bRûšêsµÉQ£¢[3:ËI!U›Ñ¿“J?(Úê×3’·+}l̈^Ü>Ö‰X“Of8âY}˜SØÎ¾iÅôeµ€’æ§5Úàr@pÀ6 „@Öà?à x`mÃޥ߶9g\5H§œÝ™Â?NšÜòͨ,J#Y¼2£ˆ¤g,Ê+äÕ#‹ŽŸõ!ˆçÛÉ|L¹ëÉ­ŒâñfJ ;nÿav -ÓÈ-…¥À©lŲ°þÛôÀ t])rÔO£ hº‹×äÍašIÞ‘›Ô‚´šfßo†`ö7YƒŸ^šoÊ8Îî1^‚}&p•uð½YK¢9C‚\¼<¥»mþJuäÞÆL©2H¦žm±q‚jòðf´6‹½%ä ”õEã¡ YšnLÒM[FßÀ’*þ«ŠÙj Õrë+Ó—‹™ÅòÎ «¹´×¥¯ö³Sˆã§í—rù*-}Fº!Ks*[–½¨Í?õ&K)RvÕÓ¹øºœÕX_}Ñ+í±Ï Žœù—Ê;}5!u”ô5Ôãžk™XçpwƧT¢Òðe8ÞÒFF­y-ßîå=Rݪ~ z"Õ»ÌÓæal+\[áX µÚiÒßö—v~u w ¤ÀQÌ’lº|©õ`^t²ô6Ý›xFmô@Zwì‰m'ÔZê4—§ìZ´U¯Á.UD€×TŸC:°ÒH¸çÆ*Ö—à¨Æ4ÜàÓÓRmN.gܹNÓ±œÒRÂ×(ý[iðŠDÚ‹‚ÏB9o«·“J0N¢w½²M¬¬‰©®ã~ä4îí¹¤s·†KÕN fÚ“‡²·c8¬ßµ"VQs­m-‚CyÉPÖ7êCÕ•ä ¥ÉôGA1*±Fã –×1Fs~¬è(iZDÏÜÞæ‹6f3÷H•aÅZ]‡¨¡§‚³ ½ËƒØ§¿A]nhJ&„i3Uéú| jð’êG–£]rN°ðòaXIúïÕZ„–;¦'˜…\ò¯ò(wZ†´ü`”ØÒV“]k«U}òdPÄ=À` Qö·Ї4ùŸ¶92;#¥MG}À›mTãjQ]rÎhGšJ=Y×'—Ù‰ª£} [å‹—L™ÒVM“ÅË“†–rðX:íÉ·¸/q7}J½Ñ7û¤Õ²+t åw,wŽã î-µÃèM7z6èÿùüŠACI ‘^ÃjyŠðaµÒŽ!_†Ÿf™çžUzU—ûny…z”—Ó¥´ß§O'›óÔŒz»µ—3“ZhzakE\O–¢³W"O.åE¨çq£ Óp•ž›1Òxqù6œ~¤-ø9éâo¸ò ^#b¾¬Ùi]ùYò\0›è€‡+ñìη—ûz—­>ç õù,Já_¯ç~ÿ#–*«í!O"¥êjý‰y3—¸Óìˆò(ûà,L {ЫÈÒ~ÖbôºkY2Åú_b)WäjÑèúT†.´/QÏ8rËK"~Ódî¹^Q $ši¢*-‚—€QM»I»j¿ e4îE§Õ~HåIû¿M+è‡x­aÍ'¥.ïä“»î'e«Èœ±éX›meÙM«>_ÉšÖæ°V‹ûr$ŠkJÀ b¢·`•ð¾€6ÕÅv%Þ Ts- ­ê’nI­Éun죎å^S‹ÉPNÒ–{±IEÃ×qÓOF°Öâ>Y5&¬ÀÍE=%ɽ(Å»Þæ.ž×ŽˆÇ–šˆ¥¨ÒÍÄ®=M k™Y™}),«3`0–]¶k&-Yäé©®eª0šº¾úª‰íàÖ„nïl#9'+%©×NQ@i˜Ãƒ•Ðuc)²j+Ü»Z^IŸ]É⢛Ë]‰Ý–•¥u¡VdT_î5ßr#¡[_`4¦ñnƒšß¡všîhòN#*ÊðRèg­×Sd¯ÐÁÝ$ûØ•c9¬¿÷"#¡­Lg£¹–’ù"œ¦KäZ;.Ó].'‰xÀÄ+Æ2ø0:ª+Ñ—lœ¥Øƒ`  廲Z¼¹ºiäÝê(ÅE(ô×È^þ6áÕê7²F“~‡Ý“ArÑæþæ9{ã£X+E#—–!“±o>n!¯íV/ƒœiˆ7"­¸-ö¾L/-oq;©¶e5…Ø è‡Ô h»O»F³Õ˜Sv’}‰+¯Ø‚#{3ZWÉ’4¤í/€4jó©±Ðò[N!w‰åIZmteB ßƒ7Ù=a$r§ÇÕ9tV:j½Gˆ…–7+<¶73dV°›æÎQcjŠKG‘&[\Ôß]J‰bcYŠð$ÒšºÁZñ ¾Zk»5”wŽŒç®ýJ= ŒžCЖ"߃Ζ©ö=ïI[xˆW%ejÒ_#©|»[.µhŠ™·‚Ôpó¡|·Š³¹ŸÚ¼—B †~…5λõêOܽ Zó8èÔØÖ‡ÉhOÛ·c:š­Ì™b=)ÓMsGNĥ̜ežç5 ò¥e¬z‘pª¯uºÝÎ×,­f‚6¾¦î)«<™ºn2ÓÔƒ:œ¶ÔÎénÙµHàÆÙÿô¹º ËÜ®\‚ˆk"¬·a  ,šÃÙògrãí@bÔ¿¦Û¾ÝX×"½½VŒ­l½A¸G{¾ˆW\mÑ’1÷?„“œŸ*²]‹q²KEܯl0¹Lù¢ž·}Š)(¥k7ä´Úè‘‹©M‘)¶òÈ5“Œevû¡ÎIÃ+ØÎ~¨_t¤“åz<2Šææ”,µvfÒž†4bãRI­ žlµXµÊ»ä¢b­Ž…ˆÆpË[3c:‘nÎ:¡DR‡­Ëe„n$”UÄb`€€FE9_™te½ ùg’QÐg/mÓÐÐÎI©5³B…{÷3ëu¡tñ'd¯wù"¦8-{m܄DzîE^ÉšÅÝ\ÇR齋›ÄÓ2­7mòm$EUx'дbýQò¬`ïtûÇFºMeÙèî¾Lªg¢cž·ê®0°_€•nªÇc®;õUªË¾@€(bÊZŒ| R”$ö.ê(Nm¾€/¥-ì¾Gôe³ä<°æ¶€'Jkí¿‚iå4jª2¾¥Õ¤“@`Ζ—‹ìg*n9Õu@H0µçí¡’MÉ%©Òý1PD ¼a ذŸD)Gš¬WÈ*6P‡ACÕQ±·™K¢ +*5Ñ\ñç.iÊOwsÔâ%ÉÃÍö±ä–HoBV@ AµÄ€zÈíÐ ’줞‚iÆÈ;K1¿\œ©³¦Ÿ¶?(‚^ÅÓ~¢%îШ{ÀÚ_­٣ή­ÄTÿ“= âTŸ{\Z·,kgûPz< yxvú²ç™|ŽŒyxjkµÅ«¿AQ,J.Z,¹Ë±Ð¢’ÐI£™Á¥r©<ØÝ¤ö3pQ—0Á•¹e$ºÝ JÌ©êŸÀµ"µ¤ïW±ËWÜÛêt'ÉgàÊ´sû•ZëÁÝO4¡âÇWo¡ÙIÿJu~W؉?LM8…èfÑ’ÍÙØ ûYbðBèhý«Á,¯vwDhTpÕ€‹ê5 ä·%ª}¾ ûUX‰’‘p“DÓ± °÷L£²Bxš·se•tî™çÉdºrq³M¯Q×86®¿;º×ø5\CKÔ“ð/üŠ5«¸¶-Î…2Ìd¿ é´ñJÿþCljœž‰›(ÕÚAôêKÝ?„0gÉû¤—b¹’Šåû°ä¥ ·-"¾¤#f—…p%Âsw“·K”£®T¹™?UeÙ¿&R«&õ·€6”ì½RItB„“»K vså´­sVùb¢¶ ™ÍÉåÜôߨ”sv6òÐßK‰=ƬÀ¸ô{àË1“] ]WU. tÁÞ VË/õ{jTRŒcÁñ}™¦T•ØòÊð ±vЂ®Å䢀!ˆ|‚ÐK¨Ö€)輘6š¿äÚ§·áœëFŒÕŽ˜;Á0š¼qªÉ4ž,hj#«}…uŸ“I+\ÂÒ2¢Ö•‡ö¢¦°üôDUE”žZ¢‚6yW&×N!MÞ6è7‰#HåÒ£&¢éº±¥uiÜ™ûTºdʲZâ×oà°Gù 4f\BÌ_UcV¬õ΄UW¥~Œp(¨ÆRÑ`åÅ€Vê4KðH¶›Õ ÔwHZy$p@ ;žå§} ÐôÊ`9AIúpÿ“6¬ìõ5YÜ¥¨ùe†·iFÉͬ¼"ï4 c%°–„óc~fSè°b—§˜é¦¹h.åC–)ùf´Õ’FRÍH®ˆÞ+^>V¥õgžuqÒ½eíG(¤\½UÈ./ —k!°ÒºbòܸËz…¸r·•”oOÓÞ©Üæ‹jÖ5¥î’ë %¨ãîLRÌP¶L𾨾’G­]wŠ;*fŠ9¸õêƒìÊŽ0 •Ú]DkÃÇ›ˆ¦»ÜN~˜¨­‘“ÑTÔPWÞÂõB<±Kr€I§£4† ]XyG-Ïææµ¦ëTDVLجë;$¾EL1T|Ó—ì:O-u ÆÖÆçM/Òñ#žjÓfôsN]nXcí#fœ—FtVöOÂg=-d»– x‚ðE‹yŠðEg¥®Tu‰.Ö){Ýtv•ìM_jòdª+DNjخÄ,2Ê*Z Ž™ê1ˆGr _µ¤sK~N˜îŽy¯P µ½¼ƒ{\¡óÊÞé~AæWÀhÚ:%ØÂçL©§Ø‚e­–ĽÞF—4’@]5kÍøD·yQ¤¹V„Ç[z"ÈÐ ¸K%Á)µÖæiäÞŠ¼œ»‹w¹k© ZFš#QÉ_bž¤K>¡¬¬ ^ÂZö*Â+!€…q°`NÅ­ ìPƒ:º|}·6¬ðüý¦jÆÐÕ>¦›™SÉw¼S,ôg'c¬æ¨¹fФ\Z”lÈjÖì8;5Ñà&²™ŸbÓº!• à*àí4ºàÑ£…²o{Ææ¢VUãzwèd³¡«ÅŜкn?¤e<[ð-®]EÿdEàŠ©g=UÅnhIv³Ã°áªeàÕAG2µú$©ÊI/“;ä¡ó;ܬÉÜk[l°?ÜrÑ?‚@@nÞBö €7‡` €-pV¸‚àRvðt%ËìÆ”yžtYf»ä»J6܇Œ5¡iÜÒœUI«ìîÔ/$7K>N†¬ãˆÇ3âü3Výò*=UØÝhcEzM*Ë’”åÑ%yu¥ÏZrêÌÀТõ$iäÀá¸nÇ£×pz‹pèkMÚ¬{àÏv;Û•ô`t¬Å®Œ¾JÒrB¶Ï4> 8ÕzTÙÑÁ#+<,ZZ5ü < oÄ_¢læ;Óãú’ð„GLõeÁZ7ë’-wn¬ued¢„ýÔŸ3²ÐQŒŸµ æ’7NÊѢݽZ”C§tj 3—¡7ÑU7MØQÈðõùZ}ÆöŒ4uWªëAðÎñ¨¼õS]VÂû¦º¢£Yå5Ö æ¤ÿ¨»¦Ž·¬~QÇL×fx‘£^ˆø±2ԥ쉉KX‰Ük`÷˜ –¬QÐ,ÄçÐèz#cÀµ(Ÿä¤Ê-{>B>𱮀µDGS¾älµFU°þ@Ì0ÃPØ Õ ih àÌÒ:[ÂKc(.X¶Ö¦‰áx ÏsJk–.OÂ3IÊI-Ëœ­d´Xs' Ý´è(ãÔK@}h |ƒÐU S¿Vrß:Òå„cر*­wr„°†iÍç¤òä”$š]ÊJȘåßm‹,/A½è„ý¤: KD2Œæ“æoC7Éxß­fñb’VÔÍQ Bt~Kþ ã/Ró`5^×ØÎ²¼Tºjj·®œYQÊž Uº™ÙÅÙê]Ì´AgqÉfû2z¡tŸ¢Ý ÓºEÁòÍwÁbUèÎj‹–³èòu3"7Q’ðZFU±„}Ö:iÜÇ—–fTA]Iit5ªùj_¸ž/ÙØ «¯Z}Q‘½ex'ј.¥ k¸6ª%ad¥©/PîÀ€ Ââ vj´cžw¢ÓÈ$©Á/¹å“|ÜÈw iïc«‡\±rëüÑõY-Χé¥$´JňT³Í=Ŧ ÅUSw¼z‹‡Åv»0O–wÚã‚åâ£Þåƒg¢òrO—fuËÚûg÷9k+U~çù-{#ÿÍÈÕEõEé‘X° a±ý T½ÍØ·îì.«` 'e̤³cgìFo/ dRÓà'À°®. ­ K> ×>àú…Çd•ßà YCæ{;.ÃævÕµjMõfñVHˆ+B+µÍ F@côKÚÀÎvÇbZÊ ¿U» ù2«ŽŒ‰æ)š&¬ÌÚźT}­³tgã ®¦º;샺ðsÕ\µZ3t­&º‘Z<оè¾¾SÔ©¯MÑšèkxÛ©‘Žæ©áµgn…Åè‚®ž&×SCÙÅôfæ¢W=uf¤EEÍ&õcÍ柂R0O€Ž­u@Õ¤ÐïiÜŠ>äÌë«Tò®k,m£3®¯¾˜ 6P\ktJÀÖ  Õ¯P00.”9çm·"×vG\#ô¡Ë»Õ€äÒÂÁ›µÂWÔDt×4³¦äoƒjjÑ¿P/V\Rrè¬M<¿’Òô¿÷J则â u5¦¬’èe%zŠ=ˆˆ3âTšz<\ãË&Žþ.^¨Ç圵4/¼zF" à8¼•¹)älzl-Àh+\qƒ””RÈr•£©ÛJ8Fòõ?ØÎ)B<«åõ.2ÑvÖ.<öQ¼Ö¥uxl´·ÎŸCWtõ’ôu­…hrÍIhÍã¢ò•QZ¬×vI¯­ÄOÍÌ‚€6á#ÍÄÃÍÏRù}‘çð õÛéw·hI–#–ULYtDÅzÒ³#!tC¸‘QNR RÔ¨+Éé§lè . M—W›³ø7‹¼QÊžMéJ÷B¡)|8óA£UoF*o×nªÃê‰ÒWé“ :åïO©Ï]OÄŽ‰}¯±•lÂwòTaOI.×7_¢Œ){×{£x~ÈK”\ˆ[‘TöðJÔoEàKÜ—´OB¤½$ê˜ËŽ}=t%„uOb€§¢Öyºí]™‡ºÅ¯dŒã‰£Xë$3V“*œnùžˆSMÎËS\F6ÙoA=Ž1r|»°.’勛ߥêHš$¢´XC§ŠwÜ zØLoV$®Àk@Y5—mÀk«øï–ÂOe¢'ÈåÂ<ÒŠîC6á£z·è€ëÜbV¸Í²01‰è0½¬dÏÚ(Ƨ¼ÇSÞ'©…kk"å'éø3{RÅ7Ý¢âï÷X"Y¤]ÓÉF«fÇ»Oroî_#zÅ”sµËQÄ¥°ê«M2^ÈÈs÷y…<ÃÁ,*õ‹îkx£7cJxm%[Ê9—¦¤£×C¨æª­8È´Œj+Jýˆz&mV8f[SyKº—5)uÔqöxaZØ]@$­&žÎÀP¶à7íðMÊìHN›©5¦ï¢^›÷½´5“K{RV²ÄR²2ôßRÛÖâvöN™L¤î»€rÞInlôÆšMa¿À÷°RVMôEcš1芥SòCx”¿B§ê¨än•‘(ú[êlÚŒ[z$X•ÁÄKš¼³…‚"ìÓÛFCmÉÉîÜ&¤y&ÖÛo(óÒºËðbìµ+bw+`¬+ [K\1‡ÒY÷=Iá©óKê=#üšNWw –RYDlZÅ—`×±¬ž/á˜Ë,×ZkÀEI}JMoª¿L|¡R{QZ2KÉGÅ+qïgû›ñª¿âŒ€;ÓÖjKÂ:çˆÛ±‡¿¡'ÖFÓ~«Äõœu“è…œ”¡~äô2ÖË5öG•k»& 7è½¥”Ç&¹R–Œ"²MOw‚ŒÚåm2©»M½P¾è”AÔNé1›G%XòÔ}òbή"7Š—C™™ªéŽxx;hML©.±*Žx 5jû«ÇË(¾ŒëŽ!%ÒGÃèv'x7Ù01ž,fµhÒ¦„nˆ§öÄZ1Ûм“¸^ÖB¿å?k3辸ހ¿té±öa”;YÉ.—oêº6^ÿ&-ãð\Ò‹ÚÀG'+æzèŒäï‹›Uļ©®X9nðŒ£)$kVXIx@e/T¬m­àÉa\º~ß%»6‡ÄõZ¶R~–ÉC–‰X.ÃàVº#®„TbíòsCyt:©+QWÕä±+E À  Å`'°Å-…ó÷?"z²Ÿ©¿$½Q†—ö?Oc_±øFOü¦´~I¤í4;ÿMy3xwêjÒý„ô}˜ßªêùF„Ô\Ð}Œ[ÓÁºîa%f×FJ* _"’³hH©-ÑG]u-;M?ƒ-îjôÇŒ«Fñ}Mº– £ú©¯ÁΞNˆ¤¹£ºx0š´Ù…÷8õÀ_7í+ŽKÔÿ!X×Vªß\™×WŒeÓÁÀz‰õ꬀Ԓ£O—î–eÿFt!ÿ±è´ò|Òm þJ“ýÈz4íà¨Ý´‘ù7¢¬œŸ„‹ !Á^HKdkF-˲ÚO– 'Ši-ͦð—Vg,ÔQéƒT ¬‘ygÚµ`U*R’æÑmsY®]´)4ò±m„å‹=È1ZØ4äV¼]¼‘ôåÑ[ÈË„qÌþAEåÝŽ÷z]qhÃk­z—ètEÞr—LR\´Ü·f”—¡ww,AYÙ$\’] å꬗CT_Q—.Z-uv8§W'Í­•ÎUû’¬ø XÒûŸÁáM%Í/Á´[VÛ²S”Ÿ3X5Tìô."RŒ¶³8kМ*4¢ÚÕY’V&¬9á†ÓEÁäÊ2‹ÌZøßÍ5¤Û]ò)}9~¥4›û‘ tâç5«5©Â´¹©¾dW MÇš£Za´­¢´XDÔxò*—±+FhEä/°Æ´B{ hZl Úi÷û÷¢Xšòk6ô~¬t,G?¿£? ù<ÓÕâ•èNÝ(R ¸U~&nbtð*üO„Â;ê?R3޲Ï3d,E¾¬Q2ØrÙtBJí ú§Ž¤QÑv.8\ÝÈYmìT±O˱Qš[à¼EeŠ8»±-¶Em7ÀIYÜÍ<êmî‹ORÄgQcÁt]â×A%xÛàš.Ó·Q:7HååäâÕ´¹¶•<“Z>¨O£ÉSÄ“"¹ê¯C]Œ,âÖÌꬱ?8ûwVÄ“9'‰³®^ºQ—TrÔ^«‹Ò4áÕê.È锬eÂÇÒåð\ÖG‚›¾×F_J–²‚ø’Œ±–K›o/#Bj^˜/œ‘)=[ 7¡"‹Ý‰àz+±7–¯ja·S²É0NJËSYzaË–Iû–Éö´¤ß\GÕ%Ñ£™–‡‘k§Q¼ àBàýiµ¸ã¨ºrZ³%ä©aµz°ÅÃqu6iN.vŒul‹e$wѧôà¯îܲ"㨭À ÃÐ ió2%‰$–M„µÍÉU2ö}Æ“ö¯,Éû°f‡W x!UÕvFaU%˜3Jñk£¹œ´]è?[]pXã‰4*¨­•ìW/ƒ8æ-éch<‘QZo¦¦@¶*H„î]ïJÕcG‹¾Žæ/}noªO©b4ØÊ¢³o¦Kƒôø ¬_¡QÉ^;™,£¦¤oNÝ0s-H«Ö 挣Õ`#ý½U‡ŸÁÈ"êÇ–¤–×Á1s’ŒVYÔÒ§徤ÓÓþçû ú¤@öIÞn á±-V@w²°\OªÈ×rRÈÓ¸ ²’õ$·'sjJîï`4ž"¢W¦ËdŒWª¬|ÜÒ£µ9>¸,DSÌå# Ê’ô¯ÉUeÉJRí‚ÄqUŸ=Y=UðEÝôüìoN‚—®xòEE:s©,%mÝŽÕÁlK’Œmb»ê86RM*íXêÅ'ö­¬–ã¼ö.Šç´L¨Ïf¬Ì~¯ûr£5,jì'd¢‰O Ýò8EÉèJ/SX1$£‡–5g¦FX«I®¦~Ú·Ósih™•E¸£p&.ðL£HŠ‹š ol<Ùš7‚jhJFsW‹î¬qëKRVmw"º©>n9ÓUªÅp¯šœã¾¦ªŸõå¢Jq䦣ù"¬ZÎÅÞÒ±Z—¨æ¾ærÕù:'Nù_ƒ ÙI¦™œTîFš”åÓm>n¡Cm•¹»"£ÃÊ^ì/Üך0\±AR¦œV_S6îì‡y¤µ¹K^¡VŸ*IlcUZE­5õºƒÓ·à·Ù?J²ÞèMÜkkSR—=.Bö¿ †Ásjyß4—¥~àiÃÑ·®Z쎀l€à )Ý4ÉO> ,O.nA1c»äèšæ·G2÷’¬UGë·c6‹©úðNÝȧ¯à˜Ë–wè7«ðKÕ¾Àv¬mЈKšŒ^ëEÚVz°Â¢¼·@ñ6Š^¤ãÕX Qpy±žUʋЊrY.›¼Z•ãqSv˜FÑ~¯(¦®¬fúôfº£Q¿þyG$×,ßC²JÒ“›ˆ¤žÄT§£÷;o”Lt*þ”÷LŠÊºöÉn¬É¥ zŸÁ»‚œk &mÝ콘GÚØµLkdÀ™=×r[»íö ÷À® (ؤGD=4¼˜Æ<Í.¦ÓvH ¢½R—L¶‘‰TcjK¾H~ªÚh_´•Œ8¹ZŠÕ» CžmJ«iåbý xˆ¥IGÕ<¾ å&EÕ­²ÐµÞæUO±¤W$;³:k96·] ¨ß\"—,Uì‘ÂÖW“²¹_½öÓO+¡.®}*ÝĪ?î`i㇢8øŠjVí‰e±—6ºõéF¬"žÌ£*k’„SÕä9š.®·Z'|XÈ«µ+ޤTÒ[ìÉÜw³³Åÿf÷†•cuÌ•šÔÊþ›…‚ÿ õ@°ìK#bÖÃ`mG1käß“𹮍éܱ©âKk¹íž5Uj³Kû™iPz< · 'Õ³Î=N[„tÙbS~Ò'«ò[Í—Vg,³"—³Ë¢@ñø¸oáq|±”º§dûšÕ|´’ݳ<%òZ®mËôÂ"+SU‘æmÜÖ-½uZÂ.Z~Mc¾âÁ¢Ê3’n-•…%fÙP¨»ÂÝ ib¤‘¨œ(dË0,VÁFKnç-lU’:od»3&)NýŒ¨á«5ÕsmFèà¥.ZÑ}ÎùûYgMÞ)¦>k;‘CBnÏÉ4jš–šŠR³´– Ó¨ãÝ>£LÓþÕøœc¢”±kÀŸ'Y2›}¬ä±…»qZFþIrlŠwP~Ÿ–VCκö}€#ÐU½‰ŽáÔV¦×9¼¤lLVû!·ÓÀÞ¶¸¼Á>Ä=Kô×›©%Ž :TYµjÎÔ’I%d‚1PŠŠÐfäÆ@ Þ÷0œyjvyGA32ðK,ÿUù ~¤¼–„½ÒÑ1ËVÃXtá(ü”Þ¡i®ø4xm5|ö&,IìôÐ$ÀšŠÓ¿÷´5šæu“-þ4ƒº± qvcšõ\+Uê”U7xÛ¡7†·Ø¥‰ù5SÙô9ëÂððu5tÑ‹W…·ÐQÇ“HÆíDZŸ+Så5o•+SMc¦–0’´ÚèlÕ¤ñ®QT¹”º«+@¾¬zE"%lí‘1¥‚]î°n>…ê4.…-H6¥+¿òÙ^Ø’樿 t{Rè‘•vÛܺ®Ð}݇N<°WY5ê)»&úŽWvX¾æõߢÝNw¯VJCWz"¬¯kèBw—[GV‘]Ë_Øq·ÓšZ"¡¤£i$c)ó¼ßÀå>|™¬²ÓÛö*1{+gr×u§¶°i»Ü˜§u©¡¨•…Uf×Ê1JçUHóGº9Zi2R(mrSi¢žÖ"ñw›a˜Mrß[ll°û0œo·@`¢Éz”Ñv¨»;üœÐviô:¾æX‹<Ž#EO'®y\Zÿê§ñü‘€AëÐVá ¿Úy´•©¥ÑX±+'ªí“7±£Ãà…™[¹åîK à¹¦ú~¶Ë£6X"»½KtFO2°Ûæ¨ßsJæm½hPײDû¤Ëv:êìLp¼Uíd´*7#Vh’м‘F‰Ý´¹*qxEê#é«ðncQ^7èjÒd€Ø`ÔVr2®¹£Ù£¢¢º¹„Õèø3UÊög¥~jiõW<סÝÃKš„{`B§Iöa-æ³àRwŒd€”ö°Å¸7kK êÖÕ À5tð~D˜| ,«€= ¿¥2‚¢ïÃ6šæ‹î`µGD?OÂäÑXI\sÄÚî bÁIˆo¨ãNIG-è´¢ç’Üì„8Ù|±R¤©BË]Ùf¤d@…p@¨/Ø&¯ÜZ°å¨ú<’tÖZinų'¢ýÂ4‚²»²]ÍbÓX±Ï™ÊòƒHFÙL²Šš½ÐRw¦»`rêMeª9g©("òѤ^,g¢..ödVŽêÌÂqå“[ln³u×B&¯ ô{•­ÉÐ`8êŽÊ^ß÷t~å೩Zžú‚õÁög pÿ¨¬S~Qª‘ÂZmÂ+ñPùþUèy¼ ¿â,ô‹°ûElŸÀåŒ2·s#JjÑ]Ìx‰^¥º#¡Zÿß5Fû–ðoAjÍe„úMrÒ]ÇQÚœ™|G:ÒýXâ¯$„ñŽÃŽ—De¢›¼Ý¼/JQÝkäšjò¾Ë"r»l"®Ö RÎLÛÙÑ̈öÕ]ð(ÊÍ]—Qc™lîi-PÀ¨¨¯gб1G]"þ^ŠŠ^­Eï]ÌZÂfwÍÙ©l,ZÚ¦LeÍB/¡Qw_Á¤fãªùDK1fÚDÎ>–Ö†Feö MdI ê„®Ý ¤­ŸÀ$£®X›Ü –¯ Svi¾¢Õ&kJ“–^"T¤êY/É¥:q¥Gåõ,R6Ⱦ ²®%¸ô@1=h0Ðb¾‰ib¢D“²4D=A¿MÅ»){@‹d½VIµíÕ å«JÝ Ý׋²šÕµgØ–)ßOOÆø&Jí2+vù¡Û$màtß4'Ó¸+cðT$Úɤ¬ìú™²âî¬@NÒ§Þ&i7¡´Ûé¹-rúVÅ¢±ùÔ”ì[Ì|àïé>ÄÃò9-Ñ|b'eûÐ5ª*8—Bïgt9Ç–£ï’Q†—”šÑ= +Ã’oäÕexþV?RŽ5ŽB96À4*¥y%¸‘­(ë&±YIlúP·Ü BòÕìg™ÏR#z Oà~êÝ‘QôÓÀ©¬7ÔÐUçÉIÛW„p6oÄÔæ©dñîöd¤\Ùº\õT6Z™ÓJ*ýøxâS݈4Ÿ¹-Žy»ÉöÐÖr´]·0Úâu Ç¢.”9¥}‘¤$?ÜÇÒ?½Û•°´ rÓVʉ«SéÆëÜô2µ¢ºîG3«ZïOð\Ø¡_#!d¶ˆ¦¯c¢.í>ǸeÍ|×V(ÆO%Óy!¬„Y‘¥­"õBÖ7Zr}„½ÝI¯ŠVêÄW+Øë¤­Iw9w;4‚D…(Mú²tGlåÜPßé¾ìk4Úø°¢Ÿ› nÐä€Mo¨ÜÒ†¸#¸¦ýV逦äÚÔòØ–p €îÇÌÖÜ•Ô/;©Ëšœ_bŒxgý6º3cq w^àÈÆJ( !€›°Äô`-Ý£Üå²yòf´F¶¾IÕ6¹‘“Næ©Ùx9ø„Ô–pÅ"ÝHEs] úÍËI'fU³uðM͵,hòJ÷ZãOšŠ}0OFxcMá ™+¡Ñ}$·&k>EJ_oRÚ¼ywEFkÝm‹‹´¬Gqß@-aا –UÆô¹P\bDÎ q³9y$¥Ëc°RŠ’³%ƒ¤–uÛ±~Õg¸šåwbR»»ÐŠÑY;f¬ó¡Kˆ¡6¢›z!œü]NX(-õðQÉ6êT”žäjí¸ÞAz¼i¦#ÑÜcòÌå–’:¨GÔß@*»FÇ+w•ë<Øç[²Ò7Šä¥Ý™ÓNRɤçm¢oŒ™q2´T7y‘¼t»ÓVpÎnsmêÀIt:šQJ;EÑç#’êKoÉœ¥Ìăpðu)/Q+Nå,0)]ÏäÊr½Fû›C RèŽmÀ醑oÁR—,Ñv§qÏTéå~ ëFò²YÕyZj㬯²øŽu›5¸·’í/ÙƒVzW¿S]“éƒ=¡ý½B£êog‘Ç_’Ú½4ú•ä£cŸ‹«ôè4µ–Ðy|e_©]¤ý1Â5R9Ày$º™iìÁZœRÑ$'¹L—£-d¢½LψyK¡´79jËš^Y‚X,°7á¤×TtœTݪ§Üí5€*b¾Gq=n@‚öò Њ¤ú”LrQ¨€Æô0 Æ$0!½€ËðQ+¨Ëê]â•[·ôÔšÓnÉhÌãüV´ž«äº‘ç¦ÒÕheË4Ù´pì!\EEßÓø*´9j>ùF}H­è¼ÊF‡mŒá,©îµ5š³¿\•­Õû‘¹Oa5¹^ÒLÝ;çòsêiˉD×,î´`×MÍR¿[68²ÌôyÜÑ;–tš J† _R5³±`¨YÞå%` 6¬þ¥G/Á×ÅTä§ÊždpÜ•a6ihþæqWfã»2§Êçm%Ë’’:ôƒü%aYÝà¬9;°Š»DV´ýÜŸÀ ´ï©SûaòÇwä¨Ïˆ—-.U¬¿ƒ—Éu§ÏY½– ^ÊÙ¢Œyi9=̤ù›osZ¯–* ˜n@öÀ-B©hR݉lY€çŠ õv0¶M«»Fù1½– kMó&Š–`Ÿc:>ëv5ÖòSwÍ$¹èÉo©9Zö7ƒõ4XŽWv¿qß™w\²q{2}³ìE;ô6ŽðfÖ4.Ÿð馓ê$­"£¥‡lÜÓ,¸Š¿JŒ¥¾‹Éä|u^jŠšx޾NAVè«Ö‚ÿr ׆Wâiù"½fKö”Éz"ÖC|´Û9%ª]ŽšÎÔíÕœÒÌ¿«P^çØÕþø"’´wbŸ»ä[ôâŒaª&œKÑÅz_A MvÉŸƒEí“舊»]¢¦]1A'y7ò5íŒÚß={µÚx´4» Þ²‘Ådë¤ïMx,J°4€0h10n@šI݆)åVYµÉËeÜbÜq€¤ñZŠz 3’º²{—RVVZ³’êKV•ã“5‹šC*ÌËK™Uý·6NñRì`³ÜÒ›¼<1\DoMKtr±´¡oƒ«I­Ó- ‹¶NŸu$úËׇ—©Áèô;`U‡l>ÂÑßr*RÍ™Qvv¸¤·@ïdD^,òg”jÑ©õkãp‹ë¨Ú³¸ZùÂÙè2 1âjrRik, 9+Ôú•ÛDdô°ÉÕ™i¥8Ù]åÛE]¤A½%d™¥GË» ?üþEUä¨Éô5¤²ÛÑ+ÜÙúiÙn@®ÛmêØêKéÑ“ZûP%oþncÅOÔ ´òQ…ͨ+Ô¾É\Äè¢y?Øœ¹¤Ù=†õ'b)¶ а×¹vi}K· Wwªû`Éëà·$Û“o$]7«é;My6K2F g¿{ð†&mi# %soðÂ"²å«u¾H¨¯gÔ׈WQ‘ž°}Qh)»ÆÏU¡p÷#ÝYîtA)ZKåt ÙV¢¥NS{!ÃK\}\ªKl³~#ŽMÊNOW‘hðjüT~ƒ«€_ýCí‹Ü[¡½Í# îòHËYIìiS32›²·\³5[C1›Ž9kÈ£ŽUÒ%AzqòDi:ÎóA/b )7Õ’½²}¬TßôÒîKö.ùð$¯.ÀžÚÀ-€kÁ\×Ô‘­@·ˆy:8wxX唚²Øèáž,Jè@ ãã-âì ¡|‹Ff;wò0¬&®0РܦJÔ 'pž]»FãÜά­€‰»¿„È–ÅMæ=Ð¥í]Œ¨‹õQe¾£½šyOmÈ3ƒ4§‰µÕ§i¼I>Œ+h?W“"6¨ŸTjñ+¡ñæ§}ѯ˰F\²O£ò- «®I7u£Fmdtß=+o÷+– ]?}×Aµur*bìm¬Œw¹¢xH±êNSÊ4„1 óøš¼õ´XGeyòRvÕásµü¬KvMîN¬Ö Ñ2¢] ¤³s=~M ­-ØSêú\ÊoSUìo«²1“»-ERä\ç°…E>mÊ‚¶zWQM½"®p6äÛz·s§‰—-%å–r-k[%«:*4šŠÒ*ÆtW«™ì¯ò;²)j'›X¦¹%``ióЭ)Í“ «Šiu`a'‹½‡,±h,*WPo¡ÊµÁ¼_ôâú0*Yf‰Ý|Jê]Í)¾eó`‹©êáïÐÆ:kòoxJ'<=¶- èßSZWWdÛ-=µ8Ùwd‚Ü”!)=Osu&æõlíãªrÁR[圩AÙþž¿©7Øã;¿Ó—ê?D®Ö|°o°Ìë¿B]Y¤c{LÉå«êÙ£÷7Ù‘O5"»˜iÐýÒü8»ìMó&?¶^ Œ'úžjìýGä'ﱩö®ÄÏÜ—DTÕêÛÂ3ošMõBÞã{+ÞB–¦D6·aÅ ô*8L'vmÂû¤s³~Ú¢]Pˆë—ÿ¡­    ÔOA¼¢^„ xh‡,µî4ïä5DÙ¦€“¸ÊŸÀL0X@0fí Ý6L^W‘§èB†ÄV€T'…L*;É.†·S²1–[}Yš°ç˜D½»«„Ÿ¢>C퉗¬ìN’)bá\ïSE˜“5iµÜpz¯7Oš ö±¢õÃ;£i%òiOtj#‘«6­”,šW-Vúä„eWF\µz<Jð›9Þ§KõÒŒ÷ܨvÝ IgF(»;•%urÓ°EõØqÙ «i¡C޶,‡‚¢Ë@PzŸN“{¼ 98š¼õ´Ž‹µ°'¯_82ÑÅ_­Ù`˜%k¼WÁºÃðŒ ­che®ïø¹b ¥Í+XÖ£Ë&’K/BŠ–ª=2ËK =u&¦ÛÜ*K–—\ 9x‰óÔ} —@ywÜZKP­¡uI=äÄË›K,@ ãH’•äŠrv±n f邲иæë®KAVy]‘Kc:®ò{ä Ÿ‘ ±'ÔmèhÄÖ–þ¹ç#§¿äOر°Sk›à˜?[F6œ’5¾/±Uª¾êåñMØßÞ‰Q»’ìG[–’¦µ–¾+Š­GV¬¦÷dzéëús}Ï<ô¸ÿÓ·þâÄ®£ Îõ"ºœÓÍf*D7î}‚ê_¢lOFU%g7ØÊ´^Ò¶òжA,E|²Žu™üƒÍWät½Â§ú‰ü‘I¿TåäÍt)û;¶LV@o?#ër@{†é-Øú”ý¶Ôl«¹µU‰Š_“HË•§¸qwœ‘fWµo&¦ã ¸7À'‘5`ÜÊ©‰<ûI¹QXÃ(‹à.Ó,d 11€œÙmØÊYv%"ž"¼Ô騍hǪ°*2ž9ükšT÷y¹œrš3TOô×YŠð9~—É)á=maé·@û©¨´fqv’5–`ÿ&/P:!ï·\ OÉŠxM3g‰&º–"x˜Þ*]c¶¤y©Év8±aH}¨KB”µ¸1^îÛ Ý”°„•®Ød`²ˆEÁz€퓞M›ÍÚ2; p+bé¿Z]QôŽž'7û<`˜û×’–’]ÈÈÚú;ª»‹ì,¸·áš5ÍTE%Ë ésͯSêÕrÛEàïâ&¡O‘k,|`zœÿk,òÏ[…Vá©ø,JØåoúö:&ì—vs­eàR"^×äºx§'Õ¤CÑy.+ú+¼®dh°Ñ51ö•kÉx"«ÌôèQѾ̘c™ôL¥úrd¯Ó“¿b–"—È££Gy[¦{$‚…¡;èSÂWцÀÀ|„u»¬±^óð= ú¼ØR—²]“:Uš0}.tSw§ØÔEP €=¿ iØÏFÉUwÁ: Ó ×½Ø'”2QêReˆ`PÔdܤLåË÷^ó}8”¾EOÛ&8fHÊŠÔ\}¨‰fF‹,è¯ÈɃË(±Õ^«öfk_'EEx>¨æM¸³5b俦ú\ÍYE_©£ÒlÏíðÈ.ÚÖ‹òJwEOÚFc%fj½Â¨½Wê†ccm`¿µìmMÝI|ˆ6Né3Žk–mw:ᡇM>¦¯ÀkEä-ìe[Q’ö=\J߃ží5mQÖŸ<­’õ¬±r–„Û¯LD dØhÒ¤ì®Ú@³’äòê}*Mï¢ ãâªsU²Ò8ù0½ÅãR4¬W*3Š»Ê5Ò-N¬rvŠKVYúª§²ÈEr¦º+#iú`£ÐÊš»väÍ&ï"¡ErÅÈtÖìRÚ?,Ñ,(õÈו £¼ÙÉ'yÕŸ=I>šßöè•Ý–§LñhôFT#zœÖÑ\¹e‘PÞ/¸—`Ìš¶MaI¼°%亂ŠÊOà®oíJ/ÀF6Étµodƒš}M½94¬í°Õ¢»»™niUúÒ葞è)=ì!½ÄQ[ ;4Ūø ¬AЕ¥%Ø—î){“ê„õXf º6‡·&4´^M’\¼½MD¯:µO©UÉh´9ä­7äÑâR"~ëõDT€ÅjÓþÔxçµjq],Jš)y±ŽÍ•'z²ì‰~Çä”CÒ?&šBšù2—Ú»µê‚è‘Ç20›mI­ÿìÞ8R}Žy{>J (ü‰/饳åŠiÅ5á² [}XØ–XõQ! nà€£À–£zh³)-…°Û´[Ü“õ[ ÖŒ”³‘¯kzNü;ìΚ?¤ŽZ6ä’ðΚ/Ñòj%h@ÿ‚„õ=.&¯‘ía&@!^è_QÉsA®¨Ó.1ÚÊÁºÉJ<ÎÛ™h¹SÏCJrq—f'Û¡JáZîábbùpÚ,Ú¸Ä2%—mŠnÈIu8¬\MNz'ˆàé«W’“’Õá{X%X{ãJø"® šÄPÒV¹+.û6ùaÒ^™=Þl¶7¤¬¡Ù]´¤û+rîöwa/L-×AÏ6ØT—-9Kw„TW,.·9ø™z”‘Y <%Ô‚ä›–^…((û³ÙWF/é;nÊp[»öF’VJ8I#7(­²ÑXn]ÉMjÅu}­KòZ’x¹œo|h\S“î’ËkåJ·eJ8Ot&½qì\G Ýê6ú‹pnò¿pÜ)=DSÐÈ+`û´ ¬Ü’týŒrÔQw¦ŸF\•Àª*í¢£;×}6%5Nå ¢íR/ª*9+®Zòòe=àéã#jÍõIœÒöx`@Jí#ÚÑx_,POÛØUqMxEKßm¬Eµd´l}X¶Ö ›O”ÖŒ7Ð#§È-@®„ÏU…a_±ží€lØ×µØ.4¯”]ª8õŽšOú~ÇIÿZ/«±ÙOÙ/7,F $NŒÈÚ¨’㛡å‰ê®¤Wt ŒŒ}\̱'q”nÃ%åK(†&10V¸†N-¬d•M·ÑK›’‚jа¡ˆ6TýŒŸ³àz=Å?k<0—·]ÉâˆášÇ¡¡bP@´(›/ŒZ“ð;ç°GÚÙgžGðlÕÕŽe+ëm ©Ïw•”£ËÍà…Ÿ”tTÓ{ØÆ1–Öv%ƒ5†kÄ—NI¿K* Ù¦™5ê*8dÊ2zE•OÌ+9ÆÓjÀ³Ò¥94ïo!-k%ø."黯?‚㡃òRM6XŽzFm[Aór«%‘Ö\³Rêf™*©T“Þß);6ÝþHЏäöZ"vÙ¤'k&d—rÒÍð ÜŽM¤²Íê›—;åZnDª_Ó!N_F‹t°‰ªÃˆŸ=K/lLvº"¤¸¬ÿÙÜÖ*ÈKKÄ[è-]ÂnÉ %.i$·gRÒMo„aEzÛ莈¯TWL•[ "=Ó²Ñ`¹>Xß¡4ãev6¢ÛÚ(äånNrvÜÞ´ù"¢²ÞNY6Ö^¢ùÒVˆé'*‰¼%“8Çw©½¿Q™ñõ-еš¯É•GÍRO¹ôÈ—Àò!쀭‚:‰ìTú2vIuË'd ó;†È¥¡•¤IÙ§Ðïßo'ÝEÞ>b‹tß¦Ý 2¦ýrîjj ²04KWE€Á)[Q½&µ'}Š'¹B€=RØ`Øa° ö MOi1w’EOÚE?q/U¤³à™èYÔTÑ„ôC·žÄñDrhDU—rÖˆ±ž¶;”Kxcû±ÄV6µ×ba'š-e3-Ì«±5(ÝhÉÞËR••ºšIe=Í2NV]õ®;¨¬€Û²¹M¦K•¤îðö!âWØ–«^fâGÔi뀋µÓÐͶ›LhèRMî‹0Né>†×ÅË”ð¯ÐÏX¦k%x´gËË—û £–Vµ¼ô¡³`Óyžä©Fú³E¬%r‘E£ž¬¹¥e¢Á´åË÷ØÁFÙH¨Fùg/WêUv~˜á5§ÉI¿ºXG zê£K pYeËLV&üÒ¹’¾ËS6îÛ.NÉ/“4®í»¢Œ_'ü™ÑIsNRؘÁF×ûQ´-}µ,B•®“Ïa¼Ú?’b®Û¹5'jmï,"Žz²ú•ÛDCÃðŠV!ës*Û&ÏÓM#kškòk6¹­Ða ì§’’Í–¤Û%ÇÓoÀ7¤6_»’ÐK«*9jOúw9¸§ýEö£®œmNÝβæ©'Õ—ÄDqù)êLu/"¥0ì4»…½LnãKÔÔcŸ$TŸ<±íXE9ªTâ·›²1[ù*VÐÙf›ïmK0_‚*êz¸9v8—»ÉÝOÕBqìplŠŒ·ËÞüˆ(:8%~&>ÚÝãQ÷98}vúE_úeÝ„Oþ¿Ÿ¹!«}%äR~´@é{&ÑpKÒE5nßviMe2ŒfïRoàq÷¯‚o{¾¬¥«}ø Tó?ÜÃYC“{E˜lú-Xd6 À ”ß-7ø&ÙH*ì–ÀFˆrÐVÈÞ $[ö¢wЩh¼'g ïòŽ-®ê‹´NÕQ¹Ï5i§t™aL €C „^¨¡0€ è1!€ ÀOQ¡n07d·z‰lŠZ38ûÍ„‚gídSÝö.z?Óö±ê­jDµeÇQK\XˆK ­"^öD¥¢%hTtB!‘S_%™Ë‹ë‚Ðä•îMLBû–ÕÈ«í¶ú’«>膮մeGÛkæøâMêdRÕô5§.xgS(­ZÐTÛRºÛRÁЗS)»Ë:·uu¹‹Î¾ Hs‹ºkFfÝö5wä¿BRZdnžÌ'ß`вÏઊñMlA7ºi~ ©»Á~xÞèÚ–è°­”¤Ôš62©‰ù-"lŸa¨ôdÞ夭s!ò»ë‚Ò±*räƒf¢2«?U–Áwü™«É޼Õ*\«Ý"u\õª}J­¯jÂ3 ­Â‚à®ÈWêkd@IÙ (®VÞtjòn.N”ñ¶Lܯ¡­5h7»À«ÊËû™´ôIN6—…b­y±e¹Í^iÎËE„o9òBSøG²á6Ⱦ×A-¯¹­dÙ-Ýê_¶ ¸Âa¸íUÙRwvZ ^˜‰c 4–÷ði•oÁ .ÈÒ+( ä¡'ØóÛÆÙľZ =YÄõ-Hqnåg©4êÈ©MÝ~IJ’vØ ¾P✥a/pªÏéÑǺX*µyë&½±vFËÝ#ŒìNó¿XÜõ4¢ðû3&]-eàŠœ‘çÉZR]ÝMÚ·“–ºå¯Qg.åñT÷’\þßWï¨ÿÚuo$¸½bí$·d·ÉÞáwÜ£dEU‹–W‹F‘Í»²¸Œ+H«#*ÎíGdlíߡΕÝÛ5H¨E%vqÕ©õ*¹m¢GMyZ«Wüܤ¸Òm¬”P+õ±á å—¢Æ;‚²Ð›Ý€ïÿôÊR»m—7hØÎîà8«»PYŒ^Ùfä—VuSWÏR£HáwcÛø”¹S“ÑüD®ÔÛü˜¬ŽRo;¶-#s*‡—qÓ\ÓÎÙ&æ”ס¾¸ ©<"^ zö%äRÕ²Ë@P îTas°Ù½uòg:|¶wº}Mè+D±qr½HÇ¢9ž¦•¥ÍZO¹€D¾¤Ä´ˆ©."k7*`TäÎJÓú•Z,#§ˆŸÒ¥e¬ÿƒˆ : î©¾Ç)ÓOô ú6ˆ)¯ØtýþDýÌ"í5ä ㊑}Œxµn"ýUÍ^±}Ú#^ªrê¬TrÏÚŒÍf½?&A@ÛÁ~CzŸ¥&| oB}\­ûÕ‹Pж ?gòD´‘¢Õx3µî¼¬×±tB©ŠÈê+Ív_ÒŠêÀÉ,Å/kîÅz ;AydW¢Œ·±­o¶=0c½Àá¸X4 KBV…ÞɾÀLæúhC×R·d€ÓÇ‘n10Âa-l?µyÀ ¯¯A-³º¦bŸS:o–ªüOÕÃö ÷-ê:ÀºO¨@jí CÀOFC@0d컀¤î$%íö2¡b¤¼±+z›ìRö¢¢[õ x°ß¼Rwm?°hRÒÀµ«nDbÕî^ÌK`V«¨¡«(S¯º¢g™$OG4=ù*Ù±ôÍöf’ꌴ-~ƒ–¯R@òù‚..í&gRñ§Ê÷cŽdº‘9¤ùd¯Q=ûF|²í¸(]zûn%EûYÒõ¾ÌN8k}I¢Û,–šÚÙ4Ë_ÀñQRÆŒÉjÑU2“&ÎJÖ›Fq÷"½P {A3hÊÙ±¤VäÊêO¹IÚ7{**É%fðJ×™á#>g9_¹5êZÐ^YM¹IÉ“ùdvdQy>ÅÅ_$¥woɦˆW¶/Àµb“Ù2»a6ó š/D´£vßÁÒ•’FT¡hG¾Mcê“{lXŠxG=yÉ~ ÜdžSVìz|Á|Øa¯0O=7ÊõIüéRzÁ"a®‚}N×ÃÒ—UòKá"ô›ùk\”·7|$Ö’‹"T*%íÜ3½Œ—†2q”¢ÓW[¢§îmIÞ0Y–¾MN À]Æ-| Æ&Ü¥‚RÉBÊNù.RÛ©¯‰Vu½É½µ owØ­žƒÙÿ°OßòU½BÇ8Q5”ÔnÍŠ?àôbßà­‰¾¬!¬&(e¶7í&6W}÷ ¿P¾á,ȊʪµWù±EWXRøb¥í}‡¡<Êý…ê»Ð%‚)Ã9Û»o®N˜{Z9{T5)Ô’û™1Öàð§Ô–¼Ì鋿В8Ö†´*rË•èË*Ví]¼HÜάwE¤%®ÖÔˆÇÔÓиf×*JÎätÓÝj ’Ðʼ½*+Vlr·Í'.º¬ ªqr{¹7'–Í«Jö‚xZù1oc*CKòôVkîõ`8ÆÈ xð$¯ØEvC󀓻ÇÁ RËð\<’&ÖV:(BÙÕâ.Ûá•£bVlö¥ÉÙ¤aÄOì_';VCw“m‰êeBºM‘û•?j]Iðqö7×XKÀžÑC—@¬-‘³Àh­¾X’È7‹€ž¥^Ë•wØ ’´]Œ¸·ì‡Esx«¥sˆ—7.‹FiÝ tJX"œJè$ZVµ€q´SrÄVYÅRn¤ÜÞ¬èâ§Ê•%æG)@´5’êŒh~ª]SgíZ‹íLkÚJÌ|2Šy§o(Ú‡é# /&ô1NÝ,JæâcjÿòG éqkÙ#Îxm B¯[…Vá¡n†Æ\2· OÁ©¦@`%¸÷ NÂÔ$´®ÈªXY§be+¶–ˆ‰<‹Es;6 ¦C°Gßà´hM‘Ô nïÉ<Ù@ߤ’ æÉ\Ø2`Z›¹Q›1¾J‹Üº7ºlN–¨Í3R˨ˆÒQ•Óf€ ­Æ$1n0°†$•À™hK[‚ÖÁ%‘Û(Ê¥bK±vËÃ}Gª¿`Ó]Æ'§Èʃ©?û,Vì_{ðZý@·Ì™KK‘ODM°†ô )h¼Š•»o) õàz¦õl˜ê9oä…©(ªŽÐM鹌SQw¾¬¹z©KÁ„«aE¥—ÔWV)õ±-áV°—s sy6½¤—Da{ù7ÐODhšwºÑÊí‹(ëaè%'¡N-ÓJ|ðΫRÚº³9©¾I_òu^èÔe–ħìË)«»î'Ð`˜jhe©dÔB“WMu9¤ù"徉7»}Ž.!·U«ah*Æoæâ²[yÁQ…òõ2¢z»v-Û@xÂÔ]¿,äMÛ’œ¹WàÎ÷ÉQêĕˊ»¡»6´T7z“N6±¬V­îX†Žzó¼¹VˆÚrå]ÎI;²Ò%±,°a¥Ù•LÞp(fitÈ™pVƒoÀ½R¿AU“ äqYIÞ„±ß7ØO2ô5§Õú‘ó3nuhÛ¥Â-znÞÇ›&Üœž­Üô+Ï–„¥Õyiµ*ØÕ1Ûr*â²]Õ8ºE§„o„aÅÔæŸÓZGùžRr““Õˆ é;U’i'ÑÕ³ìJû‹xœˆ^ö–èƒJ?wƒ®—µùg%+sùGe?e˳âUèߣ<Éûߓլ“¥5Úç—SÞÅ"+Ø¡úÿâ¿‚Û±?BŸüWðSÔÓ*  K@`¶W‘7eoÈs>VÛÐÍ»¶Ù-SXDêÇ-¯dÙ• ó65©+T0 <Š2î'¸“öd'бmhYb“ÈИb–"Fø+m@w6ƒ½4sß¾æÔž,J±§t' E•Ý‘7\¡?h—°”&â5(ä‹] ÖäSm<ܤ×*ÉúþGbþÛ”Jö Òž·¥ ­—r—´™kDH¡ì2eî^´™fAsè&ß>ž|²(¨BÄ‹©¯Á »è…#Eœ©Y¾ÇL^LªÙMã¸Ì­t‡¹|[š8 ZÔ~Llk¯{jdšéû…=Â8у–4BR}@´¥ÐwÇýÂ/UÛÛòoNx˹ÌÊ‹i ŽÁ5›ŠDrú®X Ø “¶7g?MÊQz&²t»jMUzw[«–0Qoa½0ò,¼R}´|»]ì•´Ë3yÿ° ü,¡$h•¼€[d©ÂÞw(oø5¶yV»• ¶öX-´•ÞˆåI#*“æi-5/5$ÚoàÁ»OTŒ™–ˆS~œÁwmØ ÜÕ«$ºÅsIt4y}ÀiZ(Zqֶ鑽.²¶ïPyl4®/þ"ã„ï°~Uôì(êMÛyò˦®À\[µ8Cw“’Ù7âåzÖþÕcZ¥ØÎ:ØÞ”[zU9ý_sÂòyÚ³n&¯Ô©dý1Â1* ìoÔŸUr4¨Š¶²&xdMÚªòwSö7´ïòwRö|–%2kª<ª·æWÖǯº{ž_­Qùh´ŒŠö(~…?ø¯à§©4?BŸüWðWÜi• è @“- %ç2W¹–BÔ”KÑ­õ#t†äßa,dŠMä™=ŠH†îðERÇa\ˆ6`' ´Cè&a§ ¯¸q=F„ZT%ì±¥'iÛª3ÒÃNÒO¸ˆèz‰;4[W3x5F€%”†T Û¾V†¥Ì¬õLv²hÏ1i𼫑YæÈî[WW%¥d@íªêÅÆ¶ÄÚD½!¸-n!ŠZ ™ûE´-hˆÑnH©–[ᬄô”½LWö¾å/k}Œå…É¥E”CÃ4ž‹É“‹Dq )­*ö «š—€2‡·ä·£—b!‹KôŸ’†ÆVÁ¤u3èš¶a7wpžÎÀžAhî\{’– ‚ÅÀÖfjck;§¡ªÐÔJbzX9—^Áb¢nœv sA®¨9m~š“;[B+™¸­[~sm5¢èUDã9.äR¶ÚW+l«Yc,.SJpo-³v²n—.XBöá,•òùÜq²õ"¬ÜU£«5ÄgéqO-ØÛÛD'Œn>FÚPïbUe7©™Rw$Šðfõ*}zÞà]5éreG[ü…¹bã„ØÀ%wÙ£ÑX±l[³Ø¿à­Ôzj,¿)iäÚ’õ#ü_’”罄GIsNRÆX¬'‘¥žåUEgÆ£«S’žd¬» xVÙe³žrs•È$ ¦ú1ùMY4_ôüŠžWÁ¬Wƒ¾–i§Ôà^ÔvÐýX•rÇ)çñªÕ“Зµ>‡²Ÿ‚Ò8€ŠõøoþÚŸ‚߸υwá¡àÒÞ£L«`Ô7Ü؇£eÝ$g'üˆ‡¼´#‰ü„–leRô%^ãžÈKCË ˜À z±¡0Q¢P \z±à5¡_i/QìèpØ@uAÞ ¤Ìè¿K] MÆBV@Dåen¤¯c ê/±™Q• _àˆ{‚8šê ÒÞ–ˆzZæž73zŠCY_ ݦ˜.‚yŠ}À×d=Ä´æ ^ÑŠ^Ö[½ÉèQ Ÿ¹ŽzÊ—@&>ÖŒê{¬\H©îdñZÏ1º2fÏ4þ ¶†ØÒ¼mÕö*/( •íIb1îÅQZvù žØç`%+3'enokÅ3»·ÐŠH}Åq€ã¸Ð–£zØ Žpj°®Ìé¬ÜÕ€+»áMYq5yZŒ^MOˆsw¨ã¶Æ´çt¯ù2”¾¥8ÕZîU=|’tnO"½È“qwE}D’orê1¯Ï~¨ÉG¢go¥ôaʆ.¹cJO\#XÒQ_ökk)Â*òšC l‡é‚m¿–aS‹ŒU ®ÎIÔWyKGTø‡Vj<'¬YÏšÞ˜ìgErSszËÙ.X¥òÿÁÛ)?,Sw·|²–—ëƒ9;¶È¨a³MâÀCo"‚æ’¾›ƒ4‚´[“»ÔizP™O.È–àÝÙOKð€_ä¤+NÊËpùŸm׺ëaGKlZؾ!òðê=XA^Y#‹~¥ˆ±èµ…}Þ‚Š¾^ˆ¬œÞÚQVV\‹Ë1m¶Þ¬EÐÌ$»£If Á—ó5Úæ¯ÚA0ö¿'o ú_'Êêvp¿¦ü–u+V¹¢ÑËÆÇúQ}ލîcÆ+Ðl¨òÀ=N ß…kÿ&öÉÍÀ;ðöé&u#L0Üÿk#û¾Þ c6ÂF}<™«ÿ³äê0ûîÅßR ›¼®C`ÑÒÂê÷ØOPB`5‹øÔkÛqnZ°Ü=IZ–€¸ž kEÚ¥º"vqg_sQ(\B¡€ ê‚RåD'èý…ÊÞÝ…¸7ê2¥ ÿÙò=ž¬‚âí.P’±3ĵ/ܰQ=èÿ#kÒ-ü«¤}¨bµ Ò=Öà¯rÌKÝð?´LtA+æÃ‰3y°ñT–†wRÖÆÚüAÙµÔ”t/bK¡‹ÐÚÔg5|¢Ña¢^…ìeEE~WðMGvÕô6Ö&Ý&ËQQÄZês5gØÚí&ßFg$¤®E@Àv)-–†‘WV¢¬“.ÜÏ¡/ ÝM ¬›,A9*pmžtŸ4œ¯–kÄÕú“åOÒŒ^UÅ#^iIÁé=<›Æñvz¦q^ϱ’«Ïw‡ä ju^HµàÑzÓKà˜=º2\ôdº«þ(ÎKI5×'|=Íw8&¹$áÑØç'‡)~IK9À‘t¡õ$¢·djuÒ‡Ò¥Ìת_ÀEÙJjÞÈÿÛ~XÒ劋Õåÿ„%«—@ axÁ“.X²3y"’É ÞWع;EõЀŒÑ«E–R¾š•'vqiY\˜+¶Ê“À ÷'Ww ÃàÜ—êw°Y¸m+^ÀŠŠýÀÖšõµŸ5i[©Ø½”º#‰úU÷*¯h­ jÉJV^ÔiR\ǹœäPðÿ©n©›lü˜pÿ¯Á¾œÈ‚cï±ÙÂþ›òq}Ìíá½’òYÔ­c¯Ãȵïbš½«8§¡þžÿ§5Üì8?ÓŸª¢ì™Þj3Fá¸÷ü î%îcÜ –Æobêj™÷#5IÿЪêÞ©"g—~Ķ7°µØR4-@6Aì-€{!-Fô n"–¤€ã©iêJ‘;ƒZJÁ¸ 4Ÿ55ø9¶6 ìÜ~KµÐKò6+èÊŠ€™JÎÀDŸ7ð5ìù&ÙýË~Ëv2¬ã¨¤ï’¢­vM²‘KÜK×ÉSê-Ó`9ê•§m˜KÚ™E±FÍþ ‹æ÷B·¨£@Ñ ¨ ÝøÂYl ˆÉû¼š½ õ‘*Óô¿[¦iQZLÕ­bR7ƒ¼/V¶,&º0—¹ø/ƒ&¬ì4ûŽZ'ð+u25‰ÏQ5Q¯ÁÓ ëÆñæZ£Wƒ-SðÌ–<ý¯Ã12ªjÞÊãXðÊôßV€HÒšµÛø"ñ]Ù¬vi^Dñ5~œ9W¹ÿÆ”žˆó'QÔªä÷5ÀÚÈõˆµŠaÑ•&»›póåŸ+Ò_³2×(ô㘳5é“ü‡©õ!Í¾Èæ­;• «KÊ9x¨ÿZÿÜ®uK1O¡—á ÛGbKX/ØMšR£*³²ÂZ°«áèýIsKÙÜé^¹9½ˆm%N ÈnÉYh‚"oÞ¢Ò×Û"½å£w·w’–HÕ•"_¦=ØTIÞAÔº˲ý€qѱ{‘ZE"¡zž»ÜTRŠù³zçR_@a{ Z‰»€,•ؘ¬–µ¸³cHêBÁ¤¬”h>ø95õKDoÅ¿T`´Jç%Yý‹m|•ÊNr»PU7j°}ÑÖýÍIÙÜîŸêv`dýÇg š_'µGo úOȉZýÿk]Jû‚ö•ºšG‹%iµÜEÕV«5܃-:¸n!®±=#Éá%ËÄþX±š¢V£Ü# À‰û‘œ½æ’Õ¿{ü« N×}&_o€¨òKDÈ3Ý€=rM`[D-€A°\Ø÷кb£¨1-FØ a-Fؘ֘¬Ž2åšl[ `;I’ôŠœ¹©®ºclˆ»¡’žJ&ìˆÔ%+°Óá©G2‚¥”Ñö,‚-éd¬Ë÷.X!n@åí@´£òk`V´Ìß´Ñ{z2‡MÚV¾«Zu9Ù¼4s¨…^€-†iºŒ ‘ ^Cž¬!î%ê•g„Bv*³É »Ø—£jz±ÉNW›W4eœF{4JÏ’ô"JÒo¡¢Ð1£ ‰‹Î #G—™v2±×R<ðijrµ¶¡›aê$E8FìÝD˜FÊæ|]o¥O’/Õ/رñu¹ß,_¥~ç0Ö`K Ò/ ‚ж°@I Z—ª3îÜ-O§VÍúe†wT^›ô<·¢v=>µê°ÍD8¥(Û©5 åAÅ,ì];¦Ñ ‘Tø6ÝêatGKµ4¡áï°”T|õ%G•u{²'+Ñs–?ƒ(¦ß;ø%SKo–Kwm–ý*ßsÔ‰]F¯±œ­&ûè\ݽ$ê’Á+QÉãSƒ”¬€q3»ö¢î܇6’QŽˆ„ð؃\ívÁ:ŽøW]€iY%Œ‡`½ØÖu¥“xEC©´_$%9h•ËÉÄÏ–r–÷²8Ê©79¶HPvߨû#ˆë‹½>ßä ž¨ëá?N_ò9j-N®ôŸ‘·&_©…+s#UW­ÄOÉ‘ÑÆ«q/ÁÎeUN\µc.ÑážÕ)sR„º¤XUÐô*¥€tdŒÞfíÔÓ.ÆmÙ7ÔÍVswÁ¿Jò) û>H©yèoA §Èl VÜCZ6ØCê GQ‚Ü6® ax<8HLhĆò„€Ú„²×\›œ‘n->çUî®D©~ë–LâÀ ˜7dK$²)¼Lô&^ä¶2ªŠÕ†öîå_‘oò<l¦¢½’Ž­v±‚Õ±éa=ã¿jßr‰z•Mò˰š%]@Lk;mm<¾ã‚Ô’lÒ>ÒEc<¹y"=zd¶®›îKÂ}̇MúѼ•Ñ̰Ó:ž†¡Rò´YK©K¨[(!IÚ$Ãr§í°½öL™ÓSΨÛÀl€ÅÑšz] oucTÇ¢»º‰Î4i¹=¿s̨åRno-šñ¾¬íö­;˜;¯ ”‚Ø£O)”㟅B±k+þ‰ÁQiüIzlLº¡ßÕûOà‚5Á¿ ?§U+âXlÊÖÑØ£×JÀeÃÔú´“z¬3SL“ijg*ÉSWI ÞÖîKª…7“D­—¢Ð«+vß¹2Î6 ‰<’åÊ­¾ÅI¨,åô0”›mîE.ïQ]ÛcIɤ•Ø ')r¥w¥Ž§JŸ*÷=XãÑ…ñÎ÷2“¾åâ%°Ò(O,¦EJЖîÊ“ÙûÖVUßbµxZ\¨«½…¹z.ì Y’H8É}>ÅoƒJ1²æg/ú„ï(C¢¹gÄ@×I߆]›G!ÓÃæŒ—ISÊ¿c§ƒý'äæ–`¼<é?ù•»ÑŠZ&Ç»ðLÿMš¨áã×õ¢úÄä;8åúoµŽ3*Sƒ—7 ×G–w§Êñœ;¦XWp ãÕ—Á•M6kýy»ÈÍX™<í¶Ì¶É#Ø61 êú ` ƽ¢ÈÔKK @R¬cHÛ`@0ÓÈ-}@íªGE^6èsÞîåS“ŒÓ¾ ÒôÃòQ µNêã(L –]…~ ÷ ˆ§ü25”™WÔPZy }¾¶˜ô^@™ìŹMaòÈeýÆe?r}€q÷[àKT ÚkÈ<2…%ŸKKÝq&E\_,L75ƒ¼MDª ´˜-l[Ä_dK̇?c ÉûmÜMÝõMBæiàÊ©Ç7ZwŠ0NæÐw‰aMni Z‹€‚: ÇJÄÀ%ec—‹­eôâòõ6â+*0ÿsÑuù²õÜU‰³CL<ŠÖ"Ÿ*yE4ùrAqwˆfUš]Øï×B\®î%×RžQ K1¬¯ ä–‹xð+'¨ðµ9*¥|K y6³=*>¥$Þ« ÔJÐM­ØÈ”oص”L¥VØŠ·pp—LvÉ›Œ›ö³:¨n틹¢£7µ¼›F„c™;¾ƒ=:R¨ôÇS¥(ÑŽ5ÝÍ%Œ#žSrxÐ)9HÎOm‡|; B(ŠÈ7löÖ¬†8õÚÊÃBÕ•kÚÀ[²â¯—¡/85…—…7Qùg—ÄÏŸˆ›ïcÒæä§:¥Ï!»»”.•dÿsœÛ…Ôk¬XFßgåéKɆÍtfü'éËþB¾ÿÉ^+ lѤpñ¹¥M÷8GOÿv‘çPtpsåâê¬s• rÎ2è½ ÊC4ÈÑŒŠÓn§ ¯rº´-Mc¹šžM"ïq nV°Ìç–TÕºÔQÖú\²$¶ZЉ«ç¡KRT“mhÉFMzY66œmc+ªi6ÊY’²)+05Z-Ú:Óå–¿À¼uv¿¥õg ·úÖ¾‰™UÃ)®™‘0vš-ïØ*ª† X54YŠí‚n8=P=@Wò5”ÉØià ïè„ÅòËÉZx WÁ¢:xZœµ9^’þNÉ.h´yz4ÓÉéSŸÔ¦¥ù5¹ìHº´Ýî·3³ÜÊ“!´TžÄ0ü hØ´C`'„8ub+H®à'¨â·`—6v)°}†¬¼‚VWOPŠÚ >©_ðK|Í$ðiì¾æýRåZ#jk}´F4Õ¼³Jòú\4žö·ÉbW™ZR´çÕà€ BNõ#-n¿”mÃû_“ž.ô©KÁÕEZ/ÈEK@o1 â"Ùy*3©Õ^œ¬òbK2_Ü•`­xyý:ñ}ìÏ\ðÏb„þ¥Ë{gÉbU·d`ÖMÙ•²)-ZìCÑ{¶KÐÊ“ÑPžˆùwÀýÌO è€í`‚Þ”-ØàÀ4 Q°Z€2lTµàWPzÓÈ0¡K%h4÷¤1ǨžZ²£6—nŒKQ¥6Œ¹•ÆD‹7ÜhCÐÅïÔÒLK/Á*„¬›øBÚÙ)â)Q°¾äŠdÇÜÀ¦ò™- è %†ÃéÔLŠ­ü¡GI i÷Ûm l) hÅ=@hÒ:ÄÓB³ í.–:’ó%Û#Nè;›A³g;ît%TxŠÇ/c\G¦M4šwL`@Ê^¡ ;ù+LEï6$®û àqѲ(yD¯¹‹D1n0%¬‰•’CM{âH!¨Ob‡žfLö/x²%í¸¡Ã64z2!©e‰XK ¨ ’¼ÇŸU'êø,ϯàÑ"j?AŠ5©¢Fiw%êÅG_"¶mи äõ\`±b°§8Ó‹”’5ªT(9IÙ#¿þG5ÕšwK±ÅÄW•yßH­pÕ>•x½ž5qÝ->B^˜st‹f²ìaÅ>N]í`ó@(*›´×|jÈf—½¥Ô–¾¨Czˆ¸h×ÉAÚHï{’\µdí¨.:Û©@SVÎKyJDx©¾Âs}´ØëશåNNû£©çž\&áQIj™ê]J*KG’£à–òmnnÒ!¬ú–›™ÚÓ$»=Ëi=ÁE_P£ !kئÒx&ìاèÞ»!¥Ê¹¥ž‹©s•÷ëÐå+¼±ÉÙrÄm¨+D”·` Éw5§Ë"+™Ýèb³mÞ_dXŠœÕ:2ŸEƒÇÕž‡;SŒÜîyå¤Etprµ~W¤“G¥Ë£ÆM¦šÃG±J¢«J3[¢Ä«2¥íhÔÎ8«$Z‡,F>O/‰Vâj_©êMz1Ôóxµn&]íü¬`Pz\ ^z\XÿDô<š]*±žÛø=w˜Ý2øŒ>á=Ëk~ä½×S*_i/rÒÁ7™|ÞM¿wX@µCè ¯`'VÁ‚ÔÀˆCØ,µ› lÅmý¢ZèÕìÚÊ@ƒqa2»€4\Q6Éiz@Ÿò8ê²ã„8G7.RP‹”’Ô"ÛvHó8ž%Ö•£ˆ-;šâÄJ¼ºAhŒÓ¿¯uô¤ò½§iâFNR‹³YG¯Fª­MIkºèË´ Ä€5 ÄÀ‰a hQì@žXžŒkQX)+nÆ´ D4[ÐVÂGM]¯ríx€}‰ôXcZ4 ]V¾Fµ "8„E¬Ûe%híÜo`$´ü”ƒDD ê?U!_r£}ȪKb„…9Æœ¤ì‘¤œa);$y|G*óé¢#ˆ•ytŠÑ’ÕÀW«ÂÕUh¤ßª8g7QJq‚ûrüœ‘œ ï4û ¶ÝÛ».¦"€Jnñ”~A؈¾Y&k%!ˆb` —¼Sü’žn‡üAÐÖbd¬L]ž¦­]]hÈ3 l6­¨‘B¶NÞ¥é¸=²¼~M(ËéÍL#ºJÖýƒšêÒ×—g ¤¿L©ä• YIµ¡|ý@Ë—«*1V¾l‹¼R»Â2•W'…€ .gyiÑ)¤¬‰ropåÝ‘BWËsI^Í~ÕÿäÀ’¿Ú¿vkI;9KY¯êÕQ^È›Uš§JSè°j#Îâêsñé#yw(³€©iºmáåcŒœ$¤µNáÙ›V¬žÍXªsU)ÆkF®6“ÔÒæqÊÜO”Ló¿Ôõ¢úÄR9Ë@C­Í¥'˜éàóʧ7NjqÕz³“±-z™¤&«SRŽŒM /kðfµ±¯ØÌÒÔ¿eÌÍ$¿¦¼‘¸Q¸=ÙÜ€7AÜ{€¨ö`$V=«–‚ÙŽ(- B.÷$¨å[p*)¿‚·ð8«&ú•ÞÛ +%7qr“²[„¥Pr“²G™Äq¯.‘Z"ðWĺÎË[u9À  ¸jîK¿kÕ€âi«¬¦ÄòµJok;Í2]Áè10%,1Øm`6 ›ƒ‚Ù4OcFˆdª°ã¸Zè#©@±+uîCÜ!Hk@- ½L}ƒpÜê)ûmÔ¡5p!E–$Ejð£ÉçeÔ`ª•#JRvG•_ˆ•ygZ!U­*Óæ—ÂèfKW@¬_45Ê2.œ­,èð‘&’V3x°µ€/‡~†’ê´fvLÒ9º6é ‘_à@#Zn÷Žû 7‹¬•Ñ r³Dù£qZêÄÛÔ—RÙJºÕ‹•é`:èKž·‰jWÃÔç£>J‹¦‡LàïtT$µ{ xõKB¹”RæjýLçvýK哛ͬO/r¬º¯Èr»e¥òA8[~A'&?Mõæ}J2’Ϧ(+6†^슓J?N¾¡:ªÜ”ôÝõ—3R~ÔQ½rC»9¸ú–Q¦¼³·ÎÇ‘Z§Õ­)ìÞ<fPwWÝI¾èî”ùdýýI«£Ä;¸>&éR›ÿ‹ÿ‰]MYXÏü³f½W3åõ$J&~Ûnˆ5–²3¶ ©l»W’­°©°-ƵA¸ì PVÕ Å,¬t^ µ Aâ^ ZŠKp"ÖeEd®\&]8î\¨Šµ£B“ÎË©~*4W,}SéÐó§9T“”Û4*µiV•å¦Ë¡˜èðœOÔ_NoÖ´}O8³ºÔ#Ü—…â•T¡7iÿ'Q¤+d`k# ÀMÊ%­Q}Ev‡­‚À ähCJÀ \` ´•Û²GÆÞñ¥ó 7â8¨Ñ\±´§Ó¡æÎr©');²uw`gTPÉóÁ7ªÃ!ኜ¹eÙêi8Ù˜ÀXq|®û ˆ š³ÿ$µaÁóFÏT€œ °ôØ@]9ÙçMÍyü›Áò%ž¤ ¾¥%‹Ü9Þ2»}6ôNÀBÉ×x+êqUâ#Jñ…¥.»#>»Sºž­õ,GMTùß1«(cXôg\¢¤³¯SštÚz| ú”¥î‹ˆ7BÞçø2q艶H7u©ÇÛßs)Ô•LKNˆ›S£)¾‹©B§IÔ•–›³±%¤´ØQŠŒyc Ö·zlY‡WéÐåZ˘oÅUúµ½«À•` ô8 ·ƒ¦õY^<ÒO¥V3騈ö?õý(>’±Ö²®Ó9¸õ~>’5Q怖€èð¼R¨”&ý[>§M•îx§wÆaB«ñ/û.£¥¬¿5h›4š&Q%ƒ$­v$°[VŠêÅlPÇþGaÛ`%aÛ â¤ZZ ,•oK‹ -Š·ý•ŒË‹îËKš#Q0­ÅÓ¥ˆú¥ÑÁ·¦¼šK{œUø×+Æ–Sž­iÖw›ÆÉhŒÉ  iÝjz<7§hTv–Ï©çG¸Ãñ’§hÔ¼£×twÂqœy¢Ó]j(+$0À™Ô…8óNI (Ê· +Ôîú-NJÜt¥ŠK•uzœ¶îÝÙ5q­n"už]£Ñ€@½)sÇ‘ê´0m;­PIYˆÓc̵Z£6¬ù…­¨ 6škcgê\ÑÐÉŽpwY[ .ØÉ6±§*š¼J…7¬´è÷ ˜FË™ü×zr¹lC­N—µ)Ïö@ZЧÉÛ«0«ÄÊk–-¨þìÊu%RW“¹%êðÕ¾µþå†lÒ’³ÉåpÕ©ý¯ ôÞœÑÊyÁu*7~—ù¢ÛõE~M“ÜnýFA£–iuk"|Ü2ôü„;§ƒ.·Ò£eî–³q„[nÉežMz®µW'¦Ë¢0#@O‚«ÏG•ë|WáeÙ£‡…«ô«¦ôxg¡Å«ðÓñrø$  èqS£tz3¾•zu–ŸFy 5Ì£q8žu>2­<_™tgL8ø?|\_l—àÛ—!`\M iQ/8-Nœ–'¼Œ5*#å+šÝɽÿ²? `j;Ù1—F:7/Âê~È%Ýä|Ö²ÎÆ58ÊTðŸ3è:¥j•=óo±LoW‹©WåD`EÓ«:R¼%bF— b¢å}v:“RWM5Øñ …IÓw„š.¦= <øqó^ø©wX7FZóGÊ.¦:@Éqe¥Hü»ªA«©Çò<ðþèþI|E¿R?4ž\mé'/ÆêÙ–ÆŽã:•éÒ÷I_¦ç›>*µMgeÑ`Äš¸ì«ÇÉâš·vrJrœ¯&Ûî (£' ]jn¹jÆñÕls 6Ó³W¶dµÿô¸ñ÷ÆýÑJT[÷ÛÊ`el`_CG:+y?ŸüŽ_d}^XÓ¤áê–;ØçÅF=$ÎYNS~©6HT¯:˜nË¢Â3;8>'—úSxûYÆÓ‚y+ÚLá¡Æ8%—qÙîŽÈÕ¥5éœYEgqçÁœ«R§™N>§~-ÔN0¼cû°Šã8Ÿ¨þœ¥júœ€P@èÆ§Öàew˜Å¦yÆÜ<ù\ Ý£8´Â?ÿÙjftp-1.52.orig/src/images/current/0000700000175000017500000000000011155274771016131 5ustar varunvarunjftp-1.52.orig/src/images/current/information.png0000700000175000017500000000141211112477774021166 0ustar varunvarun‰PNG  IHDRóÿagAMA¯È7ŠétEXtSoftwareAdobe ImageReadyqÉe<œIDAT8Ë¥“ËkÔWÅ?wL¬dL&1 ™‰6Ѩ(h¡‰R,ÅM!R;TA¢.\t•m\ù >V¾°¥tš®…Zš”†Î¢™Æ0ÕÄ4Ñ3É$ýÍÜï½÷ëBH|´=Ë/_>8çUå}Tóæ!su4-ÁWNV­´8 (¡á¦wáÎàÙO¾úo^uðÅ•‘Œµr±#¡Éž¶FÖ®`!r žpzy£ý¹óŸeß¾œÏØHnÚVßÝZÏÔœ¥¸გ¨[C*±ŽÂ³2??\¦†S¹ ‡³+€ÞK÷;EÜС­ñÔö–zrc%œö´5*ŽÍcb†]Éõü3_æ§»…i4|š»vôQ @‚ëëhÐÔŽdÃ…çØÈ"Õ@ïÇIz»SˆlÕ’Ÿ,Ѿ1A×Ö†”FÒ°ÞŸØ×ÞÌXq A‚ÇÇÃd‡'°b±Î²EŒÏ.r`oÆÚ+)ØÈ¶6Õ×P˜)á¼G¼ !Ðw°†G¦ÑCqn‘®ÔfÔG­«ª ŠS°®Jðž”üãyþ­8¼uxñ8q8+¨¼g~jn¹Bs¼£14(Á{^&¤xq‚Xñx²XƘ0µ °îÖ`~’¶Mqœrd;;?l¢n]-ýGö "8:Z ý è­Õ&V¢Û#Ê_§“©ž®Mü–Ÿäû_GùöÞ_¨8TŠòÑö-Œ—y”/L¸ýZ‘ºO—ÑråÆç_îŽwn¬çÁãYfŸ— .°¡±Žm[š/-qï‡_–1µ§rßdߪr÷±ëÔ^LïJ&ìKÓ¼~- <]¨0øû(ùÂŒ1±þÜÀ™ìn ç«+iU ' •4`Œ)7 rçsÿ?¦wÑ ¨?‚{Y¶!¹IEND®B`‚jftp-1.52.orig/src/images/current/page_white_text.png0000700000175000017500000000052611112477774022026 0ustar varunvarun‰PNG  IHDRµú7êgAMA¯È7ŠétEXtSoftwareAdobe ImageReadyqÉe<èIDATÁ1nSAÀÙÇž4A¸‚Ž‚(¡I“Sp.KPp"„ÒQÒAŠ7%Žƒßþû1Ó¢;ó°ó+„‹çýZ######Ïù´µ±DWk=æCù›?ù‘û|ÞÚX‚æjä˜9昇ì³ËÈSóekMs9¾•¯NNV«ÕG@ÿà¶‹kD)ÃÞ4¼hn­†“¡”éÐ.Q¦@ønJ)1]:À;1@ø¡ ÓT˜Þ:Àt€Ÿ¦išÞ:ˆö€I²$fM³ž-Ú+g”]îþ´•Ï^LvIEND®B`‚jftp-1.52.orig/src/images/current/control_play_blue.png0000700000175000017500000000131511112477774022357 0ustar varunvarun‰PNG  IHDRóÿagAMA¯È7ŠétEXtSoftwareAdobe ImageReadyqÉe<_IDAT8Ë¥“MoQ†ûüüXºtîš.º3qcÂÆÄESW%5ÕEc a,QL›Ö*kª¶©‘ZéŠi,¥ èP˜Áa``ÊqÎ…©ºó&ïfæ<ïù¸çŽÀبn,‚A•I•YÕäPæá7ßñ£à5UÆo‹ïàŒ §éØÉ)'¸ý£$ýj/GMyy Æ`ìƒ!|Ý([£§Y†­ J]P.ûD– ¥ Á£8³´“µb¬f¢Ž'¿‹íŽx$¹¼ØNU³Ó#ßDI†ýpDtm¥ÐÄH °/,3kpU¡òS†·á °uÊõ”øŽn²³d؎ L>ú…eÂÞz€Ã Ïjm"<ÉÜ98¼! Y40¿¥hìKEPËzsvèuˆ%p¡Ú¡¥ÀE]‚åõw4²h0‰p8¬Z£K`ÌXäÚ*ü™hâQü1r‰ÉÊ%¬¹×9d‰Áq4N °| Æ@ÏÀøŒŸü˲ҰŠ.,¯¼Ô Ì_¾&èºØ†¤è½bàÄ}Μ·Èͤ‹up¸Üz &·?CJ5è÷€ù ‰”;>ó‰À¦Ë-H•ZÐíõa÷0Vç}ˆ†ûžªÅ3œ0˜2fC!¬ÉR“$ȨÙíÏV™;ÎôàµErlD­›"ËëME¯— 3§‹<Ø\qÚ±õ{‘FWyÞ¶®z7™P$V 3Ážy¶Q˜w,1Sö÷¯òècºû"o™}¾M=Y\¡OÜ‚âÛ\ô´ÍGݦ’ÿ~LÿóœxWÌž%IEND®B`‚jftp-1.52.orig/src/images/current/application_xp_terminal.png0000700000175000017500000000077311112477774023557 0ustar varunvarun‰PNG  IHDRóÿagAMA¯È7ŠétEXtSoftwareAdobe ImageReadyqÉe<IDAT8Ë¥S=KA½ìE@söv ib#øR™Fˆ…­…­ö±ò¤<Ó )­,Ô€ vé‚ àGLvÇyë]\ YfgwöÍ›UÌL³,}|ñt5ÒÚó;—–µÄ"${ÃFöL–åÌÑì´‘ûùhôö1ä;-~µÍÕÅà¾?¤×O[e}¡O·/K©^¦ýóJvOË×75utöÈláI´•.jÊÆû{æöÂF˜±hÇ—'Û¤”*” œämÈÊÖ¡j©T¢Á`ðÇ©èoW*©…¡€¼.t:jµZÿî€ PÂ0tÒh4¨Z­R½^wvE“;_´ÖN£6mÂ$IêõzÔívCž¶ŸÒF1µM Z³Ùt°3G¬| ÜI@tF£M-¿€~Ä"{ÂÀÈde9å}°ý=´‘Ð  kZÄL2¼#—‡0ˆã¸Ðy4þ†VFÓ0MÓ’yu}í£¨eÅ c~±×œ­®üÉ›X¾í© É‹ú.6c@dÆ`ëß—~}tôƒ@üÒTh‘\::þyð p9$gUÇ'3_Îá’&Z0¦HTÚLi݉àA&˜µ`øjßàrH.5|‚K È ?õžtâ+ã£whŽ‚Rð ’,ÅŽCä“ ÉEÞN‘L‚’ ұŎDó:ð „sÀ!™\ÎleNçnÀƒ„ðøä¶z ¹ÙÙrãDm‡¡!r!¹T’«ã'Ÿ #7†lŸV‹ÁV®p÷#žš"µûé \Ø„äHÞâÓoÈÆÈÅÈV‘‘«pãe…§õ"›6®¡mn;·Ÿ_áÞ³‘ðRéT@.‘ ÙÈ–QúÙ2²ed+\{QeuG7.pt/ÜŠ3)½«6ÙQâ+v²§ão'‹ØÆ|\Ò†wËðn%£µ2ÍfÛ;÷‘;°ùËZ»ÈD!Õ'ߜ߱±C‘¿Ôj•èùÈ} 1°õ"Çoî"jšA¦n$ñ/½ý¥cmKfÞÐÕGû‚†¿<äþ“!>¾OIüÞþÒq`PÆ€³ÎŒ üÿs-û·ðëMIEND®B`‚jftp-1.52.orig/src/images/current/folder_delete.png0000700000175000017500000000123211112477774021436 0ustar varunvarun‰PNG  IHDRóÿagAMA¯È7ŠétEXtSoftwareAdobe ImageReadyqÉe<,IDAT8Ë¥“ÏKTQÇ?÷½7ãS{âüAj« ‹ !ˆ6-£E› Z„ ¶ ê°]´mSnTdÛ †™6㯙q~¿wï=-Æ_ÑFðlîåpÎç|Ͻç(á,æpF;3ÀX™¾žô›”:ɪùÕu£³7€ê?Y €â•»KÚPâôu}ˆ)¥@jÉ(…®ì\J'_¯ËÀ7‰˜h«ðgþ%ðÉ@KÖUS“˜Ð§ ¥üö[´¾#X Ê9×úcjhü)Glˆ ãˆlùQ1Ma+AÌo‰À†ˆh@ôÆÛ}ô(ñ­.–@Â"Q~Ÿ ï~sÿAÇ ¤¦À;ÆñŽ‘ƒWßÂùþÇG‚ņèìbrˆÎ!z1ü‹cPNDÄT°¥ÅZ°É#:‹2ˆÉÎ’J,‘úºLisXË<õ®ÇÃC@«±Ñv­’É!:{pÏN,SXÑ\¥®÷*åž/Ìz³Ã±gµEÑ{ˆÞE¢Ú©wa}.Éå›÷ñW¨hXûLOW3¢ä¹ ¡ÍèÒnCTˆØÀ‰ @. ¦J´ó¿µî¼8žÀ‰6\«zj€JõÝÚû{ƒÃ(‚ÿæµÞ­+%§UãÔSªå% ¿ïb\6Õi¶qa¤c"4Žu6kÏs~“ßÖüL»&ªÈ¸:í:ézUÜÛ|âÕm\Ù˜¼=£ßütæ2eŸ‰g—IEND®B`‚jftp-1.52.orig/src/images/current/control_eject.png0000700000175000017500000000113311112477774021473 0ustar varunvarun‰PNG  IHDRóÿagAMA¯È7ŠétEXtSoftwareAdobe ImageReadyqÉe<íIDAT8Ë¥Sɪ"A|ÕÿÔàòtí/QP½xQôàÁ“ ÒQ·r9xp_[ms* »å17 ST“]™YõADÿƒ?ý~_êõzJ·ÛU;ŽÆÓZ­–Úl6•z½.ý(ÀÉ2'³õzMçó™‡Àét¢ÅbAµZU«Uù[Y¿^¯„…ýp8®ët¹\D ¢•JE/—Ëò—mfw»m·[Z.W´ßïi³Ù\"ªª²B¡ ™¼^Å8`G£1¹Ýn²Ûí/±¥Ö`0 l6«˜¼Y*”aUÓ4šÍf‚h³ÙÉéüÅw›ˆ£èÓé´j ´Ûm Í‚]üüt2ˆ€Ãá$«Õ*Ê€‹ÛíF‰DB3ø˜„ìãÐjµ2-#+M§SÃE< 4 G !+2‹EÀårÑd2“‡‹ÅÞ%ðù*øù|>E¯×KŠ¢Çã1wÄF£Ýïw*•J‰DÞMäs•ŠÅ"C° »Ç‚ˆ¬H€oNfÒ—‹”Ïçå\.§cæ8x<…›ù|..2C„õ`0({•3™ŒœJ¥/I4=A͘;¿<ĉÌï÷Ë?>¦d2)E£Q%«¡PH '©>ŸOáßÒ__ã¿â7Ÿµ1ÇO¬ô0IEND®B`‚jftp-1.52.orig/src/images/current/folder.png0000700000175000017500000000103111112477774020111 0ustar varunvarun‰PNG  IHDRóÿagAMA¯È7ŠétEXtSoftwareAdobe ImageReadyqÉe<«IDAT8ËÅ“»ŠA†¿êí[±‡EtQg7wAØLCŸÀÄWA0ÔÐÌÀÌP01ðÍ7pÝõ2=×í®®:¿A·3cb2'©âpþïܪœ$V±„me@ ðáå•ݬ·µåÜ2OTãOû1Wê/•`zùÆû8%ý ;O;Î9P#Æ9BùãÒÁîƒ}µ^€µnOŠõáäëë;Àó€ óǪo‰~ ’ÎådרØ~ØE d€pÉɳ_ìÜ_j—È<Ñw‘ ;úL==`rø†NvTƒy¤òþÝ.²‹óà”Y8ÂÏ@~J=‘÷o‘ÚlþSš ÒuˆIºÔ éñ3¬oÞž ÃüBñ Å! CF(NÈÎ߃J,$Å›½k‚ã…«(!­„âTA½´F*$ Xý½É‡(í}ÐfÍR˜/¶xÉQøÕ ‹EÙqˆÂx!¶²i3,ämf?OÔ“nŽå‰ÔËA§Q¬’ætI$–¥ä­ZÊêÑÞ“›Ûˆë8ò¾]î­Çô¬Yàÿþ¿¾ˆáÛšNIEND®B`‚jftp-1.52.orig/src/images/current/camera.png0000700000175000017500000000123111112477774020070 0ustar varunvarun‰PNG  IHDRóÿagAMA¯È7ŠétEXtSoftwareAdobe ImageReadyqÉe<+IDAT8ËÅSËŽA=ÕÝИI˜ð*CF0Ž Äà,f¥&lX¹ðÐOÐ_`ܸҰ`áŠOÐ1MØÄ Ñ&<yÉ«é‡÷–Bf? +¹u««ï9uϽUÂq\d(¸àÐx*•JO×ëuv»Ý^²,Kl6×jµr³·m[èºnøýþ7…Bá ÇçóùSrßËåò/Q,UUd2°HkTßááýë0¾½Â‹'ðFn¢Õj?Ç/ ì%cígj"‘¨§R)$A§ÓA¯×Ãp8Äå£|üüÍùmÜ:½!ºÝîEQtÇMÓÄl6»«Ñ©I¯×‹z½Žp8Œt: ’’‚P(„F£J¥‚@ €l6‹~¿Éd"cšÍæ ƒ‚Á ¶Gxþ~……)`S~ºpáÞÕkðÏç”~ œ%Ûí6¢Ñ¨”ªð´X,‹Åðú‹£Àã"s+°>ý8ÀÑh$Á†a€ ¼ÏRcª¶´ß–›€*4j._A“á¸A’Æ`Žã5{™³ìXy8ŽýL$ ™ª,—Ks>ƒ=Á.ª(ÜŽÓ&ý¶Cé9’Ȧөš¦)I8žýž€kµ2‡=¨æÚ3‰D±–¸²ùŠjµº×½#ÙhÌÆ'p{ã1ÎŽeq8`NÕgb¾ÉdRî±þx<.e1Èår©¯ÏèC÷ù|‚¯.ðOöpè‡oéù‡÷oýVü÷×øwØ”U‘D ªIEND®B`‚jftp-1.52.orig/src/images/current/folder_explore.png0000700000175000017500000000124711112477774021660 0ustar varunvarun‰PNG  IHDRóÿagAMA¯È7ŠétEXtSoftwareAdobe ImageReadyqÉe<9IDAT¥Á=HUaÇáß{î{Wó˜¡ÖÕÑÅÛ´$AAP-mMÕP-ÎÑÖÇXsPS45E4Ô`jT”]-ïÕû¡çœ÷¼ÿŒnäÒ>‘ÄFØwöOºví2&à/×f>g®:Ĭgø¥1rìµc5 J;Æoç1 ÖŒÁ­~.O^ù,-¹°KÊÒùúÜÓóÀ=ÖXœVñI[üíY’ƒ  c" ½"äa‚Îâûûã{¬±¤&OÈ’yáW>‘6ÊÔ矑/ôƒRð ’QéBˆü -£‚w+$MPÒ ­-•NQèÙ @€ ÆvCXZ,i€mßJ÷Î3€ áñÉ\õ Ó‹½|Xda¥H{[žžMuÜC‹%•”­â›¯P¶„²rU|ZaºRäcz€ÒP'{ò9æ—*µ˜ÙÎÓv7¿ÄHÞáÓ|²€OÊø¤ŒÒ¦êÞÖA%6Ì-g8“cûÖˆææ±-–D2dÈ-"WE®Š²%ä–¨¯$„a;¼ v¢`s8Yþ°J|Å5t¤õ0ÂG”zéhË“¤i΋_d Ùhð‡Õj|möæñQÄ! ëD#ÃùZñH.j‰3aÃÜbŠ~¼Õ£K§_y|ÇHâ_®?ü8Ôf9¹¥3¼ìËØ»ò”ïûj3Ïk³S/ÏIüû—ž-ö¯õ íë~óâaÓHâÝ(èÞ{Ë{×n$±?T§6LØš¶IEND®B`‚jftp-1.52.orig/src/images/current/rss_go.png0000700000175000017500000000117311112477774020141 0ustar varunvarun‰PNG  IHDRóÿagAMA¯È7ŠétEXtSoftwareAdobe ImageReadyqÉe< IDAT8Ë¥“ÍKUa‡Ÿs¼LÔ(¤¤Ìà‚‘h†–$-* Z»scEËÌEµÚDTPÿ@´qa‹ŠÀ¨ BP3„2?2Z˜×î9ï;ïL‹{¯P Ì 3ü˜™ÈÌØŒÅlÒ6 È0Üö ^A<ˆ‚w ¡X €3H!@SÏ?³ú·…б¥XàÍã`uT±PjÁ‚€L|1÷ñdw쇂•fÐ~ƒ([ƒ}|ˆ…@|èHð¼øÜ¢l%òê¶8Þ—"Em¦­ÅÆnu…xA‰^¦ÿYù4Ï݃ýÄó“ë€ï‹5ˆ3P½T°•%âã׉Û.¢³/H‚ÐP×ÌùñAœ ˆ@jd($E}ªD@ÔÚ‹}}JßÔ}LÎN„]Ûšh®?Æj²F÷Ò#~7[R#CZ¢©‚ztòqÇUdò6gZz ¦ (ÆòÊ"ºÈ»'FÕ*2 R(:zDO.ˆ#˜2ÿs¯‚¨Çϯt•Ã{N÷¿é8ò¶ðž(T•W‰$HvÖ6"¦|_Y`{u=ß137ÎðôV"»Vox[¿,‚ƒî®jçpêHÄ‘«k¡3w–‰…÷LåÑL û’ ¢~cë`¼ÖÞxªêõ——ßœrzyÈ>䢵 U ¹C6W®ÿ(Q3¡s«ÀIEND®B`‚jftp-1.52.orig/src/images/current/arrow_up.png0000700000175000017500000000056411112477774020506 0ustar varunvarun‰PNG  IHDRóÿagAMA¯È7ŠétEXtSoftwareAdobe ImageReadyqÉe<IDAT8Ë¥“?/QÅϲ™„hg5²Ñj%ì'‘ˆF,[ ¾’ŠLH–¨ 3•(„ˆ†v‡è¼wÿ=•fcoN{O~9çÞÜVM4Q7Ü¿Ù)v/ûWQ€½ëí»´=»œ&Þàbã¶ÊׯpS»O“ÎâüÌÌ å^Ê×'&^:\˨6Š…eND!& ˜šœ9ê’£Ó_|«?\«ÝÔ Ås·råxó,÷µ«º‘g°*,(Fï#d[çùO¾•aAAŽ*¯P p1…øO+C›$`˜)¼ãˆŽÀ*Íw`AÁž#Ê0˜$àÙÑ „*Š?ÿÂõëºb&NÛRIEND®B`‚jftp-1.52.orig/src/images/current/drive_link.png0000700000175000017500000000124711112477774020775 0ustar varunvarun‰PNG  IHDRóÿagAMA¯È7ŠétEXtSoftwareAdobe ImageReadyqÉe<9IDAT8Ë¥S9«ZQž«× ÷¨¸¡" ÑŸbB6©\«)üR,lÔß‘W*í´Q ÅBqG ¸Ï5g®hÚw`˜sî™o¹çr×ë^³DðÊÅ ›N§óû|>‡YÀét‚ãñx‹Ãáp‹——ÌåT*Á>%°æ÷R©´b2™¨èÿu/S"‘@¥RÁ`I§ÓebÀ¿ët:˜Íf “ÉnM÷¸F ÑhÀív#è{\æšÍ&¡ X¯×tQ 6rb±˜ÐÕj5(•J(•JÐëõ"<¢#uÔŠEr¹œB@¿g‚ùr¹À~¿‡`0ívû‰G¤Ýn‹Å‚ ŠÐLÌÂYx†gžçA¥RKÆéxÀ&‰(‹D¢ §ÓIuv»{Â<¢¢V |ƒ6› ɰX,Ðï÷A¡P¼ív Z­æó9¬V+bL°}@#F#Äb1’æñx V«@2™$#§Ó)Ôëu¢øp@£Ñ Âwá0är9’ƒ,Ð0lÊf³”D£Q¼ À3GKÅbñR¯V«„HW”… âñ8èõz¢F ÇTÃä\øD"ñY¸,ù|þÓþƒmu­Vë3îC&“‘àwÇ…Ù:²ü‡å“ÉdÍÝß6¿ßÿÖëõþ …B‡Ãqa,Þ aÝn—n¨Ëå³ÙŒ2ÿ‡C»Ò³‡>ŸOlµZƒ ñÙf³™X“ÿØårù•å13÷æÛ™¡/“/ÿù´ŽÀçò'OIEND®B`‚jftp-1.52.orig/src/images/current/page_excel.png0000700000175000017500000000146111112477774020741 0ustar varunvarun‰PNG  IHDRóÿagAMA¯È7ŠétEXtSoftwareAdobe ImageReadyqÉe<ÃIDATÁMˆUUàïœ{ï¼ùÑ ‘´¦S# µr£ý ¥-¬M¥…RT‹Ú„µK ¡E aBD!Ñ¢•H!j¤M ¨dI” ešc¦ï½™wï9}_È9[³íèæáÖÆ,G?ÈœÔ)ývåŸ|8\|ýØžõÓ!çì±w&Ž}öêò%1†Y™B gÈ.^ëÙw⊿ÎMµþéÌèw{ÖOA ±‹úÊbÖé¿19Ñ䤮³N¯ñЙVÜQ:ž.æ´xòÁWÌþv÷º©!„9碯ˆªH("E ¢€dÞpŸõ÷Í36Þ(‡‡>…ðÔŽÕgS›5˜B“ƒeã»|ý’o~Ü+£UÍФںeÏØôÀKZU©Ý¶é½“õÁ·WU%N½üÈæ[;­?ý~ùŒS'÷«SÛ²…÷˜njívG2j|ÁÓŽŸ«¥4mÕm-¡Œ5DlüðëƒÍ yÜðаEwÍSÆA—®^Önw•Å\[Ö¼oxhD_¡¿¯’EBñó×Mµ›'{_Lìµd`µ™ýÆÝ¢ÛéªëÒ kw¨Zª2ê+ ­2JȈÐn.¾ÿõˆ]¶»ÎMÙqç’»Mõ&þã² *‚2e5‰&ñÞ7nzñZçãjÅâ•rìÜÿ–GÊå2²Ù,B¡ªÕ*t:Ð!.—ë2 è÷ûÈçó‡Ã¨T*p»Ý$ @±Xl¢%žÉ4€µB¡€`0EQàñx`·Û‘H$`±Xx%þ'Àï÷#NóòS©ÿ'“IX­VÞž®ë³I¥ÛN[CȲŒh4ʳ *l6‡5›M4›€'¯ví/·O!cÝ{§¸Ç+Éd2üFèdʇB$Mž,­mˆ¥ßŸuD~èØŠkXy­LF­€DïÁ0ãê3o©/] ü]ǧª ˆ_Unk0p‘y°*œtwÏ<¾Àö~kï‹ðFUãT³Ù,ðøm¡¶©@ü¦áé»_"g7JŸ%ðð…üèÁ†\_^ÿÙq9cô!þ6 Sº4Büs÷Y@mZ¸™ímòé5r‹q‹Fá ÕOźX­¥IEND®B`‚jftp-1.52.orig/src/images/current/page_white_powerpoint.png0000700000175000017500000000111411112477774023242 0ustar varunvarun‰PNG  IHDRóÿagAMA¯È7ŠétEXtSoftwareAdobe ImageReadyqÉe<ÞIDAT8Ë“¿‹SAÇ?»ïåŒb.Hîôl´±,mÅ^¼ÊB ZZhaëPñH ±5þ-×^c£ Ø„$BÉ;ß{;»cñ’è‘ va™Ï|gvƨ*Ƙ-à,ñoßU5 ªÌ W³,;缈è*ϲLÛíö[à"`Uõ`Ç9ç§Ó©¦iºðÉd¢£ÑHûý¾Šˆöz=ít: ˆ™¾n)€†^QïQ™¹+Oœ OÞÑh4(Š‚Ýnw¿Õj½aúê¾þÏ~<¸¥Ãáp©$`'V){Ò)éÇ€Åû‚ݾÂÉÛ±§ëhîH’„ñxL¡Ùl`Õ é‡gœ¸yÚî!=Âðóýóž;â8&I*• Õjuñ%ñ Lý ¶VC3‡ŠÇ}:,ßrGEc0ÆÌ›^BQü×ÏŒ÷v "PA f°ÖbŒY «¹+/›— yæŽP84sÄç6Ë YGQ„µvpêî#¢ —P ¨â­m6¿,8AU—ä—%ÌÔl<Ý_9»ó>Dz—M̃;7Ê,îÏ!õaá«ê03i¸&"€a= q_·³…R xïa`ïýàÍ_ë|~¶ÎvMüõ,|ý—NIEND®B`‚jftp-1.52.orig/src/images/current/arrow_left.png0000700000175000017500000000053111112477774021006 0ustar varunvarun‰PNG  IHDRóÿagAMA¯È7ŠétEXtSoftwareAdobe ImageReadyqÉe<ëIDAT8Ëcüÿÿ?%€‰B0È (=‘ÉÄ»I1€õ2¤À‹ ÍÅÙ$ôþüùÃððýC†_?3üú¿~1˜þŽ`ƒä.ô_edj>)Æ*®§À­Äðçßn90ýûï_ þÍðûÿýÑ¿V¯\‹ðÐÙ¿ÿ0þaøõ÷XÑ ¢ß`Å¿4ÔÜŸÿ@±_P½¹3î¼0›ˆ3'Ã×^¿ƒÕÙ ¯4ÿùý‡áþÂGŒŒÈ)1vUÈM B9 Ç i;N@ͺ@͉Ռ⅜㡻¼zZÓÉIEND®B`‚jftp-1.52.orig/src/images/current/control_pause.png0000700000175000017500000000112611112477774021520 0ustar varunvarun‰PNG  IHDRóÿagAMA¯È7ŠétEXtSoftwareAdobe ImageReadyqÉe<èIDAT8Ë¥S=kAƒ(Š(r‚6‚…ÕXha©½mêt^¥þ Mig¡!¥…`k'¢Ý¨• j!‚wøýµ™Y½Í™&YöfoæÍ{] c þ³¬_F£QAÓIŒ ¸^¯*î-ÜÑh´g®·˜`³‚yN’$Ùét‚ÝnççûýÖë5Ìf³>‚”b±XY4Åp8Tƒ†ÅŒíº®3MÓØn·ãg›Í†u:­Ýn+Fgp§ý …dšºZ­°yˆÏçƒív Ýn—˜¼¤R©Þ`’&ÚFs¡P€J¥*š‹ÅW¨VßI ƒ2²I É0úAZ nƒÙý›ño ÁëõRm’Î š~8(„aœ€Ëå‚óùf­Ôtû~4Ù\s<át:™JæØl¶;>ó[3I].—  €ËåÒ"ƒ/’$߃rß`A5Óé”$´„‰¨½1ŸQ›ì÷ûAQ2âžÐÊdn¹Ûí†ù|ªªö1m‰D¢‡®–ð’èDÏãñ€Õjå¦ÒNAÍx¡ÙlêèA A{ß®r½^WP[.Ë@€¡c¸!ýi¸ýÖ‚á½9BL%†^Öéð0—Þn9ÖˆsÐ>i Ö“ˆ¡«Þië¶»œÿ®ùk>¯Gj—ÜÿÎý ˆ]ò™î†IEND®B`‚jftp-1.52.orig/src/images/current/server_add.png0000700000175000017500000000124411112477774020762 0ustar varunvarun‰PNG  IHDRóÿagAMA¯È7ŠétEXtSoftwareAdobe ImageReadyqÉe<6IDAT8Ë¥SMhAþ6i“j\L5Šý1JA-i«Kõ"’¢(ê!/…€àÏA¼x‹ `EâA¥^=zJ©„$”`iÌÖôPŒ$ V«"ùÓæof|3ɆRS\x¼ÝÙ÷ý¼y3šÿó´­]ˆÇãOkµÚ¹jµÚF”UT*™Ÿù|¾³- ÃØL€'N§Óg·oD™@àʹììtbzzê }ýIH$ŽJ°Ëåêq8Hg>Aªs.À'"Fdår¹u T<åv»ÕÂÊJ U¿5戀7Ã;~LµÑ’@öh³ÙÏçëÊŒaïàˆR u¹Ùë:ÌŒ@²HEZ7³”™R—ÿºŽŸú»ƒú^ U, =û•ºéB¬³ÓI H¤2«÷þMOc2{|U]ËšàÐTŸ\|ŒŸ…™0rÛR8ï´(üʲŷC·Œ›Š@Z3O¤ñ†eNkW¶^Ç"f‘)Åà=|½[ðjá¹KFnŒ^êv6[S°Z­ueÆWP ù9Œ‘ÝÃ`†á./˜VŨgLB/Z^G"‹EèºŽŽ v:š"bäâ{aíÚ&œÜsY¹¼zäú·É×Eà÷û¤R©¡Ph. ÃnÓ°«¯nwúvv#_ÌbaiÁ—Š øbï¿ÎË×’¶ö6që y™>ð$Úû—16t;öáÝ—7˜™âc:wWû×ëL¤tB§(P<Œ=Xºöâ …P(")RIEND®B`‚jftp-1.52.orig/src/images/current/house_go.png0000700000175000017500000000153511112477774020457 0ustar varunvarun‰PNG  IHDRóÿagAMA¯È7ŠétEXtSoftwareAdobe ImageReadyqÉe<ïIDAT8Ë“o,ÔqÇMûyЪÍZMªIΟüÉ…š,Îdù¯ÅÔ]ÅÅp"vrçvs¸ù»::¥ü?eŽîZQZj­u ÷›ðï~®2ŠÖƒ÷“ᆵ×çû}÷%›¥+ùIÇZÃcXkÒÈ­öm «y £&Ýq±'ËyQ›}Ô¨Íu#ÿK Nq iФ“±0Þ”ˆ×Í)З‡¢¯à˜©¯Ð“ü§@“æHöd:›†äA˜xÀ£“†‰– L¶gc¸: =L“&In*Ðd8‘½|j¸,“Ó¡¯ƒVä…Çboè*£0Ö"@¿"-|Oê^º¹AЛåBj³])½"“­™ÐWF _ê‹·o&Ìéù¢O ƒ* ]…!¨ãºRU]Ì‚.ˆ¤ ¢ôåa˜lãÓG„Vr /G^`zz³³³˜zÿM™>hãÉ­$4\€,‚Až±'‰¾<ƒ¾2ü×=£iØãc£˜™™1ÿ“ªòÁ•zÔ^óCgq,*.{#Û÷ ›ei ™Ëºªh¨…'V>}œZ›¼>ÜOä«Ï#ºÆ%l&ø'.Óaý,0ÉêÈõR”ÊWÖ&&7C‚Ò ìZgä´GâÁˆÏâtÉnð÷‡þõŒ2™lŽ¢(³ ‰†;^U¡u´Â Þ)CY”†"pUþp—X.3DÛ¬6ÄbñœÉd2 .Ñ÷]…K´©ö&Aü(B5šÔèDˆ½ãƒyÄ‘ü”íÈé<¥ î’‡,ÝlÀª$æöa4¿(ƒê¹J}êžÝ¤%‰¨Ö ^Å‚m®Å… v>€£ˆ•Ú(ˆ‚…±´ Q´ŒEþ€ÉÙÝ™ù,öDc¼waXv~ó}»3$®ß{°"é©`qY ¨Avx¡¤­oïÝ? 0 ^¸#87^^lÖn!í%A… ØÜúÅn¡Á)úUpu¼¼Ð\[]`ñäU¡¨U£V?~xžù¹WnÜåÒ‘ñʯ>~accE{*$bs{‡.eö¯ÞÍ`4àìù%Μ8Š;HA„p…Øí Ož­M÷àûú6£vH×u””±¨çÆ ƒáˆc‡f iÌ )%n^V8 ˜PLSàAI…T¼Úq‘{ˆ¹h°ìS±·PrXˆl{PB”âÌÐRæ5ÙBHds,©%7QÂ)¥ï9ÅbÚ/P/e¯"0 Ì„Yí…V nBˆˆøñŸÚ– —VQÓà.ÌEôQ}7ælHº´vðæõË÷·ëäíë&ñâë‡ç·ö¿|úÕ–»:Ç IEND®B`‚jftp-1.52.orig/src/images/current/disk_multiple.png0000700000175000017500000000126311112477774021512 0ustar varunvarun‰PNG  IHDRóÿagAMA¯È7ŠétEXtSoftwareAdobe ImageReadyqÉe<EIDAT8Ë¥“ÍKTaÆç½÷ÎLãGöA Jh%Õ")%—‰´ B‰ jUH¸ò/h'´1h§«!‰VmÄ!m"­ÁÁPp¥¢ÕŒÖ4Ž3÷ó}[XZ‹Àg}Îï<çá1ÆpÙCc‹³uq(û!Çjclä*ˆ‚Ú¤…6Âb…éLöÁÊxÿâ?•²ËõÎ Üê¨ebæ3ï]ÚWôâm­%tˆ1†ûOff{º/²²–kŸXLq´Æáë¦ øægÉݘÎdûVÆûç÷9PJ° ¸—žkç¸q¹†7s_êkC€íJHDLÌÑZ^g÷ŽÂõr—õ¼ÇÐØj¼.“s3i=ÑàáȬ™Îd»VÆû?Ø¡6xQˆR ËÈÿf2 ˆØ.8bs¼ÎÂR!e/àûvÀTúÛ^£Bу|ÁGDWWˆ´ÁÂ!Ôš‚»¹—Iižv µÁ†¤ žçQÜñ«Û¶hi„ôR@M,IÂ)ázïVQa¤Ñ‘ÆÆ0tv(€åléSjr­¢Æ/×ïeb)ÁBÄ£0FÂ߫ң½w†ß/Ÿo¦3A«#6ƒ7뵿;Ç€MÂŽ1òr­âNðGËÙÒ\jr¡#Ò`á ©š{ÄÉäE¾¼ÎÀÕg(”=ÿo@z´÷öo'¦¥N×nÓÓÞIC¬ Ü&NÕ„$c`‹TOù ® N½kk>ÒÝo a×êÑ1ZÊ,­-“+Ì?¿+rØwþÿÑ!/-‘FÕIEND®B`‚jftp-1.52.orig/src/images/current/page.png0000700000175000017500000000117311112477774017561 0ustar varunvarun‰PNG  IHDRóÿagAMA¯È7ŠétEXtSoftwareAdobe ImageReadyqÉe< IDATÁ¿¯žsàëþ>Ï{ÚÓSG•ˆ3ñ;1Ј„….“Åbc#61Ùl’ŽIÿ£AKD"$‚X$ ÚTDÏyÏóÜ×UI¼ðÞ¥×w÷O¼6Ê9œDBŠ´¥û×›×óYý}ãËÎo*‰—>øòò'o{tŒ:& ¸öﱋßÜôÇoGÿýôÃÏg¿¸pþfS=¼3Og~¼jUiÖ´e‰[Ç«ç¼ÍÓ;îk§ÒÜxîÍOïøü£—TÕé$ÓÎ4ls1 ¦¢Š¡ÐöwœêÀ}œØ÷÷>†¡``£Ê¨2ªŒ*c*¿ÿu˽§=v¶¼ñ̦Íô*Ì óD)©ÒkežØÉðËõØö¢{ëÙûO¨y,0CB0×Ô(…4™;Œ.Ý“Ô3*J ‚4› PC­%# 0C/$4 IÀè2O!Eˆ²6k3tGB€¥T˜“Ö%`†µYCšÐam‚)6Ó°l0C/щ÷¿Û*ÑER4©€„\¼gãø¨Á ˲ZWö7ž¼{è°†µè$$|u‘ŽãÃ̰u/ÝÙ®ê«+«®ˆJtÈ(£Ë{éŒä=AÈ_iµ` B’î¸o“Y¶t«Nf7;óæÍczÌL°<Ï_”R¸ëH‡ƒÎùi6›=›B$³,[î÷{þËÖë5Ïçów©Pg@†½.¿HiRŒQ;^XÿD¼¿ajšFÊŽj…2¢ë«Ì™X|V¦k]×§˜™ŠÙQ×Ý€MZÚ^-u´‘[fª;ŸepÑ×Q'•U;7·EÂJªªò@‡‡ÛKÛA”&ê™ûp8¤íöÛ?‚[„«ÕŠ6›¹GQDqS­ØçF¥BqY––Án·3ï£ÑèDƒ¾tN’Ä8Îzì»wü )îêãŽèÕ@Æã1鵦¢(ìÐáW.Àd21]]§ÓéÿÂ04Ÿ!Ç,Gƒ·4Mï€.ŽD‰®k=R÷HµÓ¥%iªIEND®B`‚jftp-1.52.orig/src/images/current/arrow_right.png0000700000175000017500000000053511112477774021175 0ustar varunvarun‰PNG  IHDRóÿagAMA¯È7ŠétEXtSoftwareAdobe ImageReadyqÉe<ïIDAT8Ëcüÿÿ?%€‰B0Ä ˜å±Ûk’ÙüúñËæç÷_W‘ÅA±Pz"ÿüeøóûÃï_~ýü Ô¿~1ˆ–’døõë7ÃÍÛ·.j¿ ÒÃ3ÉJØ–áï? ÿþÀñï¿ø7Ãï@ü&ö‡áË—¯zZYj'¯M»e㤮¨è7Xñoý!÷ë÷o+Ã]röþ‡{±:èg0›‹ƒ‹ARRŠáõ«× ·oܽp{Î=x µ-€ìÚü¨YäX¸ÐõPóA ku1ba„ççÀ7Ýl¬ÐIEND®B`‚jftp-1.52.orig/src/images/current/image.png0000700000175000017500000000100411112477774017720 0ustar varunvarun‰PNG  IHDRóÿagAMA¯È7ŠétEXtSoftwareAdobe ImageReadyqÉe<–IDAT¥Á?kSaÆáßóž7žœ*­ƒ§ (⦓‹‚ŸÀÍÉÁ"ˆâ–½“hÑÍYÄIw?…:b#¶Djšœœ÷¹=©‰!{]&‰Ãˆ4VV_?IµÝܤöîˆ9(rX,xþæñN¤‘ÜVÞ½T.—¥™Ep& $p&Dª+n?x{ èDÛ»)/O”vÿéKN9Nž9I9„%‚A0ÁÈ‚ñaã=:÷'3‘Æ`!DΟ;Ë…ËWÉB†”À"˜Ì0 „hew~ŠL9çmÚÅ1˜G‘)ÆÕñpÌWÂ=`€$2KÔÕÉ™‰LIð¹ÿ‘/½>c¯q%¾Ž¶¨ÒiŒ–óö¾õA™È”Ÿ¶hu‡ì“@%Ò™ º]ñ»Hà Bv„åÌ“µÚˆ_Sÿ%Ò;ô6×9Host wöEÆ„x¶¶ ó]*f"Å"ô½.\00CLâoF]Wä-Hãh^ÝY{we0ÖEw”· ˆ¼ a’8ŒïÓò«VšÙ IEND®B`‚jftp-1.52.orig/src/images/current/html.png0000700000175000017500000000110211112477774017601 0ustar varunvarun‰PNG  IHDRóÿagAMA¯È7ŠétEXtSoftwareAdobe ImageReadyqÉe<ÔIDAT8ËÅ“;kTa†ŸsrvϪ‰‹‚((H´R ""Vb+ˆ"Øú[ ±Q€• ˆ`%X؈ ñŠ`²g¿ó}s³Ø Ú¥pša`Þ¹¼ïLìÅjöh{.ÐÜ{þýŸ;¨;"NVE’)+Y”T‚Nœ””`}ußÐ@=0›zµ@4wDQGÌ)ê<Ýü:-°=QÌ™œb³d Š:Y"AV§ˆ³4߯:åÀ#¸|f,Æ•µ®]俯·.,³qzžaSqýÜ £aÅ틇gc’ OBUuÚ¦"‹Ój¿þFUÁƒŸ9¶<àÔ‘–£KC kNjéz#‰ãÒtYéÕi7Î/ÓÔ]V"‚q6Üa}užzqƽ1)F–šèŒzœ‚\œTœ‡/¿PÔ™ôN]oXo?Nx¿5!‹©½ž õ¯Tè‹Á¬3Œg¾Ë†{ðèÕ?v”^œƒûçxrg'rP]ºÿ.®®-òég¦ˆ“ÕɲËüT®]5Ä™É{|¥eóÙší%ca4GTŒ¤BÚ@µB´F< Ìu0ŸN»ûBÕÉ»o¢OJHàÙ‰¢„8‘ ŠæÓXÜÿºØê¿ãoÙßrØ?#-AIEND®B`‚jftp-1.52.orig/src/images/current/email_go.png0000700000175000017500000000136211112477774020421 0ustar varunvarun‰PNG  IHDRóÿagAMA¯È7ŠétEXtSoftwareAdobe ImageReadyqÉe<„IDAT8Ë¥“»kaÅßÌìËìnÝçFØ€(FPÅFÑFT´³llý Ö6*¶Z˜NP5š">Q ]и1ÁÉîÆdö1óÍ÷°HÄ‚.÷Q.çp„µ–ÿÃÂ;}åÙÃôªÜ–jw4Bå ‹6c-ÚZŒYÞWÊ"t·«•wå²×ÓÝYŠ­H§ÜßØÅŸ³XîíH¹íH;…Ž¿¤JRqíᕪ¤Y¦k†JÝ0óÍ0·hðKµi‰5ÌÔ$nαЌœ\OqÄiFZ¤ƒýyî¾ôùÖˆéÍ .$]AÒ$=èÊjK’ñ©¯t­Î³¦+ œV¨(õeêÍsç…ÏBSÈ:$=HºÐ™ÔÉø”OaMžÒ`±bžÓ õ²š.”²ôt¯âúd…z éL riA-œ¿}€w ‡( dÉx¿ØØl/ ¨X‘ö Ã]Üzî3S ™©†Üxê[ÅPa'FIz?•õZ‘ÆR*¾Öн9’É—áÍ}4 ©Ý#lèÛN69{c-WO”Á ¼V¤¬6Vøµ€bOŽL:”‘ìÛxm Úh –ÙÅ ›†vÑm^,Ðçܳ^³þåS$ÕÚõC‘Í8B8•D[Ãtí±Q(똥(`sq7¸Åó»ñdc~zï©;Ý©\G‡—r…ç¹8® ¿zJ+zóÃ(£ÑÖ0·ø™ÕÙ>^Uñ¬\ŽoÏ= ÓÑK%J‰4’PIF ¥ý¼øü˜‰÷w_KŶÙ1‰Mãè9g~ëðžÂäû‰—Ò°svÌJ€&(óÚ¸…¶Ñ ̪÷ïiÈV„G5ùIEND®B`‚jftp-1.52.orig/src/images/current/control_stop.png0000700000175000017500000000062311112477774021371 0ustar varunvarun‰PNG  IHDRµú7êgAMA¯È7ŠétEXtSoftwareAdobe ImageReadyqÉe<%IDAT(Ï}‘MKAÆýPóæ”}…Iï! ÅB]ºuèÐ)ˆ˜C(AHeãËÁÚ–µŽ:Ö’”ôô쬔lÏeØßïÿ²39äþÏ÷¡#Úª¥›Ö؆¾U×"#tdÛDˆ±`^1DÝ\ÉØÍÌ1ƒÃO1.]M.67 ž` ËŒyE›sá…–Š2ø‰º8Q^hê˜m¸ÎäQ$r“1Ž´îìSâˆ0ï…G>Y‘4xx>PE.YfÊ­`È‚ˆåEÉS7âÇßDZ:Dà*råªå¡©sDÌÙ]hTLIfë@ì¨m½e˶¤7UYüzÍ¿ò(Þyv-|úHIEND®B`‚jftp-1.52.orig/src/images/current/help.png0000700000175000017500000000142211112477774017572 0ustar varunvarun‰PNG  IHDRóÿagAMA¯È7ŠétEXtSoftwareAdobe ImageReadyqÉe<¤IDAT8Ë¥“ÝO’aÆý[àOh­æjÕjÕÖ8è §æ'ÐÔrµ –³t˜Ó,)53 j꜊o"ˆ&Ê— ðb"_ÊÇDxáU³íê5œËÙZ¿“{ÏõÛ®g÷ çøc #ÙZ÷@ãÜ'Uë4õÅž¢6Šœ±$S¦=ö™µ“æÌ:Ò!Oø;4ÜA*ƒg; G ‘Åhhh!Ì9U@¬¥8rk2µÙ‡ùÛ.¤s~ˆÆœ¨YG±ƒ# WˆÂ'•?ÕElqNdækr5ÜÓXpÆPË„: ü1¾Xc‹ÔH­P®†`÷%Ð:I›Ç]¬¬`t)*\ó§°â‰C8hÇã3ÒG ?~s„ÚA júM˜·G ]‹ Njf}s!ÒÅtí&6QÝcBU÷ üÑ4¦–PÛ¶A3µ-n»­SX½»xÒm$³‚…—v“J,¨üh¯ÓÀ<ÖcÚèÃ.u€]½³.”¶iQùA‡o<±žÎ ZÆ]´+ÄÓ ¸z”¿×¡ìIú;¶"øb-ŠZT¸ÏÀk`÷Ǒߤ>¼ÚHÛVb™ ¼vÊÄó(y;‡â×ê …¯6*PÐ(G½tFOwëäǘ>B…1½#‚ÊC6Kì#²G#O4“¡P$±êƒ„©s«fâøùâVù›ùà’3åŠÜ6 š”h7eøÎo˜À°Æ %€›ÕcÁëGY')O4˹×@¤töm¨­A¼”,¡¤YŽ¢Æi<ïÕCiôBeöãjÅçÔåCœSWùŽPƹýl2ÔG¬ã«; ‹7–aѹƒ.™ ¹O§ÓIC>|)Ï6|°™§ó¿Ë©ªŠœ€g `sGbT8R©U*/˜ƒ`s0È~.—óô{½ÞnénãÞl$o)N)}á_F«Õú‡g³YeË­»u»] †ä -bŸ5K­¥áü³…c›Aaj•±š÷X,ñbµ¡ôͯïæ;1/  Üã¯[¸|°ƒud>!hÀǯžäñíÕüñüóÓcPÜNýšVº2d{IEND®B`‚jftp-1.52.orig/src/images/current/page_white_zip.png0000700000175000017500000000060211112477774021637 0ustar varunvarun‰PNG  IHDRµú7êgAMA¯È7ŠétEXtSoftwareAdobe ImageReadyqÉe<IDAT(Ï]ÑMJÆáÑ+¸µà"/$Bׂ¸QìBT)ø¯´¢"Vt£â DÑ*ÖôǦIúú%­¡ ßìæÉÌ$1ÌÆÍ17— ÅâÄåtêAôÈŽ&é°²ôOârƒ¨É/ìòÃ7ï"oÄlÄÜ_¸jPçC M“U‘øìë©5(ŒMÍ_ÌÜÇ™®ýrÇ ØL°[ÆnЬÂIEND®B`‚jftp-1.52.orig/src/images/current/drive_web.png0000700000175000017500000000125611112477774020615 0ustar varunvarun‰PNG  IHDRóÿagAMA¯È7ŠétEXtSoftwareAdobe ImageReadyqÉe<@IDAT8Ë…’ÍkÓpÇ¿Y—¦}/¥«u[ ½hvpPÑ/ē첣û†<õ`/žõ `ÜÐZ¨/à¦\¥¶«uj†í¶4ÍKí/’чçùýò|?ÏKB ØŸ»¯33ðƒIþBüX¡°ü¹Yo5ï?ʬí¹”0_»>sùéœo=ì»ðµ{Ý£~(ÕÂíâç§ cvây¿ÿá¬7Å6u Û€g"^Ò[ˆ†ÂŒ×áZµç3ö‹Ù³ÓSïä±O@ÿvbÚ‰þ é2NdàMKÇ7‘w…£»ʽ‰žZûg_£ªÕªP©T»?E:¤H8’j Æ8|÷@?ÜCœ껿èB¡0ÈçóÂ)ÀP<ïp8ÒÉdW‰‹ã·PÜ^ƒª½Ãöñ±Õ©Eð]Fñxõz}y(}A•Ëåyžç7c±:úýþȆ`ÏLQhš˲˜˜˜€Óé„ v•Qe% bè$Žã 3ÿâ­±®ëèõzH$¨ÕjË ©"IDQ„,Ë£$MÓ ožÍ;rfn·ÛèÒ¤2iÙL° ìgâ].é:MF0HÄ̪ÖÊvˆùÎÔ1¦ÐÛ!öQÌØ’ßïU²&˜Ë#±u¡Ä"‘Ȱ^*•Ì–¬#Yc똖®×ÿ´^Ñ3y,9MIEND®B`‚jftp-1.52.orig/src/images/current/cancel.png0000700000175000017500000000111311112477774020064 0ustar varunvarun‰PNG  IHDRóÿagAMA¯È7ŠétEXtSoftwareAdobe ImageReadyqÉe<ÝIDAT8Ë¥“kkA†÷kH !)¦4„–^c› ¨¡Æ˜4eJ›ÚK¤i(½ÑËÿ̇\ £Ä• ²Î®»;OgV7U”–Ò/ þϙ÷œ3`üÆ à  Feý` ݇ïïàÛòë[ä—:òÓä‡WønãF{2 2ÿ8³ˆÌd©A2I°¶†ŸÏâ>§wï&Bÿ;6ÔáüY«$««ø• òì ¯ZÂÛߎ³Œ=€D€þ•Uem¦Óf¿ZÅ/—ÁRÑÛmäÉ ½ÄCz/ tBë Ì›Nìí…æJ›¤·½³¸ˆûì ­a€î°ü¼ÿ;¯ºrd ¥ÌîÖN,†XXÀ©ä'>¾îçÇñK¥€®îærˆùyº³³8¥ì8 x_Ã_YÁ7Í«Ìú«Í´ZÈ‹ „šŒ==ótËa€§jDÞãòô´_µÑÀÝÜÄÙØÍRA‚£#ºË×Åô(ÀU¦çëÕËxfàø84ë¼Ý¹9„n®2‹õ$b'C{éMÃø9²Hj9,=ßÞËÜøÝ«¼öÌ öÔöR,¬Ü2­²Z˾u·šÇÙÍá˜Ù0¯(f…Ô˜yâcRݵt‡#]Ôì«ù÷×øú畸ƒýžÝ¿IEND®B`‚jftp-1.52.orig/src/images/current/delete.png0000700000175000017500000000131311112477774020103 0ustar varunvarun‰PNG  IHDRóÿagAMA¯È7ŠétEXtSoftwareAdobe ImageReadyqÉe<]IDAT8Ë¥“ûKSaÇý[¶¢‰n„„QP˜ó2wÖÚܦγL[,biŽašAÅ\øC¨¥vÕÊ_2Ml”ZFjסå±òÒNMjmž³kÊ·¹`&.#záûËËûù¼<Ï“ 岿bV¯ÎPæ÷T3¥%¹I­†{Gª™qRiv•È…ë ætzâ#E±ß6„ˆ¼EddüÝÌJñª`Ÿ«ÅDRÁ2<]Nñ ·;°4õѾ;ˆ¶Ûm>‡7›°8ÜÉ€Qe6ÿLžI¬Ìèt‚ìæ®·c‰q!zñ |v ü¶j„/Xi ¶ž@øÞ Ì%1|hŸû±l !ˆÁô|­‹®±ø! ïY#‚uºUáN’w]Á˼ H3è„àu„ t]E´³>k%¾I“f¡’o«ÇR…‡D:“0åÚ`ä~¢ |§ øÓñ(rॠáon„3oG0!˜$‹‚¡ÎV„ë ž*[W0_ª‚¿©ýâ-+‚‰ãµÖ d§ÁWÇ&2¾ZfMFô‰ÒVJpËiF&B°³ >­ ÞRɘ•gƒ- Ð~ CâmèÍÚ´ÒÄ×ERÁ ឫРp«5Þ°y•ø¨È+‹Á21ø¶ŒK—aw·h£`Õ ä#Šüôa×Zñ½ž†‡Tâ³ZoüåL¨óÑ“•ÊÇ`"é(?•ï'žÜËŽJváKµÞ†óñ|ª:†G9[—aöw8é2 Jw Äéf'±“y¿ëmæzsÓ˜žìTswæá_·ñ_óÒιIrþIEND®B`‚jftp-1.52.orig/src/images/current/basket_put.png0000700000175000017500000000133511112477774021006 0ustar varunvarun‰PNG  IHDRóÿagAMA¯È7ŠétEXtSoftwareAdobe ImageReadyqÉe<oIDAT8Ë…“]H“aÇÏ3×–ûpclb º)9¶†B„Hö±FÒE#Ѝ ‹ºè"(‚®¼Âë o&í&ê®d´YÄšM,”-?j¶ÂèõcŸïǶþÏ(©pvàÇÿ}žsžsÎóñ²J¥B›ÙµGû+bI¤•Âåä|ùÁ¹¹ºÍâTTÃS¯û< v]¢bIªV;©Kjb*ª0"…äšqê'nGV³rZMÝÕüå2#‡ÅM»‡ë3™¼(&o”­[&¨Û&™Üæ^j2í¡åLŠÖ õÙaO:ÃÓىⷰðùV÷lnœæ… ²è›Éjl£øòsJ­©wû}ëÀ•»][&´¯«—†h2÷„f~„hFxF¯SÉõÆì)²²<õÛËþ:ìééé;Š¢ì$˲´{<öpl\ ÙÎhU‚“.· ÓËx¢p¤o}$ÉK’ôIE‚~Wa¡b³Ù\HæÂÄUFâÑ諎fí‰Õ‘“§ 7)‘Ho³êêÃáðˆ^¯×‹Å!§ÓéB’v‹Å:cs¹\ À Òp6òJÀïEh3ô´ ¬hµÚ´ cªžžž¹l6»Ž¾ à0oQá N§›‚ú Ã;¨ú~ŸÉdâzÀápð-¼`ü)‡`œ…ƒwÐ ý m…ÎóÀ>oÃ9 `»?Z½T¸÷GS¼BCCÃ^Ñl6óŽ|‹%Žñ!è{$ñ"AL²ß?Óèè¨ ‡Av~ºÐNhì ;ÀhBå]àb èÛx‰X Ó¯+Ú‹6à×C§R©ô¸újýÎ[™ßï×p ƒÒO&)¦hÇh4IEND®B`‚jftp-1.52.orig/src/images/current/page_white.png0000700000175000017500000000044611112477774020763 0ustar varunvarun‰PNG  IHDRµú7êgAMA¯È7ŠétEXtSoftwareAdobe ImageReadyqÉe<¸IDAT(Ïu‘[ E§®Ã&î†}šè‡ÔøŠµO(Ôë@_Ö–œá‡9a.Ñ–É?v´9\ •šÖbBá°WÒ´JÏ/\Y¹àØ+DI‹šO)n,T(pbe´§æF†û8гD½`ü…áéñ_9Ï…NÉ8És]蔊³d!Á¢á4Œ¬Öãiš‘À/&~…Ï’ 8øQ€˜>Ã^:D*¯›ÌÌ»…;C"µc ƒ:¿ÃQl:=sq\êÒqíÉ"CCëZCŒŒíÃb_æHKF÷÷O=ST9×$½j\Êa7™Ã¬'‰³r¶„Ã´Š¾‘÷DÃÝá#“Óµ"HrŽM™„j!¼—E›cߢ2+Ѫw¾nv‡Ïž±²H–1Ÿy|Ö¥ˆ©cFL—ô4´LT9O¡Ã:¬4[&-Rõ*·ÛVÌöqaÙÁ¶(³™PÏ- S.Ú-½BS燿W¹ú3ÝêÙ2µ¾žâžwõó–—ÝÒ‹NNjë°òÍîü÷gúŸïüöÈâ`~i—IEND®B`‚jftp-1.52.orig/src/images/current/control_pause_blue.png0000700000175000017500000000132111112477774022524 0ustar varunvarun‰PNG  IHDRóÿagAMA¯È7ŠétEXtSoftwareAdobe ImageReadyqÉe<cIDAT8Ë¥“Koa†ûüüXºtÃÎê¦;ãݰ1qÑÔ•¤š¸hŒ™BÓ¦µJ‚&UÛÔH[éb (S@À…a†ËPŽs>˜/;'yóå¼ÏyÏw™€‰qsI“E“UÓÔHÖÑšéÏúqãMæ»/%[àã1ÙO3‰C!Î&…ݽób'GOûë6¬ÁÚß#óY_¨lf9¾&¬ô@=5Z](UêÞc¹…ͬkuˆ0£™M}•ÛðSº}¨Ë=45;}²&+]ØÆdÏúBÌ€sal쬛«R*?ºÀ‹C•Ŕ겹æn¯ð8Ž –óÆØºùâƒÜr' óäì\w%HüR¹ï@ù#4z` 9bpfŒŠ¦ ÷ ]‹B[l@­Ñ©¥Â‰¨Àâêk½˜Š$Ü,,@v¼¡Žkm¢Iû6\›gI:ü盛°â]ÐKûq–°»ê‘±¸PmÃù{A¸Jø/µz°¸ôÜX?|N2¢Ü†¢;’È,äOÈU ðžpcñdÒE(×Áâ fèB©ƒ•å"4_¦X2^¯?€­OI°»ß›hºã«Ú‚¡('Hmã$t¥Ë-ã8ќѺ;Ÿ,sWÜéá1ê‰z·¯½ É|½I’ˆM•¤Á1ðøÐœ.ÖÁáñÉ3Ôú¯‹4~•ç¼Qû²‹Ä2Pà%²'8s2/ÀF(sÔ7í|ó÷UL7Ÿåm³O7èG®%†šw ´ðÐáafúú÷cúŸçü? sq"õ–IEND®B`‚jftp-1.52.orig/src/images/current/control_repeat.png0000700000175000017500000000064611112477774021671 0ustar varunvarun‰PNG  IHDRµú7êgAMA¯È7ŠétEXtSoftwareAdobe ImageReadyqÉe<8IDAT(Ï}‘MK‚A…ýQóŸ¦]ôév~AˆFõBmŠ(jáÂMAÔ,"éK*? MËÒQ_ë%)étœWBŒâl.÷ÞY8õÓr0Ü ì6Z°T ‡hs(WƒF Q§yj+ì”RÈ週Q\º³/xÆf¹I »Ú·¶Ð|D ÷˜aõ-ë€,6ƒÏÙ¬ÒžÆ:3ÖCàZw¹RlîÑžÂ$yŸ2ÖÂUÅÍ'Æ×°Ià|â^¸dZ›·®QU<`E¨À3ž>ÔÜ÷›l¾ºŸ§Ëðü„yê¤Ü1Ž8»„‰É±ÏÚ«jY/Ù¸é¿~ó/}wu4L×Í’IEND®B`‚jftp-1.52.orig/src/images/current/control_stop_blue.png0000700000175000017500000000126711112477774022405 0ustar varunvarun‰PNG  IHDRóÿagAMA¯È7ŠétEXtSoftwareAdobe ImageReadyqÉe<IIDAT8Ë¥“MoQ†ûüüXºtC¢û&FMܘ°1qÑ´º!n\4¦KÓ¦µJ‚&Ô¶©I¥#ˆi,SJ>,С03ÃÇPŽsî0#jãÆ›¼››ó¼çãž;S“º¶6]]N]Óc9Çw¶?ã'Á+ºìsodWøÓ)?Ì1GÇ'›J ûæõ‡"=]ƒ±¿Œá«ÁhÍÍž8¾)ƒ¢@»µ:}¨ÖEˆ¤¸¥‚cMÓÀŽp*óMéö4À£ö‡ *tµ{Cr§¨}ØO$ÿVMìÄû²1³ 7ä>Ôô— Õ¤TÅže²³ãî¯ñØŽ aæ;eÿ >mv‰ðdŠg@…â4²hàŒ}Í2Ø3–j‚7mz¸·½,Ë.È Î%–×7dÑ`:yt,à°š­1#‚¦Ð t®B±®£¾vkuYbpȦˆ–pEèZðõ¹Üò°PàU"£Š,¯¼² œ¿¤IéAKÕ¬^1+‚¨› †Aþ¬C^&W‘€ò¬Ý<]®6a4’Á,×ÌŠ`®Ölµƒáö>§ÁíÛ´†h{l¸v£ N)_fªm’ ¯g÷>_åîúrÆ3š‹D½eÝ‘÷Q…@©­YÕà2aæ\E?¨ÌR[¿ir•ç ÷j(ÂÅ“y(ó2™ öœ. °eažZâf¼ïþ^åÉÏtïeÉõøÅ6ýtq…¡žù„/-<ñø™YO˜¾Cg.ÿLÿóë8öÇu‚éIEND®B`‚jftp-1.52.orig/src/images/current/table_save.png0000700000175000017500000000132311112477774020747 0ustar varunvarun‰PNG  IHDRóÿagAMA¯È7ŠétEXtSoftwareAdobe ImageReadyqÉe<eIDAT8Ë•’Ik”A†Ÿî¯'ljDÉ"("HET\Æ-§è1(\.""9x÷¢(˜›¢¿@PAÁC ‡€"*Æ}½ ŠŠ5™hdb&3_wWy˜˜Dð  ÍÛÕM=]oQæò±ªŽ*‹E„(DˆQˆ¢„(³v$%Š<î9ÐVp¢z´«ÐÐĬ“WÞ¬þ}vQ¤  ïíE‚B x øèg4†é·c[zð>ÖÏ(ûVú§ß'*"3€(ôÞù'ÀÎ HgÂ`o{ W‡Ù³­uúîÚƒaº6ÏÄ£¥Ê˜sýCz¨£™cXc0(·_i¨‡r˜Ÿ¯ãóÈ$ÆB>— j+MróùÐ&£ €K » Íô=*²«ÐÂÀ½t–³k]žþŸ8¾ÅV.Ý*"bZpúŸI’š–«žïã€ëO†§+JU(þH1F°>ªJ&ÎõÍd¡s}3Ö…³ÝëQ¢( BÎ Õj•ÒDŠ Rkbb 7^Žpãå(ÙŒ¥Rõœ¾òk DA¦ìª*(ä2‚ !Ôz`aÇš&\RÓ J5›Á‡!Á˜Ô¢jð!¦çcͪ%y¾|ŸdYëÞ}ýÉxÙ“1Žî΂¤€5BÖÕq¦÷ßJ¸uðTïëµi”¹>D|ˆÄ S~3“\xv„¦Ü –bù#‡7žÇ’¥\Mqg®hÿÛÄí9}_—.„Öü8Û×h¬[~TÑ27«g FUÿ:²º¯¶-ž³µ±¾‘¬›GÁhDL™WÞ2RòüZ>žë„JIEND®B`‚jftp-1.52.orig/src/images/current/control_play.png0000700000175000017500000000112011112477774021342 0ustar varunvarun‰PNG  IHDRóÿagAMA¯È7ŠétEXtSoftwareAdobe ImageReadyqÉe<âIDAT8Ë¥“˪â@†ÏCåò8«<ˆ‚"èÆ¢ ®‘ ¢*ÞÚËÂ…÷kÔxAQ±¦ÿæ$"s8Ã0 EBº¿¿ªþê|ÑÇÿÄúý¾Ôëõ´n·«w:ƒ1f´Z-½Ùljõz]úV€Ã2‡Ùz½¦óùLÇCÄét¢ÅbAµZU*ùKOؼ^¯„…çáp Ó4ér¹ˆo-—Ëf©T’ß>Ëf¼Ûíh»ÝR>Ÿ'Ã0h³Ùª²Dt]gÙlV²x¿šuÀ‚:?)—Ë x¹\ŠÀ ”J¥4[€›¥C¥´²:N<£€áü@‚D"¡ÛívÛ€Yûý^ÀȸZ­8ìárý¢jµJ³ÙLÝn7ŠF£†-ÀÇ$P¾ã `Uu‘¢ü{ÓéÔ®"‰¼†ÇцÕ+ªªúO&1™ápHápøÕŸ¯†Íçó)Àù|.ÊUEÀØÇ4è~¿S±X¤`0ø2‘ÏU* `!°"+àÃŒ‡ôv‘2™ŒœN§M¸ƒÇãÑ®— ™!ÂAÓçóÉ_^åd2)ÇãqÆ[-ÀôŒ¹c”dGþögŠÅbR(Ò€î÷û ¯×kpHw»Ý—þú7þküFF?ÔE·E IEND®B`‚jftp-1.52.orig/src/images/current/control_eject_blue.png0000700000175000017500000000132711112477774022507 0ustar varunvarun‰PNG  IHDRóÿagAMA¯È7ŠétEXtSoftwareAdobe ImageReadyqÉe<iIDAT8Ë¥SKoQîðð;`éÒ ;«¢7&lL\4uå¤VÖ*dÆÅ´im ’ IÕ65¶"‚4MRÊð°@¡0Œ000@9ιÀˆ“|™äæ|sî¹#02Œs³ Q S W`èCß?ÓüY?L<£@{ûMÅèÜ>b¼þ»pÈCa~k7¾v%™qGÙˆ5Xû›@Ÿ|ÖîÎQÁ×/U@”ZÐ>íTë2d eð솸¹õ…µ‘€É¡È7±Ñl~’ܲØ^A­Ù!g¢$Ö/ ZW£(¢%ØÆFç¹X‘¡ðC†£RJÕä„&dËMUd}ÓÃÝ\Êc;Ð9Ùï Æ&G³u¸üh.Üu©bü"Éc ^¹( ÷ìEYì£æ’‰G']0vß«ü?“ót±•zN æ—ß±ÈEC`ÿ€Çaa\,¼8Å2c÷¶a”Ú m` ¹} K¶e¹DÀ ŒE¾¡FFWL”È÷ÐKÑ‚ù…Wª€þËN˜Ä&T¥6!gÅqþÎ'‚K}?®“›‰e ­6µm#Τ³%èv8\™ñÃÕ'0<ÞSÿx†ƒmuº°ù5 ”åƒ:DÍ-{Ѹáöq|¥7åA\tŒåê„ÉÖˆA\q7?_ä®[b½k,ý6H­|t‹ùr¯P¨µIšÔ‰D– c™2˜¬vq‚^ýµHë>> Connection closed..."); LocalIO.pause(100); JScrollBar bar = RawConnection.outputPane.getVerticalScrollBar(); bar.setValue(bar.getMaximum()); in.close(); return; } else { String tmp = new String(buf); tmp = tmp.substring(0, cnt); RawConnection.output.append(tmp); LocalIO.pause(100); JScrollBar bar = RawConnection.outputPane.getVerticalScrollBar(); bar.setValue(bar.getMaximum()); LocalIO.pause(400); } } } catch(Exception ex) { ex.printStackTrace(); } } public void reset(DataInputStream in) { reciever.destroy(); this.in = in; reciever = new Thread(this); reciever.start(); } } jftp-1.52.orig/src/java/net/sf/jftp/util/ZipFileCreator.java0000700000175000017500000000553211112477774022777 0ustar varunvarun/* * 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. */ package net.sf.jftp.util; import net.sf.jftp.*; import net.sf.jftp.net.*; import net.sf.jftp.system.logging.Log; import net.sf.jftp.util.*; import java.io.*; import java.util.zip.*; public class ZipFileCreator { private ZipOutputStream z; public ZipFileCreator(String[] files, String path, String name) throws Exception { z = new ZipOutputStream(new BufferedOutputStream(new FileOutputStream(path + name))); perform(files, path, ""); z.finish(); z.flush(); z.close(); } private void perform(String[] files, String path, String offset) { byte[] buf = new byte[4096]; for(int i = 0; i < files.length; i++) { try { File f = new File(path + offset + files[i]); BufferedInputStream in = null; if(f.exists() && !f.isDirectory()) { in = new BufferedInputStream(new FileInputStream(path + offset + files[i])); } else if(f.exists()) { if(!files[i].endsWith("/")) { files[i] = files[i] + "/"; } perform(f.list(), path, offset + files[i]); } ZipEntry tmp = new ZipEntry(offset + files[i]); z.putNextEntry(tmp); int len = 0; while((in != null) && (len != StreamTokenizer.TT_EOF)) { len = in.read(buf); if(len == StreamTokenizer.TT_EOF) { break; } z.write(buf, 0, len); } z.closeEntry(); } catch(Exception ex) { Log.debug("Skipping a file (no permission?)"); } } } } jftp-1.52.orig/src/java/net/sf/jftp/gui/0000700000175000017500000000000011155274771017050 5ustar varunvarunjftp-1.52.orig/src/java/net/sf/jftp/gui/tasks/0000700000175000017500000000000011155274771020175 5ustar varunvarunjftp-1.52.orig/src/java/net/sf/jftp/gui/tasks/ProxyChooser.java0000700000175000017500000000577311112477774023524 0ustar varunvarun/* * 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. */ package net.sf.jftp.gui.tasks; import java.awt.FlowLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JLabel; import net.sf.jftp.config.Settings; import net.sf.jftp.gui.framework.HButton; import net.sf.jftp.gui.framework.HPanel; import net.sf.jftp.gui.framework.HTextField; import net.sf.jftp.system.logging.Log; public class ProxyChooser extends HPanel implements ActionListener { private HTextField proxy; private HTextField port; private HButton ok = new HButton("Ok"); public ProxyChooser() { //setSize(500,120); //setTitle("Proxy settings..."); //setLocation(50,150); //getContentPane(). setLayout(new FlowLayout(FlowLayout.LEFT)); proxy = new HTextField("Socks proxy:", ""); port = new HTextField("Port:", ""); proxy.setText(Settings.getSocksProxyHost()); port.setText(Settings.getSocksProxyPort()); //getContentPane(). add(proxy); //getContentPane(). add(port); //getContentPane(). add(ok); //getContentPane(). add(new JLabel("Please note that you have to restart JFtp to apply the changes!")); ok.addActionListener(this); //setVisible(true); } public void actionPerformed(ActionEvent e) { if(e.getSource() == ok) { //setVisible(false); String h = proxy.getText().trim(); String p = port.getText().trim(); java.util.Properties sysprops = System.getProperties(); // Remove previous values sysprops.remove("socksProxyHost"); sysprops.remove("socksProxyPort"); Settings.setProperty("jftp.socksProxyHost", h); Settings.setProperty("jftp.socksProxyPort", p); Settings.save(); Log.out("proxy vars: " + h + ":" + p); if(h.equals("") || p.equals("")) { return; } // Set your values sysprops.put("socksProxyHost", h); sysprops.put("socksProxyPort", p); Log.out("new proxy vars set."); remove(3); add(new JLabel("Options set. Please restart JFtp.")); validate(); setVisible(true); } } } jftp-1.52.orig/src/java/net/sf/jftp/gui/tasks/Remover.java0000700000175000017500000000443211112477774022466 0ustar varunvarun/* * 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. */ package net.sf.jftp.gui.tasks; import net.sf.jftp.*; import net.sf.jftp.gui.framework.*; import net.sf.jftp.util.*; import java.awt.*; import java.awt.event.*; import java.io.*; public class Remover extends HFrame implements ActionListener { private HTextField text; private HButton ok = new HButton("Remove file/directory..."); private HButton cancel = new HButton("Cancel"); private HPanel okP = new HPanel(); private String type = null; public Remover(String l, String type) { this.type = type; setSize(350, 100); setTitle("Choose..."); setLocation(150, 150); getContentPane().setLayout(new BorderLayout(10, 10)); text = new HTextField(l, ""); okP.add(ok); okP.add(cancel); getContentPane().add("North", text); getContentPane().add("South", okP); ok.addActionListener(this); cancel.addActionListener(this); setVisible(true); } public void actionPerformed(ActionEvent e) { if(e.getSource() == ok) { setVisible(false); String tmp = text.getText(); if(!tmp.endsWith("/")) { tmp = tmp + "/"; } AutoRemover armv = new AutoRemover(tmp, type); if(type.equals("local")) { JFtp.localUpdate(); } if(type.equals("remote")) { JFtp.remoteUpdate(); } } if(e.getSource() == cancel) { this.dispose(); } } } jftp-1.52.orig/src/java/net/sf/jftp/gui/tasks/NameChooser.java0000700000175000017500000000333311112477774023251 0ustar varunvarun/* * 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. */ package net.sf.jftp.gui.tasks; import net.sf.jftp.*; import net.sf.jftp.gui.framework.*; import net.sf.jftp.net.*; import net.sf.jftp.util.*; import java.awt.*; import java.awt.event.*; import java.io.*; public class NameChooser extends HFrame implements ActionListener { public HTextField text; private HButton ok = new HButton("Ok"); private HPanel okP = new HPanel(); public NameChooser() { //setSize(400, 80); setTitle("Enter a name for the file..."); //setLocation(150, 150); getContentPane().setLayout(new FlowLayout()); text = new HTextField("Filename: ", "tmp.zip"); getContentPane().add(text); getContentPane().add(ok); ok.addActionListener(this); text.text.addActionListener(this); pack(); fixLocation(); setVisible(true); } public void actionPerformed(ActionEvent e) { if((e.getSource() == ok) || (e.getSource() == text.text)) { setVisible(false); } } } jftp-1.52.orig/src/java/net/sf/jftp/gui/tasks/Creator.java0000700000175000017500000000343611112477774022451 0ustar varunvarun/* * 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. */ package net.sf.jftp.gui.tasks; import net.sf.jftp.*; import net.sf.jftp.gui.framework.*; import net.sf.jftp.net.*; import net.sf.jftp.util.*; import java.awt.*; import java.awt.event.*; import java.io.*; /** * Create directory dialog. * * @author David Hansmann * */ public class Creator extends HFrame implements ActionListener { private HTextField text; private HButton ok = new HButton("Create directory..."); private BasicConnection con; public Creator(String l, BasicConnection con) { this.con = con; setTitle("Choose..."); getContentPane().setLayout(new FlowLayout()); text = new HTextField(l, ""); getContentPane().add(text); getContentPane().add(ok); ok.addActionListener(this); text.text.addActionListener(this); pack(); fixLocation(); setVisible(true); } public void actionPerformed(ActionEvent e) { if((e.getSource() == ok) || (e.getSource() == text.text)) { setVisible(false); con.mkdir(text.getText()); } } } jftp-1.52.orig/src/java/net/sf/jftp/gui/tasks/LastConnections.java0000700000175000017500000004235011112477774024156 0ustar varunvarun/* * 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. */ //TODO: Having capacity passed to these methods is redundant, take it out //*** (should it be in GUI dir?) package net.sf.jftp.gui.tasks; import net.sf.jftp.JFtp; //*** import net.sf.jftp.config.*; import java.awt.*; import java.awt.event.*; import java.io.*; import java.lang.*; import java.util.*; import javax.swing.*; public class LastConnections { public static String SENTINEL = new String("********************"); private static JFtp jftp; //*** changed this so that JFtp object is passed to it and //initialized public LastConnections(JFtp jftp) { this.jftp = jftp; //init(); } //writeToFile: This code is called when modifications are done //being made (should it be private and called from inside //this class?) //maybe I should return a boolean value stating whether or not it //succeeded //SHOULD THIS BE PRIVATE? //public static void writeToFile(String[] a, int capacity) { public static void writeToFile(String[][] a, int capacity) { try { File f1 = new File(Settings.appHomeDir); f1.mkdir(); File f2 = new File(Settings.last_cons); f2.createNewFile(); FileOutputStream fos; PrintStream out; fos = new FileOutputStream(Settings.last_cons); out = new PrintStream(fos); //String[] lastCons = new String[capacity]; //lastCons = readFromFile(capacity); for(int i = 0; i < capacity; i++) { //out.println(a[i]); int j = 0; out.println(a[i][j]); while((j < JFtp.CAPACITY) && !(a[i][j].equals(SENTINEL))) { j++; out.println(a[i][j]); //retVal[i][j] = raf.readLine(); //System.out.println(); } //System.out.println(a[i]); } /* RandomAccessFile raf = new RandomAccessFile(f2, "rw"); for (int i = 0; i < capacity; i++) { raf.writeChars(a[i] + "\n"); } */ jftp.updateMenuBar(); } catch(Exception e) { e.printStackTrace(); } } //writeToFile public static String[][] readFromFile(int capacity) { //MAKE THIS 2D //String[] retVal = new String[capacity]; String[][] retVal = new String[capacity][JFtp.CONNECTION_DATA_LENGTH]; //if ((f.exists())) // System.out.println("not found"); try { File f1 = new File(Settings.appHomeDir); f1.mkdir(); File f2 = new File(Settings.last_cons); //File f; //f = init(capacity); if(!f2.exists()) { init(capacity); } /* FileReader fr = new FileReader(Settings.last_cons); BufferedReader breader = new BufferedReader(fr); for (int i=0; i"); //System.out.println(retVal[i][j]); while((j < JFtp.CONNECTION_DATA_LENGTH) && !(retVal[i][j].equals(SENTINEL))) { j++; retVal[i][j] = raf.readLine(); //System.out.print("--->"); //System.out.println(retVal[i][j]); //j++; } //while //retVal[i][j+1] = raf.readLine(); } //for } catch(Exception ex) { ex.printStackTrace(); } return retVal; } //readFromFile public static String[][] prepend(String[] newString, int capacity, boolean newConnection) { //BUGFIX: 2D //String[] lastCons = new String[capacity]; String[][] lastCons = new String[capacity][JFtp.CONNECTION_DATA_LENGTH]; lastCons = readFromFile(capacity); for(int i = 0; i < capacity; i++) { int j = 0; while(!(lastCons[i][j].equals(SENTINEL))) { //temp[j] = lastCons[i][j]; //lastCons[i][j] = newString[j]; //System.out.println(lastCons[i][j]); j++; } //System.out.println(lastCons[i][j]); } //BUGFIX: now need array to represent 1st connection data //String temp = new String(""); String[] temp = new String[JFtp.CONNECTION_DATA_LENGTH]; int j = 0; //is temp necessary? //System.out.println("++++++++++++++++++++"); while(!(lastCons[0][j].equals(SENTINEL))) { //while (!(newString[j].equals(SENTINEL))) { temp[j] = lastCons[0][j]; //lastCons[0][j] = newString[j]; //System.out.println(lastCons[0][j]); //if (lastCons[0][j].equals(SENTINEL)) //break; j++; } temp[j] = SENTINEL; j = 0; while(!(newString[j].equals(SENTINEL))) { lastCons[0][j] = newString[j]; j++; } lastCons[0][j] = SENTINEL; //take out any data that would be "left over" after sentinel //is this necessary? j++; while(j < JFtp.CONNECTION_DATA_LENGTH) { lastCons[0][j] = ""; j++; } //System.out.println("-----------------"); for(int i = 0; i < capacity; i++) { //while (!(lastCons[j].equals(SENTINEL))) { //newString = temp; if((i + 1) != capacity) { //System.out.print("-->"); j = 0; //System.out.println(temp[j]); //shift temp data into newString while(!(temp[j].equals(SENTINEL))) { newString[j] = temp[j]; //System.out.println(newString[j]); j++; } newString[j] = SENTINEL; //System.out.println("$$$$$$$$$$$$$"); //store lastCons data in temp again j = 0; //while (!(temp[j].equals(SENTINEL))) { while(!(lastCons[i + 1][j].equals(SENTINEL))) { //newString[j] = temp[j]; temp[j] = lastCons[i + 1][j]; //temp[j] = lastCons[i + 1][j]; //lastCons[i+1][j] = newString[j]; //j++; //System.out.println(lastCons[i+1][j]); //System.out.println(temp[j]); //if (temp[j].equals(SENTINEL)) //if (lastCons[i][j].equals(SENTINEL)) //break; //temp[j] = lastCons[i+1][j]; j++; } //while temp[j] = SENTINEL; //System.out.println("+-+-+-+-+-+-"); //then, make adjustments to lastCons j = 0; //while (!(lastCons[i+1][j].equals(SENTINEL))) { while(!(newString[j].equals(SENTINEL))) { lastCons[i + 1][j] = newString[j]; //System.out.println(lastCons[i+1][j]); j++; } lastCons[i + 1][j] = SENTINEL; //j=0; /* while (!(lastCons[i][j].equals(SENTINEL))) { temp[j] = lastCons[i+1][j]; j++; } */ //lastCons[i+1][j] = SENTINEL; } //if } //for for(int i = 0; i < capacity; i++) { j = 0; while(!lastCons[i][j].equals(SENTINEL)) { //System.out.println(lastCons[i][j]); if(lastCons[i][j].equals(SENTINEL)) { break; } j++; } //System.out.println(lastCons[i][j]); } //*** if(newConnection) { writeToFile(lastCons, capacity); } return lastCons; } //prepend public static String[][] moveToFront(int position, int capacity) { //make these 2D //String[] lastCons = new String[capacity]; //String[] newLastCons = new String[capacity]; String[][] lastCons = new String[capacity][JFtp.CONNECTION_DATA_LENGTH]; String[][] newLastCons = new String[capacity][JFtp.CONNECTION_DATA_LENGTH]; //System.out.print("--------:"); //System.out.println(capacity); lastCons = readFromFile(capacity); //String temp = new String(""); String[] temp = new String[JFtp.CONNECTION_DATA_LENGTH]; //String[] lastCons = new String[capacity]; int j = 0; temp[j] = lastCons[position][j]; while(!(lastCons[position][j].equals(SENTINEL))) { j++; temp[j] = lastCons[position][j]; } j = 0; //System.out.println("START"); while(!(lastCons[position][j].equals(SENTINEL))) { //System.out.println(lastCons[position][j]); j++; } //System.out.println("END"); //possible bugfix code? /* for (int i=0; i"); //System.out.println(newData[i][0]); //System.out.println(j); //for backwards compatibility with versions that //don't have SFTP port remembered: enter port 22 //(which is default) there if(newData[i][0].equals("SFTP") && (j == 5)) { String temp = new String(""); String temp2 = new String(""); temp = newData[i][4]; newData[i][4] = "22"; temp2 = newData[i][5]; newData[i][5] = temp; //temp2 = newData[i][5]; //newData[i][6] = temp2; //newData[i][7] = SENTINEL; newData[i][6] = SENTINEL; /* for (int j=5; j++; j<7) { temp = newData[i][j]; newData[i][j] = newData[i][j-1]; } */ } //if } //for writeToFile(newData, JFtp.CAPACITY); } //changeFile } //LastConnections jftp-1.52.orig/src/java/net/sf/jftp/gui/tasks/HostInfo.java0000700000175000017500000000232411112477774022576 0ustar varunvarun/* * 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. */ package net.sf.jftp.gui.tasks; /* Incapsulate all the information of the current connection */ public class HostInfo { public String type; // parameter used for ftp public String hostname; public String username; public String password; public String port; // local path + filename // public String local; // remote path + filename // public String remote; // used only for smb public String localip; public String domain; public HostInfo() { } } jftp-1.52.orig/src/java/net/sf/jftp/gui/tasks/HttpBrowser.java0000700000175000017500000000740211112477774023332 0ustar varunvarun/* * 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. */ package net.sf.jftp.gui.tasks; import net.sf.jftp.*; import net.sf.jftp.config.*; import net.sf.jftp.gui.framework.*; import net.sf.jftp.net.*; import net.sf.jftp.system.logging.Log; import net.sf.jftp.util.*; import java.awt.*; import java.io.*; import java.util.*; import javax.swing.*; import javax.swing.event.*; import javax.swing.text.html.*; public class HttpBrowser extends JInternalFrame implements HyperlinkListener { public HttpBrowser(String url) { super("Http Browser", true, true, true, true); try { setTitle(url); JEditorPane pane = new JEditorPane(url); pane.setEditable(false); pane.addHyperlinkListener(this); if(!pane.getEditorKit().getContentType().equals("text/html") && !pane.getEditorKit().getContentType().equals("text/rtf")) { if(!pane.getEditorKit().getContentType().equals("text/plain")) { Log.debug("Could not display URL."); return; } pane.setEditable(false); pane.addHyperlinkListener(this); } JScrollPane jsp = new JScrollPane(pane); getContentPane().setLayout(new BorderLayout()); getContentPane().add("Center", jsp); setLocation(50, 50); setSize(600, 400); show(); requestFocus(); } catch(Exception ex) { Log.debug("Error fetching URL: " + ex); ex.printStackTrace(); } } public void hyperlinkUpdate(HyperlinkEvent e) { if(e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) { JEditorPane pane = (JEditorPane) e.getSource(); if(e instanceof HTMLFrameHyperlinkEvent) { HTMLFrameHyperlinkEvent evt = (HTMLFrameHyperlinkEvent) e; HTMLDocument doc = (HTMLDocument) pane.getDocument(); doc.processHTMLFrameHyperlinkEvent(evt); } else { try { String url = e.getURL().toString(); String tmp = url.substring(url.lastIndexOf("/")); Vector listeners = new Vector(); listeners.add(JFtp.localDir); if(!url.endsWith(".htm") && !url.endsWith(".html") && (tmp.indexOf(".") >= 0)) { JFtp.statusP.startTransfer(url, JFtp.localDir.getPath(), listeners, JFtp.getConnectionHandler()); } else { pane.setPage(e.getURL()); } } catch(Throwable t) { t.printStackTrace(); } } } } } jftp-1.52.orig/src/java/net/sf/jftp/gui/tasks/BookmarkManager.java0000700000175000017500000001171311112477774024107 0ustar varunvarun/* * 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. */ package net.sf.jftp.gui.tasks; import net.sf.jftp.*; import net.sf.jftp.config.*; import net.sf.jftp.gui.framework.*; import net.sf.jftp.system.logging.Log; import net.sf.jftp.util.*; import java.awt.*; import java.awt.event.*; import java.io.*; import javax.swing.*; public class BookmarkManager extends JInternalFrame implements ActionListener { private JTextArea info = new JTextArea(25, 50); private JButton save = new JButton("Save and close"); private JButton close = new JButton("Close"); public BookmarkManager() { super("Manage Bookmarks", true, true, true, true); setLocation(50, 50); setSize(600, 540); getContentPane().setLayout(new BorderLayout()); load(Settings.bookmarks); JScrollPane jsp = new JScrollPane(info); getContentPane().add("Center", jsp); HPanel closeP = new HPanel(); closeP.setLayout(new FlowLayout(FlowLayout.CENTER)); //closeP.add(close); closeP.add(save); close.addActionListener(this); save.addActionListener(this); getContentPane().add("South", closeP); info.setCaretPosition(0); pack(); setVisible(true); } public void actionPerformed(ActionEvent e) { if(e.getSource() == close) { this.dispose(); } else { save(Settings.bookmarks); JFtp.menuBar.loadBookmarks(); this.dispose(); } } private void setDefaultText() { info.setText(""); info.append("# JFtp Bookmark Configuration file\n"); info.append("#\n"); info.append("# Syntax: protocol#host#user#password#port#dir/domain#local\n"); info.append("#\n"); info.append("# Note: not all values are used by every connection, but all fields must contain at least\n"); info.append("# one character.\n"); info.append("Use \"<%hidden%>\" for password fields you don't want to fill out."); info.append("#\n"); info.append("# protocol: FTP, SFTP, SMB or NFS (uppercase)\n"); info.append("# host: hostname or ip for ftp + sftp, valid url for smb + nfs (\"(LAN)\" for smb lan browsing)\n"); info.append("# user, password: the login data\n"); info.append("# port: this must be a number (even if it is not used for smb+nfs, set it in the url for nfs)\n"); info.append("# dir/domain: inital directory for the connection, domainname for smb\n"); info.append("# local: \"true\" if connection should be opened in local tab, \"false\" otherwise\n"); info.append("# directories must be included in tags and can be ended" + " using a single\n# tag"); info.append("#\n"); info.append("#\n"); info.append("\nJFtp\n"); info.append("FTP#upload.sourceforge.net#anonymous#j-ftp@sf.net#21#/incoming#false\n"); info.append("\n"); info.append("\n"); info.append("FTP#ftp.kernel.org#anonymous#j-ftp@sf.net#21#/pub/linux/kernel/v2.6#false\n"); info.append("\n"); info.append("SMB#(LAN)#guest#guest#-1#-#false\n\n"); } private void load(String file) { String data = ""; String now = ""; try { DataInput in = new DataInputStream(new BufferedInputStream(new FileInputStream(file))); while((data = in.readLine()) != null) { now = now + data + "\n"; } } catch(IOException e) { Log.debug("No bookmarks.txt found, using defaults."); setDefaultText(); return; } info.setText(now); } private void save(String file) { try { PrintStream out = new PrintStream(new BufferedOutputStream(new FileOutputStream(file))); out.println(info.getText()); out.flush(); out.close(); } catch(IOException e) { Log.debug(e + " @BookmarkManager.save()"); } } public Insets getInsets() { Insets std = super.getInsets(); return new Insets(std.top + 5, std.left + 5, std.bottom + 5, std.right + 5); } } jftp-1.52.orig/src/java/net/sf/jftp/gui/tasks/AdvancedOptions.java0000700000175000017500000001234111112477774024126 0ustar varunvarun/* * 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. */ package net.sf.jftp.gui.tasks; import net.sf.jftp.*; //*** import net.sf.jftp.config.*; import net.sf.jftp.gui.framework.*; import net.sf.jftp.net.*; import java.awt.*; import java.awt.event.*; import javax.swing.*; //*** public class AdvancedOptions extends HPanel implements ActionListener { //used this to see if it needs to look up file value public static boolean listOptionSet = false; private HTextField listCommand = new HTextField("FTP LIST command:", FtpConnection.LIST, 15); private JButton setListCommand = new JButton("Set"); //*** private JButton saveCommand = new JButton("Set and Save"); //*** //*** should it really be set up so that the original message here on top //*** is cleared out when events such as changing settings occurs //*** (the text area which contains instructions at first has these //*** instructions cleared out when some events occur.) //*** So maybe should have a text box at the bottom? And a label at top //*** with the instruction text? //***this line may be deprecated private JLabel text = new JLabel(); //private JLabel note = new JLabel(); //*** private JLabel statusText = new JLabel(); private String listOptionText = new String(); //what the text in the box initially is //*** public AdvancedOptions() { setLayout(new BorderLayout(5, 5)); //text.setText("You can override the default values here, but note that " + // "the values are not saved\n and lost after closing the application."); text.setText("Default values for commands can be overidden here."); statusText.setText("Note: The FTP LIST command should be \"LIST\" when connecting to an OS/2 server."); text.setPreferredSize(new Dimension(400, 30)); //text.setLineWrap(true); //*** statusText.setPreferredSize(new Dimension(400, 30)); //statusText.setLineWrap(true); //*** //load initial advanced options here //JUST FOR NOW: We just know that value 0 is the FTP LIST command if(listOptionSet) { listOptionText = FtpConnection.LIST; } else { //AND NEED TO CHECK IF FILE DOESN'T EXIST (if not, create it //and set the file and settings to the default if(LoadSet.loadSet(Settings.adv_settings) != null) { listOptionText = LoadSet.loadSet(Settings.adv_settings)[0]; } else { listOptionText = FtpConnection.LIST_DEFAULT; SaveSet s = new SaveSet(Settings.adv_settings, FtpConnection.LIST_DEFAULT); } } listCommand.setText(listOptionText); HPanel content = new HPanel(); HPanel panel = new HPanel(); panel.add(listCommand); panel.add(setListCommand); //*** panel.add(saveCommand); //*** content.add(panel); add("North", text); add("Center", content); add("South", statusText); setListCommand.addActionListener(this); saveCommand.addActionListener(this); } public void actionPerformed(ActionEvent e) { if(e.getSource() == setListCommand) { FtpConnection.LIST = listCommand.getText().trim(); //text.setText("LIST command set."); //*** statusText.setText("LIST command set."); listOptionSet = true; //*** } //if(e.getSource() == saveCommand) else { //isn't the following line redundant? So I commented it out //it would be redundant if the LIST command is read in by LoadSet each time //FtpConnection.LIST = listCommand.getText().trim(); FtpConnection.LIST = listCommand.getText().trim(); listOptionSet = true; //text.setText("LIST command set and saved"); //statusText.setText("LIST command set and saved."); SaveSet s = new SaveSet(Settings.adv_settings, listCommand.getText().trim()); //*** //text.setText("LIST command set and saved"); statusText.setText("LIST command set and saved."); //*** } } public Insets getInsets() { return new Insets(super.getInsets().top+5,super.getInsets().left+5,super.getInsets().bottom+5,super.getInsets().right+5); } } jftp-1.52.orig/src/java/net/sf/jftp/gui/tasks/ImageViewer.java0000700000175000017500000000465711112477774023264 0ustar varunvarun/* * 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. */ package net.sf.jftp.gui.tasks; import net.sf.jftp.config.Settings; import net.sf.jftp.gui.*; import net.sf.jftp.gui.framework.*; import net.sf.jftp.util.*; import java.awt.*; import java.io.*; import java.net.*; import java.util.*; import javax.swing.*; public class ImageViewer extends JInternalFrame { public ImageViewer(String img) { super(img, true, true, true, true); setLocation(150, 50); setSize(400, 300); setLayout(new BorderLayout(2, 2)); ImagePanel p = new ImagePanel(img); JScrollPane scroll = new JScrollPane(p); getContentPane().add("Center", scroll); p.setMinimumSize(new Dimension(1500, 1500)); p.setPreferredSize(new Dimension(1500, 1500)); p.setMaximumSize(new Dimension(1500, 1500)); setVisible(true); //doLayout(); //validate(); //p.repaint(); //Log.out(""+p.getSize().width); } } class ImagePanel extends JPanel { private Image img; public ImagePanel(String url) { try { setBackground(Color.white); img = Toolkit.getDefaultToolkit().getImage(new URL(url)); MediaTracker mt = new MediaTracker(this); mt.addImage(img, 1); mt.waitForAll(); //System.out.println(img); //setVisible(true); repaint(); //validate(); } catch(Exception ex) { ex.printStackTrace(); } } public void paintComponent(Graphics g) { g.setColor(Color.white); g.fillRect(0, 0, 1500, 1500); g.drawImage(img, 0, 0, null); } public void update(Graphics g) { paintComponent(g); } } jftp-1.52.orig/src/java/net/sf/jftp/gui/tasks/Renamer.java0000700000175000017500000000414711112477774022443 0ustar varunvarun/* * 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. */ package net.sf.jftp.gui.tasks; import net.sf.jftp.*; import net.sf.jftp.gui.framework.*; import net.sf.jftp.net.*; import net.sf.jftp.system.logging.Log; import net.sf.jftp.util.*; import java.awt.*; import java.awt.event.*; import java.io.*; public class Renamer extends HFrame implements ActionListener { public HTextField text; private HButton ok = new HButton("Ok"); private HPanel okP = new HPanel(); private String oldName; private String path; public Renamer(String oldName, String path) { this.oldName = oldName; this.path = path; setSize(400, 80); setTitle("Enter new name..."); setLocation(150, 150); getContentPane().setLayout(new FlowLayout()); text = new HTextField("Name: ", oldName); getContentPane().add(text); getContentPane().add(ok); ok.addActionListener(this); text.text.addActionListener(this); setVisible(true); } public void actionPerformed(ActionEvent e) { if((e.getSource() == ok) || (e.getSource() == text.text)) { String name = text.getText(); setVisible(false); File f = new File(path + oldName); if(f.exists()) { f.renameTo(new File(path + name)); } JFtp.localUpdate(); Log.debug("Successfully renamed."); } } } jftp-1.52.orig/src/java/net/sf/jftp/gui/tasks/AddBookmarks.java0000700000175000017500000002525611112477774023417 0ustar varunvarun/* * 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 TO SELF: use setModal here somewhere? package net.sf.jftp.gui.tasks; import net.sf.jftp.*; import net.sf.jftp.config.*; import net.sf.jftp.gui.framework.*; import net.sf.jftp.net.*; import net.sf.jftp.net.wrappers.StartConnection; import net.sf.jftp.system.StringUtils; import net.sf.jftp.util.*; import java.awt.*; import java.awt.event.*; import java.io.*; import javax.swing.*; public class AddBookmarks extends HFrame implements ActionListener, WindowListener { private static JFtp jftp; private HButton add = new HButton("Add Bookmark"); private HButton addAndConnect = new HButton("Add Bookmark and Connect to Server"); //public JComboBox protocols = new JComboBox(); public HComboBox protocols = new HComboBox("Protocol:"); public HTextField host = new HTextField("Hostname:", "localhost"); public HTextField user = new HTextField("Username:", "anonymous"); public HPasswordField pass = new HPasswordField("Password:", "none@nowhere.no"); public HTextField port = new HTextField("Port: ", "21"); public HTextField dirOrDom = new HTextField("Directory/Domain: ", ""); //public JComboBox isLocal = new JComboBox(); public HComboBox isLocal = new HComboBox("Local Connection:"); //private ActionListener protocolListener = new ActionListener(); //private FlowLayout fl = new FlowLayout(FlowLayout.RIGHT, 10, 5); public AddBookmarks(ComponentListener l, JFtp jftp) { //listener = l; this.jftp = jftp; init(); } public AddBookmarks(JFtp jftp) { this.jftp = jftp; init(); } public void init() { setSize(650, 400); setLocation(50, 150); setTitle("Add Bookmarks..."); //setBackground(okP.getBackground()); getContentPane().setLayout(new GridLayout(8, 1)); getContentPane().add(protocols); getContentPane().add(host); getContentPane().add(port); getContentPane().add(user); getContentPane().add(pass); getContentPane().add(dirOrDom); getContentPane().add(isLocal); //getContentPane().add(new FlowLayout(FlowLayout.RIGHT, 10, 5)); //getContentPane().add(fl); //fl.add(add); Panel buttonPanel = new Panel(new FlowLayout(FlowLayout.CENTER, 5, 20)); getContentPane().add(buttonPanel); buttonPanel.add(add); buttonPanel.add(addAndConnect); /* getContentPane().add(add); getContentPane().add(addAndConnect); */ add.addActionListener(this); addAndConnect.addActionListener(this); //port.setEnabled(false); protocols.setEditable(false); protocols.addItem("FTP"); protocols.addItem("SFTP"); protocols.addItem("SMB"); protocols.addItem("NFS"); protocols.addActionListener(this); //protocols.addActionListener(); isLocal.setEditable(false); isLocal.addItem("No"); isLocal.addItem("Yes"); } public void update() { setVisible(true); toFront(); } public void windowClosing(WindowEvent e) { //System.exit(0); this.dispose(); } public void windowClosed(WindowEvent e) { } public void windowActivated(WindowEvent e) { } public void windowDeactivated(WindowEvent e) { } public void windowIconified(WindowEvent e) { } public void windowDeiconified(WindowEvent e) { } public void windowOpened(WindowEvent e) { } public void actionPerformed(ActionEvent e) { if(e.getSource() == add) { getData(false); } else if(e.getSource() == addAndConnect) { getData(true); } //FOR NOW: only other possible event is update of the protocol ComboBox else { String s = new String(""); //s = (String) protocols.getSelectedItem() s = protocols.getSelectedItem().toString(); System.out.println(s); //need to put information on what each protocol accepts //elsewhere to make it universally accessible to all routines //that need this info? if(s.equals("FTP")) { port.setEnabled(true); user.setEnabled(true); pass.setEnabled(true); dirOrDom.setEnabled(true); } else if(s.equals("SFTP")) { port.setEnabled(true); user.setEnabled(true); pass.setEnabled(true); dirOrDom.setEnabled(false); } else if(s.equals("SMB")) { port.setEnabled(false); user.setEnabled(true); pass.setEnabled(true); dirOrDom.setEnabled(true); } //can assume this is NFS for now else { port.setEnabled(false); user.setEnabled(true); pass.setEnabled(true); dirOrDom.setEnabled(false); } //System.out.println("yes!"); } //OK event } //actionPerformed private void getData(boolean andConnect) { String protocoltmp = new String(""); //here, get the selected protocol //s = (String) protocols.getSelectedItem() protocoltmp = protocols.getSelectedItem().toString(); //System.out.println(s); System.out.println("test"); //what happens next: get data on protocol, and based on the data //for the protocol, get what's needed for each field. //the data extraction from each field can actually be put in a //separate private method which could also be accessed if the //connection is to be initiated here //then, need a routine to open the bookmark file, then append it //to the end (add a blank line, then the data, separated by the //hash/sharp (#) comment) (and should it be here, or should only //one class know about it. Or maybe it can just refer to the config //file //don't need to get all this, it depends on the protocol //***IMPORTANT NOTE!!!!: LAN BROWSING SHOULD BE SPEAPRTE PROTOCOL! //ALSO IMPORTANT: can refer to JFtp.hostinfo.hostname, for current //hostname, JFtp.hostinfo.type for prortocol, etc... refer to //code in HostChooser.java that says this, but might not be the //case for SFTP //FTP: get all of it //SFTP: All but dirOrDom? (SFTP doesn;t seem to support that at this time) //SMB: Don't get port //NFS: Don;t get port or dirOrDom //FOR NOW: just get all data /* String htmp = StringUtils.cut(host.getText(), " "); String utmp = StringUtils.cut(user.getText(), " "); String ptmp = StringUtils.cut(pass.getText(), " "); String potmp = StringUtils.cut(port.getText(), " "); String dirOrDomtmp = StringUtils.cut(dirOrDom.getText(), " "); */ String htmp = checkIfEmpty(StringUtils.cut(host.getText(), " ")); String utmp = checkIfEmpty(StringUtils.cut(user.getText(), " ")); String ptmp = checkIfEmpty(StringUtils.cut(pass.getText(), " ")); String potmp = checkIfEmpty(StringUtils.cut(port.getText(), " ")); String dirOrDomtmp = checkIfEmpty(StringUtils.cut(dirOrDom.getText(), " ")); String local = new String(""); Integer potmpInt = new Integer(potmp); int potmpint = potmpInt.intValue(); local = isLocal.getSelectedItem().toString(); String localString = new String(""); boolean localtmp = false; if(local.equals("true")) { localtmp = true; localString = "true"; } else { localtmp = false; localString = "false"; } //first, build the string which is to be appended to end //of bookmark file // protocol#host#user#password#port#dir/domain#local String addedString = new String(""); addedString += (protocoltmp + "#"); addedString += (htmp + "#"); addedString += (utmp + "#"); addedString += (ptmp + "#"); addedString += (potmp + "#"); addedString += (dirOrDomtmp + "#"); addedString += localString; //here, start the routine for appending the line to the bookmark //file (SHOULD IT BE IN A SEPARATE ROUTINE?) try { FileOutputStream fos; PrintStream out; fos = new FileOutputStream(Settings.bookmarks, true); out = new PrintStream(fos); //commented out, just for now out.println(addedString); out.println(""); //if it worked, update the menu jftp.menuBar.loadBookmarks(); } catch(Exception e) { e.printStackTrace(); } if(andConnect) { if(protocoltmp.equals("FTP")) { StartConnection.startFtpCon(htmp, utmp, ptmp, potmpint, dirOrDomtmp, localtmp); } else { StartConnection.startCon(protocoltmp, htmp, utmp, ptmp, potmpint, dirOrDomtmp, localtmp); } } //else { //} this.dispose(); //this.setVisible(false); JFtp.mainFrame.setVisible(true); JFtp.mainFrame.toFront(); } //getData private String checkIfEmpty(String value) { String retVal = new String("0"); if(value.equals("")) { return retVal; } else { return value; } } //checkIfEmpty } jftp-1.52.orig/src/java/net/sf/jftp/gui/tasks/AutoRemover.java0000700000175000017500000000275711112477774023327 0ustar varunvarun/* * 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. */ package net.sf.jftp.gui.tasks; import net.sf.jftp.*; import net.sf.jftp.net.*; import net.sf.jftp.system.LocalIO; import net.sf.jftp.util.*; import java.io.*; public class AutoRemover { public AutoRemover(String file, String type) { if(type.equals("local")) { File f = new File(JFtp.localDir.getPath() + file); if(f.isDirectory()) { LocalIO.cleanLocalDir(file, JFtp.localDir.getPath()); f.delete(); } else { f.delete(); } } if(type.equals("remote")) { JFtp.remoteDir.lock(false); JFtp.remoteDir.getCon().removeFileOrDir(file); JFtp.remoteDir.unlock(false); } } } jftp-1.52.orig/src/java/net/sf/jftp/gui/tasks/RemoteCommand.java0000700000175000017500000000522311112477774023600 0ustar varunvarun/* * 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. */ package net.sf.jftp.gui.tasks; import net.sf.jftp.*; import net.sf.jftp.gui.framework.*; import net.sf.jftp.net.*; import net.sf.jftp.system.logging.Log; import net.sf.jftp.util.*; import java.awt.*; import java.awt.event.*; import java.io.*; import javax.swing.*; public class RemoteCommand extends HFrame implements ActionListener { private HTextField text; private HButton ok = new HButton("Execute"); public RemoteCommand() { //setSize(400, 80); setTitle("Choose command..."); setLocation(150, 150); getContentPane().setLayout(new FlowLayout()); text = new HTextField("Command:", "SITE CHMOD 755 file", 30); getContentPane().add(text); getContentPane().add(ok); ok.addActionListener(this); text.text.addActionListener(this); pack(); setVisible(true); } public void actionPerformed(ActionEvent e) { if((e.getSource() == ok) || (e.getSource() == text.text)) { setVisible(false); String cmd = text.getText(); Log.debug("-> " + cmd); JFtp.remoteDir.getCon().sendRawCommand(cmd); if(cmd.toUpperCase().trim().startsWith("QUIT")) { JFtp.statusP.jftp.safeDisconnect(); return; } JDialog j = new JDialog(); j.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); j.setTitle("Command response"); j.setLocation(150, 150); JTextArea t = new JTextArea(); JScrollPane logSp = new JScrollPane(t); logSp.setMinimumSize(new Dimension(300, 200)); t.setText(Log.getCache()); j.getContentPane().setLayout(new BorderLayout(5, 5)); j.getContentPane().add("Center", t); j.setSize(new Dimension(400, 300)); j.pack(); j.setVisible(true); JFtp.remoteUpdate(); } } } jftp-1.52.orig/src/java/net/sf/jftp/gui/tasks/HostList.java0000700000175000017500000003413311112477774022621 0ustar varunvarun/* * 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. */ package net.sf.jftp.gui.tasks; import net.sf.jftp.config.*; import net.sf.jftp.gui.base.FtpHost; import net.sf.jftp.gui.framework.*; import net.sf.jftp.system.StringUtils; import net.sf.jftp.util.*; import java.awt.*; import java.awt.event.*; import java.io.File; import javax.swing.*; import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; public class HostList extends JDialog { private String promptHost = " Host : "; private String promptUser = " User : "; private String promptPass = " Password : "; private String promptName = " Name : "; private String promptPort = " Port : "; private String promptButtonCancel = "Cancel"; private String promptButtonOk = " Ok "; private String promptButtonSave = " Apply "; private String promptButtonNew = " New "; private String promptButtonDelete = "Delete"; private String promptDialogTitle = " J-FTP Host Selection "; // has an ok, cancel button, and a save // needs to load itself too. private JPanel jpHostInfo; private JTextField jtfHost; private JTextField jtfUser; private JPasswordField jtfPass; private JTextField jtfName; private JTextField jtfPort; private JLabel jlHost; private JLabel jlUser; private JLabel jlPass; private JLabel jlName; private JLabel jlPort; private JSplitPane jsplitpane; private JScrollPane jscrollpane; private JPanel jpbuttons; private JButton jbsave; private JButton jbcancel; private JButton jbok; private JButton jbnew; private JButton jbdelete; private JList hostList; private DefaultListModel hostListModel; /** * The currently selected FtpHost instance */ private FtpHost selectedHostInfo = null; /** * Constructs an instance of the HostList with the * given parent and initializes the UI for the host list. * calling getFtpHost() will show the dialog and wait until * the user clicks ok() or cancel(). * @param parent The parent JDialog */ public HostList(JDialog parent) { super(parent); setTitle(promptDialogTitle); init(); setSize(600, 300); } /** * Adds listeners to any components that need them */ protected void initListeners() { hostList.addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent lse) { onSelectHost(); } }); jbsave.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { onSave(); } }); jbok.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { onOk(); } }); jbcancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { onCancel(); } }); jbnew.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { onNew(); } }); jbdelete.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { onDelete(); } }); } /** * This method makes the dialog popup * and the user must select ok or cancel * upon clicking ok, the selected FtpHost will be returned * upon cancel, a null will be returned. */ public FtpHost getFtpHost() { selectedHostInfo = null; setVisible(true); return selectedHostInfo; } /** * overall initialization routine called from the ctor */ protected void init() { this.initPrompts(); this.initHostInfoPanel(); this.initButtonPanel(); this.initHostListFrame(); this.loadHostList(); initListeners(); if(hostListModel.size() > 0) { hostList.setSelectedIndex(0); } else { updateHostInfoPanel(); } selectedHostInfo = getSelected(); setModal(true); } /** * This is where your internationalization can * take hold, you can change the values of the prompt * strings to whatever */ protected void initPrompts() { // do nothing } /** * initialize the button panel */ protected void initButtonPanel() { jpbuttons = new JPanel(); jpbuttons.setLayout(new FlowLayout(FlowLayout.RIGHT)); jbcancel = new JButton(promptButtonCancel); jbok = new JButton(promptButtonOk); jbsave = new JButton(promptButtonSave); jbnew = new JButton(promptButtonNew); jbdelete = new JButton(promptButtonDelete); jpbuttons.add(jbsave); jpbuttons.add(jbok); jpbuttons.add(jbcancel); } /** * Build the host info panel */ protected void initHostInfoPanel() { jtfHost = new JTextField(20); jtfUser = new JTextField(20); jtfPass = new JPasswordField(20); jtfName = new JTextField(20); jtfPort = new JTextField(20); jlHost = new JLabel(promptHost); jlUser = new JLabel(promptUser); jlPass = new JLabel(promptPass); jlName = new JLabel(promptName); jlPort = new JLabel(promptPort); jpHostInfo = new JPanel(); GridBagLayout gbl = new GridBagLayout(); jpHostInfo.setLayout(gbl); GridBagConstraints gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 0; gbc.weightx = 0.0; gbc.weighty = 0.0; gbc.anchor = gbc.NORTHWEST; gbc.fill = gbc.HORIZONTAL; gbl.setConstraints(jlName, gbc); gbc.gridy = 1; gbl.setConstraints(jlHost, gbc); gbc.gridy = 2; gbl.setConstraints(jlUser, gbc); gbc.gridy = 3; gbl.setConstraints(jlPass, gbc); gbc.gridy = 4; gbl.setConstraints(jlPort, gbc); gbc.gridy = 0; gbc.gridx = 1; gbc.weightx = 1.0; gbl.setConstraints(jtfName, gbc); gbc.gridy = 1; gbl.setConstraints(jtfHost, gbc); gbc.gridy = 2; gbl.setConstraints(jtfUser, gbc); gbc.gridy = 3; gbl.setConstraints(jtfPass, gbc); gbc.gridy = 4; gbl.setConstraints(jtfPort, gbc); jpHostInfo.add(jlName); jpHostInfo.add(jlHost); jpHostInfo.add(jlUser); jpHostInfo.add(jlPass); jpHostInfo.add(jlPort); jpHostInfo.add(jtfName); jpHostInfo.add(jtfHost); jpHostInfo.add(jtfUser); jpHostInfo.add(jtfPass); jpHostInfo.add(jtfPort); } /** * Initializes the overall dialog/frame */ protected void initHostListFrame() { hostListModel = new DefaultListModel(); hostList = new JList(hostListModel); jscrollpane = new JScrollPane(hostList); JPanel jptempleft = new JPanel(new BorderLayout()); jptempleft.add(jscrollpane, BorderLayout.CENTER); JPanel jptempbutt = new JPanel(new FlowLayout()); jptempbutt.add(jbnew); jptempbutt.add(jbdelete); jptempleft.add(jptempbutt, BorderLayout.SOUTH); JPanel jptemp = new JPanel(new BorderLayout()); jptemp.add(jpbuttons, BorderLayout.SOUTH); jptemp.add(jpHostInfo, BorderLayout.CENTER); jsplitpane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, jptempleft, jptemp); getContentPane().add(jsplitpane); } /** * Loads the host list from the hard drive */ protected void loadHostList() { //Log.out("x"); // current host number int i = 0; while(i >= 0) { String filename = Settings.login.concat(String.valueOf(i)); String[] host_info = LoadSet.loadSet(filename); if((host_info == null) || (host_info.length == 1)) { // no file was loaded, break out. i = -1; continue; } FtpHost ftpHost = new FtpHost(); try { ftpHost.hostname = host_info[0]; ftpHost.username = host_info[1]; ftpHost.password = host_info[2]; ftpHost.name = host_info[3]; ftpHost.port = host_info[4]; } catch(ArrayIndexOutOfBoundsException aioobe) { // do nothing, this can happen } hostListModel.addElement(ftpHost); i++; } } public void onSelectHost() { // update the old one, then show the new one updateHostInfoObject(); selectedHostInfo = getSelected(); updateHostInfoPanel(); } /** * Delete button handler */ public void onDelete() { Object selected = hostList.getSelectedValue(); hostListModel.removeElement(selected); selectedHostInfo = null; if(hostListModel.size() > 0) { hostList.setSelectedIndex(0); } else { updateHostInfoPanel(); } onSave(); hostList.repaint(); } /** * Save button handler */ public void onSave() { updateHostInfoObject(); // remove all previously saved hosts int i = 0; while(true) { File f = new File(Settings.login.concat(String.valueOf(i))); if(f.exists()) { f.delete(); i++; } else { break; } } int len = hostListModel.size(); for(i = 0; i < len; i++) { FtpHost ftphost = (FtpHost) hostListModel.elementAt(i); String htmp = StringUtils.cut(ftphost.hostname, " "); String utmp = StringUtils.cut(ftphost.username, " "); String ptmp = StringUtils.cut(ftphost.password, " "); String ntmp = StringUtils.cut(ftphost.name, " "); String ttmp = StringUtils.cut(ftphost.port, " "); SaveSet s = new SaveSet(Settings.login.concat(String.valueOf(i)), htmp, utmp, ptmp, ntmp, ttmp); } hostList.repaint(); } /** * OK Button handler */ public void onOk() { selectedHostInfo = getSelected(); onSave(); dispose(); } /** * Cancel button handler */ public void onCancel() { selectedHostInfo = null; dispose(); } /** * Create a default one and stuff itin the list */ public void onNew() { FtpHost ftpHost = new FtpHost(); ftpHost.name = "undefined"; ftpHost.username = "undefined"; ftpHost.hostname = "undefined"; ftpHost.password = "undefined"; ftpHost.port = "21"; hostListModel.addElement(ftpHost); hostList.setSelectedValue(ftpHost, true); selectedHostInfo = ftpHost; } /** * Returns the selected FtpHost from the hostList */ private FtpHost getSelected() { int sel = hostList.getSelectedIndex(); if((sel < 0) || (sel > (hostListModel.size() - 1))) { return null; } else { return (FtpHost) hostListModel.elementAt(hostList.getSelectedIndex()); } } /** * Updates the screen to reflect the values from the currently * selected FtpHost object. If none is selected, then * it clears the panel */ private void updateHostInfoPanel() { if(selectedHostInfo == null) { jtfName.setText(""); jtfUser.setText(""); jtfPass.setText(""); jtfHost.setText(""); jtfPort.setText(""); jtfName.setEnabled(false); jtfUser.setEnabled(false); jtfHost.setEnabled(false); jtfPass.setEnabled(false); jtfPort.setEnabled(false); } else { jtfName.setEnabled(true); jtfUser.setEnabled(true); jtfHost.setEnabled(true); jtfPass.setEnabled(true); jtfPort.setEnabled(true); jtfName.setText(selectedHostInfo.name); jtfUser.setText(selectedHostInfo.username); jtfPass.setText(selectedHostInfo.password); jtfHost.setText(selectedHostInfo.hostname); jtfPort.setText(selectedHostInfo.port); } } /** * Updates the currently selected FtpHost object called * "selectedHostInfo" from the contents of the screen */ private void updateHostInfoObject() { if(selectedHostInfo == null) { return; } selectedHostInfo.hostname = jtfHost.getText(); selectedHostInfo.name = jtfName.getText(); selectedHostInfo.username = jtfUser.getText(); selectedHostInfo.password = new String(jtfPass.getPassword()); selectedHostInfo.port = jtfPort.getText(); } } jftp-1.52.orig/src/java/net/sf/jftp/gui/tasks/PathChanger.java0000700000175000017500000000372411112477774023236 0ustar varunvarun/* * 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. */ package net.sf.jftp.gui.tasks; import net.sf.jftp.*; import net.sf.jftp.gui.framework.*; import net.sf.jftp.net.*; import java.awt.*; import java.awt.event.*; import java.io.*; public class PathChanger extends HFrame implements ActionListener { private HTextField text; private HButton ok = new HButton("Change Directory"); private String type = ""; public PathChanger(String type) { this.type = type; //setSize(400, 80); setTitle("Choose path..."); //setLocation(150, 150); getContentPane().setLayout(new FlowLayout()); text = new HTextField("Path:", ""); getContentPane().add(text); getContentPane().add(ok); ok.addActionListener(this); text.text.addActionListener(this); pack(); fixLocation(); setVisible(true); } public void actionPerformed(ActionEvent e) { if((e.getSource() == ok) || (e.getSource() == text.text)) { setVisible(false); if(type.equals("remote")) { JFtp.remoteDir.getCon().chdir(text.getText()); } if(type.equals("local")) { JFtp.localDir.getCon().chdir(text.getText()); } } } } jftp-1.52.orig/src/java/net/sf/jftp/gui/tasks/ExternalDisplayer.java0000700000175000017500000000536011112477774024507 0ustar varunvarun/* * 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. */ package net.sf.jftp.gui.tasks; import net.sf.jftp.*; import net.sf.jftp.gui.framework.*; import net.sf.jftp.system.logging.Log; import net.sf.jftp.util.*; import java.awt.*; import java.awt.event.*; import java.io.*; import javax.swing.*; public class ExternalDisplayer extends HFrame implements ActionListener { private JTextArea info = new JTextArea(25, 50); private JButton close = new JButton("Close"); public ExternalDisplayer(java.net.URL file) { setTitle("Info..."); setLocation(50, 50); setSize(600, 540); getContentPane().setLayout(new BorderLayout()); addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { dispose(); } }); load(file); info.setEditable(false); JScrollPane jsp = new JScrollPane(info); getContentPane().add("Center", jsp); HPanel closeP = new HPanel(); closeP.setLayout(new FlowLayout(FlowLayout.CENTER)); closeP.add(close); close.addActionListener(this); getContentPane().add("South", closeP); info.setCaretPosition(0); setVisible(true); pack(); } public void actionPerformed(ActionEvent e) { if(e.getSource() == close) { this.dispose(); } } private void load(java.net.URL file) { String data = ""; String now = ""; try { DataInput in = new DataInputStream(new BufferedInputStream(file.openStream())); while((data = in.readLine()) != null) { now = now + data + "\n"; } } catch(IOException e) { Log.debug(e + " @Displayer.load()"); } info.setText(now); } public Insets getInsets() { Insets std = super.getInsets(); return new Insets(std.top + 5, std.left + 5, std.bottom + 5, std.right + 5); } } jftp-1.52.orig/src/java/net/sf/jftp/gui/tasks/HttpDownloader.java0000700000175000017500000000421211112477774024001 0ustar varunvarun/* * 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. */ package net.sf.jftp.gui.tasks; import net.sf.jftp.*; import net.sf.jftp.gui.framework.*; import net.sf.jftp.net.*; import net.sf.jftp.net.wrappers.HttpTransfer; import java.awt.*; import java.awt.event.*; import java.io.*; import java.util.*; public class HttpDownloader extends HPanel implements ActionListener { private HTextField text; private HButton ok = new HButton("Start"); public HttpDownloader() { //setSize(480,100); //setTitle("Download a file via an URL"); //setLocation(150,150); //getContentPane(). setLayout(new FlowLayout()); text = new HTextField("URL:", "http://", 25); //getContentPane(). add(text); //getContentPane(). add(ok); ok.addActionListener(this); text.text.addActionListener(this); setVisible(true); } public void actionPerformed(ActionEvent e) { if((e.getSource() == ok) || (e.getSource() == text.text)) { Vector listeners = new Vector(); listeners.add(JFtp.localDir); HttpTransfer t = new HttpTransfer(text.getText().trim(), JFtp.localDir.getPath(), listeners, JFtp.getConnectionHandler()); JFtp.statusP.jftp.removeFromDesktop(this.hashCode()); //hide(); } } } jftp-1.52.orig/src/java/net/sf/jftp/gui/tasks/BookmarkItem.java0000700000175000017500000000577011112477774023441 0ustar varunvarun/* * 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. */ package net.sf.jftp.gui.tasks; import net.sf.jftp.JFtp; import net.sf.jftp.config.Settings; import net.sf.jftp.gui.base.UIUtils; import net.sf.jftp.gui.framework.*; import net.sf.jftp.net.*; import net.sf.jftp.net.wrappers.StartConnection; import java.awt.*; import java.awt.event.*; import java.io.*; import java.lang.Integer; import java.util.*; import javax.swing.*; //*** public class BookmarkItem extends JMenuItem { private String host = "localhost"; private String user = "anonymous"; private String pass = "j-ftp@sourceforge.net"; private String protocol = "FTP"; private int port = 21; private String dirOrDom = "/"; private boolean useLocal = false; public BookmarkItem(String host) { super(host); this.host = host; } public void setProtocol(String proto) { protocol = proto; setLabel(proto + ": " + getLabel()); } public void setDirectory(String dir) { dirOrDom = dir; } public void setPort(int p) { port = p; } public void setLocal(boolean local) { useLocal = local; } public void setUserdata(String u, String p) { user = u; pass = p; } public void connect() { if(protocol.equals("FTP")) { if(pass.equals(Settings.hiddenPassword)) { pass = UIUtils.getPasswordFromUser(JFtp.statusP.jftp); } int i = StartConnection.startFtpCon(host, user, pass, port, dirOrDom, useLocal); if(i < 0) { pass = Settings.hiddenPassword; } /* FtpConnection con = StartConnection.con; if(con != null) { con.chdir(dirOrDom); } */ } else { if(pass.equals(Settings.hiddenPassword)) { pass = UIUtils.getPasswordFromUser(JFtp.statusP.jftp); } boolean ok = StartConnection.startCon(protocol, host, user, pass, port, dirOrDom, useLocal); if(!ok) { pass = Settings.hiddenPassword; } } } } jftp-1.52.orig/src/java/net/sf/jftp/gui/tasks/Displayer.java0000700000175000017500000000600011112477774022774 0ustar varunvarun/* * 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. */ package net.sf.jftp.gui.tasks; import net.sf.jftp.*; import net.sf.jftp.gui.framework.*; import net.sf.jftp.system.logging.Log; import net.sf.jftp.util.*; import java.awt.*; import java.awt.event.*; import java.io.*; import javax.swing.*; public class Displayer extends JInternalFrame implements ActionListener { public static boolean showCloseButton = false; private JTextArea info = new JTextArea(25, 50) { public Insets getInsets() { Insets std = super.getInsets(); return new Insets(std.top + 5, std.left + 5, std.bottom + 5, std.right + 5); } }; private JButton close = new JButton("Close"); public Displayer(java.net.URL file, Font font) { super(file.getFile(), true, true, true, true); setLocation(50, 50); setSize(600, 540); getContentPane().setLayout(new BorderLayout()); load(file); if(font != null) { info.setFont(font); } else { info.setFont(new Font("monospaced",Font.PLAIN, 11)); } info.setEditable(false); JScrollPane jsp = new JScrollPane(info); getContentPane().add("Center", jsp); HPanel closeP = new HPanel(); closeP.setLayout(new FlowLayout(FlowLayout.CENTER)); closeP.add(close); close.addActionListener(this); if(showCloseButton) { getContentPane().add("South", closeP); } info.setCaretPosition(0); setVisible(true); } public void actionPerformed(ActionEvent e) { if(e.getSource() == close) { this.dispose(); } } private void load(java.net.URL file) { String data = ""; String now = ""; try { DataInput in = new DataInputStream(new BufferedInputStream(file.openStream())); while((data = in.readLine()) != null) { now = now + data + "\n"; } } catch(IOException e) { Log.debug(e + " @Displayer.load()"); } info.setText(now); } public Insets getInsets() { Insets std = super.getInsets(); return new Insets(std.top + 5, std.left + 5, std.bottom + 5, std.right + 5); } } jftp-1.52.orig/src/java/net/sf/jftp/gui/tasks/RemoverQuery.java0000700000175000017500000000327211112477774023515 0ustar varunvarun/* * 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. */ package net.sf.jftp.gui.tasks; import net.sf.jftp.gui.framework.*; import net.sf.jftp.util.*; import java.awt.*; import java.awt.event.*; public class RemoverQuery extends HFrame implements ActionListener { private String file; private String type; private HButton ok = new HButton("Ok"); private HButton cancel = new HButton("Cancel"); public RemoverQuery(String file, String type) { this.file = file; this.type = type; setSize(200, 70); setTitle("Really?"); setLayout(new FlowLayout()); setLocation(150, 150); add(ok); add(cancel); ok.addActionListener(this); cancel.addActionListener(this); setVisible(true); } public void actionPerformed(ActionEvent e) { if(e.getSource() == ok) { AutoRemover armv = new AutoRemover(file, type); this.dispose(); } else { this.dispose(); } } } jftp-1.52.orig/src/java/net/sf/jftp/gui/hostchooser/0000700000175000017500000000000011206335012021367 5ustar varunvarunjftp-1.52.orig/src/java/net/sf/jftp/gui/hostchooser/HostChooser.java0000700000175000017500000004656411206335720024522 0ustar varunvarun/* * 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. */ package net.sf.jftp.gui.hostchooser; import java.awt.BorderLayout; import java.awt.Cursor; import java.awt.FlowLayout; import java.awt.Font; import java.awt.GridLayout; import java.awt.Insets; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.ComponentEvent; import java.awt.event.ComponentListener; import java.awt.event.WindowEvent; import java.awt.event.WindowListener; import java.io.IOException; import javax.swing.BoxLayout; import javax.swing.JCheckBox; import javax.swing.JDialog; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTextArea; import net.sf.jftp.JFtp; import net.sf.jftp.config.LoadSet; import net.sf.jftp.config.SaveSet; import net.sf.jftp.config.Settings; import net.sf.jftp.gui.base.FtpHost; import net.sf.jftp.gui.framework.HButton; import net.sf.jftp.gui.framework.HFrame; import net.sf.jftp.gui.framework.HInsetPanel; import net.sf.jftp.gui.framework.HPanel; import net.sf.jftp.gui.framework.HPasswordField; import net.sf.jftp.gui.framework.HTextField; import net.sf.jftp.gui.tasks.HostList; import net.sf.jftp.net.FilesystemConnection; import net.sf.jftp.net.FtpConnection; import net.sf.jftp.net.FtpURLConnection; import net.sf.jftp.net.wrappers.StartConnection; import net.sf.jftp.system.StringUtils; import net.sf.jftp.system.logging.Log; public class HostChooser extends HFrame implements ActionListener, WindowListener { public HTextField host = new HTextField("Hostname:", "localhost "); public HTextField user = new HTextField("Username:", "anonymous "); //public static HTextField pass = new HTextField("Password:","none@nowhere.no"); public HPasswordField pass = new HPasswordField("Password:", "none@nowhere.no"); public HTextField port = new HTextField("Port: ", "21"); public HTextField cwd = new HTextField("Remote: ", Settings.defaultDir); public HTextField lcwd = new HTextField("Local: ", Settings.defaultWorkDir); public HTextField dl = new HTextField("Max. connections: ", "3"); public HTextField crlf = new HTextField("Override server newline: ", ""); private JCheckBox anonBox = new JCheckBox("Use anonymous login", false); private JCheckBox listBox = new JCheckBox("LIST compatibility mode", false); private JCheckBox dirBox = new JCheckBox("Use default directories", Settings.getUseDefaultDir()); private JCheckBox modeBox = new JCheckBox("Use active Ftp (no need to)", false); private JCheckBox threadBox = new JCheckBox("Multiple connections", false); private HPanel okP = new HPanel(); private HButton ok = new HButton("Connect"); private HButton backMode = new HButton("Yes"); private HButton frontMode = new HButton("No"); private HFrame h = new HFrame(); private HPanel listP = new HPanel(); private HButton list = new HButton("Choose from or edit list..."); private ComponentListener listener = null; private int mode = 0; private boolean useLocal = false; private boolean ext = Settings.showNewlineOption; public HostChooser(ComponentListener l, boolean local) { listener = l; useLocal = local; //TODO ext -> newlineoption //this.ext = ext; init(); } public HostChooser(ComponentListener l) { listener = l; init(); } public HostChooser() { init(); } public void init() { setTitle("Ftp Connection..."); setBackground(okP.getBackground()); anonBox.setSelected(false); user.setEnabled(true); pass.text.setEnabled(true); LoadSet l = new LoadSet(); String[] login = l.loadSet(Settings.login_def); if((login != null) && (login[0] != null)) { host.setText(login[0]); user.setText(login[1]); if(login[3] != null) { port.setText(login[3]); } if(login[4] != null) { cwd.setText(login[4]); } if(login[5] != null) { lcwd.setText(login[5]); } } if(Settings.getStorePasswords()) { if(login != null) { pass.setText(login[2]); } } else { pass.setText(""); } HInsetPanel root = new HInsetPanel(); root.setLayout(new GridLayout((ext ? 8 : 7), 2, 5, 3)); root.add(host); root.add(port); root.add(anonBox); root.add(listBox); root.add(user); root.add(pass); root.add(dirBox); root.add(modeBox); root.add(lcwd); root.add(cwd); root.add(threadBox); root.add(dl); if(ext) { root.add(crlf); JPanel x1 = new JPanel(); x1.setLayout(new BorderLayout(2,2)); JLabel l1 = new JLabel("Unix: LF, Mac/MVS: CR, Win: CRLF"); l1.setFont(new Font("Dialog", Font.PLAIN, 10)); JLabel l2 = new JLabel("Don't change this unless you transfer text only"); l2.setFont(new Font("Dialog", Font.PLAIN, 10)); x1.add("North", l1); x1.add("South", l2); root.add(x1); } modeBox.setSelected(!Settings.getFtpPasvMode()); threadBox.setSelected(Settings.getEnableMultiThreading()); dirBox.setSelected(Settings.getUseDefaultDir()); anonBox.addActionListener(this); threadBox.addActionListener(this); root.add(okP); okP.add(ok); ok.addActionListener(this); root.add(listP); listP.add(list); list.addActionListener(this); dirBox.addActionListener(this); setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE); lcwd.setEnabled(!dirBox.isSelected()); cwd.setEnabled(!dirBox.isSelected()); pass.text.addActionListener(this); getContentPane().setLayout(new BorderLayout(10,10)); getContentPane().add("Center", root); pack(); setModal(false); setVisible(false); //invalidate(); //validate(); addWindowListener(this); prepareBackgroundMessage(); } public void update() { fixLocation(); setVisible(true); toFront(); host.requestFocus(); } public void update(String url) { try { FtpURLConnection uc = new FtpURLConnection(new java.net.URL(url)); FtpConnection con = uc.getFtpConnection(); JFtp.statusP.jftp.addConnection(url, con); //con.addConnectionListener((ConnectionListener) JFtp.localDir); //con.addConnectionListener((ConnectionListener) JFtp.remoteDir); //JFtp.remoteDir.setCon(con); uc.connect(); int response = uc.getLoginResponse(); if(response != FtpConnection.LOGIN_OK) { setTitle("Wrong password!"); host.setText(uc.getHost()); port.setText(Integer.toString(uc.getPort())); user.setText(uc.getUser()); pass.setText(uc.getPass()); setVisible(true); toFront(); host.requestFocus(); } else { this.dispose(); if(listener != null) { listener.componentResized(new ComponentEvent(this, 0)); } JFtp.mainFrame.setVisible(true); JFtp.mainFrame.toFront(); } } //catch(MalformedURLException ex) //{ // Log.debug("Malformed URL!"); // ex.printStackTrace(); //} catch(IOException ex) { Log.debug("Error!"); ex.printStackTrace(); } } public void actionPerformed(ActionEvent e) { if((e.getSource() == ok) || (e.getSource() == pass.text)) { // Switch windows //this.setVisible(false); setCursor(new Cursor(Cursor.WAIT_CURSOR)); //JFtp.mainFrame.setVisible(true); //JFtp.mainFrame.toFront(); FtpConnection con = null; JFtp.setHost(host.getText()); String htmp = StringUtils.cut(host.getText(), " "); String utmp = StringUtils.cut(user.getText(), " "); String ptmp = StringUtils.cut(pass.getText(), " "); String potmp = StringUtils.cut(port.getText(), " "); Settings.setProperty("jftp.ftpPasvMode", !modeBox.isSelected()); Settings.setProperty("jftp.enableMultiThreading", threadBox.isSelected()); Settings.setProperty("jftp.useDefaultDir", dirBox.isSelected()); if(listBox.isSelected()) { FtpConnection.LIST = "LIST"; } else { FtpConnection.LIST = "LIST -laL"; } /* All the information of the current server are stored in JFtp.HostInfo */ JFtp.hostinfo.hostname = htmp; JFtp.hostinfo.username = utmp; JFtp.hostinfo.password = ptmp; JFtp.hostinfo.port = potmp; JFtp.hostinfo.type = "ftp"; boolean pasv = Settings.getFtpPasvMode(); boolean threads = Settings.getEnableMultiThreading(); /* if(!pasv && threads) // only passive ftp threading works { //Settings.setProperty("jftp.enableMultiThreading", false); JDialog j = new JDialog(); j.setTitle("Warning"); j.setLocation(150, 150); j.setSize(450, 100); j.getContentPane().add(new JLabel("Multithreading in active mode is EXPERIMENTAL")); j.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); j.setModal(true); j.setVisible(true); }*/ int x = Integer.parseInt(dl.getText().trim()); Settings.maxConnections = x; Settings.save(); //*** My modifications are below here String dtmp; String ltmp; if(dirBox.isSelected()) { dtmp = Settings.defaultDir; ltmp = Settings.defaultWorkDir; } else { dtmp = cwd.getText(); ltmp = lcwd.getText(); } //*** More of my stuff SaveSet s = new SaveSet(Settings.login_def, htmp, utmp, ptmp, potmp, dtmp, ltmp); if(JFtp.localDir instanceof FilesystemConnection) { if(!JFtp.localDir.setPath(ltmp)) { if(!JFtp.localDir.setPath(System.getProperty("user.home"))) { JFtp.localDir.setPath("/"); } } } int response = StartConnection.startFtpCon(htmp, utmp, ptmp, Integer.parseInt(potmp), dtmp, useLocal, crlf.getText().trim()); /* con = new FtpConnection(htmp, Integer.parseInt(potmp), dtmp); //con.addConnectionListener((ConnectionListener) JFtp.localDir); //con.addConnectionListener((ConnectionListener) JFtp.remoteDir); //JFtp.remoteDir.setCon(con); if (useLocal) JFtp.statusP.jftp.addLocalConnection( htmp, con); else JFtp.statusP.jftp.addConnection(htmp, con); int response = con.login(utmp, ptmp); */ //*** START OF STUFF TO PUT INTO SEPARATE METHOD /* if (response!=FtpConnection.LOGIN_OK) tryFtpAgain(response, htmp, ptmp, utmp, potmp, dtmp, useLocal); */ //*** END OF STUFF TO PUT INTO SEPARATE METHOD //else //{ setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); this.dispose(); //this.setVisible(false); JFtp.mainFrame.setVisible(true); JFtp.mainFrame.toFront(); if(listener != null) { listener.componentResized(new ComponentEvent(this, 0)); } //} } else if(e.getSource() == list) { HostList hl = new HostList(this); FtpHost selectedHost = hl.getFtpHost(); if(selectedHost == null) { return; } host.setText(selectedHost.hostname); pass.setText(selectedHost.password); user.setText(selectedHost.username); port.setText(selectedHost.port); Settings.setProperty("jftp.useDefaultDir", true); dirBox.setSelected(Settings.getUseDefaultDir()); lcwd.setEnabled(!dirBox.isSelected()); cwd.setEnabled(!dirBox.isSelected()); } else if(e.getSource() == dirBox) { if(!dirBox.isSelected()) { lcwd.setEnabled(true); cwd.setEnabled(true); } else { lcwd.setEnabled(false); cwd.setEnabled(false); } } else if(e.getSource() == anonBox) { if(!anonBox.isSelected()) { user.setEnabled(true); pass.text.setEnabled(true); } else { user.setText("anonymous"); pass.setText("no@no.no"); user.setEnabled(false); pass.text.setEnabled(false); } } else if(e.getSource() == threadBox) { if(threadBox.isSelected()) { dl.setEnabled(true); } else { dl.setEnabled(false); } } else if(e.getSource() == backMode) { mode = 1; h.setVisible(false); ; } else if(e.getSource() == frontMode) { mode = 2; h.setVisible(false); } } /* private void setFilesystemConnection() { FilesystemConnection c = new FilesystemConnection(); c.addConnectionListener(((ConnectionListener)JFtp.remoteDir)); if(!c.chdir("/")) c.chdir("C:\\"); JFtp.remoteDir.setCon(c); } */ private void prepareBackgroundMessage() { HPanel p = new HPanel(); p.add(backMode); p.add(frontMode); p.setLayout(new FlowLayout(FlowLayout.CENTER)); backMode.addActionListener(this); frontMode.addActionListener(this); h.getContentPane().setLayout(new BorderLayout(10, 10)); h.setTitle("Connection failed!"); h.setLocation(150, 200); JTextArea text = new JTextArea(); h.getContentPane().add("Center", text); h.getContentPane().add("South", p); text.setText(" ---------------- Output -----------------\n\n" + "The server is busy at the moment.\n\n" + "Do you want JFtp to go to disappear and try to login\n" + "continuously?\n\n" + "(It will show up again when it has initiated a connection)\n\n"); JFtp.log.setText(""); text.setEditable(false); h.pack(); } public void windowClosing(WindowEvent e) { //System.exit(0); this.dispose(); } public void windowClosed(WindowEvent e) { } public void windowActivated(WindowEvent e) { } public void windowDeactivated(WindowEvent e) { } public void windowIconified(WindowEvent e) { } public void windowDeiconified(WindowEvent e) { } public void windowOpened(WindowEvent e) { } public void pause(int time) { try { Thread.sleep(time); } catch(Exception ex) { } } private void tryFtpAgain(int response, String htmp, String ptmp, String utmp, String potmp, String dtmp, boolean useLocal) { //*** FOR TESTING PURPOSES //System.out.println(htmp + " " + ptmp + " " + utmp); //System.out.println(potmp + " " + dtmp); //*** if((response == FtpConnection.OFFLINE) && Settings.reconnect) { //FtpConnection con; setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); h.setVisible(true); while(mode == 0) { pause(10); } JFtp.mainFrame.setVisible(false); while((response == FtpConnection.OFFLINE) && (mode == 1)) { System.out.print("Server is full, next attempt in "); int r = 5; for(int i = 0; i < r; r--) { System.out.print("" + r + "-"); try { Thread.sleep(1000); } catch(Exception ex) { } } System.out.println("0..."); response = StartConnection.startFtpCon(htmp, utmp, ptmp, Integer.parseInt(potmp), dtmp, useLocal); } if(mode == 1) { JFtp.mainFrame.setVisible(true); } else { // Switch windows JFtp.mainFrame.setVisible(false); this.setVisible(true); this.toFront(); return; } } else if((response != FtpConnection.LOGIN_OK) || ((response == FtpConnection.OFFLINE) && (!Settings.reconnect))) { setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); //setFilesystemConnection(); if(useLocal) { JFtp.statusP.jftp.closeCurrentLocalTab(); } else { JFtp.statusP.jftp.closeCurrentTab(); } //this.setVisible(true); //this.toFront(); return; } } } jftp-1.52.orig/src/java/net/sf/jftp/gui/hostchooser/SmbHostChooser.java0000700000175000017500000002626011206336025025152 0ustar varunvarun/* * 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. */ package net.sf.jftp.gui.hostchooser; import net.sf.jftp.*; import net.sf.jftp.config.*; import net.sf.jftp.gui.framework.*; import net.sf.jftp.net.*; import net.sf.jftp.net.wrappers.SmbConnection; import net.sf.jftp.net.wrappers.StartConnection; import net.sf.jftp.system.logging.Log; import net.sf.jftp.util.*; import java.awt.*; import java.awt.event.*; import java.io.*; import java.net.*; import java.util.*; import javax.swing.*; public class SmbHostChooser extends HFrame implements ActionListener, WindowListener { public static HTextField host = new HTextField("URL:", "smb://localhost/"); public static HTextField user = new HTextField("Username:", "guest"); //public static HTextField pass = new HTextField("Password:","none@nowhere.no"); public static HPasswordField pass = new HPasswordField("Password:", "nopasswd"); JCheckBox lan = new JCheckBox("Browse LAN", true); public HTextField domain = new HTextField("Domain: ", "WORKGROUP"); public HTextField broadcast = new HTextField("Broadcast IP: ", "AUTO"); public HTextField wins = new HTextField("WINS Server IP: ", "NONE"); //public HTextField ip = new HTextField("Local IP: ",""); public JComboBox ip = new JComboBox(); private HPanel okP = new HPanel(); private HButton ok = new HButton("Connect"); private ComponentListener listener = null; private boolean useLocal = false; public SmbHostChooser(ComponentListener l, boolean local) { listener = l; useLocal = local; init(); } public SmbHostChooser(ComponentListener l) { listener = l; init(); } public SmbHostChooser() { init(); } public void init() { //setSize(500, 320); setLocation(100, 150); setTitle("Smb Connection..."); setBackground(okP.getBackground()); //*** MY CHANGES try { File f = new File(Settings.appHomeDir); f.mkdir(); File f1 = new File(Settings.login); f1.createNewFile(); File f2 = new File(Settings.login_def_smb); f2.createNewFile(); } catch(IOException ex) { ex.printStackTrace(); } String[] login = LoadSet.loadSet(Settings.login_def_smb); if((login[0] != null) && (login.length > 1)) { host.setText(login[0]); user.setText(login[1]); //if (login[3] != null) //lan.setText(login[3]); //if (login[4] != null) //ip.setText(login[4]); //if (login[5] != null) domain.setText(login[5]); } /* else { host.setText("smb://localhost/"); user.setText("guest"); domain.setText("WORKGROUP"); } */ if(Settings.getStorePasswords()) { if((login != null) && (login.length > 2) && (login[2] != null)) { pass.setText(login[2]); } } else { pass.setText(""); } //***end of my changes (for this section) ip.setEditable(true); HInsetPanel root = new HInsetPanel(); root.setLayout(new GridLayout(5, 2, 5, 3)); root.add(host); root.add(lan); root.add(user); root.add(pass); root.add(ip); root.add(domain); root.add(broadcast); root.add(okP); root.add(wins); JTextArea t = new JTextArea(); t.setLineWrap(true); t.setText("Note: URL is in form \"smb://host/\"\n" + "and most people do not need WINS."); root.add(t); okP.add(ok); ok.addActionListener(this); host.setEnabled(!lan.isSelected()); setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE); lan.addActionListener(this); pass.text.addActionListener(this); getContentPane().setLayout(new BorderLayout(10,10)); getContentPane().add("Center", root); setModal(false); setVisible(false); addWindowListener(this); ip.addItem(""); try { Enumeration e = NetworkInterface.getNetworkInterfaces(); while(e.hasMoreElements()) { Enumeration f = ((NetworkInterface) e.nextElement()).getInetAddresses(); while(f.hasMoreElements()) { ; ip.addItem(((InetAddress) f.nextElement()).getHostAddress()); } } } catch(Exception ex) { Log.debug("Error determining default network interface: " + ex); //ex.printStackTrace(); } //setBCast(); domain.setEnabled(false); broadcast.setEnabled(false); wins.setEnabled(false); ip.addActionListener(this); pack(); setVisible(true); } private void setBCast() { try { String tmp = ((String) ip.getSelectedItem()).trim(); String x = tmp.substring(0, tmp.lastIndexOf(".") + 1) + "255"; broadcast.setText(x); } catch(Exception ex) { Log.out("Error (SMBHostChooser): " + ex); } } public void update() { fixLocation(); setVisible(true); toFront(); host.requestFocus(); } public void actionPerformed(ActionEvent e) { if(e.getSource() == lan) { host.setEnabled(!lan.isSelected()); } else if(e.getSource() == ip) { if(ip.getSelectedItem().equals("")) { domain.setEnabled(false); broadcast.setEnabled(false); wins.setEnabled(false); } else { domain.setEnabled(true); broadcast.setEnabled(true); wins.setEnabled(true); setBCast(); } } else if((e.getSource() == ok) || (e.getSource() == pass.text)) { // Switch windows //this.setVisible(false); setCursor(new Cursor(Cursor.WAIT_CURSOR)); SmbConnection con = null; //System.out.println(jcifs.Config.getProperty("jcifs.smb.client.laddr")); String tmp = ((String) ip.getSelectedItem()).trim(); if(!tmp.equals("") && !tmp.equals("")) { String x = tmp.trim().substring(0, tmp.lastIndexOf(".") + 1) + "255"; String bcast = broadcast.getText().trim(); if(!bcast.equals("AUTO")) { x = bcast; } Log.debug("Setting LAN interface to: " + tmp + "/" + x); jcifs.Config.setProperty("jcifs.netbios.laddr", tmp); jcifs.Config.setProperty("jcifs.smb.client.laddr", tmp); jcifs.Config.setProperty("jcifs.netbios.baddr", x); String y = wins.getText().trim(); if(!y.equals("NONE")) { Log.debug("Setting WINS server IP to: " + y); jcifs.Config.setProperty("jcifs.netbios.wins", y); } } //System.out.println(jcifs.Config.getProperty("jcifs.smb.client.laddr")); //JFtp.setHost(host.getText()); String htmp = host.getText().trim(); String utmp = user.getText().trim(); String ptmp = pass.getText(); String dtmp = domain.getText().trim(); //*** //if(dtmp.equals("")) dtmp = null; if(dtmp.equals("")) { dtmp = "NONE"; } //if(lan.isSelected()) htmp = null; if(lan.isSelected()) { htmp = "(LAN)"; } //***save the set of selected data SaveSet s = new SaveSet(Settings.login_def_smb, htmp, utmp, ptmp, "", "", dtmp); //*** Now make the function call to the methos for starting //connections boolean status; int potmp = 0; //*** port number: unlikely to be needed in the future status = StartConnection.startCon("SMB", htmp, utmp, ptmp, potmp, dtmp, useLocal); /* try { con = new SmbConnection(htmp,dtmp,utmp,ptmp, ((ConnectionListener)JFtp.remoteDir)); //JFtp.statusP.jftp.addConnection(htmp, con); if(useLocal) { JFtp.statusP.jftp.addLocalConnection(htmp, con); JFtp.localDir.fresh(); } else { JFtp.statusP.jftp.addConnection(htmp, con); JFtp.remoteDir.fresh(); } //JFtp.remoteDir.setCon(con); //con.setLocalPath(JFtp.localDir.getCon().getPWD()); //con.addConnectionListener((ConnectionListener) JFtp.localDir); //con.addConnectionListener((ConnectionListener) JFtp.remoteDir); //JFtp.remoteDir.fresh(); } catch(Exception ex) { Log.debug("Could not create SMBConnection, does this distribution come with jcifs?"); } */ setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); this.dispose(); JFtp.mainFrame.setVisible(true); JFtp.mainFrame.toFront(); if(listener != null) { listener.componentResized(new ComponentEvent(this, 0)); } } } public void windowClosing(WindowEvent e) { //System.exit(0); this.dispose(); } public void windowClosed(WindowEvent e) { } public void windowActivated(WindowEvent e) { } public void windowDeactivated(WindowEvent e) { } public void windowIconified(WindowEvent e) { } public void windowDeiconified(WindowEvent e) { } public void windowOpened(WindowEvent e) { } public void pause(int time) { try { Thread.sleep(time); } catch(Exception ex) { } } } jftp-1.52.orig/src/java/net/sf/jftp/gui/hostchooser/SftpHostChooser.java0000700000175000017500000003016411264115412025342 0ustar varunvarun/* * 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. */ package net.sf.jftp.gui.hostchooser; import java.awt.BorderLayout; import java.awt.Cursor; import java.awt.GridLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.ComponentEvent; import java.awt.event.ComponentListener; import java.awt.event.WindowEvent; import java.awt.event.WindowListener; import java.io.File; import java.io.IOException; import javax.swing.JCheckBox; import javax.swing.JComboBox; import javax.swing.JDialog; import javax.swing.JFileChooser; import javax.swing.JLabel; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import net.sf.jftp.JFtp; import net.sf.jftp.config.LoadSet; import net.sf.jftp.config.SaveSet; import net.sf.jftp.config.Settings; import net.sf.jftp.gui.framework.HButton; import net.sf.jftp.gui.framework.HFrame; import net.sf.jftp.gui.framework.HInsetPanel; import net.sf.jftp.gui.framework.HPanel; import net.sf.jftp.gui.framework.HPasswordField; import net.sf.jftp.gui.framework.HTextField; import net.sf.jftp.net.FtpConnection; import net.sf.jftp.net.wrappers.Sftp2Connection; import net.sf.jftp.net.wrappers.SftpConnection; import net.sf.jftp.net.wrappers.SftpURLConnection; import net.sf.jftp.net.wrappers.StartConnection; import net.sf.jftp.system.logging.Log; import net.sf.jftp.tools.SshShell; public class SftpHostChooser extends HFrame implements ActionListener, WindowListener, ChangeListener { public HTextField host = new HTextField("Host:", "localhost"); public HTextField user = new HTextField("Username:", "guest"); public HTextField port = new HTextField("Port:", "22"); public HPasswordField pass = new HPasswordField("Password/Phrase:", "nopasswd"); public JComboBox enc = new JComboBox(); public JComboBox cs = new JComboBox(); public JComboBox keys = new JComboBox(); public JLabel encL = new JLabel("Pref. Encryption"); public JLabel csL = new JLabel("Pref. Message Auth."); public JLabel keysL = new JLabel("Pref. Public Key"); public JLabel keyfileL = new JLabel("(No File)"); private HPanel okP = new HPanel(); private HPanel keyP = new HPanel(); private HButton ok = new HButton("Connect"); private HButton keyfile = new HButton("Choose Key File"); private ComponentListener listener = null; private boolean useLocal = false; private boolean shell = false; private String keyfileName = null; private JCheckBox useJSch = new JCheckBox("Use JSch instead of j2ssh"); public SftpHostChooser(ComponentListener l, boolean local) { listener = l; useLocal = local; init(); } public SftpHostChooser(ComponentListener l) { listener = l; init(); } public SftpHostChooser() { init(); } public SftpHostChooser(boolean shell) { this.shell = shell; init(); } public void init() { //setSize(500, 200); setLocation(100, 150); setTitle("Sftp Connection..."); setBackground(okP.getBackground()); //***MY CHANGES try { File f = new File(Settings.appHomeDir); f.mkdir(); File f1 = new File(Settings.login); f1.createNewFile(); File f2 = new File(Settings.login_def_sftp); f2.createNewFile(); } catch(IOException ex) { ex.printStackTrace(); } String[] login = LoadSet.loadSet(Settings.login_def_sftp); if((login[0] != null) && (login.length > 1)) { host.setText(login[0]); user.setText(login[1]); } /* else { host.setText("localhost"); user.setText("guest"); } */ if(Settings.getStorePasswords()) { if((login != null) && (login.length > 2) && (login[2] != null)) { pass.setText(login[2]); } } else { pass.setText(""); } enc.addItem("3des-cbc"); enc.addItem("blowfish-cbc"); cs.addItem("hmac-sha1"); cs.addItem("hmac-sha1-96"); cs.addItem("hmac-md5"); cs.addItem("hmac-md5-96"); keys.addItem("ssh-rsa"); keys.addItem("ssh-dss"); HInsetPanel root = new HInsetPanel(); root.setLayout(new GridLayout(7, 2, 5, 3)); root.add(host); root.add(port); root.add(user); root.add(pass); root.add(encL); root.add(enc); root.add(csL); root.add(cs); root.add(keysL); root.add(keys); root.add(keyP); root.add(new JLabel("Keyfiles are usually located ~/.ssh/ on UNIX")); root.add(useJSch); root.add(okP); //useJSch.setSelected(true); keyP.add(keyfileL); keyP.add(keyfile); okP.add(new JLabel(" ")); okP.add(ok); getContentPane().setLayout(new BorderLayout(10,10)); getContentPane().add("Center", root); ok.addActionListener(this); keyfile.addActionListener(this); setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE); pass.text.addActionListener(this); useJSch.addChangeListener(this); pack(); setModal(false); setVisible(false); addWindowListener(this); } public void stateChanged(ChangeEvent e) { if(useJSch.isSelected()) { enc.setEnabled(false); cs.setEnabled(false); keys.setEnabled(false); } else { keyfile.setEnabled(true); enc.setEnabled(true); cs.setEnabled(true); keys.setEnabled(true); } } public void update() { fixLocation(); setVisible(true); toFront(); host.requestFocus(); } public void update(String url) { try { SftpURLConnection uc = new SftpURLConnection(new java.net.URL(url)); SftpConnection con = uc.getSftpConnection(); JFtp.statusP.jftp.addConnection(url, con); uc.connect(); if(!uc.getLoginResponse()) { setTitle("Wrong password!"); host.setText(uc.getHost()); port.setText(Integer.toString(uc.getPort())); user.setText(uc.getUser()); pass.setText(uc.getPass()); setVisible(true); toFront(); host.requestFocus(); } else { this.dispose(); if(listener != null) { listener.componentResized(new ComponentEvent(this, 0)); } JFtp.mainFrame.setVisible(true); JFtp.mainFrame.toFront(); } } catch(IOException ex) { Log.debug("Error!"); ex.printStackTrace(); } } public void setShell(boolean shell) { this.shell = shell; } public boolean getShell() { return shell; } public void actionPerformed(ActionEvent e) { if((e.getSource() == ok) || (e.getSource() == pass.text)) { // Switch windows //this.setVisible(false); //this.setModal(false); //JFtp.mainFrame.setVisible(true); //JFtp.mainFrame.toFront(); setCursor(new Cursor(Cursor.WAIT_CURSOR)); SftpConnection con = null; String htmp = host.getText().trim(); String utmp = user.getText().trim(); String ptmp = pass.getText(); //***port number: to be initialized in a future version? int potmp = 22; try { potmp = Integer.parseInt(port.getText()); } catch(Exception ex) { Log.debug("Error: Not a number!"); } String potmpString = new String("" + potmp); com.sshtools.j2ssh.configuration.SshConnectionProperties properties = new com.sshtools.j2ssh.configuration.SshConnectionProperties(); properties.setHost(htmp); //Log.debug(htmp+":"+properties.getHost()); properties.setPort(potmp); properties.setPrefSCEncryption((String) enc.getSelectedItem()); properties.setPrefCSMac((String) cs.getSelectedItem()); properties.setPrefPublicKey((String) keys.getSelectedItem()); if(shell) { SshShell s = new SshShell(properties, utmp, ptmp, potmp); setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); this.dispose(); s.toFront(); return; } else { try { boolean status; SaveSet s = new SaveSet(Settings.login_def_sftp, htmp, utmp, ptmp, potmpString, "null", "null"); if(!useJSch.isSelected()) { StartConnection.setSshProperties(properties); StartConnection.setSshKeyfile(keyfileName); status = StartConnection.startCon("SFTP", htmp, utmp, ptmp, potmp, "", useLocal); } else { Sftp2Connection con2 = new Sftp2Connection(htmp, ""+potmp, keyfileName); if(con2.login(utmp, ptmp)) { if(useLocal) { JFtp.statusP.jftp.addLocalConnection(htmp, con2); } else { JFtp.statusP.jftp.addConnection(htmp, con2); } if(con2.chdir(con2.getPWD()) || con2.chdir("/")) { ; } } } } catch(Exception ex) { ex.printStackTrace(); Log.debug("Could not create SftpConnection, does this distribution come with j2ssh?"); } } setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); this.dispose(); JFtp.mainFrame.setVisible(true); JFtp.mainFrame.toFront(); if(listener != null) { listener.componentResized(new ComponentEvent(this, 0)); } } else if(e.getSource() == keyfile) { JFileChooser chooser = new JFileChooser(); int returnVal = chooser.showOpenDialog(this); if(returnVal == JFileChooser.APPROVE_OPTION) { keyfileName = chooser.getSelectedFile().getPath(); if(keyfileName != null) { keyfileL.setText("(File present)"); } } else { keyfileName = null; if(keyfileName != null) { keyfileL.setText("(No File)"); } } } } public void windowClosing(WindowEvent e) { //System.exit(0); this.dispose(); } public void windowClosed(WindowEvent e) { } public void windowActivated(WindowEvent e) { } public void windowDeactivated(WindowEvent e) { } public void windowIconified(WindowEvent e) { } public void windowDeiconified(WindowEvent e) { } public void windowOpened(WindowEvent e) { } public void pause(int time) { try { Thread.sleep(time); } catch(Exception ex) { } } } jftp-1.52.orig/src/java/net/sf/jftp/gui/hostchooser/NfsHostChooser.java0000700000175000017500000001656311206336252025166 0ustar varunvarun/* * 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. */ package net.sf.jftp.gui.hostchooser; import net.sf.jftp.*; import net.sf.jftp.config.*; import net.sf.jftp.gui.framework.*; import net.sf.jftp.gui.tasks.ExternalDisplayer; import net.sf.jftp.net.*; import net.sf.jftp.net.wrappers.NfsConnection; import net.sf.jftp.net.wrappers.StartConnection; import net.sf.jftp.system.logging.Log; import net.sf.jftp.util.*; import java.awt.*; import java.awt.event.*; import java.io.*; import java.net.*; import javax.swing.*; public class NfsHostChooser extends HFrame implements ActionListener, WindowListener { public static HTextField host = new HTextField("URL:", "nfs://localhost:v2m/tmp", 20); public static HTextField user = new HTextField("Username:", "", 15); //public static HTextField pass = new HTextField("Password:","none@nowhere.no"); public static HPasswordField pass = new HPasswordField("Password:", "nopasswd"); public static HButton info = new HButton("Read me!"); private HPanel okP = new HPanel(); private HButton ok = new HButton("Connect"); private ComponentListener listener = null; private boolean useLocal = false; public NfsHostChooser(ComponentListener l, boolean local) { listener = l; useLocal = local; init(); } public NfsHostChooser(ComponentListener l) { listener = l; init(); } public NfsHostChooser() { init(); } public void init() { //setSize(600, 220); setLocation(100, 150); setTitle("NFS Connection..."); setBackground(okP.getBackground()); JPanel p = new JPanel(); p.add(info); //*** MY ADDITIONS try { File f = new File(Settings.appHomeDir); f.mkdir(); File f1 = new File(Settings.login); f1.createNewFile(); File f2 = new File(Settings.login_def_nfs); f2.createNewFile(); } catch(IOException ex) { ex.printStackTrace(); } LoadSet l = new LoadSet(); String[] login = l.loadSet(Settings.login_def_nfs); if((login[0] != null) && (login.length > 1)) { host.setText(login[0]); user.setText(login[1]); } /* else { System.out.println("made it here"); host.setText("nfs://localhost:v2m/tmp"); user.setText("guest"); } */ if(Settings.getStorePasswords()) { if((login[0] != null) && (login.length > 2) && (login[2] != null)) { pass.setText(login[2]); } } else { pass.setText(""); } HInsetPanel root = new HInsetPanel(); root.setLayout(new GridLayout(4, 2, 5, 3)); root.add(host); root.add(p); root.add(user); root.add(pass); root.add(new JLabel("")); root.add(okP); okP.add(ok); getContentPane().setLayout(new BorderLayout(10,10)); getContentPane().add("Center", root); ok.addActionListener(this); info.addActionListener(this); setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE); pass.text.addActionListener(this); pack(); setModal(false); setVisible(false); addWindowListener(this); } public void update() { fixLocation(); setVisible(true); toFront(); host.requestFocus(); } public void actionPerformed(ActionEvent e) { if(e.getSource() == info) { java.net.URL url = ClassLoader.getSystemResource(Settings.nfsinfo); if(url == null) { url = HImage.class.getResource("/" + Settings.nfsinfo); } ExternalDisplayer d = new ExternalDisplayer(url); } else if((e.getSource() == ok) || (e.getSource() == pass.text)) { // Switch windows //this.setVisible(false); setCursor(new Cursor(Cursor.WAIT_CURSOR)); NfsConnection con = null; String htmp = host.getText().trim(); String utmp = user.getText().trim(); String ptmp = pass.getText(); //*** MY ADDITIONS int potmp = 0; //*** just filler for the port number String userName = user.text.getText(); //*** try { boolean status; status = StartConnection.startCon("NFS", htmp, userName, ptmp, potmp, "", useLocal); /* con = new NfsConnection(htmp); //JFtp.remoteDir.setCon(con); //con.addConnectionListener(((ConnectionListener)JFtp.remoteDir)); //JFtp.statusP.jftp.addConnection(htmp, con); if(!userName.equals("")) ((NfsConnection)con).login(utmp,ptmp); if(useLocal) { con.setLocalPath("/"); JFtp.statusP.jftp.addLocalConnection(htmp, con); } else JFtp.statusP.jftp.addConnection(htmp, con); con.chdir(htmp); //con.setLocalPath(JFtp.localDir.getCon().getPWD()); //con.addConnectionListener((ConnectionListener) JFtp.localDir); */ } catch(Exception ex) { Log.debug("Could not create NfsConnection!"); } setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); this.dispose(); JFtp.mainFrame.setVisible(true); JFtp.mainFrame.toFront(); if(listener != null) { listener.componentResized(new ComponentEvent(this, 0)); } } } public void windowClosing(WindowEvent e) { //System.exit(0); this.dispose(); } public void windowClosed(WindowEvent e) { } public void windowActivated(WindowEvent e) { } public void windowDeactivated(WindowEvent e) { } public void windowIconified(WindowEvent e) { } public void windowDeiconified(WindowEvent e) { } public void windowOpened(WindowEvent e) { } public void pause(int time) { try { Thread.sleep(time); } catch(Exception ex) { } } } jftp-1.52.orig/src/java/net/sf/jftp/gui/base/0000700000175000017500000000000011155274771017762 5ustar varunvarunjftp-1.52.orig/src/java/net/sf/jftp/gui/base/ResumeDialog.java0000700000175000017500000000644611112477774023223 0ustar varunvarun/* * 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. */ package net.sf.jftp.gui.base; import net.sf.jftp.*; import net.sf.jftp.config.*; import net.sf.jftp.gui.base.dir.DirEntry; import net.sf.jftp.gui.framework.*; import net.sf.jftp.net.*; import java.awt.*; import java.awt.event.*; import java.io.*; import javax.swing.*; import javax.swing.event.*; public class ResumeDialog extends HFrame implements ActionListener { private JButton resume = new JButton("Resume"); private JButton skip = new JButton("Skip"); private JButton over = new JButton("Overwrite"); private DirEntry dirEntry = null; public ResumeDialog(DirEntry dirEntry) { this.dirEntry = dirEntry; setLocation(150, 150); setTitle("Question"); resume.setEnabled(false); JTextArea text = new JTextArea(); text.append("A file named " + dirEntry.file + " already exists. \n\n"); File f = new File(JFtp.localDir.getPath() + dirEntry.file); long diff = 0; diff = dirEntry.getRawSize() - f.length(); if(diff == 0) { text.append("It has exactly the same size as the remote file.\n\n"); } else if(diff < 0) { text.append("It is bigger than the remote file.\n\n"); } else { text.append("It is smaller than the remote file.\n\n"); resume.setEnabled(true); } getContentPane().setLayout(new BorderLayout(5, 5)); getContentPane().add("Center", text); HPanel p = new HPanel(); p.add(resume); p.add(skip); p.add(over); getContentPane().add("South", p); resume.addActionListener(this); skip.addActionListener(this); over.addActionListener(this); pack(); fixLocation(); setVisible(true); } public void actionPerformed(ActionEvent e) { if(e.getSource() == resume) { this.dispose(); transfer(); } else if(e.getSource() == skip) { this.dispose(); } else if(e.getSource() == over) { this.dispose(); File f = new File(JFtp.localDir.getPath() + dirEntry.file); f.delete(); transfer(); } } private void transfer() { if((dirEntry.getRawSize() < Settings.smallSize) && !dirEntry.isDirectory()) { JFtp.remoteDir.getCon().download(dirEntry.file); } else { JFtp.remoteDir.getCon().handleDownload(dirEntry.file); } } } jftp-1.52.orig/src/java/net/sf/jftp/gui/base/DownloadQueue.java0000700000175000017500000004172711112477774023420 0ustar varunvarun/* * 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. */ package net.sf.jftp.gui.base; import net.sf.jftp.*; import net.sf.jftp.config.*; import net.sf.jftp.gui.framework.*; import net.sf.jftp.net.*; import net.sf.jftp.system.StringUtils; import net.sf.jftp.system.logging.Log; import net.sf.jftp.util.*; import java.awt.*; import java.awt.event.*; import java.io.*; import java.util.*; import javax.swing.*; import javax.swing.JComponent.*; import javax.swing.event.*; public class DownloadQueue extends HPanel implements ActionListener { private static final String SEP = "--> "; // Number of Retry int NumRetry = 5; //private JTextArea text = new JTextArea(); private DefaultListModel liststr = new DefaultListModel(); private JList list = new JList(liststr); private ArrayList queue = new ArrayList(); private queueDownloader thread = new queueDownloader(); private QueueRecord lastDownload; private BasicConnection con; // private Vector listeners = new Vector(); private HImageButton start = new HImageButton(Settings.resumeImage, "start", "Start queue download...", this); private HImageButton stop = new HImageButton(Settings.pauseImage, "stop", "Stop queue download...", this); private HImageButton save = new HImageButton(Settings.saveImage, "save", "Save queue list to file...", this); private HImageButton load = new HImageButton(Settings.cdImage, "load", "Load queue list from...", this); private HImageButton up = new HImageButton(Settings.downloadImage, "up", "Change order of queue", this); private HImageButton down = new HImageButton(Settings.uploadImage, "down", "Change order of queue", this); private HImageButton delete = new HImageButton(Settings.deleteImage, "del", "Delete item in queue", this); //private HImageButton rotate = new HImageButton(Settings.cmdImage,"rotate","Toggle selected transfer...",this); // connection established? private boolean isThere = false; private boolean downloading = false; private ConnectionHandler handler = new ConnectionHandler(); private JLabel statuslabel; public DownloadQueue() { setLayout(new BorderLayout()); // list.setCellRenderer(new DirCellRenderer()); HPanel cmdP = new HPanel(); cmdP.add(start); cmdP.add(stop); cmdP.add(new JLabel(" ")); cmdP.add(up); cmdP.add(down); cmdP.add(delete); cmdP.add(new JLabel(" ")); cmdP.add(save); cmdP.add(load); start.setSize(24, 24); start.setBorder(true); stop.setSize(24, 24); stop.setBorder(true); up.setSize(24, 24); up.setBorder(true); down.setSize(24, 24); down.setBorder(true); delete.setSize(24, 24); delete.setBorder(true); save.setSize(24, 24); save.setBorder(true); load.setSize(24, 24); load.setBorder(true); JScrollPane dP = new JScrollPane(list); //add("South",cmdP); //add("North",dP); add(cmdP, BorderLayout.SOUTH); add(dP, BorderLayout.CENTER); HPanel status = new HPanel(); statuslabel = new JLabel(""); statuslabel.setSize(100, 100); status.add(statuslabel); add(status, BorderLayout.NORTH); //*** MY ADDITIONS start.setToolTipText("Start queue download..."); stop.setToolTipText("Stop queue download..."); save.setToolTipText("Save queue list to file..."); load.setToolTipText("Load queue list from..."); up.setToolTipText("Change order of queue"); down.setToolTipText("Change order of queue"); delete.setToolTipText("Delete item in queue"); //*** } /* public void fresh() { } */ public void addFtp(String file) { Log.debug("Remote File" + JFtp.remoteDir.getPath() + file + "Local File" + JFtp.localDir.getPath() + file + "HostName" + JFtp.hostinfo.hostname); QueueRecord rec = new QueueRecord(); rec.type = "ftp"; rec.hostname = JFtp.hostinfo.hostname; rec.username = JFtp.hostinfo.username; rec.password = JFtp.hostinfo.password; rec.port = JFtp.hostinfo.port; rec.local = JFtp.localDir.getPath(); rec.remote = JFtp.remoteDir.getPath(); rec.file = file; queue.add(rec); liststr.addElement(rec.hostname + " : " + rec.remote + rec.file); } public void actionPerformed(ActionEvent e) { if(e.getActionCommand().equals("start")) { if(thread != null) { if(!thread.isAlive()) { thread = new queueDownloader(); thread.start(); //listeners.add(thread); } } else { thread = new queueDownloader(); thread.start(); //listeners.add(thread); } } else if(e.getActionCommand().equals("stop")) { if(thread != null) { thread.block = true; //QueueRecord rec = (QueueRecord)queue.get(0); //Transfer d = (Transfer)handler.getConnections().get(rec.file); //DataConnection dcon = d.getDataConnection(); FtpConnection ftpcon = (FtpConnection) con; DataConnection dcon = ftpcon.getDataConnection(); dcon.getCon().work = false; try { dcon.sock.close(); } catch(Exception ex) { ex.printStackTrace(); } } } else if(e.getActionCommand().equals("down")) { if(list.getSelectedIndex() != -1) { int a = list.getSelectedIndex(); int b = a + 1; QueueRecord qa = (QueueRecord) queue.get(b); queue.remove(b); queue.add(a, qa); String sa = (String) liststr.get(b); liststr.remove(b); liststr.add(a, sa); list.setSelectedIndex(b); } } else if(e.getActionCommand().equals("up")) { if(list.getSelectedIndex() != -1) { int a = list.getSelectedIndex() - 1; int b = a + 1; QueueRecord qa = (QueueRecord) queue.get(b); queue.remove(b); queue.add(a, qa); String sa = (String) liststr.get(b); liststr.remove(b); liststr.add(a, sa); list.setSelectedIndex(a); } } else if(e.getActionCommand().equals("del")) { if(list.getSelectedIndex() != -1) { queue.remove(list.getSelectedIndex()); liststr.remove(list.getSelectedIndex()); list.setSelectedIndex(0); } } else if(e.getActionCommand().equals("save")) { JFileChooser chooser = new JFileChooser(); chooser.setDialogTitle("Save file"); chooser.setDialogType(JFileChooser.SAVE_DIALOG); int returnVal = chooser.showSaveDialog(new JDialog()); if(returnVal == JFileChooser.APPROVE_OPTION) { File f = chooser.getSelectedFile(); saveList(f); } } else if(e.getActionCommand().equals("load")) { JFileChooser chooser = new JFileChooser(); chooser.setDialogTitle("Open file"); chooser.setDialogType(JFileChooser.OPEN_DIALOG); int returnVal = chooser.showOpenDialog(new JDialog()); if(returnVal == JFileChooser.APPROVE_OPTION) { File f = chooser.getSelectedFile(); loadList(f); } } } private void saveList(File file) { try { if(file.exists()) { file.delete(); } FileOutputStream fos; PrintStream f = new PrintStream((fos = new FileOutputStream(file))); for(int i = 0; i <= queue.size(); i++) { QueueRecord rec = (QueueRecord) queue.get(i); f.println(rec.type); f.println(rec.hostname); f.println(rec.username); f.println(rec.password); f.println(rec.port); f.println(rec.file); f.println(rec.local); f.println(rec.remote); f.println(rec.localip); f.println(rec.domain); } fos.close(); } catch(Exception ex) { ex.printStackTrace(); } } private void loadList(File file) { try { BufferedReader breader = new BufferedReader(new FileReader(file)); boolean Eof = false; queue.clear(); liststr.clear(); while(!Eof) { QueueRecord rec = new QueueRecord(); rec.type = breader.readLine(); rec.hostname = breader.readLine(); rec.username = breader.readLine(); rec.password = breader.readLine(); rec.port = breader.readLine(); rec.file = breader.readLine(); rec.local = breader.readLine(); rec.remote = breader.readLine(); rec.localip = breader.readLine(); rec.domain = breader.readLine(); if(rec.hostname == null) { Eof = true; } else { queue.add(rec); liststr.addElement(rec.hostname + " : " + rec.remote + rec.file); } } } catch(Exception ex) { } } // ------------ needed by Logger interface -------------- // main log method public void debug(String msg) { System.out.println(msg); } // rarely used public void debugRaw(String msg) { System.out.print(msg); } // methods below are not used yet. public void debug(String msg, Throwable throwable) { } public void warn(String msg) { } public void warn(String msg, Throwable throwable) { } public void error(String msg) { } public void error(String msg, Throwable throwable) { } public void info(String msg) { } public void info(String msg, Throwable throwable) { } public void fatal(String msg) { } public void fatal(String msg, Throwable throwable) { } class QueueRecord { public String type; // parameter used for ftp public String hostname; public String username; public String password; public String port; public String file; // local path public String local; // remote path public String remote; // used only for smb public String localip; public String domain; public QueueRecord() { } } class queueDownloader extends Thread implements ConnectionListener { public boolean block = false; public boolean connected = false; public QueueRecord last; private FtpConnection conFtp; public void run() { try { while((queue.size() >= 1) && !block) { QueueRecord rec = (QueueRecord) queue.get(0); last = rec; if(!connected) { con = new FtpConnection(rec.hostname, Integer.parseInt(rec.port), "/"); conFtp = (FtpConnection) con; conFtp.addConnectionListener(this); conFtp.setConnectionHandler(handler); conFtp.login(rec.username, rec.password); connected = true; } conFtp.chdirNoRefresh(rec.remote); conFtp.setLocalPath(rec.local); int i = 0; while(!isThere) { i++; if(i > NumRetry) { return; } try { Thread.sleep(10); } catch(Exception ex) { ex.printStackTrace(); } } conFtp.download(rec.file); statuslabel.setText(""); if(queue.size() >= 1) { rec = (QueueRecord) queue.get(0); if((rec.hostname.compareTo(last.hostname) == 0) && (rec.port.compareTo(last.port) == 0) && (rec.username.compareTo(last.username) == 0) && (rec.password.compareTo(last.password) == 0)) { connected = true; } else { conFtp.disconnect(); connected = false; } } else { conFtp.disconnect(); connected = false; } Thread.sleep(100); } } catch(InterruptedException e) { } if(connected) { con.disconnect(); } } // ------------------ needed by ConnectionListener interface ----------------- // called if the remote directory has changed public void updateRemoteDirectory(BasicConnection con) { } // called if a connection has been established public void connectionInitialized(BasicConnection con) { isThere = true; } // called every few kb by DataConnection during the trnsfer (interval can be changed in Settings) public void updateProgress(String file, String type, long bytes) { String strtmp; if(StringUtils.getFile(file).compareTo("") == 0) { strtmp = "directory " + file; } else { strtmp = "file " + StringUtils.getFile(file); } statuslabel.setText("Downloading " + strtmp + " - kbyte " + (bytes / 1024)); String tmp; if(type.length() >= 10) { tmp = type.substring(0, 9); } else { tmp = " "; } if(((type.compareTo(DataConnection.FINISHED) == 0) || (tmp.compareTo(DataConnection.DFINISHED) == 0)) && !block) { queue.remove(0); liststr.remove(0); } } // called if connection fails public void connectionFailed(BasicConnection con, String why) { System.out.println("connection failed!"); } // up- or download has finished public void actionFinished(BasicConnection con) { } } } jftp-1.52.orig/src/java/net/sf/jftp/gui/base/LogFlusher.java0000700000175000017500000000130011112477774022675 0ustar varunvarunpackage net.sf.jftp.gui.base; import net.sf.jftp.JFtp; import net.sf.jftp.config.Settings; public class LogFlusher implements Runnable { private Thread runner; public LogFlusher() { runner = new Thread(this); if(Settings.useLogFlusher) { runner.start(); } } public void run() { while(true) { try { runner.sleep(Settings.logFlushInterval); } catch(InterruptedException ex) { ex.printStackTrace(); } //System.out.println("logflush"); JFtp.statusP.jftp.ensureLogging(); } } } jftp-1.52.orig/src/java/net/sf/jftp/gui/base/AppMenuBar.java0000700000175000017500000012526711264336105022626 0ustar varunvarun/* * 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. */ package net.sf.jftp.gui.base; import net.sf.jftp.JFtp; import net.sf.jftp.config.Settings; import net.sf.jftp.gui.framework.*; import net.sf.jftp.gui.hostchooser.HostChooser; import net.sf.jftp.gui.hostchooser.NfsHostChooser; import net.sf.jftp.gui.hostchooser.SftpHostChooser; import net.sf.jftp.gui.hostchooser.SmbHostChooser; import net.sf.jftp.gui.hostchooser.WebdavHostChooser; import net.sf.jftp.gui.tasks.AddBookmarks; import net.sf.jftp.gui.tasks.AdvancedOptions; import net.sf.jftp.gui.tasks.BookmarkItem; import net.sf.jftp.gui.tasks.BookmarkManager; import net.sf.jftp.gui.tasks.Displayer; import net.sf.jftp.gui.tasks.HttpBrowser; import net.sf.jftp.gui.tasks.HttpDownloader; import net.sf.jftp.gui.tasks.LastConnections; import net.sf.jftp.gui.tasks.ProxyChooser; import net.sf.jftp.net.*; import net.sf.jftp.net.wrappers.StartConnection; import net.sf.jftp.system.logging.Log; import net.sf.jftp.tools.*; import net.sf.jftp.util.*; import java.awt.*; import java.awt.event.*; import java.io.*; import java.lang.Integer; import java.util.*; import javax.swing.*; import javazoom.jl.decoder.*; import javazoom.jl.player.*; //*** public class AppMenuBar extends JMenuBar implements ActionListener { public static JCheckBoxMenuItem fadeMenu = new JCheckBoxMenuItem("Enable Status Animation", Settings.getEnableStatusAnimation()); public static JCheckBoxMenuItem askToDelete = new JCheckBoxMenuItem("Confirm Remove", Settings.getAskToDelete()); public static JCheckBoxMenuItem debug = new JCheckBoxMenuItem("Verbose Console Debugging", Settings.getEnableDebug()); public static JCheckBoxMenuItem disableLog = new JCheckBoxMenuItem("Disable Log", Settings.getDisableLog()); public static JMenuItem clearItems = new JMenuItem("Clear Finished Items"); private JFtp jftp; JMenu file = new JMenu("File"); JMenu opt = new JMenu("Options"); JMenu view = new JMenu("View"); JMenu tools = new JMenu("Tools"); JMenu bookmarks = new JMenu("Bookmarks"); JMenu info = new JMenu("Info"); JMenu lf = new JMenu(" Switch Look & Feel to"); JMenu background = new JMenu("Desktop Background"); JMenu ftp = new JMenu(" FTP"); JMenu smb = new JMenu(" SMB"); JMenu sftp = new JMenu(" SFTP"); JMenu security = new JMenu("Security"); JMenu experimental = new JMenu("Experimental Features"); JMenu rss = new JMenu("RSS Feed"); JMenu cnn = new JMenu("CNN"); JMenuItem localFtpCon = new JMenuItem("Open FTP Connection in Local Tab..."); JMenuItem localSftpCon = new JMenuItem("Open SFTP Connection in Local Tab..."); JMenuItem localSmbCon = new JMenuItem("Open SMB/LAN Connection in Local Tab..."); JMenuItem localNfsCon = new JMenuItem("Open NFS Connection in Local Tab..."); JMenuItem localWebdavCon = new JMenuItem("Open WebDAV Connection in Local Tab... (ALPHA)"); JMenuItem closeLocalCon = new JMenuItem("Close Active Connection in Local Tab"); JMenuItem ftpCon = new JMenuItem("Connect to FTP Server..."); JMenuItem sftpCon = new JMenuItem("Connect to SFTP Server..."); JMenuItem smbCon = new JMenuItem("Connect to SMB Server / Browse LAN..."); JMenuItem nfsCon = new JMenuItem("Connect to NFS Server..."); JMenuItem webdavCon = new JMenuItem("Connect to WebDAV Server... (ALPHA)"); JMenuItem close = new JMenuItem("Disconnect and Connect to Filesystem"); JMenuItem exit = new JMenuItem("Exit"); JMenuItem readme = new JMenuItem("Show Readme..."); JMenuItem changelog = new JMenuItem("View Changelog..."); JMenuItem todo = new JMenuItem("What's Next..."); JMenuItem hp = new JMenuItem("Visit Project Homepage..."); JMenuItem opts = new JMenuItem("Advanced Options..."); JMenuItem http = new JMenuItem("Download File from URL..."); JMenuItem raw = new JMenuItem("Raw TCP/IP Connection..."); JMenuItem spider = new JMenuItem("Recursive HTTP Download..."); JMenuItem sshShell = new JMenuItem("SSH Shell..."); JMenuItem shell = new JMenuItem("Execute /bin/bash"); JMenuItem loadAudio = new JMenuItem("Play MP3"); JCheckBoxMenuItem rssDisabled = new JCheckBoxMenuItem("Enable RSS Feed", Settings.getEnableRSS()); JCheckBoxMenuItem nl = new JCheckBoxMenuItem("Show Newline Option", Settings.showNewlineOption); JMenuItem loadSlash = new JMenuItem("Slashdot"); JMenuItem loadCNN1 = new JMenuItem("CNN Top Stories"); JMenuItem loadCNN2 = new JMenuItem("CNN World"); JMenuItem loadCNN3 = new JMenuItem("CNN Tech"); JMenuItem loadRss = new JMenuItem("Custom RSS Feed"); JCheckBoxMenuItem stdback = new JCheckBoxMenuItem("Background Image", Settings.getUseBackground()); JCheckBoxMenuItem resuming = new JCheckBoxMenuItem("Enable Resuming", Settings.enableResuming); JCheckBoxMenuItem ask = new JCheckBoxMenuItem("Always Ask to Resume", Settings.askToResume); JMenuItem proxy = new JMenuItem("Proxy Settings..."); JCheckBoxMenuItem smbThreads = new JCheckBoxMenuItem("Multiple Connections", Settings.getEnableSmbMultiThreading()); JCheckBoxMenuItem sftpThreads = new JCheckBoxMenuItem("Multiple Connections", Settings.getEnableSftpMultiThreading()); JCheckBoxMenuItem sshKeys = new JCheckBoxMenuItem("Enable Host Key check", Settings.getEnableSshKeys()); JCheckBoxMenuItem storePasswords = new JCheckBoxMenuItem("Store passwords (plaintext)", Settings.getStorePasswords()); JCheckBoxMenuItem useTableLayout = new JCheckBoxMenuItem("Use JTable layout", Settings.getUseJTableLayout()); JCheckBoxMenuItem useNewIcons = new JCheckBoxMenuItem("Use Silk Icons", Settings.getUseNewIcons()); JCheckBoxMenuItem hideHidden = new JCheckBoxMenuItem("Hide local hidden files (Unix only)", Settings.getHideLocalDotNames()); JMenuItem clear = new JMenuItem("Clear Log"); //*** the menu items for the last connections JMenuItem[] lastConnections = new JMenuItem[jftp.CAPACITY]; //*** information on each of the last connections //BUGFIX String[][] cons = new String[jftp.CAPACITY][JFtp.CONNECTION_DATA_LENGTH]; String[] lastConData = new String[jftp.CAPACITY]; Character charTab = new Character('\t'); String tab = charTab.toString(); JMenuItem manage = new JMenuItem("Manage Bookmarks..."); JMenuItem add = new JMenuItem("Add Bookmark..."); Hashtable marks; JMenu current = bookmarks; JMenu last = bookmarks; /* String[] lastProtocols; String[] lastHosts; String[] lastUnames; */ public AppMenuBar(JFtp jftp) { this.jftp = jftp; ftpCon.addActionListener(this); close.addActionListener(this); exit.addActionListener(this); readme.addActionListener(this); changelog.addActionListener(this); todo.addActionListener(this); resuming.addActionListener(this); ask.addActionListener(this); smbCon.addActionListener(this); clear.addActionListener(this); sftpCon.addActionListener(this); fadeMenu.addActionListener(this); askToDelete.addActionListener(this); smbThreads.addActionListener(this); sftpThreads.addActionListener(this); debug.addActionListener(this); disableLog.addActionListener(this); http.addActionListener(this); hp.addActionListener(this); raw.addActionListener(this); nfsCon.addActionListener(this); spider.addActionListener(this); proxy.addActionListener(this); stdback.addActionListener(this); opts.addActionListener(this); webdavCon.addActionListener(this); sshShell.addActionListener(this); shell.addActionListener(this); nl.addActionListener(this); localFtpCon.addActionListener(this); localSftpCon.addActionListener(this); localSmbCon.addActionListener(this); localNfsCon.addActionListener(this); localWebdavCon.addActionListener(this); closeLocalCon.addActionListener(this); add.addActionListener(this); storePasswords.addActionListener(this); rssDisabled.addActionListener(this); loadRss.addActionListener(this); loadSlash.addActionListener(this); loadCNN1.addActionListener(this); loadCNN2.addActionListener(this); loadCNN3.addActionListener(this); loadAudio.addActionListener(this); useTableLayout.addActionListener(this); useNewIcons.addActionListener(this); hideHidden.addActionListener(this); clearItems.addActionListener(JFtp.dList); clear.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_1, ActionEvent.ALT_MASK)); clearItems.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_2, ActionEvent.ALT_MASK)); changelog.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_3, ActionEvent.ALT_MASK)); readme.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_4, ActionEvent.ALT_MASK)); todo.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_5, ActionEvent.ALT_MASK)); //*** setMnemonics(); was here //*** BELOW, ADDITIONS FOR THE FILE MENU ARE PUT IN PUBLIC METHOD resetFileItems(); ftp.add(resuming); ftp.add(ask); ftp.add(nl); smb.add(smbThreads); sftp.add(sftpThreads); sftp.add(sshKeys); security.add(askToDelete); security.add(storePasswords); cnn.add(loadCNN1); cnn.add(loadCNN2); cnn.add(loadCNN3); rss.add(rssDisabled); rss.add(loadSlash); rss.add(cnn); rss.add(loadRss); opt.add(security); opt.addSeparator(); opt.add(ftp); opt.add(smb); opt.add(sftp); opt.addSeparator(); opt.add(proxy); opt.add(opts); tools.add(http); tools.add(spider); tools.addSeparator(); tools.add(raw); tools.addSeparator(); tools.add(sshShell); tools.add(shell); view.add(hideHidden); view.addSeparator(); view.add(useTableLayout); view.add(useNewIcons); view.add(fadeMenu); view.add(clear); view.add(clearItems); view.addSeparator(); view.add(debug); view.add(disableLog); view.addSeparator(); view.add(rss); view.addSeparator(); info.add(readme); info.add(changelog); //info.add(todo); //info.addSeparator(); //info.add(hp); UIManager.LookAndFeelInfo[] m = UIManager.getInstalledLookAndFeels(); for(int i = 0; i < m.length; i++) { //JMenuItem tmp = new JMenuItem(m[i].getName()); //tmp.addActionListener(this); //lf.add(tmp); /* * Don't add menu items for unsupported look and feel's. * * It would be nice to use something like * isSupportedLookandFeel, but the information provided by * UIManager.LookAndFeelInfo is very limited. This is * supposedly done on purpose according to the API docs, * but what good does a non-supported look and feel in a * menu item do? */ try { LookAndFeel lnf = (LookAndFeel) Class.forName(m[i].getClassName()) .newInstance(); if(lnf.isSupportedLookAndFeel()) { JMenuItem tmp = new JMenuItem(m[i].getName()); tmp.addActionListener(this); lf.add(tmp); } } catch(ClassNotFoundException cnfe) { continue; } catch(InstantiationException ie) { continue; } catch(IllegalAccessException iae) { continue; } } view.add(lf); background.add(stdback); view.add(background); manage.addActionListener(this); //UIManager.setLookAndFeel(); add(file); add(opt); add(view); add(tools); add(bookmarks); add(info); loadBookmarks(); //add(experimental); } public void loadBookmarks() { marks = new Hashtable(); bookmarks.removeAll(); bookmarks.add(add); bookmarks.add(manage); bookmarks.addSeparator(); String data = ""; try { DataInput in = new DataInputStream(new BufferedInputStream(new FileInputStream(Settings.bookmarks))); while((data = in.readLine()) != null) { if(!data.startsWith("#") && !data.trim().equals("")) { addBookmarkLine(data); } } } catch(IOException e) { Log.debug("No bookmarks.txt found, using defaults."); addBookmark("FTP", "ftp.kernel.org", "anonymous", "j-ftp@sf.net", 21, "/pub/linux/kernel", "false"); addBookmark("FTP", "upload.sourceforge.net", "anonymous", "j-ftp@sf.net", 21, "/incoming", "false"); addBookmark("SMB", "(LAN)", "guest", "guest", -1, "-", "false"); return; } } private void addBookmarkLine(String tmp) { try { StringTokenizer t = new StringTokenizer(tmp, "#", false); if(tmp.toLowerCase().trim().startsWith("")) { String dir = tmp.substring(tmp.indexOf(">") + 1, tmp.lastIndexOf("<")); //Log.debug("Dir: " + dir); JMenu m = new JMenu(dir); current.add(m); last = current; current = m; } else if(tmp.toLowerCase().trim().startsWith("")) { current = last; } else { addBookmark(t.nextToken(), t.nextToken(), t.nextToken(), t.nextToken(), Integer.parseInt(t.nextToken()), t.nextToken(), t.nextToken()); } } catch(Exception ex) { Log.debug("Broken line: " + tmp); ex.printStackTrace(); } } public void addBookmark(String pr, String h, String u, String p, int po, String d, String l) { BookmarkItem x = new BookmarkItem(h); x.setUserdata(u, p); if(l.trim().startsWith("t")) { x.setLocal(true); } x.setPort(po); x.setProtocol(pr); x.setDirectory(d); //bookmarks current.add(x); marks.put(x.getLabel(), x); x.addActionListener(this); } //*** Where changes to the file menu are made (iniitalization done here too) public void resetFileItems() { file.removeAll(); file.add(ftpCon); file.add(sftpCon); file.add(smbCon); file.add(nfsCon); file.add(webdavCon); file.addSeparator(); file.add(close); file.addSeparator(); file.addSeparator(); file.add(localFtpCon); file.add(localSftpCon); file.add(localSmbCon); file.add(localNfsCon); //file.add(localWebdavCon); -> not yet file.addSeparator(); file.add(closeLocalCon); file.addSeparator(); //*** ADDITION OF THE REMEMBERED CONNECTIONS boolean connectionsExist = false; try { //*** get the information on the last connections cons = new String[jftp.CAPACITY][jftp.CONNECTION_DATA_LENGTH]; cons = LastConnections.readFromFile(jftp.CAPACITY); String protocol; String htmp; String utmp; String conNumber; String usingLocal = new String(""); Integer conNumberInt; //lastConData = new String(""); //*** for(int i = 0; i < jftp.CAPACITY; i++) { if(!(cons[i][0].equals("null"))) { protocol = cons[i][0]; htmp = cons[i][1]; utmp = cons[i][2]; int j = 3; while(!(cons[i][j].equals(LastConnections.SENTINEL))) { j++; } //usingLocal is always last piece of data! usingLocal = cons[i][j - 1]; if(usingLocal.equals("true")) { usingLocal = "(in local tab)"; } else { usingLocal = ""; } //lastConnections[i] = new JMenuItem(cons[i]); conNumberInt = new Integer(i + 1); conNumber = conNumberInt.toString(); //lastConData[i] = new String(conNumber + " " + protocol + ": Hostname: " + htmp + "; Username: " + utmp); lastConData[i] = new String(conNumber + " " + protocol + ": " + htmp + " " + usingLocal); lastConnections[i] = new JMenuItem(lastConData[i]); lastConnections[i].addActionListener(this); connectionsExist = true; //*** code repetition: maybe getting these tokens //*** should be in a separate private method //file.add(protocol + ": Hostname: " + htmp + "; Username: " + utmp); file.add(lastConnections[i]); } } } catch(Exception ex) { Log.debug("WARNING: Remembered connections broken."); ex.printStackTrace(); } if(connectionsExist) { file.addSeparator(); } file.add(exit); setMnemonics(); } //resetFileItems public void actionPerformed(ActionEvent e) { if(e.getSource() == proxy) { //ProxyChooser p = JFtp.statusP.jftp.addToDesktop("Proxy Settings", new ProxyChooser(), 500, 110); } else if(e.getSource() == add) { Log.out("add called"); AddBookmarks a = new AddBookmarks(JFtp.statusP.jftp); a.update(); } else if(e.getSource() == webdavCon) { WebdavHostChooser hc = new WebdavHostChooser(); hc.toFront(); hc.update(); } else if((e.getSource() == localFtpCon) && (!jftp.uiBlocked)) { HostChooser hc = new HostChooser(null, true); hc.toFront(); //hc.setModal(true); hc.update(); } else if((e.getSource() == localSmbCon) && (!jftp.uiBlocked)) { SmbHostChooser hc = new SmbHostChooser(null, true); hc.toFront(); //hc.setModal(true); hc.update(); } else if((e.getSource() == localSftpCon) && (!jftp.uiBlocked)) { SftpHostChooser hc = new SftpHostChooser(null, true); hc.toFront(); //hc.setModal(true); hc.update(); } else if((e.getSource() == localNfsCon) && (!jftp.uiBlocked)) { NfsHostChooser hc = new NfsHostChooser(null, true); hc.toFront(); //hc.setModal(true); hc.update(); } else if((e.getSource() == localWebdavCon) && (!jftp.uiBlocked)) { WebdavHostChooser hc = new WebdavHostChooser(null, true); hc.toFront(); //hc.setModal(true); hc.update(); } else if(e.getSource() == closeLocalCon) { JFtp.statusP.jftp.closeCurrentLocalTab(); } else if(e.getSource() == clear) { jftp.clearLog(); } else if(e.getSource() == spider) { jftp.addToDesktop("Http recursive download", new HttpSpider(jftp.localDir.getPath() + "_httpdownload/"), 440, 250); } else if(e.getSource() == hp) { HttpBrowser h = new HttpBrowser("http://j-ftp.sourceforge.net"); JFtp.desktop.add(h, new Integer(Integer.MAX_VALUE - 10)); } else if(e.getSource() == raw) { RawConnection c = new RawConnection(); } else if(e.getSource() == readme) { show(Settings.readme); } else if(e.getSource() == changelog) { show(Settings.changelog); } else if(e.getSource() == todo) { show(Settings.todo); } else if(e.getSource() == shell) { UIUtils.runCommand("/bin/bash"); } else if(e.getSource() == loadAudio) { try { JFileChooser f = new JFileChooser(); f.showOpenDialog(jftp); File file = f.getSelectedFile(); Player p = new Player(new FileInputStream(file)); p.play(); } catch(Exception ex) { ex.printStackTrace(); Log.debug("Error: (" + ex + ")"); } } else if(e.getSource() == exit) { jftp.windowClosing(null); // handles everything } else if(e.getSource() == close) { JFtp.statusP.jftp.closeCurrentTab(); /* jftp.safeDisconnect(); FilesystemConnection con = new FilesystemConnection(); jftp.remoteDir.setCon(con); con.addConnectionListener((ConnectionListener)jftp.remoteDir); if(!con.chdir("/")) con.chdir("C:\\"); */ } else if((e.getSource() == ftpCon) && (!jftp.uiBlocked)) { //jftp.safeDisconnect(); HostChooser hc = new HostChooser(); hc.toFront(); //hc.setModal(true); hc.update(); } else if((e.getSource() == smbCon) && (!jftp.uiBlocked)) { //jftp.safeDisconnect(); SmbHostChooser hc = new SmbHostChooser(); hc.toFront(); //hc.setModal(true); hc.update(); } else if((e.getSource() == sftpCon) && (!jftp.uiBlocked)) { //jftp.safeDisconnect(); SftpHostChooser hc = new SftpHostChooser(); hc.toFront(); //hc.setModal(true); hc.update(); } else if((e.getSource() == nfsCon) && (!jftp.uiBlocked)) { // jftp.safeDisconnect(); NfsHostChooser hc = new NfsHostChooser(); hc.toFront(); //hc.setModal(true); hc.update(); } else if(e.getSource() == resuming) { boolean res = resuming.getState(); Settings.enableResuming = res; Settings.setProperty("jftp.enableResuming", res); ask.setEnabled(Settings.enableResuming); Settings.save(); } else if(e.getSource() == useTableLayout) { boolean res = useTableLayout.getState(); Settings.setProperty("jftp.useJTableLayout", res); Settings.save(); JOptionPane.showMessageDialog(this, "Please restart JFtp to have the UI changed."); } else if(e.getSource() == useNewIcons) { boolean res = useNewIcons.getState(); Settings.setProperty("jftp.gui.look.newIcons", res); Settings.save(); JOptionPane.showMessageDialog(this, "Please restart JFtp to have the UI changed."); } else if(e.getSource() == hideHidden) { boolean res = hideHidden.getState(); Settings.setProperty("jftp.hideHiddenDotNames", res); Settings.save(); JFtp.localUpdate(); } else if(e.getSource() == nl) { boolean res = nl.getState(); Settings.showNewlineOption = res; } else if(e.getSource() == stdback) { Settings.setProperty("jftp.useBackground", stdback.getState()); Settings.save(); JFtp.statusP.jftp.fireUpdate(); } else if(e.getSource() == sshKeys) { Settings.setProperty("jftp.useSshKeyVerification", sshKeys.getState()); Settings.save(); JFtp.statusP.jftp.fireUpdate(); } else if(e.getSource() == rssDisabled) { Settings.setProperty("jftp.enableRSS", rssDisabled.getState()); Settings.save(); JFtp.statusP.jftp.fireUpdate(); } else if(e.getSource() == loadRss) { String what = JOptionPane.showInputDialog("Enter URL", "http://"); if(what == null) { return; } Settings.setProperty("jftp.customRSSFeed", what); Settings.save(); JFtp.statusP.jftp.feeder.switchTo(what); } else if(e.getSource() == loadSlash) { Settings.setProperty("jftp.customRSSFeed", "http://slashdot.org/rss/slashdot.rss"); Settings.save(); JFtp.statusP.jftp.feeder.switchTo("http://slashdot.org/rss/slashdot.rss"); } else if(e.getSource() == loadCNN1) { Settings.setProperty("jftp.customRSSFeed", "http://rss.cnn.com/rss/cnn_topstories.rss"); Settings.save(); JFtp.statusP.jftp.feeder.switchTo("http://rss.cnn.com/rss/cnn_topstories.rss"); } else if(e.getSource() == loadCNN2) { Settings.setProperty("jftp.customRSSFeed", "http://rss.cnn.com/rss/cnn_world.rss"); Settings.save(); JFtp.statusP.jftp.feeder.switchTo("http://rss.cnn.com/rss/cnn_world.rss"); } else if(e.getSource() == loadCNN3) { Settings.setProperty("jftp.customRSSFeed", "http://rss.cnn.com/rss/cnn_tech.rss"); Settings.save(); JFtp.statusP.jftp.feeder.switchTo("http://rss.cnn.com/rss/cnn_tech.rss"); } else if(e.getSource() == debug) { Settings.setProperty("jftp.enableDebug", debug.getState()); Settings.save(); } else if(e.getSource() == disableLog) { Settings.setProperty("jftp.disableLog", disableLog.getState()); Settings.save(); } else if(e.getSource() == smbThreads) { Settings.setProperty("jftp.enableSmbMultiThreading", smbThreads.getState()); Settings.save(); } else if(e.getSource() == sftpThreads) { Settings.setProperty("jftp.enableSftpMultiThreading", sftpThreads.getState()); Settings.save(); } else if(e.getSource() == ask) { Settings.askToResume = ask.getState(); } else if(e.getSource() == http) { HttpDownloader dl = new HttpDownloader(); jftp.addToDesktop("Http download", dl, 480, 100); jftp.setLocation(dl.hashCode(), 100, 150); } else if(e.getSource() == fadeMenu) { Settings.setProperty("jftp.gui.enableStatusAnimation", fadeMenu.getState()); Settings.save(); } else if(e.getSource() == askToDelete) { Settings.setProperty("jftp.gui.askToDelete", askToDelete.getState()); Settings.save(); } //***MY ADDITIONS (***how can I make this flexible enough to //*** easily add > 5 connections?) else if((e.getSource() == lastConnections[0]) && (!jftp.uiBlocked)) { connectionSelected(0); } else if((e.getSource() == lastConnections[1]) && (!jftp.uiBlocked)) { connectionSelected(1); } else if((e.getSource() == lastConnections[2]) && (!jftp.uiBlocked)) { connectionSelected(2); } else if((e.getSource() == lastConnections[3]) && (!jftp.uiBlocked)) { connectionSelected(3); } else if((e.getSource() == lastConnections[4]) && (!jftp.uiBlocked)) { connectionSelected(4); } else if((e.getSource() == lastConnections[5]) && (!jftp.uiBlocked)) { connectionSelected(5); } else if((e.getSource() == lastConnections[6]) && (!jftp.uiBlocked)) { connectionSelected(6); } else if((e.getSource() == lastConnections[7]) && (!jftp.uiBlocked)) { connectionSelected(7); } else if((e.getSource() == lastConnections[8]) && (!jftp.uiBlocked)) { connectionSelected(8); } else if(e.getSource() == opts) { AdvancedOptions adv = new AdvancedOptions(); jftp.addToDesktop("Advanced Options", adv, 500, 180); jftp.setLocation(adv.hashCode(), 110, 180); } else if(e.getSource() == manage) { BookmarkManager m = new BookmarkManager(); JFtp.desktop.add(m, new Integer(Integer.MAX_VALUE - 10)); } else if(marks.contains(e.getSource())) { ((BookmarkItem) e.getSource()).connect(); } else if(e.getSource() == storePasswords) { boolean state = storePasswords.getState(); if(!state) { JOptionPane j = new JOptionPane(); int x = j.showConfirmDialog(storePasswords, "You chose not to Save passwords.\n" + "Do you want your old login data to be deleted?", "Delete old passwords?", JOptionPane.YES_NO_OPTION); if(x == JOptionPane.YES_OPTION) { File f = new File(Settings.login_def); f.delete(); f = new File(Settings.login_def_sftp); f.delete(); f = new File(Settings.login_def_nfs); f.delete(); f = new File(Settings.login_def_smb); f.delete(); f = new File(Settings.login); f.delete(); f = new File(Settings.last_cons); f.delete(); Log.debug("Deleted old login data files.\n" + "Please edit your bookmarks file manually!"); } } Settings.setProperty("jftp.security.storePasswords", state); Settings.save(); } else if(e.getSource() == sshShell) { SftpHostChooser c = new SftpHostChooser(true); c.update(); } //*** END OF NEW LISTENERS else { String tmp = ((JMenuItem) e.getSource()).getLabel(); UIManager.LookAndFeelInfo[] m = UIManager.getInstalledLookAndFeels(); for(int i = 0; i < m.length; i++) { if(m[i].getName().equals(tmp)) { JFtp.statusP.jftp.setLookAndFeel(m[i].getClassName()); Settings.setProperty("jftp.gui.look", m[i].getClassName()); Settings.save(); } } } } private void show(String file) { java.net.URL url = ClassLoader.getSystemResource(file); if(url == null) { url = HImage.class.getResource("/" + file); } Displayer d = new Displayer(url, null); JFtp.desktop.add(d, new Integer(Integer.MAX_VALUE - 11)); } // by jake private void setMnemonics() { //*** I added accelerators for more menu items //*** (issue: should ALL accelerators have the CTRL modifier (so that //*** the ALT modifier is for mnemonics only?) //*** I added mnemonics for the main menu items file.setMnemonic('F'); opt.setMnemonic('O'); view.setMnemonic('V'); tools.setMnemonic('T'); bookmarks.setMnemonic('B'); info.setMnemonic('I'); //*** set accelerators for the remote connection window ftpCon.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F, ActionEvent.CTRL_MASK)); sftpCon.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S, ActionEvent.CTRL_MASK)); smbCon.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_L, ActionEvent.CTRL_MASK)); nfsCon.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_N, ActionEvent.CTRL_MASK)); //*** IMPORTANT NOTE: Adding an accelerator for disconnecting could //*** be something of a "gotcha" that we may not want close.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_C, ActionEvent.CTRL_MASK)); //*** These next five lines can be commented out if we decide against having accelerators //*** starting with the shift key //*** version 1.44: we have chosen not to have shift as a modifier //*** as we've found this is a "gotcha" /* localFtpCon.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F, ActionEvent.SHIFT_MASK)); localSftpCon.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S, ActionEvent.SHIFT_MASK)); localSmbCon.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_L, ActionEvent.SHIFT_MASK)); localNfsCon.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_N, ActionEvent.SHIFT_MASK)); closeLocalCon.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_C, ActionEvent.SHIFT_MASK)); */ //*** I have decided to get areound the problem by having mnemonics within the menu //*** as accelerators. So to quickly start an FTP connection in the local window, //*** the user can enter Alt+f+f, and Alt+f+s for SFTP,etc. localFtpCon.setMnemonic('F'); localSftpCon.setMnemonic('S'); localSmbCon.setMnemonic('L'); localNfsCon.setMnemonic('N'); //localNfsCon.setMnemonic('N'); closeLocalCon.setMnemonic('C'); //*** and here are some other menu mnemonics I thought I'd include: //*** (I'll add more if more are wanted) exit.setMnemonic('X'); proxy.setMnemonic('P'); http.setMnemonic('D'); spider.setMnemonic('H'); raw.setMnemonic('T'); readme.setMnemonic('R'); todo.setMnemonic('N'); changelog.setMnemonic('C'); hp.setMnemonic('H'); opts.setMnemonic('A'); manage.setMnemonic('M'); clear.setMnemonic('C'); clearItems.setMnemonic('F'); try { //*** end of new code section Integer intI; String stringI; char charI; for(int i = 0; i < jftp.CAPACITY; i++) { //*** I should note that functionality below only allows //*** a maximum of nine connections to be remembered //BUGFIX 1.40 //if (!(cons[i].equals("null"))) { if(!(cons[i][0].equals("null"))) { intI = new Integer(i + 1); stringI = intI.toString(); charI = stringI.charAt(0); lastConnections[i].setMnemonic(charI); //lastConnections[i].setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_C, ActionEvent.CTRL_MASK)); } } //for } catch(Exception ex) { Log.out("WARNING: AppMenuBar produced Exception, ignored it"); ex.printStackTrace(); } } //setMnemonics private void connectionSelected(int position) { //*** tokenize the string to extract the required data //*** or is this the thing done elsewhere in the code, //*** when the menu is being set up? //String connectionInfo = cons[position]; //StringTokenizer tokens = new StringTokenizer(connectionInfo); //StringTokenizer tokens = new StringTokenizer(cons[position], " ", false); // tab); String protocol; int numTokens; String htmp = new String(""); String utmp = new String(""); String ptmp = new String(""); String dtmp = new String(""); boolean useLocal = false; int potmp = 0; String potmpString = new String("0"); String useLocalString = new String("false"); /* //numTokens = tokens.countTokens(); protocol = tokens.nextToken(); htmp = tokens.nextToken(); utmp = tokens.nextToken(); ptmp = tokens.nextToken(); */ protocol = cons[position][0]; htmp = cons[position][1]; utmp = cons[position][2]; ptmp = cons[position][3]; if(ptmp.equals("")) { ptmp = UIUtils.getPasswordFromUser(JFtp.statusP.jftp); } //int j=4; //while (cons[i][j].equals(LastConnections.SENTINEL)) { // j++; //} //usingLocal = cons[i][j-1]; /* System.out.println(position); System.out.println(protocol); System.out.println(cons[position][1]); System.out.println(cons[position][2]); System.out.println(cons[position][3]); */ // if(protocol.equals("FTP")) { potmpString = cons[position][4]; dtmp = cons[position][5]; useLocalString = cons[position][6]; /* potmpString = tokens.nextToken(); dtmp = tokens.nextToken(); useLocalString = tokens.nextToken(); System.out.println(potmpString); System.out.println("FTP"); */ potmp = Integer.parseInt(potmpString); if(useLocalString.equals("true")) { useLocal = true; } else { useLocal = false; } StartConnection.startFtpCon(htmp, utmp, ptmp, potmp, dtmp, useLocal); //System.out.println(htmp + utmp + ptmp + potmpString +dtmp + useLocalString); } else if(protocol.equals("SFTP")) { /* htmp = tokens.nextToken(); utmp = tokens.nextToken(); ptmp = tokens.nextToken(); */ //useLocalString = tokens.nextToken(); //System.out.println("SFTP"); potmpString = cons[position][4]; useLocalString = cons[position][5]; //System.out.println(htmp + utmp + ptmp + useLocalString); //if (protocol == "SFTP") } else if(protocol.equals("NFS")) { useLocalString = cons[position][4]; } else if(protocol.equals("SMB")) { /* htmp = tokens.nextToken(); utmp = tokens.nextToken(); ptmp = tokens.nextToken(); */ /* dtmp = tokens.nextToken(); useLocalString = tokens.nextToken(); */ dtmp = cons[position][4]; useLocalString = cons[position][5]; //System.out.println(htmp+utmp+ptmp+dtmp + useLocalString); } //***StartConnection functionality to be put in each //***if statement potmp = Integer.parseInt(potmpString); if(useLocalString.equals("true")) { useLocal = true; } else { useLocal = false; } if(protocol.equals("SFTP")) { //BUGFIX 1.40: no longer setting port # //to 22, now potmp StartConnection.startCon(protocol, htmp, utmp, ptmp, potmp, dtmp, useLocal); } else if(!(protocol.equals("FTP"))) { //System.out.println(protocol); StartConnection.startCon(protocol, htmp, utmp, ptmp, potmp, dtmp, useLocal); } } //connectionSelected } jftp-1.52.orig/src/java/net/sf/jftp/gui/base/Properties.java0000700000175000017500000000470211112477774022770 0ustar varunvarun/* * 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. */ package net.sf.jftp.gui.base; import net.sf.jftp.*; import net.sf.jftp.gui.framework.*; import net.sf.jftp.system.logging.Log; import net.sf.jftp.util.*; import java.awt.*; import java.awt.event.*; import java.io.*; public class Properties extends HFrame implements ActionListener { private Label fileL = new Label("File: "); private Label sizeL = new Label("Size: ? bytes "); private HButton ok = new HButton("Dismiss"); private HPanel okP = new HPanel(); private String type = ""; private String file = ""; public Properties(String file, String type) { this.file = file; this.type = type; setSize(300, 110); setTitle("File properties..."); setLocation(150, 150); setLayout(new GridLayout(3, 1)); okP.add(ok); add(sizeL); add(fileL); add(okP); ok.addActionListener(this); process(); setVisible(true); } private void process() { if(type.equals("local")) { File f = new File(JFtp.localDir.getPath() + file); sizeL.setText("Size: " + Long.toString(f.length()) + " bytes"); try { fileL.setText("File: " + f.getCanonicalPath()); } catch(Exception ex) { Log.debug(ex.toString()); } sizeL.setText("Size: " + Long.toString(f.length()) + " bytes"); } if(type.equals("remote")) { fileL.setText("File: " + JFtp.remoteDir.getPath() + file); } } public void actionPerformed(ActionEvent e) { if(e.getSource() == ok) { setVisible(false); } } } jftp-1.52.orig/src/java/net/sf/jftp/gui/base/UITool.java0000700000175000017500000000374511112477774022015 0ustar varunvarun/* * 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. */ package net.sf.jftp.gui.base; import java.io.*; import javax.swing.*; public class UITool { public static boolean askToDelete(JComponent parent) { int res = JOptionPane.showConfirmDialog(parent, "Do you really want to continue?"); if((res == JOptionPane.OK_OPTION)) { return true; } else { return false; } } public static boolean askToRun(JComponent parent) { int res = JOptionPane.showConfirmDialog(parent, "Do you want to launch this file?"); if((res == JOptionPane.OK_OPTION)) { return true; } else { return false; } } public static String getPathFromDialog(String path) { JFileChooser chooser = new JFileChooser(path); chooser.setDialogTitle("Choose directory"); chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); int returnVal = chooser.showOpenDialog(new JDialog()); if(returnVal == JFileChooser.APPROVE_OPTION) { File f = chooser.getSelectedFile(); return f.getPath(); } return null; } } jftp-1.52.orig/src/java/net/sf/jftp/gui/base/StatusCanvas.java0000700000175000017500000001063111155300616023234 0ustar varunvarun/* * 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. */ package net.sf.jftp.gui.base; import net.sf.jftp.*; import net.sf.jftp.config.Settings; import net.sf.jftp.gui.framework.*; import java.awt.*; import javax.swing.*; public class StatusCanvas extends JPanel { JLabel host = new JLabel(""); JLabel separator = new JLabel(" "); JLabel text = new JLabel(Settings.greeting); String drawText = ""; int pos = 0; Image image; Graphics offg; boolean slide = false; int interval = 3; boolean fwd = false; public StatusCanvas() { setMinimumSize(new Dimension(200, 25)); setPreferredSize(new Dimension(320, 25)); setLayout(null); //setLayout(new FlowLayout(FlowLayout.LEFT)); //add(host); //add(separator); //add(text); setVisible(true); } public void setInterval(int x) { interval = x; } public void forward() { fwd = true; } public void setText(String msg) { if(false) { text.setText(msg); } else { text.setText(""); drawText = msg; slide = false; if(AppMenuBar.fadeMenu.getState()) { SwingUtilities.invokeLater(new Runnable() { public void run() { for(pos = 30; pos > 0; pos -= 1) { paintImmediately(0, 0, getSize().width, getSize().height); net.sf.jftp.system.LocalIO.pause(interval); } } }); } else { repaint(); } } validate(); } public void scrollText(String msg) { if(false) { text.setText(msg); } else { text.setText(""); drawText = msg; slide = true; if(AppMenuBar.fadeMenu.getState()) { for(pos = 700; pos > (msg.length() * -6); pos -= 1) { if(fwd) { break; } //paintImmediately(0, 0, getSize().width, getSize().height); repaint(); net.sf.jftp.system.LocalIO.pause(interval); //JFtp.statusP.jftp.validate(); } } else { repaint(); } fwd = false; } validate(); } public void setHost(String h) { host.setText(h); validate(); } public String getHost() { return host.getText(); } public void fresh() { image = null; offg = null; repaint(); } public void paintComponent(Graphics g) { if(image == null) { image = createImage(getWidth(), getHeight()); } if(offg == null) { offg = image.getGraphics(); } offg.setColor(GUIDefaults.light); offg.setFont(GUIDefaults.status); offg.fillRect(0, 0, getSize().width, getSize().height); offg.setColor(new Color(125, 125, 175)); if(!slide) { offg.drawString(drawText, 10, 15 + pos); } else { offg.drawString(drawText, 10 + pos, 15); } offg.setColor(GUIDefaults.front); offg.drawRect(0, 0, getSize().width - 1, getSize().height - 1); offg.drawRect(0, 0, getSize().width - 2, getSize().height - 2); g.drawImage(image, 0, 0, this); } public void update(Graphics g) { paintComponent(g); } } jftp-1.52.orig/src/java/net/sf/jftp/gui/base/dir/0000700000175000017500000000000011155274771020540 5ustar varunvarunjftp-1.52.orig/src/java/net/sf/jftp/gui/base/dir/DirLister.java0000700000175000017500000002745211112477774023322 0ustar varunvarun/* * 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. */ package net.sf.jftp.gui.base.dir; import net.sf.jftp.*; import net.sf.jftp.config.Settings; import net.sf.jftp.gui.framework.*; import net.sf.jftp.net.*; import net.sf.jftp.system.LocalIO; import net.sf.jftp.util.*; import java.awt.event.*; import java.io.*; import java.net.*; import java.text.*; import java.util.*; public class DirLister implements ActionListener { private int length; private String[] files; private String[] sizes; private int[] perms; private boolean isDirectory = true; public boolean finished = false; private BasicConnection con; private String sortMode = null; private Date[] dates = null; public DirLister(BasicConnection con) //String type) { this.con = con; init(); } public DirLister(BasicConnection con, String sortMode) //String type) { this.con = con; this.sortMode = sortMode; init(); } public DirLister(BasicConnection con, String sortMode, boolean hide) //String type) { this.con = con; this.sortMode = sortMode; init(); int cnt = files.length; if(hide) { for(int i=0; i 0) Log.out(files[i]+":"+v.elementAt(i)); } }*/ if(sortMode != null) { if(!sortMode.equals("Date")) { //Log.out("0"+sortMode); sortFirst(); } sort(sortMode); } else if(sortMode == null) { //Log.out("1"+sortMode); sortFirst(); } } catch(Exception ex) { ex.printStackTrace(); isDirectory = false; } finished = true; } private void sort(String type) { Vector fv = new Vector(); Vector sv = new Vector(); Vector pv = new Vector(); if(type.equals("Reverse")) { for(int i = 0; i < length; i++) { fv.add(files[i]); sv.add(sizes[i]); if(perms != null) { pv.add(new Integer(perms[i])); } } Collections.sort(fv, Collections.reverseOrder()); // Collections.sort(sv, Collections.reverseOrder()); // if(perms != null) Collections.sort(pv, Collections.reverseOrder()); Object[] filesTmp = fv.toArray(); Object[] sizesTmp = sv.toArray(); Object[] permsTmp = null; if(perms != null) { permsTmp = pv.toArray(); } for(int i = 0; i < length; i++) { files[i] = (String) filesTmp[i]; sizes[i] = (String) sizesTmp[length - i - 1]; if(perms != null) { perms[i] = ((Integer) permsTmp[length - i - 1]).intValue(); } } } else if(type.startsWith("Size")) { int cnt = 0; Hashtable processed = new Hashtable(); boolean reverse = false; if(type.endsWith("/Re")) { reverse = true; } while(cnt < length) { int idx = 0; double current = 0; if(reverse) { current = Double.MAX_VALUE; } for(int i = 0; i < length; i++) { if(processed.containsKey("" + i)) { continue; } int si = Integer.parseInt(sizes[i]); if(!reverse && (si >= current)) { //Log.out(sizes[i]+"/"+i); idx = i; current = si; } else if(reverse && (si <= current)) { idx = i; current = si; } } processed.put("" + idx, "" + sizes[idx]); fv.add(files[idx]); sv.add(sizes[idx]); //System.out.println(files[idx]+":"+sizes[idx]+":"+idx); if(perms != null) { pv.add(new Integer(perms[idx])); } cnt++; } for(int i = 0; i < length; i++) { files[i] = (String) fv.elementAt(i); sizes[i] = (String) sv.elementAt(i); if(perms != null) { perms[i] = ((Integer) pv.elementAt(i)).intValue(); } } } else if(type.equals("Date")) { String style = "ftp"; //TODO: may be slow if(!(con instanceof FtpConnection) || (((FtpConnection) con).dateVector == null) || (((FtpConnection) con).dateVector.size() < 1)) { if(!(con instanceof FilesystemConnection) || (((FilesystemConnection) con).dateVector == null) || (((FilesystemConnection) con).dateVector.size() < 1)) { } else { style = "file"; } } Object[] date = null; if(style.equals("ftp")) { date = ((FtpConnection) con).dateVector.toArray(); /* for(int v=0; v 0) // c.compareTo(c2) > 0) { return true; } else { return false; } } public void sortFirst() { String[] tmpx = new String[length]; for(int x = 0; x < length; x++) { if(perms != null) { tmpx[x] = files[x] + "@@@" + sizes[x] + "@@@" + perms[x]; //Log.debug(tmpx[x]); } else { tmpx[x] = files[x] + "@@@" + sizes[x]; } } LocalIO.sortStrings(tmpx); for(int y = 0; y < length; y++) { files[y] = tmpx[y].substring(0, tmpx[y].indexOf("@@@")); String tmp = tmpx[y].substring(tmpx[y].indexOf("@@@") + 3); sizes[y] = tmp.substring(0, tmp.lastIndexOf("@@@")); if(perms != null) { perms[y] = Integer.parseInt(tmpx[y].substring(tmpx[y].lastIndexOf("@@@") + 3)); } } } public void actionPerformed(ActionEvent e) { } public boolean isOk() { return isDirectory; } public int getLength() { return length; } public String[] list() { return files; } public String[] sList() { return sizes; } public int[] getPermissions() { return perms; } public Date[] getDates() { return dates; } } jftp-1.52.orig/src/java/net/sf/jftp/gui/base/dir/DirCellRenderer.java0000700000175000017500000001077211112477774024423 0ustar varunvarun/* * 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. */ package net.sf.jftp.gui.base.dir; import net.sf.jftp.config.Settings; import net.sf.jftp.system.logging.Log; import net.sf.jftp.gui.base.LocalDir; import net.sf.jftp.gui.base.RemoteDir; import net.sf.jftp.gui.framework.GUIDefaults; import java.awt.*; import java.awt.event.*; import java.text.*; import java.util.*; import javax.swing.*; // Display an icon and a string for each object in the list. // class DirCellRenderer extends JLabel implements ListCellRenderer { public class DirCellRenderer extends DefaultListCellRenderer { final static ImageIcon longIcon = new ImageIcon(Settings.dirImage); final static ImageIcon shortIcon = new ImageIcon(Settings.fileImage); private Object value; public DirCellRenderer() { } // This is the only method defined by ListCellRenderer. // We just reconfigure the JLabel each time we're called. public Component getListCellRendererComponent(JList list, Object value, // value to display int index, // cell index boolean isSelected, // is the cell selected boolean cellHasFocus) // the list and the cell have the focus { /* The DefaultListCellRenderer class will take care of * the JLabels text property, it's foreground and background * colors, and so on. */ super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); ImageIcon i = new ImageIcon(((DirEntry) value).getImage()); if(i == null) { System.out.println("Img null: " + ((DirEntry) value).toString() + "/" + ((DirEntry) value).getImage()); } else { setIcon((Icon) i); } this.value = value; Log.devnull(this.value); // prevents eclipse warning if(!((DirEntry) list.getModel().getElementAt(index)).getNoRender()) { String size = ""; if(Settings.showFileSize) { size = ((DirEntry) list.getModel().getElementAt(index)).getFileSize(); } setFont(GUIDefaults.monospaced); String s = value.toString(); String date = ""; if(Settings.showDateNoSize && (((DirEntry) list.getModel().getElementAt(index)).who instanceof RemoteDir)) { size = ((DirEntry) list.getModel().getElementAt(index)).getDate(); int x = 12 - size.length(); for(int j = 0; j < x; j++) { size += " "; } } else if(Settings.showLocalDateNoSize && (((DirEntry) list.getModel().getElementAt(index)).who instanceof LocalDir)) { size = ((DirEntry) list.getModel().getElementAt(index)).getDate(); int x = 12 - size.length(); for(int j = 0; j < x; j++) { size += " "; } } setText(size + s); } else { setFont(GUIDefaults.small); String s = value.toString(); setText(s); } int ok = ((DirEntry) value).getPermission(); if(ok == DirEntry.DENIED) { setForeground(GUIDefaults.deniedColor); } else if(ok == DirEntry.W) { setForeground(GUIDefaults.writableColor); } else { setForeground(GUIDefaults.defaultColor); } if(((DirEntry) value).file.equals("..")) { setBackground(GUIDefaults.cdColor); } return this; } } jftp-1.52.orig/src/java/net/sf/jftp/gui/base/dir/ColoredCellRenderer.java0000700000175000017500000000412211112477774025264 0ustar varunvarunpackage net.sf.jftp.gui.base.dir; import java.awt.Color; import java.awt.Component; import java.awt.Insets; import javax.swing.JComponent; import javax.swing.JLabel; import javax.swing.JTable; import javax.swing.border.CompoundBorder; import javax.swing.border.EmptyBorder; import javax.swing.table.DefaultTableCellRenderer; public class ColoredCellRenderer extends DefaultTableCellRenderer { public Component getTableCellRendererComponent (JTable table, Object value, boolean isSelected,boolean hasFocus, int row, int column) { Component cell = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); //System.out.println("-> "+row+"/"+column + " ("+TableUtils.STATUS_COLUMN+"), "+value); /* if(column == TableUtils.STATUS_COLUMN) { if(value == null || ((String)value) == null) { cell.setBackground(Color.RED); return cell; } String status = (String) value; if(status.equals("0")) cell.setBackground(Color.BLUE); else if(status.equals("1")) cell.setBackground(Color.GREEN); else if(status.equals("2")) cell.setBackground(Color.YELLOW); else if(status.equals("3")) cell.setBackground(Color.YELLOW); else cell.setBackground(Color.RED); } else { */ if(isSelected) cell.setBackground(table.getSelectionBackground()); else cell.setBackground(table.getBackground()); ((JComponent)cell).setBorder( new CompoundBorder( new EmptyBorder(new Insets(2,4,2,4)), ((JComponent)cell).getBorder())); //} if(column == 2 || column == 3) { setHorizontalAlignment(JLabel.RIGHT); } else { setHorizontalAlignment(JLabel.LEFT); } if(column == 3) { int x = ((DirEntry)value).getPermission(); if(x == DirEntry.R) { cell.setBackground(Color.WHITE); ((JLabel)cell).setText("r-"); } else if(x == DirEntry.W) { cell.setBackground(new Color(230,255,230)); ((JLabel)cell).setText("rw"); } else if(x == DirEntry.DENIED) { cell.setBackground(new Color(255,230,230)); ((JLabel)cell).setText("--"); } } return cell; } } jftp-1.52.orig/src/java/net/sf/jftp/gui/base/dir/DirEntry.java0000700000175000017500000002147711112477774023162 0ustar varunvarun/* * 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. */ package net.sf.jftp.gui.base.dir; import java.awt.Image; import java.awt.event.ActionListener; import java.text.DateFormat; import java.util.Date; import java.util.Hashtable; import javax.swing.ImageIcon; import javax.swing.JLabel; import net.sf.jftp.config.Settings; import net.sf.jftp.gui.framework.HImage; import net.sf.jftp.net.FtpConnection; public class DirEntry { // to check file permissions public static final int R = FtpConnection.R; public static final int W = FtpConnection.W; public static final int DENIED = FtpConnection.DENIED; static Hashtable extensionMap = new Hashtable(); final static Object[] extensions = { new String[] { Settings.textFileImage, ".txt", ".doc", ".rtf" }, new String[] { Settings.htmlFileImage, ".htm", ".html" }, new String[] { Settings.zipFileImage, ".arj", ".bz", ".bz2", ".deb", ".jar", ".gz", ".rav", ".rpm", ".tar", ".tgz", ".zip", ".z", ".iso" }, new String[] { Settings.imageFileImage, "bmp", ".gif", ".jpg", ".png", ".xbm", ".xpm" }, new String[] { Settings.codeFileImage, ".c", ".cc", ".h", ".java" }, new String[] { Settings.audioFileImage, ".au", ".mid", ".midi", ".mp3", ".wav" }, new String[] { Settings.execFileImage, ".bat", ".csh", ".cgi", ".com", ".class", ".cmd", ".csh", ".dtksh", ".exe", ".ksh", ".pdksh", ".pl", ".sh", ".tcl", ".tksh", ".zsh" }, new String[] { Settings.presentationFileImage, ".ppt" }, new String[] { Settings.spreadsheetFileImage, ".xls" }, new String[] { Settings.videoFileImage, ".asf", ".avi", ".mpg", "mpeg", ".wmf" } }; static { for(int i = 0; i < extensions.length; i++) { String[] temp = (String[]) extensions[i]; for(int j = 1; j < temp.length; j++) { extensionMap.put(temp[j], temp[0]); } } } public String file = ""; private JLabel c = new JLabel(); public boolean selected = false; public ActionListener who = null; //private boolean entered = false; private Image img; public boolean isFile = true; private boolean isDirectory = false; private long size = 0; private long transferred = 0; private boolean isLink = false; private int accessible = -1; private boolean noRender = false; public Date date = null; public DirEntry(String file, ActionListener who) { this.file = file; this.who = who; setFile(); } public void setFile() { String f = file; if((f.indexOf("<") >= 0) && (f.indexOf(">") >= 0)) { f = file.substring(file.indexOf("<") + 1); f = f.substring(0, f.lastIndexOf(">")); } int lastIndex = f.lastIndexOf("."); String image = Settings.fileImage; // default if(lastIndex != -1) { String ext = f.substring(lastIndex); String tmp = (String) extensionMap.get(ext.toLowerCase()); if(tmp != null) // we found an extension, let's use it's image { image = tmp; } } // else use the default img = HImage.getImage(c, image); if(img == null) { img = HImage.getImage(c, Settings.fileImage); } isFile = true; isDirectory = false; } public void setDirectory() { img = HImage.getImage(c, Settings.dirImage); isFile = false; isDirectory = true; } public void setNoRender() { noRender = true; } public boolean getNoRender() { return noRender; } public void setPermission(int what) { accessible = what; } public int getPermission() { return accessible; } public void setSelected(boolean state) { selected = state; } public boolean isDirectory() { return isDirectory; } public boolean isFile() { return isFile; } public boolean isSelected() { return selected; } public String toString() { return file; } public Image getImage() { return img; } public ImageIcon getImageIcon() { return new ImageIcon(img); } public void setDate(Date d) { date = d; } public String getDate() { if(date == null) { return ""; } DateFormat df = DateFormat.getDateInstance(DateFormat.SHORT); return df.format(date); } public void setFileSize(long s) { size = s; } public String getFileSize() { if(isDirectory() || (size < 0)) { return " "; } long rsize = size; String type = "bs"; if(rsize > 1024) { rsize = rsize / 1024; type = "kb"; } if(rsize > 1024) { rsize = rsize / 1024; type = "mb"; } if(rsize > 1024) { rsize = rsize / 1024; type = "gb"; } String x = Long.toString(rsize); while(x.length() < 4) { x = " " + x; } return x + " " + type + " > "; } public long getRawSize() { return size; } public void setLink() { img = HImage.getImage(c, Settings.linkImage); file = file.substring(0, file.lastIndexOf("###")); isLink = true; } public boolean isLink() { return isLink; } public long getTransferred() { return transferred; } public void setTransferred(long transferred) { this.transferred = transferred; } } jftp-1.52.orig/src/java/net/sf/jftp/gui/base/dir/TableUtils.java0000700000175000017500000002024511112477774023462 0ustar varunvarunpackage net.sf.jftp.gui.base.dir; import java.awt.BorderLayout; import java.awt.Component; import java.lang.reflect.Constructor; import java.lang.reflect.Method; import java.util.Vector; import javax.swing.ImageIcon; import javax.swing.JComponent; import javax.swing.JLabel; import javax.swing.JList; import javax.swing.JTable; import javax.swing.table.JTableHeader; import javax.swing.table.TableCellRenderer; import javax.swing.table.TableColumn; import javax.swing.table.TableColumnModel; import javax.swing.table.TableModel; import javax.swing.table.TableRowSorter; import net.sf.jftp.config.Settings; public class TableUtils { /** * Setzt die Breite der TableColumns. * * Quelle: http://www.chka.de/swing/table/cell-sizes.html * * @param table */ public static void calcColumnWidths(JTable table) { JTableHeader header = table.getTableHeader(); TableCellRenderer defaultHeaderRenderer = null; if (header != null) defaultHeaderRenderer = header.getDefaultRenderer(); TableColumnModel columns = table.getColumnModel(); TableModel data = table.getModel(); int margin = columns.getColumnMargin(); // only JDK1.3 int rowCount = data.getRowCount(); int totalWidth = 0; for (int i = columns.getColumnCount() - 1; i >= 0; --i) { TableColumn column = columns.getColumn(i); int columnIndex = column.getModelIndex(); int width = -1; TableCellRenderer h = column.getHeaderRenderer(); if (h == null) h = defaultHeaderRenderer; if (h != null) // Not explicitly impossible { Component c = h.getTableCellRendererComponent (table, column.getHeaderValue(), false, false, -1, i); width = c.getPreferredSize().width; } for (int row = rowCount - 1; row >= 0; --row) { TableCellRenderer r = table.getCellRenderer(row, i); Component c = r.getTableCellRendererComponent (table, data.getValueAt(row, columnIndex), false, false, row, i); width = Math.max(width, c.getPreferredSize().width); } if (width >= 0) column.setPreferredWidth(width + margin); // <1.3: without margin else ; // ??? totalWidth += column.getPreferredWidth(); } // only <1.3: totalWidth += columns.getColumnCount() * columns.getColumnMargin(); /* If you like; This does not make sense for two many columns! Dimension size = table.getPreferredScrollableViewportSize(); size.width = totalWidth; table.setPreferredScrollableViewportSize(size); */ // table.sizeColumnsToFit(-1); <1.3; possibly even table.revalidate() // if (header != null) // header.repaint(); only makes sense when the header is visible (only <1.3) } public static void setFixedWidths(JTable table) { JTableHeader header = table.getTableHeader(); TableCellRenderer defaultHeaderRenderer = null; if (header != null) defaultHeaderRenderer = header.getDefaultRenderer(); TableColumnModel columns = table.getColumnModel(); TableModel data = table.getModel(); int rowCount = data.getRowCount(); for (int i = 0; i 0 ? ((Vector)list.getModel().getElementAt(0)).size() : 0); return 4; } public int getRowCount() { return list.getModel().getSize(); } public Object getValueAt(int row, int col) { if(list.getModel().getSize() == 0) return ""+null; DirEntry ret = (DirEntry) list.getModel().getElementAt(row); if(col == 0) return ret.getImageIcon(); else if(col == 1) return ret.toString(); else if(col == 2) { String tmp = ""+ret.getFileSize(); String r = tmp.replaceAll(" >", ""); return r; } else if(col == 3) { return ret; } //System.out.println(">>> "+ret.get(col)+" -> "+(ret.get(col) instanceof Status)); //return ret.size() > col ? ret.get(col) : ""; return ret; } }; return dataModel; } /** * F?hrt Updates auf einen beliebigen JTable durch. * * list muss hierzu vom Typ Vector sein. * * @param list * @param listTbl */ public static void layoutTable(JList list, JTable listTbl) { layoutTable(list, listTbl, null); } /** * F?hrt Updates auf einen beliebigen JTable durch. * * list muss hierzu vom Typ Vector sein. */ public static void layoutTable(JList list, JTable listTbl, Vector names) { listTbl.setModel(generateTableModel(list)); if(Settings.useFixedTableWidths) { setFixedWidths(listTbl); } else { calcColumnWidths(listTbl); } if(names != null) modifyTableHeader(listTbl.getTableHeader(), names); // 1.6+ only tryToEnableRowSorting(listTbl); //listTbl.doLayout(); } public static void tryToEnableRowSorting(JTable listTbl) { TableRowSorter sorter = new TableRowSorter(listTbl.getModel()); listTbl.setRowSorter(sorter); } /** * Setzt den Header einer JTable * @param head * @param columnNames */ public static void modifyTableHeader(JTableHeader head, Vector columnNames) { TableColumnModel m = head.getColumnModel(); if(m.getColumnCount() != columnNames.size()) { System.out.println("Column mismatch: "+m.getColumnCount()+"/"+columnNames.size()); return; } for(int i=0; i 0) { fSize[y] = tmp.substring(0, tmp.lastIndexOf("@@@")); } else { fSize[y] = tmp; } if(perms != null) { perms[y] = Integer.parseInt(tmpx[y].substring(tmpx[y].lastIndexOf("@@@") + 3)); } } } */ // ----------- end sorting -------------------- for(int i = 0; i < length; i++) { //System.out.println(files[i]); if((files == null) || (files[i] == null)) { //System.out.println("Critical error, files or files[i] is null!\nPlease report when and how this happened..."); System.out.println("skipping setDirList, files or files[i] is null!"); return; //System.exit(0); } //Log.debug("adding: " + files[i]); dirEntry[i] = new DirEntry(files[i], this); if(dirEntry[i] == null) { System.out.println("\nskipping setDirList, dirEntry[i] is null!"); return; } if(dirEntry[i].file == null) { System.out.println("\nskipping setDirList, dirEntry[i].file is null!"); return; } if(perms != null) { dirEntry[i].setPermission(perms[i]); } if(fSize[i].startsWith("@")) { fSize[i] = fSize[i].substring(1); } dirEntry[i].setFileSize(Long.parseLong(fSize[i])); if(dirEntry[i].file.endsWith("/")) { dirEntry[i].setDirectory(); } else { dirEntry[i].setFile(); } if(dirEntry[i].file.endsWith("###")) { dirEntry[i].setLink(); } //------ date parser ------- Object[] d = dir.getDates(); if(d != null) { dirEntry[i].setDate((Date) d[i]); } //-------------------------- jlm.addElement(dirEntry[i]); } } else { Log.debug("Not a directory: " + path); } } //System.out.println("length: "+dirEntry.length); } jl.setModel(jlm); jl.grabFocus(); jl.setSelectedIndex(0); //Log.debug("ListModel set."); //System.out.print("x"); //new Exception().printStackTrace(); //System.out.println("\n\n\n"); update(); } /** * Handles the user events if the ui is unlocked */ public void actionPerformed(ActionEvent e) { if(JFtp.uiBlocked) { return; } if(e.getActionCommand().equals("rm")) { lock(false); if(Settings.getAskToDelete()) { if(!UITool.askToDelete(this)) { unlock(false); return; } } for(int i = 0; i < length; i++) { if(dirEntry[i].selected) { con.removeFileOrDir(dirEntry[i].file); } } unlock(false); fresh(); } else if(e.getActionCommand().equals("mkdir")) { Creator c = new Creator("Create:", con); //TODO: do we need this on events? UpdateDaemon.updateRemoteDirGUI(); //fresh(); } else if(e.getActionCommand().equals("cmd")) { if(!(con instanceof FtpConnection)) { Log.debug("This feature is for ftp only."); return; } int opt = JOptionPane.showOptionDialog(this, "Would you like to type one command or to open a shell?","Question", JOptionPane.DEFAULT_OPTION, JOptionPane.QUESTION_MESSAGE, new ImageIcon(HImage.getImage(this, Settings.helpImage)), new String[] {"Shell","Command", "Cancel"}, "Command"); if(opt == 1) { RemoteCommand rc = new RemoteCommand(); } else if(opt == 0) { FtpConnection conn = (FtpConnection) con; Shell s = new Shell(conn.getCommandInputReader(), conn.getCommandOutputStream()); } //fresh(); } else if(e.getActionCommand().equals("cd")) { PathChanger pthc = new PathChanger("remote"); //fresh(); //String tmp = UITool.getPathFromDialog(); //setPath(tmp); } else if(e.getActionCommand().equals("fresh")) { fresh(); } else if(e.getActionCommand().equals("->")) { blockedTransfer(-2); } else if(e.getActionCommand().equals("<-")) { blockedTransfer(-2); } else if(e.getActionCommand().equals("list")) { try { if(!(con instanceof FtpConnection)) { Log.debug("Can only list FtpConnection output!"); } PrintStream out = new PrintStream(Settings.ls_out); for(int i=0; i<((FtpConnection)con).currentListing.size(); i++) { out.println(((FtpConnection)con).currentListing.get(i)); } out.flush(); out.close(); java.net.URL url = new java.io.File(Settings.ls_out).toURL(); Displayer d = new Displayer(url, new Font("monospaced",Font.PLAIN, 11)); JFtp.desktop.add(d, new Integer(Integer.MAX_VALUE - 13)); } catch(java.net.MalformedURLException ex) { ex.printStackTrace(); Log.debug("ERROR: Malformed URL!"); } catch(FileNotFoundException ex2) { ex2.printStackTrace(); Log.debug("ERROR: File not found!"); } } else if(e.getActionCommand().equals("type") && (!JFtp.uiBlocked)) { if(!(con instanceof FtpConnection)) { Log.debug("You can only set the transfer type for ftp connections."); return; } FtpConnection c = (FtpConnection) con; String t = c.getTypeNow(); boolean ret = false; if(t.equals(FtpConnection.ASCII)) { ret = c.type(FtpConnection.BINARY); } else if(t.equals(FtpConnection.BINARY)) { ret = c.type(FtpConnection.EBCDIC); } if(t.equals(FtpConnection.EBCDIC) || (!ret && !t.equals(FtpConnection.L8))) { ret = c.type(FtpConnection.L8); } if(!ret) { c.type(FtpConnection.ASCII); Log.debug("Warning: type should be \"I\" if you want to transfer binary files!"); } Log.debug("Type is now " + c.getTypeNow()); } else if(e.getActionCommand().equals("que")) /*&& (!JFtp.uiBlocked))*/ { if(!(con instanceof FtpConnection)) { Log.debug("Queue supported only for FTP"); return; } Object[] o = jl.getSelectedValues(); DirEntry[] tmp = new DirEntry[Array.getLength(o)]; for(int i = 0; i < Array.getLength(o); i++) { tmp[i] = (DirEntry) o[i]; JFtp.dQueue.addFtp(tmp[i].toString()); } } else if(e.getSource() == props) { JFtp.statusP.jftp.clearLog(); int x = currentPopup.getPermission(); String tmp; if(x == FtpConnection.R) { tmp = "read only"; } else if(x == FtpConnection.W) { tmp = "read/write"; } else if(x == FtpConnection.DENIED) { tmp = "denied"; } else { tmp = "undefined"; } String msg = "File: " + currentPopup.toString() + "\n" + " Size: " + currentPopup.getFileSize() + " raw size: " + currentPopup.getRawSize() + "\n" + " Symlink: " + currentPopup.isLink() + "\n" + " Directory: " + currentPopup.isDirectory() + "\n" + " Permission: " + tmp + "\n"; Log.debug(msg); } else if(e.getSource() == sorter) { sortMode = (String) sorter.getSelectedItem(); if(sortMode.equals("Date")) { Settings.showDateNoSize = true; } else { Settings.showDateNoSize = false; } fresh(); } else if(e.getActionCommand().equals("cdUp")) { JFtp.remoteDir.getCon().chdir(".."); } else if(e.getActionCommand().equals("rn")) { Object[] target = jl.getSelectedValues(); if((target == null) || (target.length == 0)) { Log.debug("No file selected"); return; } else if(target.length > 1) { Log.debug("Too many files selected"); return; } String val = JOptionPane.showInternalInputDialog(this, "Choose a name..."); if(val != null) { if(!con.rename(target[0].toString(), val)) { Log.debug("Rename failed."); } else { Log.debug("Successfully renamed."); fresh(); } } } } /** * Initiate a tranfer with ui locking enabled */ public synchronized void blockedTransfer(int index) { tmpindex = index; Runnable r = new Runnable() { public void run() { boolean block = !Settings.getEnableMultiThreading(); if(!(con instanceof FtpConnection)) { block = true; } if(block) { lock(false); } transfer(tmpindex); if(block) { JFtp.localDir.fresh(); unlock(false); } } }; Thread t = new Thread(r); t.start(); } /** * Lock the gui. */ public void lock(boolean first) { JFtp.uiBlocked = true; jl.setEnabled(false); if(!first) { JFtp.localDir.lock(true); } Log.out("ui locked."); } /** * Unlock the gui. */ public void unlock(boolean first) { JFtp.uiBlocked = false; jl.setEnabled(true); if(!first) { JFtp.localDir.unlock(true); } Log.out("ui unlocked."); } /** * Do a hard UI refresh - do no longe call this directly, use * safeUpdate() instead if possible. */ public void fresh() { Log.out("fresh() called."); Cursor x = null; if(JFtp.mainFrame != null) { x = JFtp.mainFrame.getCursor(); JFtp.mainFrame.setCursor(Cursor.WAIT_CURSOR); } //TODO .debug("fresh()"); String i = ""; int idx = jl.getSelectedIndex(); if(idx >= 0) { Object o = jl.getSelectedValue(); if(o != null) { i = o.toString(); } } con.chdir(path); if((idx >= 0) && (idx < jl.getModel().getSize())) { if(jl.getModel().getElementAt(idx).toString().equals(i)) { jl.setSelectedIndex(idx); } else { jl.setSelectedIndex(0); } } update(); if((JFtp.mainFrame != null) && (x.getType() != Cursor.WAIT_CURSOR)) { JFtp.mainFrame.setCursor(Cursor.DEFAULT_CURSOR); } } /** * Called by FtpConnection, DownloadList is updated from here */ public void updateProgress(String file, String type, long bytes) { if((dList == null) || (dirEntry == null) || file == null) { return; } boolean flag = false; if(file.endsWith("/") && (file.length() > 1)) { flag = true; file = file.substring(0, file.lastIndexOf("/")); } file = file.substring(file.lastIndexOf("/") + 1); if(flag) { file = file + "/"; } long s = 0; if(JFtp.dList.sizeCache.containsKey(file)) { s = ((Long) JFtp.dList.sizeCache.get(file)).longValue(); } else { for(int i = 0; i < dirEntry.length; i++) { if(dirEntry[i] == null) { continue; } if(dirEntry[i].toString().equals(file)) { s = dirEntry[i].getRawSize(); JFtp.dList.sizeCache.put(file, new Long(s)); break; } } if(s <= 0) { File f = new File(JFtp.localDir.getPath() + file); if(f.exists()) { s = f.length(); } } } dList.updateList(file, type, bytes, s); } /** * Called by FtpConnection */ public void connectionInitialized(BasicConnection con) { if(con == null) { return; } setDate(); Log.out("remote connection initialized"); } /** * Called by FtpConnection */ public void connectionFailed(BasicConnection con, String reason) { Log.out("remote connection failed"); if((Integer.parseInt(reason) == FtpConnection.OFFLINE) && Settings.reconnect) { return; } //this.con = con; HFrame h = new HFrame(); h.getContentPane().setLayout(new BorderLayout(10, 10)); h.setTitle("Connection failed!"); h.setLocation(150, 200); JTextArea text = new JTextArea(); h.getContentPane().add("Center", text); text.setText(" ---------------- Output -----------------\n" + JFtp.log.getText()); JFtp.log.setText(""); text.setEditable(false); h.pack(); h.show(); } private void setDate() { if(!(con instanceof FtpConnection) && !(con instanceof FilesystemConnection)) { try { sorter.removeItem("Date"); } catch(Exception ex) { } dateEnabled = false; return; } //Log.debug(">>> date gui init"); if((con instanceof FtpConnection) && (((FtpConnection) con).dateVector.size() > 0)) { if(!dateEnabled) { sorter.addItem("Date"); dateEnabled = true; UpdateDaemon.updateRemoteDirGUI(); } } else if((con instanceof FilesystemConnection) && (((FilesystemConnection) con).dateVector.size() > 0)) { if(!dateEnabled) { sorter.addItem("Date"); dateEnabled = true; UpdateDaemon.updateRemoteDirGUI(); } } else { if(dateEnabled) { try { sorter.removeItem("Date"); dateEnabled = false; Settings.showDateNoSize = false; UpdateDaemon.updateRemoteDirGUI(); } catch(Exception ex) { } } } } /** * Called by FtpConnection */ public void updateRemoteDirectory(BasicConnection c) { //TODO Log.debug("updateRemoteDirectory()"); if(con == null) { return; } if((c != con) && !c.hasUploaded && con instanceof FtpConnection) { //System.out.println("Skipping connection: " + con.getCachedPWD() + " : " + JFtp.remoteDir.path); return; } //Log.out(">>> update remote dir"); setDate(); if(con instanceof FtpConnection) { path = ((FtpConnection) con).getCachedPWD(); } else if(con instanceof SmbConnection && !path.startsWith("smb://")) { path = c.getPWD(); } else { path = con.getPWD(); } //System.out.println("path: "+path +":"+ con +":" +con.getPWD() +":"+c+":" +c.getPWD()); if((c != null) && (c instanceof FtpConnection)) { FtpConnection con = (FtpConnection) c; String tmp = con.getCachedPWD(); SaveSet s = new SaveSet(Settings.login_def, con.getHost(), con.getUsername(), con.getPassword(), Integer.toString(con.getPort()), tmp, con.getLocalPath()); } else if((c != null) && (c instanceof FilesystemConnection)) { JFtp.localDir.getCon().setLocalPath(path); } //TODO .debug("before gui()"); //Log.debug(c.toString()); pathChanged = true; gui(false); UpdateDaemon.updateLog(); //JFtp.statusP.jftp.ensureLogging(); //TODO .debug("after gui()"); } /** * Transfers all selected files */ public synchronized void transfer() { boolean[] bFileSelected = new boolean[dirEntry.length + 1]; DirEntry[] cacheEntry = new DirEntry[dirEntry.length]; System.arraycopy(dirEntry, 0, cacheEntry, 0, cacheEntry.length); for(int i = 0; i < dirEntry.length; i++) { bFileSelected[i] = cacheEntry[i].selected; if(!cacheEntry[i].equals(dirEntry[i])) { Log.out("mismatch"); } } for(int i = 0; i < cacheEntry.length; i++) { if(bFileSelected[i]) { startTransfer(cacheEntry[i]); } } } /** * Start a file transfer. * Depending on the local and remote connection types some things like * local working directory have to be set, resuming may have to be checked etc. * As with ftp to ftp transfers the action used to download a file might actually be * an upload. * * WARNING: If you do anything here, please check LocalDir.startTransfer(), too! */ public void startTransfer(DirEntry entry) { if(con instanceof FtpConnection && JFtp.localDir.getCon() instanceof FtpConnection) { if(entry.isDirectory()) { Log.debug("Directory transfer between remote connections is not supported yet!"); return; } Log.out("direct ftp transfer started (download)"); ((FtpConnection) JFtp.localDir.getCon()).upload(entry.file, ((FtpConnection) JFtp.remoteDir.getCon()).getDownloadInputStream(path + entry.file)); } else if(con instanceof FtpConnection && JFtp.localDir.getCon() instanceof FilesystemConnection) { // local: file, remote: ftp int status = checkForExistingFile(entry); if(status >= 0) { //-------------------------------------------- // dirty bugfix for sizes that would be // messed up otherwise /* boolean flag = false; String file = entry.file; if(file.endsWith("/") && (file.length() > 1)) { flag = true; file = file.substring(0, file.lastIndexOf("/")); } file = file.substring(file.lastIndexOf("/") + 1); if(flag) { file = file + "/"; } */ long s = entry.getRawSize(); JFtp.dList.sizeCache.put(entry.file, new Long(s)); // --------------------------------- if((entry.getRawSize() < Settings.smallSize) && !entry.isDirectory()) { con.download(entry.file); } else { con.handleDownload(path + entry.file); } } } else if(con instanceof FilesystemConnection && JFtp.localDir.getCon() instanceof FtpConnection) { try { File f = new File(path + entry.file); FileInputStream in = new FileInputStream(f); JFtp.localDir.getCon().setLocalPath(path); Log.debug(JFtp.localDir.getCon().getPWD()); ((FtpConnection) JFtp.localDir.getCon()).upload(entry.file, in); } catch(FileNotFoundException ex) { Log.debug("Error: File not found: " + path + entry.file); } } else if(con instanceof FilesystemConnection && JFtp.localDir.getCon() instanceof FilesystemConnection) { con.download(path + entry.file); JFtp.localDir.actionPerformed(con, ""); } else if(JFtp.localDir.getCon() instanceof FilesystemConnection) { // local: file, remote: smb, sftp, nfs con.handleDownload(entry.file); JFtp.localDir.actionPerformed(con, ""); } else { if(entry.isDirectory()) { Log.debug("Directory transfer between remote connections is not supported yet!"); return; } Log.out("direct transfer started (download)"); JFtp.localDir.getCon().upload(entry.file, JFtp.remoteDir.getCon() .getDownloadInputStream(path + entry.file)); JFtp.localDir.actionPerformed(con, "FRESH"); } } /** * Transfers single file, or all selected files if index is -1 */ public void transfer(int i) { if(i == -2) { transfer(); return; } else if(dirEntry[i].selected) { startTransfer(dirEntry[i]); } } /** * Ask for resuming or overwrite if a local file does already exist for a download */ private int checkForExistingFile(DirEntry dirEntry) { File f = new File(JFtp.localDir.getPath() + dirEntry.file); if(f.exists() && Settings.enableResuming && Settings.askToResume) { ResumeDialog r = new ResumeDialog(dirEntry); // ResumeDialog handels the rest return -1; } return 1; } /** * Called by FtpConnection */ public void actionFinished(BasicConnection c) { JFtp.localDir.actionPerformed(c, "LOWFRESH"); if(c instanceof FtpConnection) { if(((FtpConnection) c).hasUploaded) { Log.out("actionFinished called by upload: " + c); //fresh(); UpdateDaemon.updateRemoteDir(); } Log.out("actionFinished called by download: " + c); } else { Log.out("actionFinished called by: " + c); //fresh(); UpdateDaemon.updateRemoteDir(); } //JFtp.statusP.jftp.ensureLogging(); UpdateDaemon.updateLog(); } /** * Called by FtpConnection */ public void actionPerformed(Object target, String msg) { if(msg.equals(type)) { UpdateDaemon.updateRemoteDirGUI(); //gui(true); //updateRemoteDirectory(con); } else if(msg.equals("FRESH")) { UpdateDaemon.updateRemoteDir(); //fresh(); } //Log.out("actionPerformed called."); //JFtp.statusP.jftp.ensureLogging(); UpdateDaemon.updateLog(); } /** * Mime type handler for doubleclicks on files */ public void showContentWindow(String url, DirEntry d) { try { if(d.getRawSize() > 200000) { Log.debug("File is too big - 200kb is the maximum, sorry."); return; } String path = JFtp.localDir.getPath(); if(!path.endsWith("/")) { path = path + "/"; } if(!new File(path + StringUtils.getFile(url)).exists()) { con.download(url); } else { Log.debug("\nRemote file must be downloaded to be viewed and\n" + " you already have a local copy present, pleasen rename it\n" + " and try again."); return; } File file = new File(JFtp.localDir.getPath() + StringUtils.getFile(url)); if(!file.exists()) { Log.debug("File not found: " + JFtp.localDir.getPath() + StringUtils.getFile(url)); } HFrame f = new HFrame(); f.setTitle(url); JEditorPane pane = new JEditorPane("file://" + file.getAbsolutePath()); if(!pane.getEditorKit().getContentType().equals("text/html") && !pane.getEditorKit().getContentType().equals("text/rtf")) { if(!pane.getEditorKit().getContentType().equals("text/plain")) { Log.debug("Nothing to do with this filetype - use the buttons if you want to transfer files."); return; } pane.setEditable(false); } JScrollPane jsp = new JScrollPane(pane); f.getContentPane().setLayout(new BorderLayout()); f.getContentPane().add("Center", jsp); f.setModal(false); f.setLocation(100, 100); f.setSize(600, 400); //f.pack(); f.show(); dList.fresh(); JFtp.localDir.getCon().removeFileOrDir(StringUtils.getFile(url)); JFtp.localDir.fresh(); } catch(Exception ex) { Log.debug("File error: " + ex); } } public void keyPressed(KeyEvent e) { if(e.getKeyCode() == KeyEvent.VK_ENTER) { Object o = jl.getSelectedValue(); if(o == null) { return; } String tmp = ((DirEntry) o).toString(); if(tmp.endsWith("/")) { con.chdir(tmp); } else { showContentWindow(path + tmp, (DirEntry) o); } } else if(e.getKeyCode() == KeyEvent.VK_SPACE) { int x = ((DirPanel) JFtp.localDir).jl.getSelectedIndex(); if(x == -1) { x = 0; } ((DirPanel) JFtp.localDir).jl.grabFocus(); ((DirPanel) JFtp.localDir).jl.setSelectedIndex(x); } } public void keyReleased(KeyEvent e) { } public void keyTyped(KeyEvent e) { } } jftp-1.52.orig/src/java/net/sf/jftp/gui/base/LocalDir.java0000700000175000017500000013207011112477774022325 0ustar varunvarun/* * 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. */ package net.sf.jftp.gui.base; import java.awt.BorderLayout; import java.awt.Cursor; import java.awt.FlowLayout; import java.awt.Insets; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.io.BufferedInputStream; import java.io.BufferedOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.StreamTokenizer; import java.util.Date; import java.util.Enumeration; import java.util.Hashtable; import java.util.zip.ZipEntry; import java.util.zip.ZipFile; import javax.swing.DefaultListModel; import javax.swing.ImageIcon; import javax.swing.JComboBox; import javax.swing.JEditorPane; import javax.swing.JLabel; import javax.swing.JList; import javax.swing.JMenuItem; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JPopupMenu; import javax.swing.JScrollPane; import javax.swing.JToolBar; import javax.swing.SwingUtilities; import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; import net.sf.jftp.JFtp; import net.sf.jftp.config.SaveSet; import net.sf.jftp.config.Settings; import net.sf.jftp.gui.base.dir.DirCanvas; import net.sf.jftp.gui.base.dir.DirCellRenderer; import net.sf.jftp.gui.base.dir.DirComponent; import net.sf.jftp.gui.base.dir.DirEntry; import net.sf.jftp.gui.base.dir.DirLister; import net.sf.jftp.gui.base.dir.DirPanel; import net.sf.jftp.gui.base.dir.TableUtils; import net.sf.jftp.gui.framework.HImage; import net.sf.jftp.gui.framework.HImageButton; import net.sf.jftp.gui.framework.HPanel; import net.sf.jftp.gui.tasks.Creator; import net.sf.jftp.gui.tasks.ImageViewer; import net.sf.jftp.gui.tasks.NameChooser; import net.sf.jftp.gui.tasks.RemoteCommand; import net.sf.jftp.net.BasicConnection; import net.sf.jftp.net.ConnectionListener; import net.sf.jftp.net.FilesystemConnection; import net.sf.jftp.net.FtpConnection; import net.sf.jftp.net.wrappers.SmbConnection; import net.sf.jftp.system.LocalIO; import net.sf.jftp.system.StringUtils; import net.sf.jftp.system.UpdateDaemon; import net.sf.jftp.system.logging.Log; import net.sf.jftp.util.ZipFileCreator; public class LocalDir extends DirComponent implements ListSelectionListener, ActionListener, ConnectionListener, KeyListener { static final String deleteString = "rm"; static final String mkdirString = "mkdir"; static final String refreshString = "fresh"; static final String cdString = "cd"; static final String cmdString = "cmd"; static final String downloadString = "<-"; static final String uploadString = "->"; static final String zipString = "zip"; static final String cpString = "cp"; static final String rnString = "rn"; static final String cdUpString = "cdUp"; HImageButton deleteButton; HImageButton mkdirButton; HImageButton cmdButton; HImageButton refreshButton; HImageButton cdButton; HImageButton uploadButton; HImageButton zipButton; HImageButton cpButton; HImageButton rnButton; private DirCanvas label = new DirCanvas(this); private boolean pathChanged = true; private boolean firstGui = true; private int pos = 0; private JPanel p = new JPanel(); private JToolBar buttonPanel = new JToolBar() { public Insets getInsets() { return new Insets(0, 0, 0, 0); } }; private JToolBar currDirPanel = new JToolBar() { public Insets getInsets() { return new Insets(0, 0, 0, 0); } }; private DefaultListModel jlm; private JScrollPane jsp = new JScrollPane(jl); private int tmpindex = -1; private Hashtable dummy = new Hashtable(); private JPopupMenu popupMenu = new JPopupMenu(); private JMenuItem runFile = new JMenuItem("Launch file"); private JMenuItem viewFile = new JMenuItem("View file"); private JMenuItem props = new JMenuItem("Properties"); private DirEntry currentPopup = null; private String sortMode = null; String[] sortTypes = new String[] { "Normal", "Reverse", "Size", "Size/Re" }; private JComboBox sorter = new JComboBox(sortTypes); HImageButton cdUpButton; private boolean dateEnabled = false; /** * LocalDir constructor. */ public LocalDir() { type = "local"; con = new FilesystemConnection(); con.addConnectionListener(this); } /** * LocalDir constructor. */ public LocalDir(String path) { type = "local"; this.path = path; con = new FilesystemConnection(); con.addConnectionListener(this); con.chdir(path); //gui(false); } /** * Creates the gui and adds the MouseListener etc. */ public void gui_init() { setLayout(new BorderLayout()); currDirPanel.setFloatable(false); buttonPanel.setFloatable(false); FlowLayout f = new FlowLayout(FlowLayout.RIGHT); f.setHgap(1); f.setVgap(2); buttonPanel.setLayout(f); buttonPanel.setMargin(new Insets(0, 0, 0, 0)); runFile.addActionListener(this); viewFile.addActionListener(this); props.addActionListener(this); popupMenu.add(runFile); popupMenu.add(viewFile); popupMenu.add(props); deleteButton = new HImageButton(Settings.deleteImage, deleteString, "Delete selected", this); deleteButton.setToolTipText("Delete selected"); mkdirButton = new HImageButton(Settings.mkdirImage, mkdirString, "Create a new directory", this); mkdirButton.setToolTipText("Create directory"); refreshButton = new HImageButton(Settings.refreshImage, refreshString, "Refresh current directory", this); refreshButton.setToolTipText("Refresh directory"); refreshButton.setRolloverIcon(new ImageIcon(HImage.getImage(this, Settings.refreshImage2))); refreshButton.setRolloverEnabled(true); cdButton = new HImageButton(Settings.cdImage, cdString, "Change directory", this); cdButton.setToolTipText("Change directory"); uploadButton = new HImageButton(Settings.uploadImage, uploadString, "Upload selected", this); uploadButton.setToolTipText("Upload selected"); zipButton = new HImageButton(Settings.zipFileImage, zipString, "Add selected to new zip file", this); zipButton.setToolTipText("Create zip"); cpButton = new HImageButton(Settings.copyImage, cpString, "Copy selected files to another local dir", this); cpButton.setToolTipText("Local copy selected"); rnButton = new HImageButton(Settings.textFileImage, rnString, "Rename selected file or directory", this); rnButton.setToolTipText("Rename selected"); cdUpButton = new HImageButton(Settings.cdUpImage, cdUpString, "Go to Parent Directory", this); cdUpButton.setToolTipText("Go to Parent Directory"); label.setText("Filesystem: " + StringUtils.cutPath(path)); label.setSize(getSize().width - 10, 24); currDirPanel.add(label); currDirPanel.setSize(getSize().width - 10, 32); label.setSize(getSize().width - 20, 24); p.setLayout(new BorderLayout()); p.add("North", currDirPanel); buttonPanel.add(sorter); buttonPanel.add(new JLabel(" ")); buttonPanel.add(refreshButton); buttonPanel.add(new JLabel(" ")); buttonPanel.add(cpButton); buttonPanel.add(rnButton); buttonPanel.add(mkdirButton); buttonPanel.add(cdButton); buttonPanel.add(deleteButton); buttonPanel.add(cdUpButton); buttonPanel.add(new JLabel(" ")); buttonPanel.add(zipButton); buttonPanel.add(new JLabel(" ")); buttonPanel.add(uploadButton); buttonPanel.setVisible(true); buttonPanel.setSize(getSize().width - 10, 32); //JPanel sortPanel = new JPanel(); p.add("East", buttonPanel); //p.add("West", sortPanel); sorter.addActionListener(this); add("North", p); setDirList(true); jlm = new DefaultListModel(); jl = new JList(jlm); jl.setCellRenderer(new DirCellRenderer()); jl.setVisibleRowCount(Settings.visibleFileRows); // add this becaus we need to fetch only doubleclicks MouseListener mouseListener = new MouseAdapter() { public void mousePressed(MouseEvent e) { if(JFtp.uiBlocked) { return; } if(e.isPopupTrigger() || SwingUtilities.isRightMouseButton(e)) { int index = jl.getSelectedIndex() - 1; if(index < -1) { return; } String tgt = (String) jl.getSelectedValue().toString(); if(index < 0) { } else if((dirEntry == null) || (dirEntry.length < index) || (dirEntry[index] == null)) { return; } else { currentPopup = dirEntry[index]; popupMenu.show(e.getComponent(), e.getX(), e.getY()); } } } public void mouseClicked(MouseEvent e) { if(JFtp.uiBlocked) { return; } if(Settings.getUseJTableLayout()) { TableUtils.copyTableSelectionsToJList(jl, table); } //System.out.println("DirEntryListener::"); if(e.getClickCount() == 2) { //System.out.println("2xList selection: "+jl.getSelectedValue().toString()); int index = jl.getSelectedIndex() - 1; // mousewheel bugfix, ui refresh bugfix if(index < -1) { return; } String tgt = (String) jl.getSelectedValue().toString(); //System.out.println("List selection: "+index); if(index < 0) { chdir(path + tgt); } else if((dirEntry == null) || (dirEntry.length < index) || (dirEntry[index] == null)) { return; } else if(dirEntry[index].isDirectory()) { if(JFtp.mainFrame != null) { JFtp.mainFrame.setCursor(Cursor.WAIT_CURSOR); } chdir(path + tgt); if(JFtp.mainFrame != null) { JFtp.mainFrame.setCursor(Cursor.DEFAULT_CURSOR); } } else { showContentWindow(path + dirEntry[index].toString(), dirEntry[index]); //blockedTransfer(index); } } } }; if(Settings.newTableGui) { jsp = new JScrollPane(table); table.getSelectionModel().addListSelectionListener(this); table.addMouseListener(mouseListener); } else { jsp = new JScrollPane(jl); jl.addListSelectionListener(this); jl.addKeyListener(this); jl.addMouseListener(mouseListener); jl.requestFocus(); } jsp.setSize(getSize().width - 20, getSize().height - 72); add("Center", jsp); jsp.setVisible(true); TableUtils.tryToEnableRowSorting(table); if(Settings.IS_JAVA_1_6) { //sorter.setVisible(false); buttonPanel.remove(sorter); } setVisible(true); } public void setViewPort() { } /** * Part of a gui refresh. * There's no need to call this by hand. */ public void gui(boolean fakeInit) { if(firstGui) { gui_init(); firstGui = false; } if(con instanceof FilesystemConnection) { label.setText("Filesystem: " + StringUtils.cutPath(path)); } else { label.setText("Remote: " + StringUtils.cutPath(path)); } if(!fakeInit) { setDirList(false); } invalidate(); validate(); } /** * List directory and create/update the whole file list. * There's no need to call this by hand. */ public void setDirList(boolean fakeInit) { jlm = new DefaultListModel(); DirEntry dwn = new DirEntry("..", this); dwn.setDirectory(); jlm.addElement(dwn); if(!fakeInit) { if(pathChanged) { pathChanged = false; DirLister dir = new DirLister(con, sortMode, Settings.getHideLocalDotNames()); while(!dir.finished) { LocalIO.pause(10); } if(dir.isOk()) { length = dir.getLength(); dirEntry = new DirEntry[length]; files = dir.list(); String[] fSize = dir.sList(); int[] perms = dir.getPermissions(); // --------- sorting aphabetically ------------ // is now in DirLister /* if(Settings.sortDir) { String[] tmpx = new String[length]; //if(fSize != null) System.out.println(":"+length+":"+fSize.length+":"+files.length); int pLength = length; if(perms != null) { pLength = perms.length; } //System.out.println(files.length + ":" + fSize.length+":"+ pLength + ":"+ length); if((fSize.length != files.length) || (pLength != files.length) || (length != files.length)) { System.out.println("Sort mismatch - hopefully ignoring it..."); } for(int x = 0; x < length; x++) { if(perms != null) { tmpx[x] = files[x] + "@@@" + fSize[x] + "@@@" + perms[x]; } else { tmpx[x] = files[x] + "@@@" + fSize[x]; } } LocalIO.sortStrings(tmpx); for(int y = 0; y < length; y++) { files[y] = tmpx[y].substring(0, tmpx[y].indexOf("@@@")); String tmp = tmpx[y].substring(tmpx[y].indexOf("@@@") + 3); fSize[y] = tmp.substring(0, tmp.lastIndexOf("@@@")); if(perms != null) { perms[y] = Integer.parseInt(tmpx[y].substring(tmpx[y].lastIndexOf("@@@") + 3)); } } } */ // ----------- end sorting -------------------- for(int i = 0; i < length; i++) { if((files == null) || (files[i] == null)) { //System.out.println("Critical error, files or files[i] is null!\nPlease report when and how this happened..."); System.out.println("skipping setDirList, files or files[i] is null!"); return; //System.exit(0); } dirEntry[i] = new DirEntry(files[i], this); if(dirEntry[i] == null) { System.out.println("\nskipping setDirList, dirEntry[i] is null!"); return; } if(dirEntry[i].file == null) { System.out.println("\nskipping setDirList, dirEntry[i].file is null!"); return; } if(perms != null) { dirEntry[i].setPermission(perms[i]); } if(fSize[i].startsWith("@")) { fSize[i] = fSize[i].substring(1); } dirEntry[i].setFileSize(Long.parseLong(fSize[i])); if(dirEntry[i].file.endsWith("/")) { dirEntry[i].setDirectory(); } else { dirEntry[i].setFile(); } //------ date parser ------- Object[] d = dir.getDates(); if(d != null) { dirEntry[i].setDate((Date) d[i]); } //-------------------------- jlm.addElement(dirEntry[i]); } } else { Log.debug("Not a directory: " + path); } } //System.out.println("length: "+dirEntry.length); } jl.setModel(jlm); update(); } // 20011213:rb - Added logic for MSDOS style root dir /** * Change the directory of this connection and update the gui */ public boolean chdir(String p) { if((JFtp.remoteDir == null) || (p == null) || p.trim().equals("")) { return false; } BasicConnection c = JFtp.remoteDir.getCon(); if((c != null) && (c instanceof FtpConnection)) { FtpConnection con = (FtpConnection) c; //con.setLocalPath(path); SaveSet s = new SaveSet(Settings.login_def, con.getHost(), con.getUsername(), con.getPassword(), Integer.toString(con.getPort()), con.getCachedPWD(), con.getLocalPath()); } if(con.chdirNoRefresh(p)) { path = con.getPWD(); if(con instanceof FilesystemConnection) { JFtp.remoteDir.getCon().setLocalPath(path); //con.fireDirectoryUpdate(con); //OR setDate(); } pathChanged = true; gui(false); return true; } //Log.debug("CWD (local) : " + p); return false; } /** * Handles the user events if the ui is unlocked */ public void actionPerformed(ActionEvent e) { if(JFtp.uiBlocked) { return; } if(e.getActionCommand().equals("rm")) { lock(false); if(Settings.getAskToDelete()) { if(!UITool.askToDelete(this)) { unlock(false); return; } } for(int i = 0; i < length; i++) { if(dirEntry[i].selected) { con.removeFileOrDir(dirEntry[i].file); } } unlock(false); fresh(); } else if(e.getActionCommand().equals("mkdir")) { Creator c = new Creator("Create:", con); //fresh(); } else if(e.getActionCommand().equals("cmd")) { RemoteCommand rc = new RemoteCommand(); //fresh(); } else if(e.getActionCommand().equals("cd")) { String tmp = UITool.getPathFromDialog(path); chdir(tmp); } else if(e.getActionCommand().equals("fresh")) { fresh(); } else if(e.getActionCommand().equals("cp")) { Object[] o = jl.getSelectedValues(); if(o == null) { return; } String tmp = UITool.getPathFromDialog(path); if(tmp == null) { return; } if(!tmp.endsWith("/")) { tmp = tmp + "/"; } try { copy(o, path, "", tmp); //fresh(); Log.debug("Copy finished..."); } catch(Exception ex) { ex.printStackTrace(); Log.debug("Copy failed!"); } } else if(e.getActionCommand().equals("zip")) { try { Object[] entry = jl.getSelectedValues(); if(entry == null) { return; } String[] tmp = new String[entry.length]; for(int i = 0; i < tmp.length; i++) { tmp[i] = entry[i].toString(); } NameChooser n = new NameChooser(); String name = n.text.getText(); ZipFileCreator z = new ZipFileCreator(tmp, path, name); fresh(); } catch(Exception ex) { ex.printStackTrace(); } } else if(e.getActionCommand().equals("->")) { blockedTransfer(-2); } else if(e.getActionCommand().equals("<-")) { blockedTransfer(-2); } else if(e.getActionCommand().equals("rn")) { Object[] target = jl.getSelectedValues(); if((target == null) || (target.length == 0)) { Log.debug("No file selected"); return; } else if(target.length > 1) { Log.debug("Too many files selected"); return; } //Renamer r = new Renamer(target[0].toString(), path); //fresh(); String val = JOptionPane.showInternalInputDialog(JFtp.desktop, "Choose a name..."); if(val != null) { if(!con.rename(target[0].toString(), val)) { Log.debug("Rename failed."); } else { Log.debug("Successfully renamed."); fresh(); } } } else if(e.getSource() == props) { JFtp.statusP.jftp.clearLog(); int x = currentPopup.getPermission(); String tmp; if(x == FtpConnection.R) { tmp = "read only"; } else if(x == FtpConnection.W) { tmp = "read/write"; } else if(x == FtpConnection.DENIED) { tmp = "denied"; } else { tmp = "undefined"; } String msg = "File: " + currentPopup.toString() + "\n" + " Size: " + currentPopup.getFileSize() + " raw size: " + currentPopup.getRawSize() + "\n" + " Symlink: " + currentPopup.isLink() + "\n" + " Directory: " + currentPopup.isDirectory() + "\n" + " Permission: " + tmp + "\n"; Log.debug(msg); } else if(e.getSource() == viewFile) { if(currentPopup.isDirectory()) { Log.debug("This is a directory, not a file."); return; } String url = JFtp.localDir.getPath() + currentPopup.toString(); showContentWindow(url, currentPopup); } else if(e.getSource() == runFile) { if(currentPopup.isDirectory()) { Log.debug("This is a directory, not a file."); return; } String url = JFtp.localDir.getPath() + currentPopup.toString(); showContentWindow("popup-run@"+url, currentPopup); } else if(e.getSource() == sorter) { sortMode = (String) sorter.getSelectedItem(); if(sortMode.equals("Date")) { Settings.showLocalDateNoSize = true; } else { Settings.showLocalDateNoSize = false; } fresh(); } else if(e.getActionCommand().equals("cdUp")) { chdir(".."); } } private void copy(Object[] fRaw, String path, String offset, String target) throws Exception { String[] files = new String[fRaw.length]; for(int j = 0; j < fRaw.length; j++) { files[j] = fRaw[j].toString(); } for(int i = 0; i < files.length; i++) { File f = new File(path + offset + files[i]); BufferedInputStream in = null; BufferedOutputStream out = null; byte[] buf = new byte[4096]; if(f.exists() && !f.isDirectory()) { in = new BufferedInputStream(new FileInputStream(path + offset + files[i])); out = new BufferedOutputStream(new FileOutputStream(target + offset + files[i])); int len = 0; while(in != null) { len = in.read(buf); if(len == StreamTokenizer.TT_EOF) { break; } out.write(buf, 0, len); } out.flush(); out.close(); } else if(f.exists()) { if(!files[i].endsWith("/")) { files[i] = files[i] + "/"; } File f2 = new File(target + offset + files[i]); if(!f.exists()) { f.mkdir(); } copy(f.list(), path, offset + files[i], target); } } } /** * Initiate a tranfer with ui locking enabled */ public synchronized void blockedTransfer(int index) { tmpindex = index; Runnable r = new Runnable() { public void run() { // --------------- local ------------------- boolean block = !Settings.getEnableMultiThreading(); if(!(con instanceof FtpConnection)) { block = true; } if(block || Settings.getNoUploadMultiThreading()) { lock(false); } transfer(tmpindex); if(block || Settings.getNoUploadMultiThreading()) { unlock(false); } //{ //JFtp.remoteDir.fresh(); //unlock(false); //} } }; Thread t = new Thread(r); t.start(); } /** * Lock the gui. */ public void lock(boolean first) { JFtp.uiBlocked = true; jl.setEnabled(false); if(!first) { JFtp.remoteDir.lock(true); } } /** * Unlock the gui. */ public void unlock(boolean first) { JFtp.uiBlocked = false; jl.setEnabled(true); if(!first) { JFtp.remoteDir.unlock(true); } } /** * Do a hard UI refresh - do no longer call this directly, use * safeUpdate() instead. */ public void fresh() { if(JFtp.mainFrame != null) { JFtp.mainFrame.setCursor(Cursor.WAIT_CURSOR); } String i = ""; int idx = jl.getSelectedIndex(); if(idx >= 0) { Object o = jl.getSelectedValue(); if(o != null) { i = o.toString(); } } chdir(path); if((idx >= 0) && (idx < jl.getModel().getSize())) { if(jl.getModel().getElementAt(idx).toString().equals(i)) { jl.setSelectedIndex(idx); } else { jl.setSelectedIndex(0); } } update(); if(JFtp.mainFrame != null) { JFtp.mainFrame.setCursor(Cursor.DEFAULT_CURSOR); } } /** * Transfers all selected files */ public synchronized void transfer() { boolean[] bFileSelected = new boolean[dirEntry.length + 1]; DirEntry[] cacheEntry = new DirEntry[dirEntry.length]; System.arraycopy(dirEntry, 0, cacheEntry, 0, cacheEntry.length); for(int i = 0; i < dirEntry.length; i++) { bFileSelected[i] = cacheEntry[i].selected; if(!cacheEntry[i].equals(dirEntry[i])) { Log.out("mismatch"); } } for(int i = 0; i < cacheEntry.length; i++) { if(bFileSelected[i]) { startTransfer(cacheEntry[i]); } } } /** * Start a file transfer. * Depending on the local and remote connection types some things like * local working directory have to be set, resuming may have to be checked etc. * As with ftp to ftp transfers the action used to download a file might actually be * an upload. * * WARNING: If you do anything here, please check RemoteDir.startTransfer(), too! */ public void startTransfer(DirEntry entry) { if(con instanceof FilesystemConnection && JFtp.remoteDir.getCon() instanceof FtpConnection) { if((entry.getRawSize() < Settings.smallSizeUp) && !entry.isDirectory()) { JFtp.remoteDir.getCon().upload(path + entry.file); } else { JFtp.remoteDir.getCon().handleUpload(path + entry.file); } } else if(con instanceof FtpConnection && JFtp.remoteDir.getCon() instanceof FtpConnection) { // local: ftp, remote: ftp if(entry.isDirectory()) { Log.debug("Directory transfer between remote connections is not supported yet!"); return; } Log.out("direct ftp transfer started (upload)"); ((FtpConnection) JFtp.remoteDir.getCon()).upload(entry.file, ((FtpConnection) JFtp.localDir.getCon()).getDownloadInputStream(path + entry.file)); } else if(con instanceof FtpConnection && JFtp.remoteDir.getCon() instanceof FilesystemConnection) { con.setLocalPath(JFtp.remoteDir.getPath()); con.handleDownload(path + entry.file); } else if(con instanceof FilesystemConnection && JFtp.remoteDir.getCon() instanceof FilesystemConnection) { con.upload(entry.file); JFtp.remoteDir.actionPerformed(con, "FRESH"); } else if(con instanceof FilesystemConnection) { // local: file, remote: smb,sftp,nfs JFtp.remoteDir.getCon().handleUpload(entry.file); JFtp.remoteDir.actionPerformed(con, "FRESH"); } else { if(entry.isDirectory()) { Log.debug("Directory transfer between remote connections is not supported yet!"); return; } Log.out("direct transfer started (upload)"); JFtp.remoteDir.getCon().upload(entry.file, JFtp.localDir.getCon() .getDownloadInputStream(path + entry.file)); JFtp.remoteDir.actionPerformed(con, "FRESH"); } } /** * Transfers single file, or all selected files if index is -1 */ public void transfer(int i) { if(i == -2) { transfer(); return; } else if(dirEntry[i].selected) { startTransfer(dirEntry[i]); } } /** * Safely refresh the UI. */ public void safeUpdate() { UpdateDaemon.updateLocalDir(); } /** * Called by FtpConnection */ public void actionPerformed(Object target, String msg) { //System.out.print(msg); //fresh(); safeUpdate(); } /** * Called by FtpConnection, DownloadList is updated from here */ public void updateProgress(String file, String type, long bytes) // only for url-downloads, for other see RemoteDir { if((dList == null) || (dirEntry == null) || file == null) { return; } boolean flag = false; if(file.endsWith("/") && (file.length() > 1)) { flag = true; file = file.substring(0, file.lastIndexOf("/")); } file = file.substring(file.lastIndexOf("/") + 1); if(flag) { file = file + "/"; } long s = 0; if(JFtp.dList.sizeCache.containsKey(file)) { s = ((Long) JFtp.dList.sizeCache.get(file)).longValue(); } else { s = new File(getPath() + file).length(); JFtp.dList.sizeCache.put(file, new Long(s)); } dList.updateList(file, type, bytes, s); } /** * Called by FtpConnection */ public void connectionInitialized(BasicConnection con) { } /** * Called by FtpConnection */ public void actionFinished(BasicConnection con) { //fresh(); safeUpdate(); } /** * Called by FtpConnection */ public void connectionFailed(BasicConnection con, String reason) { } private void setDate() { if(!(con instanceof FtpConnection) && !(con instanceof FilesystemConnection)) { try { sorter.removeItem("Date"); } catch(Exception ex) { } dateEnabled = false; return; } //Log.debug(">>> date gui init (local)"); if((con instanceof FtpConnection) && (((FtpConnection) con).dateVector.size() > 0)) { if(!dateEnabled) { sorter.addItem("Date"); dateEnabled = true; UpdateDaemon.updateRemoteDirGUI(); } } else if((con instanceof FilesystemConnection) && (((FilesystemConnection) con).dateVector.size() > 0)) { if(!dateEnabled) { sorter.addItem("Date"); dateEnabled = true; UpdateDaemon.updateRemoteDirGUI(); } } else { if(dateEnabled) { sorter.removeItem("Date"); dateEnabled = false; Settings.showLocalDateNoSize = false; UpdateDaemon.updateRemoteDirGUI(); } } } /** * Called by FtpConnection */ public void updateRemoteDirectory(BasicConnection c) { if(con instanceof FtpConnection) { path = ((FtpConnection) con).getCachedPWD(); } else if(con instanceof SmbConnection && !path.startsWith("smb://")) { path = con.getPWD(); } else { path = con.getPWD(); } //Log.out(">>> update local dir"); //fresh(); safeUpdate(); } /** * Extract a zip file and change to the directory */ private void setZipFilePath(DirEntry entry) { if(JFtp.mainFrame != null) { JFtp.mainFrame.setCursor(Cursor.WAIT_CURSOR); } String n = entry.toString(); String tmp = path + n + "-dir/"; Log.debug("\nExtracting: " + path + n); File tmpDir = new File(tmp); if(tmpDir.exists() || tmpDir.mkdir()) { try { ZipFile z = new ZipFile(path + n); Enumeration e = z.entries(); while(e.hasMoreElements()) { ZipEntry z1 = (ZipEntry) e.nextElement(); Log.debug("-> " + z1.getName()); BufferedInputStream in = new BufferedInputStream(z.getInputStream(z1)); BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(tmp + z1.getName())); byte[] buf = new byte[8192]; while(in.read(buf, 0, 8192) != StreamTokenizer.TT_EOF) { out.write(buf); } out.flush(); out.close(); in.close(); } chdir(tmp); } catch(IOException ex) { ex.printStackTrace(); Log.debug("ERROR: " + ex); } } else { Log.debug("Cannot create directory, skipping extraction..."); } //chdir(path + tgt); if(JFtp.mainFrame != null) { JFtp.mainFrame.setCursor(Cursor.DEFAULT_CURSOR); } } /** * Mime type handler for doubleclicks on files */ public void showContentWindow(String url, DirEntry d) { //------- popup -> run if(Settings.runtimeCommands > 0 && url.startsWith("popup-run@")) { String ext = url.substring(10); try { System.out.println("xx: "+ext); if(!Settings.askToRun || (Settings.askToRun && UITool.askToRun(this))) UIUtils.runCommand(ext); } catch(Exception ex) { Log.out("Could not launch file: "+ ext); } return; } //------------ if(d.toString().endsWith(".zip")) { setZipFilePath(d); } else { try { url = "file://" + url; // -------- images ---------- String ext = url.toLowerCase(); if(ext.endsWith(".jpg") || ext.endsWith(".gif") || ext.endsWith(".jpeg") || ext.endsWith(".png")) { ImageViewer d1 = new ImageViewer(url); JFtp.desktop.add(d1, new Integer(Integer.MAX_VALUE - 11)); return; } if(Settings.runtimeCommands > 1) { try { if(!Settings.askToRun || (Settings.askToRun && UITool.askToRun(this))) { UIUtils.runCommand(ext); return; } } catch(Exception ex) { Log.out("Could not launch file: "+ ext); } } // ----------------- if(d.getRawSize() > 200000) { Log.debug("File is too big - 200kb is the maximum, sorry."); return; } HPanel f = new HPanel(); JEditorPane pane = new JEditorPane(url); pane.setEditable(false); if(!pane.getEditorKit().getContentType().equals("text/html") && !pane.getEditorKit().getContentType().equals("text/rtf")) { if(!pane.getEditorKit().getContentType().equals("text/plain")) { Log.debug("Nothing to do with this filetype - use the buttons if you want to transfer files."); return; } pane.setEditable(false); } JScrollPane jsp = new JScrollPane(pane); f.setLayout(new BorderLayout()); f.add("Center", jsp); JFtp.statusP.jftp.addToDesktop(url, f, 600, 400); } catch(Exception ex) { Log.debug("File error: " + ex); } } } public void keyPressed(KeyEvent e) { if(e.getKeyCode() == KeyEvent.VK_ENTER) { Object o = jl.getSelectedValue(); if(o == null) { return; } String tmp = ((DirEntry) o).toString(); if(tmp.endsWith("/") || tmp.equals("..")) { chdir(tmp); } else { showContentWindow(path + tmp, (DirEntry) o); } } else if(e.getKeyCode() == KeyEvent.VK_SPACE) { int x = ((DirPanel) JFtp.remoteDir).jl.getSelectedIndex(); if(x == -1) { x = 0; } ((DirPanel) JFtp.remoteDir).jl.grabFocus(); ((DirPanel) JFtp.remoteDir).jl.setSelectedIndex(x); } } public void keyReleased(KeyEvent e) { } public void keyTyped(KeyEvent e) { } } jftp-1.52.orig/src/java/net/sf/jftp/gui/base/DownloadList.java0000700000175000017500000004027011206340454023223 0ustar varunvarun/* * 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. */ package net.sf.jftp.gui.base; import java.awt.BorderLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Enumeration; import java.util.Hashtable; import javax.swing.ImageIcon; import javax.swing.JLabel; import javax.swing.JScrollPane; import net.sf.jftp.JFtp; import net.sf.jftp.config.Settings; import net.sf.jftp.gui.base.dir.DirEntry; import net.sf.jftp.gui.base.dir.DirPanel; import net.sf.jftp.gui.framework.HImage; import net.sf.jftp.gui.framework.HImageButton; import net.sf.jftp.gui.framework.HPanel; import net.sf.jftp.gui.framework.ProgressBarList; import net.sf.jftp.gui.framework.ProgressbarItem; import net.sf.jftp.net.ConnectionHandler; import net.sf.jftp.net.DataConnection; import net.sf.jftp.net.Transfer; import net.sf.jftp.net.wrappers.HttpTransfer; import net.sf.jftp.system.LocalIO; import net.sf.jftp.system.UpdateDaemon; import net.sf.jftp.system.logging.Log; public class DownloadList extends HPanel implements ActionListener { //private HImageButton rotate = new HImageButton(Settings.cmdImage,"rotate","Toggle selected transfer...",this); //private int rotator = 0; //private static final String SEP = "--> "; public Hashtable sizeCache = new Hashtable(); //private JTextArea text = new JTextArea(); //private JList text = new JList(); private ProgressBarList list = new ProgressBarList(); private Hashtable downloads = new Hashtable(); //private boolean working = false; private long oldtime = 0; private HImageButton resume = new HImageButton(Settings.resumeImage, "resume", "Resume selected transfer...", this); private HImageButton pause = new HImageButton(Settings.pauseImage, "pause", "Pause selected transfer...", this); private HImageButton cancel = new HImageButton(Settings.deleteImage, "delete", "Cancel selected transfer...", this); private HImageButton clear = new HImageButton(Settings.clearImage, "clear", "Remove old/stalled items from output...", this); public DownloadList() { setLayout(new BorderLayout()); resume.setRolloverIcon(new ImageIcon(HImage.getImage(this, Settings.resumeImage2))); resume.setRolloverEnabled(true); pause.setRolloverIcon(new ImageIcon(HImage.getImage(this, Settings.pauseImage2))); pause.setRolloverEnabled(true); clear.setRolloverIcon(new ImageIcon(HImage.getImage(this, Settings.clearImage2))); clear.setRolloverEnabled(true); cancel.setRolloverIcon(new ImageIcon(HImage.getImage(this, Settings.deleteImage2))); cancel.setRolloverEnabled(true); //text.setCellRenderer(new DirCellRenderer()); HPanel cmdP = new HPanel(); // cmdP.add(rotate); cmdP.add(clear); cmdP.add(new JLabel(" ")); cmdP.add(resume); cmdP.add(pause); cmdP.add(new JLabel(" ")); cmdP.add(cancel); clear.setSize(24, 24); clear.setBorder(true); cancel.setSize(24, 24); cancel.setBorder(true); // rotate.setSize(24,24); // rotate.setBorder(true); resume.setSize(24, 24); resume.setBorder(true); pause.setSize(24, 24); pause.setBorder(true); //*** MY ADDITIONS clear.setToolTipText("Remove old/stalled items from output..."); resume.setToolTipText("Resume selected transfer..."); pause.setToolTipText("Pause selected transfer..."); cancel.setToolTipText("Cancel selected transfer..."); //*** //JScrollPane dP = new JScrollPane(text); JScrollPane dP = new JScrollPane(list); add("South", cmdP); add("Center", dP); } public void fresh() { downloads = new Hashtable(); updateArea(); } public void actionPerformed(ActionEvent e) { if(e.getActionCommand().equals("delete")) { deleteCon(); } else if(e.getActionCommand().equals("clear") || (e.getSource() == AppMenuBar.clearItems)) { //FtpConnection con = JFtp.getControlConnection(); //JFtp.getConnectionHandler().fireProgressClear(con); fresh(); } // else if(e.getActionCommand().equals("rotate")) // { // rotator++; // if(rotator >= downloads.size()) rotator = 0; // } else if(e.getActionCommand().equals("pause")) { pauseCon(); } else if(e.getActionCommand().equals("resume")) { resumeCon(); } } private void deleteCon() { try { String cmd = getActiveItem(); if(cmd == null) { return; } if((cmd.indexOf(Transfer.QUEUED) >= 0) || (cmd.indexOf(Transfer.PAUSED) >= 0)) { cmd = getFile(cmd); try { Transfer d = (Transfer) JFtp.getConnectionHandler() .getConnections().get(cmd); if(d == null) { return; } d.work = false; d.pause = false; } catch(Exception ex) { ex.printStackTrace(); } } else { cmd = getFile(cmd); ConnectionHandler h = JFtp.getConnectionHandler(); //Enumeration e =h.getConnections().keys(); //while(e.hasMoreElements()) Log.out("available transfer: " + (String) e.nextElement()); Object o = h.getConnections().get(cmd); Log.out("aborting transfer: " + cmd); Log.out("connection handler present: " + h + ", pool size: " + h.getConnections().size()); if(o instanceof HttpTransfer) { Transfer d = (Transfer) o; d.work = false; updateList(cmd, DataConnection.FAILED, -1, -1); return; } else { Transfer d = (Transfer) o; DataConnection con = d.getDataConnection(); con.getCon().work = false; try { con.sock.close(); //con.getCon().abort(); //if(Settings.getEnableMultiThreading()) con.getCon().disconnect(); } catch(Exception ex) { ex.printStackTrace(); //System.out.println("no socket close"); } } LocalIO.pause(500); updateList(getRawFile(getActiveItem()), DataConnection.FAILED, -1, -1); } } catch(Exception ex) { Log.debug("Action is not supported for this connection."); ex.printStackTrace(); } } // fake pause, it disconnects instead private void pauseCon() { try { String cmd = getActiveItem(); if(cmd == null) { return; } if((cmd.indexOf(DataConnection.GET) >= 0) || (cmd.indexOf(DataConnection.PUT) >= 0)) { cmd = getFile(cmd); Object o = JFtp.getConnectionHandler().getConnections().get(cmd); if(o == null) { return; } Transfer d = (Transfer) o; d.pause = true; DataConnection con = d.getDataConnection(); try { con.sock.close(); } catch(Exception ex) { ex.printStackTrace(); } d.prepare(); } } catch(Exception ex) { Log.debug("Action is not supported for this connection."); } } private void resumeCon() { try { String cmd = getActiveItem(); if(cmd == null) { return; } if((cmd.indexOf(Transfer.PAUSED) >= 0) || (cmd.indexOf(Transfer.QUEUED) >= 0)) { cmd = getFile(cmd); try { Object o = JFtp.getConnectionHandler().getConnections().get(cmd); if(o == null) { return; } Transfer d = (Transfer) o; d.work = true; d.pause = false; } catch(Exception ex) { ex.printStackTrace(); } } } catch(Exception ex) { Log.debug("Action is not supported for this connection."); } } private String getActiveItem() { //String tmp = (String) text.getSelectedValue().toString(); String tmp = (String) ((ProgressbarItem)(list.getSelectedValue())).getDirEntry().toString(); if(tmp == null) { return ""; } else { return tmp; } } public synchronized void updateList(String file, String type, long bytes, long size) { String message = type + ": <" + file + "> "; if(!safeUpdate()) { if(!type.startsWith(DataConnection.DFINISHED) && !type.startsWith(DataConnection.FINISHED) && !type.startsWith(DataConnection.FAILED) && !type.startsWith(Transfer.PAUSED) && !type.startsWith(Transfer.REMOVED)) { return; } } // directory int count = 0; if(type.startsWith(DataConnection.GETDIR) || type.startsWith(DataConnection.PUTDIR) || type.startsWith(DataConnection.PUTDIR) || type.startsWith(DataConnection.DFINISHED)) { //System.out.println(type); String tmp = type.substring(type.indexOf(":") + 1); type = type.substring(0, type.indexOf(":")); count = Integer.parseInt(tmp); message = type + ": <" + file + "> "; } // fetch size from remote panel if(type.equals(DataConnection.GET)) { DirEntry[] e = ((DirPanel)JFtp.remoteDir).dirEntry; for(int i=0; i 0) { tmp = Long.toString(s); } else { tmp = "?"; } //System.out.println(message); if(type.equals(DataConnection.GET) || type.equals(DataConnection.PUT)) { message = message + (bytes / 1024) + " / " + tmp + " kb"; list.setTransferred(file, (bytes/1024), message, s); } else if(type.equals(DataConnection.GETDIR) || type.equals(DataConnection.PUTDIR)) { message = message + (bytes / 1024) + " kb of file #" + count; list.setTransferred(file, (bytes/1024), message, -1); } else if(type.startsWith(DataConnection.DFINISHED)) { message = message + " " + count + " files."; } if(type.equals(DataConnection.FINISHED) || type.startsWith(DataConnection.DFINISHED)) { try { JFtp.getConnectionHandler().removeConnection(file); } catch(Exception ex) { // SMB does not need this } UpdateDaemon.updateCall(); } else if(type.equals(DataConnection.FAILED)) { UpdateDaemon.updateCall(); } // downloads.put(file, message); DirEntry d = null; if(downloads.containsKey(message)) { d = (DirEntry) downloads.get(message); } else { d = new DirEntry(message, null); d.setNoRender(); if(getFile(tmp).endsWith("/")) { d.setDirectory(); } d.setFileSize(size); } d.setTransferred(bytes); downloads.put(file, d); updateArea(); } private synchronized DirEntry[] toArray() { DirEntry[] f = new DirEntry[downloads.size()]; int i = 0; Enumeration k = downloads.elements(); while(k.hasMoreElements()) { Object o = k.nextElement(); if(o instanceof DirEntry) { f[i] = (DirEntry) o; } else { String tmp = (String) o; DirEntry d = new DirEntry(tmp, null); if(getFile(tmp).endsWith("/")) { d.setDirectory(); } d.setNoRender(); f[i] = d; } i++; } return f; } private synchronized void updateArea() { int idx = list.getSelectedIndex(); DirEntry[] f = toArray(); list.setListData(f); if((f.length == 1) && (idx < 0)) { list.setSelectedIndex(0); } else { list.setSelectedIndex(idx); } list.revalidate(); list.repaint(); } private String getFile(String msg) { String f = msg; if(msg.indexOf("<") >= 0 && msg.indexOf(">") >= 0) { f = msg.substring(msg.indexOf("<") + 1); f = f.substring(0, f.lastIndexOf(">")); } //System.out.println(f); return getRealName(f); } private String getRealName(String file) { //System.out.println(">>>"+file); try { Enumeration e = JFtp.getConnectionHandler().getConnections().keys(); while(e.hasMoreElements()) { String tmp = (String) e.nextElement(); //System.out.println(tmp); if(tmp.endsWith(file)) { return tmp; } } } catch(Exception ex) { // SMB does not need this } return file; } private String getRawFile(String msg) { String f = msg.substring(msg.indexOf("<") + 1); f = f.substring(0, f.lastIndexOf(">")); //System.out.println(f); return f; } private boolean safeUpdate() { long time = System.currentTimeMillis(); if((time - oldtime) < Settings.refreshDelay) { return false; } oldtime = time; return true; } } jftp-1.52.orig/src/java/net/sf/jftp/gui/base/StatusPanel.java0000700000175000017500000001740211112477774023100 0ustar varunvarun/* * 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. */ package net.sf.jftp.gui.base; import net.sf.jftp.JFtp; import net.sf.jftp.config.Settings; import net.sf.jftp.gui.framework.*; import net.sf.jftp.gui.hostchooser.HostChooser; import net.sf.jftp.gui.hostchooser.NfsHostChooser; import net.sf.jftp.gui.hostchooser.SftpHostChooser; import net.sf.jftp.gui.hostchooser.SmbHostChooser; import net.sf.jftp.gui.hostchooser.WebdavHostChooser; import net.sf.jftp.gui.tasks.HttpBrowser; import net.sf.jftp.net.*; import net.sf.jftp.net.wrappers.HttpTransfer; import net.sf.jftp.util.*; import java.awt.*; import java.awt.event.*; import java.util.*; import javax.swing.*; public class StatusPanel extends HPanel implements ActionListener { public static StatusCanvas status = new StatusCanvas(); private HImageButton newcon = new HImageButton(Settings.hostImage, "newcon", "Add FTP Connection...", this); private HImageButton smbcon = new HImageButton(Settings.openImage, "smbcon", "Add SMB Connection...", this); private HImageButton sftpcon = new HImageButton(Settings.sftpImage, "sftpcon", "Add SFTP Connection...", this); private HImageButton nfscon = new HImageButton(Settings.nfsImage, "nfscon", "Add NFS Connection...", this); private HImageButton webdavcon = new HImageButton(Settings.webdavImage, "webdavcon", "Add WebDAV Connection...", this); public HImageButton close = new HImageButton(Settings.closeImage, "close", "Close active tab...", this); private HImageButton go = new HImageButton(Settings.refreshImage, "go", "Download URL now...", this); private JTextField address = new JTextField("http://", 30); public JFtp jftp; public StatusPanel(JFtp jftp) { this.jftp = jftp; setLayout(new BorderLayout()); JToolBar bar = new JToolBar(); /* FlowLayout f = new FlowLayout(FlowLayout.LEFT); f.setHgap(1); f.setVgap(2); bar.setLayout(f); bar.setMargin(new Insets(0,0,0,0)); */ Insets in = bar.getMargin(); bar.setMargin(new Insets(in.top + 2, in.left + 4, in.bottom + 2, in.right + 4)); bar.add(newcon); newcon.setSize(24, 24); newcon.setToolTipText("New FTP Connection..."); bar.add(new JLabel(" ")); bar.add(smbcon); smbcon.setSize(24, 24); smbcon.setToolTipText("New SMB Connection..."); bar.add(new JLabel(" ")); bar.add(sftpcon); sftpcon.setSize(24, 24); sftpcon.setToolTipText("New SFTP Connection..."); bar.add(new JLabel(" ")); bar.add(nfscon); nfscon.setSize(24, 24); nfscon.setToolTipText("New NFS Connection..."); bar.add(new JLabel(" ")); if(Settings.enableWebDav) bar.add(webdavcon); webdavcon.setSize(24, 24); webdavcon.setToolTipText("New WebDAV Connection..."); bar.add(new JLabel(" ")); bar.add(close); close.setSize(24, 24); close.setToolTipText("Close Active Remote tab..."); bar.add(new JLabel(" ")); address.addActionListener(this); bar.add(new JLabel("URL: ")); bar.add(address); bar.add(new JLabel(" ")); bar.add(go); //*** go.setToolTipText("Download URL Now..."); //*** bar.add(new JLabel(" ")); //bar.add(status); add("North", bar); validate(); setFont(GUIDefaults.menuFont); setVisible(true); } public void status(String msg) { status.setText(msg); } public String getHost() { return status.getHost(); } public void setHost(String host) { status.setHost(host); } public void actionPerformed(ActionEvent e) { if(e.getActionCommand().equals("go") || (e.getSource() == address)) { Vector listeners = new Vector(); listeners.add(JFtp.localDir); String url = address.getText().trim(); startTransfer(url, JFtp.localDir.getPath(), listeners, JFtp.getConnectionHandler()); } else if(e.getActionCommand().equals("smbcon")) { //jftp.safeDisconnect(); SmbHostChooser hc = new SmbHostChooser(); hc.toFront(); //hc.setModal(true); hc.update(); } else if(e.getActionCommand().equals("sftpcon")) { //jftp.safeDisconnect(); SftpHostChooser hc = new SftpHostChooser(); hc.toFront(); //hc.setModal(true); hc.update(); } else if(e.getActionCommand().equals("nfscon")) { //jftp.safeDisconnect(); NfsHostChooser hc = new NfsHostChooser(); hc.toFront(); //hc.setModal(true); hc.update(); } else if(e.getActionCommand().equals("webdavcon")) { //jftp.safeDisconnect(); WebdavHostChooser hc = new WebdavHostChooser(); hc.toFront(); //hc.setModal(true); hc.update(); } else if(e.getActionCommand().equals("close")) { jftp.closeCurrentTab(); } else if(e.getActionCommand().equals("newcon") && (!jftp.uiBlocked)) { // jftp.safeDisconnect(); // Switch windows // jftp.mainFrame.setVisible(false); HostChooser hc = new HostChooser(); hc.toFront(); //hc.setModal(true); hc.update(); } } public void startTransfer(String url, String localPath, Vector listeners, ConnectionHandler handler) { if(url.startsWith("ftp://") && (url.endsWith("/") || (url.lastIndexOf("/") < 10))) { jftp.safeDisconnect(); HostChooser hc = new HostChooser(); hc.update(url); } else if(url.startsWith("http://") && (url.endsWith("/") || (url.lastIndexOf("/") < 10))) { HttpBrowser h = new HttpBrowser(url); JFtp.desktop.add(h, new Integer(Integer.MAX_VALUE)); } else { HttpTransfer t = new HttpTransfer(url, localPath, listeners, handler); } } public Insets getInsets() { Insets in = super.getInsets(); return new Insets(in.top, in.left, in.bottom, in.right); } } jftp-1.52.orig/src/java/net/sf/jftp/gui/base/UIUtils.java0000700000175000017500000000422711112477774022174 0ustar varunvarun/* * 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. */ package net.sf.jftp.gui.base; import java.io.BufferedInputStream; import java.io.BufferedOutputStream; import javax.swing.JComponent; import javax.swing.JOptionPane; import javax.swing.JPasswordField; import net.sf.jftp.tools.Shell; public class UIUtils { public static String getPasswordFromUser(JComponent parent) { JOptionPane j = new JOptionPane(); JPasswordField pField = new JPasswordField(); int ret = j.showOptionDialog(parent, pField, "Password required", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, null, null); return pField.getText(); } public static void runCommand(String cmd) { Spawn s = new Spawn(cmd); } } class Spawn implements Runnable { private Thread runner; private String cmd; public Spawn(String cmd) { this.cmd = cmd; runner = new Thread(this); runner.start(); } public void run() { try { String str = ""; if(cmd.startsWith("file://")) cmd = cmd.substring(7); Process p = Runtime.getRuntime().exec(cmd); new Shell(p.getInputStream(), p.getOutputStream()); //while ((str = stdout.readLine()) !=null) { // Log.debug(str); //} } catch(Exception ex) { ex.printStackTrace(); } } } jftp-1.52.orig/src/java/net/sf/jftp/gui/base/FtpHost.java0000700000175000017500000000204711112477774022223 0ustar varunvarun/* * 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. */ package net.sf.jftp.gui.base; public class FtpHost { public String name; public String hostname; public String username; public String password; public String port; public String toString() { return (name == null) ? (" @ " + hostname) : (name + " @ " + hostname); } } jftp-1.52.orig/src/java/net/sf/jftp/gui/framework/0000700000175000017500000000000011206335232021030 5ustar varunvarunjftp-1.52.orig/src/java/net/sf/jftp/gui/framework/HFrame.java0000700000175000017500000000312011206334634023041 0ustar varunvarun/* * 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. */ package net.sf.jftp.gui.framework; import net.sf.jftp.config.Settings; import java.awt.*; import javax.swing.*; public class HFrame extends JDialog { public HFrame() { setFont(GUIDefaults.font); setTitle("JFtp..."); setBackground(new JLabel().getBackground()); setResizable(Settings.resize); //setModal(true); fixLocation(); } public void fixLocation() { Toolkit tk = Toolkit.getDefaultToolkit(); setLocation((tk.getScreenSize().width-getSize().width)/2, (tk.getScreenSize().height-getSize().height)/2); } public static void fixLocation(Window w) { Toolkit tk = Toolkit.getDefaultToolkit(); w.setLocation((tk.getScreenSize().width-w.getSize().width)/2, (tk.getScreenSize().height-w.getSize().height)/2); } /* public Insets getInsets() { Insets in = super.getInsets(); return new Insets(in.top + 5, in.left + 5, in.bottom + 5, in.right + 5); } */ } jftp-1.52.orig/src/java/net/sf/jftp/gui/framework/HImageButton.java0000700000175000017500000001024311112477774024242 0ustar varunvarun/* * 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. */ package net.sf.jftp.gui.framework; import net.sf.jftp.*; import java.awt.*; import java.awt.event.*; import javax.swing.*; public class HImageButton extends JButton implements MouseListener { public String label = ""; public ActionListener who = null; private boolean entered = false; private Color cacheBack = GUIDefaults.light; //private Color back = cacheBack; private Color swing = new Color(155, 155, 205); //private Color swing2 = new Color(75,75,125); //private Color front = GUIDefaults.front; //private Font font = GUIDefaults.font; //private Image img; //private String image = null; private String cmd = "default"; private boolean drawBorder = true; private JButton button; public HImageButton(String image, String cmd, String label, ActionListener who) { //this.image = image; this.cmd = cmd; this.label = label; this.who = who; try { //cacheBack = getBackground(); //back = cacheBack; //button = new JButton(new ImageIcon(HImage.getImage(this,image))); setIcon(new ImageIcon(HImage.getImage(this, image))); } catch(Exception ex) { System.out.println("Image file: "+image); ex.printStackTrace(); } //add(button, BorderLayout.CENTER); addMouseListener(this); //addMouseListener(this); setVisible(true); setMinimumSize(new Dimension(25, 25)); setPreferredSize(new Dimension(25, 25)); setMaximumSize(new Dimension(25, 25)); } /* public void paintComponent(Graphics g) { g.setColor(back); g.fillRect(0,0,getSize().width,getSize().height); if(drawBorder) { g.setColor(front); g.drawRect(0,0,getSize().width-1,getSize().height-1); //g.setColor(swing2); g.drawRect(0,0,getSize().width-2,getSize().height-2); g.setColor(back); g.fillRect(0,0,1,1); g.fillRect(0,getSize().height,1,getSize().height-1); g.fillRect(getSize().width-1,0,getSize().width,1); g.fillRect(getSize().width-1,getSize().height,getSize().width,getSize().height-1); } g.drawImage(img,2,2,this); } */ public void update(Graphics g) { paintComponent(g); } public void mouseClicked(MouseEvent e) { } public void mousePressed(MouseEvent e) { } public void mouseReleased(MouseEvent e) { //back = cacheBack; who.actionPerformed(new ActionEvent(this, ActionEvent.ACTION_PERFORMED, cmd)); //repaint(); } public void mouseEntered(MouseEvent e) { entered = true; setCursor(new Cursor(Cursor.HAND_CURSOR)); //back = swing; //button.setBackground(swing); //paintImmediately(0,0,getSize().width,getSize().height); JFtp.statusP.status(label); } public void mouseExited(MouseEvent e) { entered = false; setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); //back = cacheBack; //button.setBackground(cacheBack); //paintImmediately(0,0,getSize().width,getSize().height); JFtp.statusP.status(""); } public void setBorder(boolean what) { drawBorder = what; } } jftp-1.52.orig/src/java/net/sf/jftp/gui/framework/Template.java0000700000175000017500000000233611112477774023473 0ustar varunvarun/* * 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. */ package net.sf.jftp.gui.framework; import net.sf.jftp.gui.framework.*; import java.awt.*; import java.awt.event.*; public class Template extends HPanel implements ActionListener { public Template() { setVisible(true); } public void actionPerformed(ActionEvent e) { } public Insets getInsets() { Insets in = super.getInsets(); //return new Insets(in.top+5,in.left+5,in.bottom+5,in.right+5); return new Insets(in.top, in.left, in.bottom, in.right); } } jftp-1.52.orig/src/java/net/sf/jftp/gui/framework/GUIDefaults.java0000700000175000017500000000414511112477774024034 0ustar varunvarun/* * 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. */ package net.sf.jftp.gui.framework; import java.awt.*; public class GUIDefaults { public static Color mainBack = Color.lightGray; public static Color back = new Color(230, 230, 230); public static Color sizeBack = new Color(255, 200, 0); public static Color front = new Color(0, 0, 0); public static Color white = new Color(255, 255, 255); public static Color red = new Color(255, 0, 0); public static Color blue = new Color(0, 255, 0); public static Color green = new Color(0, 0, 255); public static Color activeColor = new Color(100, 190, 240); public static Color activatedColor = new Color(0, 0, 255); public static Color cdColor = new Color(230, 230, 230); public static Color deniedColor = new Color(140, 0, 0); public static Color writableColor = new Color(0, 140, 0); public static Color defaultColor = new Color(0, 0, 0); public static Color light = new Color(233, 233, 233); public static Color lightActive = new Color(222, 222, 255); public static final Font small = new Font("Arial", Font.PLAIN, 10); public static final Font font = new Font("monospaced", Font.PLAIN, 12); public static final Font active = new Font("Arial", Font.PLAIN, 14); public static final Font menuFont = new Font("Arial", Font.PLAIN, 12); public static final Font status = new Font("Arial", Font.BOLD, 12); public static final Font monospaced = font; } jftp-1.52.orig/src/java/net/sf/jftp/gui/framework/HImage.java0000700000175000017500000000460111112477774023047 0ustar varunvarun/* * 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. */ package net.sf.jftp.gui.framework; import net.sf.jftp.system.logging.Log; import net.sf.jftp.util.*; import java.awt.*; import java.awt.image.*; import javax.swing.*; public class HImage { public static synchronized Image getImage(Component c, String name) { Image img = null; try { java.net.URL url = ClassLoader.getSystemResource(name); if(url == null) { url = HImage.class.getResource("/" + name); } //System.out.println(name + ":" + url); // this is used in case the image not found, and we are packaged as a jar. if(url == null) { url = HImage.class.getResource("/" + name.replace('\\', '/')); } img = (url != null) ? Toolkit.getDefaultToolkit().getImage(url) : null; //Image img = Toolkit.getDefaultToolkit().getImage(name); MediaTracker mt = new MediaTracker(c); mt.addImage(img, 1); mt.waitForAll(); } catch(Exception ex) { Log.debug("\n\n\nError fetching image!"); ex.printStackTrace(); //System.exit(1); //System.out.println(ex); return img; } return img; } public static synchronized ImageIcon getImageIcon(String name, String desc) { java.net.URL url = ClassLoader.getSystemResource(name); if(url == null) { url = HImage.class.getResource("/" + name); } //System.out.println(name + ":" + url); ImageIcon img = (url != null) ? new ImageIcon(url) : null; return img; } } jftp-1.52.orig/src/java/net/sf/jftp/gui/framework/BorderPanel.java0000700000175000017500000000407111112477774024113 0ustar varunvarun/* * 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. */ package net.sf.jftp.gui.framework; import java.awt.*; import javax.swing.*; public class BorderPanel extends JPanel { public boolean left = true; public void paintComponent(Graphics g) { if(left) { g.setColor(Color.black); g.drawLine(2, 2, 2, getSize().height - 3); g.drawLine(2, 2, getSize().width - 3, 2); g.setColor(new Color(80, 80, 80)); g.drawLine(1, 1, 1, getSize().height - 2); g.drawLine(1, 1, getSize().width - 2, 1); g.setColor(new Color(180, 180, 180)); g.drawLine(0, 0, 0, getSize().height - 1); g.drawLine(0, 0, getSize().width - 1, 0); } else { g.setColor(Color.black); g.drawLine(getSize().width - 1, 2, getSize().width - 1, getSize().height - 3); g.drawLine(0, 2, getSize().width - 3, 2); g.setColor(new Color(80, 80, 80)); g.drawLine(getSize().width - 2, 1, getSize().width - 2, getSize().height - 2); g.drawLine(1, 1, getSize().width - 2, 1); g.setColor(new Color(180, 180, 180)); g.drawLine(getSize().width - 3, 0, getSize().width - 3, getSize().height - 1); g.drawLine(0, 0, getSize().width - 1, 0); } } } jftp-1.52.orig/src/java/net/sf/jftp/gui/framework/HDesktopBackground.java0000700000175000017500000000456111112477774025443 0ustar varunvarun/* * 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. */ package net.sf.jftp.gui.framework; import net.sf.jftp.*; import net.sf.jftp.config.*; import java.awt.*; import java.awt.event.*; import java.awt.image.*; import javax.swing.*; public class HDesktopBackground extends JPanel implements MouseListener, ImageObserver { public ActionListener who = null; private Image img; private String image = null; private String cmd = "default"; public HDesktopBackground(String image, ActionListener who) { this.image = image; this.who = who; img = HImage.getImage(this, image); addMouseListener(this); setVisible(true); } public void paintComponent(Graphics g) { if(!Settings.getUseBackground()) { return; } int x = img.getWidth(this); int y = img.getHeight(this); int w = 2000 / x; int h = 2000 / y; for(int i = 0; i < w; i++) { for(int j = 0; j < h; j++) { g.drawImage(img, i * x, j * y, this); } } } public void update(Graphics g) { paintComponent(g); } public void mouseClicked(MouseEvent e) { } public void mousePressed(MouseEvent e) { } public void mouseReleased(MouseEvent e) { } public void mouseEntered(MouseEvent e) { } public void mouseExited(MouseEvent e) { } public boolean imageUpdate(Image image, int infoflags, int x, int y, int width, int height) { //if(width > 0 && height >0) repaint(); return true; } } jftp-1.52.orig/src/java/net/sf/jftp/gui/framework/HPanel.java0000700000175000017500000000216111206332443023046 0ustar varunvarun/* * 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. */ package net.sf.jftp.gui.framework; import javax.swing.JLabel; import javax.swing.JPanel; public class HPanel extends JPanel { public HPanel() { setFont(GUIDefaults.font); setBackground(new JLabel().getBackground()); } /* public Insets getInsets() { Insets in = super.getInsets(); return new Insets(in.top+2,in.left+2,in.bottom+2,in.right+2); } */ } jftp-1.52.orig/src/java/net/sf/jftp/gui/framework/HButton.java0000700000175000017500000000165511112477774023306 0ustar varunvarun/* * 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. */ package net.sf.jftp.gui.framework; import java.awt.*; import javax.swing.*; public class HButton extends JButton { public HButton(String str) { setFont(GUIDefaults.font); setText(str); } } jftp-1.52.orig/src/java/net/sf/jftp/gui/framework/TransferComponent.java0000700000175000017500000000165411112477774025371 0ustar varunvarun/* * 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. */ package net.sf.jftp.gui.framework; import net.sf.jftp.*; import net.sf.jftp.config.*; import net.sf.jftp.gui.framework.*; import net.sf.jftp.net.*; import java.io.*; public class TransferComponent extends HPanel { } jftp-1.52.orig/src/java/net/sf/jftp/gui/framework/HInsetPanel.java0000700000175000017500000000172511206335264024062 0ustar varunvarun/* * 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. */ package net.sf.jftp.gui.framework; import java.awt.Insets; public class HInsetPanel extends HPanel { public Insets getInsets() { Insets in = super.getInsets(); return new Insets(in.top+10,in.left+10,in.bottom+10,in.right+10); } } jftp-1.52.orig/src/java/net/sf/jftp/gui/framework/LoadPanel.java0000700000175000017500000000202211112477774023547 0ustar varunvarun/* * 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. */ package net.sf.jftp.gui.framework; import net.sf.jftp.*; import net.sf.jftp.config.*; import net.sf.jftp.gui.framework.*; import net.sf.jftp.util.*; import java.awt.*; import java.awt.event.*; import java.io.*; import java.net.*; import javax.swing.*; // class is obsolete public class LoadPanel extends HPanel { } jftp-1.52.orig/src/java/net/sf/jftp/gui/framework/ProgressBarList.java0000700000175000017500000000532011206337567025000 0ustar varunvarunpackage net.sf.jftp.gui.framework; import java.awt.Component; import java.awt.GridLayout; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import javax.swing.JLabel; import javax.swing.JPanel; import net.sf.jftp.gui.base.dir.DirEntry; public class ProgressBarList extends JPanel { private int index = -1; public ProgressBarList() { setLayout(new GridLayout(0,1)); addMouseListener( new MouseAdapter() { public void mouseReleased(MouseEvent e) { Component c = getComponentAt(e.getX(), e.getY()); deselectAll(); for(int i=0; i "+items[i].getTransferred()+"/"+items[i].getRawSize()); add(p); } while(getComponentCount() < 10) { add(new JLabel(" ")); } setSelectedIndex(index); } public ProgressbarItem getSelectedValue() { return (ProgressbarItem) getComponent(index); } public int getSelectedIndex() { return index; } private void deselectAll() { for(int i=0; i= 0 && getComponentCount() > index && getComponent(index) instanceof ProgressbarItem) { ((ProgressbarItem) getComponent(index)).select(); } } private String strip(String in) { String tmp; if(in.indexOf("<") >= 0) { in = in.substring(in.lastIndexOf("<")+1); in = in.substring(0,in.lastIndexOf(">")); } return in; } public void setTransferred(String file, long bytes, String message, long max) { boolean ok = false; //System.out.println(file+":"+bytes+":"+max); for(int i=0; i Integer.MAX_VALUE) { max = max / 1000; size = size / 1000; } if(max > 0) { bar.setMaximum((int) max); bar.setValue((int) size); } else { bar.setMaximum(99999999); bar.setValue(0); } bar.setString(lbl); //System.out.println(""+bar.getValue()+":"+bar.getMaximum()+" -> "+lbl); } public DirEntry getDirEntry() { return d; } public void deselect() { setBackground(Color.WHITE); repaint(); } public void select() { setBackground(Color.LIGHT_GRAY); repaint(); } public Insets getInsets() { Insets in = super.getInsets(); return new Insets(in.top+3,in.left+3,in.bottom+3,in.right+3); } } jftp-1.52.orig/src/java/net/sf/jftp/gui/framework/HTextField.java0000700000175000017500000000407211112477774023717 0ustar varunvarun/* * 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. */ package net.sf.jftp.gui.framework; import java.awt.*; import javax.swing.*; public class HTextField extends JPanel { private JLabel label; public JTextField text; public HTextField(String l, String t) { setLayout(new BorderLayout(5, 5)); label = new JLabel(l + " "); add("West", label); text = new JTextField(t, 12) { public Insets getInsets() { return new Insets(4,4,4,4); } }; add("Center", text); setVisible(true); } public HTextField(String l, String t, int size) { setLayout(new BorderLayout(5, 5)); label = new JLabel(l + " "); add("West", label); text = new JTextField(t, size) { public Insets getInsets() { return new Insets(4,4,4,4); } }; add("East", text); setVisible(true); } public String getLabel() { return label.getText(); } public void setLabel(String l) { label.setText(l + " "); } public String getText() { return text.getText(); } public void setText(String t) { text.setText(t); } public void requestFocus() { text.requestFocus(); } public void setEnabled(boolean yesno) { text.setEnabled(yesno); } } jftp-1.52.orig/src/java/net/sf/jftp/system/0000700000175000017500000000000011155274771017610 5ustar varunvarunjftp-1.52.orig/src/java/net/sf/jftp/system/UpdateDaemon.java0000700000175000017500000000624311112477774023032 0ustar varunvarun/* * 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. */ package net.sf.jftp.system; import net.sf.jftp.JFtp; import net.sf.jftp.config.Settings; import net.sf.jftp.gui.*; import net.sf.jftp.gui.base.LocalDir; import net.sf.jftp.gui.base.RemoteDir; import net.sf.jftp.util.*; public class UpdateDaemon implements Runnable { private static int rem; private static int loc; private static int log; private static int reg; private static int cal; private Thread runner = null; private JFtp jftp; public UpdateDaemon(JFtp jftp) { this.jftp = jftp; runner = new Thread(this); runner.start(); } public static void updateRemoteDirGUI() { //System.out.print("+"); reg++; } public static void updateRemoteDir() { //System.out.print("-"); rem++; } public static void updateLocalDir() { //System.out.print("#"); loc++; } public static void updateLog() { //System.out.print("."); log++; } public static void updateCall() { cal++; } public void run() { while(true) { try { //System.out.print(":"); if(rem > 0) { ((RemoteDir) jftp.remoteDir).fresh(); //System.out.print("R"); rem = 0; Thread.sleep(100); } if(reg > 0) { ((RemoteDir) jftp.remoteDir).gui(true); //System.out.print("r"); reg = 0; Thread.sleep(100); } if(loc > 0) { ((LocalDir) jftp.localDir).fresh(); //System.out.print("L"); loc = 0; Thread.sleep(100); } if(cal > 0) { jftp.fireUpdate(); cal = 0; Thread.sleep(100); } if(log > 0) { jftp.ensureLogging(); //System.out.print("O"); log = 0; Thread.sleep(500); } Thread.sleep(Settings.uiRefresh); } catch(Exception ex) { ex.printStackTrace(); System.exit(1); } } } } jftp-1.52.orig/src/java/net/sf/jftp/system/CommandLine.java0000700000175000017500000000425711112477774022655 0ustar varunvarun/* * 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. */ package net.sf.jftp.system; import net.sf.jftp.config.Settings; import net.sf.jftp.event.*; import net.sf.jftp.net.*; import net.sf.jftp.system.logging.Log; import net.sf.jftp.system.logging.SystemLogger; import net.sf.jftp.util.*; import java.io.*; import java.net.*; public class CommandLine implements Runnable, EventHandler, FtpEventConstants { private EventCollector eventCollector; public CommandLine() { Log.setLogger(new SystemLogger()); eventCollector = new EventCollector(); EventProcessor.addHandler(FTPCommand, new FtpEventHandler()); EventProcessor.addHandler(FTPPrompt, this); new Thread(this).start(); } public boolean handle(Event e) { System.out.print("ftp> "); return true; } public void run() { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); String line = null; do { try { eventCollector.accept(new FtpEvent(FTPPrompt)); line = in.readLine(); eventCollector.accept(new FtpEvent(FTPCommand, line)); } catch(IOException e) { } } while(!line.toLowerCase().startsWith("quit")); eventCollector.accept(new FtpEvent(FTPShutdown)); // make the quit command spawn this event? } public static void main(String[] argv) { CommandLine ftp = new CommandLine(); } } jftp-1.52.orig/src/java/net/sf/jftp/system/LocalIO.java0000700000175000017500000000524611112477774021750 0ustar varunvarun/* * 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. */ package net.sf.jftp.system; import java.io.*; public class LocalIO { /** * sorts a string alphabetically * probably better off just calling java.util.Arrays.sort */ public static String[] sortStrings(String[] array) { for(int i = array.length; --i >= 0;) { boolean swapped = false; for(int j = 0; j < i; j++) { if(array[j].compareTo(array[j + 1]) > 0) { String T = new String(array[j]); array[j] = new String(array[j + 1]); array[j + 1] = new String(T); swapped = true; } } if(!swapped) { break; } } return array; } /** recursive removal of a local directoy */ public static void cleanLocalDir(String dir, String path) { if(dir.endsWith("\\")) { System.out.println("oops... fucked up, need to fix \\-problem!!!"); } if(!dir.endsWith("/")) { dir = dir + "/"; } //String remoteDir = StringUtils.removeStart(dir,path); //System.out.println(">>> " + dir); File f2 = new File(path + dir); String[] tmp = f2.list(); for(int i = 0; i < tmp.length; i++) { File f3 = new File(path + dir + tmp[i]); if(f3.isDirectory()) { //System.out.println(dir); cleanLocalDir(dir + tmp[i], path); f3.delete(); } else { //System.out.println(dir+tmp[i]); f3.delete(); } } } /** sleep amount of time in millisconds */ public static void pause(int time) { try { Thread.sleep(time); } catch(Exception ex) { ex.printStackTrace(); } } } jftp-1.52.orig/src/java/net/sf/jftp/system/StringUtils.java0000700000175000017500000001431011112477774022745 0ustar varunvarun/* * 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. */ package net.sf.jftp.system; import java.io.*; public class StringUtils { /** * Makes a (path) string shorter to get it displayed correctly */ public static String cutPath(String s) { int maxlabel = 64; if(s.length() > maxlabel) { while(s.indexOf("/") >= 0) { s = StringUtils.cutAfter(s, '/'); if(s.length() < 16) { StringBuffer sb = new StringBuffer(s); sb.insert(0, ".../"); return sb.toString(); } } } return s; } /** * Removes the a string at the beginning of a string */ public static String removeStart(String str, String what) { if(str.startsWith(what)) { int x = what.length(); return str.substring(x); } else { return str; } } /** * Returns the rest of a string after a given character */ public static String cutAfter(String str, char c) { for(int i = 0; i < str.length(); i++) { if(str.charAt(i) == c) { // System.out.println(str.substring(i+1)); return str.substring(i + 1); } } return str; } /** * Used to search for return codes in a string array. * Returns the first one found */ public static String contains(String[] tmp, String[] str) { for(int i = 0; i < tmp.length; i++) { for(int j = 0; j < str.length; j++) { if(tmp[i].startsWith(str[j])) { return tmp[i]; } } } return ""; } /** * Returns true if the given string contains the given character */ public static boolean strstr(String tmp, char str) { for(int i = 0; i < tmp.length(); i++) { if(tmp.charAt(i) == str) { return true; } } return false; } /** * Returns a string representing a given character */ public static String string(char c) { char[] buf = new char[1]; buf[0] = c; return new String(buf); } /** * Get a filename out of a full path string */ public static String getFile(String file) { int x = file.lastIndexOf("/"); // unix if(x >= 0) { file = file.substring(x + 1); } // windows x = file.lastIndexOf("\\"); if(x >= 0) { file = file.substring(x + 1); } // may work, but can test the other method better //int x = file.lastIndexOf(File.separatorChar); //if(x >= 0) file = file.substring(x+1); //System.out.println(file); return file; } /** * Returns a string representing a relative directory path. * Examples: "/tmp/dir/" -> "dir/" and "/tmp/dir" -> "dir" */ public static String getDir(String tmp) { int x; while(true) { x = tmp.indexOf("/"); if((x == (tmp.length() - 1)) || (x < 0)) { break; } else { tmp = tmp.substring(x + 1); } } while(true) { x = tmp.indexOf("\\"); if((x == (tmp.length() - 1)) || (x < 0)) { break; } else { tmp = tmp.substring(x + 1); } } return tmp; } /* * Returns true if the string represents a relative filename, false otherwise */ public static boolean isRelative(String file) { // unix if(file.startsWith("/")) { return false; } // windows if((file.length() > 2) && (file.charAt(1) == ':')) { return false; } //System.out.println("true: " + file); // default return true; } /** * Main method containing a few testcases for getFile() / isRelative() */ public static void main(String[] argv) { String a1 = "E:\\programme\\test.html"; String a2 = "programme\\test.html"; String a3 = "test.html"; String a4 = "/programme/test.html"; String a5 = "programme/test.html"; System.out.println("getfile: " + getFile(a1) + " - false, " + isRelative(a1)); System.out.println("getfile: " + getFile(a2) + " - true, " + isRelative(a2)); System.out.println("getfile: " + getFile(a3) + " - true, " + isRelative(a3)); System.out.println("getfile: " + getFile(a4) + " - false, " + isRelative(a4)); System.out.println("getfile: " + getFile(a5) + " - true, " + isRelative(a5)); } public static String cut(String tmp, String where) { StringBuffer ret = new StringBuffer(); for(int i = 0; i < tmp.length(); i++) { if(!string(tmp.charAt(i)).equals(where)) { ret.append(string(tmp.charAt(i))); } if(string(tmp.charAt(i)).equals(where)) { return ret.toString(); } } return ret.toString(); } } jftp-1.52.orig/src/java/net/sf/jftp/system/logging/0000700000175000017500000000000011155274771021236 5ustar varunvarunjftp-1.52.orig/src/java/net/sf/jftp/system/logging/Log4JLogger.java0000700000175000017500000000442311112477774024167 0ustar varunvarun/* * 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. */ package net.sf.jftp.system.logging; import org.apache.log4j.*; import java.io.PrintWriter; import java.io.StringWriter; public class Log4JLogger implements Logger { private Category cat = Category.getInstance("jftp"); public Log4JLogger() { BasicConfigurator.configure(); } private String stacktrace(Throwable throwable) { StringWriter out = new StringWriter(); throwable.printStackTrace(new PrintWriter(out)); return (throwable.toString()); } public void debug(String msg) { cat.debug(msg); } public void debugRaw(String msg) { cat.debug(msg); } public void debug(String msg, Throwable throwable) { cat.debug(msg); cat.debug(stacktrace(throwable)); } public void warn(String msg) { cat.warn(msg); } public void warn(String msg, Throwable throwable) { cat.warn(msg); cat.warn(stacktrace(throwable)); } public void error(String msg) { cat.error(msg); } public void error(String msg, Throwable throwable) { cat.error(msg); cat.error(stacktrace(throwable)); } public void info(String msg) { cat.info(msg); } public void info(String msg, Throwable throwable) { cat.info(msg); cat.info(stacktrace(throwable)); } public void fatal(String msg) { cat.fatal(msg); } public void fatal(String msg, Throwable throwable) { cat.fatal(msg); cat.fatal(stacktrace(throwable)); } } jftp-1.52.orig/src/java/net/sf/jftp/system/logging/SystemLogger.java0000700000175000017500000000355611112477774024542 0ustar varunvarun/* * 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. */ package net.sf.jftp.system.logging; public class SystemLogger implements Logger { private void log(String msg) { System.out.println(msg); } private void log(String msg, Throwable throwable) { System.out.println(msg); throwable.printStackTrace(); } public void debug(String msg) { log(msg + "\n"); } public void debugRaw(String msg) { log(msg); } public void debug(String msg, Throwable throwable) { log(msg, throwable); } public void warn(String msg) { log(msg); } public void warn(String msg, Throwable throwable) { log(msg, throwable); } public void error(String msg) { log(msg); } public void error(String msg, Throwable throwable) { log(msg, throwable); } public void info(String msg) { log(msg); } public void info(String msg, Throwable throwable) { log(msg, throwable); } public void fatal(String msg) { log(msg); } public void fatal(String msg, Throwable throwable) { log(msg, throwable); } } jftp-1.52.orig/src/java/net/sf/jftp/system/logging/Logger.java0000700000175000017500000000240411112477774023324 0ustar varunvarun/* * 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. */ package net.sf.jftp.system.logging; public interface Logger { public void debug(String msg); public void debugRaw(String msg); public void debug(String msg, Throwable throwable); public void warn(String msg); public void warn(String msg, Throwable throwable); public void error(String msg); public void error(String msg, Throwable throwable); public void info(String msg); public void info(String msg, Throwable throwable); public void fatal(String msg); public void fatal(String msg, Throwable throwable); } jftp-1.52.orig/src/java/net/sf/jftp/system/logging/Log.java0000700000175000017500000000377611112477774022643 0ustar varunvarun/* * 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. */ package net.sf.jftp.system.logging; import net.sf.jftp.config.Settings; public class Log { private static Logger logger = new SystemLogger(); private static Log log = new Log(); private static StringBuffer cache = new StringBuffer(); private Log() { } public static void setLogger(Logger logger) { Log.logger = logger; } public static void debug(String msg) { if(Settings.getDisableLog()) { return; } //System.out.println(msg); logger.debug(msg); cache.append(msg + "\n"); if(!Settings.getEnableDebug()) System.out.println("> " + msg); } public static void debugRaw(String msg) { if(Settings.getDisableLog()) { return; } logger.debugRaw(msg); cache.append(msg); if(Settings.getEnableDebug()) System.out.print(msg); } public static void out(String msg) { if(!Settings.getEnableDebug()) { return; } System.out.println("> " + msg); } public static void devnull(Object msg) { } public static String getCache() { return cache.toString(); } public static void clearCache() { cache = new StringBuffer(); } } jftp-1.52.orig/src/java/net/sf/jftp/tools/0000700000175000017500000000000011155274771017424 5ustar varunvarunjftp-1.52.orig/src/java/net/sf/jftp/tools/InsomniacClient.java0000700000175000017500000001715411112477774023362 0ustar varunvarun/* * 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. */ package net.sf.jftp.tools; import net.sf.jftp.*; import net.sf.jftp.config.*; import net.sf.jftp.gui.*; import net.sf.jftp.gui.base.dir.DirCellRenderer; import net.sf.jftp.gui.base.dir.DirEntry; import net.sf.jftp.gui.framework.*; import net.sf.jftp.net.*; import net.sf.jftp.net.wrappers.SmbConnection; import net.sf.jftp.system.logging.Log; import net.sf.jftp.util.*; import java.awt.*; import java.awt.event.*; import java.io.*; import java.net.*; import java.util.*; import javax.swing.*; import javax.swing.event.*; public class InsomniacClient extends HPanel implements Runnable, ActionListener { private HTextField host = new HTextField("URL:", "http://canofsleep.com:8180/Insomniac/test.jsp?keywords=", 40); private HTextField search = new HTextField("Search term:", "mp3", 20); private HTextField user = new HTextField("User:", "guest", 10); private HPasswordField pass = new HPasswordField("Password:", "none"); private HTextField dir = new HTextField("Download to:", Settings.defaultWorkDir, 20); private JPanel p1 = new JPanel(); private JPanel p2 = new JPanel(); private JButton ok = new JButton("Search"); private JList list = new JList(); private JButton load = new JButton("Download file"); private Vector files; private Vector sizes; private Thread runner; private boolean doSearch; private Vector fileNames; public InsomniacClient() { setLayout(new BorderLayout()); JPanel x1 = new JPanel(); x1.setLayout(new FlowLayout(FlowLayout.LEFT)); x1.add(host); x1.add(search); JPanel x2 = new JPanel(); x2.setLayout(new FlowLayout(FlowLayout.LEFT)); x2.add(search); x2.add(dir); JPanel x3 = new JPanel(); x3.setLayout(new FlowLayout(FlowLayout.LEFT)); x3.add(user); x3.add(pass); p1.setLayout(new BoxLayout(p1, BoxLayout.Y_AXIS)); p1.add(x1); p1.add(x2); p1.add(x3); JPanel okP = new JPanel(); okP.setLayout(new FlowLayout(FlowLayout.CENTER)); okP.add(ok); okP.add(new JLabel(" ")); okP.add(load); //p1.add(okP); //list.setHeight(300); list.setFixedCellWidth(720); list.setVisibleRowCount(12); list.setCellRenderer(new DirCellRenderer()); JScrollPane pane = new JScrollPane(list); p2.add(new JScrollPane(pane)); add("North", p1); add("Center", p2); add("South", okP); //JPanel p3 = new JPanel(); //p3.setLayout(new FlowLayout(FlowLayout.CENTER)); //p3.add(load); load.addActionListener(this); load.setEnabled(false); //add("South", p3); ok.addActionListener(this); setVisible(true); validate(); doLayout(); } public void actionPerformed(ActionEvent e) { if((e.getSource() == ok) || e.getSource() instanceof DirEntry) { doSearch = true; runner = new Thread(this); runner.start(); } else if(e.getSource() == load) { doSearch = false; runner = new Thread(this); runner.start(); } } public void run() { if(doSearch) { search.setEnabled(false); String url = host.getText().trim() + search.getText().trim(); search(url); load.setEnabled(true); search.setEnabled(true); } else { download((String) fileNames.elementAt(list.getSelectedIndex())); } } private void download(String url) { try { Log.debug("Insomniac: Download started: " + url); String host = url.substring(6); host = host.substring(0, host.indexOf("/")); Log.debug("Insomniac: Trying to connect to remote host: " + host); JFtp.statusP.jftp.ensureLogging(); SmbConnection con = new SmbConnection(host, user.getText().trim(), pass.getText().trim(), "WORKGROUP", ((ConnectionListener) JFtp.remoteDir)); Log.debug("Insomniac: Connected, downloading to: " + Settings.defaultWorkDir); JFtp.statusP.jftp.ensureLogging(); con.setLocalPath(dir.getText().trim()); if(con.download(url) >= 0) { Log.debug("Insomniac: Finished download."); } else { Log.debug("Insomniac: Download failed."); } JFtp.statusP.jftp.ensureLogging(); } catch(Exception ex) { ex.printStackTrace(); Log.debug("Insomniac: Error: " + ex); } } private void search(String url) { files = new Vector(); sizes = new Vector(); fileNames = new Vector(); try { URL u = new URL(url); DataInputStream in = new DataInputStream(u.openStream()); String tmp = null; while(true) { tmp = in.readLine(); if(tmp == null) { return; } else { if(tmp.indexOf("X-File") >= 0) { tmp = parse(tmp); fileNames.add(tmp); DirEntry entry = new DirEntry(tmp.substring(tmp.lastIndexOf("/") + 1), this); entry.setFile(); tmp = in.readLine(); if(tmp.indexOf("X-Size") >= 0) { tmp = parse(tmp); entry.setFileSize(Long.parseLong(tmp)); } else if(tmp == null) { return; } files.add(entry); list.setListData(files); } } } } catch(Exception ex) { ex.printStackTrace(); Log.debug("Insomniac: Error: " + ex); } } private String parse(String tmp) { if(tmp == null) { return "-1"; } tmp.trim(); tmp = tmp.substring(8); tmp = tmp.substring(0, tmp.length() - 1); return tmp; } public Insets getInsets() { Insets in = super.getInsets(); return new Insets(in.top + 5, in.left + 5, in.bottom + 5, in.right + 5); } } jftp-1.52.orig/src/java/net/sf/jftp/tools/HttpSpider.java0000700000175000017500000003415311112477774022367 0ustar varunvarun/* * 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. */ package net.sf.jftp.tools; import net.sf.jftp.*; import net.sf.jftp.config.*; import net.sf.jftp.gui.framework.*; import net.sf.jftp.net.*; import net.sf.jftp.system.LocalIO; import net.sf.jftp.system.logging.Log; import net.sf.jftp.util.*; import java.awt.*; import java.awt.event.*; import java.io.*; import java.net.*; import java.util.*; import javax.swing.*; import javax.swing.event.*; public class HttpSpider extends HPanel implements Runnable, ActionListener { private HTextField host = new HTextField("Full URL:", "http://j-ftp.sourceforge.net/index.html", 30); private HTextField type = new HTextField("Types (use * for all):", "html-htm-css-gif-jpg-zip-gz-avi-mpg", 25); private HTextField depth = new HTextField("Search up to this many levels deeper:", "1", 10); private HTextField dir = new HTextField("Store files in:", "", 25); private JPanel p1 = new JPanel(); private JPanel okP = new JPanel(); private JButton ok = new JButton("Start"); private int currentDepth = 0; private int MAX = 1; private String[] typeArray = { "mpg", "avi", "mpeg", "mov", "rm", "wmv" }; private String localDir = "."; private String[] argv; private Thread runner; private boolean stopflag = false; private JButton stop = new JButton("Stop download (ASAP)"); public HttpSpider(String localDir) { this.localDir = localDir; //setSize(440,220); //setLocation(200,250); //setTitle("Http spider..."); //getContentPane(). setLayout(new BorderLayout()); //setBackground(Color.lightGray); p1.setLayout(new GridLayout(4, 1, 5, 5)); p1.add(host); p1.add(type); p1.add(depth); dir.setText(localDir); p1.add(dir); //getContentPane(). add("Center", p1); //getContentPane(). add("South", okP); okP.add(ok); ok.addActionListener(this); setVisible(true); } public void actionPerformed(ActionEvent e) { if(e.getSource() == ok) { //this.dispose(); localDir = dir.getText(); if(!localDir.endsWith("/")) { localDir = localDir + "/"; } String[] argv2 = { host.getText().trim(), type.getText().trim(), depth.getText().trim() }; argv = argv2; removeAll(); add("North", new JLabel("Starting download, please watch the log window for details")); add("Center", stop); stop.addActionListener(this); JFtp.statusP.jftp.setClosable(this.hashCode(), false); validate(); runner = new Thread(this); runner.start(); } else if(e.getSource() == stop) { stopflag = true; } } public void run() { spider(argv); if(!stopflag) { Log.debug("\nRecursive download finished.\nOuptut dir: " + localDir); } else { Log.debug("\nRecursive download aborted."); } JFtp.statusP.jftp.ensureLogging(); JFtp.statusP.jftp.removeFromDesktop(this.hashCode()); } private void spider(String[] argv) { try { String url = "http://j-ftp.sourceforge.net/index.html"; if(argv.length >= 2) { url = clear(argv[0]); if(url.indexOf("/") < 0) { url = url + "/"; } typeArray = check(argv[1]); Log.debugRaw(">>> Scanning for "); for(int i = 0; i < typeArray.length; i++) { Log.debugRaw(typeArray[i] + " "); } Log.debug(""); } if(argv.length > 2) { MAX = Integer.parseInt(argv[2]); } //for(int i=0; i= 0) { url = url.substring(7); } return url; } private Vector addVector(Vector v, Vector x) { Enumeration e = x.elements(); while(e.hasMoreElements()) { String next = (String) e.nextElement(); v.add(next); } return v; } private void smoke(String url) throws Exception { if(stopflag) { return; } url = clear(url); Holer sammy = new Holer(localDir); String zeug = sammy.holZeug(url); Vector m = sortiermal(zeug, url.substring(0, url.lastIndexOf("/")), "href=\""); m = addVector(m, sortiermal(zeug, url.substring(0, url.lastIndexOf("/")), "src=\"")); m = addVector(m, sortiermal(zeug, url.substring(0, url.lastIndexOf("/")), "HREF=\"")); m = addVector(m, sortiermal(zeug, url.substring(0, url.lastIndexOf("/")), "SRC=\"")); Enumeration mischen = m.elements(); while(mischen.hasMoreElements()) { if(stopflag) { return; } String next = (String) mischen.nextElement(); Log.out("Processing: " + next); for(int i = 0; i < typeArray.length; i++) { if(next.endsWith(typeArray[i]) || typeArray[i].trim().equals("*")) { int x = next.indexOf("/"); if((x > 0) && (next.substring(0, x).indexOf(".") > 0)) { Holer nochnsammy = new Holer(localDir); nochnsammy.bringAnStart(next, false); if(stopflag) { return; } continue; } } } if(currentDepth < MAX) { if(stopflag) { return; } int x = next.indexOf("/"); if((x > 0) && (next.substring(0, x).indexOf(".") > 0)) { currentDepth++; smoke(next); currentDepth--; } } } } private Vector sortiermal(String zeug, String url, String index) { Vector mischen = new Vector(); int wo = 0; while(true) { wo = zeug.indexOf(index); if(wo < 0) { return mischen; } zeug = zeug.substring(wo + index.length()); String was = zeug.substring(0, zeug.indexOf("\"")); was = checker(was, url); mischen.add(was); Log.out("Added: " + was); } } private String[] check(String auswahl) { StringTokenizer flyer = new StringTokenizer(auswahl, "-", false); String[] einkauf = new String[flyer.countTokens()]; int tmp = 0; while(flyer.hasMoreElements()) { einkauf[tmp] = (String) flyer.nextElement(); tmp++; } return einkauf; } private String checker(String was, String url) { was = clear(was); if(was.startsWith(url)) { return was; } if(was.startsWith("/") && (url.indexOf("/") > 0)) { was = url.substring(0, url.indexOf("/")) + was; } else if(was.startsWith("/") && (url.indexOf("/") < 0)) { was = url + was; } else if((was.indexOf(".") > 0)) { int idx = was.indexOf("/"); String tmp = ""; if(idx >= 0) { tmp = was.substring(0, idx); } if((tmp.indexOf(".") > 0)) { return clear(was); } if(url.endsWith("/")) { was = url + was; } else { was = url + "/" + was; } } Log.out("-> " + was); return was; } public Insets getInsets() { return new Insets(5, 5, 5, 5); } } class Holer { private String localDir = null; public Holer(String localDir) { this.localDir = localDir; } public String holZeug(String wat) { try { String dealer = wat.substring(0, wat.indexOf("/")); String wo = wat.substring(wat.indexOf("/")); String zeug = ""; Log.out(">> " + dealer + wo); Socket deal = new Socket(dealer, 80); deal.setSoTimeout(5000); BufferedWriter order = new BufferedWriter(new OutputStreamWriter(deal.getOutputStream())); BufferedReader checkung = new BufferedReader(new InputStreamReader(deal.getInputStream())); order.write("GET http://" + wat + " HTTP/1.0\n\n"); order.flush(); int len = 0; while(!checkung.ready() && (len < 5000)) { chill(100); len += 100; } while(checkung.ready()) { zeug = zeug + checkung.readLine(); } order.close(); checkung.close(); return zeug; } catch(Exception ex) { ex.printStackTrace(); } return ""; } public void bringAnStart(String wat, boolean force) { try { String dealer = wat.substring(0, wat.indexOf("/")); String wo = wat.substring(wat.indexOf("/")); String zeug = ""; Log.debug(">>> " + dealer + wo); //JFtp.statusP.jftp.ensureLogging(); File d = new File(localDir); d.mkdir(); File f = new File(localDir + wo.substring(wo.lastIndexOf("/") + 1)); if(f.exists() && !force) { Log.debug(">>> file already exists..."); return; } else { f.delete(); } Socket deal = new Socket(dealer, 80); BufferedWriter order = new BufferedWriter(new OutputStreamWriter(deal.getOutputStream())); DataInputStream checkung = new DataInputStream(new BufferedInputStream(deal.getInputStream())); BufferedOutputStream vorrat = new BufferedOutputStream(new FileOutputStream(localDir + wo.substring(wo.lastIndexOf("/") + 1))); byte[] alu = new byte[2048]; order.write("GET http://" + wat + " HTTP/1.0\n\n"); order.flush(); boolean line = true; boolean bin = false; while(true) { chill(10); String tmp = ""; while(line) { String x = checkung.readLine(); if(x == null) { break; } tmp += (x + "\n"); if(x.equals("")) { line = false; } } int x = checkung.read(alu); if(x == -1) { if(line) { vorrat.write(tmp.getBytes(), 0, tmp.length()); } order.close(); checkung.close(); vorrat.flush(); vorrat.close(); return; } else { vorrat.write(alu, 0, x); } } } catch(Exception ex) { ex.printStackTrace(); } } private static void chill(int time) { try { Thread.sleep(time); } catch(Exception ex) { } } } jftp-1.52.orig/src/java/net/sf/jftp/tools/RSSParser.java0000700000175000017500000000526011112477774022122 0ustar varunvarun/* * 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. */ package net.sf.jftp.tools; import java.io.*; import java.net.*; import java.util.*; public class RSSParser { URL file; Vector titles = new Vector(); Vector descs = new Vector(); Vector links = new Vector(); Vector content = new Vector(); public RSSParser(URL f) { file = f; parse(); } private void parse() { try { DataInputStream in = new DataInputStream(new BufferedInputStream(file.openStream())); String tmp; String data = ""; while((tmp = in.readLine()) != null) { data += tmp; } add(data, content, "", "", "", ""); add(data, titles, "", "", null, null); add(data, descs, "", "", null, null); add(data, links, "", "", null, null); } catch(Exception ex) { ex.printStackTrace(); return; } } private void add(String tmp, Vector target, String start, String end, String s2, String e2) { if(s2 == null) { s2 = start; e2 = end; } int x = tmp.indexOf(start); int x2 = tmp.indexOf(s2); if(((x < 0) && (x2 < 0)) || ((x < 0) && start.equals(s2))) { return; } if((x2 >= 0) && ((x2 < x) || (x < 0))) { x = x2; String t = start; start = s2; s2 = t; t = end; end = e2; e2 = t; } //System.out.println(tmp+":::"+x+":::"+x2); String value = tmp.substring(x + start.length(), tmp.indexOf(end)); //System.out.println(value); target.add(value); tmp = tmp.substring(tmp.indexOf(end) + end.length()); add(tmp, target, start, end, s2, e2); } } jftp-1.52.orig/src/java/net/sf/jftp/tools/SshShell.java0000700000175000017500000002352211112477774022024 0ustar varunvarunpackage net.sf.jftp.tools; import java.awt.BorderLayout; import java.awt.Font; import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.io.BufferedInputStream; import java.io.BufferedOutputStream; import java.io.IOException; import java.io.StreamTokenizer; import java.util.Vector; import javax.swing.JFrame; import javax.swing.JOptionPane; import javax.swing.JScrollBar; import javax.swing.JScrollPane; import javax.swing.JTextArea; import net.sf.jftp.JFtp; import net.sf.jftp.config.Settings; import net.sf.jftp.gui.framework.HFrame; import net.sf.jftp.net.wrappers.SftpVerification; import net.sf.jftp.system.logging.Log; import com.sshtools.common.hosts.DialogHostKeyVerification; import com.sshtools.j2ssh.SshClient; import com.sshtools.j2ssh.authentication.AuthenticationProtocolState; import com.sshtools.j2ssh.authentication.PasswordAuthenticationClient; import com.sshtools.j2ssh.configuration.ConfigurationLoader; import com.sshtools.j2ssh.configuration.SshConnectionProperties; import com.sshtools.j2ssh.session.SessionChannelClient; public class SshShell extends JFrame implements Runnable { BufferedOutputStream out; BufferedInputStream in; BufferedInputStream err; JTextArea text = new JTextArea(25, 101); //JTextField input = new JTextField(); long off; Thread runner; JScrollPane textP; int port; SshConnectionProperties properties; String input = ""; SshClient ssh; Vector commands = new Vector(); int currCmd = 0; public SshShell(SshConnectionProperties properties, String user, String pass, int port) { this.port = port; this.properties = properties; try { init(user, pass); } catch(Exception e) { e.printStackTrace(); Log.debug("ERROR: " + e.getMessage()); } } public SshShell() { try { String host = JOptionPane.showInternalInputDialog(JFtp.desktop, "Please enter a host:"); String user = JOptionPane.showInternalInputDialog(JFtp.desktop, "Please enter your username:"); String pass = JOptionPane.showInternalInputDialog(JFtp.desktop, "Please enter your password:"); if((host != null) && (user != null) && (pass != null)) { init(user, pass); } } catch(Exception e) { e.printStackTrace(); Log.debug("ERROR: " + e.getMessage()); } } public void init(String user, String pass) throws Exception { setTitle("SSH Shell"); //setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { ssh.disconnect(); dispose(); } }); //setLocation(150, 150); HFrame.fixLocation(this); textP = new JScrollPane(text); text.setFont(new Font("Monospaced", Font.TRUETYPE_FONT, 10)); //text.setCaretColor(Color.black); /* text.setCaret(new DefaultCaret() { public void focusGained(FocusEvent e) { super.focusGained(e); setVisible(true); } public void focusLost(FocusEvent e) { super.focusLost(e); setVisible(true); } }); */ getContentPane().setLayout(new BorderLayout(5, 5)); getContentPane().add("Center", textP); //getContentPane().add("South", input); text.setEditable(false); text.setLineWrap(true); setBackground(text.getBackground()); text.addKeyListener(new KeyAdapter() { public void keyPressed(KeyEvent e) { if((e.getKeyCode() == KeyEvent.VK_BACK_SPACE) && (input.length() > 0)) { input = input.substring(0, input.length() - 1); String t = text.getText(); t = t.substring(0, t.length() - 1); text.setText(t); } else if(e.getKeyCode() == KeyEvent.VK_UP) { String t = text.getText(); t = t.substring(0, t.length() - input.length()); if((currCmd <= commands.size()) && (currCmd > 0)) { currCmd--; String cmd = (String) commands.get(currCmd); input = cmd.substring(0, cmd.length() - 1); text.setText(t + input); } } else if(e.getKeyCode() == KeyEvent.VK_DOWN) { String t = text.getText(); t = t.substring(0, t.length() - input.length()); if(((currCmd + 1) < commands.size()) && (currCmd >= 0)) { currCmd++; String cmd = (String) commands.get(currCmd); input = cmd.substring(0, cmd.length() - 1); text.setText(t + input); } } else if(e.getKeyCode() != KeyEvent.VK_SHIFT) { //Char c = new Char(e.getKeyChar()); if(!e.isActionKey()) { input += e.getKeyChar(); text.append("" + e.getKeyChar()); } } if(e.getKeyCode() == KeyEvent.VK_ENTER) { send(); } } }); ConfigurationLoader.initialize(false); ssh = new SshClient(); ssh.setSocketTimeout(30000); //SshConnectionProperties properties = new SshConnectionProperties(); //properties.setHost(host); //properties.setPort(port); //properties.setPrefPublicKey("ssh-dss"); if(Settings.getEnableSshKeys()) { ssh.connect(properties, new DialogHostKeyVerification(this)); } else { ssh.connect(properties, new SftpVerification(Settings.sshHostKeyVerificationFile)); } PasswordAuthenticationClient pwd = new PasswordAuthenticationClient(); pwd.setUsername(user); pwd.setPassword(pass); int result = ssh.authenticate(pwd); if(result == AuthenticationProtocolState.COMPLETE) { SessionChannelClient session = ssh.openSessionChannel(); if(!session.requestPseudoTerminal("vt100", 80, 24, 0, 0, "")) { Log.debug("ERROR: Could not open terminal"); } if(session.startShell()) { out = new BufferedOutputStream(session.getOutputStream()); in = new BufferedInputStream(session.getInputStream()); err = new BufferedInputStream(session.getStderrInputStream()); //session.getState().waitForState(ChannelState.CHANNEL_CLOSED); } else { Log.debug("ERROR: Could not start shell"); } } else { ssh.disconnect(); } pack(); setVisible(true); runner = new Thread(this); runner.start(); toFront(); text.requestFocus(); } public void run() { try { byte[] b = new byte[4096]; int i; while((i = in.read(b)) != StreamTokenizer.TT_EOF) { text.append(new String(b, 0, i)); //Log.out("recv: "+i+" -> "+new String(b)); while(err.available() > 0) { err.read(b); text.append(new String(b, 0, i)); } while(text.getRows() > 500) { String t = text.getText(); t = t.substring(250); text.setText(t); } try { Thread.sleep(100); } catch(Exception ex) { ex.printStackTrace(); } JScrollBar bar = textP.getVerticalScrollBar(); bar.setValue(bar.getMaximum()); } } catch(Exception ex) { ex.printStackTrace(); Log.debug("ERROR: " + ex.getMessage()); this.dispose(); } } private void send() { try { String msg = input; input = ""; out.write(msg.getBytes()); out.flush(); commands.add(msg); currCmd = commands.size(); //Log.out("send: "+msg); } catch(IOException ex) { ex.printStackTrace(); Log.debug("ERROR: " + ex.getMessage()); this.dispose(); } } public static void main(String[] args) { new SshShell(); } } jftp-1.52.orig/src/java/net/sf/jftp/tools/Shell.java0000700000175000017500000001654011112477774021350 0ustar varunvarunpackage net.sf.jftp.tools; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Font; import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; import java.io.BufferedOutputStream; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.StreamTokenizer; import java.util.Vector; import javax.swing.JFrame; import javax.swing.JScrollBar; import javax.swing.JScrollPane; import javax.swing.JTextArea; import javax.swing.text.DefaultCaret; import net.sf.jftp.gui.framework.HFrame; import net.sf.jftp.system.logging.Log; public class Shell extends HFrame implements Runnable { BufferedOutputStream out; //BufferedInputStream in; BufferedReader in; BufferedOutputStream err; JTextArea text = new JTextArea(25, 101); //JTextField input = new JTextField(); long off; Thread runner; JScrollPane textP; String input = ""; Vector commands = new Vector(); int currCmd = 0; public Shell(InputStream in, OutputStream out) { try { this.in = new BufferedReader(new InputStreamReader(in)); this.out = new BufferedOutputStream(out); //in = new BufferedInputStream(System.in); //out = new BufferedOutputStream(System.out); //err = new BufferedOutputStream(System.err); init(); } catch(Exception e) { e.printStackTrace(); Log.debug("ERROR: " + e.getMessage()); } } public Shell(BufferedReader in, OutputStream out) { try { this.in = in; this.out = new BufferedOutputStream(out); //in = new BufferedInputStream(System.in); //out = new BufferedOutputStream(System.out); //err = new BufferedOutputStream(System.err); init(); } catch(Exception e) { e.printStackTrace(); Log.debug("ERROR: " + e.getMessage()); } } public void init() throws Exception { setTitle("Shell"); setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); //setLocation(150, 150); HFrame.fixLocation(this); textP = new JScrollPane(text); text.setFont(new Font("Monospaced", Font.TRUETYPE_FONT, 10)); getContentPane().setLayout(new BorderLayout(5, 5)); getContentPane().add("Center", textP); //getContentPane().add("South", input); text.setEditable(false); setBackground(text.getBackground()); DefaultCaret c = new DefaultCaret(); c.setBlinkRate(1000); text.setCaret(c); text.setCaretColor(Color.BLACK); c.setVisible(true); text.setLineWrap(true); text.addKeyListener(new KeyAdapter() { public void keyPressed(KeyEvent e) { if((e.getKeyCode() == KeyEvent.VK_BACK_SPACE) && (input.length() > 0)) { input = input.substring(0, input.length() - 1); String t = text.getText(); t = t.substring(0, t.length() - 1); text.setText(t); } else if(e.getKeyCode() == KeyEvent.VK_UP) { String t = text.getText(); t = t.substring(0, t.length() - input.length()); if((currCmd <= commands.size()) && (currCmd > 0)) { currCmd--; String cmd = (String) commands.get(currCmd); input = cmd.substring(0, cmd.length() - 1); text.setText(t + input); } } else if(e.getKeyCode() == KeyEvent.VK_DOWN) { String t = text.getText(); t = t.substring(0, t.length() - input.length()); if(((currCmd + 1) < commands.size()) && (currCmd >= 0)) { currCmd++; String cmd = (String) commands.get(currCmd); input = cmd.substring(0, cmd.length() - 1); text.setText(t + input); } } else if(e.getKeyCode() != KeyEvent.VK_SHIFT) { //Char c = new Char(e.getKeyChar()); if(!e.isActionKey()) { input += e.getKeyChar(); text.append("" + e.getKeyChar()); } } if(e.getKeyCode() == KeyEvent.VK_ENTER) { send(); } } }); pack(); HFrame.fixLocation(this); setVisible(true); runner = new Thread(this); runner.start(); toFront(); text.requestFocus(); } public void run() { try { char[] b = new char[4096]; int i; while((i = in.read(b,0,b.length)) != StreamTokenizer.TT_EOF) { text.append(new String(b, 0, i)); //Log.out("recv: "+i+" -> "+new String(b)); //while(err.available() > 0) //{ // err.read(b); // text.append(new String(b, 0, i)); //} while(text.getRows() > 500) { String t = text.getText(); t = t.substring(250); text.setText(t); // text.setCaretPosition(-250); } try { Thread.sleep(100); } catch(Exception ex) { ex.printStackTrace(); } JScrollBar bar = textP.getVerticalScrollBar(); bar.setValue(bar.getMaximum()); // text.setCaretPosition(i); text.setCaretPosition(text.getText().length()); //text.getCaret().setDot(1); } text.setEnabled(false); } catch(Exception ex) { ex.printStackTrace(); Log.debug("ERROR: " + ex.getMessage()); this.dispose(); } } private void send() { try { String msg = input; input = ""; out.write(msg.getBytes()); out.flush(); commands.add(msg); currCmd = commands.size(); //Log.out("send: "+msg); } catch(IOException ex) { ex.printStackTrace(); Log.debug("ERROR: " + ex.getMessage()); this.dispose(); } } public static void main(String[] argv) { try { Process p = Runtime.getRuntime().exec(argv.length > 0 ? argv[0] : "/bin/bash"); new Shell(p.getInputStream(), p.getOutputStream()); } catch(Exception ex) { ex.printStackTrace(); } } } jftp-1.52.orig/src/java/net/sf/jftp/tools/RSSFeeder.java0000700000175000017500000001036011112477774022055 0ustar varunvarun/* * 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. */ package net.sf.jftp.tools; import net.sf.jftp.config.Settings; import net.sf.jftp.gui.*; import net.sf.jftp.gui.base.StatusCanvas; import net.sf.jftp.gui.framework.*; import net.sf.jftp.system.LocalIO; import net.sf.jftp.system.logging.Log; import net.sf.jftp.util.*; import java.awt.*; import java.awt.event.*; import java.net.*; import java.util.*; import javax.swing.*; public class RSSFeeder extends JPanel implements Runnable, ActionListener { public static String urlstring = Settings.getRSSFeed(); Thread runner; URL url; RSSParser parser; StatusCanvas can = new StatusCanvas(); HImageButton next = new HImageButton(Settings.nextRSSImage, "nextRSS", "Display next RSS news item", this); boolean header = false; boolean breakHeader = false; int HEADER_IVAL = 4000; int LOAD_IVAL = 31 * 60000; //"http://www.spiegel.de/schlagzeilen/rss/0,5291,,00.xml"; public RSSFeeder() { setLayout(new BorderLayout(0, 0)); next.setPreferredSize(new Dimension(22, 22)); next.setMaximumSize(new Dimension(22, 22)); //next.addActionListener(this); add("West", next); add("Center", can); setPreferredSize(new Dimension(500, 25)); runner = new Thread(this); runner.start(); } public void switchTo(String u) { if(u == null) { return; } urlstring = u; runner.stop(); runner = new Thread(this); runner.start(); } public void run() { long time; LocalIO.pause(3000); Log.out("Starting RSS Feed"); try { can.setInterval(10); url = new URL(urlstring); parser = new RSSParser(url); time = System.currentTimeMillis(); } catch(Exception ex) { Log.debug("Error: Can't load RSS feed (" + ex + ")"); ex.printStackTrace(); return; } while(true) { try { Enumeration e = parser.titles.elements(); Enumeration e2 = parser.descs.elements(); while(e.hasMoreElements()) { can.setText((String) e.nextElement()); next.setEnabled(true); header = true; int i = 0; while(!breakHeader && (i < 100)) { LocalIO.pause(HEADER_IVAL / 100); i++; } next.setEnabled(false); breakHeader = false; header = false; if(e2.hasMoreElements()) { next.setEnabled(true); can.scrollText((String) e2.nextElement()); next.setEnabled(false); } } } catch(Exception ex) { ex.printStackTrace(); } if(System.currentTimeMillis() > (LOAD_IVAL + time)) { parser = new RSSParser(url); time = System.currentTimeMillis(); } } } public void actionPerformed(ActionEvent e) { if(e.getSource() == next) { if(header) { breakHeader = true; } else { can.forward(); } } } } jftp-1.52.orig/src/java/net/sf/jftp/tools/FileSearch.java0000700000175000017500000003326111112477774022305 0ustar varunvarun/* * 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. */ package net.sf.jftp.tools; import java.io.BufferedInputStream; import java.io.BufferedOutputStream; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.DataInputStream; import java.io.File; import java.io.FileOutputStream; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.net.Socket; import java.util.Enumeration; import java.util.Hashtable; import java.util.StringTokenizer; import java.util.Vector; import net.sf.jftp.system.LocalIO; import net.sf.jftp.system.logging.Log; public class FileSearch { private int currentDepth = 0; private Hashtable checked = new Hashtable(); public static boolean quiet = true; public static boolean ultraquiet = false; String localDir = "."; int MAX = 999999; int MIN_TERM = 1; int MIN_FACTOR = 1; boolean LOAD = false; String[] typeArray = { "" }; String[] termArray = { "" }; String[] optArray = { "" }; String[] ignoreArray = { "" }; String[] scanArray = { "" }; public static void main(String argv[]) { String[] typeArray = { ".gz", ".bz2", ".zip", ".rar" }; String[] termArray = { "linux", "kernel" }; String[] optArray = { "download", "file", "mirror", "location" }; String[] ignoreArray = { ".gif", ".jpg", ".png", ".swf", ".jar", ".class", ".google." }; String[] scanArray = { ".html", ".htm", "/", ".jsp", ".jhtml", ".phtml", ".asp", ".xml", ".js", ".cgi" }; String url = "http://www.google.de/search?hl=de&q="; for(int i=0; i>> URL: "+url); Log.out(">>> Scanning for "); for(int i = 0; i < typeArray.length; i++) { Log.out(typeArray[i] + " "); } Log.out(""); Log.out("Fetching initial HTML file..."); Getter urlGetter = new Getter(localDir); urlGetter.fetch(url, true); Log.out("Searching for links..."); LocalIO.pause(500); crawl(url); } catch(Exception ex) { ex.printStackTrace(); } } private String clear(String url) { int idx = url.indexOf("http://"); if(idx >= 0) { url = url.substring(7); } return url; } private Vector addVector(Vector v, Vector x) { Enumeration e = x.elements(); while(e.hasMoreElements()) { String next = (String) e.nextElement(); v.add(next); } return v; } private int rate(String content) { int score = 0; for(int i=0; i= 0) score += 3; } if(score < MIN_TERM) return 0; for(int i=0; i= 0) score++; } return score; } private int checkForResult(String url) { //for(int i=0; i= 0) return 2; //} for(int i=0; i= 0) return -1; } if(!checkForScanableUrl(url)) return -1; return 1; } private boolean checkForScanableUrl(String url) { if(checked.containsKey(url)) { return false; } else { checked.put(url, ""); } if(url.indexOf("/") > 0) { String tmp = url.substring(0, url.indexOf("/")); } for(int i=0; i "+urlRating+" @"+currentDepth); if(urlRating > 0) { //System.out.println("!!!"); //Getter.chill(1000); //System.exit(0); } else if(urlRating < 0 && currentDepth > 0) { if(!quiet) Log.out("SKIP "+url); return; } Getter urlGetter = new Getter(localDir); String content = urlGetter.fetch(url); int factor = rate(content); if(!quiet) Log.out("Content-Rating: "+url+" -> "+factor+" @"+currentDepth); if(factor < MIN_FACTOR) { if(!quiet) Log.out("DROP: "+url); return; } if(!ultraquiet) Log.out("Url: "+url+" -> "+urlRating+":"+factor+"@"+currentDepth); Vector m = sort(content, url.substring(0, url.lastIndexOf("/")), "href=\""); m = addVector(m, sort(content, url.substring(0, url.lastIndexOf("/")), "src=\"")); m = addVector(m, sort(content, url.substring(0, url.lastIndexOf("/")), "HREF=\"")); m = addVector(m, sort(content, url.substring(0, url.lastIndexOf("/")), "SRC=\"")); Enumeration links = m.elements(); while(links.hasMoreElements()) { String next = (String) links.nextElement(); if(!quiet) Log.out("PROCESS: " + next); boolean skip = false; while(!skip) { for(int i = 0; i < typeArray.length; i++) { if(next.endsWith(typeArray[i]) || typeArray[i].trim().equals("*")) { Log.out("HIT: "+url+" -> "+next); //Getter.chill(2000); if(!LOAD || !checkForScanableUrl(url)) continue; int x = next.indexOf("/"); if((x > 0) && (next.substring(0, x).indexOf(".") > 0)) { Getter urlGetter2 = new Getter(localDir); urlGetter2.fetch(next, false); continue; } } } skip = true; } if(currentDepth < MAX) { int x = next.indexOf("/"); if((x > 0) && (next.substring(0, x).indexOf(".") > 0)) { currentDepth++; crawl(next); currentDepth--; } } } } private Vector sort(String content, String url, String index) { Vector res = new Vector(); int wo = 0; while(true) { wo = content.indexOf(index); if(wo < 0) { return res; } content = content.substring(wo + index.length()); String was = content.substring(0, content.indexOf("\"")); was = createAbsoluteUrl(was, url); res.add(was); if(!quiet) Log.out("ADD: " + was); } } private String[] check(String auswahl) { StringTokenizer tokenizer = new StringTokenizer(auswahl, "-", false); String[] strArr = new String[tokenizer.countTokens()]; int tmp = 0; while(tokenizer.hasMoreElements()) { strArr[tmp] = (String) tokenizer.nextElement(); tmp++; } return strArr; } private String createAbsoluteUrl(String newLink, String baseUrl) { newLink = clear(newLink); if(newLink.startsWith(baseUrl)) { return newLink; } if(newLink.startsWith("/") && (baseUrl.indexOf("/") > 0)) { newLink = baseUrl.substring(0, baseUrl.indexOf("/")) + newLink; } else if(newLink.startsWith("/") && (baseUrl.indexOf("/") < 0)) { newLink = baseUrl + newLink; } else if((newLink.indexOf(".") > 0)) { int idx = newLink.indexOf("/"); String tmp = ""; if(idx >= 0) { tmp = newLink.substring(0, idx); } if((tmp.indexOf(".") > 0)) { return clear(newLink); } if(baseUrl.endsWith("/")) { newLink = baseUrl + newLink; } else { newLink = baseUrl + "/" + newLink; } } //Log.out("-> " + newLink); return newLink; } } class Getter { private String localDir = null; public Getter(String localDir) { this.localDir = localDir; } public String fetch(String url) { try { String host = url.substring(0, url.indexOf("/")); String wo = url.substring(url.indexOf("/")); String result = ""; //Log.out(">> " + host + wo); Socket deal = new Socket(host, 80); deal.setSoTimeout(5000); BufferedWriter out = new BufferedWriter(new OutputStreamWriter(deal.getOutputStream())); BufferedReader in = new BufferedReader(new InputStreamReader(deal.getInputStream())); out.write("GET http://" + url + " HTTP/1.0\n\n"); out.flush(); int len = 0; while(!in.ready() && (len < 5000)) { chill(100); len += 100; } while(in.ready()) { result = result + in.readLine(); } out.close(); in.close(); return result; } catch(Exception ex) { if(!FileSearch.quiet) ex.printStackTrace(); } return ""; } public void fetch(String url, boolean force) { try { String host = url.substring(0, url.indexOf("/")); String wo = url.substring(url.indexOf("/")); String result = ""; if(!FileSearch.quiet) Log.debug(">>> " + host + wo); //JFtp.statusP.jftp.ensureLogging(); File d = new File(localDir); d.mkdir(); File f = new File(localDir + wo.substring(wo.lastIndexOf("/") + 1)); if(f.exists() && !force) { if(!FileSearch.quiet) Log.debug(">>> file already exists..."); return; } else { f.delete(); } Socket deal = new Socket(host, 80); BufferedWriter out = new BufferedWriter(new OutputStreamWriter(deal.getOutputStream())); DataInputStream in = new DataInputStream(new BufferedInputStream(deal.getInputStream())); BufferedOutputStream localOut = new BufferedOutputStream(new FileOutputStream(localDir + wo.substring(wo.lastIndexOf("/") + 1))); byte[] alu = new byte[2048]; out.write("GET http://" + url + " HTTP/1.0\n\n"); out.flush(); boolean line = true; boolean bin = false; while(true) { chill(10); String tmp = ""; while(line) { String x = in.readLine(); if(x == null) { break; } tmp += (x + "\n"); if(x.equals("")) { line = false; } } int x = in.read(alu); if(x == -1) { if(line) { localOut.write(tmp.getBytes(), 0, tmp.length()); } out.close(); in.close(); localOut.flush(); localOut.close(); return; } else { localOut.write(alu, 0, x); } } } catch(Exception ex) { if(!FileSearch.quiet) ex.printStackTrace(); } } public static void chill(int time) { try { Thread.sleep(time); } catch(Exception ex) { } } } jftp-1.52.orig/src/java/net/sf/jftp/JFtp.java0000700000175000017500000012213011264340373017765 0ustar varunvarun/* * 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. */ package net.sf.jftp; import java.awt.BorderLayout; import java.awt.Component; import java.awt.Dimension; import java.awt.FlowLayout; import java.awt.Image; import java.awt.Point; import java.awt.Toolkit; import java.awt.datatransfer.DataFlavor; import java.awt.datatransfer.Transferable; import java.awt.dnd.DnDConstants; import java.awt.dnd.DropTarget; import java.awt.dnd.DropTargetDragEvent; import java.awt.dnd.DropTargetDropEvent; import java.awt.dnd.DropTargetEvent; import java.awt.dnd.DropTargetListener; import java.awt.event.ActionListener; import java.awt.event.ComponentEvent; import java.awt.event.ComponentListener; import java.awt.event.WindowEvent; import java.awt.event.WindowListener; import java.io.BufferedInputStream; import java.io.BufferedOutputStream; import java.io.DataInputStream; import java.io.File; import java.io.FileOutputStream; import java.io.PrintWriter; import java.io.Reader; import java.io.StringWriter; import java.net.URL; import java.util.Hashtable; import javax.swing.JDesktopPane; import javax.swing.JFrame; import javax.swing.JInternalFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JScrollBar; import javax.swing.JScrollPane; import javax.swing.JSplitPane; import javax.swing.JTabbedPane; import javax.swing.JTextArea; import javax.swing.JToolBar; import javax.swing.SwingUtilities; import javax.swing.UIManager; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import javax.swing.event.InternalFrameEvent; import javax.swing.event.InternalFrameListener; import javax.swing.plaf.basic.BasicInternalFrameTitlePane.RestoreAction; import net.sf.jftp.config.Settings; import net.sf.jftp.gui.base.AppMenuBar; import net.sf.jftp.gui.base.DownloadList; import net.sf.jftp.gui.base.DownloadQueue; import net.sf.jftp.gui.base.LocalDir; import net.sf.jftp.gui.base.LogFlusher; import net.sf.jftp.gui.base.RemoteDir; import net.sf.jftp.gui.base.StatusPanel; import net.sf.jftp.gui.base.dir.Dir; import net.sf.jftp.gui.base.dir.DirEntry; import net.sf.jftp.gui.framework.FileTransferable; import net.sf.jftp.gui.framework.GUIDefaults; import net.sf.jftp.gui.framework.HDesktopBackground; import net.sf.jftp.gui.framework.HImage; import net.sf.jftp.gui.hostchooser.HostChooser; import net.sf.jftp.gui.hostchooser.SftpHostChooser; import net.sf.jftp.gui.tasks.HostInfo; import net.sf.jftp.net.BasicConnection; import net.sf.jftp.net.ConnectionHandler; import net.sf.jftp.net.ConnectionListener; import net.sf.jftp.net.FilesystemConnection; import net.sf.jftp.net.FtpConnection; import net.sf.jftp.system.LocalIO; import net.sf.jftp.system.UpdateDaemon; import net.sf.jftp.system.logging.Log; import net.sf.jftp.system.logging.Logger; import net.sf.jftp.tools.RSSFeeder; public class JFtp extends JPanel implements WindowListener, ComponentListener, Logger, ChangeListener, InternalFrameListener { public static boolean mainUsed = false; public static StatusPanel statusP; public static JLabel statusL = new JLabel("Welcome to JFtp... "); public static JFrame mainFrame; public static Dir localDir; public static Dir remoteDir; public static DownloadList dList = new DownloadList(); public static DownloadQueue dQueue = new DownloadQueue(); public static boolean uiBlocked = false; public static HostInfo hostinfo = new HostInfo(); //public static BasicConnection controlConnection = null; private static ConnectionHandler defaultConnectionHandler = new ConnectionHandler(); public static JDesktopPane desktop = new JDesktopPane(); private static JScrollPane logSp; public static JTextArea log; //***appMenuBar: this must now be a public object that JFtp refers to public static AppMenuBar menuBar = null; public static final int CAPACITY = 9; //number of connections remembered public static final int CONNECTION_DATA_LENGTH = 10; public static DropTarget dropTarget; public static DropTargetListener dtListener; public static int acceptableActions = DnDConstants.ACTION_COPY; private LogFlusher flusher; private boolean initSize = true; public JTabbedPane remoteConnectionPanel = new JTabbedPane(); public JTabbedPane localConnectionPanel = new JTabbedPane(); private String oldText = ""; private HDesktopBackground background; /** JSplitPane that holds the directory panes and the log/dl JSplitPane */ private JSplitPane workP = null; /** JSplitPane that holds the log download parts */ private JSplitPane logP = null; private JInternalFrame j1; private JInternalFrame j2; private JInternalFrame j3; private JInternalFrame j4; private JInternalFrame j5; private Hashtable internalFrames = new Hashtable(); public HostChooser hc; private String buffer = ""; private long oldtime = 0; private UpdateDaemon daemon; public RSSFeeder feeder; //*** public JFtp() { Log.setLogger(this); // we have jesktop-environment if(statusP != null) { statusP.remove(statusP.close); } init(); } public JFtp(boolean mainUsed) { Log.setLogger(this); this.mainUsed = mainUsed; init(); } public void init() { dtListener = new DTListener(); dropTarget = new DropTarget(this, this.acceptableActions, dtListener, true); setLayout(new BorderLayout()); setBackground(GUIDefaults.mainBack); setForeground(GUIDefaults.front); statusP = new StatusPanel(this); add("North", statusP); localDir = (Dir) new LocalDir(Settings.defaultWorkDir); localDir.setDownloadList(dList); remoteDir = (Dir) new RemoteDir(); remoteDir.setDownloadList(dList); desktop.setDropTarget(this.dropTarget); Dimension d = Settings.getWindowSize(); setPreferredSize(d); setSize(d); int width = (int) d.getWidth(); int height = (int) d.getHeight(); dList.setMinimumSize(new Dimension((int) (width / 2.5), (int) (height * 0.20))); dList.setPreferredSize(new Dimension((int) (width / 2.5), (int) (height * 0.25))); dList.setSize(new Dimension((int) (width / 2.5), (int) (height * 0.25))); desktop.setDragMode(JDesktopPane.OUTLINE_DRAG_MODE); addBackgroundImage(); j1 = new JInternalFrame("Local filesystem", true, false, true, true); j1.setMinimumSize(new Dimension(300, 300)); j1.setLocation(5, 5); localConnectionPanel.addTab("file://", null, (Component) localDir, "Filesystem"); localConnectionPanel.setSelectedIndex(0); localConnectionPanel.addChangeListener(this); j1.getContentPane().add(localConnectionPanel); localDir.fresh(); desktop.add(j1); j1.setDefaultCloseOperation(JInternalFrame.DO_NOTHING_ON_CLOSE); j1.addInternalFrameListener(this); j1.pack(); j1.setSize(new Dimension(400, j1.getSize().height)); j1.show(); j2 = new JInternalFrame("Remote connections", true, false, true, true); j2.setLocation(430, 5); remoteConnectionPanel.addTab("file://", null, (Component) remoteDir, "Filesystem"); remoteConnectionPanel.setSelectedIndex(0); remoteConnectionPanel.addChangeListener(this); j2.getContentPane().add(remoteConnectionPanel); desktop.add(j2); j2.setDefaultCloseOperation(JInternalFrame.DO_NOTHING_ON_CLOSE); j2.addInternalFrameListener(this); j2.pack(); j2.setSize(new Dimension(415, j1.getSize().height)); j2.show(); log = new JTextArea(); log.setBackground(GUIDefaults.light); log.setForeground(GUIDefaults.front); log.setEditable(false); logSp = new JScrollPane(log); logSp.setSize(new Dimension(438, 148)); j5 = new JInternalFrame("Queue System", true, false, true, true); j5.setLocation(5, 400); j5.getContentPane().add(dQueue, BorderLayout.CENTER); desktop.add(j5); j5.pack(); j5.setSize(new Dimension(440, 150)); j5.show(); j3 = new JInternalFrame("Log", true, false, true, true); int x = (int) (desktop.getSize().width / 2); j3.setLocation(5, 425); j3.getContentPane().add(logSp, BorderLayout.CENTER); desktop.add(j3); j3.pack(); j3.setSize(new Dimension(440, 150)); j3.show(); j4 = new JInternalFrame("Download Manager", true, false, true, true); j4.setLocation(450, 425); j4.getContentPane().add(dList, BorderLayout.CENTER); desktop.add(j4); j4.pack(); j4.setSize(new Dimension(380, 150)); j4.show(); j1.toFront(); j2.toFront(); add("Center", desktop); JToolBar j = new JToolBar(); j.setFloatable(false); j.add(statusP.status, FlowLayout.LEFT); if(Settings.getEnableRSS()) { feeder = new RSSFeeder(); j.add(feeder); } add("South", j); addComponentListener(this); componentResized(new ComponentEvent(log, 0)); restoreInternalPositions(); validate(); setVisible(true); if(!mainUsed) { SwingUtilities.invokeLater(new Runnable() { public void run() { chooseHost(); } }); } else { chooseHost(); } flusher = new LogFlusher(); daemon = new UpdateDaemon(this); } protected void chooseHost() { hc = new HostChooser(this); if(!mainUsed) { hc.update(); } } public static String getHost() { return statusP.getHost(); } public static void setHost(String which) { statusP.setHost(which); } public static void localUpdate() { localDir.fresh(); } public static void remoteUpdate() { remoteDir.fresh(); } private void saveInternalPositions() { saveInternalPosition(j1, "local"); saveInternalPosition(j2, "remote"); saveInternalPosition(j5, "queue"); saveInternalPosition(j3, "log"); saveInternalPosition(j4, "manager"); } private void restoreInternalPositions() { if(Settings.getProperty("jftp.iframes.resize").equals("false")) { } else { restoreInternalPosition(j1, "local"); restoreInternalPosition(j2, "remote"); restoreInternalPosition(j5, "queue"); restoreInternalPosition(j3, "log"); restoreInternalPosition(j4, "manager"); } } private void restoreInternalPosition(JInternalFrame f, String desc) { String x = Settings.getProperty("jftp.iframes."+desc+".x"); String y = Settings.getProperty("jftp.iframes."+desc+".y"); String w = Settings.getProperty("jftp.iframes."+desc+".width"); String h = Settings.getProperty("jftp.iframes."+desc+".height"); if(x.indexOf(".") >= 0) x = x.substring(0, x.indexOf(".")); if(y.indexOf(".") >= 0) y = y.substring(0, y.indexOf(".")); try { f.setLocation(Integer.parseInt(x), Integer.parseInt(y)); f.setSize(Integer.parseInt(w), Integer.parseInt(h)); } catch(Exception ex) { Log.out("Can not set internal fram position for: "+desc); ex.printStackTrace(); } } private void saveInternalPosition(JInternalFrame f, String desc) { Point p = f.getLocation(); Settings.setProperty("jftp.iframes."+desc+".x", ""+p.getX()); Settings.setProperty("jftp.iframes."+desc+".y", ""+p.getY()); Settings.setProperty("jftp.iframes."+desc+".width", f.getWidth()); Settings.setProperty("jftp.iframes."+desc+".height", f.getHeight()); } public void windowClosing(WindowEvent e) { saveInternalPositions(); Settings.setProperty("jftp.window.width", this.getWidth()); Settings.setProperty("jftp.window.height", this.getHeight()); if(!mainUsed) { Settings.setProperty("jftp.window.x", (int) this.getLocationOnScreen().getX()); Settings.setProperty("jftp.window.y", (int) this.getLocationOnScreen().getY()); } else { Settings.setProperty("jftp.window.x", (int) mainFrame.getLocationOnScreen().getX()); Settings.setProperty("jftp.window.y", (int) mainFrame.getLocationOnScreen().getY()); } Settings.save(); safeDisconnect(); if(Settings.isStandalone) { System.exit(0); } else { mainFrame.dispose(); } } public static void safeDisconnect() { BasicConnection con = remoteDir.getCon(); if((con != null) && con.isConnected()) { try { con.disconnect(); } catch(Exception ex) { } } FilesystemConnection c = new FilesystemConnection(); c.addConnectionListener((ConnectionListener) remoteDir); remoteDir.setCon(c); if(!c.chdir("/")) { c.chdir("C:\\"); } } public void windowClosed(WindowEvent e) { } public void windowActivated(WindowEvent e) { } public void windowDeactivated(WindowEvent e) { } public void windowIconified(WindowEvent e) { } public void windowDeiconified(WindowEvent e) { } public void windowOpened(WindowEvent e) { } public void componentHidden(ComponentEvent e) { } public void componentMoved(ComponentEvent e) { } public void componentShown(ComponentEvent e) { } public void componentResized(ComponentEvent e) { localDir.actionPerformed(this, "local"); remoteDir.actionPerformed(this, "remote"); desktop.remove(background); addBackgroundImage(); validate(); System.out.println(statusP.status); statusP.status.fresh(); } public void addBackgroundImage() { try { background = new HDesktopBackground(Settings.background, null); background.setBounds(0, 0, getSize().width, getSize().height); desktop.add(background, new Integer(Integer.MIN_VALUE)); } catch(Exception ex) { Log.out(Settings.background + " missing, no background image used"); } } private static void compile() { /* try { Compiler.enable(); System.out.println(Compiler.compileClass(Class.forName("java.util.Hashtable"))); System.out.println(Compiler.compileClasses("net.sf.jftp")); System.out.println(Compiler.compileClasses("net.sf.jftp.JFtp")); System.out.println(Compiler.compileClasses("JFtp")); } catch(ClassNotFoundException ex) { ex.printStackTrace(); } */ } private static void setSocksProxyOptions(String proxy, String port) { if(proxy.equals("") || port.equals("")) { return; } java.util.Properties sysprops = System.getProperties(); // Remove previous values sysprops.remove("socksProxyHost"); sysprops.remove("socksProxyPort"); // Set your values sysprops.put("socksProxyHost", proxy); sysprops.put("socksProxyPort", port); Log.out("socks proxy: " + sysprops.get("socksProxyHost") + ":" + sysprops.get("socksProxyPort")); } public static void main(String[] argv) { try { long start = System.currentTimeMillis(); Log.out("starting up jftp..."); compile(); System.setProperty("sshtools.logfile", Settings.appHomeDir + "log4.txt"); if(Settings.autoUpdate) { checkForUpgrade(); } Settings.enableResuming = true; Settings.enableUploadResuming = true; Settings.noUploadResumingQuestion = false; setSocksProxyOptions(Settings.getSocksProxyHost(), Settings.getSocksProxyPort()); JFtp jftp = new JFtp(true); UIManager.getLookAndFeelDefaults().put("ClassLoader", jftp.getClass().getClassLoader()); //boolean lookSet = false; String tmp = Settings.getLookAndFeel(); //UIManager.installLookAndFeel("Metouia", "net.sourceforge.mlf.metouia.MetouiaLookAndFeel"); if(tmp != null) { jftp.setLookAndFeel(Settings.getLookAndFeel()); } else { jftp.setLookAndFeel("net.sourceforge.mlf.metouia.MetouiaLookAndFeel"); } //else //{ // jftp.setLookAndFeel("com.incors.plaf.kunststoff.KunststoffLookAndFeel"); // lookSet = true; //} //if(!lookSet) UIManager.installLookAndFeel("Kunststoff", "com.incors.plaf.kunststoff.KunststoffLookAndFeel"); /* * Don't try to add the Kunststoff look and feel if it has * already been added. */ if((Settings.getLookAndFeel() == null) || !Settings.getLookAndFeel().equals("com.incors.plaf.kunststoff.KunststoffLookAndFeel")) { /* * Somehow even though UIManager.installLookAndFeel throws a * ClassNotFoundException, it ends up getting added to the * list of installed look and feels anyway. What we do here is * make Java throw a ClassNotFoundException before then by * checking whether or not the class exists, and only if the * class exists does it then get added to the list of * available look and feel's. */ try { Class.forName("com.incors.plaf.kunststoff.KunststoffLookAndFeel"); UIManager.installLookAndFeel("Kunststoff", "com.incors.plaf.kunststoff.KunststoffLookAndFeel"); } catch(ClassNotFoundException cnfe) { } } /* * Don't try to add the Metouia look and feel if it has * already been added. */ if((Settings.getLookAndFeel() == null) || !Settings.getLookAndFeel().equals("net.sourceforge.mlf.metouia.MetouiaLookAndFeel")) { /* * Somehow even though UIManager.installLookAndFeel throws a * ClassNotFoundException, it ends up getting added to the * list of installed look and feels anyway. What we do here is * make Java throw a ClassNotFoundException before then by * checking whether or not the class exists, and only if the * class exists does it then get added to the list of * available look and feel's. */ try { Class.forName("net.sourceforge.mlf.metouia.MetouiaLookAndFeel"); UIManager.installLookAndFeel("Metouia", "net.sourceforge.mlf.metouia.MetouiaLookAndFeel"); } catch(ClassNotFoundException cnfe) { } } /* try { Class.forName("com.jgoodies.looks.plastic.PlasticXPLookAndFeel"); UIManager.installLookAndFeel("PlasticXP", "com.jgoodies.looks.plastic.PlasticXPLookAndFeel"); Class.forName("com.jgoodies.looks.plastic.Plastic3DLookAndFeel"); UIManager.installLookAndFeel("Plastic3D", "com.jgoodies.looks.plastic.Plastic3DLookAndFeel"); Class.forName("com.jgoodies.looks.plastic.PlasticLookAndFeel"); UIManager.installLookAndFeel("Plastic", "com.jgoodies.looks.plastic.PlasticLookAndFeel"); Class.forName("com.jgoodies.looks.windows.WindowsLookAndFeel"); UIManager.installLookAndFeel("Windows", "com.jgoodies.looks.windows.WindowsLookAndFeel"); } catch(ClassNotFoundException cnfe) { cnfe.printStackTrace(); } */ mainFrame = new JFrame(); mainFrame.setLocation(Settings.getWindowLocation()); mainFrame.setTitle(Settings.title + " - Version " + getVersion()); mainFrame.setResizable(Settings.resize); mainFrame.addWindowListener(jftp); Image icon = HImage.getImage(jftp, Settings.iconImage); mainFrame.setIconImage(icon); mainFrame.setFont(GUIDefaults.font); //*** MY CHANGES //mainFrame.setJMenuBar(new AppMenuBar(jftp)); menuBar = new AppMenuBar(jftp); mainFrame.setJMenuBar(menuBar); //*** mainFrame.getContentPane().setLayout(new BorderLayout()); mainFrame.getContentPane().add("Center", jftp); SwingUtilities.updateComponentTreeUI(mainFrame); mainFrame.pack(); mainFrame.validate(); mainFrame.setVisible(true); if(argv.length > 0) { if(argv[0].indexOf("sftp:") >= 0) { new SftpHostChooser().update(argv[0].replaceAll("sftp:", "ftp:")); } else { jftp.hc.update(argv[0]); } } else { //jftp.hc.update(); } Log.out("jftp is up and running."); long end = System.currentTimeMillis(); Log.out("startup time: " + (end - start) + "ms."); } catch(Error ex) { ex.printStackTrace(); } } private void log(String msg) { if(msg.startsWith("200") || msg.startsWith("227")) { if((msg.indexOf("NOOP") > 0) || (msg.indexOf("Type") > 0) || (msg.indexOf("MODE") > 0) || (msg.indexOf("Passive") > 0)) { if(Settings.hideStatus) { return; } } } else if(log == null) { return; } if(!msg.equals("")) { buffer = buffer + " " + msg; } log.append(buffer); buffer = ""; long time = System.currentTimeMillis(); if(((time - oldtime) < Settings.uiRefresh)) { UpdateDaemon.updateLog(); return; } oldtime = time; JScrollBar bar = logSp.getVerticalScrollBar(); bar.setValue(bar.getMaximum()); //logSp.paintImmediately(0, 0, logSp.getSize().width, // logSp.getSize().height); /* SwingUtilities.invokeLater(new Runnable() { public void run() { repaint(); //paintImmediately(0, 0, getSize().width, getSize().height); } }); */ repaint(); revalidate(); } private void logRaw(String msg) { log.append(" " + msg); Log.out("NOTE: logRaw called"); paintImmediately(0, 0, getSize().width, getSize().height); //logSp.paintImmediately(0,0,logSp.getSize().width,logSp.getSize().height); } public void clearLog() { log.setText(""); logSp.paintImmediately(0, 0, logSp.getSize().width, logSp.getSize().height); } private void log(String msg, Throwable throwable) { PrintWriter p = new PrintWriter(new StringWriter()); throwable.printStackTrace(p); log(msg); log(p.toString()); } public void debug(String msg) { log(msg + "\n"); } public void debugRaw(String msg) { logRaw(msg); } public void debug(String msg, Throwable throwable) { log(msg, throwable); } public void warn(String msg) { log(msg); } public void warn(String msg, Throwable throwable) { log(msg, throwable); } public void error(String msg) { log(msg); } public void error(String msg, Throwable throwable) { log(msg, throwable); } public void info(String msg) { log(msg); } public void info(String msg, Throwable throwable) { log(msg, throwable); } public void fatal(String msg) { log(msg); } public void fatal(String msg, Throwable throwable) { log(msg, throwable); } public void debugSize(int size, boolean recv, boolean last, String file) { } public static String getVersion() { try { URL u = ClassLoader.getSystemResource(Settings.readme); if(u == null) { u = HImage.class.getResource("/" + Settings.readme); } DataInputStream i = new DataInputStream(u.openStream()); String tmp = i.readLine(); tmp = tmp.substring(tmp.lastIndexOf(">") + 1); tmp = tmp.substring(0, tmp.indexOf("<")); return tmp; } catch(Exception ex) { } return ""; } private static void checkForUpgrade() { try { Log.out("Checking for updates..."); URL u = ClassLoader.getSystemResource(Settings.readme); if(u == null) { u = HImage.class.getResource("/" + Settings.readme); } DataInputStream i = new DataInputStream(u.openStream()); String tmp = i.readLine(); tmp = tmp.substring(tmp.lastIndexOf(">")); tmp = tmp.substring(tmp.indexOf(".") + 1); tmp = tmp.substring(0, tmp.indexOf("<")); int x = Integer.parseInt(tmp) + 1; String nextVersion = "jftp-1."; if(x < 10) { nextVersion = nextVersion + "0"; } nextVersion = nextVersion + x + ".tar.gz"; //System.out.println(nextVersion); File dl = new File(nextVersion); if(!dl.exists() || (dl.length() <= 0)) { URL url = new URL("http://osdn.dl.sourceforge.net/sourceforge/j-ftp/" + nextVersion); BufferedOutputStream f = new BufferedOutputStream(new FileOutputStream(dl)); BufferedInputStream in = new BufferedInputStream(url.openStream()); byte[] buf = new byte[4096]; int stat = 1; Log.out("\ndownloading update: " + dl.getAbsolutePath() + "\n\n"); while(stat > 0) { //while(in.available() <= 0) LocalIO.pause(10); stat = in.read(buf); if(stat == -1) { break; } f.write(buf, 0, stat); System.out.print("."); } f.flush(); f.close(); in.close(); } Log.out("\n\n\na newer version was found!\nplease install the File " + dl.getAbsolutePath() + " or even better visit the homepage to download the latest version...\n" + "you can turn this feature off if you don't like it (view readme for details)\n\nStarting anyway...\n\n"); //LocalIO.pause(5000); //System.exit(0); } catch(Exception ex) { // FileNotFoundException, everything is ok //ex.printStackTrace(); } Log.out("finished check..."); } public static ConnectionHandler getConnectionHandler() { BasicConnection con = remoteDir.getCon(); if((con != null) && con instanceof FtpConnection) { return ((FtpConnection) con).getConnectionHandler(); } else { return defaultConnectionHandler; } } public void fireUpdate() { // if(!(JFtp.remoteDir.getCon() instanceof FilesystemConnection)) LocalIO.pause(200); repaint(); /* else { LocalIO.pause(200); paintImmediately(0,0,getSize().width,getSize().height); } */ } public void ensureLogging() { if(buffer.equals("")) { JScrollBar bar; if((logSp == null) || ((bar = logSp.getVerticalScrollBar()) == null) || bar == null || (bar.getValue() == bar.getMaximum()) || bar.getValueIsAdjusting()) { return; } else { bar.setValue(bar.getMaximum()); logSp.repaint(); /* logSp.paintImmediately(0, 0, logSp.getSize().width, logSp.getSize().height); */ /* SwingUtilities.invokeLater(new Runnable() { public void run() { repaint(); //paintImmediately(0, 0, getSize().width, // getSize().height); } }); */ repaint(); revalidate(); } return; } Log.out("flushing log buffer..."); oldtime = 0; log(""); } public void setLookAndFeel(String name) { if(name == null) { return; } try { UIManager.setLookAndFeel(name); if(mainFrame != null) { //SwingUtilities.updateComponentTreeUI(mainFrame); //invalidate(); //validate(); //repaint(); SwingUtilities.invokeLater(new Runnable() { public void run() { SwingUtilities.updateComponentTreeUI(mainFrame); SwingUtilities.updateComponentTreeUI(JFtp.statusP); } }); } } catch(Exception ex) { Log.debug("Error setting look and feel: " + ex); } } public void addConnection(String name, BasicConnection con) { con.addConnectionListener((ConnectionListener) localDir); Dir tmp = (Dir) new RemoteDir(); tmp.setDownloadList(dList); con.addConnectionListener((ConnectionListener) tmp); tmp.setCon(con); int x = remoteConnectionPanel.getSelectedIndex(); remoteConnectionPanel.addTab(parse(name), null, (Component) tmp, "Switch to: " + parse(name)); remoteConnectionPanel.setSelectedIndex(x + 1); j2.setClosable(true); } public void addLocalConnection(String name, BasicConnection con) { con.addConnectionListener((ConnectionListener) remoteDir); Dir tmp = (Dir) new LocalDir(); tmp.setDownloadList(dList); con.addConnectionListener((ConnectionListener) tmp); tmp.setCon(con); int x = localConnectionPanel.getSelectedIndex(); localConnectionPanel.addTab(parse(name), null, (Component) tmp, "Switch to: " + parse(name)); localConnectionPanel.setSelectedIndex(x + 1); j1.setClosable(true); } private String parse(String what) { if(what.indexOf("@") >= 0) { return what.substring(what.lastIndexOf("@") + 1); } else { return what; } } public void stateChanged(ChangeEvent e) { remoteDir = (Dir) remoteConnectionPanel.getSelectedComponent(); localDir = (Dir) localConnectionPanel.getSelectedComponent(); remoteDir.getCon().setLocalPath(localDir.getPath()); //localDir.getCon().setLocalPath(remoteDir.getPath()); } public void closeCurrentTab() { int x = remoteConnectionPanel.getSelectedIndex(); if(x > 0) { safeDisconnect(); remoteConnectionPanel.remove(x); remoteConnectionPanel.setSelectedIndex(x - 1); } if(remoteConnectionPanel.getTabCount() < 2) { j2.setClosable(false); } } public void closeCurrentLocalTab() { int x = localConnectionPanel.getSelectedIndex(); if(x > 0) { BasicConnection con = localDir.getCon(); if((con != null) && con.isConnected()) { try { con.disconnect(); } catch(Exception ex) { } } localConnectionPanel.remove(x); localConnectionPanel.setSelectedIndex(x - 1); } if(localConnectionPanel.getTabCount() < 2) { j1.setClosable(false); } } public void addToDesktop(String title, Component c, int w, int h) { JInternalFrame jt = new JInternalFrame(title, false, true, false, true); if(w < 500) { jt.setLocation(200, 100); } else { jt.setLocation(80, 100); } jt.getContentPane().add(c); desktop.add(jt); internalFrames.put("" + c.hashCode(), jt); jt.pack(); jt.setSize(new Dimension(w, h)); jt.show(); } public void removeFromDesktop(int component) { JInternalFrame f = (JInternalFrame) internalFrames.get("" + component); if(f != null) { f.dispose(); //internalFrames.remove(component); } else { Log.debug("ERROR: " + component + " not found in Hashtable!"); } } public void setClosable(int component, boolean ok) { JInternalFrame f = (JInternalFrame) internalFrames.get("" + component); if(f != null) { f.setClosable(ok); } else { Log.debug("ERROR: " + component + " not found in Hashtable!"); } } public void setLocation(int component, int x, int y) { JInternalFrame f = (JInternalFrame) internalFrames.get("" + component); if(f != null) { f.setLocation(x, y); } else { Log.debug("ERROR: " + component + " not found in Hashtable!"); } } //*** REFRESH MENU BAR public static void updateMenuBar() { //mainFrame.setJMenuBar(new AppMenuBar(this)); menuBar.resetFileItems(); } public void internalFrameClosing(InternalFrameEvent e) { if(e.getSource() == j1) { closeCurrentLocalTab(); } else if(e.getSource() == j2) { closeCurrentTab(); } } public void internalFrameActivated(InternalFrameEvent e) { } public void internalFrameClosed(InternalFrameEvent e) { } public void internalFrameDeactivated(InternalFrameEvent e) { } public void internalFrameDeiconified(InternalFrameEvent e) { } public void internalFrameIconified(InternalFrameEvent e) { } public void internalFrameOpened(InternalFrameEvent e) { } public void drop() { try { handleDrop(null, Toolkit.getDefaultToolkit().getSystemClipboard() .getContents(this)); } catch(Exception ex) { ex.printStackTrace(); } } public void handleDrop(DropTargetDropEvent e, Transferable t) throws Exception { System.out.println("Starting dropAttempt"); DataFlavor chosen = DataFlavor.javaFileListFlavor; DataFlavor second = FileTransferable.plainTextFlavor; DataFlavor flavor = null; Object data = null; if(e != null) { flavor = e.getCurrentDataFlavors()[0]; e.acceptDrop(acceptableActions); Class c = flavor.getDefaultRepresentationClass(); } if(flavor == null) { flavor = second; } String name = ""; if(t.isDataFlavorSupported(chosen)) { System.out.println("Using List DnD style"); java.util.List myList = (java.util.List) t.getTransferData(chosen); File[] f = (File[]) myList.toArray(); for(int i = 0; i < f.length; i++) { name = f[i].getAbsolutePath(); System.out.println("DnD file: " + name); } draggedTransfer(f, name); } else if(t.isDataFlavorSupported(second)) { System.out.println("Using text/plain DnD style"); data = t.getTransferData(flavor); String str = ""; int i = 0; if(data instanceof Reader) { int c; while((c = ((Reader) data).read()) != -1) { if(((i == 1) && (c == 0))) { //System.out.println("Applying charset bugfix"); i = -1; } else { str = str + new Character((char) c).toString(); } i++; } } else { str = "" + data; } System.out.println("Object data: \"" + str + "\""); if(str.startsWith("<")) { Log.debug("Mozilla DnD detected (preparsing)"); str = str.substring(str.indexOf("\"") + 1); str = str.substring(0, str.indexOf("\"")); Log.debug("Parsed data: " + str); } //str = "[c:\\windows\\test.txt]"; if(str.indexOf("[") >= 0) { Log.debug("Windows DnD detected"); name = str.substring(str.indexOf("[") + 1); name = name.substring(0, name.lastIndexOf("]")); // last was str } else if(new String(str).startsWith("file://")) { name = str.substring(7); Log.debug("File URL DnD detected: " + name); } if(!new File(name).exists()) { System.out.println("No file string in clipboard: " + name); return; } System.out.println("DnD file: " + name); File[] f1 = new File[1]; f1[0] = new File(name); draggedTransfer(f1, name); } } private void draggedTransfer(File[] f, String name) { if((f.length == 1) && f[0].isFile()) { String path = ""; if(name.indexOf("/") >= 0) { path = name.substring(0, name.lastIndexOf("/") + 1); name = name.substring(name.lastIndexOf("/") + 1); } Log.debug("DnD: " + path + " -> " + name); //TODO: parse "\\" if(!path.trim().equals("")) { ((LocalDir) localDir).chdir(path); } ((LocalDir) localDir).startTransfer(new DirEntry(name, ((ActionListener) localDir))); } else { Log.debug("Dragging multiple files or dirs is not yet supported."); } } class DTListener implements DropTargetListener { public void dragEnter(DropTargetDragEvent e) { e.acceptDrag(JFtp.acceptableActions); } public void dragOver(DropTargetDragEvent e) { e.acceptDrag(JFtp.acceptableActions); } public void dropActionChanged(DropTargetDragEvent e) { e.acceptDrag(JFtp.acceptableActions); } public void dragExit(DropTargetEvent e) { } public void drop(DropTargetDropEvent e) { try { handleDrop(e, e.getTransferable()); e.dropComplete(true); UpdateDaemon.updateRemoteDir(); } catch(Throwable t) { t.printStackTrace(); e.dropComplete(false); return; } } } } jftp-1.52.orig/src/java/net/sf/jftp/JFtpApplet.java0000700000175000017500000000110411112477774021140 0ustar varunvarunpackage net.sf.jftp; import java.applet.Applet; import java.security.AccessController; import java.security.PrivilegedAction; import net.sf.jftp.config.Settings; public class JFtpApplet extends Applet { public JFtpApplet() { AccessController.doPrivileged(new PrivilegedAction() { public Object run() { Settings.isStandalone = false; JFtp.main(new String[0]); return new Object(); } }); } public void init() { } } jftp-1.52.orig/src/java/net/sf/jftp/config/0000700000175000017500000000000011155274771017531 5ustar varunvarunjftp-1.52.orig/src/java/net/sf/jftp/config/SaveSet.java0000700000175000017500000000522111112477774021752 0ustar varunvarun/* * 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. */ package net.sf.jftp.config; import java.io.*; public class SaveSet { private PrintStream out = null; public SaveSet(String file, String host, String user, String pass, String name, String port) { try { FileOutputStream fos; out = new PrintStream((fos = new FileOutputStream(file))); out.println(host); out.println(user); if(Settings.getStorePasswords()) { out.println(pass); } else { out.println(""); } out.println(name); out.println(port); fos.close(); } catch(Exception ex) { ex.printStackTrace(); } } public SaveSet(String file, String host, String user, String pass, String port, String cwd, String lcwd) { try { out = new PrintStream(new FileOutputStream(file)); out.println(host); out.println(user); if(Settings.getStorePasswords()) { out.println(pass); } else { out.println(""); } out.println(port); out.println(cwd); out.println(lcwd); } catch(Exception ex) { ex.printStackTrace(); } } //*** //***this is for saving advanced option data //***ideally, we'd have it set up so that common code in //***all of these constructors is put in a private method //*** file: the file name //*** lsCMD: the FTP LIST command to be saved public SaveSet(String file, String lsCmd) { try { out = new PrintStream(new FileOutputStream(file)); out.println(lsCmd); } catch(Exception ex) { ex.printStackTrace(); } } } jftp-1.52.orig/src/java/net/sf/jftp/config/Settings.java0000700000175000017500000005542111112477774022207 0ustar varunvarun/* * 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. */ package net.sf.jftp.config; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.util.Properties; public class Settings { private static Properties p = new Properties(); public static final String propertyFilename = System.getProperty("user.home") + File.separator + ".jftp/jftp.properties".replace('/', File.separatorChar); public static boolean IS_JAVA_1_6 = true; public static String sshHostKeyVerificationFile = System.getProperty("user.home") + File.separator + ".jftp" + File.separator + ".ssh_hostfile"; public static final String defaultWidth = "840"; public static final String defaultHeight = "640"; public static final String defaultX = "20"; public static final String defaultY = "20"; public static int maxConnections = 3; public static boolean enableResuming = false; // overridden by JFtp public static boolean enableUploadResuming = false; public static boolean noUploadResumingQuestion = true; public static boolean askToResume = true; public static boolean reconnect = true; public static int uiRefresh = 500; public static int logFlushInterval = 2000; // obsolete public static boolean useLogFlusher = false; // obsolete public static int ftpTransferThreadPause = 2000; public static int smallSize = 0; //100000; public static int smallSizeUp = 0; //50000; public static boolean autoUpdate = false; public static boolean shortProgress = true; private static String defaultFtpPasvMode = "true"; private static String defaultEnableDebug = "false"; private static String enableMultiThreading = "true"; private static String enableSmbMultiThreading = "true"; private static String enableSftpMultiThreading = "true"; private static String noUploadMultiThreading = "false"; private static String storePasswords = "false"; public static boolean newTableGui = getUseJTableLayout(); public static boolean useFixedTableWidths = true; public static boolean enableWebDav = false; // 1: manual, 2: onclick, 0: off public static int runtimeCommands = 2; public static boolean askToRun = true; // currently changed by remotedir on-the-fly public static boolean showDateNoSize = false; public static boolean showLocalDateNoSize = false; // hides some messages like MODE, Type etc. public static boolean hideStatus = false; public static boolean showNewlineOption = false; // for DataConnection - lower means less buffer, more updates in the downloadmanager // i recommend to use values greater than 2048 bytes public static int bufferSize = 8192; // sends NOOPs to ensure that buffers are empty public static boolean safeMode = false; // enables some delays public static boolean enableFtpDelays = false; // title of the app public static final String title = "JFtp - The Java Network Browser"; // overridden title for insomniac client public static final String insomniacTitle = ">>> Insomniac client BETA 1 <<< Based on JFtp "; // override ui with the insomniac client configuration public static boolean isInsomniacClient = false; public static int refreshDelay = 250; public static boolean useDefaultDir = true; // may the windows be resized? public static boolean resize = true; public static boolean showFileSize = true; public static boolean sortDir = true; public static final int visibleFileRows = 15; public static int scrollSpeed = 9; public static int numFiles = 9; public static final int connectionTimeout = 30000; public static final int testTimeout = 5000; public static int statusMessageAfterMillis = 1000; public static final String defaultDir = ""; public static final String defaultWorkDir = System.getProperty("user.home"); public static final String userHomeDir = System.getProperty("user.home"); public static final String appHomeDir = userHomeDir + "/.jftp/".replace('/', File.separatorChar); public static final String greeting = "Have a lot of fun..."; public static final String bookmarks = appHomeDir + "bookmarks.txt".replace('/', File.separatorChar); public static final String ls_out = appHomeDir+".ls_out".replace('/', File.separatorChar); public static final String login_def = appHomeDir + ".login_default".replace('/', File.separatorChar); public static final String login = appHomeDir + ".login".replace('/', File.separatorChar); //*** The new files that I have created public static final String last_cons = appHomeDir + ".last_cons".replace('/', File.separatorChar); public static final String login_def_sftp = appHomeDir + ".last_cons_sftp".replace('/', File.separatorChar); public static final String login_def_smb = appHomeDir + ".last_cons_smb".replace('/', File.separatorChar); public static final String login_def_nfs = appHomeDir + ".last_cons_nfs".replace('/', File.separatorChar); //*** //*** added in version 1.44 public static final String adv_settings = appHomeDir + ".adv_settings".replace('/', File.separatorChar); //*** public static final String readme = "docs/readme"; public static final String changelog = "docs/CHANGELOG"; public static final String todo = "docs/TODO"; public static final String nfsinfo = "docs/doc/nfsinfo"; public static String iconImage; public static String hostImage; public static String closeImage; public static String infoImage; public static String listImage; public static String rmdirImage; public static String mkdirImage; public static String refreshImage; public static String refreshImage2; public static String cdImage; public static String cmdImage; public static String downloadImage; public static String uploadImage; public static String fileImage; public static String dirImage; public static String codeFileImage; public static String textFileImage; public static String execFileImage; public static String audioFileImage; public static String videoFileImage; public static String htmlFileImage; public static String zipFileImage; public static String imageFileImage; public static String presentationFileImage; public static String spreadsheetFileImage; public static String bookFileImage; public static String copyImage; public static String openImage; public static String sftpImage; public static String nfsImage; public static String webdavImage; public static String linkImage; public static String typeImage; public static String deleteImage; public static String deleteImage2; public static String clearImage; public static String clearImage2; public static String resumeImage; public static String resumeImage2; public static String pauseImage; public static String pauseImage2; public static String saveImage; public static String cdUpImage; public static String nextRSSImage; public static String helpImage; public static String background = "images/back.jpg"; //set to false if you want it to run as an applet public static boolean isStandalone = true; public static String hiddenPassword = "<%hidden%>"; public static Object setProperty(String key, String value) { return p.setProperty(key, value); } public static String getProperty(String key) { return ""+p.getProperty(key); } public static Object setProperty(String key, int value) { return p.setProperty(key, Integer.toString(value)); } public static Object setProperty(String key, boolean value) { String val = "false"; if(value) { val = "true"; } return p.setProperty(key, val); } public static void save() { try { new File(System.getProperty("user.home") + File.separator + ".jftp").mkdir(); p.store(new FileOutputStream(propertyFilename), "jftp.properties"); } catch(Exception e) { System.out.println("Cannot save properties..."); //e.printStackTrace(); } } public static boolean getHideLocalDotNames() { String what = p.getProperty("jftp.hideHiddenDotNames", "false"); if(what.trim().equals("false")) { return false; } else { return true; } } public static int getMaxConnections() { return maxConnections; } public static String getSocksProxyHost() { String what = p.getProperty("jftp.socksProxyHost", ""); return what; } public static boolean getUseJTableLayout() { String what = p.getProperty("jftp.useJTableLayout", "true"); if(what.trim().equals("false")) { return false; } else { return true; } } public static String getSocksProxyPort() { String what = p.getProperty("jftp.socksProxyPort", ""); return what; } public static boolean getUseBackground() { String what = p.getProperty("jftp.useBackground", "true"); if(what.trim().equals("false")) { return false; } else { return true; } } public static boolean getEnableSshKeys() { String what = p.getProperty("jftp.useSshKeyVerification", "false"); if(what.trim().equals("false")) { return false; } else { return true; } } public static boolean getEnableResuming() { String what = p.getProperty("jftp.enableResuming", "true"); if(what.trim().equals("false")) { return false; } else { return true; } } public static boolean getEnableDebug() { String what = p.getProperty("jftp.enableDebug", defaultEnableDebug); if(what.trim().equals("false")) { return false; } else { return true; } } public static boolean getDisableLog() { String what = p.getProperty("jftp.disableLog", "false"); if(what.trim().equals("false")) { return false; } else { return true; } } public static boolean getEnableStatusAnimation() { String what = p.getProperty("jftp.gui.enableStatusAnimation", "false"); if(what.trim().equals("false")) { return false; } else { return true; } } public static boolean getAskToDelete() { String what = p.getProperty("jftp.gui.askToDelete", "true"); if(what.trim().equals("false")) { return false; } else { return true; } } public static String getLookAndFeel() { return p.getProperty("jftp.gui.look", null); } public static boolean getUseNewIcons() { String what = p.getProperty("jftp.gui.look.newIcons", "true"); if(what.trim().equals("false")) { return false; } else { return true; } } public static boolean getEnableMultiThreading() { String what = p.getProperty("jftp.enableMultiThreading", enableMultiThreading); if(what.trim().equals("false")) { return false; } else { return true; } } public static boolean getEnableSmbMultiThreading() { String what = p.getProperty("jftp.enableSmbMultiThreading", enableSmbMultiThreading); if(what.trim().equals("false")) { return false; } else { return true; } } public static boolean getEnableSftpMultiThreading() { String what = p.getProperty("jftp.enableSftpMultiThreading", enableSftpMultiThreading); if(what.trim().equals("false")) { return false; } else { return true; } } public static boolean getNoUploadMultiThreading() { String what = p.getProperty("jftp.noUploadMultiThreading", noUploadMultiThreading); if(what.trim().equals("false")) { return false; } else { return true; } } public static boolean getFtpPasvMode() { String what = p.getProperty("jftp.ftpPasvMode", defaultFtpPasvMode); if(what.trim().equals("false")) { return false; } else { return true; } } public static boolean getUseDefaultDir() { String what = p.getProperty("jftp.useDefaultDir", "true"); if(what.trim().equals("false")) { return false; } else { return true; } } public static boolean getEnableRSS() { String what = p.getProperty("jftp.enableRSS", "false"); if(what.trim().equals("false")) { return false; } else { return true; } } public static String getRSSFeed() { String what = p.getProperty("jftp.customRSSFeed", "http://slashdot.org/rss/slashdot.rss"); return what; } public static java.awt.Dimension getWindowSize() { int width = Integer.parseInt(p.getProperty("jftp.window.width", defaultWidth)); int height = Integer.parseInt(p.getProperty("jftp.window.height", defaultHeight)); return new java.awt.Dimension(width, height); } public static java.awt.Point getWindowLocation() { int x = Integer.parseInt(p.getProperty("jftp.window.x", defaultX)); int y = Integer.parseInt(p.getProperty("jftp.window.y", defaultY)); return new java.awt.Point(x, y); } public static int getSocketTimeout() { return 3000; } public static boolean getStorePasswords() { String what = p.getProperty("jftp.security.storePasswords", storePasswords); if(what.trim().equals("false")) { return false; } else { return true; } } static { try { p.load(new FileInputStream(propertyFilename)); } catch(Exception e) { System.out.println("no property file loaded, using defaults... (" + e + ")"); } if(!getUseNewIcons()) { iconImage = "images/org/javalobby/icons/20x20/ComputerIn.gif"; hostImage = "images/org/javalobby/icons/20x20/ComputerIn.gif"; closeImage = "images/org/javalobby/icons/20x20/Error.gif"; infoImage = "images/org/javalobby/icons/20x20/Inform.gif"; listImage = "images/org/javalobby/icons/20x20/List.gif"; deleteImage = "images/org/javalobby/icons/16x16/DeleteDocument.gif"; deleteImage2 = "images/org/javalobby/icons/16x16/DeleteDocument.gif"; rmdirImage = "images/org/javalobby/icons/16x16/DeleteFolder.gif"; mkdirImage = "images/org/javalobby/icons/16x16/NewFolder.gif"; refreshImage = "images/org/javalobby/icons/16x16/Undo.gif"; refreshImage2 = "images/org/javalobby/icons/16x16/Undo.gif"; cdImage = "images/org/javalobby/icons/16x16/Open.gif"; cmdImage = "images/org/javalobby/icons/16x16/ExecuteProject.gif"; downloadImage = "images/org/javalobby/icons/16x16/Left.gif"; uploadImage = "images/org/javalobby/icons/16x16/Right.gif"; fileImage = "images/org/javalobby/icons/16x16/Document.gif"; dirImage = "images/org/javalobby/icons/16x16/Folder.gif"; codeFileImage = "images/org/javalobby/icons/16x16/List.gif"; textFileImage = "images/org/javalobby/icons/16x16/DocumentDraw.gif"; execFileImage = "images/org/javalobby/icons/16x16/ExecuteProject.gif"; audioFileImage = "images/org/javalobby/icons/16x16/cd.gif"; videoFileImage = "images/org/javalobby/icons/16x16/CameraFlash.gif"; htmlFileImage = "images/org/javalobby/icons/16x16/World2.gif"; zipFileImage = "images/org/javalobby/icons/16x16/DataStore.gif"; imageFileImage = "images/org/javalobby/icons/16x16/Camera.gif"; presentationFileImage = "images/org/javalobby/icons/16x16/DocumentDiagram.gif"; spreadsheetFileImage = "images/org/javalobby/icons/16x16/DatePicker.gif"; bookFileImage = "images/org/javalobby/icons/16x16/Book.gif"; copyImage = "images/org/javalobby/icons/16x16/Copy.gif"; openImage = "images/org/javalobby/icons/16x16/World2.gif"; sftpImage = "images/org/javalobby/icons/16x16/NewEnvelope.gif"; nfsImage = "images/org/javalobby/icons/16x16/TrafficGreen.gif"; webdavImage = "images/org/javalobby/icons/16x16/DataStore.gif"; linkImage = "images/org/javalobby/icons/16x16/Right.gif"; typeImage = "images/org/javalobby/icons/20x20/Type.gif"; clearImage = "images/org/javalobby/icons/16x16/Undo.gif"; resumeImage = "images/org/javalobby/icons/16x16/GreenCircle.gif"; pauseImage = "images/org/javalobby/icons/16x16/RedCircle.gif"; clearImage2 = "images/org/javalobby/icons/16x16/Undo.gif"; resumeImage2 = "images/org/javalobby/icons/16x16/GreenCircle.gif"; pauseImage2 = "images/org/javalobby/icons/16x16/RedCircle.gif"; saveImage = "images/org/javalobby/icons/16x16/Save.gif"; cdUpImage = "images/org/javalobby/icons/16x16/Exit.gif"; nextRSSImage = "images/org/javalobby/icons/16x16/Forward.gif"; helpImage = "images/current/help.png"; } else { iconImage = "images/current/server_add.png"; hostImage = "images/current/server_add.png"; closeImage = "images/current/cancel.png"; infoImage = "images/current/information.png"; listImage = "images/current/page_white_text.png"; rmdirImage = "images/current/folder_delete.png"; mkdirImage = "images/current/folder_add.png"; refreshImage = "images/current/control_repeat.png"; refreshImage2 = "images/current/control_repeat_blue.png"; cdImage = "images/current/folder_explore.png"; cmdImage = "images/current/application_xp_terminal.png"; downloadImage = "images/current/arrow_left.png"; uploadImage = "images/current/arrow_right.png"; fileImage = "images/current/page_white.png"; dirImage = "images/current/folder.png"; codeFileImage = "images/current/page_white_wrench.png"; textFileImage = "images/current/page_white_text.png"; execFileImage = "images/current/cog.png"; audioFileImage = "images/current/ipod.png"; videoFileImage = "images/current/camera.png"; htmlFileImage = "images/current/html.png"; zipFileImage = "images/current/page_white_zip.png"; imageFileImage = "images/current/image.png"; presentationFileImage = "images/current/page_white_powerpoint.png"; spreadsheetFileImage = "images/current/page_excel.png"; bookFileImage = "images/current/book.png"; copyImage = "images/current/disk_multiple.png"; openImage = "images/current/drive_web.png"; sftpImage = "images/current/drive_link.png"; nfsImage = "images/current/drive_network.png"; webdavImage = "images/current/house_go.png"; linkImage = "images/current/arrow_right.png"; typeImage = "images/current/email_go.png"; deleteImage = "images/current/control_stop.png"; deleteImage2 = "images/current/control_stop_blue.png"; clearImage = "images/current/control_eject.png"; clearImage2 = "images/current/control_eject_blue.png"; resumeImage = "images/current/control_play.png"; resumeImage2 = "images/current/control_play_blue.png"; pauseImage = "images/current/control_pause.png"; pauseImage2 = "images/current/control_pause_blue.png"; saveImage = "images/current/disk.png"; cdUpImage = "images/current/arrow_up.png"; nextRSSImage = "images/current/rss_go.png"; helpImage = "images/current/help.png"; } } } jftp-1.52.orig/src/java/net/sf/jftp/config/LoadSet.java0000700000175000017500000000422611112477774021737 0ustar varunvarun/* * 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. */ package net.sf.jftp.config; import net.sf.jftp.*; import net.sf.jftp.config.*; import net.sf.jftp.gui.*; import net.sf.jftp.gui.base.UIUtils; import net.sf.jftp.system.logging.Log; import net.sf.jftp.util.*; import java.io.*; public class LoadSet { // private BufferedInputStream in = null; // private String result[] = new String[6]; public static String[] loadSet(String file, boolean ask) { try { BufferedReader breader = new BufferedReader(new FileReader(file)); String[] result = new String[6]; result[0] = breader.readLine(); result[1] = breader.readLine(); result[2] = breader.readLine(); result[3] = breader.readLine(); result[4] = breader.readLine(); result[5] = breader.readLine(); if((result[2].equals("") || !Settings.getStorePasswords()) && ask) { result[2] = UIUtils.getPasswordFromUser(JFtp.statusP.jftp); Log.debug("fetched: " + result[2] + ", storing: " + Settings.getStorePasswords()); } return result; } catch(Exception ex) { // don't need this, occurs if first run //Log.debug(ex.toString() + "@LoadSet::loadSet()"); } return new String[1]; } public static String[] loadSet(String file) { return loadSet(file, false); } } jftp-1.52.orig/src/java/net/sf/jftp/event/0000700000175000017500000000000011155274771017405 5ustar varunvarunjftp-1.52.orig/src/java/net/sf/jftp/event/EventHandler.java0000700000175000017500000000146411112477774022640 0ustar varunvarun/* * 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. */ package net.sf.jftp.event; public interface EventHandler { public boolean handle(Event e); } jftp-1.52.orig/src/java/net/sf/jftp/event/EventProcessor.java0000700000175000017500000000425611112477774023244 0ustar varunvarun/* * 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. */ package net.sf.jftp.event; import java.util.Hashtable; import java.util.Vector; public class EventProcessor implements Runnable, Acceptor, FtpEventConstants, EventHandler { private static Hashtable table = new Hashtable(); private Vector buffer; private boolean done = false; public EventProcessor(Vector b) { buffer = b; new Thread(this).start(); addHandler(FTPShutdown, this); } public void accept(Event e) { Integer code = new Integer(e.eventCode()); Vector handlers = (Vector) (table.get(code)); if(handlers != null) { for(int i = 0, max = handlers.size(); i < max; i++) { ((EventHandler) (handlers.elementAt(i))).handle(e); } } } public static void addHandler(int eventCode, EventHandler h) { Integer code = new Integer(eventCode); Vector handlers = (Vector) (table.get(code)); if(handlers == null) { handlers = new Vector(); table.put(code, handlers); } handlers.addElement(h); } public boolean handle(Event e) { done = true; return true; } public void run() { while(!done) { if(buffer.size() != 0) { accept((Event) buffer.firstElement()); buffer.removeElementAt(0); } } } } jftp-1.52.orig/src/java/net/sf/jftp/event/Event.java0000700000175000017500000000146311112477774021341 0ustar varunvarun/* * 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. */ package net.sf.jftp.event; public abstract class Event { public abstract int eventCode(); } jftp-1.52.orig/src/java/net/sf/jftp/event/FtpEventHandler.java0000700000175000017500000001151511112477774023310 0ustar varunvarun/* * 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. */ package net.sf.jftp.event; import net.sf.jftp.net.FtpClient; import java.lang.reflect.*; import java.util.ArrayList; import java.util.Hashtable; import java.util.StringTokenizer; import java.util.Vector; public class FtpEventHandler implements EventHandler { private static ArrayList commands = null; static { commands = new ArrayList(); commands.add("account"); commands.add("append"); commands.add("ascii"); commands.add("bell"); commands.add("bye"); commands.add("cd"); commands.add("cdup"); commands.add("chmod"); commands.add("close"); commands.add("cr"); // unsupported commands.add("delete"); commands.add("dir"); commands.add("disconnect"); commands.add("form"); // unsupported commands.add("get"); commands.add("glob"); // unsupported commands.add("hash"); commands.add("idle"); commands.add("image"); commands.add("lcd"); commands.add("mdelete"); commands.add("mdir"); commands.add("mget"); commands.add("mkdir"); commands.add("mls"); commands.add("mode"); commands.add("modtime"); commands.add("mput"); commands.add("newer"); commands.add("nlist"); commands.add("open"); commands.add("passive"); commands.add("put"); commands.add("pwd"); commands.add("quote"); commands.add("recv"); commands.add("reget"); commands.add("rstatus"); commands.add("rhelp"); commands.add("rename"); commands.add("reset"); commands.add("restart"); commands.add("rmdir"); commands.add("runique"); commands.add("send"); commands.add("sendport"); commands.add("site"); commands.add("size"); commands.add("status"); commands.add("struct"); commands.add("system"); commands.add("sunique"); commands.add("type"); commands.add("user"); } private FtpClient client; private Hashtable methods = new Hashtable(); public FtpEventHandler() { this.client = new FtpClient(); Method[] m = this.getClass().getDeclaredMethods(); String methodName = null; for(int i = 0; i < m.length; i++) { methodName = m[i].getName(); if(commands.contains(methodName)) { methods.put(methodName, m[i]); } } } public void open(Vector args) { System.out.println("***open"); client.login((String) args.elementAt(1)); } public void disconnect(Vector args) { System.out.println("***disconnect"); client.disconnect(); } public void cd(Vector args) { System.out.println("***cd"); client.cd((String) args.elementAt(1)); } public void pwd(Vector args) { System.out.println("***pwd"); String directory = client.pwd(); } public void get(Vector args) { System.out.println("***get"); client.get((String) args.elementAt(1)); } public void put(Vector args) { System.out.println("***put"); client.put((String) args.elementAt(1)); } public void quit(Vector args) { disconnect(args); } public boolean handle(Event e) { System.out.println(e.eventCode()); System.out.println(((FtpEvent) e).eventMsg()); StringTokenizer st = new StringTokenizer(((FtpEvent) e).eventMsg()); Vector list = new Vector(); while(st.hasMoreTokens()) { list.addElement(st.nextToken()); } if(list.size() != 0) { String command = (String) list.elementAt(0); Method o = (Method) methods.get(command.toLowerCase()); if(o != null) { try { o.invoke(this, new Object[] { list }); } catch(Exception ex) { } } } return true; } } jftp-1.52.orig/src/java/net/sf/jftp/event/EventCollector.java0000700000175000017500000000202111112477774023177 0ustar varunvarun/* * 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. */ package net.sf.jftp.event; import java.util.Vector; public class EventCollector implements Acceptor { protected Vector buffer; public EventCollector() { buffer = new Vector(); new EventProcessor(buffer); } public void accept(Event e) { buffer.addElement(e); } } jftp-1.52.orig/src/java/net/sf/jftp/event/FtpEvent.java0000700000175000017500000000220511112477774022006 0ustar varunvarun/* * 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. */ package net.sf.jftp.event; public class FtpEvent extends Event { private int code = 0; private String message; public FtpEvent(int code) { this.code = code; } public FtpEvent(int code, String message) { this.code = code; this.message = message; } public String eventMsg() { return message; } public int eventCode() { return code; } } jftp-1.52.orig/src/java/net/sf/jftp/event/Acceptor.java0000700000175000017500000000145511112477774022021 0ustar varunvarun/* * 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. */ package net.sf.jftp.event; public interface Acceptor { public void accept(Event e); } jftp-1.52.orig/src/java/net/sf/jftp/event/FtpEventConstants.java0000700000175000017500000000031511112477774023703 0ustar varunvarunpackage net.sf.jftp.event; public interface FtpEventConstants { public final static int FTPCommand = 100; public final static int FTPPrompt = 200; public final static int FTPShutdown = 900; } jftp-1.52.orig/src/java/net/sf/jftp/net/0000700000175000017500000000000011155274771017052 5ustar varunvarunjftp-1.52.orig/src/java/net/sf/jftp/net/JConnection.java0000700000175000017500000001517611112477774022144 0ustar varunvarun/* * 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. */ package net.sf.jftp.net; import java.io.BufferedOutputStream; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintStream; import java.net.InetAddress; import java.net.Socket; import net.sf.jftp.config.Settings; import net.sf.jftp.system.logging.Log; /** * Basic class for getting an TCP/IP-Connection * timeout sets (as the name says) the maximum time the Thread * waits for the target host... */ public class JConnection implements Runnable { private int timeout = Settings.connectionTimeout; private String host; private int port; private PrintStream out; private BufferedReader in; private Socket s; private boolean isOk = false; private boolean established = false; //private boolean reciever = false; private Thread runner; private int localPort = -1; //private int time = 0; /* private boolean useSocks4 = false; private String socks4Host = "192.168.0.1"; private int socks4Port = 1080; */ public JConnection(String host, int port) { this.host = host; this.port = port; runner = new Thread(this); runner.start(); } /* public JConnection(String host, int port, int time) { this.host = host; this.port = port; this.timeout = time; this.time = time; runner = new Thread(this); runner.start(); } */ /* private int swabInt(int v) { return (v >>> 24) | (v << 24) | ((v << 8) & 0x00FF0000) | ((v >> 8) & 0x0000FF00); } */ public void run() { try { /* if(useSocks4) { s = new Socket(socks4Host, socks4Port); Log.debug("\nsending socks4-request..."); OutputStream o = s.getOutputStream(); byte buf[] = new byte[9]; buf[0] = (byte) 4; buf[1] = (byte) 0x1; buf[2] = (byte) 1; buf[3] = (byte) 1; buf[4] = (byte) 1; buf[5] = (byte) 1; buf[6] = (byte) 1; buf[7] = (byte) 1; buf[8] = (byte) 0; o.write(buf); o.flush(); Log.debug("reading response..."); byte ret[] = new byte[8]; int bytes = s.getInputStream().read(ret); if(ret[1] == 90) { Log.debug("connection accepted"); localPort = s.getLocalPort(); out = new PrintStream(new BufferedOutputStream(s.getOutputStream(), Settings.bufferSize)); in = new BufferedReader(new InputStreamReader(s.getInputStream()), Settings.bufferSize); isOk = true; } else { Log.debug("socks-connection refused (returncode " + ret[1] + ")"); isOk = false; } } else { */ s = new Socket(host, port); localPort = s.getLocalPort(); //if(time > 0) s.setSoTimeout(time); out = new PrintStream(new BufferedOutputStream(s.getOutputStream(), Settings.bufferSize)); in = new BufferedReader(new InputStreamReader(s.getInputStream()), Settings.bufferSize); isOk = true; // } } catch(Exception ex) { ex.printStackTrace(); Log.out("WARNING: connection closed due to exception (" + host + ":" + port + ")"); isOk = false; try { if((s != null) && !s.isClosed()) { s.close(); } if(out != null) { out.close(); } if(in != null) { in.close(); } } catch(Exception ex2) { ex2.printStackTrace(); Log.out("WARNING: got more errors trying to close socket and streams"); } } established = true; } public boolean isThere() { int cnt = 0; while(!established && (cnt < timeout)) { pause(10); cnt = cnt + 10; //System.out.println(cnt + "/" + timeout); } return isOk; } public void send(String data) { try { //System.out.println(":"+data+":"); out.print(data); out.print("\r\n"); out.flush(); if(data.startsWith("PASS")) { Log.debug("> PASS ****"); } else { Log.debug("> " + data); } } catch(Exception ex) { ex.printStackTrace(); } } public PrintStream getInetOutputStream() { return out; } public BufferedReader getReader() { return in; } public int getLocalPort() { return localPort; } public InetAddress getLocalAddress() throws IOException { return s.getLocalAddress(); } private void pause(int time) { try { Thread.sleep(time); } catch(Exception ex) { } } public BufferedReader getIn() { return in; } public void setIn(BufferedReader in) { this.in = in; } public PrintStream getOut() { return out; } public void setOut(PrintStream out) { this.out = out; } } jftp-1.52.orig/src/java/net/sf/jftp/net/ConnectionListener.java0000700000175000017500000000271111112477774023527 0ustar varunvarun/* * 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. */ package net.sf.jftp.net; /** * Classes that implement this interface are notified about various * events that may happen. Make sure to use myftpconnection.addConnectionListener(this) in * the class to get it working. */ public interface ConnectionListener { /** * Called if the remote directory has changed by a chdir() or a finished upload for example. */ public void updateRemoteDirectory(BasicConnection con); /** * Called every n bytes, where n is defined by Settings */ public void updateProgress(String file, String type, long bytes); public void connectionInitialized(BasicConnection con); public void connectionFailed(BasicConnection con, String why); public void actionFinished(BasicConnection con); } jftp-1.52.orig/src/java/net/sf/jftp/net/FtpURLStreamHandler.java0000700000175000017500000000210511112477774023505 0ustar varunvarun/* * 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. */ package net.sf.jftp.net; import java.net.URL; import java.net.URLConnection; import java.net.URLStreamHandler; /** * An URLStreamHandler for handling ftp urls. */ public class FtpURLStreamHandler extends URLStreamHandler { public FtpURLStreamHandler() { super(); } public URLConnection openConnection(URL u) { return null; } } jftp-1.52.orig/src/java/net/sf/jftp/net/FtpConnection.java0000700000175000017500000024250411112477774022501 0ustar varunvarun/* * 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. */ package net.sf.jftp.net; import java.io.BufferedReader; import java.io.File; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.net.InetAddress; import java.net.ServerSocket; import java.net.UnknownHostException; import java.util.Calendar; import java.util.Date; import java.util.GregorianCalendar; import java.util.StringTokenizer; import java.util.Vector; import javax.swing.JLabel; import javax.swing.JOptionPane; import net.sf.jftp.config.LoadSet; import net.sf.jftp.config.SaveSet; import net.sf.jftp.config.Settings; import net.sf.jftp.system.StringUtils; import net.sf.jftp.system.logging.Log; /** * All control transactions are made here. * See doc/FtpDownload.java for examples and note * that this class is event-driven and not Exception-based! * You might want to take a look at ConnectionListener, too. * * @author David Hansmann, hansmann.d@debitel.net * @version 1.30+, June 2003 */ public class FtpConnection implements BasicConnection, FtpConstants { private static final boolean TESTMODE = false; // everything starting with this will be treated // as a negative response private final static String NEGATIVE = "5"; private final static String NEGATIVE2 = "4"; // everything starting with this will be treated // as a positive response private final static String POSITIVE = "2"; // for resuming private final static String PROCEED = "3"; //"350"; private final static char MORE_LINES_APPENDED = '-'; /** Internal download constant */ public final static String DOWNLOAD = "DOWNLOAD"; /** Internal upload constant */ public final static String UPLOAD = "UPLOAD"; /** Internal abort command constant */ public final static String ABOR = "ABOR"; //*** 1.44: if LIST is not set, then load it from advanced settings //*** And if the file for it is not found, then create it //*** with LIST -laL as the default public static String LIST_DEFAULT = "LIST -laL"; public static String LIST = "default"; public final static String ASCII = "A"; public final static String BINARY = "I"; public final static String EBCDIC = "E"; public final static String L8 = "L 8"; public final static String STREAM = "S"; public final static String BLOCKED = "B"; public final static String COMPRESSED = "C"; private static boolean useStream = true; private static boolean useBlocked = true; private static boolean useCompressed = true; // active ftp ports private static int porta = 5; // 5 * 256 + 1 = 1281 private static int portb = 1; //*** /** * Used to determine the type of transfer. */ public boolean hasUploaded = false; public boolean work = true; private boolean msg = true; private boolean ok = true; private String pwd = ""; private String initCWD = Settings.defaultDir; private String[] loginAck = new String[] { FTP331_USER_OK_NEED_PASSWORD, FTP230_LOGGED_IN }; private String osType = ""; private String dataType; private FtpTransfer lastTransfer = null; private boolean modeStreamSet = false; private DataConnection dcon = null; private Vector listeners = new Vector(); private ConnectionHandler handler = new ConnectionHandler(); // directory downloaded to private String localPath = null; /** the host */ private String host = ""; /** the user */ private String username; /** the password */ private String password; /** the port */ private int port = 21; /** the InputStream of the control connection */ private BufferedReader in; /** the OutputStream of the control connection */ private JConnection jcon; /** we are disconnected */ private boolean connected = false; private boolean shortProgress = false; private boolean isDirUpload = false; private String baseFile; private int fileCount; private String typeNow = ""; private String crlf = null; /** * May contain date listing */ public Vector dateVector = new Vector(); public Vector currentListing = new Vector(); public Vector currentFiles = new Vector(); public Vector currentSizes = new Vector(); public Vector currentPerms = new Vector(); /** * Create an instance with a given host * * @param host The host to connect to */ public FtpConnection(String host) { this.host = host; File f = new File("."); setLocalPath(f.getAbsolutePath()); } /** * Create an instance with a given host, port and initial remote working directory * * @param host The host to connect to * @param port The port used for the control connection, usually 21 * @param initCWD The initial remote working directory */ public FtpConnection(String host, int port, String initCWD) { this.host = host; this.port = port; this.initCWD = initCWD; File f = new File("."); setLocalPath(f.getAbsolutePath()); } /** * Connect to the server an log in. * * Does also fire directory update and connection initialized event if successful or * connection failed event if failed. * * @param username The username * @param password The password * @param initCWD The initial remote working directory * @param crlfx \n, \r, \r\n, CR, LF or CRLF - line break style of the server * @return WRONG_LOGIN_DATA, OFFLINE, GENERIC_FAILED or LOGIN_OK status code */ public FtpConnection(String host, int port, String initCWD, String crlfx) { this.host = host; this.port = port; this.initCWD = initCWD; if(crlfx != null) { if(crlfx.equals("\n") || crlfx.equals("\r") || crlfx.equals("\r\n")) this.crlf = crlfx; crlfx = crlfx.trim().toUpperCase(); if(crlfx.equals("LF")) this.crlf = "\n"; else if(crlfx.equals("CR")) this.crlf = "\r"; else if(crlfx.equals("CRLF")) this.crlf = "\r\n"; } //Log.out("\n\nCRLF:---"+crlf+"---\n\n"); File f = new File("."); setLocalPath(f.getAbsolutePath()); } /** * Connect to the server an log in. * * Does also fire directory update and connection initialized event if successful or * connection failed event if failed. * * @param username The username * @param password The password * @return WRONG_LOGIN_DATA, OFFLINE, GENERIC_FAILED or LOGIN_OK status code */ public int login(String username, String password) { this.username = username; this.password = password; int status = LOGIN_OK; if(msg) { Log.debug("Connecting to " + host); } jcon = new JConnection(host, port); if(jcon.isThere()) { in = jcon.getReader(); if(getLine(POSITIVE) == null)//FTP220_SERVICE_READY) == null) { ok = false; Log.debug("Server closed Connection, maybe too many users..."); status = OFFLINE; } if(msg) { Log.debug("Connection established..."); } jcon.send(USER + " " + username); if(!getLine(loginAck).startsWith(POSITIVE))//FTP230_LOGGED_IN)) { jcon.send(PASS + " " + password); if(success(POSITIVE))//FTP230_LOGGED_IN)) { if(msg) { Log.debug("Logged in..."); } } else { Log.debug("Wrong password!"); ok = false; status = WRONG_LOGIN_DATA; } } // end if(jcon)... } else { if(msg) { Log.debug("FTP not available!"); ok = false; status = GENERIC_FAILED; } } if(ok) { connected = true; system(); //if(getOsType().indexOf("MVS") < 0) binary(); if(initCWD.trim().equals(Settings.defaultDir) || !chdirNoRefresh(initCWD)) { //System.out.println("default dir..."); //if(!chdirNoRefresh(getPWD())) //{ //System.out.println("FtpConnection should not do this..."); // if(!chdirNoRefresh("~")) // { // chdirNoRefresh("/"); // } //} updatePWD(); } //Array of length 6 created, as that is maximum LoadSet size (need //public variable with that constant there for it to refer to?) String[] advSettings = new String[6]; if(getOsType().indexOf("OS/2") >= 0) { LIST_DEFAULT = "LIST"; } if(LIST.equals("default")) { //just get the first item (somehow it knows first is the //FTP list command) advSettings = LoadSet.loadSet(Settings.adv_settings); //*** IF FILE NOT FOUND, CREATE IT AND SET IT TO LIST_DEFAULT if(advSettings == null) { LIST = LIST_DEFAULT; new SaveSet(Settings.adv_settings, LIST); } else { LIST = advSettings[0]; if(LIST == null) { LIST = LIST_DEFAULT; } } } if(getOsType().indexOf("MVS") >= 0) { LIST = "LIST"; } //*** fireDirectoryUpdate(this); fireConnectionInitialized(this); } else { fireConnectionFailed(this, new Integer(status).toString()); } return status; } /** * Sort the filesizes an return an array. * * The Array should be in sync with the other sort*-Methods * * @return An String-array of sizes containing the size or -1 if failed or 0 for directories */ public String[] sortSize() { try { currentSizes.removeAllElements(); for(int i=0; i= 0) { if(tmp.indexOf(";") < 0) { continue; } currentSizes.add("-1"); continue; } // ------------- MVS override ------------------- if(getOsType().indexOf("MVS") >= 0) { if(tmp.startsWith("Volume") || (tmp.indexOf(" ") < 0)) { continue; } currentSizes.add("-1"); continue; } // ------------------------------------------------ else if(getOsType().indexOf("WINDOW") >= 0) { StringTokenizer to = new StringTokenizer(tmp, " ", false); if(to.countTokens() >= 4) { to.nextToken(); to.nextToken(); String size = to.nextToken(); if(size.equals("")) { currentSizes.add("0"); } else { try { Long.parseLong(size); currentSizes.add(size); } catch(Exception ex) { currentSizes.add("-1"); Log.out("WARNING: filesize can not be determined - value is " + size); } } } } // ------------------------------------------------ else if(getOsType().indexOf("OS/2") >= 0) { StringTokenizer to = new StringTokenizer(tmp, " ", false); tmp = giveSize(to, 0); Log.out("OS/2 parser (size): " + tmp); currentSizes.add(tmp); } else { //Log.out("\n\nparser\n\n"); StringTokenizer to = new StringTokenizer(tmp, " ", false); if(to.countTokens() >= 8) // unix { tmp = giveSize(to, 4); currentSizes.add(tmp); //Log.out(tmp); } else if(to.countTokens() == 7) // unix, too { Log.out("WARNING: 7 token backup size parser activated!"); tmp = giveSize(to, 4); currentSizes.add(tmp); } else { Log.debug("cannot parse line: " + tmp); } } } } catch(Exception ex) { Log.debug(ex.toString() + " @FtpConnection::sortSize#1"); return new String[0]; } return toArray(currentSizes); } private String[] toArray(Vector in) { String ret[] = new String[in.size()]; for(int i=0; i= 0) { if(tmp.indexOf(";") < 0) { continue; } currentPerms.add("r"); continue; } // ------------- MVS override ------------------- if(getOsType().indexOf("MVS") >= 0) { if(tmp.startsWith("Volume")) { continue; } currentPerms.add("r"); continue; } // ------------------------------------------------ StringTokenizer to = new StringTokenizer(tmp.trim(), " ", false); if(!(to.countTokens() > 3) || (tmp.startsWith("/") && (tmp.indexOf("denied") > 0))) { continue; } tmp = to.nextToken(); if(tmp.length() != 10) { //System.out.println(tmp + " - e"); return null; // exotic bug, hardlinks are not found or something ("/bin/ls: dir: no such file or directy" in ls output) - we have no permissions then } char ur = tmp.charAt(1); char uw = tmp.charAt(2); char ar = tmp.charAt(7); char aw = tmp.charAt(8); to.nextToken(); String user = to.nextToken(); //System.out.println(""+ur+":"+ar+":"+tmp); if(aw == 'w') { currentPerms.add("w"); } else if(user.equals(username) && (uw == 'w')) { currentPerms.add("w"); } else if(ar == 'r') { currentPerms.add("r"); } else if(user.equals(username) && (ur == 'r')) { currentPerms.add("r"); } else { //System.out.println(ur+":"+ar+":"+user+":"+username+":"); currentPerms.add("n"); } } } catch(Exception ex) { Log.debug(ex.toString() + " @FtpConnection::getPermissions#1"); } int[] ret = new int[currentPerms.size()]; for(int i=0; i(); currentFiles.removeAllElements(); for(int i=0; i= 0) { int x = tmp.indexOf(";"); if(x < 0) { continue; } tmp = tmp.substring(0, x); if(tmp.endsWith("DIR")) { currentFiles.add(tmp.substring(0, tmp.lastIndexOf(".")) + "/"); } else { currentFiles.add(tmp); } //Log.out("listing - (vms parser): " + tmp); continue; } else if(getOsType().indexOf("OS/2") >= 0) { StringTokenizer to2 = new StringTokenizer(tmp, " ", true); if(giveFile(to2, 2).indexOf("DIR") >= 0) { to2 = new StringTokenizer(tmp, " ", true); tmp = giveFile(to2, 5); tmp = tmp + "/"; } else { to2 = new StringTokenizer(tmp, " ", true); if(giveFile(to2, 1).indexOf("DIR") >= 0) { //Log.out("OS/2 parser (DIRFIX): " + tmp); to2 = new StringTokenizer(tmp, " ", true); tmp = giveFile(to2, 4); tmp = tmp + "/"; } else { to2 = new StringTokenizer(tmp, " ", true); tmp = giveFile(to2, 4); } } Log.out("OS/2 parser: " + tmp); currentFiles.add(tmp); continue; } // ------------------------------------------------------- // ------------------- MVS override -------------------- if(getOsType().indexOf("MVS") >= 0) { if(tmp.startsWith("Volume") || (tmp.indexOf(" ") < 0)) { Log.out("->" + tmp); continue; } String f = tmp.substring(tmp.lastIndexOf(" ")).trim(); String isDir = tmp.substring(tmp.lastIndexOf(" ") - 5, tmp.lastIndexOf(" ")); if(isDir.indexOf("PO") >= 0) { currentFiles.add(f + "/"); } else { currentFiles.add(f); } Log.out("listing - (mvs parser): " + tmp + " -> " + f); continue; } else if(getOsType().indexOf("OS/2") >= 0) { StringTokenizer to2 = new StringTokenizer(tmp, " ", true); if(giveFile(to2, 2).indexOf("DIR") >= 0) { to2 = new StringTokenizer(tmp, " ", true); tmp = giveFile(to2, 5); tmp = tmp + "/"; } else { to2 = new StringTokenizer(tmp, " ", true); if(giveFile(to2, 1).indexOf("DIR") >= 0) { //Log.out("OS/2 parser (DIRFIX): " + tmp); to2 = new StringTokenizer(tmp, " ", true); tmp = giveFile(to2, 4); tmp = tmp + "/"; } else { to2 = new StringTokenizer(tmp, " ", true); tmp = giveFile(to2, 4); } } Log.out("OS/2 parser: " + tmp); currentFiles.add(tmp); continue; } // ------------------------------------------------------- // ------------------- Unix, Windows and others ----- boolean isDir = false; boolean isLink = false; if(tmp.startsWith("d") || (tmp.indexOf("") >= 0)) { isDir = true; } if(tmp.startsWith("l")) { isLink = true; } if(tmp.startsWith("/") && (tmp.indexOf("denied") > 0)) { continue; } StringTokenizer to = new StringTokenizer(tmp, " ", false); StringTokenizer to2 = new StringTokenizer(tmp, " ", true); int tokens = to.countTokens(); //Log.out("listing: tokens: " + tokens + " - " + tmp); boolean set = false; //-----preparsing----- int lcount = 0; if(!newUnixDateStyle) { try { StringTokenizer tx = new StringTokenizer(tmp, " ", false); tx.nextToken(); tx.nextToken(); tx.nextToken(); tx.nextToken(); tx.nextToken(); String date = tx.nextToken(); int x = date.indexOf("-"); int y = date.lastIndexOf("-"); if(y > x) { Log.debug("Using new Unix date parser"); newUnixDateStyle = true; } } catch(Exception ex) { Log.out("could not preparse line: " + tmp); lcount++; //ex.printStackTrace(); } } //-------------------- //Log.out("tmp: " + tmp); if(newUnixDateStyle) // unix, too { set = true; //Log.out("listing - (unix parser #2, token 7): " + tmp); //------- date parser testing --------- try { //Log.out(">>> date parser: " + tmp); StringTokenizer to3 = new StringTokenizer(tmp, " ", true); String date = giveFile(to3, 5); String date2 = date.substring(date.indexOf("-") + 1); date2 = date2.substring(date.indexOf("-") + 2); //Log.out("date1: "+date+"/"+"date2: "+date2); String t = date; String y = t.substring(0, t.indexOf("-")); String m = t.substring(t.indexOf("-") + 1, t.indexOf("-") + 3); String m1 = t.substring(t.indexOf("-") + 1); String day = m1.substring(m1.indexOf("-") + 1, m1.indexOf("-") + 3); String h = date2.substring(0, date2.indexOf(":")); String min = date2.substring(date2.indexOf(":") + 1, date2.indexOf(":") + 3); //Log.out("day:"+day+"year:"+y+"mon:"+m+"hour:"+h+"m:"+min); Calendar c = new GregorianCalendar(); c.set(Calendar.DAY_OF_MONTH, Integer.parseInt(day)); c.set(Calendar.YEAR, Integer.parseInt(y)); c.set(Calendar.MONTH, Integer.parseInt(m) - 1); c.set(Calendar.HOUR, Integer.parseInt(h)); c.set(Calendar.MINUTE, Integer.parseInt(min)); dateVector.add(c.getTime()); //Log.out("+++ date: \"" + d.toString() + "\""); } catch(Exception ex) { ex.printStackTrace(); //set = false; } // ----------------------------- tmp = giveFile(to2, 7); if(lcount > 1) { dateVector = new Vector(); } } else if(tokens > 8) // unix { set = true; tmp = giveFile(to2, 8); //Log.out("listing - (unix parser, token 8): " + tmp); } else if(tokens > 3) // windows { set = true; tmp = giveFile(to2, 3); if(tmp.startsWith("")) { tmp = giveFile(to2, 4); //Log.out("listing - (windows parser, token 4): " + tmp); } else { //Log.out("listing - (windows parser, token 3): " + tmp); } } if(tmp.startsWith("") || !set) { if(tokens < 3) { continue; } tmp = giveFile(to2, tokens); Log.out("listing - WARNING: listing style unknown, using last token as filename!"); Log.out("listing - this may work but may also fail, filesizes and permissions will probably fail, too..."); Log.out("listing - please send us a feature request with the serveraddress to let us support this listing style :)"); Log.out("listing - (backup parser, token " + tokens + " ): " + tmp); } if(isDir) { tmp = tmp + "/"; } else if(isLink) { tmp = tmp + "###"; } currentFiles.add(tmp); // ------------------------------------------------------------- } String[] files = toArray(currentFiles); for(int i = 0; i < files.length; i++) { files[i] = parseSymlink(files[i]); //System.out.println("> " + files[i]+":"+dateVector.elementAt(i)); //System.out.println("> " + files.length+":"+dateVector.size()); } return files; } catch(Exception ex) { Log.debug(ex.toString() + " @FtpConnection::sortLs"); ex.printStackTrace(); } //------- date parser test ------ /* String[] x = (String[]) dateVector.toArray(); for(int i=0; i "+t); if(t.equals(" ") || t.equals("\t")) { // - /* while(to.hasMoreTokens()) { t2 = to.nextToken(); if(!t.equals(" ") && !t.equals("\t")) break; } */ i--; } } } String tmp = ""; /* if(t2 != null) { tmp = t2; } */ while(tmp.equals(" ") || tmp.equals("\t") || tmp.equals("")) { if(to.hasMoreTokens()) { tmp = to.nextToken(); } else { break; } } while(to.hasMoreTokens()) { tmp = tmp + to.nextToken(); } //Log.out(">>> "+tmp); return tmp; } /** get a filesize */ private String giveSize(StringTokenizer to, int lev) { for(int i = 0; i < lev; i++) { if(to.hasMoreTokens()) { if(to.nextToken().equals(" ")) { i--; } } } while(to.hasMoreTokens()) { String tmp = to.nextToken(); if(!tmp.equals(" ")) { try { Integer.parseInt(tmp); } catch(NumberFormatException ex) { return "-1"; } return tmp; } } return "-2"; } /** * Try to determine the os-type. * (Used internally to check how to parse the ls-output) * * @return A Part of the SYST comman server response */ public String getOsType() { if(TESTMODE) { return "MVS"; } else { return osType; } } private void setOsType(String os) { osType = os.toUpperCase(); } private int getPasvPort(String str) { int start = str.lastIndexOf(","); String lo = ""; start++; while(start < str.length()) { char c = str.charAt(start); if(!Character.isDigit(c)) { break; } lo = lo + c; start++; } System.out.println("\n\n\n"+str); String hi = ""; start = str.lastIndexOf(","); start--; while(true) { char c = str.charAt(start); if(!Character.isDigit(c)) { break; } hi = c + hi; start--; } //System.out.print(hi+":"+lo+" - "); return ((Integer.parseInt(hi) * 256) + Integer.parseInt(lo)); } private int getActivePort() { return (getPortA() * 256) + getPortB(); } /** parse a symlink */ private String parseSymlink(String file) { if(file.indexOf("->") >= 0) { //System.out.print(file+" :-> symlink converted to:"); file = file.substring(0, file.indexOf("->")).trim(); file = file + "###"; //System.out.println(file); } return file; } /** parse a symlink and cut the back */ private String parseSymlinkBack(String file) { if(file.indexOf("->") >= 0) { //System.out.print(file+" :-> symlink converted to:"); file = file.substring(file.indexOf("->") + 2).trim(); //System.out.println(file); } return file; } /** test for symlink */ private boolean isSymlink(String file) { if(file.indexOf("->") >= 0) { return true; } return false; } /** Download a file or directory. * Uses multithreading if enabled and does not block. * * @param file The file to download * @return An int-statuscode, see constants defined in this class for details */ public int handleDownload(String file) { if(Settings.getEnableMultiThreading()) { Log.out("spawning new thread for this download."); FtpTransfer t = new FtpTransfer(host, port, getLocalPath(), getCachedPWD(), file, username, password, Transfer.DOWNLOAD, handler, listeners, crlf); lastTransfer = t; return NEW_TRANSFER_SPAWNED; } else { Log.out("multithreading is completely disabled."); return download(file); } } /** * Download a file or directory, block until finished. * * @param file The file to download * @return An int returncode */ public int download(String file) { //Log.out("ftp download started:" + this); int stat; if(file.endsWith("/")) { shortProgress = true; fileCount = 0; baseFile = file; dataType = DataConnection.GETDIR; stat = downloadDir(file); //pause(100); fireActionFinished(this); fireProgressUpdate(baseFile, DataConnection.DFINISHED + ":" + fileCount, -1); shortProgress = false; } else { dataType = DataConnection.GET; stat = rawDownload(file); if(Settings.enableFtpDelays) { try { Thread.sleep(100); } catch(Exception ex) {} } fireActionFinished(this); } if(Settings.enableFtpDelays) { try { Thread.sleep(400); } catch(Exception ex) { } } return stat; } /** * Get download InputStream. * * @param file The file to download * @return An InputStream */ public InputStream getDownloadInputStream(String file) { Log.out("ftp stream download started:" + this); file = parse(file); try { int p = 0; dataType = DataConnection.GET; file = StringUtils.getFile(file); String path = getLocalPath() + file; //BufferedReader in = jcon.getReader(); modeStream(); p = negotiatePort(); dcon = new DataConnection(this, p, host, path, dataType, false, true); while(!dcon.isThere()) { pause(10); } jcon.send(RETR + " " + file); return dcon.getInputStream(); } catch(Exception ex) { ex.printStackTrace(); Log.debug(ex.toString() + " @FtpConnection::getDownloadInputStream"); return null; } } private int rawDownload(String file) { file = parse(file); //String path = file; try { int p = 0; //if(isRelative(file)) path = getLocalPath() + file; file = StringUtils.getFile(file); String path = getLocalPath() + file; //System.out.println(file + " : " + path); //BufferedReader in = jcon.getReader(); modeStream(); //binary(); p = negotiatePort(); File f = new File(path); //System.out.println("path: "+path); boolean resume = false; if(f.exists() && Settings.enableResuming) { jcon.send(REST + " " + f.length()); if(getLine(PROCEED) != null) { resume = true; } } dcon = new DataConnection(this, p, host, path, dataType, resume); //, new Updater()); while(!dcon.isThere()) { pause(10); } jcon.send(RETR + " " + file); String line = getLine(POSITIVE); Log.debug(line); // file has been created even if not downloaded, delete it if(line.startsWith(NEGATIVE)) { File f2 = new File(path); if(f2.exists() && (f2.length() == 0)) { f2.delete(); } return PERMISSION_DENIED; } else if(!line.startsWith(POSITIVE) && !line.startsWith(PROCEED)) { return TRANSFER_FAILED; } // we need to block since some ftp-servers do not want the // refresh command that dirpanel sends otherwise while(!dcon.finished) { pause(10); } } catch(Exception ex) { ex.printStackTrace(); Log.debug(ex.toString() + " @FtpConnection::download"); return TRANSFER_FAILED; } return TRANSFER_SUCCESSFUL; } private int downloadDir(String dir) { if(!dir.endsWith("/")) { dir = dir + "/"; } if(StringUtils.isRelative(dir)) { dir = getCachedPWD() + dir; } String path = getLocalPath() + StringUtils.getDir(dir); //System.out.println("path: "+path); String pwd = getCachedPWD() + StringUtils.getDir(dir); String oldDir = getLocalPath(); String oldPwd = getCachedPWD(); File f = new File(path); if(!f.exists()) { if(!f.mkdir()) { Log.debug("Can't create directory: " + dir); } else { Log.debug("Created directory..."); } } setLocalPath(path); if(!chdirNoRefresh(pwd)) { return CHDIR_FAILED; } try { list(); } catch(IOException ex) { return PERMISSION_DENIED; } String[] tmp = sortLs(); setLocalPath(path); for(int i = 0; i < tmp.length; i++) { if(tmp[i].endsWith("/")) { if(tmp[i].trim().equals("../") || tmp[i].trim().equals("./")) { Log.debug("Skipping " + tmp[i].trim()); } else { if(!work) { return TRANSFER_STOPPED; } if(downloadDir(tmp[i]) < 0) { ; // return TRANSFER_FAILED; } } } else { //System.out.println( "file: " + getLocalPath() + tmp[i] + "\n\n"); if(!work) { return TRANSFER_STOPPED; } fileCount++; if(rawDownload(getLocalPath() + tmp[i]) < 0) { ; // return TRANSFER_FAILED; } } } chdirNoRefresh(oldPwd); setLocalPath(oldDir); return TRANSFER_SUCCESSFUL; } /** Upload a file or directory. * Uses multithreading if enabled and does not block. * * @param file The file to upload * @return An int-statuscode, NEW_TRANSFER_SPAWNED,TRANSFER_FAILED or TRANSFER_SUCCESSFUL */ public int handleUpload(String file) { return handleUpload(file, null); } /** Upload a file or directory. * Uses multithreading if enabled and does not block. * * @param file The file to upload * @param realName The file to rename the uploaded file to * @return An int-statuscode, NEW_TRANSFER_SPAWNED,TRANSFER_FAILED or TRANSFER_SUCCESSFUL */ public int handleUpload(String file, String realName) { if(Settings.getEnableMultiThreading() && (!Settings.getNoUploadMultiThreading())) { Log.out("spawning new thread for this upload."); FtpTransfer t; if(realName != null) { t = new FtpTransfer(host, port, getLocalPath(), getCachedPWD(), file, username, password, Transfer.UPLOAD, handler, listeners, realName, crlf); } else { t = new FtpTransfer(host, port, getLocalPath(), getCachedPWD(), file, username, password, Transfer.UPLOAD, handler, listeners, crlf); } lastTransfer = t; return NEW_TRANSFER_SPAWNED; } else { if(Settings.getNoUploadMultiThreading()) { Log.out("upload multithreading is disabled."); } else { Log.out("multithreading is completely disabled."); } return (realName == null) ? upload(file) : upload(file, realName); } } /** * Upload a file or directory, block until finished. * * @param file The file to upload * @return An int returncode */ public int upload(String file) { return upload(file, file); } /** * Upload and a file or directory under a given name, block until finished. * Note that setting realName does not affect directory transfers * * @param file The file to upload * @param realName The file to rename the uploaded file to * @return An int responsecode */ public int upload(String file, String realName) { return upload(file, realName, null); } /** * Upload from an InputStream, block until finished. * * @param file The file to upload * @param in InputStream to read from * @return An int responsecode */ public int upload(String file, InputStream in) { return upload(file, file, in); } /** * Upload and a file or directory under a given name, block until finished. * Note that setting realName does not affect directory transfers * * @param file The file to upload * @param realName The file to rename the uploaded file to * @param in InputStream to read from * @return An int responsecode */ public int upload(String file, String realName, InputStream in) { hasUploaded = true; Log.out("ftp upload started: " + this); int stat; if((in == null) && new File(file).isDirectory()) { shortProgress = true; fileCount = 0; baseFile = file; dataType = DataConnection.PUTDIR; isDirUpload = true; stat = uploadDir(file); shortProgress = false; //System.out.println(fileCount + ":" + baseFile); fireProgressUpdate(baseFile, DataConnection.DFINISHED + ":" + fileCount, -1); fireActionFinished(this); fireDirectoryUpdate(this); } else { dataType = DataConnection.PUT; stat = rawUpload(file, realName, in); try { Thread.sleep(100); } catch(Exception ex) { } fireActionFinished(this); fireDirectoryUpdate(this); } try { Thread.sleep(500); } catch(Exception ex) { } return stat; } private int rawUpload(String file) { return rawUpload(file, file); } private int rawUpload(String file, String realName) { return rawUpload(file, realName, null); } /** uploads a file */ private int rawUpload(String file, String realName, InputStream in) { if(!file.equals(realName)) { Log.debug("File: " + file + ", stored as " + realName); } else { Log.debug("File: " + file); realName = null; } file = parse(file); String path = file; try { int p = 0; if(StringUtils.isRelative(file)) { path = getLocalPath() + file; } file = StringUtils.getFile(file); //BufferedReader in = jcon.getReader(); boolean resume = false; String size = "0"; if(Settings.enableUploadResuming && (in == null)) { list(); String[] ls = sortLs(); String[] sizes = sortSize(); if((ls == null) || (sizes == null)) { Log.out(">>> ls out of sync (skipping resume check)"); } else { for(int i = 0; i < ls.length; i++) { //Log.out(ls[i] + ":" + sizes[i]); if(realName != null) { if(ls[i].equals(realName)) { resume = true; size = sizes[i]; break; } } else { if(ls[i].equals(file)) { resume = true; size = sizes[i]; } } } File f = new File(path); if(f.exists() && (f.length() <= Integer.parseInt(size))) { Log.out("skipping resuming, file is <= filelength"); resume = false; } else if(f.exists() && Integer.parseInt(size) > 0) { if(!Settings.noUploadResumingQuestion) { if(JOptionPane.showConfirmDialog(new JLabel(), "A file smaller than the one to be uploaded already exists on the server,\n do you want to resume the upload?", "Resume upload?", JOptionPane.YES_NO_OPTION) != JOptionPane.OK_OPTION) { resume = false; } } Log.out("resume: " + resume + ", size: " + size); } else { Log.out("resume: " + resume + ", size: " + size); } } } modeStream(); //binary(); p = negotiatePort(); if(resume && Settings.enableUploadResuming) { jcon.send(REST + " " + size); if(getLine(PROCEED) == null) { resume = false; } } dcon = new DataConnection(this, p, host, path, dataType, resume, Integer.parseInt(size), in); //, new Updater()); while(!dcon.isThere()) { pause(10); } //System.out.println(path + " : " + file); if(realName != null) { jcon.send(STOR + " " + realName); } else { jcon.send(STOR + " " + file); } String tmp = getLine(POSITIVE); if(!tmp.startsWith(POSITIVE) && !tmp.startsWith(PROCEED)) { return TRANSFER_FAILED; } Log.debug(tmp); // we need to block since some ftp-servers do not want the // refresh command that dirpanel sends otherwise while(!dcon.finished) { pause(10); } } catch(Exception ex) { ex.printStackTrace(); Log.debug(ex.toString() + " @FtpConnection::upload"); return TRANSFER_FAILED; } return TRANSFER_SUCCESSFUL; } private int uploadDir(String dir) { //System.out.println("up"); if(dir.endsWith("\\")) { System.out.println("Something's wrong with the selected directory - please report this bug!"); } if(!dir.endsWith("/")) { dir = dir + "/"; } if(StringUtils.isRelative(dir)) { dir = getLocalPath() + dir; } String single = StringUtils.getDir(dir); //String path = dir.substring(0, dir.indexOf(single)); String remoteDir = getCachedPWD() + single; //StringUtils.removeStart(dir,path); String oldDir = getCachedPWD(); if(Settings.safeMode) { noop(); } boolean successful = mkdir(remoteDir); if(!successful) { return MKDIR_FAILED; } if(Settings.safeMode) { noop(); } chdirNoRefresh(remoteDir); File f2 = new File(dir); String[] tmp = f2.list(); for(int i = 0; i < tmp.length; i++) { String res = dir + tmp[i]; File f3 = new File(res); if(f3.isDirectory()) { if(!work) { return TRANSFER_STOPPED; } uploadDir(res); } else { //System.out.println(">>>\nlp: "+path+single + "\nrp: "); //System.out.println(remoteDir +"\nres: "+res); if(!work) { return TRANSFER_STOPPED; } fileCount++; if(rawUpload(res) < 0) { ; //return TRANSFER_STOPPED; } } } chdirNoRefresh(oldDir); return TRANSFER_SUCCESSFUL; } private String parse(String file) { file = parseSymlink(file); return file; } /** recursive delete remote directory */ private int cleanDir(String dir, String path) { if(dir.equals("")) { return 0; } if(!dir.endsWith("/")) { dir = dir + "/"; } String remoteDir = StringUtils.removeStart(dir, path); String oldDir = pwd; chdirNoRefresh(pwd + remoteDir); try { list(); } catch(IOException ex) { // probably we don't have permission to ls here return PERMISSION_DENIED; } String[] tmp = sortLs(); chdirNoRefresh(oldDir); if(tmp == null) { return GENERIC_FAILED; } for(int i = 0; i < tmp.length; i++) { Log.out("cleanDir: " + tmp); if(isSymlink(tmp[i])) { Log.debug("WARNING: Skipping symlink, remove failed."); Log.debug("This is necessary to prevent possible data loss when removing those symlinks."); tmp[i] = null; } if(tmp[i] != null) { tmp[i] = parseSymlink(tmp[i]); } if((tmp[i] == null) || tmp[i].equals("./") || tmp[i].equals("../")) { //System.out.println(tmp[i]+"\n\n\n"); continue; } //System.out.println(tmp[i]); //pause(500); if(tmp[i].endsWith("/")) { // System.out.println(dir); cleanDir(dir + tmp[i], path); int x = removeFileOrDir(dir + tmp[i]); if(x < 0) { return x; } } else { // System.out.println(dir+tmp[i]); int x = removeFileOrDir(dir + tmp[i]); if(x < 0) { return x; } } } return REMOVE_SUCCESSFUL; } /** * Remove a remote file or directory. * * @param file The file to remove * @return REMOVE_SUCCESSFUL, REMOVE_FAILED, PERMISSION_DENIED or GENERIC_FAILED */ public int removeFileOrDir(String file) { if(file == null) { return 0; } if(file.trim().equals(".") || file.trim().equals("..")) { Log.debug("ERROR: Catching attempt to delete . or .. directories"); return GENERIC_FAILED; } if(isSymlink(file)) { Log.debug("WARNING: Skipping symlink, remove failed."); Log.debug("This is necessary to prevent possible data loss when removing those symlinks."); return REMOVE_FAILED; } file = parseSymlink(file); if(file.endsWith("/")) { int ret = cleanDir(file, getCachedPWD()); if(ret < 0) { return ret; } jcon.send(RMD + " " + file); } else { jcon.send(DELE + " " + file); } if(success(POSITIVE))//FTP250_COMPLETED)) { return REMOVE_SUCCESSFUL; } else { return REMOVE_FAILED; } } /** * Disconnect from the server. * The connection is marked ad closed even if the server does not respond correctly - * if it fails for any reason the connection should just time out * */ public void disconnect() { jcon.send(QUIT); getLine(POSITIVE);//FTP221_SERVICE_CLOSING); connected = false; } /** * Execute a remote command. * Sends noops before and after the command * * @param cmd The raw command that is to be sent to the server */ public void sendRawCommand(String cmd) { noop(); Log.clearCache(); jcon.send(cmd); noop(); } /** * Reads the response until line found or error. * (Used internally) * * @param until The String the response line hast to start with, 2 for succesful return codes for example */ public String getLine(String until) { return getLine(new String[] { until }); } /** * Reads the response until line found or error. * (Used internally) */ public String getLine(String[] until) { BufferedReader in = null; try { in = jcon.getReader(); } catch(Exception ex) { Log.debug(ex.toString() + " @FtpConnection::getLine"); } //String resultString = null; String tmp; while(true) { try { tmp = in.readLine(); if(tmp == null) { break; } Log.debug(tmp); if(((tmp.startsWith(NEGATIVE) || (tmp.startsWith(NEGATIVE2))) && (tmp.charAt(3) != MORE_LINES_APPENDED)) || tmp.startsWith(PROCEED)) { return tmp; } else { for(int i = 0; i < until.length; i++) { if(tmp.startsWith(until[i])) { //if(resultString == null) resultString = tmp; //else resultString = resultString + "\n" + tmp; if(tmp.charAt(3) != MORE_LINES_APPENDED) { return tmp; } } } } } catch(Exception ex) { Log.debug(ex.toString() + " @FtpConnection::getLine"); break; } } return null; } /** * Check if login() was successful. * * @return True if connected, false otherwise */ public boolean isConnected() { return connected; } /** * Get the current remote directory. * * @return The server's CWD */ public String getPWD() { if(connected) { updatePWD(); } if(TESTMODE) { return "HUGO.user."; } return pwd; } /** * Returns current remote directory (cached) * * @return The cached CWD */ public String getCachedPWD() { return pwd; } /** * updates PWD */ private void updatePWD() { jcon.send(PWD); String tmp = getLine(POSITIVE);//FTP257_PATH_CREATED); if(tmp == null) { return; } if(TESTMODE) { tmp = "\"'T759F.'\""; } String x1 = tmp; if(x1.indexOf("\"") >= 0) { x1 = tmp.substring(tmp.indexOf("\"") + 1); x1 = x1.substring(0, x1.indexOf("\"")); } if(getOsType().indexOf("MVS") >= 0) { //if(x1.indexOf("'") == 0) { // String x2 = x1.substring(1, x1.lastIndexOf("'")); // x1 = x2; //} Log.out("pwd: " + x1); } else if(!x1.endsWith("/")) { x1 = x1 + "/"; } pwd = x1; } /** * Change directory unparsed. * Use chdir instead if you do not parse the dir correctly... * * @param dirName The raw directory name * @return True if successful, false otherwise */ public boolean chdirRaw(String dirName) { jcon.send(CWD + " " + dirName); return success(POSITIVE);//FTP250_COMPLETED); } private boolean success(String op) { String tmp = getLine(op); if((tmp != null) && tmp.startsWith(op)) { return true; } else { return false; } } /** * Change to the parent of the current working directory. * The CDUP command is a special case of CWD, and is included * to simplify the implementation of programs for transferring * directory trees between operating systems having different * syntaxes for naming the parent directory. * * @return True if successful, false otherwise */ public boolean cdup() { jcon.send(CDUP); return success(POSITIVE);//FTP200_OK); } /** * Create a directory with the given name. * * @param dirName The name of the directory to create * @return True if successful, false otherwise */ public boolean mkdir(String dirName) { jcon.send(MKD + " " + dirName); boolean ret = success(POSITIVE); // Filezille server bugfix, was: FTP257_PATH_CREATED); Log.out("mkdir(" + dirName + ") returned: " + ret); //*** Added 03/20/2005 fireDirectoryUpdate(this); //*** return ret; } private int negotiatePort() throws IOException { String tmp = ""; if(Settings.getFtpPasvMode()) { jcon.send(PASV); tmp = getLine(FTP227_ENTERING_PASSIVE_MODE); if((tmp != null) && !tmp.startsWith(NEGATIVE)) { return getPasvPort(tmp); } } tmp = getActivePortCmd(); jcon.send(tmp); getLine(FTP200_OK); return getActivePort(); } /** * List remote directory. * Note that you have to get the output using the * sort*-methods. * * @param outfile The file to save the output to, usually Settings.ls_out */ public void list() throws IOException { String oldType = ""; try { //BufferedReader in = jcon.getReader(); int p = 0; modeStream(); oldType = getTypeNow(); ascii(); p = negotiatePort(); dcon = new DataConnection(this, p, host, null, DataConnection.GET, false, true); //,null); while(dcon.getInputStream() == null) { //System.out.print("#"); pause(10); } BufferedReader input = new BufferedReader(new InputStreamReader(dcon.getInputStream())); jcon.send(LIST); String line; currentListing.removeAllElements(); while((line = input.readLine()) != null) { System.out.println("-> "+line); if(!line.trim().equals("")) { currentListing.add(line); } } getLine(POSITIVE); //FTP226_CLOSING_DATA_REQUEST_SUCCESSFUL); input.close(); if(!oldType.equals(ASCII)) { type(oldType); } } catch(Exception ex) { Log.debug("Cannot list remote directory!"); if(!oldType.equals(ASCII)) { type(oldType); } ex.printStackTrace(); throw new IOException(ex.getMessage()); } } /** * Parses directory and does a chdir(). * Does also fire a directory update event. * * @return True is successful, false otherwise */ public boolean chdir(String p) { //Log.out("Change directory to: "+p); //String tmpPath = p; boolean tmp = chdirWork(p); if(!tmp) { return false; } else { fireDirectoryUpdate(this); return true; } } /** * Parses directory and does a chdir(), but does not send an update signal * * @return True is successful, false otherwise */ public boolean chdirNoRefresh(String p) { return chdirWork(p); } private boolean chdirWork(String p) { if(Settings.safeMode) { noop(); } p = parseSymlinkBack(p); if(getOsType().indexOf("OS/2") >= 0) { return chdirRaw(p); } else if(getOsType().indexOf("MVS") >= 0) { boolean cdup = false; System.out.print("MVS parser: "+p+" -> "); //TODO: handle relative unix paths if(!getPWD().startsWith("/")) //return chdirRaw(p); { if(p.endsWith("..")) { cdup = true; } //TODO let dirlister form correct syntax p = p.replaceAll("/", ""); boolean ew = p.startsWith("'"); String tmp = null; if(p.startsWith("'") && !p.endsWith("'")) { if(cdup){ p = p.substring(0,p.length()-4); if(p.indexOf(".") > 0) { p = p.substring(0,p.lastIndexOf(".")); } p += "'"; } tmp = p.substring(0, p.lastIndexOf("'")); p = p.substring(p.lastIndexOf("'")+1); ew = false; } else if(cdup){ p = p.substring(0,p.length()-3); if(p.indexOf(".") > 0) { p = p.substring(0,p.lastIndexOf(".")); } } if(p.indexOf(".") > 0 && !ew) { p = p.substring(0, p.indexOf(".")); } if(tmp != null) p = tmp+p+"'"; System.out.println(p); Log.out("MVS parser: " + p); return chdirRaw(p); } } try { // check if we don't have a relative path if(!p.startsWith("/") && !p.startsWith("~")) { p = pwd + p; } // argh, we should document that! if(p.endsWith("..")) { boolean home = p.startsWith("~"); StringTokenizer stok = new StringTokenizer(p, "/"); //System.out.println("path p :"+p +" Tokens: "+stok.countTokens()); if(stok.countTokens() > 2) { String pold1 = ""; String pold2 = ""; String pnew = ""; while(stok.hasMoreTokens()) { pold1 = pold2; pold2 = pnew; pnew = pnew + "/" + stok.nextToken(); } p = pold1; } else { p = "/"; } if(home) { p = p.substring(1); } } //System.out.println("path: "+p); if(!chdirRaw(p)) { return false; } } catch(Exception ex) { Log.debug("(remote) Can not get pathname! " + pwd + ":" + p); ex.printStackTrace(); return false; } //fireDirectoryUpdate(this); // -------------------------------------- updatePWD(); return true; } /** * Waits a specified amount of time * * @param time The time to sleep in milliseconds */ public void pause(int time) { try { Thread.sleep(time); } catch(Exception ex) { ex.printStackTrace(); } } /** * Return the local working directory * * @return The local CWD */ public String getLocalPath() { return localPath; } /** * Set the local working directory * * @param newPath The new local CWD * @return Always true in the current implementation */ public boolean setLocalPath(String newPath) { localPath = newPath; if(!localPath.endsWith("/")) { localPath = localPath + "/"; } return true; } /** * Checks wheter a file exists. * * @param file the name of the file * @return An int-code: CHDIR_FAILED, PERMISSION_DENIED (no listing allowed), R, W or DENIED */ public int exists(String file) { String dir = null; String tmpPWD = getCachedPWD(); if(file.indexOf("/") >= 0) { dir = file.substring(0, file.lastIndexOf("/") + 1); Log.out("checking dir: " + dir); if(!chdir(dir)) { return CHDIR_FAILED; } } try { list(); } catch(IOException ex) { ex.printStackTrace(); return PERMISSION_DENIED; } String f = file.substring(file.lastIndexOf("/") + 1); Log.out("checking file: " + f); String[] files = sortLs(); int[] perms = getPermissions(); int y = -1; for(int x = 0; x < files.length; x++) { if(files[x].equals(f)) { y = x; break; } } if(y == -1) { return FILE_NOT_FOUND; } if(dir != null) { chdir(tmpPWD); } return perms[y]; } /** Moves or renames remote file. * @param from remote file to move or rename. * @param to new file name. * @return true if completed successfully; false otherwise. */ public boolean rename(String from, String to) { jcon.send("RNFR " + from); if(success(RC350)) { jcon.send("RNTO " + to); if(success(POSITIVE))//FTP250_COMPLETED)) { return true; } } return false; } /** * Get the port. * * @return The port used by the FTP control connection */ public int getPort() { return port; } private int getPortA() { return porta; } private int getPortB() { return portb; } /* private void incrementPort() { portb++; } */ /* private String getActivePortCmd() throws UnknownHostException, IOException { InetAddress ipaddr = jcon.getLocalAddress(); String ip = ipaddr.getHostAddress().replace('.', ','); incrementPort(); int a = getPortA(); int b = getPortB(); String ret = "PORT " + ip + "," + a + "," + b; //System.out.println(ret); return ret; } */ private String getActivePortCmd() throws UnknownHostException, IOException { InetAddress ipaddr = jcon.getLocalAddress(); String ip = ipaddr.getHostAddress().replace('.', ','); ServerSocket aSock = new ServerSocket(0); int availPort = aSock.getLocalPort(); aSock.close(); porta = availPort/256; portb = availPort%256; String ret = "PORT " + ip + "," + porta + "," + portb; // System.out.println(ret); return ret; } /** * Tell server we want binary data connections. */ public void binary() { // possible responses 200, 500, 501, 504, 421 and 530 type(BINARY); } /** * Tell server we want ascii data connections. */ public void ascii() { type(ASCII); } /** * Set type (L8,I,A for example). * * @return True if the type was changed successfully, false otherwise */ public boolean type(String code) { jcon.send(TYPE + " " + code); String tmp = getLine(POSITIVE);//FTP200_OK); if((tmp != null) && tmp.startsWith(POSITIVE))//FTP200_OK)) { typeNow = code; return true; } return false; } /** * Returns the type used. * * @return The type String, I, A, L8 for example */ public String getTypeNow() { return typeNow; } /** * Do nothing, but flush buffers */ public void noop() { jcon.send(NOOP); getLine(POSITIVE);//FTP200_OK); } /** * Try to abort the transfer. */ public void abort() { jcon.send(ABOR); getLine(POSITIVE); // 226 } /** * This command is used to find out the type of operating * system at the server. The reply shall have as its first * word one of the system names listed in the current version * of the Assigned Numbers document (RFC 943). * * @return The server response of the SYST command */ public String system() { // possible responses 215, 500, 501, 502, and 421 jcon.send(SYST); String response = getLine(POSITIVE);//FTP215_SYSTEM_TYPE); if(response != null) { //StringTokenizer st = new StringTokenizer(response); //if (st.countTokens() >= 2) //{ // st.nextToken(); // String os = st.nextToken(); // setOsType(os); //} setOsType(response); } else { setOsType("UNIX"); } return response; } /** * Set mode to Stream. * Used internally. */ public void modeStream() { if(useStream && !modeStreamSet) { String ret = mode(STREAM); if((ret != null) && ret.startsWith(NEGATIVE)) { useStream = false; } else { modeStreamSet = true; } } } /** * Unsupported at this time. */ public void modeBlocked() { if(useBlocked) { if(mode(BLOCKED).startsWith(NEGATIVE)) { useBlocked = false; } } } /* * Unsupported at this time. */ public void modeCompressed() { if(useCompressed) { if(mode(COMPRESSED).startsWith(NEGATIVE)) { useCompressed = false; } } } /** * Set mode manually. * * @param code The mode code wanted, I, A, L8 for example * @return The server's response to the request */ public String mode(String code) { jcon.send(MODE + " " + code); String ret = ""; try { ret = getLine(POSITIVE);//FTP200_OK); } catch(Exception ex) { ex.printStackTrace(); } return ret; } /** * Return the host used. * * @return The remote host of this connection */ public String getHost() { return host; } /** * Return the username. * * @return The username used by this connection */ public String getUsername() { return username; } /** * Return the password. * * @return The password used by this connection */ public String getPassword() { return password; } /** * Return the DataConnection. * Should be necessary only for complex actions. * * @return The DataConnection object currently used by this conenction */ public DataConnection getDataConnection() { return dcon; } /** * Add a ConnectionListener. * The Listener is notified about transfers and the connection state. * @param l A ConnectionListener object */ public void addConnectionListener(ConnectionListener l) { listeners.add(l); } /** * Add a Vector of ConnectionListeners. * Each Listener is notified about transfers and the connection state. * * @param l A Vector containig ConnectionListener objects */ public void setConnectionListeners(Vector l) { listeners = l; } /** * Remote directory has changed. * * @param con The FtpConnection calling the event */ public void fireDirectoryUpdate(FtpConnection con) { if(listeners == null) { return; } else { for(int i = 0; i < listeners.size(); i++) { ((ConnectionListener) listeners.elementAt(i)).updateRemoteDirectory(con); } } } /** * Progress update. * The transfer is active and makes progress, so a signal is send * each few kb. * * @param file The file transferred * @param type the type of event, DataConnection.GETDIR for example * @param bytes The number of bytes transferred so far */ public void fireProgressUpdate(String file, String type, long bytes) { //System.out.println(listener); if(listeners == null) { return; } else { for(int i = 0; i < listeners.size(); i++) { ConnectionListener listener = (ConnectionListener) listeners.elementAt(i); if(shortProgress && Settings.shortProgress) { if(type.startsWith(DataConnection.DFINISHED)) { listener.updateProgress(baseFile, DataConnection.DFINISHED + ":" + fileCount, bytes); } else if(isDirUpload) { listener.updateProgress(baseFile, DataConnection.PUTDIR + ":" + fileCount, bytes); } else { listener.updateProgress(baseFile, DataConnection.GETDIR + ":" + fileCount, bytes); } } else { listener.updateProgress(file, type, bytes); } } } } /** * Connection is there and user logged in * * @param con The FtpConnection calling the event */ public void fireConnectionInitialized(FtpConnection con) { if(listeners == null) { return; } else { for(int i = 0; i < listeners.size(); i++) { ((ConnectionListener) listeners.elementAt(i)).connectionInitialized(con); } } } /** * We are not logged in for some reason * * @param con The FtpConnection calling the event * @param why The login() response code */ public void fireConnectionFailed(FtpConnection con, String why) { if(listeners == null) { return; } else { for(int i = 0; i < listeners.size(); i++) { ((ConnectionListener) listeners.elementAt(i)).connectionFailed(con, why); } } } /** * Transfer is done * * @param con The FtpConnection calling the event */ public void fireActionFinished(FtpConnection con) { if(listeners == null) { return; } else { for(int i = 0; i < listeners.size(); i++) { ((ConnectionListener) listeners.elementAt(i)).actionFinished(con); } } } /** * Return the ConnectionHandler. * * @return The connection handler of this instance */ public ConnectionHandler getConnectionHandler() { return handler; } /** * Set the ConnectionHandler. * * @param h The connection handler that is to be used by this connection */ public void setConnectionHandler(ConnectionHandler h) { handler = h; } /** * Get the last FtpTransfer object spawned. * */ public FtpTransfer getLastInitiatedTransfer() { return lastTransfer; } /** * Abort the last spawned transfer. * */ public void abortTransfer() { try { DataConnection dcon = lastTransfer.getDataConnection(); if(dcon == null) { Log.out("nothing to abort"); return; } dcon.getCon().work = false; dcon.sock.close(); } catch(Exception ex) { Log.debug("Exception during abort: " + ex.toString()); ex.printStackTrace(); } } public Date[] sortDates() { if(dateVector.size() > 0) { return (Date[]) dateVector.toArray(); } else { return null; } } public String getCRLF() { return crlf; } public BufferedReader getIn() { return in; } public void setIn(BufferedReader in) { this.in = in; } public BufferedReader getCommandInputReader() { return jcon.getIn(); } public OutputStream getCommandOutputStream() { return jcon.getOut(); } } jftp-1.52.orig/src/java/net/sf/jftp/net/FtpConstants.java0000700000175000017500000002405311112477774022353 0ustar varunvarun/* * 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. */ package net.sf.jftp.net; /** * This class provides some constant used by FtpConnection. */ public interface FtpConstants { /** List */ //public static final String LIST = "LIST -laL"; /** Possible upload() / download() return code */ public static final int TRANSFER_FAILED = -1; /** Possible upload() / download() return code */ public static final int TRANSFER_STOPPED = -2; /** Possible upload() / download() / remove() return code */ public static final int MKDIR_FAILED = -3; /** Possible upload() / download() return code */ public static final int PERMISSION_DENIED = -4; /** Possible upload() / download() / exists() return code */ public static final int CHDIR_FAILED = -5; /** Possible login() return code */ public final static int WRONG_LOGIN_DATA = -6; /** Possible login() return code */ public final static int OFFLINE = -7; /** Possible login() / remove() return code */ public final static int GENERIC_FAILED = -8; /** Possible remove() return code */ public final static int REMOVE_FAILED = -9; /** Possible upload() return code */ public final static int RENAME_FAILED = -10; /** Possible exists() return code */ public final static int FILE_NOT_FOUND = -11; /** Possible up/download() return code */ public final static int DATACONNECTION_FAILED = -12; /** Possible upload() / download() return code */ public static final int NEW_TRANSFER_SPAWNED = 0; /** Possible upload() / download() return code */ public static final int TRANSFER_SUCCESSFUL = 1; /** Possible login() return code */ public final static int LOGIN_OK = 2; /** Possible remove() return code */ public final static int REMOVE_SUCCESSFUL = 3; /** Possible getPermissions() / exists() return code */ public static final int R = 23; /** Possible getPermissions() / exists() return code */ public static final int W = 42; /** Possible getPermissions() / exists() return code */ public static final int DENIED = -666; // Access Control Commands /** User Name */ public final static String USER = "USER"; /** Password */ public final static String PASS = "PASS"; /** Account */ public final static String ACCT = "ACCT"; /** Change Working Directory */ public final static String CWD = "CWD"; /** Change to Parent Directory */ public final static String CDUP = "CDUP"; /** Structure Mount */ public final static String SMNT = "SMNT"; /** Reinitialize */ public final static String REIN = "REIN"; /** Logout */ public final static String QUIT = "QUIT"; // Transfer Parameter Commands /** Data Port */ public final static String PORT = "PORT"; /** Passive */ public final static String PASV = "PASV"; /** Representation Type (ASCII, EBCDIC, Image, Non-print, Telnet format effectors, Carriage Control, Local byte Byte size) */ public final static String TYPE = "TYPE"; /** File Structure (File, Record Structure, Page Structure) */ public final static String STRU = "STRU"; /** Transfer Mode (Stream, Block, Compressed) */ public final static String MODE = "MODE"; // FTP Service Commands /** Retrieve */ public final static String RETR = "RETR"; /** Store */ public final static String STOR = "STOR"; /** Store Unique */ public final static String STOU = "STOU"; /** Append (with create) */ public final static String APPE = "APPE"; /** Allocate */ public final static String ALLO = "ALLO"; /** Restart */ public final static String REST = "REST"; /** Rename From */ public final static String RNFR = "RNFR"; /** Rename To */ public final static String RNTO = "RNTO"; /** Abort */ public final static String ABOR = "ABOR"; /** Delete */ public final static String DELE = "DELE"; /** Remove Directory */ public final static String RMD = "RMD"; /** Make Directory */ public final static String MKD = "MKD"; /** Print Working Directory */ public final static String PWD = "PWD"; /** Name List */ public final static String NLST = "NLST"; /** Site Parameters */ public final static String SITE = "SITE"; /** System */ public final static String SYST = "SYST"; /** Status */ public final static String STAT = "STAT"; /** Help */ public final static String HELP = "HELP"; /** NOOP */ public final static String NOOP = "NOOP"; // The following commands were introduced in rfc 2228 FTP Security Extensions /** Authentication/Security Mechanism */ public final static String AUTH = "AUTH"; /** Authentication/Security Data */ public final static String ADAT = "ADAT"; /** Data Channel Protection Level */ public final static String PROT = "PROT"; /** Protection Buffer Size */ public final static String PBSZ = "PBSZ"; /** Clear Command Channel */ public final static String CCC = "CCC"; /** Integrity Protected Command */ public final static String MIC = "MIC"; /** Confidentiality Protected Command */ public final static String CONF = "CONF"; /** Privacy Protected Command */ public final static String ENC = "ENC"; // end of commands from rfc 2228 // ftp reply codes // x0z Syntax // x1z Information // x2z Connections // x3z Authentication and accounting // x4z Unspecified // x5z File system // 1yz Positive Preliminary reply /** Restart marker reply */ public final static String RC110 = "110"; /** Service ready in nnn minutes */ public final static String RC120 = "120"; /** Data connection already open */ public final static String RC125 = "125"; /** File status okay; about to open data connection */ public final static String RC150 = "150"; // 2yz Positive Completion reply /** Command okay */ public final static String FTP200_OK = "2"; /** Command not implemented, superfluous at this site */ public final static String RC202 = "202"; /** System status, or system help reply */ public final static String RC211 = "211"; /** Directory status */ public final static String RC212 = "212"; /** File status */ public final static String RC213 = "213"; /** Help message */ public final static String RC214 = "214"; /** System type */ public final static String FTP215_SYSTEM_TYPE = "215"; /** Service ready for new user */ public final static String FTP220_SERVICE_READY = "220"; /** Service closing control connection */ public final static String FTP221_SERVICE_CLOSING = "221"; /** Data connection open; no transfer in progress */ public final static String RC225 = "225"; /** Closing data connection; requested file action successful */ public final static String FTP226_CLOSING_DATA_REQUEST_SUCCESSFUL = "226"; /** Entering Passive Mode */ public final static String FTP227_ENTERING_PASSIVE_MODE = "227"; /** User logged in, proceed */ public final static String FTP230_LOGGED_IN = "2"; // 230 /** Requested file action okay, completed */ public final static String FTP250_COMPLETED = "250"; /** "PATHNAME" created */ public final static String FTP257_PATH_CREATED = "257"; // 3yz Positive Intermediate reply /** User name okay, need password */ public final static String FTP331_USER_OK_NEED_PASSWORD = "331"; /** Need account for login */ public final static String RC332 = "332"; /** Requested file action pending further information */ public final static String RC350 = "350"; // 4yz Transient Negative Completion reply /** Service not available */ public final static String RC421 = "421"; /** Can't open data connection */ public final static String RC425 = "425"; /** Connection closed; transfer aborted */ public final static String RC426 = "426"; /** Requested file action not taken, file unavailable (file busy) */ public final static String RC450 = "450"; /** Requested action aborted: local error in processing */ public final static String RC451 = "451"; /** Requested action not taken, insufficient storage space in system */ public final static String RC452 = "452"; // 5yz Permanent Negative Completion reply /** Syntax error, command unrecognized */ public final static String RC500 = "500"; /** Syntax error in parameters or arguments */ public final static String RC501 = "501"; /** Command not implemented */ public final static String RC502 = "502"; /** Bad sequence of commands */ public final static String RC503 = "503"; /** Command not implemented for that parameter */ public final static String RC504 = "504"; /** Not logged in */ public final static String RC530 = "530"; /** Need account for storing files */ public final static String RC532 = "532"; /** Requested action not taken, file unavailable (file not found, no access) */ public final static String RC550 = "550"; /** Requested action aborted: page type unknown */ public final static String RC551 = "551"; /** Requested file action aborted, exceeded storage allocation */ public final static String RC552 = "552"; /** Requested action not taken, file name not allowed */ public final static String RC553 = "553"; } jftp-1.52.orig/src/java/net/sf/jftp/net/wrappers/0000700000175000017500000000000011264111603020676 5ustar varunvarunjftp-1.52.orig/src/java/net/sf/jftp/net/wrappers/SmbTransfer.java0000700000175000017500000000264311112477774024017 0ustar varunvarunpackage net.sf.jftp.net.wrappers; import java.util.Vector; import net.sf.jftp.net.Transfer; public class SmbTransfer implements Runnable { private String url; private String domain; private String localPath; private String file; private String user; private String pass; private SmbConnection con = null; private String type; public Thread runner; private Vector listeners; public SmbTransfer(String url, String localPath, String file, String user, String pass, String domain, Vector listeners, String type) { this.url = url; this.localPath = localPath; this.file = file; this.user = user; this.pass = pass; this.type = type; this.domain = domain; this.listeners = listeners; prepare(); } public void prepare() { runner = new Thread(this); runner.setPriority(Thread.MIN_PRIORITY); runner.start(); } public void run() { con = new SmbConnection(url, domain, user, pass, null); con.setLocalPath(localPath); con.setConnectionListeners(listeners); if(type.equals(Transfer.DOWNLOAD)) { con.download(file); } else if(type.equals(Transfer.UPLOAD)) { con.upload(file); } } public SmbConnection getSmbConnection() { return con; } } jftp-1.52.orig/src/java/net/sf/jftp/net/wrappers/SftpURLConnection.java0000700000175000017500000000630411264334022025070 0ustar varunvarun/* * 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. */ package net.sf.jftp.net.wrappers; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.net.URL; import java.net.URLConnection; import net.sf.jftp.JFtp; import net.sf.jftp.net.FtpConnection; import net.sf.jftp.net.FtpURLConnection; import net.sf.jftp.system.logging.Log; /** * */ public class SftpURLConnection extends URLConnection { private SftpConnection connection = null; private String username = "no"; private String password = "none@no.no"; private boolean loginFlag; public SftpURLConnection(URL u) { super(u); com.sshtools.j2ssh.configuration.SshConnectionProperties properties = new com.sshtools.j2ssh.configuration.SshConnectionProperties(); properties.setHost(u.getHost()); properties.setPort(getPort()); // parse the url for username and password and the remote directory String userInfo = u.getUserInfo(); if(userInfo != null) { int index = userInfo.indexOf(":"); if(index != -1) { username = userInfo.substring(0, index); password = userInfo.substring(index + 1); } } System.out.println(u.getPath()); System.out.println(u.getPort()); System.out.println(u.getUserInfo()); Log.debug("Connecting..."); connection = new SftpConnection(properties); } public void connect() throws IOException { loginFlag = connection.login(username, password); if(!loginFlag) { return; } //System.out.println(url.getPath()); connection.chdir(url.getPath()); } public SftpConnection getSftpConnection() { return connection; } public InputStream getInputStream() throws IOException { return null; } public OutputStream getOutputStream() throws IOException { return null; } public String getUser() { return username; } public String getPass() { return password; } public String getHost() { return url.getHost(); } public int getPort() { int ret = url.getPort(); if(ret <= 0) { return 22; } else { return ret; } } public boolean getLoginResponse() { return loginFlag; } public boolean loginSucceeded() { return loginFlag; } } jftp-1.52.orig/src/java/net/sf/jftp/net/wrappers/Sftp2Connection.java0000700000175000017500000006441211112477774024611 0ustar varunvarun/* * 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. */ package net.sf.jftp.net.wrappers; import java.io.BufferedInputStream; import java.io.BufferedOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.StreamTokenizer; import java.util.Date; import java.util.Enumeration; import java.util.Vector; import javax.swing.JOptionPane; import net.sf.jftp.config.Settings; import net.sf.jftp.net.BasicConnection; import net.sf.jftp.net.ConnectionListener; import net.sf.jftp.net.DataConnection; import net.sf.jftp.net.FtpConnection; import net.sf.jftp.net.Transfer; import net.sf.jftp.system.StringUtils; import net.sf.jftp.system.logging.Log; import com.jcraft.jsch.Channel; import com.jcraft.jsch.ChannelSftp; import com.jcraft.jsch.JSch; import com.jcraft.jsch.Session; import com.jcraft.jsch.SftpException; import com.jcraft.jsch.UserInfo; import com.jcraft.jsch.ChannelSftp.LsEntry; import com.sshtools.j2ssh.sftp.SftpFile; import com.sshtools.j2ssh.sftp.SftpFileInputStream; import com.sshtools.j2ssh.sftp.SftpFileOutputStream; import com.sshtools.j2ssh.sftp.SftpSubsystemClient; public class Sftp2Connection implements BasicConnection { public static int smbBuffer = 32000; private String path = ""; private String pwd = "/"; private Vector listeners = new Vector(); private String[] files; private String[] size = new String[0]; private int[] perms = null; private String user; private String pass; private String host; private String baseFile; private int fileCount; private boolean isDirUpload = false; private boolean shortProgress = false; private int RW = SftpSubsystemClient.OPEN_CREATE | SftpSubsystemClient.OPEN_WRITE; private int W = SftpSubsystemClient.OPEN_CREATE; private int R = SftpSubsystemClient.OPEN_READ; private int port = 22; private boolean connected = false; private String keyfile = null; private Session session; private ChannelSftp channel; public Sftp2Connection(String host, String port, String keyfile) { this.host = host; this.port = Integer.parseInt(port); this.keyfile = keyfile; Log.debug("Using JSch wrapper..."); } private boolean login() { try { JSch jsch = new JSch(); if(keyfile != null) { jsch.addIdentity(keyfile); } session = jsch.getSession(user, host, this.port); UserInfo ui = new MyUserInfo(pass); session.setUserInfo(ui); session.connect(); channel = (ChannelSftp) session.openChannel("sftp"); channel.connect(); Log.debug("Host: "+host+":"+port); connected = true; return true; } catch(Exception ex) { ex.printStackTrace(); Log.debug("Error: " + ex); return false; } } public int removeFileOrDir(String file) { file = toSFTP(file); try { if(!file.endsWith("/")) { Log.out(">>>>>>>> remove file: " + file); channel.rm(file); } else { Log.out(">>>>>>>> remove dir: " + file); cleanSftpDir(file); channel.rmdir(file); } } catch(Exception ex) { ex.printStackTrace(); Log.debug("Removal failed (" + ex + ")."); ex.printStackTrace(); return -1; } return 1; } private void cleanSftpDir(String dir) throws Exception { Log.out(">>>>>>>> cleanSftpDir: " + dir); Vector v = channel.ls(dir); String[] tmp = new String[v.size()]; Enumeration e = v.elements(); int x = 0; while(e.hasMoreElements()) { LsEntry entry = ((LsEntry)e.nextElement()); tmp[x] = entry.getFilename(); //Log.out("sftp delete: " + tmp[x]); if(entry.getAttrs().isDir() && !tmp[x].endsWith("/")) { tmp[x] = tmp[x] + "/"; } x++; } if(tmp == null) { return; } for(int i = 0; i < tmp.length; i++) { if(tmp[i].equals("./") || tmp[i].equals("../")) { continue; } Log.out(">>>>>>>> remove file/dir: " + dir + tmp[i]); if(tmp[i].endsWith("/")) { cleanSftpDir(dir + tmp[i]); channel.rmdir(dir + tmp[i]); } else { channel.rm(dir + tmp[i]); } } } public void sendRawCommand(String cmd) { } public void disconnect() { try { channel.disconnect(); session.disconnect(); } catch(Exception e) { e.printStackTrace(); Log.debug("Sftp2Connection.disconnect()" + e); } connected = false; } public boolean isConnected() { return connected; } public String getPWD() { //Log.debug("PWD: " + pwd); return toSFTPDir(pwd); } public boolean mkdir(String dirName) { try { if(!dirName.endsWith("/")) { dirName = dirName + "/"; } dirName = toSFTP(dirName); channel.mkdir(dirName); fireDirectoryUpdate(); return true; } catch(Exception ex) { Log.debug("Failed to create directory (" + ex + ")."); return false; } } public void list() throws IOException { } public boolean chdir(String p) { return chdir(p, true); } public boolean chdir(String p, boolean refresh) { String tmp = toSFTP(p); try { if(!tmp.endsWith("/")) { tmp = tmp + "/"; } if(tmp.endsWith("../")) { return cdup(); } System.out.println("sftp path: "+tmp+", chan: "+channel); channel.cd(tmp); pwd = tmp; //Log.debug("chdir: " + getPWD()); if(refresh) { fireDirectoryUpdate(); } //System.out.println("chdir2: " + getPWD()); //Log.debug("Changed path to: " + tmp); return true; } catch(Exception ex) { ex.printStackTrace(); //System.out.println(tmp); Log.debug("Could not change directory (" + ex + ")."); return false; } } public boolean cdup() { String tmp = pwd; if(pwd.endsWith("/")) { tmp = pwd.substring(0, pwd.lastIndexOf("/")); } return chdir(tmp.substring(0, tmp.lastIndexOf("/") + 1)); } public boolean chdirNoRefresh(String p) { return chdir(p, false); } public String getLocalPath() { return path; } public boolean setLocalPath(String p) { if(StringUtils.isRelative(p)) { p = path + p; } p = p.replace('\\', '/'); //System.out.println(", local 2:" + p); File f = new File(p); if(f.exists()) { try { path = f.getCanonicalPath(); path = path.replace('\\', '/'); if(!path.endsWith("/")) { path = path + "/"; } //System.out.println("localPath: "+path); } catch(IOException ex) { Log.debug("Error: can not get pathname (local)!"); return false; } } else { Log.debug("(local) No such path: \"" + p + "\""); return false; } return true; } public String[] sortLs() { try { System.out.println(pwd); Vector v = channel.ls(pwd); String[] tmp = new String[v.size()]; files = new String[tmp.length]; size = new String[tmp.length]; perms = new int[tmp.length]; Enumeration e = v.elements(); int x = 0; while(e.hasMoreElements()) { LsEntry entry = ((LsEntry)e.nextElement()); tmp[x] = entry.getFilename(); size[x] = ""+entry.getAttrs().getSize(); //Log.debug("Perms: "+entry.getAttrs().getPermissionsString()); /* if(!entry.getAttrs().getPermissionsString()) { perms[x] = FtpConnection.DENIED; } else {*/ perms[x] = FtpConnection.R; //} //Log.debugRaw("."); if(entry.getAttrs().isDir() && !tmp[x].endsWith("/")) { tmp[x] = tmp[x] + "/"; } x++; } for(int i = 0; i < tmp.length; i++) { files[i] = tmp[i]; } return files; } catch(Exception ex) { ex.printStackTrace(); Log.debug(" Error while listing directory: " + ex); return new String[0]; } } public String[] sortSize() { return size; } public int[] getPermissions() { return perms; } public int handleUpload(String f) { if(Settings.getEnableSftpMultiThreading()) { Sftp2Transfer t = new Sftp2Transfer(getLocalPath(), getPWD(), f, user, pass, listeners, Transfer.UPLOAD, keyfile, host, ""+port); } else { upload(f); } return 0; } public int handleDownload(String f) { if(Settings.getEnableSftpMultiThreading()) { Sftp2Transfer t = new Sftp2Transfer(getLocalPath(), getPWD(), f, user, pass, listeners, Transfer.DOWNLOAD, keyfile, host, ""+port); } else { download(f); } return 0; } public int upload(String f) { String file = toSFTP(f); if(file.endsWith("/")) { String out = StringUtils.getDir(file); uploadDir(file, getLocalPath() + out); fireActionFinished(this); } else { String outfile = StringUtils.getFile(file); //System.out.println("transfer: " + file + ", " + getLocalPath() + outfile); work(getLocalPath() + outfile, file, true); fireActionFinished(this); } return 0; } public int download(String f) { String file = toSFTP(f); if(file.endsWith("/")) { String out = StringUtils.getDir(file); downloadDir(file, getLocalPath() + out); fireActionFinished(this); } else { String outfile = StringUtils.getFile(file); //System.out.println("transfer: " + file + ", " + getLocalPath() + outfile); work(file, getLocalPath() + outfile, false); fireActionFinished(this); } return 0; } private void downloadDir(String dir, String out) { try { //System.out.println("downloadDir: " + dir + "," + out); fileCount = 0; shortProgress = true; baseFile = StringUtils.getDir(dir); Vector v = channel.ls(dir); String[] tmp = new String[v.size()]; SftpFile[] f = new SftpFile[v.size()]; Enumeration e = v.elements(); int x = 0; while(e.hasMoreElements()) { LsEntry entry = ((LsEntry)e.nextElement()); tmp[x] = entry.getFilename(); if(entry.getAttrs().isDir() && !tmp[x].endsWith("/")) { tmp[x] = tmp[x] + "/"; } x++; } File fx = new File(out); fx.mkdir(); for(int i = 0; i < tmp.length; i++) { if(tmp[i].equals("./") || tmp[i].equals("../")) { continue; } tmp[i] = tmp[i].replace('\\', '/'); //System.out.println("1: " + dir+tmp[i] + ", " + out +tmp[i]); if(tmp[i].endsWith("/")) { if(!tmp[i].endsWith("/")) { tmp[i] = tmp[i] + "/"; } downloadDir(dir + tmp[i], out + tmp[i]); } else { fileCount++; fireProgressUpdate(baseFile, DataConnection.GETDIR + ":" + fileCount, -1); work(dir + tmp[i], out + tmp[i], false); } } //System.out.println("enddir"); fireProgressUpdate(baseFile, DataConnection.DFINISHED + ":" + fileCount, -1); } catch(Exception ex) { ex.printStackTrace(); System.out.println(dir + ", " + out); Log.debug("Transfer error: " + ex); fireProgressUpdate(baseFile, DataConnection.FAILED + ":" + fileCount, -1); } shortProgress = false; } private void uploadDir(String dir, String out) { try { //System.out.println("uploadDir: " + dir + "," + out); isDirUpload = true; fileCount = 0; shortProgress = true; baseFile = StringUtils.getDir(dir); File f2 = new File(out); String[] tmp = f2.list(); if(tmp == null) { return; } channel.mkdir(dir); //channel.chmod(744, dir); for(int i = 0; i < tmp.length; i++) { if(tmp[i].equals("./") || tmp[i].equals("../")) { continue; } tmp[i] = tmp[i].replace('\\', '/'); //System.out.println("1: " + dir+tmp[i] + ", " + out +tmp[i]); File f3 = new File(out + tmp[i]); if(f3.isDirectory()) { if(!tmp[i].endsWith("/")) { tmp[i] = tmp[i] + "/"; } uploadDir(dir + tmp[i], out + tmp[i]); } else { fileCount++; fireProgressUpdate(baseFile, DataConnection.PUTDIR + ":" + fileCount, -1); work(out + tmp[i], dir + tmp[i], true); } } fireProgressUpdate(baseFile, DataConnection.DFINISHED + ":" + fileCount, -1); } catch(Exception ex) { ex.printStackTrace(); System.out.println(dir + ", " + out); Log.debug("Transfer error: " + ex); fireProgressUpdate(baseFile, DataConnection.FAILED + ":" + fileCount, -1); } isDirUpload = false; shortProgress = true; } private String toSFTP(String f) { String file; if(f.startsWith("/")) { file = f; } else { file = getPWD() + f; } file = file.replace('\\', '/'); //System.out.println("file: "+file); return file; } private String toSFTPDir(String f) { String file; if(f.startsWith("/")) { file = f; } else { file = pwd + f; } file = file.replace('\\', '/'); if(!file.endsWith("/")) { file = file + "/"; } //System.out.println("file: "+file); return file; } private void work(String file, String outfile, boolean up) { BufferedInputStream in = null; BufferedOutputStream out = null; //System.out.println("work"); try { boolean outflag = false; if(up) { in = new BufferedInputStream(new FileInputStream(file)); } else { in = new BufferedInputStream(channel.get(file)); } if(up) { outflag = true; try { channel.rm(outfile); } catch(Exception ex) { } out = new BufferedOutputStream(channel.put(outfile)); } else { out = new BufferedOutputStream(new FileOutputStream(outfile)); } //System.out.println("out: " + outfile + ", in: " + file); byte[] buf = new byte[smbBuffer]; int len = 0; int reallen = 0; //System.out.println(file+":"+getLocalPath()+outfile); while(true) { len = in.read(buf); //System.out.print("."); if(len == StreamTokenizer.TT_EOF) { break; } out.write(buf, 0, len); reallen += len; //System.out.println(file + ":" + StringUtils.getFile(file)); if(outflag) { fireProgressUpdate(StringUtils.getFile(outfile), DataConnection.PUT, reallen); } else { fireProgressUpdate(StringUtils.getFile(file), DataConnection.GET, reallen); } } //if(up) { // channel.chmod(744, outfile); //} fireProgressUpdate(file, DataConnection.FINISHED, -1); } catch(IOException ex) { ex.printStackTrace(); Log.debug("Error with file IO (" + ex + ")!"); fireProgressUpdate(file, DataConnection.FAILED, -1); } catch(SftpException ex) { ex.printStackTrace(); Log.debug("Error with SFTP IO (" + ex + ")!"); fireProgressUpdate(file, DataConnection.FAILED, -1); } finally { try { out.flush(); out.close(); in.close(); } catch(Exception ex) { ex.printStackTrace(); } } } public boolean rename(String oldName, String newName) { try { oldName = toSFTP(oldName); newName = toSFTP(newName); channel.rename(oldName, newName); return true; } catch(Exception ex) { ex.printStackTrace(); Log.debug("Could rename file (" + ex + ")."); return false; } } private void update(String file, String type, int bytes) { if(listeners == null) { return; } else { for(int i = 0; i < listeners.size(); i++) { ConnectionListener listener = (ConnectionListener) listeners.elementAt(i); listener.updateProgress(file, type, bytes); } } } public void addConnectionListener(ConnectionListener l) { listeners.add(l); } public void setConnectionListeners(Vector l) { listeners = l; } /** remote directory has changed */ public void fireDirectoryUpdate() { if(listeners == null) { return; } else { for(int i = 0; i < listeners.size(); i++) { ((ConnectionListener) listeners.elementAt(i)).updateRemoteDirectory(this); } } } public boolean login(String user, String pass) { this.user = user; this.pass = pass; if(!login()) { Log.debug("Login failed."); return false; } else { Log.debug("Authed successfully."); //if(!chdir(getPWD())) chdir("/"); } return true; } /** progress update */ public void fireProgressUpdate(String file, String type, int bytes) { if(listeners == null) { return; } for(int i = 0; i < listeners.size(); i++) { ConnectionListener listener = (ConnectionListener) listeners.elementAt(i); if(shortProgress && Settings.shortProgress) { if(type.startsWith(DataConnection.DFINISHED)) { listener.updateProgress(baseFile, DataConnection.DFINISHED + ":" + fileCount, bytes); } else if(isDirUpload) { listener.updateProgress(baseFile, DataConnection.PUTDIR + ":" + fileCount, bytes); } else { listener.updateProgress(baseFile, DataConnection.GETDIR + ":" + fileCount, bytes); } } else { listener.updateProgress(file, type, bytes); } } } public void fireActionFinished(Sftp2Connection con) { if(listeners == null) { return; } else { for(int i = 0; i < listeners.size(); i++) { ((ConnectionListener) listeners.elementAt(i)).actionFinished(con); } } } public int upload(String file, InputStream i) { BufferedOutputStream out = null; BufferedInputStream in = null; try { file = toSFTP(file); out = new BufferedOutputStream(channel.put(file)); in = new BufferedInputStream(i); //Log.debug(getLocalPath() + ":" + file+ ":"+getPWD()); byte[] buf = new byte[smbBuffer]; int len = 0; int reallen = 0; while(true) { len = in.read(buf); //System.out.print("."); if(len == StreamTokenizer.TT_EOF) { break; } out.write(buf, 0, len); reallen += len; fireProgressUpdate(StringUtils.getFile(file), DataConnection.PUT, reallen); } //channel.chmod(744, file); fireProgressUpdate(file, DataConnection.FINISHED, -1); return 0; } catch(IOException ex) { ex.printStackTrace(); Log.debug("Error with file IO (" + ex + ")!"); fireProgressUpdate(file, DataConnection.FAILED, -1); return -1; } catch(SftpException ex) { ex.printStackTrace(); Log.debug("Error with file SFTP IO (" + ex + ")!"); fireProgressUpdate(file, DataConnection.FAILED, -1); return -1; } finally { try { out.flush(); out.close(); in.close(); } catch(Exception ex) { ex.printStackTrace(); } } } public InputStream getDownloadInputStream(String file) { try { return channel.get(file); } catch(SftpException ex) { ex.printStackTrace(); Log.debug(ex.toString() + " @Sftp2Connection::getDownloadInputStream"); return null; } } public Date[] sortDates() { return null; } } class MyUserInfo implements UserInfo { String password; public MyUserInfo(String pass) { this.password = pass; } public String getPassword(){ return password; } public boolean promptYesNo(String str){ /* Object[] options={ "yes", "no" }; int foo=JOptionPane.showOptionDialog(null, str, "Warning", JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE, null, options, options[0]); return foo==0; */ return true; } public String getPassphrase(){ return password; } public boolean promptPassphrase(String message){ return true; } public boolean promptPassword(String message){ return true; } public void showMessage(String message){ JOptionPane.showMessageDialog(null, message); } } jftp-1.52.orig/src/java/net/sf/jftp/net/wrappers/SftpConnection.java0000700000175000017500000007420011112477774024523 0ustar varunvarun/* * 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. */ package net.sf.jftp.net.wrappers; import java.io.BufferedInputStream; import java.io.BufferedOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.StreamTokenizer; import java.util.Date; import java.util.Enumeration; import java.util.Vector; import javax.swing.JLabel; import net.sf.jftp.config.Settings; import net.sf.jftp.net.BasicConnection; import net.sf.jftp.net.ConnectionListener; import net.sf.jftp.net.DataConnection; import net.sf.jftp.net.FtpConnection; import net.sf.jftp.net.Transfer; import net.sf.jftp.system.StringUtils; import net.sf.jftp.system.logging.Log; import com.sshtools.common.hosts.DialogHostKeyVerification; import com.sshtools.j2ssh.SshClient; import com.sshtools.j2ssh.authentication.AuthenticationProtocolState; import com.sshtools.j2ssh.authentication.PasswordAuthenticationClient; import com.sshtools.j2ssh.authentication.PublicKeyAuthenticationClient; import com.sshtools.j2ssh.configuration.SshConnectionProperties; import com.sshtools.j2ssh.sftp.SftpFile; import com.sshtools.j2ssh.sftp.SftpFileInputStream; import com.sshtools.j2ssh.sftp.SftpFileOutputStream; import com.sshtools.j2ssh.sftp.SftpSubsystemClient; import com.sshtools.j2ssh.transport.publickey.SshPrivateKey; import com.sshtools.j2ssh.transport.publickey.SshPrivateKeyFile; public class SftpConnection implements BasicConnection { public static int smbBuffer = 32000; private String path = ""; private String pwd = "/"; private Vector listeners = new Vector(); private String[] files; private String[] size = new String[0]; private int[] perms = null; private String user; private String pass; private String host; private String baseFile; private int fileCount; private boolean isDirUpload = false; private boolean shortProgress = false; private int RW = SftpSubsystemClient.OPEN_CREATE | SftpSubsystemClient.OPEN_WRITE; private int W = SftpSubsystemClient.OPEN_CREATE; private int R = SftpSubsystemClient.OPEN_READ; private SftpSubsystemClient sftp = null; private int port = 22; private boolean connected = false; private SshClient ssh = null; private String keyfile = null; //private int timeout = 30000; //private SessionChannelClient session = null; private SshConnectionProperties properties = new SshConnectionProperties(); public SftpConnection(SshConnectionProperties properties) { this.properties = properties; this.host = properties.getHost(); this.port = properties.getPort(); } public SftpConnection(SshConnectionProperties properties, String keyfile) { this.properties = properties; this.keyfile = keyfile; this.host = properties.getHost(); this.port = properties.getPort(); } // seem to be broken, use the newer constructors /* public SftpConnection(String host) { this.host = host; properties.setHost(host); } public SftpConnection(String host, int port) { this.host = host; this.port = port; properties.setHost(host); properties.setPort(port); } */ private boolean login() { try { ssh = new SshClient(); //ssh.setSocketTimeout(timeout); //ssh.setKexTimeout(timeout); Log.debug("Host: "+properties.getHost()+":"+properties.getPort()); if(!Settings.getEnableSshKeys()) { ssh.connect(properties,//new IgnoreHostKeyVerification()); new SftpVerification(Settings.sshHostKeyVerificationFile)); } else { ssh.connect(properties, new DialogHostKeyVerification(new JLabel())); } int result = -1; if(keyfile == null) { //ssh.connect(host); PasswordAuthenticationClient pwd = new PasswordAuthenticationClient(); pwd.setUsername(user); pwd.setPassword(pass); result = ssh.authenticate(pwd); } else { Log.out("keyfile-auth: " + keyfile); PublicKeyAuthenticationClient pk = new PublicKeyAuthenticationClient(); pk.setUsername(user); SshPrivateKeyFile file = SshPrivateKeyFile.parse(new File(keyfile)); SshPrivateKey key = file.toPrivateKey(pass); pk.setKey(key); result = ssh.authenticate(pk); } if(result == AuthenticationProtocolState.COMPLETE) { //session = ssh.openSessionChannel(); //boolean ok = session.startSubsystem("sftp"); sftp = new SftpSubsystemClient(); boolean ok = ssh.openChannel(sftp); boolean ok2 = sftp.startSubsystem(); //Log.out("sftp sub ok: "+ok+" and "+ok2); // newer api //SftpClient sftp = ssh.openSftpClient(); connected = true; return true; } else { return false; } } catch(Exception ex) { ex.printStackTrace(); Log.debug("Error: " + ex); return false; } } public int removeFileOrDir(String file) { file = toSFTP(file); try { SftpFile f; if(!file.endsWith("/")) { Log.out(">>>>>>>> remove file: " + file); f = sftp.openFile(file, RW); sftp.removeFile(file); //f.delete(); } else { Log.out(">>>>>>>> remove dir: " + file); f = sftp.openDirectory(file); cleanSftpDir(file, f); sftp.closeFile(f); sftp.removeDirectory(file); } } catch(Exception ex) { ex.printStackTrace(); Log.debug("Removal failed (" + ex + ")."); ex.printStackTrace(); return -1; } return 1; } private void cleanSftpDir(String dir, SftpFile f2) throws Exception { Log.out(">>>>>>>> cleanSftpDir: " + dir); Vector v = new Vector(); while(sftp.listChildren(f2, v) > 0) { ; } String[] tmp = new String[v.size()]; SftpFile[] f = new SftpFile[v.size()]; Enumeration e = v.elements(); int x = 0; while(e.hasMoreElements()) { f[x] = ((SftpFile) e.nextElement()); tmp[x] = f[x].getFilename(); //Log.out("sftp delete: " + tmp[x]); //Log.out(">>>>>>>> remove file/dir: " + tmp[x]); if(f[x].isDirectory() && !tmp[x].endsWith("/")) { tmp[x] = tmp[x] + "/"; } //sftp.closeFile(f[x]); x++; } if(tmp == null) { return; } for(int i = 0; i < tmp.length; i++) { if(tmp[i].equals("./") || tmp[i].equals("../")) { continue; } SftpFile f3; //System.out.println(dir+tmp[i]); if(tmp[i].endsWith("/")) { f3 = sftp.openDirectory(dir + tmp[i]); } else { f3 = sftp.openFile(dir + tmp[i], RW); } Log.out(">>>>>>>> remove file/dir: " + dir + tmp[i]); if(f3.isDirectory()) { cleanSftpDir(dir + tmp[i], f3); //sftp.closeFile(f3); sftp.removeDirectory(dir + tmp[i]); } else { //f3.delete(); sftp.removeFile(dir + tmp[i]); } } } public void sendRawCommand(String cmd) { } public void disconnect() { try { //sftp.stop(); //session.close(); ssh.disconnect(); } catch(Exception e) { e.printStackTrace(); Log.debug("SftpSshClient.disconnect()" + e); } connected = false; } public boolean isConnected() { return connected; } public String getPWD() { //Log.debug("PWD: " + pwd); return toSFTPDir(pwd); } public boolean mkdir(String dirName) { try { if(!dirName.endsWith("/")) { dirName = dirName + "/"; } dirName = toSFTP(dirName); sftp.makeDirectory(dirName); fireDirectoryUpdate(); return true; } catch(Exception ex) { Log.debug("Failed to create directory (" + ex + ")."); return false; } } public void list() throws IOException { } public boolean chdir(String p) { return chdir(p, true); } public boolean chdir(String p, boolean refresh) { String tmp = toSFTP(p); try { if(!tmp.endsWith("/")) { tmp = tmp + "/"; } if(tmp.endsWith("../")) { return cdup(); } // Log.out("sftp path: "+tmp); SftpFile f = sftp.openDirectory(tmp); //Log.out("sftp after path..."); //if(!f.isDirectory()) return false; sftp.closeFile(f); pwd = toSFTP(f.getAbsolutePath()); //Log.debug("chdir: " + getPWD()); if(refresh) { fireDirectoryUpdate(); } //System.out.println("chdir2: " + getPWD()); //Log.debug("Changed path to: " + tmp); return true; } catch(Exception ex) { ex.printStackTrace(); //System.out.println(tmp); Log.debug("Could not change directory (" + ex + ")."); return false; } } public boolean cdup() { String tmp = pwd; if(pwd.endsWith("/")) { tmp = pwd.substring(0, pwd.lastIndexOf("/")); } return chdir(tmp.substring(0, tmp.lastIndexOf("/") + 1)); } public boolean chdirNoRefresh(String p) { return chdir(p, false); } public String getLocalPath() { return path; } public boolean setLocalPath(String p) { if(StringUtils.isRelative(p)) { p = path + p; } p = p.replace('\\', '/'); //System.out.println(", local 2:" + p); File f = new File(p); if(f.exists()) { try { path = f.getCanonicalPath(); path = path.replace('\\', '/'); if(!path.endsWith("/")) { path = path + "/"; } //System.out.println("localPath: "+path); } catch(IOException ex) { Log.debug("Error: can not get pathname (local)!"); return false; } } else { Log.debug("(local) No such path: \"" + p + "\""); return false; } return true; } public String[] sortLs() { try { String t = getPWD(); SftpFile fx = sftp.openDirectory(t); //if(fx == null) System.out.println("Sftp: fx null"); Vector v = new Vector(); while(sftp.listChildren(fx, v) > 0) { ; } String[] tmp = new String[v.size()]; SftpFile[] f = new SftpFile[v.size()]; files = new String[tmp.length]; size = new String[tmp.length]; perms = new int[tmp.length]; Enumeration e = v.elements(); int x = 0; while(e.hasMoreElements()) { f[x] = ((SftpFile) e.nextElement()); tmp[x] = f[x].getFilename(); size[x] = f[x].getAttributes().getSize().toString(); //if(f[x].canWrite()) Log.debug(tmp[x]); //if(f[x].canWrite()) perms[x] = FtpConnection.W; //else if(!f[x].canRead()) { perms[x] = FtpConnection.DENIED; } else { perms[x] = FtpConnection.R; } //Log.debugRaw("."); if(f[x].isDirectory() && !tmp[x].endsWith("/")) { tmp[x] = tmp[x] + "/"; } x++; } sftp.closeFile(fx); for(int i = 0; i < tmp.length; i++) { files[i] = tmp[i]; } //Log.debug(" done."); return files; } catch(Exception ex) { //ex.printStackTrace(); //Log.debug(" Error while listing directory: " + ex); return new String[0]; } } public String[] sortSize() { return size; } public int[] getPermissions() { return perms; } public int handleUpload(String f) { if(Settings.getEnableSftpMultiThreading()) { SftpTransfer t = new SftpTransfer(properties, getLocalPath(), getPWD(), f, user, pass, listeners, Transfer.UPLOAD, keyfile); } else { upload(f); } return 0; } public int handleDownload(String f) { if(Settings.getEnableSftpMultiThreading()) { SftpTransfer t = new SftpTransfer(properties, getLocalPath(), getPWD(), f, user, pass, listeners, Transfer.DOWNLOAD, keyfile); } else { download(f); } return 0; } public int upload(String f) { String file = toSFTP(f); if(file.endsWith("/")) { String out = StringUtils.getDir(file); uploadDir(file, getLocalPath() + out); fireActionFinished(this); } else { String outfile = StringUtils.getFile(file); //System.out.println("transfer: " + file + ", " + getLocalPath() + outfile); work(getLocalPath() + outfile, file, true); fireActionFinished(this); } return 0; } public int download(String f) { String file = toSFTP(f); if(file.endsWith("/")) { String out = StringUtils.getDir(file); downloadDir(file, getLocalPath() + out); fireActionFinished(this); } else { String outfile = StringUtils.getFile(file); //System.out.println("transfer: " + file + ", " + getLocalPath() + outfile); work(file, getLocalPath() + outfile, false); fireActionFinished(this); } return 0; } private void downloadDir(String dir, String out) { try { //System.out.println("downloadDir: " + dir + "," + out); fileCount = 0; shortProgress = true; baseFile = StringUtils.getDir(dir); SftpFile f2 = sftp.openDirectory(dir); Vector v = new Vector(); while(sftp.listChildren(f2, v) > 0) { ; } String[] tmp = new String[v.size()]; SftpFile[] f = new SftpFile[v.size()]; Enumeration e = v.elements(); int x = 0; while(e.hasMoreElements()) { f[x] = ((SftpFile) e.nextElement()); tmp[x] = f[x].getFilename(); Log.debugRaw("."); if(f[x].isDirectory() && !tmp[x].endsWith("/")) { tmp[x] = tmp[x] + "/"; } //sftp.closeFile(f[x]); x++; } //sftp.closeFile(f2); File fx = new File(out); fx.mkdir(); for(int i = 0; i < tmp.length; i++) { if(tmp[i].equals("./") || tmp[i].equals("../")) { continue; } tmp[i] = tmp[i].replace('\\', '/'); //System.out.println("1: " + dir+tmp[i] + ", " + out +tmp[i]); SftpFile f3 = sftp.openFile(dir + tmp[i], R); if(f3.isDirectory()) { if(!tmp[i].endsWith("/")) { tmp[i] = tmp[i] + "/"; } downloadDir(dir + tmp[i], out + tmp[i]); } else { fileCount++; fireProgressUpdate(baseFile, DataConnection.GETDIR + ":" + fileCount, -1); work(dir + tmp[i], out + tmp[i], false); } //sftp.closeFile(f3); } fireProgressUpdate(baseFile, DataConnection.DFINISHED + ":" + fileCount, -1); } catch(Exception ex) { ex.printStackTrace(); System.out.println(dir + ", " + out); Log.debug("Transfer error: " + ex); fireProgressUpdate(baseFile, DataConnection.FAILED + ":" + fileCount, -1); } shortProgress = false; } private void uploadDir(String dir, String out) { try { //System.out.println("uploadDir: " + dir + "," + out); isDirUpload = true; fileCount = 0; shortProgress = true; baseFile = StringUtils.getDir(dir); File f2 = new File(out); String[] tmp = f2.list(); if(tmp == null) { return; } sftp.makeDirectory(dir); sftp.changePermissions(dir, "rwxr--r--"); for(int i = 0; i < tmp.length; i++) { if(tmp[i].equals("./") || tmp[i].equals("../")) { continue; } tmp[i] = tmp[i].replace('\\', '/'); //System.out.println("1: " + dir+tmp[i] + ", " + out +tmp[i]); File f3 = new File(out + tmp[i]); if(f3.isDirectory()) { if(!tmp[i].endsWith("/")) { tmp[i] = tmp[i] + "/"; } uploadDir(dir + tmp[i], out + tmp[i]); } else { fileCount++; fireProgressUpdate(baseFile, DataConnection.PUTDIR + ":" + fileCount, -1); work(out + tmp[i], dir + tmp[i], true); } } fireProgressUpdate(baseFile, DataConnection.DFINISHED + ":" + fileCount, -1); } catch(Exception ex) { ex.printStackTrace(); System.out.println(dir + ", " + out); Log.debug("Transfer error: " + ex); fireProgressUpdate(baseFile, DataConnection.FAILED + ":" + fileCount, -1); } isDirUpload = false; shortProgress = true; } private String toSFTP(String f) { String file; if(f.startsWith("/")) { file = f; } else { file = getPWD() + f; } file = file.replace('\\', '/'); //System.out.println("file: "+file); return file; } private String toSFTPDir(String f) { String file; if(f.startsWith("/")) { file = f; } else { file = pwd + f; } file = file.replace('\\', '/'); if(!file.endsWith("/")) { file = file + "/"; } //System.out.println("file: "+file); return file; } private void work(String file, String outfile, boolean up) { BufferedInputStream in = null; BufferedOutputStream out = null; try { SftpFile inf = null; SftpFile of = null; boolean outflag = false; if(up) { in = new BufferedInputStream(new FileInputStream(file)); } else { inf = sftp.openFile(file, R); in = new BufferedInputStream(new SftpFileInputStream(inf)); } if(up) { outflag = true; //FileAttributes fa = new FileAttributes(); //fa.setPermissions("rwxr--r--"); //fa.setSize(new UnsignedInteger64( // new java.math.BigInteger(""+new File(file).length()))); //of = sftp.openFile(outfile, W); //of.delete(); try { sftp.removeFile(outfile); } catch(Exception ex) { } of = sftp.openFile(outfile, RW); // , fa); sftp.changePermissions(of, "rwxr--r--"); out = new BufferedOutputStream(new SftpFileOutputStream(of)); } else { out = new BufferedOutputStream(new FileOutputStream(outfile)); } //System.out.println("out: " + outfile + ", in: " + file); byte[] buf = new byte[smbBuffer]; int len = 0; int reallen = 0; //System.out.println(file+":"+getLocalPath()+outfile); while(true) { len = in.read(buf); //System.out.print("."); if(len == StreamTokenizer.TT_EOF) { break; } out.write(buf, 0, len); reallen += len; //System.out.println(file + ":" + StringUtils.getFile(file)); if(outflag) { fireProgressUpdate(StringUtils.getFile(outfile), DataConnection.PUT, reallen); } else { fireProgressUpdate(StringUtils.getFile(file), DataConnection.GET, reallen); } } fireProgressUpdate(file, DataConnection.FINISHED, -1); } catch(IOException ex) { ex.printStackTrace(); Log.debug("Error with file IO (" + ex + ")!"); fireProgressUpdate(file, DataConnection.FAILED, -1); } finally { try { out.flush(); out.close(); in.close(); } catch(Exception ex) { ex.printStackTrace(); } } } public boolean rename(String oldName, String newName) { try { oldName = toSFTP(oldName); newName = toSFTP(newName); SftpFile f = sftp.openFile(oldName, RW); f.rename(newName); return true; } catch(Exception ex) { ex.printStackTrace(); Log.debug("Could rename file (" + ex + ")."); return false; } } private void update(String file, String type, int bytes) { if(listeners == null) { return; } else { for(int i = 0; i < listeners.size(); i++) { ConnectionListener listener = (ConnectionListener) listeners.elementAt(i); listener.updateProgress(file, type, bytes); } } } public void addConnectionListener(ConnectionListener l) { listeners.add(l); } public void setConnectionListeners(Vector l) { listeners = l; } /** remote directory has changed */ public void fireDirectoryUpdate() { if(listeners == null) { return; } else { for(int i = 0; i < listeners.size(); i++) { ((ConnectionListener) listeners.elementAt(i)).updateRemoteDirectory(this); } } } public boolean login(String user, String pass) { this.user = user; this.pass = pass; if(!login()) { Log.debug("Login failed."); return false; } else { Log.debug("Authed successfully."); //if(!chdir(getPWD())) chdir("/"); } return true; } /** progress update */ public void fireProgressUpdate(String file, String type, int bytes) { if(listeners == null) { return; } for(int i = 0; i < listeners.size(); i++) { ConnectionListener listener = (ConnectionListener) listeners.elementAt(i); if(shortProgress && Settings.shortProgress) { if(type.startsWith(DataConnection.DFINISHED)) { listener.updateProgress(baseFile, DataConnection.DFINISHED + ":" + fileCount, bytes); } else if(isDirUpload) { listener.updateProgress(baseFile, DataConnection.PUTDIR + ":" + fileCount, bytes); } else { listener.updateProgress(baseFile, DataConnection.GETDIR + ":" + fileCount, bytes); } } else { listener.updateProgress(file, type, bytes); } } } public void fireActionFinished(SftpConnection con) { if(listeners == null) { return; } else { for(int i = 0; i < listeners.size(); i++) { ((ConnectionListener) listeners.elementAt(i)).actionFinished(con); } } } public int upload(String file, InputStream i) { BufferedOutputStream out = null; BufferedInputStream in = null; try { file = toSFTP(file); SftpFile of = sftp.openFile(file, RW); //of.delete(); //of = sftp.openFile(file, RW); sftp.changePermissions(of, "rwxr--r--"); out = new BufferedOutputStream(new SftpFileOutputStream(of)); in = new BufferedInputStream(i); //Log.debug(getLocalPath() + ":" + file+ ":"+getPWD()); byte[] buf = new byte[smbBuffer]; int len = 0; int reallen = 0; while(true) { len = in.read(buf); //System.out.print("."); if(len == StreamTokenizer.TT_EOF) { break; } out.write(buf, 0, len); reallen += len; fireProgressUpdate(StringUtils.getFile(file), DataConnection.PUT, reallen); } //byte[] fin = new byte[1]; //fin[0] = -1; //out.write(fin, 0, 1); /* try { out.flush(); out.close(); } catch(Exception ex) { Log.out("flush: "+ex); } */ fireProgressUpdate(file, DataConnection.FINISHED, -1); return 0; } catch(IOException ex) { ex.printStackTrace(); Log.debug("Error with file IO (" + ex + ")!"); fireProgressUpdate(file, DataConnection.FAILED, -1); return -1; } finally { try { out.flush(); out.close(); in.close(); } catch(Exception ex) { ex.printStackTrace(); } } } public InputStream getDownloadInputStream(String file) { try { file = toSFTP(file); SftpFile inf = sftp.openFile(file, R); return new SftpFileInputStream(inf); } catch(IOException ex) { ex.printStackTrace(); Log.debug(ex.toString() + " @SftpConnection::getDownloadInputStream"); return null; } } public Date[] sortDates() { return null; } } jftp-1.52.orig/src/java/net/sf/jftp/net/wrappers/SmbConnection.java0000700000175000017500000005773711112477774024350 0ustar varunvarun/* * 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. */ package net.sf.jftp.net.wrappers; import java.io.BufferedInputStream; import java.io.BufferedOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.StreamTokenizer; import java.util.Date; import java.util.Vector; import jcifs.smb.NtlmAuthenticator; import jcifs.smb.NtlmPasswordAuthentication; import jcifs.smb.SmbAuthException; import jcifs.smb.SmbFile; import jcifs.smb.SmbFileOutputStream; import net.sf.jftp.config.Settings; import net.sf.jftp.net.BasicConnection; import net.sf.jftp.net.ConnectionListener; import net.sf.jftp.net.DataConnection; import net.sf.jftp.net.FtpConnection; import net.sf.jftp.net.Transfer; import net.sf.jftp.system.StringUtils; import net.sf.jftp.system.logging.Log; public class SmbConnection extends NtlmAuthenticator implements BasicConnection { public static int smbBuffer = 128000; private String path = ""; private String pwd = "smb://"; private Vector listeners = new Vector(); private String[] files; private String[] size = new String[0]; private int[] perms = null; private String user; private String pass; private String host; private String domain = null; private String baseFile; private int fileCount; private boolean isDirUpload = false; private boolean shortProgress = false; private boolean dummy = false; public SmbConnection() { } public SmbConnection(String url, String domain, String user, String pass, ConnectionListener l) { if(l != null) { listeners.add(l); } this.user = user; this.pass = pass; //TODO set hostname from smb url //this.host = host; //*** if(domain.equals("NONE")) { domain = null; } this.domain = domain; //if(url == null) chdir(getPWD()); if(url.equals("(LAN)")) { chdir(getPWD()); } else { chdir(url); } //*** } protected NtlmPasswordAuthentication getNtlmPasswordAuthentication() { //Log.debug("Auth: " + domain+ ";" + user + ":" + pass); try { return new NtlmPasswordAuthentication(domain, user, pass); } catch(Exception ex) { Log.debug("Error logging in: " + ex); ex.printStackTrace(); return null; } } private NtlmPasswordAuthentication getAuth() { return getNtlmPasswordAuthentication(); } public int removeFileOrDir(String file) { file = toSMB(file); //System.out.println(file); try { SmbFile f = new SmbFile(file, getAuth()); if(f.exists() && f.isDirectory()) { cleanSmbDir(file); } f.delete(); } catch(Exception ex) { Log.debug("Removal failed (" + ex + ")."); return -1; } return 1; } private void cleanSmbDir(String dir) throws Exception { dir = toSMB(dir); SmbFile f2 = new SmbFile(dir, getAuth()); String[] tmp = f2.list(); if(tmp == null) { return; } for(int i = 0; i < tmp.length; i++) { SmbFile f3 = new SmbFile(dir + tmp[i], getAuth()); if(f3.isDirectory()) { //System.out.println(dir); cleanSmbDir(dir + tmp[i]); f3.delete(); } else { //System.out.println(dir+tmp[i]); f3.delete(); } } } public void sendRawCommand(String cmd) { } public void disconnect() { } public boolean isConnected() { return true; } public String getPWD() { //Log.debug("PWD: " + pwd); return toSMB(pwd); } public boolean cdup() { String tmp = pwd; if(pwd.endsWith("/") && !pwd.equals("smb://")) { tmp = pwd.substring(0, pwd.lastIndexOf("/")); } return chdir(tmp.substring(0, tmp.lastIndexOf("/") + 1)); } public boolean mkdir(String dirName) { try { if(!dirName.endsWith("/")) { dirName = dirName + "/"; } dirName = toSMB(dirName); SmbFile f = new SmbFile(dirName, getAuth()); f.mkdir(); fireDirectoryUpdate(); return true; } catch(Exception ex) { Log.debug("Failed to create directory (" + ex + ")."); return false; } } public void list() throws IOException { } public boolean chdir(String p) { return chdir(p, true); } public boolean chdir(String p, boolean refresh) { try { if(p.endsWith("..")) { return cdup(); } String tmp = toSMB(p); if(!tmp.endsWith("/")) { tmp = tmp + "/"; } //Log.debug("tmp: " + tmp); SmbFile f = new SmbFile(tmp, getAuth()); f.list(); pwd = tmp; //Log.debug("pwd: " + pwd); //System.out.println("chdir: " + getPWD()); if(refresh) { fireDirectoryUpdate(); } //System.out.println("chdir2: " + getPWD()); dummy = false; return true; } catch(Exception ex) { if((ex.getMessage().indexOf("MSBROWSE") > 0) && !dummy) { Log.debug("\nCould not find a master server."); Log.debug("Please make sure you have the local IP set to the interface you want to use, and if"); Log.debug("that does not work try \"\"..."); Log.debug("If you still can not find a master make sure that there is one your LAN and submit a bug report."); dummy = true; } else { Log.debug("Could not change directory (" + ex + ")."); } return false; } } public boolean chdirNoRefresh(String p) { return chdir(p, false); } public String getLocalPath() { return path; } public boolean setLocalPath(String p) { if(StringUtils.isRelative(p)) { p = path + p; } p = p.replace('\\', '/'); //System.out.println(", local 2:" + p); File f = new File(p); if(f.exists()) { try { path = f.getCanonicalPath(); path = path.replace('\\', '/'); if(!path.endsWith("/")) { path = path + "/"; } //System.out.println("localPath: "+path); } catch(IOException ex) { Log.debug("Error: can not get pathname (local)!"); return false; } } else { Log.debug("(local) No such path: \"" + p + "\""); return false; } return true; } public String[] sortLs() { try { //Log.debug("sortLs: trying"); chdirNoRefresh(getPWD()); SmbFile fx = new SmbFile(pwd, getAuth()); //System.out.println(pwd); //if(fx == null) System.out.println("Smb: fx null"); SmbFile[] f = fx.listFiles(); //Log.debug("sortLs: file is there and listed"); //if(f == null) System.out.println("Smb: f null"); files = new String[f.length]; size = new String[f.length]; perms = new int[f.length]; int i; for(i = 0; i < f.length; i++) { files[i] = f[i].toURL().toString(); int x = 0; for(int j = 0; j < files[i].length(); j++) { if(files[i].charAt(j) == '/') { x++; } } if(files[i].endsWith("/") && (x > 3)) { files[i] = StringUtils.getDir(files[i]); } else if(x > 3) { files[i] = StringUtils.getFile(files[i]); } size[i] = "" + f[i].length(); if(f[i].canRead()) { perms[i] = FtpConnection.R; } else if(f[i].canWrite()) { perms[i] = FtpConnection.R; } else { perms[i] = FtpConnection.DENIED; } } //Log.debug("sortLs: finished, ok"); return files; } catch(Exception ex) { if(ex instanceof SmbAuthException) { Log.debug("Access denied: " + ex); //Log.debug("URL: " + getPWD()); //Log.debug("Auth (bin): " + getAuth().toString()); //Log.debug("Auth: " + domain+ ";" + user + ":" + pass); } else { Log.debug("Error: " + ex); } return new String[0]; } } public String[] sortSize() { return size; } public int[] getPermissions() { return perms; } public int handleUpload(String f) { if(Settings.getEnableSmbMultiThreading()) { SmbTransfer t = new SmbTransfer(getPWD(), getLocalPath(), f, user, pass, domain, listeners, Transfer.UPLOAD); } else { upload(f); } return 0; } public int handleDownload(String f) { if(Settings.getEnableSmbMultiThreading()) { SmbTransfer t = new SmbTransfer(getPWD(), getLocalPath(), f, user, pass, domain, listeners, Transfer.DOWNLOAD); } else { download(f); } return 0; } public int upload(String f) { String file = toSMB(f); if(file.endsWith("/")) { String out = StringUtils.getDir(file); uploadDir(file, getLocalPath() + out); fireActionFinished(this); } else { String outfile = StringUtils.getFile(file); //System.out.println("transfer: " + file + ", " + getLocalPath() + outfile); work(getLocalPath() + outfile, file); fireActionFinished(this); } return 0; } public int download(String f) { String file = toSMB(f); if(file.endsWith("/")) { String out = StringUtils.getDir(file); downloadDir(file, getLocalPath() + out); fireActionFinished(this); } else { String outfile = StringUtils.getFile(file); //System.out.println("transfer: " + file + ", " + getLocalPath() + outfile); work(file, getLocalPath() + outfile); fireActionFinished(this); } return 0; } private void downloadDir(String dir, String out) { try { //System.out.println("downloadDir: " + dir + "," + out); fileCount = 0; shortProgress = true; baseFile = StringUtils.getDir(dir); SmbFile f2 = new SmbFile(dir, getAuth()); String[] tmp = f2.list(); if(tmp == null) { return; } File fx = new File(out); fx.mkdir(); for(int i = 0; i < tmp.length; i++) { tmp[i] = tmp[i].replace('\\', '/'); //System.out.println("1: " + dir+tmp[i] + ", " + out +tmp[i]); SmbFile f3 = new SmbFile(dir + tmp[i], getAuth()); if(f3.isDirectory()) { if(!tmp[i].endsWith("/")) { tmp[i] = tmp[i] + "/"; } downloadDir(dir + tmp[i], out + tmp[i]); } else { fileCount++; fireProgressUpdate(baseFile, DataConnection.GETDIR + ":" + fileCount, -1); work(dir + tmp[i], out + tmp[i]); } } fireProgressUpdate(baseFile, DataConnection.DFINISHED + ":" + fileCount, -1); } catch(Exception ex) { ex.printStackTrace(); //System.out.println(dir + ", " + out); Log.debug("Transfer error: " + ex); fireProgressUpdate(baseFile, DataConnection.FAILED + ":" + fileCount, -1); } shortProgress = false; } private void uploadDir(String dir, String out) { try { //System.out.println("uploadDir: " + dir + "," + out); isDirUpload = true; fileCount = 0; shortProgress = true; baseFile = StringUtils.getDir(dir); File f2 = new File(out); String[] tmp = f2.list(); if(tmp == null) { return; } SmbFile fx = new SmbFile(dir, getAuth()); fx.mkdir(); for(int i = 0; i < tmp.length; i++) { tmp[i] = tmp[i].replace('\\', '/'); //System.out.println("1: " + dir+tmp[i] + ", " + out +tmp[i]); File f3 = new File(out + tmp[i]); if(f3.isDirectory()) { if(!tmp[i].endsWith("/")) { tmp[i] = tmp[i] + "/"; } uploadDir(dir + tmp[i], out + tmp[i]); } else { fileCount++; fireProgressUpdate(baseFile, DataConnection.PUTDIR + ":" + fileCount, -1); work(out + tmp[i], dir + tmp[i]); } } fireProgressUpdate(baseFile, DataConnection.DFINISHED + ":" + fileCount, -1); } catch(Exception ex) { ex.printStackTrace(); //System.out.println(dir + ", " + out); Log.debug("Transfer error: " + ex); fireProgressUpdate(baseFile, DataConnection.FAILED + ":" + fileCount, -1); } isDirUpload = false; shortProgress = true; } private String toSMB(String f) { String file; if(f.lastIndexOf("smb://") > 0) { f = f.substring(f.lastIndexOf("smb://")); } if(f.startsWith("smb://")) { file = f; } else { file = getPWD() + f; } file = file.replace('\\', '/'); //System.out.println("file: "+file); return file; } private void work(String file, String outfile) { BufferedOutputStream out = null; BufferedInputStream in = null; try { boolean outflag = false; if(outfile.startsWith("smb://")) { outflag = true; out = new BufferedOutputStream(new SmbFileOutputStream(new SmbFile(outfile, getAuth()))); } else { out = new BufferedOutputStream(new FileOutputStream(outfile)); } //System.out.println("out: " + outfile + ", in: " + file); if(file.startsWith("smb://")) { in = new BufferedInputStream(new SmbFile(file, getAuth()).getInputStream()); } else { in = new BufferedInputStream(new FileInputStream(file)); } byte[] buf = new byte[smbBuffer]; int len = 0; int reallen = 0; //System.out.println(file+":"+getLocalPath()+outfile); while(true) { len = in.read(buf); //System.out.print("."); if(len == StreamTokenizer.TT_EOF) { break; } out.write(buf, 0, len); reallen += len; //System.out.println(file + ":" + StringUtils.getFile(file)); if(outflag) { fireProgressUpdate(StringUtils.getFile(outfile), DataConnection.PUT, reallen); } else { fireProgressUpdate(StringUtils.getFile(file), DataConnection.GET, reallen); } } fireProgressUpdate(file, DataConnection.FINISHED, -1); } catch(IOException ex) { Log.debug("Error with file IO (" + ex + ")!"); fireProgressUpdate(file, DataConnection.FAILED, -1); } finally { try { out.flush(); out.close(); in.close(); } catch(Exception ex) { ex.printStackTrace(); } } } private void update(String file, String type, int bytes) { if(listeners == null) { return; } else { for(int i = 0; i < listeners.size(); i++) { ConnectionListener listener = (ConnectionListener) listeners.elementAt(i); listener.updateProgress(file, type, bytes); } } } public void addConnectionListener(ConnectionListener l) { listeners.add(l); } public void setConnectionListeners(Vector l) { listeners = l; } /** remote directory has changed */ public void fireDirectoryUpdate() { if(listeners == null) { return; } else { for(int i = 0; i < listeners.size(); i++) { ((ConnectionListener) listeners.elementAt(i)).updateRemoteDirectory(this); } } } public boolean login(String user, String pass) { return true; } /** progress update */ public void fireProgressUpdate(String file, String type, int bytes) { //System.out.println(listener); if(listeners == null) { return; } else { for(int i = 0; i < listeners.size(); i++) { ConnectionListener listener = (ConnectionListener) listeners.elementAt(i); if(shortProgress && Settings.shortProgress) { if(type.startsWith(DataConnection.DFINISHED)) { listener.updateProgress(baseFile, DataConnection.DFINISHED + ":" + fileCount, bytes); } else if(isDirUpload) { listener.updateProgress(baseFile, DataConnection.PUTDIR + ":" + fileCount, bytes); } else { listener.updateProgress(baseFile, DataConnection.GETDIR + ":" + fileCount, bytes); } } else { listener.updateProgress(file, type, bytes); } } } } public void fireActionFinished(SmbConnection con) { if(listeners == null) { return; } else { for(int i = 0; i < listeners.size(); i++) { ((ConnectionListener) listeners.elementAt(i)).actionFinished(con); } } } public int upload(String file, InputStream i) { BufferedOutputStream out = null; BufferedInputStream in = null; try { file = toSMB(file); out = new BufferedOutputStream(new SmbFileOutputStream(new SmbFile(file, getAuth()))); in = new BufferedInputStream(i); byte[] buf = new byte[smbBuffer]; int len = 0; int reallen = 0; while(true) { len = in.read(buf); if(len == StreamTokenizer.TT_EOF) { break; } out.write(buf, 0, len); reallen += len; fireProgressUpdate(StringUtils.getFile(file), DataConnection.PUT, reallen); } fireProgressUpdate(file, DataConnection.FINISHED, -1); return 0; } catch(IOException ex) { ex.printStackTrace(); Log.debug("Error with file IO (" + ex + ")!"); fireProgressUpdate(file, DataConnection.FAILED, -1); } finally { try { out.flush(); out.close(); in.close(); } catch(Exception ex) { ex.printStackTrace(); } } return -1; } public InputStream getDownloadInputStream(String file) { file = toSMB(file); try { return new BufferedInputStream(new SmbFile(file, getAuth()).getInputStream()); } catch(Exception ex) { ex.printStackTrace(); Log.debug(ex.toString() + " @SmbConnection::getDownloadInputStream"); return null; } } public Date[] sortDates() { return null; } public boolean rename(String file, String to) { try { file = toSMB(file); to = toSMB(to); SmbFile src = new SmbFile(file, getAuth()); src.renameTo(new SmbFile(to, getAuth())); return true; } catch(Exception ex) { ex.printStackTrace(); Log.debug(ex.toString() + " @SmbConnection::rename"); return false; } } } jftp-1.52.orig/src/java/net/sf/jftp/net/wrappers/NfsConnection.java0000700000175000017500000005403211112477774024336 0ustar varunvarun/* * 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. */ package net.sf.jftp.net.wrappers; import java.io.BufferedInputStream; import java.io.BufferedOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.StreamTokenizer; import java.util.Date; import java.util.Vector; import net.sf.jftp.config.Settings; import net.sf.jftp.net.BasicConnection; import net.sf.jftp.net.ConnectionListener; import net.sf.jftp.net.DataConnection; import net.sf.jftp.net.FtpConnection; import net.sf.jftp.system.StringUtils; import net.sf.jftp.system.logging.Log; import com.sun.xfile.XFile; import com.sun.xfile.XFileInputStream; import com.sun.xfile.XFileOutputStream; public class NfsConnection implements BasicConnection { public static int buffer = 128000; private String url = ""; private String host = ""; private String path = ""; private String pwd = ""; private Vector listeners = new Vector(); private String[] files; private String[] size = new String[0]; private int[] perms = null; //private NfsHandler handler = new NfsHandler(); private String baseFile; private int fileCount; private boolean isDirUpload = false; private boolean shortProgress = false; private boolean dummy = false; public NfsConnection(String url) { this.url = url; host = url.substring(6); int x = host.indexOf("/"); if(x >= 0) { host = host.substring(0, x); } Log.out("nfs host is: " + host); } public boolean login(String user, String pass) { Log.out("nfs login called: " + url); try { XFile xf = new XFile(url); if(xf.exists()) { Log.out("nfs url ok"); } else { Log.out("WARNING: nfs url not found, cennection will fail!"); } com.sun.nfs.XFileExtensionAccessor nfsx = (com.sun.nfs.XFileExtensionAccessor) xf.getExtensionAccessor(); //Log.out("nfs extension accessor: " + nfsx); if(!nfsx.loginPCNFSD(host, user, pass)) { Log.out("login failed!"); return false; } else { Log.debug("Login successful..."); } } catch(Exception e) { e.printStackTrace(); } return true; } public String[] getExports() throws Exception { XFile xf = new XFile(url); com.sun.nfs.XFileExtensionAccessor nfsx = (com.sun.nfs.XFileExtensionAccessor) xf.getExtensionAccessor(); String[] tmp = nfsx.getExports(); if(tmp == null) { return new String[0]; } for(int i = 0; i < tmp.length; i++) { Log.out("nfs export found: " + tmp[i]); } return tmp; } public int removeFileOrDir(String file) { try { String tmp = toNFS(file); XFile f = new XFile(tmp); if(!f.getAbsolutePath().equals(f.getCanonicalPath())) { Log.debug("WARNING: Skipping symlink, remove failed."); Log.debug("This is necessary to prevent possible data loss when removing those symlinks."); return -1; } if(f.exists() && f.isDirectory()) { cleanLocalDir(tmp); } //System.out.println(tmp); if(!f.delete()) { return -1; } else { return 1; } } catch(IOException ex) { Log.debug("Error: " + ex.toString()); ex.printStackTrace(); } return -1; } private void cleanLocalDir(String dir) { dir = toNFS(dir); if(dir.endsWith("\\")) { Log.out("need to fix \\-problem!!!"); } if(!dir.endsWith("/")) { dir = dir + "/"; } //String remoteDir = StringUtils.removeStart(dir,path); //System.out.println(">>> " + dir); XFile f2 = new XFile(dir); String[] tmp = f2.list(); if(tmp == null) { return; } for(int i = 0; i < tmp.length; i++) { XFile f3 = new XFile(dir + tmp[i]); if(f3.isDirectory()) { //System.out.println(dir); cleanLocalDir(dir + tmp[i]); f3.delete(); } else { //System.out.println(dir+tmp[i]); f3.delete(); } } } public void sendRawCommand(String cmd) { } public void disconnect() { } public boolean isConnected() { return true; } public String getPWD() { String tmp = toNFS(pwd); if(!tmp.endsWith("/")) { tmp = tmp + "/"; } return tmp; } public boolean cdup() { String tmp = pwd; if(pwd.endsWith("/") && !pwd.equals("nfs://")) { tmp = pwd.substring(0, pwd.lastIndexOf("/")); } return chdir(tmp.substring(0, tmp.lastIndexOf("/") + 1)); } public boolean mkdir(String dirName) { if(!dirName.endsWith("/")) { dirName = dirName + "/"; } dirName = toNFS(dirName); File f = new File(dirName); boolean x = f.mkdir(); fireDirectoryUpdate(); return x; } public void list() throws IOException { } public boolean chdir(String p) { return chdir(p, true); } public boolean chdir(String p, boolean refresh) { if(p.endsWith("..")) { return cdup(); } String tmp = toNFS(p); if(!tmp.endsWith("/")) { tmp = tmp + "/"; } if(check(tmp) < 3) { return false; } pwd = tmp; if(refresh) { fireDirectoryUpdate(); } return true; } private int check(String url) { int x = 0; for(int j = 0; j < url.length(); j++) { if(url.charAt(j) == '/') { x++; } } return x; } public boolean chdirNoRefresh(String p) { /* String p2 = toNFS(p); if(p2 == null) return false; pwd = p2; return true; */ return chdir(p, false); } public String getLocalPath() { //System.out.println("local: " + path); return path; } private String toNFS(String f) { String file; if(f.lastIndexOf("nfs://") > 0) { f = f.substring(f.lastIndexOf("nfs://")); } if(f.startsWith("nfs://")) { file = f; } else { file = getPWD() + f; } file = file.replace('\\', '/'); Log.out("nfs url: " + file); return file; } public boolean setLocalPath(String p) { if(!p.startsWith("/") && !p.startsWith(":", 1)) { p = path + p; } File f = new File(p); if(f.exists()) { try { path = f.getCanonicalPath(); path = path.replace('\\', '/'); if(!path.endsWith("/")) { path = path + "/"; } //System.out.println("2:"+path+":"+getPWD()); } catch(IOException ex) { Log.debug("Error: can not get pathname (local)!"); return false; } } else { Log.debug("(local) No such path: \"" + p + "\""); return false; } return true; } public String[] sortLs() { String dir = getPWD(); if(check(toNFS(dir)) == 3) { try { files = getExports(); } catch(Exception ex) { Log.debug("Can not list exports:" + ex.toString()); ex.printStackTrace(); } } else { XFile f = new XFile(dir); files = f.list(); } if(files == null) { return new String[0]; } size = new String[files.length]; perms = new int[files.length]; int accessible = 0; for(int i = 0; i < files.length; i++) { XFile f2 = new XFile(dir + files[i]); if(f2.isDirectory() && !files[i].endsWith("/")) { files[i] = files[i] + "/"; } size[i] = "" + f2.length(); if(f2.canWrite()) { accessible = FtpConnection.W; } else if(f2.canRead()) { accessible = FtpConnection.R; } else { accessible = FtpConnection.DENIED; } perms[i] = accessible; //System.out.println(pwd+files[i] +" : " +accessible + " : " + size[i]); } return files; } public String[] sortSize() { return size; } public int[] getPermissions() { return perms; } public int handleUpload(String f) { upload(f); return 0; } public int handleDownload(String f) { download(f); return 0; } public int upload(String f) { String file = toNFS(f); if(file.endsWith("/")) { String out = StringUtils.getDir(file); uploadDir(file, getLocalPath() + out); fireActionFinished(this); } else { String outfile = StringUtils.getFile(file); //System.out.println("transfer: " + file + ", " + getLocalPath() + outfile); work(getLocalPath() + outfile, file); fireActionFinished(this); } return 0; } public int download(String f) { String file = toNFS(f); if(file.endsWith("/")) { String out = StringUtils.getDir(file); downloadDir(file, getLocalPath() + out); fireActionFinished(this); } else { String outfile = StringUtils.getFile(file); //System.out.println("transfer: " + file + ", " + getLocalPath() + outfile); work(file, getLocalPath() + outfile); fireActionFinished(this); } return 0; } private void downloadDir(String dir, String out) { try { //System.out.println("downloadDir: " + dir + "," + out); fileCount = 0; shortProgress = true; baseFile = StringUtils.getDir(dir); XFile f2 = new XFile(dir); String[] tmp = f2.list(); if(tmp == null) { return; } File fx = new File(out); fx.mkdir(); for(int i = 0; i < tmp.length; i++) { tmp[i] = tmp[i].replace('\\', '/'); //System.out.println("1: " + dir+tmp[i] + ", " + out +tmp[i]); XFile f3 = new XFile(dir + tmp[i]); if(f3.isDirectory()) { if(!tmp[i].endsWith("/")) { tmp[i] = tmp[i] + "/"; } downloadDir(dir + tmp[i], out + tmp[i]); } else { fileCount++; fireProgressUpdate(baseFile, DataConnection.GETDIR + ":" + fileCount, -1); work(dir + tmp[i], out + tmp[i]); } } fireProgressUpdate(baseFile, DataConnection.DFINISHED + ":" + fileCount, -1); } catch(Exception ex) { ex.printStackTrace(); //System.out.println(dir + ", " + out); Log.debug("Transfer error: " + ex); fireProgressUpdate(baseFile, DataConnection.FAILED + ":" + fileCount, -1); } shortProgress = false; } private void uploadDir(String dir, String out) { try { //System.out.println("uploadDir: " + dir + "," + out); isDirUpload = true; fileCount = 0; shortProgress = true; baseFile = StringUtils.getDir(dir); File f2 = new File(out); String[] tmp = f2.list(); if(tmp == null) { return; } XFile fx = new XFile(dir); fx.mkdir(); for(int i = 0; i < tmp.length; i++) { tmp[i] = tmp[i].replace('\\', '/'); //System.out.println("1: " + dir+tmp[i] + ", " + out +tmp[i]); File f3 = new File(out + tmp[i]); if(f3.isDirectory()) { if(!tmp[i].endsWith("/")) { tmp[i] = tmp[i] + "/"; } uploadDir(dir + tmp[i], out + tmp[i]); } else { fileCount++; fireProgressUpdate(baseFile, DataConnection.PUTDIR + ":" + fileCount, -1); work(out + tmp[i], dir + tmp[i]); } } fireProgressUpdate(baseFile, DataConnection.DFINISHED + ":" + fileCount, -1); } catch(Exception ex) { ex.printStackTrace(); //System.out.println(dir + ", " + out); Log.debug("Transfer error: " + ex); fireProgressUpdate(baseFile, DataConnection.FAILED + ":" + fileCount, -1); } isDirUpload = false; shortProgress = true; } private void work(String file, String outfile) { BufferedOutputStream out = null; BufferedInputStream in = null; try { boolean outflag = false; if(outfile.startsWith("nfs://")) { outflag = true; out = new BufferedOutputStream(new XFileOutputStream(outfile)); } else { out = new BufferedOutputStream(new FileOutputStream(outfile)); } //System.out.println("out: " + outfile + ", in: " + file); if(file.startsWith("nfs://")) { in = new BufferedInputStream(new XFileInputStream(file)); } else { in = new BufferedInputStream(new FileInputStream(file)); } byte[] buf = new byte[buffer]; int len = 0; int reallen = 0; //System.out.println(file+":"+getLocalPath()+outfile); while(true) { len = in.read(buf); //System.out.print("."); if(len == StreamTokenizer.TT_EOF) { break; } out.write(buf, 0, len); reallen += len; //System.out.println(file + ":" + StringUtils.getFile(file)); if(outflag) { fireProgressUpdate(StringUtils.getFile(outfile), DataConnection.PUT, reallen); } else { fireProgressUpdate(StringUtils.getFile(file), DataConnection.GET, reallen); } } fireProgressUpdate(file, DataConnection.FINISHED, -1); } catch(IOException ex) { Log.debug("Error with file IO (" + ex + ")!"); fireProgressUpdate(file, DataConnection.FAILED, -1); } finally { try { out.flush(); out.close(); in.close(); } catch(Exception ex) { ex.printStackTrace(); } } } private void update(String file, String type, int bytes) { if(listeners == null) { return; } else { for(int i = 0; i < listeners.size(); i++) { ConnectionListener listener = (ConnectionListener) listeners.elementAt(i); listener.updateProgress(file, type, bytes); } } } public void addConnectionListener(ConnectionListener l) { listeners.add(l); } public void setConnectionListeners(Vector l) { listeners = l; } /** remote directory has changed */ public void fireDirectoryUpdate() { if(listeners == null) { return; } else { for(int i = 0; i < listeners.size(); i++) { ((ConnectionListener) listeners.elementAt(i)).updateRemoteDirectory(this); } } } /** progress update */ public void fireProgressUpdate(String file, String type, int bytes) { //System.out.println(listener); if(listeners == null) { return; } else { for(int i = 0; i < listeners.size(); i++) { ConnectionListener listener = (ConnectionListener) listeners.elementAt(i); if(shortProgress && Settings.shortProgress) { if(type.startsWith(DataConnection.DFINISHED)) { listener.updateProgress(baseFile, DataConnection.DFINISHED + ":" + fileCount, bytes); } else if(isDirUpload) { listener.updateProgress(baseFile, DataConnection.PUTDIR + ":" + fileCount, bytes); } else { listener.updateProgress(baseFile, DataConnection.GETDIR + ":" + fileCount, bytes); } } else { listener.updateProgress(file, type, bytes); } } } } public void fireActionFinished(NfsConnection con) { if(listeners == null) { return; } else { for(int i = 0; i < listeners.size(); i++) { ((ConnectionListener) listeners.elementAt(i)).actionFinished(con); } } } public int upload(String file, InputStream i) { BufferedInputStream in = null; BufferedOutputStream out = null; try { file = toNFS(file); out = new BufferedOutputStream(new XFileOutputStream(file)); in = new BufferedInputStream(i); byte[] buf = new byte[buffer]; int len = 0; int reallen = 0; while(true) { len = in.read(buf); if(len == StreamTokenizer.TT_EOF) { break; } out.write(buf, 0, len); reallen += len; fireProgressUpdate(StringUtils.getFile(file), DataConnection.PUT, reallen); } fireProgressUpdate(file, DataConnection.FINISHED, -1); } catch(IOException ex) { Log.debug("Error with file IO (" + ex + ")!"); fireProgressUpdate(file, DataConnection.FAILED, -1); return -1; } finally { try { out.flush(); out.close(); in.close(); } catch(Exception ex) { ex.printStackTrace(); } } return 0; } public InputStream getDownloadInputStream(String file) { file = toNFS(file); Log.debug(file); try { return new BufferedInputStream(new XFileInputStream(file)); } catch(Exception ex) { ex.printStackTrace(); Log.debug(ex.toString() + " @NfsConnection::getDownloadInputStream"); return null; } } public Date[] sortDates() { return null; } public boolean rename(String from, String to) { Log.debug("Not implemented!"); return false; } } jftp-1.52.orig/src/java/net/sf/jftp/net/wrappers/SftpVerification.java0000700000175000017500000000312011112477774025037 0ustar varunvarunpackage net.sf.jftp.net.wrappers; import net.sf.jftp.system.logging.Log; import com.sshtools.j2ssh.transport.AbstractKnownHostsKeyVerification; import com.sshtools.j2ssh.transport.InvalidHostFileException; import com.sshtools.j2ssh.transport.TransportProtocolException; import com.sshtools.j2ssh.transport.publickey.SshPublicKey; public class SftpVerification extends AbstractKnownHostsKeyVerification { public SftpVerification(String tmp) throws InvalidHostFileException { super(tmp); } public void onDeniedHost(final String host) throws TransportProtocolException { Log.debug("Access to '" + host + "' is denied.\nVerify the access granted/denied in the allowed hosts file."); } public void onHostKeyMismatch(final String host, SshPublicKey recordedFingerprint, SshPublicKey actualFingerprint) throws TransportProtocolException { try { allowHost(host, actualFingerprint, false); } catch(Exception ex) { Log.debug("Error: " + ex); } } public void onUnknownHost(final String host, SshPublicKey fingerprint) throws TransportProtocolException { try { allowHost(host, fingerprint, false); } catch(Exception ex) { Log.debug("Error: " + ex); } } private void showExceptionMessage(Exception ex) { Log.debug("Error: " + ex); } } jftp-1.52.orig/src/java/net/sf/jftp/net/wrappers/SftpTransfer.java0000700000175000017500000000332311112477774024206 0ustar varunvarunpackage net.sf.jftp.net.wrappers; import java.util.Vector; import net.sf.jftp.net.Transfer; import com.sshtools.j2ssh.configuration.SshConnectionProperties; public class SftpTransfer implements Runnable { private String host; private String localPath; private String remotePath; private String file; private String user; private String pass; private SftpConnection con = null; private String type; public Thread runner; private Vector listeners; private SshConnectionProperties props; private String keyfile; public SftpTransfer(SshConnectionProperties props, String localPath, String remotePath, String file, String user, String pass, Vector listeners, String type, String keyfile) { this.props = props; this.localPath = localPath; this.remotePath = remotePath; this.file = file; this.user = user; this.pass = pass; this.type = type; this.listeners = listeners; this.keyfile = keyfile; prepare(); } public void prepare() { runner = new Thread(this); runner.setPriority(Thread.MIN_PRIORITY); runner.start(); } public void run() { con = new SftpConnection(props, keyfile); con.setConnectionListeners(listeners); con.login(user, pass); con.setLocalPath(localPath); con.chdir(remotePath); if(type.equals(Transfer.DOWNLOAD)) { con.download(file); } else if(type.equals(Transfer.UPLOAD)) { con.upload(file); } } public SftpConnection getSftpConnection() { return con; } } jftp-1.52.orig/src/java/net/sf/jftp/net/wrappers/StartConnection.java0000700000175000017500000003335711112477774024714 0ustar varunvarun/* * 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. */ //TODO: Add SFTP port number here (convert potmp to a string and pass it package net.sf.jftp.net.wrappers; import net.sf.jftp.JFtp; import net.sf.jftp.config.Settings; import net.sf.jftp.gui.tasks.LastConnections; import net.sf.jftp.net.ConnectionListener; import net.sf.jftp.net.FtpConnection; import net.sf.jftp.system.logging.Log; // This class is used to initiate connections of all types (FTP, SFTP, SMB, NFS // are currently supported.) Any time the user tries to open a connection using // any protocol, this class is the intermediary between the GUI and the actual // connection establishing classes. This puts much common functionality into // one method (so in creating this I did some code cleanup.) public class StartConnection { public static FtpConnection con = null; public static com.sshtools.j2ssh.configuration.SshConnectionProperties properties = new com.sshtools.j2ssh.configuration.SshConnectionProperties(); public static String keyfile = null; public static void setSshProperties(com.sshtools.j2ssh.configuration.SshConnectionProperties props) { properties = props; } public static void setSshKeyfile(String file) { keyfile = file; } //data sent to startCon: protocol: (ie. FTP, SFTP, etc.) // htmp: hostname // utmp: username // ptmp: password // potmp: port // dtmp: domain // (null data is sent if it is ever not applicable) //maybe it should just take an array of strings instead? (What's //stored in the array can then be determined by reading the 1st //entry, which is the protocol name) public static boolean startCon(String protocol, String htmp, String utmp, String ptmp, int potmp, String dtmp, boolean useLocal) { // I may need a series of If statements following this one // declaring con for each of the possible types of connections //FtpConnection con = null; // ie.: if (protocol=="SFTP) SftpConnection con = null; //NfsConnection con = null; String conType; // this is for error msgs: may not be needed String[] searchValue = new String[JFtp.CONNECTION_DATA_LENGTH]; Integer potmpInt = new Integer(potmp); String potmpString = potmpInt.toString(); String useLocalString = new String("false"); if(useLocal) { useLocalString = "true"; } //*** FTP section: deprecated if(protocol.equals("FTP")) { /* */ } else if(protocol.equals("SFTP")) { SftpConnection con; //Log.debug(htmp+":"+properties.getHost()); //properties.setHost(htmp); con = new SftpConnection(properties, keyfile); //con.setLocalPath(JFtp.localDir.getCon().getPWD()); //con.addConnectionListener((ConnectionListener) JFtp.localDir); //con.addConnectionListener((ConnectionListener) JFtp.remoteDir); //JFtp.statusP.jftp.addConnection(htmp, con); if(con.login(utmp, ptmp)) { if(useLocal) { JFtp.statusP.jftp.addLocalConnection(htmp, con); } else { JFtp.statusP.jftp.addConnection(htmp, con); } //JFtp.remoteDir.setCon(con); if(con.chdir(con.getPWD()) || con.chdir("/")) { ; } //BUGFIX searchValue[0] = "SFTP"; searchValue[1] = htmp; searchValue[2] = utmp; if(Settings.getStorePasswords()) { searchValue[3] = ptmp; } else { searchValue[3] = ""; } //BUGFIX 1.40: now accepts string //for port number searchValue[4] = potmpString; searchValue[5] = useLocalString; searchValue[6] = LastConnections.SENTINEL; //searchValue = "SFTP " + htmp + " " + utmp + " " + // ptmp + " " + useLocalString; updateFileMenu(searchValue); return true; } //if } else if(protocol.equals("SMB")) { SmbConnection con = null; try { con = new SmbConnection(htmp, dtmp, utmp, ptmp, ((ConnectionListener) JFtp.remoteDir)); //JFtp.statusP.jftp.addConnection(htmp, con); if(useLocal) { JFtp.statusP.jftp.addLocalConnection(htmp, con); JFtp.localDir.fresh(); } else { JFtp.statusP.jftp.addConnection(htmp, con); JFtp.remoteDir.fresh(); } //JFtp.remoteDir.setCon(con); //con.setLocalPath(JFtp.localDir.getCon().getPWD()); //con.addConnectionListener((ConnectionListener) JFtp.localDir); //con.addConnectionListener((ConnectionListener) JFtp.remoteDir); //JFtp.remoteDir.fresh(); //BUGFIX searchValue[0] = "SMB"; searchValue[1] = htmp; searchValue[2] = utmp; if(Settings.getStorePasswords()) { searchValue[3] = ptmp; } else { searchValue[3] = ""; } searchValue[4] = dtmp; searchValue[5] = useLocalString; searchValue[6] = LastConnections.SENTINEL; //searchValue = "SMB " + htmp + " " + utmp + " " + // ptmp + " " + dtmp + " " + useLocalString; updateFileMenu(searchValue); return true; } catch(Exception ex) { Log.debug("Could not create SMBConnection, does this distribution come with jcifs?"); } } //can assume any other connection is NFS for now else { NfsConnection con; //*** boolean status = true; //*** con = new NfsConnection(htmp); //JFtp.remoteDir.setCon(con); //con.addConnectionListener(((ConnectionListener)JFtp.remoteDir)); //JFtp.statusP.jftp.addConnection(htmp, con); if(!utmp.equals("")) { status = ((NfsConnection) con).login(utmp, ptmp); } if(useLocal) { con.setLocalPath("/"); JFtp.statusP.jftp.addLocalConnection(htmp, con); } else { JFtp.statusP.jftp.addConnection(htmp, con); } con.chdir(htmp); //con.setLocalPath(JFtp.localDir.getCon().getPWD()); //con.addConnectionListener((ConnectionListener) JFtp.localDir); //BUGFIX searchValue[0] = "NFS"; searchValue[1] = htmp; searchValue[2] = utmp; if(Settings.getStorePasswords()) { searchValue[3] = ptmp; } else { searchValue[3] = ""; } searchValue[4] = useLocalString; searchValue[5] = LastConnections.SENTINEL; //searchValue = "NFS " + htmp + " " + utmp + " " + // ptmp + " " + useLocalString; /* searchValue = "NFS " + htmp + " " + utmp + " " + ptmp + " " + potmpString + " " + dtmp + " " + useLocalString; */ updateFileMenu(searchValue); return status; } /* //Common functionality goes here try { //if statement here, select connection type (or should // a superclass be used?) con = new NfsConnection(htmp); JFtp.statusP.jftp.addConnection(htmp, con); } catch (Exception ex) { Log.debug("Could not create " + protocol + "Connection!"); } */ //return true only if all has executed as expected return true; } public static int startFtpCon(String htmp, String utmp, String ptmp, int potmp, String dtmp, boolean useLocal) { return startFtpCon(htmp, utmp, ptmp, potmp, dtmp, useLocal, null); } //startCon public static int startFtpCon(String htmp, String utmp, String ptmp, int potmp, String dtmp, boolean useLocal, String crlf) { boolean pasv = Settings.getFtpPasvMode(); boolean threads = Settings.getEnableMultiThreading(); //BUGFIX: this is now an array //String searchValue = new String(""); String[] searchValue = new String[JFtp.CONNECTION_DATA_LENGTH]; //BELOW IS GUI-related stuff... should put in separate //method in GUI dir? /* if(!pasv && threads) { // only passive ftp threading works //Settings.setProperty("jftp.enableMultiThreading", false); JDialog j = new JDialog(); j.setTitle("Warning"); j.setLocation(150, 150); j.setSize(450, 100); j.getContentPane().add(new JLabel(" Multithreading in active mode is EXPERIMENTAL")); j.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); j.setModal(true); j.show(); } */ //***also need to get max connections!! con = new FtpConnection(htmp, potmp, dtmp, crlf); //con.addConnectionListener((ConnectionListener) JFtp.localDir); //con.addConnectionListener((ConnectionListener) JFtp.remoteDir); //JFtp.remoteDir.setCon(con); if(useLocal) { JFtp.statusP.jftp.addLocalConnection(htmp, con); } else { JFtp.statusP.jftp.addConnection(htmp, con); } //System.out.println("**" + htmp + potmp + dtmp); //System.out.println("**" + utmp + ptmp); int response = con.login(utmp, ptmp); //boolean isConnected = false; if(response == FtpConnection.LOGIN_OK) { //System.out.println(htmp + " " + potmp + " " + dtmp); /* if (useLocal) JFtp.statusP.jftp.addLocalConnection( htmp, con); else JFtp.statusP.jftp.addConnection(htmp, con); */ //String searchValue = new String(""); Integer potmpInt = new Integer(potmp); String potmpString = potmpInt.toString(); String useLocalString = new String("false"); if(useLocal) { useLocalString = "true"; } //BUGFIX /* searchValue = "FTP " + htmp + " " + utmp + " " + ptmp + " " + potmpString + " " + dtmp + " " + useLocalString; */ searchValue[0] = "FTP"; searchValue[1] = htmp; searchValue[2] = utmp; if(Settings.getStorePasswords()) { searchValue[3] = ptmp; } else { searchValue[3] = ""; } searchValue[4] = potmpString; searchValue[5] = dtmp; searchValue[6] = useLocalString; searchValue[7] = LastConnections.SENTINEL; updateFileMenu(searchValue); } //*** JUST FOR NOW: if not connected, take out the tabs else { if(useLocal) { JFtp.statusP.jftp.closeCurrentLocalTab(); } else { JFtp.statusP.jftp.closeCurrentTab(); } } return response; //*** code that indicates successful connection } //startFtpCon private static void updateFileMenu(String[] searchValue) { int position; position = LastConnections.findString(searchValue, JFtp.CAPACITY); //bugfix: now a 2D array String[][] newVals = new String[JFtp.CAPACITY][JFtp.CONNECTION_DATA_LENGTH]; if(position >= 0) { //System.out.println(JFtp.CAPACITY); //System.out.println("IT WAS FOUND"); //System.out.println(position); newVals = LastConnections.moveToFront(position, JFtp.CAPACITY); } else { //System.out.println("IT WASN'T FOUND"); newVals = LastConnections.prepend(searchValue, JFtp.CAPACITY, true); } } //updateFileMenu } //StartConnection jftp-1.52.orig/src/java/net/sf/jftp/net/wrappers/HttpTransfer.java0000700000175000017500000000772611112477774024224 0ustar varunvarunpackage net.sf.jftp.net.wrappers; import java.io.BufferedInputStream; import java.io.BufferedOutputStream; import java.io.File; import java.io.FileOutputStream; import java.net.URL; import java.util.Vector; import net.sf.jftp.net.ConnectionHandler; import net.sf.jftp.net.ConnectionListener; import net.sf.jftp.net.DataConnection; import net.sf.jftp.net.FtpConnection; import net.sf.jftp.net.Transfer; import net.sf.jftp.system.StringUtils; import net.sf.jftp.system.logging.Log; public class HttpTransfer extends Transfer implements Runnable { private String url; private String localPath; private String file; public boolean work = true; public boolean pause = false; public Thread runner; private Vector listeners; private int stat = 1; private ConnectionHandler handler = new ConnectionHandler(); public HttpTransfer(String url, String localPath, Vector listeners, ConnectionHandler handler) { this.url = url; this.localPath = localPath; this.listeners = listeners; this.handler = handler; file = StringUtils.getFile(url); prepare(); } public void prepare() { runner = new Thread(this); runner.setPriority(Thread.MIN_PRIORITY); runner.start(); } public void run() { try { if(handler.getConnections().get(file) == null) { Log.out("download started: " + url); Log.out("connection handler present: " + handler + ", poll size: " + handler.getConnections().size()); Log.out("local file: " + localPath + file); handler.addConnection(file, this); } else { Log.debug("Transfer already in progress: " + file); work = false; stat = 2; return; } URL u = new URL(url); BufferedOutputStream f = new BufferedOutputStream(new FileOutputStream(localPath + file)); BufferedInputStream in = new BufferedInputStream(u.openStream()); byte[] buf = new byte[4096]; int len = 0; while((stat > 0) && work) { stat = in.read(buf); if(stat == -1) { break; } f.write(buf, 0, stat); len += stat; fireProgressUpdate(file, DataConnection.GET, len); } f.flush(); f.close(); in.close(); fireProgressUpdate(file, DataConnection.FINISHED, len); } catch(Exception ex) { work = false; Log.debug("Download failed: " + ex.toString()); File f = new File(localPath + file); f.delete(); fireProgressUpdate(file, DataConnection.FAILED, -1); ex.printStackTrace(); return; } if(!work) { File f = new File(localPath + file); f.delete(); Log.out("download aborted: " + file); } } public void fireProgressUpdate(String file, String type, int bytes) { if(listeners == null) { return; } for(int i = 0; i < listeners.size(); i++) { ((ConnectionListener) listeners.elementAt(i)).updateProgress(file, type, bytes); } } public int getStatus() { return stat; } public boolean hasStarted() { return true; } public FtpConnection getFtpConnection() { return null; } public DataConnection getDataConnection() { return null; } } jftp-1.52.orig/src/java/net/sf/jftp/net/wrappers/Sftp2Transfer.java0000700000175000017500000000334211112477774024271 0ustar varunvarunpackage net.sf.jftp.net.wrappers; import java.util.Vector; import net.sf.jftp.net.Transfer; import com.sshtools.j2ssh.configuration.SshConnectionProperties; public class Sftp2Transfer implements Runnable { private String host; private String localPath; private String remotePath; private String file; private String user; private String pass; private Sftp2Connection con = null; private String type; public Thread runner; private Vector listeners; private String keyfile; private String port; public Sftp2Transfer(String localPath, String remotePath, String file, String user, String pass, Vector listeners, String type, String keyfile, String host, String port) { this.localPath = localPath; this.remotePath = remotePath; this.file = file; this.user = user; this.pass = pass; this.type = type; this.listeners = listeners; this.keyfile = keyfile; this.host = host; this.port = port; prepare(); } public void prepare() { runner = new Thread(this); runner.setPriority(Thread.MIN_PRIORITY); runner.start(); } public void run() { con = new Sftp2Connection(host, port, keyfile); con.setConnectionListeners(listeners); con.login(user, pass); con.setLocalPath(localPath); con.chdir(remotePath); if(type.equals(Transfer.DOWNLOAD)) { con.download(file); } else if(type.equals(Transfer.UPLOAD)) { con.upload(file); } } public Sftp2Connection getSftpConnection() { return con; } } jftp-1.52.orig/src/java/net/sf/jftp/net/FtpTransfer.java0000700000175000017500000001552511112477774022167 0ustar varunvarunpackage net.sf.jftp.net; import java.io.File; import java.util.Vector; import net.sf.jftp.config.Settings; import net.sf.jftp.system.logging.Log; /** * This class is used internally by FtpConnection. * You probably don't have to use it directly. */ public class FtpTransfer extends Transfer implements Runnable { private String host; private int port; private String localPath; private String remotePath; private String file; private String user; private String pass; private FtpConnection con = null; private String type; public Thread runner; private int stat = 0; private boolean started = false; private ConnectionHandler handler; private Vector listeners; private String newName = null; private int transferStatus = 0; private String crlf = null; public FtpTransfer(String host, int port, String localPath, String remotePath, String file, String user, String pass, String type, ConnectionHandler handler, Vector listeners, String newName, String crlf) { this.host = host; this.port = port; this.localPath = localPath; this.remotePath = remotePath; this.file = file; this.user = user; this.pass = pass; this.type = type; this.handler = handler; this.listeners = listeners; this.newName = newName; this.crlf = crlf; if(handler == null) { handler = new ConnectionHandler(); } prepare(); } public FtpTransfer(String host, int port, String localPath, String remotePath, String file, String user, String pass, String type, ConnectionHandler handler, Vector listeners, String crlf) { this.host = host; this.port = port; this.localPath = localPath; this.remotePath = remotePath; this.file = file; this.user = user; this.pass = pass; this.type = type; this.handler = handler; this.listeners = listeners; this.crlf = crlf; if(handler == null) { handler = new ConnectionHandler(); } prepare(); } public void prepare() { runner = new Thread(this); runner.setPriority(Thread.MIN_PRIORITY); runner.start(); } public void run() { //System.out.println(file); if(handler.getConnections().get(file) == null) { handler.addConnection(file, this); } else if(!pause) { Log.debug("Transfer already in progress: " + file); work = false; stat = 2; return; } boolean hasPaused = false; while(pause) { try { Thread.sleep(100); if(listeners != null) { for(int i = 0; i < listeners.size(); i++) { ((ConnectionListener) listeners.elementAt(i)).updateProgress(file, PAUSED, -1); } } if(!work) { if(listeners != null) { for(int i = 0; i < listeners.size(); i++) { ((ConnectionListener) listeners.elementAt(i)).updateProgress(file, REMOVED, -1); } } } } catch(Exception ex) { } hasPaused = true; } while((handler.getConnectionSize() >= Settings.getMaxConnections()) && (handler.getConnectionSize() > 0) && work) { try { stat = 4; Thread.sleep(400); if(!hasPaused && (listeners != null)) { for(int i = 0; i < listeners.size(); i++) { ((ConnectionListener) listeners.elementAt(i)).updateProgress(file, QUEUED, -1); } } else { break; } } catch(Exception ex) { ex.printStackTrace(); } } if(!work) { if(listeners != null) { for(int i = 0; i < listeners.size(); i++) { ((ConnectionListener) listeners.elementAt(i)).updateProgress(file, REMOVED, -1); } } handler.removeConnection(file); stat = 3; return; } started = true; try { Thread.sleep(Settings.ftpTransferThreadPause); } catch(Exception ex) { } con = new FtpConnection(host, port, remotePath, crlf); con.setConnectionHandler(handler); con.setConnectionListeners(listeners); int status = con.login(user, pass); if(status == FtpConnection.LOGIN_OK) { File f = new File(localPath); con.setLocalPath(f.getAbsolutePath()); if(type.equals(UPLOAD)) { if(newName != null) { transferStatus = con.upload(file, newName); } else { transferStatus = con.upload(file); } } else { transferStatus = con.download(file); } } if(!pause) { handler.removeConnection(file); } } public int getStatus() { return stat; } public int getTransferStatus() { return transferStatus; } public boolean hasStarted() { return started; } public FtpConnection getFtpConnection() { return con; } public DataConnection getDataConnection() { return con.getDataConnection(); } } jftp-1.52.orig/src/java/net/sf/jftp/net/FtpClient.java0000700000175000017500000000363011112477774021613 0ustar varunvarun/* * 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. */ package net.sf.jftp.net; public class FtpClient { private String name = "ftp"; private String password = "ftp@sourceforge.net"; private FtpConnection connection = null; public FtpClient() { } public void login(String host) { connection = new FtpConnection(host); connection.login(name, password); } public void setUsername(String s) { name = s; } public void setPassword(String s) { password = s; } public void disconnect() { if(connection != null) { connection.disconnect(); } } public void cd(String s) { if(connection != null) { connection.chdir(s); } } public String pwd() { if(connection != null) { return connection.getPWD(); } else { return ""; } } public void get(String file) { if(connection != null) { connection.handleDownload(file); } } public void put(String file) { if(connection != null) { connection.handleUpload(file); } } } jftp-1.52.orig/src/java/net/sf/jftp/net/BasicConnection.java0000700000175000017500000000407611112477774022771 0ustar varunvarun/* * 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. */ package net.sf.jftp.net; import java.io.IOException; import java.io.InputStream; import java.util.Date; import java.util.Vector; /** * Interface for all connection types */ public interface BasicConnection { public boolean hasUploaded = false; public void sendRawCommand(String cmd); //public boolean login(String user, String pass); public void disconnect(); public boolean isConnected(); public String getPWD(); public boolean cdup(); public boolean mkdir(String dirName); public void list() throws IOException; public boolean chdir(String p); public boolean chdirNoRefresh(String p); public String getLocalPath(); public boolean setLocalPath(String newPath); public String[] sortLs(); public String[] sortSize(); public Date[] sortDates(); public int[] getPermissions(); public int handleDownload(String file); public int handleUpload(String file); public int download(String file); public int upload(String file); public int upload(String file, InputStream in); public InputStream getDownloadInputStream(String file); public int removeFileOrDir(String file); public void addConnectionListener(ConnectionListener listener); public void setConnectionListeners(Vector listeners); public boolean rename(String from, String to); } jftp-1.52.orig/src/java/net/sf/jftp/net/server/0000700000175000017500000000000011155274771020360 5ustar varunvarunjftp-1.52.orig/src/java/net/sf/jftp/net/server/FtpServerSocket.java0000700000175000017500000003113311112477774024321 0ustar varunvarun/* * 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. */ package net.sf.jftp.net.server; import net.sf.jftp.system.logging.Log; import java.io.*; import java.lang.reflect.*; import java.net.*; import java.text.*; import java.util.*; /** * */ public class FtpServerSocket extends Thread { public final static int port = 21; public final static int dataPort = 20; private static ArrayList commands = null; static { commands = new ArrayList(); commands.add("auth"); commands.add("cdup"); commands.add("cwd"); commands.add("feat"); commands.add("help"); commands.add("lang"); commands.add("list"); commands.add("mkd"); commands.add("mode"); commands.add("motd"); commands.add("nlst"); commands.add("noop"); commands.add("opts"); commands.add("pass"); commands.add("pasv"); commands.add("port"); commands.add("pwd"); commands.add("quit"); commands.add("rein"); commands.add("smnt"); commands.add("stat"); commands.add("stru"); commands.add("syst"); commands.add("type"); commands.add("user"); } private Socket socket = null; private BufferedReader in = null; private PrintWriter out = null; private Hashtable methods = new Hashtable(); private File directory = new File("."); private ResourceBundle bundle = ResourceBundle.getBundle("responses", Locale.US); private ServerSocket pasvSocket = null; private boolean passive = false; private int activePort = 0; private String structure = "file"; private String transferMode = "stream"; private String type = "ascii"; private String rootDir = null; private String currentDir = null; public FtpServerSocket(Socket s) throws IOException { socket = s; try { in = new BufferedReader(new InputStreamReader(socket.getInputStream())); out = new PrintWriter(socket.getOutputStream(), true); } catch(IOException ioe) { throw ioe; } Method[] m = this.getClass().getDeclaredMethods(); String methodName = null; for(int i = 0; i < m.length; i++) { methodName = m[i].getName(); if(commands.contains(methodName)) { methods.put(methodName, m[i]); } } this.start(); } private void send(String bundleId) { out.print(bundle.getString(bundleId)); out.flush(); } private void send(String bundleId, Object[] args) { MessageFormat fmt = new MessageFormat(bundle.getString(bundleId)); out.print(fmt.format(args)); out.flush(); } public void motd() { send("220motd"); } public void user(String line) { send("331user"); } public void pass(String line) { send("230pass"); } public void syst(String line) { send("215syst"); } public void type(String line) { // needs work A, E, I, L, C, T, N Object[] args = { "I" }; send("200type", args); } public void stru(String line) { // needs work - check for F, R, or P Object[] args = { line.toUpperCase() }; send("200ok", args); } public void mode(String line) { // check for S, B, or C Object[] args = { line.toUpperCase() }; send("200ok", args); } public void rein(String line) { Object[] args = { "REIN" }; send("502", args); } public void smnt(String line) { Object[] args = { "SMNT" }; send("502", args); } public void quit(String line) { out.print("221-You have transferred 0 bytes in 0 files.\r\n"); out.print("221-Total traffic for this session was 0 bytes in 0 transfers.\r\n"); out.print("221 Thank you for using the FTP service on pikachu.\r\n"); out.flush(); try { socket.close(); } catch(Exception e) { } } public void pwd(String line) { Object[] args = { currentDir }; send("257pwd", args); } public void cwd(String line) { String arg = line.substring(4); String tmpDir; if(arg.startsWith("/")) { tmpDir = removeTrailingSlash(rootDir) + arg; } else { tmpDir = addTrailingSlash(currentDir) + arg; } File tmp = new File(tmpDir); if(tmp.exists() && tmp.isDirectory()) { currentDir = tmpDir; send("250cwd"); } else { out.print("550 " + arg + ": No such file or directory.\r\n"); out.flush(); } } public void cdup(String line) { Object[] args = { "CDUP" }; File tmp = directory.getParentFile(); if(tmp != null) { directory = tmp; } send("200", args); } public void noop(String line) { Object[] args = { "NOOP" }; send("200", args); } public void help(String line) { out.print("214-The following commands are recognized.\r\n"); /* USER PORT STOR RNTO NLST MKD CDUP PASS PASV APPE ABOR SITE XMKD XCUP TYPE DELE SYST RMD STOU STRU ALLO CWD STAT XRMD SIZE MODE REST XCWD HELP PWD MDTM QUIT RETR RNFR LIST NOOP XPWD */ out.print("214 Direct comments to root@localhost.\r\n"); out.flush(); } public void stat(String line) { out.print("211-FTP server status:\r\n"); /* Version wu-2.6.1-16 Connected to pikachu (127.0.0.1) Logged in as gary TYPE: ASCII, FORM: Nonprint; STRUcture: File; transfer MODE: Stream No data connection 0 data bytes received in 0 files 0 data bytes transmitted in 0 files 0 data bytes total in 0 files 82 traffic bytes received in 0 transfers 2502 traffic bytes transmitted in 1 transfers 2634 traffic bytes total in 1 transfers Disk quota: 0 disk blocks in use, 0 quota, 0 limit - time left Inode quota: 0 inodes in use, 0 quota, 0 limit - time left */ out.print("211 End of status\r\n"); out.flush(); } private String addTrailingSlash(String s) { if(s.endsWith("/")) { return s; } else { return s + "/"; } } private String removeTrailingSlash(String s) { if(s.endsWith("/")) { return s.substring(0, s.length() - 1); } else { return s; } } public void mkd(String line) { String arg = line.substring(4); if(arg.startsWith("/")) { arg = removeTrailingSlash(rootDir) + arg; } else { arg = addTrailingSlash(currentDir) + arg; } File f = new File(arg); MessageFormat fmt = null; Object[] args = { f.getAbsolutePath() }; if(f.exists()) { send("521mkd", args); } else if(f.mkdirs()) { send("257mkd", args); } else { send("550mkd", args); } } public void feat(String line) { out.print("211-Extensions supported\r\n"); out.print(" LANG EN*;FR\r\n"); out.print("211 END\r\n"); out.flush(); } public void pasv(String line) { InetAddress address = socket.getLocalAddress(); String pasvAddress = address.getHostAddress().replace('.', ','); try { pasvSocket = new ServerSocket(0, 5, address); passive = true; } catch(IOException ioe) { } int pasvPort = pasvSocket.getLocalPort(); Object[] args = { pasvAddress + "," + ((int) pasvPort / 256) + "," + (pasvPort % 256) }; send("227pasv", args); } public void list(String line) { send("150list"); if(!passive) { try { Socket activeSocket = new Socket(socket.getInetAddress(), activePort); PrintStream ps = new PrintStream(activeSocket.getOutputStream()); ps.print("bleah\r\n"); ps.print("bleah\r\n"); ps.print("bleah\r\n"); ps.print("bleah\r\n"); ps.print("bleah\r\n"); ps.flush(); ps.close(); send("226"); } catch(Exception e) { } } } public void nlst(String line) { send("150nlst"); if(!passive) { try { Socket activeSocket = new Socket(socket.getInetAddress(), activePort); PrintStream ps = new PrintStream(activeSocket.getOutputStream()); ps.print("bleah\r\n"); ps.print("bleah\r\n"); ps.print("bleah\r\n"); ps.print("bleah\r\n"); ps.print("bleah\r\n"); ps.flush(); ps.close(); send("225"); } catch(Exception e) { } } } public void port(String line) { int start = line.lastIndexOf(","); int end = line.length(); String lo = null; // lo-ordered byte if((start != -1) && (end != -1)) { lo = line.substring(start + 1, end); } end = start; start = line.lastIndexOf(",", start - 1); String hi = null; // hi-ordered byte if((start != -1) && (end != -1)) { hi = line.substring(start + 1, end); } activePort = ((Integer.parseInt(hi) * 256) + Integer.parseInt(lo)); Object[] args = { "PORT" }; send("200", args); } public void opts(String line) { // return 200, 451 or 501 } public void lang(String line) { out.print("200 Responses changed to english\r\n"); out.flush(); } public void auth(String line) { } public void setRoot(String line) { if(new File(line).exists()) { rootDir = line; } else { System.err.println("invalid root directory"); } } public void run() { try { String line = null; motd(); while((line = in.readLine()) != null) { System.out.println(line); int index = line.indexOf(' '); if(index == -1) { index = line.length(); } String command = line.substring(0, index).toLowerCase(); Method o = (Method) methods.get(command); if(o != null) { try { o.invoke(this, new Object[] { line }); } catch(Exception e) { } } else { send("500"); } } } catch(IOException ioe) { Log.debug("Socket error: " + ioe); } } public static void main(String[] args) { } } jftp-1.52.orig/src/java/net/sf/jftp/net/server/FtpServer.java0000700000175000017500000000304311112477774023147 0ustar varunvarun/* * 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. */ package net.sf.jftp.net.server; import net.sf.jftp.system.logging.Log; import java.io.*; import java.net.*; import java.util.*; /** * */ public class FtpServer extends Thread { private int port = 21; private int dataPort = 20; public FtpServer() { } public FtpServer(int port) { this.port = port; } public void run() { try { ServerSocket listener = new ServerSocket(port); while(true) { Socket s = listener.accept(); new FtpServerSocket(s); } } catch(IOException ioe) { Log.debug("ServerSocket error: " + ioe); } } public static void main(String[] args) { FtpServer server = new FtpServer(2100); server.start(); } } jftp-1.52.orig/src/java/net/sf/jftp/net/Transfer.java0000700000175000017500000000127511112477774021512 0ustar varunvarunpackage net.sf.jftp.net; /** * The basic Transfer interface. * You probably don't have to use it directly. */ public abstract class Transfer { public static final String PAUSED = "STOPPED"; public static final String QUEUED = "QUEUED"; public static final String REMOVED = "REMOVED"; public static final String UPLOAD = "UPLOAD"; public static final String DOWNLOAD = "DOWNLOAD"; public boolean work = true; public boolean pause = false; public abstract void prepare(); public abstract int getStatus(); public abstract boolean hasStarted(); public abstract FtpConnection getFtpConnection(); public abstract DataConnection getDataConnection(); } jftp-1.52.orig/src/java/net/sf/jftp/net/FtpURLConnection.java0000700000175000017500000000640711264334034023051 0ustar varunvarun/* * 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. */ package net.sf.jftp.net; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.net.URL; import java.net.URLConnection; import net.sf.jftp.system.logging.Log; /** * */ public class FtpURLConnection extends URLConnection { private FtpConnection connection = null; private String username = "ftp"; private String password = "none@no.no"; private int loginFlag = 0; public FtpURLConnection(URL u) { super(u); // parse the url for username and password and the remote directory connection = new FtpConnection(u.getHost()); String userInfo = u.getUserInfo(); if(userInfo != null) { int index = userInfo.indexOf(":"); if(index != -1) { username = userInfo.substring(0, index); password = userInfo.substring(index + 1); } } //System.out.println(u.getPath()); //System.out.println(u.getPort()); //System.out.println(u.getUserInfo()); //System.out.println(u.getAuthority()); Log.debug("Connecting..."); } public void connect() throws IOException { loginFlag = connection.login(username, password); if(loginFlag != FtpConnection.LOGIN_OK) { return; } //System.out.println(url.getPath()); connection.chdir(url.getPath()); } public FtpConnection getFtpConnection() { return connection; } public InputStream getInputStream() throws IOException { return null; } public OutputStream getOutputStream() throws IOException { return null; } public String getUser() { return username; } public String getPass() { return password; } public String getHost() { return url.getHost(); } public int getPort() { int ret = url.getPort(); if(ret <= 0) { return 21; } else { return ret; } } public int getLoginResponse() { return loginFlag; } public boolean loginSucceeded() { if(loginFlag == FtpConnection.LOGIN_OK) { return true; } return false; } public static void main(String[] args) { try { URLConnection uc = new FtpURLConnection(new URL("ftp://ftp:pass@localhost/pub")); uc.connect(); } catch(IOException ioe) { } } } jftp-1.52.orig/src/java/net/sf/jftp/net/ConnectionHandler.java0000700000175000017500000000335511112477774023324 0ustar varunvarun/* * 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. */ package net.sf.jftp.net; import java.util.Enumeration; import java.util.Hashtable; /** * This class manages a connection pool. * You do not have to create an instance, but when you do use FtpConnection.setConnectionHandler * for each connection to make the connection recognize its handler. */ public class ConnectionHandler { private Hashtable connections = new Hashtable(); public void addConnection(String file, Transfer t) { connections.put(file, t); } public void removeConnection(String file) { connections.remove(file); } public Hashtable getConnections() { return connections; } public int getConnectionSize() { int size = 0; Enumeration e = connections.elements(); while(e.hasMoreElements()) { Transfer t = (Transfer) e.nextElement(); if(t.hasStarted()) { size++; } } return size; } } jftp-1.52.orig/src/java/net/sf/jftp/net/FilesystemConnection.java0000700000175000017500000004161011112477774024067 0ustar varunvarun/* * 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. */ package net.sf.jftp.net; import java.io.BufferedInputStream; import java.io.BufferedOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.StreamTokenizer; import java.util.Date; import java.util.Vector; import net.sf.jftp.config.Settings; import net.sf.jftp.system.StringUtils; import net.sf.jftp.system.logging.Log; public class FilesystemConnection implements BasicConnection { public static int filesystemBuffer = 128000; private String path = ""; private String pwd = ""; private Vector listeners = new Vector(); private String[] files; private String[] size = new String[0]; private int[] perms = null; private String baseFile; private int fileCount; private boolean shortProgress = false; public Vector dateVector = new Vector(); public FilesystemConnection() { } public FilesystemConnection(String path, ConnectionListener l) { listeners.add(l); chdir(path); } public int removeFileOrDir(String file) { try { if((file == null) || file.equals("")) { return -1; } String tmp = file; if(StringUtils.isRelative(file)) { tmp = getPWD() + file; } File f = new File(tmp); if(!f.getAbsolutePath().equals(f.getCanonicalPath())) { //Log.debug("WARNING: Symlink removed");//Skipping symlink, remove failed."); //Log.debug("This is necessary to prevent possible data loss when removing those symlinks."); //return -1; if(!f.delete()) { return -1; } } if(f.exists() && f.isDirectory()) { cleanLocalDir(tmp); } //System.out.println(tmp); if(!f.delete()) { Log.debug("Removal failed."); return -1; } } catch(IOException ex) { Log.debug("Error: " + ex.toString()); ex.printStackTrace(); } return -1; } private void cleanLocalDir(String dir) { try { dir = dir.replace('\\', '/'); if(!dir.endsWith("/")) { dir = dir + "/"; } //String remoteDir = StringUtils.removeStart(dir,path); //System.out.println(">>> " + dir); File f2 = new File(dir); String[] tmp = f2.list(); if(tmp == null) { return; } for(int i = 0; i < tmp.length; i++) { File f3 = new File(dir + tmp[i]); if(!f3.getAbsolutePath().equals(f3.getCanonicalPath())) { //Log.debug("WARNING: Symlink remove");//Skipping symlink, remove may fail."); f3.delete(); //Log.debug("This is necessary to prevent possible data loss when removing those symlinks."); //continue; } if(f3.isDirectory()) { //System.out.println(dir); cleanLocalDir(dir + tmp[i]); f3.delete(); } else { //System.out.println(dir+tmp[i]); f3.delete(); } } } catch(IOException ex) { Log.debug("Error: " + ex.toString()); ex.printStackTrace(); } } public void sendRawCommand(String cmd) { } public void disconnect() { } public boolean isConnected() { return true; } public String getPWD() { return pwd; } public boolean cdup() { return chdir(pwd.substring(0, pwd.lastIndexOf("/") + 1)); } public boolean mkdir(String dirName) { if(StringUtils.isRelative(dirName)) { dirName = getPWD() + dirName; } File f = new File(dirName); boolean x = f.mkdir(); fireDirectoryUpdate(); return x; } public void list() throws IOException { } public boolean chdir(String p) { String p2 = processPath(p); if(p2 == null) { return false; } File f = new File(p2); if(!f.exists() || !f.isDirectory() || !f.canRead()) { Log.debug("Access denied."); return false; } pwd = p2; fireDirectoryUpdate(); return true; } public boolean chdirNoRefresh(String p) { String p2 = processPath(p); if(p2 == null) { return false; } //System.out.println(p2); pwd = p2; return true; } public String getLocalPath() { //System.out.println("local: " + path); return path; } public String processPath(String p) { p = p.replace('\\', '/'); //System.out.print("processPath 1: "+p); if(StringUtils.isRelative(p)) { p = pwd + p; } p = p.replace('\\', '/'); //System.out.println(", processPath 2: "+p); File f = new File(p); String p2; if(f.exists()) { try { p2 = f.getCanonicalPath(); p2 = p2.replace('\\', '/'); if(!p2.endsWith("/")) { p2 = p2 + "/"; } return p2; } catch(IOException ex) { Log.debug("Error: can not get pathname (processPath)!"); return null; } } else { Log.debug("(processpPath) No such path: \"" + p + "\""); return null; } } public boolean setLocalPath(String p) { p = p.replace('\\', '/'); //System.out.print("local 1:" + p); if(StringUtils.isRelative(p)) { p = path + p; } p = p.replace('\\', '/'); //System.out.println(", local 2:" + p); File f = new File(p); if(f.exists()) { try { path = f.getCanonicalPath(); path = path.replace('\\', '/'); if(!path.endsWith("/")) { path = path + "/"; } //System.out.println("localPath: "+path); } catch(IOException ex) { Log.debug("Error: can not get pathname (local)!"); return false; } } else { Log.out("(local) obsolete setLocalDir: \"" + p + "\""); return false; } return true; } public String[] sortLs() { dateVector = new Vector(); File f = new File(pwd); files = f.list(); if(files == null) { return new String[0]; } size = new String[files.length]; perms = new int[files.length]; int accessible = 0; for(int i = 0; i < files.length; i++) { File f2 = new File(pwd + files[i]); if(f2.isDirectory() && !files[i].endsWith("/")) { files[i] = files[i] + "/"; } size[i] = "" + new File(pwd + files[i]).length(); if(f2.canWrite()) { accessible = FtpConnection.W; } else if(f2.canRead()) { accessible = FtpConnection.R; } else { accessible = FtpConnection.DENIED; } perms[i] = accessible; //System.out.println(pwd+files[i] +" : " +accessible + " : " + size[i]); Date d = new Date(f2.lastModified()); //System.out.println(d.toString()); dateVector.add(d); } return files; } public String[] sortSize() { return size; } public int[] getPermissions() { return perms; } public int handleDownload(String file) { transfer(file); return 0; } public int handleUpload(String file) { transfer(file); return 0; } public int download(String file) { transfer(file); return 0; } public int upload(String file) { transfer(file); return 0; } private void transferDir(String dir, String out) { fileCount = 0; shortProgress = true; baseFile = StringUtils.getDir(dir); File f2 = new File(dir); String[] tmp = f2.list(); if(tmp == null) { return; } File fx = new File(out); if(!fx.mkdir()) { Log.debug("Can not create directory: " + out + " - already exist or permission denied?"); } for(int i = 0; i < tmp.length; i++) { tmp[i] = tmp[i].replace('\\', '/'); //System.out.println("1: " + dir+tmp[i] + ", " + out +tmp[i]); File f3 = new File(dir + tmp[i]); if(f3.isDirectory()) { if(!tmp[i].endsWith("/")) { tmp[i] = tmp[i] + "/"; } transferDir(dir + tmp[i], out + tmp[i]); } else { fireProgressUpdate(baseFile, DataConnection.GETDIR + ":" + fileCount, -1); work(dir + tmp[i], out + tmp[i]); } } fireProgressUpdate(baseFile, DataConnection.DFINISHED + ":" + fileCount, -1); shortProgress = false; } private void transfer(String file) { String out = StringUtils.getDir(file); if(StringUtils.isRelative(file)) { file = getPWD() + file; } file = file.replace('\\', '/'); out = out.replace('\\', '/'); String outfile = StringUtils.getFile(file); if(file.endsWith("/")) { transferDir(file, getLocalPath() + out); return; } else { work(file, getLocalPath() + outfile); } } private void work(String file, String outfile) { try { BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(outfile)); BufferedInputStream in = new BufferedInputStream(new FileInputStream(file)); byte[] buf = new byte[filesystemBuffer]; int len = 0; int reallen = 0; //System.out.println(file+":"+getLocalPath()+outfile); while(true) { len = in.read(buf); //System.out.print("."); if(len == StreamTokenizer.TT_EOF) { break; } out.write(buf, 0, len); reallen += len; fireProgressUpdate(StringUtils.getFile(file), DataConnection.GET, reallen); } out.flush(); out.close(); in.close(); fireProgressUpdate(file, DataConnection.FINISHED, -1); } catch(IOException ex) { Log.debug("Error with file IO (" + ex + ")!"); fireProgressUpdate(file, DataConnection.FAILED, -1); } } public int upload(String file, InputStream in) { if(StringUtils.isRelative(file)) { file = getPWD() + file; } file = file.replace('\\', '/'); try { work(new BufferedInputStream(in), file, file); return 0; } catch(Exception ex) { Log.debug("Error: " + ex.toString()); ex.printStackTrace(); return -1; } } private void work(BufferedInputStream in, String outfile, String file) { try { BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(outfile)); byte[] buf = new byte[filesystemBuffer]; int len = 0; int reallen = 0; while(true) { len = in.read(buf); System.out.print("."); if(len == StreamTokenizer.TT_EOF) { break; } out.write(buf, 0, len); reallen += len; fireProgressUpdate(StringUtils.getFile(file), DataConnection.GET, reallen); } out.flush(); out.close(); in.close(); fireProgressUpdate(file, DataConnection.FINISHED, -1); } catch(IOException ex) { Log.debug("Error with file IO (" + ex + ")!"); fireProgressUpdate(file, DataConnection.FAILED, -1); } } public InputStream getDownloadInputStream(String file) { if(StringUtils.isRelative(file)) { file = getPWD() + file; } file = file.replace('\\', '/'); try { return new FileInputStream(file); } catch(Exception ex) { ex.printStackTrace(); Log.debug(ex.toString() + " @Filesystemconnection::getDownloadInputStream"); return null; } } public void addConnectionListener(ConnectionListener l) { listeners.add(l); fireDirectoryUpdate(); } public void setConnectionListeners(Vector l) { listeners = l; fireDirectoryUpdate(); } /** remote directory has changed */ public void fireDirectoryUpdate() { if(listeners == null) { return; } else { for(int i = 0; i < listeners.size(); i++) { ((ConnectionListener) listeners.elementAt(i)).updateRemoteDirectory(this); } } } public boolean login(String user, String pass) { return true; } public void fireProgressUpdate(String file, String type, int bytes) { if(listeners == null) { return; } else { for(int i = 0; i < listeners.size(); i++) { ConnectionListener listener = (ConnectionListener) listeners.elementAt(i); if(shortProgress && Settings.shortProgress) { if(type.startsWith(DataConnection.DFINISHED)) { listener.updateProgress(baseFile, DataConnection.DFINISHED + ":" + fileCount, bytes); } listener.updateProgress(baseFile, DataConnection.GETDIR + ":" + fileCount, bytes); } else { listener.updateProgress(file, type, bytes); } } } } public Date[] sortDates() { if(dateVector.size() > 0) { return (Date[]) dateVector.toArray(); } else { return null; } } public boolean rename(String file, String to) { if(StringUtils.isRelative(file)) { file = getPWD() + file; } file = file.replace('\\', '/'); File f = new File(file); if(StringUtils.isRelative(to)) { to = getPWD() + to; } to = to.replace('\\', '/'); return f.renameTo(new File(to)); } } jftp-1.52.orig/src/java/net/sf/jftp/net/DataConnection.java0000700000175000017500000005327211112477774022623 0ustar varunvarun/* * 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. */ package net.sf.jftp.net; import java.io.BufferedInputStream; import java.io.BufferedOutputStream; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.RandomAccessFile; import java.io.StreamTokenizer; import java.net.ServerSocket; import java.net.Socket; import net.sf.jftp.config.Settings; import net.sf.jftp.system.logging.Log; /** * This class represents a ftp data connection. * It is used internally by FtpConnection, so you probably don't have to use it directly. */ public class DataConnection implements Runnable { public final static String GET = "GET"; public final static String PUT = "PUT"; public final static String FAILED = "FAILED"; public final static String FINISHED = "FINISHED"; public final static String DFINISHED = "DFINISHED"; public final static String GETDIR = "DGET"; public final static String PUTDIR = "DPUT"; private BufferedInputStream in = null; private BufferedOutputStream out = null; private Thread reciever; private int port = 7000; public Socket sock = null; private ServerSocket ssock = null; private String type; private String file; private String host; private boolean resume = false; public boolean finished = false; private boolean isThere = false; private long start; private FtpConnection con; private int skiplen = 0; private boolean justStream = false; private boolean ok = true; private String localfile = null; //private String outputCharset = "CP037"; private String newLine = null; private String LINEEND = System.getProperty("line.separator"); public DataConnection(FtpConnection con, int port, String host, String file, String type) { this.con = con; this.file = file; this.host = host; this.port = port; this.type = type; reciever = new Thread(this); reciever.start(); } public DataConnection(FtpConnection con, int port, String host, String file, String type, boolean resume) { this.con = con; this.file = file; this.host = host; this.port = port; this.type = type; this.resume = resume; //resume = false; reciever = new Thread(this); reciever.start(); } public DataConnection(FtpConnection con, int port, String host, String file, String type, boolean resume, boolean justStream) { this.con = con; this.file = file; this.host = host; this.port = port; this.type = type; this.resume = resume; this.justStream = justStream; //resume = false; reciever = new Thread(this); reciever.start(); } public DataConnection(FtpConnection con, int port, String host, String file, String type, boolean resume, String localfile) { this.con = con; this.file = file; this.host = host; this.port = port; this.type = type; this.resume = resume; this.localfile = localfile; //resume = false; reciever = new Thread(this); reciever.start(); } public DataConnection(FtpConnection con, int port, String host, String file, String type, boolean resume, int skiplen) { this.con = con; this.file = file; this.host = host; this.port = port; this.type = type; this.resume = resume; this.skiplen = skiplen; //resume = false; reciever = new Thread(this); reciever.start(); } public DataConnection(FtpConnection con, int port, String host, String file, String type, boolean resume, int skiplen, InputStream i) { this.con = con; this.file = file; this.host = host; this.port = port; this.type = type; this.resume = resume; this.skiplen = skiplen; if(i != null) { this.in = new BufferedInputStream(i); } //resume = false; reciever = new Thread(this); reciever.start(); } public void run() { try { newLine = con.getCRLF(); //Log.debug("NL: "+newLine+"\n\n\n\n\n"); if(Settings.getFtpPasvMode()) { try { sock = new Socket(host, port); sock.setSoTimeout(Settings.getSocketTimeout()); } catch(Exception ex) { ok = false; ex.printStackTrace(); debug("Can't open Socket on "+host+":" + port); } } else { //Log.debug("trying new server socket: "+port); try { ssock = new ServerSocket(port); } catch(Exception ex) { ok = false; ex.printStackTrace(); Log.debug("Can't open ServerSocket on port " + port); } } } catch(Exception ex) { debug(ex.toString()); } isThere = true; boolean ok = true; RandomAccessFile fOut = null; BufferedOutputStream bOut = null; RandomAccessFile fIn = null; try { if(!Settings.getFtpPasvMode()) { int retry = 0; while((retry++ < 5) && (sock == null)) { try { ssock.setSoTimeout(Settings.connectionTimeout); sock = ssock.accept(); } catch(IOException e) { sock = null; debug("Got IOException while trying to open a socket!"); if(retry == 5) { debug("Connection failed, tried 5 times - maybe try a higher timeout in Settings.java..."); } finished = true; throw e; } finally { ssock.close(); } debug("Attempt timed out, retrying..."); } } if(ok) { byte[] buf = new byte[Settings.bufferSize]; start = System.currentTimeMillis(); long buflen = 0; //---------------download---------------------- if(type.equals(GET) || type.equals(GETDIR)) { if(!justStream) { try { if(resume) { File f = new File(file); fOut = new RandomAccessFile(file, "rw"); fOut.seek(f.length()); buflen = f.length(); } else { if(localfile == null) { localfile = file; } File f2 = new File(Settings.appHomeDir); f2.mkdirs(); File f = new File(localfile); if(f.exists()) { f.delete(); } bOut = new BufferedOutputStream(new FileOutputStream(localfile), Settings.bufferSize); } } catch(Exception ex) { debug("Can't create outputfile: " + file); ok = false; ex.printStackTrace(); } } if(ok) { try { in = new BufferedInputStream(sock.getInputStream(), Settings.bufferSize); if(justStream) { return; } } catch(Exception ex) { ok = false; debug("Can't get InputStream"); } if(ok) { try { long len = buflen; if(fOut != null) { while(true) { // resuming int read = -2; try { read = in.read(buf); } catch(IOException es) { Log.out("got a IOException"); ok = false; fOut.close(); finished = true; con.fireProgressUpdate(file, FAILED, -1); Log.out("last read: " + read + ", len: " + (len + read)); es.printStackTrace(); return; } len += read; if(read == -1) { break; } if(newLine != null) { byte[] buf2 = modifyGet(buf, read); fOut.write(buf2, 0, buf2.length); } else { fOut.write(buf, 0, read); } con.fireProgressUpdate(file, type, len); if(time()) { // Log.debugSize(len, true, false, file); } if(read == StreamTokenizer.TT_EOF) { break; } } //Log.debugSize(len, true, true, file); } else { // no resuming while(true) { //System.out.println("."); int read = -2; try { read = in.read(buf); } catch(IOException es) { Log.out("got a IOException"); ok = false; bOut.close(); finished = true; con.fireProgressUpdate(file, FAILED, -1); Log.out("last read: " + read + ", len: " + (len + read)); es.printStackTrace(); return; } len += read; if(read == -1) { break; } if(newLine != null) { byte[] buf2 = modifyGet(buf, read); bOut.write(buf2, 0, buf2.length); } else { bOut.write(buf, 0, read); } con.fireProgressUpdate(file, type, len); if(time()) { //Log.debugSize(len, true, false, file); } if(read == StreamTokenizer.TT_EOF) { break; } } bOut.flush(); //Log.debugSize(len, true, true, file); } } catch(IOException ex) { ok = false; debug("Old connection removed"); con.fireProgressUpdate(file, FAILED, -1); //debug(ex + ": " + ex.getMessage()); ex.printStackTrace(); } } } } //---------------upload---------------------- if(type.equals(PUT) || type.equals(PUTDIR)) { if(in == null) { try { fIn = new RandomAccessFile(file, "r"); if(resume) { fIn.seek(skiplen); } //fIn = new BufferedInputStream(new FileInputStream(file)); } catch(Exception ex) { debug("Can't open inputfile: " + " (" + ex + ")"); ok = false; } } if(ok) { try { out = new BufferedOutputStream(sock.getOutputStream()); } catch(Exception ex) { ok = false; debug("Can't get OutputStream"); } if(ok) { try { int len = skiplen; while(true) { int read; if(in != null) { read = in.read(buf); } else { read = fIn.read(buf); } len += read; //System.out.println(file + " " + type+ " " + len + " " + read); if(read == -1) { break; } if(newLine != null) { byte[] buf2 = modifyPut(buf, read); out.write(buf2, 0, buf2.length); } else { out.write(buf, 0, read); } con.fireProgressUpdate(file, type, len); if(time()) { // Log.debugSize(len, false, false, file); } if(read == StreamTokenizer.TT_EOF) { break; } } out.flush(); //Log.debugSize(len, false, true, file); } catch(IOException ex) { ok = false; debug("Error: Data connection closed."); con.fireProgressUpdate(file, FAILED, -1); ex.printStackTrace(); } } } } } } catch(IOException ex) { Log.debug("Can't connect socket to ServerSocket"); ex.printStackTrace(); } finally { try { if(out != null) { out.flush(); out.close(); } } catch(Exception ex) { ex.printStackTrace(); } try { if(bOut != null) { bOut.flush(); bOut.close(); } } catch(Exception ex) { ex.printStackTrace(); } try { if(fOut != null) { fOut.close(); } } catch(Exception ex) { ex.printStackTrace(); } try { if(in != null && !justStream) { in.close(); } if(fIn != null) { fIn.close(); } } catch(Exception ex) { ex.printStackTrace(); } } try { sock.close(); } catch(Exception ex) { debug(ex.toString()); } if(!Settings.getFtpPasvMode()) { try { ssock.close(); } catch(Exception ex) { debug(ex.toString()); } } finished = true; if(ok) { con.fireProgressUpdate(file, FINISHED, -1); } else { con.fireProgressUpdate(file, FAILED, -1); } } public InputStream getInputStream() { return in; } public FtpConnection getCon() { return con; } private void debug(String msg) { Log.debug(msg); } public void reset() { //reciever.destroy(); reciever = new Thread(this); reciever.start(); } private boolean time() { long now = System.currentTimeMillis(); long offset = now - start; if(offset > Settings.statusMessageAfterMillis) { start = now; return true; } return false; } public boolean isThere() { if(finished) { return true; } return isThere; } public void setType(String tmp) { type = tmp; } public boolean isOK() { return ok; } public void interrupt() { if(Settings.getFtpPasvMode() && (type.equals(GET) || type.equals(GETDIR))) { try { reciever.join(); } catch(InterruptedException ex) { ex.printStackTrace(); } } } private byte[] modifyPut(byte[] buf, int len) { //Log.debug("\n\n\n\nNewline: "+newLine); if(newLine == null) return buf; String s = (new String(buf)).substring(0,len); s = s.replaceAll(LINEEND, newLine); //Log.debug("Newline_own: "+LINEEND+", s:"+s); return s.getBytes(); } private byte[] modifyGet(byte[] buf, int len) { //Log.debug("\n\n\n\nNewline: "+newLine); if(newLine == null) return buf; String s = (new String(buf)).substring(0,len); s = s.replaceAll(newLine, LINEEND); //Log.debug("Newline_own: "+LINEEND+", s:"+s); return s.getBytes(); } } jftp-1.52.orig/build/0000700000175000017500000000000011264344675013514 5ustar varunvarunjftp-1.52.orig/doc/0000700000175000017500000000000011264336664013161 5ustar varunvarunjftp-1.52.orig/doc/FtpDownload.java~0000700000175000017500000001062211142553764016444 0ustar varunvarunimport net.sf.jftp.net.ConnectionHandler; import net.sf.jftp.net.ConnectionListener; import net.sf.jftp.net.DataConnection; import net.sf.jftp.net.FtpConnection; import net.sf.jftp.net.BasicConnection; import net.sf.jftp.util.Log; import net.sf.jftp.util.Logger; import net.sf.jftp.config.Settings; import java.io.*; // this class download a file via anonymous ftp and shows output. // // if you want to use the api in a more complex way, please do at least take a look at the // FtpConnection, FtpTransfer, ConnectionHandler, DirPanel (blockedTransfer, transfer) // and ConnectionListener sourcecode. public class FtpDownload implements Logger, ConnectionListener { // is the connection established? private boolean isThere = false; public static long time = 0; // connection pool, not necessary but you should take a look at this class // if you want to use multiple event based ftp transfers. private ConnectionHandler handler = new ConnectionHandler(); //creates a FtpConnection and downloads a file public FtpDownload(String host, String file) { // the ftp client default is very small, you may want to increase this Settings.bufferSize = 16384; long current = System.currentTimeMillis(); //System.out.println("1) "+(System.currentTimeMillis()-current)+"ms."); // register app as Logger, debug() and debugRaw below are from now on called by // FtpConnection Log.setLogger(this); // create a FtpConnection - note that it does *not* connect instantly FtpConnection con = new FtpConnection(host); //System.out.println("2) "+(System.currentTimeMillis()-current)+"ms."); // set updatelistener, interface methods are below con.addConnectionListener(this); // set handler con.setConnectionHandler(handler); // connect and login. this is from where connectionFailed() may be called for example con.login("cdemon","........"); //System.out.println("3) "+(System.currentTimeMillis()-current)+"ms."); // login calls connectionInitialized() below which sets isThere to true while(!isThere) { try { Thread.sleep(10); } catch(Exception ex) { ex.printStackTrace(); } } //System.out.println("4) "+(System.currentTimeMillis()-current)+"ms."); // download the file - this method blocks until the download has finished // if you want non-blocking, multithreaded io, just use // // con.handleDownload(file); // // which spawns a new thread for the download con.download(file); time = (System.currentTimeMillis()-current); System.out.println("Download took "+time+"ms."); } // download welcome.msg from sourceforge or any other given file public static void main(String argv[]) { if(argv.length < 2) { //FtpDownload f = new FtpDownload("ftp.kernel.org", "/welcome.msg"); long x = 0; for(int i=0;i<5;i++) { FtpDownload f = new FtpDownload("localhost", "dsm.pdf"); x += f.time; } System.out.println("5 runs took "+x+" ms, "+(long) x/5+" ms average."); } else { FtpDownload f = new FtpDownload(argv[0], argv[1]); } } // ------------------ needed by ConnectionListener interface ----------------- // called if the remote directory has changed public void updateRemoteDirectory(BasicConnection con) { System.out.println("new path is: " + con.getPWD()); } // called if a connection has been established public void connectionInitialized(BasicConnection con) { isThere = true; } // called every few kb by DataConnection during the trnsfer (interval can be changed in Settings) public void updateProgress(String file, String type, long bytes) {} // called if connection fails public void connectionFailed(BasicConnection con, String why) {System.out.println("connection failed!");} // up- or download has finished public void actionFinished(BasicConnection con) {} // ------------ needed by Logger interface -------------- // main log method public void debug(String msg) {} //{System.out.println(msg);} // rarely used public void debugRaw(String msg) {}//System.out.print(msg);} // methods below are not used yet. public void debug(String msg, Throwable throwable) {} public void warn(String msg) {} public void warn(String msg, Throwable throwable) {} public void error(String msg) {} public void error(String msg, Throwable throwable) {} public void info(String msg) {} public void info(String msg, Throwable throwable) {} public void fatal(String msg) {} public void fatal(String msg, Throwable throwable) {} } jftp-1.52.orig/doc/applet.html0000700000175000017500000000037511112477766015345 0ustar varunvarun

JFtp should start soon...

Watch your java console log if the application does not start correctly.



Sorry, no java found jftp-1.52.orig/doc/FtpUpload.java~0000700000175000017500000000417211142554026016114 0ustar varunvarunimport net.sf.jftp.net.ConnectionHandler; import net.sf.jftp.net.ConnectionListener; import net.sf.jftp.net.DataConnection; import net.sf.jftp.net.FtpConnection; import net.sf.jftp.net.BasicConnection; import net.sf.jftp.util.Log; import net.sf.jftp.util.Logger; import net.sf.jftp.config.Settings; import java.io.*; /** * See FtpDownload.java for comments. */ public class FtpUpload implements Logger, ConnectionListener { private boolean isThere = false; private ConnectionHandler handler = new ConnectionHandler(); public FtpUpload(String host, String dir, String file) { Log.setLogger(this); FtpConnection con = new FtpConnection(host); con.addConnectionListener(this); con.setConnectionHandler(handler); con.login("anonymous","no@no.no"); while(!isThere) { try { Thread.sleep(10); } catch(Exception ex) { ex.printStackTrace(); } } con.chdir(dir); con.upload(file); } public static void main(String argv[]) { if(argv.length == 3) { FtpUpload f = new FtpUpload(argv[0], argv[2], argv[1]); } else { FtpUpload g = new FtpUpload("upload.sourceforge.net", "/incoming", "test.txt"); } } public void updateRemoteDirectory(BasicConnection con) { System.out.println("new path is: " + con.getPWD()); } public void connectionInitialized(BasicConnection con) { isThere = true; } public void updateProgress(String file, String type, long bytes) {} public void connectionFailed(BasicConnection con, String why) {System.out.println("connection failed!");} public void actionFinished(BasicConnection con) {} public void debug(String msg) {System.out.println(msg);} public void debugRaw(String msg) {System.out.print(msg);} public void debug(String msg, Throwable throwable) {} public void warn(String msg) {} public void warn(String msg, Throwable throwable) {} public void error(String msg) {} public void error(String msg, Throwable throwable) {} public void info(String msg) {} public void info(String msg, Throwable throwable) {} public void fatal(String msg) {} public void fatal(String msg, Throwable throwable) {} } jftp-1.52.orig/doc/build.sh0000700000175000017500000000014011112477766014613 0ustar varunvarun#!/bin/bash export CLASSPATH=$CLASSPATH:../build/jars/jftp.jar javac *.java java FtpDownload jftp-1.52.orig/doc/jftp.jnlp0000700000175000017500000000145711264337654015023 0ustar varunvarun JFtp http://www.sourceforge.net/projects/j-ftp Java FTP client jftp-1.52.orig/doc/FtpDownload.java0000700000175000017500000001064611142553764016254 0ustar varunvarunimport net.sf.jftp.net.ConnectionHandler; import net.sf.jftp.net.ConnectionListener; import net.sf.jftp.net.DataConnection; import net.sf.jftp.net.FtpConnection; import net.sf.jftp.net.BasicConnection; import net.sf.jftp.system.logging.Log; import net.sf.jftp.system.logging.Logger; import net.sf.jftp.config.Settings; import java.io.*; // this class download a file via anonymous ftp and shows output. // // if you want to use the api in a more complex way, please do at least take a look at the // FtpConnection, FtpTransfer, ConnectionHandler, DirPanel (blockedTransfer, transfer) // and ConnectionListener sourcecode. public class FtpDownload implements Logger, ConnectionListener { // is the connection established? private boolean isThere = false; public static long time = 0; // connection pool, not necessary but you should take a look at this class // if you want to use multiple event based ftp transfers. private ConnectionHandler handler = new ConnectionHandler(); //creates a FtpConnection and downloads a file public FtpDownload(String host, String file) { // the ftp client default is very small, you may want to increase this Settings.bufferSize = 16384; long current = System.currentTimeMillis(); //System.out.println("1) "+(System.currentTimeMillis()-current)+"ms."); // register app as Logger, debug() and debugRaw below are from now on called by // FtpConnection Log.setLogger(this); // create a FtpConnection - note that it does *not* connect instantly FtpConnection con = new FtpConnection(host); //System.out.println("2) "+(System.currentTimeMillis()-current)+"ms."); // set updatelistener, interface methods are below con.addConnectionListener(this); // set handler con.setConnectionHandler(handler); // connect and login. this is from where connectionFailed() may be called for example con.login("cdemon","........"); //System.out.println("3) "+(System.currentTimeMillis()-current)+"ms."); // login calls connectionInitialized() below which sets isThere to true while(!isThere) { try { Thread.sleep(10); } catch(Exception ex) { ex.printStackTrace(); } } //System.out.println("4) "+(System.currentTimeMillis()-current)+"ms."); // download the file - this method blocks until the download has finished // if you want non-blocking, multithreaded io, just use // // con.handleDownload(file); // // which spawns a new thread for the download con.download(file); time = (System.currentTimeMillis()-current); System.out.println("Download took "+time+"ms."); } // download welcome.msg from sourceforge or any other given file public static void main(String argv[]) { if(argv.length < 2) { //FtpDownload f = new FtpDownload("ftp.kernel.org", "/welcome.msg"); long x = 0; for(int i=0;i<5;i++) { FtpDownload f = new FtpDownload("localhost", "dsm.pdf"); x += f.time; } System.out.println("5 runs took "+x+" ms, "+(long) x/5+" ms average."); } else { FtpDownload f = new FtpDownload(argv[0], argv[1]); } } // ------------------ needed by ConnectionListener interface ----------------- // called if the remote directory has changed public void updateRemoteDirectory(BasicConnection con) { System.out.println("new path is: " + con.getPWD()); } // called if a connection has been established public void connectionInitialized(BasicConnection con) { isThere = true; } // called every few kb by DataConnection during the trnsfer (interval can be changed in Settings) public void updateProgress(String file, String type, long bytes) {} // called if connection fails public void connectionFailed(BasicConnection con, String why) {System.out.println("connection failed!");} // up- or download has finished public void actionFinished(BasicConnection con) {} // ------------ needed by Logger interface -------------- // main log method public void debug(String msg) {} //{System.out.println(msg);} // rarely used public void debugRaw(String msg) {}//System.out.print(msg);} // methods below are not used yet. public void debug(String msg, Throwable throwable) {} public void warn(String msg) {} public void warn(String msg, Throwable throwable) {} public void error(String msg) {} public void error(String msg, Throwable throwable) {} public void info(String msg) {} public void info(String msg, Throwable throwable) {} public void fatal(String msg) {} public void fatal(String msg, Throwable throwable) {} } jftp-1.52.orig/doc/bookmarks.txt0000700000175000017500000000177211112477766015725 0ustar varunvarun# JFtp Bookmark Configuration file # # Syntax: protocol#host#user#password#port#dir/domain#local # # Note: not all values are used by every connection, but all fields must contain at least # one character. # # protocol: FTP, SFTP, SMB or NFS (uppercase) # host: hostname or ip for ftp + sftp, valid url for smb + nfs ("(LAN)" for smb lan browsing) # user, password: the login data # port: this must be a number (even if it is not used for smb+nfs, set it in the url for nfs) # dir/domain: inital directory for the connection, domainname for smb # local: "true" if connection should be opened in local tab, "false" otherwise # # directories must be included in tags and can be ended unsing a single # tag # JFtp FTP#upload.sourceforge.net#anonymous#j-ftp@sf.net#21#/incoming#false Other Linux FTP#ftp.kernel.org#anonymous#j-ftp@sf.net#21#/pub/linux/kernel/v2.6#false Lan SMB#(LAN)#guest#guest#-1#-#false jftp-1.52.orig/doc/Grapher.java0000700000175000017500000001223111112477766015417 0ustar varunvarunimport java.io.*; import java.net.*; import java.util.*; import java.awt.*; import javax.swing.*; public class Grapher extends Canvas { public String files[] = new String[] {"JFtp.java", "LoadSet.java","EventCollector.java", "EventProcessor.java", "FtpEvent.java","DirCellRenderer.java","DirPanel.java", "Displayer.java","HostChooser.java","HostList.java","Properties.java","Updater.java","GUIDefaults.java","HPasswordField.java", "DataConnection.java","FtpClient.java","FtpConnection.java","FtpConstants.java","FtpServerSocket.java","FtpURLConnection.java", "FtpURLStreamHandler.java","JConnection.java","LocalIO.java","Log.java","Log4JLogger.java","Logger.java","SystemLogger.java", "CommandLine.java","SaveSet.java","Settings.java","Acceptor.java","Event.java","EventHandler.java","FtpEventConstants.java", "FtpEventHandler.java","AutoRemover.java","Creator.java","DirCanvas.java","DirEntry.java","DirLister.java","DownloadList.java", "LoadPanel.java","PathChanger.java","RemoteCommand.java","Remover.java","RemoverQuery.java","ResumeDialog.java", "StatusCanvas.java","StatusPanel.java","Template.java","HFrame.java","HImage.java","HImageButton.java","HPanel.java", "HTextField.java","ConnectionHandler.java","ConnectionListener.java","FtpServer.java","Transfer.java","StringUtils.java" }; public String prefix = "/home/cdemon/JFtp/j-ftp/src/java/net/sf/jftp/"; public String[] paths = new String[] { prefix, prefix+"gui/", prefix+"net/", prefix+"util/", prefix+"config/", prefix+"gui/framework", prefix+"event/" }; public Hashtable table = new Hashtable(); public Hashtable pool = new Hashtable(); public static int width = 800; public static int height = 600; public Grapher() { setSize(width,height); try { for(int i=0; i 0) table.put(files[i] + ":" +files[j].substring(0, files[j].indexOf(".java")), new String(""+x)); } } } show(); repaint(); } catch(Exception ex) { ex.printStackTrace(); } } public void paint(Graphics g) { // init g.setColor(Color.white); g.fillRect(0,0,getSize().width, getSize().height); g.setColor(Color.blue); g.setFont(new Font("serif", Font.BOLD, 14)); // points Random r = new Random(); for(int i=0; i " + "(" + link + ")" + " - " + x); Point x2 = (Point) pool.get(file); if(x2 == null) continue; if(x > 0) { //for(int y=0; y 255) color = 255; g.setColor(new Color(color,color,color)); if(color < 255) g.drawLine(((int)p.getX()+20),((int)p.getY()+15),((int)x2.getX()+20),((int)x2.getY()+15)); //} } } } public boolean check(int x, int y) { Enumeration e = pool.elements(); Point d = null; int a; int b; while(e.hasMoreElements()) { d = (Point) e.nextElement(); a = (int) d.getX(); b = (int) d.getY(); if(a > x-100 && a < x+100) { if(b > y-20 && b < y +20) { return false; } } } return true; } public int countRelations(File f, String what) throws IOException { int x = 0; String tmp; what = what.substring(0, what.indexOf(".java")); URL url = f.toURL(); DataInputStream in = new DataInputStream(new BufferedInputStream(url.openStream())); while(true) { tmp = in.readLine(); //System.out.println(f.getAbsolutePath() + ": " + tmp + ": " +what); if(tmp == null) break; if(tmp.indexOf(what) >= 0) x++; } in.close(); return x; } public File getFile(String name) { for(int i=0; i jftp-1.52.orig/run0000700000175000017500000000020411112477770013136 0ustar varunvarun#!/bin/bash dir=`dirname $0` cd $dir/build if test -z "$1" ; then java -jar jars/jftp.jar else java -jar jars/jftp.jar "$1" fi jftp-1.52.orig/.classpath0000700000175000017500000000057711155275743014412 0ustar varunvarun jftp-1.52.orig/LICENSE0000700000175000017500000004325411112477770013430 0ustar varunvarun GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 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 Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License.