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

World: r3wp

[Core] Discuss core issues

Anton
30-Jan-2007
[6970]
omg. it stares me in the face.
Oldes
30-Jan-2007
[6971x2]
you want to do:
use [vars id][
	vars: [a b c]
	id: 0 foreach :vars [1 2 3 4 5 6] [print id: id + 1]
]
Anton
30-Jan-2007
[6973x2]
ah nice, I was about to something with DO COMPOSE
Thanks... :)
In my actual code it was really confusing.
Oldes
30-Jan-2007
[6975]
maybe it would be good to give this into FAQ or something like that, 
if it exists:)
Anton
30-Jan-2007
[6976]
Hmm... I'm not sure. I think the problem is that of coding too many 
hours without rest.
Oldes
30-Jan-2007
[6977]
it's not so late:)
Anton
30-Jan-2007
[6978]
Should put that in the FAQ: "How many hours should I code before 
taking a break ?"
Oldes
30-Jan-2007
[6979]
It depends how strong you are:)
Ladislav
30-Jan-2007
[6980]
insert/dup looks like not working when used on /binary/seek ports. 
Is that a known issue?
Oldes
30-Jan-2007
[6981]
for me not
Ladislav
30-Jan-2007
[6982x2]
what version?
(I used rebol/version == 1.3.2.3.1)
Oldes
30-Jan-2007
[6984]
I mean, that didn't know that it's a problem:)
Ladislav
30-Jan-2007
[6985]
aha, sorry for misunderstanding
Gabriele
30-Jan-2007
[6986]
i don't think it's known, otoh /seek is known to have a few problems 
so it's not really surprising. :)
Ladislav
30-Jan-2007
[6987x2]
thanks - RAMBO #4235
Anton - you ran into yet another case of nontransparent argument 
passing. Let me repeat - I don't like nontransparent argument passing...
Anton
30-Jan-2007
[6989x3]
It's just funny because FOREACH is used so often.
I guess FOREACH would suffer much if the first argument was expected 
to be always a block!
would not suffer
Ladislav
31-Jan-2007
[6992x2]
try this:

foreach': func [
    "Evaluates a block for each value(s) in a series."

    word [word! block!] {Word or block of words to set each time (will 
    be local)}
    data [series!] "The series to traverse"
    body [block!] "Block to evaluate each time"
] [
    foreach :word :data :body
]
(it is a referentially transparent argument passing variant)
Anton
31-Jan-2007
[6994]
The second and third arguments look like they are already referentially 
transparent, but I suppose you are ensuring this in case FOREACH 
ever changes its spec.
Graham
1-Feb-2007
[6995x7]
Has anyone got smtp to work with gmail ?
I cloned the esmtp protocol to use on port 465, and added a /secure 
to 'send so that it uses my new ssmtp protocol.
I changed  the open-proto to open-proto/secure/sub-protocol port 
'ssl in the new ssmtp protocol.
I can send like this
set-net [ [compkarori-:-gmail-:-com] smtp.gmail.com ]
send/secure [compkarori-:-gmail-:-com] "testing .. "


and a trace/net shows that it sends the message but then hangs waiting 
for a 250 response from the 'check-write
oh crap .. web-public channel ... going to get spammed now :(
mucking around, i changed the system/words/insert port/sub-port "^/." 
to system/words/insert port/sub-port "^M^J.^M^J" and that gives an 
error.
Henrik
1-Feb-2007
[7002x2]
oh crap
 <-- isn't this another peeve?
added to checklist
Gabriele
1-Feb-2007
[7004]
graham, doesn't gmail require tls? it works with ssl too?
Graham
1-Feb-2007
[7005x2]
appears to.
I've managed to send a few emails to myself using smtp.gmail.com
Graham
2-Feb-2007
[7007x8]
Rebol []

email: [compkarori-:-gmail-:-com]
pass: "password"
address: [target-:-gmail-:-com]
message: read %your-fully-formed-email.txt

state: 'EHLO

smtp: open/lines ssl://smtp.gmail.com:465
set-modes smtp [secure: true]

forever [
	S: pick smtp 1
	?? S
	if found? S [
		code: copy/part S 3
		?? code
		?? state
	]

	switch/default state [
		EHLO [ 
			insert smtp "EHLO rebol.com" 
			state: 'PLAIN
			while [ S: pick smtp 1 	][ 
				?? S 
				if find/part S "250 " 4 [ 
					print "sending authentication"

     insert smtp join "AUTH PLAIN " enbase rejoin [ email #"^@" email 
     #"^@" pass ]
					break 
				]
			]
		] 
		PLAIN [
			if code = "235" [
				print "authenticated"
				insert smtp REjoin [ "MAIL FROM: <" email ">" ]
				state: 'FROM
			]
			if code = "535" [
				print "credentials incorrect"
				break
			]
		]
		FROM [
			either code = "250" [
				insert smtp rejoin [ "RCPT TO: <" address ">" ]
				state: 'TO	
			][ print "doesn't like me" break ]	
		]
		TO [
			either code = "250" [
				state: 'DATA
				insert smtp "DATA"
			][ print "doesn't like to address" ]
		]
		DATA [
			replace/all message "^/." "^/.."
			insert smtp message
			insert smtp "."
			state: 'END
		]
		END [
			either code = "250" [
				print "message was sent"
				close smtp
				break
			][ print [ "message had some error: " S ] break ]
		]
		
	][ print ["Unknown state" state ] ]
This should work ...
Anyone care to help me test this?
Of course it would be easier to get the protocol working ...
gmail allows you to use their smtp server only using ssl to prevent 
spamming ...
ie. you have to authenticate as a gmail user before you can send 
using their smtp interface.
But this also means that you can now send secure emails to yourself.
the data block should check to see if it is okay to send ...
Oldes
2-Feb-2007
[7015]
I would like to test it, but I don't have SSL:(
Graham
2-Feb-2007
[7016x2]
Just buy R/Command
I think it is kinda silly to have to get R/command just for ssl now 
.. since ssl is required for so many things
Pekr
2-Feb-2007
[7018x2]
I hope it will be free ...
does proxy setting apply even for https?