Author: dylan
Date: 2005-07-18 10:44:16 -0400 (Mon, 18 Jul 2005)
New Revision: 872
Added:
trunk/docs/spec/Haver/Spec/Reg.pod
Modified:
trunk/
trunk/docs/spec/Haver/Spec.pod
trunk/docs/spec/Haver/Spec/Auth.pod
trunk/perl/client/lib/Haver/Client.pm
trunk/perl/server/lib/Haver/Server/Entity/Channel.pm
trunk/perl/server/lib/Haver/Server/Wheel/AuthReg.pm
trunk/perl/server/lib/Haver/Server/Wheel/Main.pm
Log:
[EMAIL PROTECTED]: dylan | 2005-07-18 01:47:17 -0400
More fun API changes, and the 'connect' state is documented again. Not very
well,
but still.
[EMAIL PROTECTED]: dylan | 2005-07-18 10:23:28 -0400
I forget what I did to channel and main... But AuthReg has commands
for changing the password and email address now.
[EMAIL PROTECTED]: dylan | 2005-07-18 10:43:13 -0400
Moved registration stuff into a different extension and renamed the commands.
It's the same stuff, but with a different name. I think it is more logical. :-)
Registration stuff better defined now.
Property changes on: trunk
___________________________________________________________________
Name: svk:merge
- 1f59643a-e6e5-0310-bc24-f7d4c744f460:/haver/havercurs-objc:43089
1f59643a-e6e5-0310-bc24-f7d4c744f460:/haver/local/trunk:11166
1f59643a-e6e5-0310-bc24-f7d4c744f460:/haver/local/trunk-merge-10131:11178
27e50396-46e3-0310-8b22-ae223a1f35ce:/local:212
e9404bb1-7af0-0310-a7ff-e22194cd388b:/haver/local:1277
edfcd8bd-4ce7-0310-a97e-bb1efd40edf3:/local:238
+ 1f59643a-e6e5-0310-bc24-f7d4c744f460:/haver/havercurs-objc:43089
1f59643a-e6e5-0310-bc24-f7d4c744f460:/haver/local/trunk:11166
1f59643a-e6e5-0310-bc24-f7d4c744f460:/haver/local/trunk-merge-10131:11178
27e50396-46e3-0310-8b22-ae223a1f35ce:/local:212
e9404bb1-7af0-0310-a7ff-e22194cd388b:/haver/local:1281
edfcd8bd-4ce7-0310-a97e-bb1efd40edf3:/local:238
Modified: trunk/docs/spec/Haver/Spec/Auth.pod
===================================================================
--- trunk/docs/spec/Haver/Spec/Auth.pod 2005-07-18 05:33:36 UTC (rev 871)
+++ trunk/docs/spec/Haver/Spec/Auth.pod 2005-07-18 14:44:16 UTC (rev 872)
@@ -8,11 +8,10 @@
=head1 BEGIN YOUR FEAR
-The auth extension consists of two parts; a login authentication system
-and a way of registering user or services accounts.
+The auth extension provides a login authentication system.
+A related extension, L<Haver::Spec::Reg> provides a way of registering under
this auth
+system.
-=head2 Login stuff
-
The client must advertize it understands the auth extension. It does this by
mentioning
'auth' in the second arg of C:HAVER, like so:
@@ -53,24 +52,6 @@
}
-=head2 Staking your claim
-
-To register a given name, first login with it.
-After you've logged in, you need but send the message:
-
- C: AUTH:REGISTER $email $passcode
-
-The $email address is a email address that the server admin can use to contact
you for
-whatever reason, and $passcode is as defined in L</PASSCODES>.
-
-If everything is okay, the server will send:
-
- S: AUTH:REGISTER $name $email
-
-Where $name is your username, and $email the email address you asked for.
-
-Things that can go wrong are: L</invalid.email>, and L</registered.user>.
-
=head1 YOU FAIL
This extension introduces a few new errors.
@@ -90,15 +71,6 @@
Raised when the hashing (digest) algorithm requested by the client is unknown
to the server.
-=head2 invalid.email
-
-Raised when the email address given in C: AUTH:REGISTER is not a valid email
address,
-according to the related RFCs.
-
-=head2 registered.user
-
-Raised when AUTH:REGISTER is called for by a user that is already registered.
-
=head1 PASSCODES
First, the problem: The server admin can't be trusted knowing the user's
password.
Added: trunk/docs/spec/Haver/Spec/Reg.pod
===================================================================
--- trunk/docs/spec/Haver/Spec/Reg.pod 2005-07-18 05:33:36 UTC (rev 871)
+++ trunk/docs/spec/Haver/Spec/Reg.pod 2005-07-18 14:44:16 UTC (rev 872)
@@ -0,0 +1,91 @@
+=head1 NAME
+
+Haver::Spec::Reg - The Registration extension
+
+=head1 DESCRIPTION
+
+This document describes the registration extension to L<Haver::Spec>.
+
+=head1 BEGIN YOUR FEAR
+
+This extension depends on the L<Haver::Spec::Auth> extension. In fact neither
is very
+useful without the other.
+
+=head2 Creating an account
+
+An account is created with REG:ACCOUNT, like so:
+
+ C: REG:ACCOUNT $email $passcode
+ S: REG:ACCOUNT $name $email
+
+Where $email is a standard email address, $passcode is as defined in
+L<Haver::Spec::Auth/PASSCODES>, and $name is the name you sent via B<IDENT>
upon login.
+
+=head2 Changing a passcode
+
+Changing a passcode is done with REG:PASSCODE.
+
+ C: REG:PASSCODE $passcode
+ S: REG:PASSCODE $name
+
+The server doesn't echo the passcode for security reasons. Note that using
this command
+without SSL is probably very insecure anyway.
+
+=head2 Changing the email address
+
+You can change the registered email address with REG:EMAIL:
+
+ C: REG:EMAIL $email
+ S: REG:EMAIL $name $email
+
+=head2 Deleting an account
+
+Accounts can be removed, either by the owner or a server admin.
+
+ C: REG:REMOVE $name
+ S: REG:REMOVE $name
+
+
+
+=head1 YOU FAIL
+
+This extension introduces a few new errors.
+
+=head2 invalid.email
+
+Raised when the email address given in REG:ACCOUNT or REG:EMAIL is not a valid
email address,
+according to the related RFCs.
+
+=head2 registered.user
+
+Raised when REG:ACCOUNT is called for by a user that is already registered.
+
+=head2 permission
+
+Raised when REG:REMOVE is used by non-admins on users other their self.
+
+=head1 AUTHOR
+
+Dylan William Hardison E<lt>[EMAIL PROTECTED]<gt>.
+
+=head1 SEE ALSO
+
+L<Haver::Spec>, L<Haver::Spec::Auth>, L<http://www.haverdev.org/>.
+
+=head1 COPYRIGHT and LICENSE
+
+Copyright (C) 2005 by Dylan William Hardison. All Rights Reserved.
+
+This module is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This module is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this module; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Modified: trunk/docs/spec/Haver/Spec.pod
===================================================================
--- trunk/docs/spec/Haver/Spec.pod 2005-07-18 05:33:36 UTC (rev 871)
+++ trunk/docs/spec/Haver/Spec.pod 2005-07-18 14:44:16 UTC (rev 872)
@@ -233,7 +233,8 @@
=head1 EXTENSIONS
-Currently defined extensions: L<Haver::Spec::Ghost>, L<Haver::Spec::Auth>.
+Currently defined extensions: L<Haver::Spec::Ghost>, L<Haver::Spec::Auth>,
+L<Haver::Spec::Reg>.
=head1 AUTHOR
Modified: trunk/perl/client/lib/Haver/Client.pm
===================================================================
--- trunk/perl/client/lib/Haver/Client.pm 2005-07-18 05:33:36 UTC (rev
871)
+++ trunk/perl/client/lib/Haver/Client.pm 2005-07-18 14:44:16 UTC (rev
872)
@@ -137,7 +137,8 @@
sub connect {
my ($kernel, $heap, %opts) = @_[KERNEL,HEAP,ARG0..$#_];
- $opts{Port} ||= 7575;
+ $opts{port} ||= 7575;
+
# TODO: handle arg errors
if ($heap->{state} == S_DYING) {
$heap->{pending} = \%opts;
@@ -147,13 +148,13 @@
$heap->{pending} = \%opts;
} else {
$heap->{state} = S_CONN;
- $heap->{name} = $opts{Name};
- $heap->{port} = $opts{Port};
+ $heap->{name} = $opts{name};
+ $heap->{port} = $opts{port};
if (!$heap->{resolver}) {
- _call('_do_connect', $opts{Host});
+ _call('_do_connect', $opts{host});
} else {
my $resp = $heap->{resolver}->resolve(
- host => $opts{Host},
+ host => $opts{host},
context => {},
event => '_dns_resp',
);
@@ -465,6 +466,13 @@
version => "WackyClient/1.20",
);
+ $kernel->post('haver', 'connect',
+ host => 'hardison.net',
+ name => ucfirst($ENV{USER}),
+ port => 7575,
+ );
+
+
=head1 DESCRIPTION
FIXME
@@ -485,7 +493,11 @@
=head1 STATES
+=head2 connect(host => $host, name => $name, [ port => 7575 ])
+Connect to $host on port $port (defaults to 7575) with the user name $name.
+If already connected to a server, Haver::Client will disconnect and re-connect
using the
+new settings.
=head1 BUGS
Modified: trunk/perl/server/lib/Haver/Server/Entity/Channel.pm
===================================================================
--- trunk/perl/server/lib/Haver/Server/Entity/Channel.pm 2005-07-18
05:33:36 UTC (rev 871)
+++ trunk/perl/server/lib/Haver/Server/Entity/Channel.pm 2005-07-18
14:44:16 UTC (rev 872)
@@ -9,13 +9,13 @@
const namespace => 'channel';
field _contents => {};
-field creator => '&root';
+field owner => '&root';
sub dump {
my ($self, $store) = @_;
my $dump = super($store);
- $dump->{creator} = $self->creator;
+ $dump->{owner} = $self->owner;
return $dump;
}
@@ -23,7 +23,7 @@
sub load {
my ($this, $data, $store) = @_;
my $self = super($data, $store);
- $self->creator($data->{creator});
+ $self->owner($data->{owner});
return $self;
}
@@ -36,7 +36,7 @@
sub info {
my $self = shift;
return (
- creator => $self->creator,
+ owner => $self->owner,
);
}
Modified: trunk/perl/server/lib/Haver/Server/Wheel/AuthReg.pm
===================================================================
--- trunk/perl/server/lib/Haver/Server/Wheel/AuthReg.pm 2005-07-18 05:33:36 UTC
(rev 871)
+++ trunk/perl/server/lib/Haver/Server/Wheel/AuthReg.pm 2005-07-18 14:44:16 UTC
(rev 872)
@@ -12,6 +12,8 @@
$self->msg(
qw(
AUTH:REGISTER
+ AUTH:PASSCODE
+ AUTH:EMAIL
)
);
}
@@ -38,5 +40,21 @@
$heap->{client}->put(['AUTH:REGISTER', $user->name, $email]);
}
+sub msg_AUTH_PASSCODE {
+ my ($kernel, $heap, $args) = @_[KERNEL, HEAP, ARG0];
+ my ($passcode) = @$args;
+ $user->passcode($passcode);
+ $heap->{client}->put(['AUTH:PASSCODE', $heap->{user}->name]);
+}
+
+sub msg_AUTH_EMAIL {
+ my ($kernel, $heap, $args) = @_[KERNEL, HEAP, ARG0];
+ my ($email) = @$args;
+
+ $user->email($email);
+ $heap->{client}->put(['AUTH:EMAIL', $heap->{user}->name, $email]);
+}
+
+
1;
Modified: trunk/perl/server/lib/Haver/Server/Wheel/Main.pm
===================================================================
--- trunk/perl/server/lib/Haver/Server/Wheel/Main.pm 2005-07-18 05:33:36 UTC
(rev 871)
+++ trunk/perl/server/lib/Haver/Server/Wheel/Main.pm 2005-07-18 14:44:16 UTC
(rev 872)
@@ -85,8 +85,8 @@
$lobby->add(
new Haver::Server::Entity::Channel (
- name => $name,
- creator => 'bob',
+ name => $name,
+ owner => 'bob',
)
);
$heap->{client}->put(['OPEN', $name]);