def start_listener_thread #:nodoc:
      listener_thread = Thread.new do
        loop do
          if @jabber.received_messages?
            @jabber.received_messages do |message|
              # Remove the Jabber resourse, if any
              sender = message.from.to_s.sub(/\/.+$/, '')

              if message.type == :chat
                parse_thread = Thread.new do
                  parse_command(sender, message.body)
                end

                parse_thread.join
              end
            end
          end

          sleep 1
        end
      end

      listener_thread.join
    end
def start_listener_thread #:nodoc:
      listener_thread = Thread.new do
        loop do
          if @jabber.received_messages?
            @jabber.received_messages do |message|
              # Remove the Jabber resourse, if any
              sender = message.from.to_s.sub(/\/.+$/, '')

              if message.type == :chat
                parse_thread = Thread.new do
                  parse_command(sender, message.body)
                end

                parse_thread.join
              end
            end
          end

          sleep 1
        end
      end

      listener_thread.join
    end
Creates a new Thread dedicated to listening for incoming chat messages.
 When a chat message is received, the bot checks if the sender is its
 master. If so, it is tested for the presence commands, and processed
 accordingly. If the bot itself or the command issued is not made public,
 a message sent by anyone other than the bot's master is silently ignored.

 Only the chat message type is supported. Other message types such as
 error and groupchat are not supported.