summaryrefslogtreecommitdiff
path: root/indra/newview/lltranslate.h
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/lltranslate.h')
-rw-r--r--indra/newview/lltranslate.h37
1 files changed, 37 insertions, 0 deletions
diff --git a/indra/newview/lltranslate.h b/indra/newview/lltranslate.h
index 1bf6965fd4..672a56af8b 100644
--- a/indra/newview/lltranslate.h
+++ b/indra/newview/lltranslate.h
@@ -44,6 +44,10 @@ public:
const std::string &to_lang,
const std::string &text) const = 0;
+ virtual void getKeyVerificationURL(
+ std::string &url,
+ const std::string &key) const = 0;
+
virtual bool parseResponse(
int& status,
const std::string& body,
@@ -67,6 +71,9 @@ public:
const std::string &from_lang,
const std::string &to_lang,
const std::string &text) const;
+ /*virtual*/ void getKeyVerificationURL(
+ std::string &url,
+ const std::string &key) const;
/*virtual*/ bool parseResponse(
int& status,
const std::string& body,
@@ -96,6 +103,9 @@ public:
const std::string &from_lang,
const std::string &to_lang,
const std::string &text) const;
+ /*virtual*/ void getKeyVerificationURL(
+ std::string &url,
+ const std::string &key) const;
/*virtual*/ bool parseResponse(
int& status,
const std::string& body,
@@ -112,6 +122,12 @@ class LLTranslate
LOG_CLASS(LLTranslate);
public :
+
+ typedef enum e_service {
+ SERVICE_BING,
+ SERVICE_GOOGLE,
+ } EService;
+
class TranslationReceiver: public LLHTTPClient::Responder
{
public:
@@ -134,13 +150,34 @@ public :
const LLTranslationAPIHandler& mHandler;
};
+ class KeyVerificationReceiver: public LLHTTPClient::Responder
+ {
+ public:
+ EService getService() const;
+
+ protected:
+ KeyVerificationReceiver(EService service);
+ /*virtual*/ void completedRaw(
+ U32 http_status,
+ const std::string& reason,
+ const LLChannelDescriptors& channels,
+ const LLIOPipe::buffer_ptr_t& buffer);
+ virtual void setVerificationStatus(bool ok) = 0;
+
+ EService mService;
+ };
+
typedef boost::intrusive_ptr<TranslationReceiver> TranslationReceiverPtr;
+ typedef boost::intrusive_ptr<KeyVerificationReceiver> KeyVerificationReceiverPtr;
static void translateMessage(TranslationReceiverPtr &receiver, const std::string &from_lang, const std::string &to_lang, const std::string &mesg);
+ static void verifyKey(KeyVerificationReceiverPtr& receiver, const std::string& key);
static std::string getTranslateLanguage();
private:
static const LLTranslationAPIHandler& getPreferredHandler();
+ static const LLTranslationAPIHandler& getHandler(EService service);
+ static void sendRequest(const std::string& url, LLHTTPClient::ResponderPtr responder);
};
#endif