Class: Jabber::RPC::Server

Class | Jabber::RPC::Server
In: | lib/xmpp4r/rpc/helper/server.rb
Parent: | XMLRPC::BasicServer

XMLRPC Server

### Methods

handle_iq new

### Included Modules

XMLRPC::ParserWriterChooseMixin XMLRPC::ParseContentType

### Public Class methods

new(stream,class_delim=".")

new - creates a new server

[Source]

        # File lib/xmpp4r/rpc/helper/server.rb, line 24
    24:       def initialize(stream,class_delim=".")
    25:         super(class_delim)
    26:         @stream = stream
    27:         @stream.add_iq_callback(120,"Helpers::RPCServer") { |iq|
    28:           if iq.type == :set and iq.type != :result
    29:             handle_iq(iq)
    30:             true
    31:           else
    32:             false
    33:           end
    34:         }
    35:       end

### Public Instance methods

handle_iq(iq)

handles incoming iqs

iq: | [Jabber::IQ] - the jabber iq

[Source]

        # File lib/xmpp4r/rpc/helper/server.rb, line 40
    40:       def handle_iq(iq)
    41:         if iq.type == :set
    42:           if iq.query.kind_of?(IqQueryRPC)
    43:             data = iq.query
    44:             response = IqQueryRPC.new
    45:             data.elements.each { |rpc|
    46:               if rpc
    47:                 response.typed_add(handle_rpc_requests(rpc))
    48:               end
    49:             }
    50:
    51:             respiq = iq.answer(false)
    52:             respiq.type = :result
    53:             respiq.add(response)
    54:             @stream.send(respiq)
    55:           end
    56:         end
    57:       end

[Validate]