[ekg2-commit] r4012 - in trunk: ekg plugins/gg plugins/jabber plugins/ncurses: trunk/ekg/plugins.h trunk/ekg/queries.h trunk/ekg/sessions.c trunk/ekg/stuff.c trunk/ekg/stuff.h trunk/ekg/themes.c trunk/plugins/gg/pubdir.c trunk/plugins/jabber/commands.c trunk/plugins/ncurses/old.c
SVN commit
svn w toxygen.net
Sob, 7 Cze 2008, 12:44:25 CEST
Author: peres
Date: 2008-06-07 12:44:25 +0200 (Sat, 07 Jun 2008)
New Revision: 4012
Modified:
trunk/ekg/plugins.h
trunk/ekg/queries.h
trunk/ekg/sessions.c
trunk/ekg/stuff.c
trunk/ekg/stuff.h
trunk/ekg/themes.c
trunk/plugins/gg/pubdir.c
trunk/plugins/jabber/commands.c
trunk/plugins/ncurses/old.c
Log:
Support custom prompts and 'norepeat' in UI_PASSWORD_INPUT.
Modified: trunk/ekg/plugins.h
===================================================================
--- trunk/ekg/plugins.h 2008-06-05 22:13:36 UTC (rev 4011)
+++ trunk/ekg/plugins.h 2008-06-07 10:44:25 UTC (rev 4012)
@@ -26,7 +26,7 @@
#include "dynstuff.h"
#include "sessions.h"
-#define EKG_ABI_VER 3963
+#define EKG_ABI_VER 3998
#define EXPORT __attribute__ ((visibility("default")))
Modified: trunk/ekg/queries.h
===================================================================
--- trunk/ekg/queries.h 2008-06-05 22:13:36 UTC (rev 4011)
+++ trunk/ekg/queries.h 2008-06-07 10:44:25 UTC (rev 4012)
@@ -447,6 +447,8 @@
{ UI_PASSWORD_INPUT, "ui-password-input", {
QUERY_ARG_CHARP, /* password pointer storage */
+ QUERY_ARG_CHARP, /* alternate input prompt (&NULL = default) */
+ QUERY_ARG_CHARP, /* alternate repeat prompt (&NULL = default, NULL = no) */
QUERY_ARG_END } },
{ PROTOCOL_DISCONNECTING, "protocol-disconnecting", { /* meant to be send before user-initiated disconnect,
Modified: trunk/ekg/sessions.c
===================================================================
--- trunk/ekg/sessions.c 2008-06-05 22:13:36 UTC (rev 4011)
+++ trunk/ekg/sessions.c 2008-06-07 10:44:25 UTC (rev 4012)
@@ -1197,7 +1197,9 @@
}
if (!xstrcmp(params[1], "password")) {
- char *pass = password_input();
+ char *prompt = format_string("session_password_input", session_name(session));
+ char *pass = password_input(prompt, NULL, 1);
+ xfree(prompt);
if (pass) {
session_set(session, params[1], pass);
@@ -1238,7 +1240,9 @@
}
if (!xstrcmp(params[2], "password")) {
- char *pass = password_input();
+ char *prompt = format_string(format_find("session_password_input"), session->uid);
+ char *pass = password_input(prompt, NULL, 1);
+ xfree(prompt);
if (pass) {
session_set(session, params[2], pass);
Modified: trunk/ekg/stuff.c
===================================================================
--- trunk/ekg/stuff.c 2008-06-05 22:13:36 UTC (rev 4011)
+++ trunk/ekg/stuff.c 2008-06-07 10:44:25 UTC (rev 4012)
@@ -3202,10 +3202,10 @@
* succeeded (wrong input / no support).
*/
-char *password_input() {
+char *password_input(const char *prompt, const char *rprompt, const bool norepeat) {
char *pass = NULL;
- if (query_emit_id(NULL, UI_PASSWORD_INPUT, &pass) == -2) {
+ if (query_emit_id(NULL, UI_PASSWORD_INPUT, &pass, &prompt, norepeat ? NULL : &rprompt) == -2) {
print("password_nosupport");
return NULL;
}
Modified: trunk/ekg/stuff.h
===================================================================
--- trunk/ekg/stuff.h 2008-06-05 22:13:36 UTC (rev 4011)
+++ trunk/ekg/stuff.h 2008-06-07 10:44:25 UTC (rev 4012)
@@ -38,6 +38,7 @@
#include <ctype.h>
#include <stdarg.h>
#include <stdio.h>
+#include <stdbool.h>
#include <time.h>
#include "dynstuff.h"
@@ -393,7 +394,7 @@
char *ekg_convert_string_p(const char *ps, void *ptr);
char *ekg_convert_string(const char *ps, const char *from, const char *to);
int ekg_converters_display(int quiet);
-char *password_input();
+char *password_input(const char *prompt, const char *rprompt, const bool norepeat);
/* funkcje poza stuff.c */
void ekg_exit();
Modified: trunk/ekg/themes.c
===================================================================
--- trunk/ekg/themes.c 2008-06-05 22:13:36 UTC (rev 4011)
+++ trunk/ekg/themes.c 2008-06-07 10:44:25 UTC (rev 4012)
@@ -1167,12 +1167,14 @@
format_add("statusbar_timestamp", "%H:%M", 1);
/* ui-password-input */
- format_add("password_input", _("Please input your password: "), 1);
- format_add("password_repeat", _("Please repeat your password: "), 1);
+ format_add("password_input", _("Please input password:"), 1);
+ format_add("password_repeat", _("Please repeat password:"), 1);
format_add("password_empty", _("%! No password entered"), 1);
format_add("password_nomatch", _("%! Entered passwords do not match"), 1);
format_add("password_nosupport", _("%! %|UI-plugin doesn't seem to support password input, please use command-line input."), 1);
+ format_add("session_password_input", _("Password for %1:"), 1);
+
/* dla funkcji format_user() */
format_add("known_user", "%T%1%n/%2", 1);
format_add("known_user,speech", "%1", 1);
Modified: trunk/plugins/gg/pubdir.c
===================================================================
--- trunk/plugins/gg/pubdir.c 2008-06-05 22:13:36 UTC (rev 4011)
+++ trunk/plugins/gg/pubdir.c 2008-06-07 10:44:25 UTC (rev 4012)
@@ -132,7 +132,7 @@
passwd_b = xstrdup(params[1]);
params[1] = params[2];
params[2] = NULL;
- } else if (!(passwd_b = password_input()))
+ } else if (!(passwd_b = password_input(NULL, NULL, 0)))
return -1;
passwd = gg_locale_to_cp(xstrdup(passwd_b));
@@ -364,7 +364,7 @@
#else
if (!params[0]) {
#endif
- newpasswd = gg_locale_to_cp(password_input());
+ newpasswd = gg_locale_to_cp(password_input(NULL, NULL, 0));
if (!newpasswd)
return -1;
} else
Modified: trunk/plugins/jabber/commands.c
===================================================================
--- trunk/plugins/jabber/commands.c 2008-06-05 22:13:36 UTC (rev 4011)
+++ trunk/plugins/jabber/commands.c 2008-06-07 10:44:25 UTC (rev 4012)
@@ -535,7 +535,7 @@
*(xstrchr(username, '@')) = 0;
if (!params[0]) {
- char *tmp = password_input();
+ char *tmp = password_input(NULL, NULL, 0);
if (!tmp)
return -1;
passwd = jabber_escape(tmp);
Modified: trunk/plugins/ncurses/old.c
===================================================================
--- trunk/plugins/ncurses/old.c 2008-06-05 22:13:36 UTC (rev 4011)
+++ trunk/plugins/ncurses/old.c 2008-06-07 10:44:25 UTC (rev 4012)
@@ -107,6 +107,9 @@
QUERY(ncurses_password_input) {
char **buf = va_arg(ap, char**);
+ const char *prompt = *va_arg(ap, const char**);
+ const char **rprompt = va_arg(ap, const char**);
+
char *oldprompt;
CHAR_T *oldline, *passa, *passb = NULL;
CHAR_T **oldlines;
@@ -118,7 +121,7 @@
oldpromptlen = ncurses_current->prompt_len;
oldline = ncurses_line;
oldlines = ncurses_lines;
- ncurses_current->prompt = (char*) format_find("password_input");
+ ncurses_current->prompt = (char*) prompt ? prompt : format_find("password_input");
ncurses_current->prompt_len = xstrlen(ncurses_current->prompt);
ncurses_update_real_prompt(ncurses_current);
ncurses_lines = NULL;
@@ -131,17 +134,19 @@
passa = ncurses_passbuf;
if (xwcslen(passa)) {
- ncurses_current->prompt = (char*) format_find("password_repeat");
- ncurses_current->prompt_len = xstrlen(ncurses_current->prompt);
- ncurses_noecho = 1;
- ncurses_update_real_prompt(ncurses_current);
- ncurses_redraw_input(0);
-
- while (ncurses_noecho)
- ncurses_watch_stdin(0, 0, WATCH_READ, NULL);
- passb = ncurses_passbuf;
-
- if (xwcscmp(passa, passb))
+ if (rprompt) {
+ ncurses_current->prompt = (char*) *rprompt ? *rprompt : format_find("password_repeat");
+ ncurses_current->prompt_len = xstrlen(ncurses_current->prompt);
+ ncurses_noecho = 1;
+ ncurses_update_real_prompt(ncurses_current);
+ ncurses_redraw_input(0);
+
+ while (ncurses_noecho)
+ ncurses_watch_stdin(0, 0, WATCH_READ, NULL);
+ passb = ncurses_passbuf;
+ }
+
+ if (passb && xwcscmp(passa, passb))
print("password_nomatch");
else
#if USE_UNICODE
Więcej informacji o liście dyskusyjnej ekg2-commit