Updated Twitter4J for API 1.1 support.
This commit is contained in:
parent
af780428d4
commit
3b9c5d6431
13 changed files with 216 additions and 146 deletions
|
@ -36,9 +36,9 @@
|
|||
*/
|
||||
package net.thauvin.erik.mobibot;
|
||||
|
||||
import org.json.XML;
|
||||
import twitter4j.internal.http.BASE64Encoder;
|
||||
import twitter4j.internal.org.json.JSONObject;
|
||||
import twitter4j.internal.org.json.XML;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.InputStreamReader;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* Created by JReleaseInfo AntTask from Open Source Competence Group */
|
||||
/* Creation date Fri Aug 24 02:59:30 PDT 2012 */
|
||||
/* Creation date Wed Jun 12 14:18:56 PDT 2013 */
|
||||
package net.thauvin.erik.mobibot;
|
||||
|
||||
import java.util.Date;
|
||||
|
@ -20,21 +20,21 @@ public class ReleaseInfo {
|
|||
}
|
||||
|
||||
|
||||
/** buildDate (set during build process to 1345802370733L). */
|
||||
private static final Date buildDate = new Date(1345802370733L);
|
||||
/** buildDate (set during build process to 1371071936682L). */
|
||||
private static final Date buildDate = new Date(1371071936682L);
|
||||
|
||||
/**
|
||||
* Get buildDate (set during build process to Fri Aug 24 02:59:30 PDT 2012).
|
||||
* Get buildDate (set during build process to Wed Jun 12 14:18:56 PDT 2013).
|
||||
* @return Date buildDate
|
||||
*/
|
||||
public static Date getBuildDate() { return buildDate; }
|
||||
|
||||
|
||||
/**
|
||||
* Get buildNumber (set during build process to 4).
|
||||
* Get buildNumber (set during build process to 10).
|
||||
* @return int buildNumber
|
||||
*/
|
||||
public static int getBuildNumber() { return 4; }
|
||||
public static int getBuildNumber() { return 10; }
|
||||
|
||||
|
||||
/** project (set during build process to "mobibot"). */
|
||||
|
|
|
@ -38,7 +38,7 @@ package net.thauvin.erik.mobibot;
|
|||
|
||||
import twitter4j.Status;
|
||||
import twitter4j.TwitterFactory;
|
||||
import twitter4j.http.AccessToken;
|
||||
import twitter4j.conf.ConfigurationBuilder;
|
||||
|
||||
/**
|
||||
* Inserts presence information into Twitter.
|
||||
|
@ -112,17 +112,22 @@ public class Twitter implements Runnable
|
|||
{
|
||||
try
|
||||
{
|
||||
final twitter4j.Twitter twitter = new TwitterFactory().getOAuthAuthorizedInstance(_consumerKey,
|
||||
_consumerSecret,
|
||||
new AccessToken(
|
||||
_accessToken,
|
||||
_accessTokenSecret));
|
||||
final ConfigurationBuilder cb = new ConfigurationBuilder();
|
||||
cb.setDebugEnabled(true).setOAuthConsumerKey(_consumerKey).setOAuthConsumerSecret(_consumerSecret)
|
||||
.setOAuthAccessToken(_accessToken).setOAuthAccessTokenSecret(_accessTokenSecret);
|
||||
final TwitterFactory tf = new TwitterFactory(cb.build());
|
||||
final twitter4j.Twitter twitter = tf.getInstance();
|
||||
|
||||
final Status status = twitter.updateStatus(_message + " (" + _sender + ')');
|
||||
|
||||
_bot.send(_sender,
|
||||
"You message was posted to http://twitter.com/" + twitter.getScreenName() + "/statuses/" + status
|
||||
.getId());
|
||||
|
||||
twitter.shutdown();
|
||||
|
||||
// @TODO Does it help?
|
||||
twitter4j.internal.json.DataObjectFactoryUtil.clearThreadLocalMap();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
|
|
@ -2,8 +2,8 @@ package net.thauvin.erik.mobibot;
|
|||
|
||||
import twitter4j.TwitterException;
|
||||
import twitter4j.TwitterFactory;
|
||||
import twitter4j.http.AccessToken;
|
||||
import twitter4j.http.RequestToken;
|
||||
import twitter4j.auth.AccessToken;
|
||||
import twitter4j.auth.RequestToken;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.InputStreamReader;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue