Added support for Twitter's OAuth, see TwitterOAuth.java for instructions.

This commit is contained in:
Erik C. Thauvin 2010-09-14 00:52:14 +00:00
parent 64656550eb
commit 907c4c371b
10 changed files with 384 additions and 195 deletions

View file

@ -1,3 +1,3 @@
#ANT Task: ch.oscg.jreleaseinfo.BuildNumberHandler #ANT Task: ch.oscg.jreleaseinfo.BuildNumberHandler
#Mon Sep 13 14:45:55 PDT 2010 #Mon Sep 13 17:42:54 PDT 2010
build.num.last=5 build.num.last=6

Binary file not shown.

Binary file not shown.

View file

@ -1,4 +1,6 @@
Copyright (c) 2007-2008, Yusuke Yamamoto Twitter4J includes software from JSON.org to parse JSON response from the Twitter API. You can see the license term at http://www.JSON.org/license.html
Copyright (c) 2007-2010, Yusuke Yamamoto
All rights reserved. All rights reserved.
Redistribution and use in source and binary forms, with or without Redistribution and use in source and binary forms, with or without

View file

@ -191,7 +191,7 @@
<orderEntry type="module-library"> <orderEntry type="module-library">
<library> <library>
<CLASSES> <CLASSES>
<root url="jar://$MODULE_DIR$/lib/twitter4j-1.0.4.jar!/" /> <root url="jar://$MODULE_DIR$/lib/twitter4j-core-2.1.5-SNAPSHOT.jar!/" />
</CLASSES> </CLASSES>
<JAVADOC /> <JAVADOC />
<SOURCES /> <SOURCES />

View file

@ -32,12 +32,15 @@
<list default="true" readonly="true" id="944923a8-a8d5-4232-a77e-02473b958f59" name="Default" comment=""> <list default="true" readonly="true" id="944923a8-a8d5-4232-a77e-02473b958f59" name="Default" comment="">
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/buildnum.properties" afterPath="$PROJECT_DIR$/buildnum.properties" /> <change type="MODIFICATION" beforePath="$PROJECT_DIR$/buildnum.properties" afterPath="$PROJECT_DIR$/buildnum.properties" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/net/thauvin/erik/mobibot/Mobibot.java" afterPath="$PROJECT_DIR$/src/net/thauvin/erik/mobibot/Mobibot.java" /> <change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/net/thauvin/erik/mobibot/Mobibot.java" afterPath="$PROJECT_DIR$/src/net/thauvin/erik/mobibot/Mobibot.java" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/net/thauvin/erik/mobibot/Twitter.java" afterPath="$PROJECT_DIR$/src/net/thauvin/erik/mobibot/Twitter.java" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/mobibot.iws" afterPath="$PROJECT_DIR$/mobibot.iws" /> <change type="MODIFICATION" beforePath="$PROJECT_DIR$/mobibot.iws" afterPath="$PROJECT_DIR$/mobibot.iws" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/mobibot.ipr" afterPath="$PROJECT_DIR$/mobibot.ipr" /> <change type="MODIFICATION" beforePath="$PROJECT_DIR$/mobibot.iml" afterPath="$PROJECT_DIR$/mobibot.iml" />
<change type="DELETED" beforePath="K:\java\mobibot\lib\twitter4j-1.0.4.jar" afterPath="" />
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/src/net/thauvin/erik/mobibot/TwitterOAuth.java" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/net/thauvin/erik/mobibot/ReleaseInfo.java" afterPath="$PROJECT_DIR$/src/net/thauvin/erik/mobibot/ReleaseInfo.java" /> <change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/net/thauvin/erik/mobibot/ReleaseInfo.java" afterPath="$PROJECT_DIR$/src/net/thauvin/erik/mobibot/ReleaseInfo.java" />
</list> </list>
<ignored path="$USER_HOME_GRAILS$/" />
<ignored path="$USER_HOME_GRIFFON$/" /> <ignored path="$USER_HOME_GRIFFON$/" />
<ignored path="$USER_HOME_GRAILS$/" />
<option name="TRACKING_ENABLED" value="true" /> <option name="TRACKING_ENABLED" value="true" />
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" /> <option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -102,10 +105,6 @@
<breakpoint_rules /> <breakpoint_rules />
<ui_properties /> <ui_properties />
</component> </component>
<component name="ErrorTreeViewConfiguration">
<option name="IS_AUTOSCROLL_TO_SOURCE" value="false" />
<option name="HIDE_WARNINGS" value="false" />
</component>
<component name="FavoritesManager"> <component name="FavoritesManager">
<favorites_list name="mobibot" /> <favorites_list name="mobibot" />
</component> </component>
@ -135,10 +134,10 @@
<component name="FileColors" enabled="true" enabledForTabs="true" /> <component name="FileColors" enabled="true" enabledForTabs="true" />
<component name="FileEditorManager"> <component name="FileEditorManager">
<leaf> <leaf>
<file leaf-file-name="Mobibot.java" pinned="false" current="false" current-in-tab="false"> <file leaf-file-name="Twitter.java" pinned="false" current="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/net/thauvin/erik/mobibot/Mobibot.java"> <entry file="file://$PROJECT_DIR$/src/net/thauvin/erik/mobibot/Twitter.java">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state line="96" column="95" selection-start="3468" selection-end="3468" vertical-scroll-proportion="-18.0"> <state line="93" column="18" selection-start="2403" selection-end="2403" vertical-scroll-proportion="0.0">
<folding> <folding>
<element signature="imports" expanded="true" /> <element signature="imports" expanded="true" />
</folding> </folding>
@ -146,46 +145,48 @@
</provider> </provider>
</entry> </entry>
</file> </file>
<file leaf-file-name="TwitterOAuth.java" pinned="false" current="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/net/thauvin/erik/mobibot/TwitterOAuth.java">
<provider selected="true" editor-type-id="text-editor">
<state line="36" column="111" selection-start="955" selection-end="955" vertical-scroll-proportion="0.0">
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
<file leaf-file-name="Mobibot.java" pinned="false" current="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/net/thauvin/erik/mobibot/Mobibot.java">
<provider selected="true" editor-type-id="text-editor">
<state line="2512" column="124" selection-start="59852" selection-end="59852" vertical-scroll-proportion="-14.36">
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="build.properties" pinned="false" current="false" current-in-tab="false">
<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">
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="mobibot.properties" pinned="false" current="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/mobibot.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">
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="buildnum.properties" pinned="false" current="true" current-in-tab="true"> <file leaf-file-name="buildnum.properties" pinned="false" current="true" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/buildnum.properties"> <entry file="file://$PROJECT_DIR$/buildnum.properties">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state line="3" column="0" selection-start="98" selection-end="98" vertical-scroll-proportion="0.06716418"> <state line="2" column="16" selection-start="97" selection-end="97" vertical-scroll-proportion="0.04477612">
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="ReleaseInfo.java" pinned="false" current="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/net/thauvin/erik/mobibot/ReleaseInfo.java">
<provider selected="true" editor-type-id="text-editor">
<state line="56" column="28" selection-start="1568" selection-end="1578" vertical-scroll-proportion="0.0">
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="EntryLink.java" pinned="false" current="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/net/thauvin/erik/mobibot/EntryLink.java">
<provider selected="true" editor-type-id="text-editor">
<state line="382" column="80" selection-start="8127" selection-end="8127" vertical-scroll-proportion="0.0">
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="Twitter.java" pinned="false" current="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/net/thauvin/erik/mobibot/Twitter.java">
<provider selected="true" editor-type-id="text-editor">
<state line="75" column="12" selection-start="1425" selection-end="1488" vertical-scroll-proportion="0.0">
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="StockQuote.java" pinned="false" current="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/net/thauvin/erik/mobibot/StockQuote.java">
<provider selected="true" editor-type-id="text-editor">
<state line="52" column="13" selection-start="2029" selection-end="2029" vertical-scroll-proportion="0.0">
<folding /> <folding />
</state> </state>
</provider> </provider>
@ -213,9 +214,11 @@
<component name="IdeDocumentHistory"> <component name="IdeDocumentHistory">
<option name="changedFiles"> <option name="changedFiles">
<list> <list>
<option value="$PROJECT_DIR$/src/net/thauvin/erik/mobibot/Twitter.java" />
<option value="$PROJECT_DIR$/src/net/thauvin/erik/mobibot/EntryLink.java" /> <option value="$PROJECT_DIR$/src/net/thauvin/erik/mobibot/EntryLink.java" />
<option value="$PROJECT_DIR$/src/net/thauvin/erik/mobibot/TwitterOAuth.java" />
<option value="$PROJECT_DIR$/src/net/thauvin/erik/mobibot/TwitterTest.java" />
<option value="$PROJECT_DIR$/src/net/thauvin/erik/mobibot/Mobibot.java" /> <option value="$PROJECT_DIR$/src/net/thauvin/erik/mobibot/Mobibot.java" />
<option value="$PROJECT_DIR$/src/net/thauvin/erik/mobibot/Twitter.java" />
<option value="$PROJECT_DIR$/buildnum.properties" /> <option value="$PROJECT_DIR$/buildnum.properties" />
</list> </list>
</option> </option>
@ -343,35 +346,6 @@
<sortByType /> <sortByType />
</navigator> </navigator>
<panes> <panes>
<pane id="Favorites" />
<pane id="PackagesPane">
<subPane>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="mobibot" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PackageViewProjectNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="mobibot" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PackageViewModuleNode" />
</PATH_ELEMENT>
</PATH>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="mobibot" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PackageViewProjectNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="mobibot" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PackageViewModuleNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="net.thauvin.erik.mobibot" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PackageElementNode" />
</PATH_ELEMENT>
</PATH>
</subPane>
</pane>
<pane id="ProjectPane"> <pane id="ProjectPane">
<subPane> <subPane>
<PATH> <PATH>
@ -404,9 +378,52 @@
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" /> <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT> </PATH_ELEMENT>
</PATH> </PATH>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="mobibot" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="mobibot" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="lib" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
</PATH>
</subPane> </subPane>
</pane> </pane>
<pane id="Favorites" />
<pane id="Scope" /> <pane id="Scope" />
<pane id="PackagesPane">
<subPane>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="mobibot" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PackageViewProjectNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="mobibot" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PackageViewModuleNode" />
</PATH_ELEMENT>
</PATH>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="mobibot" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PackageViewProjectNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="mobibot" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PackageViewModuleNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="net.thauvin.erik.mobibot" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PackageElementNode" />
</PATH_ELEMENT>
</PATH>
</subPane>
</pane>
</panes> </panes>
</component> </component>
<component name="PropertiesComponent"> <component name="PropertiesComponent">
@ -427,14 +444,14 @@
<property name="vcs_file_view_treeOrder1" value="1" /> <property name="vcs_file_view_treeOrder1" value="1" />
<property name="vcs_file_view_treeOrder4" value="4" /> <property name="vcs_file_view_treeOrder4" value="4" />
<property name="vcs_file_view_flatWidth5" value="81" /> <property name="vcs_file_view_flatWidth5" value="81" />
<property name="WebServerToolWindowFactoryState" value="false" />
<property name="cvs_file_history_flatWidth6" value="135" /> <property name="cvs_file_history_flatWidth6" value="135" />
<property name="WebServerToolWindowFactoryState" value="false" />
<property name="cvs_file_history_flatWidth4" value="135" /> <property name="cvs_file_history_flatWidth4" value="135" />
<property name="cvs_file_history_flatWidth5" value="136" /> <property name="cvs_file_history_flatWidth5" value="136" />
<property name="cvs_file_history_flatWidth2" value="135" />
<property name="vcs_file_view_flatOrder0" value="0" /> <property name="vcs_file_view_flatOrder0" value="0" />
<property name="cvs_file_history_flatWidth3" value="136" /> <property name="cvs_file_history_flatWidth2" value="135" />
<property name="cvs_file_history_treeOrder0" value="0" /> <property name="cvs_file_history_treeOrder0" value="0" />
<property name="cvs_file_history_flatWidth3" value="136" />
<property name="vcs_file_view_flatWidth0" value="81" /> <property name="vcs_file_view_flatWidth0" value="81" />
<property name="vcs_file_view_flatOrder2" value="2" /> <property name="vcs_file_view_flatOrder2" value="2" />
<property name="cvs_file_history_flatWidth0" value="135" /> <property name="cvs_file_history_flatWidth0" value="135" />
@ -451,8 +468,11 @@
<property name="GoToFile.includeJavaFiles" value="false" /> <property name="GoToFile.includeJavaFiles" value="false" />
<property name="RunManagerConfig.compileBeforeRunning" value="true" /> <property name="RunManagerConfig.compileBeforeRunning" value="true" />
<property name="options.lastSelected" value="com.intellij.profile.codeInspection.ui.ProjectInspectionToolsConfigurable" /> <property name="options.lastSelected" value="com.intellij.profile.codeInspection.ui.ProjectInspectionToolsConfigurable" />
<property name="project.structure.side.proportion" value="0.2" />
<property name="MemberChooser.copyJavadoc" value="false" /> <property name="MemberChooser.copyJavadoc" value="false" />
<property name="project.structure.last.edited" value="Modules" />
<property name="vcs_file_view_treeWidth4" value="100" /> <property name="vcs_file_view_treeWidth4" value="100" />
<property name="project.structure.proportion" value="0.0" />
<property name="vcs_file_view_treeWidth1" value="101" /> <property name="vcs_file_view_treeWidth1" value="101" />
<property name="vcs_file_view_treeWidth0" value="100" /> <property name="vcs_file_view_treeWidth0" value="100" />
<property name="vcs_file_view_treeWidth3" value="101" /> <property name="vcs_file_view_treeWidth3" value="101" />
@ -463,8 +483,8 @@
<property name="cvs_file_history_treeWidth1" value="135" /> <property name="cvs_file_history_treeWidth1" value="135" />
<property name="cvs_file_history_treeWidth2" value="135" /> <property name="cvs_file_history_treeWidth2" value="135" />
<property name="cvs_file_history_treeWidth3" value="136" /> <property name="cvs_file_history_treeWidth3" value="136" />
<property name="MemberChooser.showClasses" value="true" />
<property name="cvs_file_history_treeWidth4" value="135" /> <property name="cvs_file_history_treeWidth4" value="135" />
<property name="MemberChooser.showClasses" value="true" />
<property name="cvs_file_history_treeWidth5" value="136" /> <property name="cvs_file_history_treeWidth5" value="136" />
<property name="cvs_file_history_treeWidth6" value="135" /> <property name="cvs_file_history_treeWidth6" value="135" />
<property name="cvs_file_history_flatOrder4" value="4" /> <property name="cvs_file_history_flatOrder4" value="4" />
@ -474,8 +494,8 @@
<property name="cvs_file_history_flatOrder0" value="0" /> <property name="cvs_file_history_flatOrder0" value="0" />
<property name="cvs_file_history_flatOrder1" value="1" /> <property name="cvs_file_history_flatOrder1" value="1" />
<property name="cvs_file_history_flatOrder6" value="6" /> <property name="cvs_file_history_flatOrder6" value="6" />
<property name="dynamic.classpath" value="false" />
<property name="options.searchVisible" value="true" /> <property name="options.searchVisible" value="true" />
<property name="dynamic.classpath" value="false" />
</component> </component>
<component name="RecentsManager"> <component name="RecentsManager">
<key name="CopyClassDialog.RECENTS_KEY"> <key name="CopyClassDialog.RECENTS_KEY">
@ -493,7 +513,16 @@
<option name="referencePos" value="0" /> <option name="referencePos" value="0" />
<option name="showLabels" value="true" /> <option name="showLabels" value="true" />
</component> </component>
<component name="RunManager" selected="Application.Mobibot"> <component name="RunManager" selected="Application.TwitterOAuth">
<configuration default="true" type="PhpRunConfigurationType" factoryName="PHP">
<method>
<option name="AntTarget" enabled="false" />
<option name="BuildArtifacts" enabled="false" />
<option name="FtpUpload" enabled="false" />
<option name="Maven.BeforeRunTask" enabled="false" />
<option name="ValidateXdebugSetup" enabled="true" />
</method>
</configuration>
<configuration default="true" type="PHPUnitRunConfigurationType" factoryName="PHPUnit"> <configuration default="true" type="PHPUnitRunConfigurationType" factoryName="PHPUnit">
<method> <method>
<option name="AntTarget" enabled="false" /> <option name="AntTarget" enabled="false" />
@ -514,6 +543,14 @@
<option name="Maven.BeforeRunTask" enabled="false" /> <option name="Maven.BeforeRunTask" enabled="false" />
</method> </method>
</configuration> </configuration>
<configuration default="true" type="FlexUnitRunConfigurationType" factoryName="FlexUnit">
<method>
<option name="AntTarget" enabled="false" />
<option name="BuildArtifacts" enabled="false" />
<option name="Make" enabled="true" />
<option name="Maven.BeforeRunTask" enabled="false" />
</method>
</configuration>
<configuration default="true" type="TestNG" factoryName="TestNG"> <configuration default="true" type="TestNG" factoryName="TestNG">
<extension name="coverage" enabled="false" merge="false" /> <extension name="coverage" enabled="false" merge="false" />
<extension name="snapshooter" /> <extension name="snapshooter" />
@ -587,6 +624,26 @@
<option name="Maven.BeforeRunTask" enabled="false" /> <option name="Maven.BeforeRunTask" enabled="false" />
</method> </method>
</configuration> </configuration>
<configuration default="true" type="PhpUnitRemoteRunConfigurationType" factoryName="PHPUnit on Server">
<method>
<option name="AntTarget" enabled="false" />
<option name="BuildArtifacts" enabled="false" />
<option name="FtpUpload" enabled="false" />
<option name="Maven.BeforeRunTask" enabled="false" />
<option name="ValidateXdebugSetup" enabled="true" />
</method>
</configuration>
<configuration default="true" type="JavascriptDebugSession" factoryName="Local">
<JSDebuggerConfigurationSettings>
<option name="engineId" value="embedded" />
<option name="fileUrl" />
</JSDebuggerConfigurationSettings>
<method>
<option name="AntTarget" enabled="false" />
<option name="BuildArtifacts" enabled="false" />
<option name="Maven.BeforeRunTask" enabled="false" />
</method>
</configuration>
<configuration default="true" type="WebLogic Instance" factoryName="Local"> <configuration default="true" type="WebLogic Instance" factoryName="Local">
<option name="PORT" value="7001" /> <option name="PORT" value="7001" />
<deployment /> <deployment />
@ -602,17 +659,6 @@
<option name="Maven.BeforeRunTask" enabled="false" /> <option name="Maven.BeforeRunTask" enabled="false" />
</method> </method>
</configuration> </configuration>
<configuration default="true" type="JavascriptDebugSession" factoryName="Local">
<JSDebuggerConfigurationSettings>
<option name="engineId" value="embedded" />
<option name="fileUrl" />
</JSDebuggerConfigurationSettings>
<method>
<option name="AntTarget" enabled="false" />
<option name="BuildArtifacts" enabled="false" />
<option name="Maven.BeforeRunTask" enabled="false" />
</method>
</configuration>
<configuration default="true" type="JUnit" factoryName="JUnit"> <configuration default="true" type="JUnit" factoryName="JUnit">
<extension name="coverage" enabled="false" merge="false" /> <extension name="coverage" enabled="false" merge="false" />
<extension name="snapshooter" /> <extension name="snapshooter" />
@ -640,7 +686,7 @@
</method> </method>
</configuration> </configuration>
<configuration default="false" name="Mobibot" type="Application" factoryName="Application"> <configuration default="false" name="Mobibot" type="Application" factoryName="Application">
<extension name="coverage" enabled="false" merge="false" /> <extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
<extension name="snapshooter" /> <extension name="snapshooter" />
<option name="MAIN_CLASS_NAME" value="net.thauvin.erik.mobibot.Mobibot" /> <option name="MAIN_CLASS_NAME" value="net.thauvin.erik.mobibot.Mobibot" />
<option name="VM_PARAMETERS" value="" /> <option name="VM_PARAMETERS" value="" />
@ -663,8 +709,27 @@
<ConfigurationWrapper RunnerId="Run" /> <ConfigurationWrapper RunnerId="Run" />
<method /> <method />
</configuration> </configuration>
<list size="1"> <configuration default="false" name="TwitterOAuth" type="Application" factoryName="Application">
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
<extension name="snapshooter" />
<option name="MAIN_CLASS_NAME" value="net.thauvin.erik.mobibot.TwitterOAuth" />
<option name="VM_PARAMETERS" value="" />
<option name="PROGRAM_PARAMETERS" value="" />
<option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
<option name="ALTERNATIVE_JRE_PATH" value="" />
<option name="ENABLE_SWING_INSPECTOR" value="false" />
<option name="ENV_VARIABLES" />
<option name="PASS_PARENT_ENVS" value="true" />
<module name="mobibot" />
<envs />
<RunnerSettings RunnerId="Run" />
<ConfigurationWrapper RunnerId="Run" />
<method />
</configuration>
<list size="2">
<item index="0" class="java.lang.String" itemvalue="Application.Mobibot" /> <item index="0" class="java.lang.String" itemvalue="Application.Mobibot" />
<item index="1" class="java.lang.String" itemvalue="Application.TwitterOAuth" />
</list> </list>
</component> </component>
<component name="ScopeViewComponent"> <component name="ScopeViewComponent">
@ -768,12 +833,12 @@
</todo-panel> </todo-panel>
</component> </component>
<component name="ToolWindowManager"> <component name="ToolWindowManager">
<frame x="129" y="67" width="1414" height="1175" extended-state="0" /> <frame x="154" y="0" width="1414" height="1175" extended-state="0" />
<editor active="false" /> <editor active="false" />
<layout> <layout>
<window_info id="Changes" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32934684" sideWeight="0.5" order="9" side_tool="false" content_ui="tabs" /> <window_info id="Changes" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32934684" sideWeight="0.5" order="9" side_tool="false" content_ui="tabs" />
<window_info id="Palette" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" /> <window_info id="Palette" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32662836" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" /> <window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32854405" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.09696521" sideWeight="0.66762453" order="1" side_tool="false" content_ui="tabs" /> <window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.09696521" sideWeight="0.66762453" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.39907408" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" /> <window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.39907408" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="IDEtalk Messages" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="10" side_tool="false" content_ui="tabs" /> <window_info id="IDEtalk Messages" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="10" side_tool="false" content_ui="tabs" />
@ -786,7 +851,7 @@
<window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" /> <window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
<window_info id="Project" active="true" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.18134715" sideWeight="0.66762453" order="0" side_tool="false" content_ui="tabs" /> <window_info id="Project" active="true" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.18134715" sideWeight="0.66762453" order="0" side_tool="false" content_ui="tabs" />
<window_info id="Dependency Viewer" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="17" side_tool="false" content_ui="tabs" /> <window_info id="Dependency Viewer" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="17" side_tool="false" content_ui="tabs" />
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.39447004" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" x="22" y="277" width="980" height="213" /> <window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.39367816" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" x="22" y="277" width="980" height="213" />
<window_info id="UI Designer" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" /> <window_info id="UI Designer" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="IntelliTail" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="12" side_tool="false" content_ui="tabs" /> <window_info id="IntelliTail" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="12" side_tool="false" content_ui="tabs" />
<window_info id="Properties File Structure" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.20918368" sideWeight="0.5" order="11" side_tool="false" content_ui="tabs" /> <window_info id="Properties File Structure" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.20918368" sideWeight="0.5" order="11" side_tool="false" content_ui="tabs" />
@ -805,8 +870,8 @@
<window_info id="Code Outline" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="9" side_tool="false" content_ui="tabs" /> <window_info id="Code Outline" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="9" side_tool="false" content_ui="tabs" />
<window_info id="EJB" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" /> <window_info id="EJB" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="JProfiler" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="14" side_tool="false" content_ui="tabs" /> <window_info id="JProfiler" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="14" side_tool="false" content_ui="tabs" />
<window_info id="CVS" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32962963" sideWeight="0.5" order="18" side_tool="false" content_ui="tabs" />
<window_info id="Module Dependencies" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="10" side_tool="false" content_ui="tabs" /> <window_info id="Module Dependencies" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="10" side_tool="false" content_ui="tabs" />
<window_info id="CVS" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32962963" sideWeight="0.5" order="18" side_tool="false" content_ui="tabs" />
<window_info id="Duplicates" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" /> <window_info id="Duplicates" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
<window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32934684" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" /> <window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32934684" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
<window_info id="Regex" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.44135803" sideWeight="0.5" order="20" side_tool="false" content_ui="tabs" x="22" y="277" width="980" height="214" /> <window_info id="Regex" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.44135803" sideWeight="0.5" order="20" side_tool="false" content_ui="tabs" x="22" y="277" width="980" height="214" />
@ -909,31 +974,6 @@
<option name="myLastEditedConfigurable" /> <option name="myLastEditedConfigurable" />
</component> </component>
<component name="editorHistoryManager"> <component name="editorHistoryManager">
<entry file="file://$PROJECT_DIR$/licenses/JDOM License.txt">
<provider selected="true" editor-type-id="text-editor">
<state line="0" column="0" selection-start="0" selection-end="0" vertical-scroll-proportion="0.0" />
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/licenses/GoogleTagLib License.txt">
<provider selected="true" editor-type-id="text-editor">
<state line="0" column="0" selection-start="0" selection-end="0" vertical-scroll-proportion="0.0" />
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/licenses/delicious-java License.txt">
<provider selected="true" editor-type-id="text-editor">
<state line="0" column="0" selection-start="0" selection-end="0" vertical-scroll-proportion="0.0" />
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/licenses/JWeather License.txt">
<provider selected="true" editor-type-id="text-editor">
<state line="0" column="0" selection-start="0" selection-end="0" vertical-scroll-proportion="0.0" />
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/licenses/License.txt">
<provider selected="true" editor-type-id="text-editor">
<state line="0" column="0" selection-start="0" selection-end="0" vertical-scroll-proportion="0.0" />
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/licenses/PircBot License.html"> <entry file="file://$PROJECT_DIR$/licenses/PircBot License.html">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state line="0" column="0" selection-start="0" selection-end="0" vertical-scroll-proportion="0.0" /> <state line="0" column="0" selection-start="0" selection-end="0" vertical-scroll-proportion="0.0" />
@ -959,9 +999,14 @@
<state line="28" column="13" selection-start="642" selection-end="642" vertical-scroll-proportion="-0.13314448" /> <state line="28" column="13" selection-start="642" selection-end="642" vertical-scroll-proportion="-0.13314448" />
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/src/net/thauvin/erik/mobibot/Twitter.java"> <entry file="file://$PROJECT_DIR$/src/net/thauvin/erik/mobibot/ReleaseInfo.java">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state line="75" column="12" selection-start="1425" selection-end="1488" vertical-scroll-proportion="0.0" /> <state line="56" column="28" selection-start="1568" selection-end="1578" vertical-scroll-proportion="0.0" />
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/net/thauvin/erik/mobibot/EntryLink.java">
<provider selected="true" editor-type-id="text-editor">
<state line="382" column="80" selection-start="8127" selection-end="8127" vertical-scroll-proportion="0.0" />
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/src/net/thauvin/erik/mobibot/StockQuote.java"> <entry file="file://$PROJECT_DIR$/src/net/thauvin/erik/mobibot/StockQuote.java">
@ -969,32 +1014,55 @@
<state line="52" column="13" selection-start="2029" selection-end="2029" vertical-scroll-proportion="0.0" /> <state line="52" column="13" selection-start="2029" selection-end="2029" vertical-scroll-proportion="0.0" />
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/src/net/thauvin/erik/mobibot/EntryLink.java"> <entry file="file://$PROJECT_DIR$/build.xml">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state line="382" column="80" selection-start="8127" selection-end="8127" vertical-scroll-proportion="0.0"> <state line="34" column="59" selection-start="1429" selection-end="1429" vertical-scroll-proportion="-22.173914">
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/net/thauvin/erik/mobibot/ReleaseInfo.java">
<provider selected="true" editor-type-id="text-editor">
<state line="56" column="28" selection-start="1568" selection-end="1578" vertical-scroll-proportion="0.0">
<folding /> <folding />
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/src/net/thauvin/erik/mobibot/Mobibot.java"> <entry file="file://$PROJECT_DIR$/src/net/thauvin/erik/mobibot/Mobibot.java">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state line="96" column="95" selection-start="3468" selection-end="3468" vertical-scroll-proportion="-18.0"> <state line="2512" column="124" selection-start="59852" selection-end="59852" vertical-scroll-proportion="-14.36">
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/net/thauvin/erik/mobibot/TwitterOAuth.java">
<provider selected="true" editor-type-id="text-editor">
<state line="36" column="111" selection-start="955" selection-end="955" vertical-scroll-proportion="0.0">
<folding> <folding>
<element signature="imports" expanded="true" /> <element signature="imports" expanded="true" />
</folding> </folding>
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/src/net/thauvin/erik/mobibot/Twitter.java">
<provider selected="true" editor-type-id="text-editor">
<state line="93" column="18" selection-start="2403" selection-end="2403" vertical-scroll-proportion="0.0">
<folding>
<element signature="imports" expanded="true" />
</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">
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/mobibot.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">
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/buildnum.properties"> <entry file="file://$PROJECT_DIR$/buildnum.properties">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state line="3" column="0" selection-start="98" selection-end="98" vertical-scroll-proportion="0.06716418"> <state line="2" column="16" selection-start="97" selection-end="97" vertical-scroll-proportion="0.04477612">
<folding /> <folding />
</state> </state>
</provider> </provider>
@ -1048,7 +1116,13 @@
<state key="ArtifactsStructureConfigurable.UI"> <state key="ArtifactsStructureConfigurable.UI">
<UIState> <UIState>
<splitter-proportions> <splitter-proportions>
<SplitterProportionsDataImpl /> <SplitterProportionsDataImpl>
<option name="proportions">
<list>
<option value="0.2" />
</list>
</option>
</SplitterProportionsDataImpl>
</splitter-proportions> </splitter-proportions>
<settings /> <settings />
</UIState> </UIState>

View file

@ -94,8 +94,7 @@ public class Mobibot extends PircBot
* The version strings. * The version strings.
*/ */
private static final String[] VERSION_STRS = private static final String[] VERSION_STRS =
{"Version: " + ReleaseInfo.getVersion() + '.' + ReleaseInfo.getBuildNumber() + " (" {"Version: " + ReleaseInfo.getVersion() + '.' + ReleaseInfo.getBuildNumber() + " (" + ISO_SDF.format(ReleaseInfo.getBuildDate()) + ')',
+ ISO_SDF.format(ReleaseInfo.getBuildDate()) + ')',
"Platform: " + System.getProperty("os.name") + " (" + System.getProperty("os.version") + ", " "Platform: " + System.getProperty("os.name") + " (" + System.getProperty("os.version") + ", "
+ System.getProperty("os.arch") + ", " + System.getProperty("user.country") + ')', + System.getProperty("os.arch") + ", " + System.getProperty("user.country") + ')',
"Runtime: " + System.getProperty("java.runtime.name") + " (build " "Runtime: " + System.getProperty("java.runtime.name") + " (build "
@ -471,19 +470,24 @@ public class Mobibot extends PircBot
private String _jaikuUser = ""; private String _jaikuUser = "";
/** /**
* The Twitter password. * The Twitter consumer key.
*/ */
private String _twitterPwd = ""; private String _twitterConsumerKey = "";
/** /**
* The Twitter user. * The Twitter consumer secret.
*/ */
private String _twitterUser = ""; private String _twitterConsumerSecret = "";
/** /**
* The Twitter client id/source. * The Twitter token.
*/ */
private String _twitterSrc = ""; private String _twitterToken = "";
/**
* The Twitter token secret.
*/
private String _twitterTokenSecret = "";
/** /**
* The history/backlogs array. * The history/backlogs array.
@ -754,9 +758,10 @@ public class Mobibot extends PircBot
final String jkey = p.getProperty("jaiku-key"); final String jkey = p.getProperty("jaiku-key");
// Get the Twitter properties // Get the Twitter properties
final String tname = p.getProperty("twitter-user"); final String tconsumerKey = p.getProperty("twitter-consumerKey");
final String tpwd = p.getProperty("twitter-pwd"); final String tconsumerSecret = p.getProperty("twitter-consumerSecret");
final String tsrc = p.getProperty("twitter-src", ""); final String ttoken = p.getProperty("twitter-token", "");
final String ttokenSecret = p.getProperty("twitter-tokenSecret", "");
// Create the bot // Create the bot
final Mobibot bot = new Mobibot(server, port, channel, logsDir); final Mobibot bot = new Mobibot(server, port, channel, logsDir);
@ -796,10 +801,11 @@ public class Mobibot extends PircBot
bot.setJaikuAuth(jname, jkey); bot.setJaikuAuth(jname, jkey);
} }
if (isValidString(tname) && isValidString(tpwd)) if (isValidString(tconsumerKey) && isValidString(tconsumerSecret) && isValidString(ttoken) && isValidString(
ttokenSecret))
{ {
// Set the Twitter authentication // Set the Twitter authentication
bot.setTwitterAuth(tname, tpwd, tsrc); bot.setTwitterAuth(tconsumerKey, tconsumerSecret, ttoken, ttokenSecret);
} }
// Set the tags // Set the tags
@ -1227,9 +1233,8 @@ public class Mobibot extends PircBot
{ {
if (_logger.isDebugEnabled()) if (_logger.isDebugEnabled())
{ {
_logger.debug( _logger.debug("Unable to reconnect to " + _ircServer + " after " + MAX_RECONNECT + " retries.",
"Unable to reconnect to " + _ircServer + " after " + MAX_RECONNECT + " retries.", ex);
ex);
} }
e.printStackTrace(System.err); e.printStackTrace(System.err);
@ -2490,11 +2495,18 @@ public class Mobibot extends PircBot
*/ */
private void twitterResponse(String sender, String message) private void twitterResponse(String sender, String message)
{ {
if (isValidString(_twitterPwd) && isValidString(_twitterUser)) if (isValidString(_twitterConsumerKey) && isValidString(_twitterConsumerSecret) && isValidString(_twitterToken)
&& isValidString(_twitterTokenSecret))
{ {
if (message.length() > 0) if (message.length() > 0)
{ {
new Thread(new Twitter(this, sender, _twitterUser, _twitterPwd, _twitterSrc, message)).start(); new Thread(new Twitter(this,
sender,
_twitterConsumerKey,
_twitterConsumerSecret,
_twitterToken,
_twitterTokenSecret,
message)).start();
} }
else else
{ {
@ -3010,17 +3022,19 @@ public class Mobibot extends PircBot
} }
/** /**
* Sets the Twitter user and password.. * Sets the Twitter consumerSecret and password..
* *
* @param user The Twitter user. * @param consumerKey The Twitter consumer key.
* @param key The Twitter password. * @param consumerSecret The Twitter consumer secret.
* @param source The Twitter source. * @param token The Twitter token.
* @param tokenSecret The Twitter token secret.
*/ */
private void setTwitterAuth(String user, String key, String source) private void setTwitterAuth(String consumerKey, String consumerSecret, String token, String tokenSecret)
{ {
_twitterPwd = key; _twitterConsumerKey = consumerKey;
_twitterUser = user; _twitterConsumerSecret = consumerSecret;
_twitterSrc = source; _twitterToken = token;
_twitterTokenSecret = tokenSecret;
} }
/** /**

View file

@ -1,5 +1,5 @@
/* Created by JReleaseInfo AntTask from Open Source Competence Group */ /* Created by JReleaseInfo AntTask from Open Source Competence Group */
/* Creation date Mon Sep 13 14:45:55 PDT 2010 */ /* Creation date Mon Sep 13 17:42:54 PDT 2010 */
package net.thauvin.erik.mobibot; package net.thauvin.erik.mobibot;
import java.util.Date; import java.util.Date;
@ -20,21 +20,21 @@ public class ReleaseInfo {
} }
/** buildDate (set during build process to 1284414355047L). */ /** buildDate (set during build process to 1284424974097L). */
private static final Date buildDate = new Date(1284414355047L); private static final Date buildDate = new Date(1284424974097L);
/** /**
* Get buildDate (set during build process to Mon Sep 13 14:45:55 PDT 2010). * Get buildDate (set during build process to Mon Sep 13 17:42:54 PDT 2010).
* @return Date buildDate * @return Date buildDate
*/ */
public static Date getBuildDate() { return buildDate; } public static Date getBuildDate() { return buildDate; }
/** /**
* Get buildNumber (set during build process to 5). * Get buildNumber (set during build process to 6).
* @return int buildNumber * @return int buildNumber
*/ */
public static int getBuildNumber() { return 5; } public static int getBuildNumber() { return 6; }
/** project (set during build process to "mobibot"). */ /** project (set during build process to "mobibot"). */

View file

@ -9,6 +9,10 @@
*/ */
package net.thauvin.erik.mobibot; package net.thauvin.erik.mobibot;
import twitter4j.Status;
import twitter4j.TwitterFactory;
import twitter4j.http.AccessToken;
/** /**
* Inserts presence information into Twitter. * Inserts presence information into Twitter.
* *
@ -25,14 +29,14 @@ public class Twitter implements Runnable
private final Mobibot _bot; private final Mobibot _bot;
/** /**
* The Twitter API password. * The Twitter consumer secret.
*/ */
private final String _pwd; private final String _consumerSecret;
/** /**
* The Twitter user. * The Twitter consumer key.
*/ */
private final String _user; private final String _consumerKey;
/** /**
* The Twitter message. * The Twitter message.
@ -40,9 +44,14 @@ public class Twitter implements Runnable
private final String _message; private final String _message;
/** /**
* The Twitter source. * The Twitter access token.
*/ */
private final String _source; private final String _accessToken;
/**
* The Twitter access token secret.
*/
private final String _accessTokenSecret;
/** /**
* The nick of the person who sent the message. * The nick of the person who sent the message.
@ -54,17 +63,20 @@ public class Twitter implements Runnable
* *
* @param bot The bot. * @param bot The bot.
* @param sender The nick of the person who sent the message. * @param sender The nick of the person who sent the message.
* @param user The Twitter user. * @param consumerKey The Twitter consumer key.
* @param password The Twitter password. * @param consumerSecret The Twitter consumer secret.
* @param source The Twitter client id/source. * @param accessToken The Twitter access token.
* @param accessTokenSecret The Twitter access token secret.
* @param message The Twitter message. * @param message The Twitter message.
*/ */
public Twitter(Mobibot bot, String sender, String user, String password, String source, String message) public Twitter(Mobibot bot, String sender, String consumerKey, String consumerSecret, String accessToken,
String accessTokenSecret, String message)
{ {
_bot = bot; _bot = bot;
_user = user; _consumerKey = consumerKey;
_pwd = password; _consumerSecret = consumerSecret;
_source = source; _accessToken = accessToken;
_accessTokenSecret = accessTokenSecret;
_message = message; _message = message;
_sender = sender; _sender = sender;
} }
@ -73,16 +85,17 @@ public class Twitter implements Runnable
{ {
try try
{ {
twitter4j.Twitter twitter = new twitter4j.Twitter(_user, _pwd); final twitter4j.Twitter twitter = new TwitterFactory().getOAuthAuthorizedInstance(_consumerKey,
_consumerSecret,
new AccessToken(
_accessToken,
_accessTokenSecret));
if (Mobibot.isValidString(_source)) final Status status = twitter.updateStatus(_message + " (" + _sender + ')');
{
twitter.setSource(_source);
}
twitter.update(_message + " (" + _sender + ')'); _bot.send(_sender,
"You message was posted to http://twitter.com/" + twitter.getScreenName() + "/statuses/" + status
_bot.send(_sender, "You message was posted to http://twitter.com/" + _user); .getId());
} }
catch (Exception e) catch (Exception e)
{ {

View file

@ -0,0 +1,86 @@
/*
* @(#)TwitterOAuth.java
*
* Copyright (C) 2010 Erik C. Thauvin
* All rights reserved.
*/
package net.thauvin.erik.mobibot;
import twitter4j.TwitterException;
import twitter4j.TwitterFactory;
import twitter4j.http.AccessToken;
import twitter4j.http.RequestToken;
import java.io.BufferedReader;
import java.io.InputStreamReader;
/**
* The <code>TwitterOAuth</code> class.
* <p/>
* Go to <a href="http://twitter.com/oauth_clients/new">http://twitter.com/oauth_clients/new</a> to register your bot.
* Then execute:
* <p/>
* <code>java -cp "mobibot.jar:../lib/*" net.thauvin.erik.mobibot.TwitterOAuth <consumerKey> <consumerSecret></code>
* <p/>
* and follow the prompts/instructions.
*
* @author <a href="mailto:erik@thauvin.net">Erik C. Thauvin</a>
* @version $Revision$, $Date$
* @created Sep 13, 2010
* @since 1.0
*/
public class TwitterOAuth
{
public static void main(String args[])
throws Exception
{
if (args.length == 2)
{
final twitter4j.Twitter twitter = new TwitterFactory().getInstance();
twitter.setOAuthConsumer(args[0], args[1]);
final RequestToken requestToken = twitter.getOAuthRequestToken();
AccessToken accessToken = null;
final BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
while (null == accessToken)
{
System.out.println("Open the following URL and grant access to your account:");
System.out.println(requestToken.getAuthorizationURL());
System.out.print("Enter the PIN (if available) or just hit enter.[PIN]:");
final String pin = br.readLine();
try
{
if (pin.length() > 0)
{
accessToken = twitter.getOAuthAccessToken(requestToken, pin);
}
else
{
accessToken = twitter.getOAuthAccessToken();
}
}
catch (TwitterException te)
{
if (401 == te.getStatusCode())
{
System.out.println("Unable to get the access token.");
}
else
{
te.printStackTrace();
}
}
}
System.out.println(
"Please add the following to the bot's property file:" + "\n\n" + "twitter-consumerKey=" + args[0]
+ '\n' + "twitter-consumerSecret=" + args[1] + '\n' + "twitter-token=" + accessToken.getToken()
+ '\n' + "twitter-tokenSecret=" + accessToken.getTokenSecret());
}
else
{
System.out.println("Usage: " + TwitterOAuth.class.getName() + " <consumerKey> <consumerSecret>");
}
System.exit(0);
}
}