This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* This file is part of Z-Reader (c) 2013 | |
* | |
* Z-Reader is free software: you can redistribute it and/or modify | |
* it under the terms of the GNU General Public License as published by | |
* the Free Software Foundation, either version 3 of the License, or | |
* (at your option) any later version. | |
* | |
* Z-Reader is distributed in the hope that it will be useful, | |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* This file is part of Z-Reader (c) 2013 | |
* | |
* Z-Reader is free software: you can redistribute it and/or modify | |
* it under the terms of the GNU General Public License as published by | |
* the Free Software Foundation, either version 3 of the License, or | |
* (at your option) any later version. | |
* | |
* Z-Reader is distributed in the hope that it will be useful, | |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* This file is part of Z-Reader (c) 2013 | |
* | |
* Z-Reader is free software: you can redistribute it and/or modify | |
* it under the terms of the GNU General Public License as published by | |
* the Free Software Foundation, either version 3 of the License, or | |
* (at your option) any later version. | |
* | |
* Z-Reader is distributed in the hope that it will be useful, | |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* This file is part of Z-Reader (c) 2013 | |
* | |
* Z-Reader is free software: you can redistribute it and/or modify | |
* it under the terms of the GNU General Public License as published by | |
* the Free Software Foundation, either version 3 of the License, or | |
* (at your option) any later version. | |
* | |
* Z-Reader is distributed in the hope that it will be useful, | |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private def exchange(request : Req)(code : String) : Option[Token] = { | |
val client = new DefaultHttpClient | |
val request = new HttpPost(entryURL) | |
val params = List( | |
("code", code), | |
("client_id", settings.clientId), | |
("client_secret", settings.clientSecret), | |
("redirectUri", settings.redirectUri), | |
("grantType", "authorization_code")). | |
map(p => new BasicNameValuePair(p._1, p._2)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
case class Callback(settings: Settings) extends RestHelper { | |
private def exchange(request : Req)(code : String): Option[Token] = { | |
val client = new DefaultHttpClient | |
val request = new HttpPost(entryURL) | |
val params = List( | |
("code", code), | |
("client_id", settings.clientId), | |
("client_secret", settings.clientSecret), | |
("redirectUri", settings.redirectUri), | |
("grantType", "authorization_code")). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Token for access to Google API | |
* @param accessToken the token that can be sent to a Google API | |
* @param refreshToken a token that may be used to obtain a new access token. Refresh tokens are valid until the user revokes access. This field is only present if access_type=offline is included in the authorization code request. | |
* @param expiresIn the remaining lifetime on the access token | |
* @param tokenType indicates the type of token returned. At this time, this field will always have the value Bearer | |
*/ | |
case class Token(accessToken : String, | |
refreshToken : Option[String] = None, | |
expiresIn : Integer, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
abstract class Response | |
case class Token() extends Response | |
case class Problem() extends Response | |
case class Connection() extends Problem | |
case class InvalidResponse() extends Problem |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <boost/utility.hpp> | |
#include <boost/asio.hpp> | |
#include <boost/bind.hpp> | |
class Repeater : boost::noncopyable | |
{ | |
public: | |
typedef bool(*Action)(); | |
Repeater(boost::asio::io_service& io, | |
Action action, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <fstream> | |
#include <iostream> | |
#include <unordered_set> | |
#include <boost/format.hpp> | |
typedef std::unordered_set<uint64_t> Set; | |
void load(Set& data, const std::string& filename) | |
{ | |
uint64_t current; |
OlderNewer