Added support for Twitter's OAuth, see TwitterOAuth.java for instructions.
This commit is contained in:
parent
64656550eb
commit
907c4c371b
10 changed files with 384 additions and 195 deletions
|
@ -1,3 +1,3 @@
|
|||
#ANT Task: ch.oscg.jreleaseinfo.BuildNumberHandler
|
||||
#Mon Sep 13 14:45:55 PDT 2010
|
||||
build.num.last=5
|
||||
#Mon Sep 13 17:42:54 PDT 2010
|
||||
build.num.last=6
|
||||
|
|
Binary file not shown.
BIN
lib/twitter4j-core-2.1.5-SNAPSHOT.jar
Normal file
BIN
lib/twitter4j-core-2.1.5-SNAPSHOT.jar
Normal file
Binary file not shown.
|
@ -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.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
|
|
|
@ -191,7 +191,7 @@
|
|||
<orderEntry type="module-library">
|
||||
<library>
|
||||
<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>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
|
|
350
mobibot.iws
350
mobibot.iws
|
@ -32,12 +32,15 @@
|
|||
<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$/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.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" />
|
||||
</list>
|
||||
<ignored path="$USER_HOME_GRAILS$/" />
|
||||
<ignored path="$USER_HOME_GRIFFON$/" />
|
||||
<ignored path="$USER_HOME_GRAILS$/" />
|
||||
<option name="TRACKING_ENABLED" value="true" />
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
|
@ -102,10 +105,6 @@
|
|||
<breakpoint_rules />
|
||||
<ui_properties />
|
||||
</component>
|
||||
<component name="ErrorTreeViewConfiguration">
|
||||
<option name="IS_AUTOSCROLL_TO_SOURCE" value="false" />
|
||||
<option name="HIDE_WARNINGS" value="false" />
|
||||
</component>
|
||||
<component name="FavoritesManager">
|
||||
<favorites_list name="mobibot" />
|
||||
</component>
|
||||
|
@ -135,10 +134,10 @@
|
|||
<component name="FileColors" enabled="true" enabledForTabs="true" />
|
||||
<component name="FileEditorManager">
|
||||
<leaf>
|
||||
<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">
|
||||
<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="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>
|
||||
<element signature="imports" expanded="true" />
|
||||
</folding>
|
||||
|
@ -146,46 +145,48 @@
|
|||
</provider>
|
||||
</entry>
|
||||
</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">
|
||||
<entry file="file://$PROJECT_DIR$/buildnum.properties">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state line="3" column="0" selection-start="98" selection-end="98" vertical-scroll-proportion="0.06716418">
|
||||
<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">
|
||||
<state line="2" column="16" selection-start="97" selection-end="97" vertical-scroll-proportion="0.04477612">
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
|
@ -213,9 +214,11 @@
|
|||
<component name="IdeDocumentHistory">
|
||||
<option name="changedFiles">
|
||||
<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/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/Twitter.java" />
|
||||
<option value="$PROJECT_DIR$/buildnum.properties" />
|
||||
</list>
|
||||
</option>
|
||||
|
@ -343,35 +346,6 @@
|
|||
<sortByType />
|
||||
</navigator>
|
||||
<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">
|
||||
<subPane>
|
||||
<PATH>
|
||||
|
@ -404,9 +378,52 @@
|
|||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
||||
</PATH_ELEMENT>
|
||||
</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>
|
||||
</pane>
|
||||
<pane id="Favorites" />
|
||||
<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>
|
||||
</component>
|
||||
<component name="PropertiesComponent">
|
||||
|
@ -427,14 +444,14 @@
|
|||
<property name="vcs_file_view_treeOrder1" value="1" />
|
||||
<property name="vcs_file_view_treeOrder4" value="4" />
|
||||
<property name="vcs_file_view_flatWidth5" value="81" />
|
||||
<property name="WebServerToolWindowFactoryState" value="false" />
|
||||
<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_flatWidth5" value="136" />
|
||||
<property name="cvs_file_history_flatWidth2" value="135" />
|
||||
<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_flatWidth3" value="136" />
|
||||
<property name="vcs_file_view_flatWidth0" value="81" />
|
||||
<property name="vcs_file_view_flatOrder2" value="2" />
|
||||
<property name="cvs_file_history_flatWidth0" value="135" />
|
||||
|
@ -451,8 +468,11 @@
|
|||
<property name="GoToFile.includeJavaFiles" value="false" />
|
||||
<property name="RunManagerConfig.compileBeforeRunning" value="true" />
|
||||
<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="project.structure.last.edited" value="Modules" />
|
||||
<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_treeWidth0" value="100" />
|
||||
<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_treeWidth2" value="135" />
|
||||
<property name="cvs_file_history_treeWidth3" value="136" />
|
||||
<property name="MemberChooser.showClasses" value="true" />
|
||||
<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_treeWidth6" value="135" />
|
||||
<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_flatOrder1" value="1" />
|
||||
<property name="cvs_file_history_flatOrder6" value="6" />
|
||||
<property name="dynamic.classpath" value="false" />
|
||||
<property name="options.searchVisible" value="true" />
|
||||
<property name="dynamic.classpath" value="false" />
|
||||
</component>
|
||||
<component name="RecentsManager">
|
||||
<key name="CopyClassDialog.RECENTS_KEY">
|
||||
|
@ -493,7 +513,16 @@
|
|||
<option name="referencePos" value="0" />
|
||||
<option name="showLabels" value="true" />
|
||||
</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">
|
||||
<method>
|
||||
<option name="AntTarget" enabled="false" />
|
||||
|
@ -514,6 +543,14 @@
|
|||
<option name="Maven.BeforeRunTask" enabled="false" />
|
||||
</method>
|
||||
</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">
|
||||
<extension name="coverage" enabled="false" merge="false" />
|
||||
<extension name="snapshooter" />
|
||||
|
@ -587,6 +624,26 @@
|
|||
<option name="Maven.BeforeRunTask" enabled="false" />
|
||||
</method>
|
||||
</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">
|
||||
<option name="PORT" value="7001" />
|
||||
<deployment />
|
||||
|
@ -602,17 +659,6 @@
|
|||
<option name="Maven.BeforeRunTask" enabled="false" />
|
||||
</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="JUnit" factoryName="JUnit">
|
||||
<extension name="coverage" enabled="false" merge="false" />
|
||||
<extension name="snapshooter" />
|
||||
|
@ -640,7 +686,7 @@
|
|||
</method>
|
||||
</configuration>
|
||||
<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" />
|
||||
<option name="MAIN_CLASS_NAME" value="net.thauvin.erik.mobibot.Mobibot" />
|
||||
<option name="VM_PARAMETERS" value="" />
|
||||
|
@ -663,8 +709,27 @@
|
|||
<ConfigurationWrapper RunnerId="Run" />
|
||||
<method />
|
||||
</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="1" class="java.lang.String" itemvalue="Application.TwitterOAuth" />
|
||||
</list>
|
||||
</component>
|
||||
<component name="ScopeViewComponent">
|
||||
|
@ -768,12 +833,12 @@
|
|||
</todo-panel>
|
||||
</component>
|
||||
<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" />
|
||||
<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="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="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" />
|
||||
|
@ -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="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="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="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" />
|
||||
|
@ -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="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="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="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="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" />
|
||||
|
@ -909,31 +974,6 @@
|
|||
<option name="myLastEditedConfigurable" />
|
||||
</component>
|
||||
<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">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<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" />
|
||||
</provider>
|
||||
</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">
|
||||
<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>
|
||||
</entry>
|
||||
<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" />
|
||||
</provider>
|
||||
</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">
|
||||
<state line="382" column="80" selection-start="8127" selection-end="8127" vertical-scroll-proportion="0.0">
|
||||
<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">
|
||||
<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/Mobibot.java">
|
||||
<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>
|
||||
<element signature="imports" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</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">
|
||||
<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>
|
||||
|
@ -1048,7 +1116,13 @@
|
|||
<state key="ArtifactsStructureConfigurable.UI">
|
||||
<UIState>
|
||||
<splitter-proportions>
|
||||
<SplitterProportionsDataImpl />
|
||||
<SplitterProportionsDataImpl>
|
||||
<option name="proportions">
|
||||
<list>
|
||||
<option value="0.2" />
|
||||
</list>
|
||||
</option>
|
||||
</SplitterProportionsDataImpl>
|
||||
</splitter-proportions>
|
||||
<settings />
|
||||
</UIState>
|
||||
|
|
|
@ -94,8 +94,7 @@ public class Mobibot extends PircBot
|
|||
* The version strings.
|
||||
*/
|
||||
private static final String[] VERSION_STRS =
|
||||
{"Version: " + ReleaseInfo.getVersion() + '.' + ReleaseInfo.getBuildNumber() + " ("
|
||||
+ ISO_SDF.format(ReleaseInfo.getBuildDate()) + ')',
|
||||
{"Version: " + ReleaseInfo.getVersion() + '.' + ReleaseInfo.getBuildNumber() + " (" + ISO_SDF.format(ReleaseInfo.getBuildDate()) + ')',
|
||||
"Platform: " + System.getProperty("os.name") + " (" + System.getProperty("os.version") + ", "
|
||||
+ System.getProperty("os.arch") + ", " + System.getProperty("user.country") + ')',
|
||||
"Runtime: " + System.getProperty("java.runtime.name") + " (build "
|
||||
|
@ -471,19 +470,24 @@ public class Mobibot extends PircBot
|
|||
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.
|
||||
|
@ -754,9 +758,10 @@ public class Mobibot extends PircBot
|
|||
final String jkey = p.getProperty("jaiku-key");
|
||||
|
||||
// Get the Twitter properties
|
||||
final String tname = p.getProperty("twitter-user");
|
||||
final String tpwd = p.getProperty("twitter-pwd");
|
||||
final String tsrc = p.getProperty("twitter-src", "");
|
||||
final String tconsumerKey = p.getProperty("twitter-consumerKey");
|
||||
final String tconsumerSecret = p.getProperty("twitter-consumerSecret");
|
||||
final String ttoken = p.getProperty("twitter-token", "");
|
||||
final String ttokenSecret = p.getProperty("twitter-tokenSecret", "");
|
||||
|
||||
// Create the bot
|
||||
final Mobibot bot = new Mobibot(server, port, channel, logsDir);
|
||||
|
@ -796,10 +801,11 @@ public class Mobibot extends PircBot
|
|||
bot.setJaikuAuth(jname, jkey);
|
||||
}
|
||||
|
||||
if (isValidString(tname) && isValidString(tpwd))
|
||||
if (isValidString(tconsumerKey) && isValidString(tconsumerSecret) && isValidString(ttoken) && isValidString(
|
||||
ttokenSecret))
|
||||
{
|
||||
// Set the Twitter authentication
|
||||
bot.setTwitterAuth(tname, tpwd, tsrc);
|
||||
bot.setTwitterAuth(tconsumerKey, tconsumerSecret, ttoken, ttokenSecret);
|
||||
}
|
||||
|
||||
// Set the tags
|
||||
|
@ -1227,9 +1233,8 @@ public class Mobibot extends PircBot
|
|||
{
|
||||
if (_logger.isDebugEnabled())
|
||||
{
|
||||
_logger.debug(
|
||||
"Unable to reconnect to " + _ircServer + " after " + MAX_RECONNECT + " retries.",
|
||||
ex);
|
||||
_logger.debug("Unable to reconnect to " + _ircServer + " after " + MAX_RECONNECT + " retries.",
|
||||
ex);
|
||||
}
|
||||
|
||||
e.printStackTrace(System.err);
|
||||
|
@ -2490,11 +2495,18 @@ public class Mobibot extends PircBot
|
|||
*/
|
||||
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)
|
||||
{
|
||||
new Thread(new Twitter(this, sender, _twitterUser, _twitterPwd, _twitterSrc, message)).start();
|
||||
new Thread(new Twitter(this,
|
||||
sender,
|
||||
_twitterConsumerKey,
|
||||
_twitterConsumerSecret,
|
||||
_twitterToken,
|
||||
_twitterTokenSecret,
|
||||
message)).start();
|
||||
}
|
||||
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 key The Twitter password.
|
||||
* @param source The Twitter source.
|
||||
* @param consumerKey The Twitter consumer key.
|
||||
* @param consumerSecret The Twitter consumer secret.
|
||||
* @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;
|
||||
_twitterUser = user;
|
||||
_twitterSrc = source;
|
||||
_twitterConsumerKey = consumerKey;
|
||||
_twitterConsumerSecret = consumerSecret;
|
||||
_twitterToken = token;
|
||||
_twitterTokenSecret = tokenSecret;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* 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;
|
||||
|
||||
import java.util.Date;
|
||||
|
@ -20,21 +20,21 @@ public class ReleaseInfo {
|
|||
}
|
||||
|
||||
|
||||
/** buildDate (set during build process to 1284414355047L). */
|
||||
private static final Date buildDate = new Date(1284414355047L);
|
||||
/** buildDate (set during build process to 1284424974097L). */
|
||||
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
|
||||
*/
|
||||
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
|
||||
*/
|
||||
public static int getBuildNumber() { return 5; }
|
||||
public static int getBuildNumber() { return 6; }
|
||||
|
||||
|
||||
/** project (set during build process to "mobibot"). */
|
||||
|
|
|
@ -9,6 +9,10 @@
|
|||
*/
|
||||
package net.thauvin.erik.mobibot;
|
||||
|
||||
import twitter4j.Status;
|
||||
import twitter4j.TwitterFactory;
|
||||
import twitter4j.http.AccessToken;
|
||||
|
||||
/**
|
||||
* Inserts presence information into Twitter.
|
||||
*
|
||||
|
@ -25,14 +29,14 @@ public class Twitter implements Runnable
|
|||
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.
|
||||
|
@ -40,9 +44,14 @@ public class Twitter implements Runnable
|
|||
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.
|
||||
|
@ -54,17 +63,20 @@ public class Twitter implements Runnable
|
|||
*
|
||||
* @param bot The bot.
|
||||
* @param sender The nick of the person who sent the message.
|
||||
* @param user The Twitter user.
|
||||
* @param password The Twitter password.
|
||||
* @param source The Twitter client id/source.
|
||||
* @param consumerKey The Twitter consumer key.
|
||||
* @param consumerSecret The Twitter consumer secret.
|
||||
* @param accessToken The Twitter access token.
|
||||
* @param accessTokenSecret The Twitter access token secret.
|
||||
* @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;
|
||||
_user = user;
|
||||
_pwd = password;
|
||||
_source = source;
|
||||
_consumerKey = consumerKey;
|
||||
_consumerSecret = consumerSecret;
|
||||
_accessToken = accessToken;
|
||||
_accessTokenSecret = accessTokenSecret;
|
||||
_message = message;
|
||||
_sender = sender;
|
||||
}
|
||||
|
@ -73,16 +85,17 @@ public class Twitter implements Runnable
|
|||
{
|
||||
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))
|
||||
{
|
||||
twitter.setSource(_source);
|
||||
}
|
||||
final Status status = twitter.updateStatus(_message + " (" + _sender + ')');
|
||||
|
||||
twitter.update(_message + " (" + _sender + ')');
|
||||
|
||||
_bot.send(_sender, "You message was posted to http://twitter.com/" + _user);
|
||||
_bot.send(_sender,
|
||||
"You message was posted to http://twitter.com/" + twitter.getScreenName() + "/statuses/" + status
|
||||
.getId());
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
|
86
src/net/thauvin/erik/mobibot/TwitterOAuth.java
Normal file
86
src/net/thauvin/erik/mobibot/TwitterOAuth.java
Normal 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);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue