def deliver(jid, message, type=:chat)
      contacts(jid) do |friend|
        unless subscribed_to? friend
          add(friend.jid)
          return deliver_deferred(friend.jid, message, type)
        end
        if message.kind_of?(Jabber::Message)
          msg = message
          msg.to = friend.jid
        else
          msg = Message.new(friend.jid)
          msg.type = type
          msg.body = message
        end
        send!(msg)
      end
    end
def deliver(jid, message, type=:chat)
      contacts(jid) do |friend|
        unless subscribed_to? friend
          add(friend.jid)
          return deliver_deferred(friend.jid, message, type)
        end
        if message.kind_of?(Jabber::Message)
          msg = message
          msg.to = friend.jid
        else
          msg = Message.new(friend.jid)
          msg.type = type
          msg.body = message
        end
        send!(msg)
      end
    end
Send a message to jabber user jid.

 Valid message types are:

   * :normal (default): a normal message.
   * :chat: a one-to-one chat message.
   * :groupchat: a group-chat message.
   * :headline: a "headline" message.
   * :error: an error message.

 If the recipient is not in your contacts list, the message will be queued
 for later delivery, and the Contact will be automatically asked for
 authorization (see Jabber::Simple#add).

 message should be a string or a valid Jabber::Message object. In either case,
 the message recipient will be set to jid.