Commons HTTPClinet 2.0.1 update.

Added automated backup for the data file.
This commit is contained in:
Erik C. Thauvin 2004-08-03 08:07:45 +00:00
parent 2386906e33
commit 2f11c58c62
7 changed files with 452 additions and 176 deletions

View file

@ -20,11 +20,11 @@
</target>
<target name="compile" depends="init" description="Compiles sources">
<mkdir dir="${path.classes}" />
<javac sourcepathref="path.source" classpathref="path.class" destdir="${path.classes}" debug="off" deprecation="on">
<javac sourcepathref="path.source" classpathref="path.class" destdir="${path.classes}" debug="on" deprecation="on">
<src refid="path.source" />
</javac>
</target>
<target name="build" depends="compile" description="Rebuilds project" />
<target name="build" depends="clean,jar" description="Rebuilds project" />
<target name="jar" depends="compile" description="Builds the JAR">
<copy todir="${path.classes}">
<fileset dir="${path.src}" includes="*.properties" />

Binary file not shown.

Binary file not shown.

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<module version="4" relativePaths="false">
<module version="4" relativePaths="false" type="JAVA_MODULE">
<component name="ModuleRootManager" />
<component name="NewModuleRootManager">
<output url="file://$MODULE_DIR$/build" />
@ -81,15 +81,6 @@
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/lib/jweather-0.2.3.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
@ -117,24 +108,6 @@
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/lib/commons-net-1.1.0.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/lib/commons-httpclient-2.0-final.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
@ -153,6 +126,34 @@
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/lib/jweather-0.2.5.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/lib/commons-net-1.2.2.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/lib/commons-httpclient-2.0.1.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntryProperties />
</component>
</module>

View file

@ -1,21 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4" relativePaths="false">
<component name="AntConfiguration">
<defaultAnt bundledAnt="true" />
<buildFile url="file://$PROJECT_DIR$/build.xml">
<useEmacsModeOutput value="true" />
<additionalClassPath />
<antReference projectDefault="true" />
<customJdkName value="" />
<maximumHeapSize value="128" />
<useCustomJdk value="false" />
<useJavaw value="false" />
<includeProjectClasspath value="false" />
<includeParser value="true" />
<properties />
</buildFile>
</component>
<component name="BSFConsole">
<sendcommandbycontrolenter>false</sendcommandbycontrolenter>
<restoresystemstreams>false</restoresystemstreams>
<outwaitsforerr>false</outwaitsforerr>
<errwaitsforout>false</errwaitsforout>
<storedupsinrecentcommands>false</storedupsinrecentcommands>
<moduleforclasspath />
<includeoutputpath>false</includeoutputpath>
<includetestsoutputpath>false</includetestsoutputpath>
<languages>
<language name="ant" engine="org.kos.bsfconsoleplugin.AntConsoleBSFEngine" />
<language name="ant" engine="org.kos.bsfconsoleplugin.languages.AntConsoleBSFEngine" />
<language name="beanshell" engine="bsh.util.BeanShellBSFEngine" />
<language name="netrexx" engine="org.apache.bsf.engines.netrexx.NetRexxEngine" />
<language name="xslt" engine="org.apache.bsf.engines.xslt.XSLTEngine" />
@ -38,6 +43,9 @@
<language name="vbscript" engine="org.apache.bsf.engines.activescript.ActiveScriptEngine" />
</languages>
<startupscripts />
<preferredrecentcommandsdividerlocations>
<dividerlocationd language="beanshell" position="939" />
</preferredrecentcommandsdividerlocations>
<BSFConsoleSearchOptions searchfromcursor="false">
<recentsearches />
</BSFConsoleSearchOptions>
@ -49,12 +57,26 @@
<component name="CompilerConfiguration">
<option name="DEFAULT_COMPILER" value="Javac" />
<option name="CLEAR_OUTPUT_DIRECTORY" value="false" />
<option name="DEPLOY_AFTER_MAKE" value="0" />
<resourceExtensions>
<entry name=".+\.(properties|xml|html|dtd|tld)" />
<entry name=".+\.(gif|png|jpeg|jpg)" />
</resourceExtensions>
<wildcardResourcePatterns>
<entry name="?*.properties" />
<entry name="?*.xml" />
<entry name="?*.html" />
<entry name="?*.dtd" />
<entry name="?*.tld" />
<entry name="?*.gif" />
<entry name="?*.png" />
<entry name="?*.jpeg" />
<entry name="?*.jpg" />
</wildcardResourcePatterns>
</component>
<component name="DataSourceManager" />
<component name="DataSourceManagerImpl" />
<component name="DependencyValidationManager" />
<component name="EntryPointsManager">
<entry_points />
</component>
@ -96,19 +118,130 @@
<option name="IS_EMACS_ERRORS_MODE" value="true" />
<option name="ADDITIONAL_OPTIONS_STRING" value="" />
</component>
<component name="Palette2">
<group name="Swing">
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.png" removable="false">
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
</item>
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.png" removable="false">
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
</item>
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.png" removable="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
</item>
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.png" removable="false">
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
</item>
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.png" removable="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
<initial-values>
<property name="text" value="Button" />
</initial-values>
</item>
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.png" removable="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
<initial-values>
<property name="text" value="RadioButton" />
</initial-values>
</item>
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.png" removable="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
<initial-values>
<property name="text" value="CheckBox" />
</initial-values>
</item>
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.png" removable="false">
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
<initial-values>
<property name="text" value="Label" />
</initial-values>
</item>
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.png" removable="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.png" removable="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.png" removable="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.png" removable="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.png" removable="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.png" removable="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.png" removable="false">
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
</item>
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.png" removable="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.png" removable="false">
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.png" removable="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.png" removable="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
<preferred-size width="200" height="200" />
</default-constraints>
</item>
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.png" removable="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
<preferred-size width="200" height="200" />
</default-constraints>
</item>
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.png" removable="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
</item>
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.png" removable="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
</item>
</group>
</component>
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/mobibot.iml" filepath="$PROJECT_DIR$/mobibot.iml" />
</modules>
</component>
<component name="ProjectRootManager" version="2" assert-keyword="false" project-jdk-name="1.4.x" />
<component name="ProjectRootManager" version="2" assert-keyword="false" jdk-15="false" project-jdk-name="1.4.x" />
<component name="Regex">
<option name="pos1" value="218" />
<option name="pos2" value="218" />
<option name="pos3" value="116" />
<option name="pos4" value="444" />
<option name="pos5" value="117" />
<option name="pos6" value="707" />
<option name="autoUpdate" value="true" />
</component>
<component name="RmicSettings">
<option name="IS_EANABLED" value="false" />
<option name="DEBUGGING_INFO" value="true" />
<option name="GENERATE_NO_WARNINGS" value="false" />
<option name="GENERATE_IIOP_STUBS" value="false" />
<option name="ADDITIONAL_OPTIONS_STRING" value="" />
</component>
<component name="libraryTable" />
<component name="uidesigner-configuration">

View file

@ -11,6 +11,7 @@
<component name="CompilerWorkspaceConfiguration">
<option name="COMPILE_IN_BACKGROUND" value="false" />
<option name="AUTO_SHOW_ERRORS_IN_EDITOR" value="true" />
<option name="CLOSE_MESSAGE_VIEW_IF_SUCCESS" value="true" />
</component>
<component name="Cvs2Configuration">
<option name="ON_FILE_ADDING" value="0" />
@ -62,6 +63,11 @@
<option name="REMOVE_WATCH_INDEX" value="0" />
<option name="UPDATE_KEYWORD_SUBSTITUTION" />
<option name="MAKE_NEW_FILES_READONLY" value="false" />
<option name="SHOW_CORRUPTED_PROJECT_FILES" value="0" />
<option name="TAG_AFTER_FILE_COMMIT" value="false" />
<option name="TAG_AFTER_FILE_COMMIT_NAME" value="" />
<option name="TAG_AFTER_PROJECT_COMMIT" value="false" />
<option name="TAG_AFTER_PROJECT_COMMIT_NAME" value="" />
<option name="PUT_FOCUS_INTO_COMMENT" value="false" />
<option name="SHOW_CHECKIN_OPTIONS" value="true" />
<option name="FORCE_NON_EMPTY_COMMENT" value="false" />
@ -75,6 +81,7 @@
<option name="FILE_HISTORY_DIALOG_COMMENTS_SPLITTER_PROPORTION" value="0.8" />
<option name="FILE_HISTORY_DIALOG_SPLITTER_PROPORTION" value="0.5" />
</component>
<component name="CvsTabbedWindow" />
<component name="DaemonCodeAnalyzer">
<disable_hints />
</component>
@ -88,13 +95,13 @@
<option name="SUSPEND_VM" value="true" />
<option name="LOG_ENABLED" value="false" />
<option name="LOG_EXPRESSION_ENABLED" value="false" />
<option name="LOG_MESSAGE" value="" />
<option name="COUNT_FILTER_ENABLED" value="false" />
<option name="COUNT_FILTER" value="0" />
<option name="CONDITION_ENABLED" value="false" />
<option name="CONDITION" value="" />
<option name="CLASS_FILTERS_ENABLED" value="false" />
<option name="INSTANCE_FILTERS_ENABLED" value="false" />
<option name="myCondition" value="" />
<option name="myLogMessage" value="" />
</breakpoint_any>
</exception_breakpoints>
<field_breakpoints />
@ -108,16 +115,23 @@
<first-group selected-file="file://$PROJECT_DIR$/src/net/thauvin/erik/mobibot/Mobibot.java">
<entry file="file://$PROJECT_DIR$/src/net/thauvin/erik/mobibot/Mobibot.java" pinned="false">
<provider selected="true" editor-type-id="text-editor">
<state line="2291" column="12" selection-start="55270" selection-end="55270" vertical-scroll-proportion="0.28818443">
<state line="63" column="65" selection-start="2257" selection-end="2257" vertical-scroll-proportion="0.8733945">
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/build.xml" pinned="false">
<provider selected="true" editor-type-id="text-editor">
<state line="26" column="4" selection-start="884" selection-end="884" vertical-scroll-proportion="0.81100917">
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/net/thauvin/erik/mobibot/StockQuote.java" pinned="false">
<provider selected="true" editor-type-id="text-editor">
<state line="53" column="13" selection-start="2037" selection-end="2037" vertical-scroll-proportion="0.8818444">
<state line="53" column="13" selection-start="2037" selection-end="2037" vertical-scroll-proportion="0.5614679">
<folding>
<element signature="imports" expanded="true" />
</folding>
@ -126,7 +140,7 @@
</entry>
<entry file="file://$PROJECT_DIR$/src/net/thauvin/erik/mobibot/CurrencyConverter.java" pinned="false">
<provider selected="true" editor-type-id="text-editor">
<state line="63" column="13" selection-start="2150" selection-end="2150" vertical-scroll-proportion="1.1613833">
<state line="151" column="87" selection-start="4160" selection-end="4231" vertical-scroll-proportion="1.0899082">
<folding>
<element signature="imports" expanded="true" />
</folding>
@ -135,21 +149,21 @@
</entry>
<entry file="file://$PROJECT_DIR$/src/net/thauvin/erik/mobibot/Weather.java" pinned="false">
<provider selected="true" editor-type-id="text-editor">
<state line="122" column="34" selection-start="3500" selection-end="3507" vertical-scroll-proportion="1.7118156">
<state line="173" column="12" selection-start="4757" selection-end="4757" vertical-scroll-proportion="1.0899082">
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/net/thauvin/erik/mobibot/GoogleSearch.java" pinned="false">
<provider selected="true" editor-type-id="text-editor">
<state line="156" column="131" selection-start="4367" selection-end="4371" vertical-scroll-proportion="1.7118156">
<state line="157" column="108" selection-start="4458" selection-end="4458" vertical-scroll-proportion="1.0623853">
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/net/thauvin/erik/mobibot/FeedReader.java" pinned="false">
<provider selected="true" editor-type-id="text-editor">
<state line="141" column="26" selection-start="3819" selection-end="3826" vertical-scroll-proportion="1.2103746">
<state line="151" column="53" selection-start="4082" selection-end="4082" vertical-scroll-proportion="1.0477064">
<folding>
<element signature="imports" expanded="true" />
</folding>
@ -158,7 +172,7 @@
</entry>
<entry file="file://$PROJECT_DIR$/src/net/thauvin/erik/mobibot/EntryLink.java" pinned="false">
<provider selected="true" editor-type-id="text-editor">
<state line="55" column="13" selection-start="2034" selection-end="2034" vertical-scroll-proportion="0.9033149">
<state line="55" column="13" selection-start="2034" selection-end="2034" vertical-scroll-proportion="0.6238532">
<folding>
<element signature="imports" expanded="true" />
</folding>
@ -167,7 +181,7 @@
</entry>
<entry file="file://$PROJECT_DIR$/src/net/thauvin/erik/mobibot/EntryComment.java" pinned="false">
<provider selected="true" editor-type-id="text-editor">
<state line="53" column="13" selection-start="2016" selection-end="2016" vertical-scroll-proportion="0.8453039">
<state line="53" column="13" selection-start="2016" selection-end="2016" vertical-scroll-proportion="0.5614679">
<folding>
<element signature="imports" expanded="true" />
</folding>
@ -188,24 +202,26 @@
<profile name="Erik's Inspection Profile" />
</component>
<component name="J2EEProjectPane" />
<component name="NamedScopeManager" />
<component name="PackagesPane">
<expanded_node url="net.thauvin.erik.mobibot" module="mobibot" type="package" />
<expanded_node url="net.thauvin.erik" module="mobibot" type="package" />
<expanded_node url="" module="mobibot" type="module" />
<expanded_node url="net" module="mobibot" type="package" />
<expanded_node url="net.thauvin" module="mobibot" type="package" />
<expanded_node url="net" module="mobibot" type="package" />
<expanded_node url="net.thauvin.erik.mobibot" module="mobibot" type="package" />
</component>
<component name="ProjectPane">
<expanded_node url="file://$PROJECT_DIR$/src/net/thauvin/erik/mobibot" module="mobibot" type="directory" />
<expanded_node url="file://$PROJECT_DIR$/src/net/thauvin" module="mobibot" type="directory" />
<expanded_node url="file://$PROJECT_DIR$" module="mobibot" type="directory" />
<expanded_node url="file://$PROJECT_DIR$/src/net/thauvin/erik" module="mobibot" type="directory" />
<expanded_node url="file://$PROJECT_DIR$" module="mobibot" type="directory" />
<expanded_node url="file://$PROJECT_DIR$/src" module="mobibot" type="directory" />
<expanded_node url="" module="mobibot" type="module" />
<expanded_node url="file://$PROJECT_DIR$/src/net" module="mobibot" type="directory" />
<expanded_node url="" module="mobibot" type="module" />
<expanded_node url="file://$PROJECT_DIR$/src/net/thauvin/erik/mobibot" module="mobibot" type="directory" />
<expanded_node url="file://$PROJECT_DIR$/lib" module="mobibot" type="directory" />
<expanded_node url="file://$PROJECT_DIR$/src/net/thauvin" module="mobibot" type="directory" />
</component>
<component name="ProjectView">
<navigator currentView="PackagesPane" splitterProportion="0.5">
<navigator currentView="ProjectPane" splitterProportion="0.5">
<flattenPackages />
<showMembers />
<showModules />
@ -213,6 +229,7 @@
<hideEmptyPackages />
<showStructure PackagesPane="false" ProjectPane="false" />
<autoscrollToSource />
<autoscrollFromSource />
</navigator>
</component>
<component name="PropertiesComponent">
@ -226,24 +243,7 @@
</component>
<component name="RunManager">
<activeType name="Application" />
<configuration name="&lt;template&gt;" type="Application" default="true" selected="false">
<option name="MAIN_CLASS_NAME" />
<option name="VM_PARAMETERS" />
<option name="PROGRAM_PARAMETERS" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
<module name="" />
</configuration>
<configuration name="&lt;template&gt;" type="Applet" default="true" selected="false">
<module name="" />
<option name="MAIN_CLASS_NAME" />
<option name="HTML_FILE_NAME" />
<option name="HTML_USED" value="false" />
<option name="WIDTH" value="400" />
<option name="HEIGHT" value="300" />
<option name="POLICY_FILE" value="C:/IntelliJ-IDEA/bin/appletviewer.policy" />
<option name="VM_PARAMETERS" />
</configuration>
<configuration name="&lt;template&gt;" type="JUnit" default="true" selected="false">
<configuration selected="false" default="true" type="JUnit" factoryName="JUnit">
<module name="" />
<option name="PACKAGE_NAME" />
<option name="MAIN_CLASS_NAME" />
@ -253,25 +253,49 @@
<option name="PARAMETERS" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
<option name="ADDITIONAL_CLASS_PATH" />
<option name="TEST_SEARCH_SCOPE">
<value defaultName="wholeProject" />
</option>
</configuration>
<configuration name="&lt;template&gt;" type="Remote" default="true" selected="false">
<configuration selected="false" default="true" type="Application" factoryName="Application">
<option name="MAIN_CLASS_NAME" />
<option name="VM_PARAMETERS" />
<option name="PROGRAM_PARAMETERS" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
<module name="" />
</configuration>
<configuration selected="false" default="true" type="WebLogic Instance" factoryName="Local">
<option name="WORKING_DIRECTORY" />
<option name="HOST" value="localhost" />
<option name="PORT" value="7001" />
<option name="LOCAL" value="true" />
<option name="OPEN_IN_BROWSER" value="true" />
<option name="OPEN_IN_BROWSER_URL" value="/" />
<option name="COMMON_VM_ARGUMENTS" value="" />
<option name="DOMAIN_PATH" value="" />
<option name="USER" value="weblogic" />
<option name="PASSWORD" value="weblogic" />
<option name="SERVER_NAME" value="myserver" />
<option name="DOMAIN_NAME" value="mydomain" />
</configuration>
<configuration selected="false" default="true" type="Applet" factoryName="Applet">
<module name="" />
<option name="MAIN_CLASS_NAME" />
<option name="HTML_FILE_NAME" />
<option name="HTML_USED" value="false" />
<option name="WIDTH" value="400" />
<option name="HEIGHT" value="300" />
<option name="POLICY_FILE" value="C:/IntelliJ-IDEA/bin/appletviewer.policy" />
<option name="VM_PARAMETERS" />
</configuration>
<configuration selected="false" default="true" type="Remote" factoryName="Remote">
<option name="USE_SOCKET_TRANSPORT" value="true" />
<option name="SERVER_MODE" value="false" />
<option name="SHMEM_ADDRESS" value="javadebug" />
<option name="HOST" value="localhost" />
<option name="PORT" value="5005" />
</configuration>
<configuration name="&lt;template&gt;" type="WebApp" default="true" selected="false">
<module name="" />
<WebServerIntegration name="" />
<Host>localhost</Host>
<Port>5050</Port>
<LaunchServer>false</LaunchServer>
</configuration>
<configuration name="&lt;template&gt;" type="WebLogic Instance" default="true" selected="false">
<setting name="WEBLOGIC_INSTANCE_CONFIGURATION_NAME" value="" />
</configuration>
<configuration name="Mobibot" type="Application" default="false" selected="true">
<configuration selected="true" default="false" name="Mobibot" type="Application" factoryName="Application">
<option name="MAIN_CLASS_NAME" value="net.thauvin.erik.mobibot.Mobibot" />
<option name="VM_PARAMETERS" value="" />
<option name="PROGRAM_PARAMETERS" value="-d -s mobibot2.ser" />
@ -307,6 +331,7 @@
<option name="FILE_HISTORY_DIALOG_COMMENTS_SPLITTER_PROPORTION" value="0.8" />
<option name="FILE_HISTORY_DIALOG_SPLITTER_PROPORTION" value="0.5" />
</component>
<component name="StructuralSearchPlugin" />
<component name="StructureViewFactory">
<option name="SORT_MODE" value="0" />
<option name="GROUP_INHERITED" value="true" />
@ -330,18 +355,20 @@
</todo-panel>
</component>
<component name="ToolWindowManager">
<frame x="-4" y="-4" width="1032" height="776" extended-state="1" />
<frame x="-4" y="-4" width="1032" height="776" extended-state="0" />
<editor active="false" />
<layout>
<window_info id="Properties File Structure" active="false" anchor="right" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.33" order="5" />
<window_info id="CVS" active="false" anchor="bottom" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.33024693" order="8" />
<window_info id="Regex" active="false" anchor="bottom" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.44135803" order="10" x="22" y="277" width="980" height="214" />
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.33024693" order="7" />
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.29897958" order="0" />
<window_info id="Project" active="true" anchor="left" auto_hide="false" internal_type="docked" type="docked" visible="true" weight="0.35" order="0" />
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.33024693" order="1" />
<window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.22857143" order="1" />
<window_info id="Messages" active="true" anchor="bottom" auto_hide="false" internal_type="docked" type="docked" visible="true" weight="0.33024693" order="9" />
<window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.20816326" order="1" />
<window_info id="Messages" active="false" anchor="bottom" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.33024693" order="9" />
<window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.39969134" order="6" />
<window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="docked" type="docked" visible="true" weight="0.13979591" order="1" />
<window_info id="Dependency Viewer" active="false" anchor="bottom" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.33" order="-1" />
<window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="docked" type="docked" visible="true" weight="0.08877551" order="1" />
<window_info id="Run" active="false" anchor="bottom" auto_hide="true" internal_type="docked" type="docked" visible="false" weight="0.39660493" order="2" x="22" y="277" width="980" height="213" />
<window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.25" order="2" />
<window_info id="CVS File View" active="false" anchor="right" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.33" order="3" />
@ -349,6 +376,7 @@
<window_info id="BSFConsole" active="false" anchor="bottom" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.33024693" order="11" />
<window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="sliding" type="sliding" visible="false" weight="0.4" order="0" />
<window_info id="Web" active="false" anchor="left" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.25" order="2" />
<window_info id="Code Outline" active="false" anchor="right" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.33" order="4" />
<window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.33" order="0" />
<window_info id="EJB" active="false" anchor="bottom" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.25" order="3" />
<window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.25" order="5" />
@ -363,6 +391,7 @@
</component>
<component name="VcsManagerConfiguration">
<option name="ACTIVE_VCS_NAME" value="CVS" />
<option name="STATE" value="0" />
</component>
<component name="VssConfiguration">
<CheckoutOptions>
@ -420,41 +449,15 @@
<option name="IS_AUTOSCROLL_TO_SOURCE" value="false" />
<option name="FILTER_TARGETS" value="false" />
<buildFile url="file://$PROJECT_DIR$/build.xml">
<antCommandLine value="" />
<runInBackground value="false" />
<viewClosedWhenNoErrors value="false" />
<targetFilters />
<treeView value="true" />
<verbose value="true" />
<viewClosedWhenNoErrors value="false" />
</buildFile>
</component>
<component name="editorHistoryManager">
<entry file="jar://$PROJECT_DIR$/lib/commons-logging.jar!/org/apache/commons/logging/impl/Log4JLogger.class">
<provider selected="true" editor-type-id="text-editor">
<state line="28" column="16" selection-start="652" selection-end="657" vertical-scroll-proportion="0.33333334">
<folding />
</state>
</provider>
</entry>
<entry file="jar://C:/j2sdk1.4.2_03/src.zip!/java/io/Serializable.java">
<provider selected="true" editor-type-id="text-editor">
<state line="44" column="52" selection-start="200" selection-end="4427" vertical-scroll-proportion="0.3567753">
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/build.xml">
<provider selected="true" editor-type-id="text-editor">
<state line="22" column="105" selection-start="865" selection-end="865" vertical-scroll-proportion="0.6584507">
<folding />
</state>
</provider>
</entry>
<entry file="jar://C:/j2sdk1.4.2_03/src.zip!/java/lang/Runnable.java">
<provider selected="true" editor-type-id="text-editor">
<state line="37" column="10" selection-start="1508" selection-end="1508" vertical-scroll-proportion="0.41680962">
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/build.properties">
<provider selected="true" editor-type-id="text-editor">
<state line="0" column="0" selection-start="0" selection-end="0" vertical-scroll-proportion="0.0">
@ -469,18 +472,32 @@
</state>
</provider>
</entry>
<entry file="jar://$PROJECT_DIR$/lib/pircbot.jar!/org/jibble/pircbot/PircBot.class">
<provider selected="true" editor-type-id="text-editor">
<state line="353" column="18" selection-start="10733" selection-end="10733" vertical-scroll-proportion="0.33274648">
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/net/thauvin/erik/mobibot/Mobibot.java">
<provider selected="true" editor-type-id="text-editor">
<state line="2291" column="12" selection-start="55270" selection-end="55270" vertical-scroll-proportion="0.28818443">
<state line="63" column="65" selection-start="2257" selection-end="2257" vertical-scroll-proportion="0.8733945">
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/build.xml">
<provider selected="true" editor-type-id="text-editor">
<state line="26" column="4" selection-start="884" selection-end="884" vertical-scroll-proportion="0.81100917">
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/net/thauvin/erik/mobibot/StockQuote.java">
<provider selected="true" editor-type-id="text-editor">
<state line="53" column="13" selection-start="2037" selection-end="2037" vertical-scroll-proportion="0.8818444">
<state line="53" column="13" selection-start="2037" selection-end="2037" vertical-scroll-proportion="0.5614679">
<folding>
<element signature="imports" expanded="true" />
</folding>
@ -489,7 +506,7 @@
</entry>
<entry file="file://$PROJECT_DIR$/src/net/thauvin/erik/mobibot/CurrencyConverter.java">
<provider selected="true" editor-type-id="text-editor">
<state line="63" column="13" selection-start="2150" selection-end="2150" vertical-scroll-proportion="1.1613833">
<state line="151" column="87" selection-start="4160" selection-end="4231" vertical-scroll-proportion="1.0899082">
<folding>
<element signature="imports" expanded="true" />
</folding>
@ -498,21 +515,21 @@
</entry>
<entry file="file://$PROJECT_DIR$/src/net/thauvin/erik/mobibot/Weather.java">
<provider selected="true" editor-type-id="text-editor">
<state line="122" column="34" selection-start="3500" selection-end="3507" vertical-scroll-proportion="1.7118156">
<state line="173" column="12" selection-start="4757" selection-end="4757" vertical-scroll-proportion="1.0899082">
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/net/thauvin/erik/mobibot/GoogleSearch.java">
<provider selected="true" editor-type-id="text-editor">
<state line="156" column="131" selection-start="4367" selection-end="4371" vertical-scroll-proportion="1.7118156">
<state line="157" column="108" selection-start="4458" selection-end="4458" vertical-scroll-proportion="1.0623853">
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/net/thauvin/erik/mobibot/FeedReader.java">
<provider selected="true" editor-type-id="text-editor">
<state line="141" column="26" selection-start="3819" selection-end="3826" vertical-scroll-proportion="1.2103746">
<state line="151" column="53" selection-start="4082" selection-end="4082" vertical-scroll-proportion="1.0477064">
<folding>
<element signature="imports" expanded="true" />
</folding>
@ -521,7 +538,7 @@
</entry>
<entry file="file://$PROJECT_DIR$/src/net/thauvin/erik/mobibot/EntryLink.java">
<provider selected="true" editor-type-id="text-editor">
<state line="55" column="13" selection-start="2034" selection-end="2034" vertical-scroll-proportion="0.9033149">
<state line="55" column="13" selection-start="2034" selection-end="2034" vertical-scroll-proportion="0.6238532">
<folding>
<element signature="imports" expanded="true" />
</folding>
@ -530,7 +547,7 @@
</entry>
<entry file="file://$PROJECT_DIR$/src/net/thauvin/erik/mobibot/EntryComment.java">
<provider selected="true" editor-type-id="text-editor">
<state line="53" column="13" selection-start="2016" selection-end="2016" vertical-scroll-proportion="0.8453039">
<state line="53" column="13" selection-start="2016" selection-end="2016" vertical-scroll-proportion="0.5614679">
<folding>
<element signature="imports" expanded="true" />
</folding>
@ -565,7 +582,7 @@
<property name="noinner" value="false" />
<property name="nolvt" value="false" />
<property name="nonlb" value="false" />
<property name="outputDirectory" value="D:\projects\ect\java\mobibot\src" />
<property name="outputDirectory" value="D:\projects\java\mobibot\src" />
<property name="packFields" value="3" />
<property name="packImports" value="7" />
<property name="prefixNumericalClasses" value="_cls" />

View file

@ -47,13 +47,17 @@ import org.apache.commons.net.WhoisClient;
import org.apache.log4j.Level;
import org.jibble.pircbot.*;
import org.jibble.pircbot.Colors;
import org.jibble.pircbot.PircBot;
import org.jibble.pircbot.User;
import java.io.*;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.nio.channels.FileChannel;
import java.text.SimpleDateFormat;
import java.util.*;
@ -78,11 +82,8 @@ public class Mobibot extends PircBot
/**
* The info strings.
*/
private static final String[] INFO_STRS =
{
"Mobibot v0.1.3b5 by Erik C. Thauvin (erik@thauvin.net)",
"http://www.thauvin.net/mobitopia/mobibot/"
};
private static final String[] INFO_STRS =
{ "Mobibot v0.1.3b12 by Erik C. Thauvin (erik@thauvin.net)", "http://www.thauvin.net/mobitopia/mobibot/" };
/**
* Debug command line argument.
@ -197,7 +198,7 @@ public class Mobibot extends PircBot
/**
* The link match string.
*/
private static final String LINK_MATCH = "http://";
private static final String LINK_MATCH = "^[hH][tT][tT][pP](|[sS])://.*";
/**
* The lookup command.
@ -242,7 +243,8 @@ public class Mobibot extends PircBot
/**
* The date/time format for the {@link #TIME_CMD time} command.
*/
private static final SimpleDateFormat TIME_SDF = new SimpleDateFormat("'The time is 'HH:mm' on 'EEE, d MMM yyyy' in '");
private static final SimpleDateFormat TIME_SDF =
new SimpleDateFormat("'The time is 'HH:mm' on 'EEE, d MMM yyyy' in '");
/**
* The beats (Internet Time) keyword.
@ -269,11 +271,6 @@ public class Mobibot extends PircBot
*/
private static final String VIEW_CMD = "view";
/**
* The view "all" keyword.
*/
private static final String VIEW_ALL_KEYWORD = "all";
/**
* The weather command.
*/
@ -325,6 +322,7 @@ public class Mobibot extends PircBot
COUNTRIES_MAP.put("NZ", "Pacific/Auckland");
COUNTRIES_MAP.put("RU", "Europe/Moscow");
COUNTRIES_MAP.put("SE", "Europe/Stockholm");
COUNTRIES_MAP.put("SG", "Asia/Singapore");
COUNTRIES_MAP.put("SU", "Europe/Moscow");
COUNTRIES_MAP.put("TH", "Asia/Bangkok");
COUNTRIES_MAP.put("TW", "Asia/Taipei");
@ -350,6 +348,11 @@ public class Mobibot extends PircBot
*/
private static final String WHOIS_HOST = "whois.arin.net";
/**
* The number of milliseconds to delay between consecutive messages.
*/
private static final int MESSAGE_DELAY = 1000;
/**
* The logger default level.
*/
@ -595,8 +598,9 @@ public class Mobibot extends PircBot
try
{
stdout = new PrintStream(new FileOutputStream(logsDir + channel.substring(1) + '.' + today() +
".log", true));
stdout =
new PrintStream(new FileOutputStream(logsDir + channel.substring(1) + '.' + today() + ".log",
true));
}
catch (IOException e)
{
@ -630,8 +634,8 @@ public class Mobibot extends PircBot
final String googleKey = p.getProperty("google", "");
// Create the bot
final Mobibot bot = new Mobibot(server, channel, line.getOptionValue(DATA_ARG.charAt(0), "./mobibot.ser"),
logsDir);
final Mobibot bot =
new Mobibot(server, channel, line.getOptionValue(DATA_ARG.charAt(0), "./mobibot.ser"), logsDir);
// Initialize the bot
bot.setVerbose(true);
@ -639,6 +643,7 @@ public class Mobibot extends PircBot
bot.setName(nickname);
bot.setLogin(login);
bot.setVersion(weblogURL);
bot.setMessageDelay(MESSAGE_DELAY);
// Set the URLs
bot.setWeblogURL(weblogURL);
@ -796,9 +801,7 @@ public class Mobibot extends PircBot
else if (lcTopic.endsWith(VIEW_CMD))
{
this.sendNotice(sender, "To list or search the current URL posts:");
this.sendNotice(sender,
DOUBLE_INDENT + bold(getNick() + ": " + VIEW_CMD) + " [<query or " + VIEW_ALL_KEYWORD +
">]");
this.sendNotice(sender, DOUBLE_INDENT + bold(getNick() + ": " + VIEW_CMD) + " [<start>] [<query>]");
}
else if (lcTopic.endsWith(_channel.substring(1).toLowerCase()))
{
@ -943,6 +946,49 @@ public class Mobibot extends PircBot
}
}
/**
* Copies a file
*
* @param in The source file.
* @param out The destination file
*
* @throws IOException If the file could not be copied.
*/
public void copyFile(File in, File out)
throws IOException
{
FileChannel inChannel;
FileChannel outChannel;
inChannel = new FileInputStream(in).getChannel();
outChannel = new FileOutputStream(out).getChannel();
try
{
inChannel.transferTo(0, inChannel.size(), outChannel);
}
finally
{
try
{
inChannel.close();
}
catch (IOException ignore)
{
; // Do nothing
}
try
{
outChannel.close();
}
catch (IOException ignore)
{
; // Do nothing
}
}
}
/**
* This method is called whenever an ACTION is sent from a user.
*
@ -1019,9 +1065,7 @@ public class Mobibot extends PircBot
{
_logger.debug(">>> " + sender + ": " + message);
final String lcMsg = message.toLowerCase();
if ((lcMsg.startsWith(LINK_MATCH)) && (lcMsg.length() > LINK_MATCH.length()))
if (message.matches(LINK_MATCH))
{
final String[] cmds = message.split(" ", 2);
final String cmd = cmds[0].trim();
@ -1061,7 +1105,7 @@ public class Mobibot extends PircBot
this.sendNotice(sender, "Duplicate >> " + buildLink(dupIndex, entry));
}
}
else if (lcMsg.matches(getNick() + ":.*"))
else if (message.matches(getNickPattern() + ":.*"))
{
final String[] cmds = message.substring(message.indexOf(':') + 1).trim().split(" ", 2);
final String cmd = cmds[0].toLowerCase();
@ -1079,15 +1123,14 @@ public class Mobibot extends PircBot
}
else if (cmd.equals(PING_CMD))
{
final String[] pings =
{
"is barely alive.", "is trying to stay awake.", "has gone fishing.",
"is somewhere over the rainbow.", "has fallen and can't get up.",
"is running. You better go chase it.", "has just spontantiously combusted.",
"is talking to itself... don't interrupt. That's rude.",
"is bartending at an AA meeting.", "is hibernating.",
"is saving energy: apathetic mode activated.", "is busy. Go away!"
};
final String[] pings =
{
"is barely alive.", "is trying to stay awake.", "has gone fishing.",
"is somewhere over the rainbow.", "has fallen and can't get up.",
"is running. You better go chase it.", "has just spontantiously combusted.",
"is talking to itself... don't interrupt. That's rude.", "is bartending at an AA meeting.",
"is hibernating.", "is saving energy: apathetic mode activated.", "is busy. Go away!"
};
final Random r = new Random();
@ -1251,7 +1294,7 @@ public class Mobibot extends PircBot
{
final String link = cmd.substring(1);
if ((link.length() > (LINK_MATCH.length())) && link.toLowerCase().startsWith(LINK_MATCH))
if (link.matches(LINK_MATCH))
{
entry.setLink(link);
this.sendNotice(_channel, buildLink(index, entry));
@ -2075,6 +2118,15 @@ public class Mobibot extends PircBot
_logger.debug("Unable to close the data file stream.", e);
}
}
try
{
copyFile(new File(_data), new File(_data + ".bak"));
}
catch (IOException e)
{
_logger.warn("Unable to backup the data file.", e);
}
}
/**
@ -2084,7 +2136,6 @@ public class Mobibot extends PircBot
*/
private static void sleep(int secs)
{
/*
try
{
Thread.sleep((long) (secs * 1000));
@ -2093,14 +2144,6 @@ public class Mobibot extends PircBot
{
; // Do nothing
}
*/
final long stop = System.currentTimeMillis() + ((long) secs * 1000);
while (System.currentTimeMillis() <= stop)
{
; // Do nothing
}
}
/**
@ -2227,8 +2270,9 @@ public class Mobibot extends PircBot
else
{
TIME_SDF.setTimeZone(TimeZone.getTimeZone(tz));
response = TIME_SDF.format(Calendar.getInstance().getTime()) +
tz.substring(tz.indexOf('/') + 1).replace('_', ' ');
response =
TIME_SDF.format(Calendar.getInstance().getTime()) +
tz.substring(tz.indexOf('/') + 1).replace('_', ' ');
}
}
else
@ -2264,6 +2308,34 @@ public class Mobibot extends PircBot
return ISO_SDF.format(Calendar.getInstance().getTime());
}
/**
* Returns the bot's nickname regexp pattern.
*
* @return The nickname regexp pattern.
*/
private final String getNickPattern()
{
final StringBuffer buff = new StringBuffer(0);
final String nick = getNick();
char c;
for (int i = 0; i < nick.length(); i++)
{
c = nick.charAt(i);
if (Character.isLetter(c))
{
buff.append('[').append(String.valueOf(c).toLowerCase()).append(String.valueOf(c).toUpperCase()).append(']');
}
else
{
buff.append(c);
}
}
return buff.toString();
}
/**
* Responds with the users on a channel.
*
@ -2301,36 +2373,89 @@ public class Mobibot extends PircBot
*/
private void viewResponse(String sender, String args, boolean isPrivate)
{
final String lcArgs = args.toLowerCase();
String lcArgs = args.toLowerCase();
if (!_entries.isEmpty())
{
final int max = _entries.size();
int i = 0;
if (!(args.length() > 0) && (max > MAX_ENTRIES))
if (!(lcArgs.length() > 0) && (max > MAX_ENTRIES))
{
i = max - MAX_ENTRIES;
}
if (lcArgs.matches("^\\d+(| .*)"))
{
final String[] split = lcArgs.split(" ", 2);
try
{
i = Integer.parseInt(split[0]);
if (i > 0)
{
i--;
}
if (split.length == 2)
{
lcArgs = split[1].trim();
}
else
{
lcArgs = "";
}
if (i > max)
{
i = 0;
}
}
catch (NumberFormatException ignore)
{
; // Do nothing
}
}
EntryLink entry;
int sent = 0;
for (; i < max; i++)
{
entry = (EntryLink) _entries.get(i);
if ((args.length() > 0) && !(args.equals(VIEW_ALL_KEYWORD)))
if (lcArgs.length() > 0)
{
if ((entry.getLink().toLowerCase().indexOf(lcArgs) != -1) ||
(entry.getTitle().toLowerCase().indexOf(lcArgs) != -1) ||
(entry.getNick().toLowerCase().indexOf(lcArgs) != -1))
{
if (sent > MAX_ENTRIES)
{
send(sender,
"To view more, try: " +
bold(getNick() + ": " + VIEW_CMD + ' ' + (i + 1) + ' ' + lcArgs), isPrivate);
break;
}
send(sender, buildLink(i, entry, true), isPrivate);
sent++;
}
}
else
{
if (sent > MAX_ENTRIES)
{
send(sender, "To view more, try: " + bold(getNick() + ": " + VIEW_CMD + ' ' + (i + 1)),
isPrivate);
break;
}
send(sender, buildLink(i, entry, true), isPrivate);
sent++;
}
}
}