|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnl.tue.id.tim.FileTransfer
TIM File Transfer plugin for JBother.
Description: This plugin uses a simple http server for transfering files.
it monitors incoming and outgoing messages and reacts on those that started
with "/file". A "/file" message is expected to come with a url that links to
a file. The sender first upload selected file to the root of the http server
(a cache under the users profile directory), then form a url to this file,
send a "/file [url]" to the buddy in conversation. The receiver get the url
from the message, download the file and send a confirmation message back to
the sender.
This plugin also addes a file transfer button to chat panels.
Copyright: Copyright (c) 2005 Jun Hu
Company: ID, TU/e
Field Summary | |
private java.util.ResourceBundle |
resources
i18n translation resources. |
(package private) java.lang.String |
root
root directory of the simple http server. |
(package private) HttpServer |
server
a simple http server for tranfering files. |
Constructor Summary | |
FileTransfer()
|
Method Summary | |
private void |
conversationHandler(com.valhalla.jbother.plugins.events.ConversationEvent pluginEvent)
conversationHandler processes the conversation events from ChatPanels. |
private void |
copy(java.io.File src,
java.io.File dst)
copy one file to another. no worning if the destination file exists. use it with care. |
void |
downloadFile(java.lang.String f,
com.valhalla.jbother.ChatPanel chat)
download the file, when finish send a confirmation message to the butty in chat. |
void |
handleEvent(com.valhalla.pluginmanager.PluginEvent pluginEvent)
This is the event handling interface defined in JBother Plugin. |
boolean |
init()
Initiate the plugin. |
void |
unload()
Unloads the plugin. remove this plugin from the PluginChain, stop the web server, remove file transfer buttons from ChatPanels. |
java.lang.String |
uploadFile()
uploadFile the file will be uploaded to a cahce directory that serves as http root. the cache directory is named "cache" under the current user's profile All the uploaded files will be removed when the virtual machine terminates. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private java.util.ResourceBundle resources
HttpServer server
java.lang.String root
Constructor Detail |
public FileTransfer()
Method Detail |
public boolean init()
init
in interface com.valhalla.pluginmanager.Plugin
public void unload()
unload
in interface com.valhalla.pluginmanager.Plugin
public void handleEvent(com.valhalla.pluginmanager.PluginEvent pluginEvent)
handleEvent
in interface com.valhalla.pluginmanager.PluginEventListener
pluginEvent
- PluginEventprivate void conversationHandler(com.valhalla.jbother.plugins.events.ConversationEvent pluginEvent)
pluginEvent
- ConversationEventpublic java.lang.String uploadFile()
public void downloadFile(java.lang.String f, com.valhalla.jbother.ChatPanel chat) throws java.io.IOException
f
- String, the url link to the file to download. If the url is
malformed, nothing will happen.chat
- ChatPanel, to which the confirmation message will be sent.
java.io.IOException
- IOException, if anything wrong during downloading, an
IOException will be thrown.private void copy(java.io.File src, java.io.File dst) throws java.io.IOException
src
- Filedst
- File
java.io.IOException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |