World: r3wp
[Core] Discuss core issues
older newer | first last |
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? | |
Gabriele 2-Feb-2007 [7020] | petr: i think the answer is yes, but i don't remember. i'm not sure it has ever been tested though. |
Joe 3-Feb-2007 [7021] | graham, what kind of testing help do you need ? I am going to try the script |
Graham 3-Feb-2007 [7022x4] | Just to check it works for a start! :) |
I only got this script to work once .. never again after that! but it works using standard smtp port on other servers. | |
There's some type of deadlock occuring .... waiting for gmail's smtp server to respond to the insert smtp "." | |
Now, if you change insert smtp "." with insert smtp "^M^J.^M^J" gmail drops the connection | |
Oldes 8-Feb-2007 [7026x3] | . |
I think, it's a shame, that cannot do this: >> test: func[/a a][probe a] ** Script Error: Duplicate function value: a ** Where: throw-on-error ** Near: func [/a a] [probe a] | |
as I need so often to write something and have the name same as the path :( | |
Pekr 8-Feb-2007 [7029] | yes, that is the limitation - you try to find out intuitive name for your function's refinement, but then you want to use intuitive names for your words. So I sometimes used underscore for words, but it looks ugly ... |
Sunanda 8-Feb-2007 [7030] | One hack is to assign the refinement value to the refinement word at the start of the function: test: func[/a _a][if not none? a [a: :_a] probe a] You can then just refer to a. It introduces an ambiguity though -- does none mean no /a refinement supplied, or that the value was none ? |
Maxim 8-Feb-2007 [7031] | in useage after all these years I've come to realize that verifying the refinement itself is less usefull than ingnoring the value if its none. one should usually use none as the fact its not a value, so therefor just like a default, or something to ignore. this kind of useage allows one to rethrow the function (is that the proper term?) with very little fuss. in a way, this becomes exactly like option args in other applications, ex: myfunc [count /option opt][ unless (count: count - 1) = 0 [ if opt [ print count ] myfunc/option count opt ] ] |
older newer | first last |