Skip to content

Commit

Permalink
introduce includeEmails property
Browse files Browse the repository at this point in the history
  • Loading branch information
yusuke committed Apr 24, 2016
1 parent 39cd327 commit 733f407
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 9 deletions.
12 changes: 4 additions & 8 deletions twitter4j-core/src/main/java/twitter4j/TwitterImpl.java
Expand Up @@ -238,13 +238,13 @@ public ResponseList<Status> lookup(long... ids) throws TwitterException {
public UploadedMedia uploadMedia(File image) throws TwitterException {
checkFileValidity(image);
return new UploadedMedia(post(conf.getUploadBaseURL() + "media/upload.json"
, new HttpParameter[]{new HttpParameter("media", image)}).asJSONObject());
, new HttpParameter("media", image)).asJSONObject());
}

@Override
public UploadedMedia uploadMedia(String fileName, InputStream image) throws TwitterException {
return new UploadedMedia(post(conf.getUploadBaseURL() + "media/upload.json"
, new HttpParameter[]{new HttpParameter("media", fileName, image)}).asJSONObject());
, new HttpParameter("media", fileName, image)).asJSONObject());
}

/* Search Resources */
Expand Down Expand Up @@ -578,14 +578,10 @@ public AccountSettings getAccountSettings() throws TwitterException {

@Override
public User verifyCredentials() throws TwitterException {
return super.fillInIDAndScreenName();
return super.fillInIDAndScreenName(
new HttpParameter[]{new HttpParameter("include_email", conf.isIncludeEmailEnabled())});
}

@Override
public User verifyCredentials(HttpParameter[] parameters) throws TwitterException {
return super.fillInIDAndScreenName(parameters);
}

@Override
public AccountSettings updateAccountSettings(Integer trend_locationWoeid,
Boolean sleep_timeEnabled, String start_sleepTime,
Expand Down
Expand Up @@ -47,7 +47,6 @@ public interface UsersResources {
* @since Twitter4J 2.0.0
*/
User verifyCredentials() throws TwitterException;
User verifyCredentials(HttpParameter[] parameters) throws TwitterException;

/**
* Updates the current trend, geo, language, timezone and sleep time information for the authenticating user.
Expand Down
Expand Up @@ -118,4 +118,6 @@ public interface Configuration extends AuthorizationConfiguration, java.io.Seria
boolean isIncludeExtAltTextEnabled();

boolean isDaemonEnabled();

boolean isIncludeEmailEnabled();
}
10 changes: 10 additions & 0 deletions twitter4j-core/src/main/java/twitter4j/conf/ConfigurationBase.java
Expand Up @@ -73,6 +73,7 @@ class ConfigurationBase implements Configuration, java.io.Serializable {
private boolean includeEntitiesEnabled = true;
private boolean trimUserEnabled = false;
private boolean includeExtAltTextEnabled = true;
private boolean includeEmailEnabled = false;

private boolean jsonStoreEnabled = false;

Expand Down Expand Up @@ -626,6 +627,15 @@ protected void setDaemonEnabled(boolean daemonEnabled) {
this.daemonEnabled = daemonEnabled;
}

@Override
public boolean isIncludeEmailEnabled() {
return includeEmailEnabled;
}

protected void setIncludeEmailEnabled(boolean includeEmailEnabled) {
this.includeEmailEnabled = includeEmailEnabled;
}

public void setTrimUserEnabled(boolean enabled) {
this.trimUserEnabled = enabled;
}
Expand Down
Expand Up @@ -72,6 +72,8 @@ public final class PropertyConfiguration extends ConfigurationBase implements ja
private static final String ASYNC_DISPATCHER_IMPL = "async.dispatcherImpl";
private static final String INCLUDE_MY_RETWEET = "includeMyRetweet";
private static final String INCLUDE_ENTITIES = "includeEntities";
private static final String INCLUDE_EMAIL = "includeEmail";
private static final String INCLUDE_EXT_ALT_TEXT = "includeExtAltText";
private static final String LOGGER_FACTORY = "loggerFactory";
private static final String JSON_STORE_ENABLED = "jsonStoreEnabled";
private static final String MBEAN_ENABLED = "mbeanEnabled";
Expand Down Expand Up @@ -348,6 +350,12 @@ private void setFieldsWithPrefix(Properties props, String prefix) {
if (notNull(props, prefix, INCLUDE_ENTITIES)) {
setIncludeEntitiesEnabled(getBoolean(props, prefix, INCLUDE_ENTITIES));
}
if (notNull(props, prefix, INCLUDE_EMAIL)) {
setIncludeEmailEnabled(getBoolean(props, prefix, INCLUDE_EMAIL));
}
if (notNull(props, prefix, INCLUDE_EXT_ALT_TEXT)) {
setIncludeExtAltTextEnabled(getBoolean(props, prefix, INCLUDE_EXT_ALT_TEXT));
}
if (notNull(props, prefix, LOGGER_FACTORY)) {
setLoggerFactory(getString(props, prefix, LOGGER_FACTORY));
}
Expand Down

0 comments on commit 733f407

Please sign in to comment.