revert between 56095 -> 55830 in arch
[AROS.git] / workbench / libs / reqtools / rtinternalgetpassword.c
blob29eed1b6d2271386fdb707ee77c120b2d9354842
1 /*
2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc:
6 Lang: English
7 */
9 #include <exec/types.h>
10 #include <proto/exec.h>
11 #include <proto/reqtools.h>
12 #include <proto/intuition.h>
13 #include <exec/libraries.h>
14 #include <exec/memory.h>
15 #include <libraries/reqtools.h>
16 #include <aros/libcall.h>
18 #include "reqtools_intern.h"
19 #include "general.h"
21 /*****************************************************************************
23 NAME */
25 AROS_LH5(BOOL, rtInternalGetPasswordA,
27 /* SYNOPSIS */
29 AROS_LHA(UBYTE *, buffer, A1),
30 AROS_LHA(ULONG, checksum, D1),
31 AROS_LHA(PWCALLBACKFUNPTR, pwcallback, D2),
32 AROS_LHA(struct rtReqInfo *, reqinfo, A3),
33 AROS_LHA(struct TagItem *, taglist, A0),
35 /* LOCATION */
37 struct ReqToolsBase *, ReqToolsBase, 14, ReqTools)
39 /* FUNCTION
40 Puts up a requester to verify a password from the user.
42 'reqinfo' can be used to customize the requester. For greater
43 control use the tags listed below. The advantage of the rtReqInfo
44 structure is that it is global, where tags have to be specified
45 each function call. See libraries/reqtools.[hi] for a description
46 of the rtReqInfo structure.
48 INPUTS
49 buffer - pointer to buffer to hold characters entered.
50 checksum - checksum of the password, passed to pwcallback.
51 really just the least significant 16 bits.
52 pwcallback - pointer to password callback function.
53 reqinfo - pointer to a rtReqInfo structure allocated with
54 rtAllocRequest() or NULL.
55 taglist - pointer to a TagItem array.
57 TAGS
58 RT_Window - see rtEZRequestA()
60 RT_IDCMPFlags - see rtEZRequestA()
62 RT_ReqPos - see rtEZRequestA()
64 RT_LeftOffset - see rtEZRequestA()
66 RT_TopOffset - see rtEZRequestA()
68 RT_PubScrName - see rtEZRequestA()
70 RT_Screen - see rtEZRequestA()
72 RT_ReqHandler - see rtEZRequestA()
74 RT_WaitPointer - see rtEZRequestA()
76 RT_Underscore - [V38] see rtEZRequestA(). Only when you also use
77 the RTGS_GadFmt tag.
79 RT_LockWindow - [V38] see rtEZRequestA()
81 RT_ScreenToFront - [V38] see rtEZRequestA()
83 RT_ShareIDCMP - [V38] see rtEZRequestA()
85 RT_Locale - [V38] see rtEZRequestA()
87 RT_IntuiMsgFunc - [V38] see rtEZRequestA()
89 RT_TextAttr - [V38] see rtEZRequestA(). Note that under 1.2/1.3 the
90 string gadget's font will remain the screen font.
92 RTGS_Width - (ULONG) Width of requester window in pixels. This is
93 only a suggestion. rtGetStringA() will not go below a certain
94 width.
96 RTGS_AllowEmpty - (BOOL) If RTGS_AllowEmpty is TRUE an empty string
97 will also be accepted and returned. Defaults to FALSE, meaning
98 that if the user enters an empty string the requester will be
99 canceled.
101 RTGS_GadFmt - (char *) [V38] Using this tag you can offer the user
102 severalresponses. See rtEZRequestA() for more information. Note
103 that selecting this gadget is considered a positive response so
104 the string in the gadget is copied to 'buffer'.
106 RTGS_GadFmtArgs - (APTR) [V38] If you used formatting codes with
107 RTGS_GadFmt use this tag to pass the arguments.
109 RTGS_Invisible - (BOOL) [V38] Using this tag you can switch on
110 invisible typing. Very useful if you need to get something like
111 a password from the user. It is strongly advised to use an
112 empty initial string or the user may get very confused!
113 Default is FALSE.
115 RTGS_BackFill - (BOOL) [V38] Backfill requester window with
116 pattern. Default TRUE.
118 RTGS_TextFmt - (char *) [V38] Print these lines of text above the
119 gadget in the requester. Very useful to inform the user of what
120 he should enter. Most of the time you will also want to set the
121 GSREQF_CENTERTEXT flag. If you set the RTGS_BackFill tag to
122 FALSE _no_ recessed border will be placed around the text.
123 Formatting codes may be used in the string (see
124 RTGS_TextFmtArgs tag).
126 RTGS_TextFmtArgs - (APTR) [V38] If you used formatting codes with
127 RTGS_TextFmt use this tag to pass the arguments.
129 RTGS_Flags - (ULONG) [V38]
131 GSREQF_CENTERTEXT - centers each line of text above the gadget
132 in the requester window. Should be generally set.
134 GSREQF_HIGHLIGHTTEXT - Highlight text above the gadget. You
135 will normally only want to use this if you also turned off
136 the window backfilling.
138 RESULT
139 ret - TRUE if user entered something, FALSE if not. If one of your
140 idcmp flags caused the requester to end 'ret' will hold this
141 flag. If you used the RTGS_GadFmt tag the return code will hold
142 the value of the response as with rtEZRequestA().
144 NOTES
145 This function is private, and it should NOT be used by user code
146 (Currently it is used by powerpacker.library on native AmigaOS).
148 The contents of the buffer will be one nullbyte if the requester is
149 aborted. This is different to rtGetStringA. Maximum password length
150 is 16 chars, the requester title is always "Password" and
151 RTGS_Invisible is TRUE by default.
153 Automatically adjusts the requester to the screen font.
155 rtInternalGetPasswordA() checks the pr_WindowPtr of your process
156 to find the screen to put the requester on.
158 If you use the RTGS_GadFmt tag the return value is not always the
159 gadget the user selected. If the string gadget is empty and the
160 user presses the leftmost gadget (normally 'Ok')
161 rtInternalGetPasswordA() will return 0 (FALSE)! If the string gadget
162 is empty and the user presses one of the other gadgets
163 rtInternalGetPasswordA() _will_ return its value! Important:
164 'buffer' will not be changed in either of these cases.
165 If you set the RTGS_AllowEmpty tag to TRUE 'buffer' will always be
166 changed of course, and rtGetString() will always return the value
167 of the gadget pressed.
169 EXAMPLE
171 BUGS
172 This documentation is intentionally incomplete.
174 SEE ALSO
176 INTERNALS
178 HISTORY
180 ******************************************************************************/
182 AROS_LIBFUNC_INIT
184 buffer[0] = '\0';
186 return GetString(buffer,
188 "Password",
189 checksum & 0xffff,
190 (ULONG *) pwcallback,
191 CHECK_PASSWORD,
192 reqinfo,
193 taglist);
195 AROS_LIBFUNC_EXIT
197 } /* rtInternalGetPasswordA */