>>>>> "Emre" == Emre Sevinç <[EMAIL PROTECTED]> writes:

    Emre> Vehbi Sinan Tunalioglu wrote:

    >>  Daha faydali bir olaya girisiyorum: su ana kadar aldigim
    >> bilgileri NNTP uzerinden almak. org-davep-nntp isimli bir paket
    >> var. NNTP baglantisi yapabiliyorsun. Dun Can Burak ile
    >> calstigina sahit olduk. NNTP kullanmanin faydasi, epostalarin
    >> body kisimlarini almak zorunda kalmamak. Zaten header, bizim
    >> calismamizin ihtiyac duydugu tum bilgileri iceriyor. Bugun
    >> yarin, onu da yazip gonderirim.
    >> 

    Emre> Sasirtici ve sevindirici bir gelisme. Nereden cikti bu
    Emre> paket? CLiki filan? "asdf-install"able bir sey mi? CPAN
    Emre> rahatligi lazim CL'ye gercekten de.

cliki + asdf-installable.

Hizli giris (internette kullanimina dair ornek
bulamadim. Asagidakilerde hata varsa bildirirsiniz.)

;;=======================================================================
;;====== * org-davep-nntp icin ornek kullanim.
;;====== * example usage of org-davep-nntp.
;;=======================================================================

(asdf:oos 'asdf:load-op :org-davep-nntp)

;(defun get-list-of-groups (host port)
;  (nntp:with-nntp-client (connection :host host :port port)
;                                                (nntp:data (nntp:group-list 
connection))))

;(defun get-group-details (host port group-name)
;  (nntp:with-nntp-client (connection :host host :port port)
;                                                (nntp:data (nntp:group 
connection group-name))))

(defun create-nntp-connection (host port)
  (let ((client (nntp:make-nntp-client :host host :port port)))
        (nntp:connect client)
        (if (nntp:connectedp client)
                client
          nil)))

(defun close-nntp-connection (connection)
  (nntp:disconnect connection))

(defun get-list-of-groups (connection)
  (nntp:data (nntp:group-list connection)))

(defun get-group-details (connection group-name)
  (nntp:data (nntp:group connection group-name)))

(defun dump-list-of-pairs-of-atoms-to-life (lst file-path)
  (with-open-file (output-stream file-path :direction :OUTPUT)
        (loop for pair in lst do
                  (format output-stream "(~A . ~A)~%" (car pair) (cdr pair)))))

(defvar *host* "news.gmane.org")
(defvar *port* 119)
(defvar *nntp-connection* (create-nntp-connection *host* *port*))
(defvar *group-list* (get-list-of-groups *nntp-connection*))
(defvar *number-of-groups* (length *group-list*))
(defvar *group-list-names* (mapcar #'nntp:group-name *group-list*))

;; dikkat   : biraz zaman aliyor (10dk kadar :)
;; attention: takes so much time
(defvar *group-list-no-of-articles* (mapcar #'(lambda (x)
                                                                                
                (cons x
                                                                                
                          (nntp:article-count
                                                                                
                           (get-group-details *nntp-connection* x))))
                                                                                
        *group-list-names*))

(dump-list-of-pairs-of-atoms-to-life *group-list-no-of-articles* 
"./name-number.txt")
;(close-nntp-connection *nntp-connection*)


_______________________________________________
cs-lisp mailing list
[email protected]
http://church.cs.bilgi.edu.tr/lcg
http://cs.bilgi.edu.tr/mailman/listinfo/cs-lisp

Cevap