Module: Jabber::Protocol

Defined in:
lib/jabber4r/protocol.rb

Overview

The Protocol module contains helper methods for constructing Jabber protocol elements and classes that implement protocol elements.

Defined Under Namespace

Classes: Connection, 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



233
234
235
# File 'lib/jabber4r/protocol.rb', line 233

def Protocol.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



224
225
226
# File 'lib/jabber4r/protocol.rb', line 224

def Protocol.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



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

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