Sha256: 099e9d5a49b217d6efef351be965b378fe6550f0da8d6b37e0cddd1cdc6b804d
Contents?: true
Size: 1.15 KB
Versions: 1
Compression:
Stored size: 1.15 KB
Contents
module Blather class Stanza class Presence class Subscription < Presence register :subscription, :subscription def self.new(to = nil, type = nil) elem = super() elem.to = to elem.type = type elem end def inherit(node) inherit_attrs node.attributes self end def to=(to) super JID.new(to).stripped end ## # Create an approve stanza def approve! self.type = :subscribed morph_to_reply end ## # Create a refuse stanza def refuse! self.type = :unsubscribed morph_to_reply end ## # Create an unsubscribe stanza def unsubscribe! self.type = :unsubscribe morph_to_reply end ## # Create a cancel stanza def cancel! self.type = :unsubscribed morph_to_reply end ## # Create a request stanza def request! self.type = :subscribe morph_to_reply end def request? self.type == :subscribe end private def morph_to_reply self.to = self.from if self.from self.from = nil self end end #Subscription end #Presence end #Stanza end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
blather-0.2 | lib/blather/stanza/presence/subscription.rb |