Module: Jabber::Protocol

Defined in:
lib/jabber4r/protocol.rb,
lib/jabber4r/protocol/iq.rb,
lib/jabber4r/protocol/message.rb,
lib/jabber4r/protocol/presence.rb,
lib/jabber4r/protocol/xml_element.rb,
lib/jabber4r/protocol/parsed_xml_element.rb

Overview

License: see LICENSE Jabber4R - Jabber Instant Messaging Library for Ruby Copyright © 2002 Rich Kilmer <[email protected]>

Defined Under Namespace

Classes: ExpatJabberParser, Iq, Message, ParsedXMLElement, Presence, REXMLJabberParser, XMLElement

Constant Summary collapse

USE_PARSER =

either :rexml or :xmlparser

:rexml

Class Method Summary collapse

Class Method Details

.gen_close_streamObject

Generates an close stream XML element

return
String

The XML data to send



65
66
67
# File 'lib/jabber4r/protocol.rb', line 65

def self.gen_close_stream
  return "</stream:stream>"
end

.gen_open_stream(host) ⇒ Object

Generates an open stream XML element

host
String

The host being connected to

return
String

The XML data to send



56
57
58
# File 'lib/jabber4r/protocol.rb', line 56

def self.gen_open_stream(host)
  return ('<?xml version="1.0" encoding="UTF-8" ?><stream:stream to="'+host+'" xmlns="jabber:client" xmlns:stream="http://etherx.jabber.org/streams">')
end

.ParserObject

The parser to use for stream processing. The current available parsers are:

  • Jabber::Protocol::ExpatJabberParser uses XMLParser

  • Jabber::Protocol::REXMLJabberParser uses REXML

return
Class

The parser class



42
43
44
45
46
47
48
# File 'lib/jabber4r/protocol.rb', line 42

def Protocol.Parser
  if USE_PARSER==:xmlparser
    Jabber::Protocol::ExpatJabberParser
  else
    Jabber::Protocol::REXMLJabberParser
  end
end