anchor.diff:  
   (defvar *tg-message-sender*)
   
  +;; supress warning
   (defun bot-halt ())
  -(defun send-tg-message (a) a) ;; supress warning
  -(defun irc-reconnect (&optional (try 0) (callback nil))
  -  (if (> try 50)
  -      (progn
  -        (format t "FATAL ERROR: CAN NOT CONNECT TO IRC~%")
  -        (send-tg-message "can not connect to IRC, BOT HALT!")
  -        (format t "BOT HALT~%")
  -        (bot-halt)
  -        (error "BOT HALT!"))
  -      (progn
  -        (tryto (remove-all-hooks *irc-connection*))
  -        (tryto (quit *irc-connection*))
  -        (sleep 5)
  -        (setf *irc-connection*
  -              (connect :nickname "MidyMidyTGBot"
  -                       :server "irc.freenode.net"))
  -        (join *irc-connection* *irc-channel*)
  -        (add-hook *irc-connection*
  -                  'irc::irc-privmsg-message
  -                  (lambda (msg)
  -                    (funcall *tg-message-sender*
  -                             (msgstr-irc->tg msg))))
  -        (add-hook *irc-connection*
  -                  'irc::irc-pong-message
  -                  (lambda (msg)
  -                    (setf *pong* (received-time msg))))
  -        (start-background-message-handler *irc-connection*)
  -        (if callback
  -            (funcall callback)))))
  -
  -(defun clear-msg-pool-f (&optional (try 0))
  +(defun send-tg-message (str) str)
  +(defun irc-check-connection ())
  +(defun irc-reconnect (&optional (callback nil))
  +  (tryto (remove-all-hooks *irc-connection*))
  +  (tryto (quit *irc-connection*))
  +  (sleep 5)
  +  (format *stdout* "Connecting to IRC~%")
  +  (setf *irc-connection*
  +        (connect :nickname "MidyMidyTGBot"
  +                 :server "irc.freenode.net"))
  +  (format *stdout* "JOIN CHANNEL~%")
  +  (join *irc-connection* *irc-channel*)
  +  (format *stdout* "ADD HOOKS~%")
  +  (add-hook *irc-connection*
  +            'irc::irc-privmsg-message
  +            (lambda (msg)
  +              (funcall *tg-message-sender*
  +                       (msgstr-irc->tg msg))))
  +  (add-hook *irc-connection*
  +            'irc::irc-pong-message
  +            (lambda (msg)
  +              (declare (ignore msg))
  +              (sb-thread:signal-semaphore
  +               *ping-semaphore*)))
  +  (format *stdout* "ACTIVATE HOOKS~%")
  +  (start-background-message-handler *irc-connection*)
  +  (if callback
  +      (funcall callback)))
  +
  +(defun clear-msg-pool-f ()
     (if (cdr *irc-message-pool-head*)
         (handler-case
             (progn
  
positive.code: 
  (defparameter *tg-loop* nil)
  (defparameter *irc-watcher* nil)
  
  (defun bot-start ()
    (irc-reconnect)
    (setf *irc-watcher*
          (sb-thread:make-thread
           (lambda ()
             (loop
                (sleep 60)
                (irc-check-connection)))))
    (setf *tg-loop* (sb-thread:make-thread #'tg-getupdate-loop)))
  
  (defun bot-halt ()
    (tryto (sb-thread:terminate-thread *tg-loop*))
  
negative.code:   (tryto (quit *irc-connection* "leaving")))
  
  (defun irc-check-connection ()
    (tryto (ping *irc-connection* *irc-channel*))
    (if (sb-thread:wait-on-semaphore
         *ping-semaphore* :timeout 20)
        (progn (setf *ping-semaphore* (sb-thread:make-semaphore))
               t)
        (progn (setf *ping-semaphore* (sb-thread:make-semaphore))
               nil)))
  
  ;;;; -----------------------------------------
  
  