Module: Jabber

Defined in:
lib/jabber4r/jid.rb,
lib/jabber4r/vcard.rb,
lib/jabber4r/roster.rb,
lib/jabber4r/session.rb,
lib/jabber4r/jabber4r.rb,
lib/jabber4r/protocol.rb

Overview

The Jabber module is the main namespace for all Jabber modules and classes.

Defined Under Namespace

Modules: Protocol Classes: AutoSubscriptionHandler, JID, JabberConnectionException, Roster, Session, Subscription, SubscriptionHandler, VCard

Constant Summary collapse

HEX =
"0123456789abcdef"
VERSION_MAJOR =
0
VERSION_MINOR =
6
RELEASE =
0
DEBUG =
false

Class Method Summary collapse

Class Method Details

.gen_random_id(prefix = "Jabber4R_", length = 16) ⇒ Object

Generates a random id as a hex string

prefix
String=“Jabber4R_

The prefix for the random hex data

length
Integer=16

The number of hex characters

return
String

The random id



37
38
39
40
# File 'lib/jabber4r/session.rb', line 37

def Jabber.gen_random_id(prefix="Jabber4R_", length=16)
  length.times {prefix += HEX[rand(16),1]}
  prefix
end

.gen_random_resourceObject

Generates a random hex string in the following format:

JRR_01234567
return
String

The resource id



16
17
18
# File 'lib/jabber4r/session.rb', line 16

def Jabber.gen_random_resource
  return Jabber.gen_random_id("JRR_", 8)
end

.gen_random_threadObject

Generates a random thread as a hex string in the following format:

JRT_01234567890123456789
return
String

The thread id



26
27
28
# File 'lib/jabber4r/session.rb', line 26

def Jabber.gen_random_thread
  return Jabber.gen_random_id("JRT_", 20)
end