guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [ANN] guile-toxcore


From: David Thompson
Subject: Re: [ANN] guile-toxcore
Date: Fri, 12 Sep 2014 10:49:31 -0400
User-agent: Notmuch/0.18.1 (http://notmuchmail.org) Emacs/24.3.1 (x86_64-pc-linux-gnu)

David Thompson <address@hidden> writes:

> One of my goals with this project is to write a bot that users can add
> as a friend and use to test text/audio/video chat.  Currently, I have a
> working text chat echo bot.

Here's the config for the example client (examples/client.scm) that
provides the echo bot functionality:

  (use-modules (tox util))
  
  (define tox-bootstrap-nodes
    '(((ip . "192.254.75.98")
       (id . "951C88B7E75C867418ACDB5D273821372BB5BD652740BCDF623A4FA293E75D2F")
       (port . 33445)
       (ipv6? . #t))
      ((ip . "144.76.60.215")
       (id . "04119E835DF3E78BACF0F84235B300546AF8B936F035185E2A8E9E0A67C8924F")
       (port . 33445)
       (ipv6? . #t))
      ((ip . "23.226.230.47")
       (id . "A09162D68618E742FFBCA1C2C70385E6679604B2D80EA6E84AD0996A1AC8A074")
       (port . 33445)
       (ipv6? . #t))
      ((ip . "37.187.20.216")
       (id . "4FD54CFD426A338399767E56FD0F44F5E35FA8C38C8E87C8DC3FEAC0160F8E17")
       (port . 33445)
       (ipv6? . #t))
      ((ip . "54.199.139.199")
       (id . "7F9C31FE850E97CEFD4C4591DF93FC757C7C12549DDD55F8EEAECC34FE76C029")
       (port . 33445)
       (ipv6? . #f))
      ((ip . "37.59.102.176")
       (id . "B98A2CEAA6C6A2FADC2C3632D284318B60FE5375CCB41EFA081AB67F500C1B0B")
       (port . 33445)
       (ipv6? . #t))
      ((ip . "192.210.149.121")
       (id . "F404ABAA1C99A9D37D61AB54898F56793E1DEF8BD46B1038B9D822E8460FAB67")
       (port . 33445)
       (ipv6? . #f))
      ((ip . "37.187.46.132")
       (id . "5EB67C51D3FF5A9D528D242B669036ED2A30F8A60E674C45E7D43010CB2E1331")
       (port . 33445)
       (ipv6? . #t))))
  
  (define (tox-friend-names tox)
    (map (lambda (friend-number)
           (tox-friend-name tox friend-number))
         (tox-friend-list tox)))
  
  (set-tox-name tox "Tox Test Bot")
  (set-tox-status-message tox "Hanging around")
  
  (add-hook! tox-friend-request-hook
             (lambda (tox public-key message)
               (format #t
                       "Friend request:\nClient ID: ~a\nMessage: ~a\n\n"
                       (bytevector->hex-string public-key)
                       message)
             (tox-add-friend-no-request tox public-key)))
  
  (add-hook! tox-message-hook
             (lambda (tox friend message)
               (let ((name (tox-friend-name tox friend))
                     (response (format #f "I received the message: \"~a\""
                                       message)))
                 (format #t "~a says: ~a\n" name message)
                 (tox-send-message tox friend response))))

-- 
David Thompson
Web Developer - Free Software Foundation - http://fsf.org
GPG Key: 0FF1D807
Support the FSF: https://fsf.org/donate



reply via email to

[Prev in Thread] Current Thread [Next in Thread]