aboutsummaryrefslogtreecommitdiffstats
path: root/src/ui.cpp
diff options
context:
space:
mode:
authorlloyd <[email protected]>2006-05-18 18:33:19 +0000
committerlloyd <[email protected]>2006-05-18 18:33:19 +0000
commita2c99d3270eb73ef2db5704fc54356c6b75096f8 (patch)
treead3d6c4fcc8dd0f403f8105598943616246fe172 /src/ui.cpp
Initial checkin1.5.6
Diffstat (limited to 'src/ui.cpp')
-rw-r--r--src/ui.cpp62
1 files changed, 62 insertions, 0 deletions
diff --git a/src/ui.cpp b/src/ui.cpp
new file mode 100644
index 000000000..f8ce0c544
--- /dev/null
+++ b/src/ui.cpp
@@ -0,0 +1,62 @@
+/*************************************************
+* User Interface Source File *
+* (C) 1999-2006 The Botan Project *
+*************************************************/
+
+#include <botan/ui.h>
+
+namespace Botan {
+
+/*************************************************
+* Get a passphrase from the user *
+*************************************************/
+std::string User_Interface::get_passphrase(const std::string&,
+ const std::string&,
+ UI_Result& action) const
+ {
+ action = OK;
+
+ if(!first_try)
+ action = CANCEL_ACTION;
+
+ return preset_passphrase;
+ }
+
+/*************************************************
+* User_Interface Constructor *
+*************************************************/
+User_Interface::User_Interface(const std::string& preset) :
+ preset_passphrase(preset)
+ {
+ first_try = true;
+ }
+
+namespace UI {
+
+/*************************************************
+* The current pulse function *
+*************************************************/
+pulse_func pulse_f = 0;
+void* pulse_f_data = 0;
+
+/*************************************************
+* Set the UI pulse function *
+*************************************************/
+void set_pulse(pulse_func p, void* p_data)
+ {
+ pulse_f = p;
+ pulse_f_data = p_data;
+ }
+
+/*************************************************
+* Call the UI pulse function *
+*************************************************/
+void pulse(Pulse_Type type)
+ {
+ if(pulse_f)
+ pulse_f(type, pulse_f_data);
+ }
+
+}
+
+}