[ekg2-commit] ekg2: commands.c (HEAD) jabber.c (HEAD) jabber_handlers.c (HEAD) [peres]

CVS commit cvs w toxygen.net
Pon, 7 Maj 2007, 17:50:25 CEST


Module name:	ekg2
Changes by:	peres	2007-05-07 17:50:22

Modified files:
	commands.c jabber.c jabber_handlers.c

Log message:
Fixing registration:
- checking for NULL password fixed,
- we don't reprint received password any longer.

Index: commands.c
===================================================================
RCS file: /home/cvs/ekg2/plugins/jabber/commands.c,v
diff -d -u -r1.171 -r1.172
--- commands.c	6 May 2007 17:45:17 -0000	1.171
+++ commands.c	7 May 2007 15:50:21 -0000	1.172
@@ -338,7 +338,7 @@
 		return -1;
 	}
 
-	if (!session_get(session, "__new_acount") && !(session_get(session, "password"))) {
+	if (!session_get(session, "__new_account") && !(session_get(session, "password"))) {
 		printq("no_config");
 		return -1;
 	}
@@ -1285,8 +1285,8 @@
 	const char *passwd = session_get(session, "password");
 	char **splitted	= NULL;
 
-	if (!session_connected_get(session) && (!passwd || !xstrcmp(passwd, "foo"))) {
-		session_set(session, "__new_acount", "1");
+	if (!session_connected_get(session) && (!passwd || !*passwd || !xstrcmp(passwd, "foo"))) {
+		session_set(session, "__new_account", "1");
 		if (params[0]) session_set(session, "password", params[0]);
 		jabber_command_connect(("connect"), NULL, session, target, quiet);
 		return 0;

Index: jabber.c
===================================================================
RCS file: /home/cvs/ekg2/plugins/jabber/jabber.c,v
diff -d -u -r1.333 -r1.334
--- jabber.c	4 May 2007 11:56:25 -0000	1.333
+++ jabber.c	7 May 2007 15:50:22 -0000	1.334
@@ -470,7 +470,7 @@
 			username = xstrndup(s->uid + payload, tmp - s->uid - payload);
 		else	username = xstrdup(s->uid + payload);
 
-		if (!j->istlen && session_get(s, "__new_acount")) {
+		if (!j->istlen && session_get(s, "__new_account")) {
 			char *epasswd	= jabber_escape(passwd);
 			watch_write(j->send_watch, 
 				"<iq type=\"set\" to=\"%s\" id=\"register%d\">"
@@ -1188,7 +1188,7 @@
 	format_add("jabber_unknown_resource", _("%! (%1) User's resource unknown%n\n\n"), 1);
 	format_add("jabber_status_notavail", _("%! (%1) Unable to check version, because %2 is unavailable%n\n"), 1);
 	format_add("jabber_charset_init_error", _("%! Error initialising charset conversion (%1->%2): %3"), 1);
-	format_add("register_change_passwd", _("%> Your password for acount %T%1 is '%T%2%n' change it as fast as you can using command /jid:passwd <newpassword>"), 1);
+	format_add("register_change_passwd", _("%> Your password for account %T%1%n is '%T%2%n'. Change it as soon as possible, using command /jid:passwd <newpassword>"), 1);
 
 	/* %1 - session_name, %2 - server/ uid */
 	format_add("jabber_privacy_list_begin",   _("%g,+=%G----- Privacy list on %T%2%n"), 1);

Index: jabber_handlers.c
===================================================================
RCS file: /home/cvs/ekg2/plugins/jabber/jabber_handlers.c,v
diff -d -u -r1.108 -r1.109
--- jabber_handlers.c	4 May 2007 10:07:44 -0000	1.108
+++ jabber_handlers.c	7 May 2007 15:50:22 -0000	1.109
@@ -2467,7 +2467,10 @@
 						if (!xstrcmp(reg->name, "instructions")) continue;
 
 						jname = jabber_unescape(reg->name);
-						jdata = jabber_unescape(reg->data);
+						if (!xstrcmp(jname, "password"))
+							jdata = xstrdup("(...)");
+						else
+							jdata = jabber_unescape(reg->data);
 						print("jabber_registration_item", session_name(s), from_str, jname, jdata);
 						xfree(jname);
 						xfree(jdata);
@@ -2815,10 +2818,10 @@
 
 	query_emit_id(NULL, PROTOCOL_CONNECTED, &__session);
 
-	if (session_get(s, "__new_acount")) {
+	if (session_get(s, "__new_account")) {
 		print("register", __session);
 		if (!xstrcmp(session_get(s, "password"), "foo")) print("register_change_passwd", __session, "foo");
-		session_set(s, "__new_acount", NULL);
+		session_set(s, "__new_account", NULL);
 	}
 
 	session_int_set(s, "__roster_retrieved", 0);


Więcej informacji o liście dyskusyjnej ekg2-commit