Example usage for twitter4j Relationship canSourceDm

List of usage examples for twitter4j Relationship canSourceDm

Introduction

In this page you can find the example usage for twitter4j Relationship canSourceDm.

Prototype

boolean canSourceDm();

Source Link

Document

Checks if source user can send dm to target user

Usage

From source file:twitter4j.examples.friendship.ShowFriendship.java

License:Apache License

/**
 * Usage: java twitter4j.examples.friendship.ShowFriendship  [source screen name] [target screen name]
 *
 * @param args message/*  www .  j a  v a  2 s  .  c  o m*/
 */
public static void main(String[] args) {
    if (args.length < 2) {
        System.out.println(
                "Usage: java twitter4j.examples.friendship.ShowFriendship [source screen name] [target screen name]");
        System.exit(-1);
    }
    try {
        Twitter twitter = new TwitterFactory().getInstance();
        Relationship relationship = twitter.showFriendship(args[0], args[1]);
        System.out.println("isSourceBlockingTarget: " + relationship.isSourceBlockingTarget());
        System.out.println("isSourceFollowedByTarget: " + relationship.isSourceFollowedByTarget());
        System.out.println("isSourceFollowingByTarget: " + relationship.isSourceFollowingTarget());
        System.out.println("isSourceNotificationsEnabled: " + relationship.isSourceNotificationsEnabled());
        System.out.println("canSourceDm: " + relationship.canSourceDm());
        System.exit(0);
    } catch (TwitterException te) {
        te.printStackTrace();
        System.out.println("Failed to show friendship: " + te.getMessage());
        System.exit(-1);
    }
}