# HG changeset patch # User Jaroslav Tulach # Date 1289429044 -3600 # Node ID 6a5c4c2bda381bc29ebd30a7eca3ee39e2151c94 # Parent 3f7e9d629f55c881ee336e022d6733bcbca953a6 Highlighting specific code snippets diff -r 3f7e9d629f55 -r 6a5c4c2bda38 src/main/java/cz/xelfi/feedbook/Main.java --- a/src/main/java/cz/xelfi/feedbook/Main.java Wed Nov 10 23:24:05 2010 +0100 +++ b/src/main/java/cz/xelfi/feedbook/Main.java Wed Nov 10 23:44:04 2010 +0100 @@ -20,6 +20,7 @@ private static String APP_FEED; + // BEGIN: feedbook-login private static String login() throws IOException, FacebookException, URISyntaxException { FacebookJaxbRestClient login = new FacebookJaxbRestClient(APP_KEY, APP_SEC); final String token = login.auth_createToken(); @@ -28,6 +29,7 @@ browser(msg, u); return login.auth_getSession(token, false); } + // END: feedbook-login private static void browser(String msg, URI u) throws IOException { System.out.println(msg + ": " + u); @@ -88,6 +90,7 @@ break; } + // BEGIN: feedbook-permission while (!fb.users_hasAppPermission(Permission.SHARE_ITEM)) { URI u = new URI("https://graph.facebook.com/oauth/authorize?" + "client_id=" + APP_KEY @@ -95,6 +98,7 @@ + "&scope=publish_stream"); browser("Need permission to publish links", u); } + // END: feedbook-permission Preferences n = prefs.node("feeds"); int cnt = 0; for (Object o : rss.getItems()) { @@ -104,9 +108,14 @@ continue; } cnt++; - System.out.printf("link: %s date: %s title: %s\n", item.getLink(), item.getPubDate(), item.getTitle()); + // BEGIN: feedbook-publish-link + System.out.printf( + "link: %s date: %s title: %s\n", + item.getLink(), item.getPubDate(), item.getTitle() + ); Long ok = fb.links_post(user, item.getLink(), item.getTitle()); System.out.println("posted as " + ok); + // END: feedbook-publish-link n.putLong(hex, ok); n.put(hex + ".url", item.getLink()); }