r3wp [groups: 83 posts: 189283]
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

World: r3wp

[!REBOL3 Schemes] Implementors guide

Andreas
17-Jan-2010
[1625]
the more interesting questions would be about a satisfying user interface. 
mostly how to wrap imap folders nicely in something that feels natural 
in rebol
Graham
17-Jan-2010
[1626]
at present I think you have to specify the folder you want to open 
in the url for r2
Graham
18-Jan-2010
[1627]
Since FTP, andIMAP have folder structures, I propose that we use 
cd, ls, pwd etc for those schemes that support this.  This is no 
different to the lookup that is done by read, write, length? etc
BrianH
18-Jan-2010
[1628x2]
Won't work without native changes to CHANGE-DIR, which calls the 
OS change directory function in the host code. In R3 the current 
directory is real on platforms that have a current directory (i.e. 
not WinCE), not faked like on R2.
Such changes to CHANGE-DIR could break R3 rather thoroughly.
Graham
18-Jan-2010
[1630x2]
Why?  All it does is check the port type first ...
and if it's not a file!, then check the scheme to see if there is 
an actor defined.
BrianH
18-Jan-2010
[1632]
Um, no, ports aren';t supported at all, just file! types. You can't 
even use file:// urls.
Graham
18-Jan-2010
[1633]
well, still can't see that the issue is not insurmountable .. but 
we can define 'cd, 'pwd, 'ls, 'rm etc to what needs to be done.
BrianH
18-Jan-2010
[1634x3]
You could redefine the file and dir schemes in the host code to a 
virtual file system. It would be easier to have the operating system 
mount the urls to the filesystem, at least on Windows, OS X and *nix.
The trick is that the file and dir schemes are defined to be relative 
to the OS current directory, so you can't separate the two.
It would break CALL too.
Graham
18-Jan-2010
[1637]
cd: func [ d [file! port!]
[
	either file? d [
		change-dir d
	][
		; look if supported cd method in actors, and execute it
	]
]
BrianH
18-Jan-2010
[1638]
It doesn't matter, since the only thing about CD that matters is 
changing PWD, and PWD has to be the OS current directory for R3 to 
work. However, what "the OS current directory" means is defined in 
the host code.
Graham
18-Jan-2010
[1639]
rebol doesn't seem to have a concept of a currernt directory as in 
windows ... where you can keep a directory for each volume mounted
BrianH
18-Jan-2010
[1640x3]
You are thinking R2. R3 does have a current directory.
The only thing about PWD that matters at all is relative filenames, 
and those are handled by native code, not mezzanine. But most of 
that native code is in the host since it's platform-specific.
Afaik, the R3 current directory is process-specific and is only one, 
not one per drive.
Graham
18-Jan-2010
[1643x3]
http://rebol.wik.is/Rebol3/Schemes/Imap4
Updated to version 0.0.2 
Logs into Imap server using cram-md5 if available
Switches to inbox
gets inbox status for unseen messages
Retrieves the first 3 messages
As Andreas notes, a write to the port inside the awake handler is 
fine .. but outside the handler, you have to do a wait on the port 
to do anything.

Also i found that without using a timeout value, it doesn't work 
for me 

So, I removed the 'read cmdport from write-cmdport function, and 
put the wait instead in the actor 'read ...
with a timeout
Graham
19-Jan-2010
[1646x8]
I've got the imap protocol to the point where
1. can authenticate using cram-md5 ( reused r2 code )

2. can select different mailboxes ( unlike r2 where you have to select 
at time of opening the port )
3. length? 
4. Pick messages

However, I don't like this timeout which is there ..
2010.01.19 22:43:38 LOG5[4624:1256]: stunnel 4.29 on x86-pc-mingw32-gnu 
with OpenSSL 0.9.8l 5 Nov 2009

2010.01.19 22:43:38 LOG5[4624:1256]: Threading:WIN32 SSL:ENGINE Sockets:SELECT,IPv6

2010.01.19 22:43:38 LOG5[4624:5260]: No limit detected for the number 
of clients

2010.01.19 22:43:38 LOG3[4624:5260]: Error binding imaps to 0.0.0.0:993

2010.01.19 22:43:38 LOG3[4624:5260]: bind: Permission denied (WSAEACCES) 
(10013)

2010.01.19 22:43:38 LOG3[4624:5260]: Server is down
using run as admin
time to read the manual :(
I thought yahoo had free imap service .. but can't find it now :(
Nope ... not free.
Looks like AIM still has free IMAP ... signing up again!
Signed up, sent myself a couple of emails to that account, and then 
managed to login and download using the imap protocol
Pekr
19-Jan-2010
[1654]
Graham - you are becoming a networking Guru :-)
Graham
19-Jan-2010
[1655x2]
Nah .. this stuff isn't at all hard.  Carl made scheme creation much 
easier than in r2
I suspect that the amount of detail put into making a bullet proof 
http scheme frightened everyone off!
Pekr
19-Jan-2010
[1657x2]
yes, probably ...
Any thoughts on the unification process of error handling, logging, 
timeouts, etc.?
Graham
19-Jan-2010
[1659]
Well, Carl is going to have to look at them .. but since my  schemes 
use the same method ... they are pretty unified :)
Carl
19-Jan-2010
[1660]
So, where's the best place to start... the one that best shows the 
basic template?
Graham
19-Jan-2010
[1661x2]
smtp I think ...
though that one is an early effort
Carl
19-Jan-2010
[1663x3]
So, not Daytime?
Graham: During your "journey" through this .. did you notice if there's 
a standard template that would make sense for various parts of the 
implementation?
Also, where and how would you like to see my comments?
Graham
19-Jan-2010
[1666x3]
I started with daytime, moved to smtp, and then ftp, fax and now 
imap.  I am using pretty much the same template with changes appropriate 
to the protocol.
I think docbase ... is the place
Daytime is too trivial to learn much from ... maybe FTP instead??
Carl
19-Jan-2010
[1669x2]
Ok.


My question above is whether there's a standard "core" that can be 
used across many protocols... a bit like net-utils or default protocol 
on R2.
I'll go with SMTP for now.  Looks simple enough.
Graham
19-Jan-2010
[1671x3]
The only standard stuff I use is ...
1. net-log
2. some parse rules and bitsets
3. some authentication stuff like cram-md5


I also stack the commands sent to the port and pop them off as the 
port is async ...
I do this in ftp, fax and imap .. but I should go back and do this 
for smtp as well
I was thinking of using net-log as a way to hook into the low level 
activity of the protocol so that I can patch it as needed when interacting 
with a GUI ... eg, for progress meters
Carl
19-Jan-2010
[1674]
Ok, good... then I'll start with IMAP... since it's more recent.