monotone

monotone Mtn Source Tree

Root/botan/ui.cpp

1/*************************************************
2* User Interface Source File *
3* (C) 1999-2005 The Botan Project *
4*************************************************/
5
6#include <botan/ui.h>
7
8namespace Botan {
9
10/*************************************************
11* Get a passphrase from the user *
12*************************************************/
13std::string User_Interface::get_passphrase(const std::string&,
14 const std::string&,
15 UI_Result& action) const
16 {
17 action = OK;
18
19 if(!first_try)
20 action = CANCEL_ACTION;
21
22 return preset_passphrase;
23 }
24
25/*************************************************
26* User_Interface Constructor *
27*************************************************/
28User_Interface::User_Interface(const std::string& preset) :
29 preset_passphrase(preset)
30 {
31 first_try = true;
32 }
33
34namespace UI {
35
36/*************************************************
37* The current pulse function *
38*************************************************/
39pulse_func pulse_f = 0;
40void* pulse_f_data = 0;
41
42/*************************************************
43* Set the UI pulse function *
44*************************************************/
45void set_pulse(pulse_func p, void* p_data)
46 {
47 pulse_f = p;
48 pulse_f_data = p_data;
49 }
50
51/*************************************************
52* Call the UI pulse function *
53*************************************************/
54void pulse(Pulse_Type type)
55 {
56 if(pulse_f)
57 pulse_f(type, pulse_f_data);
58 }
59
60}
61
62}

Archive Download this file

Branches

Tags

Quick Links:     www.monotone.ca    -     Downloads    -     Documentation    -     Wiki    -     Code Forge    -     Build Status