#newlisp

Started by jeremyc, December 09, 2006, 07:46:51 AM

Previous topic - Next topic

jeremyc

Anyone use it any more? #newlisp's topic still says latest release 8.7.0. I've visited it the last few days and only me and ChanServ were there... ChanServ isn't much for company :-/



Jeremy

cormullion

#1
<baffled>

What's #newlisp? And whose ChanServ?

</baffled>

newdep

#2
You mean the IRC..? It was setup by some people from Kozoru,

on the otherhand... I myself am not a real IRC user so im mostly not there.... ;-)



Norman.
-- (define? (Cornflakes))

jeremyc

#3
Yeah, on IRC, I should have said:



irc.freenode.net#newlisp



IRC can be pretty nice for focused groups, such as newLisp.



Jeremy

cormullion

#4
Ah OK, I googled 'irc.freenode.net#newlisp'... I've never done anything irc.



But aren't these the places where people with nothing better to do moan about things that aren't 'The One True Lisp'? I'd find the hostility rather wearisome.

jeremyc

#5
If you've never done IRC, download an IRC client for your computer, type in irc.freenode.net as the server, and then join the channel #newlisp .. normally by typing /join #newlisp



I'm there hanging out.



Jeremy

cormullion

#6
Norman - can you explain your irc.lsp file on your site:


(setq online 'true)
;; connect to irc server no error checking done
(setq server (net-connect "irc.freenode.net" 6667))

;; login and join
(net-send server "USER ircnewlisp 0 * :ircuserrn")
(net-send server "NICK ircuserrn")
(net-send server "JOIN #ircgroup-herern")

;; dont use (net-error) in a while loop by default.
;; You dont want you while loop to quit on all net-errors.
(while online
        (if (net-select server "read" 1000)  
              (begin
                  ;; do linebased receive
                  (net-receive server 'buffer 8192 "n")
                  (print buffer)
;; AUTO ping reply!
                  (if (regex {^PING :(.*)rn} buffer)
                    (begin
                      (println "NEWLISP >>  PONG :"$1)
                      (net-send server (append "PONG :" (string $1 ) "rn"))
                    )
                  )
             )
        )
       (if (net-error) (println "NEWLISP >> " (net-error)))
)


I tried it out but it didn't work.. Any clues? I changed the names, but after



#newlisp :End of /NAMES list.





it didn't seem to do anything... Should I start typing?



I've tried #newlisp with Colloquy (a MacOS client) and it worked well. But I'm intrigued by your very compact version!

newdep

#7
I used that script for my auto "newlisp-news" bot.. But i think thats a long time ago..

In the meantime also the IRC server have change policy's, like cant send anonymous messages etc... due to spam..



This script is actualy very RAW.. Its a step by step connect which cant handle any

failure ;-)



he best way is to retry again step by step...



here is the code of that thing, replace  XXXXXXX with i.e.  cormullion ->







#!/usr/bin/newlisp



(define (fetch-news)

   (set 'rssbuffer '())

   (set 'urldata (get-url "http://newlisp.org/rss.cgi?News">http://newlisp.org/rss.cgi?News"))

   

   ;; check if get-url had an error

   ;;(if (not (net-error))

    (begin

      (xml-type-tags nil 'cdata '!-- nil)

      (set 'url (xml-parse urldata (+ 1 2 8 16)))



      ;; continue if no xml-error detected and if url is not empty

      (if (and (not (xml-error)) (not (empty? url)) )

       (begin



         ;; remove headers etc...               

         (until (= (first (nth 0 url)) 'rss ) (pop url))

        

         (set 'rsschannel (nth 2 (nth 0 url)))

         (set 'rsschannellen (length rsschannel))

        

         (dotimes (y rsschannellen)

          (if (list? (nth y rsschannel))    

           (if (= (nth 0 (nth y rsschannel)) 'item )

            (push (lookup 'title (nth y rsschannel)) rssbuffer -1 )  )))

       )

      )         

    )

   ;;)

   

   ;; we got an error somewhere, so notify someting nice to the user..     

   (if (empty? rssbuffer) (push "No newLisp News available at the moment, try again later..." rssbuffer))

)





;; fetch once..

(fetch-news)

;; fetch every 5 minutes new data!

(timer 'fetch-news 300)





(setq online 'true)



;; connect to irc server no error checking done

(setq server (net-connect "irc.freenode.net" 6667))



;; login and join

(net-send server "USER newlispbot 0 * :XXXXXXXrn")

(net-send server "NICK newsbotrn")

(net-send server "JOIN #newlisprn")

;;(net-send server (append "AWAY :" {Im a very sleepy bot...} "rn"))

;;(net-send server (append "PRIVMSG #newlisp " {:Hi, Im the newLisp RSS news robot, "/msg newsbot !news" } "rn"))





;; do not exit on (14 "select-failed")!

(while online



        (if (net-select server "read" 1000)  

              (begin

                  ;; do linebased receive

                  (net-receive server 'buffer 8192 "n")

                  (print buffer)

                 

      ;; AUTO ping reply!

                  (if (regex {^PING :(.*)rn} buffer)

                    (begin

                      (println "BOT ---  PONG :"$1)

                      (net-send server (append "PONG :" (string $1 ) "rn"))

                    )

                  )

                   

                   

                ;;    

                ;; Scan for !news

                  (if (regex {^:(.*)!(.*)PRIVMSG newsbot :(!news)rn} buffer)

                    (begin

                                         

                      (println "BOT --- PRIVMSG " $0)

                      (net-send server (append "PRIVMSG " $1  { :Im checking the RSS newLisp news, hold on! } "rn"))

                     

            ;; read from pre-stored buffer by timer and send line by line!

                      (dolist (x rssbuffer) (net-send server (append "PRIVMSG " $1 " :" x "rn")) )

                     

                     

                    )

                  )



              )

        )

       (if (net-error) (println "BOT --- " (net-error)))

)





(close server)

(println (net-error))

(exit)
-- (define? (Cornflakes))