Module: Jabber
- Defined in:
- lib/jabber4r.rb,
lib/jabber4r/jid.rb,
lib/jabber4r/bosh.rb,
lib/jabber4r/vcard.rb,
lib/jabber4r/roster.rb,
lib/jabber4r/session.rb,
lib/jabber4r/version.rb,
lib/jabber4r/debugger.rb,
lib/jabber4r/protocol.rb,
lib/jabber4r/connection.rb
Overview
License: see LICENSE Jabber4R - Jabber Instant Messaging Library for Ruby Copyright © 2002 Rich Kilmer <[email protected]> Copyright © 2013 Sergey Fedorov <[email protected]>
Defined Under Namespace
Modules: Bosh, Protocol Classes: AuthenticationError, AutoSubscriptionHandler, Connection, ConnectionForceCloseError, Debugger, JID, JabberConnectionException, Roster, Session, Subscription, SubscriptionHandler, VCard, XMLMalformedError
Constant Summary collapse
- DEBUG =
false
- HEX =
"0123456789abcdef"
- VERSION =
"0.10.0"
Class Method Summary collapse
-
.gen_random_id(prefix = "Jabber4R_", length = 16) ⇒ Object
Generates a random id as a hex string.
-
.gen_random_resource ⇒ Object
Generates a random hex string in the following format: JRR_01234567.
-
.gen_random_thread ⇒ Object
Generates a random thread as a hex string in the following format: JRT_01234567890123456789.
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_resource ⇒ Object
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_thread ⇒ Object
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 |