Highlighting specific code snippets
authorJaroslav Tulach <jtulach@netbeans.org>
Wed, 10 Nov 2010 23:44:04 +0100
changeset 96a5c4c2bda38
parent 8 3f7e9d629f55
child 10 febc09a6a7cf
Highlighting specific code snippets
src/main/java/cz/xelfi/feedbook/Main.java
     1.1 --- a/src/main/java/cz/xelfi/feedbook/Main.java	Wed Nov 10 23:24:05 2010 +0100
     1.2 +++ b/src/main/java/cz/xelfi/feedbook/Main.java	Wed Nov 10 23:44:04 2010 +0100
     1.3 @@ -20,6 +20,7 @@
     1.4      private static String APP_FEED;
     1.5      
     1.6      
     1.7 +    // BEGIN: feedbook-login
     1.8      private static String login() throws IOException, FacebookException, URISyntaxException {
     1.9          FacebookJaxbRestClient login = new FacebookJaxbRestClient(APP_KEY, APP_SEC);
    1.10          final String token = login.auth_createToken();
    1.11 @@ -28,6 +29,7 @@
    1.12          browser(msg, u);
    1.13          return login.auth_getSession(token, false); 
    1.14      }
    1.15 +    // END: feedbook-login
    1.16  
    1.17      private static void browser(String msg, URI u) throws IOException {
    1.18          System.out.println(msg + ": " + u);
    1.19 @@ -88,6 +90,7 @@
    1.20              break;
    1.21          }
    1.22          
    1.23 +        // BEGIN: feedbook-permission
    1.24          while (!fb.users_hasAppPermission(Permission.SHARE_ITEM)) {
    1.25              URI u = new URI("https://graph.facebook.com/oauth/authorize?"
    1.26                      + "client_id=" + APP_KEY
    1.27 @@ -95,6 +98,7 @@
    1.28                      + "&scope=publish_stream");
    1.29              browser("Need permission to publish links", u);
    1.30          }
    1.31 +        // END: feedbook-permission
    1.32          Preferences n = prefs.node("feeds");
    1.33          int cnt = 0;
    1.34          for (Object o : rss.getItems()) {
    1.35 @@ -104,9 +108,14 @@
    1.36                  continue;
    1.37              }
    1.38              cnt++;
    1.39 -            System.out.printf("link: %s date: %s title: %s\n", item.getLink(), item.getPubDate(), item.getTitle());
    1.40 +            // BEGIN: feedbook-publish-link
    1.41 +            System.out.printf(
    1.42 +                "link: %s date: %s title: %s\n", 
    1.43 +                item.getLink(), item.getPubDate(), item.getTitle()
    1.44 +            );
    1.45              Long ok = fb.links_post(user, item.getLink(), item.getTitle());
    1.46              System.out.println("posted as " + ok);
    1.47 +            // END: feedbook-publish-link
    1.48              n.putLong(hex, ok);
    1.49              n.put(hex + ".url", item.getLink());
    1.50          }