author | Michael Krelin <hacker@klever.net> | 2008-01-31 22:07:53 (UTC) |
---|---|---|
committer | Michael Krelin <hacker@klever.net> | 2008-01-31 22:07:53 (UTC) |
commit | 67133db1f33b142561575cdf99fedca8fb6ad79b (patch) (side-by-side diff) | |
tree | 4320aff864ce4848808c6643bf289b9bbfe70a60 /include/opkele/util.h | |
parent | 66b14d4368d661daf2248e36ac4f9a3f69f6a75a (diff) | |
download | libopkele-67133db1f33b142561575cdf99fedca8fb6ad79b.zip libopkele-67133db1f33b142561575cdf99fedca8fb6ad79b.tar.gz libopkele-67133db1f33b142561575cdf99fedca8fb6ad79b.tar.bz2 |
added util::change_mode_message_proxy class
generatlized checkauth_message_proxy and added it to util namespace. To be
later used for constructing setup url in 1.0 checkid_immediate reply.
Signed-off-by: Michael Krelin <hacker@klever.net>
-rw-r--r-- | include/opkele/util.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/include/opkele/util.h b/include/opkele/util.h index e9176b0..6f3ddf6 100644 --- a/include/opkele/util.h +++ b/include/opkele/util.h @@ -131,21 +131,39 @@ namespace opkele { /** * Normalize http(s) URI according to RFC3986, section 6. URI is * expected to have scheme: in front of it. * @param uri URI * @return normalized URI * @throw not_implemented in case of non-httpi(s) URI * @throw bad_input in case of malformed URI */ string rfc_3986_normalize_uri(const string& uri); string& strip_uri_fragment_part(string& uri); string abi_demangle(const char* mn); string base64_signature(const assoc_t& assoc,const basic_openid_message& om); + class change_mode_message_proxy : public basic_openid_message { + public: + const basic_openid_message& x; + const string& mode; + + change_mode_message_proxy(const basic_openid_message& xx,const string& m) : x(xx), mode(m) { } + + bool has_field(const string& n) const { return x.has_field(n); } + const string& get_field(const string& n) const { + return (n=="mode")?mode:x.get_field(n); } + bool has_ns(const string& uri) const {return x.has_ns(uri); } + string get_ns(const string& uri) const { return x.get_ns(uri); } + fields_iterator fields_begin() const { + return x.fields_begin(); } + fields_iterator fields_end() const { + return x.fields_end(); } + }; + } } #endif /* __OPKELE_UTIL_H */ |